@geowiki/map 0.16.9-dev.9 → 0.16.9

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.js CHANGED
@@ -166,8 +166,7 @@ function getAdjPixel(y, x, selectedValue, array2dMatrix) {
166
166
  while (pixelsToCheck.length > 0) {
167
167
  const [xTiff, yTiff] = pixelsToCheck.pop();
168
168
  var key = xTiff + "_" + yTiff;
169
- if (checkedPixels.has(key))
170
- continue;
169
+ if (checkedPixels.has(key)) continue;
171
170
  checkedPixels.add(key);
172
171
  if (array2dMatrix[yTiff][xTiff] === selectedValue) {
173
172
  sameValPixels.push([yTiff, xTiff]);
@@ -195,8 +194,7 @@ function pointInsidePolygon(xTiff, yTiff, vs) {
195
194
  var xi = vs[i].xTiff, yi = vs[i].yTiff;
196
195
  var xj = vs[j].xTiff, yj = vs[j].yTiff;
197
196
  var intersect = yi > yTiff !== yj > yTiff && xTiff < (xj - xi) * (yTiff - yi) / (yj - yi) + xi;
198
- if (intersect)
199
- inside = !inside;
197
+ if (intersect) inside = !inside;
200
198
  }
201
199
  return inside;
202
200
  }
@@ -305,8 +303,8 @@ var init_canvas = __esm({
305
303
  ctx == null ? void 0 : ctx.putImageData(imageData, 0, 0);
306
304
  return canvas;
307
305
  };
308
- getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvasContext, selectedBand) => __async(void 0, null, function* () {
309
- var _a, _b;
306
+ getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvasContext, selectedBand) => __async(null, null, function* () {
307
+ var _a;
310
308
  try {
311
309
  var tiffWidth = rasterItem.width;
312
310
  var tiffHeight = rasterItem.height;
@@ -319,10 +317,9 @@ var init_canvas = __esm({
319
317
  );
320
318
  let selectedValue = raster[xTiff + yTiff * tiffWidth];
321
319
  var rgb = null;
322
- if (((_a = rasterItem.name) == null ? void 0 : _a.toLowerCase().includes("ndvi")) && ((_b = rasterItem.name) == null ? void 0 : _b.toLowerCase().includes("perc")))
320
+ if ((_a = rasterItem.name) == null ? void 0 : _a.toLowerCase().includes("ndvi"))
323
321
  rgb = yield getNDVIValueForPixel(ndviImageCanvasContext, xTiff, yTiff);
324
- else
325
- rgb = null;
322
+ else rgb = null;
326
323
  return [
327
324
  selectedValue,
328
325
  rgb !== null && rgb !== void 0 ? {
@@ -365,12 +362,11 @@ var init_canvas = __esm({
365
362
  rasterItem.buffer = [...asset.buffer];
366
363
  rasterItem.uri = [...asset.uri];
367
364
  rasterItem.buffer[selectedBand] = new Uint32Array(assetBuffer);
368
- if (Array.isArray(rasterItem.uri))
369
- rasterItem.uri[selectedBand] = uri;
365
+ if (Array.isArray(rasterItem.uri)) rasterItem.uri[selectedBand] = uri;
370
366
  }
371
367
  return rasterItem;
372
368
  };
373
- getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnnotation, selectedBand, metadata) => __async(void 0, null, function* () {
369
+ getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnnotation, selectedBand, metadata) => __async(null, null, function* () {
374
370
  var { newArray, canvas } = yield getEmptyPreviewRasterItemForInsert(
375
371
  length,
376
372
  width,
@@ -395,12 +391,12 @@ var init_canvas = __esm({
395
391
  }
396
392
  return rasterItem;
397
393
  });
398
- getEmptyPreviewRasterItemForInsert = (length, width, height, labels) => __async(void 0, null, function* () {
394
+ getEmptyPreviewRasterItemForInsert = (length, width, height, labels) => __async(null, null, function* () {
399
395
  const newArray = new Uint32Array(length).fill(0);
400
396
  const canvas = grayScaleArrayToCanvas(newArray, width, height, labels);
401
397
  return { newArray, canvas };
402
398
  });
403
- updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnnotation) => __async(void 0, null, function* () {
399
+ updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnnotation) => __async(null, null, function* () {
404
400
  var _a, _b, _c;
405
401
  if (!fromRasterItem) {
406
402
  return toPreviewRasterItem;
@@ -426,7 +422,7 @@ var init_canvas = __esm({
426
422
  }
427
423
  return toPreviewRasterItem;
428
424
  });
429
- getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(void 0, null, function* () {
425
+ getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(null, null, function* () {
430
426
  const tiff = yield (0, import_geotiff.fromArrayBuffer)(arrayBuffer);
431
427
  const image = yield tiff.getImage();
432
428
  const pool = new import_geotiff.Pool();
@@ -450,7 +446,7 @@ var init_canvas = __esm({
450
446
  pool.destroy();
451
447
  return { width, height, rasterItems };
452
448
  });
453
- getRasterItems = (arrayBuffer, projectType) => __async(void 0, null, function* () {
449
+ getRasterItems = (arrayBuffer, projectType) => __async(null, null, function* () {
454
450
  const tiff = yield (0, import_geotiff.fromArrayBuffer)(arrayBuffer);
455
451
  const image = yield tiff.getImage();
456
452
  const pool = new import_geotiff.Pool();
@@ -490,7 +486,7 @@ var init_canvas = __esm({
490
486
  pool.destroy();
491
487
  return { rasters, width, height, rasterItems };
492
488
  });
493
- getAssetItemsForLocationAssets = (assets, labels) => __async(void 0, null, function* () {
489
+ getAssetItemsForLocationAssets = (assets, labels) => __async(null, null, function* () {
494
490
  var rasterItems = [];
495
491
  for (var i = 0; i < (assets == null ? void 0 : assets.length); i++) {
496
492
  const item = assets[i];
@@ -513,7 +509,7 @@ var init_canvas = __esm({
513
509
  }
514
510
  return rasterItems;
515
511
  });
516
- getRasterAssetItemsForLocationComposite = (assets) => __async(void 0, null, function* () {
512
+ getRasterAssetItemsForLocationComposite = (assets) => __async(null, null, function* () {
517
513
  var rasterItems = [];
518
514
  for (var i = 0; i < (assets == null ? void 0 : assets.length); i++) {
519
515
  const item = assets[i];
@@ -534,7 +530,7 @@ var init_canvas = __esm({
534
530
  }
535
531
  return rasterItems;
536
532
  });
537
- copyAllRasterSegments = (rasterItem, previewRasterItem, selectedValue, labelValue, labels) => __async(void 0, null, function* () {
533
+ copyAllRasterSegments = (rasterItem, previewRasterItem, selectedValue, labelValue, labels) => __async(null, null, function* () {
538
534
  var newBuffer = overwriteArrayBufferWithSelectedValue(
539
535
  rasterItem.buffer,
540
536
  previewRasterItem.buffer,
@@ -603,7 +599,7 @@ var init_canvas = __esm({
603
599
  return destRasterItem;
604
600
  }
605
601
  };
606
- paintRasterSegment = (sourceRasterItem, destRasterItem, locations, bounds, labelValue, labels, paintType, selectedBand, isAnnualAnnotation) => __async(void 0, null, function* () {
602
+ paintRasterSegment = (sourceRasterItem, destRasterItem, locations, bounds, labelValue, labels, paintType, selectedBand, isAnnualAnnotation) => __async(null, null, function* () {
607
603
  var tiffWidth = sourceRasterItem.width;
608
604
  var tiffHeight = sourceRasterItem.height;
609
605
  var annotatedRaster = isAnnualAnnotation ? destRasterItem.buffer : destRasterItem.buffer[selectedBand];
@@ -720,7 +716,7 @@ var init_canvas = __esm({
720
716
  destRasterItem.name = "My Annotation";
721
717
  return destRasterItem;
722
718
  });
723
- getActiveLearningAnnotation = (assetHref, projectType) => __async(void 0, null, function* () {
719
+ getActiveLearningAnnotation = (assetHref, projectType) => __async(null, null, function* () {
724
720
  const res = yield fetch(assetHref);
725
721
  const buffer = yield res.arrayBuffer();
726
722
  const rItems = yield getRasterItems(buffer, projectType);
@@ -737,7 +733,7 @@ var init_canvas = __esm({
737
733
  };
738
734
  return assetItem;
739
735
  });
740
- createImageDataForNDVI = (asset) => __async(void 0, null, function* () {
736
+ createImageDataForNDVI = (asset) => __async(null, null, function* () {
741
737
  var canvas = document.createElement("canvas");
742
738
  var context = canvas.getContext("2d");
743
739
  var image = new Image();
@@ -747,7 +743,7 @@ var init_canvas = __esm({
747
743
  context == null ? void 0 : context.drawImage(image, 0, 0, canvas.width, canvas.height);
748
744
  return context;
749
745
  });
750
- getNDVIValueForPixel = (ndviImageCanvasContext, x, y) => __async(void 0, null, function* () {
746
+ getNDVIValueForPixel = (ndviImageCanvasContext, x, y) => __async(null, null, function* () {
751
747
  var context = ndviImageCanvasContext;
752
748
  var data = context == null ? void 0 : context.getImageData(x, y, 1, 1).data;
753
749
  return data;
@@ -961,8 +957,7 @@ function getRasterAssetItemsForLocationAssets(assets) {
961
957
  if (Array.isArray((_a = rItem.result) == null ? void 0 : _a.base64)) {
962
958
  bufferData = (_b = rItem.result) == null ? void 0 : _b.base64.map((x) => {
963
959
  var _a2, _b2;
964
- if (((_a2 = rItem.result) == null ? void 0 : _a2.arrayType) == "uint8")
965
- return Buffer.from(x, "base64");
960
+ if (((_a2 = rItem.result) == null ? void 0 : _a2.arrayType) == "uint8") return Buffer.from(x, "base64");
966
961
  else if (((_b2 = rItem.result) == null ? void 0 : _b2.arrayType) == "uint32") {
967
962
  const buffer2 = Buffer.from(x, "base64");
968
963
  return new Uint32Array(
@@ -1043,16 +1038,14 @@ function ClearAnnotation(annotatedRasterAsset, isAnnualAnnotation, selectedBand,
1043
1038
  selectedBand,
1044
1039
  annotationRasterAsset.metadata
1045
1040
  );
1046
- if (isAnnualAnnotation)
1047
- return { annotationRaster, pastValues };
1041
+ if (isAnnualAnnotation) return { annotationRaster, pastValues };
1048
1042
  else {
1049
1043
  var multiBandAnnotation = annotatedRasterAsset;
1050
1044
  if (multiBandAnnotation == null ? void 0 : multiBandAnnotation.buffer[selectedBand]) {
1051
1045
  multiBandAnnotation.buffer[selectedBand] = annotationRaster.buffer[selectedBand];
1052
1046
  multiBandAnnotation.uri[selectedBand] = annotationRaster.uri[selectedBand];
1053
1047
  return { multiBandAnnotation, undefined: void 0 };
1054
- } else
1055
- return { annotatedRasterAsset: void 0, undefined: void 0 };
1048
+ } else return { annotatedRasterAsset: void 0, undefined: void 0 };
1056
1049
  }
1057
1050
  });
1058
1051
  }
@@ -1086,8 +1079,7 @@ function createTask(locationId, projectId, referenceDate) {
1086
1079
  currentTask: res.task,
1087
1080
  annotation_dates: yield getAnnotationDates(res == null ? void 0 : res.task)
1088
1081
  };
1089
- } else
1090
- return { location: null, currentTask: null, annotation_dates: null };
1082
+ } else return { location: null, currentTask: null, annotation_dates: null };
1091
1083
  });
1092
1084
  }
1093
1085
  function getTask(taskId) {
@@ -1115,8 +1107,7 @@ function getTask(taskId) {
1115
1107
  annotation_dates: yield getAnnotationDates(res == null ? void 0 : res.task),
1116
1108
  location: locData
1117
1109
  };
1118
- } else
1119
- return { currentTask: null, annotation_dates: null, location: null };
1110
+ } else return { currentTask: null, annotation_dates: null, location: null };
1120
1111
  });
1121
1112
  }
1122
1113
  function getActiveLearningAnnotationAsset(assetHref, labels, projectDetail) {
@@ -1168,8 +1159,7 @@ function insertEmptyBufferForSingleBand(length, width, height, selectedBand, ann
1168
1159
  annotatedAsset.buffer[selectedBand] = newArray;
1169
1160
  annotatedAsset.uri[selectedBand] = canvas.toDataURL();
1170
1161
  return annotatedAsset;
1171
- } else
1172
- return null;
1162
+ } else return null;
1173
1163
  });
1174
1164
  }
1175
1165
  function getTaskChangeDetails(taskId) {
@@ -1183,10 +1173,8 @@ function getTaskGeometryDetail(taskId) {
1183
1173
  });
1184
1174
  }
1185
1175
  function getCentroid(geometry, has_area_of_interest, geometry_aoi, is_segment, geometry_segment) {
1186
- if (has_area_of_interest)
1187
- return geometry_aoi;
1188
- if (is_segment)
1189
- return geometry_segment;
1176
+ if (has_area_of_interest) return geometry_aoi;
1177
+ if (is_segment) return geometry_segment;
1190
1178
  return geometry;
1191
1179
  }
1192
1180
  function showAnnotation(savedAnnotations, submittedAnnotations, annotatedRasterAsset) {
@@ -1270,7 +1258,10 @@ var init_evoland = __esm({
1270
1258
  isAnnualAnnotation: true,
1271
1259
  selectedBand: void 0,
1272
1260
  taskGeometry: null,
1273
- task_for_review: false
1261
+ task_for_review: false,
1262
+ s2_tile_url: null,
1263
+ landsat_tile_url: null,
1264
+ selectedBaseLayer: null
1274
1265
  };
1275
1266
  useEvolandStore = (0, import_zustand.create)()((set) => ({
1276
1267
  clickPoint: null,
@@ -1323,10 +1314,13 @@ var init_evoland = __esm({
1323
1314
  selectedBand: void 0,
1324
1315
  taskGeometry: null,
1325
1316
  task_for_review: false,
1317
+ s2_tile_url: null,
1318
+ landsat_tile_url: null,
1319
+ selectedBaseLayer: null,
1326
1320
  setSelectedRasterAsset: (selectedRaster) => {
1327
1321
  var _a;
1328
1322
  set({ selectedRasterAsset: selectedRaster });
1329
- if ((selectedRaster == null ? void 0 : selectedRaster.type) == "SEGMENTATION_MASK" /* SegmentationMask */ && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi perc"))) {
1323
+ if ((selectedRaster == null ? void 0 : selectedRaster.type) == "SEGMENTATION_MASK" /* SegmentationMask */ && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi"))) {
1330
1324
  createImageDataForNDVI(selectedRaster).then((res) => {
1331
1325
  set({ ndviImageCanvasContext: res });
1332
1326
  });
@@ -1334,9 +1328,9 @@ var init_evoland = __esm({
1334
1328
  },
1335
1329
  setAnnotationUndoRedo: (annotationUndoRedo, annotatedRasterAsset) => set({ annotationUndoRedo, annotatedRasterAsset }),
1336
1330
  setSelectedCompositeRasterAsset: (selectedRaster) => {
1337
- var _a, _b;
1331
+ var _a;
1338
1332
  set({ selectedCompositeRasterAsset: selectedRaster });
1339
- if ((selectedRaster == null ? void 0 : selectedRaster.type) == "COMPOSITE" /* Composite */ && selectedRaster.isInteractive && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi")) && ((_b = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _b.toLowerCase().includes("perc"))) {
1333
+ if ((selectedRaster == null ? void 0 : selectedRaster.type) == "COMPOSITE" /* Composite */ && selectedRaster.isInteractive && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi"))) {
1340
1334
  createImageDataForNDVI(selectedRaster).then((res) => {
1341
1335
  set({ ndviImageCanvasContext: res });
1342
1336
  });
@@ -1347,7 +1341,7 @@ var init_evoland = __esm({
1347
1341
  setRecenterLocation: () => set({ recenterLocation: false }),
1348
1342
  setTimerReset: (timerreset) => set({ timerReset: timerreset }),
1349
1343
  setAnnotationTime: (annotationtime) => set({ annotationTime: annotationtime }),
1350
- onLocationSelected: (point3) => __async(void 0, null, function* () {
1344
+ onLocationSelected: (point3) => __async(null, null, function* () {
1351
1345
  var data = yield import_evoland_api_proxy2.LocationService.getPolygonUtmlocationLonLonLatLatWidthWidthHeightHeightGet(
1352
1346
  point3.lng,
1353
1347
  point3.lat,
@@ -1373,10 +1367,10 @@ var init_evoland = __esm({
1373
1367
  location: locData
1374
1368
  });
1375
1369
  }),
1376
- onRecenterLocation: () => __async(void 0, null, function* () {
1370
+ onRecenterLocation: () => __async(null, null, function* () {
1377
1371
  return set({ recenterLocation: true });
1378
1372
  }),
1379
- getLocationAssets: (locationId, projectId, type, taskId) => __async(void 0, null, function* () {
1373
+ getLocationAssets: (locationId, projectId, type, taskId) => __async(null, null, function* () {
1380
1374
  var _a, _b;
1381
1375
  const state = useEvolandStore.getState();
1382
1376
  var {
@@ -1499,12 +1493,16 @@ var init_evoland = __esm({
1499
1493
  }
1500
1494
  return [];
1501
1495
  }),
1502
- getLocationDetails: (locationId, projectId, user, taskId, isAdmin) => __async(void 0, null, function* () {
1496
+ getLocationDetails: (locationId, projectId, user, taskId, isAdmin) => __async(null, null, function* () {
1503
1497
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1504
1498
  var state = useEvolandStore.getState();
1505
1499
  var { referenceDate, reference_dates, sessionTimeOut, projectDetail, task_for_review } = state;
1506
- if (!referenceDate)
1500
+ if (!referenceDate) {
1507
1501
  referenceDate = projectDetail.project_reference_date.toString();
1502
+ set({
1503
+ referenceDate
1504
+ });
1505
+ }
1508
1506
  var annotationDates = null;
1509
1507
  var locationreq = {
1510
1508
  location_id: locationId,
@@ -1588,7 +1586,7 @@ var init_evoland = __esm({
1588
1586
  }
1589
1587
  }
1590
1588
  }),
1591
- getNextLocationDetails: (projectId) => __async(void 0, null, function* () {
1589
+ getNextLocationDetails: (projectId) => __async(null, null, function* () {
1592
1590
  var _a, _b, _c;
1593
1591
  set({ isLoading: true });
1594
1592
  var state = useEvolandStore.getState();
@@ -1657,7 +1655,7 @@ var init_evoland = __esm({
1657
1655
  setOpacity: (opacity) => set({ opacity }),
1658
1656
  setCompositeOpacity: (opacity) => set({ compositeOpacity: opacity }),
1659
1657
  setAnnotationOpacity: (opacity) => set({ annotationOpacity: opacity }),
1660
- addLabel: (loc, bounds, label) => __async(void 0, null, function* () {
1658
+ addLabel: (loc, bounds, label) => __async(null, null, function* () {
1661
1659
  var _a;
1662
1660
  set({ isLoading: true });
1663
1661
  var store = useEvolandStore.getState();
@@ -1717,14 +1715,14 @@ var init_evoland = __esm({
1717
1715
  setShowTimeSeries: (value) => set({ showTimeSeries: value }),
1718
1716
  reset: () => set(initialState),
1719
1717
  setSelectedColorLabel: (label) => set({ selectedColorLabel: label }),
1720
- getLegendsDetails: (array) => __async(void 0, null, function* () {
1718
+ getLegendsDetails: (array) => __async(null, null, function* () {
1721
1719
  var store = useEvolandStore.getState();
1722
1720
  var legends = yield getLegends(array, store.labels);
1723
1721
  set({
1724
1722
  legends
1725
1723
  });
1726
1724
  }),
1727
- getLocationMetaData: (locationId, projectId, taskId) => __async(void 0, null, function* () {
1725
+ getLocationMetaData: (locationId, projectId, taskId) => __async(null, null, function* () {
1728
1726
  var _a, _b;
1729
1727
  set({ isLoading: true });
1730
1728
  var state = useEvolandStore.getState();
@@ -1750,7 +1748,7 @@ var init_evoland = __esm({
1750
1748
  set({ sessionTimeOut: true, isLoading: false });
1751
1749
  }
1752
1750
  }),
1753
- getLabels: (projectId) => __async(void 0, null, function* () {
1751
+ getLabels: (projectId) => __async(null, null, function* () {
1754
1752
  var state = useEvolandStore.getState();
1755
1753
  if (state.labels) {
1756
1754
  return state.labels;
@@ -1772,10 +1770,10 @@ var init_evoland = __esm({
1772
1770
  });
1773
1771
  return allLabels;
1774
1772
  }),
1775
- setBrushThickness: (value) => __async(void 0, null, function* () {
1773
+ setBrushThickness: (value) => __async(null, null, function* () {
1776
1774
  return set({ brushThickness: value });
1777
1775
  }),
1778
- getProjectDetail: (projectId) => __async(void 0, null, function* () {
1776
+ getProjectDetail: (projectId) => __async(null, null, function* () {
1779
1777
  set({ isLoading: true });
1780
1778
  const projectInfo = yield import_evoland_api_proxy2.ProjectService.projectDetailProjectdetailProjectIdProjectIdGet(
1781
1779
  projectId
@@ -1786,12 +1784,12 @@ var init_evoland = __esm({
1786
1784
  isAnnualAnnotation: (projectInfo == null ? void 0 : projectInfo.project_type) == "ANNUALLY" /* ANNUALLY */ ? true : false
1787
1785
  });
1788
1786
  }),
1789
- getTaskEvents: (taskId) => __async(void 0, null, function* () {
1787
+ getTaskEvents: (taskId) => __async(null, null, function* () {
1790
1788
  set({ isLoading: true });
1791
1789
  const taskevents = yield import_evoland_api_proxy2.TaskService.getTaskEventsTaskeventsTaskIdTaskIdGet(taskId);
1792
1790
  set({ isLoading: false, taskEvents: taskevents });
1793
1791
  }),
1794
- getTaskAnnotation: (submittedAnnotationAsset, assetType) => __async(void 0, null, function* () {
1792
+ getTaskAnnotation: (submittedAnnotationAsset, assetType) => __async(null, null, function* () {
1795
1793
  var _a, _b, _c;
1796
1794
  if (submittedAnnotationAsset != null && submittedAnnotationAsset.length > 0) {
1797
1795
  const state = useEvolandStore.getState();
@@ -1841,7 +1839,7 @@ var init_evoland = __esm({
1841
1839
  setCurrentPosition: (position) => set({ currentPosition: position }),
1842
1840
  setSessionTimeOut: (hasTimeOut) => set({ sessionTimeOut: hasTimeOut }),
1843
1841
  setLatestTaskAnnotation: (locationTask) => set({ latestTaskAnnotation: locationTask }),
1844
- getTaskReferenceDates: (projectId, locatioId, asset_type, setSelected) => __async(void 0, null, function* () {
1842
+ getTaskReferenceDates: (projectId, locatioId, asset_type, setSelected) => __async(null, null, function* () {
1845
1843
  const state = useEvolandStore.getState();
1846
1844
  const { annotation_dates, reference_dates, selectedReferenceDate } = state;
1847
1845
  var task_ref_dates = yield getRefDates(projectId, locatioId, asset_type);
@@ -1857,7 +1855,7 @@ var init_evoland = __esm({
1857
1855
  });
1858
1856
  }
1859
1857
  }),
1860
- setSelectedReferenceDate: (currentReferenceDate) => __async(void 0, null, function* () {
1858
+ setSelectedReferenceDate: (currentReferenceDate) => __async(null, null, function* () {
1861
1859
  const state = useEvolandStore.getState();
1862
1860
  const { selectedReferenceDate, reference_dates } = state;
1863
1861
  if (currentReferenceDate !== selectedReferenceDate)
@@ -1866,53 +1864,62 @@ var init_evoland = __esm({
1866
1864
  selectedBand: reference_dates == null ? void 0 : reference_dates.indexOf(currentReferenceDate)
1867
1865
  });
1868
1866
  }),
1869
- setUpdateAsset: (updateAssets) => __async(void 0, null, function* () {
1867
+ setUpdateAsset: (updateAssets) => __async(null, null, function* () {
1870
1868
  return set({ updateAssets });
1871
1869
  }),
1872
- setComment: (comment) => __async(void 0, null, function* () {
1870
+ setComment: (comment) => __async(null, null, function* () {
1873
1871
  return set({ comment });
1874
1872
  }),
1875
- setAnnualAnnotation: (val) => __async(void 0, null, function* () {
1873
+ setAnnualAnnotation: (val) => __async(null, null, function* () {
1876
1874
  return set({ isAnnualAnnotation: val });
1877
1875
  }),
1878
- setSelectedBand: (bandIndex) => __async(void 0, null, function* () {
1876
+ setSelectedBand: (bandIndex) => __async(null, null, function* () {
1879
1877
  return set({ selectedBand: bandIndex });
1880
1878
  }),
1881
- setAnnotationDates: (annotationDates) => __async(void 0, null, function* () {
1879
+ setAnnotationDates: (annotationDates) => __async(null, null, function* () {
1882
1880
  return set({ annotation_dates: annotationDates });
1883
1881
  }),
1884
- setSavedAnnotations: (savedAnnotation) => __async(void 0, null, function* () {
1882
+ setSavedAnnotations: (savedAnnotation) => __async(null, null, function* () {
1885
1883
  return set({ savedAnnotations: savedAnnotation });
1886
1884
  }),
1887
- setLabelList: (labels) => __async(void 0, null, function* () {
1885
+ setLabelList: (labels) => __async(null, null, function* () {
1888
1886
  return set({ labelList: labels });
1889
1887
  }),
1890
- setLocation: (loc) => __async(void 0, null, function* () {
1888
+ setLocation: (loc) => __async(null, null, function* () {
1891
1889
  return set({ location: loc });
1892
1890
  }),
1893
- setCurrentTask: (task) => __async(void 0, null, function* () {
1891
+ setCurrentTask: (task) => __async(null, null, function* () {
1894
1892
  return set({ currentTask: task });
1895
1893
  }),
1896
- setTimeSeriesTypes: (types) => __async(void 0, null, function* () {
1894
+ setTimeSeriesTypes: (types) => __async(null, null, function* () {
1897
1895
  return set({ timeSeriesTypes: types });
1898
1896
  }),
1899
- setTimeSeriesAssets: (assets) => __async(void 0, null, function* () {
1897
+ setTimeSeriesAssets: (assets) => __async(null, null, function* () {
1900
1898
  return set({ timeSeriesAssets: assets });
1901
1899
  }),
1902
- setActiveLearningAnnotations: (active_learning) => __async(void 0, null, function* () {
1900
+ setActiveLearningAnnotations: (active_learning) => __async(null, null, function* () {
1903
1901
  return set({ activeLearningAnnotations: active_learning });
1904
1902
  }),
1905
- setSubmittedAnnotations: (submit_annotation) => __async(void 0, null, function* () {
1903
+ setSubmittedAnnotations: (submit_annotation) => __async(null, null, function* () {
1906
1904
  return set({ submittedAnnotations: submit_annotation });
1907
1905
  }),
1908
- setAnnotatedRasterAsset: (annotated_raster) => __async(void 0, null, function* () {
1906
+ setAnnotatedRasterAsset: (annotated_raster) => __async(null, null, function* () {
1909
1907
  return set({ annotatedRasterAsset: annotated_raster });
1910
1908
  }),
1911
- setTaskGeometry: (task_geometry) => __async(void 0, null, function* () {
1909
+ setTaskGeometry: (task_geometry) => __async(null, null, function* () {
1912
1910
  return set({ taskGeometry: task_geometry });
1913
1911
  }),
1914
1912
  setTaskForReview(taskForReview) {
1915
1913
  set({ task_for_review: taskForReview });
1914
+ },
1915
+ setS2TileUrl(url) {
1916
+ set({ s2_tile_url: url });
1917
+ },
1918
+ setLandsatTileUrl(url) {
1919
+ set({ landsat_tile_url: url });
1920
+ },
1921
+ setSelectedBaseLayer(baseLayer) {
1922
+ set({ selectedBaseLayer: baseLayer });
1916
1923
  }
1917
1924
  }));
1918
1925
  evoland_default = useEvolandStore;
@@ -2039,8 +2046,7 @@ var init_TiffImage = __esm({
2039
2046
  } else if (localcomment !== void 0 && (localcomment == null ? void 0 : localcomment.includes("#" + x))) {
2040
2047
  localcomment = localcomment.replace(" #" + x, "");
2041
2048
  this.className = "rounded-xl flex inline-flex text-secondary p-1 text-sm";
2042
- } else
2043
- localcomment = "#" + x + " ";
2049
+ } else localcomment = "#" + x + " ";
2044
2050
  if (evolandStore.comment !== void 0 && evolandStore.comment !== null && !((_a5 = evolandStore.comment) == null ? void 0 : _a5.includes("#" + x)))
2045
2051
  evolandStore.setComment(
2046
2052
  evolandStore.comment + localcomment
@@ -2049,8 +2055,7 @@ var init_TiffImage = __esm({
2049
2055
  evolandStore.setComment(
2050
2056
  evolandStore.comment.replace(" #" + x, "")
2051
2057
  );
2052
- else
2053
- evolandStore.setComment(localcomment);
2058
+ else evolandStore.setComment(localcomment);
2054
2059
  });
2055
2060
  container.appendChild(content);
2056
2061
  }
@@ -2091,7 +2096,7 @@ var init_TiffImage = __esm({
2091
2096
  bubblingMouseEvents: false,
2092
2097
  className: "border-2 border-blue-600"
2093
2098
  }).bringToFront();
2094
- imageOverlay3.on("mouseover", (e) => __async(void 0, null, function* () {
2099
+ imageOverlay3.on("mouseover", (e) => __async(null, null, function* () {
2095
2100
  var _a3, _b2;
2096
2101
  if (isBrush()) {
2097
2102
  tooltip2 = L.tooltip({ offset: L.point(20, 0), opacity: 0.6 }).setContent(
@@ -2113,21 +2118,20 @@ var init_TiffImage = __esm({
2113
2118
  ).setLatLng(e.latlng).addTo(map);
2114
2119
  }
2115
2120
  }));
2116
- imageOverlay3.on("mousemove", (e) => __async(void 0, null, function* () {
2121
+ imageOverlay3.on("mousemove", (e) => __async(null, null, function* () {
2117
2122
  evolandStore.setNDVIRGBValues(ndvi);
2118
2123
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2119
2124
  if (isDrawing) {
2120
2125
  handleMouseMove(e);
2121
2126
  }
2122
2127
  }));
2123
- imageOverlay3.on("mouseout", () => __async(void 0, null, function* () {
2128
+ imageOverlay3.on("mouseout", () => __async(null, null, function* () {
2124
2129
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2125
2130
  }));
2126
- imageOverlay3.on("click", (e) => __async(void 0, null, function* () {
2131
+ imageOverlay3.on("click", (e) => __async(null, null, function* () {
2127
2132
  var _a3, _b2, _c2;
2128
2133
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2129
- if (((_a3 = evolandStore.selectedRasterAsset) == null ? void 0 : _a3.type) == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */)
2130
- return;
2134
+ if (((_a3 = evolandStore.selectedRasterAsset) == null ? void 0 : _a3.type) == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */) return;
2131
2135
  if (evolandStore.selectedColorLabel == null && evolandStore.selectedToolType !== 6 /* ClearSegmentWithPolygon */) {
2132
2136
  alert("Please select label");
2133
2137
  return;
@@ -2174,25 +2178,23 @@ var init_TiffImage = __esm({
2174
2178
  opacity: 0.8,
2175
2179
  lineCap: "round"
2176
2180
  }).addTo(map);
2177
- polyLine.on("click", () => __async(void 0, null, function* () {
2181
+ polyLine.on("click", () => __async(null, null, function* () {
2178
2182
  stopPaint();
2179
2183
  }));
2180
- polyLine.on("mouseover", (e) => __async(void 0, null, function* () {
2184
+ polyLine.on("mouseover", (e) => __async(null, null, function* () {
2181
2185
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2182
2186
  tooltip2 = L.tooltip({ offset: L.point(20, 0), opacity: 0.6 }).setContent("Click to Stop").setLatLng(e.latlng).addTo(map);
2183
2187
  }));
2184
- polyLine.on("mousemove", () => __async(void 0, null, function* () {
2188
+ polyLine.on("mousemove", () => __async(null, null, function* () {
2185
2189
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2186
2190
  }));
2187
- polyLine.on("mouseout", () => __async(void 0, null, function* () {
2191
+ polyLine.on("mouseout", () => __async(null, null, function* () {
2188
2192
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2189
2193
  }));
2190
2194
  }
2191
2195
  return () => {
2192
- if (imageOverlay3)
2193
- map.removeLayer(imageOverlay3);
2194
- if (tagsPopUp)
2195
- map.removeLayer(tagsPopUp);
2196
+ if (imageOverlay3) map.removeLayer(imageOverlay3);
2197
+ if (tagsPopUp) map.removeLayer(tagsPopUp);
2196
2198
  if (rectangle3 && evolandStore.isAnnualAnnotation)
2197
2199
  map.removeLayer(rectangle3);
2198
2200
  if (polyLine !== void 0) {
@@ -2299,7 +2301,7 @@ var init_ReadOnlyTiffImage = __esm({
2299
2301
  bubblingMouseEvents: false,
2300
2302
  className: "border-2 border-blue-600"
2301
2303
  }).bringToBack();
2302
- imageOverlay3.on("mouseover", (e) => __async(void 0, null, function* () {
2304
+ imageOverlay3.on("mouseover", (e) => __async(null, null, function* () {
2303
2305
  var data = yield getCanvasDataFromImageArray(
2304
2306
  props.raster,
2305
2307
  e.latlng,
@@ -2309,7 +2311,7 @@ var init_ReadOnlyTiffImage = __esm({
2309
2311
  );
2310
2312
  setNDVI(data[1]);
2311
2313
  }));
2312
- imageOverlay3.on("mousemove", () => __async(void 0, null, function* () {
2314
+ imageOverlay3.on("mousemove", () => __async(null, null, function* () {
2313
2315
  evolandStore.setNDVIRGBValues(ndvi);
2314
2316
  }));
2315
2317
  imageOverlay3.addTo(map);
@@ -2327,12 +2329,9 @@ var init_ReadOnlyTiffImage = __esm({
2327
2329
  }).addTo(map);
2328
2330
  }
2329
2331
  return () => {
2330
- if (imageOverlay3)
2331
- map.removeLayer(imageOverlay3);
2332
- if (rectangle3 && showRectangleAtCenter)
2333
- map.removeLayer(rectangle3);
2334
- if (props.polygonBounds)
2335
- map.removeLayer(polygon_segment);
2332
+ if (imageOverlay3) map.removeLayer(imageOverlay3);
2333
+ if (rectangle3 && showRectangleAtCenter) map.removeLayer(rectangle3);
2334
+ if (props.polygonBounds) map.removeLayer(polygon_segment);
2336
2335
  };
2337
2336
  }, [props, map, showRectangleAtCenter]);
2338
2337
  return null;
@@ -2619,8 +2618,7 @@ var init_EvolandContainer = __esm({
2619
2618
  import_jsx_runtime4 = require("react/jsx-runtime");
2620
2619
  EvolandContainer = ({ sessionStatus }) => {
2621
2620
  const evolandStore = useEvolandStore();
2622
- if (sessionStatus === "unauthenticated")
2623
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui.AuthenticationFailure, {});
2621
+ if (sessionStatus === "unauthenticated") return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui.AuthenticationFailure, {});
2624
2622
  return evolandStore.location && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EvoLandGeometry, {});
2625
2623
  };
2626
2624
  }
@@ -2838,8 +2836,7 @@ var init_MapUtils = __esm({
2838
2836
  };
2839
2837
  excludedProperties = /* @__PURE__ */ new Set(["bbox", "geometry", "type"]);
2840
2838
  formatValue = (value) => {
2841
- if (value === null || value === void 0)
2842
- return "";
2839
+ if (value === null || value === void 0) return "";
2843
2840
  if (typeof value === "number") {
2844
2841
  return value.toLocaleString();
2845
2842
  }
@@ -3026,8 +3023,7 @@ var init_BetterWMS = __esm({
3026
3023
  * Builds the URL for the GetFeatureInfo WMS request
3027
3024
  */
3028
3025
  getFeatureInfoUrl(latlng) {
3029
- if (!this.currentMap)
3030
- return null;
3026
+ if (!this.currentMap) return null;
3031
3027
  const point3 = this.currentMap.latLngToContainerPoint(latlng);
3032
3028
  const size = this.currentMap.getSize();
3033
3029
  const wmsParams = this.wmsParams;
@@ -3096,8 +3092,7 @@ var init_BetterWMS = __esm({
3096
3092
  return;
3097
3093
  }
3098
3094
  this.geoJsonLayer.addData(content);
3099
- if (!this.currentMap)
3100
- return;
3095
+ if (!this.currentMap) return;
3101
3096
  if (this.currentPopup) {
3102
3097
  this.currentMap.closePopup(this.currentPopup);
3103
3098
  }
@@ -3114,8 +3109,7 @@ var init_BetterWMS = __esm({
3114
3109
  * Show loading popup
3115
3110
  */
3116
3111
  showLoading(latlng) {
3117
- if (!this.currentMap || this.loading || !this.canShowLoading)
3118
- return;
3112
+ if (!this.currentMap || this.loading || !this.canShowLoading) return;
3119
3113
  this.loading = true;
3120
3114
  this.currentPopup = import_leaflet4.default.popup(this.popupOptions).setLatLng(latlng).setContent(this.loadingContent).openOn(this.currentMap);
3121
3115
  }
@@ -3126,8 +3120,7 @@ var init_BetterWMS = __esm({
3126
3120
  return __async(this, null, function* () {
3127
3121
  var _a, _b, _c;
3128
3122
  const url = this.getFeatureInfoUrl(event.latlng);
3129
- if (!url)
3130
- return;
3123
+ if (!url) return;
3131
3124
  try {
3132
3125
  this.showLoading(event.latlng);
3133
3126
  const data = yield this.fetchWithRetry(url);
@@ -3196,7 +3189,7 @@ function getPropsAndEvents(props) {
3196
3189
  }
3197
3190
  function createMarkerClusterGroup(props, context) {
3198
3191
  const { clusterProps, clusterEvents } = getPropsAndEvents(props);
3199
- const markerClusterGroup = new L7.MarkerClusterGroup(clusterProps);
3192
+ const markerClusterGroup = new import_leaflet5.default.MarkerClusterGroup(clusterProps);
3200
3193
  Object.entries(clusterEvents).forEach(([eventAsProp, callback]) => {
3201
3194
  const clusterEvent = `cluster${eventAsProp.substring(2).toLowerCase()}`;
3202
3195
  markerClusterGroup.on(clusterEvent, callback);
@@ -3206,17 +3199,17 @@ function createMarkerClusterGroup(props, context) {
3206
3199
  (0, import_core4.extendContext)(context, { layerContainer: markerClusterGroup })
3207
3200
  );
3208
3201
  }
3209
- var import_core4, L7, import_leaflet5, updateMarkerCluster, MarkerClusterGroup2;
3202
+ var import_core4, import_leaflet5, import_leaflet6, updateMarkerCluster, MarkerClusterGroup;
3210
3203
  var init_MarkerClusterGroup = __esm({
3211
3204
  "src/Components/MarkerClusterGroup.tsx"() {
3212
3205
  "use strict";
3213
3206
  "use client";
3214
3207
  import_core4 = require("@react-leaflet/core");
3215
- L7 = __toESM(require("leaflet"));
3216
- import_leaflet5 = require("leaflet.markercluster");
3208
+ import_leaflet5 = __toESM(require("leaflet"));
3209
+ import_leaflet6 = require("leaflet.markercluster");
3217
3210
  updateMarkerCluster = () => {
3218
3211
  };
3219
- MarkerClusterGroup2 = (0, import_core4.createPathComponent)(
3212
+ MarkerClusterGroup = (0, import_core4.createPathComponent)(
3220
3213
  createMarkerClusterGroup,
3221
3214
  updateMarkerCluster
3222
3215
  );
@@ -3336,8 +3329,7 @@ var init_FarmerClusterPopup = __esm({
3336
3329
  import_jsx_runtime8 = require("react/jsx-runtime");
3337
3330
  FarmerClusterPopup = ({ properties }) => {
3338
3331
  const fileUrl = (0, import_core7.useFileUrl)();
3339
- if (!properties)
3340
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "No properties found" });
3332
+ if (!properties) return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "No properties found" });
3341
3333
  const name = properties["name"];
3342
3334
  const description = properties["description"];
3343
3335
  const url = "/cluster/view/" + properties["id"];
@@ -3405,8 +3397,7 @@ var init_IfbnSitePopup = __esm({
3405
3397
  import_core9 = require("@geowiki/core");
3406
3398
  import_jsx_runtime10 = require("react/jsx-runtime");
3407
3399
  SiteInformation = ({ data }) => {
3408
- if (!data)
3409
- return null;
3400
+ if (!data) return null;
3410
3401
  const baseDocUrl = "https://raw.githubusercontent.com/iiasa/static/refs/heads/main/geotrees/docs/biomass_processing_protocol/";
3411
3402
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-6", children: [
3412
3403
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "space-y-4", children: [
@@ -3581,8 +3572,7 @@ var init_IfbnSitePopup = __esm({
3581
3572
  const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
3582
3573
  const [imageError, setImageError] = (0, import_react6.useState)(false);
3583
3574
  const { status: sessionStatus, data: session } = (0, import_core8.useSession)();
3584
- if (!properties)
3585
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: "No properties found" });
3575
+ if (!properties) return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { children: "No properties found" });
3586
3576
  const plotId = properties["Plot_ID"];
3587
3577
  const subPlotId = properties["SubPlot_Id"];
3588
3578
  const network = properties["Network"];
@@ -3591,7 +3581,7 @@ var init_IfbnSitePopup = __esm({
3591
3581
  const fallbackUrl = "https://cms.main.geo-wiki.org/geotrees/media/cocoa.png";
3592
3582
  const baseImageUrl = "https://raw.githubusercontent.com/iiasa/static/refs/heads/main/geotrees/sites/";
3593
3583
  const imageUrl = `${baseImageUrl}${plotId}.jpg?raw=true`;
3594
- const fetchSiteData = () => __async(void 0, null, function* () {
3584
+ const fetchSiteData = () => __async(null, null, function* () {
3595
3585
  setIsLoading(true);
3596
3586
  try {
3597
3587
  const response = yield fetch(
@@ -3602,8 +3592,7 @@ var init_IfbnSitePopup = __esm({
3602
3592
  }
3603
3593
  }
3604
3594
  );
3605
- if (!response.ok)
3606
- throw new Error("Failed to fetch data");
3595
+ if (!response.ok) throw new Error("Failed to fetch data");
3607
3596
  const data = yield response.json();
3608
3597
  setSiteData(data);
3609
3598
  } catch (error) {
@@ -3683,16 +3672,14 @@ var init_IfbnPlotPopup = __esm({
3683
3672
  const [error, setError] = (0, import_react7.useState)(null);
3684
3673
  const API_URL = process.env.NEXT_PUBLIC_GEO_TREE_API_URL;
3685
3674
  (0, import_react7.useEffect)(() => {
3686
- const fetchApiData = () => __async(void 0, null, function* () {
3687
- if (!(properties == null ? void 0 : properties.id))
3688
- return;
3675
+ const fetchApiData = () => __async(null, null, function* () {
3676
+ if (!(properties == null ? void 0 : properties.id)) return;
3689
3677
  setIsLoading(true);
3690
3678
  try {
3691
3679
  const response = yield fetch(
3692
3680
  `${API_URL}/api/plots/by-plot-id/${properties.plot_id}`
3693
3681
  );
3694
- if (!response.ok)
3695
- throw new Error("Failed to fetch data");
3682
+ if (!response.ok) throw new Error("Failed to fetch data");
3696
3683
  const data = yield response.json();
3697
3684
  console.log("API Response:", data);
3698
3685
  setApiData(data);
@@ -3848,14 +3835,14 @@ var init_GeoJsonLayerPopup = __esm({
3848
3835
  });
3849
3836
 
3850
3837
  // src/Components/GeoJsonLayer.tsx
3851
- var import_react_query, import_react_leaflet6, import_leaflet6, ReactDOMServer, import_ui6, import_server2, import_MapPinIcon, import_react8, turf2, import_ui7, import_jsx_runtime13, getIcon, createIcon, createClusterIcon, GeoJsonLayer;
3838
+ var import_react_query, import_react_leaflet6, import_leaflet7, ReactDOMServer, import_ui6, import_server2, import_MapPinIcon, import_react8, turf2, import_ui7, import_jsx_runtime13, getIcon, createIcon, createClusterIcon, GeoJsonLayer;
3852
3839
  var init_GeoJsonLayer = __esm({
3853
3840
  "src/Components/GeoJsonLayer.tsx"() {
3854
3841
  "use strict";
3855
3842
  "use client";
3856
3843
  import_react_query = require("@tanstack/react-query");
3857
3844
  import_react_leaflet6 = require("react-leaflet");
3858
- import_leaflet6 = __toESM(require("leaflet"));
3845
+ import_leaflet7 = __toESM(require("leaflet"));
3859
3846
  ReactDOMServer = __toESM(require("react-dom/server"));
3860
3847
  import_ui6 = require("@geowiki/ui");
3861
3848
  init_MarkerClusterGroup();
@@ -3876,7 +3863,7 @@ var init_GeoJsonLayer = __esm({
3876
3863
  };
3877
3864
  createIcon = (color, name) => {
3878
3865
  const background = color || "MediumSeaGreen";
3879
- return new import_leaflet6.default.DivIcon({
3866
+ return new import_leaflet7.default.DivIcon({
3880
3867
  iconSize: [40, 40],
3881
3868
  html: `${getIcon(background, name)}`,
3882
3869
  className: "custom-div-icon"
@@ -3893,14 +3880,11 @@ var init_GeoJsonLayer = __esm({
3893
3880
  markers.forEach((marker2) => {
3894
3881
  var _a, _b, _c;
3895
3882
  const status = ((_c = (_b = (_a = marker2.feature) == null ? void 0 : _a.properties) == null ? void 0 : _b.Status) == null ? void 0 : _c.trim().toLowerCase()) || "default";
3896
- if (status === "ongoing")
3897
- statusCount.ongoing++;
3898
- else if (status === "auxiliary")
3899
- statusCount.auxiliary++;
3900
- else
3901
- statusCount.default++;
3883
+ if (status === "ongoing") statusCount.ongoing++;
3884
+ else if (status === "auxiliary") statusCount.auxiliary++;
3885
+ else statusCount.default++;
3902
3886
  });
3903
- return import_leaflet6.default.divIcon({
3887
+ return import_leaflet7.default.divIcon({
3904
3888
  html: `<div style=
3905
3889
  "background-color: ${color};
3906
3890
  width: 36px;
@@ -3924,7 +3908,7 @@ var init_GeoJsonLayer = __esm({
3924
3908
  ({ layer }) => {
3925
3909
  const { isLoading, error, data } = (0, import_react_query.useQuery)({
3926
3910
  queryKey: ["geoJson", layer.id],
3927
- queryFn: () => __async(void 0, null, function* () {
3911
+ queryFn: () => __async(null, null, function* () {
3928
3912
  const res = yield fetch(layer.url);
3929
3913
  return yield res.json();
3930
3914
  })
@@ -3957,7 +3941,7 @@ var init_GeoJsonLayer = __esm({
3957
3941
  });
3958
3942
  if (feature.geometry.type !== "Point") {
3959
3943
  var center4 = turf2.center(feature);
3960
- var marker2 = import_leaflet6.default.marker(
3944
+ var marker2 = import_leaflet7.default.marker(
3961
3945
  [center4.geometry.coordinates[1], center4.geometry.coordinates[0]],
3962
3946
  {
3963
3947
  icon: layerIcon
@@ -3974,8 +3958,7 @@ var init_GeoJsonLayer = __esm({
3974
3958
  [layerIcon]
3975
3959
  );
3976
3960
  const processedData = (0, import_react8.useMemo)(() => {
3977
- if (!(data == null ? void 0 : data.features))
3978
- return data;
3961
+ if (!(data == null ? void 0 : data.features)) return data;
3979
3962
  const processed = __spreadValues({}, data);
3980
3963
  processed.features = data.features.map((feature) => {
3981
3964
  var _a;
@@ -4001,12 +3984,10 @@ var init_GeoJsonLayer = __esm({
4001
3984
  }),
4002
3985
  [layer.id]
4003
3986
  );
4004
- if (error)
4005
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: "error" });
4006
- if (isLoading)
4007
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui6.LoaderFull, {});
3987
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: "error" });
3988
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_ui6.LoaderFull, {});
4008
3989
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4009
- MarkerClusterGroup2,
3990
+ MarkerClusterGroup,
4010
3991
  {
4011
3992
  ref,
4012
3993
  iconCreateFunction: clusterIconFunction,
@@ -4033,7 +4014,7 @@ function getIcon2(color) {
4033
4014
  const MyIcon = import_MapPinIcon2.default;
4034
4015
  return (0, import_server3.renderToString)(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MyIcon, { height: 40, width: 40, color }));
4035
4016
  }
4036
- var import_ui8, import_react_query2, import_react9, import_react_leaflet7, turf3, import_leaflet7, import_MapPinIcon2, import_server3, import_jsx_runtime14, createDotIcon, icon, createClusterIcon2, IfbnPlotLayer;
4017
+ var import_ui8, import_react_query2, import_react9, import_react_leaflet7, turf3, import_leaflet8, import_MapPinIcon2, import_server3, import_jsx_runtime14, createDotIcon, icon, createClusterIcon2, IfbnPlotLayer;
4037
4018
  var init_IfbnPlotLayer = __esm({
4038
4019
  "src/Components/Ifbn/IfbnPlotLayer.tsx"() {
4039
4020
  "use strict";
@@ -4043,13 +4024,13 @@ var init_IfbnPlotLayer = __esm({
4043
4024
  import_react_leaflet7 = require("react-leaflet");
4044
4025
  init_MarkerClusterGroup();
4045
4026
  turf3 = __toESM(require("@turf/turf"));
4046
- import_leaflet7 = __toESM(require("leaflet"));
4027
+ import_leaflet8 = __toESM(require("leaflet"));
4047
4028
  init_IfbnSitePopup();
4048
4029
  import_MapPinIcon2 = __toESM(require("@heroicons/react/24/solid/MapPinIcon"));
4049
4030
  import_server3 = require("react-dom/server");
4050
4031
  import_jsx_runtime14 = require("react/jsx-runtime");
4051
4032
  createDotIcon = (color) => {
4052
- return new import_leaflet7.default.DivIcon({
4033
+ return new import_leaflet8.default.DivIcon({
4053
4034
  html: `<span style="
4054
4035
  background-color: ${color};
4055
4036
  width: 10px;
@@ -4065,7 +4046,7 @@ var init_IfbnPlotLayer = __esm({
4065
4046
  };
4066
4047
  icon = (color) => {
4067
4048
  const background = color || "MediumSeaGreen";
4068
- return new import_leaflet7.default.DivIcon({
4049
+ return new import_leaflet8.default.DivIcon({
4069
4050
  iconSize: [40, 40],
4070
4051
  iconAnchor: [28, 15],
4071
4052
  html: `<i>${getIcon2(background)}</i>`,
@@ -4082,12 +4063,9 @@ var init_IfbnPlotLayer = __esm({
4082
4063
  markers.forEach((marker2) => {
4083
4064
  var _a, _b, _c;
4084
4065
  const status = ((_c = (_b = (_a = marker2.feature) == null ? void 0 : _a.properties) == null ? void 0 : _b.Status) == null ? void 0 : _c.trim().toLowerCase()) || "default";
4085
- if (status === "ongoing")
4086
- statusCount.ongoing++;
4087
- else if (status === "auxiliary")
4088
- statusCount.auxiliary++;
4089
- else
4090
- statusCount.default++;
4066
+ if (status === "ongoing") statusCount.ongoing++;
4067
+ else if (status === "auxiliary") statusCount.auxiliary++;
4068
+ else statusCount.default++;
4091
4069
  });
4092
4070
  let clusterColor = "#2E7D32";
4093
4071
  if (statusCount.ongoing > statusCount.auxiliary && statusCount.ongoing > statusCount.default) {
@@ -4095,7 +4073,7 @@ var init_IfbnPlotLayer = __esm({
4095
4073
  } else if (statusCount.auxiliary > statusCount.ongoing && statusCount.auxiliary > statusCount.default) {
4096
4074
  clusterColor = "red";
4097
4075
  }
4098
- return new import_leaflet7.default.DivIcon({
4076
+ return new import_leaflet8.default.DivIcon({
4099
4077
  html: `<div style="
4100
4078
  background-color: ${clusterColor};
4101
4079
  color: white;
@@ -4110,7 +4088,7 @@ var init_IfbnPlotLayer = __esm({
4110
4088
  font-weight: bold;
4111
4089
  ">${cluster.getChildCount()}</div>`,
4112
4090
  className: "custom-cluster-icon",
4113
- iconSize: import_leaflet7.default.point(32, 32)
4091
+ iconSize: import_leaflet8.default.point(32, 32)
4114
4092
  });
4115
4093
  };
4116
4094
  IfbnPlotLayer = ({
@@ -4136,7 +4114,7 @@ var init_IfbnPlotLayer = __esm({
4136
4114
  });
4137
4115
  const { isLoading, error, data } = (0, import_react_query2.useQuery)({
4138
4116
  queryKey: ["IfbnPlotLayer", layer.id],
4139
- queryFn: () => __async(void 0, null, function* () {
4117
+ queryFn: () => __async(null, null, function* () {
4140
4118
  const res = yield fetch(`${layer.url}`);
4141
4119
  return yield res.json();
4142
4120
  })
@@ -4145,8 +4123,7 @@ var init_IfbnPlotLayer = __esm({
4145
4123
  return currentZoom <= hideMarkersAboveZoom;
4146
4124
  };
4147
4125
  (0, import_react9.useEffect)(() => {
4148
- if (!markerClusterGroupRef.current)
4149
- return;
4126
+ if (!markerClusterGroupRef.current) return;
4150
4127
  if (shouldShowMarkers()) {
4151
4128
  markersRef.current.forEach((marker2) => {
4152
4129
  var _a, _b;
@@ -4170,7 +4147,7 @@ var init_IfbnPlotLayer = __esm({
4170
4147
  return zoom >= 16 ? 0 : 80;
4171
4148
  };
4172
4149
  (0, import_react9.useEffect)(() => {
4173
- markerClusterGroupRef.current = import_leaflet7.default.markerClusterGroup({
4150
+ markerClusterGroupRef.current = import_leaflet8.default.markerClusterGroup({
4174
4151
  maxClusterRadius: (zoom) => getClusterRadius(zoom),
4175
4152
  disableClusteringAtZoom: 16,
4176
4153
  spiderfyOnMaxZoom: false,
@@ -4214,7 +4191,7 @@ var init_IfbnPlotLayer = __esm({
4214
4191
  }
4215
4192
  }
4216
4193
  var center4 = turf3.center(feature);
4217
- var marker2 = import_leaflet7.default.marker(
4194
+ var marker2 = import_leaflet8.default.marker(
4218
4195
  [center4.geometry.coordinates[1], center4.geometry.coordinates[0]],
4219
4196
  {
4220
4197
  icon: createDotIcon(color)
@@ -4234,12 +4211,10 @@ var init_IfbnPlotLayer = __esm({
4234
4211
  setSelectedFeature({ feature, latlng });
4235
4212
  };
4236
4213
  const ref = (0, import_react9.useRef)(null);
4237
- if (error)
4238
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: "error" });
4239
- if (isLoading)
4240
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.LoaderFull, {});
4214
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: "error" });
4215
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ui8.LoaderFull, {});
4241
4216
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4242
- MarkerClusterGroup2,
4217
+ MarkerClusterGroup,
4243
4218
  {
4244
4219
  ref,
4245
4220
  chunkedLoading: true,
@@ -4494,8 +4469,7 @@ var init_customLayers = __esm({
4494
4469
  createLayerFromTemplate: (templateId, customData) => {
4495
4470
  var _a, _b;
4496
4471
  const template = get().getTemplate(templateId);
4497
- if (!template)
4498
- return null;
4472
+ if (!template) return null;
4499
4473
  const newLayer = {
4500
4474
  id: (0, import_uuid.v4)(),
4501
4475
  isCustom: true,
@@ -4862,16 +4836,11 @@ function getColumnStats(data, columnName) {
4862
4836
  let type;
4863
4837
  if (uniqueTypes.size === 1) {
4864
4838
  const singleType = types[0];
4865
- if (singleType === "string")
4866
- type = "string";
4867
- else if (singleType === "number")
4868
- type = "number";
4869
- else if (singleType === "boolean")
4870
- type = "boolean";
4871
- else if (singleType === "object")
4872
- type = "date";
4873
- else
4874
- type = "mixed";
4839
+ if (singleType === "string") type = "string";
4840
+ else if (singleType === "number") type = "number";
4841
+ else if (singleType === "boolean") type = "boolean";
4842
+ else if (singleType === "object") type = "date";
4843
+ else type = "mixed";
4875
4844
  } else {
4876
4845
  type = "mixed";
4877
4846
  }
@@ -4896,21 +4865,15 @@ var init_GoogleSheetsPopup = __esm({
4896
4865
  properties
4897
4866
  }) => {
4898
4867
  const isEmpty = (value) => {
4899
- if (value === null || value === void 0)
4900
- return true;
4901
- if (typeof value === "string")
4902
- return value.trim() === "";
4903
- if (typeof value === "number")
4904
- return isNaN(value);
4905
- if (Array.isArray(value))
4906
- return value.length === 0;
4907
- if (typeof value === "object")
4908
- return Object.keys(value).length === 0;
4868
+ if (value === null || value === void 0) return true;
4869
+ if (typeof value === "string") return value.trim() === "";
4870
+ if (typeof value === "number") return isNaN(value);
4871
+ if (Array.isArray(value)) return value.length === 0;
4872
+ if (typeof value === "object") return Object.keys(value).length === 0;
4909
4873
  return false;
4910
4874
  };
4911
4875
  const isUrl2 = (value) => {
4912
- if (typeof value !== "string")
4913
- return false;
4876
+ if (typeof value !== "string") return false;
4914
4877
  const trimmedValue = value.trim();
4915
4878
  const urlPatterns = [
4916
4879
  /^https?:\/\//i,
@@ -5353,8 +5316,7 @@ function analyzeColumn(rows, columnName) {
5353
5316
  };
5354
5317
  }
5355
5318
  function getLegendColumns(rows, excludeCoordinateColumns = []) {
5356
- if (rows.length === 0)
5357
- return [];
5319
+ if (rows.length === 0) return [];
5358
5320
  const headers = Object.keys(rows[0]);
5359
5321
  const legendColumns = [];
5360
5322
  for (const header of headers) {
@@ -5551,7 +5513,7 @@ function useGenericCache({
5551
5513
  const isCached = cache.has(cacheKey);
5552
5514
  const queryOptions = {
5553
5515
  queryKey: [cacheKey.type, cacheKey.id, cacheKey.subId, cacheKey.version],
5554
- queryFn: () => __async(this, null, function* () {
5516
+ queryFn: () => __async(null, null, function* () {
5555
5517
  const cachedData = cache.get(cacheKey);
5556
5518
  if (cachedData) {
5557
5519
  console.log(
@@ -5690,8 +5652,7 @@ var init_GenericCache = __esm({
5690
5652
  getFromStorage(key) {
5691
5653
  try {
5692
5654
  const stored = localStorage.getItem(key);
5693
- if (!stored)
5694
- return null;
5655
+ if (!stored) return null;
5695
5656
  const entry = JSON.parse(stored);
5696
5657
  if (this.isValid(entry)) {
5697
5658
  this.hitCount++;
@@ -5995,7 +5956,7 @@ function useGoogleSheetsData({
5995
5956
  subId: sheetConfig.sheetId,
5996
5957
  version: "1.0.0"
5997
5958
  } : null;
5998
- const fetchData = () => __async(this, null, function* () {
5959
+ const fetchData = () => __async(null, null, function* () {
5999
5960
  if (!sheetConfig) {
6000
5961
  throw new Error("Invalid Google Sheets configuration");
6001
5962
  }
@@ -6047,13 +6008,13 @@ var init_useGoogleSheetsData = __esm({
6047
6008
  });
6048
6009
 
6049
6010
  // src/Components/GoogleSheetsLayer.tsx
6050
- var import_react_leaflet8, import_leaflet8, ReactDOMServer2, import_ui9, import_react10, turf4, import_lucide_react2, import_jsx_runtime19, RANDOM_COLORS, getRandomColor, createCircleIcon, createPinIcon, icon2, createClusterIcon3, getMarkerConfig, GoogleSheetsLayer;
6011
+ var import_react_leaflet8, import_leaflet9, ReactDOMServer2, import_ui9, import_react10, turf4, import_lucide_react2, import_jsx_runtime19, RANDOM_COLORS, getRandomColor, createCircleIcon, createPinIcon, icon2, createClusterIcon3, getMarkerConfig, GoogleSheetsLayer;
6051
6012
  var init_GoogleSheetsLayer = __esm({
6052
6013
  "src/Components/GoogleSheetsLayer.tsx"() {
6053
6014
  "use strict";
6054
6015
  "use client";
6055
6016
  import_react_leaflet8 = require("react-leaflet");
6056
- import_leaflet8 = __toESM(require("leaflet"));
6017
+ import_leaflet9 = __toESM(require("leaflet"));
6057
6018
  ReactDOMServer2 = __toESM(require("react-dom/server"));
6058
6019
  import_ui9 = require("@geowiki/ui");
6059
6020
  init_MarkerClusterGroup();
@@ -6102,7 +6063,7 @@ var init_GoogleSheetsLayer = __esm({
6102
6063
  const index = Math.abs(hash) % RANDOM_COLORS.length;
6103
6064
  return RANDOM_COLORS[index];
6104
6065
  };
6105
- createCircleIcon = (color) => import_leaflet8.default.divIcon({
6066
+ createCircleIcon = (color) => import_leaflet9.default.divIcon({
6106
6067
  html: `<div style="background-color: ${color}; width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.3);"></div>`,
6107
6068
  className: "custom-div-icon",
6108
6069
  iconSize: [20, 20],
@@ -6113,7 +6074,7 @@ var init_GoogleSheetsLayer = __esm({
6113
6074
  const iconHtml = ReactDOMServer2.renderToString(
6114
6075
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconComponent, { size: 40, color, strokeWidth: 2 })
6115
6076
  );
6116
- return import_leaflet8.default.divIcon({
6077
+ return import_leaflet9.default.divIcon({
6117
6078
  html: iconHtml,
6118
6079
  className: "custom-pin-icon",
6119
6080
  iconSize: [40, 40],
@@ -6129,7 +6090,7 @@ var init_GoogleSheetsLayer = __esm({
6129
6090
  createClusterIcon3 = () => (cluster) => {
6130
6091
  const count = cluster.getChildCount();
6131
6092
  const size = count < 10 ? "small" : count < 100 ? "medium" : "large";
6132
- return import_leaflet8.default.divIcon({
6093
+ return import_leaflet9.default.divIcon({
6133
6094
  html: `<div style="background-color: #ff6b35; color: white; border-radius: 50%; font-weight: bold; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.3); width: 100%; height: 100%; min-width: 100%; min-height: 100%;">${count}</div>`,
6134
6095
  className: "google-sheets-cluster-icon",
6135
6096
  iconSize: size === "small" ? [30, 30] : size === "medium" ? [45, 45] : [60, 60]
@@ -6197,7 +6158,7 @@ var init_GoogleSheetsLayer = __esm({
6197
6158
  }) => {
6198
6159
  var _a;
6199
6160
  const ref = (0, import_react10.useRef)(null);
6200
- const markerClusterGroup = import_leaflet8.default.markerClusterGroup();
6161
+ const markerClusterGroup = import_leaflet9.default.markerClusterGroup();
6201
6162
  const { updateLayer } = mapLayers_default();
6202
6163
  const legendConfigUpdated = (0, import_react10.useRef)(false);
6203
6164
  const [forceUpdate, setForceUpdate] = (0, import_react10.useState)(0);
@@ -6273,7 +6234,7 @@ var init_GoogleSheetsLayer = __esm({
6273
6234
  });
6274
6235
  if (feature.geometry.type !== "Point") {
6275
6236
  var center4 = turf4.center(feature);
6276
- var marker2 = import_leaflet8.default.marker(
6237
+ var marker2 = import_leaflet9.default.marker(
6277
6238
  [center4.geometry.coordinates[1], center4.geometry.coordinates[0]],
6278
6239
  {
6279
6240
  icon: icon2(markerConfig.color, markerConfig.icon)
@@ -6289,8 +6250,7 @@ var init_GoogleSheetsLayer = __esm({
6289
6250
  };
6290
6251
  const processedData = (0, import_react10.useMemo)(() => {
6291
6252
  var _a2;
6292
- if (!data)
6293
- return null;
6253
+ if (!data) return null;
6294
6254
  return __spreadProps(__spreadValues({}, data), {
6295
6255
  features: (_a2 = data.features) == null ? void 0 : _a2.map((feature) => {
6296
6256
  var _a3;
@@ -6473,7 +6433,7 @@ var init_GoogleSheetsLayer = __esm({
6473
6433
  }
6474
6434
  )
6475
6435
  ] }),
6476
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MarkerClusterGroup2, { ref, iconCreateFunction: createClusterIcon3(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6436
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MarkerClusterGroup, { ref, iconCreateFunction: createClusterIcon3(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6477
6437
  import_react_leaflet8.GeoJSON,
6478
6438
  {
6479
6439
  data: processedData,
@@ -6494,7 +6454,7 @@ var init_GoogleSheetsLayer = __esm({
6494
6454
  });
6495
6455
 
6496
6456
  // src/Components/CustomLayerRenderer.tsx
6497
- var import_react11, import_react_leaflet9, import_leaflet9, import_jsx_runtime20, createMarkerIcon, createClusterIcon4, createPopupContent, GeoJSONRenderer, MarkerRenderer, MarkerClusterRenderer, WMSRenderer, TileRenderer, GoogleSheetsRenderer, CustomLayerRenderer, CustomLayerList;
6457
+ var import_react11, import_react_leaflet9, import_leaflet10, import_jsx_runtime20, createMarkerIcon, createClusterIcon4, createPopupContent, GeoJSONRenderer, MarkerRenderer, MarkerClusterRenderer, WMSRenderer, TileRenderer, GoogleSheetsRenderer, CustomLayerRenderer, CustomLayerList;
6498
6458
  var init_CustomLayerRenderer = __esm({
6499
6459
  "src/Components/CustomLayerRenderer.tsx"() {
6500
6460
  "use strict";
@@ -6502,7 +6462,7 @@ var init_CustomLayerRenderer = __esm({
6502
6462
  import_react_leaflet9 = require("react-leaflet");
6503
6463
  init_customLayers();
6504
6464
  init_statusMapping();
6505
- import_leaflet9 = __toESM(require("leaflet"));
6465
+ import_leaflet10 = __toESM(require("leaflet"));
6506
6466
  init_GoogleSheetsLayer();
6507
6467
  init_MarkerClusterGroup();
6508
6468
  import_jsx_runtime20 = require("react/jsx-runtime");
@@ -6535,7 +6495,7 @@ var init_CustomLayerRenderer = __esm({
6535
6495
  />
6536
6496
  </svg>
6537
6497
  `;
6538
- return import_leaflet9.default.divIcon({
6498
+ return import_leaflet10.default.divIcon({
6539
6499
  html: iconHtml,
6540
6500
  className: "geotrees-marker-icon",
6541
6501
  iconSize: [size, size],
@@ -6546,7 +6506,7 @@ var init_CustomLayerRenderer = __esm({
6546
6506
  const count = cluster.getChildCount();
6547
6507
  const size = count < 10 ? "small" : count < 100 ? "medium" : "large";
6548
6508
  const iconSize = size === "small" ? [30, 30] : size === "medium" ? [40, 40] : [50, 50];
6549
- return import_leaflet9.default.divIcon({
6509
+ return import_leaflet10.default.divIcon({
6550
6510
  html: `<div style="background-color: #22c55e; color: white; border-radius: 50%; font-weight: bold; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,0.3); width: 100%; height: 100%; min-width: 100%; min-height: 100%;">${count}</div>`,
6551
6511
  className: "geotrees-cluster-icon",
6552
6512
  iconSize
@@ -6709,7 +6669,7 @@ var init_CustomLayerRenderer = __esm({
6709
6669
  return null;
6710
6670
  }
6711
6671
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
6712
- MarkerClusterGroup2,
6672
+ MarkerClusterGroup,
6713
6673
  {
6714
6674
  chunkedLoading: true,
6715
6675
  maxClusterRadius: 60,
@@ -7038,10 +6998,9 @@ var init_RasterPreview = __esm({
7038
6998
  },
7039
6999
  { scopes: ["evoland"] }
7040
7000
  );
7041
- const onSubmit = (taskStatus) => __async(void 0, null, function* () {
7001
+ const onSubmit = (taskStatus) => __async(null, null, function* () {
7042
7002
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2;
7043
- if (disableSubmit)
7044
- return;
7003
+ if (disableSubmit) return;
7045
7004
  setDisableSubmit(true);
7046
7005
  var bufferData = null;
7047
7006
  var { data: savedAnnotationBuffer, indexArr: savedAnnotationIndexArr } = evolandStore.savedAnnotations && evolandStore.isAnnualAnnotation ? { data: evolandStore.savedAnnotations.buffer, indexArr: 0 } : evolandStore.savedAnnotations ? flatten(evolandStore.savedAnnotations.buffer) : { data: void 0, indexArr: 0 };
@@ -7098,8 +7057,7 @@ var init_RasterPreview = __esm({
7098
7057
  if (_props.userRole === "admin") {
7099
7058
  if (tasks == null ? void 0 : tasks.task)
7100
7059
  window.location.href = `/map?projectId=${projectId}&locationId=${(_v2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _v2.location_id}&taskId=${(_w2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _w2.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
7101
- else
7102
- alert("No more tasks to review");
7060
+ else alert("No more tasks to review");
7103
7061
  }
7104
7062
  var res = yield evolandStore.getNextLocationDetails(
7105
7063
  parseInt(projectId)
@@ -7123,8 +7081,7 @@ var init_RasterPreview = __esm({
7123
7081
  }
7124
7082
  });
7125
7083
  const arrayEqual = (a, b) => {
7126
- if (a.length !== b.length)
7127
- return false;
7084
+ if (a.length !== b.length) return false;
7128
7085
  return Buffer.compare(Buffer.from(a.buffer), Buffer.from(b.buffer)) === 0;
7129
7086
  };
7130
7087
  const flatten = (input, refArr) => {
@@ -7148,15 +7105,14 @@ var init_RasterPreview = __esm({
7148
7105
  }
7149
7106
  }
7150
7107
  }
7151
- if (indexArr.length == 0)
7152
- result = emptyAnnotation;
7108
+ if (indexArr.length == 0) result = emptyAnnotation;
7153
7109
  return { data: new Uint32Array(result), indexArr };
7154
7110
  };
7155
7111
  function isBase64Zeros(base64String) {
7156
7112
  const trimmed = base64String.replace(/=+$/, "");
7157
7113
  return /^A+$/.test(trimmed);
7158
7114
  }
7159
- const onSave = () => __async(void 0, null, function* () {
7115
+ const onSave = () => __async(null, null, function* () {
7160
7116
  var _a2, _b2;
7161
7117
  var bufferData = null;
7162
7118
  const { data, indexArr } = evolandStore.isAnnualAnnotation ? { data: evolandStore.annotatedRasterAsset.buffer, indexArr: 0 } : flatten(
@@ -7204,8 +7160,7 @@ var init_RasterPreview = __esm({
7204
7160
  setSubmitNotificationMessage(
7205
7161
  "Annotation has been SAVED successfully"
7206
7162
  );
7207
- else
7208
- setSubmitNotificationMessage("Please try again");
7163
+ else setSubmitNotificationMessage("Please try again");
7209
7164
  setSubmitNotification(true);
7210
7165
  }
7211
7166
  } catch (err) {
@@ -7214,7 +7169,7 @@ var init_RasterPreview = __esm({
7214
7169
  }
7215
7170
  }
7216
7171
  });
7217
- const ClearPreview = () => __async(void 0, null, function* () {
7172
+ const ClearPreview = () => __async(null, null, function* () {
7218
7173
  const { annotationRaster, pastValues } = yield ClearAnnotation(
7219
7174
  evolandStore.annotatedRasterAsset,
7220
7175
  evolandStore.isAnnualAnnotation,
@@ -7277,16 +7232,14 @@ var init_RasterPreview = __esm({
7277
7232
  )] : newValue == null ? void 0 : newValue.buffer[0] : newValue == null ? void 0 : newValue.buffer
7278
7233
  );
7279
7234
  };
7280
- if (layerStore.layerOpacity == 0)
7281
- layerStore.setLayerOpacity(0.4);
7235
+ if (layerStore.layerOpacity == 0) layerStore.setLayerOpacity(0.4);
7282
7236
  if (!goToNextTask && evolandStore.location !== null && evolandStore.location.locationId !== searchParams.get("locationId")) {
7283
7237
  if (status == import_core13.TaskStatus.ACCEPTED || status == import_core13.TaskStatus.DISCARDED || status == import_core13.TaskStatus.TO_FIX) {
7284
7238
  setGoToNextTask(true);
7285
7239
  if (_props.userRole === "admin")
7286
7240
  if (tasks == null ? void 0 : tasks.task)
7287
7241
  window.location.href = `/map?projectId=${projectId}&locationId=${(_a = tasks == null ? void 0 : tasks.task) == null ? void 0 : _a.location_id}&taskId=${(_b = tasks == null ? void 0 : tasks.task) == null ? void 0 : _b.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
7288
- else
7289
- alert("No more tasks to review");
7242
+ else alert("No more tasks to review");
7290
7243
  } else
7291
7244
  window.location.href = `/map?projectId=${projectId}&locationId=${(_c = evolandStore.location) == null ? void 0 : _c.locationId}&taskId=${(_d = evolandStore.location) == null ? void 0 : _d.task[0].task_id}`;
7292
7245
  }
@@ -7335,10 +7288,8 @@ var init_RasterPreview = __esm({
7335
7288
  parseInt(projectId),
7336
7289
  evolandStore.referenceDate
7337
7290
  ).then(({ location, currentTask, annotation_dates }) => {
7338
- if (location)
7339
- evolandStore.setLocation(location);
7340
- if (currentTask)
7341
- evolandStore.setCurrentTask(currentTask);
7291
+ if (location) evolandStore.setLocation(location);
7292
+ if (currentTask) evolandStore.setCurrentTask(currentTask);
7342
7293
  evolandStore.setAnnotationDates(annotation_dates);
7343
7294
  });
7344
7295
  },
@@ -7374,8 +7325,7 @@ var init_RasterPreview = __esm({
7374
7325
  evolandStore.setComment(
7375
7326
  evolandStore.comment.replace(" #" + x, "")
7376
7327
  );
7377
- else
7378
- evolandStore.setComment("#" + x + " ");
7328
+ else evolandStore.setComment("#" + x + " ");
7379
7329
  },
7380
7330
  children: [
7381
7331
  "#",
@@ -7641,7 +7591,7 @@ var init_Annotation = __esm({
7641
7591
  labelId: 0
7642
7592
  });
7643
7593
  const [currentLabelItem, setCurrentLabelItem] = (0, import_react16.useState)();
7644
- const OnSubmitActiveLearning = () => __async(void 0, null, function* () {
7594
+ const OnSubmitActiveLearning = () => __async(null, null, function* () {
7645
7595
  var _a2, _b2;
7646
7596
  setActiveLearningLoading(true);
7647
7597
  var bufferData = null;
@@ -8736,8 +8686,7 @@ var init_ViewAssets = __esm({
8736
8686
  import_jsx_runtime31 = require("react/jsx-runtime");
8737
8687
  assetsByYear = (assets) => assets == null ? void 0 : assets.reduce((acc, item) => {
8738
8688
  const year = new Date(item.reference_date).getFullYear();
8739
- if (!acc[year])
8740
- acc[year] = [];
8689
+ if (!acc[year]) acc[year] = [];
8741
8690
  acc[year].push(item);
8742
8691
  return acc;
8743
8692
  }, {});
@@ -8760,6 +8709,7 @@ var init_ViewAssets = __esm({
8760
8709
  const [compositesTab, setCompositesTab] = (0, import_react18.useState)(
8761
8710
  props.defaultAssetView == "COMPOSITE" /* Composite */ ? true : false
8762
8711
  );
8712
+ const [fetchComposite, setFetchComposite] = (0, import_react18.useState)(false);
8763
8713
  const [masks, setMasks] = (0, import_react18.useState)(
8764
8714
  evolandStore.maskAsset !== null ? evolandStore.maskAsset : []
8765
8715
  );
@@ -8854,14 +8804,10 @@ var init_ViewAssets = __esm({
8854
8804
  );
8855
8805
  if (props.taskId !== void 0 && IsTaskAnnotationLoading)
8856
8806
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui13.LoaderFull, {});
8857
- if (maskTab && (masks == null ? void 0 : masks.length) == 0)
8858
- setMasks(evolandStore.maskAsset);
8859
- if (changeMaskTab && (changeMasks == null ? void 0 : changeMasks.length) == 0)
8860
- checkChangeMasksAndLoad();
8861
- if (compositesTab && composites.length == 0)
8862
- checkCompositesAndLoad();
8863
- if (annotationTab)
8864
- checkAnnotationsAndLoad();
8807
+ if (maskTab && (masks == null ? void 0 : masks.length) == 0) setMasks(evolandStore.maskAsset);
8808
+ if (changeMaskTab && (changeMasks == null ? void 0 : changeMasks.length) == 0) checkChangeMasksAndLoad();
8809
+ if (compositesTab && composites.length == 0) checkCompositesAndLoad();
8810
+ if (annotationTab) checkAnnotationsAndLoad();
8865
8811
  function checkMasksAndLoad() {
8866
8812
  if ((masks == null ? void 0 : masks.length) === 0 && !evolandStore.maskAsset) {
8867
8813
  evolandStore.getLocationAssets(
@@ -8872,8 +8818,7 @@ var init_ViewAssets = __esm({
8872
8818
  ).then((res) => {
8873
8819
  setMasks(res);
8874
8820
  });
8875
- } else if (masks.length == 0)
8876
- setMasks(evolandStore.maskAsset);
8821
+ } else if (masks.length == 0) setMasks(evolandStore.maskAsset);
8877
8822
  }
8878
8823
  function checkChangeMasksAndLoad() {
8879
8824
  if ((changeMasks == null ? void 0 : changeMasks.length) === 0 && !evolandStore.changeMaskAsset) {
@@ -8889,7 +8834,8 @@ var init_ViewAssets = __esm({
8889
8834
  setChangeMasks(evolandStore.changeMaskAsset);
8890
8835
  }
8891
8836
  function checkCompositesAndLoad() {
8892
- if ((composites == null ? void 0 : composites.length) === 0 && !evolandStore.compositeAsset) {
8837
+ if ((composites == null ? void 0 : composites.length) === 0 && !evolandStore.compositeAsset && !fetchComposite) {
8838
+ setFetchComposite(true);
8893
8839
  evolandStore.getLocationAssets(
8894
8840
  props.locationId,
8895
8841
  props.projectId,
@@ -8897,6 +8843,7 @@ var init_ViewAssets = __esm({
8897
8843
  props.taskId
8898
8844
  ).then((res) => {
8899
8845
  setComposites(assetsByYear(res));
8846
+ setFetchComposite(false);
8900
8847
  });
8901
8848
  }
8902
8849
  }
@@ -8919,8 +8866,7 @@ var init_ViewAssets = __esm({
8919
8866
  }
8920
8867
  if (props.taskId !== void 0 && IsTaskAnnotationLoading)
8921
8868
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_ui13.LoaderFull, {});
8922
- if (maskTab && ((masks == null ? void 0 : masks.length) == 0 || masks == null))
8923
- setMaskTab(false);
8869
+ if (maskTab && ((masks == null ? void 0 : masks.length) == 0 || masks == null)) setMaskTab(false);
8924
8870
  return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
8925
8871
  /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
8926
8872
  "div",
@@ -9273,7 +9219,7 @@ var init_ViewAssets = __esm({
9273
9219
  asset.id + index
9274
9220
  );
9275
9221
  }) })
9276
- ] }))
9222
+ ] }, year))
9277
9223
  }
9278
9224
  )
9279
9225
  ] })
@@ -9482,8 +9428,7 @@ var init_SearchAnnotation = __esm({
9482
9428
  localStorage.setItem("toDate", toDate);
9483
9429
  if (tasks == null ? void 0 : tasks.exists)
9484
9430
  window.location.href = `/map?projectId=${tasks == null ? void 0 : tasks.task.project_id}&locationId=${tasks == null ? void 0 : tasks.task.location_id}&taskId=${tasks == null ? void 0 : tasks.task.task_id}${props.taskForReview ? "&review=true" : ""}`;
9485
- else
9486
- alert("No data for search parameters");
9431
+ else alert("No data for search parameters");
9487
9432
  },
9488
9433
  children: [
9489
9434
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -9824,14 +9769,11 @@ var init_EvolandLeftSideBar = __esm({
9824
9769
  }
9825
9770
  if (evolandStore.projectDetail) {
9826
9771
  if (((_m = (_l = evolandStore.projectDetail) == null ? void 0 : _l.meta_data) == null ? void 0 : _m.default_asset_view) == "SEGMENTATION_MASK" /* SegmentationMask */) {
9827
- if ((masks == null ? void 0 : masks.length) === 0)
9828
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
9772
+ if ((masks == null ? void 0 : masks.length) === 0) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
9829
9773
  } else if (((_o = (_n = evolandStore.projectDetail) == null ? void 0 : _n.meta_data) == null ? void 0 : _o.default_asset_view) == "COMPOSITE" /* Composite */) {
9830
- if ((composites == null ? void 0 : composites.length) === 0)
9831
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
9774
+ if ((composites == null ? void 0 : composites.length) === 0) return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
9832
9775
  }
9833
- } else
9834
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
9776
+ } else return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui15.LoaderFull, {});
9835
9777
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
9836
9778
  "div",
9837
9779
  {
@@ -9998,8 +9940,7 @@ var init_EvolandLeftSideBar = __esm({
9998
9940
  canDelete = confirm(
9999
9941
  (review ? "This is a targeted review task. " : "") + "Are you sure you want to delete this task?"
10000
9942
  );
10001
- if (canDelete)
10002
- setDeleteTask(true);
9943
+ if (canDelete) setDeleteTask(true);
10003
9944
  },
10004
9945
  children: [
10005
9946
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
@@ -10041,8 +9982,7 @@ var init_EvolandLeftSideBar = __esm({
10041
9982
  evolandStore.setAnnotationDates(annotation_dates);
10042
9983
  if (currentTask)
10043
9984
  evolandStore.setCurrentTask(currentTask);
10044
- if (location)
10045
- evolandStore.setLocation(location);
9985
+ if (location) evolandStore.setLocation(location);
10046
9986
  if (props.userRole === "admin")
10047
9987
  window.location.href = "/map?projectId=" + projectId + "&locationId=" + (currentTask == null ? void 0 : currentTask.location_id) + "&taskId=" + (currentTask == null ? void 0 : currentTask.task_id) + (evolandStore.task_for_review ? "&review=true" : "");
10048
9988
  }
@@ -10234,10 +10174,9 @@ var init_Questions = __esm({
10234
10174
  userUserAlias: !localStorage.getItem("searchUser") ? null : localStorage.getItem("searchUser"),
10235
10175
  locationLocationId: null
10236
10176
  });
10237
- const onSubmit = (taskStatus) => __async(void 0, null, function* () {
10177
+ const onSubmit = (taskStatus) => __async(null, null, function* () {
10238
10178
  var _a2, _b2, _c2, _d2, _e2;
10239
- if (disableSubmit)
10240
- return;
10179
+ if (disableSubmit) return;
10241
10180
  setDisableSubmit(true);
10242
10181
  setStatus(taskStatus[0]);
10243
10182
  if (evolandStore.currentTask) {
@@ -10269,8 +10208,7 @@ var init_Questions = __esm({
10269
10208
  if (props.userRole === "admin") {
10270
10209
  if (tasks == null ? void 0 : tasks.task)
10271
10210
  window.location.href = `/map?projectId=${projectId}&locationId=${(_d2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _d2.location_id}&taskId=${(_e2 = tasks == null ? void 0 : tasks.task) == null ? void 0 : _e2.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
10272
- else
10273
- alert("No more tasks to review");
10211
+ else alert("No more tasks to review");
10274
10212
  }
10275
10213
  var res = yield evolandStore.getNextLocationDetails(
10276
10214
  parseInt(projectId)
@@ -10293,7 +10231,7 @@ var init_Questions = __esm({
10293
10231
  setSubmitNotificationMessage("");
10294
10232
  }
10295
10233
  });
10296
- const onSave = () => __async(void 0, null, function* () {
10234
+ const onSave = () => __async(null, null, function* () {
10297
10235
  if (evolandStore.currentTask) {
10298
10236
  const saveQuestionnaireReq = {
10299
10237
  task_id: evolandStore.currentTask.task_id,
@@ -10312,8 +10250,7 @@ var init_Questions = __esm({
10312
10250
  setSubmitNotificationMessage(
10313
10251
  "Questionnaire has been SAVED successfully"
10314
10252
  );
10315
- else
10316
- setSubmitNotificationMessage("Please try again");
10253
+ else setSubmitNotificationMessage("Please try again");
10317
10254
  setSubmitNotification(true);
10318
10255
  }
10319
10256
  } catch (err) {
@@ -10346,8 +10283,7 @@ var init_Questions = __esm({
10346
10283
  "<" + key + ">",
10347
10284
  "" + (label == null ? void 0 : label.labelName)
10348
10285
  );
10349
- } else
10350
- y.text = y.text.replace("<" + key + ">", "" + value);
10286
+ } else y.text = y.text.replace("<" + key + ">", "" + value);
10351
10287
  });
10352
10288
  });
10353
10289
  }
@@ -10393,15 +10329,14 @@ var init_Questions = __esm({
10393
10329
  if (props.userRole === "admin")
10394
10330
  if (tasks == null ? void 0 : tasks.task)
10395
10331
  window.location.href = `/map?projectId=${projectId}&locationId=${(_c = tasks == null ? void 0 : tasks.task) == null ? void 0 : _c.location_id}&taskId=${(_d = tasks == null ? void 0 : tasks.task) == null ? void 0 : _d.task_id}${evolandStore.task_for_review ? "&review=true" : ""}`;
10396
- else
10397
- alert("No more tasks to review");
10332
+ else alert("No more tasks to review");
10398
10333
  } else
10399
10334
  window.location.href = `/map?projectId=${projectId}&locationId=${(_e = evolandStore.location) == null ? void 0 : _e.locationId}&taskId=${(_f = evolandStore.location) == null ? void 0 : _f.task[0].task_id}`;
10400
10335
  }
10401
10336
  if (IsQuestionnaireLoading || IsTaskAnswerLoading || !((_g = evolandStore.location) == null ? void 0 : _g.result))
10402
10337
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_ui16.LoaderFull, {});
10403
10338
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { children: [
10404
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: context && (context == null ? void 0 : context.map((x) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "m-5 w-full", children: x.text }))) }),
10339
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { children: context && (context == null ? void 0 : context.map((x) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "m-5 w-full", children: x.text }, x.id))) }),
10405
10340
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
10406
10341
  "div",
10407
10342
  {
@@ -10443,8 +10378,8 @@ var init_Questions = __esm({
10443
10378
  }
10444
10379
  ),
10445
10380
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_ui16.Label, { htmlFor: "r1", children: y.text })
10446
- ] })) })
10447
- ] }) });
10381
+ ] }, y.id)) })
10382
+ ] }) }, x.id);
10448
10383
  })),
10449
10384
  singleChoice && userAnswers.length > 0 && ((_i = singleChoice == null ? void 0 : singleChoice.filter(
10450
10385
  (ques) => userAnswers == null ? void 0 : userAnswers.some(
@@ -10474,8 +10409,8 @@ var init_Questions = __esm({
10474
10409
  }
10475
10410
  ),
10476
10411
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_ui16.Label, { htmlFor: "r1", children: y.text })
10477
- ] })) })
10478
- ] }) });
10412
+ ] }, y.id)) })
10413
+ ] }) }, x.id);
10479
10414
  }))
10480
10415
  ] })
10481
10416
  }
@@ -10509,8 +10444,7 @@ var init_Questions = __esm({
10509
10444
  evolandStore.setComment(
10510
10445
  evolandStore.comment.replace(" #" + x, "")
10511
10446
  );
10512
- else
10513
- evolandStore.setComment("#" + x + " ");
10447
+ else evolandStore.setComment("#" + x + " ");
10514
10448
  },
10515
10449
  children: [
10516
10450
  "#",
@@ -10543,8 +10477,7 @@ var init_Questions = __esm({
10543
10477
  onClick: () => {
10544
10478
  if (import_core24.TaskState[x[0]] !== import_core24.TaskState.SKIPPED && import_core24.TaskState[x[0]] !== import_core24.TaskState.DISCARDED && import_core24.TaskState[x[0]] !== import_core24.TaskState.USER_DISCARDED && userAnswers.length !== requiredUserAnswers)
10545
10479
  alert("Please provide all answers");
10546
- else
10547
- onSubmit(x);
10480
+ else onSubmit(x);
10548
10481
  },
10549
10482
  children: import_core24.TaskState[x[0]]
10550
10483
  }
@@ -10601,7 +10534,7 @@ var init_TimeSeries = __esm({
10601
10534
  const bbox4 = [bounds[1], bounds[0], bounds[3], bounds[2]];
10602
10535
  const years = changeYears != null ? changeYears : taskChangeYears;
10603
10536
  if (years) {
10604
- years.map((year) => __async(this, null, function* () {
10537
+ years.map((year) => __async(null, null, function* () {
10605
10538
  yield getTimeseries(
10606
10539
  year + "-01-01",
10607
10540
  year + "-12-31",
@@ -10636,8 +10569,7 @@ var init_TimeSeries = __esm({
10636
10569
  })
10637
10570
  }
10638
10571
  );
10639
- if (!appendImages)
10640
- setDetailedImgUrls((yield response.json()).images);
10572
+ if (!appendImages) setDetailedImgUrls((yield response.json()).images);
10641
10573
  else {
10642
10574
  response.json().then((res) => {
10643
10575
  setDetailedImgUrls((prevUrls) => [...prevUrls, ...res.images]);
@@ -10681,18 +10613,15 @@ var init_TimeSeries = __esm({
10681
10613
  return 1;
10682
10614
  else if (x.substring(x.split("_")[0].length, x.length) < y.substring(y.split("_")[0].length, y.length))
10683
10615
  return -1;
10684
- else
10685
- return 0;
10616
+ else return 0;
10686
10617
  }).map((x, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10687
10618
  "button",
10688
10619
  {
10689
10620
  className: currentTab === index ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-gray-200",
10690
10621
  onClick: () => {
10691
10622
  setDetailedImgUrls([]);
10692
- if (x.includes("RGB"))
10693
- fetchImages("TRUE_COLOR" /* RGB */);
10694
- else if (x.includes("FCC"))
10695
- fetchImages("COLOR_INFRARED" /* FCC */);
10623
+ if (x.includes("RGB")) fetchImages("TRUE_COLOR" /* RGB */);
10624
+ else if (x.includes("FCC")) fetchImages("COLOR_INFRARED" /* FCC */);
10696
10625
  setCurrentTab(index);
10697
10626
  },
10698
10627
  children: x.substring(x.split("_")[0].length + 1, x.length)
@@ -10702,7 +10631,7 @@ var init_TimeSeries = __esm({
10702
10631
  !evolandStore.isAnnualAnnotation && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10703
10632
  "button",
10704
10633
  {
10705
- className: currentTab === -1 ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-primary text-white",
10634
+ className: currentTab === -1 ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-white text-black",
10706
10635
  onClick: () => setCurrentTab(-1),
10707
10636
  children: "View Annotations"
10708
10637
  }
@@ -10710,7 +10639,7 @@ var init_TimeSeries = __esm({
10710
10639
  ]
10711
10640
  }
10712
10641
  ),
10713
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "overflow-x-scroll", children: taskChangeYears == null ? void 0 : taskChangeYears.map((year) => {
10642
+ currentTab !== -1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "overflow-x-scroll", children: taskChangeYears == null ? void 0 : taskChangeYears.map((year) => {
10714
10643
  var _a;
10715
10644
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
10716
10645
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-full pt-4", children: year }),
@@ -10720,31 +10649,43 @@ var init_TimeSeries = __esm({
10720
10649
  var _a2;
10721
10650
  return (_a2 = x.minDate) == null ? void 0 : _a2.includes(year);
10722
10651
  })) == null ? void 0 : _a.map((x, index) => {
10723
- var _a2, _b;
10652
+ var _a2, _b, _c;
10653
+ let selected_ref_date = new Date(evolandStore.selectedReferenceDate);
10654
+ let current_date = new Date(x.date);
10655
+ let selected_date;
10656
+ if (selected_ref_date.getMonth() == current_date.getMonth())
10657
+ selected_date = (_a2 = evolandStore.reference_dates) == null ? void 0 : _a2.find((date) => new Date(date).getMonth() + 1 == new Date(x.date).getMonth() + 1);
10724
10658
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
10725
10659
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10726
10660
  "img",
10727
10661
  {
10728
- className: "text-xs w-32 border-y border-x hover:border-blue-500 hover:border-2 hover:cursor-pointer pl-1 pr-1 pb-1" + (((_a2 = evolandStore.selectedCompositeRasterAsset) == null ? void 0 : _a2.id) == x.id || !evolandStore.isAnnualAnnotation && evolandStore.selectedReferenceDate == x.date ? " border-2 border-red-500" : ""),
10662
+ className: "text-xs w-32 border-y border-x hover:border-blue-500 hover:border-2 hover:cursor-pointer pl-1 pr-1 pb-1" + (((_b = evolandStore.selectedCompositeRasterAsset) == null ? void 0 : _b.id) == x.id || !evolandStore.isAnnualAnnotation && evolandStore.selectedReferenceDate == selected_date ? " border-2 border-red-500" : ""),
10729
10663
  src: x.imgUrl,
10730
10664
  alt: x.date,
10731
10665
  onClick: () => {
10732
- var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
10666
+ var _a3, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
10733
10667
  evolandStore.getLegendsDetails(
10734
10668
  !evolandStore.isAnnualAnnotation ? evolandStore.reference_dates && evolandStore.selectedReferenceDate ? (_b2 = evolandStore.annotatedRasterAsset) == null ? void 0 : _b2.buffer[(_a3 = evolandStore.reference_dates) == null ? void 0 : _a3.indexOf(
10735
10669
  x.date
10736
- )] : (_c = evolandStore.annotatedRasterAsset) == null ? void 0 : _c.buffer[0] : (_d = evolandStore.annotatedRasterAsset) == null ? void 0 : _d.buffer
10670
+ )] : (_c2 = evolandStore.annotatedRasterAsset) == null ? void 0 : _c2.buffer[0] : (_d = evolandStore.annotatedRasterAsset) == null ? void 0 : _d.buffer
10737
10671
  );
10738
10672
  if (evolandStore.reference_dates.length > 1) {
10739
- evolandStore.setSelectedReferenceDate(x.date);
10673
+ let selected_date2;
10674
+ if (!((_e = evolandStore.reference_dates) == null ? void 0 : _e.find((date) => date == x.date))) {
10675
+ selected_date2 = (_f = evolandStore.reference_dates) == null ? void 0 : _f.find((date) => new Date(date).getMonth() + 1 == new Date(x.date).getMonth() + 1);
10676
+ evolandStore.setSelectedReferenceDate(selected_date2);
10677
+ } else {
10678
+ evolandStore.setSelectedReferenceDate(x.date);
10679
+ selected_date2 = x.date;
10680
+ }
10740
10681
  evolandStore.setUpdateAsset(true);
10741
10682
  insertEmptyBufferForSingleBand(
10742
- (_h = evolandStore.reference_dates && evolandStore.selectedReferenceDate ? (_f = evolandStore.annotatedRasterAsset) == null ? void 0 : _f.buffer[(_e = evolandStore.reference_dates) == null ? void 0 : _e.indexOf(
10683
+ (_j = evolandStore.reference_dates && evolandStore.selectedReferenceDate ? (_h = evolandStore.annotatedRasterAsset) == null ? void 0 : _h.buffer[(_g = evolandStore.reference_dates) == null ? void 0 : _g.indexOf(
10743
10684
  evolandStore.selectedReferenceDate
10744
- )] : (_g = evolandStore.annotatedRasterAsset) == null ? void 0 : _g.buffer[0]) == null ? void 0 : _h.length,
10745
- (_i = evolandStore.annotatedRasterAsset) == null ? void 0 : _i.width,
10746
- (_j = evolandStore.annotatedRasterAsset) == null ? void 0 : _j.height,
10747
- (_k = evolandStore.reference_dates) == null ? void 0 : _k.indexOf(x.date),
10685
+ )] : (_i = evolandStore.annotatedRasterAsset) == null ? void 0 : _i.buffer[0]) == null ? void 0 : _j.length,
10686
+ (_k = evolandStore.annotatedRasterAsset) == null ? void 0 : _k.width,
10687
+ (_l = evolandStore.annotatedRasterAsset) == null ? void 0 : _l.height,
10688
+ (_m = evolandStore.reference_dates) == null ? void 0 : _m.indexOf(selected_date2),
10748
10689
  evolandStore.annotatedRasterAsset,
10749
10690
  evolandStore.labels,
10750
10691
  evolandStore.isAnnualAnnotation
@@ -10777,7 +10718,7 @@ var init_TimeSeries = __esm({
10777
10718
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
10778
10719
  "div",
10779
10720
  {
10780
- className: "pl-8 text-xs w-32 text-white " + (((_b = evolandStore.selectedCompositeRasterAsset) == null ? void 0 : _b.id) == x.id || !evolandStore.isAnnualAnnotation && evolandStore.selectedReferenceDate == x.date ? "bg-red-400" : ""),
10721
+ className: "pl-8 text-xs w-32 text-white " + (((_c = evolandStore.selectedCompositeRasterAsset) == null ? void 0 : _c.id) == x.id || !evolandStore.isAnnualAnnotation && evolandStore.selectedReferenceDate == selected_date ? "bg-red-400" : ""),
10781
10722
  children: x.date
10782
10723
  }
10783
10724
  )
@@ -10786,7 +10727,7 @@ var init_TimeSeries = __esm({
10786
10727
  ] })
10787
10728
  ] });
10788
10729
  }) }),
10789
- currentTab == -1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "overflow-x-scroll flex flex-row", children: [
10730
+ currentTab == -1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "overflow-x-scroll flex flex-row pt-4", children: [
10790
10731
  !evolandStore.annotatedRasterAsset && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: "No annotation" }),
10791
10732
  evolandStore.annotatedRasterAsset && evolandStore.annotation_dates && evolandStore.annotation_dates.map(
10792
10733
  (annotationDate, index) => {
@@ -10879,8 +10820,7 @@ var init_OverlayLayer = __esm({
10879
10820
  if (e.target.value !== "0") {
10880
10821
  layerStore.setSelectedLayer(e.target.value);
10881
10822
  setShowLayerOpacity(true);
10882
- if (layerStore.layerOpacity == 0)
10883
- layerStore.setLayerOpacity(0.4);
10823
+ if (layerStore.layerOpacity == 0) layerStore.setLayerOpacity(0.4);
10884
10824
  } else {
10885
10825
  setShowLayerOpacity(false);
10886
10826
  layerStore.setSelectedLayer("");
@@ -10912,16 +10852,17 @@ var GeoWikiMap_exports = {};
10912
10852
  __export(GeoWikiMap_exports, {
10913
10853
  GeoWikiMap: () => GeoWikiMap
10914
10854
  });
10915
- var import_react60, import_react_leaflet28, import_leaflet22, import_dist, import_core44, import_ui43, import_core45, import_react_hotkeys_hook3, import_jsx_runtime77, GeoWikiMapComponent, GeoWikiMap;
10855
+ var import_react60, import_react_leaflet28, import_leaflet23, import_dist, import_core44, import_leaflet24, import_ui43, import_core45, import_react_hotkeys_hook3, import_jsx_runtime77, GeoWikiMapComponent, GeoWikiMap;
10916
10856
  var init_GeoWikiMap = __esm({
10917
10857
  "src/Components/Map/GeoWikiMap.tsx"() {
10918
10858
  "use strict";
10919
10859
  "use client";
10920
10860
  import_react60 = require("react");
10921
10861
  import_react_leaflet28 = require("react-leaflet");
10922
- import_leaflet22 = require("leaflet/dist/leaflet.css");
10862
+ import_leaflet23 = require("leaflet/dist/leaflet.css");
10923
10863
  import_dist = require("@bopen/leaflet-area-selection/dist/index.css");
10924
10864
  import_core44 = require("@geowiki/core");
10865
+ import_leaflet24 = require("leaflet");
10925
10866
  init_EvolandContainer();
10926
10867
  init_EvolandLeftSideBar();
10927
10868
  init_Annotation();
@@ -10944,7 +10885,7 @@ var init_GeoWikiMap = __esm({
10944
10885
  import_jsx_runtime77 = require("react/jsx-runtime");
10945
10886
  GeoWikiMapComponent = ({ mapSettings, session }) => {
10946
10887
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
10947
- const mapRef = (0, import_react60.useRef)();
10888
+ const mapRef = (0, import_react60.useRef)(void 0);
10948
10889
  const router = (0, import_core45.useRouter)();
10949
10890
  var projectId = router.query.projectId;
10950
10891
  var locationId = router.query.locationId;
@@ -11051,7 +10992,7 @@ var init_GeoWikiMap = __esm({
11051
10992
  children: "Guide"
11052
10993
  }
11053
10994
  ) }),
11054
- /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_react_leaflet28.LayersControl, { position: "topright", children: [
10995
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_react_leaflet28.LayersControl, { position: "topright", children: [
11055
10996
  /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react_leaflet28.LayersControl.BaseLayer, { name: "Esri World imagery", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11056
10997
  import_react_leaflet28.TileLayer,
11057
10998
  {
@@ -11086,27 +11027,33 @@ var init_GeoWikiMap = __esm({
11086
11027
  maxZoom: 21
11087
11028
  }
11088
11029
  ) }),
11089
- /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_ui43.RequireFeature, { feature: "GeoWiki.EvoLand", children: wmsLayerNames == null ? void 0 : wmsLayerNames.layers.map((layer) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11090
- import_react_leaflet28.LayersControl.Overlay,
11091
- {
11092
- checked: layer.layerName == layerStore.selectedLayer,
11093
- name: layer.layerName,
11094
- children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11095
- CustomWMSTileLayer,
11096
- {
11097
- transparent: true,
11098
- zIndex: 100,
11099
- layers: layer.layerName,
11100
- attribution: "GeoWiki",
11101
- format: "image/png",
11102
- url: "https://services.terrascope.be/wms/v2",
11103
- opacity: layer.opacity == void 0 ? layerStore.layerOpacity : layer.opacity
11104
- }
11105
- )
11106
- },
11107
- layer.layerName
11108
- )) })
11109
- ] }),
11030
+ /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_ui43.RequireFeature, { feature: "GeoWiki.EvoLand", children: wmsLayerNames == null ? void 0 : wmsLayerNames.layers.map((layer) => {
11031
+ const len = layer.layerDescription.split(" ").length;
11032
+ const year = layer.layerDescription.split(" ")[len - 1];
11033
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11034
+ import_react_leaflet28.LayersControl.Overlay,
11035
+ {
11036
+ checked: layer.layerName == layerStore.selectedLayer,
11037
+ name: layer.layerName,
11038
+ children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11039
+ CustomWMSTileLayer,
11040
+ {
11041
+ transparent: true,
11042
+ zIndex: 100,
11043
+ layers: layer.layerName,
11044
+ attribution: "GeoWiki",
11045
+ format: "image/png",
11046
+ version: "1.3.0",
11047
+ crs: import_leaflet24.CRS.EPSG3857,
11048
+ url: `https://titiler.terrascope.be/wms?time=${year}-01-01`,
11049
+ opacity: layer.opacity == void 0 ? layerStore.layerOpacity : layer.opacity
11050
+ }
11051
+ )
11052
+ },
11053
+ layer.layerName
11054
+ );
11055
+ }) })
11056
+ ] }) }),
11110
11057
  /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_react_leaflet28.LayerGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(LayerStoreList, {}) }),
11111
11058
  /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_ui43.RequireFeature, { feature: "GeoWiki.EvoLand", children: [
11112
11059
  /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(EvolandContainer, { sessionStatus: session.status }),
@@ -11123,7 +11070,7 @@ var init_GeoWikiMap = __esm({
11123
11070
  viewBox: "0 0 24 24",
11124
11071
  xmlns: "http://www.w3.org/2000/svg",
11125
11072
  fill: "#000000",
11126
- className: "w-7 h-7 bg-white mb-2 hover:cursor-pointer",
11073
+ className: "w-7 h-7 bg-white mb-2 hover:cursor-pointer rounded-md p-1",
11127
11074
  onClick: () => {
11128
11075
  evolandStore.setShowTimeSeries(
11129
11076
  !evolandStore.showTimeSeries
@@ -11156,7 +11103,7 @@ var init_GeoWikiMap = __esm({
11156
11103
  viewBox: "0 0 24 24",
11157
11104
  strokeWidth: "1.5",
11158
11105
  stroke: "currentColor",
11159
- className: "w-7 h-7 mb-2 bg-white hover:cursor-pointer",
11106
+ className: "w-7 h-7 mb-2 bg-white hover:cursor-pointer rounded-md",
11160
11107
  children: [
11161
11108
  /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
11162
11109
  "path",
@@ -11194,7 +11141,7 @@ var init_GeoWikiMap = __esm({
11194
11141
  viewBox: "0 0 24 24",
11195
11142
  strokeWidth: "1.5",
11196
11143
  stroke: "currentColor",
11197
- className: "w-7 h-7 bg-white hover:cursor-pointer",
11144
+ className: "w-7 h-7 bg-white hover:cursor-pointer rounded-md",
11198
11145
  onClick: () => {
11199
11146
  evolandStore.onRecenterLocation();
11200
11147
  },
@@ -11331,8 +11278,8 @@ var init_GeoWikiMap = __esm({
11331
11278
  });
11332
11279
 
11333
11280
  // src/index.tsx
11334
- var src_exports = {};
11335
- __export(src_exports, {
11281
+ var index_exports = {};
11282
+ __export(index_exports, {
11336
11283
  Annotation: () => Annotation,
11337
11284
  BasfMap: () => BasfMap,
11338
11285
  BasicMap: () => BasicMap,
@@ -11357,7 +11304,7 @@ __export(src_exports, {
11357
11304
  MapEvents: () => MapEvents,
11358
11305
  MapLibre: () => MapLibre,
11359
11306
  MapSidebar: () => MapSidebar,
11360
- MarkerClusterGroup: () => MarkerClusterGroup2,
11307
+ MarkerClusterGroup: () => MarkerClusterGroup,
11361
11308
  OverlayLayer: () => OverlayLayer,
11362
11309
  PointSelection: () => PointSelection,
11363
11310
  Questions: () => Questions,
@@ -11374,7 +11321,7 @@ __export(src_exports, {
11374
11321
  useMapLayerStore: () => useMapLayerStore,
11375
11322
  useMapStore: () => useMapStore
11376
11323
  });
11377
- module.exports = __toCommonJS(src_exports);
11324
+ module.exports = __toCommonJS(index_exports);
11378
11325
  init_GenericControl();
11379
11326
  init_EvoLandGeometry();
11380
11327
  init_PointSelection();
@@ -11555,7 +11502,7 @@ init_evoland();
11555
11502
  init_EvoLandRasterType();
11556
11503
 
11557
11504
  // src/Components/Map/BasicMap.tsx
11558
- var import_leaflet10 = require("leaflet/dist/leaflet.css");
11505
+ var import_leaflet11 = require("leaflet/dist/leaflet.css");
11559
11506
  var import_react36 = require("react");
11560
11507
  var import_react_leaflet15 = require("react-leaflet");
11561
11508
  var import_core33 = require("@geowiki/core");
@@ -11592,10 +11539,8 @@ var BingLayer = class extends L13.TileLayer {
11592
11539
  for (let i = z4; i > 0; i--) {
11593
11540
  let digit = 0;
11594
11541
  const mask = 1 << i - 1;
11595
- if ((x & mask) !== 0)
11596
- digit += 1;
11597
- if ((y & mask) !== 0)
11598
- digit += 2;
11542
+ if ((x & mask) !== 0) digit += 1;
11543
+ if ((y & mask) !== 0) digit += 2;
11599
11544
  quad = quad + digit;
11600
11545
  }
11601
11546
  return quad;
@@ -11609,8 +11554,7 @@ var BingLayer = class extends L13.TileLayer {
11609
11554
  }
11610
11555
  loadMetadata() {
11611
11556
  var _a;
11612
- if (this.metaRequested)
11613
- return;
11557
+ if (this.metaRequested) return;
11614
11558
  this.metaRequested = true;
11615
11559
  const _this = this;
11616
11560
  const cbid = "_bing_metadata_" + L13.Util.stamp(this);
@@ -11618,8 +11562,7 @@ var BingLayer = class extends L13.TileLayer {
11618
11562
  var _a2;
11619
11563
  window[cbid] = void 0;
11620
11564
  const e = document.getElementById(cbid);
11621
- if (e)
11622
- (_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
11565
+ if (e) (_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
11623
11566
  if (meta.errorDetails) {
11624
11567
  console.log(meta.errorDetails);
11625
11568
  return;
@@ -11663,8 +11606,7 @@ var BingLayer = class extends L13.TileLayer {
11663
11606
  this._update();
11664
11607
  }
11665
11608
  _update() {
11666
- if (this._url === null || !this._map)
11667
- return;
11609
+ if (this._url === null || !this._map) return;
11668
11610
  this._update_attribution();
11669
11611
  super._update();
11670
11612
  }
@@ -11827,8 +11769,7 @@ var useMapControlStore = (0, import_zustand6.create)((set) => ({
11827
11769
  })),
11828
11770
  toggleControlOpen: (id) => set((state) => {
11829
11771
  const targetControl = state.controls.find((c) => c.id === id);
11830
- if (!targetControl)
11831
- return state;
11772
+ if (!targetControl) return state;
11832
11773
  const targetPosition = targetControl.position;
11833
11774
  const shouldOpenTarget = !targetControl.isOpen;
11834
11775
  const updatedControls = state.controls.map((control) => {
@@ -12016,7 +11957,7 @@ var import_jsx_runtime42 = require("react/jsx-runtime");
12016
11957
  var constructLegendUrl = (baseUrl, layer, format, style) => {
12017
11958
  return `${baseUrl}?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=${format}&LAYER=${layer}&STYLE=${style}&legend_options=dpi:150`;
12018
11959
  };
12019
- var fetchLegendData = (baseUrl, layerName, format, style) => __async(void 0, null, function* () {
11960
+ var fetchLegendData = (baseUrl, layerName, format, style) => __async(null, null, function* () {
12020
11961
  const legendGraphicUrl = constructLegendUrl(
12021
11962
  baseUrl,
12022
11963
  layerName,
@@ -12817,10 +12758,8 @@ var LayerSwitcher = (0, import_react27.memo)(() => {
12817
12758
  },
12818
12759
  [openHoverCardId]
12819
12760
  );
12820
- if (error)
12821
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Error loading map layers" });
12822
- if (isLoading)
12823
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Loading layers..." });
12761
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Error loading map layers" });
12762
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: "Loading layers..." });
12824
12763
  const mapMenus = parseMapMenuItems(mapMenuItems);
12825
12764
  const hasRegularLayers = (mapMenus == null ? void 0 : mapMenus.length) > 0;
12826
12765
  const hasCustomLayers = customLayers.length > 0;
@@ -12834,6 +12773,7 @@ var LayerSwitcher = (0, import_react27.memo)(() => {
12834
12773
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
12835
12774
  import_react30.Disclosure,
12836
12775
  {
12776
+ as: "div",
12837
12777
  "data-component": menu.title,
12838
12778
  defaultOpen: mapMenus.length === 1,
12839
12779
  children: ({ open }) => {
@@ -13291,8 +13231,7 @@ var MapControlContainer = (0, import_react35.memo)(() => {
13291
13231
  }, [controls]);
13292
13232
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_ui24.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, { children: Object.entries(POSITION_CLASSES2).map(([position, className]) => {
13293
13233
  const positionControls = controlsByPosition[position] || [];
13294
- if (positionControls.length === 0)
13295
- return null;
13234
+ if (positionControls.length === 0) return null;
13296
13235
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
13297
13236
  PositionGroup,
13298
13237
  {
@@ -13319,8 +13258,7 @@ var BasicMap = () => {
13319
13258
  ((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
13320
13259
  ];
13321
13260
  (0, import_core33.useRenderInfo)("BasicMap");
13322
- if (isSettingsLoading)
13323
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_ui25.LoaderFull, {});
13261
+ if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_ui25.LoaderFull, {});
13324
13262
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
13325
13263
  import_react_leaflet15.MapContainer,
13326
13264
  {
@@ -13349,7 +13287,7 @@ var BasicMap = () => {
13349
13287
  };
13350
13288
 
13351
13289
  // src/Components/Map/BasfMap.tsx
13352
- var import_leaflet14 = require("leaflet/dist/leaflet.css");
13290
+ var import_leaflet15 = require("leaflet/dist/leaflet.css");
13353
13291
  var import_react46 = require("react");
13354
13292
  var import_react_leaflet19 = require("react-leaflet");
13355
13293
  var import_useMapSettings2 = __toESM(require("@geowiki/core/src/hooks/useMapSettings"));
@@ -13389,8 +13327,7 @@ var useSelectedPixelStore = (0, import_zustand7.default)((set) => ({
13389
13327
  set((state) => {
13390
13328
  var _a;
13391
13329
  const feat = (_a = geoJson.features[0]) == null ? void 0 : _a.id;
13392
- if (!feat)
13393
- return state;
13330
+ if (!feat) return state;
13394
13331
  const existing = state.data.some(
13395
13332
  (item) => item.features[0].id === geoJson.features[0].id
13396
13333
  );
@@ -13477,7 +13414,7 @@ init_map();
13477
13414
  // src/Components/Basf/SelectedPixelsLayer.tsx
13478
13415
  var import_react38 = require("react");
13479
13416
  var import_react_leaflet16 = require("react-leaflet");
13480
- var import_leaflet11 = __toESM(require("leaflet"));
13417
+ var import_leaflet12 = __toESM(require("leaflet"));
13481
13418
  var SelectedPixelsLayer = () => {
13482
13419
  const { data } = useSelectedPixelStore();
13483
13420
  const layerRef = (0, import_react38.useRef)(null);
@@ -13485,13 +13422,13 @@ var SelectedPixelsLayer = () => {
13485
13422
  const prevDataRef = (0, import_react38.useRef)(data);
13486
13423
  (0, import_react38.useEffect)(() => {
13487
13424
  if (!layerRef.current) {
13488
- layerRef.current = import_leaflet11.default.layerGroup().addTo(map);
13425
+ layerRef.current = import_leaflet12.default.layerGroup().addTo(map);
13489
13426
  }
13490
13427
  if (prevDataRef.current !== data) {
13491
13428
  layerRef.current.clearLayers();
13492
13429
  data.forEach((geoJson) => {
13493
13430
  var _a;
13494
- const layer = import_leaflet11.default.geoJSON(geoJson, {
13431
+ const layer = import_leaflet12.default.geoJSON(geoJson, {
13495
13432
  style: () => ({
13496
13433
  color: "red",
13497
13434
  weight: 2,
@@ -14056,7 +13993,7 @@ var BasfSelect = () => {
14056
13993
  [selectedItems]
14057
13994
  );
14058
13995
  const onSubmit = (0, import_react43.useCallback)(
14059
- (data) => __async(void 0, null, function* () {
13996
+ (data) => __async(null, null, function* () {
14060
13997
  setIsSubmitting(true);
14061
13998
  try {
14062
13999
  if (checkIfItemExists(data)) {
@@ -14156,8 +14093,8 @@ var import_ui32 = require("@geowiki/ui");
14156
14093
  // src/Components/Controls/MeasureControl.tsx
14157
14094
  var import_react44 = require("react");
14158
14095
  var import_react_leaflet17 = require("react-leaflet");
14159
- var import_leaflet12 = __toESM(require("leaflet"));
14160
- var import_leaflet13 = require("leaflet.polylinemeasure");
14096
+ var import_leaflet13 = __toESM(require("leaflet"));
14097
+ var import_leaflet14 = require("leaflet.polylinemeasure");
14161
14098
  var import_ui31 = require("@geowiki/ui");
14162
14099
  var import_core38 = require("@geowiki/core");
14163
14100
  var import_jsx_runtime60 = require("react/jsx-runtime");
@@ -14166,9 +14103,8 @@ function PolylineMeasureControl() {
14166
14103
  const controlRef = (0, import_react44.useRef)(null);
14167
14104
  const [active, setActive] = (0, import_react44.useState)(false);
14168
14105
  (0, import_react44.useEffect)(() => {
14169
- if (!map)
14170
- return;
14171
- controlRef.current = import_leaflet12.default.control.polylineMeasure({
14106
+ if (!map) return;
14107
+ controlRef.current = import_leaflet13.default.control.polylineMeasure({
14172
14108
  position: "topright",
14173
14109
  unit: "metres",
14174
14110
  showBearings: true,
@@ -14188,8 +14124,7 @@ function PolylineMeasureControl() {
14188
14124
  };
14189
14125
  }, [map]);
14190
14126
  const togglePolylineMeasure = () => {
14191
- if (!controlRef.current)
14192
- return;
14127
+ if (!controlRef.current) return;
14193
14128
  if (!controlRef.current._measureControl) {
14194
14129
  console.warn("Measurement control not properly initialized");
14195
14130
  return;
@@ -14205,8 +14140,7 @@ function PolylineMeasureControl() {
14205
14140
  }
14206
14141
  };
14207
14142
  const clearMeasurements = () => {
14208
- if (!controlRef.current)
14209
- return;
14143
+ if (!controlRef.current) return;
14210
14144
  controlRef.current._clearAllMeasurements();
14211
14145
  import_core38.trackMapEvent.measurementTool("clear");
14212
14146
  };
@@ -14315,8 +14249,7 @@ var BasfMapComponent = (_a) => {
14315
14249
  Number((_i = (_h = (_g = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _g.Longitude) == null ? void 0 : _h.Text) != null ? _i : 16.3738)
14316
14250
  ];
14317
14251
  const steps = (_k = (_j = mapSettings == null ? void 0 : mapSettings.MapSettings) == null ? void 0 : _j.TourSteps) == null ? void 0 : _k.Text;
14318
- if (isSettingsLoading)
14319
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_ui33.LoaderFull, {});
14252
+ if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_ui33.LoaderFull, {});
14320
14253
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_jsx_runtime62.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
14321
14254
  import_react_leaflet19.MapContainer,
14322
14255
  __spreadProps(__spreadValues({
@@ -14344,7 +14277,7 @@ var BasfMap = (0, import_react46.memo)(BasfMapComponent);
14344
14277
  BasfMap.displayName = "BasfMap";
14345
14278
 
14346
14279
  // src/Components/Map/GeoTreesMap.tsx
14347
- var import_leaflet16 = require("leaflet/dist/leaflet.css");
14280
+ var import_leaflet17 = require("leaflet/dist/leaflet.css");
14348
14281
  var import_react_leaflet23 = require("react-leaflet");
14349
14282
 
14350
14283
  // src/Components/Map/GeoTreesControlList.tsx
@@ -14386,7 +14319,7 @@ var GeoTreesDownloadContent = () => {
14386
14319
  }
14387
14320
  }, [session, setValue]);
14388
14321
  (0, import_react47.useEffect)(() => {
14389
- const fetchCountries = () => __async(void 0, null, function* () {
14322
+ const fetchCountries = () => __async(null, null, function* () {
14390
14323
  try {
14391
14324
  const response = yield fetch(
14392
14325
  `${baseUrl}/api/plots/get-available-countries`,
@@ -14402,7 +14335,7 @@ var GeoTreesDownloadContent = () => {
14402
14335
  console.error("Error fetching countries:", error);
14403
14336
  }
14404
14337
  });
14405
- const fetchVersions = () => __async(void 0, null, function* () {
14338
+ const fetchVersions = () => __async(null, null, function* () {
14406
14339
  try {
14407
14340
  const response = yield fetch(
14408
14341
  `${baseUrl}/api/plots/available-versions`,
@@ -14656,8 +14589,7 @@ var ScaleControl3 = ({
14656
14589
  const [scale, setScale] = (0, import_react48.useState)("");
14657
14590
  (0, import_react48.useEffect)(() => {
14658
14591
  const updateScale = () => {
14659
- if (!map)
14660
- return;
14592
+ if (!map) return;
14661
14593
  const center4 = map.getCenter();
14662
14594
  const zoom = map.getZoom();
14663
14595
  const metersPerPixel = 156543.03392 * Math.cos(center4.lat * Math.PI / 180) / Math.pow(2, zoom);
@@ -14673,8 +14605,7 @@ var ScaleControl3 = ({
14673
14605
  map.off("moveend", updateScale);
14674
14606
  };
14675
14607
  }, [map]);
14676
- if (!scale)
14677
- return null;
14608
+ if (!scale) return null;
14678
14609
  return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
14679
14610
  "div",
14680
14611
  {
@@ -14769,7 +14700,7 @@ var import_react52 = require("react");
14769
14700
  var import_react50 = require("react");
14770
14701
  var import_react_leaflet22 = require("react-leaflet");
14771
14702
  init_MarkerClusterGroup();
14772
- var import_leaflet15 = __toESM(require("leaflet"));
14703
+ var import_leaflet16 = __toESM(require("leaflet"));
14773
14704
  init_mapLayers();
14774
14705
  init_customLayers();
14775
14706
  var import_MapPinIcon3 = __toESM(require("@heroicons/react/24/solid/MapPinIcon"));
@@ -14792,7 +14723,7 @@ var createTreeIcon = (color = "#22c55e") => {
14792
14723
  const iconHtml = (0, import_server5.renderToString)(
14793
14724
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_MapPinIcon3.default, { height: 24, width: 24, color })
14794
14725
  );
14795
- return new import_leaflet15.default.DivIcon({
14726
+ return new import_leaflet16.default.DivIcon({
14796
14727
  html: `<div style="
14797
14728
  display: flex;
14798
14729
  align-items: center;
@@ -14816,7 +14747,7 @@ var createClusterIcon5 = (cluster) => {
14816
14747
  size = 48;
14817
14748
  fontSize = 16;
14818
14749
  }
14819
- return new import_leaflet15.default.DivIcon({
14750
+ return new import_leaflet16.default.DivIcon({
14820
14751
  html: `<div style="
14821
14752
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
14822
14753
  color: white;
@@ -14834,7 +14765,7 @@ var createClusterIcon5 = (cluster) => {
14834
14765
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
14835
14766
  ">${childCount}</div>`,
14836
14767
  className: "custom-tree-cluster-icon",
14837
- iconSize: import_leaflet15.default.point(size, size)
14768
+ iconSize: import_leaflet16.default.point(size, size)
14838
14769
  });
14839
14770
  };
14840
14771
  var TreeMarkerPopup = ({
@@ -15043,7 +14974,7 @@ var GeoTreesCustomLayerComponent = () => {
15043
14974
  );
15044
14975
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
15045
14976
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
15046
- MarkerClusterGroup2,
14977
+ MarkerClusterGroup,
15047
14978
  {
15048
14979
  chunkedLoading: true,
15049
14980
  maxClusterRadius: 60,
@@ -15273,7 +15204,7 @@ var GeoTreesExternalLayer = (0, import_react51.forwardRef)(
15273
15204
  const externalUrl = `${API_URL}/api/external/google-sheet-geojson`;
15274
15205
  const { isLoading, error, data } = (0, import_react_query5.useQuery)({
15275
15206
  queryKey: ["geoTreesExternal", externalUrl],
15276
- queryFn: () => __async(void 0, null, function* () {
15207
+ queryFn: () => __async(null, null, function* () {
15277
15208
  if (!API_URL) {
15278
15209
  throw new Error("NEXT_PUBLIC_GEO_TREE_API_URL is not configured");
15279
15210
  }
@@ -15305,8 +15236,7 @@ var GeoTreesExternalLayer = (0, import_react51.forwardRef)(
15305
15236
  );
15306
15237
  const addGeoTreesLayer = (0, import_react51.useCallback)(() => {
15307
15238
  var _a2;
15308
- if (!data)
15309
- return;
15239
+ if (!data) return;
15310
15240
  const layerId = "geotrees-external-layer";
15311
15241
  if (hasLayerBeenAdded(layerId) || existingLayer || hasAddedLayer.current) {
15312
15242
  console.warn("GEO-TREES BRM layer already exists, skipping addition", {
@@ -15319,8 +15249,7 @@ var GeoTreesExternalLayer = (0, import_react51.forwardRef)(
15319
15249
  const filteredFeatures = ((_a2 = data.features) == null ? void 0 : _a2.filter((feature) => {
15320
15250
  var _a3;
15321
15251
  const status = (_a3 = feature.properties) == null ? void 0 : _a3.Status;
15322
- if (!status)
15323
- return true;
15252
+ if (!status) return true;
15324
15253
  const statusKey = getStatusFromRaw(status);
15325
15254
  return statusKey ? statusFilter[statusKey] : true;
15326
15255
  })) || [];
@@ -15388,12 +15317,9 @@ var GeoTreesExternalLayer = (0, import_react51.forwardRef)(
15388
15317
  addGeoTreesLayer();
15389
15318
  }
15390
15319
  }, [data, autoAdd, existingLayer, addGeoTreesLayer, hasLayerBeenAdded]);
15391
- if (error)
15392
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ErrorDisplay, { error });
15393
- if (isLoading)
15394
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(LoadingDisplay, {});
15395
- if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length))
15396
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(EmptyStateDisplay, {});
15320
+ if (error) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ErrorDisplay, { error });
15321
+ if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(LoadingDisplay, {});
15322
+ if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length)) return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(EmptyStateDisplay, {});
15397
15323
  return null;
15398
15324
  }
15399
15325
  );
@@ -15444,8 +15370,7 @@ var GeoTreesMap = () => {
15444
15370
  "Error loading map settings: ",
15445
15371
  error.message
15446
15372
  ] }) });
15447
- if (isSettingsLoading)
15448
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_ui35.LoaderFull, { showInCenter: false });
15373
+ if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_ui35.LoaderFull, { showInCenter: false });
15449
15374
  const zoom = (_c = (_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) != null ? _c : 12;
15450
15375
  const center4 = [
15451
15376
  (_f = (_e = (_d = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _d.Latitude) == null ? void 0 : _e.Text) != null ? _f : 48.2082,
@@ -15455,7 +15380,7 @@ var GeoTreesMap = () => {
15455
15380
  };
15456
15381
 
15457
15382
  // src/Components/Canopy/CanopyMap.tsx
15458
- var import_leaflet21 = require("leaflet/dist/leaflet.css");
15383
+ var import_leaflet22 = require("leaflet/dist/leaflet.css");
15459
15384
  var import_react58 = require("react");
15460
15385
  var import_react_leaflet27 = require("react-leaflet");
15461
15386
  var import_core41 = require("@geowiki/core");
@@ -15471,7 +15396,7 @@ var import_react_leaflet26 = require("react-leaflet");
15471
15396
  // src/Components/Map/GenericAreaSelect.tsx
15472
15397
  var import_react53 = require("react");
15473
15398
  var import_react_leaflet24 = require("react-leaflet");
15474
- var import_leaflet17 = require("leaflet");
15399
+ var import_leaflet18 = require("leaflet");
15475
15400
 
15476
15401
  // src/store/AreaSelectStore.ts
15477
15402
  var import_zustand8 = require("zustand");
@@ -15506,11 +15431,10 @@ var useAreaSelect = ({
15506
15431
  const rectangleRef = (0, import_react53.useRef)(null);
15507
15432
  (0, import_react53.useEffect)(() => {
15508
15433
  var _a;
15509
- if (!map.selectArea)
15510
- return;
15434
+ if (!map.selectArea) return;
15511
15435
  (_a = map.selectArea) == null ? void 0 : _a.setControlKey(false);
15512
15436
  if (!rectangleRef.current) {
15513
- rectangleRef.current = new import_leaflet17.Rectangle(
15437
+ rectangleRef.current = new import_leaflet18.Rectangle(
15514
15438
  [
15515
15439
  [0, 0],
15516
15440
  [0, 0]
@@ -15520,8 +15444,7 @@ var useAreaSelect = ({
15520
15444
  }
15521
15445
  const handleAreaSelected = (e) => {
15522
15446
  var _a2, _b, _c;
15523
- if (!e.bounds)
15524
- return;
15447
+ if (!e.bounds) return;
15525
15448
  const boundsString = e.bounds.toBBoxString();
15526
15449
  if (onAreaSelected) {
15527
15450
  onAreaSelected(boundsString);
@@ -15589,14 +15512,13 @@ var useAreaSelect = ({
15589
15512
  var import_react54 = require("react");
15590
15513
  var import_lucide_react5 = require("lucide-react");
15591
15514
  var import_ui36 = require("@geowiki/ui");
15592
- var import_leaflet18 = __toESM(require("leaflet"));
15515
+ var import_leaflet19 = __toESM(require("leaflet"));
15593
15516
  var import_jsx_runtime70 = require("react/jsx-runtime");
15594
15517
  var CanopyAtlasDownload = () => {
15595
15518
  const [format, setFormat] = (0, import_react54.useState)("shape-zip");
15596
15519
  const { bbox: bbox4 } = useAreaSelectStore();
15597
- const handleDownload = () => __async(void 0, null, function* () {
15598
- if (!bbox4)
15599
- return;
15520
+ const handleDownload = () => __async(null, null, function* () {
15521
+ if (!bbox4) return;
15600
15522
  const params = {
15601
15523
  request: "GetFeature",
15602
15524
  service: "WFS",
@@ -15608,11 +15530,10 @@ var CanopyAtlasDownload = () => {
15608
15530
  maxFeatures: 1e3
15609
15531
  };
15610
15532
  const baseUrl = "https://geoserver.iiasa.ac.at/geoserver/canopyatlas/ows";
15611
- const wfsUrl = baseUrl + import_leaflet18.default.Util.getParamString(params, baseUrl, true);
15533
+ const wfsUrl = baseUrl + import_leaflet19.default.Util.getParamString(params, baseUrl, true);
15612
15534
  try {
15613
15535
  const response = yield fetch(wfsUrl);
15614
- if (!response.ok)
15615
- throw new Error("Download failed");
15536
+ if (!response.ok) throw new Error("Download failed");
15616
15537
  const blob = yield response.blob();
15617
15538
  const url = window.URL.createObjectURL(blob);
15618
15539
  const a = document.createElement("a");
@@ -15662,7 +15583,7 @@ var CanopyAtlasDownload = () => {
15662
15583
  var import_react55 = require("react");
15663
15584
  var import_ui37 = require("@geowiki/ui");
15664
15585
  var import_lucide_react6 = require("lucide-react");
15665
- var import_leaflet19 = __toESM(require("leaflet"));
15586
+ var import_leaflet20 = __toESM(require("leaflet"));
15666
15587
  var import_ui38 = require("@geowiki/ui");
15667
15588
  var import_react_hook_form5 = require("react-hook-form");
15668
15589
  var z2 = __toESM(require("zod"));
@@ -15786,20 +15707,15 @@ var CanopyFilter = (0, import_react55.memo)(({ onFilterChange }) => {
15786
15707
  localStorage.setItem(STORAGE_KEY, JSON.stringify(updatedFilters));
15787
15708
  onFilterChange(updatedFilters);
15788
15709
  };
15789
- const handleDownload = () => __async(void 0, null, function* () {
15710
+ const handleDownload = () => __async(null, null, function* () {
15790
15711
  const cqlFilters = [];
15791
- if (filters.biome)
15792
- cqlFilters.push(`biome='${filters.biome}'`);
15793
- if (filters.realm)
15794
- cqlFilters.push(`realm='${filters.realm}'`);
15795
- if (filters.access)
15796
- cqlFilters.push(`access='${filters.access}'`);
15712
+ if (filters.biome) cqlFilters.push(`biome='${filters.biome}'`);
15713
+ if (filters.realm) cqlFilters.push(`realm='${filters.realm}'`);
15714
+ if (filters.access) cqlFilters.push(`access='${filters.access}'`);
15797
15715
  if (filters.idunique)
15798
15716
  cqlFilters.push(`IDunique LIKE '%${filters.idunique}%'`);
15799
- if (filters.minyear)
15800
- cqlFilters.push(`minyear>=${filters.minyear}`);
15801
- if (filters.maxyear)
15802
- cqlFilters.push(`minyear<=${filters.maxyear}`);
15717
+ if (filters.minyear) cqlFilters.push(`minyear>=${filters.minyear}`);
15718
+ if (filters.maxyear) cqlFilters.push(`minyear<=${filters.maxyear}`);
15803
15719
  const params = __spreadValues({
15804
15720
  request: "GetFeature",
15805
15721
  service: "WFS",
@@ -15810,11 +15726,10 @@ var CanopyFilter = (0, import_react55.memo)(({ onFilterChange }) => {
15810
15726
  maxFeatures: 1e3
15811
15727
  }, cqlFilters.length > 0 && { CQL_FILTER: cqlFilters.join(" AND ") });
15812
15728
  const baseUrl = "https://geoserver.iiasa.ac.at/geoserver/canopyatlas/ows";
15813
- const wfsUrl = baseUrl + import_leaflet19.default.Util.getParamString(params, baseUrl, true);
15729
+ const wfsUrl = baseUrl + import_leaflet20.default.Util.getParamString(params, baseUrl, true);
15814
15730
  try {
15815
15731
  const response = yield fetch(wfsUrl);
15816
- if (!response.ok)
15817
- throw new Error("Download failed");
15732
+ if (!response.ok) throw new Error("Download failed");
15818
15733
  const blob = yield response.blob();
15819
15734
  const url = window.URL.createObjectURL(blob);
15820
15735
  const a = document.createElement("a");
@@ -16039,7 +15954,7 @@ var import_react56 = require("react");
16039
15954
  var import_react_leaflet25 = require("react-leaflet");
16040
15955
  var import_react_query6 = require("@tanstack/react-query");
16041
15956
  var turf7 = __toESM(require("@turf/turf"));
16042
- var import_leaflet20 = __toESM(require("leaflet"));
15957
+ var import_leaflet21 = __toESM(require("leaflet"));
16043
15958
  init_MarkerClusterGroup();
16044
15959
  var import_server7 = __toESM(require("react-dom/server"));
16045
15960
  init_map();
@@ -16050,10 +15965,8 @@ var constructCqlFilter = (filterParams) => {
16050
15965
  return "";
16051
15966
  }
16052
15967
  let _a = filterParams || {}, { minyear, maxyear } = _a, rest = __objRest(_a, ["minyear", "maxyear"]);
16053
- if (Array.isArray(minyear))
16054
- minyear = minyear[0];
16055
- if (Array.isArray(maxyear))
16056
- maxyear = maxyear[0];
15968
+ if (Array.isArray(minyear)) minyear = minyear[0];
15969
+ if (Array.isArray(maxyear)) maxyear = maxyear[0];
16057
15970
  const cqlExpressions = [];
16058
15971
  if (minyear && maxyear) {
16059
15972
  cqlExpressions.push(
@@ -16100,7 +16013,7 @@ var defaultIcon = (() => {
16100
16013
  const iconSvg = import_server7.default.renderToString(
16101
16014
  /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_lucide_react7.MapPin, { size: 41, color: "#2196F3", strokeWidth: 2, fill: "#ffffff" })
16102
16015
  );
16103
- return new import_leaflet20.default.DivIcon({
16016
+ return new import_leaflet21.default.DivIcon({
16104
16017
  html: iconSvg,
16105
16018
  className: "wfs-layer-marker-icon",
16106
16019
  iconSize: [41, 41],
@@ -16160,16 +16073,14 @@ var formatPropertyValue = (value, propertyName) => {
16160
16073
  return value.toString();
16161
16074
  };
16162
16075
  var createDefaultPopupContent = (feature, propertyNames) => {
16163
- if (!feature.properties)
16164
- return "";
16076
+ if (!feature.properties) return "";
16165
16077
  const propertiesToShow = (propertyNames == null ? void 0 : propertyNames.length) ? propertyNames : DEFAULT_POPUP_PROPERTIES;
16166
16078
  const properties = Object.entries(feature.properties).filter(([key]) => propertiesToShow.includes(key)).sort((a, b) => {
16167
16079
  const indexA = propertiesToShow.indexOf(a[0]);
16168
16080
  const indexB = propertiesToShow.indexOf(b[0]);
16169
16081
  return indexA - indexB;
16170
16082
  });
16171
- if (properties.length === 0)
16172
- return "";
16083
+ if (properties.length === 0) return "";
16173
16084
  return `
16174
16085
  <div class="leaflet-popup-content-wrapper" style="background-color: #fff; padding: 0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);">
16175
16086
  <div style="width: 100%; overflow-y: auto;">
@@ -16240,7 +16151,7 @@ var openDatabase = () => {
16240
16151
  };
16241
16152
  });
16242
16153
  };
16243
- var storeInIndexedDB = (key, data) => __async(void 0, null, function* () {
16154
+ var storeInIndexedDB = (key, data) => __async(null, null, function* () {
16244
16155
  try {
16245
16156
  const db = yield openDatabase();
16246
16157
  const transaction = db.transaction(STORE_NAME, "readwrite");
@@ -16259,7 +16170,7 @@ var storeInIndexedDB = (key, data) => __async(void 0, null, function* () {
16259
16170
  console.warn("Failed to store data in IndexedDB:", e);
16260
16171
  }
16261
16172
  });
16262
- var getFromIndexedDB = (key) => __async(void 0, null, function* () {
16173
+ var getFromIndexedDB = (key) => __async(null, null, function* () {
16263
16174
  try {
16264
16175
  const db = yield openDatabase();
16265
16176
  const transaction = db.transaction(STORE_NAME, "readonly");
@@ -16281,7 +16192,7 @@ var getFromIndexedDB = (key) => __async(void 0, null, function* () {
16281
16192
  return null;
16282
16193
  }
16283
16194
  });
16284
- var cleanupIndexedDB = () => __async(void 0, null, function* () {
16195
+ var cleanupIndexedDB = () => __async(null, null, function* () {
16285
16196
  try {
16286
16197
  const db = yield openDatabase();
16287
16198
  const transaction = db.transaction(STORE_NAME, "readwrite");
@@ -16331,8 +16242,7 @@ var WfsLayer = ({
16331
16242
  }
16332
16243
  });
16333
16244
  const stableFilterParams = (0, import_react56.useMemo)(() => {
16334
- if (!filterParams)
16335
- return null;
16245
+ if (!filterParams) return null;
16336
16246
  return JSON.stringify(filterParams);
16337
16247
  }, [filterParams]);
16338
16248
  const queryKey = (0, import_react56.useMemo)(() => {
@@ -16354,7 +16264,7 @@ var WfsLayer = ({
16354
16264
  }, [url, layerName, filterParams, useServerFiltering]);
16355
16265
  const { data: geoJsonData, error } = (0, import_react_query6.useQuery)({
16356
16266
  queryKey,
16357
- queryFn: () => __async(void 0, null, function* () {
16267
+ queryFn: () => __async(null, null, function* () {
16358
16268
  mapStore.setIsLoading(true);
16359
16269
  const wfsUrl = constructWfsUrl();
16360
16270
  const storageKey = `wfs-data-${queryKey.join("-")}`;
@@ -16419,8 +16329,7 @@ var WfsLayer = ({
16419
16329
  const getFeatureStyle = (0, import_react56.useCallback)(
16420
16330
  (feature) => {
16421
16331
  var _a2;
16422
- if (!feature)
16423
- return defaultStyle;
16332
+ if (!feature) return defaultStyle;
16424
16333
  const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
16425
16334
  return featureId === selectedFeatureId ? highlightStyle : defaultStyle;
16426
16335
  },
@@ -16431,8 +16340,7 @@ var WfsLayer = ({
16431
16340
  var _a2;
16432
16341
  const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
16433
16342
  layerRef.current[featureId] = layer;
16434
- if (!popupOptions || !feature.properties)
16435
- return;
16343
+ if (!popupOptions || !feature.properties) return;
16436
16344
  let popupContent;
16437
16345
  if (popupOptions.renderContent) {
16438
16346
  popupContent = popupOptions.renderContent(feature);
@@ -16444,7 +16352,7 @@ var WfsLayer = ({
16444
16352
  }
16445
16353
  const content = typeof popupContent === "string" ? popupContent : import_server7.default.renderToString(popupContent);
16446
16354
  if (popupContent) {
16447
- const popup = import_leaflet20.default.popup(__spreadValues(__spreadValues({}, DEFAULT_POPUP_OPTIONS), popupOptions.popupOptions || {}));
16355
+ const popup = import_leaflet21.default.popup(__spreadValues(__spreadValues({}, DEFAULT_POPUP_OPTIONS), popupOptions.popupOptions || {}));
16448
16356
  popup.on("add", () => {
16449
16357
  setSelectedFeatureId(featureId);
16450
16358
  });
@@ -16477,8 +16385,7 @@ var WfsLayer = ({
16477
16385
  []
16478
16386
  );
16479
16387
  const filteredGeoJson = (0, import_react56.useMemo)(() => {
16480
- if (!geoJsonData)
16481
- return null;
16388
+ if (!geoJsonData) return null;
16482
16389
  if (useServerFiltering || !filterParams || Object.keys(filterParams).length === 0) {
16483
16390
  return geoJsonData;
16484
16391
  }
@@ -16531,7 +16438,7 @@ var WfsLayer = ({
16531
16438
  },
16532
16439
  layerKey
16533
16440
  ),
16534
- showMarkers && shouldRenderMarkers && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MarkerClusterGroup2, __spreadProps(__spreadValues({}, clusterOptions), { children: filteredGeoJson.features.map(
16441
+ showMarkers && shouldRenderMarkers && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(MarkerClusterGroup, __spreadProps(__spreadValues({}, clusterOptions), { children: filteredGeoJson.features.map(
16535
16442
  (feature, index) => {
16536
16443
  var _a2;
16537
16444
  const coordinates = getFeaturePoint(feature);
@@ -16715,15 +16622,14 @@ var import_jsx_runtime74 = require("react/jsx-runtime");
16715
16622
  var CanopyMap = () => {
16716
16623
  var _a, _b, _c, _d, _e, _f;
16717
16624
  const { data: mapSettings, isLoading: isSettingsLoading } = (0, import_useMapSettings4.default)();
16718
- const mapRef = (0, import_react58.useRef)();
16625
+ const mapRef = (0, import_react58.useRef)(void 0);
16719
16626
  const zoom = ((_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) || 5;
16720
16627
  const center4 = [
16721
16628
  ((_d = (_c = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _c.Latitude) == null ? void 0 : _d.Text) || 48.2082,
16722
16629
  ((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
16723
16630
  ];
16724
16631
  (0, import_core41.useRenderInfo)("BasicMap");
16725
- if (isSettingsLoading)
16726
- return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_ui41.LoaderFull, { showInCenter: false });
16632
+ if (isSettingsLoading) return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_ui41.LoaderFull, { showInCenter: false });
16727
16633
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_jsx_runtime74.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
16728
16634
  import_react_leaflet27.MapContainer,
16729
16635
  {
@@ -16847,7 +16753,7 @@ var BasfLeftPanel = () => {
16847
16753
  [selectedItems]
16848
16754
  );
16849
16755
  const onSubmit = (0, import_react59.useCallback)(
16850
- (data) => __async(void 0, null, function* () {
16756
+ (data) => __async(null, null, function* () {
16851
16757
  setIsSubmitting(true);
16852
16758
  try {
16853
16759
  if (checkIfItemExists(data)) {
@@ -16953,8 +16859,7 @@ var WaybackTimelineMap = (props) => {
16953
16859
  return null;
16954
16860
  }
16955
16861
  (0, import_react61.useEffect)(() => {
16956
- if (props.mapping)
16957
- setWAYBACK_SNAPSHOTS(props.mapping);
16862
+ if (props.mapping) setWAYBACK_SNAPSHOTS(props.mapping);
16958
16863
  }, [props.mapping]);
16959
16864
  const west = parseFloat(searchParams.get("xmin"));
16960
16865
  const south = parseFloat(searchParams.get("ymin"));
@@ -17353,7 +17258,7 @@ var LayerItem2 = (0, import_react62.memo)(
17353
17258
  }
17354
17259
  );
17355
17260
  LayerItem2.displayName = "LayerItem";
17356
- var LayerSwitcher2 = (0, import_react62.memo)(({ mapMenuItems, customLayers }) => {
17261
+ var LayerSwitcher2 = (0, import_react62.memo)((({ mapMenuItems, customLayers }) => {
17357
17262
  const store = useMapLayerStore2();
17358
17263
  const [openHoverCardId, setOpenHoverCardId] = (0, import_react62.useState)(null);
17359
17264
  (0, import_react62.useEffect)(() => {
@@ -17384,6 +17289,7 @@ var LayerSwitcher2 = (0, import_react62.memo)(({ mapMenuItems, customLayers }) =
17384
17289
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
17385
17290
  import_react65.Disclosure,
17386
17291
  {
17292
+ as: "div",
17387
17293
  "data-component": menu.title,
17388
17294
  defaultOpen: mapMenuItems.length === 1,
17389
17295
  children: ({ open }) => {
@@ -17409,8 +17315,7 @@ var LayerSwitcher2 = (0, import_react62.memo)(({ mapMenuItems, customLayers }) =
17409
17315
  ) !== -1,
17410
17316
  onToggle: () => {
17411
17317
  handleToggle(layer);
17412
- if (layer.ontoggle)
17413
- layer.ontoggle();
17318
+ if (layer.ontoggle) layer.ontoggle();
17414
17319
  },
17415
17320
  openHoverCardId,
17416
17321
  onInfoClick: handleInfoClick
@@ -17466,30 +17371,25 @@ var LayerSwitcher2 = (0, import_react62.memo)(({ mapMenuItems, customLayers }) =
17466
17371
  ] })
17467
17372
  ] }, menu.id);
17468
17373
  }) });
17469
- });
17374
+ }));
17470
17375
  LayerSwitcher2.displayName = "LayerSwitcher";
17471
17376
 
17472
17377
  // src/Components/Generic/Map/MapControlToolbar.tsx
17473
17378
  var Popover7 = __toESM(require("@radix-ui/react-popover"));
17474
17379
  var import_ui45 = require("@geowiki/ui");
17475
17380
 
17476
- // ../../node_modules/clsx/dist/clsx.m.js
17381
+ // ../../node_modules/clsx/dist/clsx.mjs
17477
17382
  function r(e) {
17478
17383
  var t, f, n = "";
17479
- if ("string" == typeof e || "number" == typeof e)
17480
- n += e;
17481
- else if ("object" == typeof e)
17482
- if (Array.isArray(e))
17483
- for (t = 0; t < e.length; t++)
17484
- e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
17485
- else
17486
- for (t in e)
17487
- e[t] && (n && (n += " "), n += t);
17384
+ if ("string" == typeof e || "number" == typeof e) n += e;
17385
+ else if ("object" == typeof e) if (Array.isArray(e)) {
17386
+ var o = e.length;
17387
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
17388
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
17488
17389
  return n;
17489
17390
  }
17490
17391
  function clsx() {
17491
- for (var e, t, f = 0, n = ""; f < arguments.length; )
17492
- (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
17392
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
17493
17393
  return n;
17494
17394
  }
17495
17395
 
@@ -17870,7 +17770,7 @@ var arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
17870
17770
  var fractionRegex = /^\d+\/\d+$/;
17871
17771
  var stringLengths = /* @__PURE__ */ new Set(["px", "full", "screen"]);
17872
17772
  var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
17873
- var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))/;
17773
+ var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
17874
17774
  var shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
17875
17775
  function isLength(value) {
17876
17776
  return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value) || isArbitraryLength(value);
@@ -17970,8 +17870,11 @@ function getDefaultConfig() {
17970
17870
  var getOverflow = function getOverflow2() {
17971
17871
  return ["auto", "hidden", "clip", "visible", "scroll"];
17972
17872
  };
17973
- var getSpacingWithAuto = function getSpacingWithAuto2() {
17974
- return ["auto", spacing];
17873
+ var getSpacingWithAutoAndArbitrary = function getSpacingWithAutoAndArbitrary2() {
17874
+ return ["auto", isArbitraryValue, spacing];
17875
+ };
17876
+ var getSpacingWithArbitrary = function getSpacingWithArbitrary2() {
17877
+ return [isArbitraryValue, spacing];
17975
17878
  };
17976
17879
  var getLengthWithEmpty = function getLengthWithEmpty2() {
17977
17880
  return ["", isLength];
@@ -18008,29 +17911,29 @@ function getDefaultConfig() {
18008
17911
  theme: {
18009
17912
  colors: [isAny],
18010
17913
  spacing: [isLength],
18011
- blur: ["none", "", isTshirtSize, isArbitraryLength],
17914
+ blur: ["none", "", isTshirtSize, isArbitraryValue],
18012
17915
  brightness: getNumber(),
18013
17916
  borderColor: [colors],
18014
- borderRadius: ["none", "", "full", isTshirtSize, isArbitraryLength],
18015
- borderSpacing: [spacing],
17917
+ borderRadius: ["none", "", "full", isTshirtSize, isArbitraryValue],
17918
+ borderSpacing: getSpacingWithArbitrary(),
18016
17919
  borderWidth: getLengthWithEmpty(),
18017
17920
  contrast: getNumber(),
18018
17921
  grayscale: getZeroAndEmpty(),
18019
17922
  hueRotate: getNumberAndArbitrary(),
18020
17923
  invert: getZeroAndEmpty(),
18021
- gap: [spacing],
17924
+ gap: getSpacingWithArbitrary(),
18022
17925
  gradientColorStops: [colors],
18023
17926
  gradientColorStopPositions: [isPercent, isArbitraryLength],
18024
- inset: getSpacingWithAuto(),
18025
- margin: getSpacingWithAuto(),
17927
+ inset: getSpacingWithAutoAndArbitrary(),
17928
+ margin: getSpacingWithAutoAndArbitrary(),
18026
17929
  opacity: getNumber(),
18027
- padding: [spacing],
17930
+ padding: getSpacingWithArbitrary(),
18028
17931
  saturate: getNumber(),
18029
17932
  scale: getNumber(),
18030
17933
  sepia: getZeroAndEmpty(),
18031
17934
  skew: getNumberAndArbitrary(),
18032
- space: [spacing],
18033
- translate: [spacing]
17935
+ space: getSpacingWithArbitrary(),
17936
+ translate: getSpacingWithArbitrary()
18034
17937
  },
18035
17938
  classGroups: {
18036
17939
  // Layout
@@ -18254,7 +18157,7 @@ function getDefaultConfig() {
18254
18157
  * @see https://tailwindcss.com/docs/flex-basis
18255
18158
  */
18256
18159
  basis: [{
18257
- basis: [spacing]
18160
+ basis: getSpacingWithAutoAndArbitrary()
18258
18161
  }],
18259
18162
  /**
18260
18163
  * Flex Direction
@@ -18311,7 +18214,7 @@ function getDefaultConfig() {
18311
18214
  */
18312
18215
  "col-start-end": [{
18313
18216
  col: ["auto", {
18314
- span: [isInteger]
18217
+ span: ["full", isInteger]
18315
18218
  }, isArbitraryValue]
18316
18219
  }],
18317
18220
  /**
@@ -18620,14 +18523,14 @@ function getDefaultConfig() {
18620
18523
  * @see https://tailwindcss.com/docs/width
18621
18524
  */
18622
18525
  w: [{
18623
- w: ["auto", "min", "max", "fit", spacing]
18526
+ w: ["auto", "min", "max", "fit", isArbitraryValue, spacing]
18624
18527
  }],
18625
18528
  /**
18626
18529
  * Min-Width
18627
18530
  * @see https://tailwindcss.com/docs/min-width
18628
18531
  */
18629
18532
  "min-w": [{
18630
- "min-w": ["min", "max", "fit", isLength]
18533
+ "min-w": ["min", "max", "fit", isArbitraryValue, isLength]
18631
18534
  }],
18632
18535
  /**
18633
18536
  * Max-Width
@@ -18636,28 +18539,28 @@ function getDefaultConfig() {
18636
18539
  "max-w": [{
18637
18540
  "max-w": ["0", "none", "full", "min", "max", "fit", "prose", {
18638
18541
  screen: [isTshirtSize]
18639
- }, isTshirtSize, isArbitraryLength]
18542
+ }, isTshirtSize, isArbitraryValue]
18640
18543
  }],
18641
18544
  /**
18642
18545
  * Height
18643
18546
  * @see https://tailwindcss.com/docs/height
18644
18547
  */
18645
18548
  h: [{
18646
- h: [spacing, "auto", "min", "max", "fit"]
18549
+ h: [isArbitraryValue, spacing, "auto", "min", "max", "fit"]
18647
18550
  }],
18648
18551
  /**
18649
18552
  * Min-Height
18650
18553
  * @see https://tailwindcss.com/docs/min-height
18651
18554
  */
18652
18555
  "min-h": [{
18653
- "min-h": ["min", "max", "fit", isLength]
18556
+ "min-h": ["min", "max", "fit", isArbitraryValue, isLength]
18654
18557
  }],
18655
18558
  /**
18656
18559
  * Max-Height
18657
18560
  * @see https://tailwindcss.com/docs/max-height
18658
18561
  */
18659
18562
  "max-h": [{
18660
- "max-h": [spacing, "min", "max", "fit"]
18563
+ "max-h": [isArbitraryValue, spacing, "min", "max", "fit"]
18661
18564
  }],
18662
18565
  // Typography
18663
18566
  /**
@@ -18726,7 +18629,7 @@ function getDefaultConfig() {
18726
18629
  * @see https://tailwindcss.com/docs/letter-spacing
18727
18630
  */
18728
18631
  tracking: [{
18729
- tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", isArbitraryLength]
18632
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", isArbitraryValue]
18730
18633
  }],
18731
18634
  /**
18732
18635
  * Line Clamp
@@ -18740,7 +18643,7 @@ function getDefaultConfig() {
18740
18643
  * @see https://tailwindcss.com/docs/line-height
18741
18644
  */
18742
18645
  leading: [{
18743
- leading: ["none", "tight", "snug", "normal", "relaxed", "loose", isLength]
18646
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose", isArbitraryValue, isLength]
18744
18647
  }],
18745
18648
  /**
18746
18649
  * List Style Image
@@ -18823,7 +18726,7 @@ function getDefaultConfig() {
18823
18726
  * @see https://tailwindcss.com/docs/text-underline-offset
18824
18727
  */
18825
18728
  "underline-offset": [{
18826
- "underline-offset": ["auto", isLength]
18729
+ "underline-offset": ["auto", isArbitraryValue, isLength]
18827
18730
  }],
18828
18731
  /**
18829
18732
  * Text Decoration Color
@@ -18847,14 +18750,14 @@ function getDefaultConfig() {
18847
18750
  * @see https://tailwindcss.com/docs/text-indent
18848
18751
  */
18849
18752
  indent: [{
18850
- indent: [spacing]
18753
+ indent: getSpacingWithArbitrary()
18851
18754
  }],
18852
18755
  /**
18853
18756
  * Vertical Alignment
18854
18757
  * @see https://tailwindcss.com/docs/vertical-align
18855
18758
  */
18856
18759
  "vertical-align": [{
18857
- align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryLength]
18760
+ align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryValue]
18858
18761
  }],
18859
18762
  /**
18860
18763
  * Whitespace
@@ -19284,7 +19187,7 @@ function getDefaultConfig() {
19284
19187
  * @see https://tailwindcss.com/docs/outline-offset
19285
19188
  */
19286
19189
  "outline-offset": [{
19287
- "outline-offset": [isLength]
19190
+ "outline-offset": [isArbitraryValue, isLength]
19288
19191
  }],
19289
19192
  /**
19290
19193
  * Outline Width
@@ -19363,7 +19266,7 @@ function getDefaultConfig() {
19363
19266
  opacity: [opacity]
19364
19267
  }],
19365
19268
  /**
19366
- * Mix Beldn Mode
19269
+ * Mix Blend Mode
19367
19270
  * @see https://tailwindcss.com/docs/mix-blend-mode
19368
19271
  */
19369
19272
  "mix-blend": [{
@@ -19722,126 +19625,126 @@ function getDefaultConfig() {
19722
19625
  * @see https://tailwindcss.com/docs/scroll-margin
19723
19626
  */
19724
19627
  "scroll-m": [{
19725
- "scroll-m": [spacing]
19628
+ "scroll-m": getSpacingWithArbitrary()
19726
19629
  }],
19727
19630
  /**
19728
19631
  * Scroll Margin X
19729
19632
  * @see https://tailwindcss.com/docs/scroll-margin
19730
19633
  */
19731
19634
  "scroll-mx": [{
19732
- "scroll-mx": [spacing]
19635
+ "scroll-mx": getSpacingWithArbitrary()
19733
19636
  }],
19734
19637
  /**
19735
19638
  * Scroll Margin Y
19736
19639
  * @see https://tailwindcss.com/docs/scroll-margin
19737
19640
  */
19738
19641
  "scroll-my": [{
19739
- "scroll-my": [spacing]
19642
+ "scroll-my": getSpacingWithArbitrary()
19740
19643
  }],
19741
19644
  /**
19742
19645
  * Scroll Margin Start
19743
19646
  * @see https://tailwindcss.com/docs/scroll-margin
19744
19647
  */
19745
19648
  "scroll-ms": [{
19746
- "scroll-ms": [spacing]
19649
+ "scroll-ms": getSpacingWithArbitrary()
19747
19650
  }],
19748
19651
  /**
19749
19652
  * Scroll Margin End
19750
19653
  * @see https://tailwindcss.com/docs/scroll-margin
19751
19654
  */
19752
19655
  "scroll-me": [{
19753
- "scroll-me": [spacing]
19656
+ "scroll-me": getSpacingWithArbitrary()
19754
19657
  }],
19755
19658
  /**
19756
19659
  * Scroll Margin Top
19757
19660
  * @see https://tailwindcss.com/docs/scroll-margin
19758
19661
  */
19759
19662
  "scroll-mt": [{
19760
- "scroll-mt": [spacing]
19663
+ "scroll-mt": getSpacingWithArbitrary()
19761
19664
  }],
19762
19665
  /**
19763
19666
  * Scroll Margin Right
19764
19667
  * @see https://tailwindcss.com/docs/scroll-margin
19765
19668
  */
19766
19669
  "scroll-mr": [{
19767
- "scroll-mr": [spacing]
19670
+ "scroll-mr": getSpacingWithArbitrary()
19768
19671
  }],
19769
19672
  /**
19770
19673
  * Scroll Margin Bottom
19771
19674
  * @see https://tailwindcss.com/docs/scroll-margin
19772
19675
  */
19773
19676
  "scroll-mb": [{
19774
- "scroll-mb": [spacing]
19677
+ "scroll-mb": getSpacingWithArbitrary()
19775
19678
  }],
19776
19679
  /**
19777
19680
  * Scroll Margin Left
19778
19681
  * @see https://tailwindcss.com/docs/scroll-margin
19779
19682
  */
19780
19683
  "scroll-ml": [{
19781
- "scroll-ml": [spacing]
19684
+ "scroll-ml": getSpacingWithArbitrary()
19782
19685
  }],
19783
19686
  /**
19784
19687
  * Scroll Padding
19785
19688
  * @see https://tailwindcss.com/docs/scroll-padding
19786
19689
  */
19787
19690
  "scroll-p": [{
19788
- "scroll-p": [spacing]
19691
+ "scroll-p": getSpacingWithArbitrary()
19789
19692
  }],
19790
19693
  /**
19791
19694
  * Scroll Padding X
19792
19695
  * @see https://tailwindcss.com/docs/scroll-padding
19793
19696
  */
19794
19697
  "scroll-px": [{
19795
- "scroll-px": [spacing]
19698
+ "scroll-px": getSpacingWithArbitrary()
19796
19699
  }],
19797
19700
  /**
19798
19701
  * Scroll Padding Y
19799
19702
  * @see https://tailwindcss.com/docs/scroll-padding
19800
19703
  */
19801
19704
  "scroll-py": [{
19802
- "scroll-py": [spacing]
19705
+ "scroll-py": getSpacingWithArbitrary()
19803
19706
  }],
19804
19707
  /**
19805
19708
  * Scroll Padding Start
19806
19709
  * @see https://tailwindcss.com/docs/scroll-padding
19807
19710
  */
19808
19711
  "scroll-ps": [{
19809
- "scroll-ps": [spacing]
19712
+ "scroll-ps": getSpacingWithArbitrary()
19810
19713
  }],
19811
19714
  /**
19812
19715
  * Scroll Padding End
19813
19716
  * @see https://tailwindcss.com/docs/scroll-padding
19814
19717
  */
19815
19718
  "scroll-pe": [{
19816
- "scroll-pe": [spacing]
19719
+ "scroll-pe": getSpacingWithArbitrary()
19817
19720
  }],
19818
19721
  /**
19819
19722
  * Scroll Padding Top
19820
19723
  * @see https://tailwindcss.com/docs/scroll-padding
19821
19724
  */
19822
19725
  "scroll-pt": [{
19823
- "scroll-pt": [spacing]
19726
+ "scroll-pt": getSpacingWithArbitrary()
19824
19727
  }],
19825
19728
  /**
19826
19729
  * Scroll Padding Right
19827
19730
  * @see https://tailwindcss.com/docs/scroll-padding
19828
19731
  */
19829
19732
  "scroll-pr": [{
19830
- "scroll-pr": [spacing]
19733
+ "scroll-pr": getSpacingWithArbitrary()
19831
19734
  }],
19832
19735
  /**
19833
19736
  * Scroll Padding Bottom
19834
19737
  * @see https://tailwindcss.com/docs/scroll-padding
19835
19738
  */
19836
19739
  "scroll-pb": [{
19837
- "scroll-pb": [spacing]
19740
+ "scroll-pb": getSpacingWithArbitrary()
19838
19741
  }],
19839
19742
  /**
19840
19743
  * Scroll Padding Left
19841
19744
  * @see https://tailwindcss.com/docs/scroll-padding
19842
19745
  */
19843
19746
  "scroll-pl": [{
19844
- "scroll-pl": [spacing]
19747
+ "scroll-pl": getSpacingWithArbitrary()
19845
19748
  }],
19846
19749
  /**
19847
19750
  * Scroll Snap Align
@@ -20101,47 +20004,43 @@ var import_jsx_runtime81 = require("react/jsx-runtime");
20101
20004
  var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapControls, sourceData, show_popup, popup }, ref) => {
20102
20005
  const mapContainer = ref;
20103
20006
  const mapRef = (0, import_react66.useRef)(null);
20104
- const map = mapRef.current;
20007
+ const [isMapReady, setIsMapReady] = (0, import_react66.useState)(false);
20008
+ const hasSatelliteLayer = baseLayers == null ? void 0 : baseLayers.find((layer) => layer.layer_type == "satellite");
20105
20009
  const changeMapProjection = () => {
20106
20010
  var _a;
20107
- if (!mapRef.current)
20108
- return;
20109
- const map2 = mapRef.current;
20110
- const currentProjection = (_a = map2.getProjection()) == null ? void 0 : _a.type;
20011
+ if (!mapRef.current) return;
20012
+ const map = mapRef.current;
20013
+ const currentProjection = (_a = map.getProjection()) == null ? void 0 : _a.type;
20111
20014
  const newProjection = currentProjection === "mercator" ? "globe" : "mercator";
20112
- map2.setProjection({
20015
+ map.setProjection({
20113
20016
  type: newProjection
20114
20017
  });
20115
20018
  };
20116
20019
  const zoomIn = () => {
20117
- if (!mapRef.current)
20118
- return;
20119
- const map2 = mapRef.current;
20120
- map2.zoomIn();
20121
- return map2.getBounds();
20020
+ if (!mapRef.current) return;
20021
+ const map = mapRef.current;
20022
+ map.zoomIn();
20023
+ return map.getBounds();
20122
20024
  };
20123
20025
  const zoomOut = () => {
20124
- if (!mapRef.current)
20125
- return;
20126
- const map2 = mapRef.current;
20127
- map2.zoomOut();
20128
- return map2.getBounds();
20026
+ if (!mapRef.current) return;
20027
+ const map = mapRef.current;
20028
+ map.zoomOut();
20029
+ return map.getBounds();
20129
20030
  };
20130
20031
  function getLayersByPattern(pattern) {
20131
- if (!mapRef.current)
20132
- return;
20133
- const map2 = mapRef.current;
20134
- return map2 == null ? void 0 : map2.getStyle().layers.filter((layer) => pattern.test(layer.id)).map((layer) => layer.id);
20032
+ if (!mapRef.current) return;
20033
+ const map = mapRef.current;
20034
+ return map == null ? void 0 : map.getStyle().layers.filter((layer) => pattern.test(layer.id)).map((layer) => layer.id);
20135
20035
  }
20136
20036
  const handleToggle = (layerId) => {
20137
- if (!mapRef.current)
20138
- return;
20139
- const map2 = mapRef.current;
20037
+ if (!mapRef.current) return;
20038
+ const map = mapRef.current;
20140
20039
  const layers = getLayersByPattern(new RegExp(layerId));
20141
20040
  layers == null ? void 0 : layers.forEach((id) => {
20142
- const visibility = map2 == null ? void 0 : map2.getLayoutProperty(id, "visibility");
20041
+ const visibility = map == null ? void 0 : map.getLayoutProperty(id, "visibility");
20143
20042
  const newVisibility = visibility === "none" ? "visible" : "none";
20144
- map2 == null ? void 0 : map2.setLayoutProperty(id, "visibility", newVisibility);
20043
+ map == null ? void 0 : map.setLayoutProperty(id, "visibility", newVisibility);
20145
20044
  });
20146
20045
  };
20147
20046
  const buildControls = (controls) => {
@@ -20263,7 +20162,7 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20263
20162
  return control;
20264
20163
  }));
20265
20164
  };
20266
- const loadSvgImage = (color) => __async(void 0, null, function* () {
20165
+ const loadSvgImage = (color) => __async(null, null, function* () {
20267
20166
  let svgText = (0, import_server8.renderToStaticMarkup)(
20268
20167
  /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_MapPinIcon4.default, { className: "w-6 h-6" })
20269
20168
  );
@@ -20275,67 +20174,71 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20275
20174
  yield img.decode();
20276
20175
  return img;
20277
20176
  });
20278
- const updatePinImage = (source) => __async(void 0, null, function* () {
20177
+ const updatePinImage = (source) => __async(null, null, function* () {
20178
+ const map = mapRef.current;
20179
+ if (!map) return;
20279
20180
  const img = yield loadSvgImage(source.style.pin_color);
20280
20181
  const imgName = `${source.name}-pin`;
20281
- if (map == null ? void 0 : map.hasImage(imgName))
20282
- map == null ? void 0 : map.removeImage(imgName);
20283
- map == null ? void 0 : map.addImage(imgName, img);
20182
+ if (map.hasImage(imgName)) map.removeImage(imgName);
20183
+ map.addImage(imgName, img);
20284
20184
  });
20285
20185
  const updateClusterColors = (source) => {
20186
+ const map = mapRef.current;
20187
+ if (!map) return;
20286
20188
  const layerId = `${source.name}-cluster-circles`;
20287
- if (!(map == null ? void 0 : map.getLayer(layerId)))
20288
- return;
20289
- const current = map == null ? void 0 : map.getPaintProperty(layerId, "circle-color");
20189
+ if (!map.getLayer(layerId)) return;
20190
+ const current = map.getPaintProperty(layerId, "circle-color");
20290
20191
  if (current !== source.style.cluster_color) {
20291
- map == null ? void 0 : map.setPaintProperty(layerId, "circle-color", source.style.cluster_color);
20292
- map == null ? void 0 : map.setPaintProperty(layerId, "circle-stroke-color", source.style.cluster_stroke_color);
20192
+ map.setPaintProperty(layerId, "circle-color", source.style.cluster_color);
20193
+ map.setPaintProperty(layerId, "circle-stroke-color", source.style.cluster_stroke_color);
20293
20194
  }
20294
20195
  };
20295
20196
  const loadBaseLayers = () => {
20296
- if (baseLayers && (baseLayers == null ? void 0 : baseLayers.length) > 0) {
20297
- const base_layers = buildBaseLayers(baseLayers);
20298
- base_layers == null ? void 0 : base_layers.forEach((layer) => {
20299
- if (!(map == null ? void 0 : map.getLayer(layer.name))) {
20300
- if (!(map == null ? void 0 : map.getSource(layer == null ? void 0 : layer.name))) {
20301
- if ((layer == null ? void 0 : layer.layer_type) == "satellite")
20302
- map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
20303
- type: layer == null ? void 0 : layer.type,
20304
- tiles: [layer == null ? void 0 : layer.url],
20305
- tileSize: layer == null ? void 0 : layer.tileSize
20306
- });
20307
- else
20308
- map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
20309
- type: layer == null ? void 0 : layer.type,
20310
- url: layer == null ? void 0 : layer.url,
20311
- tileSize: layer == null ? void 0 : layer.tileSize
20312
- });
20313
- if ((layer == null ? void 0 : layer.layer_type) == "terrainSource")
20314
- map == null ? void 0 : map.setTerrain({
20315
- source: "terrainSource",
20316
- exaggeration: 1
20317
- });
20318
- if ((layer == null ? void 0 : layer.layer_type) == "hillshade")
20319
- map == null ? void 0 : map.addLayer({
20320
- id: layer == null ? void 0 : layer.name,
20321
- type: layer == null ? void 0 : layer.layer_type,
20322
- source: layer == null ? void 0 : layer.name,
20323
- paint: { "hillshade-shadow-color": "#473B24" },
20324
- layout: { visibility: "visible" }
20325
- });
20326
- if ((layer == null ? void 0 : layer.layer_type) == "satellite")
20327
- map == null ? void 0 : map.addLayer({ id: layer == null ? void 0 : layer.name, type: layer == null ? void 0 : layer.type, source: layer == null ? void 0 : layer.name });
20328
- }
20197
+ const map = mapRef.current;
20198
+ if (!map || !baseLayers || baseLayers.length === 0) return;
20199
+ const base_layers = buildBaseLayers(baseLayers);
20200
+ base_layers == null ? void 0 : base_layers.forEach((layer) => {
20201
+ if (!map.getLayer(layer.name)) {
20202
+ if (!map.getSource(layer == null ? void 0 : layer.name)) {
20203
+ if ((layer == null ? void 0 : layer.layer_type) == "satellite") {
20204
+ map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
20205
+ type: layer == null ? void 0 : layer.type,
20206
+ tiles: [layer == null ? void 0 : layer.url],
20207
+ tileSize: layer == null ? void 0 : layer.tileSize
20208
+ });
20209
+ map == null ? void 0 : map.addLayer({ id: layer == null ? void 0 : layer.name, type: layer == null ? void 0 : layer.type, source: layer == null ? void 0 : layer.name });
20210
+ } else
20211
+ map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
20212
+ type: layer == null ? void 0 : layer.type,
20213
+ url: layer == null ? void 0 : layer.url,
20214
+ tileSize: layer == null ? void 0 : layer.tileSize
20215
+ });
20216
+ if ((layer == null ? void 0 : layer.layer_type) == "terrainSource")
20217
+ map == null ? void 0 : map.setTerrain({
20218
+ source: "terrainSource",
20219
+ exaggeration: 1
20220
+ });
20221
+ if ((layer == null ? void 0 : layer.layer_type) == "hillshade")
20222
+ map == null ? void 0 : map.addLayer({
20223
+ id: layer == null ? void 0 : layer.name,
20224
+ type: layer == null ? void 0 : layer.layer_type,
20225
+ source: layer == null ? void 0 : layer.name,
20226
+ paint: { "hillshade-shadow-color": "#473B24" },
20227
+ layout: { visibility: "visible" }
20228
+ });
20329
20229
  }
20330
- });
20331
- }
20230
+ }
20231
+ });
20332
20232
  };
20333
- const loadSourceData = () => {
20334
- sourceData == null ? void 0 : sourceData.forEach((source) => __async(void 0, null, function* () {
20335
- const existing_data = map == null ? void 0 : map.getSource(source.name);
20233
+ const loadSourceData = () => __async(null, null, function* () {
20234
+ var _a, _b, _c, _d;
20235
+ const map = mapRef.current;
20236
+ if (!map || (sourceData == null ? void 0 : sourceData.length) == 0) return;
20237
+ for (const source of sourceData) {
20238
+ const existing_data = map.getSource(source.name);
20336
20239
  if (!existing_data) {
20337
20240
  if (source.is_cluster) {
20338
- map == null ? void 0 : map.addSource(source.name, {
20241
+ map.addSource(source.name, {
20339
20242
  type: source.type,
20340
20243
  data: source.data,
20341
20244
  cluster: true,
@@ -20343,12 +20246,9 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20343
20246
  clusterRadius: 50
20344
20247
  });
20345
20248
  } else
20346
- map == null ? void 0 : map.addSource(source.name, {
20249
+ map.addSource(source.name, {
20347
20250
  type: source.type,
20348
20251
  data: source.data
20349
- // cluster: true,
20350
- // clusterMaxZoom: 10,
20351
- // clusterRadius: 50,
20352
20252
  });
20353
20253
  if (source.show_cluster_count) {
20354
20254
  map == null ? void 0 : map.addLayer({
@@ -20357,11 +20257,11 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20357
20257
  source: source.name,
20358
20258
  filter: ["has", "point_count"],
20359
20259
  paint: {
20360
- "circle-color": source.style.cluster_color,
20260
+ "circle-color": (_a = source.style) == null ? void 0 : _a.cluster_color,
20361
20261
  "circle-opacity": 1,
20362
20262
  "circle-radius": 20,
20363
20263
  "circle-stroke-width": 4,
20364
- "circle-stroke-color": source.style.cluster_stroke_color
20264
+ "circle-stroke-color": (_b = source.style) == null ? void 0 : _b.cluster_stroke_color
20365
20265
  }
20366
20266
  });
20367
20267
  map == null ? void 0 : map.addLayer({
@@ -20399,25 +20299,20 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20399
20299
  id: `${source.name}-cluster-circles`,
20400
20300
  type: "circle",
20401
20301
  source: source.name,
20402
- filter: [">", ["get", "count"], 1],
20302
+ filter: ["!=", ["get", "count"], null],
20403
20303
  paint: {
20404
- "circle-color": source.style.cluster_color,
20304
+ "circle-color": (_c = source.style) == null ? void 0 : _c.cluster_color,
20405
20305
  "circle-opacity": 1,
20406
20306
  "circle-radius": 20,
20407
20307
  "circle-stroke-width": 4,
20408
- "circle-stroke-color": source.style.cluster_stroke_color
20409
- // "circle-radius": [
20410
- // "step",
20411
- // ["get", "count"],
20412
- // 20, 100, 30, 750, 40
20413
- // ]
20308
+ "circle-stroke-color": (_d = source.style) == null ? void 0 : _d.cluster_stroke_color
20414
20309
  }
20415
20310
  });
20416
20311
  map == null ? void 0 : map.addLayer({
20417
20312
  id: `${source.name}-cluster-count`,
20418
20313
  type: "symbol",
20419
20314
  source: source.name,
20420
- filter: [">", ["get", "count"], 1],
20315
+ filter: ["!=", ["get", "count"], null],
20421
20316
  layout: {
20422
20317
  "text-field": "{count}",
20423
20318
  "text-font": ["Open Sans Bold"],
@@ -20435,7 +20330,6 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20435
20330
  id: source.name + "-pins",
20436
20331
  type: "symbol",
20437
20332
  source: source.name,
20438
- //filter: ["!", ["has", "point_count"]],
20439
20333
  filter: ["==", ["get", "count"], null],
20440
20334
  layout: {
20441
20335
  "icon-image": `${source.name}-pin`,
@@ -20450,16 +20344,12 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20450
20344
  updateClusterColors(source);
20451
20345
  updatePinImage(source);
20452
20346
  }
20453
- }));
20454
- };
20347
+ }
20348
+ });
20455
20349
  (0, import_react66.useEffect)(() => {
20456
- if (typeof mapContainer === "function")
20457
- return;
20458
- if (!(mapContainer == null ? void 0 : mapContainer.current))
20459
- return;
20460
- if (!sourceData)
20461
- return;
20462
- const map2 = new import_maplibre_gl.default.Map({
20350
+ if (typeof mapContainer === "function") return;
20351
+ if (!(mapContainer == null ? void 0 : mapContainer.current)) return;
20352
+ const map = new import_maplibre_gl.default.Map({
20463
20353
  container: mapContainer == null ? void 0 : mapContainer.current,
20464
20354
  style: {
20465
20355
  version: 8,
@@ -20487,21 +20377,22 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20487
20377
  renderWorldCopies: false,
20488
20378
  canvasContextAttributes: { antialias: true }
20489
20379
  });
20490
- mapRef.current = map2;
20491
- map2.scrollZoom.disable();
20492
- mapRef.current.getContainer().addEventListener("mouseenter", () => map2.scrollZoom.enable());
20493
- mapRef.current.getContainer().addEventListener("mouseleave", () => map2.scrollZoom.disable());
20494
- map2.on("load", () => __async(void 0, null, function* () {
20380
+ mapRef.current = map;
20381
+ map.scrollZoom.disable();
20382
+ mapRef.current.getContainer().addEventListener("mouseenter", () => map.scrollZoom.enable());
20383
+ mapRef.current.getContainer().addEventListener("mouseleave", () => map.scrollZoom.disable());
20384
+ map.on("load", () => __async(null, null, function* () {
20495
20385
  changeMapProjection();
20386
+ setIsMapReady(true);
20496
20387
  }));
20497
20388
  return () => {
20498
- map2.remove();
20389
+ map.remove();
20499
20390
  mapRef.current = null;
20500
20391
  };
20501
20392
  }, []);
20502
20393
  (0, import_react66.useEffect)(() => {
20503
- if (!map)
20504
- return;
20394
+ const map = mapRef.current;
20395
+ if (!map || !isMapReady) return;
20505
20396
  const init = () => {
20506
20397
  loadBaseLayers();
20507
20398
  };
@@ -20516,34 +20407,52 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20516
20407
  if (map.isStyleLoaded()) {
20517
20408
  init();
20518
20409
  map.on("zoomend", zoom);
20519
- } else
20520
- map.once("load", () => {
20521
- init();
20522
- map.on("zoomend", zoom);
20523
- });
20524
- }, [map]);
20410
+ map.on("moveend", zoom);
20411
+ } else map.once("load", () => {
20412
+ init();
20413
+ map.on("zoomend", zoom);
20414
+ map.on("moveend", zoom);
20415
+ });
20416
+ return () => {
20417
+ map.off("zoomend", zoom);
20418
+ map.off("moveend", zoom);
20419
+ };
20420
+ }, [mapControls, baseLayers, isMapReady]);
20525
20421
  (0, import_react66.useEffect)(() => {
20526
- var _a, _b, _c;
20527
- if (!map || !sourceData)
20528
- return;
20529
- if (map.isStyleLoaded()) {
20422
+ var _a;
20423
+ const map = mapRef.current;
20424
+ if (!map || !(sourceData == null ? void 0 : sourceData.length)) return;
20425
+ const satelliteLayerLoaded = hasSatelliteLayer !== void 0 ? map.getLayer("satellite") !== void 0 ? true : false : true;
20426
+ map.on("sourcedata", function onData(e) {
20427
+ if (e.sourceId === "satellite" && e.isSourceLoaded) {
20428
+ map.off("sourcedata", onData);
20429
+ loadSourceData();
20430
+ }
20431
+ });
20432
+ if (map.isStyleLoaded() && satelliteLayerLoaded) {
20530
20433
  loadSourceData();
20531
- return;
20434
+ } else {
20435
+ const handler = () => {
20436
+ if (satelliteLayerLoaded) loadSourceData();
20437
+ };
20438
+ map.once("load", handler);
20439
+ return () => {
20440
+ map.off("load", handler);
20441
+ };
20532
20442
  }
20533
- const handler = () => loadSourceData();
20534
- map.once("load", handler);
20535
20443
  if (show_popup && customLayers) {
20536
- map.on("mouseenter", ((_a = customLayers[0]) == null ? void 0 : _a.layerName) + "-pins", () => {
20444
+ const layerId = ((_a = customLayers[0]) == null ? void 0 : _a.layerName) + "-pins";
20445
+ const onMouseEnter = () => {
20537
20446
  map.getCanvas().style.cursor = "pointer";
20538
- });
20539
- map.on("mouseleave", ((_b = customLayers[0]) == null ? void 0 : _b.layerName) + "-pins", () => {
20447
+ };
20448
+ const onMouseLeave = () => {
20540
20449
  map.getCanvas().style.cursor = "";
20541
- });
20542
- map.on("click", ((_c = customLayers[0]) == null ? void 0 : _c.layerName) + "-pins", (e) => {
20543
- var _a2, _b2, _c2, _d;
20450
+ };
20451
+ const onLayerClick = (e) => {
20452
+ var _a2, _b, _c, _d;
20544
20453
  if (e.features) {
20545
20454
  const properties = (_a2 = e.features[0]) == null ? void 0 : _a2.properties;
20546
- const coordinates = (_c2 = (_b2 = e.features[0]) == null ? void 0 : _b2.geometry) == null ? void 0 : _c2.coordinates.slice();
20455
+ const coordinates = (_c = (_b = e.features[0]) == null ? void 0 : _b.geometry) == null ? void 0 : _c.coordinates.slice();
20547
20456
  const description = `
20548
20457
  <a class="popup-link text-primary text-xs hover:cursor-pointer">${(_d = e.features[0]) == null ? void 0 : _d.properties.description}</a>
20549
20458
  `;
@@ -20558,28 +20467,31 @@ var MapLibre = (0, import_react67.forwardRef)(({ baseLayers, customLayers, mapCo
20558
20467
  }
20559
20468
  }, 0);
20560
20469
  }
20561
- });
20470
+ };
20471
+ map.on("mouseenter", layerId, onMouseEnter);
20472
+ map.on("mouseleave", layerId, onMouseLeave);
20473
+ map.on("click", layerId, onLayerClick);
20474
+ return () => {
20475
+ map.off("mouseenter", layerId, onMouseEnter);
20476
+ map.off("mouseleave", layerId, onMouseLeave);
20477
+ map.off("click", layerId, onLayerClick);
20478
+ };
20562
20479
  }
20563
- return () => {
20564
- map.off("load", handler);
20565
- };
20566
- }, [sourceData]);
20480
+ }, [sourceData, customLayers, show_popup, popup, isMapReady]);
20567
20481
  (0, import_react66.useEffect)(() => {
20568
- if (!map || !sourceData)
20569
- return;
20482
+ const map = mapRef.current;
20483
+ if (!map || !(sourceData == null ? void 0 : sourceData.length)) return;
20570
20484
  sourceData.forEach((source) => {
20571
20485
  const source_layer = map.getSource(source.name);
20572
- if (source_layer)
20573
- source_layer.setData(source.data);
20486
+ if (source_layer) source_layer.setData(source.data);
20574
20487
  });
20575
20488
  }, [sourceData]);
20576
- if (!sourceData)
20577
- return;
20578
20489
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "relative", style: { width: "100%", height: "100%" }, children: [
20579
20490
  /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { ref: mapContainer, className: "w-full h-full" }),
20580
20491
  /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(MapControlToolbar, { controls: mapControl, onToggleControl: (id) => toggleControl(id) })
20581
20492
  ] });
20582
20493
  });
20494
+ MapLibre.displayName = "MapLibre";
20583
20495
 
20584
20496
  // src/features/components/GeoWikiMapContainer.tsx
20585
20497
  var import_react68 = require("react");
@@ -20705,9 +20617,9 @@ init_MarkerClusterGroup();
20705
20617
 
20706
20618
  // src/Components/LocationMarker.tsx
20707
20619
  var import_react_leaflet30 = require("react-leaflet");
20708
- var import_leaflet23 = require("leaflet");
20620
+ var import_leaflet25 = require("leaflet");
20709
20621
  var import_jsx_runtime84 = require("react/jsx-runtime");
20710
- var ICON = (0, import_leaflet23.icon)({
20622
+ var ICON = (0, import_leaflet25.icon)({
20711
20623
  iconUrl: "/assets/img/marker-icon.png",
20712
20624
  iconSize: [25, 35]
20713
20625
  });