@xyo-network/react-map 7.4.2 → 7.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,38 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/Components/AnimatedHeatMap.tsx
2
5
  import { useTheme } from "@mui/material";
3
6
  import { FlexCol as FlexCol2 } from "@xylabs/react-flexbox";
4
7
  import { darkenCss } from "@xylabs/react-theme";
5
- import { useState as useState5 } from "react";
8
+ import React8, { useState as useState5 } from "react";
6
9
 
7
10
  // src/Contexts/HeatMapInitializer/Provider.tsx
8
11
  import { forget as forget2 } from "@xylabs/forget";
9
- import { useEffect as useEffect4, useMemo as useMemo6 } from "react";
12
+ import React3, { useEffect as useEffect4, useMemo as useMemo6 } from "react";
10
13
 
11
14
  // src/hooks/useDynamicMapResize.tsx
12
15
  import { useEffect, useMemo } from "react";
13
- var useDynamicMapResize = (mapContainerRef, mapCanvasRef, mapInstance, active = true) => {
14
- const resizer = useMemo(
15
- () => new ResizeObserver(() => {
16
- const width = mapContainerRef.current?.getBoundingClientRect().width;
17
- if (width && mapCanvasRef.current) {
18
- mapCanvasRef.current.style.width = `${width}px`;
19
- setTimeout(() => mapInstance?.resize());
20
- }
21
- }),
22
- [mapCanvasRef, mapContainerRef, mapInstance]
23
- );
16
+ var useDynamicMapResize = /* @__PURE__ */ __name((mapContainerRef, mapCanvasRef, mapInstance, active = true) => {
17
+ const resizer = useMemo(() => new ResizeObserver(() => {
18
+ const width = mapContainerRef.current?.getBoundingClientRect().width;
19
+ if (width && mapCanvasRef.current) {
20
+ mapCanvasRef.current.style.width = `${width}px`;
21
+ setTimeout(() => mapInstance?.resize());
22
+ }
23
+ }), [
24
+ mapCanvasRef,
25
+ mapContainerRef,
26
+ mapInstance
27
+ ]);
24
28
  const dependenciesReady = useMemo(() => {
25
29
  return !!(active && mapInstance && mapContainerRef?.current && mapCanvasRef.current);
26
- }, [active, mapCanvasRef, mapContainerRef, mapInstance]);
30
+ }, [
31
+ active,
32
+ mapCanvasRef,
33
+ mapContainerRef,
34
+ mapInstance
35
+ ]);
27
36
  useEffect(() => {
28
37
  if (dependenciesReady) {
29
38
  if (mapContainerRef.current) {
@@ -33,17 +42,33 @@ var useDynamicMapResize = (mapContainerRef, mapCanvasRef, mapInstance, active =
33
42
  resizer.disconnect();
34
43
  };
35
44
  }
36
- }, [active, dependenciesReady, mapCanvasRef, mapContainerRef, mapInstance, resizer]);
37
- };
45
+ }, [
46
+ active,
47
+ dependenciesReady,
48
+ mapCanvasRef,
49
+ mapContainerRef,
50
+ mapInstance,
51
+ resizer
52
+ ]);
53
+ }, "useDynamicMapResize");
38
54
 
39
55
  // src/hooks/useDynamicPositioning.tsx
40
56
  import { useWindowSize } from "@xylabs/react-shared";
41
57
  import { useMemo as useMemo2 } from "react";
42
58
  var defaultZoom = 1.6;
43
- var defaultAspectRatioRange = [0.5, 2];
44
- var latRange = [0.9121644205263664, 1.71785031559439];
45
- var lngRange = [-81.4742014851959, 12.788958675506933];
46
- var linearInterpolate = (aspectRatio, degreeRange, aspectRatioRange) => {
59
+ var defaultAspectRatioRange = [
60
+ 0.5,
61
+ 2
62
+ ];
63
+ var latRange = [
64
+ 0.9121644205263664,
65
+ 1.71785031559439
66
+ ];
67
+ var lngRange = [
68
+ -81.4742014851959,
69
+ 12.788958675506933
70
+ ];
71
+ var linearInterpolate = /* @__PURE__ */ __name((aspectRatio, degreeRange, aspectRatioRange) => {
47
72
  const [degreeMin, degreeMax] = degreeRange;
48
73
  const [aspectRatioMin, aspectRatioMax] = aspectRatioRange || defaultAspectRatioRange;
49
74
  const aspectRatioRangeSpan = aspectRatioMax - aspectRatioMin;
@@ -51,41 +76,51 @@ var linearInterpolate = (aspectRatio, degreeRange, aspectRatioRange) => {
51
76
  const percent = (aspectRatio - aspectRatioMin) / aspectRatioRangeSpan;
52
77
  const scaledDegree = percent * degreeRangeSpan + degreeMin;
53
78
  return scaledDegree;
54
- };
55
- var useDynamicPositioning = () => {
79
+ }, "linearInterpolate");
80
+ var useDynamicPositioning = /* @__PURE__ */ __name(() => {
56
81
  const { width, height } = useWindowSize();
57
82
  const options = useMemo2(() => {
58
83
  if (width && height) {
59
84
  const aspectRatio = width / height;
60
85
  return {
61
- center: [linearInterpolate(aspectRatio, lngRange), linearInterpolate(aspectRatio, latRange)],
86
+ center: [
87
+ linearInterpolate(aspectRatio, lngRange),
88
+ linearInterpolate(aspectRatio, latRange)
89
+ ],
62
90
  zoom: defaultZoom
63
91
  };
64
92
  }
65
- }, [height, width]);
66
- return { options };
67
- };
93
+ }, [
94
+ height,
95
+ width
96
+ ]);
97
+ return {
98
+ options
99
+ };
100
+ }, "useDynamicPositioning");
68
101
 
69
102
  // src/hooks/useQuadKeyPayloadsToFeatures.tsx
70
- import { exists } from "@xylabs/exists";
71
- import { GeoJson } from "@xyo-network/sdk-geo";
103
+ import { GeoJson } from "@xylabs/geo";
104
+ import { exists } from "@xylabs/sdk-js";
72
105
  import { useMemo as useMemo3, useState } from "react";
73
- var quadKeyToFeature = ({ density, quadkey }) => {
106
+ var quadKeyToFeature = /* @__PURE__ */ __name(({ density, quadkey }) => {
74
107
  const polygonFeature = new GeoJson(quadkey).polygonFeature();
75
108
  polygonFeature.properties = {
76
109
  count: density,
77
110
  density
78
111
  };
79
112
  return polygonFeature;
80
- };
81
- var setDensity = (feature) => {
113
+ }, "quadKeyToFeature");
114
+ var setDensity = /* @__PURE__ */ __name((feature) => {
82
115
  if (feature.properties) {
83
116
  feature.properties.value = feature.properties.density / 5;
84
117
  }
85
118
  return feature;
86
- };
87
- var useQuadKeyPayloadsToFeatures = (payloads) => {
88
- const [multipleFeatureSets, setMultipleFeatureSets] = useState([[]]);
119
+ }, "setDensity");
120
+ var useQuadKeyPayloadsToFeatures = /* @__PURE__ */ __name((payloads) => {
121
+ const [multipleFeatureSets, setMultipleFeatureSets] = useState([
122
+ []
123
+ ]);
89
124
  const [features, setFeatures] = useState([]);
90
125
  const [error, setError] = useState();
91
126
  useMemo3(() => {
@@ -102,18 +137,23 @@ var useQuadKeyPayloadsToFeatures = (payloads) => {
102
137
  const mappedFeatures = singlePayload.result.map(quadKeyToFeature);
103
138
  setFeatures(mappedFeatures.map(setDensity));
104
139
  }
105
- }, [payloads]);
140
+ }, [
141
+ payloads
142
+ ]);
106
143
  return {
107
144
  error,
108
145
  features,
109
146
  multipleFeatureSets
110
147
  };
111
- };
148
+ }, "useQuadKeyPayloadsToFeatures");
112
149
 
113
150
  // src/MapBoxClasses/MapBase.ts
