@classic-homes/maps-react 0.1.4 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React6 = require('react');
3
+ var React25 = require('react');
4
4
  var clsx = require('clsx');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var jsxRuntime = require('react/jsx-runtime');
@@ -12,6 +12,8 @@ var mapsCore = require('@classic-homes/maps-core');
12
12
  var ReactDOM = require('react-dom');
13
13
  var classVarianceAuthority = require('class-variance-authority');
14
14
  require('@classic-homes/maps-core/styles/basemap-switcher.css');
15
+ require('@classic-homes/maps-core/styles/layer-manager.css');
16
+ var themeReact = require('@classic-homes/theme-react');
15
17
 
16
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
19
 
@@ -33,7 +35,7 @@ function _interopNamespace(e) {
33
35
  return Object.freeze(n);
34
36
  }
35
37
 
36
- var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
38
+ var React25__namespace = /*#__PURE__*/_interopNamespace(React25);
37
39
  var maplibregl__default = /*#__PURE__*/_interopDefault(maplibregl);
38
40
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
39
41
 
@@ -41,7 +43,7 @@ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
41
43
  function cn(...inputs) {
42
44
  return tailwindMerge.twMerge(clsx.clsx(inputs));
43
45
  }
44
- var MapSkeleton = React6__namespace.forwardRef(
46
+ var MapSkeleton = React25__namespace.forwardRef(
45
47
  ({ height = 400, className, ...props }, ref) => {
46
48
  const heightStyle = typeof height === "number" ? `${height}px` : height;
47
49
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -95,7 +97,7 @@ var MapSkeleton = React6__namespace.forwardRef(
95
97
  }
96
98
  );
97
99
  MapSkeleton.displayName = "MapSkeleton";
98
- var MapError = React6__namespace.forwardRef(
100
+ var MapError = React25__namespace.forwardRef(
99
101
  ({ message = "Failed to load map", height = 400, onRetry, className, ...props }, ref) => {
100
102
  const heightStyle = typeof height === "number" ? `${height}px` : height;
101
103
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -116,6 +118,8 @@ var MapError = React6__namespace.forwardRef(
116
118
  {
117
119
  className: "h-10 w-10 text-destructive",
118
120
  xmlns: "http://www.w3.org/2000/svg",
121
+ width: "40",
122
+ height: "40",
119
123
  fill: "none",
120
124
  viewBox: "0 0 24 24",
121
125
  stroke: "currentColor",
@@ -149,7 +153,7 @@ var MapError = React6__namespace.forwardRef(
149
153
  }
150
154
  );
151
155
  MapError.displayName = "MapError";
152
- var MapEmpty = React6__namespace.forwardRef(
156
+ var MapEmpty = React25__namespace.forwardRef(
153
157
  ({ message = "No map data to display", height = 400, className, ...props }, ref) => {
154
158
  const heightStyle = typeof height === "number" ? `${height}px` : height;
155
159
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -192,7 +196,7 @@ var MapEmpty = React6__namespace.forwardRef(
192
196
  }
193
197
  );
194
198
  MapEmpty.displayName = "MapEmpty";
195
- var MapContainer = React6__namespace.forwardRef(
199
+ var MapContainer = React25__namespace.forwardRef(
196
200
  ({
197
201
  title,
198
202
  description,
@@ -241,8 +245,8 @@ var MapContainer = React6__namespace.forwardRef(
241
245
  );
242
246
  MapContainer.displayName = "MapContainer";
243
247
  function useMapTheme(preference = "auto") {
244
- const [isDark, setIsDark] = React6.useState(false);
245
- const updateTheme = React6.useCallback(() => {
248
+ const [isDark, setIsDark] = React25.useState(false);
249
+ const updateTheme = React25.useCallback(() => {
246
250
  if (preference !== "auto") {
247
251
  setIsDark(preference === "dark");
248
252
  return;
@@ -252,7 +256,7 @@ function useMapTheme(preference = "auto") {
252
256
  setIsDark(hasDarkClass);
253
257
  }
254
258
  }, [preference]);
255
- React6.useEffect(() => {
259
+ React25.useEffect(() => {
256
260
  updateTheme();
257
261
  if (preference !== "auto" || typeof document === "undefined") return;
258
262
  const observer = new MutationObserver((mutations) => {
@@ -282,8 +286,8 @@ function useMapTheme(preference = "auto") {
282
286
  };
283
287
  }
284
288
  function useReducedMotion() {
285
- const [prefersReducedMotion2, setPrefersReducedMotion] = React6.useState(false);
286
- React6.useEffect(() => {
289
+ const [prefersReducedMotion2, setPrefersReducedMotion] = React25.useState(false);
290
+ React25.useEffect(() => {
287
291
  if (typeof window === "undefined") return;
288
292
  const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
289
293
  setPrefersReducedMotion(mediaQuery.matches);
@@ -297,9 +301,9 @@ function useReducedMotion() {
297
301
  }, []);
298
302
  return prefersReducedMotion2;
299
303
  }
300
- var MapContext = React6__namespace.createContext(null);
304
+ var MapContext = React25__namespace.createContext(null);
301
305
  function useMap() {
302
- const context = React6__namespace.useContext(MapContext);
306
+ const context = React25__namespace.useContext(MapContext);
303
307
  if (!context) {
304
308
  throw new Error("useMap must be used within a Map component");
305
309
  }
@@ -309,7 +313,7 @@ function useMapInstance() {
309
313
  const { map, loaded } = useMap();
310
314
  return loaded ? map : null;
311
315
  }
312
- var Map = React6__namespace.forwardRef(
316
+ var Map2 = React25__namespace.forwardRef(
313
317
  ({
314
318
  // Base props
315
319
  title,
@@ -363,33 +367,33 @@ var Map = React6__namespace.forwardRef(
363
367
  onZoom,
364
368
  onError
365
369
  }, ref) => {
366
- const containerRef = React6__namespace.useRef(null);
367
- const mapRef = React6__namespace.useRef(null);
368
- const [mapLoaded, setMapLoaded] = React6__namespace.useState(false);
369
- const [mapError, setMapError] = React6__namespace.useState(null);
370
- const [styleVersion, setStyleVersion] = React6__namespace.useState(0);
371
- const activeStyleOverrideRef = React6__namespace.useRef(
370
+ const containerRef = React25__namespace.useRef(null);
371
+ const mapRef = React25__namespace.useRef(null);
372
+ const [mapLoaded, setMapLoaded] = React25__namespace.useState(false);
373
+ const [mapError, setMapError] = React25__namespace.useState(null);
374
+ const [styleVersion, setStyleVersion] = React25__namespace.useState(0);
375
+ const activeStyleOverrideRef = React25__namespace.useRef(
372
376
  null
373
377
  );
374
- const setMapStyle = React6__namespace.useCallback((style) => {
378
+ const setMapStyle = React25__namespace.useCallback((style) => {
375
379
  activeStyleOverrideRef.current = style;
376
380
  mapRef.current?.setStyle(style);
377
381
  }, []);
378
- const customControlRegistryRef = React6__namespace.useRef({
382
+ const customControlRegistryRef = React25__namespace.useRef({
379
383
  "top-left": [],
380
384
  "top-right": [],
381
385
  "bottom-left": [],
382
386
  "bottom-right": []
383
387
  });
384
- const [, forceUpdate] = React6__namespace.useReducer((x) => x + 1, 0);
388
+ const [, forceUpdate] = React25__namespace.useReducer((x) => x + 1, 0);
385
389
  const prefersReducedMotion2 = useReducedMotion();
386
390
  const { style: themeStyle } = useMapTheme(themePref);
387
- const onLoadRef = React6__namespace.useRef(onLoad);
391
+ const onLoadRef = React25__namespace.useRef(onLoad);
388
392
  onLoadRef.current = onLoad;
389
- const onErrorRef = React6__namespace.useRef(onError);
393
+ const onErrorRef = React25__namespace.useRef(onError);
390
394
  onErrorRef.current = onError;
391
395
  const mapStyle = customStyle || themeStyle;
392
- const controlOffsets = React6__namespace.useMemo(() => {
396
+ const controlOffsets = React25__namespace.useMemo(() => {
393
397
  const offsets = {
394
398
  "top-left": 0,
395
399
  "top-right": 0,
@@ -408,6 +412,9 @@ var Map = React6__namespace.forwardRef(
408
412
  if (geolocateControl) {
409
413
  offsets[geolocateControlPosition] += 38;
410
414
  }
415
+ if (attributionControl) {
416
+ offsets["bottom-right"] += 32;
417
+ }
411
418
  return offsets;
412
419
  }, [
413
420
  navigationControl,
@@ -417,9 +424,10 @@ var Map = React6__namespace.forwardRef(
417
424
  fullscreenControl,
418
425
  fullscreenControlPosition,
419
426
  geolocateControl,
420
- geolocateControlPosition
427
+ geolocateControlPosition,
428
+ attributionControl
421
429
  ]);
422
- const registerControl = React6__namespace.useCallback(
430
+ const registerControl = React25__namespace.useCallback(
423
431
  (id, position, height2) => {
424
432
  const registry = customControlRegistryRef.current;
425
433
  const positionControls = registry[position] || [];
@@ -440,13 +448,13 @@ var Map = React6__namespace.forwardRef(
440
448
  },
441
449
  []
442
450
  );
443
- const unregisterControl = React6__namespace.useCallback((id, position) => {
451
+ const unregisterControl = React25__namespace.useCallback((id, position) => {
444
452
  const registry = customControlRegistryRef.current;
445
453
  const positionControls = registry[position] || [];
446
454
  registry[position] = positionControls.filter((c) => c.id !== id);
447
455
  forceUpdate();
448
456
  }, []);
449
- const getCustomControlOffset = React6__namespace.useCallback((id, position) => {
457
+ const getCustomControlOffset = React25__namespace.useCallback((id, position) => {
450
458
  const registry = customControlRegistryRef.current;
451
459
  const positionControls = registry[position] || [];
452
460
  let offset = 0;
@@ -460,7 +468,7 @@ var Map = React6__namespace.forwardRef(
460
468
  center,
461
469
  zoom
462
470
  });
463
- React6__namespace.useEffect(() => {
471
+ React25__namespace.useEffect(() => {
464
472
  if (!containerRef.current || mapRef.current) return;
465
473
  try {
466
474
  const map = new maplibregl__default.default.Map({
@@ -540,8 +548,8 @@ var Map = React6__namespace.forwardRef(
540
548
  onErrorRef.current?.({ type: "error", message: errorMessage, error: err });
541
549
  }
542
550
  }, []);
543
- const styleInitialized = React6__namespace.useRef(false);
544
- React6__namespace.useEffect(() => {
551
+ const styleInitialized = React25__namespace.useRef(false);
552
+ React25__namespace.useEffect(() => {
545
553
  if (!mapRef.current || !mapLoaded) return;
546
554
  if (!styleInitialized.current) {
547
555
  styleInitialized.current = true;
@@ -550,12 +558,12 @@ var Map = React6__namespace.forwardRef(
550
558
  if (activeStyleOverrideRef.current) return;
551
559
  mapRef.current.setStyle(mapStyle);
552
560
  }, [mapStyle, mapLoaded]);
553
- React6__namespace.useEffect(() => {
561
+ React25__namespace.useEffect(() => {
554
562
  if (customStyle) {
555
563
  activeStyleOverrideRef.current = null;
556
564
  }
557
565
  }, [customStyle]);
558
- React6__namespace.useEffect(() => {
566
+ React25__namespace.useEffect(() => {
559
567
  const map = mapRef.current;
560
568
  if (!map || !mapLoaded) return;
561
569
  const createEventParams = (e) => ({
@@ -689,7 +697,7 @@ var Map = React6__namespace.forwardRef(
689
697
  );
690
698
  }
691
699
  );
692
- Map.displayName = "Map";
700
+ Map2.displayName = "Map";
693
701
  var Source = ({
694
702
  id,
695
703
  type,
@@ -710,9 +718,9 @@ var Source = ({
710
718
  children
711
719
  }) => {
712
720
  const { map, loaded, styleVersion } = useMap();
713
- const sourceAdded = React6__namespace.useRef(false);
714
- const initialFitDone = React6__namespace.useRef(false);
715
- const fitBoundsParamsRef = React6__namespace.useRef({
721
+ const sourceAdded = React25__namespace.useRef(false);
722
+ const initialFitDone = React25__namespace.useRef(false);
723
+ const fitBoundsParamsRef = React25__namespace.useRef({
716
724
  shouldFitBounds,
717
725
  data,
718
726
  fitBoundsPadding,
@@ -728,7 +736,7 @@ var Source = ({
728
736
  fitBoundsAnimate,
729
737
  type
730
738
  };
731
- const performFitBounds = React6__namespace.useCallback(
739
+ const performFitBounds = React25__namespace.useCallback(
732
740
  (cancelledRef) => {
733
741
  const params = fitBoundsParamsRef.current;
734
742
  if (cancelledRef.current || !params.shouldFitBounds || initialFitDone.current) return;
@@ -772,7 +780,7 @@ var Source = ({
772
780
  },
773
781
  [map]
774
782
  );
775
- React6__namespace.useEffect(() => {
783
+ React25__namespace.useEffect(() => {
776
784
  if (!map || !loaded || sourceAdded.current) return;
777
785
  if (map.getSource(id)) {
778
786
  sourceAdded.current = true;
@@ -922,24 +930,39 @@ var Source = ({
922
930
  styleVersion
923
931
  // re-add source after basemap style changes
924
932
  ]);
925
- React6__namespace.useEffect(() => {
933
+ React25__namespace.useEffect(() => {
926
934
  if (!map || !loaded || !sourceAdded.current || type !== "geojson") return;
927
935
  const source = map.getSource(id);
928
936
  if (!source) return;
937
+ let cancelled = false;
929
938
  try {
930
- if (typeof data === "string") {
931
- source.setData(data);
932
- } else if (data && typeof data === "object") {
933
- source.setData(data);
939
+ const newData = typeof data === "string" ? data : data && typeof data === "object" ? data : null;
940
+ if (!newData) return;
941
+ const handleSourceData = (e) => {
942
+ if (cancelled) return;
943
+ if (e.sourceId === id && e.isSourceLoaded) {
944
+ map.off("sourcedata", handleSourceData);
945
+ map.triggerRepaint();
946
+ }
947
+ };
948
+ if (cluster) {
949
+ map.on("sourcedata", handleSourceData);
934
950
  }
951
+ source.setData(newData);
952
+ return () => {
953
+ cancelled = true;
954
+ if (cluster) {
955
+ map.off("sourcedata", handleSourceData);
956
+ }
957
+ };
935
958
  } catch (err) {
936
959
  console.error(`[maps-react] Failed to update source "${id}" data:`, err);
937
960
  }
938
- }, [map, loaded, id, type, data]);
961
+ }, [map, loaded, id, type, data, cluster]);
939
962
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
940
963
  };
941
964
  Source.displayName = "Source";
942
- var Marker = React6__namespace.forwardRef(
965
+ var Marker = React25__namespace.forwardRef(
943
966
  ({
944
967
  id,
945
968
  coordinates,
@@ -955,27 +978,27 @@ var Marker = React6__namespace.forwardRef(
955
978
  children
956
979
  }, ref) => {
957
980
  const { map, loaded } = useMap();
958
- const markerRef = React6__namespace.useRef(null);
959
- const elementRef = React6__namespace.useRef(null);
960
- const originalLngLatRef = React6__namespace.useRef();
961
- const clickHandlerRef = React6__namespace.useRef(null);
962
- const [mounted, setMounted] = React6__namespace.useState(false);
963
- const onClickRef = React6__namespace.useRef(onClick);
981
+ const markerRef = React25__namespace.useRef(null);
982
+ const elementRef = React25__namespace.useRef(null);
983
+ const originalLngLatRef = React25__namespace.useRef();
984
+ const clickHandlerRef = React25__namespace.useRef(null);
985
+ const [mounted, setMounted] = React25__namespace.useState(false);
986
+ const onClickRef = React25__namespace.useRef(onClick);
964
987
  onClickRef.current = onClick;
965
- const onDragRef = React6__namespace.useRef(onDrag);
988
+ const onDragRef = React25__namespace.useRef(onDrag);
966
989
  onDragRef.current = onDrag;
967
- const onDragEndRef = React6__namespace.useRef(onDragEnd);
990
+ const onDragEndRef = React25__namespace.useRef(onDragEnd);
968
991
  onDragEndRef.current = onDragEnd;
969
- React6__namespace.useEffect(() => {
992
+ React25__namespace.useEffect(() => {
970
993
  setMounted(true);
971
994
  return () => setMounted(false);
972
995
  }, []);
973
- React6__namespace.useEffect(() => {
996
+ React25__namespace.useEffect(() => {
974
997
  if (children && !elementRef.current) {
975
998
  elementRef.current = document.createElement("div");
976
999
  }
977
1000
  }, [children]);
978
- React6__namespace.useEffect(() => {
1001
+ React25__namespace.useEffect(() => {
979
1002
  if (!map || !loaded || !mounted) return;
980
1003
  if (markerRef.current) return;
981
1004
  const markerOptions = {
@@ -1059,17 +1082,17 @@ var Marker = React6__namespace.forwardRef(
1059
1082
  }
1060
1083
  };
1061
1084
  }, [map, loaded, mounted]);
1062
- React6__namespace.useEffect(() => {
1085
+ React25__namespace.useEffect(() => {
1063
1086
  if (markerRef.current) {
1064
1087
  markerRef.current.setLngLat(coordinates);
1065
1088
  }
1066
1089
  }, [coordinates]);
1067
- React6__namespace.useEffect(() => {
1090
+ React25__namespace.useEffect(() => {
1068
1091
  if (markerRef.current) {
1069
1092
  markerRef.current.setDraggable(draggable);
1070
1093
  }
1071
1094
  }, [draggable]);
1072
- React6__namespace.useEffect(() => {
1095
+ React25__namespace.useEffect(() => {
1073
1096
  if (markerRef.current && rotation !== void 0) {
1074
1097
  markerRef.current.setRotation(rotation);
1075
1098
  }
@@ -1115,7 +1138,7 @@ function panToFitPopup(map, popup, padding) {
1115
1138
  });
1116
1139
  }
1117
1140
  }
1118
- var Popup = React6__namespace.forwardRef(
1141
+ var Popup = React25__namespace.forwardRef(
1119
1142
  ({
1120
1143
  coordinates,
1121
1144
  closeButton = true,
@@ -1133,25 +1156,25 @@ var Popup = React6__namespace.forwardRef(
1133
1156
  children
1134
1157
  }, ref) => {
1135
1158
  const { map, loaded } = useMap();
1136
- const popupRef = React6__namespace.useRef(null);
1137
- const onOpenRef = React6__namespace.useRef(onOpen);
1159
+ const popupRef = React25__namespace.useRef(null);
1160
+ const onOpenRef = React25__namespace.useRef(onOpen);
1138
1161
  onOpenRef.current = onOpen;
1139
- const onCloseRef = React6__namespace.useRef(onClose);
1162
+ const onCloseRef = React25__namespace.useRef(onClose);
1140
1163
  onCloseRef.current = onClose;
1141
- const coordinatesRef = React6__namespace.useRef(coordinates);
1164
+ const coordinatesRef = React25__namespace.useRef(coordinates);
1142
1165
  coordinatesRef.current = coordinates;
1143
- const containerRef = React6__namespace.useRef(null);
1166
+ const containerRef = React25__namespace.useRef(null);
1144
1167
  if (!containerRef.current && typeof document !== "undefined") {
1145
1168
  containerRef.current = document.createElement("div");
1146
1169
  containerRef.current.className = "maplibregl-popup-content-wrapper";
1147
1170
  }
1148
- const [contentReady, setContentReady] = React6__namespace.useState(false);
1149
- const contentCallbackRef = React6__namespace.useCallback((node) => {
1171
+ const [contentReady, setContentReady] = React25__namespace.useState(false);
1172
+ const contentCallbackRef = React25__namespace.useCallback((node) => {
1150
1173
  if (node && containerRef.current) {
1151
1174
  setContentReady(true);
1152
1175
  }
1153
1176
  }, []);
1154
- React6__namespace.useEffect(() => {
1177
+ React25__namespace.useEffect(() => {
1155
1178
  if (!map || !loaded || !containerRef.current) return;
1156
1179
  const popup = new maplibregl__default.default.Popup({
1157
1180
  closeButton,
@@ -1191,7 +1214,7 @@ var Popup = React6__namespace.forwardRef(
1191
1214
  maxWidth,
1192
1215
  focusAfterOpen
1193
1216
  ]);
1194
- React6__namespace.useEffect(() => {
1217
+ React25__namespace.useEffect(() => {
1195
1218
  if (!popupRef.current || !ref) return;
1196
1219
  if (typeof ref === "function") {
1197
1220
  ref(popupRef.current);
@@ -1199,12 +1222,12 @@ var Popup = React6__namespace.forwardRef(
1199
1222
  ref.current = popupRef.current;
1200
1223
  }
1201
1224
  }, [ref]);
1202
- React6__namespace.useEffect(() => {
1225
+ React25__namespace.useEffect(() => {
1203
1226
  if (popupRef.current) {
1204
1227
  popupRef.current.setLngLat(coordinates);
1205
1228
  }
1206
1229
  }, [coordinates]);
1207
- React6__namespace.useEffect(() => {
1230
+ React25__namespace.useEffect(() => {
1208
1231
  if (!map || !popupRef.current || !contentReady) return;
1209
1232
  let rafHandle;
1210
1233
  if (open) {
@@ -1233,7 +1256,7 @@ var Popup = React6__namespace.forwardRef(
1233
1256
  }
1234
1257
  );
1235
1258
  Popup.displayName = "Popup";
1236
- var PopupCard = React6__namespace.forwardRef(
1259
+ var PopupCard = React25__namespace.forwardRef(
1237
1260
  ({ className, children, ...props }, ref) => {
1238
1261
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("bg-popover text-popover-foreground", className), ...props, children });
1239
1262
  }
@@ -1253,7 +1276,7 @@ var badgeVariants = classVarianceAuthority.cva("text-xs px-1.5 py-0.5 rounded fo
1253
1276
  badgeVariant: "secondary"
1254
1277
  }
1255
1278
  });
1256
- var PopupHeader = React6__namespace.forwardRef(
1279
+ var PopupHeader = React25__namespace.forwardRef(
1257
1280
  ({ className, title, badge, badgeVariant, ...props }, ref) => {
1258
1281
  return /* @__PURE__ */ jsxRuntime.jsxs(
1259
1282
  "div",
@@ -1273,13 +1296,13 @@ var PopupHeader = React6__namespace.forwardRef(
1273
1296
  }
1274
1297
  );
1275
1298
  PopupHeader.displayName = "PopupHeader";
1276
- var PopupContent = React6__namespace.forwardRef(
1299
+ var PopupContent = React25__namespace.forwardRef(
1277
1300
  ({ className, children, ...props }, ref) => {
1278
1301
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("px-4 py-3 text-sm", className), ...props, children });
1279
1302
  }
1280
1303
  );
1281
1304
  PopupContent.displayName = "PopupContent";
1282
- var PopupFooter = React6__namespace.forwardRef(
1305
+ var PopupFooter = React25__namespace.forwardRef(
1283
1306
  ({ className, children, ...props }, ref) => {
1284
1307
  return /* @__PURE__ */ jsxRuntime.jsx(
1285
1308
  "div",
@@ -1314,14 +1337,14 @@ function useLayer({
1314
1337
  hoverThrottleMs = 0
1315
1338
  }) {
1316
1339
  const { map, loaded, styleVersion } = useMap();
1317
- const [layerAdded, setLayerAdded] = React6__namespace.useState(false);
1318
- const hoveredFeatureId = React6__namespace.useRef(null);
1319
- const lastHoverCallTime = React6__namespace.useRef(0);
1320
- const lastMousePosition = React6__namespace.useRef(null);
1321
- React6__namespace.useEffect(() => {
1340
+ const [layerAdded, setLayerAdded] = React25__namespace.useState(false);
1341
+ const hoveredFeatureId = React25__namespace.useRef(null);
1342
+ const lastHoverCallTime = React25__namespace.useRef(0);
1343
+ const lastMousePosition = React25__namespace.useRef(null);
1344
+ React25__namespace.useEffect(() => {
1322
1345
  hoveredFeatureId.current = null;
1323
1346
  }, [styleVersion]);
1324
- React6__namespace.useEffect(() => {
1347
+ React25__namespace.useEffect(() => {
1325
1348
  if (!map || !loaded) return;
1326
1349
  if (!map.getSource(source)) {
1327
1350
  let timeoutId = null;
@@ -1392,24 +1415,24 @@ function useLayer({
1392
1415
  }
1393
1416
  };
1394
1417
  }, [map, loaded, id, source, sourceLayer, type, beforeId, styleVersion]);
1395
- React6__namespace.useEffect(() => {
1418
+ React25__namespace.useEffect(() => {
1396
1419
  if (!map || !layerAdded) return;
1397
1420
  if (!map.getLayer(id)) return;
1398
1421
  map.setLayoutProperty(id, "visibility", visible ? "visible" : "none");
1399
1422
  }, [map, id, visible, layerAdded]);
1400
- React6__namespace.useEffect(() => {
1423
+ React25__namespace.useEffect(() => {
1401
1424
  if (!map || !layerAdded) return;
1402
1425
  if (!map.getLayer(id)) return;
1403
1426
  Object.entries(paint).forEach(([key, value]) => {
1404
1427
  map.setPaintProperty(id, key, value);
1405
1428
  });
1406
1429
  }, [map, id, paint, layerAdded]);
1407
- React6__namespace.useEffect(() => {
1430
+ React25__namespace.useEffect(() => {
1408
1431
  if (!map || !layerAdded || !filter) return;
1409
1432
  if (!map.getLayer(id)) return;
1410
1433
  map.setFilter(id, filter);
1411
1434
  }, [map, id, filter, layerAdded]);
1412
- React6__namespace.useEffect(() => {
1435
+ React25__namespace.useEffect(() => {
1413
1436
  if (!map || !layerAdded) return;
1414
1437
  const createFeatureParams = (e) => {
1415
1438
  const feature = e.features?.[0];
@@ -1545,7 +1568,7 @@ var FillLayer = ({
1545
1568
  fillTranslate,
1546
1569
  fillAntialias
1547
1570
  }) => {
1548
- const paint = React6__namespace.useMemo(() => {
1571
+ const paint = React25__namespace.useMemo(() => {
1549
1572
  const p = {};
1550
1573
  if (fillColor !== void 0) p["fill-color"] = fillColor;
1551
1574
  if (fillOpacity !== void 0) p["fill-opacity"] = fillOpacity;
@@ -1566,7 +1589,7 @@ var FillLayer = ({
1566
1589
  fillAntialias,
1567
1590
  opacity
1568
1591
  ]);
1569
- const layout = React6__namespace.useMemo(() => ({}), []);
1592
+ const layout = React25__namespace.useMemo(() => ({}), []);
1570
1593
  useLayer({
1571
1594
  id,
1572
1595
  source,
@@ -1610,7 +1633,7 @@ var LineLayer = ({
1610
1633
  lineOffset,
1611
1634
  lineGradient
1612
1635
  }) => {
1613
- const paint = React6__namespace.useMemo(() => {
1636
+ const paint = React25__namespace.useMemo(() => {
1614
1637
  const p = {};
1615
1638
  if (lineColor !== void 0) p["line-color"] = lineColor;
1616
1639
  if (lineWidth !== void 0) p["line-width"] = lineWidth;
@@ -1635,7 +1658,7 @@ var LineLayer = ({
1635
1658
  lineGradient,
1636
1659
  opacity
1637
1660
  ]);
1638
- const layout = React6__namespace.useMemo(() => {
1661
+ const layout = React25__namespace.useMemo(() => {
1639
1662
  const l = {};
1640
1663
  if (lineCap !== void 0) l["line-cap"] = lineCap;
1641
1664
  if (lineJoin !== void 0) l["line-join"] = lineJoin;
@@ -1684,7 +1707,7 @@ var CircleLayer = ({
1684
1707
  circlePitchScale,
1685
1708
  circleTranslate
1686
1709
  }) => {
1687
- const paint = React6__namespace.useMemo(() => {
1710
+ const paint = React25__namespace.useMemo(() => {
1688
1711
  const p = {};
1689
1712
  if (circleRadius !== void 0) p["circle-radius"] = circleRadius;
1690
1713
  if (circleColor !== void 0) p["circle-color"] = circleColor;
@@ -1713,7 +1736,7 @@ var CircleLayer = ({
1713
1736
  circleTranslate,
1714
1737
  opacity
1715
1738
  ]);
1716
- const layout = React6__namespace.useMemo(() => ({}), []);
1739
+ const layout = React25__namespace.useMemo(() => ({}), []);
1717
1740
  useLayer({
1718
1741
  id,
1719
1742
  source,
@@ -1773,7 +1796,7 @@ var SymbolLayer = ({
1773
1796
  symbolSpacing,
1774
1797
  symbolSortKey
1775
1798
  }) => {
1776
- const paint = React6__namespace.useMemo(() => {
1799
+ const paint = React25__namespace.useMemo(() => {
1777
1800
  const p = {};
1778
1801
  if (iconOpacity !== void 0) p["icon-opacity"] = iconOpacity;
1779
1802
  if (iconColor !== void 0) p["icon-color"] = iconColor;
@@ -1794,7 +1817,7 @@ var SymbolLayer = ({
1794
1817
  textHaloColor,
1795
1818
  textHaloWidth
1796
1819
  ]);
1797
- const layout = React6__namespace.useMemo(() => {
1820
+ const layout = React25__namespace.useMemo(() => {
1798
1821
  const l = {};
1799
1822
  if (iconImage !== void 0) l["icon-image"] = iconImage;
1800
1823
  if (iconSize !== void 0) l["icon-size"] = iconSize;
@@ -1875,7 +1898,7 @@ var FillExtrusionLayer = ({
1875
1898
  fillExtrusionTranslate,
1876
1899
  fillExtrusionVerticalGradient
1877
1900
  }) => {
1878
- const paint = React6__namespace.useMemo(() => {
1901
+ const paint = React25__namespace.useMemo(() => {
1879
1902
  const p = {};
1880
1903
  if (fillExtrusionHeight !== void 0) p["fill-extrusion-height"] = fillExtrusionHeight;
1881
1904
  if (fillExtrusionBase !== void 0) p["fill-extrusion-base"] = fillExtrusionBase;
@@ -1901,7 +1924,7 @@ var FillExtrusionLayer = ({
1901
1924
  fillExtrusionVerticalGradient,
1902
1925
  opacity
1903
1926
  ]);
1904
- const layout = React6__namespace.useMemo(() => ({}), []);
1927
+ const layout = React25__namespace.useMemo(() => ({}), []);
1905
1928
  useLayer({
1906
1929
  id,
1907
1930
  source,
@@ -1940,7 +1963,7 @@ var HeatmapLayer = ({
1940
1963
  heatmapRadius,
1941
1964
  heatmapOpacity
1942
1965
  }) => {
1943
- const paint = React6__namespace.useMemo(() => {
1966
+ const paint = React25__namespace.useMemo(() => {
1944
1967
  const p = {};
1945
1968
  if (heatmapIntensity !== void 0) p["heatmap-intensity"] = heatmapIntensity;
1946
1969
  if (heatmapWeight !== void 0) p["heatmap-weight"] = heatmapWeight;
@@ -1952,7 +1975,7 @@ var HeatmapLayer = ({
1952
1975
  }
1953
1976
  return p;
1954
1977
  }, [heatmapIntensity, heatmapWeight, heatmapColor, heatmapRadius, heatmapOpacity, opacity]);
1955
- const layout = React6__namespace.useMemo(() => ({}), []);
1978
+ const layout = React25__namespace.useMemo(() => ({}), []);
1956
1979
  useLayer({
1957
1980
  id,
1958
1981
  source,
@@ -1987,11 +2010,11 @@ var Legend = ({
1987
2010
  onItemClick
1988
2011
  }) => {
1989
2012
  const { controlOffsets, registerControl, unregisterControl } = useMap();
1990
- const [isCollapsed, setIsCollapsed] = React6__namespace.useState(initialCollapsed);
1991
- const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
1992
- const legendRef = React6__namespace.useRef(null);
1993
- const legendIdRef = React6__namespace.useRef(`legend-${++legendIdCounter}`);
1994
- React6__namespace.useEffect(() => {
2013
+ const [isCollapsed, setIsCollapsed] = React25__namespace.useState(initialCollapsed);
2014
+ const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
2015
+ const legendRef = React25__namespace.useRef(null);
2016
+ const legendIdRef = React25__namespace.useRef(`legend-${++legendIdCounter}`);
2017
+ React25__namespace.useEffect(() => {
1995
2018
  if (!legendRef.current || !registerControl) return;
1996
2019
  const updatePosition = () => {
1997
2020
  if (!legendRef.current) return;
@@ -2007,7 +2030,7 @@ var Legend = ({
2007
2030
  unregisterControl?.(legendIdRef.current, position);
2008
2031
  };
2009
2032
  }, [position, registerControl, unregisterControl]);
2010
- const verticalOffsetStyle = React6__namespace.useMemo(() => {
2033
+ const verticalOffsetStyle = React25__namespace.useMemo(() => {
2011
2034
  return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2012
2035
  }, [customControlOffset, position]);
2013
2036
  const handleItemClick = (item, index) => {
@@ -2020,13 +2043,13 @@ var Legend = ({
2020
2043
  setIsCollapsed(!isCollapsed);
2021
2044
  }
2022
2045
  };
2023
- const gradientStyle = React6__namespace.useMemo(() => {
2046
+ const gradientStyle = React25__namespace.useMemo(() => {
2024
2047
  if (type !== "gradient" || gradient.length === 0) return "";
2025
2048
  const stops = gradient.map((stop) => `${stop.color} ${stop.position * 100}%`).join(", ");
2026
2049
  return `linear-gradient(to right, ${stops})`;
2027
2050
  }, [type, gradient]);
2028
2051
  const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2029
- const computedPositionClasses = React6__namespace.useMemo(() => {
2052
+ const computedPositionClasses = React25__namespace.useMemo(() => {
2030
2053
  return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2031
2054
  }, [position, hasControlsAtPosition]);
2032
2055
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2125,15 +2148,15 @@ var LegendGroup = ({
2125
2148
  class: className
2126
2149
  }) => {
2127
2150
  const { controlOffsets, registerControl, unregisterControl } = useMap();
2128
- const containerRef = React6__namespace.useRef(null);
2129
- const groupIdRef = React6__namespace.useRef(`legend-group-${++legendGroupIdCounter}`);
2130
- const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
2151
+ const containerRef = React25__namespace.useRef(null);
2152
+ const groupIdRef = React25__namespace.useRef(`legend-group-${++legendGroupIdCounter}`);
2153
+ const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
2131
2154
  const getInitialExpanded = () => {
2132
2155
  if (controlledExpanded !== void 0) return controlledExpanded;
2133
2156
  if (defaultExpanded) return defaultExpanded;
2134
2157
  return legends[0]?.id || null;
2135
2158
  };
2136
- const [internalExpanded, setInternalExpanded] = React6__namespace.useState(getInitialExpanded);
2159
+ const [internalExpanded, setInternalExpanded] = React25__namespace.useState(getInitialExpanded);
2137
2160
  const expandedId = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
2138
2161
  const handleToggle = (id) => {
2139
2162
  const newExpanded = expandedId === id ? allowCollapseAll ? null : id : id;
@@ -2142,7 +2165,7 @@ var LegendGroup = ({
2142
2165
  }
2143
2166
  onExpandedChange?.(newExpanded);
2144
2167
  };
2145
- React6__namespace.useEffect(() => {
2168
+ React25__namespace.useEffect(() => {
2146
2169
  if (!containerRef.current || !registerControl) return;
2147
2170
  const timeoutId = setTimeout(() => {
2148
2171
  if (containerRef.current) {
@@ -2156,11 +2179,11 @@ var LegendGroup = ({
2156
2179
  unregisterControl?.(groupIdRef.current, position);
2157
2180
  };
2158
2181
  }, [position, expandedId, registerControl, unregisterControl]);
2159
- const verticalOffsetStyle = React6__namespace.useMemo(() => {
2182
+ const verticalOffsetStyle = React25__namespace.useMemo(() => {
2160
2183
  return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2161
2184
  }, [customControlOffset, position]);
2162
2185
  const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2163
- const computedPositionClasses = React6__namespace.useMemo(() => {
2186
+ const computedPositionClasses = React25__namespace.useMemo(() => {
2164
2187
  return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2165
2188
  }, [position, hasControlsAtPosition]);
2166
2189
  const getGradientStyle = (legend) => {
@@ -2291,13 +2314,13 @@ var CoordinateDisplay = ({
2291
2314
  class: className
2292
2315
  }) => {
2293
2316
  const { map, loaded, controlOffsets, registerControl, unregisterControl } = useMap();
2294
- const [cursorLngLat, setCursorLngLat] = React6__namespace.useState(null);
2295
- const [currentZoom, setCurrentZoom] = React6__namespace.useState(0);
2296
- const [currentBearing, setCurrentBearing] = React6__namespace.useState(0);
2297
- const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
2298
- const controlRef = React6__namespace.useRef(null);
2299
- const controlIdRef = React6__namespace.useRef(`coord-display-${++coordDisplayIdCounter}`);
2300
- React6__namespace.useEffect(() => {
2317
+ const [cursorLngLat, setCursorLngLat] = React25__namespace.useState(null);
2318
+ const [currentZoom, setCurrentZoom] = React25__namespace.useState(0);
2319
+ const [currentBearing, setCurrentBearing] = React25__namespace.useState(0);
2320
+ const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
2321
+ const controlRef = React25__namespace.useRef(null);
2322
+ const controlIdRef = React25__namespace.useRef(`coord-display-${++coordDisplayIdCounter}`);
2323
+ React25__namespace.useEffect(() => {
2301
2324
  if (!controlRef.current || !registerControl) return;
2302
2325
  const updatePosition = () => {
2303
2326
  if (!controlRef.current) return;
@@ -2313,10 +2336,10 @@ var CoordinateDisplay = ({
2313
2336
  unregisterControl?.(controlIdRef.current, position);
2314
2337
  };
2315
2338
  }, [position, registerControl, unregisterControl]);
2316
- const verticalOffsetStyle = React6__namespace.useMemo(() => {
2339
+ const verticalOffsetStyle = React25__namespace.useMemo(() => {
2317
2340
  return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2318
2341
  }, [customControlOffset, position]);
2319
- const formatCoord = React6__namespace.useCallback(
2342
+ const formatCoord = React25__namespace.useCallback(
2320
2343
  (lngLat) => {
2321
2344
  return mapsCore.formatCoordinates(lngLat, precision, format);
2322
2345
  },
@@ -2330,10 +2353,10 @@ var CoordinateDisplay = ({
2330
2353
  return `${normalized.toFixed(0)}\xB0`;
2331
2354
  };
2332
2355
  const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2333
- const computedPositionClasses = React6__namespace.useMemo(() => {
2356
+ const computedPositionClasses = React25__namespace.useMemo(() => {
2334
2357
  return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2335
2358
  }, [position, hasControlsAtPosition]);
2336
- React6__namespace.useEffect(() => {
2359
+ React25__namespace.useEffect(() => {
2337
2360
  if (!map || !loaded) return;
2338
2361
  setCurrentZoom(map.getZoom());
2339
2362
  setCurrentBearing(map.getBearing());
@@ -2400,16 +2423,16 @@ var BasemapSwitcher = ({
2400
2423
  class: className
2401
2424
  }) => {
2402
2425
  const { controlOffsets, registerControl, unregisterControl, setMapStyle } = useMap();
2403
- const [isOpen, setIsOpen] = React6__namespace.useState(false);
2404
- const [internalActiveId, setInternalActiveId] = React6__namespace.useState(
2426
+ const [isOpen, setIsOpen] = React25__namespace.useState(false);
2427
+ const [internalActiveId, setInternalActiveId] = React25__namespace.useState(
2405
2428
  defaultBasemapId
2406
2429
  );
2407
- const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
2408
- const containerRef = React6__namespace.useRef(null);
2409
- const panelRef = React6__namespace.useRef(null);
2410
- const switcherIdRef = React6__namespace.useRef(`basemap-switcher-${++switcherIdCounter}`);
2430
+ const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
2431
+ const containerRef = React25__namespace.useRef(null);
2432
+ const panelRef = React25__namespace.useRef(null);
2433
+ const switcherIdRef = React25__namespace.useRef(`basemap-switcher-${++switcherIdCounter}`);
2411
2434
  const sourceBasemaps = basemaps ?? mapsCore.FREE_BASEMAPS;
2412
- const availableBasemaps = React6__namespace.useMemo(() => {
2435
+ const availableBasemaps = React25__namespace.useMemo(() => {
2413
2436
  const available = mapsCore.getAvailableBasemaps(sourceBasemaps, apiKeys);
2414
2437
  if (extraBasemaps?.length) {
2415
2438
  return [...available, ...mapsCore.getAvailableBasemaps(extraBasemaps, apiKeys)];
@@ -2417,7 +2440,7 @@ var BasemapSwitcher = ({
2417
2440
  return available;
2418
2441
  }, [sourceBasemaps, extraBasemaps, apiKeys]);
2419
2442
  const currentActiveId = activeBasemapId ?? internalActiveId ?? availableBasemaps[0]?.id;
2420
- React6__namespace.useEffect(() => {
2443
+ React25__namespace.useEffect(() => {
2421
2444
  if (!containerRef.current || !registerControl) return;
2422
2445
  const updatePosition = () => {
2423
2446
  if (!containerRef.current) return;
@@ -2433,7 +2456,7 @@ var BasemapSwitcher = ({
2433
2456
  unregisterControl?.(switcherIdRef.current, position);
2434
2457
  };
2435
2458
  }, [position, registerControl, unregisterControl]);
2436
- React6__namespace.useEffect(() => {
2459
+ React25__namespace.useEffect(() => {
2437
2460
  if (!isOpen) return;
2438
2461
  const handleMouseDown = (e) => {
2439
2462
  if (containerRef.current && !containerRef.current.contains(e.target)) {
@@ -2443,7 +2466,7 @@ var BasemapSwitcher = ({
2443
2466
  document.addEventListener("mousedown", handleMouseDown);
2444
2467
  return () => document.removeEventListener("mousedown", handleMouseDown);
2445
2468
  }, [isOpen]);
2446
- React6__namespace.useEffect(() => {
2469
+ React25__namespace.useEffect(() => {
2447
2470
  if (!isOpen) return;
2448
2471
  const handleKeyDown = (e) => {
2449
2472
  if (e.key === "Escape") {
@@ -2463,11 +2486,11 @@ var BasemapSwitcher = ({
2463
2486
  onBasemapChange?.(basemap);
2464
2487
  setIsOpen(false);
2465
2488
  };
2466
- const verticalOffsetStyle = React6__namespace.useMemo(() => {
2489
+ const verticalOffsetStyle = React25__namespace.useMemo(() => {
2467
2490
  return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2468
2491
  }, [customControlOffset, position]);
2469
2492
  const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2470
- const computedPositionClasses = React6__namespace.useMemo(() => {
2493
+ const computedPositionClasses = React25__namespace.useMemo(() => {
2471
2494
  return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2472
2495
  }, [position, hasControlsAtPosition]);
2473
2496
  const isTop = position.startsWith("top");
@@ -2580,6 +2603,572 @@ var BasemapSwitcher = ({
2580
2603
  );
2581
2604
  };
2582
2605
  BasemapSwitcher.displayName = "BasemapSwitcher";
2606
+ var managerIdCounter = 0;
2607
+ var LayerManager = ({
2608
+ layers,
2609
+ apiKeys,
2610
+ initialActiveLayers,
2611
+ position = "top-right",
2612
+ showSearch = false,
2613
+ showCategories = false,
2614
+ allowReorder = false,
2615
+ showOpacity = false,
2616
+ collapsible = true,
2617
+ onLayerChange,
2618
+ class: className
2619
+ }) => {
2620
+ const { controlOffsets, registerControl, unregisterControl } = useMap();
2621
+ const { isDark } = useMapTheme();
2622
+ const [isOpen, setIsOpen] = React25__namespace.useState(false);
2623
+ const [layerStates, setLayerStates] = React25__namespace.useState(
2624
+ () => mapsCore.createInitialLayerStates(layers, initialActiveLayers)
2625
+ );
2626
+ const [searchQuery, setSearchQuery] = React25__namespace.useState("");
2627
+ const [activeCategory, setActiveCategory] = React25__namespace.useState("all");
2628
+ const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
2629
+ const [expandedOpacity, setExpandedOpacity] = React25__namespace.useState(null);
2630
+ const [draggedId, setDraggedId] = React25__namespace.useState(null);
2631
+ const [dragOver, setDragOver] = React25__namespace.useState(null);
2632
+ const containerRef = React25__namespace.useRef(null);
2633
+ const managerIdRef = React25__namespace.useRef(`layer-manager-${++managerIdCounter}`);
2634
+ const lastLayerIdsRef = React25__namespace.useRef(new Set(layers.map((l) => l.id)));
2635
+ React25__namespace.useEffect(() => {
2636
+ const currentLayerIds = new Set(layers.map((l) => l.id));
2637
+ const hasNewLayers = layers.some((l) => !lastLayerIdsRef.current.has(l.id));
2638
+ const hasRemovedLayers = Array.from(lastLayerIdsRef.current).some(
2639
+ (id) => !currentLayerIds.has(id)
2640
+ );
2641
+ if (hasNewLayers || hasRemovedLayers) {
2642
+ setLayerStates((prev) => {
2643
+ const newStates = new Map(prev);
2644
+ for (const layer of layers) {
2645
+ if (!newStates.has(layer.id)) {
2646
+ newStates.set(layer.id, {
2647
+ id: layer.id,
2648
+ visible: initialActiveLayers?.includes(layer.id) ?? false,
2649
+ opacity: 1,
2650
+ loading: false,
2651
+ error: null,
2652
+ order: newStates.size
2653
+ });
2654
+ }
2655
+ }
2656
+ for (const id of lastLayerIdsRef.current) {
2657
+ if (!currentLayerIds.has(id)) {
2658
+ newStates.delete(id);
2659
+ }
2660
+ }
2661
+ return newStates;
2662
+ });
2663
+ lastLayerIdsRef.current = currentLayerIds;
2664
+ }
2665
+ }, [layers, initialActiveLayers]);
2666
+ const categories = React25__namespace.useMemo(() => mapsCore.getLayerCategories(layers), [layers]);
2667
+ const filteredLayers = React25__namespace.useMemo(() => {
2668
+ let result = layers;
2669
+ if (searchQuery) {
2670
+ result = mapsCore.searchLayers(result, searchQuery);
2671
+ }
2672
+ if (activeCategory !== "all") {
2673
+ result = result.filter((l) => l.category === activeCategory);
2674
+ }
2675
+ return [...result].sort((a, b) => {
2676
+ const orderA = layerStates.get(a.id)?.order ?? 0;
2677
+ const orderB = layerStates.get(b.id)?.order ?? 0;
2678
+ return orderA - orderB;
2679
+ });
2680
+ }, [layers, searchQuery, activeCategory, layerStates]);
2681
+ const layerGroups = React25__namespace.useMemo(
2682
+ () => showCategories ? mapsCore.groupLayersByCategory(filteredLayers) : null,
2683
+ [filteredLayers, showCategories]
2684
+ );
2685
+ React25__namespace.useEffect(() => {
2686
+ if (!containerRef.current || !registerControl) return;
2687
+ const updatePosition = () => {
2688
+ if (!containerRef.current) return;
2689
+ const height = containerRef.current.offsetHeight;
2690
+ const offset = registerControl(managerIdRef.current, position, height);
2691
+ setCustomControlOffset(offset);
2692
+ };
2693
+ updatePosition();
2694
+ const observer = new ResizeObserver(updatePosition);
2695
+ observer.observe(containerRef.current);
2696
+ return () => {
2697
+ observer.disconnect();
2698
+ unregisterControl?.(managerIdRef.current, position);
2699
+ };
2700
+ }, [position, registerControl, unregisterControl]);
2701
+ React25__namespace.useEffect(() => {
2702
+ if (!isOpen) return;
2703
+ const handleMouseDown = (e) => {
2704
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
2705
+ setIsOpen(false);
2706
+ }
2707
+ };
2708
+ document.addEventListener("mousedown", handleMouseDown);
2709
+ return () => document.removeEventListener("mousedown", handleMouseDown);
2710
+ }, [isOpen]);
2711
+ React25__namespace.useEffect(() => {
2712
+ if (!isOpen) return;
2713
+ const handleKeyDown = (e) => {
2714
+ if (e.key === "Escape") {
2715
+ setIsOpen(false);
2716
+ }
2717
+ };
2718
+ document.addEventListener("keydown", handleKeyDown);
2719
+ return () => document.removeEventListener("keydown", handleKeyDown);
2720
+ }, [isOpen]);
2721
+ const handleToggleLayer = React25__namespace.useCallback(
2722
+ (layerId) => {
2723
+ setLayerStates((prev) => {
2724
+ const newStates = mapsCore.toggleLayerVisibility(prev, layerId);
2725
+ const state = newStates.get(layerId);
2726
+ if (state && onLayerChange) {
2727
+ onLayerChange(layerId, state);
2728
+ }
2729
+ return newStates;
2730
+ });
2731
+ },
2732
+ [onLayerChange]
2733
+ );
2734
+ const handleOpacityChange = React25__namespace.useCallback(
2735
+ (layerId, opacity) => {
2736
+ setLayerStates((prev) => {
2737
+ const newStates = mapsCore.setLayerOpacity(prev, layerId, opacity);
2738
+ const state = newStates.get(layerId);
2739
+ if (state && onLayerChange) {
2740
+ onLayerChange(layerId, state);
2741
+ }
2742
+ return newStates;
2743
+ });
2744
+ },
2745
+ [onLayerChange]
2746
+ );
2747
+ const handleDragStart = React25__namespace.useCallback((e, layerId) => {
2748
+ setDraggedId(layerId);
2749
+ e.dataTransfer.effectAllowed = "move";
2750
+ e.dataTransfer.setData("text/plain", layerId);
2751
+ }, []);
2752
+ const handleDragOver = React25__namespace.useCallback(
2753
+ (e, layerId) => {
2754
+ e.preventDefault();
2755
+ e.dataTransfer.dropEffect = "move";
2756
+ if (layerId !== draggedId) {
2757
+ const rect = e.currentTarget.getBoundingClientRect();
2758
+ const relativeY = (e.clientY - rect.top) / rect.height;
2759
+ let position2;
2760
+ if (relativeY < 0.3) {
2761
+ position2 = "above";
2762
+ } else if (relativeY > 0.7) {
2763
+ position2 = "below";
2764
+ } else {
2765
+ position2 = dragOver?.id === layerId ? dragOver.position : "below";
2766
+ }
2767
+ setDragOver({ id: layerId, position: position2 });
2768
+ }
2769
+ },
2770
+ [draggedId, dragOver]
2771
+ );
2772
+ const handleDragLeave = React25__namespace.useCallback(() => {
2773
+ setDragOver(null);
2774
+ }, []);
2775
+ const handleDragEnd = React25__namespace.useCallback(() => {
2776
+ setDraggedId(null);
2777
+ setDragOver(null);
2778
+ }, []);
2779
+ const handleDrop = React25__namespace.useCallback(
2780
+ (e, targetLayerId) => {
2781
+ e.preventDefault();
2782
+ const sourceLayerId = e.dataTransfer.getData("text/plain");
2783
+ if (sourceLayerId && sourceLayerId !== targetLayerId) {
2784
+ const sortedStates = mapsCore.getLayerStatesArray(layerStates);
2785
+ const sourceIndex = sortedStates.findIndex((s) => s.id === sourceLayerId);
2786
+ let targetIndex = sortedStates.findIndex((s) => s.id === targetLayerId);
2787
+ if (targetIndex !== -1) {
2788
+ if (dragOver?.position === "below") {
2789
+ targetIndex += 1;
2790
+ }
2791
+ if (sourceIndex < targetIndex) {
2792
+ targetIndex -= 1;
2793
+ }
2794
+ setLayerStates((prev) => {
2795
+ const newStates = mapsCore.reorderLayers(prev, sourceLayerId, targetIndex);
2796
+ const state = newStates.get(sourceLayerId);
2797
+ if (state && onLayerChange) {
2798
+ onLayerChange(sourceLayerId, state);
2799
+ }
2800
+ return newStates;
2801
+ });
2802
+ }
2803
+ }
2804
+ setDraggedId(null);
2805
+ setDragOver(null);
2806
+ },
2807
+ [layerStates, onLayerChange, dragOver]
2808
+ );
2809
+ const verticalOffsetStyle = React25__namespace.useMemo(() => {
2810
+ return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2811
+ }, [customControlOffset, position]);
2812
+ const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2813
+ const computedPositionClasses = React25__namespace.useMemo(() => {
2814
+ return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2815
+ }, [position, hasControlsAtPosition]);
2816
+ const isTop = position.startsWith("top");
2817
+ const renderLayer = (layer, state) => {
2818
+ if (!state.visible) return null;
2819
+ const theme = isDark ? "dark" : "light";
2820
+ const paint = mapsCore.getLayerStyleForTheme(layer, theme);
2821
+ const sourceUrl = mapsCore.resolveLayerSourceUrl(layer, apiKeys);
2822
+ const sourceId = `lm-source-${layer.id}`;
2823
+ const sourceData = layer.source.type === "geojson-inline" ? layer.source.data : layer.source.type === "geojson-url" && sourceUrl ? sourceUrl : void 0;
2824
+ if (!sourceData && layer.source.type !== "vector-tiles") {
2825
+ return null;
2826
+ }
2827
+ const layerProps = {
2828
+ id: `lm-layer-${layer.id}`,
2829
+ source: sourceId,
2830
+ sourceLayer: layer.source.sourceLayer,
2831
+ visible: state.visible,
2832
+ opacity: state.opacity,
2833
+ minZoom: layer.style.minZoom,
2834
+ maxZoom: layer.style.maxZoom
2835
+ };
2836
+ let layerComponent = null;
2837
+ const baseOpacity = {
2838
+ fill: paint["fill-opacity"] ?? 1,
2839
+ line: paint["line-opacity"] ?? 1,
2840
+ circle: paint["circle-opacity"] ?? 1,
2841
+ icon: paint["icon-opacity"] ?? 1
2842
+ };
2843
+ switch (layer.style.renderType) {
2844
+ case "fill":
2845
+ layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
2846
+ FillLayer,
2847
+ {
2848
+ ...layerProps,
2849
+ fillColor: paint["fill-color"],
2850
+ fillOpacity: baseOpacity.fill * state.opacity,
2851
+ fillOutlineColor: paint["fill-outline-color"]
2852
+ }
2853
+ );
2854
+ break;
2855
+ case "line":
2856
+ layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
2857
+ LineLayer,
2858
+ {
2859
+ ...layerProps,
2860
+ lineColor: paint["line-color"],
2861
+ lineWidth: paint["line-width"],
2862
+ lineOpacity: baseOpacity.line * state.opacity,
2863
+ lineDasharray: paint["line-dasharray"]
2864
+ }
2865
+ );
2866
+ break;
2867
+ case "circle":
2868
+ layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
2869
+ CircleLayer,
2870
+ {
2871
+ ...layerProps,
2872
+ circleColor: paint["circle-color"],
2873
+ circleRadius: paint["circle-radius"],
2874
+ circleOpacity: baseOpacity.circle * state.opacity,
2875
+ circleStrokeWidth: paint["circle-stroke-width"],
2876
+ circleStrokeColor: paint["circle-stroke-color"]
2877
+ }
2878
+ );
2879
+ break;
2880
+ case "symbol":
2881
+ layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
2882
+ SymbolLayer,
2883
+ {
2884
+ ...layerProps,
2885
+ iconImage: paint["icon-image"],
2886
+ iconSize: paint["icon-size"],
2887
+ iconOpacity: baseOpacity.icon * state.opacity,
2888
+ textField: paint["text-field"],
2889
+ textSize: paint["text-size"],
2890
+ textColor: paint["text-color"]
2891
+ }
2892
+ );
2893
+ break;
2894
+ }
2895
+ return /* @__PURE__ */ jsxRuntime.jsx(
2896
+ Source,
2897
+ {
2898
+ id: sourceId,
2899
+ type: layer.source.type === "vector-tiles" ? "vector" : "geojson",
2900
+ data: layer.source.type !== "vector-tiles" ? sourceData : void 0,
2901
+ url: layer.source.type === "vector-tiles" ? sourceUrl ?? void 0 : void 0,
2902
+ tiles: layer.source.type === "vector-tiles" ? [sourceUrl ?? ""] : void 0,
2903
+ attribution: layer.source.attribution,
2904
+ children: layerComponent
2905
+ },
2906
+ layer.id
2907
+ );
2908
+ };
2909
+ const renderLayerItem = (layer) => {
2910
+ const state = layerStates.get(layer.id);
2911
+ if (!state) return null;
2912
+ const isDragging = draggedId === layer.id;
2913
+ const isDragOver = dragOver?.id === layer.id;
2914
+ const dragOverPosition = isDragOver ? dragOver.position : void 0;
2915
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2916
+ "div",
2917
+ {
2918
+ className: "classic-layer-item",
2919
+ draggable: allowReorder,
2920
+ onDragStart: allowReorder ? (e) => handleDragStart(e, layer.id) : void 0,
2921
+ onDragOver: allowReorder ? (e) => handleDragOver(e, layer.id) : void 0,
2922
+ onDragLeave: allowReorder ? handleDragLeave : void 0,
2923
+ onDragEnd: allowReorder ? handleDragEnd : void 0,
2924
+ onDrop: allowReorder ? (e) => handleDrop(e, layer.id) : void 0,
2925
+ "data-dragging": isDragging || void 0,
2926
+ "data-drag-over": dragOverPosition,
2927
+ children: [
2928
+ allowReorder && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "classic-layer-drag-handle text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsxs(
2929
+ "svg",
2930
+ {
2931
+ width: "12",
2932
+ height: "12",
2933
+ viewBox: "0 0 24 24",
2934
+ fill: "none",
2935
+ stroke: "currentColor",
2936
+ strokeWidth: "2",
2937
+ children: [
2938
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "6", r: "1", fill: "currentColor" }),
2939
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "6", r: "1", fill: "currentColor" }),
2940
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "12", r: "1", fill: "currentColor" }),
2941
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "12", r: "1", fill: "currentColor" }),
2942
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "18", r: "1", fill: "currentColor" }),
2943
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "18", r: "1", fill: "currentColor" })
2944
+ ]
2945
+ }
2946
+ ) }),
2947
+ /* @__PURE__ */ jsxRuntime.jsx(
2948
+ themeReact.Switch,
2949
+ {
2950
+ size: "sm",
2951
+ checked: state.visible,
2952
+ onCheckedChange: () => handleToggleLayer(layer.id),
2953
+ "aria-label": `Toggle ${layer.name}`
2954
+ }
2955
+ ),
2956
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
2957
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
2958
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-foreground truncate", children: layer.name }),
2959
+ state.loading && /* @__PURE__ */ jsxRuntime.jsx(
2960
+ "svg",
2961
+ {
2962
+ className: "classic-layer-loading w-3 h-3 text-muted-foreground",
2963
+ viewBox: "0 0 24 24",
2964
+ fill: "none",
2965
+ stroke: "currentColor",
2966
+ strokeWidth: "2",
2967
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" })
2968
+ }
2969
+ )
2970
+ ] }),
2971
+ state.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "classic-layer-error", children: state.error })
2972
+ ] }),
2973
+ showOpacity && state.visible && /* @__PURE__ */ jsxRuntime.jsx(
2974
+ "button",
2975
+ {
2976
+ type: "button",
2977
+ className: "text-muted-foreground hover:text-foreground p-1",
2978
+ onClick: () => setExpandedOpacity(expandedOpacity === layer.id ? null : layer.id),
2979
+ "aria-label": "Adjust opacity",
2980
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
2981
+ "svg",
2982
+ {
2983
+ width: "14",
2984
+ height: "14",
2985
+ viewBox: "0 0 24 24",
2986
+ fill: "none",
2987
+ stroke: "currentColor",
2988
+ strokeWidth: "2",
2989
+ children: [
2990
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
2991
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2a10 10 0 0 1 0 20", fill: "currentColor", opacity: "0.3" })
2992
+ ]
2993
+ }
2994
+ )
2995
+ }
2996
+ )
2997
+ ]
2998
+ },
2999
+ layer.id
3000
+ );
3001
+ };
3002
+ const renderOpacitySlider = (layerId) => {
3003
+ if (expandedOpacity !== layerId) return null;
3004
+ const state = layerStates.get(layerId);
3005
+ if (!state) return null;
3006
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
3007
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground w-12", children: "Opacity" }),
3008
+ /* @__PURE__ */ jsxRuntime.jsx(
3009
+ "input",
3010
+ {
3011
+ type: "range",
3012
+ min: "0",
3013
+ max: "100",
3014
+ value: state.opacity * 100,
3015
+ onChange: (e) => handleOpacityChange(layerId, Number(e.target.value) / 100),
3016
+ className: "classic-layer-opacity-slider flex-1"
3017
+ }
3018
+ ),
3019
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground w-8 text-right", children: [
3020
+ Math.round(state.opacity * 100),
3021
+ "%"
3022
+ ] })
3023
+ ] }) });
3024
+ };
3025
+ const visibleLayerStates = mapsCore.getLayerStatesArray(layerStates).filter((s) => s.visible);
3026
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3027
+ visibleLayerStates.map((state) => {
3028
+ const layer = layers.find((l) => l.id === state.id);
3029
+ return layer ? renderLayer(layer, state) : null;
3030
+ }),
3031
+ /* @__PURE__ */ jsxRuntime.jsxs(
3032
+ "div",
3033
+ {
3034
+ ref: containerRef,
3035
+ className: cn("absolute z-10", computedPositionClasses, className),
3036
+ style: verticalOffsetStyle,
3037
+ children: [
3038
+ isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
3039
+ "div",
3040
+ {
3041
+ className: cn(
3042
+ "absolute classic-layer-panel-enter",
3043
+ "bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
3044
+ "w-64",
3045
+ isTop ? "top-full mt-1" : "bottom-full mb-1",
3046
+ position.includes("right") ? "right-0" : "left-0"
3047
+ ),
3048
+ children: [
3049
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-3 border-b border-border", children: [
3050
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "Layers" }),
3051
+ collapsible && /* @__PURE__ */ jsxRuntime.jsx(
3052
+ "button",
3053
+ {
3054
+ type: "button",
3055
+ className: "text-muted-foreground hover:text-foreground",
3056
+ onClick: () => setIsOpen(false),
3057
+ "aria-label": "Close layer manager",
3058
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3059
+ "svg",
3060
+ {
3061
+ width: "16",
3062
+ height: "16",
3063
+ viewBox: "0 0 24 24",
3064
+ fill: "none",
3065
+ stroke: "currentColor",
3066
+ strokeWidth: "2",
3067
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
3068
+ }
3069
+ )
3070
+ }
3071
+ )
3072
+ ] }),
3073
+ showSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
3074
+ "input",
3075
+ {
3076
+ type: "text",
3077
+ placeholder: "Search layers...",
3078
+ value: searchQuery,
3079
+ onChange: (e) => setSearchQuery(e.target.value),
3080
+ className: "classic-layer-search"
3081
+ }
3082
+ ) }),
3083
+ showCategories && categories.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "classic-layer-tabs", children: [
3084
+ /* @__PURE__ */ jsxRuntime.jsx(
3085
+ "button",
3086
+ {
3087
+ type: "button",
3088
+ className: "classic-layer-tab",
3089
+ "data-active": activeCategory === "all",
3090
+ onClick: () => setActiveCategory("all"),
3091
+ children: "All"
3092
+ }
3093
+ ),
3094
+ categories.map((cat) => /* @__PURE__ */ jsxRuntime.jsx(
3095
+ "button",
3096
+ {
3097
+ type: "button",
3098
+ className: "classic-layer-tab",
3099
+ "data-active": activeCategory === cat,
3100
+ onClick: () => setActiveCategory(cat),
3101
+ children: mapsCore.CATEGORY_META[cat].label
3102
+ },
3103
+ cat
3104
+ ))
3105
+ ] }) }),
3106
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-64 overflow-y-auto", children: [
3107
+ showCategories && layerGroups && activeCategory === "all" ? (
3108
+ // Grouped by category
3109
+ categories.map((cat) => {
3110
+ const catLayers = layerGroups[cat];
3111
+ if (catLayers.length === 0) return null;
3112
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3113
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-xs font-medium text-muted-foreground uppercase tracking-wider", children: mapsCore.CATEGORY_META[cat].label }),
3114
+ catLayers.map((layer) => /* @__PURE__ */ jsxRuntime.jsxs(React25__namespace.Fragment, { children: [
3115
+ renderLayerItem(layer),
3116
+ renderOpacitySlider(layer.id)
3117
+ ] }, layer.id))
3118
+ ] }, cat);
3119
+ })
3120
+ ) : (
3121
+ // Flat list
3122
+ filteredLayers.map((layer) => /* @__PURE__ */ jsxRuntime.jsxs(React25__namespace.Fragment, { children: [
3123
+ renderLayerItem(layer),
3124
+ renderOpacitySlider(layer.id)
3125
+ ] }, layer.id))
3126
+ ),
3127
+ filteredLayers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No layers found" })
3128
+ ] })
3129
+ ]
3130
+ }
3131
+ ),
3132
+ /* @__PURE__ */ jsxRuntime.jsx(
3133
+ "button",
3134
+ {
3135
+ type: "button",
3136
+ className: cn(
3137
+ "w-[40px] h-[40px] flex items-center justify-center",
3138
+ "bg-card rounded shadow-lg border border-black dark:border-gray-400",
3139
+ "hover:bg-muted transition-colors cursor-pointer",
3140
+ "text-foreground"
3141
+ ),
3142
+ onClick: () => setIsOpen(!isOpen),
3143
+ "aria-label": "Toggle layer manager",
3144
+ "aria-expanded": isOpen,
3145
+ "aria-haspopup": "true",
3146
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
3147
+ "svg",
3148
+ {
3149
+ width: "20",
3150
+ height: "20",
3151
+ viewBox: "0 0 24 24",
3152
+ fill: "none",
3153
+ stroke: "currentColor",
3154
+ strokeWidth: "2",
3155
+ strokeLinecap: "round",
3156
+ strokeLinejoin: "round",
3157
+ children: [
3158
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.89 1.45l8 4A2 2 0 0 1 22 7.24v9.53a2 2 0 0 1-1.11 1.79l-8 4a2 2 0 0 1-1.78 0l-8-4a2 2 0 0 1-1.11-1.8V7.24a2 2 0 0 1 1.11-1.79l8-4a2 2 0 0 1 1.78 0z" }),
3159
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "2.32 6.16 12 11 21.68 6.16" }),
3160
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "22.76", x2: "12", y2: "11" })
3161
+ ]
3162
+ }
3163
+ )
3164
+ }
3165
+ )
3166
+ ]
3167
+ }
3168
+ )
3169
+ ] });
3170
+ };
3171
+ LayerManager.displayName = "LayerManager";
2583
3172
  var DeckOverlay = ({
2584
3173
  layers = [],
2585
3174
  onHover,
@@ -2590,9 +3179,9 @@ var DeckOverlay = ({
2590
3179
  deckProps = {}
2591
3180
  }) => {
2592
3181
  const { map, loaded } = useMap();
2593
- const overlayRef = React6__namespace.useRef(null);
2594
- const MapboxOverlayRef = React6__namespace.useRef(null);
2595
- React6__namespace.useEffect(() => {
3182
+ const overlayRef = React25__namespace.useRef(null);
3183
+ const MapboxOverlayRef = React25__namespace.useRef(null);
3184
+ React25__namespace.useEffect(() => {
2596
3185
  if (!map || !loaded) return;
2597
3186
  let cancelled = false;
2598
3187
  const initOverlay = async () => {
@@ -2632,12 +3221,12 @@ var DeckOverlay = ({
2632
3221
  }
2633
3222
  };
2634
3223
  }, [map, loaded, interleaved]);
2635
- React6__namespace.useEffect(() => {
3224
+ React25__namespace.useEffect(() => {
2636
3225
  if (overlayRef.current && "setProps" in overlayRef.current) {
2637
3226
  overlayRef.current.setProps({ layers });
2638
3227
  }
2639
3228
  }, [layers]);
2640
- React6__namespace.useEffect(() => {
3229
+ React25__namespace.useEffect(() => {
2641
3230
  if (overlayRef.current && "setProps" in overlayRef.current) {
2642
3231
  overlayRef.current.setProps({
2643
3232
  onHover,
@@ -2645,7 +3234,7 @@ var DeckOverlay = ({
2645
3234
  });
2646
3235
  }
2647
3236
  }, [onHover, onClick]);
2648
- React6__namespace.useEffect(() => {
3237
+ React25__namespace.useEffect(() => {
2649
3238
  if (overlayRef.current && effects && "setProps" in overlayRef.current) {
2650
3239
  overlayRef.current.setProps({ effects });
2651
3240
  }
@@ -2654,10 +3243,30 @@ var DeckOverlay = ({
2654
3243
  };
2655
3244
  DeckOverlay.displayName = "DeckOverlay";
2656
3245
 
3246
+ Object.defineProperty(exports, "BIKE_LANES", {
3247
+ enumerable: true,
3248
+ get: function () { return mapsCore.BIKE_LANES; }
3249
+ });
2657
3250
  Object.defineProperty(exports, "BUILTIN_BASEMAPS", {
2658
3251
  enumerable: true,
2659
3252
  get: function () { return mapsCore.BUILTIN_BASEMAPS; }
2660
3253
  });
3254
+ Object.defineProperty(exports, "BUILTIN_OVERLAY_LAYERS", {
3255
+ enumerable: true,
3256
+ get: function () { return mapsCore.BUILTIN_OVERLAY_LAYERS; }
3257
+ });
3258
+ Object.defineProperty(exports, "CATEGORY_META", {
3259
+ enumerable: true,
3260
+ get: function () { return mapsCore.CATEGORY_META; }
3261
+ });
3262
+ Object.defineProperty(exports, "CITY_LIMITS", {
3263
+ enumerable: true,
3264
+ get: function () { return mapsCore.CITY_LIMITS; }
3265
+ });
3266
+ Object.defineProperty(exports, "FLOOD_ZONES", {
3267
+ enumerable: true,
3268
+ get: function () { return mapsCore.FLOOD_ZONES; }
3269
+ });
2661
3270
  Object.defineProperty(exports, "FREE_BASEMAPS", {
2662
3271
  enumerable: true,
2663
3272
  get: function () { return mapsCore.FREE_BASEMAPS; }
@@ -2666,6 +3275,18 @@ Object.defineProperty(exports, "OSM_STANDARD", {
2666
3275
  enumerable: true,
2667
3276
  get: function () { return mapsCore.OSM_STANDARD; }
2668
3277
  });
3278
+ Object.defineProperty(exports, "PARKS", {
3279
+ enumerable: true,
3280
+ get: function () { return mapsCore.PARKS; }
3281
+ });
3282
+ Object.defineProperty(exports, "SCHOOL_DISTRICTS", {
3283
+ enumerable: true,
3284
+ get: function () { return mapsCore.SCHOOL_DISTRICTS; }
3285
+ });
3286
+ Object.defineProperty(exports, "SPORTS_FACILITIES", {
3287
+ enumerable: true,
3288
+ get: function () { return mapsCore.SPORTS_FACILITIES; }
3289
+ });
2669
3290
  Object.defineProperty(exports, "THEME_DARK", {
2670
3291
  enumerable: true,
2671
3292
  get: function () { return mapsCore.THEME_DARK; }
@@ -2674,6 +3295,22 @@ Object.defineProperty(exports, "THEME_LIGHT", {
2674
3295
  enumerable: true,
2675
3296
  get: function () { return mapsCore.THEME_LIGHT; }
2676
3297
  });
3298
+ Object.defineProperty(exports, "TRAILS", {
3299
+ enumerable: true,
3300
+ get: function () { return mapsCore.TRAILS; }
3301
+ });
3302
+ Object.defineProperty(exports, "TRANSIT_ROUTES", {
3303
+ enumerable: true,
3304
+ get: function () { return mapsCore.TRANSIT_ROUTES; }
3305
+ });
3306
+ Object.defineProperty(exports, "WATERSHEDS", {
3307
+ enumerable: true,
3308
+ get: function () { return mapsCore.WATERSHEDS; }
3309
+ });
3310
+ Object.defineProperty(exports, "ZONING_DISTRICTS", {
3311
+ enumerable: true,
3312
+ get: function () { return mapsCore.ZONING_DISTRICTS; }
3313
+ });
2677
3314
  Object.defineProperty(exports, "calculateBounds", {
2678
3315
  enumerable: true,
2679
3316
  get: function () { return mapsCore.calculateBounds; }
@@ -2694,6 +3331,10 @@ Object.defineProperty(exports, "createHoverExpression", {
2694
3331
  enumerable: true,
2695
3332
  get: function () { return mapsCore.createHoverExpression; }
2696
3333
  });
3334
+ Object.defineProperty(exports, "createInitialLayerStates", {
3335
+ enumerable: true,
3336
+ get: function () { return mapsCore.createInitialLayerStates; }
3337
+ });
2697
3338
  Object.defineProperty(exports, "createSelectionExpression", {
2698
3339
  enumerable: true,
2699
3340
  get: function () { return mapsCore.createSelectionExpression; }
@@ -2762,10 +3403,26 @@ Object.defineProperty(exports, "getHighlightStyle", {
2762
3403
  enumerable: true,
2763
3404
  get: function () { return mapsCore.getHighlightStyle; }
2764
3405
  });
3406
+ Object.defineProperty(exports, "getLayerCategories", {
3407
+ enumerable: true,
3408
+ get: function () { return mapsCore.getLayerCategories; }
3409
+ });
3410
+ Object.defineProperty(exports, "getLayerStyleForTheme", {
3411
+ enumerable: true,
3412
+ get: function () { return mapsCore.getLayerStyleForTheme; }
3413
+ });
3414
+ Object.defineProperty(exports, "getLayersByCategory", {
3415
+ enumerable: true,
3416
+ get: function () { return mapsCore.getLayersByCategory; }
3417
+ });
2765
3418
  Object.defineProperty(exports, "getSelectionStyle", {
2766
3419
  enumerable: true,
2767
3420
  get: function () { return mapsCore.getSelectionStyle; }
2768
3421
  });
3422
+ Object.defineProperty(exports, "groupLayersByCategory", {
3423
+ enumerable: true,
3424
+ get: function () { return mapsCore.groupLayersByCategory; }
3425
+ });
2769
3426
  Object.defineProperty(exports, "isClusterFeature", {
2770
3427
  enumerable: true,
2771
3428
  get: function () { return mapsCore.isClusterFeature; }
@@ -2790,6 +3447,22 @@ Object.defineProperty(exports, "resolveBasemapStyle", {
2790
3447
  enumerable: true,
2791
3448
  get: function () { return mapsCore.resolveBasemapStyle; }
2792
3449
  });
3450
+ Object.defineProperty(exports, "resolveLayerSourceUrl", {
3451
+ enumerable: true,
3452
+ get: function () { return mapsCore.resolveLayerSourceUrl; }
3453
+ });
3454
+ Object.defineProperty(exports, "searchLayers", {
3455
+ enumerable: true,
3456
+ get: function () { return mapsCore.searchLayers; }
3457
+ });
3458
+ Object.defineProperty(exports, "setLayerOpacity", {
3459
+ enumerable: true,
3460
+ get: function () { return mapsCore.setLayerOpacity; }
3461
+ });
3462
+ Object.defineProperty(exports, "toggleLayerVisibility", {
3463
+ enumerable: true,
3464
+ get: function () { return mapsCore.toggleLayerVisibility; }
3465
+ });
2793
3466
  Object.defineProperty(exports, "validateGeoJSON", {
2794
3467
  enumerable: true,
2795
3468
  get: function () { return mapsCore.validateGeoJSON; }
@@ -2801,10 +3474,11 @@ exports.DeckOverlay = DeckOverlay;
2801
3474
  exports.FillExtrusionLayer = FillExtrusionLayer;
2802
3475
  exports.FillLayer = FillLayer;
2803
3476
  exports.HeatmapLayer = HeatmapLayer;
3477
+ exports.LayerManager = LayerManager;
2804
3478
  exports.Legend = Legend;
2805
3479
  exports.LegendGroup = LegendGroup;
2806
3480
  exports.LineLayer = LineLayer;
2807
- exports.Map = Map;
3481
+ exports.Map = Map2;
2808
3482
  exports.MapContainer = MapContainer;
2809
3483
  exports.MapContext = MapContext;
2810
3484
  exports.MapEmpty = MapEmpty;