@geowiki/map 0.16.9-dev.9 → 0.16.10-dev.0

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