114
- import { assertEx } from "@xylabs/assert";
115
- import { GeoJson as GeoJson2 } from "@xyo-network/sdk-geo";
151
+ import { GeoJson as GeoJson2 } from "@xylabs/geo";
152
+ import { assertEx } from "@xylabs/sdk-js";
116
153
  var MapBase = class {
154
+ static {
155
+ __name(this, "MapBase");
156
+ }
117
157
  _config;
118
158
  constructor(config) {
119
159
  this._config = {
@@ -126,10 +166,10 @@ var MapBase = class {
126
166
  return !!this._config.map;
127
167
  }
128
168
  initializeMapSource(layer) {
129
- const getSource = () => {
169
+ const getSource = /* @__PURE__ */ __name(() => {
130
170
  const featuresCollection = GeoJson2.featureCollection(this._config.features);
131
171
  return GeoJson2.featuresSource(featuresCollection);
132
- };
172
+ }, "getSource");
133
173
  const existingSource = this._config.map.getSource(layer.source);
134
174
  const source = getSource();
135
175
  if (existingSource) {
@@ -143,12 +183,14 @@ var MapBase = class {
143
183
  };
144
184
 
145
185
  // src/MapBoxClasses/MapHeat.ts
146
- import { assertEx as assertEx2 } from "@xylabs/assert";
147
- import { delay } from "@xylabs/delay";
148
186
  import { forget } from "@xylabs/forget";
149
- import { GeoJson as GeoJson3 } from "@xyo-network/sdk-geo";
187
+ import { GeoJson as GeoJson3 } from "@xylabs/geo";
188
+ import { assertEx as assertEx2, delay } from "@xylabs/sdk-js";
150
189
  import { LngLatBounds } from "mapbox-gl";
151
190
  var MapHeat = class extends MapBase {
191
+ static {
192
+ __name(this, "MapHeat");
193
+ }
152
194
  // eslint-disable-next-line sonarjs/public-static-readonly
153
195
  static animationStarted = false;
154
196
  config;
@@ -197,7 +239,7 @@ var MapHeat = class extends MapBase {
197
239
  const stepLength = frameLength / steps;
198
240
  const lowUsageColor = startColor ?? "#FFB3B3";
199
241
  const highUsageColor = endColor ?? "#FF0000";
200
- const dynamicFillColor = (factor2, initialPad2, i) => {
242
+ const dynamicFillColor = /* @__PURE__ */ __name((factor2, initialPad2, i) => {
201
243
  const sinFade = Math.sin(i / steps * Math.PI / 2);
202
244
  const cosFade = Math.cos(i / steps * Math.PI / 2);
203
245
  const divisor = factor2 + factor2 * sinFade;
@@ -205,27 +247,54 @@ var MapHeat = class extends MapBase {
205
247
  return [
206
248
  "let",
207
249
  "density",
208
- ["+", ["/", ["number", ["get", "value"]], divisor], offset],
209
- ["interpolate", ["linear"], ["var", "density"], 0, lowUsageColor, 0.5, highUsageColor]
250
+ [
251
+ "+",
252
+ [
253
+ "/",
254
+ [
255
+ "number",
256
+ [
257
+ "get",
258
+ "value"
259
+ ]
260
+ ],
261
+ divisor
262
+ ],
263
+ offset
264
+ ],
265
+ [
266
+ "interpolate",
267
+ [
268
+ "linear"
269
+ ],
270
+ [
271
+ "var",
272
+ "density"
273
+ ],
274
+ 0,
275
+ lowUsageColor,
276
+ 0.5,
277
+ highUsageColor
278
+ ]
210
279
  ];
211
- };
280
+ }, "dynamicFillColor");
212
281
  const fadedIn = layers.map((_) => false);
213
- const fadeIn = async (id, index) => {
282
+ const fadeIn = /* @__PURE__ */ __name(async (id, index) => {
214
283
  for (let i = steps; i >= 1; i--) {
215
284
  map.setPaintProperty(id, "fill-color", dynamicFillColor(factor, initialPad, i * (180 / stepLength)));
216
285
  await delay(stepLength);
217
286
  }
218
287
  fadedIn[index] = true;
219
- };
220
- const fadeOut = async (id, index) => {
288
+ }, "fadeIn");
289
+ const fadeOut = /* @__PURE__ */ __name(async (id, index) => {
221
290
  for (let i = 1; i <= steps; i++) {
222
291
  map.setPaintProperty(id, "fill-color", dynamicFillColor(factor, initialPad, i * (180 / stepLength)));
223
292
  await delay(stepLength);
224
293
  }
225
294
  fadedIn[index] = false;
226
- };
295
+ }, "fadeOut");
227
296
  let started = false;
228
- const startAnimation = async () => {
297
+ const startAnimation = /* @__PURE__ */ __name(async () => {
229
298
  assertEx2(!started, () => "Animation Already Started");
230
299
  started = true;
231
300
  while (this.animationStarted) {
@@ -247,7 +316,7 @@ var MapHeat = class extends MapBase {
247
316
  layerTick++;
248
317
  sourceTick++;
249
318
  }
250
- };
319
+ }, "startAnimation");
251
320
  await startAnimation();
252
321
  }
253
322
  static updateLayer(map, layer, source) {
@@ -261,10 +330,10 @@ var MapHeat = class extends MapBase {
261
330
  }
262
331
  // Build layers each with the same features
263
332
  initializeHeatMapSource(layers) {
264
- const getSource = (_) => {
333
+ const getSource = /* @__PURE__ */ __name((_) => {
265
334
  const featuresCollection = GeoJson3.featureCollection(this.config.features);
266
335
  return GeoJson3.featuresSource(featuresCollection);
267
- };
336
+ }, "getSource");
268
337
  for (const [index, layer] of layers.entries()) {
269
338
  const existingSource = this.config.map.getSource(layer.source);
270
339
  const source = getSource(index);
@@ -282,6 +351,9 @@ var MapHeat = class extends MapBase {
282
351
  // src/MapBoxClasses/MapPoints.ts
283
352
  import { LngLatBounds as LngLatBounds2 } from "mapbox-gl";
284
353
  var MapPoints = class extends MapBase {
354
+ static {
355
+ __name(this, "MapPoints");
356
+ }
285
357
  config;
286
358
  constructor(config) {
287
359
  super(config);
@@ -306,17 +378,20 @@ var MapPoints = class extends MapBase {
306
378
  // src/MapBoxClasses/MapSettings.ts
307
379
  import { GeolocateControl, NavigationControl } from "mapbox-gl";
308
380
  var MapSettings = class _MapSettings {
381
+ static {
382
+ __name(this, "MapSettings");
383
+ }
309
384
  // eslint-disable-next-line sonarjs/public-static-readonly
310
385
  static geoLocateControl;
311
386
  // eslint-disable-next-line sonarjs/public-static-readonly
312
387
  static mapListeners = {
313
- logData: (ev, map) => {
388
+ logData: /* @__PURE__ */ __name((ev, map) => {
314
389
  const target = map || ev?.target;
315
390
  if (target) {
316
391
  console.log("zoom", target.getZoom());
317
392
  console.log("center", target.getCenter());
318
393
  }
319
- }
394
+ }, "logData")
320
395
  };
321
396
  // eslint-disable-next-line sonarjs/public-static-readonly
322
397
  static navControl;
@@ -342,7 +417,11 @@ var MapSettings = class _MapSettings {
342
417
  return this;
343
418
  }
344
419
  static toggleDebugLogging(value, map) {
345
- const debugEvents = ["resize", "zoomend", "dragend"];
420
+ const debugEvents = [
421
+ "resize",
422
+ "zoomend",
423
+ "dragend"
424
+ ];
346
425
  if (value) {
347
426
  this.mapListeners.logData(void 0, map);
348
427
  for (const event of debugEvents) map.on(event, this.mapListeners.logData);
@@ -359,29 +438,24 @@ var MapSettings = class _MapSettings {
359
438
  return this;
360
439
  }
361
440
  static updateSettings(config) {
362
- const {
363
- settings,
364
- map,
365
- zoom,
366
- requestLocation,
367
- debugLayerName = ""
368
- } = config;
369
- const {
370
- scrollToZoom: scrollToZoom2,
371
- enableControls,
372
- debugLayer: debugLayer2,
373
- debugLogging
374
- } = settings;
441
+ const { settings, map, zoom, requestLocation, debugLayerName = "" } = config;
442
+ const { scrollToZoom: scrollToZoom2, enableControls, debugLayer: debugLayer2, debugLogging } = settings;
375
443
  _MapSettings.toggleControls(enableControls?.value, map, zoom, requestLocation).toggleScrollToZoom(scrollToZoom2?.value, map).toggleDebugLayer(debugLayer2?.value, map, debugLayerName).toggleDebugLogging(debugLogging.value, map);
376
444
  }
377
445
  // Needs to be static so we ensure controls are only instantiated once
378
446
  static addControls(map, zoom, requestLocation) {
379
447
  const geolocateControl = new GeolocateControl({
380
- fitBoundsOptions: { zoom: zoom || 2 },
381
- positionOptions: { enableHighAccuracy: true },
448
+ fitBoundsOptions: {
449
+ zoom: zoom || 2
450
+ },
451
+ positionOptions: {
452
+ enableHighAccuracy: true
453
+ },
382
454
  trackUserLocation: true
383
455
  });
384
- const navControl = new NavigationControl({ showCompass: false });
456
+ const navControl = new NavigationControl({
457
+ showCompass: false
458
+ });
385
459
  this.geoLocateControl = this.geoLocateControl || geolocateControl;
386
460
  this.navControl = this.navControl || navControl;
387
461
  if (!map.hasControl(this.geoLocateControl) && requestLocation) {
@@ -404,71 +478,68 @@ var MapSettings = class _MapSettings {
404
478
  };
405
479
 
406
480
  // src/Contexts/MapBoxInstance/Provider.tsx
407
- import {
408
- useEffect as useEffect2,
409
- useMemo as useMemo4,
410
- useState as useState2
411
- } from "react";
481
+ import React, { useEffect as useEffect2, useMemo as useMemo4, useState as useState2 } from "react";
412
482
 
413
483
  // src/Contexts/MapBoxInstance/Context.ts
414
484
  import { createContext } from "react";
415
485
  var MapBoxInstanceContext = createContext({});
416
486
 
417
487
  // src/Contexts/MapBoxInstance/Provider.tsx
418
- import { jsx } from "react/jsx-runtime";
419
- var MapBoxInstanceProvider = ({ children }) => {
488
+ var MapBoxInstanceProvider = /* @__PURE__ */ __name(({ children }) => {
420
489
  const [map, setMapBoxInstance] = useState2();
421
490
  const [mapInitialized, setMapInitialized] = useState2(false);
422
491
  const value = useMemo4(() => ({
423
492
  map,
424
493
  mapInitialized,
425
494
  setMapBoxInstance
426
- }), [map, mapInitialized, setMapBoxInstance]);
495
+ }), [
496
+ map,
497
+ mapInitialized,
498
+ setMapBoxInstance
499
+ ]);
427
500
  useEffect2(() => {
428
501
  if (!mapInitialized && map) {
429
502
  map?.on("load", () => {
430
503
  setMapInitialized(true);
431
504
  });
432
505
  }
433
- }, [map, mapInitialized, setMapInitialized]);
434
- return /* @__PURE__ */ jsx(MapBoxInstanceContext, { value, children });
435
- };
506
+ }, [
507
+ map,
508
+ mapInitialized,
509
+ setMapInitialized
510
+ ]);
511
+ return /* @__PURE__ */ React.createElement(MapBoxInstanceContext, {
512
+ value
513
+ }, children);
514
+ }, "MapBoxInstanceProvider");
436
515
 
437
516
  // src/Contexts/MapBoxInstance/useMapBoxInstance.tsx
438
- import { assertEx as assertEx3 } from "@xylabs/assert";
517
+ import { assertEx as assertEx3 } from "@xylabs/sdk-js";
439
518
  import { use } from "react";
440
- var useMapBoxInstance = () => {
519
+ var useMapBoxInstance = /* @__PURE__ */ __name(() => {
441
520
  const context = use(MapBoxInstanceContext);
442
521
  assertEx3("map" in context, () => "useMapBoxInstance must be used within a MapBoxInstanceContext");
443
522
  return context;
444
- };
523
+ }, "useMapBoxInstance");
445
524
 
446
525
  // src/Contexts/MapSettings/Provider.tsx
447
- import {
448
- useEffect as useEffect3,
449
- useMemo as useMemo5,
450
- useState as useState3
451
- } from "react";
526
+ import React2, { useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
452
527
 
453
528
  // src/Contexts/MapSettings/Context.ts
454
529
  import { createContext as createContext2 } from "react";
455
530
  var MapSettingsContext = createContext2({});
456
531
 
457
532
  // src/Contexts/MapSettings/Provider.tsx
458
- import { jsx as jsx2 } from "react/jsx-runtime";
459
- var MapSettingsProvider = ({
460
- children,
461
- debugLayerName,
462
- defaultMapSettings,
463
- requestLocation,
464
- zoom = 1
465
- }) => {
533
+ var MapSettingsProvider = /* @__PURE__ */ __name(({ children, debugLayerName, defaultMapSettings, requestLocation, zoom = 1 }) => {
466
534
  const [mapSettings, setMapSettings] = useState3(defaultMapSettings || {});
467
535
  const { map, mapInitialized } = useMapBoxInstance();
468
536
  const value = useMemo5(() => ({
469
537
  mapSettings,
470
538
  setMapSettings
471
- }), [mapSettings, setMapSettings]);
539
+ }), [
540
+ mapSettings,
541
+ setMapSettings
542
+ ]);
472
543
  useEffect3(() => {
473
544
  if (mapSettings && map && mapInitialized) {
474
545
  MapSettings.updateSettings({
@@ -479,33 +550,32 @@ var MapSettingsProvider = ({
479
550
  zoom
480
551
  });
481
552
  }
482
- }, [debugLayerName, map, mapInitialized, mapSettings, requestLocation, zoom]);
483
- return /* @__PURE__ */ jsx2(MapSettingsContext, { value, children });
484
- };
553
+ }, [
554
+ debugLayerName,
555
+ map,
556
+ mapInitialized,
557
+ mapSettings,
558
+ requestLocation,
559
+ zoom
560
+ ]);
561
+ return /* @__PURE__ */ React2.createElement(MapSettingsContext, {
562
+ value
563
+ }, children);
564
+ }, "MapSettingsProvider");
485
565
 
486
566
  // src/Contexts/MapSettings/useMapSettings.tsx
487
567
  import { use as use2 } from "react";
488
- var useMapSettings = () => {
568
+ var useMapSettings = /* @__PURE__ */ __name(() => {
489
569
  const context = use2(MapSettingsContext);
490
570
  return context;
491
- };
571
+ }, "useMapSettings");
492
572
 
493
573
  // src/Contexts/HeatMapInitializer/Context.ts
494
574
  import { createContext as createContext3 } from "react";
495
575
  var HeatMapInitializerContext = createContext3({});
496
576
 
497
577
  // src/Contexts/HeatMapInitializer/Provider.tsx
498
- import { jsx as jsx3 } from "react/jsx-runtime";
499
- var HeatMapInitializerProvider = ({
500
- children,
501
- featureSets,
502
- featureSetsLayers,
503
- features,
504
- fitToPadding,
505
- heatMapColorProps,
506
- layers,
507
- zoom
508
- }) => {
578
+ var HeatMapInitializerProvider = /* @__PURE__ */ __name(({ children, featureSets, featureSetsLayers, features, fitToPadding, heatMapColorProps, layers, zoom }) => {
509
579
  const { options } = useDynamicPositioning();
510
580
  const { mapSettings } = useMapSettings();
511
581
  const { map, mapInitialized } = useMapBoxInstance();
@@ -515,11 +585,18 @@ var HeatMapInitializerProvider = ({
515
585
  map,
516
586
  zoom
517
587
  }) : void 0;
518
- }, [map, features, zoom]);
588
+ }, [
589
+ map,
590
+ features,
591
+ zoom
592
+ ]);
519
593
  const value = useMemo6(() => ({
520
594
  MapHeat: mapHeat,
521
595
  heatMapColorProps
522
- }), [mapHeat, heatMapColorProps]);
596
+ }), [
597
+ mapHeat,
598
+ heatMapColorProps
599
+ ]);
523
600
  useEffect4(() => {
524
601
  if (mapInitialized && featureSets?.length && featureSets[0].length > 0 && map && featureSetsLayers?.length) {
525
602
  const { lowUsageColor, highUsageColor } = heatMapColorProps;
@@ -528,94 +605,187 @@ var HeatMapInitializerProvider = ({
528
605
  return () => {
529
606
  MapHeat.animationStarted = false;
530
607
  };
531
- }, [featureSets, featureSetsLayers, mapInitialized, map, heatMapColorProps]);
608
+ }, [
609
+ featureSets,
610
+ featureSetsLayers,
611
+ mapInitialized,
612
+ map,
613
+ heatMapColorProps
614
+ ]);
532
615
  useEffect4(() => {
533
616
  if (mapHeat && mapInitialized && features?.length && layers?.length) {
534
617
  mapHeat.initializeHeatMapSource(layers);
535
618
  }
536
- }, [mapHeat, features?.length, layers, mapInitialized]);
619
+ }, [
620
+ mapHeat,
621
+ features?.length,
622
+ layers,
623
+ mapInitialized
624
+ ]);
537
625
  useEffect4(() => {
538
626
  if (mapInitialized) {
539
627
  const { fitToPoints: fitToPoints2 } = mapSettings || {};
540
628
  if (map) {
541
629
  if (fitToPoints2?.value === true) {
542
- MapHeat.initialMapPositioning(
543
- {
544
- padding: {
545
- bottom: fitToPadding,
546
- left: fitToPadding,
547
- right: fitToPadding,
548
- top: fitToPadding
549
- }
550
- },
551
- map,
552
- features
553
- );
630
+ MapHeat.initialMapPositioning({
631
+ padding: {
632
+ bottom: fitToPadding,
633
+ left: fitToPadding,
634
+ right: fitToPadding,
635
+ top: fitToPadding
636
+ }
637
+ }, map, features);
554
638
  } else if (options?.zoom && options.center) {
555
639
  map.setZoom(options.zoom);
556
640
  map.setCenter(options.center);
557
641
  }
558
642
  }
559
643
  }
560
- }, [mapHeat, map, mapSettings, fitToPadding, options, mapInitialized, features]);
561
- return /* @__PURE__ */ jsx3(HeatMapInitializerContext, { value, children });
562
- };
644
+ }, [
645
+ mapHeat,
646
+ map,
647
+ mapSettings,
648
+ fitToPadding,
649
+ options,
650
+ mapInitialized,
651
+ features
652
+ ]);
653
+ return /* @__PURE__ */ React3.createElement(HeatMapInitializerContext, {
654
+ value
655
+ }, children);
656
+ }, "HeatMapInitializerProvider");
563
657
 
564
658
  // src/Contexts/HeatMapInitializer/useHeatMapInitializer.tsx
565
- import { assertEx as assertEx4 } from "@xylabs/assert";
659
+ import { assertEx as assertEx4 } from "@xylabs/sdk-js";
566
660
  import { use as use3 } from "react";
567
- var useHeatMapInitializer = () => {
661
+ var useHeatMapInitializer = /* @__PURE__ */ __name(() => {
568
662
  const context = use3(HeatMapInitializerContext);
569
663
  assertEx4("heatMapInitialized" in context, () => "useHeatMapInitializer must be used within a HeatMapInitializerContext");
570
664
  return context;
571
- };
665
+ }, "useHeatMapInitializer");
572
666
 
573
667
  // src/Layers/Configs/HeatMapFillLayerConfig.ts
574
- var HeatMapFillLayerConfig = (color) => ({
668
+ var HeatMapFillLayerConfig = /* @__PURE__ */ __name((color) => ({
575
669
  paint: {
576
670
  "fill-color": color,
577
671
  "fill-opacity": [
578
672
  "let",
579
673
  "density",
580
- ["+", ["/", ["number", ["get", "value"]], 4], 0.125],
581
- ["interpolate", ["linear"], ["var", "density"], 0.8, ["var", "density"], 1, 0.85]
674
+ [
675
+ "+",
676
+ [
677
+ "/",
678
+ [
679
+ "number",
680
+ [
681
+ "get",
682
+ "value"
683
+ ]
684
+ ],
685
+ 4
686
+ ],
687
+ 0.125
688
+ ],
689
+ [
690
+ "interpolate",
691
+ [
692
+ "linear"
693
+ ],
694
+ [
695
+ "var",
696
+ "density"
697
+ ],
698
+ 0.8,
699
+ [
700
+ "var",
701
+ "density"
702
+ ],
703
+ 1,
704
+ 0.85
705
+ ]
582
706
  ]
583
707
  }
584
- });
708
+ }), "HeatMapFillLayerConfig");
585
709
 
586
710
  // src/Layers/Configs/HeatMapLineLayerConfig.ts
587
- var HeatMapLineLayerConfig = (color) => ({
711
+ var HeatMapLineLayerConfig = /* @__PURE__ */ __name((color) => ({
588
712
  layout: {
589
713
  // Enable for debugging
590
714
  visibility: "none"
591
715
  },
592
716
  paint: {
593
717
  "line-color": color,
594
- "line-opacity": ["let", "density", 0, ["interpolate", ["linear"], ["var", "density"], 0.8, ["var", "density"], 1, 0.85]],
718
+ "line-opacity": [
719
+ "let",
720
+ "density",
721
+ 0,
722
+ [
723
+ "interpolate",
724
+ [
725
+ "linear"
726
+ ],
727
+ [
728
+ "var",
729
+ "density"
730
+ ],
731
+ 0.8,
732
+ [
733
+ "var",
734
+ "density"
735
+ ],
736
+ 1,
737
+ 0.85
738
+ ]
739
+ ],
595
740
  "line-width": 0.5
596
741
  }
597
- });
742
+ }), "HeatMapLineLayerConfig");
598
743
 
599
744
  // src/Layers/Configs/HeatMapSymbolLayerConfig.ts
600
- var HeatMapSymbolLayerConfig = (color) => ({
745
+ var HeatMapSymbolLayerConfig = /* @__PURE__ */ __name((color) => ({
601
746
  layout: {
602
747
  "text-anchor": "center",
603
748
  "text-field": [
604
749
  "concat",
605
750
  "value: ",
606
- ["to-string", ["+", ["/", ["number", ["get", "value"]], 2], 0.25]],
751
+ [
752
+ "to-string",
753
+ [
754
+ "+",
755
+ [
756
+ "/",
757
+ [
758
+ "number",
759
+ [
760
+ "get",
761
+ "value"
762
+ ]
763
+ ],
764
+ 2
765
+ ],
766
+ 0.25
767
+ ]
768
+ ],
607
769
  "\n",
608
770
  "count: ",
609
- ["to-string", ["get", "count"]]
771
+ [
772
+ "to-string",
773
+ [
774
+ "get",
775
+ "count"
776
+ ]
777
+ ]
610
778
  ],
611
779
  "text-size": 10,
612
780
  "visibility": "none"
613
781
  },
614
- paint: { "text-color": color }
615
- });
782
+ paint: {
783
+ "text-color": color
784
+ }
785
+ }), "HeatMapSymbolLayerConfig");
616
786
 
617
787
  // src/Layers/Configs/LocationPointLayerConfig.ts
618
- var LocationPointLayerConfig = (color, circleRadius, circleOpacity) => {
788
+ var LocationPointLayerConfig = /* @__PURE__ */ __name((color, circleRadius, circleOpacity) => {
619
789
  return {
620
790
  paint: {
621
791
  "circle-color": color,
@@ -623,17 +793,23 @@ var LocationPointLayerConfig = (color, circleRadius, circleOpacity) => {
623
793
  "circle-radius": circleRadius
624
794
  }
625
795
  };
626
- };
796
+ }, "LocationPointLayerConfig");
627
797
 
628
798
  // src/Layers/FillLayer.ts
629
- import { LayerBase } from "@xyo-network/sdk-geo";
799
+ import { LayerBase } from "@xylabs/geo";
630
800
  var FillLayerBuilder = class extends LayerBase {
801
+ static {
802
+ __name(this, "FillLayerBuilder");
803
+ }
631
804
  FillLayerOptions;
632
805
  // ensures this class passes for `AnyLayer` type in MapBox
633
806
  type = "fill";
634
807
  constructor(id, source, FillLayerOptions) {
635
808
  super(id, source);
636
- this.FillLayerOptions = FillLayerOptions || { id: this.id, source: this.source };
809
+ this.FillLayerOptions = FillLayerOptions || {
810
+ id: this.id,
811
+ source: this.source
812
+ };
637
813
  }
638
814
  buildLayer() {
639
815
  return {
@@ -646,14 +822,20 @@ var FillLayerBuilder = class extends LayerBase {
646
822
  };
647
823
 
648
824
  // src/Layers/LineLayer.ts
649
- import { LayerBase as LayerBase2 } from "@xyo-network/sdk-geo";
825
+ import { LayerBase as LayerBase2 } from "@xylabs/geo";
650
826
  var LineLayerBuilder = class extends LayerBase2 {
827
+ static {
828
+ __name(this, "LineLayerBuilder");
829
+ }
651
830
  LineLayerOptions;
652
831
  // ensures this class passes for `AnyLayer` type in MapBox
653
832
  type = "line";
654
833
  constructor(id, source, LineLayerOptions) {
655
834
  super(id, source);
656
- this.LineLayerOptions = LineLayerOptions || { id: this.id, source: this.source };
835
+ this.LineLayerOptions = LineLayerOptions || {
836
+ id: this.id,
837
+ source: this.source
838
+ };
657
839
  }
658
840
  buildLayer() {
659
841
  return {
@@ -667,14 +849,20 @@ var LineLayerBuilder = class extends LayerBase2 {
667
849
  };
668
850
 
669
851
  // src/Layers/SymbolLayer.ts
670
- import { LayerBase as LayerBase3 } from "@xyo-network/sdk-geo";
852
+ import { LayerBase as LayerBase3 } from "@xylabs/geo";
671
853
  var SymbolLayerBuilder = class extends LayerBase3 {
854
+ static {
855
+ __name(this, "SymbolLayerBuilder");
856
+ }
672
857
  SymbolLayerOptions;
673
858
  // ensures this class passes for `AnyLayer` type in MapBox
674
859
  type = "symbol";
675
860
  constructor(id, source, SymbolLayerOptions) {
676
861
  super(id, source);
677
- this.SymbolLayerOptions = SymbolLayerOptions || { id: this.id, source: this.source };
862
+ this.SymbolLayerOptions = SymbolLayerOptions || {
863
+ id: this.id,
864
+ source: this.source
865
+ };
678
866
  }
679
867
  buildLayer() {
680
868
  return {
@@ -695,43 +883,43 @@ var MapHeatConstants = {
695
883
  LocationLineLayerId: "location-line-id",
696
884
  LocationLineLayerSource: "location-line-source"
697
885
  };
698
- var LocationHeatMapLayerBuilder = (color, alternateColor = "#000") => {
699
- const {
700
- LocationFillLayerId,
701
- LocationFillLayerSource,
702
- LocationLineLayerId,
703
- LocationLineLayerSource,
704
- LocationDebugLayerId,
705
- LocationDebugLayerSource
706
- } = MapHeatConstants;
886
+ var LocationHeatMapLayerBuilder = /* @__PURE__ */ __name((color, alternateColor = "#000") => {
887
+ const { LocationFillLayerId, LocationFillLayerSource, LocationLineLayerId, LocationLineLayerSource, LocationDebugLayerId, LocationDebugLayerSource } = MapHeatConstants;
707
888
  const fillLayerConfig = HeatMapFillLayerConfig(color);
708
889
  const lineLayerConfig = HeatMapLineLayerConfig(color);
709
890
  const debugLayerConfig = HeatMapSymbolLayerConfig(alternateColor);
710
891
  const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig);
711
892
  const lineLayer = new LineLayerBuilder(LocationLineLayerId, LocationLineLayerSource, lineLayerConfig);
712
893
  const debugLayer2 = new SymbolLayerBuilder(LocationDebugLayerId, LocationDebugLayerSource, debugLayerConfig);
713
- return [fillLayer, lineLayer, debugLayer2];
714
- };
894
+ return [
895
+ fillLayer,
896
+ lineLayer,
897
+ debugLayer2
898
+ ];
899
+ }, "LocationHeatMapLayerBuilder");
715
900
 
716
901
  // src/Layers/Builders/LocationHeatMapLayerBuilderAnimated.ts
717
- var MapHeatConstants2 = (index, type) => ({
902
+ var MapHeatConstants2 = /* @__PURE__ */ __name((index, type) => ({
718
903
  LocationDebugLayerId: `location-${type}-debug-id-${index}`,
719
904
  LocationDebugLayerSource: `location-${type}-debug-source-${index}`,
720
905
  LocationFillLayerId: `location-${type}-fill-id-${index}`,
721
906
  LocationFillLayerSource: `location-${type}-fill-source-${index}`,
722
907
  LocationLineLayerId: `location-${type}-line-id-${index}`,
723
908
  LocationLineLayerSource: `location-${type}-line-source-${index}`
724
- });
725
- var LocationHeatMapLayerBuilderAnimated = (color, index, type = "") => {
909
+ }), "MapHeatConstants");
910
+ var LocationHeatMapLayerBuilderAnimated = /* @__PURE__ */ __name((color, index, type = "") => {
726
911
  const { LocationFillLayerId, LocationFillLayerSource } = MapHeatConstants2(index, type);
727
912
  const fillLayerConfig = HeatMapFillLayerConfig(color);
728
913
  const fillLayer = new FillLayerBuilder(LocationFillLayerId, LocationFillLayerSource, fillLayerConfig);
729
914
  return fillLayer;
730
- };
915
+ }, "LocationHeatMapLayerBuilderAnimated");
731
916
 
732
917
  // src/Layers/CircleLayer.ts
733
- import { LayerBase as LayerBase4 } from "@xyo-network/sdk-geo";
918
+ import { LayerBase as LayerBase4 } from "@xylabs/geo";
734
919
  var CircleLayerBuilder = class extends LayerBase4 {
920
+ static {
921
+ __name(this, "CircleLayerBuilder");
922
+ }
735
923
  CircleLayerOptions;
736
924
  // ensures this class passes for `AnyLayer` type in MapBox
737
925
  type = "circle";
@@ -745,7 +933,11 @@ var CircleLayerBuilder = class extends LayerBase4 {
745
933
  }
746
934
  buildLayer() {
747
935
  return {
748
- filter: ["==", "$type", "Point"],
936
+ filter: [
937
+ "==",
938
+ "$type",
939
+ "Point"
940
+ ],
749
941
  layout: {},
750
942
  paint: {
751
943
  "circle-color": "#ff0000",
@@ -764,33 +956,25 @@ var MapPointsConstants = {
764
956
  LocationDotsLayerId: "location-dots",
765
957
  LocationDotsLayerSource: "location-dots-source"
766
958
  };
767
- var LocationPointsMapLayerBuilder = (color, circleRadius = 6, circleOpacity = 0.8) => {
959
+ var LocationPointsMapLayerBuilder = /* @__PURE__ */ __name((color, circleRadius = 6, circleOpacity = 0.8) => {
768
960
  const { LocationDotsLayerId, LocationDotsLayerSource } = MapPointsConstants;
769
961
  const dotLayerConfig = LocationPointLayerConfig(color, circleRadius, circleOpacity);
770
962
  const dotLayer = new CircleLayerBuilder(LocationDotsLayerId, LocationDotsLayerSource, dotLayerConfig);
771
- return [dotLayer];
772
- };
963
+ return [
964
+ dotLayer
965
+ ];
966
+ }, "LocationPointsMapLayerBuilder");
773
967
 
774
968
  // src/Components/MapBoxHeat.tsx
775
969
  import { FlexCol } from "@xylabs/react-flexbox";
970
+ import React7 from "react";
776
971
 
777
972
  // src/Components/MapBox.tsx
778
973
  import "mapbox-gl/dist/mapbox-gl.css";
779
974
  import { MapStyle } from "@xyo-network/react-map-model";
780
975
  import { Map } from "mapbox-gl";
781
- import {
782
- useEffect as useEffect5,
783
- useRef,
784
- useState as useState4
785
- } from "react";
786
- import { jsx as jsx4 } from "react/jsx-runtime";
787
- var MapBox = ({
788
- accessToken,
789
- darkMode = false,
790
- options,
791
- zoom = 2,
792
- ...props
793
- }) => {
976
+ import React4, { useEffect as useEffect5, useRef, useState as useState4 } from "react";
977
+ var MapBox = /* @__PURE__ */ __name(({ accessToken, darkMode = false, options, zoom = 2, ...props }) => {
794
978
  const [map, setMap] = useState4();
795
979
  const mapContainerRef = useRef(null);
796
980
  const mapCanvasRef = useRef(null);
@@ -804,11 +988,18 @@ var MapBox = ({
804
988
  } else {
805
989
  map?.setStyle(`mapbox://styles/${darkMode ? MapStyle.Dark : MapStyle.Light}`);
806
990
  }
807
- }, [map, darkMode, mapSettings]);
991
+ }, [
992
+ map,
993
+ darkMode,
994
+ mapSettings
995
+ ]);
808
996
  useEffect5(() => {
809
997
  const map2 = new Map({
810
998
  accessToken,
811
- center: [0, 0],
999
+ center: [
1000
+ 0,
1001
+ 0
1002
+ ],
812
1003
  container: mapContainerRef.current ?? "",
813
1004
  style: `mapbox://styles/${MapStyle.Light}`,
814
1005
  zoom,
@@ -822,202 +1013,201 @@ var MapBox = ({
822
1013
  console.log("Removing Map");
823
1014
  map2.remove();
824
1015
  };
825
- }, [mapContainerRef, setMap, options, zoom, setMapBoxInstance, accessToken]);
826
- return /* @__PURE__ */ jsx4(
827
- "div",
828
- {
829
- ref: (el) => {
830
- mapContainerRef.current = el;
831
- },
832
- style: {
833
- bottom: 0,
834
- left: 0,
835
- position: "absolute",
836
- right: 0,
837
- top: 0,
838
- ...props
839
- }
1016
+ }, [
1017
+ mapContainerRef,
1018
+ setMap,
1019
+ options,
1020
+ zoom,
1021
+ setMapBoxInstance,
1022
+ accessToken
1023
+ ]);
1024
+ return /* @__PURE__ */ React4.createElement("div", {
1025
+ ref: /* @__PURE__ */ __name((el) => {
1026
+ mapContainerRef.current = el;
1027
+ }, "ref"),
1028
+ style: {
1029
+ bottom: 0,
1030
+ left: 0,
1031
+ position: "absolute",
1032
+ right: 0,
1033
+ top: 0,
1034
+ ...props
840
1035
  }
841
- );
842
- };
1036
+ });
1037
+ }, "MapBox");
843
1038
 
844
1039
  // src/Components/MapSettingsComponents/Setting.tsx
845
1040
  import { FormControlLabel, Switch } from "@mui/material";
846
- import { jsx as jsx5 } from "react/jsx-runtime";
847
- var MapSettingSwitch = ({
848
- developerMode,
849
- field,
850
- ...props
851
- }) => {
1041
+ import React5 from "react";
1042
+ var MapSettingSwitch = /* @__PURE__ */ __name(({ developerMode, field, ...props }) => {
852
1043
  const { mapSettings, setMapSettings } = useMapSettings();
853
1044
  const setting = mapSettings?.[field];
854
- const onLocalChange = (event) => {
1045
+ const onLocalChange = /* @__PURE__ */ __name((event) => {
855
1046
  if (setting) {
856
1047
  setMapSettings?.((previous) => {
857
1048
  previous[setting.field].value = event.target.checked;
858
- return { ...previous };
1049
+ return {
1050
+ ...previous
1051
+ };
859
1052
  });
860
1053
  }
861
- };
1054
+ }, "onLocalChange");
862
1055
  if (setting?.devMode && developerMode === false) {
863
1056
  return null;
864
1057
  }
865
- return setting?.hidden ? null : /* @__PURE__ */ jsx5(FormControlLabel, { label: setting?.label, control: /* @__PURE__ */ jsx5(Switch, { checked: setting?.value, onChange: onLocalChange, ...props }) });
866
- };
1058
+ return setting?.hidden ? null : /* @__PURE__ */ React5.createElement(FormControlLabel, {
1059
+ label: setting?.label,
1060
+ control: /* @__PURE__ */ React5.createElement(Switch, {
1061
+ checked: setting?.value,
1062
+ onChange: onLocalChange,
1063
+ ...props
1064
+ })
1065
+ });
1066
+ }, "MapSettingSwitch");
867
1067
 
868
1068
  // src/Components/MapSettingsComponents/SettingsBox.tsx
869
1069
  import { Paper, Stack } from "@mui/material";
870
1070
  import { useAppSettings } from "@xylabs/react-app-settings";
871
1071
  import { FlexGrowRow, FlexRow } from "@xylabs/react-flexbox";
872
- import { jsx as jsx6 } from "react/jsx-runtime";
873
- var MapSettingsBox = ({ developerMode, ...props }) => {
1072
+ import React6 from "react";
1073
+ var MapSettingsBox = /* @__PURE__ */ __name(({ developerMode, ...props }) => {
874
1074
  const { mapSettings } = useMapSettings();
875
1075
  const { developerMode: devModeFromContext } = useAppSettings();
876
1076
  const resolveDeveloperMode = developerMode ?? devModeFromContext;
877
- return mapSettings && resolveDeveloperMode ? /* @__PURE__ */ jsx6(FlexGrowRow, { bottom: 36, left: 10, position: "absolute", ...props, children: /* @__PURE__ */ jsx6(FlexRow, { paddingX: 2, children: /* @__PURE__ */ jsx6(Paper, { children: /* @__PURE__ */ jsx6(Stack, { direction: "row", spacing: 1, marginX: 1, children: Object.keys(mapSettings).map((key, index) => {
878
- return /* @__PURE__ */ jsx6(MapSettingSwitch, { field: mapSettings[key].field, developerMode }, index);
879
- }) }) }) }) }) : null;
880
- };
1077
+ return mapSettings && resolveDeveloperMode ? /* @__PURE__ */ React6.createElement(FlexGrowRow, {
1078
+ bottom: 36,
1079
+ left: 10,
1080
+ position: "absolute",
1081
+ ...props
1082
+ }, /* @__PURE__ */ React6.createElement(FlexRow, {
1083
+ paddingX: 2
1084
+ }, /* @__PURE__ */ React6.createElement(Paper, null, /* @__PURE__ */ React6.createElement(Stack, {
1085
+ direction: "row",
1086
+ spacing: 1,
1087
+ marginX: 1
1088
+ }, Object.keys(mapSettings).map((key, index) => {
1089
+ return /* @__PURE__ */ React6.createElement(MapSettingSwitch, {
1090
+ key: index,
1091
+ field: mapSettings[key].field,
1092
+ developerMode
1093
+ });
1094
+ }))))) : null;
1095
+ }, "MapSettingsBox");
881
1096
 
882
1097
  // src/Components/MapBoxHeat.tsx
883
- import { jsx as jsx7, jsxs } from "react/jsx-runtime";
884
- var MapboxHeatFlexBox = ({
885
- accessToken,
886
- children,
887
- mapBoxOptions,
888
- zoom,
889
- legend,
890
- developerMode,
891
- ...props
892
- }) => {
893
- return /* @__PURE__ */ jsxs(FlexCol, { ...props, children: [
894
- /* @__PURE__ */ jsx7(MapBox, { accessToken, options: mapBoxOptions, zoom }),
895
- /* @__PURE__ */ jsx7(MapSettingsBox, { developerMode }),
896
- legend,
897
- children
898
- ] });
899
- };
1098
+ var MapboxHeatFlexBox = /* @__PURE__ */ __name(({ accessToken, children, mapBoxOptions, zoom, legend, developerMode, ...props }) => {
1099
+ return /* @__PURE__ */ React7.createElement(FlexCol, props, /* @__PURE__ */ React7.createElement(MapBox, {
1100
+ accessToken,
1101
+ options: mapBoxOptions,
1102
+ zoom
1103
+ }), /* @__PURE__ */ React7.createElement(MapSettingsBox, {
1104
+ developerMode
1105
+ }), legend, children);
1106
+ }, "MapboxHeatFlexBox");
900
1107
 
901
1108
  // src/Components/AnimatedHeatMap.tsx
902
- import { jsx as jsx8 } from "react/jsx-runtime";
903
- var AnimatedHeatMap = ({
904
- accessToken,
905
- animatedFeatureSets,
906
- defaultMapSettings,
907
- heatMapColorProps,
908
- staticFeatureSet,
909
- ...props
910
- }) => {
1109
+ var AnimatedHeatMap = /* @__PURE__ */ __name(({ accessToken, animatedFeatureSets, defaultMapSettings, heatMapColorProps, staticFeatureSet, ...props }) => {
911
1110
  const theme = useTheme();
912
- const {
913
- staticMapColor,
914
- lowUsageColor,
915
- highUsageColor
916
- } = heatMapColorProps || {};
1111
+ const { staticMapColor, lowUsageColor, highUsageColor } = heatMapColorProps || {};
917
1112
  const localStaticMapColor = staticMapColor ?? theme.vars.palette.primary.light;
918
1113
  const [layers] = useState5(() => [
919
1114
  LocationHeatMapLayerBuilderAnimated(localStaticMapColor, 0, "static"),
920
1115
  LocationHeatMapLayerBuilderAnimated(lowUsageColor || localStaticMapColor, 0, "animated"),
921
1116
  LocationHeatMapLayerBuilderAnimated(highUsageColor || darkenCss(localStaticMapColor, 0.9), 1, "animated")
922
1117
  ]);
923
- return animatedFeatureSets?.length ? /* @__PURE__ */ jsx8(MapBoxInstanceProvider, { children: /* @__PURE__ */ jsx8(MapSettingsProvider, { defaultMapSettings, debugLayerName: MapHeatConstants.LocationDebugLayerId, children: /* @__PURE__ */ jsx8(
924
- HeatMapInitializerProvider,
925
- {
926
- features: staticFeatureSet,
927
- layers: [layers[0]],
928
- featureSets: animatedFeatureSets,
929
- featureSetsLayers: layers.slice(1, 3),
930
- heatMapColorProps,
931
- children: /* @__PURE__ */ jsx8(MapboxHeatFlexBox, { accessToken, ...props })
932
- }
933
- ) }) }) : /* @__PURE__ */ jsx8(FlexCol2, { minHeight: 160, minWidth: 160, busy: true });
934
- };
1118
+ return animatedFeatureSets?.length ? /* @__PURE__ */ React8.createElement(MapBoxInstanceProvider, null, /* @__PURE__ */ React8.createElement(MapSettingsProvider, {
1119
+ defaultMapSettings,
1120
+ debugLayerName: MapHeatConstants.LocationDebugLayerId
1121
+ }, /* @__PURE__ */ React8.createElement(HeatMapInitializerProvider, {
1122
+ features: staticFeatureSet,
1123
+ layers: [
1124
+ layers[0]
1125
+ ],
1126
+ featureSets: animatedFeatureSets,
1127
+ featureSetsLayers: layers.slice(1, 3),
1128
+ heatMapColorProps
1129
+ }, /* @__PURE__ */ React8.createElement(MapboxHeatFlexBox, {
1130
+ accessToken,
1131
+ ...props
1132
+ })))) : /* @__PURE__ */ React8.createElement(FlexCol2, {
1133
+ minHeight: 160,
1134
+ minWidth: 160,
1135
+ busy: true
1136
+ });
1137
+ }, "AnimatedHeatMap");
935
1138
 
936
1139
  // src/Components/AnimatedHeatMapLoaded.tsx
937
1140
  import { Alert, AlertTitle } from "@mui/material";
938
1141
  import { FlexCol as FlexCol5 } from "@xylabs/react-flexbox";
939
1142
  import { useWeakArchivistFromNode, useWeakArchivistGet } from "@xyo-network/react-archivist";
940
- import {
941
- AnimatedHeatMapSettings,
942
- useFindHashes,
943
- useHeatMapColors
944
- } from "@xyo-network/react-map-model";
1143
+ import { AnimatedHeatMapSettings, useFindHashes, useHeatMapColors } from "@xyo-network/react-map-model";
1144
+ import React11 from "react";
945
1145
 
946
1146
  // src/Components/Legend.tsx
947
1147
  import { useMediaQuery, useTheme as useTheme3 } from "@mui/material";
948
1148
  import { FlexCol as FlexCol4 } from "@xylabs/react-flexbox";
1149
+ import React10 from "react";
949
1150
 
950
1151
  // src/Components/Legends/ColorGradient.tsx
951
1152
  import { Typography, useTheme as useTheme2 } from "@mui/material";
952
1153
  import { FlexCol as FlexCol3, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
953
- import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
954
- var ColorGradientLegend = ({
955
- startColor,
956
- endColor,
957
- startLabel,
958
- endLabel,
959
- heading,
960
- textColor,
961
- ...props
962
- }) => {
1154
+ import React9 from "react";
1155
+ var ColorGradientLegend = /* @__PURE__ */ __name(({ startColor, endColor, startLabel, endLabel, heading, textColor, ...props }) => {
963
1156
  const theme = useTheme2();
964
- return /* @__PURE__ */ jsxs2(FlexCol3, { ...props, children: [
965
- /* @__PURE__ */ jsx9(Typography, { mb: theme.spacing(0.25), color: textColor, variant: "caption", textAlign: "center", children: heading }),
966
- /* @__PURE__ */ jsx9(FlexCol3, { flexGrow: 1, alignItems: "stretch", paddingX: theme.spacing(1), mb: theme.spacing(0.25), children: /* @__PURE__ */ jsx9(
967
- FlexCol3,
968
- {
969
- height: theme.spacing(0.75),
970
- border: `1px solid ${textColor}`,
971
- sx: { backgroundImage: `linear-gradient(to right, ${startColor},${endColor})` }
972
- }
973
- ) }),
974
- /* @__PURE__ */ jsxs2(FlexRow2, { flexGrow: 1, justifyContent: "space-between", children: [
975
- /* @__PURE__ */ jsx9(Typography, { color: textColor, variant: "caption", children: startLabel }),
976
- /* @__PURE__ */ jsx9(Typography, { color: textColor, variant: "caption", children: endLabel })
977
- ] })
978
- ] });
979
- };
1157
+ return /* @__PURE__ */ React9.createElement(FlexCol3, props, /* @__PURE__ */ React9.createElement(Typography, {
1158
+ mb: theme.spacing(0.25),
1159
+ color: textColor,
1160
+ variant: "caption",
1161
+ textAlign: "center"
1162
+ }, heading), /* @__PURE__ */ React9.createElement(FlexCol3, {
1163
+ flexGrow: 1,
1164
+ alignItems: "stretch",
1165
+ paddingX: theme.spacing(1),
1166
+ mb: theme.spacing(0.25)
1167
+ }, /* @__PURE__ */ React9.createElement(FlexCol3, {
1168
+ height: theme.spacing(0.75),
1169
+ border: `1px solid ${textColor}`,
1170
+ sx: {
1171
+ backgroundImage: `linear-gradient(to right, ${startColor},${endColor})`
1172
+ }
1173
+ })), /* @__PURE__ */ React9.createElement(FlexRow2, {
1174
+ flexGrow: 1,
1175
+ justifyContent: "space-between"
1176
+ }, /* @__PURE__ */ React9.createElement(Typography, {
1177
+ color: textColor,
1178
+ variant: "caption"
1179
+ }, startLabel), /* @__PURE__ */ React9.createElement(Typography, {
1180
+ color: textColor,
1181
+ variant: "caption"
1182
+ }, endLabel)));
1183
+ }, "ColorGradientLegend");
980
1184
 
981
1185
  // src/Components/Legend.tsx
982
- import { jsx as jsx10 } from "react/jsx-runtime";
983
- var AnimatedHeatMapLegend = ({ ...legendProps }) => {
984
- const {
1186
+ var AnimatedHeatMapLegend = /* @__PURE__ */ __name(({ ...legendProps }) => {
1187
+ const { startColor, endColor, startLabel, endLabel, heading, textColor } = legendProps;
1188
+ const theme = useTheme3();
1189
+ const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
1190
+ return /* @__PURE__ */ React10.createElement(FlexCol4, {
1191
+ position: "absolute",
1192
+ bottom: 0,
1193
+ right: 0
1194
+ }, /* @__PURE__ */ React10.createElement(ColorGradientLegend, {
985
1195
  startColor,
986
1196
  endColor,
987
1197
  startLabel,
988
1198
  endLabel,
989
1199
  heading,
990
- textColor
991
- } = legendProps;
992
- const theme = useTheme3();
993
- const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
994
- return /* @__PURE__ */ jsx10(FlexCol4, { position: "absolute", bottom: 0, right: 0, children: /* @__PURE__ */ jsx10(
995
- ColorGradientLegend,
996
- {
997
- startColor,
998
- endColor,
999
- startLabel,
1000
- endLabel,
1001
- heading,
1002
- textColor,
1003
- ...{
1004
- alignItems: "stretch",
1005
- marginBottom: theme.spacing(4),
1006
- marginLeft: isSmall ? theme.spacing(3) : 0,
1007
- marginRight: isSmall ? theme.spacing(2) : theme.spacing(3),
1008
- width: isSmall ? "40vw" : theme.spacing(18)
1009
- }
1010
- }
1011
- ) });
1012
- };
1200
+ textColor,
1201
+ alignItems: "stretch",
1202
+ marginBottom: theme.spacing(4),
1203
+ marginLeft: isSmall ? theme.spacing(3) : 0,
1204
+ marginRight: isSmall ? theme.spacing(2) : theme.spacing(3),
1205
+ width: isSmall ? "40vw" : theme.spacing(18)
1206
+ }));
1207
+ }, "AnimatedHeatMapLegend");
1013
1208
 
1014
1209
  // src/Components/AnimatedHeatMapLoaded.tsx
1015
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
1016
- var AnimatedHeatMapLoaded = ({
1017
- accessToken,
1018
- archivistNameOrAddress,
1019
- ...props
1020
- }) => {
1210
+ var AnimatedHeatMapLoaded = /* @__PURE__ */ __name(({ accessToken, archivistNameOrAddress, ...props }) => {
1021
1211
  const hashes = useFindHashes();
1022
1212
  const [archivist] = useWeakArchivistFromNode(archivistNameOrAddress);
1023
1213
  const [payloads, xyoError] = useWeakArchivistGet(archivist, hashes);
@@ -1025,82 +1215,69 @@ var AnimatedHeatMapLoaded = ({
1025
1215
  const { heatMapColorProps, legendProps } = useHeatMapColors();
1026
1216
  const MapBoxHeatProps = {
1027
1217
  flexGrow: 1,
1028
- legend: legendProps ? /* @__PURE__ */ jsx11(AnimatedHeatMapLegend, { ...legendProps }) : null
1218
+ legend: legendProps ? /* @__PURE__ */ React11.createElement(AnimatedHeatMapLegend, legendProps) : null
1029
1219
  };
1030
- return /* @__PURE__ */ jsxs3(FlexCol5, { alignItems: "stretch", ...props, children: [
1031
- xyoError ? /* @__PURE__ */ jsxs3(Alert, { sx: { mt: 2 }, children: [
1032
- /* @__PURE__ */ jsx11(AlertTitle, { children: "Error Loading Map" }),
1033
- xyoError.message ? `Error: ${xyoError.message}` : null,
1034
- "You might try authenticating again."
1035
- ] }) : null,
1036
- hashes === void 0 ? /* @__PURE__ */ jsx11(Alert, { children: "Missing answer hash for heat map query" }) : /* @__PURE__ */ jsx11(
1037
- AnimatedHeatMap,
1038
- {
1039
- accessToken,
1040
- defaultMapSettings: AnimatedHeatMapSettings,
1041
- animatedFeatureSets: multipleFeatureSets.slice(1),
1042
- staticFeatureSet: multipleFeatureSets[0],
1043
- heatMapColorProps,
1044
- ...MapBoxHeatProps
1045
- }
1046
- )
1047
- ] });
1048
- };
1220
+ return /* @__PURE__ */ React11.createElement(FlexCol5, {
1221
+ alignItems: "stretch",
1222
+ ...props
1223
+ }, xyoError ? /* @__PURE__ */ React11.createElement(Alert, {
1224
+ sx: {
1225
+ mt: 2
1226
+ }
1227
+ }, /* @__PURE__ */ React11.createElement(AlertTitle, null, "Error Loading Map"), xyoError.message ? `Error: ${xyoError.message}` : null, "You might try authenticating again.") : null, hashes === void 0 ? /* @__PURE__ */ React11.createElement(Alert, null, "Missing answer hash for heat map query") : /* @__PURE__ */ React11.createElement(AnimatedHeatMap, {
1228
+ accessToken,
1229
+ defaultMapSettings: AnimatedHeatMapSettings,
1230
+ animatedFeatureSets: multipleFeatureSets.slice(1),
1231
+ staticFeatureSet: multipleFeatureSets[0],
1232
+ heatMapColorProps,
1233
+ ...MapBoxHeatProps
1234
+ }));
1235
+ }, "AnimatedHeatMapLoaded");
1049
1236
 
1050
1237
  // src/Components/HeatMapSettings.ts
1051
1238
  import { DefaultMapSettings } from "@xyo-network/react-map-model";
1052
1239
  var HeatMapSettings = DefaultMapSettings();
1053
- var {
1054
- debugLayer,
1055
- scrollToZoom,
1056
- fitToPoints
1057
- } = HeatMapSettings;
1240
+ var { debugLayer, scrollToZoom, fitToPoints } = HeatMapSettings;
1058
1241
  debugLayer.hidden = false;
1059
1242
  scrollToZoom.value = true;
1060
1243
  fitToPoints.value = true;
1061
1244
 
1062
1245
  // src/Components/LayerAnimator.tsx
1063
1246
  import { useInterval } from "@xylabs/react-shared";
1064
- import {
1065
- useCallback,
1066
- useEffect as useEffect6,
1067
- useMemo as useMemo7,
1068
- useRef as useRef2
1069
- } from "react";
1070
- import { Fragment, jsx as jsx12 } from "react/jsx-runtime";
1247
+ import React12, { useCallback, useEffect as useEffect6, useMemo as useMemo7, useRef as useRef2 } from "react";
1071
1248
  var timeIncrement = 2e3;
1072
1249
  var animatedLayerCount = 3;
1073
- var LayerAnimator = ({
1074
- animateLayers,
1075
- children,
1076
- layers,
1077
- layersInitialized,
1078
- map
1079
- }) => {
1250
+ var LayerAnimator = /* @__PURE__ */ __name(({ animateLayers, children, layers, layersInitialized, map }) => {
1080
1251
  const layerIndexQueue = useRef2([]);
1081
1252
  const fillLayers = useMemo7(() => {
1082
1253
  if (layers?.length && map && layersInitialized) {
1083
1254
  return layers.filter((layer) => {
1084
1255
  const fillLayer = layer.id.startsWith("location-fill");
1085
1256
  if (fillLayer) {
1086
- map.setPaintProperty(layer.id, "fill-opacity-transition", { delay: 0, duration: 4e3 });
1257
+ map.setPaintProperty(layer.id, "fill-opacity-transition", {
1258
+ delay: 0,
1259
+ duration: 4e3
1260
+ });
1087
1261
  }
1088
1262
  return fillLayer;
1089
1263
  });
1090
1264
  }
1091
1265
  return [];
1092
- }, [layers, layersInitialized, map]);
1093
- const incrementQueue = useCallback(
1094
- (index) => {
1095
- if (fillLayers[index]) {
1096
- layerIndexQueue.current.push(index);
1097
- } else {
1098
- layerIndexQueue.current.push(0);
1099
- }
1100
- return layerIndexQueue.current.at(-1);
1101
- },
1102
- [fillLayers]
1103
- );
1266
+ }, [
1267
+ layers,
1268
+ layersInitialized,
1269
+ map
1270
+ ]);
1271
+ const incrementQueue = useCallback((index) => {
1272
+ if (fillLayers[index]) {
1273
+ layerIndexQueue.current.push(index);
1274
+ } else {
1275
+ layerIndexQueue.current.push(0);
1276
+ }
1277
+ return layerIndexQueue.current.at(-1);
1278
+ }, [
1279
+ fillLayers
1280
+ ]);
1104
1281
  const lastQueuedIndex = useCallback(() => {
1105
1282
  const last = layerIndexQueue.current.at(-1);
1106
1283
  if (last === void 0) {
@@ -1109,7 +1286,9 @@ var LayerAnimator = ({
1109
1286
  } else {
1110
1287
  return last;
1111
1288
  }
1112
- }, [incrementQueue]);
1289
+ }, [
1290
+ incrementQueue
1291
+ ]);
1113
1292
  const unshiftQueue = useCallback(() => {
1114
1293
  layerIndexQueue.current.shift();
1115
1294
  }, []);
@@ -1117,21 +1296,25 @@ var LayerAnimator = ({
1117
1296
  const nextLayer = fillLayers[lastQueuedIndex()];
1118
1297
  incrementQueue(lastQueuedIndex() + 1);
1119
1298
  return nextLayer;
1120
- }, [fillLayers, incrementQueue, lastQueuedIndex]);
1121
- const layerAnimateWorker = useCallback(
1122
- (layer) => {
1123
- if (layer) {
1124
- map?.setPaintProperty(layer.id, "fill-opacity", 0.85);
1125
- setTimeout(() => {
1126
- map?.setPaintProperty(layer.id, "fill-opacity", 0);
1127
- unshiftQueue();
1128
- }, timeIncrement * 2);
1129
- } else {
1130
- console.warn("tried to queue an empty layer");
1131
- }
1132
- },
1133
- [map, unshiftQueue]
1134
- );
1299
+ }, [
1300
+ fillLayers,
1301
+ incrementQueue,
1302
+ lastQueuedIndex
1303
+ ]);
1304
+ const layerAnimateWorker = useCallback((layer) => {
1305
+ if (layer) {
1306
+ map?.setPaintProperty(layer.id, "fill-opacity", 0.85);
1307
+ setTimeout(() => {
1308
+ map?.setPaintProperty(layer.id, "fill-opacity", 0);
1309
+ unshiftQueue();
1310
+ }, timeIncrement * 2);
1311
+ } else {
1312
+ console.warn("tried to queue an empty layer");
1313
+ }
1314
+ }, [
1315
+ map,
1316
+ unshiftQueue
1317
+ ]);
1135
1318
  const queueLayerAnimation = useCallback(() => {
1136
1319
  const animatedLayers = [];
1137
1320
  for (let i = 0; i < animatedLayerCount; i++) {
@@ -1146,58 +1329,64 @@ var LayerAnimator = ({
1146
1329
  }, timeIncrement * index);
1147
1330
  }
1148
1331
  }
1149
- }, [getNextLayer, layerAnimateWorker]);
1332
+ }, [
1333
+ getNextLayer,
1334
+ layerAnimateWorker
1335
+ ]);
1150
1336
  useEffect6(() => {
1151
1337
  if (animateLayers && layersInitialized && map && fillLayers.length > 0) {
1152
1338
  queueLayerAnimation();
1153
1339
  }
1154
- }, [animateLayers, fillLayers.length, layersInitialized, map, queueLayerAnimation]);
1340
+ }, [
1341
+ animateLayers,
1342
+ fillLayers.length,
1343
+ layersInitialized,
1344
+ map,
1345
+ queueLayerAnimation
1346
+ ]);
1155
1347
  useInterval(() => {
1156
1348
  if (animateLayers && layersInitialized && map && fillLayers.length > 0) {
1157
1349
  queueLayerAnimation();
1158
1350
  }
1159
1351
  }, timeIncrement * animatedLayerCount);
1160
- return /* @__PURE__ */ jsx12(Fragment, { children });
1161
- };
1352
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, children);
1353
+ }, "LayerAnimator");
1162
1354
 
1163
1355
  // src/Components/MapBoxPoints.tsx
1164
1356
  import { Alert as Alert2 } from "@mui/material";
1165
1357
  import { FlexCol as FlexCol6 } from "@xylabs/react-flexbox";
1166
- import {
1167
- useCallback as useCallback2,
1168
- useEffect as useEffect7,
1169
- useMemo as useMemo8
1170
- } from "react";
1171
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
1172
- var MapboxPointsFlexBox = ({
1173
- accessToken,
1174
- features,
1175
- fitToPointsPadding = 20,
1176
- layers,
1177
- zoom,
1178
- ...props
1179
- }) => {
1358
+ import React13, { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMemo8 } from "react";
1359
+ var MapboxPointsFlexBox = /* @__PURE__ */ __name(({ accessToken, features, fitToPointsPadding = 20, layers, zoom, ...props }) => {
1180
1360
  const { mapSettings } = useMapSettings();
1181
1361
  const { map, mapInitialized } = useMapBoxInstance();
1182
- const customFitToBoundsOptions = (zoom2) => {
1362
+ const customFitToBoundsOptions = /* @__PURE__ */ __name((zoom2) => {
1183
1363
  if (zoom2 !== void 0) {
1184
- return { maxZoom: zoom2 };
1364
+ return {
1365
+ maxZoom: zoom2
1366
+ };
1185
1367
  }
1186
1368
  return {};
1187
- };
1369
+ }, "customFitToBoundsOptions");
1188
1370
  const mapPoints = useMemo8(() => {
1189
1371
  return map && features?.length ? new MapPoints({
1190
1372
  features,
1191
1373
  map,
1192
1374
  zoom
1193
1375
  }) : void 0;
1194
- }, [map, features, zoom]);
1376
+ }, [
1377
+ map,
1378
+ features,
1379
+ zoom
1380
+ ]);
1195
1381
  const updateFeatures = useCallback2(() => {
1196
- if (mapPoints?.isMapReady && features?.length && layers)
1197
- for (const layer of layers) {
1198
- mapPoints.initializeMapSource(layer);
1199
- }
1200
- }, [mapPoints, features, layers]);
1382
+ if (mapPoints?.isMapReady && features?.length && layers) for (const layer of layers) {
1383
+ mapPoints.initializeMapSource(layer);
1384
+ }
1385
+ }, [
1386
+ mapPoints,
1387
+ features,
1388
+ layers
1389
+ ]);
1201
1390
  const updateMapSetup = useCallback2(() => {
1202
1391
  const { fitToPoints: fitToPoints2 } = mapSettings || {};
1203
1392
  if (mapPoints && map && fitToPoints2?.value === true) {
@@ -1211,7 +1400,13 @@ var MapboxPointsFlexBox = ({
1211
1400
  ...customFitToBoundsOptions(zoom)
1212
1401
  });
1213
1402
  }
1214
- }, [mapSettings, mapPoints, map, fitToPointsPadding, zoom]);
1403
+ }, [
1404
+ mapSettings,
1405
+ mapPoints,
1406
+ map,
1407
+ fitToPointsPadding,
1408
+ zoom
1409
+ ]);
1215
1410
  const reInitializeMap = useCallback2(() => {
1216
1411
  mapPoints?.initialMapPositioning({
1217
1412
  padding: {
@@ -1223,18 +1418,33 @@ var MapboxPointsFlexBox = ({
1223
1418
  ...customFitToBoundsOptions(zoom)
1224
1419
  });
1225
1420
  updateFeatures();
1226
- }, [mapPoints, fitToPointsPadding, updateFeatures, zoom]);
1421
+ }, [
1422
+ mapPoints,
1423
+ fitToPointsPadding,
1424
+ updateFeatures,
1425
+ zoom
1426
+ ]);
1227
1427
  useEffect7(() => {
1228
1428
  if (mapInitialized) {
1229
1429
  updateMapSetup();
1230
1430
  reInitializeMap();
1231
1431
  }
1232
- }, [mapInitialized, reInitializeMap, updateMapSetup]);
1233
- return /* @__PURE__ */ jsx13(FlexCol6, { alignItems: "stretch", id: "xyo-mapbox-wrap", ...props, children: features ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
1234
- /* @__PURE__ */ jsx13(MapBox, { accessToken, zoom }),
1235
- /* @__PURE__ */ jsx13(MapSettingsBox, {})
1236
- ] }) : /* @__PURE__ */ jsx13(Alert2, { severity: "error", children: "No data to show" }) });
1237
- };
1432
+ }, [
1433
+ mapInitialized,
1434
+ reInitializeMap,
1435
+ updateMapSetup
1436
+ ]);
1437
+ return /* @__PURE__ */ React13.createElement(FlexCol6, {
1438
+ alignItems: "stretch",
1439
+ id: "xyo-mapbox-wrap",
1440
+ ...props
1441
+ }, features ? /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(MapBox, {
1442
+ accessToken,
1443
+ zoom
1444
+ }), /* @__PURE__ */ React13.createElement(MapSettingsBox, null)) : /* @__PURE__ */ React13.createElement(Alert2, {
1445
+ severity: "error"
1446
+ }, "No data to show"));
1447
+ }, "MapboxPointsFlexBox");
1238
1448
  export {
1239
1449
  AnimatedHeatMap,
1240
1450
  AnimatedHeatMapLegend,