@d3-maps/vue 0.8.0 → 0.10.0

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,8 +1,18 @@
1
1
  # @d3-maps/vue
2
2
 
3
- Reactive SVG maps, powered by D3.
3
+ Simple SVG maps with Vue & D3.
4
4
 
5
- [docs](https://souljorje.github.io/d3-maps)
5
+ [**Docs**](https://d3-maps.netlify.app/guide) · [**Examples**](https://d3-maps.netlify.app/examples)
6
+
7
+ ## Features
8
+
9
+ - Drop-in components, powerful defaults
10
+ - Zoom, drag, lines, markers, and more
11
+ - Reactive rerender
12
+ - Responsive by default
13
+ - Lightweight and tree-shakable
14
+ - SSR friendly
15
+ - Supports TopoJSON and GeoJSON
6
16
 
7
17
  ## Installation
8
18
 
@@ -26,8 +36,30 @@ bun add @d3-maps/vue
26
36
 
27
37
  ## Usage
28
38
 
39
+ ```html
40
+ <script setup lang="ts">
41
+ import type { MapData } from '@d3-maps/core'
42
+
43
+ import { MapBase, MapFeatures } from '@d3-maps/vue'
44
+ defineProps<{
45
+ data: MapData
46
+ }>()
47
+ </script>
48
+
49
+ <template>
50
+ <MapBase :data="data">
51
+ <MapFeatures />
52
+ </MapBase>
53
+ </template>
54
+ ```
55
+
56
+ ### Plugin
57
+
58
+ Registers all components in the app
59
+
29
60
  ```js
30
61
  import { createApp } from 'vue'
62
+ import '@d3-maps/vue/index.css'
31
63
  import { plugin as D3MapsVue } from '@d3-maps/vue'
32
64
  import App from './App.vue'
33
65
 
@@ -40,6 +72,7 @@ _Nuxt 3_ \
40
72
  Create `~/plugins/d3-maps-vue.client.ts`:
41
73
 
42
74
  ```ts
75
+ import '@d3-maps/vue/index.css'
43
76
  import { plugin as D3MapsVue } from '@d3-maps/vue'
44
77
 
45
78
  export default defineNuxtPlugin((nuxtApp) => {
@@ -47,12 +80,6 @@ export default defineNuxtPlugin((nuxtApp) => {
47
80
  })
48
81
  ```
49
82
 
50
- ## Styling
51
-
52
- Importing `@d3-maps/vue` automatically includes `@d3-maps/core/index.css`
53
-
54
- If you need strict stylesheet ordering, load your global reset/theme styles before importing the adapter entry
55
-
56
83
  ## License
57
84
 
58
85
  MIT licensed. Copyright © 2020 Georgii Bukharov. See [LICENSE](./LICENSE) for more details.
package/dist/index.css ADDED
@@ -0,0 +1,26 @@
1
+ :root {
2
+ --d3m-stroke-w: 0.5;
3
+ }
4
+ .d3-map {
5
+ width: 100%;
6
+ height: auto;
7
+ [name="background"],
8
+ [name="graticule"],
9
+ [name="feature"],
10
+ [name="mesh"] {
11
+ outline-style: none;
12
+ &:not([stroke-width]) {
13
+ stroke-width: var(--d3m-stroke-w)
14
+ }
15
+ }
16
+ [name="border"],
17
+ [name="line"],
18
+ [name="annotation-line"] {
19
+ &:not([stroke-width]) {
20
+ stroke-width: calc(var(--d3m-stroke-w) * 2);
21
+ }
22
+ }
23
+ [name="zoom"] path {
24
+ vector-effect: non-scaling-stroke;
25
+ }
26
+ }
package/dist/index.d.ts CHANGED
@@ -1,255 +1,16 @@
1
- import "@d3-maps/core/index.css";
2
- import * as vue6 from "vue";
3
- import { App, ComputedRef, InjectionKey, MaybeRef, StyleValue } from "vue";
4
- import { CurveFactory, CurveFactoryLineOnly } from "d3-shape";
5
- import { ExtendedFeature, ExtendedFeatureCollection, GeoGraticuleGenerator, GeoPath, GeoProjection } from "d3-geo";
6
- import { Topology } from "topojson-specification";
7
- import "topojson-client";
8
- import { D3ZoomEvent, ZoomBehavior } from "d3-zoom";
1
+ import * as vue36 from "vue";
2
+ import { App, ComputedRef, InjectionKey, MaybeRef, Ref, StyleValue } from "vue";
3
+ import * as _d3_maps_core0 from "@d3-maps/core";
4
+ import { MapAnnotationProps, MapContext, MapFeatureProps, MapFeaturesProps, MapGraticuleProps, MapLineProps, MapMarkerProps, MapObjectProps, MapObjectState, MapProps, ObjectZoomView, ZoomEvent, ZoomObject, ZoomProps, createZoomBehavior, getFeatureKey, getInverseZoomScale, getObjectZoomView, getZoomViewportCenter } from "@d3-maps/core";
5
+ export * from "@d3-maps/core/types";
9
6
 
10
- //#region ../core/src/lib/mapObject.d.ts
11
- /**
12
- * Supported interaction states for map objects.
13
- */
14
- declare const mapObjectState: readonly ["default", "hover", "active"];
15
- type MapObjectState = typeof mapObjectState[number];
16
- interface MapObjectProps<TStyle = unknown> {
17
- styles?: Partial<Record<MapObjectState, TStyle>>;
18
- }
19
- //#endregion
20
- //#region ../core/src/lib/feature.d.ts
21
- /**
22
- * A GeoJSON Feature used by d3-maps.
23
- *
24
- * This type allows extra top-level fields to be attached in `dataTransformer` (e.g. choropleth colors).
25
- */
26
- type MapFeature = (ExtendedFeature & Record<string, unknown>) | ExtendedFeature;
27
- /**
28
- * Shared props contract for a single rendered feature.
29
- */
30
- interface MapFeatureProps<TStyle = unknown> extends MapObjectProps<TStyle> {
31
- data: MapFeature;
32
- }
33
- /**
34
- * Shared props contract for feature collections rendered from the current map context.
35
- */
36
- interface MapFeaturesProps<TStyle = unknown> extends Omit<MapFeatureProps<TStyle>, 'data'> {
37
- idKey?: string;
38
- }
39
- //#endregion
40
- //#region ../core/src/lib/utils.d.ts
41
- type AnyFn = (...args: any) => any;
42
- /**
43
- * Extracts a union of parameter tuples from a (possibly overloaded) function type.
44
- *
45
- * TypeScript's built-in `Parameters<F>` only captures the *last* overload, which breaks typing
46
- * for overloaded getter/setter APIs (common in d3), where the setter overload might not be last.
47
- *
48
- * Notes:
49
- * - This helper supports up to 5 overload signatures (adjust if needed).
50
- * - Getter overloads like `(): T` are filtered out later via `Exclude<..., []>` when we build
51
- * setter-only config types.
52
- */
53
- type OverloadedArgs<F> = F extends {
54
- (...a: infer A1): any;
55
- (...a: infer A2): any;
56
- (...a: infer A3): any;
57
- (...a: infer A4): any;
58
- (...a: infer A5): any;
59
- } ? A1 | A2 | A3 | A4 | A5 : F extends {
60
- (...a: infer A1): any;
61
- (...a: infer A2): any;
62
- (...a: infer A3): any;
63
- (...a: infer A4): any;
64
- } ? A1 | A2 | A3 | A4 : F extends {
65
- (...a: infer A1): any;
66
- (...a: infer A2): any;
67
- (...a: infer A3): any;
68
- } ? A1 | A2 | A3 : F extends {
69
- (...a: infer A1): any;
70
- (...a: infer A2): any;
71
- } ? A1 | A2 : F extends ((...a: infer A1) => any) ? A1 : never;
72
- /**
73
- * Removes 0-arg overloads (getters), leaving only setter-style overload argument tuples.
74
- */
75
- type SetterArgs<F> = Exclude<OverloadedArgs<F>, []>;
76
- /**
77
- * True if the function has at least one overload that accepts arguments (i.e. a setter overload).
78
- */
79
- type HasArgs<F> = [SetterArgs<F>] extends [never] ? false : true;
80
- type OwnKeys<T> = T extends AnyFn ? Exclude<keyof T, keyof CallableFunction> : keyof T;
81
- /**
82
- * Converts method parameters to modifiers values
83
- * - single non-array arg: `arg` | `[arg]`
84
- * - multiple args/single array wrapped with array
85
- */
86
- type ModifierArgs<P extends unknown[]> = P extends [infer Only] ? Only extends readonly unknown[] ? [Only] : Only | [Only] : P;
87
- /**
88
- * Maps methods with args to modifiers
89
- *
90
- * @example
91
- * type X = {
92
- * a: string; // not a function - will be ignored
93
- * b(): void; // has no arguments - will be ignored
94
- * c(x: number): void;
95
- * d(x: number, y: string): void;
96
- * e(xs: string[]): void;
97
- * }
98
- *
99
- * type R = MethodsToModifiers<X>
100
- * {
101
- * c: number | [number];
102
- * d: [number, string];
103
- * e: [string[]]; // forced wrapper (arg is array)
104
- * }
105
- */
106
- type MethodsToModifiers<T extends object> = { [K in OwnKeys<T> as Extract<T[K], AnyFn> extends never ? never : HasArgs<Extract<T[K], AnyFn>> extends true ? K : never]?: ModifierArgs<Extract<SetterArgs<Extract<T[K], AnyFn>>, unknown[]>> };
107
- //#endregion
108
- //#region ../core/src/lib/map.d.ts
109
- type MapData = ExtendedFeatureCollection | Topology;
110
- type DataTransformer = (features: MapFeature[]) => MapFeature[];
111
- /**
112
- * Extra projection method calls to apply before rendering.
113
- *
114
- * Use projection method names as keys and method arguments as values.
115
- * Example: `{ center: [[0, 20]], rotate: [[0, 0, 0]], scale: 160 }`
116
- *
117
- * @see https://d3js.org/d3-geo/projection
118
- */
119
- interface ProjectionConfig extends Omit<MethodsToModifiers<GeoProjection>, 'invert' | 'stream'> {}
120
- /**
121
- * Shared props contract for the `Map` component.
122
- *
123
- * In adapters, this is usually passed as component props.
124
- */
125
- interface MapProps {
126
- width?: number;
127
- height?: number;
128
- aspectRatio?: number;
129
- /**
130
- * Projection factory from d3-geo (or a compatible implementation).
131
- *
132
- * Example: `geoNaturalEarth1`.
133
- */
134
- projection?: () => GeoProjection;
135
- /**
136
- * Projection method arguments passed to the created projection
137
- */
138
- projectionConfig?: ProjectionConfig;
139
- /**
140
- * TopoJSON or GeoJSON input.
141
- *
142
- * TopoJSON is automatically converted to GeoJSON features.
143
- */
144
- data: MapData;
145
- /**
146
- * Optional feature transformer (filter/augment/normalize features).
147
- */
148
- dataTransformer?: DataTransformer;
149
- }
150
- /**
151
- * Fully computed, framework-agnostic map context.
152
- *
153
- * Adapters provide this context to child layers (features, markers, custom SVG).
154
- */
155
- interface MapContext {
156
- width: number;
157
- height: number;
158
- projection: GeoProjection;
159
- features: MapFeature[];
160
- path: GeoPath;
161
- renderMesh: () => ReturnType<GeoPath>;
162
- }
163
- //#endregion
164
- //#region ../core/src/lib/line.d.ts
165
- /**
166
- * Geographic or cartesian line coordinates expressed as ordered `[x, y]` pairs
167
- */
168
- type MapLineCoordinates = [number, number][];
169
- /**
170
- * D3 curve factory used by custom and cartesian line rendering
171
- */
172
- type MapLineCurve = CurveFactory | CurveFactoryLineOnly;
173
- /**
174
- * Midpoint adjustment expressed as percentages of the segment length
175
- *
176
- * - first value: moves the generated midpoint along the segment direction
177
- * - second value: moves the generated midpoint perpendicular to the segment direction
178
- */
179
- type MapLineMidpoint = [number, number];
180
- //#endregion
181
- //#region ../core/src/lib/annotation.d.ts
182
- /**
183
- * Geographic anchor coordinate for an annotation
184
- */
185
- type MapAnnotationCoordinates = [number, number];
186
- /**
187
- * Public annotation props shared across adapters
188
- */
189
- interface MapAnnotationProps<TStyle = unknown> extends MapObjectProps<TStyle> {
190
- coordinates: MapAnnotationCoordinates;
191
- length?: number;
192
- angle?: number;
193
- margin?: number;
194
- curve?: MapLineCurve;
195
- midpoint?: MapLineMidpoint;
196
- }
197
- //#endregion
198
- //#region ../core/src/lib/graticule.d.ts
199
- /**
200
- * Extra graticule generator method calls to apply before rendering.
201
- *
202
- * Uses d3-geo `geoGraticule()` setter method names as keys.
203
- * Example: `{ step: [[10, 10]], precision: 2.5 }`
204
- *
205
- * @see https://d3js.org/d3-geo/shape#geoGraticule
206
- */
207
- interface GraticuleConfig extends MethodsToModifiers<GeoGraticuleGenerator> {}
208
- /**
209
- * Shared props contract for graticule layers.
210
- */
211
- interface MapGraticuleProps<TStyle = unknown> extends MapObjectProps<TStyle> {
212
- config?: GraticuleConfig;
213
- background?: boolean | string;
214
- border?: boolean | string;
215
- }
216
- //#endregion
217
- //#region ../core/src/lib/marker.d.ts
218
- type MapMarkerCoordinates = [number, number];
219
- /**
220
- * Shared props contract for marker layers.
221
- */
222
- interface MapMarkerProps<TStyle = unknown> extends MapObjectProps<TStyle> {
223
- coordinates: MapMarkerCoordinates;
224
- }
225
- //#endregion
226
- //#region ../core/src/lib/zoom.d.ts
227
- interface DefaultZoomBehavior extends ZoomBehavior<SVGSVGElement, unknown> {}
228
- /**
229
- * Extra zoom method calls to apply before rendering.
230
- *
231
- * Use zoom method names as keys and method arguments as values.
232
- * Example: `{ scaleExtent: [[2, 9]], translateExtent: [[[0, 0], [10, 10]]] }`
233
- *
234
- * @see https://d3js.org/d3-zoom
235
- */
236
- interface ZoomModifiers extends MethodsToModifiers<DefaultZoomBehavior> {}
237
- interface ZoomProps {
238
- center?: [number, number];
239
- zoom?: number;
240
- minZoom?: number;
241
- maxZoom?: number;
242
- config?: ZoomModifiers;
243
- }
244
- interface ZoomEvent extends D3ZoomEvent<SVGSVGElement, unknown> {}
245
- //#endregion
246
7
  //#region src/components/MapAnnotation.vue.d.ts
247
- type __VLS_Props$4 = MapAnnotationProps<StyleValue>;
8
+ type __VLS_Props$5 = MapAnnotationProps<StyleValue>;
248
9
  declare var __VLS_13: {};
249
10
  type __VLS_Slots$4 = {} & {
250
11
  default?: (props: typeof __VLS_13) => any;
251
12
  };
252
- declare const __VLS_base$4: vue6.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$4> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_base$4: vue36.DefineComponent<__VLS_Props$5, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<__VLS_Props$5> & Readonly<{}>, {}, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
253
14
  declare const __VLS_export$8: __VLS_WithSlots$4<typeof __VLS_base$4, __VLS_Slots$4>;
254
15
  declare const _default: typeof __VLS_export$8;
255
16
  type __VLS_WithSlots$4<T, S> = T & {
@@ -259,10 +20,16 @@ type __VLS_WithSlots$4<T, S> = T & {
259
20
  };
260
21
  //#endregion
261
22
  //#region src/components/MapBase.vue.d.ts
23
+ type MapConfigProps = MapProps & {
24
+ context?: undefined;
25
+ };
26
+ type MapContextProps = Partial<MapProps> & {
27
+ context: MapContext;
28
+ };
262
29
  type __VLS_Slots$3 = {
263
30
  default?: (props: MapContext) => unknown;
264
31
  };
265
- declare const __VLS_base$3: vue6.DefineComponent<MapProps, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<MapProps> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
32
+ declare const __VLS_base$3: vue36.DefineComponent<MapConfigProps | MapContextProps, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<MapConfigProps | MapContextProps> & Readonly<{}>, {}, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
266
33
  declare const __VLS_export$7: __VLS_WithSlots$3<typeof __VLS_base$3, __VLS_Slots$3>;
267
34
  declare const _default$1: typeof __VLS_export$7;
268
35
  type __VLS_WithSlots$3<T, S> = T & {
@@ -272,21 +39,21 @@ type __VLS_WithSlots$3<T, S> = T & {
272
39
  };
273
40
  //#endregion
274
41
  //#region src/components/MapFeature.vue.d.ts
275
- type __VLS_Props$3 = MapFeatureProps<StyleValue>;
276
- declare const __VLS_export$6: vue6.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$3> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
42
+ type __VLS_Props$4 = MapFeatureProps<StyleValue>;
43
+ declare const __VLS_export$6: vue36.DefineComponent<__VLS_Props$4, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<__VLS_Props$4> & Readonly<{}>, {}, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
277
44
  declare const _default$2: typeof __VLS_export$6;
278
45
  //#endregion
279
46
  //#region src/components/MapFeatures.vue.d.ts
280
- type __VLS_Props$2 = MapFeaturesProps<StyleValue>;
47
+ type __VLS_Props$3 = MapFeaturesProps<StyleValue>;
281
48
  declare var __VLS_1$2: {
282
- features: MapFeature[];
49
+ features: _d3_maps_core0.MapFeatureData[];
283
50
  };
284
51
  type __VLS_Slots$2 = {} & {
285
52
  default?: (props: typeof __VLS_1$2) => any;
286
53
  };
287
- declare const __VLS_base$2: vue6.DefineComponent<__VLS_Props$2, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$2> & Readonly<{}>, {
54
+ declare const __VLS_base$2: vue36.DefineComponent<__VLS_Props$3, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<__VLS_Props$3> & Readonly<{}>, {
288
55
  idKey: string;
289
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
56
+ }, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
290
57
  declare const __VLS_export$5: __VLS_WithSlots$2<typeof __VLS_base$2, __VLS_Slots$2>;
291
58
  declare const _default$3: typeof __VLS_export$5;
292
59
  type __VLS_WithSlots$2<T, S> = T & {
@@ -296,22 +63,16 @@ type __VLS_WithSlots$2<T, S> = T & {
296
63
  };
297
64
  //#endregion
298
65
  //#region src/components/MapGraticule.vue.d.ts
299
- type __VLS_Props$1 = MapGraticuleProps<StyleValue>;
300
- declare const __VLS_export$4: vue6.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
66
+ type __VLS_Props$2 = MapGraticuleProps<StyleValue>;
67
+ declare const __VLS_export$4: vue36.DefineComponent<__VLS_Props$2, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<__VLS_Props$2> & Readonly<{}>, {}, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
301
68
  declare const _default$4: typeof __VLS_export$4;
302
69
  //#endregion
303
70
  //#region src/components/MapLine.vue.d.ts
304
- interface Props$1 extends MapObjectProps<StyleValue> {
305
- coordinates: MapLineCoordinates;
306
- cartesian?: boolean;
307
- custom?: boolean;
308
- curve?: MapLineCurve;
309
- midpoint?: [number, number];
310
- }
311
- declare const __VLS_export$3: vue6.DefineComponent<Props$1, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props$1> & Readonly<{}>, {
71
+ type __VLS_Props$1 = MapLineProps<StyleValue>;
72
+ declare const __VLS_export$3: vue36.DefineComponent<__VLS_Props$1, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<__VLS_Props$1> & Readonly<{}>, {
312
73
  cartesian: boolean;
313
74
  custom: boolean;
314
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
75
+ }, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
315
76
  declare const _default$5: typeof __VLS_export$3;
316
77
  //#endregion
317
78
  //#region src/components/MapMarker.vue.d.ts
@@ -322,9 +83,9 @@ declare var __VLS_1$1: {};
322
83
  type __VLS_Slots$1 = {} & {
323
84
  default?: (props: typeof __VLS_1$1) => any;
324
85
  };
325
- declare const __VLS_base$1: vue6.DefineComponent<Props, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<Props> & Readonly<{}>, {
86
+ declare const __VLS_base$1: vue36.DefineComponent<Props, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<Props> & Readonly<{}>, {
326
87
  name: string;
327
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
88
+ }, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
328
89
  declare const __VLS_export$2: __VLS_WithSlots$1<typeof __VLS_base$1, __VLS_Slots$1>;
329
90
  declare const _default$6: typeof __VLS_export$2;
330
91
  type __VLS_WithSlots$1<T, S> = T & {
@@ -335,7 +96,7 @@ type __VLS_WithSlots$1<T, S> = T & {
335
96
  //#endregion
336
97
  //#region src/components/MapMesh.vue.d.ts
337
98
  type __VLS_Props = MapObjectProps<StyleValue>;
338
- declare const __VLS_export$1: vue6.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {}, string, vue6.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
99
+ declare const __VLS_export$1: vue36.DefineComponent<__VLS_Props, {}, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {}, string, vue36.PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
339
100
  declare const _default$7: typeof __VLS_export$1;
340
101
  //#endregion
341
102
  //#region src/components/MapZoom.vue.d.ts
@@ -343,23 +104,26 @@ declare var __VLS_1: {};
343
104
  type __VLS_Slots = {} & {
344
105
  default?: (props: typeof __VLS_1) => any;
345
106
  };
346
- declare const __VLS_base: vue6.DefineComponent<ZoomProps, {
347
- container: vue6.Ref<SVGGElement | null, SVGGElement | null>;
348
- zoomBehavior: vue6.ComputedRef<DefaultZoomBehavior>;
349
- }, {}, {}, {}, vue6.ComponentOptionsMixin, vue6.ComponentOptionsMixin, {} & {
107
+ declare const __VLS_base: vue36.DefineComponent<ZoomProps, {
108
+ container: vue36.Ref<SVGGElement | null, SVGGElement | null>;
109
+ zoomBehavior: vue36.ComputedRef<_d3_maps_core0.DefaultZoomBehavior>;
110
+ }, {}, {}, {}, vue36.ComponentOptionsMixin, vue36.ComponentOptionsMixin, {} & {
350
111
  zoom: (payload: ZoomEvent) => any;
351
- zoomstart: (payload: ZoomEvent) => any;
352
- zoomend: (payload: ZoomEvent) => any;
353
- }, string, vue6.PublicProps, Readonly<ZoomProps> & Readonly<{
112
+ zoomStart: (payload: ZoomEvent) => any;
113
+ zoomEnd: (payload: ZoomEvent) => any;
114
+ "update:center": (payload: [number, number]) => any;
115
+ "update:zoom": (payload: number) => any;
116
+ }, string, vue36.PublicProps, Readonly<ZoomProps> & Readonly<{
354
117
  onZoom?: ((payload: ZoomEvent) => any) | undefined;
355
- onZoomstart?: ((payload: ZoomEvent) => any) | undefined;
356
- onZoomend?: ((payload: ZoomEvent) => any) | undefined;
118
+ onZoomStart?: ((payload: ZoomEvent) => any) | undefined;
119
+ onZoomEnd?: ((payload: ZoomEvent) => any) | undefined;
120
+ "onUpdate:center"?: ((payload: [number, number]) => any) | undefined;
121
+ "onUpdate:zoom"?: ((payload: number) => any) | undefined;
357
122
  }>, {
358
- center: [number, number];
359
123
  zoom: number;
360
124
  minZoom: number;
361
125
  maxZoom: number;
362
- }, {}, {}, {}, string, vue6.ComponentProvideOptions, false, {}, any>;
126
+ }, {}, {}, {}, string, vue36.ComponentProvideOptions, false, {}, any>;
363
127
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
364
128
  declare const _default$8: typeof __VLS_export;
365
129
  type __VLS_WithSlots<T, S> = T & {
@@ -368,20 +132,52 @@ type __VLS_WithSlots<T, S> = T & {
368
132
  };
369
133
  };
370
134
  //#endregion
135
+ //#region src/hooks/useCreateMapContext.d.ts
136
+ declare function useCreateMapContext(config?: MaybeRef<Partial<MapProps> | undefined>, context?: MaybeRef<MapContext | undefined>): ComputedRef<MapContext | undefined>;
137
+ //#endregion
371
138
  //#region src/hooks/useMapContext.d.ts
372
139
  declare const mapContextKey: InjectionKey<ComputedRef<MapContext>>;
373
- declare function useMapContext(): ComputedRef<MapContext> | undefined;
140
+ declare function useMapContext(): ComputedRef<MapContext>;
374
141
  //#endregion
375
142
  //#region src/hooks/useMapObject.d.ts
376
143
  interface UseMapObjectResult {
377
144
  style: ComputedRef<StyleValue | undefined>;
378
- onMouseenter: (event: MouseEvent) => void;
379
- onMouseleave: (event: MouseEvent) => void;
145
+ onMouseenter: () => void;
146
+ onMouseleave: () => void;
380
147
  onMousedown: (event: MouseEvent) => void;
381
- onMouseup: (event: MouseEvent) => void;
148
+ onMouseup: () => void;
149
+ onFocus: () => void;
150
+ onBlur: () => void;
382
151
  }
383
152
  declare function useMapObject(styles: MaybeRef<Partial<Record<MapObjectState, StyleValue>> | undefined>): UseMapObjectResult;
384
153
  //#endregion
154
+ //#region src/hooks/useMapZoom.d.ts
155
+ type ZoomToObjectCallback = (view: ObjectZoomView) => void;
156
+ interface UseMapZoomResult {
157
+ center: ComputedRef<[number, number] | undefined>;
158
+ zoom: ComputedRef<number>;
159
+ minZoom: ComputedRef<number>;
160
+ maxZoom: ComputedRef<number>;
161
+ zoomToObject: (object: ZoomObject, callback: ZoomToObjectCallback) => void;
162
+ }
163
+ declare const mapZoomKey: InjectionKey<UseMapZoomResult>;
164
+ interface MapZoomEventCallbacks {
165
+ onZoomStart?: (event: ZoomEvent) => void;
166
+ onZoom?: (event: ZoomEvent) => void;
167
+ onZoomEnd?: (event: ZoomEvent) => void;
168
+ }
169
+ interface ZoomPropsWithDefaults extends ZoomProps {
170
+ zoom: number;
171
+ minZoom: number;
172
+ maxZoom: number;
173
+ }
174
+ interface CreateMapZoomResult {
175
+ zoomBehavior: ComputedRef<ReturnType<typeof createZoomBehavior>>;
176
+ zoomContext: UseMapZoomResult;
177
+ }
178
+ declare function useCreateMapZoom(container: Ref<SVGGElement | null>, props: Readonly<ZoomPropsWithDefaults>, eventCallbacks: MapZoomEventCallbacks): CreateMapZoomResult;
179
+ declare function useMapZoom(): UseMapZoomResult | undefined;
180
+ //#endregion
385
181
  //#region src/plugin.d.ts
386
182
  /**
387
183
  * Vue plugin that registers all d3-maps components globally.
@@ -390,4 +186,4 @@ declare const plugin: {
390
186
  install(app: App): void;
391
187
  };
392
188
  //#endregion
393
- export { _default as MapAnnotation, _default$1 as MapBase, _default$2 as MapFeature, _default$3 as MapFeatures, _default$4 as MapGraticule, _default$5 as MapLine, _default$6 as MapMarker, _default$7 as MapMesh, _default$8 as MapZoom, UseMapObjectResult, mapContextKey, plugin, useMapContext, useMapObject };
189
+ export { CreateMapZoomResult, _default as MapAnnotation, _default$1 as MapBase, _default$2 as MapFeature, _default$3 as MapFeatures, _default$4 as MapGraticule, _default$5 as MapLine, _default$6 as MapMarker, _default$7 as MapMesh, _default$8 as MapZoom, MapZoomEventCallbacks, UseMapObjectResult, UseMapZoomResult, ZoomPropsWithDefaults, ZoomToObjectCallback, getFeatureKey, getInverseZoomScale, getObjectZoomView, getZoomViewportCenter, mapContextKey, mapZoomKey, plugin, useCreateMapContext, useCreateMapZoom, useMapContext, useMapObject, useMapZoom };
@@ -1 +1 @@
1
- (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t&&i(n,Symbol.toStringTag,{value:`Module`}),n};let o=Symbol(`MapContext`);function s(){return(0,n.inject)(o)}let c=Symbol(`InsideZoom`);function l(){return(0,n.inject)(c,!1)}function u(e){let t=(0,n.ref)(`default`),{onMouseenter:i,onMouseleave:a,onMouseup:o,onMousedown:s,dispose:c}=(0,r.useMapObjectEvents)(e=>{t.value=e},l());return(0,n.onBeforeUnmount)(()=>{c()}),{style:(0,n.computed)(()=>(0,r.resolveObjectStyle)(t.value,(0,n.unref)(e))),onMouseenter:i,onMouseleave:a,onMousedown:s,onMouseup:o}}let d=[`d`];var f=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapLine`,props:{coordinates:{},cartesian:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},curve:{},midpoint:{},styles:{}},setup(e){let t=e,i=(0,n.useAttrs)(),a=s(),o=(0,n.computed)(()=>(0,r.getLinePath)(a?.value,{coordinates:t.coordinates,custom:t.custom,curve:t.curve,cartesian:t.cartesian,midpoint:t.midpoint})),c=(0,n.computed)(()=>i.name??`line`),{style:l,...f}=u((0,n.toRef)(t,`styles`)),p=(0,n.computed)(()=>({...i,...f,name:c.value}));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)(p.value,{d:o.value,fill:`none`,style:(0,n.unref)(l)}),null,16,d))}});let p=[`transform`,`name`];var m=(0,n.defineComponent)({__name:`MapMarker`,props:{name:{default:`marker`},coordinates:{},styles:{}},setup(e){let t=e,i=s(),a=(0,n.computed)(()=>(0,r.getMarkerTransform)(i?.value,t.coordinates)),{style:o,...c}=u((0,n.toRef)(t,`styles`));return(t,r)=>a.value?((0,n.openBlock)(),(0,n.createElementBlock)(`g`,(0,n.mergeProps)({key:0,transform:a.value,style:(0,n.unref)(o),name:e.name},c),[(0,n.renderSlot)(t.$slots,`default`)],16,p)):(0,n.createCommentVNode)(`v-if`,!0)}});let h=[`transform`],g=[`transform`];var _=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapAnnotation`,props:{coordinates:{},length:{},angle:{},margin:{},curve:{type:Function},midpoint:{},styles:{}},setup(e){let t=e,i=(0,n.computed)(()=>(0,r.getAnnotationGeometry)({length:t.length,angle:t.angle,margin:t.margin}));return(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(m,{coordinates:e.coordinates,name:`annotation`},{default:(0,n.withCtx)(()=>[(0,n.createElementVNode)(`g`,{transform:i.value.lineTransform},[(0,n.createVNode)(f,(0,n.mergeProps)(t.$attrs,{coordinates:i.value.lineCoordinates,cartesian:``,curve:e.curve,midpoint:e.midpoint,styles:e.styles,fill:`none`,name:`annotation-line`}),null,16,[`coordinates`,`curve`,`midpoint`,`styles`])],8,h),(0,n.createElementVNode)(`g`,{transform:i.value.contentTransform,name:`annotation-content`},[(0,n.renderSlot)(t.$slots,`default`)],8,g)]),_:3},8,[`coordinates`]))}});let v=[`viewBox`];var y=(0,n.defineComponent)({__name:`MapBase`,props:{width:{},height:{},aspectRatio:{},projection:{type:Function},projectionConfig:{},data:{},dataTransformer:{type:Function}},setup(e){let t=e,i=(0,n.computed)(()=>(0,r.makeMapContext)({width:t.width,height:t.height,aspectRatio:t.aspectRatio,projection:t.projection,projectionConfig:t.projectionConfig,data:t.data,dataTransformer:t.dataTransformer}));return(0,n.provide)(o,i),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`svg`,(0,n.mergeProps)({viewBox:`0 0 ${i.value.width} ${i.value.height}`},e.$attrs,{class:`d3-map`}),[(0,n.renderSlot)(e.$slots,`default`,(0,n.normalizeProps)((0,n.guardReactiveProps)(i.value)))],16,v))}});let b=[`d`];var x=(0,n.defineComponent)({__name:`MapFeature`,props:{data:{},styles:{}},setup(e){let t=e,{style:r,...i}=u((0,n.toRef)(t,`styles`)),a=s(),o=(0,n.computed)(()=>a?.value.path(t.data)??void 0);return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)({d:o.value,style:(0,n.unref)(r)},i,{name:`feature`}),null,16,b))}});let S={name:`features`};var C=(0,n.defineComponent)({__name:`MapFeatures`,props:{idKey:{default:`id`},styles:{}},setup(e){let t=s(),i=(0,n.computed)(()=>t?.value.features??[]);return(t,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,S,[(0,n.renderSlot)(t.$slots,`default`,{features:i.value},()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(i.value,(t,i)=>((0,n.openBlock)(),(0,n.createBlock)(x,{key:(0,n.unref)(r.getFeatureKey)(t,e.idKey,i),data:t,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let w=[`d`,`fill`],T=[`d`],E=[`d`,`stroke`];var D=(0,n.defineComponent)({inheritAttrs:!1,__name:`MapGraticule`,props:{config:{},background:{type:[Boolean,String]},border:{type:[Boolean,String]},styles:{}},setup(e){let t=e,i=s(),a=(0,n.useAttrs)(),o=(0,n.computed)(()=>{if(i?.value)return(0,r.renderGraticule)(i.value,t.config)??void 0}),c=(0,n.computed)(()=>{if(i?.value)return(0,r.renderOutline)(i.value)??void 0}),l=(0,n.computed)(()=>(0,r.isString)(t.background)?t.background:void 0),d=(0,n.computed)(()=>(0,r.isString)(t.border)?t.border:void 0),{style:f,...p}=u((0,n.toRef)(t,`styles`));return(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,null,[e.background?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:0,d:c.value,fill:l.value,"pointer-events":`none`,name:`background`},null,8,w)):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`path`,(0,n.mergeProps)({d:o.value,fill:`none`,style:(0,n.unref)(f)},(0,n.mergeProps)(p,(0,n.unref)(a)),{name:`graticule`}),null,16,T),e.border?((0,n.openBlock)(),(0,n.createElementBlock)(`path`,{key:1,d:c.value,fill:`none`,stroke:d.value,"pointer-events":`none`,name:`border`},null,8,E)):(0,n.createCommentVNode)(`v-if`,!0)]))}});let O=[`d`];var k=(0,n.defineComponent)({__name:`MapMesh`,props:{styles:{}},setup(e){let t=e,r=s(),i=(0,n.computed)(()=>r?.value.renderMesh()??void 0),{style:a,...o}=u((0,n.toRef)(t,`styles`));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`path`,(0,n.mergeProps)({d:i.value,fill:`none`,style:(0,n.unref)(a)},o,{name:`mesh`}),null,16,O))}}),A=(0,n.defineComponent)({__name:`MapZoom`,props:{center:{default:()=>[0,0]},zoom:{default:1},minZoom:{default:1},maxZoom:{default:8},config:{}},emits:[`zoomstart`,`zoom`,`zoomend`],setup(e,{expose:t,emit:i}){let a=e,o=i,l=(0,n.ref)(null),u=s();(0,n.provide)(c,!0);let d=(0,n.computed)(()=>(0,r.createZoomBehavior)(u?.value,{minZoom:a.minZoom,maxZoom:a.maxZoom,config:a.config,onZoomStart:e=>o(`zoomstart`,e),onZoom:e=>{(0,r.applyZoomGroupTransform)(l.value,e.transform),o(`zoom`,e)},onZoomEnd:e=>o(`zoomend`,e)}));return(0,n.onMounted)(()=>{(0,n.watch)(d,e=>{l.value&&(0,r.setupZoom)({element:l.value,behavior:e,center:a.center,zoom:a.zoom})},{immediate:!0}),(0,n.watch)(()=>[d.value,a.center[0],a.center[1],a.zoom],()=>{l.value&&(0,r.applyZoomTransform)({element:l.value,behavior:d.value,center:a.center,zoom:a.zoom})})}),t({container:l,zoomBehavior:d}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`g`,{ref_key:`container`,ref:l,name:`zoom`},[(0,n.renderSlot)(e.$slots,`default`)],512))}}),j=a({MapAnnotation:()=>_,MapBase:()=>y,MapFeature:()=>x,MapFeatures:()=>C,MapGraticule:()=>D,MapLine:()=>f,MapMarker:()=>m,MapMesh:()=>k,MapZoom:()=>A});e.MapAnnotation=_,e.MapBase=y,e.MapFeature=x,e.MapFeatures=C,e.MapGraticule=D,e.MapLine=f,e.MapMarker=m,e.MapMesh=k,e.MapZoom=A,e.mapContextKey=o,e.plugin={install(e){Object.entries(j).forEach(([t,n])=>{e.component(t,n)})}},e.useMapContext=s,e.useMapObject=u})(this.D3Maps=this.D3Maps||{},_d3_maps_core_index_css,Vue,D3Maps);
1
+ (function(e,t){var n=Object.defineProperty,r=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t&&n(r,Symbol.toStringTag,{value:`Module`}),r},i=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let i=t[r],a=e+i,o=Math.abs(e)<Math.abs(i)?e-(a-i):i-(a-e);o&&(t[n++]=o),e=a}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,i,a=0;if(t>0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}};function*a(e){for(let t of e)yield*t}function o(e){return Array.from(a(e))}function s(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}var c=1e-6,l=1e-12,u=Math.PI,d=u/2,f=u/4,p=u*2,m=180/u,h=u/180,g=Math.abs,_=Math.atan,v=Math.atan2,y=Math.cos,b=Math.ceil,x=Math.sin,S=Math.sign||function(e){return e>0?1:e<0?-1:0},C=Math.sqrt;function w(e){return e>1?0:e<-1?u:Math.acos(e)}function T(e){return e>1?d:e<-1?-d:Math.asin(e)}function E(){}function D(e,t){e&&k.hasOwnProperty(e.type)&&k[e.type](e,t)}var O={Feature:function(e,t){D(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)D(n[r].geometry,t)}},k={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){A(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)A(n[r],t,0)},Polygon:function(e,t){j(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)j(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)D(n[r],t)}};function A(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function j(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)A(e[n],t,1);t.polygonEnd()}function M(e,t){e&&O.hasOwnProperty(e.type)?O[e.type](e,t):D(e,t)}function N(e){return[v(e[1],e[0]),T(e[2])]}function P(e){var t=e[0],n=e[1],r=y(n);return[r*y(t),r*x(t),x(n)]}function F(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ee(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function I(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function te(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function ne(e){var t=C(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function re(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}function ie(e,t){return g(e)>u&&(e-=Math.round(e/p)*p),[e,t]}ie.invert=ie;function ae(e,t,n){return(e%=p)?t||n?re(se(e),ce(t,n)):se(e):t||n?ce(t,n):ie}function oe(e){return function(t,n){return t+=e,g(t)>u&&(t-=Math.round(t/p)*p),[t,n]}}function se(e){var t=oe(e);return t.invert=oe(-e),t}function ce(e,t){var n=y(e),r=x(e),i=y(t),a=x(t);function o(e,t){var o=y(t),s=y(e)*o,c=x(e)*o,l=x(t),u=l*n+s*r;return[v(c*i-u*a,s*n-l*r),T(u*i+c*a)]}return o.invert=function(e,t){var o=y(t),s=y(e)*o,c=x(e)*o,l=x(t),u=l*i-c*a;return[v(c*i+l*a,s*n+u*r),T(u*n-s*r)]},o}function le(e,t,n,r,i,a){if(n){var o=y(t),s=x(t),c=r*n;i==null?(i=t+r*p,a=t-c/2):(i=ue(o,i),a=ue(o,a),(r>0?i<a:i>a)&&(i+=r*p));for(var l,u=i;r>0?u>a:u<a;u-=c)l=N([o,-s*y(u),-s*x(u)]),e.point(l[0],l[1])}}function ue(e,t){t=P(t),t[0]-=e,ne(t);var n=w(-t[1]);return((-t[2]<0?-n:n)+p-c)%p}function de(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:E,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function fe(e,t){return g(e[0]-t[0])<c&&g(e[1]-t[1])<c}function pe(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function me(e,t,n,r,i){var a=[],o=[],s,l;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],l;if(fe(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s<t;++s)i.point((n=e[s])[0],n[1]);i.lineEnd();return}r[0]+=2*c}a.push(l=new pe(n,e,null,!0)),o.push(l.o=new pe(n,null,l,!1)),a.push(l=new pe(r,e,null,!1)),o.push(l.o=new pe(r,null,l,!0))}}),a.length){for(o.sort(t),he(a),he(o),s=0,l=o.length;s<l;++s)o[s].e=n=!n;for(var u=a[0],d,f;;){for(var p=u,m=!0;p.v;)if((p=p.n)===u)return;d=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(m)for(s=0,l=d.length;s<l;++s)i.point((f=d[s])[0],f[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(m)for(d=p.p.z,s=d.length-1;s>=0;--s)i.point((f=d[s])[0],f[1]);else r(p.x,p.p.x,-1,i);p=p.p}p=p.o,d=p.z,m=!m}while(!p.v);i.lineEnd()}}}function he(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function ge(e){return g(e[0])<=u?e[0]:S(e[0])*((g(e[0])+u)%p-u)}function _e(e,t){var n=ge(t),r=t[1],a=x(r),o=[x(n),-y(n),0],s=0,m=0,h=new i;a===1?r=d+c:a===-1&&(r=-d-c);for(var g=0,_=e.length;g<_;++g)if(S=(b=e[g]).length)for(var b,S,C=b[S-1],w=ge(C),E=C[1]/2+f,D=x(E),O=y(E),k=0;k<S;++k,w=j,D=N,O=F,C=A){var A=b[k],j=ge(A),M=A[1]/2+f,N=x(M),F=y(M),I=j-w,te=I>=0?1:-1,re=te*I,ie=re>u,ae=D*N;if(h.add(v(ae*te*x(re),O*F+ae*y(re))),s+=ie?I+te*p:I,ie^w>=n^j>=n){var oe=ee(P(C),P(A));ne(oe);var se=ee(o,oe);ne(se);var ce=(ie^I>=0?-1:1)*T(se[2]);(r>ce||r===ce&&(oe[0]||oe[1]))&&(m+=ie^I>=0?1:-1)}}return(s<-c||s<c&&h<-l)^m&1}function ve(e,t,n,r){return function(i){var a=t(i),s=de(),c=t(s),l=!1,u,d,f,p={point:m,lineStart:g,lineEnd:_,polygonStart:function(){p.point=v,p.lineStart=y,p.lineEnd=b,d=[],u=[]},polygonEnd:function(){p.point=m,p.lineStart=g,p.lineEnd=_,d=o(d);var e=_e(u,r);d.length?(l||=(i.polygonStart(),!0),me(d,be,e,n,i)):e&&(l||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),l&&=(i.polygonEnd(),!1),d=u=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function m(t,n){e(t,n)&&i.point(t,n)}function h(e,t){a.point(e,t)}function g(){p.point=h,a.lineStart()}function _(){p.point=m,a.lineEnd()}function v(e,t){f.push([e,t]),c.point(e,t)}function y(){c.lineStart(),f=[]}function b(){v(f[0][0],f[0][1]),c.lineEnd();var e=c.clean(),t=s.result(),n,r=t.length,a,o,p;if(f.pop(),u.push(f),f=null,r){if(e&1){if(o=t[0],(a=o.length-1)>0){for(l||=(i.polygonStart(),!0),i.lineStart(),n=0;n<a;++n)i.point((p=o[n])[0],p[1]);i.lineEnd()}return}r>1&&e&2&&t.push(t.pop().concat(t.shift())),d.push(t.filter(ye))}}return p}}function ye(e){return e.length>1}function be(e,t){return((e=e.x)[0]<0?e[1]-d-c:d-e[1])-((t=t.x)[0]<0?t[1]-d-c:d-t[1])}var xe=ve(function(){return!0},Se,we,[-u,-d]);function Se(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?u:-u,l=g(a-t);g(l-u)<c?(e.point(t,n=(n+o)/2>0?d:-d),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&l>=u&&(g(t-r)<c&&(t-=r*c),g(a-s)<c&&(a-=s*c),n=Ce(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function Ce(e,t,n,r){var i,a,o=x(e-n);return g(o)>c?_((x(t)*(a=y(r))*x(n)-x(r)*(i=y(t))*x(e))/(i*a*o)):(t+r)/2}function we(e,t,n,r){var i;if(e==null)i=n*d,r.point(-u,i),r.point(0,i),r.point(u,i),r.point(u,0),r.point(u,-i),r.point(0,-i),r.point(-u,-i),r.point(-u,0),r.point(-u,i);else if(g(e[0]-t[0])>c){var a=e[0]<t[0]?u:-u;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(t[0],t[1])}function Te(e){var t=y(e),n=2*h,r=t>0,i=g(t)>c;function a(t,r,i,a){le(a,e,n,i,t,r)}function o(e,n){return y(e)*y(n)>t}function s(e){var t,n,a,s,c;return{lineStart:function(){s=a=!1,c=1},point:function(f,p){var m=[f,p],h,g=o(f,p),_=r?g?0:d(f,p):g?d(f+(f<0?u:-u),p):0;if(!t&&(s=a=g)&&e.lineStart(),g!==a&&(h=l(t,m),(!h||fe(t,h)||fe(m,h))&&(m[2]=1)),g!==a)c=0,g?(e.lineStart(),h=l(m,t),e.point(h[0],h[1])):(h=l(t,m),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(i&&t&&r^g){var v;!(_&n)&&(v=l(m,t,!0))&&(c=0,r?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1],3)))}g&&(!t||!fe(t,m))&&e.point(m[0],m[1]),t=m,a=g,n=_},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return c|(s&&a)<<1}}}function l(e,n,r){var i=P(e),a=P(n),o=[1,0,0],s=ee(i,a),l=F(s,s),d=s[0],f=l-d*d;if(!f)return!r&&e;var p=t*l/f,m=-t*d/f,h=ee(o,s),_=te(o,p);I(_,te(s,m));var v=h,y=F(_,v),b=F(v,v),x=y*y-b*(F(_,_)-1);if(!(x<0)){var S=C(x),w=te(v,(-y-S)/b);if(I(w,_),w=N(w),!r)return w;var T=e[0],E=n[0],D=e[1],O=n[1],k;E<T&&(k=T,T=E,E=k);var A=E-T,j=g(A-u)<c,M=j||A<c;if(!j&&O<D&&(k=D,D=O,O=k),M?j?D+O>0^w[1]<(g(w[0]-T)<c?D:O):D<=w[1]&&w[1]<=O:A>u^(T<=w[0]&&w[0]<=E)){var ne=te(v,(-y+S)/b);return I(ne,_),[w,N(ne)]}}}function d(t,n){var i=r?e:u-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return ve(o,s,a,r?[0,-e]:[-u,e-u])}function Ee(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<d&&(d=m)}else if(f>0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<d&&(d=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<u)return;m<d&&(d=m)}else if(p>0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m<u)return;m<d&&(d=m)}return u>0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var De=1e9,Oe=-De;function ke(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,o,c){var l=0,d=0;if(i==null||(l=s(i,o))!==(d=s(a,o))||u(i,a)<0^o>0)do c.point(l===0||l===3?e:n,l>1?r:t);while((l=(l+o+4)%4)!==d);else c.point(a[0],a[1])}function s(r,i){return g(r[0]-e)<c?i>0?0:3:g(r[0]-n)<c?i>0?2:1:g(r[1]-t)<c?i>0?1:0:i>0?3:2}function l(e,t){return u(e.x,t.x)}function u(e,t){var n=s(e,1),r=s(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(s){var c=s,u=de(),d,f,p,m,h,g,_,v,y,b,x,S={point:C,lineStart:D,lineEnd:O,polygonStart:T,polygonEnd:E};function C(e,t){i(e,t)&&c.point(e,t)}function w(){for(var t=0,n=0,i=f.length;n<i;++n)for(var a=f[n],o=1,s=a.length,c=a[0],l,u,d=c[0],p=c[1];o<s;++o)l=d,u=p,c=a[o],d=c[0],p=c[1],u<=r?p>r&&(d-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(d-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function T(){c=u,d=[],f=[],x=!0}function E(){var e=w(),t=x&&e,n=(d=o(d)).length;(t||n)&&(s.polygonStart(),t&&(s.lineStart(),a(null,null,1,s),s.lineEnd()),n&&me(d,l,e,a,s),s.polygonEnd()),c=s,d=f=p=null}function D(){S.point=k,f&&f.push(p=[]),b=!0,y=!1,_=v=NaN}function O(){d&&(k(m,h),g&&y&&u.rejoin(),d.push(u.result())),S.point=C,y&&c.lineEnd()}function k(a,o){var s=i(a,o);if(f&&p.push([a,o]),b)m=a,h=o,g=s,b=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&y)c.point(a,o);else{var l=[_=Math.max(Oe,Math.min(De,_)),v=Math.max(Oe,Math.min(De,v))],u=[a=Math.max(Oe,Math.min(De,a)),o=Math.max(Oe,Math.min(De,o))];Ee(l,u,e,t,n,r)?(y||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),x=!1):s&&(c.lineStart(),c.point(a,o),x=!1)}_=a,v=o,y=s}return S}}function Ae(e,t,n){var r=s(e,t-c,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function je(e,t,n){var r=s(e,t-c,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function Me(){var e,t,n,r,i,a,o,l,u=10,d=u,f=90,p=360,m,h,_,v,y=2.5;function x(){return{type:`MultiLineString`,coordinates:S()}}function S(){return s(b(r/f)*f,n,f).map(_).concat(s(b(l/p)*p,o,p).map(v)).concat(s(b(t/u)*u,e,u).filter(function(e){return g(e%f)>c}).map(m)).concat(s(b(a/d)*d,i,d).filter(function(e){return g(e%p)>c}).map(h))}return x.lines=function(){return S().map(function(e){return{type:`LineString`,coordinates:e}})},x.outline=function(){return{type:`Polygon`,coordinates:[_(r).concat(v(o).slice(1),_(n).reverse().slice(1),v(l).reverse().slice(1))]}},x.extent=function(e){return arguments.length?x.extentMajor(e).extentMinor(e):x.extentMinor()},x.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],l=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),l>o&&(e=l,l=o,o=e),x.precision(y)):[[r,l],[n,o]]},x.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),x.precision(y)):[[t,a],[e,i]]},x.step=function(e){return arguments.length?x.stepMajor(e).stepMinor(e):x.stepMinor()},x.stepMajor=function(e){return arguments.length?(f=+e[0],p=+e[1],x):[f,p]},x.stepMinor=function(e){return arguments.length?(u=+e[0],d=+e[1],x):[u,d]},x.precision=function(s){return arguments.length?(y=+s,m=Ae(a,i,90),h=je(t,e,y),_=Ae(l,o,90),v=je(r,n,y),x):y},x.extentMajor([[-180,-90+c],[180,90-c]]).extentMinor([[-180,-80-c],[180,80+c]])}var Ne=e=>e,Pe=new i,Fe=new i,Ie,Le,Re,ze,L={point:E,lineStart:E,lineEnd:E,polygonStart:function(){L.lineStart=Be,L.lineEnd=Ue},polygonEnd:function(){L.lineStart=L.lineEnd=L.point=E,Pe.add(g(Fe)),Fe=new i},result:function(){var e=Pe/2;return Pe=new i,e}};function Be(){L.point=Ve}function Ve(e,t){L.point=He,Ie=Re=e,Le=ze=t}function He(e,t){Fe.add(ze*e-Re*t),Re=e,ze=t}function Ue(){He(Ie,Le)}var We=L,Ge=1/0,Ke=Ge,qe=-Ge,Je=qe,Ye={point:Xe,lineStart:E,lineEnd:E,polygonStart:E,polygonEnd:E,result:function(){var e=[[Ge,Ke],[qe,Je]];return qe=Je=-(Ke=Ge=1/0),e}};function Xe(e,t){e<Ge&&(Ge=e),e>qe&&(qe=e),t<Ke&&(Ke=t),t>Je&&(Je=t)}var Ze=Ye,Qe=0,$e=0,et=0,tt=0,nt=0,rt=0,it=0,at=0,ot=0,st,ct,R,z,B={point:lt,lineStart:ut,lineEnd:pt,polygonStart:function(){B.lineStart=mt,B.lineEnd=ht},polygonEnd:function(){B.point=lt,B.lineStart=ut,B.lineEnd=pt},result:function(){var e=ot?[it/ot,at/ot]:rt?[tt/rt,nt/rt]:et?[Qe/et,$e/et]:[NaN,NaN];return Qe=$e=et=tt=nt=rt=it=at=ot=0,e}};function lt(e,t){Qe+=e,$e+=t,++et}function ut(){B.point=dt}function dt(e,t){B.point=ft,lt(R=e,z=t)}function ft(e,t){var n=e-R,r=t-z,i=C(n*n+r*r);tt+=i*(R+e)/2,nt+=i*(z+t)/2,rt+=i,lt(R=e,z=t)}function pt(){B.point=lt}function mt(){B.point=gt}function ht(){_t(st,ct)}function gt(e,t){B.point=_t,lt(st=R=e,ct=z=t)}function _t(e,t){var n=e-R,r=t-z,i=C(n*n+r*r);tt+=i*(R+e)/2,nt+=i*(z+t)/2,rt+=i,i=z*e-R*t,it+=i*(R+e),at+=i*(z+t),ot+=i*3,lt(R=e,z=t)}var vt=B;function yt(e){this._context=e}yt.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,p);break}},result:E};var bt=new i,xt,St,Ct,wt,Tt,Et={point:E,lineStart:function(){Et.point=Dt},lineEnd:function(){xt&&Ot(St,Ct),Et.point=E},polygonStart:function(){xt=!0},polygonEnd:function(){xt=null},result:function(){var e=+bt;return bt=new i,e}};function Dt(e,t){Et.point=Ot,St=wt=e,Ct=Tt=t}function Ot(e,t){wt-=e,Tt-=t,bt.add(C(wt*wt+Tt*Tt)),wt=e,Tt=t}var kt=Et;let At,jt,Mt,Nt;var Pt=class{constructor(e){this._append=e==null?Ft:It(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Mt||this._append!==jt){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Mt=e,jt=this._append,Nt=this._,this._=t}this._+=Nt;break}}result(){let e=this._;return this._=``,e.length?e:null}};function Ft(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function It(e){let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return Ft;if(t!==At){let e=10**t;At=t,jt=function(t){let n=1;this._+=t[0];for(let r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return jt}function Lt(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),M(e,i(a))),a.result()}return o.area=function(e){return M(e,i(We)),We.result()},o.measure=function(e){return M(e,i(kt)),kt.result()},o.bounds=function(e){return M(e,i(Ze)),Ze.result()},o.centroid=function(e){return M(e,i(vt)),vt.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,Ne):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new Pt(n)):new yt(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new Pt(n)),o},o.projection(e).digits(n).context(t)}function Rt(e){return function(t){var n=new zt;for(var r in e)n[r]=e[r];return n.stream=t,n}}function zt(){}zt.prototype={constructor:zt,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Bt(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),M(n,e.stream(Ze)),t(Ze.result()),r!=null&&e.clipExtent(r),e}function Vt(e,t,n){return Bt(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function Ht(e,t,n){return Vt(e,[[0,0],t],n)}function Ut(e,t,n){return Bt(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function Wt(e,t,n){return Bt(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var Gt=16,Kt=y(30*h);function qt(e,t){return+t?Yt(e,t):Jt(e)}function Jt(e){return Rt({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Yt(e,t){function n(r,i,a,o,s,l,u,d,f,p,m,h,_,y){var b=u-r,x=d-i,S=b*b+x*x;if(S>4*t&&_--){var w=o+p,E=s+m,D=l+h,O=C(w*w+E*E+D*D),k=T(D/=O),A=g(g(D)-1)<c||g(a-f)<c?(a+f)/2:v(E,w),j=e(A,k),M=j[0],N=j[1],P=M-r,F=N-i,ee=x*P-b*F;(ee*ee/S>t||g((b*P+x*F)/S-.5)>.3||o*p+s*m+l*h<Kt)&&(n(r,i,a,o,s,l,M,N,A,w/=O,E/=O,D,_,y),y.point(M,N),n(M,N,A,w,E,D,u,d,f,p,m,h,_,y))}}return function(t){var r,i,a,o,s,c,l,u,d,f,p,m,h={point:g,lineStart:_,lineEnd:y,polygonStart:function(){t.polygonStart(),h.lineStart=b},polygonEnd:function(){t.polygonEnd(),h.lineStart=_}};function g(n,r){n=e(n,r),t.point(n[0],n[1])}function _(){u=NaN,h.point=v,t.lineStart()}function v(r,i){var a=P([r,i]),o=e(r,i);n(u,d,l,f,p,m,u=o[0],d=o[1],l=r,f=a[0],p=a[1],m=a[2],Gt,t),t.point(u,d)}function y(){h.point=g,t.lineEnd()}function b(){_(),h.point=x,h.lineEnd=S}function x(e,t){v(r=e,t),i=u,a=d,o=f,s=p,c=m,h.point=v}function S(){n(u,d,l,f,p,m,i,a,r,o,s,c,Gt,t),h.lineEnd=y,y()}return h}}var Xt=Rt({point:function(e,t){this.stream.point(e*h,t*h)}});function Zt(e){return Rt({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Qt(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function $t(e,t,n,r,i,a){if(!a)return Qt(e,t,n,r,i);var o=y(a),s=x(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function en(e){return tn(function(){return e})()}function tn(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,g=null,_=xe,v=null,y,b,x,S=Ne,w=.5,T,E,D,O,k;function A(e){return D(e[0]*h,e[1]*h)}function j(e){return e=D.invert(e[0],e[1]),e&&[e[0]*m,e[1]*m]}A.stream=function(e){return O&&k===e?O:O=Xt(Zt(u)(_(T(S(k=e)))))},A.preclip=function(e){return arguments.length?(_=e,g=void 0,N()):_},A.postclip=function(e){return arguments.length?(S=e,v=y=b=x=null,N()):S},A.clipAngle=function(e){return arguments.length?(_=+e?Te(g=e*h):(g=null,xe),N()):g*m},A.clipExtent=function(e){return arguments.length?(S=e==null?(v=y=b=x=null,Ne):ke(v=+e[0][0],y=+e[0][1],b=+e[1][0],x=+e[1][1]),N()):v==null?null:[[v,y],[b,x]]},A.scale=function(e){return arguments.length?(n=+e,M()):n},A.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],M()):[r,i]},A.center=function(e){return arguments.length?(a=e[0]%360*h,o=e[1]%360*h,M()):[a*m,o*m]},A.rotate=function(e){return arguments.length?(s=e[0]%360*h,c=e[1]%360*h,l=e.length>2?e[2]%360*h:0,M()):[s*m,c*m,l*m]},A.angle=function(e){return arguments.length?(d=e%360*h,M()):d*m},A.reflectX=function(e){return arguments.length?(f=e?-1:1,M()):f<0},A.reflectY=function(e){return arguments.length?(p=e?-1:1,M()):p<0},A.precision=function(e){return arguments.length?(T=qt(E,w=e*e),N()):C(w)},A.fitExtent=function(e,t){return Vt(A,e,t)},A.fitSize=function(e,t){return Ht(A,e,t)},A.fitWidth=function(e,t){return Ut(A,e,t)},A.fitHeight=function(e,t){return Wt(A,e,t)};function M(){var e=$t(n,0,0,f,p,d).apply(null,t(a,o)),m=$t(n,r-e[0],i-e[1],f,p,d);return u=ae(s,c,l),E=re(t,m),D=re(u,E),T=qt(E,w),N()}function N(){return O=k=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&j,M()}}function nn(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}nn.invert=function(e,t){var n=t,r=25,i;do{var a=n*n,o=a*a;n-=i=(n*(1.007226+a*(.015085+o*(-.044475+.028874*a-.005916*o)))-t)/(1.007226+a*(.015085*3+o*(-.044475*7+.028874*9*a-.005916*11*o)))}while(g(i)>c&&--r>0);return[e/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]};function rn(){return en(nn).scale(175.295)}function an(e){return function(){return e}}let on=Math.PI,sn=2*on,cn=1e-6,ln=sn-cn;function un(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function dn(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return un;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var fn=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?un:dn(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>cn)if(!(Math.abs(u*s-c*l)>cn)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((on-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>cn&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>cn||Math.abs(this._y1-l)>cn)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%sn+sn),d>ln?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>cn&&this._append`A${n},${n},0,${+(d>=on)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function pn(){return new fn}pn.prototype=fn.prototype;function mn(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new fn(t)}Array.prototype.slice;function hn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function gn(e){this._context=e}gn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function _n(e){return new gn(e)}function vn(e){return e[0]}function yn(e){return e[1]}function bn(e,t){var n=an(!0),r=null,i=_n,a=null,o=mn(s);e=typeof e==`function`?e:e===void 0?vn:an(e),t=typeof t==`function`?t:t===void 0?yn:an(t);function s(s){var c,l=(s=hn(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:an(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:an(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:an(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function xn(e){this._context=e}xn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Sn(e),i=Sn(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function Sn(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Cn(e){return new xn(e)}function wn(e){return e}function Tn(e){if(e==null)return wn;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c<l;)u[c]=e[c],++c;return u}}function En(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function Dn(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return On(e,t)})}:On(e,t)}function On(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=kn(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function kn(e,t){var n=Tn(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a<o;++a)t.push(n(i[a],a));e<0&&En(t,o)}function a(e){return n(e)}function o(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}function l(e){var t=e.type,n;switch(t){case`GeometryCollection`:return{type:t,geometries:e.geometries.map(l)};case`Point`:n=a(e.coordinates);break;case`MultiPoint`:n=e.coordinates.map(a);break;case`LineString`:n=o(e.arcs);break;case`MultiLineString`:n=e.arcs.map(o);break;case`Polygon`:n=c(e.arcs);break;case`MultiPolygon`:n=e.arcs.map(c);break;default:return null}return{type:t,coordinates:n}}return l(t)}function An(e,t){var n={},r={},i={},a=[],o=-1;t.forEach(function(n,r){var i=e.arcs[n<0?~n:n],a;i.length<3&&!i[1][0]&&!i[1][1]&&(a=t[++o],t[o]=n,t[r]=a)}),t.forEach(function(e){var t=s(e),n=t[0],a=t[1],o,c;if(o=i[n])if(delete i[o.end],o.push(e),o.end=a,c=r[a]){delete r[c.start];var l=c===o?o:o.concat(c);r[l.start=o.start]=i[l.end=c.end]=l}else r[o.start]=i[o.end]=o;else if(o=r[a])if(delete r[o.start],o.unshift(e),o.start=n,c=i[n]){delete i[c.end];var u=c===o?o:c.concat(o);r[u.start=c.start]=i[u.end=o.end]=u}else r[o.start]=i[o.end]=o;else o=[e],r[o.start=n]=i[o.end=a]=o});function s(t){var n=e.arcs[t<0?~t:t],r=n[0],i;return e.transform?(i=[0,0],n.forEach(function(e){i[0]+=e[0],i[1]+=e[1]})):i=n[n.length-1],t<0?[i,r]:[r,i]}function c(e,t){for(var r in e){var i=e[r];delete t[i.start],delete i.start,delete i.end,i.forEach(function(e){n[e<0?~e:e]=1}),a.push(i)}}return c(i,r),c(r,i),t.forEach(function(e){n[e<0?~e:e]||a.push([e])}),a}function jn(e){return kn(e,Mn.apply(this,arguments))}function Mn(e,t,n){var r,i,a;if(arguments.length>1)r=Nn(e,t,n);else for(i=0,r=Array(a=e.arcs.length);i<a;++i)r[i]=i;return{type:`MultiLineString`,arcs:An(e,r)}}function Nn(e,t,n){var r=[],i=[],a;function o(e){var t=e<0?~e:e;(i[t]||(i[t]=[])).push({i:e,g:a})}function s(e){e.forEach(o)}function c(e){e.forEach(s)}function l(e){e.forEach(c)}function u(e){switch(a=e,e.type){case`GeometryCollection`:e.geometries.forEach(u);break;case`LineString`:s(e.arcs);break;case`MultiLineString`:case`Polygon`:c(e.arcs);break;case`MultiPolygon`:l(e.arcs);break}}return u(t),i.forEach(n==null?function(e){r.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&r.push(e[0].i)}),r}var Pn=`http://www.w3.org/1999/xhtml`,Fn={svg:`http://www.w3.org/2000/svg`,xhtml:Pn,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function In(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Fn.hasOwnProperty(t)?{space:Fn[t],local:e}:e}function Ln(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Pn&&t.documentElement.namespaceURI===Pn?t.createElement(e):t.createElementNS(n,e)}}function Rn(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zn(e){var t=In(e);return(t.local?Rn:Ln)(t)}function Bn(){}function Vn(e){return e==null?Bn:function(){return this.querySelector(e)}}function Hn(e){typeof e!=`function`&&(e=Vn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new V(r,this._parents)}function Un(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Wn(){return[]}function Gn(e){return e==null?Wn:function(){return this.querySelectorAll(e)}}function Kn(e){return function(){return Un(e.apply(this,arguments))}}function qn(e){e=typeof e==`function`?Kn(e):Gn(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new V(r,i)}function Jn(e){return function(){return this.matches(e)}}function Yn(e){return function(t){return t.matches(e)}}var Xn=Array.prototype.find;function Zn(e){return function(){return Xn.call(this.children,e)}}function Qn(){return this.firstElementChild}function $n(e){return this.select(e==null?Qn:Zn(typeof e==`function`?e:Yn(e)))}var er=Array.prototype.filter;function tr(){return Array.from(this.children)}function nr(e){return function(){return er.call(this.children,e)}}function rr(e){return this.selectAll(e==null?tr:nr(typeof e==`function`?e:Yn(e)))}function ir(e){typeof e!=`function`&&(e=Jn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new V(r,this._parents)}function ar(e){return Array(e.length)}function or(){return new V(this._enter||this._groups.map(ar),this._parents)}function sr(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sr.prototype={constructor:sr,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function cr(e){return function(){return e}}function lr(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new sr(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function ur(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new sr(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function dr(e){return e.__data__}function fr(e,t){if(!arguments.length)return Array.from(this,dr);var n=t?ur:lr,r=this._parents,i=this._groups;typeof e!=`function`&&(e=cr(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=pr(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new V(o,r),o._enter=s,o._exit=c,o}function pr(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function mr(){return new V(this._exit||this._groups.map(ar),this._parents)}function hr(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function gr(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new V(s,this._parents)}function _r(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function vr(e){e||=yr;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new V(i,this._parents).order()}function yr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function br(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xr(){return Array.from(this)}function Sr(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Cr(){let e=0;for(let t of this)++e;return e}function wr(){return!this.node()}function Tr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Er(e){return function(){this.removeAttribute(e)}}function Dr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Or(e,t){return function(){this.setAttribute(e,t)}}function kr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ar(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function jr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Mr(e,t){var n=In(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Dr:Er:typeof t==`function`?n.local?jr:Ar:n.local?kr:Or)(n,t))}function Nr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Pr(e){return function(){this.style.removeProperty(e)}}function Fr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ir(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Lr(e,t,n){return arguments.length>1?this.each((t==null?Pr:typeof t==`function`?Ir:Fr)(e,t,n??``)):Rr(this.node(),e)}function Rr(e,t){return e.style.getPropertyValue(t)||Nr(e).getComputedStyle(e,null).getPropertyValue(t)}function zr(e){return function(){delete this[e]}}function Br(e,t){return function(){this[e]=t}}function Vr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Hr(e,t){return arguments.length>1?this.each((t==null?zr:typeof t==`function`?Vr:Br)(e,t)):this.node()[e]}function Ur(e){return e.trim().split(/^|\s+/)}function Wr(e){return e.classList||new Gr(e)}function Gr(e){this._node=e,this._names=Ur(e.getAttribute(`class`)||``)}Gr.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Kr(e,t){for(var n=Wr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function qr(e,t){for(var n=Wr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Jr(e){return function(){Kr(this,e)}}function Yr(e){return function(){qr(this,e)}}function Xr(e,t){return function(){(t.apply(this,arguments)?Kr:qr)(this,e)}}function Zr(e,t){var n=Ur(e+``);if(arguments.length<2){for(var r=Wr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Xr:t?Jr:Yr)(n,t))}function Qr(){this.textContent=``}function $r(e){return function(){this.textContent=e}}function ei(e){return function(){this.textContent=e.apply(this,arguments)??``}}function ti(e){return arguments.length?this.each(e==null?Qr:(typeof e==`function`?ei:$r)(e)):this.node().textContent}function ni(){this.innerHTML=``}function ri(e){return function(){this.innerHTML=e}}function ii(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function ai(e){return arguments.length?this.each(e==null?ni:(typeof e==`function`?ii:ri)(e)):this.node().innerHTML}function oi(){this.nextSibling&&this.parentNode.appendChild(this)}function si(){return this.each(oi)}function ci(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function li(){return this.each(ci)}function ui(e){var t=typeof e==`function`?e:zn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function di(){return null}function fi(e,t){var n=typeof e==`function`?e:zn(e),r=t==null?di:typeof t==`function`?t:Vn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function pi(){var e=this.parentNode;e&&e.removeChild(this)}function mi(){return this.each(pi)}function hi(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gi(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _i(e){return this.select(e?gi:hi)}function vi(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function yi(e){return function(t){e.call(this,t,this.__data__)}}function bi(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function xi(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function Si(e,t,n){return function(){var r=this.__on,i,a=yi(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Ci(e,t,n){var r=bi(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?Si:xi,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function wi(e,t,n){var r=Nr(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Ti(e,t){return function(){return wi(this,e,t)}}function Ei(e,t){return function(){return wi(this,e,t.apply(this,arguments))}}function Di(e,t){return this.each((typeof t==`function`?Ei:Ti)(e,t))}function*Oi(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var ki=[null];function V(e,t){this._groups=e,this._parents=t}function Ai(){return new V([[document.documentElement]],ki)}function ji(){return this}V.prototype=Ai.prototype={constructor:V,select:Hn,selectAll:qn,selectChild:$n,selectChildren:rr,filter:ir,data:fr,enter:or,exit:mr,join:hr,merge:gr,selection:ji,order:_r,sort:vr,call:br,nodes:xr,node:Sr,size:Cr,empty:wr,each:Tr,attr:Mr,style:Lr,property:Hr,classed:Zr,text:ti,html:ai,raise:si,lower:li,append:ui,insert:fi,remove:mi,clone:_i,datum:vi,on:Ci,dispatch:Di,[Symbol.iterator]:Oi};var Mi=Ai;function H(e){return typeof e==`string`?new V([[document.querySelector(e)]],[document.documentElement]):new V([[e]],ki)}function Ni(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pi(e,t){if(e=Ni(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var Fi={value:()=>{}};function Ii(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new Li(n)}function Li(e){this._=e}function Ri(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}Li.prototype=Ii.prototype={constructor:Li,on:function(e,t){var n=this._,r=Ri(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=zi(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Bi(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Bi(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Li(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function zi(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Bi(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Fi,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Vi=Ii;let Hi={capture:!0,passive:!1};function Ui(e){e.preventDefault(),e.stopImmediatePropagation()}function Wi(e){var t=e.document.documentElement,n=H(e).on(`dragstart.drag`,Ui,Hi);`onselectstart`in t?n.on(`selectstart.drag`,Ui,Hi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function Gi(e,t){var n=e.document.documentElement,r=H(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,Ui,Hi),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Ki(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qi(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ji(){}var Yi=.7,Xi=1/Yi,Zi=`\\s*([+-]?\\d+)\\s*`,Qi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,U=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,$i=/^#([0-9a-f]{3,8})$/,ea=RegExp(`^rgb\\(${Zi},${Zi},${Zi}\\)$`),ta=RegExp(`^rgb\\(${U},${U},${U}\\)$`),na=RegExp(`^rgba\\(${Zi},${Zi},${Zi},${Qi}\\)$`),ra=RegExp(`^rgba\\(${U},${U},${U},${Qi}\\)$`),ia=RegExp(`^hsl\\(${Qi},${U},${U}\\)$`),aa=RegExp(`^hsla\\(${Qi},${U},${U},${Qi}\\)$`),oa={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};Ki(Ji,da,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sa,formatHex:sa,formatHex8:ca,formatHsl:la,formatRgb:ua,toString:ua});function sa(){return this.rgb().formatHex()}function ca(){return this.rgb().formatHex8()}function la(){return Ca(this).formatHsl()}function ua(){return this.rgb().formatRgb()}function da(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=$i.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?fa(t):n===3?new W(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?pa(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?pa(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ea.exec(e))?new W(t[1],t[2],t[3],1):(t=ta.exec(e))?new W(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=na.exec(e))?pa(t[1],t[2],t[3],t[4]):(t=ra.exec(e))?pa(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ia.exec(e))?Sa(t[1],t[2]/100,t[3]/100,1):(t=aa.exec(e))?Sa(t[1],t[2]/100,t[3]/100,t[4]):oa.hasOwnProperty(e)?fa(oa[e]):e===`transparent`?new W(NaN,NaN,NaN,0):null}function fa(e){return new W(e>>16&255,e>>8&255,e&255,1)}function pa(e,t,n,r){return r<=0&&(e=t=n=NaN),new W(e,t,n,r)}function ma(e){return e instanceof Ji||(e=da(e)),e?(e=e.rgb(),new W(e.r,e.g,e.b,e.opacity)):new W}function ha(e,t,n,r){return arguments.length===1?ma(e):new W(e,t,n,r??1)}function W(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ki(W,ha,qi(Ji,{brighter(e){return e=e==null?Xi:Xi**+e,new W(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Yi:Yi**+e,new W(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new W(ba(this.r),ba(this.g),ba(this.b),ya(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:ga,formatHex:ga,formatHex8:_a,formatRgb:va,toString:va}));function ga(){return`#${xa(this.r)}${xa(this.g)}${xa(this.b)}`}function _a(){return`#${xa(this.r)}${xa(this.g)}${xa(this.b)}${xa((isNaN(this.opacity)?1:this.opacity)*255)}`}function va(){let e=ya(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ba(this.r)}, ${ba(this.g)}, ${ba(this.b)}${e===1?`)`:`, ${e})`}`}function ya(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ba(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xa(e){return e=ba(e),(e<16?`0`:``)+e.toString(16)}function Sa(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new G(e,t,n,r)}function Ca(e){if(e instanceof G)return new G(e.h,e.s,e.l,e.opacity);if(e instanceof Ji||(e=da(e)),!e)return new G;if(e instanceof G)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new G(o,s,c,e.opacity)}function wa(e,t,n,r){return arguments.length===1?Ca(e):new G(e,t,n,r??1)}function G(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ki(G,wa,qi(Ji,{brighter(e){return e=e==null?Xi:Xi**+e,new G(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Yi:Yi**+e,new G(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new W(Da(e>=240?e-240:e+120,i,r),Da(e,i,r),Da(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new G(Ta(this.h),Ea(this.s),Ea(this.l),ya(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(){let e=ya(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ta(this.h)}, ${Ea(this.s)*100}%, ${Ea(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ta(e){return e=(e||0)%360,e<0?e+360:e}function Ea(e){return Math.max(0,Math.min(1,e||0))}function Da(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Oa=e=>()=>e;function ka(e,t){return function(n){return e+n*t}}function Aa(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ja(e){return(e=+e)==1?Ma:function(t,n){return n-t?Aa(t,n,e):Oa(isNaN(t)?n:t)}}function Ma(e,t){var n=t-e;return n?ka(e,n):Oa(isNaN(e)?t:e)}var Na=(function e(t){var n=ja(t);function r(e,t){var r=n((e=ha(e)).r,(t=ha(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Ma(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function K(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Pa=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Fa=new RegExp(Pa.source,`g`);function Ia(e){return function(){return e}}function La(e){return function(t){return e(t)+``}}function Ra(e,t){var n=Pa.lastIndex=Fa.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Pa.exec(e))&&(i=Fa.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:K(r,i)})),n=Fa.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?La(c[0].x):Ia(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var za=180/Math.PI,Ba={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Va(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*za,skewX:Math.atan(c)*za,scaleX:o,scaleY:s}}var Ha;function Ua(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?Ba:Va(t.a,t.b,t.c,t.d,t.e,t.f)}function Wa(e){return e==null||(Ha||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),Ha.setAttribute(`transform`,e),!(e=Ha.transform.baseVal.consolidate()))?Ba:(e=e.matrix,Va(e.a,e.b,e.c,e.d,e.e,e.f))}function Ga(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:K(e,i)},{i:c-2,x:K(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:K(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:K(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:K(e,n)},{i:s-2,x:K(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var Ka=Ga(Ua,`px, `,`px)`,`deg)`),qa=Ga(Wa,`, `,`)`,`)`),Ja=1e-12;function Ya(e){return((e=Math.exp(e))+1/e)/2}function Xa(e){return((e=Math.exp(e))-1/e)/2}function Za(e){return((e=Math.exp(2*e))-1)/(e+1)}var Qa=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<Ja)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=Ya(y),c=s/(n*g)*(i*Za(t*r+y)-Xa(y));return[a+c*d,o+c*f,s*i/Ya(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),$a=0,eo=0,to=0,no=1e3,ro,io,ao=0,oo=0,so=0,co=typeof performance==`object`&&performance.now?performance:Date,lo=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function uo(){return oo||=(lo(fo),co.now()+so)}function fo(){oo=0}function po(){this._call=this._time=this._next=null}po.prototype=mo.prototype={constructor:po,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?uo():+n)+(t==null?0:+t),!this._next&&io!==this&&(io?io._next=this:ro=this,io=this),this._call=e,this._time=n,yo()},stop:function(){this._call&&(this._call=null,this._time=1/0,yo())}};function mo(e,t,n){var r=new po;return r.restart(e,t,n),r}function ho(){uo(),++$a;for(var e=ro,t;e;)(t=oo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$a}function go(){oo=(ao=co.now())+so,$a=eo=0;try{ho()}finally{$a=0,vo(),oo=0}}function _o(){var e=co.now(),t=e-ao;t>no&&(so-=t,ao=e)}function vo(){for(var e,t=ro,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:ro=n);io=e,yo(r)}function yo(e){$a||(eo&&=clearTimeout(eo),e-oo>24?(e<1/0&&(eo=setTimeout(go,e-co.now()-so)),to&&=clearInterval(to)):(to||=(ao=co.now(),setInterval(_o,no)),$a=1,lo(go)))}function bo(e,t,n){var r=new po;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var xo=Vi(`start`,`end`,`cancel`,`interrupt`),So=[],Co=0,wo=1,To=2,Eo=3,Do=4,Oo=5,ko=6;function Ao(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Mo(e,n,{name:t,index:r,group:i,on:xo,tween:So,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Co})}function jo(e,t){var n=J(e,t);if(n.state>Co)throw Error(`too late; already scheduled`);return n}function q(e,t){var n=J(e,t);if(n.state>Eo)throw Error(`too late; already running`);return n}function J(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Mo(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=mo(a,0,n.time);function a(e){n.state=wo,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==wo)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===Eo)return bo(o);f.state===Do?(f.state=ko,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=ko,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(bo(function(){n.state===Eo&&(n.state=Do,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=To,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===To){for(n.state=Eo,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=Oo,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===Oo&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=ko,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function No(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>To&&r.state<Oo,r.state=ko,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Po(e){return this.each(function(){No(this,e)})}function Fo(e,t){var n,r;return function(){var i=q(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Io(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=q(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Lo(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=J(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Fo:Io)(n,e,t))}function Ro(e,t,n){var r=e._id;return e.each(function(){var e=q(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return J(e,r).value[t]}}function zo(e,t){var n;return(typeof t==`number`?K:t instanceof da?Na:(n=da(t))?(t=n,Na):Ra)(e,t)}function Bo(e){return function(){this.removeAttribute(e)}}function Vo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ho(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Uo(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Wo(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Go(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ko(e,t){var n=In(e),r=n===`transform`?qa:zo;return this.attrTween(e,typeof t==`function`?(n.local?Go:Wo)(n,r,Ro(this,`attr.`+e,t)):t==null?(n.local?Vo:Bo)(n):(n.local?Uo:Ho)(n,r,t))}function qo(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Jo(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Jo(e,i)),n}return i._value=t,i}function Xo(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&qo(e,i)),n}return i._value=t,i}function Zo(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=In(e);return this.tween(n,(r.local?Yo:Xo)(r,t))}function Qo(e,t){return function(){jo(this,e).delay=+t.apply(this,arguments)}}function $o(e,t){return t=+t,function(){jo(this,e).delay=t}}function es(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Qo:$o)(t,e)):J(this.node(),t).delay}function ts(e,t){return function(){q(this,e).duration=+t.apply(this,arguments)}}function ns(e,t){return t=+t,function(){q(this,e).duration=t}}function rs(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ts:ns)(t,e)):J(this.node(),t).duration}function is(e,t){if(typeof t!=`function`)throw Error();return function(){q(this,e).ease=t}}function as(e){var t=this._id;return arguments.length?this.each(is(t,e)):J(this.node(),t).ease}function os(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();q(this,e).ease=n}}function ss(e){if(typeof e!=`function`)throw Error();return this.each(os(this._id,e))}function cs(e){typeof e!=`function`&&(e=Jn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Y(r,this._parents,this._name,this._id)}function ls(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Y(o,this._parents,this._name,this._id)}function us(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function ds(e,t,n){var r,i,a=us(t)?jo:q;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function fs(e,t){var n=this._id;return arguments.length<2?J(this.node(),n).on.on(e):this.each(ds(n,e,t))}function ps(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ms(){return this.on(`end.remove`,ps(this._id))}function hs(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Vn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Ao(l[f],t,n,f,l,J(u,n)));return new Y(a,this._parents,t,n)}function gs(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Gn(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=J(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Ao(p,t,n,h,f,m);a.push(f),o.push(u)}return new Y(a,o,t,n)}var _s=Mi.prototype.constructor;function vs(){return new _s(this._groups,this._parents)}function ys(e,t){var n,r,i;return function(){var a=Rr(this,e),o=(this.style.removeProperty(e),Rr(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function bs(e){return function(){this.style.removeProperty(e)}}function xs(e,t,n){var r,i=n+``,a;return function(){var o=Rr(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Ss(e,t,n){var r,i,a;return function(){var o=Rr(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),Rr(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Cs(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=q(this,e),l=c.on,u=c.value[a]==null?s||=bs(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ws(e,t,n){var r=(e+=``)==`transform`?Ka:zo;return t==null?this.styleTween(e,ys(e,r)).on(`end.style.`+e,bs(e)):typeof t==`function`?this.styleTween(e,Ss(e,r,Ro(this,`style.`+e,t))).each(Cs(this._id,e)):this.styleTween(e,xs(e,r,t),n).on(`end.style.`+e,null)}function Ts(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Es(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Ts(e,a,n)),r}return a._value=t,a}function Ds(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Es(e,t,n??``))}function Os(e){return function(){this.textContent=e}}function ks(e){return function(){this.textContent=e(this)??``}}function As(e){return this.tween(`text`,typeof e==`function`?ks(Ro(this,`text`,e)):Os(e==null?``:e+``))}function js(e){return function(t){this.textContent=e.call(this,t)}}function Ms(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&js(r)),t}return r._value=e,r}function Ns(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Ms(e))}function Ps(){for(var e=this._name,t=this._id,n=Rs(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=J(c,t);Ao(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Y(r,this._parents,e,n)}function Fs(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=q(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Is=0;function Y(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Ls(e){return Mi().transition(e)}function Rs(){return++Is}var X=Mi.prototype;Y.prototype=Ls.prototype={constructor:Y,select:hs,selectAll:gs,selectChild:X.selectChild,selectChildren:X.selectChildren,filter:cs,merge:ls,selection:vs,transition:Ps,call:X.call,nodes:X.nodes,node:X.node,size:X.size,empty:X.empty,each:X.each,on:fs,attr:Ko,attrTween:Zo,style:ws,styleTween:Ds,text:As,textTween:Ns,remove:ms,tween:Lo,delay:es,duration:rs,ease:as,easeVarying:ss,end:Fs,[Symbol.iterator]:X[Symbol.iterator]};function zs(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bs={time:null,delay:0,duration:250,ease:zs};function Vs(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Hs(e){var t,n;e instanceof Y?(t=e._id,e=e._name):(t=Rs(),(n=Bs).time=uo(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Ao(c,e,t,l,o,n||Vs(c,t));return new Y(r,this._parents,e,t)}Mi.prototype.interrupt=Po,Mi.prototype.transition=Hs;var Us=e=>()=>e;function Ws(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Z(e,t,n){this.k=e,this.x=t,this.y=n}Z.prototype={constructor:Z,scale:function(e){return e===1?this:new Z(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Z(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Gs=new Z(1,0,0);Ks.prototype=Z.prototype;function Ks(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Gs;return e.__zoom}function qs(e){e.stopImmediatePropagation()}function Js(e){e.preventDefault(),e.stopImmediatePropagation()}function Ys(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Xs(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Zs(){return this.__zoom||Gs}function Qs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $s(){return navigator.maxTouchPoints||`ontouchstart`in this}function ec(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function tc(){var e=Ys,t=Xs,n=ec,r=Qs,i=$s,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Qa,l=Vi(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Zs).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Zs),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Gs.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Z(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Z(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Z(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=H(this.that).datum();l.call(e,this.that,new Ws(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=Pi(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],No(this),s.start();Js(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=H(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=Pi(t,i),l=t.clientX,u=t.clientY;Wi(t.view),qs(t),a.mouse=[c,this.__zoom.invert(c)],No(this),a.start();function d(e){if(Js(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=Pi(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),Gi(e.view,a.moved),Js(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=Pi(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Js(r),s>0?H(this).transition().duration(s).call(x,d,c,r):H(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(qs(t),s=0;s<i;++s)c=r[s],l=Pi(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),No(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Js(e),s=0;s<a;++s)c=i[s],l=Pi(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(qs(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=Pi(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=H(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Us(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Us(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Us(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Us([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}function nc(e){return typeof e==`string`}function rc(e){return e!==`undefined`}let ic=e=>typeof e==`object`&&!!e;function ac(e){return typeof Element<`u`&&e instanceof Element}let Q=e=>Number.isFinite(e);function oc(e){return nc(e)||Q(e)}function sc(e){return typeof e==`function`}function cc(e,t,n){return`translate(${e}, ${t}) scale(${n??1})`}function lc(e){return e?e instanceof SVGSVGElement?e:e.closest(`svg`):null}function uc(){}function dc(e,t){if(t)for(let n of Object.keys(t)){let r=t[n];if(!rc(r))continue;let i=e[n];if(!sc(i))continue;let a=Array.isArray(r)?r:[r];i.apply(e,a)}}let fc={length:30,angle:-90,margin:0};function pc({length:e=fc.length,angle:t=fc.angle,margin:n=fc.margin}={}){let r=n+e,i=[n,0],a=[r,0],o=t*Math.PI/180,s=Math.cos(o)*r,c=Math.sin(o)*r;return{lineTransform:`rotate(${t})`,lineCoordinates:[i,a],contentTransform:cc(s,c)}}function mc(e,t=`id`,n){let r=e[t];if(oc(r))return r;let i=e.properties?.[t];return oc(i)?i:n}function hc(e,t){let n=Me();return dc(n,t),e.path(n())}function gc(e){return e.path({type:`Sphere`})}function _c(e,{coordinates:t,curve:n=Cn,custom:r=!1,cartesian:i=!1,midpoint:a}){if(!i&&!r)return!e||t.length<2?void 0:e.path({type:`LineString`,coordinates:t})??void 0;let o=i?t:vc(e,t);return a&&(a[0]!==0||a[1]!==0)?xc(o,n,a):yc(o,n)}function vc(e,t){return!e||t.length<2?[]:t.map(t=>e.projection(t)).filter(e=>e!=null)}function yc(e,t){if(e.length<2)return;let n=bn();return t&&n.curve(t),n(e)??void 0}function bc(e,t=[0,0]){let[[n,r],[i,a]]=e,[o,s]=t,c=(n+i)/2,l=(r+a)/2,u=i-n,d=a-r,f=Math.hypot(u,d);if(f===0)return[c,l];let p=u/f,m=d/f,h=m,g=-p,_=o/100,v=s/100;return[c+p*f*_+h*f*v,l+m*f*_+g*f*v]}function xc(e,t,n){if(!(e.length<2))return yc(e.flatMap((t,r)=>r===0?[t]:[bc([e[r-1],t],n),t]),t)}function Sc({width:e,height:t,config:n={},projection:r}){let i=r(),{fitExtent:a,fitSize:o,fitWidth:s,fitHeight:c}=n;return a||o||s||c||i.fitExtent([[1,1],[e-1,t-1]],{type:`Sphere`}),dc(i,{precision:.2,...n}),i}function Cc(e,t){let n;if(Ec(e)){let t=Dn(e,Dc(e));n=t.type===`FeatureCollection`?t:{type:`FeatureCollection`,features:[t]}}else n=e;return t?t(n.features):n.features}function wc(e){if(Ec(e))return jn(e,Dc(e))}function Tc({width:e=600,height:t,aspectRatio:n=2/1,data:r,dataTransformer:i,projection:a=rn,projectionConfig:o}){let s=Cc(r,i),c=t||e/n,l=Sc({width:e,height:c,projection:a,config:o}),u=Lt().projection(l),d=wc(r);return{width:e,height:c,projection:l,features:s,path:u,renderMesh:()=>d?u(d):null}}function Ec(e){return e?.type===`Topology`}function Dc(e){let t=Object.keys(e.objects)[0];return e.objects[t]}function Oc(e,t){return t?.[e]??t?.default}function kc(e,t=!1){let n=`default`,r=!1,i=!1,a=!1,o=null,s=uc,c=()=>a?`active`:i?`focus`:r?`hover`:`default`,l=t=>n===t?n:(n=t,e?.(n),n),u=()=>l(c()),d=()=>{a=!1,o=null,s(),s=uc},f=()=>{t&&(s(),s=Nc(`mouseup`,()=>(r=Mc(o),d(),u())))};return{onMouseenter:()=>(r=!0,u()),onMouseleave:()=>(r=!1,d(),u()),onMousedown:e=>(a=!0,o=jc(e),f(),u()),onMouseup:()=>(d(),u()),onFocus:()=>(i=!0,u()),onBlur:()=>(i=!1,d(),u()),dispose:()=>d()}}function Ac(e){return ac(e)?e:!ic(e)||!(`currentTarget`in e)?null:ac(e.currentTarget)?e.currentTarget:null}function jc(e){return Ac(e)??e??null}function Mc(e){let t=Ac(e);if(!ac(t))return!1;try{return t.matches(`:hover`)}catch{return!1}}function Nc(e,t){return typeof window>`u`?uc:(window.addEventListener(e,t,!0),()=>{window.removeEventListener(e,t,!0)})}function Pc(e,t){let n=e?.projection(t);if(n)return cc(...n)}let Fc={zoom:1,minZoom:1,maxZoom:8};function Ic(e,t={}){let n=tc();return dc(n,{scaleExtent:[[t.minZoom??Fc.minZoom,t.maxZoom??Fc.maxZoom]],translateExtent:[[[0,0],[e?.width??0,e?.height??0]]],...t.config}),t.onZoomStart&&n.on(`start`,t.onZoomStart),t.onZoom&&n.on(`zoom`,t.onZoom),t.onZoomEnd&&n.on(`end`,t.onZoomEnd),n}function Lc(e){qc(e.element,t=>{Gc(t,e)})}function Rc(e,t){!e||!t||e.setAttribute(`transform`,t.toString())}function zc(e){qc(e.element,t=>{t.call(e.behavior)})}function Bc(e,t,n={}){let{path:r,width:i,height:a}=e,o=n.minZoom??Fc.minZoom,s=n.maxZoom??Fc.maxZoom,c=n.padding??.1,[[l,u],[d,f]]=r.bounds(t),p=d-l,m=f-u;if(!(!Number.isFinite(p)||!Number.isFinite(m)||p<=0||m<=0))return{center:[(l+d)/2,(u+f)/2],zoom:Math.min(s,Math.max(o,(1-c)/Math.max(p/i,m/a)))}}function Vc(e,t){return t.invert([e.width/2,e.height/2])}function Hc(e){return Q(e)?e:Wc(e)?e.k:e?.transform?.k??1}function Uc(e,t=1){let n=Hc(e);return!Q(n)||n===0?t:1/n}function Wc(e){return!!(e&&Q(e.k)&&Q(e.x)&&Q(e.y))}function Gc(e,t){let n=Kc(e,t.transition);if(!t.center){n.call(t.behavior.scaleTo,t.zoom??Fc.zoom);return}let r=t.zoom??Fc.zoom,i=Jc(e,t.behavior),a=Yc(t.behavior,Gs.translate((i[0][0]+i[1][0])/2,(i[0][1]+i[1][1])/2).scale(r).translate(-t.center[0],-t.center[1]),i);n.call(t.behavior.transform,a)}function Kc(e,t){if(!t)return e;let n=e.transition();return Q(t.duration)&&n.duration(t.duration),Q(t.delay)&&n.delay(t.delay),t.ease&&n.ease(t.ease),n}function qc(e,t){let n=lc(e);if(n)return t(H(n))}function Jc(e,t){let n=e.node();return n?t.extent().call(n,e.datum()):[[0,0],[0,0]]}function Yc(e,t,n){return e.constrain()(t,n,e.translateExtent())}let Xc=Symbol(`MapContext`);function $(){let e=(0,t.inject)(Xc);if(!e)throw Error(`useMapContext must be used inside Map`);return e}let Zc=Symbol(`MapZoom`);function Qc(e,n,r){let i=$(),a=(0,t.computed)(()=>n.center?.[0]),o=(0,t.computed)(()=>n.center?.[1]),s=(0,t.computed)(()=>Ic(i.value,{minZoom:n.minZoom,maxZoom:n.maxZoom,config:n.config,onZoomStart:e=>r.onZoomStart?.(e),onZoom:t=>{Rc(e.value,t.transform),r.onZoom?.(t)},onZoomEnd:e=>r.onZoomEnd?.(e)})),c={center:(0,t.computed)(()=>n.center),zoom:(0,t.computed)(()=>n.zoom),minZoom:(0,t.computed)(()=>n.minZoom),maxZoom:(0,t.computed)(()=>n.maxZoom),zoomToObject:(e,t)=>{let r=Bc(i.value,e,{minZoom:n.minZoom,maxZoom:n.maxZoom});r&&t(r)}};(0,t.provide)(Zc,c);let l,u;return(0,t.onMounted)(()=>{l=(0,t.watch)(s,t=>{e.value&&zc({element:e.value,behavior:t})},{immediate:!0}),u=(0,t.watch)([a,o,()=>n.zoom,()=>n.transition,s],()=>{e.value&&Lc({element:e.value,behavior:s.value,center:n.center,zoom:n.zoom,transition:n.transition})},{immediate:!0})}),(0,t.onUnmounted)(()=>{l?.(),u?.()}),{zoomBehavior:s,zoomContext:c}}function $c(){let e=(0,t.inject)(Zc,void 0),n=(0,t.inject)(Xc,void 0);if(e)return{...e,zoomToObject:(t,r)=>{if(!n?.value)return;let i=Bc(n.value,t,{minZoom:e.minZoom.value,maxZoom:e.maxZoom.value});i&&r(i)}}}function el(e){let n=(0,t.ref)(`default`),{onMouseenter:r,onMouseleave:i,onMouseup:a,onMousedown:o,onFocus:s,onBlur:c,dispose:l}=kc(e=>{n.value=e},!!$c());return(0,t.onBeforeUnmount)(()=>{l()}),{style:(0,t.computed)(()=>Oc(n.value,(0,t.unref)(e))),onMouseenter:r,onMouseleave:i,onMousedown:o,onMouseup:a,onFocus:s,onBlur:c}}let tl=[`d`,`fill`];var nl=(0,t.defineComponent)({inheritAttrs:!1,__name:`MapLine`,props:{styles:{},coordinates:{},cartesian:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},curve:{},midpoint:{}},setup(e){let n=e,r=(0,t.useAttrs)(),i=$(),a=(0,t.computed)(()=>_c(i.value,{coordinates:n.coordinates,custom:n.custom,curve:n.curve,cartesian:n.cartesian,midpoint:n.midpoint})),o=(0,t.computed)(()=>r.name??`line`),s=(0,t.computed)(()=>r.fill??`none`),{style:c,...l}=el((0,t.toRef)(n,`styles`)),u=(0,t.computed)(()=>({...r,...l,name:o.value}));return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`path`,(0,t.mergeProps)(u.value,{d:a.value,fill:s.value,style:(0,t.unref)(c)}),null,16,tl))}});let rl=[`transform`,`name`];var il=(0,t.defineComponent)({__name:`MapMarker`,props:{name:{default:`marker`},coordinates:{},styles:{}},setup(e){let n=e,r=$(),i=(0,t.computed)(()=>Pc(r.value,n.coordinates)),{style:a,...o}=el((0,t.toRef)(n,`styles`));return(n,r)=>i.value?((0,t.openBlock)(),(0,t.createElementBlock)(`g`,(0,t.mergeProps)({key:0,transform:i.value,style:(0,t.unref)(a),name:e.name},o),[(0,t.renderSlot)(n.$slots,`default`)],16,rl)):(0,t.createCommentVNode)(`v-if`,!0)}});let al=[`transform`],ol=[`transform`];var sl=(0,t.defineComponent)({inheritAttrs:!1,__name:`MapAnnotation`,props:{coordinates:{},length:{},angle:{},margin:{},curve:{type:Function},midpoint:{},styles:{}},setup(e){let n=e,r=(0,t.computed)(()=>pc({length:n.length,angle:n.angle,margin:n.margin}));return(n,i)=>((0,t.openBlock)(),(0,t.createBlock)(il,{coordinates:e.coordinates,name:`annotation`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`g`,{transform:r.value.lineTransform},[(0,t.createVNode)(nl,(0,t.mergeProps)(n.$attrs,{coordinates:r.value.lineCoordinates,cartesian:``,curve:e.curve,midpoint:e.midpoint,styles:e.styles,fill:`none`,name:`annotation-line`}),null,16,[`coordinates`,`curve`,`midpoint`,`styles`])],8,al),(0,t.createElementVNode)(`g`,{transform:r.value.contentTransform,name:`annotation-content`},[(0,t.renderSlot)(n.$slots,`default`)],8,ol)]),_:3},8,[`coordinates`]))}});function cl(e,n){return(0,t.computed)(()=>{let r=(0,t.unref)(n);if(r)return r;let i=(0,t.unref)(e);if(i?.data)return Tc(i)})}let ll=[`viewBox`];var ul=(0,t.defineComponent)({__name:`MapBase`,props:{width:{},height:{},aspectRatio:{},projection:{type:Function},projectionConfig:{},data:{},dataTransformer:{type:Function},context:{}},setup(e){let n=e,r=cl(n,(0,t.toRef)(n,`context`)),i=(0,t.computed)(()=>{if(!r.value)throw Error(`Map requires data or context`);return r.value});return(0,t.provide)(Xc,i),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`svg`,(0,t.mergeProps)({viewBox:`0 0 ${i.value.width} ${i.value.height}`},e.$attrs,{class:`d3-map`}),[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(i.value)))],16,ll))}});let dl=[`d`];var fl=(0,t.defineComponent)({__name:`MapFeature`,props:{data:{},styles:{}},setup(e){let n=e,{style:r,...i}=el((0,t.toRef)(n,`styles`)),a=$(),o=(0,t.computed)(()=>a.value.path(n.data)??void 0);return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`path`,(0,t.mergeProps)({d:o.value,style:(0,t.unref)(r)},i,{name:`feature`}),null,16,dl))}});let pl={name:`features`};var ml=(0,t.defineComponent)({__name:`MapFeatures`,props:{idKey:{default:`id`},styles:{}},setup(e){let n=$(),r=(0,t.computed)(()=>n.value.features);return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,pl,[(0,t.renderSlot)(n.$slots,`default`,{features:r.value},()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(r.value,(n,r)=>((0,t.openBlock)(),(0,t.createBlock)(fl,{key:(0,t.unref)(mc)(n,e.idKey,r),data:n,styles:e.styles},null,8,[`data`,`styles`]))),128))])]))}});let hl=[`d`,`fill`],gl=[`d`],_l=[`d`,`stroke`];var vl=(0,t.defineComponent)({inheritAttrs:!1,__name:`MapGraticule`,props:{config:{},background:{type:[Boolean,String]},border:{type:[Boolean,String]},styles:{}},setup(e){let n=e,r=$(),i=(0,t.useAttrs)(),a=(0,t.computed)(()=>hc(r.value,n.config)??void 0),o=(0,t.computed)(()=>gc(r.value)??void 0),s=(0,t.computed)(()=>nc(n.background)?n.background:void 0),c=(0,t.computed)(()=>nc(n.border)?n.border:void 0),{style:l,...u}=el((0,t.toRef)(n,`styles`));return(n,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,null,[e.background?((0,t.openBlock)(),(0,t.createElementBlock)(`path`,{key:0,d:o.value,fill:s.value,"pointer-events":`none`,name:`background`},null,8,hl)):(0,t.createCommentVNode)(`v-if`,!0),(0,t.createElementVNode)(`path`,(0,t.mergeProps)({d:a.value,fill:`none`,style:(0,t.unref)(l)},(0,t.mergeProps)(u,(0,t.unref)(i)),{name:`graticule`}),null,16,gl),e.border?((0,t.openBlock)(),(0,t.createElementBlock)(`path`,{key:1,d:o.value,fill:`none`,stroke:c.value,"pointer-events":`none`,name:`border`},null,8,_l)):(0,t.createCommentVNode)(`v-if`,!0)]))}});let yl=[`d`];var bl=(0,t.defineComponent)({__name:`MapMesh`,props:{styles:{}},setup(e){let n=e,r=$(),i=(0,t.computed)(()=>r.value.renderMesh()??void 0),{style:a,...o}=el((0,t.toRef)(n,`styles`));return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`path`,(0,t.mergeProps)({d:i.value,fill:`none`,style:(0,t.unref)(a)},o,{name:`mesh`}),null,16,yl))}}),xl=(0,t.defineComponent)({__name:`MapZoom`,props:{center:{},zoom:{default:1},minZoom:{default:1},maxZoom:{default:8},transition:{},config:{}},emits:[`zoomStart`,`zoom`,`zoomEnd`,`update:center`,`update:zoom`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(null),s=$();function c(e,t){return!!(t&&e[0]===t[0]&&e[1]===t[1])}let{zoomBehavior:l}=Qc(o,i,{onZoomStart:e=>a(`zoomStart`,e),onZoom:e=>{let t=Vc(s.value,e.transform),n=e.transform.k;c(t,i.center)||a(`update:center`,t),n!==i.zoom&&a(`update:zoom`,n),a(`zoom`,e)},onZoomEnd:e=>a(`zoomEnd`,e)});return n({container:o,zoomBehavior:l}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`g`,{ref_key:`container`,ref:o,name:`zoom`},[(0,t.renderSlot)(e.$slots,`default`)],512))}}),Sl=r({MapAnnotation:()=>sl,MapBase:()=>ul,MapFeature:()=>fl,MapFeatures:()=>ml,MapGraticule:()=>vl,MapLine:()=>nl,MapMarker:()=>il,MapMesh:()=>bl,MapZoom:()=>xl});e.MapAnnotation=sl,e.MapBase=ul,e.MapFeature=fl,e.MapFeatures=ml,e.MapGraticule=vl,e.MapLine=nl,e.MapMarker=il,e.MapMesh=bl,e.MapZoom=xl,e.getFeatureKey=mc,e.getInverseZoomScale=Uc,e.getObjectZoomView=Bc,e.getZoomViewportCenter=Vc,e.mapContextKey=Xc,e.mapZoomKey=Zc,e.plugin={install(e){Object.entries(Sl).forEach(([t,n])=>{e.component(t,n)})}},e.useCreateMapContext=cl,e.useCreateMapZoom=Qc,e.useMapContext=$,e.useMapObject=el,e.useMapZoom=$c})(this.D3Maps=this.D3Maps||{},Vue);
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import "@d3-maps/core/index.css";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, openBlock, provide, ref, renderList, renderSlot, toRef, unref, useAttrs, watch, withCtx } from "vue";
3
- import { applyZoomGroupTransform, applyZoomTransform, createZoomBehavior, getAnnotationGeometry, getFeatureKey, getLinePath, getMarkerTransform, isString, makeMapContext, renderGraticule, renderOutline, resolveObjectStyle, setupZoom, useMapObjectEvents } from "@d3-maps/core";
1
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, inject, mergeProps, normalizeProps, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, toRef, unref, useAttrs, watch, withCtx } from "vue";
2
+ import { applyZoom, applyZoomGroupTransform, createZoomBehavior, getAnnotationGeometry, getFeatureKey, getFeatureKey as getFeatureKey$1, getInverseZoomScale, getLinePath, getMarkerTransform, getObjectZoomView, getObjectZoomView as getObjectZoomView$1, getZoomViewportCenter, getZoomViewportCenter as getZoomViewportCenter$1, isString, makeMapContext, renderGraticule, renderOutline, resolveObjectStyle, setupZoom, useMapObjectEvents } from "@d3-maps/core";
4
3
 
5
4
  //#region rolldown:runtime
6
5
  var __defProp = Object.defineProperty;
@@ -22,23 +21,107 @@ var __exportAll = (all, symbols) => {
22
21
  //#region src/hooks/useMapContext.ts
23
22
  const mapContextKey = Symbol("MapContext");
24
23
  function useMapContext() {
25
- return inject(mapContextKey);
24
+ const context = inject(mapContextKey);
25
+ if (!context) throw new Error("useMapContext must be used inside Map");
26
+ return context;
26
27
  }
27
28
 
28
29
  //#endregion
29
- //#region src/hooks/useInsideZoom.ts
30
- const insideZoomKey = Symbol("InsideZoom");
31
- function useInsideZoom() {
32
- return inject(insideZoomKey, false);
30
+ //#region src/hooks/useMapZoom.ts
31
+ const mapZoomKey = Symbol("MapZoom");
32
+ function useCreateMapZoom(container, props, eventCallbacks) {
33
+ const context = useMapContext();
34
+ const centerX = computed(() => props.center?.[0]);
35
+ const centerY = computed(() => props.center?.[1]);
36
+ const zoomBehavior = computed(() => {
37
+ return createZoomBehavior(context.value, {
38
+ minZoom: props.minZoom,
39
+ maxZoom: props.maxZoom,
40
+ config: props.config,
41
+ onZoomStart: (event) => eventCallbacks.onZoomStart?.(event),
42
+ onZoom: (event) => {
43
+ applyZoomGroupTransform(container.value, event.transform);
44
+ eventCallbacks.onZoom?.(event);
45
+ },
46
+ onZoomEnd: (event) => eventCallbacks.onZoomEnd?.(event)
47
+ });
48
+ });
49
+ const zoomContext = {
50
+ center: computed(() => props.center),
51
+ zoom: computed(() => props.zoom),
52
+ minZoom: computed(() => props.minZoom),
53
+ maxZoom: computed(() => props.maxZoom),
54
+ zoomToObject: (object, callback) => {
55
+ const view = getObjectZoomView$1(context.value, object, {
56
+ minZoom: props.minZoom,
57
+ maxZoom: props.maxZoom
58
+ });
59
+ if (!view) return;
60
+ callback(view);
61
+ }
62
+ };
63
+ provide(mapZoomKey, zoomContext);
64
+ let stopBehaviorWatch;
65
+ let stopViewWatch;
66
+ onMounted(() => {
67
+ stopBehaviorWatch = watch(zoomBehavior, (behavior) => {
68
+ if (!container.value) return;
69
+ setupZoom({
70
+ element: container.value,
71
+ behavior
72
+ });
73
+ }, { immediate: true });
74
+ stopViewWatch = watch([
75
+ centerX,
76
+ centerY,
77
+ () => props.zoom,
78
+ () => props.transition,
79
+ zoomBehavior
80
+ ], () => {
81
+ if (!container.value) return;
82
+ applyZoom({
83
+ element: container.value,
84
+ behavior: zoomBehavior.value,
85
+ center: props.center,
86
+ zoom: props.zoom,
87
+ transition: props.transition
88
+ });
89
+ }, { immediate: true });
90
+ });
91
+ onUnmounted(() => {
92
+ stopBehaviorWatch?.();
93
+ stopViewWatch?.();
94
+ });
95
+ return {
96
+ zoomBehavior,
97
+ zoomContext
98
+ };
99
+ }
100
+ function useMapZoom() {
101
+ const zoomContext = inject(mapZoomKey, void 0);
102
+ const mapContext = inject(mapContextKey, void 0);
103
+ if (!zoomContext) return void 0;
104
+ return {
105
+ ...zoomContext,
106
+ zoomToObject: (object, callback) => {
107
+ if (!mapContext?.value) return;
108
+ const view = getObjectZoomView$1(mapContext.value, object, {
109
+ minZoom: zoomContext.minZoom.value,
110
+ maxZoom: zoomContext.maxZoom.value
111
+ });
112
+ if (!view) return;
113
+ callback(view);
114
+ }
115
+ };
33
116
  }
34
117
 
35
118
  //#endregion
36
119
  //#region src/hooks/useMapObject.ts
37
120
  function useMapObject(styles) {
38
121
  const state = ref("default");
39
- const { onMouseenter, onMouseleave, onMouseup, onMousedown, dispose } = useMapObjectEvents((nextState) => {
122
+ const { onMouseenter, onMouseleave, onMouseup, onMousedown, onFocus, onBlur, dispose } = useMapObjectEvents((nextState) => {
40
123
  state.value = nextState;
41
- }, useInsideZoom());
124
+ }, Boolean(useMapZoom()));
42
125
  onBeforeUnmount(() => {
43
126
  dispose();
44
127
  });
@@ -47,17 +130,20 @@ function useMapObject(styles) {
47
130
  onMouseenter,
48
131
  onMouseleave,
49
132
  onMousedown,
50
- onMouseup
133
+ onMouseup,
134
+ onFocus,
135
+ onBlur
51
136
  };
52
137
  }
53
138
 
54
139
  //#endregion
55
140
  //#region src/components/MapLine.vue?vue&type=script&setup=true&lang.ts
56
- const _hoisted_1$7 = ["d"];
141
+ const _hoisted_1$7 = ["d", "fill"];
57
142
  var MapLine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
58
143
  inheritAttrs: false,
59
144
  __name: "MapLine",
60
145
  props: {
146
+ styles: {},
61
147
  coordinates: {},
62
148
  cartesian: {
63
149
  type: Boolean,
@@ -68,15 +154,14 @@ var MapLine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
68
154
  default: false
69
155
  },
70
156
  curve: {},
71
- midpoint: {},
72
- styles: {}
157
+ midpoint: {}
73
158
  },
74
159
  setup(__props) {
75
160
  const props = __props;
76
161
  const attrs = useAttrs();
77
162
  const context = useMapContext();
78
163
  const path = computed(() => {
79
- return getLinePath(context?.value, {
164
+ return getLinePath(context.value, {
80
165
  coordinates: props.coordinates,
81
166
  custom: props.custom,
82
167
  curve: props.curve,
@@ -85,6 +170,7 @@ var MapLine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
85
170
  });
86
171
  });
87
172
  const pathName = computed(() => attrs.name ?? "line");
173
+ const fill = computed(() => attrs.fill ?? "none");
88
174
  const { style, ...events } = useMapObject(toRef(props, "styles"));
89
175
  const pathAttrs = computed(() => ({
90
176
  ...attrs,
@@ -94,7 +180,7 @@ var MapLine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
94
180
  return (_ctx, _cache) => {
95
181
  return openBlock(), createElementBlock("path", mergeProps(pathAttrs.value, {
96
182
  d: path.value,
97
- fill: "none",
183
+ fill: fill.value,
98
184
  style: unref(style)
99
185
  }), null, 16, _hoisted_1$7);
100
186
  };
@@ -118,7 +204,9 @@ var MapMarker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
118
204
  setup(__props) {
119
205
  const props = __props;
120
206
  const context = useMapContext();
121
- const transform = computed(() => getMarkerTransform(context?.value, props.coordinates));
207
+ const transform = computed(() => {
208
+ return getMarkerTransform(context.value, props.coordinates);
209
+ });
122
210
  const { style, ...events } = useMapObject(toRef(props, "styles"));
123
211
  return (_ctx, _cache) => {
124
212
  return transform.value ? (openBlock(), createElementBlock("g", mergeProps({
@@ -190,6 +278,18 @@ var MapAnnotation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
190
278
  //#region src/components/MapAnnotation.vue
191
279
  var MapAnnotation_default = MapAnnotation_vue_vue_type_script_setup_true_lang_default;
192
280
 
281
+ //#endregion
282
+ //#region src/hooks/useCreateMapContext.ts
283
+ function useCreateMapContext(config, context) {
284
+ return computed(() => {
285
+ const resolvedContext = unref(context);
286
+ if (resolvedContext) return resolvedContext;
287
+ const resolvedConfig = unref(config);
288
+ if (!resolvedConfig?.data) return void 0;
289
+ return makeMapContext(resolvedConfig);
290
+ });
291
+ }
292
+
193
293
  //#endregion
194
294
  //#region src/components/MapBase.vue?vue&type=script&setup=true&lang.ts
195
295
  const _hoisted_1$4 = ["viewBox"];
@@ -202,19 +302,16 @@ var MapBase_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
202
302
  projection: { type: Function },
203
303
  projectionConfig: {},
204
304
  data: {},
205
- dataTransformer: { type: Function }
305
+ dataTransformer: { type: Function },
306
+ context: {}
206
307
  },
207
308
  setup(__props) {
208
309
  const props = __props;
209
- const context = computed(() => makeMapContext({
210
- width: props.width,
211
- height: props.height,
212
- aspectRatio: props.aspectRatio,
213
- projection: props.projection,
214
- projectionConfig: props.projectionConfig,
215
- data: props.data,
216
- dataTransformer: props.dataTransformer
217
- }));
310
+ const unresolvedContext = useCreateMapContext(props, toRef(props, "context"));
311
+ const context = computed(() => {
312
+ if (!unresolvedContext.value) throw new Error("Map requires data or context");
313
+ return unresolvedContext.value;
314
+ });
218
315
  provide(mapContextKey, context);
219
316
  return (_ctx, _cache) => {
220
317
  return openBlock(), createElementBlock("svg", mergeProps({ viewBox: `0 0 ${context.value.width} ${context.value.height}` }, _ctx.$attrs, { class: "d3-map" }), [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(context.value)))], 16, _hoisted_1$4);
@@ -239,7 +336,7 @@ var MapFeature_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
239
336
  const props = __props;
240
337
  const { style, ...events } = useMapObject(toRef(props, "styles"));
241
338
  const context = useMapContext();
242
- const path = computed(() => context?.value.path(props.data) ?? void 0);
339
+ const path = computed(() => context.value.path(props.data) ?? void 0);
243
340
  return (_ctx, _cache) => {
244
341
  return openBlock(), createElementBlock("path", mergeProps({
245
342
  d: path.value,
@@ -264,11 +361,11 @@ var MapFeatures_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
264
361
  },
265
362
  setup(__props) {
266
363
  const context = useMapContext();
267
- const features = computed(() => context?.value.features ?? []);
364
+ const features = computed(() => context.value.features);
268
365
  return (_ctx, _cache) => {
269
366
  return openBlock(), createElementBlock("g", _hoisted_1$2, [renderSlot(_ctx.$slots, "default", { features: features.value }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(features.value, (feature, index) => {
270
367
  return openBlock(), createBlock(MapFeature_default, {
271
- key: unref(getFeatureKey)(feature, __props.idKey, index),
368
+ key: unref(getFeatureKey$1)(feature, __props.idKey, index),
272
369
  data: feature,
273
370
  styles: __props.styles
274
371
  }, null, 8, ["data", "styles"]);
@@ -300,11 +397,9 @@ var MapGraticule_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
300
397
  const context = useMapContext();
301
398
  const attrs = useAttrs();
302
399
  const graticulePath = computed(() => {
303
- if (!context?.value) return void 0;
304
400
  return renderGraticule(context.value, props.config) ?? void 0;
305
401
  });
306
402
  const outlinePath = computed(() => {
307
- if (!context?.value) return void 0;
308
403
  return renderOutline(context.value) ?? void 0;
309
404
  });
310
405
  const backgroundColor = computed(() => isString(props.background) ? props.background : void 0);
@@ -350,7 +445,7 @@ var MapMesh_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
350
445
  setup(__props) {
351
446
  const props = __props;
352
447
  const context = useMapContext();
353
- const path = computed(() => context?.value.renderMesh() ?? void 0);
448
+ const path = computed(() => context.value.renderMesh() ?? void 0);
354
449
  const { style, ...events } = useMapObject(toRef(props, "styles"));
355
450
  return (_ctx, _cache) => {
356
451
  return openBlock(), createElementBlock("path", mergeProps({
@@ -371,60 +466,38 @@ var MapMesh_default = MapMesh_vue_vue_type_script_setup_true_lang_default;
371
466
  var MapZoom_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
372
467
  __name: "MapZoom",
373
468
  props: {
374
- center: { default: () => [0, 0] },
469
+ center: {},
375
470
  zoom: { default: 1 },
376
471
  minZoom: { default: 1 },
377
472
  maxZoom: { default: 8 },
473
+ transition: {},
378
474
  config: {}
379
475
  },
380
476
  emits: [
381
- "zoomstart",
477
+ "zoomStart",
382
478
  "zoom",
383
- "zoomend"
479
+ "zoomEnd",
480
+ "update:center",
481
+ "update:zoom"
384
482
  ],
385
483
  setup(__props, { expose: __expose, emit: __emit }) {
386
484
  const props = __props;
387
485
  const emit = __emit;
388
486
  const container = ref(null);
389
487
  const context = useMapContext();
390
- provide(insideZoomKey, true);
391
- const zoomBehavior = computed(() => {
392
- return createZoomBehavior(context?.value, {
393
- minZoom: props.minZoom,
394
- maxZoom: props.maxZoom,
395
- config: props.config,
396
- onZoomStart: (event) => emit("zoomstart", event),
397
- onZoom: (event) => {
398
- applyZoomGroupTransform(container.value, event.transform);
399
- emit("zoom", event);
400
- },
401
- onZoomEnd: (event) => emit("zoomend", event)
402
- });
403
- });
404
- onMounted(() => {
405
- watch(zoomBehavior, (behavior) => {
406
- if (!container.value) return;
407
- setupZoom({
408
- element: container.value,
409
- behavior,
410
- center: props.center,
411
- zoom: props.zoom
412
- });
413
- }, { immediate: true });
414
- watch(() => [
415
- zoomBehavior.value,
416
- props.center[0],
417
- props.center[1],
418
- props.zoom
419
- ], () => {
420
- if (!container.value) return;
421
- applyZoomTransform({
422
- element: container.value,
423
- behavior: zoomBehavior.value,
424
- center: props.center,
425
- zoom: props.zoom
426
- });
427
- });
488
+ function isSameCenter(nextCenter, currentCenter) {
489
+ return Boolean(currentCenter && nextCenter[0] === currentCenter[0] && nextCenter[1] === currentCenter[1]);
490
+ }
491
+ const { zoomBehavior } = useCreateMapZoom(container, props, {
492
+ onZoomStart: (event) => emit("zoomStart", event),
493
+ onZoom: (event) => {
494
+ const nextCenter = getZoomViewportCenter$1(context.value, event.transform);
495
+ const nextZoom = event.transform.k;
496
+ if (!isSameCenter(nextCenter, props.center)) emit("update:center", nextCenter);
497
+ if (nextZoom !== props.zoom) emit("update:zoom", nextZoom);
498
+ emit("zoom", event);
499
+ },
500
+ onZoomEnd: (event) => emit("zoomEnd", event)
428
501
  });
429
502
  __expose({
430
503
  container,
@@ -470,4 +543,4 @@ const plugin = { install(app) {
470
543
  } };
471
544
 
472
545
  //#endregion
473
- export { MapAnnotation_default as MapAnnotation, MapBase_default as MapBase, MapFeature_default as MapFeature, MapFeatures_default as MapFeatures, MapGraticule_default as MapGraticule, MapLine_default as MapLine, MapMarker_default as MapMarker, MapMesh_default as MapMesh, MapZoom_default as MapZoom, mapContextKey, plugin, useMapContext, useMapObject };
546
+ export { MapAnnotation_default as MapAnnotation, MapBase_default as MapBase, MapFeature_default as MapFeature, MapFeatures_default as MapFeatures, MapGraticule_default as MapGraticule, MapLine_default as MapLine, MapMarker_default as MapMarker, MapMesh_default as MapMesh, MapZoom_default as MapZoom, getFeatureKey, getInverseZoomScale, getObjectZoomView, getZoomViewportCenter, mapContextKey, mapZoomKey, plugin, useCreateMapContext, useCreateMapZoom, useMapContext, useMapObject, useMapZoom };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d3-maps/vue",
3
3
  "type": "module",
4
- "version": "0.8.0",
4
+ "version": "0.10.0",
5
5
  "private": false,
6
6
  "description": "Vue bindings for @d3-maps/core to build reactive D3 SVG maps",
7
7
  "author": "Georgii Bukharov <souljorje@gmail.com>",
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "homepage": "https://souljorje.github.io/d3-maps",
12
+ "homepage": "https://d3-maps.netlify.app",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "https://github.com/souljorje/d3-maps.git",
@@ -28,7 +28,11 @@
28
28
  ".": {
29
29
  "types": "./dist/index.d.ts",
30
30
  "import": "./dist/index.js",
31
- "browser": "./dist/index.iife.js"
31
+ "browser": "./dist/index.iife.js",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "./index.css": {
35
+ "default": "./dist/index.css"
32
36
  }
33
37
  },
34
38
  "main": "dist/index.js",
@@ -36,6 +40,7 @@
36
40
  "browser": "dist/index.iife.js",
37
41
  "unpkg": "dist/index.iife.js",
38
42
  "jsdelivr": "dist/index.iife.js",
43
+ "style": "dist/index.css",
39
44
  "types": "dist/index.d.ts",
40
45
  "files": [
41
46
  "dist/*"
@@ -44,12 +49,9 @@
44
49
  "vue": "3.5.25"
45
50
  },
46
51
  "dependencies": {
47
- "@d3-maps/core": "0.8.0"
52
+ "@d3-maps/core": "0.10.0"
48
53
  },
49
54
  "devDependencies": {
50
- "@types/geojson": "^7946.0.16",
51
- "@types/topojson-client": "^3.1.5",
52
- "@types/topojson-specification": "^1.0.5",
53
55
  "@vitejs/plugin-vue": "^6.0.2",
54
56
  "@vue/test-utils": "^2.4.6",
55
57
  "jsdom": "^27.3.0",