cool-globe 0.1.0 → 0.1.1

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
@@ -1,82 +1,96 @@
1
- # cool-globe
2
-
3
- Reusable interactive React globe component library focused on country and region drill-down.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install cool-globe
9
- ```
10
-
11
- ## Peer dependencies
12
-
13
- Install these in the consuming app:
14
-
15
- - `react` (`^18 || ^19`)
16
- - `react-dom` (`^18 || ^19`)
17
- - `react-globe.gl` (`^2`)
18
-
19
- ## Basic usage
20
-
21
- ```tsx
22
- import { useState } from "react";
23
- import { CoolGlobe, type StatisticsData } from "cool-globe";
24
-
25
- const statisticsData: StatisticsData = {
26
- countries: {
27
- LT: { population: 2801000, visits: 85000, revenue: 1200000 },
28
- DE: { population: 83200000, visits: 2800000, revenue: 52000000 },
29
- },
30
- regions: {
31
- LT: {
32
- Vilnius: { population: 580000, visits: 45000, revenue: 700000 },
33
- },
34
- DE: {
35
- Bayern: { population: 13100000, visits: 510000, revenue: 9800000 },
36
- },
37
- },
38
- };
39
-
40
- export default function Example() {
41
- const [resetSignal, setResetSignal] = useState(0);
42
-
43
- return (
44
- <div style={{ height: "100vh", width: "100vw", position: "relative" }}>
45
- <button
46
- type="button"
47
- onClick={() => setResetSignal((value) => value + 1)}
48
- style={{ position: "absolute", top: 16, left: 16, zIndex: 10 }}
49
- >
50
- Reset globe
51
- </button>
52
- <CoolGlobe statisticsData={statisticsData} resetSignal={resetSignal} />
53
- </div>
54
- );
55
- }
56
- ```
57
-
58
- ## Props
59
-
60
- - `statisticsData` (required): country/region metric tree.
61
- - `resetSignal` (optional): when this value changes, globe view and selection state reset to default.
62
- - `primaryMetric` (optional, default: `"visits"`): metric key used for color scale.
63
- - `colorScale` (optional): `{ minColor, maxColor }`.
64
- - `countryNumericToIsoMap` (optional): fallback mapping from numeric country ids to ISO2.
65
- - `countryNameToIsoMap` (optional): fallback mapping from country names to ISO2.
66
-
67
- ## Development
68
-
69
- ```bash
70
- npm install
71
- npm run dev
72
- ```
73
-
74
- ## Build
75
-
76
- ```bash
77
- npm run build
78
- ```
79
-
80
- ## License
81
-
82
- MIT
1
+ ### Description
2
+
3
+ `cool-globe` is an interactive React globe library for country and region analytics, drill-down exploration, and metric-based geospatial dashboards.
4
+
5
+ ![cool-globe banner](./assets/banner.png)
6
+
7
+ ## Overview
8
+
9
+ `cool-globe` helps to present geographic analytics in a clean and interactive way:
10
+
11
+ - Renders a 3D world globe with country and region polygons.
12
+ - Supports click drill-down from countries to regions.
13
+ - Colors areas by metric intensity (`primaryMetric`).
14
+ - Shows dynamic tooltip metrics (for example `visits`, `population`, `revenue`).
15
+ - Handles "no data" regions clearly in tooltip output.
16
+ - Exposes a library-level `resetSignal` API so frontend apps control reset UX.
17
+ - Ships as npm-ready ESM/CJS bundles with TypeScript declarations.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install cool-globe
23
+ ```
24
+
25
+ ## Peer dependencies
26
+
27
+ Install these in the consuming app:
28
+
29
+ - `react` (`^18 || ^19`)
30
+ - `react-dom` (`^18 || ^19`)
31
+ - `react-globe.gl` (`^2`)
32
+
33
+ ## Basic usage
34
+
35
+ ```tsx
36
+ import { useState } from "react";
37
+ import { CoolGlobe, type StatisticsData } from "cool-globe";
38
+
39
+ const statisticsData: StatisticsData = {
40
+ countries: {
41
+ LT: { population: 2801000, visits: 85000, revenue: 1200000 },
42
+ DE: { population: 83200000, visits: 2800000, revenue: 52000000 },
43
+ },
44
+ regions: {
45
+ LT: {
46
+ Vilnius: { population: 580000, visits: 45000, revenue: 700000 },
47
+ },
48
+ DE: {
49
+ Bayern: { population: 13100000, visits: 510000, revenue: 9800000 },
50
+ },
51
+ },
52
+ };
53
+
54
+ export default function Example() {
55
+ const [resetSignal, setResetSignal] = useState(0);
56
+
57
+ return (
58
+ <div style={{ height: "100vh", width: "100vw", position: "relative" }}>
59
+ <button
60
+ type="button"
61
+ onClick={() => setResetSignal((value) => value + 1)}
62
+ style={{ position: "absolute", top: 16, left: 16, zIndex: 10 }}
63
+ >
64
+ Reset globe
65
+ </button>
66
+ <CoolGlobe statisticsData={statisticsData} resetSignal={resetSignal} />
67
+ </div>
68
+ );
69
+ }
70
+ ```
71
+
72
+ ## Props
73
+
74
+ - `statisticsData` (required): country/region metric tree.
75
+ - `resetSignal` (optional): when this value changes, globe view and selection state reset to default.
76
+ - `primaryMetric` (optional, default: `"visits"`): metric key used for color scale.
77
+ - `colorScale` (optional): `{ minColor, maxColor }`.
78
+ - `countryNumericToIsoMap` (optional): fallback mapping from numeric country ids to ISO2.
79
+ - `countryNameToIsoMap` (optional): fallback mapping from country names to ISO2.
80
+
81
+ ## Development
82
+
83
+ ```bash
84
+ npm install
85
+ npm run dev
86
+ ```
87
+
88
+ ## Build
89
+
90
+ ```bash
91
+ npm run build
92
+ ```
93
+
94
+ ## License
95
+
96
+ MIT
@@ -1,9 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),Nt=require("react-globe.gl");var we={exports:{}},ce={};var Ze;function Tt(){if(Ze)return ce;Ze=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,i,o){var s=null;if(o!==void 0&&(s=""+o),i.key!==void 0&&(s=""+i.key),"key"in i){o={};for(var a in i)a!=="key"&&(o[a]=i[a])}else o=i;return i=o.ref,{$$typeof:t,type:n,key:s,ref:i!==void 0?i:null,props:o}}return ce.Fragment=e,ce.jsx=r,ce.jsxs=r,ce}var le={};var Je;function $t(){return Je||(Je=1,process.env.NODE_ENV!=="production"&&(function(){function t(c){if(c==null)return null;if(typeof c=="function")return c.$$typeof===K?null:c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case S:return"Fragment";case H:return"Profiler";case $:return"StrictMode";case R:return"Suspense";case j:return"SuspenseList";case ne:return"Activity"}if(typeof c=="object")switch(typeof c.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),c.$$typeof){case v:return"Portal";case A:return c.displayName||"Context";case P:return(c._context.displayName||"Context")+".Consumer";case z:var w=c.render;return c=c.displayName,c||(c=w.displayName||w.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case re:return w=c.displayName||null,w!==null?w:t(c.type)||"Memo";case Z:w=c._payload,c=c._init;try{return t(c(w))}catch{}}return null}function e(c){return""+c}function r(c){try{e(c);var w=!1}catch{w=!0}if(w){w=console;var k=w.error,M=typeof Symbol=="function"&&Symbol.toStringTag&&c[Symbol.toStringTag]||c.constructor.name||"Object";return k.call(w,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",M),e(c)}}function n(c){if(c===S)return"<>";if(typeof c=="object"&&c!==null&&c.$$typeof===Z)return"<...>";try{var w=t(c);return w?"<"+w+">":"<...>"}catch{return"<...>"}}function i(){var c=y.A;return c===null?null:c.getOwner()}function o(){return Error("react-stack-top-frame")}function s(c){if(I.call(c,"key")){var w=Object.getOwnPropertyDescriptor(c,"key").get;if(w&&w.isReactWarning)return!1}return c.key!==void 0}function a(c,w){function k(){J||(J=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",w))}k.isReactWarning=!0,Object.defineProperty(c,"key",{get:k,configurable:!0})}function l(){var c=t(this.type);return X[c]||(X[c]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),c=this.props.ref,c!==void 0?c:null}function u(c,w,k,M,d,m){var x=k.ref;return c={$$typeof:E,type:c,key:w,props:k,_owner:M},(x!==void 0?x:null)!==null?Object.defineProperty(c,"ref",{enumerable:!1,get:l}):Object.defineProperty(c,"ref",{enumerable:!1,value:null}),c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(c,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(c,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:d}),Object.defineProperty(c,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:m}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c}function f(c,w,k,M,d,m){var x=w.children;if(x!==void 0)if(M)if(N(x)){for(M=0;M<x.length;M++)h(x[M]);Object.freeze&&Object.freeze(x)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else h(x);if(I.call(w,"key")){x=t(c);var p=Object.keys(w).filter(function(C){return C!=="key"});M=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",D[x+M]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
- let props = %s;
3
- <%s {...props} />
4
- React keys must be passed directly to JSX without using spread:
5
- let props = %s;
6
- <%s key={someKey} {...props} />`,M,x,p,x),D[x+M]=!0)}if(x=null,k!==void 0&&(r(k),x=""+k),s(w)&&(r(w.key),x=""+w.key),"key"in w){k={};for(var b in w)b!=="key"&&(k[b]=w[b])}else k=w;return x&&a(k,typeof c=="function"?c.displayName||c.name||"Unknown":c),u(c,x,k,i(),d,m)}function h(c){g(c)?c._store&&(c._store.validated=1):typeof c=="object"&&c!==null&&c.$$typeof===Z&&(c._payload.status==="fulfilled"?g(c._payload.value)&&c._payload.value._store&&(c._payload.value._store.validated=1):c._store&&(c._store.validated=1))}function g(c){return typeof c=="object"&&c!==null&&c.$$typeof===E}var F=_,E=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),P=Symbol.for("react.consumer"),A=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),re=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),ne=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),y=F.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=Object.prototype.hasOwnProperty,N=Array.isArray,L=console.createTask?console.createTask:function(){return null};F={react_stack_bottom_frame:function(c){return c()}};var J,X={},U=F.react_stack_bottom_frame.bind(F,o)(),V=L(n(o)),D={};le.Fragment=S,le.jsx=function(c,w,k){var M=1e4>y.recentlyCreatedOwnerStacks++;return f(c,w,k,!1,M?Error("react-stack-top-frame"):U,M?L(n(c)):V)},le.jsxs=function(c,w,k){var M=1e4>y.recentlyCreatedOwnerStacks++;return f(c,w,k,!0,M?Error("react-stack-top-frame"):U,M?L(n(c)):V)}})()),le}var Qe;function Lt(){return Qe||(Qe=1,process.env.NODE_ENV==="production"?we.exports=Tt():we.exports=$t()),we.exports}var Ke=Lt();function Dt(t){return t}function Ot(t){if(t==null)return Dt;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(a,l){l||(e=r=0);var u=2,f=a.length,h=new Array(f);for(h[0]=(e+=a[0])*n+o,h[1]=(r+=a[1])*i+s;u<f;)h[u]=a[u],++u;return h}}function Bt(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r}function Pt(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(r){return et(t,r)})}:et(t,e)}function et(t,e){var r=e.id,n=e.bbox,i=e.properties==null?{}:e.properties,o=jt(t,e);return r==null&&n==null?{type:"Feature",properties:i,geometry:o}:n==null?{type:"Feature",id:r,properties:i,geometry:o}:{type:"Feature",id:r,bbox:n,properties:i,geometry:o}}function jt(t,e){var r=Ot(t.transform),n=t.arcs;function i(f,h){h.length&&h.pop();for(var g=n[f<0?~f:f],F=0,E=g.length;F<E;++F)h.push(r(g[F],F));f<0&&Bt(h,E)}function o(f){return r(f)}function s(f){for(var h=[],g=0,F=f.length;g<F;++g)i(f[g],h);return h.length<2&&h.push(h[0]),h}function a(f){for(var h=s(f);h.length<4;)h.push(h[0]);return h}function l(f){return f.map(a)}function u(f){var h=f.type,g;switch(h){case"GeometryCollection":return{type:h,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=l(f.arcs);break;case"MultiPolygon":g=f.arcs.map(l);break;default:return null}return{type:h,coordinates:g}}return u(e)}const Et="180",It="",Y="srgb",tt="srgb-linear",rt="linear",$e="srgb";function fe(t,e,r){return Math.max(e,Math.min(r,t))}function Ht(t,e){return(t%e+e)%e}function Le(t,e,r){return(1-r)*t+r*e}class xe{constructor(e,r,n,i,o,s,a,l,u){xe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,r,n,i,o,s,a,l,u)}set(e,r,n,i,o,s,a,l,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=r,f[4]=o,f[5]=l,f[6]=n,f[7]=s,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const r=this.elements,n=e.elements;return r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],r[4]=n[4],r[5]=n[5],r[6]=n[6],r[7]=n[7],r[8]=n[8],this}extractBasis(e,r,n){return e.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const r=e.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){const n=e.elements,i=r.elements,o=this.elements,s=n[0],a=n[3],l=n[6],u=n[1],f=n[4],h=n[7],g=n[2],F=n[5],E=n[8],v=i[0],S=i[3],$=i[6],H=i[1],P=i[4],A=i[7],z=i[2],R=i[5],j=i[8];return o[0]=s*v+a*H+l*z,o[3]=s*S+a*P+l*R,o[6]=s*$+a*A+l*j,o[1]=u*v+f*H+h*z,o[4]=u*S+f*P+h*R,o[7]=u*$+f*A+h*j,o[2]=g*v+F*H+E*z,o[5]=g*S+F*P+E*R,o[8]=g*$+F*A+E*j,this}multiplyScalar(e){const r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=e,r[4]*=e,r[7]*=e,r[2]*=e,r[5]*=e,r[8]*=e,this}determinant(){const e=this.elements,r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],f=e[8];return r*s*f-r*a*u-n*o*f+n*a*l+i*o*u-i*s*l}invert(){const e=this.elements,r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],u=e[7],f=e[8],h=f*s-a*u,g=a*l-f*o,F=u*o-s*l,E=r*h+n*g+i*F;if(E===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/E;return e[0]=h*v,e[1]=(i*u-f*n)*v,e[2]=(a*n-i*s)*v,e[3]=g*v,e[4]=(f*r-i*l)*v,e[5]=(i*o-a*r)*v,e[6]=F*v,e[7]=(n*l-u*r)*v,e[8]=(s*r-n*o)*v,this}transpose(){let e;const r=this.elements;return e=r[1],r[1]=r[3],r[3]=e,e=r[2],r[2]=r[6],r[6]=e,e=r[5],r[5]=r[7],r[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const r=this.elements;return e[0]=r[0],e[1]=r[3],e[2]=r[6],e[3]=r[1],e[4]=r[4],e[5]=r[7],e[6]=r[2],e[7]=r[5],e[8]=r[8],this}setUvTransform(e,r,n,i,o,s,a){const l=Math.cos(o),u=Math.sin(o);return this.set(n*l,n*u,-n*(l*s+u*a)+s+e,-i*u,i*l,-i*(-u*s+l*a)+a+r,0,0,1),this}scale(e,r){return this.premultiply(De.makeScale(e,r)),this}rotate(e){return this.premultiply(De.makeRotation(-e)),this}translate(e,r){return this.premultiply(De.makeTranslation(e,r)),this}makeTranslation(e,r){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,r,0,0,1),this}makeRotation(e){const r=Math.cos(e),n=Math.sin(e);return this.set(r,-n,0,n,r,0,0,0,1),this}makeScale(e,r){return this.set(e,0,0,0,r,0,0,0,1),this}equals(e){const r=this.elements,n=e.elements;for(let i=0;i<9;i++)if(r[i]!==n[i])return!1;return!0}fromArray(e,r=0){for(let n=0;n<9;n++)this.elements[n]=e[n+r];return this}toArray(e=[],r=0){const n=this.elements;return e[r]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3],e[r+4]=n[4],e[r+5]=n[5],e[r+6]=n[6],e[r+7]=n[7],e[r+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const De=new xe,nt={};function it(t){t in nt||(nt[t]=!0,console.warn(t))}const ot=new xe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),st=new xe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gt(){const t={enabled:!0,workingColorSpace:tt,spaces:{},convert:function(i,o,s){return this.enabled===!1||o===s||!o||!s||(this.spaces[o].transfer===$e&&(i.r=oe(i.r),i.g=oe(i.g),i.b=oe(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===$e&&(i.r=se(i.r),i.g=se(i.g),i.b=se(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===It?rt: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 it("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return it("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[tt]:{primaries:e,whitePoint:n,transfer:rt,toXYZ:ot,fromXYZ:st,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:Y},outputColorSpaceConfig:{drawingBufferColorSpace:Y}},[Y]:{primaries:e,whitePoint:n,transfer:$e,toXYZ:ot,fromXYZ:st,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:Y}}}),t}const G=Gt();function oe(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function se(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const vt={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},ye={h:0,s:0,l:0};function Oe(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*6*(2/3-r):t}let he=class{constructor(e,r,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,r,n)}set(e,r,n){if(r===void 0&&n===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,r,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,r=Y){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,G.colorSpaceToWorking(this,r),this}setRGB(e,r,n,i=G.workingColorSpace){return this.r=e,this.g=r,this.b=n,G.colorSpaceToWorking(this,i),this}setHSL(e,r,n,i=G.workingColorSpace){if(e=Ht(e,1),r=fe(r,0,1),n=fe(n,0,1),r===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+r):n+r-n*r,s=2*n-o;this.r=Oe(s,o,e+1/3),this.g=Oe(s,o,e),this.b=Oe(s,o,e-1/3)}return G.colorSpaceToWorking(this,i),this}setStyle(e,r=Y){function n(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 n(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,r);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(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,r);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 n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,r);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,r);if(s===6)return this.setHex(parseInt(o,16),r);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,r);return this}setColorName(e,r=Y){const n=vt[e.toLowerCase()];return n!==void 0?this.setHex(n,r):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=oe(e.r),this.g=oe(e.g),this.b=oe(e.b),this}copyLinearToSRGB(e){return this.r=se(e.r),this.g=se(e.g),this.b=se(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Y){return G.workingToColorSpace(T.copy(this),e),Math.round(fe(T.r*255,0,255))*65536+Math.round(fe(T.g*255,0,255))*256+Math.round(fe(T.b*255,0,255))}getHexString(e=Y){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,r=G.workingColorSpace){G.workingToColorSpace(T.copy(this),r);const n=T.r,i=T.g,o=T.b,s=Math.max(n,i,o),a=Math.min(n,i,o);let l,u;const f=(a+s)/2;if(a===s)l=0,u=0;else{const h=s-a;switch(u=f<=.5?h/(s+a):h/(2-s-a),s){case n:l=(i-o)/h+(i<o?6:0);break;case i:l=(o-n)/h+2;break;case o:l=(n-i)/h+4;break}l/=6}return e.h=l,e.s=u,e.l=f,e}getRGB(e,r=G.workingColorSpace){return G.workingToColorSpace(T.copy(this),r),e.r=T.r,e.g=T.g,e.b=T.b,e}getStyle(e=Y){G.workingToColorSpace(T.copy(this),e);const r=T.r,n=T.g,i=T.b;return e!==Y?`color(${e} ${r.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(r*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,r,n){return this.getHSL(Q),this.setHSL(Q.h+e,Q.s+r,Q.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,r){return this.r=e.r+r.r,this.g=e.g+r.g,this.b=e.b+r.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,r){return this.r+=(e.r-this.r)*r,this.g+=(e.g-this.g)*r,this.b+=(e.b-this.b)*r,this}lerpColors(e,r,n){return this.r=e.r+(r.r-e.r)*n,this.g=e.g+(r.g-e.g)*n,this.b=e.b+(r.b-e.b)*n,this}lerpHSL(e,r){this.getHSL(Q),e.getHSL(ye);const n=Le(Q.h,ye.h,r),i=Le(Q.s,ye.s,r),o=Le(Q.l,ye.l,r);return this.setHSL(n,i,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const r=this.r,n=this.g,i=this.b,o=e.elements;return this.r=o[0]*r+o[3]*n+o[6]*i,this.g=o[1]*r+o[4]*n+o[7]*i,this.b=o[2]*r+o[5]*n+o[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,r=0){return this.r=e[r],this.g=e[r+1],this.b=e[r+2],this}toArray(e=[],r=0){return e[r]=this.r,e[r+1]=this.g,e[r+2]=this.b,e}fromBufferAttribute(e,r){return this.r=e.getX(r),this.g=e.getY(r),this.b=e.getZ(r),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const T=new he;he.NAMES=vt;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Et}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Et);const Yt="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson",qt="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",zt="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson",Ut="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>",Vt={minColor:"#f8fafc",maxColor:"#e5e7eb"};function ze(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function kt(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function pe(){}var de=.7,Ce=1/de,ae="\\s*([+-]?\\d+)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Wt=/^#([0-9a-f]{3,8})$/,Xt=new RegExp(`^rgb\\(${ae},${ae},${ae}\\)$`),Zt=new RegExp(`^rgb\\(${W},${W},${W}\\)$`),Jt=new RegExp(`^rgba\\(${ae},${ae},${ae},${ge}\\)$`),Qt=new RegExp(`^rgba\\(${W},${W},${W},${ge}\\)$`),Kt=new RegExp(`^hsl\\(${ge},${W},${W}\\)$`),er=new RegExp(`^hsla\\(${ge},${W},${W},${ge}\\)$`),at={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};ze(pe,me,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ut,formatHex:ut,formatHex8:tr,formatHsl:rr,formatRgb:ct,toString:ct});function ut(){return this.rgb().formatHex()}function tr(){return this.rgb().formatHex8()}function rr(){return Ct(this).formatHsl()}function ct(){return this.rgb().formatRgb()}function me(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Wt.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?lt(e):r===3?new B(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?Fe(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?Fe(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=Xt.exec(t))?new B(e[1],e[2],e[3],1):(e=Zt.exec(t))?new B(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Jt.exec(t))?Fe(e[1],e[2],e[3],e[4]):(e=Qt.exec(t))?Fe(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Kt.exec(t))?dt(e[1],e[2]/100,e[3]/100,1):(e=er.exec(t))?dt(e[1],e[2]/100,e[3]/100,e[4]):at.hasOwnProperty(t)?lt(at[t]):t==="transparent"?new B(NaN,NaN,NaN,0):null}function lt(t){return new B(t>>16&255,t>>8&255,t&255,1)}function Fe(t,e,r,n){return n<=0&&(t=e=r=NaN),new B(t,e,r,n)}function nr(t){return t instanceof pe||(t=me(t)),t?(t=t.rgb(),new B(t.r,t.g,t.b,t.opacity)):new B}function Ie(t,e,r,n){return arguments.length===1?nr(t):new B(t,e,r,n??1)}function B(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}ze(B,Ie,kt(pe,{brighter(t){return t=t==null?Ce:Math.pow(Ce,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new B(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new B(te(this.r),te(this.g),te(this.b),_e(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:ft,formatHex:ft,formatHex8:ir,formatRgb:ht,toString:ht}));function ft(){return`#${ee(this.r)}${ee(this.g)}${ee(this.b)}`}function ir(){return`#${ee(this.r)}${ee(this.g)}${ee(this.b)}${ee((isNaN(this.opacity)?1:this.opacity)*255)}`}function ht(){const t=_e(this.opacity);return`${t===1?"rgb(":"rgba("}${te(this.r)}, ${te(this.g)}, ${te(this.b)}${t===1?")":`, ${t})`}`}function _e(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function te(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ee(t){return t=te(t),(t<16?"0":"")+t.toString(16)}function dt(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new q(t,e,r,n)}function Ct(t){if(t instanceof q)return new q(t.h,t.s,t.l,t.opacity);if(t instanceof pe||(t=me(t)),!t)return new q;if(t instanceof q)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,i=Math.min(e,r,n),o=Math.max(e,r,n),s=NaN,a=o-i,l=(o+i)/2;return a?(e===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-e)/a+2:s=(e-r)/a+4,a/=l<.5?o+i:2-o-i,s*=60):a=l>0&&l<1?0:s,new q(s,a,l,t.opacity)}function or(t,e,r,n){return arguments.length===1?Ct(t):new q(t,e,r,n??1)}function q(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}ze(q,or,kt(pe,{brighter(t){return t=t==null?Ce:Math.pow(Ce,t),new q(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?de:Math.pow(de,t),new q(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,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new B(Be(t>=240?t-240:t+120,i,n),Be(t,i,n),Be(t<120?t+240:t-120,i,n),this.opacity)},clamp(){return new q(gt(this.h),Ee(this.s),Ee(this.l),_e(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=_e(this.opacity);return`${t===1?"hsl(":"hsla("}${gt(this.h)}, ${Ee(this.s)*100}%, ${Ee(this.l)*100}%${t===1?")":`, ${t})`}`}}));function gt(t){return t=(t||0)%360,t<0?t+360:t}function Ee(t){return Math.max(0,Math.min(1,t||0))}function Be(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const Ue=t=>()=>t;function sr(t,e){return function(r){return t+r*e}}function ar(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function ur(t){return(t=+t)==1?_t:function(e,r){return r-e?ar(e,r,t):Ue(isNaN(e)?r:e)}}function _t(t,e){var r=e-t;return r?sr(t,r):Ue(isNaN(t)?e:t)}const He=(function t(e){var r=ur(e);function n(i,o){var s=r((i=Ie(i)).r,(o=Ie(o)).r),a=r(i.g,o.g),l=r(i.b,o.b),u=_t(i.opacity,o.opacity);return function(f){return i.r=s(f),i.g=a(f),i.b=l(f),i.opacity=u(f),i+""}}return n.gamma=t,n})(1);function cr(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=t[i]*(1-o)+e[i]*o;return n}}function lr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fr(t,e){var r=e?e.length:0,n=t?Math.min(r,t.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=Ve(t[s],e[s]);for(;s<r;++s)o[s]=e[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function hr(t,e){var r=new Date;return t=+t,e=+e,function(n){return r.setTime(t*(1-n)+e*n),r}}function Re(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function dr(t,e){var r={},n={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?r[i]=Ve(t[i],e[i]):n[i]=e[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var Ge=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Pe=new RegExp(Ge.source,"g");function gr(t){return function(){return t}}function mr(t){return function(e){return t(e)+""}}function xr(t,e){var r=Ge.lastIndex=Pe.lastIndex=0,n,i,o,s=-1,a=[],l=[];for(t=t+"",e=e+"";(n=Ge.exec(t))&&(i=Pe.exec(e));)(o=i.index)>r&&(o=e.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Re(n,i)})),r=Pe.lastIndex;return r<e.length&&(o=e.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?mr(l[0].x):gr(e):(e=l.length,function(u){for(var f=0,h;f<e;++f)a[(h=l[f]).i]=h.x(u);return a.join("")})}function Ve(t,e){var r=typeof e,n;return e==null||r==="boolean"?Ue(e):(r==="number"?Re:r==="string"?(n=me(e))?(e=n,He):xr:e instanceof me?He:e instanceof Date?hr:lr(e)?cr:Array.isArray(e)?fr:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?dr:Re)(t,e)}function pr(t,e){return t=+t,e=+e,function(r){return Math.round(t*(1-r)+e*r)}}function ke(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function br(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Rt(t){let e,r,n;t.length!==2?(e=ke,r=(a,l)=>ke(t(a),l),n=(a,l)=>t(a)-l):(e=t===ke||t===br?t:wr,r=t,n=t);function i(a,l,u=0,f=a.length){if(u<f){if(e(l,l)!==0)return f;do{const h=u+f>>>1;r(a[h],l)<0?u=h+1:f=h}while(u<f)}return u}function o(a,l,u=0,f=a.length){if(u<f){if(e(l,l)!==0)return f;do{const h=u+f>>>1;r(a[h],l)<=0?u=h+1:f=h}while(u<f)}return u}function s(a,l,u=0,f=a.length){const h=i(a,l,u,f-1);return h>u&&n(a[h-1],l)>-n(a[h],l)?h-1:h}return{left:i,center:s,right:o}}function wr(){return 0}function yr(t){return t===null?NaN:+t}const Fr=Rt(ke),Er=Fr.right;Rt(yr).center;const vr=Math.sqrt(50),kr=Math.sqrt(10),Cr=Math.sqrt(2);function Me(t,e,r){const n=(e-t)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=vr?10:o>=kr?5:o>=Cr?2:1;let a,l,u;return i<0?(u=Math.pow(10,-i)/s,a=Math.round(t*u),l=Math.round(e*u),a/u<t&&++a,l/u>e&&--l,u=-u):(u=Math.pow(10,i)*s,a=Math.round(t/u),l=Math.round(e/u),a*u<t&&++a,l*u>e&&--l),l<a&&.5<=r&&r<2?Me(t,e,r*2):[a,l,u]}function _r(t,e,r){if(e=+e,t=+t,r=+r,!(r>0))return[];if(t===e)return[t];const n=e<t,[i,o,s]=n?Me(e,t,r):Me(t,e,r);if(!(o>=i))return[];const a=o-i+1,l=new Array(a);if(n)if(s<0)for(let u=0;u<a;++u)l[u]=(o-u)/-s;else for(let u=0;u<a;++u)l[u]=(o-u)*s;else if(s<0)for(let u=0;u<a;++u)l[u]=(i+u)/-s;else for(let u=0;u<a;++u)l[u]=(i+u)*s;return l}function Ye(t,e,r){return e=+e,t=+t,r=+r,Me(t,e,r)[2]}function Rr(t,e,r){e=+e,t=+t,r=+r;const n=e<t,i=n?Ye(e,t,r):Ye(t,e,r);return(n?-1:1)*(i<0?1/-i:i)}function Mr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Ar(t){return function(){return t}}function Sr(t){return+t}var mt=[0,1];function ie(t){return t}function qe(t,e){return(e-=t=+t)?function(r){return(r-t)/e}:Ar(isNaN(e)?NaN:.5)}function Nr(t,e){var r;return t>e&&(r=t,t=e,e=r),function(n){return Math.max(t,Math.min(e,n))}}function Tr(t,e,r){var n=t[0],i=t[1],o=e[0],s=e[1];return i<n?(n=qe(i,n),o=r(s,o)):(n=qe(n,i),o=r(o,s)),function(a){return o(n(a))}}function $r(t,e,r){var n=Math.min(t.length,e.length)-1,i=new Array(n),o=new Array(n),s=-1;for(t[n]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<n;)i[s]=qe(t[s],t[s+1]),o[s]=r(e[s],e[s+1]);return function(a){var l=Er(t,a,1,n)-1;return o[l](i[l](a))}}function Lr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Dr(){var t=mt,e=mt,r=Ve,n,i,o,s=ie,a,l,u;function f(){var g=Math.min(t.length,e.length);return s!==ie&&(s=Nr(t[0],t[g-1])),a=g>2?$r:Tr,l=u=null,h}function h(g){return g==null||isNaN(g=+g)?o:(l||(l=a(t.map(n),e,r)))(n(s(g)))}return h.invert=function(g){return s(i((u||(u=a(e,t.map(n),Re)))(g)))},h.domain=function(g){return arguments.length?(t=Array.from(g,Sr),f()):t.slice()},h.range=function(g){return arguments.length?(e=Array.from(g),f()):e.slice()},h.rangeRound=function(g){return e=Array.from(g),r=pr,f()},h.clamp=function(g){return arguments.length?(s=g?!0:ie,f()):s!==ie},h.interpolate=function(g){return arguments.length?(r=g,f()):r},h.unknown=function(g){return arguments.length?(o=g,h):o},function(g,F){return n=g,i=F,f()}}function Or(){return Dr()(ie,ie)}function Br(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ae(t,e){if(!isFinite(t)||t===0)return null;var r=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),n=t.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+t.slice(r+1)]}function ue(t){return t=Ae(Math.abs(t)),t?t[1]:NaN}function Pr(t,e){return function(r,n){for(var i=r.length,o=[],s=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>n&&(a=Math.max(1,n-l)),o.push(r.substring(i-=a,i+a)),!((l+=a+1)>n));)a=t[s=(s+1)%t.length];return o.reverse().join(e)}}function jr(t){return function(e){return e.replace(/[0-9]/g,function(r){return t[+r]})}}var Ir=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Se(t){if(!(e=Ir.exec(t)))throw new Error("invalid format: "+t);var e;return new We({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]})}Se.prototype=We.prototype;function We(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+""}We.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 Hr(t){e:for(var e=t.length,r=1,n=-1,i;r<e;++r)switch(t[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+t[r])break e;n>0&&(n=0);break}return n>0?t.slice(0,n)+t.slice(i+1):t}var Ne;function Gr(t,e){var r=Ae(t,e);if(!r)return Ne=void 0,t.toPrecision(e);var n=r[0],i=r[1],o=i-(Ne=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Ae(t,Math.max(0,e+o-1))[0]}function xt(t,e){var r=Ae(t,e);if(!r)return t+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}const pt={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Br,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)=>xt(t*100,e),r:xt,s:Gr,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function bt(t){return t}var wt=Array.prototype.map,yt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Yr(t){var e=t.grouping===void 0||t.thousands===void 0?bt:Pr(wt.call(t.grouping,Number),t.thousands+""),r=t.currency===void 0?"":t.currency[0]+"",n=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?bt:jr(wt.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(h,g){h=Se(h);var F=h.fill,E=h.align,v=h.sign,S=h.symbol,$=h.zero,H=h.width,P=h.comma,A=h.precision,z=h.trim,R=h.type;R==="n"?(P=!0,R="g"):pt[R]||(A===void 0&&(A=12),z=!0,R="g"),($||F==="0"&&E==="=")&&($=!0,F="0",E="=");var j=(g&&g.prefix!==void 0?g.prefix:"")+(S==="$"?r:S==="#"&&/[boxX]/.test(R)?"0"+R.toLowerCase():""),re=(S==="$"?n:/[%p]/.test(R)?s:"")+(g&&g.suffix!==void 0?g.suffix:""),Z=pt[R],ne=/[defgprs%]/.test(R);A=A===void 0?6:/[gprs]/.test(R)?Math.max(1,Math.min(21,A)):Math.max(0,Math.min(20,A));function K(y){var I=j,N=re,L,J,X;if(R==="c")N=Z(y)+N,y="";else{y=+y;var U=y<0||1/y<0;if(y=isNaN(y)?l:Z(Math.abs(y),A),z&&(y=Hr(y)),U&&+y==0&&v!=="+"&&(U=!1),I=(U?v==="("?v:a:v==="-"||v==="("?"":v)+I,N=(R==="s"&&!isNaN(y)&&Ne!==void 0?yt[8+Ne/3]:"")+N+(U&&v==="("?")":""),ne){for(L=-1,J=y.length;++L<J;)if(X=y.charCodeAt(L),48>X||X>57){N=(X===46?i+y.slice(L+1):y.slice(L))+N,y=y.slice(0,L);break}}}P&&!$&&(y=e(y,1/0));var V=I.length+y.length+N.length,D=V<H?new Array(H-V+1).join(F):"";switch(P&&$&&(y=e(D+y,D.length?H-N.length:1/0),D=""),E){case"<":y=I+y+N+D;break;case"=":y=I+D+y+N;break;case"^":y=D.slice(0,V=D.length>>1)+I+y+N+D.slice(V);break;default:y=D+I+y+N;break}return o(y)}return K.toString=function(){return h+""},K}function f(h,g){var F=Math.max(-8,Math.min(8,Math.floor(ue(g)/3)))*3,E=Math.pow(10,-F),v=u((h=Se(h),h.type="f",h),{suffix:yt[8+F/3]});return function(S){return v(E*S)}}return{format:u,formatPrefix:f}}var ve,Mt,At;qr({thousands:",",grouping:[3],currency:["$",""]});function qr(t){return ve=Yr(t),Mt=ve.format,At=ve.formatPrefix,ve}function zr(t){return Math.max(0,-ue(Math.abs(t)))}function Ur(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ue(e)/3)))*3-ue(Math.abs(t)))}function Vr(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ue(e)-ue(t))+1}function Wr(t,e,r,n){var i=Rr(t,e,r),o;switch(n=Se(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return n.precision==null&&!isNaN(o=Ur(i,s))&&(n.precision=o),At(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=Vr(i,Math.max(Math.abs(t),Math.abs(e))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=zr(i))&&(n.precision=o-(n.type==="%")*2);break}}return Mt(n)}function Xr(t){var e=t.domain;return t.ticks=function(r){var n=e();return _r(n[0],n[n.length-1],r??10)},t.tickFormat=function(r,n){var i=e();return Wr(i[0],i[i.length-1],r??10,n)},t.nice=function(r){r==null&&(r=10);var n=e(),i=0,o=n.length-1,s=n[i],a=n[o],l,u,f=10;for(a<s&&(u=s,s=a,a=u,u=i,i=o,o=u);f-- >0;){if(u=Ye(s,a,r),u===l)return n[i]=s,n[o]=a,e(n);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;l=u}return t},t}function St(){var t=Or();return t.copy=function(){return Lr(t,St())},Mr.apply(t,arguments),Xr(t)}const je=(t,e)=>{const r=t?.[e];return typeof r=="number"?r:0},Ft=(t,e)=>{if(!t.length)return()=>e.minColor;const r=Math.min(...t),n=Math.max(...t);if(r===n)return()=>e.maxColor;const i=St().domain([r,n]).range([0,1]),o=He(e.minColor,e.maxColor);return s=>o(i(s))},Zr=t=>t<=1.35?2:t<=2.1?1:0,Jr=t=>new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(t),Qr=({statisticsData:t,resetSignal:e,countryNumericToIsoMap:r={},countryNameToIsoMap:n={},primaryMetric:i="visits",colorScale:o=Vt})=>{const s=_.useRef(null),a=_.useRef(null),l=_.useRef(void 0),u=_.useRef({}),f=_.useRef(null),h=_.useRef(e),[g,F]=_.useState(0),[E,v]=_.useState(),[S,$]=_.useState(),[H,P]=_.useState(null),[A,z]=_.useState([]),[R,j]=_.useState([]),[re,Z]=_.useState({width:900,height:760}),ne=_.useMemo(()=>Object.values(t.countries).map(d=>je(d,i)),[i,t.countries]),K=_.useMemo(()=>E?Object.values(t.regions[E]??{}).map(d=>je(d,i)):[],[E,i,t.regions]),y=_.useMemo(()=>Ft(ne,o),[ne,o]),I=_.useMemo(()=>Ft(K,o),[K,o]);_.useEffect(()=>{(async()=>{let m=[];try{m=(await(await fetch(Yt)).json()).features}catch{const b=await(await fetch(qt)).json(),C=b.objects.countries,O=Pt(b,C);m=O.type==="FeatureCollection"?O.features:[O]}const x=m.map(p=>{const b=String(p.id??""),C=p.properties??{},O=String(C.name??C.NAME??C.name_en??C.ADMIN??"").trim()||`Country ${b}`,Te=O.toLowerCase(),be=String(C.iso_a2??C.ISO_A2??C.iso_a2_eh??"").trim().toUpperCase(),Xe=r[b]??n[Te]??(be&&be!=="-99"?be:void 0)??(b.length===2?b.toUpperCase():b);return{...p,properties:{...C,__isoA2:Xe,name:O||Xe||`Country ${b}`}}});z(x)})()},[]),_.useEffect(()=>{if(!a.current)return;const d=new ResizeObserver(m=>{const x=m[0];x&&Z({width:Math.max(360,Math.floor(x.contentRect.width)),height:Math.max(520,Math.floor(x.contentRect.height))})});return d.observe(a.current),()=>d.disconnect()},[]),_.useEffect(()=>{if(!E){j([]);return}const d=u.current[E];if(d){j(d);return}(async()=>{if(!f.current){const C=await(await fetch(zt)).json();f.current=C.features}const p=(f.current??[]).filter(b=>(b.properties??{}).iso_a2===E).map(b=>{const C=b.properties??{},O=String(C.name??"").trim();return{...b,properties:{...C,__countryCode:E,__regionName:O,name:O}}});u.current[E]=p,j(p)})()},[E]),_.useEffect(()=>{if(S&&g<2)return void F(2);E&&g<1&&F(1)},[E,S,g]),_.useEffect(()=>{const d=s.current?.controls?.();if(!d)return;d.autoRotate=!0,d.autoRotateSpeed=.45,d.enablePan=!1,d.enableZoom=!0;const m=s.current?.renderer?.();m&&m.setPixelRatio(Math.min(window.devicePixelRatio,1.5))},[]),_.useEffect(()=>{const d=s.current?.controls?.();d&&(d.autoRotate=!E&&g===0)},[E,g]),_.useEffect(()=>{if(e===h.current)return;h.current=e,F(0),v(void 0),$(void 0),P(null),j([]);const d=s.current?.controls?.();d&&(d.autoRotate=!0),s.current?.pointOfView({lat:20,lng:15,altitude:2.6},650)},[e]);const N=()=>{const d=s.current?.globeMaterial?.();d&&(d.map=null,d.color=new he("#f5f5f5"),d.emissive=new he("#ffffff"),d.emissiveIntensity=.35,d.specular=new he("#d4d4d8"),d.shininess=3,d.needsUpdate=!0)},L=(d,m,x)=>{s.current?.pointOfView({lat:d,lng:m,altitude:x},650)},J=()=>{const d=s.current?.controls?.();d&&(d.autoRotate=!1)},X=d=>{if(typeof d!="object"||d===null||!("coordinates"in d))return[];const m=d.coordinates,x=[],p=b=>{if(Array.isArray(b)){if(b.length>=2&&typeof b[0]=="number"&&typeof b[1]=="number"){x.push([b[0],b[1]]);return}b.forEach(p)}};return p(m),x},U=d=>{const m=X(d.geometry);if(!m.length)return;const x=m.reduce((p,[b,C])=>({minLat:Math.min(p.minLat,C),maxLat:Math.max(p.maxLat,C),minLng:Math.min(p.minLng,b),maxLng:Math.max(p.maxLng,b)}),{minLat:Number.POSITIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY,minLng:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY});if(!(!Number.isFinite(x.minLat)||!Number.isFinite(x.minLng)))return x},V=d=>{const m=Math.max(.1,d.maxLat-d.minLat),x=Math.max(.1,d.maxLng-d.minLng),b=Math.max(m,x)/112;return Math.min(.9,Math.max(.14,b))},D=()=>{l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{const d=s.current?.pointOfView?.().altitude??2.4,m=Zr(d);F(m),m<=0&&$(void 0)},120)},c=d=>{const m=d.properties??{};if(g===0){const x=n[String(m.name??"").toLowerCase()],p=m.__isoA2??(typeof m.iso_a2=="string"?m.iso_a2.toUpperCase():void 0)??x;if(!p)return;J(),F(1),v(p),$(void 0);const b=U(d);if(b){L((b.minLat+b.maxLat)/2,(b.minLng+b.maxLng)/2,V(b));return}return}if(g>=1){const x=m.__regionName;if(!x)return;J(),F(2),$(x);const p=U(d);if(p){L((p.minLat+p.maxLat)/2,(p.minLng+p.maxLng)/2,Math.max(.2,V(p)*.52));return}}},w=g===0?A:R.length?[...A,...R]:A,k=(d,m)=>{if(m&&d)return t.regions[d]?.[m];if(d)return t.countries[d]},M=d=>{if(!d)return"<div>No data</div>";const m=Object.entries(d).filter(([,x])=>typeof x=="number"&&Number.isFinite(x));return m.length?(m.sort(([x],[p])=>x===i?-1:p===i?1:x.localeCompare(p)),m.map(([x,p])=>`<div>${x}: ${Jr(p)}</div>`).join("")):"<div>No data</div>"};return Ke.jsx("div",{ref:a,style:{position:"relative",height:"100%",overflow:"hidden",background:"white"},children:Ke.jsx(Nt,{ref:s,globeImageUrl:Ut,backgroundColor:"#ffffff",polygonsData:w,polygonAltitude:.01,polygonsTransitionDuration:180,polygonCapColor:d=>{const m=d.properties??{},x=!!m.__regionName;if(g>0&&!x)return"rgba(148,163,184,0.027)";const p=g===0?m.__isoA2:m.__countryCode,b=m.__regionName,C=k(p,b),O=je(C,i),Te=g===0?y(O):I(O);return H===d?"#60a5fa":Te},polygonSideColor:d=>{const m=d.properties??{};return g>0&&!m.__regionName?"rgba(148,163,184,0.027)":m.__regionName?"rgba(148,163,184,0.22)":"rgba(226,232,240,0.45)"},polygonStrokeColor:d=>{const m=d.properties??{};return g>0&&!m.__regionName?"rgba(100,116,139,0.067)":m.__regionName?"rgba(51,65,85,0.98)":"rgba(156,163,175,0.95)"},polygonLabel:d=>{const m=d.properties??{},x=g===0?m.__isoA2:m.__countryCode,p=m.__regionName,b=p??m.name??"Unknown",C=k(x,p),O=M(C);return`<div style="padding:6px 8px; font-size:12px; background:#111827; color:#f9fafb; border-radius:6px;">
7
- <div style="font-weight:700;">${b}</div>
8
- ${O}
9
- </div>`},onPolygonHover:d=>{P(d??null)},onPolygonClick:d=>c(d),onZoom:D,onGlobeReady:()=>{N(),L(20,15,2.6)},onGlobeClick:()=>{const d=s.current?.controls?.();d&&(d.autoRotate=!1)},lineHoverPrecision:0,width:re.width,height:re.height,showAtmosphere:!1})})};exports.CoolGlobe=Qr;
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;