@geowiki/map 0.16.9-dev.9 → 0.16.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -138,8 +138,7 @@ var init_GenericCache = __esm({
138
138
  getFromStorage(key) {
139
139
  try {
140
140
  const stored = localStorage.getItem(key);
141
- if (!stored)
142
- return null;
141
+ if (!stored) return null;
143
142
  const entry = JSON.parse(stored);
144
143
  if (this.isValid(entry)) {
145
144
  this.hitCount++;
@@ -446,6 +445,7 @@ import {
446
445
  tokenData,
447
446
  IsTokenExpired
448
447
  } from "@geowiki/core";
448
+ import { CRS } from "leaflet";
449
449
 
450
450
  // src/Components/Evoland/EvolandContainer.tsx
451
451
  import { AuthenticationFailure } from "@geowiki/ui";
@@ -556,8 +556,8 @@ var prepareRGBImage = (array, width, height) => {
556
556
  ctx == null ? void 0 : ctx.putImageData(imageData, 0, 0);
557
557
  return canvas;
558
558
  };
559
- var getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvasContext, selectedBand) => __async(void 0, null, function* () {
560
- var _a, _b;
559
+ var getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvasContext, selectedBand) => __async(null, null, function* () {
560
+ var _a;
561
561
  try {
562
562
  var tiffWidth = rasterItem.width;
563
563
  var tiffHeight = rasterItem.height;
@@ -570,10 +570,9 @@ var getCanvasDataFromImageArray = (rasterItem, location, bounds, ndviImageCanvas
570
570
  );
571
571
  let selectedValue = raster[xTiff + yTiff * tiffWidth];
572
572
  var rgb = null;
573
- if (((_a = rasterItem.name) == null ? void 0 : _a.toLowerCase().includes("ndvi")) && ((_b = rasterItem.name) == null ? void 0 : _b.toLowerCase().includes("perc")))
573
+ if ((_a = rasterItem.name) == null ? void 0 : _a.toLowerCase().includes("ndvi"))
574
574
  rgb = yield getNDVIValueForPixel(ndviImageCanvasContext, xTiff, yTiff);
575
- else
576
- rgb = null;
575
+ else rgb = null;
577
576
  return [
578
577
  selectedValue,
579
578
  rgb !== null && rgb !== void 0 ? {
@@ -616,12 +615,11 @@ var deepCloneRasterAssetItem = (isAnnualAnnotation, asset, assetBuffer, uri, sel
616
615
  rasterItem.buffer = [...asset.buffer];
617
616
  rasterItem.uri = [...asset.uri];
618
617
  rasterItem.buffer[selectedBand] = new Uint32Array(assetBuffer);
619
- if (Array.isArray(rasterItem.uri))
620
- rasterItem.uri[selectedBand] = uri;
618
+ if (Array.isArray(rasterItem.uri)) rasterItem.uri[selectedBand] = uri;
621
619
  }
622
620
  return rasterItem;
623
621
  };
624
- var getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnnotation, selectedBand, metadata) => __async(void 0, null, function* () {
622
+ var getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnnotation, selectedBand, metadata) => __async(null, null, function* () {
625
623
  var { newArray, canvas } = yield getEmptyPreviewRasterItemForInsert(
626
624
  length,
627
625
  width,
@@ -646,12 +644,12 @@ var getEmptyPreviewRasterItem = (id, length, width, height, labels, isAnnualAnno
646
644
  }
647
645
  return rasterItem;
648
646
  });
649
- var getEmptyPreviewRasterItemForInsert = (length, width, height, labels) => __async(void 0, null, function* () {
647
+ var getEmptyPreviewRasterItemForInsert = (length, width, height, labels) => __async(null, null, function* () {
650
648
  const newArray = new Uint32Array(length).fill(0);
651
649
  const canvas = grayScaleArrayToCanvas(newArray, width, height, labels);
652
650
  return { newArray, canvas };
653
651
  });
654
- var updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnnotation) => __async(void 0, null, function* () {
652
+ var updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnnotation) => __async(null, null, function* () {
655
653
  var _a, _b, _c;
656
654
  if (!fromRasterItem) {
657
655
  return toPreviewRasterItem;
@@ -677,7 +675,7 @@ var updatePreviewRasterFrom = (fromRasterItem, toPreviewRasterItem, isAnnualAnno
677
675
  }
678
676
  return toPreviewRasterItem;
679
677
  });
680
- var getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(void 0, null, function* () {
678
+ var getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(null, null, function* () {
681
679
  const tiff = yield fromArrayBuffer(arrayBuffer);
682
680
  const image = yield tiff.getImage();
683
681
  const pool = new Pool();
@@ -701,7 +699,7 @@ var getRasterItemsNoColorMap = (arrayBuffer, labels) => __async(void 0, null, fu
701
699
  pool.destroy();
702
700
  return { width, height, rasterItems };
703
701
  });
704
- var getRasterItems = (arrayBuffer, projectType) => __async(void 0, null, function* () {
702
+ var getRasterItems = (arrayBuffer, projectType) => __async(null, null, function* () {
705
703
  const tiff = yield fromArrayBuffer(arrayBuffer);
706
704
  const image = yield tiff.getImage();
707
705
  const pool = new Pool();
@@ -741,7 +739,7 @@ var getRasterItems = (arrayBuffer, projectType) => __async(void 0, null, functio
741
739
  pool.destroy();
742
740
  return { rasters, width, height, rasterItems };
743
741
  });
744
- var getAssetItemsForLocationAssets = (assets, labels) => __async(void 0, null, function* () {
742
+ var getAssetItemsForLocationAssets = (assets, labels) => __async(null, null, function* () {
745
743
  var rasterItems = [];
746
744
  for (var i = 0; i < (assets == null ? void 0 : assets.length); i++) {
747
745
  const item = assets[i];
@@ -764,7 +762,7 @@ var getAssetItemsForLocationAssets = (assets, labels) => __async(void 0, null, f
764
762
  }
765
763
  return rasterItems;
766
764
  });
767
- var getRasterAssetItemsForLocationComposite = (assets) => __async(void 0, null, function* () {
765
+ var getRasterAssetItemsForLocationComposite = (assets) => __async(null, null, function* () {
768
766
  var rasterItems = [];
769
767
  for (var i = 0; i < (assets == null ? void 0 : assets.length); i++) {
770
768
  const item = assets[i];
@@ -785,7 +783,7 @@ var getRasterAssetItemsForLocationComposite = (assets) => __async(void 0, null,
785
783
  }
786
784
  return rasterItems;
787
785
  });
788
- var copyAllRasterSegments = (rasterItem, previewRasterItem, selectedValue, labelValue, labels) => __async(void 0, null, function* () {
786
+ var copyAllRasterSegments = (rasterItem, previewRasterItem, selectedValue, labelValue, labels) => __async(null, null, function* () {
789
787
  var newBuffer = overwriteArrayBufferWithSelectedValue(
790
788
  rasterItem.buffer,
791
789
  previewRasterItem.buffer,
@@ -861,8 +859,7 @@ function getAdjPixel(y, x, selectedValue, array2dMatrix) {
861
859
  while (pixelsToCheck.length > 0) {
862
860
  const [xTiff, yTiff] = pixelsToCheck.pop();
863
861
  var key = xTiff + "_" + yTiff;
864
- if (checkedPixels.has(key))
865
- continue;
862
+ if (checkedPixels.has(key)) continue;
866
863
  checkedPixels.add(key);
867
864
  if (array2dMatrix[yTiff][xTiff] === selectedValue) {
868
865
  sameValPixels.push([yTiff, xTiff]);
@@ -884,7 +881,7 @@ function getAdjPixel(y, x, selectedValue, array2dMatrix) {
884
881
  }
885
882
  return sameValPixels;
886
883
  }
887
- var paintRasterSegment = (sourceRasterItem, destRasterItem, locations, bounds, labelValue, labels, paintType, selectedBand, isAnnualAnnotation) => __async(void 0, null, function* () {
884
+ var paintRasterSegment = (sourceRasterItem, destRasterItem, locations, bounds, labelValue, labels, paintType, selectedBand, isAnnualAnnotation) => __async(null, null, function* () {
888
885
  var tiffWidth = sourceRasterItem.width;
889
886
  var tiffHeight = sourceRasterItem.height;
890
887
  var annotatedRaster = isAnnualAnnotation ? destRasterItem.buffer : destRasterItem.buffer[selectedBand];
@@ -1007,8 +1004,7 @@ function pointInsidePolygon(xTiff, yTiff, vs) {
1007
1004
  var xi = vs[i].xTiff, yi = vs[i].yTiff;
1008
1005
  var xj = vs[j].xTiff, yj = vs[j].yTiff;
1009
1006
  var intersect = yi > yTiff !== yj > yTiff && xTiff < (xj - xi) * (yTiff - yi) / (yj - yi) + xi;
1010
- if (intersect)
1011
- inside = !inside;
1007
+ if (intersect) inside = !inside;
1012
1008
  }
1013
1009
  return inside;
1014
1010
  }
@@ -1047,7 +1043,7 @@ function getDiagonalCoordinates(x1, y1, x2, y2) {
1047
1043
  coordinates.push({ yTiff: x2, xTiff: y2 });
1048
1044
  return coordinates;
1049
1045
  }
1050
- var getActiveLearningAnnotation = (assetHref, projectType) => __async(void 0, null, function* () {
1046
+ var getActiveLearningAnnotation = (assetHref, projectType) => __async(null, null, function* () {
1051
1047
  const res = yield fetch(assetHref);
1052
1048
  const buffer = yield res.arrayBuffer();
1053
1049
  const rItems = yield getRasterItems(buffer, projectType);
@@ -1064,7 +1060,7 @@ var getActiveLearningAnnotation = (assetHref, projectType) => __async(void 0, nu
1064
1060
  };
1065
1061
  return assetItem;
1066
1062
  });
1067
- var createImageDataForNDVI = (asset) => __async(void 0, null, function* () {
1063
+ var createImageDataForNDVI = (asset) => __async(null, null, function* () {
1068
1064
  var canvas = document.createElement("canvas");
1069
1065
  var context = canvas.getContext("2d");
1070
1066
  var image = new Image();
@@ -1074,7 +1070,7 @@ var createImageDataForNDVI = (asset) => __async(void 0, null, function* () {
1074
1070
  context == null ? void 0 : context.drawImage(image, 0, 0, canvas.width, canvas.height);
1075
1071
  return context;
1076
1072
  });
1077
- var getNDVIValueForPixel = (ndviImageCanvasContext, x, y) => __async(void 0, null, function* () {
1073
+ var getNDVIValueForPixel = (ndviImageCanvasContext, x, y) => __async(null, null, function* () {
1078
1074
  var context = ndviImageCanvasContext;
1079
1075
  var data = context == null ? void 0 : context.getImageData(x, y, 1, 1).data;
1080
1076
  return data;
@@ -1290,8 +1286,7 @@ function getRasterAssetItemsForLocationAssets(assets) {
1290
1286
  if (Array.isArray((_a = rItem.result) == null ? void 0 : _a.base64)) {
1291
1287
  bufferData = (_b = rItem.result) == null ? void 0 : _b.base64.map((x) => {
1292
1288
  var _a2, _b2;
1293
- if (((_a2 = rItem.result) == null ? void 0 : _a2.arrayType) == "uint8")
1294
- return Buffer.from(x, "base64");
1289
+ if (((_a2 = rItem.result) == null ? void 0 : _a2.arrayType) == "uint8") return Buffer.from(x, "base64");
1295
1290
  else if (((_b2 = rItem.result) == null ? void 0 : _b2.arrayType) == "uint32") {
1296
1291
  const buffer2 = Buffer.from(x, "base64");
1297
1292
  return new Uint32Array(
@@ -1372,16 +1367,14 @@ function ClearAnnotation(annotatedRasterAsset, isAnnualAnnotation, selectedBand,
1372
1367
  selectedBand,
1373
1368
  annotationRasterAsset.metadata
1374
1369
  );
1375
- if (isAnnualAnnotation)
1376
- return { annotationRaster, pastValues };
1370
+ if (isAnnualAnnotation) return { annotationRaster, pastValues };
1377
1371
  else {
1378
1372
  var multiBandAnnotation = annotatedRasterAsset;
1379
1373
  if (multiBandAnnotation == null ? void 0 : multiBandAnnotation.buffer[selectedBand]) {
1380
1374
  multiBandAnnotation.buffer[selectedBand] = annotationRaster.buffer[selectedBand];
1381
1375
  multiBandAnnotation.uri[selectedBand] = annotationRaster.uri[selectedBand];
1382
1376
  return { multiBandAnnotation, undefined: void 0 };
1383
- } else
1384
- return { annotatedRasterAsset: void 0, undefined: void 0 };
1377
+ } else return { annotatedRasterAsset: void 0, undefined: void 0 };
1385
1378
  }
1386
1379
  });
1387
1380
  }
@@ -1415,8 +1408,7 @@ function createTask(locationId, projectId, referenceDate) {
1415
1408
  currentTask: res.task,
1416
1409
  annotation_dates: yield getAnnotationDates(res == null ? void 0 : res.task)
1417
1410
  };
1418
- } else
1419
- return { location: null, currentTask: null, annotation_dates: null };
1411
+ } else return { location: null, currentTask: null, annotation_dates: null };
1420
1412
  });
1421
1413
  }
1422
1414
  function getTask(taskId) {
@@ -1444,8 +1436,7 @@ function getTask(taskId) {
1444
1436
  annotation_dates: yield getAnnotationDates(res == null ? void 0 : res.task),
1445
1437
  location: locData
1446
1438
  };
1447
- } else
1448
- return { currentTask: null, annotation_dates: null, location: null };
1439
+ } else return { currentTask: null, annotation_dates: null, location: null };
1449
1440
  });
1450
1441
  }
1451
1442
  function getActiveLearningAnnotationAsset(assetHref, labels, projectDetail) {
@@ -1497,8 +1488,7 @@ function insertEmptyBufferForSingleBand(length, width, height, selectedBand, ann
1497
1488
  annotatedAsset.buffer[selectedBand] = newArray;
1498
1489
  annotatedAsset.uri[selectedBand] = canvas.toDataURL();
1499
1490
  return annotatedAsset;
1500
- } else
1501
- return null;
1491
+ } else return null;
1502
1492
  });
1503
1493
  }
1504
1494
  function getTaskChangeDetails(taskId) {
@@ -1512,10 +1502,8 @@ function getTaskGeometryDetail(taskId) {
1512
1502
  });
1513
1503
  }
1514
1504
  function getCentroid(geometry, has_area_of_interest, geometry_aoi, is_segment, geometry_segment) {
1515
- if (has_area_of_interest)
1516
- return geometry_aoi;
1517
- if (is_segment)
1518
- return geometry_segment;
1505
+ if (has_area_of_interest) return geometry_aoi;
1506
+ if (is_segment) return geometry_segment;
1519
1507
  return geometry;
1520
1508
  }
1521
1509
  function showAnnotation(savedAnnotations, submittedAnnotations, annotatedRasterAsset) {
@@ -1580,7 +1568,10 @@ var initialState = {
1580
1568
  isAnnualAnnotation: true,
1581
1569
  selectedBand: void 0,
1582
1570
  taskGeometry: null,
1583
- task_for_review: false
1571
+ task_for_review: false,
1572
+ s2_tile_url: null,
1573
+ landsat_tile_url: null,
1574
+ selectedBaseLayer: null
1584
1575
  };
1585
1576
  var useEvolandStore = create()((set) => ({
1586
1577
  clickPoint: null,
@@ -1633,10 +1624,13 @@ var useEvolandStore = create()((set) => ({
1633
1624
  selectedBand: void 0,
1634
1625
  taskGeometry: null,
1635
1626
  task_for_review: false,
1627
+ s2_tile_url: null,
1628
+ landsat_tile_url: null,
1629
+ selectedBaseLayer: null,
1636
1630
  setSelectedRasterAsset: (selectedRaster) => {
1637
1631
  var _a;
1638
1632
  set({ selectedRasterAsset: selectedRaster });
1639
- if ((selectedRaster == null ? void 0 : selectedRaster.type) == "SEGMENTATION_MASK" /* SegmentationMask */ && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi perc"))) {
1633
+ if ((selectedRaster == null ? void 0 : selectedRaster.type) == "SEGMENTATION_MASK" /* SegmentationMask */ && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi"))) {
1640
1634
  createImageDataForNDVI(selectedRaster).then((res) => {
1641
1635
  set({ ndviImageCanvasContext: res });
1642
1636
  });
@@ -1644,9 +1638,9 @@ var useEvolandStore = create()((set) => ({
1644
1638
  },
1645
1639
  setAnnotationUndoRedo: (annotationUndoRedo, annotatedRasterAsset) => set({ annotationUndoRedo, annotatedRasterAsset }),
1646
1640
  setSelectedCompositeRasterAsset: (selectedRaster) => {
1647
- var _a, _b;
1641
+ var _a;
1648
1642
  set({ selectedCompositeRasterAsset: selectedRaster });
1649
- if ((selectedRaster == null ? void 0 : selectedRaster.type) == "COMPOSITE" /* Composite */ && selectedRaster.isInteractive && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi")) && ((_b = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _b.toLowerCase().includes("perc"))) {
1643
+ if ((selectedRaster == null ? void 0 : selectedRaster.type) == "COMPOSITE" /* Composite */ && selectedRaster.isInteractive && ((_a = selectedRaster == null ? void 0 : selectedRaster.name) == null ? void 0 : _a.toLowerCase().includes("ndvi"))) {
1650
1644
  createImageDataForNDVI(selectedRaster).then((res) => {
1651
1645
  set({ ndviImageCanvasContext: res });
1652
1646
  });
@@ -1657,7 +1651,7 @@ var useEvolandStore = create()((set) => ({
1657
1651
  setRecenterLocation: () => set({ recenterLocation: false }),
1658
1652
  setTimerReset: (timerreset) => set({ timerReset: timerreset }),
1659
1653
  setAnnotationTime: (annotationtime) => set({ annotationTime: annotationtime }),
1660
- onLocationSelected: (point2) => __async(void 0, null, function* () {
1654
+ onLocationSelected: (point2) => __async(null, null, function* () {
1661
1655
  var data = yield LocationService2.getPolygonUtmlocationLonLonLatLatWidthWidthHeightHeightGet(
1662
1656
  point2.lng,
1663
1657
  point2.lat,
@@ -1683,10 +1677,10 @@ var useEvolandStore = create()((set) => ({
1683
1677
  location: locData
1684
1678
  });
1685
1679
  }),
1686
- onRecenterLocation: () => __async(void 0, null, function* () {
1680
+ onRecenterLocation: () => __async(null, null, function* () {
1687
1681
  return set({ recenterLocation: true });
1688
1682
  }),
1689
- getLocationAssets: (locationId, projectId, type, taskId) => __async(void 0, null, function* () {
1683
+ getLocationAssets: (locationId, projectId, type, taskId) => __async(null, null, function* () {
1690
1684
  var _a, _b;
1691
1685
  const state = useEvolandStore.getState();
1692
1686
  var {
@@ -1809,12 +1803,16 @@ var useEvolandStore = create()((set) => ({
1809
1803
  }
1810
1804
  return [];
1811
1805
  }),
1812
- getLocationDetails: (locationId, projectId, user, taskId, isAdmin) => __async(void 0, null, function* () {
1806
+ getLocationDetails: (locationId, projectId, user, taskId, isAdmin) => __async(null, null, function* () {
1813
1807
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1814
1808
  var state = useEvolandStore.getState();
1815
1809
  var { referenceDate, reference_dates, sessionTimeOut, projectDetail, task_for_review } = state;
1816
- if (!referenceDate)
1810
+ if (!referenceDate) {
1817
1811
  referenceDate = projectDetail.project_reference_date.toString();
1812
+ set({
1813
+ referenceDate
1814
+ });
1815
+ }
1818
1816
  var annotationDates = null;
1819
1817
  var locationreq = {
1820
1818
  location_id: locationId,
@@ -1898,7 +1896,7 @@ var useEvolandStore = create()((set) => ({
1898
1896
  }
1899
1897
  }
1900
1898
  }),
1901
- getNextLocationDetails: (projectId) => __async(void 0, null, function* () {
1899
+ getNextLocationDetails: (projectId) => __async(null, null, function* () {
1902
1900
  var _a, _b, _c;
1903
1901
  set({ isLoading: true });
1904
1902
  var state = useEvolandStore.getState();
@@ -1967,7 +1965,7 @@ var useEvolandStore = create()((set) => ({
1967
1965
  setOpacity: (opacity) => set({ opacity }),
1968
1966
  setCompositeOpacity: (opacity) => set({ compositeOpacity: opacity }),
1969
1967
  setAnnotationOpacity: (opacity) => set({ annotationOpacity: opacity }),
1970
- addLabel: (loc, bounds, label) => __async(void 0, null, function* () {
1968
+ addLabel: (loc, bounds, label) => __async(null, null, function* () {
1971
1969
  var _a;
1972
1970
  set({ isLoading: true });
1973
1971
  var store = useEvolandStore.getState();
@@ -2027,14 +2025,14 @@ var useEvolandStore = create()((set) => ({
2027
2025
  setShowTimeSeries: (value) => set({ showTimeSeries: value }),
2028
2026
  reset: () => set(initialState),
2029
2027
  setSelectedColorLabel: (label) => set({ selectedColorLabel: label }),
2030
- getLegendsDetails: (array) => __async(void 0, null, function* () {
2028
+ getLegendsDetails: (array) => __async(null, null, function* () {
2031
2029
  var store = useEvolandStore.getState();
2032
2030
  var legends = yield getLegends(array, store.labels);
2033
2031
  set({
2034
2032
  legends
2035
2033
  });
2036
2034
  }),
2037
- getLocationMetaData: (locationId, projectId, taskId) => __async(void 0, null, function* () {
2035
+ getLocationMetaData: (locationId, projectId, taskId) => __async(null, null, function* () {
2038
2036
  var _a, _b;
2039
2037
  set({ isLoading: true });
2040
2038
  var state = useEvolandStore.getState();
@@ -2060,7 +2058,7 @@ var useEvolandStore = create()((set) => ({
2060
2058
  set({ sessionTimeOut: true, isLoading: false });
2061
2059
  }
2062
2060
  }),
2063
- getLabels: (projectId) => __async(void 0, null, function* () {
2061
+ getLabels: (projectId) => __async(null, null, function* () {
2064
2062
  var state = useEvolandStore.getState();
2065
2063
  if (state.labels) {
2066
2064
  return state.labels;
@@ -2082,10 +2080,10 @@ var useEvolandStore = create()((set) => ({
2082
2080
  });
2083
2081
  return allLabels;
2084
2082
  }),
2085
- setBrushThickness: (value) => __async(void 0, null, function* () {
2083
+ setBrushThickness: (value) => __async(null, null, function* () {
2086
2084
  return set({ brushThickness: value });
2087
2085
  }),
2088
- getProjectDetail: (projectId) => __async(void 0, null, function* () {
2086
+ getProjectDetail: (projectId) => __async(null, null, function* () {
2089
2087
  set({ isLoading: true });
2090
2088
  const projectInfo = yield ProjectService.projectDetailProjectdetailProjectIdProjectIdGet(
2091
2089
  projectId
@@ -2096,12 +2094,12 @@ var useEvolandStore = create()((set) => ({
2096
2094
  isAnnualAnnotation: (projectInfo == null ? void 0 : projectInfo.project_type) == "ANNUALLY" /* ANNUALLY */ ? true : false
2097
2095
  });
2098
2096
  }),
2099
- getTaskEvents: (taskId) => __async(void 0, null, function* () {
2097
+ getTaskEvents: (taskId) => __async(null, null, function* () {
2100
2098
  set({ isLoading: true });
2101
2099
  const taskevents = yield TaskService2.getTaskEventsTaskeventsTaskIdTaskIdGet(taskId);
2102
2100
  set({ isLoading: false, taskEvents: taskevents });
2103
2101
  }),
2104
- getTaskAnnotation: (submittedAnnotationAsset, assetType) => __async(void 0, null, function* () {
2102
+ getTaskAnnotation: (submittedAnnotationAsset, assetType) => __async(null, null, function* () {
2105
2103
  var _a, _b, _c;
2106
2104
  if (submittedAnnotationAsset != null && submittedAnnotationAsset.length > 0) {
2107
2105
  const state = useEvolandStore.getState();
@@ -2151,7 +2149,7 @@ var useEvolandStore = create()((set) => ({
2151
2149
  setCurrentPosition: (position) => set({ currentPosition: position }),
2152
2150
  setSessionTimeOut: (hasTimeOut) => set({ sessionTimeOut: hasTimeOut }),
2153
2151
  setLatestTaskAnnotation: (locationTask) => set({ latestTaskAnnotation: locationTask }),
2154
- getTaskReferenceDates: (projectId, locatioId, asset_type, setSelected) => __async(void 0, null, function* () {
2152
+ getTaskReferenceDates: (projectId, locatioId, asset_type, setSelected) => __async(null, null, function* () {
2155
2153
  const state = useEvolandStore.getState();
2156
2154
  const { annotation_dates, reference_dates, selectedReferenceDate } = state;
2157
2155
  var task_ref_dates = yield getRefDates(projectId, locatioId, asset_type);
@@ -2167,7 +2165,7 @@ var useEvolandStore = create()((set) => ({
2167
2165
  });
2168
2166
  }
2169
2167
  }),
2170
- setSelectedReferenceDate: (currentReferenceDate) => __async(void 0, null, function* () {
2168
+ setSelectedReferenceDate: (currentReferenceDate) => __async(null, null, function* () {
2171
2169
  const state = useEvolandStore.getState();
2172
2170
  const { selectedReferenceDate, reference_dates } = state;
2173
2171
  if (currentReferenceDate !== selectedReferenceDate)
@@ -2176,53 +2174,62 @@ var useEvolandStore = create()((set) => ({
2176
2174
  selectedBand: reference_dates == null ? void 0 : reference_dates.indexOf(currentReferenceDate)
2177
2175
  });
2178
2176
  }),
2179
- setUpdateAsset: (updateAssets) => __async(void 0, null, function* () {
2177
+ setUpdateAsset: (updateAssets) => __async(null, null, function* () {
2180
2178
  return set({ updateAssets });
2181
2179
  }),
2182
- setComment: (comment) => __async(void 0, null, function* () {
2180
+ setComment: (comment) => __async(null, null, function* () {
2183
2181
  return set({ comment });
2184
2182
  }),
2185
- setAnnualAnnotation: (val) => __async(void 0, null, function* () {
2183
+ setAnnualAnnotation: (val) => __async(null, null, function* () {
2186
2184
  return set({ isAnnualAnnotation: val });
2187
2185
  }),
2188
- setSelectedBand: (bandIndex) => __async(void 0, null, function* () {
2186
+ setSelectedBand: (bandIndex) => __async(null, null, function* () {
2189
2187
  return set({ selectedBand: bandIndex });
2190
2188
  }),
2191
- setAnnotationDates: (annotationDates) => __async(void 0, null, function* () {
2189
+ setAnnotationDates: (annotationDates) => __async(null, null, function* () {
2192
2190
  return set({ annotation_dates: annotationDates });
2193
2191
  }),
2194
- setSavedAnnotations: (savedAnnotation) => __async(void 0, null, function* () {
2192
+ setSavedAnnotations: (savedAnnotation) => __async(null, null, function* () {
2195
2193
  return set({ savedAnnotations: savedAnnotation });
2196
2194
  }),
2197
- setLabelList: (labels) => __async(void 0, null, function* () {
2195
+ setLabelList: (labels) => __async(null, null, function* () {
2198
2196
  return set({ labelList: labels });
2199
2197
  }),
2200
- setLocation: (loc) => __async(void 0, null, function* () {
2198
+ setLocation: (loc) => __async(null, null, function* () {
2201
2199
  return set({ location: loc });
2202
2200
  }),
2203
- setCurrentTask: (task) => __async(void 0, null, function* () {
2201
+ setCurrentTask: (task) => __async(null, null, function* () {
2204
2202
  return set({ currentTask: task });
2205
2203
  }),
2206
- setTimeSeriesTypes: (types) => __async(void 0, null, function* () {
2204
+ setTimeSeriesTypes: (types) => __async(null, null, function* () {
2207
2205
  return set({ timeSeriesTypes: types });
2208
2206
  }),
2209
- setTimeSeriesAssets: (assets) => __async(void 0, null, function* () {
2207
+ setTimeSeriesAssets: (assets) => __async(null, null, function* () {
2210
2208
  return set({ timeSeriesAssets: assets });
2211
2209
  }),
2212
- setActiveLearningAnnotations: (active_learning) => __async(void 0, null, function* () {
2210
+ setActiveLearningAnnotations: (active_learning) => __async(null, null, function* () {
2213
2211
  return set({ activeLearningAnnotations: active_learning });
2214
2212
  }),
2215
- setSubmittedAnnotations: (submit_annotation) => __async(void 0, null, function* () {
2213
+ setSubmittedAnnotations: (submit_annotation) => __async(null, null, function* () {
2216
2214
  return set({ submittedAnnotations: submit_annotation });
2217
2215
  }),
2218
- setAnnotatedRasterAsset: (annotated_raster) => __async(void 0, null, function* () {
2216
+ setAnnotatedRasterAsset: (annotated_raster) => __async(null, null, function* () {
2219
2217
  return set({ annotatedRasterAsset: annotated_raster });
2220
2218
  }),
2221
- setTaskGeometry: (task_geometry) => __async(void 0, null, function* () {
2219
+ setTaskGeometry: (task_geometry) => __async(null, null, function* () {
2222
2220
  return set({ taskGeometry: task_geometry });
2223
2221
  }),
2224
2222
  setTaskForReview(taskForReview) {
2225
2223
  set({ task_for_review: taskForReview });
2224
+ },
2225
+ setS2TileUrl(url) {
2226
+ set({ s2_tile_url: url });
2227
+ },
2228
+ setLandsatTileUrl(url) {
2229
+ set({ landsat_tile_url: url });
2230
+ },
2231
+ setSelectedBaseLayer(baseLayer) {
2232
+ set({ selectedBaseLayer: baseLayer });
2226
2233
  }
2227
2234
  }));
2228
2235
  var evoland_default = useEvolandStore;
@@ -2343,8 +2350,7 @@ var TiffImage = (props) => {
2343
2350
  } else if (localcomment !== void 0 && (localcomment == null ? void 0 : localcomment.includes("#" + x))) {
2344
2351
  localcomment = localcomment.replace(" #" + x, "");
2345
2352
  this.className = "rounded-xl flex inline-flex text-secondary p-1 text-sm";
2346
- } else
2347
- localcomment = "#" + x + " ";
2353
+ } else localcomment = "#" + x + " ";
2348
2354
  if (evolandStore.comment !== void 0 && evolandStore.comment !== null && !((_a5 = evolandStore.comment) == null ? void 0 : _a5.includes("#" + x)))
2349
2355
  evolandStore.setComment(
2350
2356
  evolandStore.comment + localcomment
@@ -2353,8 +2359,7 @@ var TiffImage = (props) => {
2353
2359
  evolandStore.setComment(
2354
2360
  evolandStore.comment.replace(" #" + x, "")
2355
2361
  );
2356
- else
2357
- evolandStore.setComment(localcomment);
2362
+ else evolandStore.setComment(localcomment);
2358
2363
  });
2359
2364
  container.appendChild(content);
2360
2365
  }
@@ -2395,7 +2400,7 @@ var TiffImage = (props) => {
2395
2400
  bubblingMouseEvents: false,
2396
2401
  className: "border-2 border-blue-600"
2397
2402
  }).bringToFront();
2398
- imageOverlay3.on("mouseover", (e) => __async(void 0, null, function* () {
2403
+ imageOverlay3.on("mouseover", (e) => __async(null, null, function* () {
2399
2404
  var _a3, _b2;
2400
2405
  if (isBrush()) {
2401
2406
  tooltip2 = L.tooltip({ offset: L.point(20, 0), opacity: 0.6 }).setContent(
@@ -2417,21 +2422,20 @@ var TiffImage = (props) => {
2417
2422
  ).setLatLng(e.latlng).addTo(map);
2418
2423
  }
2419
2424
  }));
2420
- imageOverlay3.on("mousemove", (e) => __async(void 0, null, function* () {
2425
+ imageOverlay3.on("mousemove", (e) => __async(null, null, function* () {
2421
2426
  evolandStore.setNDVIRGBValues(ndvi);
2422
2427
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2423
2428
  if (isDrawing) {
2424
2429
  handleMouseMove(e);
2425
2430
  }
2426
2431
  }));
2427
- imageOverlay3.on("mouseout", () => __async(void 0, null, function* () {
2432
+ imageOverlay3.on("mouseout", () => __async(null, null, function* () {
2428
2433
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2429
2434
  }));
2430
- imageOverlay3.on("click", (e) => __async(void 0, null, function* () {
2435
+ imageOverlay3.on("click", (e) => __async(null, null, function* () {
2431
2436
  var _a3, _b2, _c2;
2432
2437
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2433
- if (((_a3 = evolandStore.selectedRasterAsset) == null ? void 0 : _a3.type) == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */)
2434
- return;
2438
+ if (((_a3 = evolandStore.selectedRasterAsset) == null ? void 0 : _a3.type) == "CHANGE_SEGMENTATION_MASK" /* ChangeSegmentationMask */) return;
2435
2439
  if (evolandStore.selectedColorLabel == null && evolandStore.selectedToolType !== 6 /* ClearSegmentWithPolygon */) {
2436
2440
  alert("Please select label");
2437
2441
  return;
@@ -2478,25 +2482,23 @@ var TiffImage = (props) => {
2478
2482
  opacity: 0.8,
2479
2483
  lineCap: "round"
2480
2484
  }).addTo(map);
2481
- polyLine.on("click", () => __async(void 0, null, function* () {
2485
+ polyLine.on("click", () => __async(null, null, function* () {
2482
2486
  stopPaint();
2483
2487
  }));
2484
- polyLine.on("mouseover", (e) => __async(void 0, null, function* () {
2488
+ polyLine.on("mouseover", (e) => __async(null, null, function* () {
2485
2489
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2486
2490
  tooltip2 = L.tooltip({ offset: L.point(20, 0), opacity: 0.6 }).setContent("Click to Stop").setLatLng(e.latlng).addTo(map);
2487
2491
  }));
2488
- polyLine.on("mousemove", () => __async(void 0, null, function* () {
2492
+ polyLine.on("mousemove", () => __async(null, null, function* () {
2489
2493
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2490
2494
  }));
2491
- polyLine.on("mouseout", () => __async(void 0, null, function* () {
2495
+ polyLine.on("mouseout", () => __async(null, null, function* () {
2492
2496
  tooltip2 == null ? void 0 : tooltip2.removeFrom(map);
2493
2497
  }));
2494
2498
  }
2495
2499
  return () => {
2496
- if (imageOverlay3)
2497
- map.removeLayer(imageOverlay3);
2498
- if (tagsPopUp)
2499
- map.removeLayer(tagsPopUp);
2500
+ if (imageOverlay3) map.removeLayer(imageOverlay3);
2501
+ if (tagsPopUp) map.removeLayer(tagsPopUp);
2500
2502
  if (rectangle3 && evolandStore.isAnnualAnnotation)
2501
2503
  map.removeLayer(rectangle3);
2502
2504
  if (polyLine !== void 0) {
@@ -2589,7 +2591,7 @@ var ReadOnlyTiffImage = (props) => {
2589
2591
  bubblingMouseEvents: false,
2590
2592
  className: "border-2 border-blue-600"
2591
2593
  }).bringToBack();
2592
- imageOverlay3.on("mouseover", (e) => __async(void 0, null, function* () {
2594
+ imageOverlay3.on("mouseover", (e) => __async(null, null, function* () {
2593
2595
  var data = yield getCanvasDataFromImageArray(
2594
2596
  props.raster,
2595
2597
  e.latlng,
@@ -2599,7 +2601,7 @@ var ReadOnlyTiffImage = (props) => {
2599
2601
  );
2600
2602
  setNDVI(data[1]);
2601
2603
  }));
2602
- imageOverlay3.on("mousemove", () => __async(void 0, null, function* () {
2604
+ imageOverlay3.on("mousemove", () => __async(null, null, function* () {
2603
2605
  evolandStore.setNDVIRGBValues(ndvi);
2604
2606
  }));
2605
2607
  imageOverlay3.addTo(map);
@@ -2617,12 +2619,9 @@ var ReadOnlyTiffImage = (props) => {
2617
2619
  }).addTo(map);
2618
2620
  }
2619
2621
  return () => {
2620
- if (imageOverlay3)
2621
- map.removeLayer(imageOverlay3);
2622
- if (rectangle3 && showRectangleAtCenter)
2623
- map.removeLayer(rectangle3);
2624
- if (props.polygonBounds)
2625
- map.removeLayer(polygon_segment);
2622
+ if (imageOverlay3) map.removeLayer(imageOverlay3);
2623
+ if (rectangle3 && showRectangleAtCenter) map.removeLayer(rectangle3);
2624
+ if (props.polygonBounds) map.removeLayer(polygon_segment);
2626
2625
  };
2627
2626
  }, [props, map, showRectangleAtCenter]);
2628
2627
  return null;
@@ -2760,8 +2759,7 @@ var EvoLandGeometry = () => {
2760
2759
  import { jsx as jsx3 } from "react/jsx-runtime";
2761
2760
  var EvolandContainer = ({ sessionStatus }) => {
2762
2761
  const evolandStore = useEvolandStore();
2763
- if (sessionStatus === "unauthenticated")
2764
- return /* @__PURE__ */ jsx3(AuthenticationFailure, {});
2762
+ if (sessionStatus === "unauthenticated") return /* @__PURE__ */ jsx3(AuthenticationFailure, {});
2765
2763
  return evolandStore.location && /* @__PURE__ */ jsx3(EvoLandGeometry, {});
2766
2764
  };
2767
2765
 
@@ -3275,8 +3273,7 @@ import { LoaderFull } from "@geowiki/ui";
3275
3273
  import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
3276
3274
  var assetsByYear = (assets) => assets == null ? void 0 : assets.reduce((acc, item) => {
3277
3275
  const year = new Date(item.reference_date).getFullYear();
3278
- if (!acc[year])
3279
- acc[year] = [];
3276
+ if (!acc[year]) acc[year] = [];
3280
3277
  acc[year].push(item);
3281
3278
  return acc;
3282
3279
  }, {});
@@ -3299,6 +3296,7 @@ var ViewAssets = (props) => {
3299
3296
  const [compositesTab, setCompositesTab] = useState5(
3300
3297
  props.defaultAssetView == "COMPOSITE" /* Composite */ ? true : false
3301
3298
  );
3299
+ const [fetchComposite, setFetchComposite] = useState5(false);
3302
3300
  const [masks, setMasks] = useState5(
3303
3301
  evolandStore.maskAsset !== null ? evolandStore.maskAsset : []
3304
3302
  );
@@ -3393,14 +3391,10 @@ var ViewAssets = (props) => {
3393
3391
  );
3394
3392
  if (props.taskId !== void 0 && IsTaskAnnotationLoading)
3395
3393
  return /* @__PURE__ */ jsx7(LoaderFull, {});
3396
- if (maskTab && (masks == null ? void 0 : masks.length) == 0)
3397
- setMasks(evolandStore.maskAsset);
3398
- if (changeMaskTab && (changeMasks == null ? void 0 : changeMasks.length) == 0)
3399
- checkChangeMasksAndLoad();
3400
- if (compositesTab && composites.length == 0)
3401
- checkCompositesAndLoad();
3402
- if (annotationTab)
3403
- checkAnnotationsAndLoad();
3394
+ if (maskTab && (masks == null ? void 0 : masks.length) == 0) setMasks(evolandStore.maskAsset);
3395
+ if (changeMaskTab && (changeMasks == null ? void 0 : changeMasks.length) == 0) checkChangeMasksAndLoad();
3396
+ if (compositesTab && composites.length == 0) checkCompositesAndLoad();
3397
+ if (annotationTab) checkAnnotationsAndLoad();
3404
3398
  function checkMasksAndLoad() {
3405
3399
  if ((masks == null ? void 0 : masks.length) === 0 && !evolandStore.maskAsset) {
3406
3400
  evolandStore.getLocationAssets(
@@ -3411,8 +3405,7 @@ var ViewAssets = (props) => {
3411
3405
  ).then((res) => {
3412
3406
  setMasks(res);
3413
3407
  });
3414
- } else if (masks.length == 0)
3415
- setMasks(evolandStore.maskAsset);
3408
+ } else if (masks.length == 0) setMasks(evolandStore.maskAsset);
3416
3409
  }
3417
3410
  function checkChangeMasksAndLoad() {
3418
3411
  if ((changeMasks == null ? void 0 : changeMasks.length) === 0 && !evolandStore.changeMaskAsset) {
@@ -3428,7 +3421,8 @@ var ViewAssets = (props) => {
3428
3421
  setChangeMasks(evolandStore.changeMaskAsset);
3429
3422
  }
3430
3423
  function checkCompositesAndLoad() {
3431
- if ((composites == null ? void 0 : composites.length) === 0 && !evolandStore.compositeAsset) {
3424
+ if ((composites == null ? void 0 : composites.length) === 0 && !evolandStore.compositeAsset && !fetchComposite) {
3425
+ setFetchComposite(true);
3432
3426
  evolandStore.getLocationAssets(
3433
3427
  props.locationId,
3434
3428
  props.projectId,
@@ -3436,6 +3430,7 @@ var ViewAssets = (props) => {
3436
3430
  props.taskId
3437
3431
  ).then((res) => {
3438
3432
  setComposites(assetsByYear(res));
3433
+ setFetchComposite(false);
3439
3434
  });
3440
3435
  }
3441
3436
  }
@@ -3458,8 +3453,7 @@ var ViewAssets = (props) => {
3458
3453
  }
3459
3454
  if (props.taskId !== void 0 && IsTaskAnnotationLoading)
3460
3455
  return /* @__PURE__ */ jsx7(LoaderFull, {});
3461
- if (maskTab && ((masks == null ? void 0 : masks.length) == 0 || masks == null))
3462
- setMaskTab(false);
3456
+ if (maskTab && ((masks == null ? void 0 : masks.length) == 0 || masks == null)) setMaskTab(false);
3463
3457
  return /* @__PURE__ */ jsxs5("div", { children: [
3464
3458
  /* @__PURE__ */ jsxs5(
3465
3459
  "div",
@@ -3812,7 +3806,7 @@ var ViewAssets = (props) => {
3812
3806
  asset.id + index
3813
3807
  );
3814
3808
  }) })
3815
- ] }))
3809
+ ] }, year))
3816
3810
  }
3817
3811
  )
3818
3812
  ] })
@@ -4021,8 +4015,7 @@ var SearchAnnotation = (props) => {
4021
4015
  localStorage.setItem("toDate", toDate);
4022
4016
  if (tasks == null ? void 0 : tasks.exists)
4023
4017
  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" : ""}`;
4024
- else
4025
- alert("No data for search parameters");
4018
+ else alert("No data for search parameters");
4026
4019
  },
4027
4020
  children: [
4028
4021
  /* @__PURE__ */ jsx8(
@@ -4336,14 +4329,11 @@ var EvolandLeftSideBar = (props) => {
4336
4329
  }
4337
4330
  if (evolandStore.projectDetail) {
4338
4331
  if (((_m = (_l = evolandStore.projectDetail) == null ? void 0 : _l.meta_data) == null ? void 0 : _m.default_asset_view) == "SEGMENTATION_MASK" /* SegmentationMask */) {
4339
- if ((masks == null ? void 0 : masks.length) === 0)
4340
- return /* @__PURE__ */ jsx10(LoaderFull3, {});
4332
+ if ((masks == null ? void 0 : masks.length) === 0) return /* @__PURE__ */ jsx10(LoaderFull3, {});
4341
4333
  } else if (((_o = (_n = evolandStore.projectDetail) == null ? void 0 : _n.meta_data) == null ? void 0 : _o.default_asset_view) == "COMPOSITE" /* Composite */) {
4342
- if ((composites == null ? void 0 : composites.length) === 0)
4343
- return /* @__PURE__ */ jsx10(LoaderFull3, {});
4334
+ if ((composites == null ? void 0 : composites.length) === 0) return /* @__PURE__ */ jsx10(LoaderFull3, {});
4344
4335
  }
4345
- } else
4346
- return /* @__PURE__ */ jsx10(LoaderFull3, {});
4336
+ } else return /* @__PURE__ */ jsx10(LoaderFull3, {});
4347
4337
  return /* @__PURE__ */ jsx10(
4348
4338
  "div",
4349
4339
  {
@@ -4510,8 +4500,7 @@ var EvolandLeftSideBar = (props) => {
4510
4500
  canDelete = confirm(
4511
4501
  (review ? "This is a targeted review task. " : "") + "Are you sure you want to delete this task?"
4512
4502
  );
4513
- if (canDelete)
4514
- setDeleteTask(true);
4503
+ if (canDelete) setDeleteTask(true);
4515
4504
  },
4516
4505
  children: [
4517
4506
  /* @__PURE__ */ jsx10(
@@ -4553,8 +4542,7 @@ var EvolandLeftSideBar = (props) => {
4553
4542
  evolandStore.setAnnotationDates(annotation_dates);
4554
4543
  if (currentTask)
4555
4544
  evolandStore.setCurrentTask(currentTask);
4556
- if (location)
4557
- evolandStore.setLocation(location);
4545
+ if (location) evolandStore.setLocation(location);
4558
4546
  if (props.userRole === "admin")
4559
4547
  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" : "");
4560
4548
  }
@@ -4843,10 +4831,9 @@ var RasterPreview = (_props) => {
4843
4831
  },
4844
4832
  { scopes: ["evoland"] }
4845
4833
  );
4846
- const onSubmit = (taskStatus) => __async(void 0, null, function* () {
4834
+ const onSubmit = (taskStatus) => __async(null, null, function* () {
4847
4835
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2;
4848
- if (disableSubmit)
4849
- return;
4836
+ if (disableSubmit) return;
4850
4837
  setDisableSubmit(true);
4851
4838
  var bufferData = null;
4852
4839
  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 };
@@ -4903,8 +4890,7 @@ var RasterPreview = (_props) => {
4903
4890
  if (_props.userRole === "admin") {
4904
4891
  if (tasks == null ? void 0 : tasks.task)
4905
4892
  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" : ""}`;
4906
- else
4907
- alert("No more tasks to review");
4893
+ else alert("No more tasks to review");
4908
4894
  }
4909
4895
  var res = yield evolandStore.getNextLocationDetails(
4910
4896
  parseInt(projectId)
@@ -4928,8 +4914,7 @@ var RasterPreview = (_props) => {
4928
4914
  }
4929
4915
  });
4930
4916
  const arrayEqual = (a, b) => {
4931
- if (a.length !== b.length)
4932
- return false;
4917
+ if (a.length !== b.length) return false;
4933
4918
  return Buffer.compare(Buffer.from(a.buffer), Buffer.from(b.buffer)) === 0;
4934
4919
  };
4935
4920
  const flatten = (input, refArr) => {
@@ -4953,15 +4938,14 @@ var RasterPreview = (_props) => {
4953
4938
  }
4954
4939
  }
4955
4940
  }
4956
- if (indexArr.length == 0)
4957
- result = emptyAnnotation;
4941
+ if (indexArr.length == 0) result = emptyAnnotation;
4958
4942
  return { data: new Uint32Array(result), indexArr };
4959
4943
  };
4960
4944
  function isBase64Zeros(base64String) {
4961
4945
  const trimmed = base64String.replace(/=+$/, "");
4962
4946
  return /^A+$/.test(trimmed);
4963
4947
  }
4964
- const onSave = () => __async(void 0, null, function* () {
4948
+ const onSave = () => __async(null, null, function* () {
4965
4949
  var _a2, _b2;
4966
4950
  var bufferData = null;
4967
4951
  const { data, indexArr } = evolandStore.isAnnualAnnotation ? { data: evolandStore.annotatedRasterAsset.buffer, indexArr: 0 } : flatten(
@@ -5009,8 +4993,7 @@ var RasterPreview = (_props) => {
5009
4993
  setSubmitNotificationMessage(
5010
4994
  "Annotation has been SAVED successfully"
5011
4995
  );
5012
- else
5013
- setSubmitNotificationMessage("Please try again");
4996
+ else setSubmitNotificationMessage("Please try again");
5014
4997
  setSubmitNotification(true);
5015
4998
  }
5016
4999
  } catch (err) {
@@ -5019,7 +5002,7 @@ var RasterPreview = (_props) => {
5019
5002
  }
5020
5003
  }
5021
5004
  });
5022
- const ClearPreview = () => __async(void 0, null, function* () {
5005
+ const ClearPreview = () => __async(null, null, function* () {
5023
5006
  const { annotationRaster, pastValues } = yield ClearAnnotation(
5024
5007
  evolandStore.annotatedRasterAsset,
5025
5008
  evolandStore.isAnnualAnnotation,
@@ -5082,16 +5065,14 @@ var RasterPreview = (_props) => {
5082
5065
  )] : newValue == null ? void 0 : newValue.buffer[0] : newValue == null ? void 0 : newValue.buffer
5083
5066
  );
5084
5067
  };
5085
- if (layerStore.layerOpacity == 0)
5086
- layerStore.setLayerOpacity(0.4);
5068
+ if (layerStore.layerOpacity == 0) layerStore.setLayerOpacity(0.4);
5087
5069
  if (!goToNextTask && evolandStore.location !== null && evolandStore.location.locationId !== searchParams.get("locationId")) {
5088
5070
  if (status == TaskStatus3.ACCEPTED || status == TaskStatus3.DISCARDED || status == TaskStatus3.TO_FIX) {
5089
5071
  setGoToNextTask(true);
5090
5072
  if (_props.userRole === "admin")
5091
5073
  if (tasks == null ? void 0 : tasks.task)
5092
5074
  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" : ""}`;
5093
- else
5094
- alert("No more tasks to review");
5075
+ else alert("No more tasks to review");
5095
5076
  } else
5096
5077
  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}`;
5097
5078
  }
@@ -5140,10 +5121,8 @@ var RasterPreview = (_props) => {
5140
5121
  parseInt(projectId),
5141
5122
  evolandStore.referenceDate
5142
5123
  ).then(({ location, currentTask, annotation_dates }) => {
5143
- if (location)
5144
- evolandStore.setLocation(location);
5145
- if (currentTask)
5146
- evolandStore.setCurrentTask(currentTask);
5124
+ if (location) evolandStore.setLocation(location);
5125
+ if (currentTask) evolandStore.setCurrentTask(currentTask);
5147
5126
  evolandStore.setAnnotationDates(annotation_dates);
5148
5127
  });
5149
5128
  },
@@ -5179,8 +5158,7 @@ var RasterPreview = (_props) => {
5179
5158
  evolandStore.setComment(
5180
5159
  evolandStore.comment.replace(" #" + x, "")
5181
5160
  );
5182
- else
5183
- evolandStore.setComment("#" + x + " ");
5161
+ else evolandStore.setComment("#" + x + " ");
5184
5162
  },
5185
5163
  children: [
5186
5164
  "#",
@@ -5441,7 +5419,7 @@ var Annotation = (props) => {
5441
5419
  labelId: 0
5442
5420
  });
5443
5421
  const [currentLabelItem, setCurrentLabelItem] = useState9();
5444
- const OnSubmitActiveLearning = () => __async(void 0, null, function* () {
5422
+ const OnSubmitActiveLearning = () => __async(null, null, function* () {
5445
5423
  var _a2, _b2;
5446
5424
  setActiveLearningLoading(true);
5447
5425
  var bufferData = null;
@@ -6151,8 +6129,7 @@ var defaultStyles = {
6151
6129
  };
6152
6130
  var excludedProperties = /* @__PURE__ */ new Set(["bbox", "geometry", "type"]);
6153
6131
  var formatValue = (value) => {
6154
- if (value === null || value === void 0)
6155
- return "";
6132
+ if (value === null || value === void 0) return "";
6156
6133
  if (typeof value === "number") {
6157
6134
  return value.toLocaleString();
6158
6135
  }
@@ -6388,8 +6365,7 @@ var BetterWMS = class extends L5.TileLayer.WMS {
6388
6365
  * Builds the URL for the GetFeatureInfo WMS request
6389
6366
  */
6390
6367
  getFeatureInfoUrl(latlng) {
6391
- if (!this.currentMap)
6392
- return null;
6368
+ if (!this.currentMap) return null;
6393
6369
  const point2 = this.currentMap.latLngToContainerPoint(latlng);
6394
6370
  const size = this.currentMap.getSize();
6395
6371
  const wmsParams = this.wmsParams;
@@ -6458,8 +6434,7 @@ var BetterWMS = class extends L5.TileLayer.WMS {
6458
6434
  return;
6459
6435
  }
6460
6436
  this.geoJsonLayer.addData(content);
6461
- if (!this.currentMap)
6462
- return;
6437
+ if (!this.currentMap) return;
6463
6438
  if (this.currentPopup) {
6464
6439
  this.currentMap.closePopup(this.currentPopup);
6465
6440
  }
@@ -6476,8 +6451,7 @@ var BetterWMS = class extends L5.TileLayer.WMS {
6476
6451
  * Show loading popup
6477
6452
  */
6478
6453
  showLoading(latlng) {
6479
- if (!this.currentMap || this.loading || !this.canShowLoading)
6480
- return;
6454
+ if (!this.currentMap || this.loading || !this.canShowLoading) return;
6481
6455
  this.loading = true;
6482
6456
  this.currentPopup = L5.popup(this.popupOptions).setLatLng(latlng).setContent(this.loadingContent).openOn(this.currentMap);
6483
6457
  }
@@ -6488,8 +6462,7 @@ var BetterWMS = class extends L5.TileLayer.WMS {
6488
6462
  return __async(this, null, function* () {
6489
6463
  var _a, _b, _c;
6490
6464
  const url = this.getFeatureInfoUrl(event.latlng);
6491
- if (!url)
6492
- return;
6465
+ if (!url) return;
6493
6466
  try {
6494
6467
  this.showLoading(event.latlng);
6495
6468
  const data = yield this.fetchWithRetry(url);
@@ -6544,7 +6517,7 @@ import {
6544
6517
  createElementObject,
6545
6518
  createPathComponent
6546
6519
  } from "@react-leaflet/core";
6547
- import * as L6 from "leaflet";
6520
+ import L6 from "leaflet";
6548
6521
  import "leaflet.markercluster";
6549
6522
  function getPropsAndEvents(props) {
6550
6523
  let clusterProps = {};
@@ -6573,7 +6546,7 @@ function createMarkerClusterGroup(props, context) {
6573
6546
  }
6574
6547
  var updateMarkerCluster = () => {
6575
6548
  };
6576
- var MarkerClusterGroup2 = createPathComponent(
6549
+ var MarkerClusterGroup = createPathComponent(
6577
6550
  createMarkerClusterGroup,
6578
6551
  updateMarkerCluster
6579
6552
  );
@@ -6674,8 +6647,7 @@ import { DesignFarmerClusterPin } from "@geowiki/ui";
6674
6647
  import { jsx as jsx15 } from "react/jsx-runtime";
6675
6648
  var FarmerClusterPopup = ({ properties }) => {
6676
6649
  const fileUrl = useFileUrl2();
6677
- if (!properties)
6678
- return /* @__PURE__ */ jsx15("div", { children: "No properties found" });
6650
+ if (!properties) return /* @__PURE__ */ jsx15("div", { children: "No properties found" });
6679
6651
  const name = properties["name"];
6680
6652
  const description = properties["description"];
6681
6653
  const url = "/cluster/view/" + properties["id"];
@@ -6740,8 +6712,7 @@ import {
6740
6712
  import { Image as Image3 } from "@geowiki/core";
6741
6713
  import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
6742
6714
  var SiteInformation = ({ data }) => {
6743
- if (!data)
6744
- return null;
6715
+ if (!data) return null;
6745
6716
  const baseDocUrl = "https://raw.githubusercontent.com/iiasa/static/refs/heads/main/geotrees/docs/biomass_processing_protocol/";
6746
6717
  return /* @__PURE__ */ jsxs12("div", { className: "space-y-6", children: [
6747
6718
  /* @__PURE__ */ jsxs12("div", { className: "space-y-4", children: [
@@ -6916,8 +6887,7 @@ var IfbnSitePopup = ({ properties }) => {
6916
6887
  const [isLoading, setIsLoading] = useState11(false);
6917
6888
  const [imageError, setImageError] = useState11(false);
6918
6889
  const { status: sessionStatus, data: session } = useSession();
6919
- if (!properties)
6920
- return /* @__PURE__ */ jsx17("div", { children: "No properties found" });
6890
+ if (!properties) return /* @__PURE__ */ jsx17("div", { children: "No properties found" });
6921
6891
  const plotId = properties["Plot_ID"];
6922
6892
  const subPlotId = properties["SubPlot_Id"];
6923
6893
  const network = properties["Network"];
@@ -6926,7 +6896,7 @@ var IfbnSitePopup = ({ properties }) => {
6926
6896
  const fallbackUrl = "https://cms.main.geo-wiki.org/geotrees/media/cocoa.png";
6927
6897
  const baseImageUrl = "https://raw.githubusercontent.com/iiasa/static/refs/heads/main/geotrees/sites/";
6928
6898
  const imageUrl = `${baseImageUrl}${plotId}.jpg?raw=true`;
6929
- const fetchSiteData = () => __async(void 0, null, function* () {
6899
+ const fetchSiteData = () => __async(null, null, function* () {
6930
6900
  setIsLoading(true);
6931
6901
  try {
6932
6902
  const response = yield fetch(
@@ -6937,8 +6907,7 @@ var IfbnSitePopup = ({ properties }) => {
6937
6907
  }
6938
6908
  }
6939
6909
  );
6940
- if (!response.ok)
6941
- throw new Error("Failed to fetch data");
6910
+ if (!response.ok) throw new Error("Failed to fetch data");
6942
6911
  const data = yield response.json();
6943
6912
  setSiteData(data);
6944
6913
  } catch (error) {
@@ -7012,16 +6981,14 @@ var IfbnPlotPopup = ({ properties }) => {
7012
6981
  const [error, setError] = useState12(null);
7013
6982
  const API_URL = process.env.NEXT_PUBLIC_GEO_TREE_API_URL;
7014
6983
  useEffect5(() => {
7015
- const fetchApiData = () => __async(void 0, null, function* () {
7016
- if (!(properties == null ? void 0 : properties.id))
7017
- return;
6984
+ const fetchApiData = () => __async(null, null, function* () {
6985
+ if (!(properties == null ? void 0 : properties.id)) return;
7018
6986
  setIsLoading(true);
7019
6987
  try {
7020
6988
  const response = yield fetch(
7021
6989
  `${API_URL}/api/plots/by-plot-id/${properties.plot_id}`
7022
6990
  );
7023
- if (!response.ok)
7024
- throw new Error("Failed to fetch data");
6991
+ if (!response.ok) throw new Error("Failed to fetch data");
7025
6992
  const data = yield response.json();
7026
6993
  console.log("API Response:", data);
7027
6994
  setApiData(data);
@@ -7195,12 +7162,9 @@ var createClusterIcon = (color) => {
7195
7162
  markers.forEach((marker2) => {
7196
7163
  var _a, _b, _c;
7197
7164
  const status = ((_c = (_b = (_a = marker2.feature) == null ? void 0 : _a.properties) == null ? void 0 : _b.Status) == null ? void 0 : _c.trim().toLowerCase()) || "default";
7198
- if (status === "ongoing")
7199
- statusCount.ongoing++;
7200
- else if (status === "auxiliary")
7201
- statusCount.auxiliary++;
7202
- else
7203
- statusCount.default++;
7165
+ if (status === "ongoing") statusCount.ongoing++;
7166
+ else if (status === "auxiliary") statusCount.auxiliary++;
7167
+ else statusCount.default++;
7204
7168
  });
7205
7169
  return L7.divIcon({
7206
7170
  html: `<div style=
@@ -7226,7 +7190,7 @@ var GeoJsonLayer = memo(
7226
7190
  ({ layer }) => {
7227
7191
  const { isLoading, error, data } = useQuery({
7228
7192
  queryKey: ["geoJson", layer.id],
7229
- queryFn: () => __async(void 0, null, function* () {
7193
+ queryFn: () => __async(null, null, function* () {
7230
7194
  const res = yield fetch(layer.url);
7231
7195
  return yield res.json();
7232
7196
  })
@@ -7276,8 +7240,7 @@ var GeoJsonLayer = memo(
7276
7240
  [layerIcon]
7277
7241
  );
7278
7242
  const processedData = useMemo2(() => {
7279
- if (!(data == null ? void 0 : data.features))
7280
- return data;
7243
+ if (!(data == null ? void 0 : data.features)) return data;
7281
7244
  const processed = __spreadValues({}, data);
7282
7245
  processed.features = data.features.map((feature) => {
7283
7246
  var _a;
@@ -7303,12 +7266,10 @@ var GeoJsonLayer = memo(
7303
7266
  }),
7304
7267
  [layer.id]
7305
7268
  );
7306
- if (error)
7307
- return /* @__PURE__ */ jsx20("div", { children: "error" });
7308
- if (isLoading)
7309
- return /* @__PURE__ */ jsx20(LoaderFull5, {});
7269
+ if (error) return /* @__PURE__ */ jsx20("div", { children: "error" });
7270
+ if (isLoading) return /* @__PURE__ */ jsx20(LoaderFull5, {});
7310
7271
  return /* @__PURE__ */ jsx20(
7311
- MarkerClusterGroup2,
7272
+ MarkerClusterGroup,
7312
7273
  {
7313
7274
  ref,
7314
7275
  iconCreateFunction: clusterIconFunction,
@@ -7379,12 +7340,9 @@ var createClusterIcon2 = (cluster) => {
7379
7340
  markers.forEach((marker2) => {
7380
7341
  var _a, _b, _c;
7381
7342
  const status = ((_c = (_b = (_a = marker2.feature) == null ? void 0 : _a.properties) == null ? void 0 : _b.Status) == null ? void 0 : _c.trim().toLowerCase()) || "default";
7382
- if (status === "ongoing")
7383
- statusCount.ongoing++;
7384
- else if (status === "auxiliary")
7385
- statusCount.auxiliary++;
7386
- else
7387
- statusCount.default++;
7343
+ if (status === "ongoing") statusCount.ongoing++;
7344
+ else if (status === "auxiliary") statusCount.auxiliary++;
7345
+ else statusCount.default++;
7388
7346
  });
7389
7347
  let clusterColor = "#2E7D32";
7390
7348
  if (statusCount.ongoing > statusCount.auxiliary && statusCount.ongoing > statusCount.default) {
@@ -7433,7 +7391,7 @@ var IfbnPlotLayer = ({
7433
7391
  });
7434
7392
  const { isLoading, error, data } = useQuery2({
7435
7393
  queryKey: ["IfbnPlotLayer", layer.id],
7436
- queryFn: () => __async(void 0, null, function* () {
7394
+ queryFn: () => __async(null, null, function* () {
7437
7395
  const res = yield fetch(`${layer.url}`);
7438
7396
  return yield res.json();
7439
7397
  })
@@ -7442,8 +7400,7 @@ var IfbnPlotLayer = ({
7442
7400
  return currentZoom <= hideMarkersAboveZoom;
7443
7401
  };
7444
7402
  useEffect7(() => {
7445
- if (!markerClusterGroupRef.current)
7446
- return;
7403
+ if (!markerClusterGroupRef.current) return;
7447
7404
  if (shouldShowMarkers()) {
7448
7405
  markersRef.current.forEach((marker2) => {
7449
7406
  var _a, _b;
@@ -7531,12 +7488,10 @@ var IfbnPlotLayer = ({
7531
7488
  setSelectedFeature({ feature, latlng });
7532
7489
  };
7533
7490
  const ref = useRef2(null);
7534
- if (error)
7535
- return /* @__PURE__ */ jsx21("div", { children: "error" });
7536
- if (isLoading)
7537
- return /* @__PURE__ */ jsx21(LoaderFull6, {});
7491
+ if (error) return /* @__PURE__ */ jsx21("div", { children: "error" });
7492
+ if (isLoading) return /* @__PURE__ */ jsx21(LoaderFull6, {});
7538
7493
  return /* @__PURE__ */ jsxs14(
7539
- MarkerClusterGroup2,
7494
+ MarkerClusterGroup,
7540
7495
  {
7541
7496
  ref,
7542
7497
  chunkedLoading: true,
@@ -7795,8 +7750,7 @@ var useCustomLayerStore = create4()((set, get) => ({
7795
7750
  createLayerFromTemplate: (templateId, customData) => {
7796
7751
  var _a, _b;
7797
7752
  const template = get().getTemplate(templateId);
7798
- if (!template)
7799
- return null;
7753
+ if (!template) return null;
7800
7754
  const newLayer = {
7801
7755
  id: uuidv4(),
7802
7756
  isCustom: true,
@@ -8167,16 +8121,11 @@ function getColumnStats(data, columnName) {
8167
8121
  let type;
8168
8122
  if (uniqueTypes.size === 1) {
8169
8123
  const singleType = types[0];
8170
- if (singleType === "string")
8171
- type = "string";
8172
- else if (singleType === "number")
8173
- type = "number";
8174
- else if (singleType === "boolean")
8175
- type = "boolean";
8176
- else if (singleType === "object")
8177
- type = "date";
8178
- else
8179
- type = "mixed";
8124
+ if (singleType === "string") type = "string";
8125
+ else if (singleType === "number") type = "number";
8126
+ else if (singleType === "boolean") type = "boolean";
8127
+ else if (singleType === "object") type = "date";
8128
+ else type = "mixed";
8180
8129
  } else {
8181
8130
  type = "mixed";
8182
8131
  }
@@ -8189,21 +8138,15 @@ var GoogleSheetsPopup = ({
8189
8138
  properties
8190
8139
  }) => {
8191
8140
  const isEmpty = (value) => {
8192
- if (value === null || value === void 0)
8193
- return true;
8194
- if (typeof value === "string")
8195
- return value.trim() === "";
8196
- if (typeof value === "number")
8197
- return isNaN(value);
8198
- if (Array.isArray(value))
8199
- return value.length === 0;
8200
- if (typeof value === "object")
8201
- return Object.keys(value).length === 0;
8141
+ if (value === null || value === void 0) return true;
8142
+ if (typeof value === "string") return value.trim() === "";
8143
+ if (typeof value === "number") return isNaN(value);
8144
+ if (Array.isArray(value)) return value.length === 0;
8145
+ if (typeof value === "object") return Object.keys(value).length === 0;
8202
8146
  return false;
8203
8147
  };
8204
8148
  const isUrl = (value) => {
8205
- if (typeof value !== "string")
8206
- return false;
8149
+ if (typeof value !== "string") return false;
8207
8150
  const trimmedValue = value.trim();
8208
8151
  const urlPatterns = [
8209
8152
  /^https?:\/\//i,
@@ -8710,8 +8653,7 @@ function analyzeColumn(rows, columnName) {
8710
8653
  };
8711
8654
  }
8712
8655
  function getLegendColumns(rows, excludeCoordinateColumns = []) {
8713
- if (rows.length === 0)
8714
- return [];
8656
+ if (rows.length === 0) return [];
8715
8657
  const headers = Object.keys(rows[0]);
8716
8658
  const legendColumns = [];
8717
8659
  for (const header of headers) {
@@ -8848,7 +8790,7 @@ function useGenericCache({
8848
8790
  const isCached = cache.has(cacheKey);
8849
8791
  const queryOptions = {
8850
8792
  queryKey: [cacheKey.type, cacheKey.id, cacheKey.subId, cacheKey.version],
8851
- queryFn: () => __async(this, null, function* () {
8793
+ queryFn: () => __async(null, null, function* () {
8852
8794
  const cachedData = cache.get(cacheKey);
8853
8795
  if (cachedData) {
8854
8796
  console.log(
@@ -8917,7 +8859,7 @@ function useGoogleSheetsData({
8917
8859
  subId: sheetConfig.sheetId,
8918
8860
  version: "1.0.0"
8919
8861
  } : null;
8920
- const fetchData = () => __async(this, null, function* () {
8862
+ const fetchData = () => __async(null, null, function* () {
8921
8863
  if (!sheetConfig) {
8922
8864
  throw new Error("Invalid Google Sheets configuration");
8923
8865
  }
@@ -9185,8 +9127,7 @@ var GoogleSheetsLayer = ({
9185
9127
  };
9186
9128
  const processedData = useMemo3(() => {
9187
9129
  var _a2;
9188
- if (!data)
9189
- return null;
9130
+ if (!data) return null;
9190
9131
  return __spreadProps(__spreadValues({}, data), {
9191
9132
  features: (_a2 = data.features) == null ? void 0 : _a2.map((feature) => {
9192
9133
  var _a3;
@@ -9369,7 +9310,7 @@ var GoogleSheetsLayer = ({
9369
9310
  }
9370
9311
  )
9371
9312
  ] }),
9372
- /* @__PURE__ */ jsx26(MarkerClusterGroup2, { ref, iconCreateFunction: createClusterIcon3(), children: /* @__PURE__ */ jsx26(
9313
+ /* @__PURE__ */ jsx26(MarkerClusterGroup, { ref, iconCreateFunction: createClusterIcon3(), children: /* @__PURE__ */ jsx26(
9373
9314
  GeoJSON4,
9374
9315
  {
9375
9316
  data: processedData,
@@ -9592,7 +9533,7 @@ var MarkerClusterRenderer = memo2(
9592
9533
  return null;
9593
9534
  }
9594
9535
  return /* @__PURE__ */ jsx27(
9595
- MarkerClusterGroup2,
9536
+ MarkerClusterGroup,
9596
9537
  {
9597
9538
  chunkedLoading: true,
9598
9539
  maxClusterRadius: 60,
@@ -9883,7 +9824,7 @@ var TimeSeries = () => {
9883
9824
  const bbox4 = [bounds[1], bounds[0], bounds[3], bounds[2]];
9884
9825
  const years = changeYears != null ? changeYears : taskChangeYears;
9885
9826
  if (years) {
9886
- years.map((year) => __async(this, null, function* () {
9827
+ years.map((year) => __async(null, null, function* () {
9887
9828
  yield getTimeseries(
9888
9829
  year + "-01-01",
9889
9830
  year + "-12-31",
@@ -9918,8 +9859,7 @@ var TimeSeries = () => {
9918
9859
  })
9919
9860
  }
9920
9861
  );
9921
- if (!appendImages)
9922
- setDetailedImgUrls((yield response.json()).images);
9862
+ if (!appendImages) setDetailedImgUrls((yield response.json()).images);
9923
9863
  else {
9924
9864
  response.json().then((res) => {
9925
9865
  setDetailedImgUrls((prevUrls) => [...prevUrls, ...res.images]);
@@ -9963,18 +9903,15 @@ var TimeSeries = () => {
9963
9903
  return 1;
9964
9904
  else if (x.substring(x.split("_")[0].length, x.length) < y.substring(y.split("_")[0].length, y.length))
9965
9905
  return -1;
9966
- else
9967
- return 0;
9906
+ else return 0;
9968
9907
  }).map((x, index) => /* @__PURE__ */ jsx30(
9969
9908
  "button",
9970
9909
  {
9971
9910
  className: currentTab === index ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-gray-200",
9972
9911
  onClick: () => {
9973
9912
  setDetailedImgUrls([]);
9974
- if (x.includes("RGB"))
9975
- fetchImages("TRUE_COLOR" /* RGB */);
9976
- else if (x.includes("FCC"))
9977
- fetchImages("COLOR_INFRARED" /* FCC */);
9913
+ if (x.includes("RGB")) fetchImages("TRUE_COLOR" /* RGB */);
9914
+ else if (x.includes("FCC")) fetchImages("COLOR_INFRARED" /* FCC */);
9978
9915
  setCurrentTab(index);
9979
9916
  },
9980
9917
  children: x.substring(x.split("_")[0].length + 1, x.length)
@@ -9984,7 +9921,7 @@ var TimeSeries = () => {
9984
9921
  !evolandStore.isAnnualAnnotation && /* @__PURE__ */ jsx30(
9985
9922
  "button",
9986
9923
  {
9987
- className: currentTab === -1 ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-primary text-white",
9924
+ className: currentTab === -1 ? "pl-1 pr-5 border-gray-300 text-white" : "pl-1 pr-5 border-gray-300 bg-white text-black",
9988
9925
  onClick: () => setCurrentTab(-1),
9989
9926
  children: "View Annotations"
9990
9927
  }
@@ -9992,7 +9929,7 @@ var TimeSeries = () => {
9992
9929
  ]
9993
9930
  }
9994
9931
  ),
9995
- /* @__PURE__ */ jsx30("div", { className: "overflow-x-scroll", children: taskChangeYears == null ? void 0 : taskChangeYears.map((year) => {
9932
+ currentTab !== -1 && /* @__PURE__ */ jsx30("div", { className: "overflow-x-scroll", children: taskChangeYears == null ? void 0 : taskChangeYears.map((year) => {
9996
9933
  var _a;
9997
9934
  return /* @__PURE__ */ jsxs21(Fragment9, { children: [
9998
9935
  /* @__PURE__ */ jsx30("div", { className: "w-full pt-4", children: year }),
@@ -10002,31 +9939,43 @@ var TimeSeries = () => {
10002
9939
  var _a2;
10003
9940
  return (_a2 = x.minDate) == null ? void 0 : _a2.includes(year);
10004
9941
  })) == null ? void 0 : _a.map((x, index) => {
10005
- var _a2, _b;
9942
+ var _a2, _b, _c;
9943
+ let selected_ref_date = new Date(evolandStore.selectedReferenceDate);
9944
+ let current_date = new Date(x.date);
9945
+ let selected_date;
9946
+ if (selected_ref_date.getMonth() == current_date.getMonth())
9947
+ selected_date = (_a2 = evolandStore.reference_dates) == null ? void 0 : _a2.find((date) => new Date(date).getMonth() + 1 == new Date(x.date).getMonth() + 1);
10006
9948
  return /* @__PURE__ */ jsxs21("div", { children: [
10007
9949
  /* @__PURE__ */ jsx30(
10008
9950
  "img",
10009
9951
  {
10010
- 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" : ""),
9952
+ 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" : ""),
10011
9953
  src: x.imgUrl,
10012
9954
  alt: x.date,
10013
9955
  onClick: () => {
10014
- var _a3, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
9956
+ var _a3, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
10015
9957
  evolandStore.getLegendsDetails(
10016
9958
  !evolandStore.isAnnualAnnotation ? evolandStore.reference_dates && evolandStore.selectedReferenceDate ? (_b2 = evolandStore.annotatedRasterAsset) == null ? void 0 : _b2.buffer[(_a3 = evolandStore.reference_dates) == null ? void 0 : _a3.indexOf(
10017
9959
  x.date
10018
- )] : (_c = evolandStore.annotatedRasterAsset) == null ? void 0 : _c.buffer[0] : (_d = evolandStore.annotatedRasterAsset) == null ? void 0 : _d.buffer
9960
+ )] : (_c2 = evolandStore.annotatedRasterAsset) == null ? void 0 : _c2.buffer[0] : (_d = evolandStore.annotatedRasterAsset) == null ? void 0 : _d.buffer
10019
9961
  );
10020
9962
  if (evolandStore.reference_dates.length > 1) {
10021
- evolandStore.setSelectedReferenceDate(x.date);
9963
+ let selected_date2;
9964
+ if (!((_e = evolandStore.reference_dates) == null ? void 0 : _e.find((date) => date == x.date))) {
9965
+ selected_date2 = (_f = evolandStore.reference_dates) == null ? void 0 : _f.find((date) => new Date(date).getMonth() + 1 == new Date(x.date).getMonth() + 1);
9966
+ evolandStore.setSelectedReferenceDate(selected_date2);
9967
+ } else {
9968
+ evolandStore.setSelectedReferenceDate(x.date);
9969
+ selected_date2 = x.date;
9970
+ }
10022
9971
  evolandStore.setUpdateAsset(true);
10023
9972
  insertEmptyBufferForSingleBand(
10024
- (_h = evolandStore.reference_dates && evolandStore.selectedReferenceDate ? (_f = evolandStore.annotatedRasterAsset) == null ? void 0 : _f.buffer[(_e = evolandStore.reference_dates) == null ? void 0 : _e.indexOf(
9973
+ (_j = evolandStore.reference_dates && evolandStore.selectedReferenceDate ? (_h = evolandStore.annotatedRasterAsset) == null ? void 0 : _h.buffer[(_g = evolandStore.reference_dates) == null ? void 0 : _g.indexOf(
10025
9974
  evolandStore.selectedReferenceDate
10026
- )] : (_g = evolandStore.annotatedRasterAsset) == null ? void 0 : _g.buffer[0]) == null ? void 0 : _h.length,
10027
- (_i = evolandStore.annotatedRasterAsset) == null ? void 0 : _i.width,
10028
- (_j = evolandStore.annotatedRasterAsset) == null ? void 0 : _j.height,
10029
- (_k = evolandStore.reference_dates) == null ? void 0 : _k.indexOf(x.date),
9975
+ )] : (_i = evolandStore.annotatedRasterAsset) == null ? void 0 : _i.buffer[0]) == null ? void 0 : _j.length,
9976
+ (_k = evolandStore.annotatedRasterAsset) == null ? void 0 : _k.width,
9977
+ (_l = evolandStore.annotatedRasterAsset) == null ? void 0 : _l.height,
9978
+ (_m = evolandStore.reference_dates) == null ? void 0 : _m.indexOf(selected_date2),
10030
9979
  evolandStore.annotatedRasterAsset,
10031
9980
  evolandStore.labels,
10032
9981
  evolandStore.isAnnualAnnotation
@@ -10059,7 +10008,7 @@ var TimeSeries = () => {
10059
10008
  /* @__PURE__ */ jsx30(
10060
10009
  "div",
10061
10010
  {
10062
- 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" : ""),
10011
+ 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" : ""),
10063
10012
  children: x.date
10064
10013
  }
10065
10014
  )
@@ -10068,7 +10017,7 @@ var TimeSeries = () => {
10068
10017
  ] })
10069
10018
  ] });
10070
10019
  }) }),
10071
- currentTab == -1 && /* @__PURE__ */ jsxs21("div", { className: "overflow-x-scroll flex flex-row", children: [
10020
+ currentTab == -1 && /* @__PURE__ */ jsxs21("div", { className: "overflow-x-scroll flex flex-row pt-4", children: [
10072
10021
  !evolandStore.annotatedRasterAsset && /* @__PURE__ */ jsx30("div", { children: "No annotation" }),
10073
10022
  evolandStore.annotatedRasterAsset && evolandStore.annotation_dates && evolandStore.annotation_dates.map(
10074
10023
  (annotationDate, index) => {
@@ -10239,10 +10188,9 @@ var Questions = (props) => {
10239
10188
  userUserAlias: !localStorage.getItem("searchUser") ? null : localStorage.getItem("searchUser"),
10240
10189
  locationLocationId: null
10241
10190
  });
10242
- const onSubmit = (taskStatus) => __async(void 0, null, function* () {
10191
+ const onSubmit = (taskStatus) => __async(null, null, function* () {
10243
10192
  var _a2, _b2, _c2, _d2, _e2;
10244
- if (disableSubmit)
10245
- return;
10193
+ if (disableSubmit) return;
10246
10194
  setDisableSubmit(true);
10247
10195
  setStatus(taskStatus[0]);
10248
10196
  if (evolandStore.currentTask) {
@@ -10274,8 +10222,7 @@ var Questions = (props) => {
10274
10222
  if (props.userRole === "admin") {
10275
10223
  if (tasks == null ? void 0 : tasks.task)
10276
10224
  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" : ""}`;
10277
- else
10278
- alert("No more tasks to review");
10225
+ else alert("No more tasks to review");
10279
10226
  }
10280
10227
  var res = yield evolandStore.getNextLocationDetails(
10281
10228
  parseInt(projectId)
@@ -10298,7 +10245,7 @@ var Questions = (props) => {
10298
10245
  setSubmitNotificationMessage("");
10299
10246
  }
10300
10247
  });
10301
- const onSave = () => __async(void 0, null, function* () {
10248
+ const onSave = () => __async(null, null, function* () {
10302
10249
  if (evolandStore.currentTask) {
10303
10250
  const saveQuestionnaireReq = {
10304
10251
  task_id: evolandStore.currentTask.task_id,
@@ -10317,8 +10264,7 @@ var Questions = (props) => {
10317
10264
  setSubmitNotificationMessage(
10318
10265
  "Questionnaire has been SAVED successfully"
10319
10266
  );
10320
- else
10321
- setSubmitNotificationMessage("Please try again");
10267
+ else setSubmitNotificationMessage("Please try again");
10322
10268
  setSubmitNotification(true);
10323
10269
  }
10324
10270
  } catch (err) {
@@ -10351,8 +10297,7 @@ var Questions = (props) => {
10351
10297
  "<" + key + ">",
10352
10298
  "" + (label == null ? void 0 : label.labelName)
10353
10299
  );
10354
- } else
10355
- y.text = y.text.replace("<" + key + ">", "" + value);
10300
+ } else y.text = y.text.replace("<" + key + ">", "" + value);
10356
10301
  });
10357
10302
  });
10358
10303
  }
@@ -10398,15 +10343,14 @@ var Questions = (props) => {
10398
10343
  if (props.userRole === "admin")
10399
10344
  if (tasks == null ? void 0 : tasks.task)
10400
10345
  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" : ""}`;
10401
- else
10402
- alert("No more tasks to review");
10346
+ else alert("No more tasks to review");
10403
10347
  } else
10404
10348
  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}`;
10405
10349
  }
10406
10350
  if (IsQuestionnaireLoading || IsTaskAnswerLoading || !((_g = evolandStore.location) == null ? void 0 : _g.result))
10407
10351
  return /* @__PURE__ */ jsx31(LoaderFull8, {});
10408
10352
  return /* @__PURE__ */ jsxs22("div", { children: [
10409
- /* @__PURE__ */ jsx31("div", { children: context && (context == null ? void 0 : context.map((x) => /* @__PURE__ */ jsx31("div", { className: "m-5 w-full", children: x.text }))) }),
10353
+ /* @__PURE__ */ jsx31("div", { children: context && (context == null ? void 0 : context.map((x) => /* @__PURE__ */ jsx31("div", { className: "m-5 w-full", children: x.text }, x.id))) }),
10410
10354
  /* @__PURE__ */ jsx31(
10411
10355
  "div",
10412
10356
  {
@@ -10448,8 +10392,8 @@ var Questions = (props) => {
10448
10392
  }
10449
10393
  ),
10450
10394
  /* @__PURE__ */ jsx31(Label, { htmlFor: "r1", children: y.text })
10451
- ] })) })
10452
- ] }) });
10395
+ ] }, y.id)) })
10396
+ ] }) }, x.id);
10453
10397
  })),
10454
10398
  singleChoice && userAnswers.length > 0 && ((_i = singleChoice == null ? void 0 : singleChoice.filter(
10455
10399
  (ques) => userAnswers == null ? void 0 : userAnswers.some(
@@ -10479,8 +10423,8 @@ var Questions = (props) => {
10479
10423
  }
10480
10424
  ),
10481
10425
  /* @__PURE__ */ jsx31(Label, { htmlFor: "r1", children: y.text })
10482
- ] })) })
10483
- ] }) });
10426
+ ] }, y.id)) })
10427
+ ] }) }, x.id);
10484
10428
  }))
10485
10429
  ] })
10486
10430
  }
@@ -10514,8 +10458,7 @@ var Questions = (props) => {
10514
10458
  evolandStore.setComment(
10515
10459
  evolandStore.comment.replace(" #" + x, "")
10516
10460
  );
10517
- else
10518
- evolandStore.setComment("#" + x + " ");
10461
+ else evolandStore.setComment("#" + x + " ");
10519
10462
  },
10520
10463
  children: [
10521
10464
  "#",
@@ -10548,8 +10491,7 @@ var Questions = (props) => {
10548
10491
  onClick: () => {
10549
10492
  if (TaskState2[x[0]] !== TaskState2.SKIPPED && TaskState2[x[0]] !== TaskState2.DISCARDED && TaskState2[x[0]] !== TaskState2.USER_DISCARDED && userAnswers.length !== requiredUserAnswers)
10550
10493
  alert("Please provide all answers");
10551
- else
10552
- onSubmit(x);
10494
+ else onSubmit(x);
10553
10495
  },
10554
10496
  children: TaskState2[x[0]]
10555
10497
  }
@@ -10614,8 +10556,7 @@ var OverlayLayer = () => {
10614
10556
  if (e.target.value !== "0") {
10615
10557
  layerStore.setSelectedLayer(e.target.value);
10616
10558
  setShowLayerOpacity(true);
10617
- if (layerStore.layerOpacity == 0)
10618
- layerStore.setLayerOpacity(0.4);
10559
+ if (layerStore.layerOpacity == 0) layerStore.setLayerOpacity(0.4);
10619
10560
  } else {
10620
10561
  setShowLayerOpacity(false);
10621
10562
  layerStore.setSelectedLayer("");
@@ -10659,7 +10600,7 @@ import { HotkeysProvider } from "react-hotkeys-hook";
10659
10600
  import { Fragment as Fragment11, jsx as jsx33, jsxs as jsxs24 } from "react/jsx-runtime";
10660
10601
  var GeoWikiMapComponent = ({ mapSettings, session }) => {
10661
10602
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
10662
- const mapRef = useRef4();
10603
+ const mapRef = useRef4(void 0);
10663
10604
  const router = useRouter6();
10664
10605
  var projectId = router.query.projectId;
10665
10606
  var locationId = router.query.locationId;
@@ -10766,7 +10707,7 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
10766
10707
  children: "Guide"
10767
10708
  }
10768
10709
  ) }),
10769
- /* @__PURE__ */ jsxs24(LayersControl, { position: "topright", children: [
10710
+ /* @__PURE__ */ jsx33("div", { children: /* @__PURE__ */ jsxs24(LayersControl, { position: "topright", children: [
10770
10711
  /* @__PURE__ */ jsx33(LayersControl.BaseLayer, { name: "Esri World imagery", children: /* @__PURE__ */ jsx33(
10771
10712
  TileLayer2,
10772
10713
  {
@@ -10801,27 +10742,33 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
10801
10742
  maxZoom: 21
10802
10743
  }
10803
10744
  ) }),
10804
- /* @__PURE__ */ jsx33(RequireFeature, { feature: "GeoWiki.EvoLand", children: wmsLayerNames == null ? void 0 : wmsLayerNames.layers.map((layer) => /* @__PURE__ */ jsx33(
10805
- LayersControl.Overlay,
10806
- {
10807
- checked: layer.layerName == layerStore.selectedLayer,
10808
- name: layer.layerName,
10809
- children: /* @__PURE__ */ jsx33(
10810
- CustomWMSTileLayer,
10811
- {
10812
- transparent: true,
10813
- zIndex: 100,
10814
- layers: layer.layerName,
10815
- attribution: "GeoWiki",
10816
- format: "image/png",
10817
- url: "https://services.terrascope.be/wms/v2",
10818
- opacity: layer.opacity == void 0 ? layerStore.layerOpacity : layer.opacity
10819
- }
10820
- )
10821
- },
10822
- layer.layerName
10823
- )) })
10824
- ] }),
10745
+ /* @__PURE__ */ jsx33(RequireFeature, { feature: "GeoWiki.EvoLand", children: wmsLayerNames == null ? void 0 : wmsLayerNames.layers.map((layer) => {
10746
+ const len = layer.layerDescription.split(" ").length;
10747
+ const year = layer.layerDescription.split(" ")[len - 1];
10748
+ return /* @__PURE__ */ jsx33(
10749
+ LayersControl.Overlay,
10750
+ {
10751
+ checked: layer.layerName == layerStore.selectedLayer,
10752
+ name: layer.layerName,
10753
+ children: /* @__PURE__ */ jsx33(
10754
+ CustomWMSTileLayer,
10755
+ {
10756
+ transparent: true,
10757
+ zIndex: 100,
10758
+ layers: layer.layerName,
10759
+ attribution: "GeoWiki",
10760
+ format: "image/png",
10761
+ version: "1.3.0",
10762
+ crs: CRS.EPSG3857,
10763
+ url: `https://titiler.terrascope.be/wms?time=${year}-01-01`,
10764
+ opacity: layer.opacity == void 0 ? layerStore.layerOpacity : layer.opacity
10765
+ }
10766
+ )
10767
+ },
10768
+ layer.layerName
10769
+ );
10770
+ }) })
10771
+ ] }) }),
10825
10772
  /* @__PURE__ */ jsx33(LayerGroup, { children: /* @__PURE__ */ jsx33(LayerStoreList, {}) }),
10826
10773
  /* @__PURE__ */ jsxs24(RequireFeature, { feature: "GeoWiki.EvoLand", children: [
10827
10774
  /* @__PURE__ */ jsx33(EvolandContainer, { sessionStatus: session.status }),
@@ -10838,7 +10785,7 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
10838
10785
  viewBox: "0 0 24 24",
10839
10786
  xmlns: "http://www.w3.org/2000/svg",
10840
10787
  fill: "#000000",
10841
- className: "w-7 h-7 bg-white mb-2 hover:cursor-pointer",
10788
+ className: "w-7 h-7 bg-white mb-2 hover:cursor-pointer rounded-md p-1",
10842
10789
  onClick: () => {
10843
10790
  evolandStore.setShowTimeSeries(
10844
10791
  !evolandStore.showTimeSeries
@@ -10871,7 +10818,7 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
10871
10818
  viewBox: "0 0 24 24",
10872
10819
  strokeWidth: "1.5",
10873
10820
  stroke: "currentColor",
10874
- className: "w-7 h-7 mb-2 bg-white hover:cursor-pointer",
10821
+ className: "w-7 h-7 mb-2 bg-white hover:cursor-pointer rounded-md",
10875
10822
  children: [
10876
10823
  /* @__PURE__ */ jsx33(
10877
10824
  "path",
@@ -10909,7 +10856,7 @@ var GeoWikiMapComponent = ({ mapSettings, session }) => {
10909
10856
  viewBox: "0 0 24 24",
10910
10857
  strokeWidth: "1.5",
10911
10858
  stroke: "currentColor",
10912
- className: "w-7 h-7 bg-white hover:cursor-pointer",
10859
+ className: "w-7 h-7 bg-white hover:cursor-pointer rounded-md",
10913
10860
  onClick: () => {
10914
10861
  evolandStore.onRecenterLocation();
10915
10862
  },
@@ -11067,7 +11014,7 @@ export {
11067
11014
  parseMapMenuItems,
11068
11015
  BetterWMS,
11069
11016
  CustomWMSTileLayer,
11070
- MarkerClusterGroup2 as MarkerClusterGroup,
11017
+ MarkerClusterGroup,
11071
11018
  GeoJsonLayer,
11072
11019
  useCustomLayerStore,
11073
11020
  statusColorMap,