bbl-mapbox-react 0.0.18 → 0.0.19

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.mjs CHANGED
@@ -4167,9 +4167,9 @@ function detectVectorSource(e) {
4167
4167
  };
4168
4168
  return null;
4169
4169
  }
4170
- function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes: i = [], defaultMinWidth: c = 0, source: l, sourceLayer: u, className: d = "", style: f }) {
4171
- let [g, _] = useState(!1), [v, y] = useState(i), [b, x] = useState(!1), S = useRef(null), C = useRef(null), w = useRef(null), T = useCallback((e, t, n) => {
4172
- if (!e.isStyleLoaded()) return !1;
4170
+ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes: i = [], defaultMinWidth: c = 0, source: l, sourceLayer: u, classField: d = "class", className: f = "", style: g }) {
4171
+ let [_, v] = useState(!1), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(!1), ve = useRef(null), w = useRef(null), T = useRef(null), E = useCallback((e, t, n) => {
4172
+ if (!e.isStyleLoaded() || !e.getSource(t)) return !1;
4173
4173
  let i = !0;
4174
4174
  return ROAD_TYPE_OPTIONS.forEach((a) => {
4175
4175
  let o = `${LAYER_ID_PREFIX}${a.class}`;
@@ -4181,7 +4181,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4181
4181
  "source-layer": n,
4182
4182
  filter: [
4183
4183
  "==",
4184
- ["get", "class"],
4184
+ ["get", d],
4185
4185
  a.class
4186
4186
  ],
4187
4187
  paint: {
@@ -4195,7 +4195,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4195
4195
  console.error(`Failed to add road highlight layer for ${a.class}:`, e), i = !1;
4196
4196
  }
4197
4197
  }), i;
4198
- }, [r]);
4198
+ }, [r, d]);
4199
4199
  useEffect(() => {
4200
4200
  if (!e) return;
4201
4201
  let t = () => {
@@ -4204,25 +4204,27 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4204
4204
  let r = detectVectorSource(e);
4205
4205
  r && (console.log("Auto-detected vector source:", r), t ||= r.source, n ||= r.sourceLayer);
4206
4206
  }
4207
- t && n ? T(e, t, n) && x(!0) : console.warn("No vector source found for road highlighting");
4207
+ t && n ? E(e, t, n) && (C.current = !0, S(!0)) : console.warn("No vector source found for road highlighting");
4208
4208
  };
4209
4209
  e.isStyleLoaded() ? t() : e.once("load", t);
4210
4210
  let n = () => {
4211
4211
  e.isStyleLoaded() && t();
4212
+ }, r = () => {
4213
+ C.current || t();
4212
4214
  };
4213
- return e.on("styledata", n), () => {
4214
- e.off("styledata", n);
4215
+ return e.on("styledata", n), e.on("sourcedata", r), () => {
4216
+ e.off("styledata", n), e.off("sourcedata", r);
4215
4217
  };
4216
4218
  }, [
4217
4219
  e,
4218
4220
  l,
4219
4221
  u,
4220
- T
4222
+ E
4221
4223
  ]), useEffect(() => {
4222
- !e || !b || ROAD_TYPE_OPTIONS.forEach((t) => {
4224
+ !e || !x || ROAD_TYPE_OPTIONS.forEach((t) => {
4223
4225
  let n = `${LAYER_ID_PREFIX}${t.class}`;
4224
4226
  if (e.getLayer(n)) try {
4225
- let r = v.includes(t.class);
4227
+ let r = y.includes(t.class);
4226
4228
  e.setLayoutProperty(n, "visibility", r ? "visible" : "none");
4227
4229
  } catch (e) {
4228
4230
  console.error(`Failed to update layer ${n}:`, e);
@@ -4230,38 +4232,38 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4230
4232
  });
4231
4233
  }, [
4232
4234
  e,
4233
- b,
4234
- v
4235
+ x,
4236
+ y
4235
4237
  ]), useEffect(() => {
4236
- if (!g) return;
4238
+ if (!_) return;
4237
4239
  let e = (e) => {
4238
- S.current && !S.current.contains(e.target) && C.current && !C.current.contains(e.target) && _(!1);
4240
+ ve.current && !ve.current.contains(e.target) && w.current && !w.current.contains(e.target) && v(!1);
4239
4241
  }, t = setTimeout(() => {
4240
4242
  document.addEventListener("mousedown", e);
4241
4243
  }, 0);
4242
4244
  return () => {
4243
4245
  clearTimeout(t), document.removeEventListener("mousedown", e);
4244
4246
  };
4245
- }, [g]), useEffect(() => () => {
4247
+ }, [_]), useEffect(() => () => {
4246
4248
  e && e.getStyle() && ROAD_TYPE_OPTIONS.forEach((t) => {
4247
4249
  let n = `${LAYER_ID_PREFIX}${t.class}`;
4248
4250
  if (e.getLayer(n)) try {
4249
4251
  e.removeLayer(n);
4250
4252
  } catch {}
4251
- }), w.current &&= (w.current.remove(), null);
4253
+ }), T.current &&= (T.current.remove(), null);
4252
4254
  }, [e]);
4253
- let E = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), D = useCallback((t) => {
4254
- if (!e || v.length === 0) {
4255
- w.current && w.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4255
+ let ye = useCallback((e) => ROAD_TYPE_OPTIONS.find((t) => t.class === e)?.label || e, []), be = useCallback((t) => {
4256
+ if (!e || y.length === 0) {
4257
+ T.current && T.current.remove(), e?.getCanvas().style.cursor && (e.getCanvas().style.cursor = "");
4256
4258
  return;
4257
4259
  }
4258
- let n = v.map((e) => `${LAYER_ID_PREFIX}${e}`), r = [[t.point.x - 10, t.point.y - 10], [t.point.x + 10, t.point.y + 10]], i = e.queryRenderedFeatures(r, { layers: n.filter((t) => e.getLayer(t)) });
4260
+ let n = y.map((e) => `${LAYER_ID_PREFIX}${e}`), r = [[t.point.x - 10, t.point.y - 10], [t.point.x + 10, t.point.y + 10]], i = e.queryRenderedFeatures(r, { layers: n.filter((t) => e.getLayer(t)) });
4259
4261
  if (i.length > 0) {
4260
4262
  let n = i[0].properties || {}, r = t.lngLat, a = n.name || n.name_en || n.name_local || "", o = n.class || "", c = n.type || "", l = n.structure || "", u = n.oneway, d = n.layer, f = n.iso_3166_1 || "", p = n.iso_3166_2 || "", m = (e) => !(e == null || e === "" || typeof e == "string" && e.toLowerCase() === "none"), h = [];
4261
4263
  m(o) && h.push(`
4262
4264
  <div class="road-highlight-popup__row">
4263
4265
  <span>道路类型:</span>
4264
- <span class="road-highlight-popup__value">${E(o)}</span>
4266
+ <span class="road-highlight-popup__value">${ye(o)}</span>
4265
4267
  </div>
4266
4268
  `), h.push(`
4267
4269
  <div class="road-highlight-popup__row">
@@ -4310,47 +4312,47 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4310
4312
  <div class="road-highlight-popup__info">${h.join("")}</div>
4311
4313
  </div>
4312
4314
  `;
4313
- w.current ||= new mapboxgl.Popup({
4315
+ T.current ||= new mapboxgl.Popup({
4314
4316
  closeButton: !1,
4315
4317
  closeOnClick: !1,
4316
4318
  offset: 15,
4317
4319
  className: "road-highlight-popup"
4318
- }), w.current.setLngLat(r).setHTML(g).addTo(e), e.getCanvas().style.cursor = "pointer";
4319
- } else w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4320
+ }), T.current.setLngLat(r).setHTML(g).addTo(e), e.getCanvas().style.cursor = "pointer";
4321
+ } else T.current && T.current.remove(), e.getCanvas().style.cursor = "";
4320
4322
  }, [
4321
4323
  e,
4322
- v,
4323
- E
4324
+ y,
4325
+ ye
4324
4326
  ]);
4325
4327
  useEffect(() => {
4326
- if (!(!e || !b)) return e.on("mousemove", D), () => {
4327
- e.off("mousemove", D), w.current && w.current.remove(), e.getCanvas().style.cursor = "";
4328
+ if (!(!e || !x)) return e.on("mousemove", be), () => {
4329
+ e.off("mousemove", be), T.current && T.current.remove(), e.getCanvas().style.cursor = "";
4328
4330
  };
4329
4331
  }, [
4330
4332
  e,
4331
- b,
4332
- D
4333
+ x,
4334
+ be
4333
4335
  ]);
4334
- let ve = (e, t) => {
4335
- y((n) => t ? [...n, e] : n.filter((t) => t !== e));
4336
- }, ye = (e) => {
4337
- y(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4338
- }, k = v.length > 0;
4336
+ let O = (e, t) => {
4337
+ b((n) => t ? [...n, e] : n.filter((t) => t !== e));
4338
+ }, xe = (e) => {
4339
+ b(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
4340
+ }, Se = y.length > 0;
4339
4341
  return /* @__PURE__ */ jsxs("div", {
4340
- className: `mapbox-road-highlight-control ${d}`,
4341
- style: f,
4342
+ className: `mapbox-road-highlight-control ${f}`,
4343
+ style: g,
4342
4344
  children: [/* @__PURE__ */ jsxs("button", {
4343
- ref: C,
4344
- className: `mapbox-control-btn mapbox-road-highlight-control__btn ${k ? "mapbox-road-highlight-control__btn--active" : ""}`,
4345
- onClick: () => _(!g),
4346
- title: `路网高亮${v.length > 0 ? ` (已选 ${v.length})` : ""}`,
4345
+ ref: w,
4346
+ className: `mapbox-control-btn mapbox-road-highlight-control__btn ${Se ? "mapbox-road-highlight-control__btn--active" : ""}`,
4347
+ onClick: () => v(!_),
4348
+ title: `路网高亮${y.length > 0 ? ` (已选 ${y.length})` : ""}`,
4347
4349
  children: [/* @__PURE__ */ jsx("img", {
4348
4350
  src: road_default,
4349
4351
  alt: "road",
4350
4352
  className: "mapbox-road-highlight-control__btn-icon"
4351
- }), /* @__PURE__ */ jsxs("span", { children: ["路网", v.length > 0 ? ` (${v.length})` : ""] })]
4352
- }), g && /* @__PURE__ */ jsxs("div", {
4353
- ref: S,
4353
+ }), /* @__PURE__ */ jsxs("span", { children: ["路网", y.length > 0 ? ` (${y.length})` : ""] })]
4354
+ }), _ && /* @__PURE__ */ jsxs("div", {
4355
+ ref: ve,
4354
4356
  className: "mapbox-road-highlight-control__panel",
4355
4357
  children: [
4356
4358
  /* @__PURE__ */ jsxs("div", {
@@ -4359,9 +4361,9 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4359
4361
  className: "mapbox-road-highlight-control__panel-title",
4360
4362
  children: "道路类型"
4361
4363
  }), /* @__PURE__ */ jsx(Checkbox, {
4362
- checked: v.length === ROAD_TYPE_OPTIONS.length,
4363
- indeterminate: v.length > 0 && v.length < ROAD_TYPE_OPTIONS.length,
4364
- onChange: ye,
4364
+ checked: y.length === ROAD_TYPE_OPTIONS.length,
4365
+ indeterminate: y.length > 0 && y.length < ROAD_TYPE_OPTIONS.length,
4366
+ onChange: xe,
4365
4367
  style: {
4366
4368
  "--color-text-1": "#fff",
4367
4369
  "--color-border-2": "rgba(255, 255, 255, 0.3)"
@@ -4378,11 +4380,11 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4378
4380
  className: "mapbox-road-highlight-control__type-list",
4379
4381
  children: ROAD_TYPE_OPTIONS.map((e) => /* @__PURE__ */ jsxs("div", {
4380
4382
  className: "mapbox-road-highlight-control__type-item",
4381
- onClick: () => ve(e.class, !v.includes(e.class)),
4383
+ onClick: () => O(e.class, !y.includes(e.class)),
4382
4384
  children: [
4383
4385
  /* @__PURE__ */ jsx(Checkbox, {
4384
- checked: v.includes(e.class),
4385
- onChange: (t) => ve(e.class, t),
4386
+ checked: y.includes(e.class),
4387
+ onChange: (t) => O(e.class, t),
4386
4388
  onClick: (e) => e.stopPropagation(),
4387
4389
  style: {
4388
4390
  "--color-text-1": "#fff",
@@ -4407,7 +4409,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
4407
4409
  className: "mapbox-road-highlight-control__tip",
4408
4410
  children: "💡 选中道路类型后立即显示高亮"
4409
4411
  }),
4410
- !b && /* @__PURE__ */ jsx("div", {
4412
+ !x && /* @__PURE__ */ jsx("div", {
4411
4413
  className: "mapbox-road-highlight-control__warning",
4412
4414
  children: "⚠️ 正在初始化图层..."
4413
4415
  })
@@ -4664,38 +4666,38 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4664
4666
  showArea: r.showArea ?? !0,
4665
4667
  showLength: r.showLength ?? !0,
4666
4668
  showRadius: r.showRadius ?? !0
4667
- } : _, [x, S] = useState([]), C = useRef(/* @__PURE__ */ new Map()), T = useRef(0), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef(null), A = useRef(null), j = useRef([]), M = useRef([]), N = useRef(b);
4668
- N.current = b;
4669
- let Ce = useRef(f);
4670
- Ce.current = f;
4671
- let P = useCallback(() => `measure-${++T.current}`, []);
4669
+ } : _, [x, S] = useState([]), C = useRef(/* @__PURE__ */ new Map()), w = useRef(0), T = useRef(null), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef(null), A = useRef([]), j = useRef([]), M = useRef(b);
4670
+ M.current = b;
4671
+ let we = useRef(f);
4672
+ we.current = f;
4673
+ let N = useCallback(() => `measure-${++w.current}`, []);
4672
4674
  useEffect(() => {
4673
4675
  s?.(f !== null);
4674
4676
  }, [f, s]);
4675
- let we = useRef(!1), Te = useCallback(() => {
4676
- !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), we.current = !0);
4677
+ let Te = useRef(!1), Ee = useCallback(() => {
4678
+ !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Te.current = !0);
4677
4679
  }, [e]);
4678
4680
  useEffect(() => {
4679
4681
  if (!e) return;
4680
4682
  let t = () => {
4681
- initAllPreviewLayers(e), we.current = !0;
4683
+ initAllPreviewLayers(e), Te.current = !0;
4682
4684
  };
4683
4685
  e.isStyleLoaded() ? t() : e.once("load", t);
4684
4686
  let n = () => {
4685
- we.current = !1;
4687
+ Te.current = !1;
4686
4688
  };
4687
4689
  return e.on("style.load", n), () => {
4688
4690
  e.off("style.load", n);
4689
4691
  };
4690
4692
  }, [e]), useEffect(() => {
4691
4693
  let e = (e) => {
4692
- E.current && !E.current.contains(e.target) && D.current && !D.current.contains(e.target) && d(!1);
4694
+ T.current && !T.current.contains(e.target) && E.current && !E.current.contains(e.target) && d(!1);
4693
4695
  };
4694
4696
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
4695
4697
  }, []);
4696
- let F = useCallback((t) => {
4698
+ let P = useCallback((t) => {
4697
4699
  if (!e) return;
4698
- let n = applyEntityConfig(t, N.current), r = null;
4700
+ let n = applyEntityConfig(t, M.current), r = null;
4699
4701
  if (n.type === "circle" ? r = new CircleRenderer(e, n) : n.type === "square" ? r = new SquareRenderer(e, n) : n.type === "rectangle" ? r = new RectangleRenderer(e, n) : n.type === "polygon" ? r = new PolygonRenderer(e, n) : n.type === "polyline" && (r = new PolylineRenderer(e, n)), r) {
4700
4702
  C.current.set(n.id, r);
4701
4703
  let e = {
@@ -4706,12 +4708,12 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4706
4708
  };
4707
4709
  S((t) => [...t, e]);
4708
4710
  }
4709
- }, [e]), Ee = useCallback((e) => {
4711
+ }, [e]), De = useCallback((e) => {
4710
4712
  let t = C.current.get(e);
4711
4713
  t && (t.destroy(), C.current.delete(e)), S((t) => t.filter((t) => t.entity.id !== e));
4712
- }, []), De = useCallback(() => {
4714
+ }, []), Oe = useCallback(() => {
4713
4715
  C.current.forEach((e) => e.destroy()), C.current.clear(), S([]);
4714
- }, []), Oe = useCallback((t) => {
4716
+ }, []), ke = useCallback((t) => {
4715
4717
  if (!e) return;
4716
4718
  let n = C.current.get(t);
4717
4719
  if (!n) return;
@@ -4721,9 +4723,9 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4721
4723
  maxZoom: 18,
4722
4724
  duration: 1e3
4723
4725
  });
4724
- }, [e]), ke = useCallback((e, t) => {
4726
+ }, [e]), Ae = useCallback((e, t) => {
4725
4727
  let n = {
4726
- ...N.current,
4728
+ ...M.current,
4727
4729
  [e]: t
4728
4730
  };
4729
4731
  y ? i?.({ ...n }) : v(n), S((t) => t.map((t) => {
@@ -4735,7 +4737,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4735
4737
  entity: i
4736
4738
  };
4737
4739
  }));
4738
- }, [y, i]), Ae = useCallback((t, n) => {
4740
+ }, [y, i]), je = useCallback((t, n) => {
4739
4741
  if (!e) return;
4740
4742
  let [r, i] = t, [a, o] = n, s = [
4741
4743
  [Math.min(r, a), Math.max(i, o)],
@@ -4754,7 +4756,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4754
4756
  });
4755
4757
  let l = e.getSource(`${PREVIEW_PREFIX}rect-preview-measure-source`);
4756
4758
  if (l) {
4757
- let e = N.current, t = [], n = s[0], r = s[1], i = s[2];
4759
+ let e = M.current, t = [], n = s[0], r = s[1], i = s[2];
4758
4760
  if (e?.showArea) {
4759
4761
  let e = distance(n, r), a = distance(r, i);
4760
4762
  t.push({
@@ -4785,7 +4787,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4785
4787
  features: t
4786
4788
  });
4787
4789
  }
4788
- }, [e]), je = useCallback((t, n) => {
4790
+ }, [e]), Me = useCallback((t, n) => {
4789
4791
  if (!e) return;
4790
4792
  let r = calculateDistance(t, n), i = createCirclePolygon(t, r), a = e.getSource(`${PREVIEW_PREFIX}circle-preview-source`);
4791
4793
  a && a.setData({
@@ -4796,7 +4798,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4796
4798
  },
4797
4799
  properties: {}
4798
4800
  });
4799
- let o = N.current, s = [], c = [];
4801
+ let o = M.current, s = [], c = [];
4800
4802
  if (o?.showArea && s.push({
4801
4803
  type: "Feature",
4802
4804
  geometry: {
@@ -4832,7 +4834,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4832
4834
  type: "FeatureCollection",
4833
4835
  features: c
4834
4836
  });
4835
- }, [e]), Me = useCallback((t, n) => {
4837
+ }, [e]), Ne = useCallback((t, n) => {
4836
4838
  if (!e) return;
4837
4839
  let r = calculateDistance(t, n) * 2, i = createSquareCoords(t, r), a = e.getSource(`${PREVIEW_PREFIX}square-preview-source`);
4838
4840
  a && a.setData({
@@ -4845,7 +4847,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4845
4847
  });
4846
4848
  let o = e.getSource(`${PREVIEW_PREFIX}square-preview-measure-source`);
4847
4849
  if (o) {
4848
- let e = N.current, n = [];
4850
+ let e = M.current, n = [];
4849
4851
  if (e?.showArea && n.push({
4850
4852
  type: "Feature",
4851
4853
  geometry: {
@@ -4869,7 +4871,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4869
4871
  features: n
4870
4872
  });
4871
4873
  }
4872
- }, [e]), Ne = useCallback((t, n) => {
4874
+ }, [e]), Pe = useCallback((t, n) => {
4873
4875
  if (!e) return;
4874
4876
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polygon-preview-source`);
4875
4877
  i && (r.length >= 3 ? i.setData({
@@ -4904,7 +4906,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4904
4906
  });
4905
4907
  let o = e.getSource(`${PREVIEW_PREFIX}polygon-preview-measure-source`);
4906
4908
  if (o) {
4907
- let e = N.current, t = [];
4909
+ let e = M.current, t = [];
4908
4910
  if (e?.showArea && r.length >= 3) {
4909
4911
  let e = polygonArea([...r, r[0]]), n = 0, i = 0;
4910
4912
  for (let e of r) n += e[0], i += e[1];
@@ -4946,7 +4948,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4946
4948
  features: t
4947
4949
  });
4948
4950
  }
4949
- }, [e]), I = useCallback((t, n) => {
4951
+ }, [e]), F = useCallback((t, n) => {
4950
4952
  if (!e) return;
4951
4953
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polyline-preview-source`);
4952
4954
  i && (r.length >= 2 ? i.setData({
@@ -4974,7 +4976,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4974
4976
  });
4975
4977
  let o = e.getSource(`${PREVIEW_PREFIX}polyline-preview-measure-source`);
4976
4978
  if (o) {
4977
- let e = N.current, t = [];
4979
+ let e = M.current, t = [];
4978
4980
  if (e?.showLength && r.length >= 2) for (let e = 0; e < r.length - 1; e++) {
4979
4981
  let n = r[e], i = r[e + 1];
4980
4982
  t.push({
@@ -4994,117 +4996,117 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
4994
4996
  }, [e]);
4995
4997
  useEffect(() => {
4996
4998
  if (!e || !f) return;
4997
- Te(), e.getCanvas().style.cursor = "crosshair";
4999
+ Ee(), e.getCanvas().style.cursor = "crosshair";
4998
5000
  let t = (t) => {
4999
- let n = [t.lngLat.lng, t.lngLat.lat], r = Ce.current;
5001
+ let n = [t.lngLat.lng, t.lngLat.lat], r = we.current;
5000
5002
  if (r === "rectangle") {
5001
- let t = O.current;
5002
- if (!t) O.current = n;
5003
+ let t = D.current;
5004
+ if (!t) D.current = n;
5003
5005
  else {
5004
5006
  let r = {
5005
- id: P(),
5007
+ id: N(),
5006
5008
  type: "rectangle",
5007
5009
  bounds: [t, n]
5008
5010
  };
5009
- F(r), O.current = null, clearAllPreviewSources(e), g(null);
5011
+ P(r), D.current = null, clearAllPreviewSources(e), g(null);
5010
5012
  }
5011
5013
  } else if (r === "circle") {
5012
- let t = k.current;
5013
- if (!t) k.current = { center: n };
5014
+ let t = O.current;
5015
+ if (!t) O.current = { center: n };
5014
5016
  else {
5015
5017
  let r = calculateDistance(t.center, n), i = {
5016
- id: P(),
5018
+ id: N(),
5017
5019
  type: "circle",
5018
5020
  center: t.center,
5019
5021
  radius: r
5020
5022
  };
5021
- F(i), k.current = null, clearAllPreviewSources(e), g(null);
5023
+ P(i), O.current = null, clearAllPreviewSources(e), g(null);
5022
5024
  }
5023
5025
  } else if (r === "square") {
5024
- let t = A.current;
5025
- if (!t) A.current = { center: n };
5026
+ let t = k.current;
5027
+ if (!t) k.current = { center: n };
5026
5028
  else {
5027
5029
  let r = calculateDistance(t.center, n) * 2, i = {
5028
- id: P(),
5030
+ id: N(),
5029
5031
  type: "square",
5030
5032
  center: t.center,
5031
5033
  length: r
5032
5034
  };
5033
- F(i), A.current = null, clearAllPreviewSources(e), g(null);
5035
+ P(i), k.current = null, clearAllPreviewSources(e), g(null);
5034
5036
  }
5035
5037
  } else if (r === "polygon") {
5036
- let t = j.current;
5038
+ let t = A.current;
5037
5039
  if (t.length >= 3 && calculateDistance(t[0], n) < 20) {
5038
5040
  let n = {
5039
- id: P(),
5041
+ id: N(),
5040
5042
  type: "polygon",
5041
5043
  coordinates: [...t]
5042
5044
  };
5043
- F(n), j.current = [], clearAllPreviewSources(e), g(null);
5045
+ P(n), A.current = [], clearAllPreviewSources(e), g(null);
5044
5046
  return;
5045
5047
  }
5046
- j.current = [...t, n];
5047
- } else r === "polyline" && (M.current = [...M.current, n]);
5048
+ A.current = [...t, n];
5049
+ } else r === "polyline" && (j.current = [...j.current, n]);
5048
5050
  }, n = (e) => {
5049
- let t = [e.lngLat.lng, e.lngLat.lat], n = Ce.current;
5050
- if (n === "rectangle" && O.current) Ae(O.current, t);
5051
- else if (n === "circle" && k.current) je(k.current.center, t);
5052
- else if (n === "square" && A.current) Me(A.current.center, t);
5051
+ let t = [e.lngLat.lng, e.lngLat.lat], n = we.current;
5052
+ if (n === "rectangle" && D.current) je(D.current, t);
5053
+ else if (n === "circle" && O.current) Me(O.current.center, t);
5054
+ else if (n === "square" && k.current) Ne(k.current.center, t);
5053
5055
  else if (n === "polygon") {
5054
- let e = j.current;
5055
- e.length > 0 && Ne(e, t);
5056
+ let e = A.current;
5057
+ e.length > 0 && Pe(e, t);
5056
5058
  } else if (n === "polyline") {
5057
- let e = M.current;
5058
- e.length > 0 && I(e, t);
5059
+ let e = j.current;
5060
+ e.length > 0 && F(e, t);
5059
5061
  }
5060
5062
  }, r = (t) => {
5061
5063
  t.preventDefault();
5062
- let n = Ce.current;
5064
+ let n = we.current;
5063
5065
  if (n === "polygon") {
5064
- let t = j.current;
5066
+ let t = A.current;
5065
5067
  if (t.length >= 3) {
5066
5068
  let n = {
5067
- id: P(),
5069
+ id: N(),
5068
5070
  type: "polygon",
5069
5071
  coordinates: [...t]
5070
5072
  };
5071
- F(n), j.current = [], clearAllPreviewSources(e), g(null);
5072
- } else j.current = [], clearAllPreviewSources(e);
5073
+ P(n), A.current = [], clearAllPreviewSources(e), g(null);
5074
+ } else A.current = [], clearAllPreviewSources(e);
5073
5075
  } else if (n === "polyline") {
5074
- let t = M.current;
5076
+ let t = j.current;
5075
5077
  if (t.length >= 2) {
5076
5078
  let n = {
5077
- id: P(),
5079
+ id: N(),
5078
5080
  type: "polyline",
5079
5081
  coordinates: [...t]
5080
5082
  };
5081
- F(n), M.current = [], clearAllPreviewSources(e), g(null);
5082
- } else M.current = [], clearAllPreviewSources(e);
5083
+ P(n), j.current = [], clearAllPreviewSources(e), g(null);
5084
+ } else j.current = [], clearAllPreviewSources(e);
5083
5085
  }
5084
5086
  }, i = (t) => {
5085
- t.key === "Escape" && (O.current = null, k.current = null, A.current = null, j.current = [], M.current = [], clearAllPreviewSources(e), g(null));
5087
+ t.key === "Escape" && (D.current = null, O.current = null, k.current = null, A.current = [], j.current = [], clearAllPreviewSources(e), g(null));
5086
5088
  }, a = (t) => {
5087
5089
  t.preventDefault();
5088
- let n = Ce.current;
5090
+ let n = we.current;
5089
5091
  if (n === "polygon") {
5090
- let t = j.current;
5092
+ let t = A.current;
5091
5093
  if (t.length >= 3) {
5092
5094
  let n = {
5093
- id: P(),
5095
+ id: N(),
5094
5096
  type: "polygon",
5095
5097
  coordinates: [...t]
5096
5098
  };
5097
- F(n), j.current = [], clearAllPreviewSources(e), g(null);
5099
+ P(n), A.current = [], clearAllPreviewSources(e), g(null);
5098
5100
  }
5099
5101
  } else if (n === "polyline") {
5100
- let t = M.current;
5102
+ let t = j.current;
5101
5103
  if (t.length >= 2) {
5102
5104
  let n = {
5103
- id: P(),
5105
+ id: N(),
5104
5106
  type: "polyline",
5105
5107
  coordinates: [...t]
5106
5108
  };
5107
- F(n), M.current = [], clearAllPreviewSources(e), g(null);
5109
+ P(n), j.current = [], clearAllPreviewSources(e), g(null);
5108
5110
  }
5109
5111
  }
5110
5112
  };
@@ -5114,25 +5116,25 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5114
5116
  }, [
5115
5117
  e,
5116
5118
  f,
5119
+ N,
5117
5120
  P,
5118
- F,
5119
- Te,
5120
- Ae,
5121
+ Ee,
5121
5122
  je,
5122
5123
  Me,
5123
5124
  Ne,
5124
- I
5125
+ Pe,
5126
+ F
5125
5127
  ]), useEffect(() => () => {
5126
5128
  C.current.forEach((e) => e.destroy()), C.current.clear();
5127
5129
  }, []);
5128
- let Pe = useCallback((t) => {
5129
- g((e) => e === t ? null : t), O.current = null, k.current = null, A.current = null, j.current = [], M.current = [], e && clearAllPreviewSources(e);
5130
+ let Fe = useCallback((t) => {
5131
+ g((e) => e === t ? null : t), D.current = null, O.current = null, k.current = null, A.current = [], j.current = [], e && clearAllPreviewSources(e);
5130
5132
  }, [e]);
5131
5133
  return e ? /* @__PURE__ */ jsxs("div", {
5132
5134
  className: `mapbox-measure-control ${c}`,
5133
5135
  style: l,
5134
5136
  children: [/* @__PURE__ */ jsxs("button", {
5135
- ref: D,
5137
+ ref: E,
5136
5138
  className: `mapbox-control-btn mapbox-measure-control__btn ${u ? "mapbox-measure-control__btn--active" : ""}`,
5137
5139
  onClick: () => d(!u),
5138
5140
  title: "测量",
@@ -5150,7 +5152,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5150
5152
  ] })
5151
5153
  ]
5152
5154
  }), u && /* @__PURE__ */ jsxs("div", {
5153
- ref: E,
5155
+ ref: T,
5154
5156
  className: "mapbox-measure-control__panel",
5155
5157
  children: [
5156
5158
  /* @__PURE__ */ jsx("div", {
@@ -5162,17 +5164,17 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5162
5164
  children: [
5163
5165
  /* @__PURE__ */ jsx(Checkbox, {
5164
5166
  checked: b.showArea,
5165
- onChange: (e) => ke("showArea", e),
5167
+ onChange: (e) => Ae("showArea", e),
5166
5168
  children: "面积"
5167
5169
  }),
5168
5170
  /* @__PURE__ */ jsx(Checkbox, {
5169
5171
  checked: b.showLength,
5170
- onChange: (e) => ke("showLength", e),
5172
+ onChange: (e) => Ae("showLength", e),
5171
5173
  children: "长度"
5172
5174
  }),
5173
5175
  /* @__PURE__ */ jsx(Checkbox, {
5174
5176
  checked: b.showRadius,
5175
- onChange: (e) => ke("showRadius", e),
5177
+ onChange: (e) => Ae("showRadius", e),
5176
5178
  children: "半径"
5177
5179
  })
5178
5180
  ]
@@ -5185,7 +5187,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5185
5187
  className: "mapbox-measure-control__tools",
5186
5188
  children: [DRAW_TOOLS.map((e) => /* @__PURE__ */ jsx("button", {
5187
5189
  className: `mapbox-measure-control__tool-btn ${f === e.mode ? "mapbox-measure-control__tool-btn--active" : ""}`,
5188
- onClick: () => Pe(e.mode),
5190
+ onClick: () => Fe(e.mode),
5189
5191
  title: e.label,
5190
5192
  children: /* @__PURE__ */ jsx("img", {
5191
5193
  src: e.icon,
@@ -5193,7 +5195,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5193
5195
  })
5194
5196
  }, e.mode)), x.length > 0 && /* @__PURE__ */ jsx("button", {
5195
5197
  className: "mapbox-measure-control__tool-btn mapbox-measure-control__tool-btn--danger",
5196
- onClick: De,
5198
+ onClick: Oe,
5197
5199
  title: "清除全部",
5198
5200
  children: /* @__PURE__ */ jsx("img", {
5199
5201
  src: "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1769394652565'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6483'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='128'%20height='128'%3e%3cpath%20d='M841.385637%20288.639098a36.479886%2036.479886%200%200%201%2072.74644%207.679976l6.613312%20629.544699A109.866323%20109.866323%200%200%201%20810.665733%201023.9968H222.507571a109.652991%20109.652991%200%200%201-109.012992-98.133027l-3.626656-629.544699a36.479886%2036.479886%200%200%201%2072.74644-7.679976L186.241018%20917.330467a36.479886%2036.479886%200%200%200%2036.266553%2032.639898H810.665733A36.479886%2036.479886%200%200%200%20847.99895%20917.330467z%20m-219.732646%20113.706311a36.479886%2036.479886%200%200%201%2036.693218%2036.479886v255.9992a36.693219%2036.693219%200%201%201-73.173104%200v-255.9992a36.479886%2036.479886%200%200%201%2036.479886-36.479886z%20m-219.305982%200a36.479886%2036.479886%200%200%201%2036.479886%2036.479886v255.9992a36.693219%2036.693219%200%201%201-73.173104%200v-255.9992a36.479886%2036.479886%200%200%201%2036.693218-36.479886z%20m-36.693218-255.9992h292.692418V91.519714a18.346609%2018.346609%200%200%200-18.346609-18.346609H384.0004a18.346609%2018.346609%200%200%200-18.346609%2018.346609z%20m-73.173105%200V73.173105A73.173105%2073.173105%200%200%201%20365.653791%200h292.692418a73.386437%2073.386437%200%200%201%2073.173105%2073.173105v73.173104h255.9992a36.693219%2036.693219%200%200%201%200%2073.173105H36.481486a36.693219%2036.693219%200%200%201%200-73.173105z'%20fill='%23EB6865'%20p-id='6484'%3e%3c/path%3e%3c/svg%3e",
@@ -5213,7 +5215,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5213
5215
  /* @__PURE__ */ jsx("th", {})
5214
5216
  ] }) }), /* @__PURE__ */ jsx("tbody", { children: x.map((e) => /* @__PURE__ */ jsxs("tr", {
5215
5217
  className: "mapbox-measure-control__table-row",
5216
- onClick: () => Oe(e.entity.id),
5218
+ onClick: () => ke(e.entity.id),
5217
5219
  children: [
5218
5220
  /* @__PURE__ */ jsx("td", { children: e.shapeLabel }),
5219
5221
  /* @__PURE__ */ jsx("td", { children: String(e.entity.id) }),
@@ -5222,7 +5224,7 @@ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, onDr
5222
5224
  /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", {
5223
5225
  className: "mapbox-measure-control__delete-btn",
5224
5226
  onClick: (t) => {
5225
- t.stopPropagation(), Ee(e.entity.id);
5227
+ t.stopPropagation(), De(e.entity.id);
5226
5228
  },
5227
5229
  title: "删除",
5228
5230
  children: /* @__PURE__ */ jsx("img", {
@@ -5299,7 +5301,7 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5299
5301
  }, [b, x]);
5300
5302
  let C = useCallback((t) => {
5301
5303
  if (!(!e || c.length === 0)) for (let n of c) e.getLayer(n) && (e.setPaintProperty(n, "raster-brightness-min", 0), e.setPaintProperty(n, "raster-brightness-max", t.brightness), e.setPaintProperty(n, "raster-saturation", t.saturation), e.setPaintProperty(n, "raster-contrast", t.contrast), e.setPaintProperty(n, "raster-hue-rotate", t.hueRotate));
5302
- }, [e, c]), w = useCallback((e, t) => {
5304
+ }, [e, c]), ve = useCallback((e, t) => {
5303
5305
  if (b) s?.({
5304
5306
  ...x,
5305
5307
  [e]: t
@@ -5317,7 +5319,7 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5317
5319
  x,
5318
5320
  h,
5319
5321
  C
5320
- ]), T = useCallback(() => {
5322
+ ]), w = useCallback(() => {
5321
5323
  b ? s?.({ ...DEFAULT_CONFIG }) : (_({ ...DEFAULT_CONFIG }), C({ ...DEFAULT_CONFIG }));
5322
5324
  }, [
5323
5325
  b,
@@ -5332,7 +5334,7 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5332
5334
  C,
5333
5335
  h
5334
5336
  ]);
5335
- let E = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5337
+ let T = (e, t) => e === "hueRotate" ? `${Math.round(t)}°` : t.toFixed(2);
5336
5338
  return /* @__PURE__ */ jsxs("div", {
5337
5339
  className: `mapbox-raster-paint-control${l ? ` ${l}` : ""}`,
5338
5340
  style: u,
@@ -5362,17 +5364,17 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
5362
5364
  max: r,
5363
5365
  step: i,
5364
5366
  value: x[e],
5365
- onChange: (t) => w(e, t),
5367
+ onChange: (t) => ve(e, t),
5366
5368
  tooltipVisible: !1
5367
5369
  }),
5368
5370
  /* @__PURE__ */ jsx("span", {
5369
5371
  className: "mapbox-raster-paint-control__value",
5370
- children: E(e, x[e])
5372
+ children: T(e, x[e])
5371
5373
  })
5372
5374
  ]
5373
5375
  }, e)), /* @__PURE__ */ jsx("button", {
5374
5376
  className: "mapbox-raster-paint-control__reset",
5375
- onClick: T,
5377
+ onClick: w,
5376
5378
  children: "重置"
5377
5379
  })]
5378
5380
  })]
@@ -5399,15 +5401,15 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5399
5401
  i === "square" ? s(null) : (r(null), s("square"));
5400
5402
  }, C = () => {
5401
5403
  i === "polyline" ? s(null) : (r(null), s("polyline"));
5402
- }, w = () => {
5404
+ }, ve = () => {
5403
5405
  (i === "rectangle" || i === "circle" || i === "polygon" || i === "square" || i === "polyline") && s(null), g(!h);
5404
- }, T = (e) => e.size ? {
5406
+ }, w = (e) => e.size ? {
5405
5407
  width: e.size,
5406
5408
  height: e.size
5407
5409
  } : {
5408
5410
  width: e.width || 32,
5409
5411
  height: e.height || 32
5410
- }, E = h || t, D = i === "rectangle", O = i === "circle", ve = i === "polygon", ye = i === "square", k = i === "polyline";
5412
+ }, T = h || t, E = i === "rectangle", D = i === "circle", ye = i === "polygon", be = i === "square", O = i === "polyline";
5411
5413
  return /* @__PURE__ */ jsxs("div", {
5412
5414
  ref: _,
5413
5415
  className: "mapbox-edit-control",
@@ -5415,8 +5417,8 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5415
5417
  className: "mapbox-edit-control__btn-group",
5416
5418
  children: [
5417
5419
  /* @__PURE__ */ jsxs("button", {
5418
- className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5419
- onClick: w,
5420
+ className: `mapbox-control-btn ${T ? "mapbox-control-btn--active" : ""}`,
5421
+ onClick: ve,
5420
5422
  title: "Marker",
5421
5423
  children: [t ? /* @__PURE__ */ jsx("img", {
5422
5424
  src: t.icon,
@@ -5429,7 +5431,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5429
5431
  }), /* @__PURE__ */ jsx("span", { children: t ? t.name : "Marker" })]
5430
5432
  }),
5431
5433
  d && /* @__PURE__ */ jsxs("button", {
5432
- className: `mapbox-control-btn ${ye ? "mapbox-control-btn--active" : ""}`,
5434
+ className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
5433
5435
  onClick: S,
5434
5436
  title: "绘制正方形",
5435
5437
  children: [/* @__PURE__ */ jsx("img", {
@@ -5439,7 +5441,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5439
5441
  }), /* @__PURE__ */ jsx("span", { children: "正方形" })]
5440
5442
  }),
5441
5443
  c && /* @__PURE__ */ jsxs("button", {
5442
- className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5444
+ className: `mapbox-control-btn ${E ? "mapbox-control-btn--active" : ""}`,
5443
5445
  onClick: y,
5444
5446
  title: "绘制矩形",
5445
5447
  children: [/* @__PURE__ */ jsx("img", {
@@ -5449,7 +5451,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5449
5451
  }), /* @__PURE__ */ jsx("span", { children: "矩形" })]
5450
5452
  }),
5451
5453
  l && /* @__PURE__ */ jsxs("button", {
5452
- className: `mapbox-control-btn ${O ? "mapbox-control-btn--active" : ""}`,
5454
+ className: `mapbox-control-btn ${D ? "mapbox-control-btn--active" : ""}`,
5453
5455
  onClick: b,
5454
5456
  title: "绘制圆形",
5455
5457
  children: [/* @__PURE__ */ jsx("img", {
@@ -5459,7 +5461,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5459
5461
  }), /* @__PURE__ */ jsx("span", { children: "圆形" })]
5460
5462
  }),
5461
5463
  u && /* @__PURE__ */ jsxs("button", {
5462
- className: `mapbox-control-btn ${ve ? "mapbox-control-btn--active" : ""}`,
5464
+ className: `mapbox-control-btn ${ye ? "mapbox-control-btn--active" : ""}`,
5463
5465
  onClick: x,
5464
5466
  title: "绘制多边形",
5465
5467
  children: [/* @__PURE__ */ jsx("img", {
@@ -5469,7 +5471,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5469
5471
  }), /* @__PURE__ */ jsx("span", { children: "多边形" })]
5470
5472
  }),
5471
5473
  f && /* @__PURE__ */ jsxs("button", {
5472
- className: `mapbox-control-btn ${k ? "mapbox-control-btn--active" : ""}`,
5474
+ className: `mapbox-control-btn ${O ? "mapbox-control-btn--active" : ""}`,
5473
5475
  onClick: C,
5474
5476
  title: "绘制折线",
5475
5477
  children: [/* @__PURE__ */ jsx("img", {
@@ -5487,7 +5489,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5487
5489
  }), /* @__PURE__ */ jsx("div", {
5488
5490
  className: "mapbox-edit-control__template-list",
5489
5491
  children: e.map((e) => {
5490
- let n = T(e), r = t?.id === e.id;
5492
+ let n = w(e), r = t?.id === e.id;
5491
5493
  return /* @__PURE__ */ jsxs("div", {
5492
5494
  className: `mapbox-edit-control__template-item ${r ? "mapbox-edit-control__template-item--selected" : ""}`,
5493
5495
  onClick: () => v(e),
@@ -5559,15 +5561,15 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
5559
5561
  };
5560
5562
  var route_planning_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20t='1775031767174'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='30653'%20data-spm-anchor-id='a313x.search_index.0.i6.78953a81FCkAe0'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='64'%20height='64'%3e%3cpath%20d='M322.24%20479.210667l-42.453333-42.432%20198.826666-198.826667c53.397333-53.376%20139.306667-53.568%20191.914667-0.981333%2052.608%2052.608%2052.416%20138.517333-0.981333%20191.914666L455.722667%20642.709333l-42.432-42.453333%20213.824-213.802667a74.773333%2074.773333%200%200%200-0.341334-105.728%2074.773333%2074.773333%200%200%200-105.728-0.341333l-198.826666%20198.826667z'%20fill='%23ffffff'%20p-id='30654'%3e%3c/path%3e%3cpath%20d='M699.093333%20613.333333l42.453334%2042.432-169.429334%20169.408c-48.341333%2048.341333-129.28%2042.282667-181.248-9.664-51.968-51.968-58.026667-132.906667-9.664-181.248l234.346667-234.346666%2042.432%2042.410666L423.616%20676.693333c-22.250667%2022.250667-19.050667%2065.024%2011.008%2095.061334%2030.037333%2030.058667%2072.810667%2033.258667%2095.061333%2010.986666l169.429334-169.408zM187.989333%20571.029333c-38.933333-38.933333-38.805333-102.613333%200.853334-142.293333%2039.68-39.68%20103.381333-39.808%20142.293333-0.853333%2038.954667%2038.912%2038.826667%20102.613333-0.853333%20142.293333-39.68%2039.658667-103.381333%2039.786667-142.293334%200.853333z%20m43.733334-43.733333c15.744%2015.744%2040.874667%2015.68%2056.128%200.426667%2015.253333-15.232%2015.296-40.362667-0.426667-56.106667-15.765333-15.744-40.896-15.701333-56.149333-0.448-15.232%2015.232-15.296%2040.384%200.448%2056.106667z'%20fill='%23ffffff'%20p-id='30655'%3e%3c/path%3e%3cpath%20d='M846.144%20489.728l-31.466667%20198.784-56.96-101.461333-104.042666-38.506667z'%20fill='%23ffffff'%20p-id='30656'%3e%3c/path%3e%3c/svg%3e", SOURCE_ID = "route-planning-temp-line", LINE_LAYER_ID = "route-planning-temp-line-layer", POINT_LAYER_ID = "route-planning-temp-point-layer";
5561
5563
  const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointCountInput: c = !1, visualType: l = "marker", onSelectFinished: u, showButton: d = !0 }, f) => {
5562
- let [h, g] = useState("idle"), [_, v] = useState(0), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(null), w = useRef(null), T = useRef([]), E = useRef([]), D = useRef("idle"), O = useRef(null), ve = useRef("");
5564
+ let [h, g] = useState("idle"), [_, v] = useState(0), [y, b] = useState(i), [x, S] = useState(!1), C = useRef(null), ve = useRef(null), w = useRef([]), T = useRef([]), E = useRef("idle"), D = useRef(null), ye = useRef("");
5563
5565
  useEffect(() => {
5564
- D.current = h;
5566
+ E.current = h;
5565
5567
  }, [h]), useEffect(() => {
5566
5568
  b(i);
5567
5569
  }, [i]), useEffect(() => {
5568
5570
  if (!x) return;
5569
5571
  let e = (e) => {
5570
- w.current && !w.current.contains(e.target) && C.current && !C.current.contains(e.target) && S(!1);
5572
+ ve.current && !ve.current.contains(e.target) && C.current && !C.current.contains(e.target) && S(!1);
5571
5573
  }, t = setTimeout(() => {
5572
5574
  document.addEventListener("mousedown", e);
5573
5575
  }, 0);
@@ -5575,12 +5577,12 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5575
5577
  clearTimeout(t), document.removeEventListener("mousedown", e);
5576
5578
  };
5577
5579
  }, [x]);
5578
- let ye = useCallback(() => {
5579
- for (let e of E.current) e.remove();
5580
- E.current = [], e && (e.getLayer(LINE_LAYER_ID) && e.removeLayer(LINE_LAYER_ID), e.getLayer(POINT_LAYER_ID) && e.removeLayer(POINT_LAYER_ID), e.getSource(SOURCE_ID) && e.removeSource(SOURCE_ID));
5581
- }, [e]), k = useCallback(() => {
5580
+ let be = useCallback(() => {
5581
+ for (let e of T.current) e.remove();
5582
+ T.current = [], e && (e.getLayer(LINE_LAYER_ID) && e.removeLayer(LINE_LAYER_ID), e.getLayer(POINT_LAYER_ID) && e.removeLayer(POINT_LAYER_ID), e.getSource(SOURCE_ID) && e.removeSource(SOURCE_ID));
5583
+ }, [e]), O = useCallback(() => {
5582
5584
  if (!e) return;
5583
- let t = T.current, n = {
5585
+ let t = w.current, n = {
5584
5586
  type: "FeatureCollection",
5585
5587
  features: [{
5586
5588
  type: "Feature",
@@ -5631,21 +5633,21 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5631
5633
  "circle-stroke-color": "#fff"
5632
5634
  }
5633
5635
  }));
5634
- }, [e]), be = useCallback((t) => {
5635
- if (!e || !O.current) return;
5636
- let { visualType: n } = O.current;
5636
+ }, [e]), xe = useCallback((t) => {
5637
+ if (!e || !D.current) return;
5638
+ let { visualType: n } = D.current;
5637
5639
  if (n === "marker") {
5638
5640
  let n = document.createElement("div");
5639
- n.className = "route-planning-temp-marker", n.textContent = String(T.current.length);
5641
+ n.className = "route-planning-temp-marker", n.textContent = String(w.current.length);
5640
5642
  let r = new mapboxgl.Marker({ element: n }).setLngLat(t).addTo(e);
5641
- E.current.push(r);
5642
- } else k();
5643
- }, [e, k]), xe = useCallback(() => {
5644
- ye(), T.current = [], O.current = null, v(0), g("idle"), e && (e.getCanvas().style.cursor = ve.current);
5645
- }, [ye, e]), Se = useCallback(async () => {
5646
- let e = O.current, t = [...T.current];
5643
+ T.current.push(r);
5644
+ } else O();
5645
+ }, [e, O]), Se = useCallback(() => {
5646
+ be(), w.current = [], D.current = null, v(0), g("idle"), e && (e.getCanvas().style.cursor = ye.current);
5647
+ }, [be, e]), Ce = useCallback(async () => {
5648
+ let e = D.current, t = [...w.current];
5647
5649
  if (!e || t.length < 2) {
5648
- xe();
5650
+ Se();
5649
5651
  return;
5650
5652
  }
5651
5653
  g("planning");
@@ -5654,58 +5656,58 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5654
5656
  } catch (e) {
5655
5657
  console.error("Route planning onSelectFinished failed:", e);
5656
5658
  } finally {
5657
- xe();
5659
+ Se();
5658
5660
  }
5659
- }, [xe]), A = useCallback((e) => {
5660
- if (D.current !== "selecting" || !O.current) return;
5661
+ }, [Se]), k = useCallback((e) => {
5662
+ if (E.current !== "selecting" || !D.current) return;
5661
5663
  let t = [e.lngLat.lng, e.lngLat.lat];
5662
- T.current.push(t);
5663
- let n = T.current.length;
5664
- v(n), be(t), n >= O.current.pointCount && Se();
5665
- }, [be, Se]), j = useCallback((e) => {
5666
- D.current === "selecting" && (e.preventDefault(), xe());
5667
- }, [xe]);
5664
+ w.current.push(t);
5665
+ let n = w.current.length;
5666
+ v(n), xe(t), n >= D.current.pointCount && Ce();
5667
+ }, [xe, Ce]), A = useCallback((e) => {
5668
+ E.current === "selecting" && (e.preventDefault(), Se());
5669
+ }, [Se]);
5668
5670
  useEffect(() => {
5669
- if (e && h === "selecting") return e.on("click", A), e.on("contextmenu", j), () => {
5670
- e.off("click", A), e.off("contextmenu", j);
5671
+ if (e && h === "selecting") return e.on("click", k), e.on("contextmenu", A), () => {
5672
+ e.off("click", k), e.off("contextmenu", A);
5671
5673
  };
5672
5674
  }, [
5673
5675
  e,
5674
5676
  h,
5675
- A,
5676
- j
5677
+ k,
5678
+ A
5677
5679
  ]);
5678
- let M = useCallback((t) => {
5680
+ let j = useCallback((t) => {
5679
5681
  if (!e) return;
5680
- D.current !== "idle" && xe();
5682
+ E.current !== "idle" && Se();
5681
5683
  let n = Math.max(2, t.pointCount ?? i), r = t.visualType ?? l;
5682
- O.current = {
5684
+ D.current = {
5683
5685
  pointCount: n,
5684
5686
  visualType: r,
5685
5687
  onSelectFinished: t.onSelectFinished
5686
- }, T.current = [], v(0), b(n), S(!1), ve.current = e.getCanvas().style.cursor, e.getCanvas().style.cursor = "crosshair", g("selecting");
5688
+ }, w.current = [], v(0), b(n), S(!1), ye.current = e.getCanvas().style.cursor, e.getCanvas().style.cursor = "crosshair", g("selecting");
5687
5689
  }, [
5688
5690
  e,
5689
5691
  i,
5690
5692
  l,
5691
- xe
5693
+ Se
5692
5694
  ]);
5693
- useImperativeHandle(f, () => ({ startPlanning: M }), [M]);
5694
- let N = () => {
5695
- h === "idle" ? S((e) => !e) : h === "selecting" && xe();
5696
- }, Ce = () => {
5697
- u && M({
5695
+ useImperativeHandle(f, () => ({ startPlanning: j }), [j]);
5696
+ let M = () => {
5697
+ h === "idle" ? S((e) => !e) : h === "selecting" && Se();
5698
+ }, we = () => {
5699
+ u && j({
5698
5700
  pointCount: Math.max(2, y),
5699
5701
  visualType: l,
5700
5702
  onSelectFinished: u
5701
5703
  });
5702
- }, P = (e) => {
5704
+ }, N = (e) => {
5703
5705
  let t = parseInt(e.target.value, 10);
5704
5706
  !isNaN(t) && t >= 2 ? b(t) : e.target.value === "" && b(2);
5705
- }, we = () => {
5707
+ }, Te = () => {
5706
5708
  if (h === "planning") return /* @__PURE__ */ jsx("span", { children: "规划中..." });
5707
5709
  if (h === "selecting") {
5708
- let e = O.current?.pointCount ?? y;
5710
+ let e = D.current?.pointCount ?? y;
5709
5711
  return /* @__PURE__ */ jsxs("span", { children: [
5710
5712
  _,
5711
5713
  "/",
@@ -5713,22 +5715,22 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5713
5715
  ] });
5714
5716
  }
5715
5717
  return "路径规划";
5716
- }, Te = h === "selecting", F = h === "planning";
5718
+ }, Ee = h === "selecting", P = h === "planning";
5717
5719
  return !d && h === "idle" ? null : /* @__PURE__ */ jsxs("div", {
5718
5720
  className: `mapbox-route-planning-control${d ? "" : " mapbox-route-planning-control--floating"}`,
5719
5721
  children: [/* @__PURE__ */ jsxs("button", {
5720
5722
  ref: C,
5721
- className: `mapbox-control-btn mapbox-route-planning-control__btn${Te ? " mapbox-route-planning-control__btn--active" : ""}${F ? " mapbox-route-planning-control__btn--planning" : ""}${x ? " mapbox-route-planning-control__btn--active" : ""}`,
5722
- onClick: N,
5723
- disabled: F,
5723
+ className: `mapbox-control-btn mapbox-route-planning-control__btn${Ee ? " mapbox-route-planning-control__btn--active" : ""}${P ? " mapbox-route-planning-control__btn--planning" : ""}${x ? " mapbox-route-planning-control__btn--active" : ""}`,
5724
+ onClick: M,
5725
+ disabled: P,
5724
5726
  title: h === "idle" ? "路径规划" : h === "selecting" ? "取消选点" : "规划中...",
5725
5727
  children: [/* @__PURE__ */ jsx("img", {
5726
5728
  src: route_planning_default,
5727
5729
  alt: "route",
5728
5730
  className: "mapbox-route-planning-control__btn-icon"
5729
- }), we()]
5731
+ }), Te()]
5730
5732
  }), x && h === "idle" && /* @__PURE__ */ jsxs("div", {
5731
- ref: w,
5733
+ ref: ve,
5732
5734
  className: "mapbox-route-planning-control__panel",
5733
5735
  children: [/* @__PURE__ */ jsx("div", {
5734
5736
  className: "mapbox-route-planning-control__panel-header",
@@ -5749,7 +5751,7 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5749
5751
  className: "mapbox-route-planning-control__panel-input",
5750
5752
  value: y,
5751
5753
  min: 2,
5752
- onChange: P
5754
+ onChange: N
5753
5755
  }) : /* @__PURE__ */ jsx("span", {
5754
5756
  className: "mapbox-route-planning-control__panel-value",
5755
5757
  children: y
@@ -5761,7 +5763,7 @@ const RoutePlanningControl = forwardRef(({ map: e, pointCount: i = 2, showPointC
5761
5763
  }),
5762
5764
  /* @__PURE__ */ jsx("button", {
5763
5765
  className: "mapbox-route-planning-control__panel-start",
5764
- onClick: Ce,
5766
+ onClick: we,
5765
5767
  disabled: !u,
5766
5768
  children: "开始规划"
5767
5769
  })
@@ -5918,53 +5920,53 @@ function adjustPopupForBounds(e, t) {
5918
5920
  return r.x + t.width + 10 > n.width && (r.x = n.width - t.width - 10), r.x < 10 && (r.x = 10), r.y + t.height + 10 > n.height && (r.y = n.height - t.height - 10), r.y < 10 && (r.y = 10), r;
5919
5921
  }
5920
5922
  const Mapbox = forwardRef((e, c) => {
5921
- let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: h = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: T, entities: E = [], selectedIds: D = [], entityConfig: O, nameConfig: k, selectNameConfig: A, areaConfig: j, circleConfig: M, lengthConfig: N, showCoordinates: Ce = !0, showScale: P = !0, showResetView: we = !0, showRoadHighlight: Te = !1, showMeasure: Ee = !1, showRasterPaint: Ae = !1, showRoutePlanning: je, onRasterPaintChange: Me, popupDefaults: I, renderPopup: Pe, onMapLoad: Fe, onEntityClick: Ie, onPopupOpen: Le, onPopupClose: Re, className: ze = "", containerStyle: Be } = e, Ve = useRef(null), He = useRef(null), L = useRef(null), R = useRef(/* @__PURE__ */ new Map()), z = useRef(/* @__PURE__ */ new Map()), Ue = useRef(/* @__PURE__ */ new Set()), [B, We] = useState(null), Ge = useRef(null), Ke = useRef(null), qe = useRef(null), [Je, Ye] = useState(null), Xe = useRef(null), Ze = useRef(null), [V, Qe] = useState(null), [$e, et] = useState(_), [tt, nt] = useState(null), rt = useRef(null), [it, H] = useState(null), [at, U] = useState(null), [ot, st] = useState(null), W = useRef(!1), G = useRef(null), ct = useRef(null), K = useRef(null), lt = useRef(null), q = useRef(null), ut = useRef([]), J = useRef(null), dt = useRef(null), ft = useRef(null), pt = useRef([]), mt = useRef(null), ht = useRef(!1), [gt, _t] = useState([]), vt = useRef([]);
5922
- vt.current = gt;
5923
- let Y = useRef(null);
5923
+ let { center: l = [116.4074, 39.9042], zoom: u = 12, pitch: d = 0, bearing: f = 0, style: h = "mapbox://styles/mapbox/dark-v11", maxBounds: g, mode: _ = "display", editConfig: v = {}, pickerConfig: y = {}, onPick: b, interactive: x = {}, layers: S = [], rasterPaint: w, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: A, circleConfig: j, lengthConfig: M, showCoordinates: we = !0, showScale: N = !0, showResetView: Te = !0, showRoadHighlight: Ee = !1, showMeasure: De = !1, showRasterPaint: je = !1, showRoutePlanning: Me, onRasterPaintChange: Ne, popupDefaults: F, renderPopup: Fe, onMapLoad: Ie, onEntityClick: Le, onPopupOpen: Re, onPopupClose: ze, className: Be = "", containerStyle: Ve } = e, He = useRef(null), Ue = useRef(null), I = useRef(null), L = useRef(/* @__PURE__ */ new Map()), R = useRef(/* @__PURE__ */ new Map()), We = useRef(/* @__PURE__ */ new Set()), [z, Ge] = useState(null), Ke = useRef(null), qe = useRef(null), Je = useRef(null), [Ye, Xe] = useState(null), Ze = useRef(null), Qe = useRef(null), [B, $e] = useState(null), [et, tt] = useState(_), [nt, rt] = useState(null), it = useRef(null), [at, V] = useState(null), [ot, H] = useState(null), [st, ct] = useState(null), U = useRef(!1), W = useRef(null), lt = useRef(null), G = useRef(null), ut = useRef(null), K = useRef(null), dt = useRef([]), q = useRef(null), ft = useRef(null), pt = useRef(null), mt = useRef([]), ht = useRef(null), gt = useRef(!1), [_t, vt] = useState([]), yt = useRef([]);
5924
+ yt.current = _t;
5925
+ let J = useRef(null);
5924
5926
  useEffect(() => {
5925
- et(_);
5927
+ tt(_);
5926
5928
  }, [_]);
5927
- let yt = useCallback((e) => {
5928
- let t = R.current.get(e), n = z.current.get(e);
5929
+ let bt = useCallback((e) => {
5930
+ let t = L.current.get(e), n = R.current.get(e);
5929
5931
  if (t && n) {
5930
5932
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5931
5933
  let r = {
5932
5934
  ...n,
5933
5935
  isAnimating: !0
5934
5936
  };
5935
- z.current.set(e, r), t.startAnimation();
5937
+ R.current.set(e, r), t.startAnimation();
5936
5938
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5937
5939
  let r = {
5938
5940
  ...n,
5939
5941
  isAnimating: !0
5940
5942
  };
5941
- z.current.set(e, r), t.startAnimation();
5943
+ R.current.set(e, r), t.startAnimation();
5942
5944
  }
5943
5945
  }
5944
- }, []), bt = useCallback((e) => {
5945
- let t = R.current.get(e), n = z.current.get(e);
5946
+ }, []), xt = useCallback((e) => {
5947
+ let t = L.current.get(e), n = R.current.get(e);
5946
5948
  if (t && n) {
5947
5949
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
5948
5950
  let r = {
5949
5951
  ...n,
5950
5952
  isAnimating: !1
5951
5953
  };
5952
- z.current.set(e, r), t.stopAnimation();
5954
+ R.current.set(e, r), t.stopAnimation();
5953
5955
  } else if (n.type === "circle" && t instanceof CanvasCircleRenderer) {
5954
5956
  let r = {
5955
5957
  ...n,
5956
5958
  isAnimating: !1
5957
5959
  };
5958
- z.current.set(e, r), t.stopAnimation();
5960
+ R.current.set(e, r), t.stopAnimation();
5959
5961
  }
5960
5962
  }
5961
- }, []), xt = useCallback((e) => {
5962
- let t = z.current.get(e);
5963
- t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? bt(e) : yt(e));
5964
- }, [yt, bt]), St = useCallback((e) => {
5963
+ }, []), St = useCallback((e) => {
5964
+ let t = R.current.get(e);
5965
+ t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? xt(e) : bt(e));
5966
+ }, [bt, xt]), Ct = useCallback((e) => {
5965
5967
  if (e === void 0) {
5966
5968
  let e = !1;
5967
- for (let [, t] of R.current) if (t instanceof UnitRenderer) {
5969
+ for (let [, t] of L.current) if (t instanceof UnitRenderer) {
5968
5970
  let n = t.getShowTrajectory();
5969
5971
  if (n === "all" || typeof n == "number" && n > 0) {
5970
5972
  e = !0;
@@ -5972,46 +5974,46 @@ const Mapbox = forwardRef((e, c) => {
5972
5974
  }
5973
5975
  }
5974
5976
  let t = e ? 0 : "all";
5975
- for (let [, e] of R.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5977
+ for (let [, e] of L.current) e instanceof UnitRenderer && e.setShowTrajectory(t);
5976
5978
  } else {
5977
5979
  let t = new Set(e.map(String));
5978
- for (let [e, n] of R.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
5980
+ for (let [e, n] of L.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
5979
5981
  }
5980
- }, []), Ct = useCallback((e, t, n) => {
5981
- let r = E.find((t) => String(t.id) === String(e));
5982
- if (!r?.popup || !L.current) return;
5983
- let i = r.popup.content ?? Pe?.(r);
5982
+ }, []), wt = useCallback((e, t, n) => {
5983
+ let r = T.find((t) => String(t.id) === String(e));
5984
+ if (!r?.popup || !I.current) return;
5985
+ let i = r.popup.content ?? Fe?.(r);
5984
5986
  if (!i) return;
5985
- let a = mergePopupConfig(r.popup, I, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, L.current, n);
5986
- We({
5987
+ let a = mergePopupConfig(r.popup, F, i), { position: o, actualPosition: s } = calculatePopupPosition(r, a, I.current, n);
5988
+ Ge({
5987
5989
  entityId: e,
5988
5990
  position: o,
5989
5991
  config: a,
5990
5992
  openedBy: t,
5991
5993
  actualPosition: s
5992
- }), Le?.(e);
5994
+ }), Re?.(e);
5993
5995
  }, [
5994
- E,
5995
- I,
5996
- Pe,
5997
- Le
5998
- ]), wt = useCallback((e) => {
5999
- B?.entityId === e && (We(null), Re?.(e));
6000
- }, [B, Re]), Tt = useCallback(() => {
6001
- We((e) => (e && Re?.(e.entityId), null));
6002
- }, [Re]), Et = useCallback((e) => B?.entityId === e, [B]), Dt = useCallback((e, t, n) => {
6003
- let r = L.current;
5996
+ T,
5997
+ F,
5998
+ Fe,
5999
+ Re
6000
+ ]), Tt = useCallback((e) => {
6001
+ z?.entityId === e && (Ge(null), ze?.(e));
6002
+ }, [z, ze]), Et = useCallback(() => {
6003
+ Ge((e) => (e && ze?.(e.entityId), null));
6004
+ }, [ze]), Dt = useCallback((e) => z?.entityId === e, [z]), Ot = useCallback((e, t, n) => {
6005
+ let r = I.current;
6004
6006
  r && r.flyTo({
6005
6007
  center: e,
6006
6008
  zoom: t ?? r.getZoom(),
6007
6009
  ...n
6008
6010
  });
6009
- }, []), Ot = useCallback((e, t, n) => {
6010
- let r = L.current;
6011
+ }, []), kt = useCallback((e, t, n) => {
6012
+ let r = I.current;
6011
6013
  if (!r || e.length === 0) return;
6012
6014
  let i = [];
6013
6015
  for (let t of e) {
6014
- let e = R.current.get(t);
6016
+ let e = L.current.get(t);
6015
6017
  e && i.push(e.getBounds());
6016
6018
  }
6017
6019
  if (i.length === 0) return;
@@ -6033,19 +6035,19 @@ const Mapbox = forwardRef((e, c) => {
6033
6035
  pitch: n?.pitch ?? r.getPitch()
6034
6036
  };
6035
6037
  t !== void 0 && (p.maxZoom = t), n?.essential !== void 0 && (p.essential = n.essential), r.fitBounds(f, p);
6036
- }, []), kt = useCallback((e) => {
6037
- let t = L.current;
6038
+ }, []), At = useCallback((e) => {
6039
+ let t = I.current;
6038
6040
  if (!t || !t.getContainer()) return;
6039
6041
  let { showMarker: n = !0, markerColor: r = "#3388ff", name: i, nameConfig: a } = y;
6040
6042
  if (!n) {
6041
- rt.current &&= (rt.current.remove(), null);
6043
+ it.current &&= (it.current.remove(), null);
6042
6044
  return;
6043
6045
  }
6044
- if (rt.current) {
6045
- rt.current.setLngLat(e);
6046
- let t = rt.current.getElement(), n = t.querySelector(".marker-label");
6046
+ if (it.current) {
6047
+ it.current.setLngLat(e);
6048
+ let t = it.current.getElement(), n = t.querySelector(".marker-label");
6047
6049
  if (i) {
6048
- let e = resolveNameConfig(a, k);
6050
+ let e = resolveNameConfig(a, O);
6049
6051
  if (n) n.textContent = i, n.style.color = e.fillColor, n.style.opacity = String(e.fillOpacity), n.style.webkitTextStrokeColor = e.strokeColor, n.style.webkitTextStrokeWidth = `${e.strokeWidth}px`;
6050
6052
  else {
6051
6053
  let n = document.createElement("div");
@@ -6057,41 +6059,41 @@ const Mapbox = forwardRef((e, c) => {
6057
6059
  n.className = "mapbox-picker-marker";
6058
6060
  let o = document.createElement("div");
6059
6061
  if (o.className = "marker-inner", o.style.background = r, n.appendChild(o), i) {
6060
- let e = resolveNameConfig(a, k), t = document.createElement("div");
6062
+ let e = resolveNameConfig(a, O), t = document.createElement("div");
6061
6063
  t.className = "marker-label", t.textContent = i, t.style.color = e.fillColor, t.style.opacity = String(e.fillOpacity), t.style.webkitTextStrokeColor = e.strokeColor, t.style.webkitTextStrokeWidth = `${e.strokeWidth}px`, n.appendChild(t);
6062
6064
  }
6063
- rt.current = new mapboxgl.Marker({
6065
+ it.current = new mapboxgl.Marker({
6064
6066
  element: n,
6065
6067
  anchor: "bottom"
6066
6068
  }).setLngLat(e).addTo(t);
6067
6069
  }
6068
- }, [y, k]), At = useCallback(() => {
6069
- rt.current &&= (rt.current.remove(), null);
6070
- }, []), jt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Mt = useCallback((e) => {
6071
- let t = L.current;
6072
- if (Ve.current) if (mt.current &&= (mt.current.remove(), null), e && t) {
6070
+ }, [y, O]), jt = useCallback(() => {
6071
+ it.current &&= (it.current.remove(), null);
6072
+ }, []), Mt = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Nt = useCallback((e) => {
6073
+ let t = I.current;
6074
+ if (He.current) if (ht.current &&= (ht.current.remove(), null), e && t) {
6073
6075
  t.getCanvas().style.cursor = "none";
6074
6076
  let n = document.createElement("div");
6075
6077
  n.className = "mapbox-custom-cursor";
6076
6078
  let r = e.size || e.width || 32;
6077
6079
  n.style.cssText = "\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n transform: translate(-50%, -50%);\n opacity: 0.8;\n ";
6078
6080
  let i = document.createElement("img");
6079
- i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), mt.current = n;
6081
+ i.src = e.icon, i.style.width = `${r}px`, i.style.height = `${e.size || e.height || r}px`, i.style.objectFit = "contain", n.appendChild(i), document.body.appendChild(n), ht.current = n;
6080
6082
  let a = (e) => {
6081
- mt.current && (mt.current.style.left = `${e.clientX}px`, mt.current.style.top = `${e.clientY}px`);
6083
+ ht.current && (ht.current.style.left = `${e.clientX}px`, ht.current.style.top = `${e.clientY}px`);
6082
6084
  };
6083
6085
  document.addEventListener("mousemove", a), n.dataset.cleanup = "true", n._cleanup = () => {
6084
6086
  document.removeEventListener("mousemove", a);
6085
6087
  };
6086
6088
  } else t && (t.getCanvas().style.cursor = "");
6087
- }, []), X = useCallback(() => {
6088
- if (mt.current) {
6089
- let e = mt.current._cleanup;
6090
- e && e(), mt.current.remove(), mt.current = null;
6089
+ }, []), Y = useCallback(() => {
6090
+ if (ht.current) {
6091
+ let e = ht.current._cleanup;
6092
+ e && e(), ht.current.remove(), ht.current = null;
6091
6093
  }
6092
- let e = L.current;
6094
+ let e = I.current;
6093
6095
  e && (e.getCanvas().style.cursor = "");
6094
- }, []), Nt = useCallback((e, t, n) => {
6096
+ }, []), Pt = useCallback((e, t, n) => {
6095
6097
  if (!e.getSource(t)) {
6096
6098
  if (!e.getStyle().glyphs) {
6097
6099
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
@@ -6127,8 +6129,8 @@ const Mapbox = forwardRef((e, c) => {
6127
6129
  }
6128
6130
  });
6129
6131
  }
6130
- }, []), Pt = useCallback(() => {
6131
- let e = L.current;
6132
+ }, []), Ft = useCallback(() => {
6133
+ let e = I.current;
6132
6134
  e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
6133
6135
  type: "geojson",
6134
6136
  data: {
@@ -6152,9 +6154,9 @@ const Mapbox = forwardRef((e, c) => {
6152
6154
  "line-width": 2,
6153
6155
  "line-dasharray": [4, 4]
6154
6156
  }
6155
- }), Nt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6156
- }, [Nt]), Ft = useCallback((e, t) => {
6157
- let n = L.current;
6157
+ }), Pt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
6158
+ }, [Pt]), It = useCallback((e, t) => {
6159
+ let n = I.current;
6158
6160
  if (!n) return;
6159
6161
  let r = n.getSource("rect-preview-source");
6160
6162
  if (!r) return;
@@ -6173,11 +6175,11 @@ const Mapbox = forwardRef((e, c) => {
6173
6175
  },
6174
6176
  properties: {}
6175
6177
  });
6176
- let l = G.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
6178
+ let l = W.current, u = l?.strokeColor ?? "#3388ff", d = l?.strokeWidth ?? 2, f = l?.fillColor ?? "#3388ff", p = l?.fillOpacity ?? .1;
6177
6179
  n.getLayer("rect-preview-line") && (n.setPaintProperty("rect-preview-line", "line-color", u), n.setPaintProperty("rect-preview-line", "line-width", d)), n.getLayer("rect-preview-fill") && (n.setPaintProperty("rect-preview-fill", "fill-color", f), n.setPaintProperty("rect-preview-fill", "fill-opacity", p));
6178
6180
  let m = n.getSource("rect-preview-measure-source");
6179
6181
  if (m) {
6180
- let e = Nn.current, t = [], n = c[0], r = c[1], i = c[2];
6182
+ let e = Pn.current, t = [], n = c[0], r = c[1], i = c[2];
6181
6183
  if (e?.showArea) {
6182
6184
  let e = [(n[0] + i[0]) / 2, (n[1] + i[1]) / 2], a = distance(n, r), o = distance(r, i);
6183
6185
  t.push({
@@ -6214,8 +6216,8 @@ const Mapbox = forwardRef((e, c) => {
6214
6216
  features: t
6215
6217
  });
6216
6218
  }
6217
- }, []), It = useCallback(() => {
6218
- let e = L.current;
6219
+ }, []), Lt = useCallback(() => {
6220
+ let e = I.current;
6219
6221
  if (!e) return;
6220
6222
  let t = e.getSource("rect-preview-source");
6221
6223
  t && t.setData({
@@ -6227,10 +6229,10 @@ const Mapbox = forwardRef((e, c) => {
6227
6229
  type: "FeatureCollection",
6228
6230
  features: []
6229
6231
  });
6230
- }, []), Z = useCallback(() => {
6231
- st(null), It();
6232
- }, [It]), Lt = useCallback(() => {
6233
- let e = L.current;
6232
+ }, []), X = useCallback(() => {
6233
+ ct(null), Lt();
6234
+ }, [Lt]), Rt = useCallback(() => {
6235
+ let e = I.current;
6234
6236
  e && (e.getSource("circle-preview-source") || (e.addSource("circle-preview-source", {
6235
6237
  type: "geojson",
6236
6238
  data: {
@@ -6254,7 +6256,7 @@ const Mapbox = forwardRef((e, c) => {
6254
6256
  "line-width": 2,
6255
6257
  "line-dasharray": [4, 4]
6256
6258
  }
6257
- }), Nt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
6259
+ }), Pt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
6258
6260
  type: "geojson",
6259
6261
  data: {
6260
6262
  type: "FeatureCollection",
@@ -6271,22 +6273,22 @@ const Mapbox = forwardRef((e, c) => {
6271
6273
  "line-dasharray": [4, 4]
6272
6274
  }
6273
6275
  }))));
6274
- }, [Nt]), Rt = useCallback((e, t, n = 64) => {
6276
+ }, [Pt]), zt = useCallback((e, t, n = 64) => {
6275
6277
  let [r, i] = e, a = [], o = t / 6371e3, s = i * Math.PI / 180;
6276
6278
  for (let e = 0; e <= n; e++) {
6277
6279
  let t = e / n * 2 * Math.PI, c = o * Math.cos(t), l = o * Math.sin(t) / Math.cos(s), u = i + c * 180 / Math.PI, d = r + l * 180 / Math.PI;
6278
6280
  a.push([d, u]);
6279
6281
  }
6280
6282
  return a;
6281
- }, []), zt = useCallback((e, t) => {
6283
+ }, []), Bt = useCallback((e, t) => {
6282
6284
  let [n, r] = e, [i, a] = t, o = (a - r) * Math.PI / 180, s = (i - n) * Math.PI / 180, c = Math.sin(o / 2) * Math.sin(o / 2) + Math.cos(r * Math.PI / 180) * Math.cos(a * Math.PI / 180) * Math.sin(s / 2) * Math.sin(s / 2);
6283
6285
  return 6371e3 * (2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)));
6284
- }, []), Bt = useCallback((e, t) => {
6285
- let n = L.current;
6286
+ }, []), Vt = useCallback((e, t) => {
6287
+ let n = I.current;
6286
6288
  if (!n) return;
6287
6289
  let r = n.getSource("circle-preview-source");
6288
6290
  if (!r) return;
6289
- let i = zt(e, t), a = Rt(e, i);
6291
+ let i = Bt(e, t), a = zt(e, i);
6290
6292
  r.setData({
6291
6293
  type: "Feature",
6292
6294
  geometry: {
@@ -6295,9 +6297,9 @@ const Mapbox = forwardRef((e, c) => {
6295
6297
  },
6296
6298
  properties: {}
6297
6299
  });
6298
- let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6300
+ let o = G.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6299
6301
  n.getLayer("circle-preview-line") && (n.setPaintProperty("circle-preview-line", "line-color", s), n.setPaintProperty("circle-preview-line", "line-width", c)), n.getLayer("circle-preview-fill") && (n.setPaintProperty("circle-preview-fill", "fill-color", l), n.setPaintProperty("circle-preview-fill", "fill-opacity", u));
6300
- let d = Nn.current, f = [], p = [];
6302
+ let d = Pn.current, f = [], p = [];
6301
6303
  if (d?.showArea) {
6302
6304
  let t = Math.PI * i * i;
6303
6305
  f.push({
@@ -6310,7 +6312,7 @@ const Mapbox = forwardRef((e, c) => {
6310
6312
  });
6311
6313
  }
6312
6314
  if (d?.showRadius) {
6313
- let t = K.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
6315
+ let t = G.current?.radiusAngle ?? 90, n = destinationPoint(e, i, t), r = [(e[0] + n[0]) / 2, (e[1] + n[1]) / 2];
6314
6316
  p.push({
6315
6317
  type: "Feature",
6316
6318
  geometry: {
@@ -6337,8 +6339,8 @@ const Mapbox = forwardRef((e, c) => {
6337
6339
  type: "FeatureCollection",
6338
6340
  features: p
6339
6341
  });
6340
- }, [zt, Rt]), Vt = useCallback(() => {
6341
- let e = L.current;
6342
+ }, [Bt, zt]), Ht = useCallback(() => {
6343
+ let e = I.current;
6342
6344
  if (!e) return;
6343
6345
  let t = e.getSource("circle-preview-source");
6344
6346
  t && t.setData({
@@ -6355,10 +6357,10 @@ const Mapbox = forwardRef((e, c) => {
6355
6357
  type: "FeatureCollection",
6356
6358
  features: []
6357
6359
  });
6358
- }, []), Ht = useCallback(() => {
6359
- lt.current = null, Vt();
6360
- }, [Vt]), Ut = useCallback(() => {
6361
- let e = L.current;
6360
+ }, []), Ut = useCallback(() => {
6361
+ ut.current = null, Ht();
6362
+ }, [Ht]), Wt = useCallback(() => {
6363
+ let e = I.current;
6362
6364
  e && (e.getSource("polygon-preview-source") || (e.addSource("polygon-preview-source", {
6363
6365
  type: "geojson",
6364
6366
  data: {
@@ -6398,9 +6400,9 @@ const Mapbox = forwardRef((e, c) => {
6398
6400
  "circle-stroke-color": "#ffffff",
6399
6401
  "circle-stroke-width": 2
6400
6402
  }
6401
- }), Nt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6402
- }, [Nt]), Wt = useCallback((e, t) => {
6403
- let n = L.current;
6403
+ }), Pt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
6404
+ }, [Pt]), Gt = useCallback((e, t) => {
6405
+ let n = I.current;
6404
6406
  if (!n) return;
6405
6407
  let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
6406
6408
  if (!r || !i) return;
@@ -6437,11 +6439,11 @@ const Mapbox = forwardRef((e, c) => {
6437
6439
  properties: {}
6438
6440
  }))
6439
6441
  });
6440
- let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6442
+ let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6441
6443
  n.getLayer("polygon-preview-line") && (n.setPaintProperty("polygon-preview-line", "line-color", s), n.setPaintProperty("polygon-preview-line", "line-width", c)), n.getLayer("polygon-preview-fill") && (n.setPaintProperty("polygon-preview-fill", "fill-color", l), n.setPaintProperty("polygon-preview-fill", "fill-opacity", u)), n.getLayer("polygon-vertices") && n.setPaintProperty("polygon-vertices", "circle-color", s);
6442
6444
  let d = n.getSource("polygon-preview-measure-source");
6443
6445
  if (d) {
6444
- let e = Nn.current, t = [];
6446
+ let e = Pn.current, t = [];
6445
6447
  if (e?.showArea && a.length >= 3) {
6446
6448
  let e = [...a, a[0]], n = polygonArea(e), r = 0, i = 0;
6447
6449
  for (let e of a) r += e[0], i += e[1];
@@ -6483,8 +6485,8 @@ const Mapbox = forwardRef((e, c) => {
6483
6485
  features: t
6484
6486
  });
6485
6487
  }
6486
- }, []), Gt = useCallback(() => {
6487
- let e = L.current;
6488
+ }, []), Kt = useCallback(() => {
6489
+ let e = I.current;
6488
6490
  if (!e) return;
6489
6491
  let t = e.getSource("polygon-preview-source");
6490
6492
  t && t.setData({
@@ -6501,10 +6503,10 @@ const Mapbox = forwardRef((e, c) => {
6501
6503
  type: "FeatureCollection",
6502
6504
  features: []
6503
6505
  });
6504
- }, []), Kt = useCallback(() => {
6505
- ut.current = [], Gt();
6506
- }, [Gt]), qt = useCallback(() => {
6507
- let e = L.current;
6506
+ }, []), qt = useCallback(() => {
6507
+ dt.current = [], Kt();
6508
+ }, [Kt]), Jt = useCallback(() => {
6509
+ let e = I.current;
6508
6510
  e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
6509
6511
  type: "geojson",
6510
6512
  data: {
@@ -6528,8 +6530,8 @@ const Mapbox = forwardRef((e, c) => {
6528
6530
  "line-width": 2,
6529
6531
  "line-dasharray": [4, 4]
6530
6532
  }
6531
- }), Nt(e, "square-preview-measure-source", "square-preview-measure-label")));
6532
- }, [Nt]), Jt = useCallback((e, t) => {
6533
+ }), Pt(e, "square-preview-measure-source", "square-preview-measure-label")));
6534
+ }, [Pt]), Yt = useCallback((e, t) => {
6533
6535
  let [n, r] = e, i = t / 2 / 6371e3, a = r * Math.PI / 180, o = i * 180 / Math.PI, s = i * 180 / Math.PI / Math.cos(a);
6534
6536
  return [
6535
6537
  [n - s, r + o],
@@ -6538,12 +6540,12 @@ const Mapbox = forwardRef((e, c) => {
6538
6540
  [n - s, r - o],
6539
6541
  [n - s, r + o]
6540
6542
  ];
6541
- }, []), Yt = useCallback((e, t) => {
6542
- let n = L.current;
6543
+ }, []), Xt = useCallback((e, t) => {
6544
+ let n = I.current;
6543
6545
  if (!n) return;
6544
6546
  let r = n.getSource("square-preview-source");
6545
6547
  if (!r) return;
6546
- let i = zt(e, t) * 2, a = Jt(e, i);
6548
+ let i = Bt(e, t) * 2, a = Yt(e, i);
6547
6549
  r.setData({
6548
6550
  type: "Feature",
6549
6551
  geometry: {
@@ -6552,11 +6554,11 @@ const Mapbox = forwardRef((e, c) => {
6552
6554
  },
6553
6555
  properties: {}
6554
6556
  });
6555
- let o = J.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6557
+ let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
6556
6558
  n.getLayer("square-preview-line") && (n.setPaintProperty("square-preview-line", "line-color", s), n.setPaintProperty("square-preview-line", "line-width", c)), n.getLayer("square-preview-fill") && (n.setPaintProperty("square-preview-fill", "fill-color", l), n.setPaintProperty("square-preview-fill", "fill-opacity", u));
6557
6559
  let d = n.getSource("square-preview-measure-source");
6558
6560
  if (d) {
6559
- let t = Nn.current, n = [];
6561
+ let t = Pn.current, n = [];
6560
6562
  if (t?.showArea && n.push({
6561
6563
  type: "Feature",
6562
6564
  geometry: {
@@ -6580,8 +6582,8 @@ const Mapbox = forwardRef((e, c) => {
6580
6582
  features: n
6581
6583
  });
6582
6584
  }
6583
- }, [zt, Jt]), Xt = useCallback(() => {
6584
- let e = L.current;
6585
+ }, [Bt, Yt]), Zt = useCallback(() => {
6586
+ let e = I.current;
6585
6587
  if (!e) return;
6586
6588
  let t = e.getSource("square-preview-source");
6587
6589
  t && t.setData({
@@ -6593,10 +6595,10 @@ const Mapbox = forwardRef((e, c) => {
6593
6595
  type: "FeatureCollection",
6594
6596
  features: []
6595
6597
  });
6596
- }, []), Zt = useCallback(() => {
6597
- dt.current = null, Xt();
6598
- }, [Xt]), Qt = useCallback(() => {
6599
- let e = L.current;
6598
+ }, []), Qt = useCallback(() => {
6599
+ ft.current = null, Zt();
6600
+ }, [Zt]), $t = useCallback(() => {
6601
+ let e = I.current;
6600
6602
  e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
6601
6603
  type: "geojson",
6602
6604
  data: {
@@ -6628,9 +6630,9 @@ const Mapbox = forwardRef((e, c) => {
6628
6630
  "circle-stroke-color": "#ffffff",
6629
6631
  "circle-stroke-width": 2
6630
6632
  }
6631
- }), Nt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6632
- }, [Nt]), $t = useCallback((e, t) => {
6633
- let n = L.current;
6633
+ }), Pt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
6634
+ }, [Pt]), en = useCallback((e, t) => {
6635
+ let n = I.current;
6634
6636
  if (!n) return;
6635
6637
  let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
6636
6638
  if (!r || !i) return;
@@ -6656,11 +6658,11 @@ const Mapbox = forwardRef((e, c) => {
6656
6658
  properties: {}
6657
6659
  }))
6658
6660
  });
6659
- let o = ft.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6661
+ let o = pt.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
6660
6662
  n.getLayer("polyline-preview-line") && (n.setPaintProperty("polyline-preview-line", "line-color", s), n.setPaintProperty("polyline-preview-line", "line-width", c)), n.getLayer("polyline-vertices") && n.setPaintProperty("polyline-vertices", "circle-color", s);
6661
6663
  let l = n.getSource("polyline-preview-measure-source");
6662
6664
  if (l) {
6663
- let e = Nn.current, t = [];
6665
+ let e = Pn.current, t = [];
6664
6666
  if (e?.showLength && a.length >= 2) for (let e = 0; e < a.length - 1; e++) {
6665
6667
  let n = a[e], r = a[e + 1], i = [(n[0] + r[0]) / 2, (n[1] + r[1]) / 2];
6666
6668
  t.push({
@@ -6677,8 +6679,8 @@ const Mapbox = forwardRef((e, c) => {
6677
6679
  features: t
6678
6680
  });
6679
6681
  }
6680
- }, []), en = useCallback(() => {
6681
- let e = L.current;
6682
+ }, []), tn = useCallback(() => {
6683
+ let e = I.current;
6682
6684
  if (!e) return;
6683
6685
  let t = e.getSource("polyline-preview-source");
6684
6686
  t && t.setData({
@@ -6695,159 +6697,159 @@ const Mapbox = forwardRef((e, c) => {
6695
6697
  type: "FeatureCollection",
6696
6698
  features: []
6697
6699
  });
6698
- }, []), Q = useCallback(() => {
6699
- pt.current = [], en();
6700
- }, [en]), tn = useCallback((e) => {
6701
- H(e), Mt(e), e ? (U("marker"), Z(), Ht(), Kt(), Zt(), Q()) : U(null);
6700
+ }, []), Z = useCallback(() => {
6701
+ mt.current = [], tn();
6702
+ }, [tn]), nn = useCallback((e) => {
6703
+ V(e), Nt(e), e ? (H("marker"), X(), Ut(), qt(), Qt(), Z()) : H(null);
6702
6704
  }, [
6703
- Mt,
6704
- Z,
6705
- Ht,
6706
- Kt,
6707
- Zt,
6708
- Q
6709
- ]), nn = useCallback((e) => {
6710
- if (U(e), e === "rectangle") {
6711
- H(null), X(), Ht(), Kt(), Zt(), Q();
6712
- let e = L.current;
6705
+ Nt,
6706
+ X,
6707
+ Ut,
6708
+ qt,
6709
+ Qt,
6710
+ Z
6711
+ ]), rn = useCallback((e) => {
6712
+ if (H(e), e === "rectangle") {
6713
+ V(null), Y(), Ut(), qt(), Qt(), Z();
6714
+ let e = I.current;
6713
6715
  e && (e.getCanvas().style.cursor = "crosshair");
6714
6716
  } else if (e === "circle") {
6715
- H(null), X(), Z(), Kt(), Zt(), Q();
6716
- let e = L.current;
6717
+ V(null), Y(), X(), qt(), Qt(), Z();
6718
+ let e = I.current;
6717
6719
  e && (e.getCanvas().style.cursor = "crosshair");
6718
6720
  } else if (e === "polygon") {
6719
- H(null), X(), Z(), Ht(), Zt(), Q();
6720
- let e = L.current;
6721
+ V(null), Y(), X(), Ut(), Qt(), Z();
6722
+ let e = I.current;
6721
6723
  e && (e.getCanvas().style.cursor = "crosshair");
6722
6724
  } else if (e === "square") {
6723
- H(null), X(), Z(), Ht(), Kt(), Q();
6724
- let e = L.current;
6725
+ V(null), Y(), X(), Ut(), qt(), Z();
6726
+ let e = I.current;
6725
6727
  e && (e.getCanvas().style.cursor = "crosshair");
6726
6728
  } else if (e === "polyline") {
6727
- H(null), X(), Z(), Ht(), Kt(), Zt();
6728
- let e = L.current;
6729
+ V(null), Y(), X(), Ut(), qt(), Qt();
6730
+ let e = I.current;
6729
6731
  e && (e.getCanvas().style.cursor = "crosshair");
6730
- } else e === "marker" ? (Z(), Ht(), Kt(), Zt(), Q()) : (H(null), X(), Z(), Ht(), Kt(), Zt(), Q());
6732
+ } else e === "marker" ? (X(), Ut(), qt(), Qt(), Z()) : (V(null), Y(), X(), Ut(), qt(), Qt(), Z());
6731
6733
  }, [
6734
+ Y,
6732
6735
  X,
6733
- Z,
6734
- Ht,
6735
- Kt,
6736
- Zt,
6737
- Q
6738
- ]), rn = useCallback((e) => {
6736
+ Ut,
6737
+ qt,
6738
+ Qt,
6739
+ Z
6740
+ ]), an = useCallback((e) => {
6739
6741
  if (e !== "picker") {
6740
6742
  let e = y.value && isFinite(y.value.lng) && isFinite(y.value.lat), t = y.showMarker !== !1;
6741
- (!e || !t) && At(), nt(null);
6743
+ (!e || !t) && jt(), rt(null);
6742
6744
  }
6743
- e !== "edit" && (H(null), U(null), Z(), Q(), X()), et(e);
6745
+ e !== "edit" && (V(null), H(null), X(), Z(), Y()), tt(e);
6744
6746
  }, [
6745
- At,
6747
+ jt,
6748
+ Y,
6746
6749
  X,
6747
- Z,
6748
- Q
6749
- ]), an = useCallback(() => $e, [$e]), on = useCallback(() => tt, [tt]), sn = useCallback(() => {
6750
- At(), nt(null);
6751
- }, [At]);
6750
+ Z
6751
+ ]), on = useCallback(() => et, [et]), sn = useCallback(() => nt, [nt]), cn = useCallback(() => {
6752
+ jt(), rt(null);
6753
+ }, [jt]);
6752
6754
  useEffect(() => {
6753
- if (!V) return;
6755
+ if (!B) return;
6754
6756
  let e = y.value;
6755
6757
  if (e && isFinite(e.lng) && isFinite(e.lat)) {
6756
6758
  let t = [e.lng, e.lat];
6757
- nt(e), kt(t);
6759
+ rt(e), At(t);
6758
6760
  }
6759
6761
  }, [
6760
6762
  y.value,
6761
- kt,
6762
- V
6763
+ At,
6764
+ B
6763
6765
  ]);
6764
- let cn = (e) => "mode" in e, ln = useCallback((e) => {
6765
- if (et("edit"), At(), nt(null), W.current = !0, cn(e)) {
6766
- if (e.mode === "marker") e.markerStyle ? (ct.current = e.markerStyle, G.current = null, K.current = null, q.current = null, J.current = null, ft.current = null, H(null), U("marker"), e.markerStyle.src && e.markerStyle.width ? Mt({
6766
+ let ln = (e) => "mode" in e, un = useCallback((e) => {
6767
+ if (tt("edit"), jt(), rt(null), U.current = !0, ln(e)) {
6768
+ if (e.mode === "marker") e.markerStyle ? (lt.current = e.markerStyle, W.current = null, G.current = null, K.current = null, q.current = null, pt.current = null, V(null), H("marker"), e.markerStyle.src && e.markerStyle.width ? Nt({
6767
6769
  id: "custom",
6768
6770
  name: e.markerStyle.name || "Marker",
6769
6771
  icon: e.markerStyle.src,
6770
6772
  width: e.markerStyle.width
6771
- }) : X()) : e.template && (ct.current = null, G.current = null, K.current = null, q.current = null, J.current = null, ft.current = null, H(e.template), U("marker"), Mt(e.template));
6773
+ }) : Y()) : e.template && (lt.current = null, W.current = null, G.current = null, K.current = null, q.current = null, pt.current = null, V(e.template), H("marker"), Nt(e.template));
6772
6774
  else if (e.mode === "rectangle") {
6773
- G.current = e.rectangleStyle || null, ct.current = null, K.current = null, q.current = null, J.current = null, ft.current = null, H(null), U("rectangle"), X();
6774
- let t = L.current;
6775
+ W.current = e.rectangleStyle || null, lt.current = null, G.current = null, K.current = null, q.current = null, pt.current = null, V(null), H("rectangle"), Y();
6776
+ let t = I.current;
6775
6777
  t && (t.getCanvas().style.cursor = "crosshair");
6776
6778
  } else if (e.mode === "circle") {
6777
- K.current = e.circleStyle || null, G.current = null, ct.current = null, q.current = null, J.current = null, ft.current = null, H(null), U("circle"), X();
6778
- let t = L.current;
6779
+ G.current = e.circleStyle || null, W.current = null, lt.current = null, K.current = null, q.current = null, pt.current = null, V(null), H("circle"), Y();
6780
+ let t = I.current;
6779
6781
  t && (t.getCanvas().style.cursor = "crosshair");
6780
6782
  } else if (e.mode === "polygon") {
6781
- q.current = e.polygonStyle || null, G.current = null, ct.current = null, K.current = null, J.current = null, ft.current = null, H(null), U("polygon"), X();
6782
- let t = L.current;
6783
+ K.current = e.polygonStyle || null, W.current = null, lt.current = null, G.current = null, q.current = null, pt.current = null, V(null), H("polygon"), Y();
6784
+ let t = I.current;
6783
6785
  t && (t.getCanvas().style.cursor = "crosshair");
6784
6786
  } else if (e.mode === "square") {
6785
- J.current = e.squareStyle || null, G.current = null, ct.current = null, K.current = null, q.current = null, ft.current = null, H(null), U("square"), X();
6786
- let t = L.current;
6787
+ q.current = e.squareStyle || null, W.current = null, lt.current = null, G.current = null, K.current = null, pt.current = null, V(null), H("square"), Y();
6788
+ let t = I.current;
6787
6789
  t && (t.getCanvas().style.cursor = "crosshair");
6788
6790
  } else if (e.mode === "polyline") {
6789
- ft.current = e.polylineStyle || null, G.current = null, ct.current = null, K.current = null, q.current = null, J.current = null, H(null), U("polyline"), X();
6790
- let t = L.current;
6791
+ pt.current = e.polylineStyle || null, W.current = null, lt.current = null, G.current = null, K.current = null, q.current = null, V(null), H("polyline"), Y();
6792
+ let t = I.current;
6791
6793
  t && (t.getCanvas().style.cursor = "crosshair");
6792
6794
  }
6793
- } else H(e), U("marker"), Mt(e), G.current = null, ct.current = null, K.current = null, q.current = null, J.current = null, ft.current = null;
6795
+ } else V(e), H("marker"), Nt(e), W.current = null, lt.current = null, G.current = null, K.current = null, q.current = null, pt.current = null;
6794
6796
  }, [
6795
- At,
6796
- Mt,
6797
- X
6797
+ jt,
6798
+ Nt,
6799
+ Y
6798
6800
  ]);
6799
6801
  useImperativeHandle(c, () => ({
6800
- startAnimation: yt,
6801
- stopAnimation: bt,
6802
- toggleAnimation: xt,
6803
- getMap: () => L.current,
6804
- openPopup: (e) => Ct(e, "programmatic"),
6805
- closePopup: wt,
6806
- closeAllPopups: Tt,
6807
- isPopupOpen: Et,
6808
- toggleUnitTrajectory: St,
6809
- flyTo: Dt,
6810
- flyToEntities: Ot,
6811
- getMode: an,
6812
- setMode: rn,
6813
- getPickedLocation: on,
6814
- clearPickedLocation: sn,
6815
- startDrawing: ln,
6816
- getRenderer: (e) => R.current.get(e),
6802
+ startAnimation: bt,
6803
+ stopAnimation: xt,
6804
+ toggleAnimation: St,
6805
+ getMap: () => I.current,
6806
+ openPopup: (e) => wt(e, "programmatic"),
6807
+ closePopup: Tt,
6808
+ closeAllPopups: Et,
6809
+ isPopupOpen: Dt,
6810
+ toggleUnitTrajectory: Ct,
6811
+ flyTo: Ot,
6812
+ flyToEntities: kt,
6813
+ getMode: on,
6814
+ setMode: an,
6815
+ getPickedLocation: sn,
6816
+ clearPickedLocation: cn,
6817
+ startDrawing: un,
6818
+ getRenderer: (e) => L.current.get(e),
6817
6819
  setEditingEntities: (e) => {
6818
- for (let t of vt.current) e.map(String).includes(String(t)) || R.current.get(t)?.setEditing?.(!1);
6819
- for (let t of e) R.current.get(t)?.setEditing?.(!0);
6820
- Y.current &&= (R.current.get(Y.current.entityId)?.cancelEditPreview?.(), null), _t(e);
6820
+ for (let t of yt.current) e.map(String).includes(String(t)) || L.current.get(t)?.setEditing?.(!1);
6821
+ for (let t of e) L.current.get(t)?.setEditing?.(!0);
6822
+ J.current &&= (L.current.get(J.current.entityId)?.cancelEditPreview?.(), null), vt(e);
6821
6823
  },
6822
- getEditingEntities: () => vt.current,
6824
+ getEditingEntities: () => yt.current,
6823
6825
  startRoutePlanning: (e) => {
6824
- He.current?.startPlanning(e);
6826
+ Ue.current?.startPlanning(e);
6825
6827
  }
6826
6828
  }), [
6827
- yt,
6828
6829
  bt,
6829
6830
  xt,
6830
- Ct,
6831
+ St,
6831
6832
  wt,
6832
6833
  Tt,
6833
6834
  Et,
6834
- St,
6835
6835
  Dt,
6836
+ Ct,
6836
6837
  Ot,
6837
- an,
6838
- rn,
6838
+ kt,
6839
6839
  on,
6840
+ an,
6840
6841
  sn,
6841
- ln
6842
+ cn,
6843
+ un
6842
6844
  ]);
6843
- let un = useCallback(() => {
6844
- let e = L.current;
6845
+ let dn = useCallback(() => {
6846
+ let e = I.current;
6845
6847
  if (!e) return;
6846
- let t = new Set(E.map((e) => e.id)), n = new Set(R.current.keys());
6847
- for (let e of n) t.has(e) || (R.current.get(e)?.destroy(), R.current.delete(e));
6848
- let r = new Set(D.map(String));
6849
- for (let t of E) {
6850
- let n = applyEntityConfig(t, O), i = R.current.get(n.id);
6848
+ let t = new Set(T.map((e) => e.id)), n = new Set(L.current.keys());
6849
+ for (let e of n) t.has(e) || (L.current.get(e)?.destroy(), L.current.delete(e));
6850
+ let r = new Set(E.map(String));
6851
+ for (let t of T) {
6852
+ let n = applyEntityConfig(t, D), i = L.current.get(n.id);
6851
6853
  if (i) if (n.type === "radar" && i instanceof CanvasRadarRenderer) i.update(n);
6852
6854
  else if (n.type === "image" && i instanceof CanvasImageRenderer) i.update(n);
6853
6855
  else if (n.type === "marker" && i instanceof MarkerRenderer) i.update(n);
@@ -6856,38 +6858,38 @@ const Mapbox = forwardRef((e, c) => {
6856
6858
  else if (n.type === "circle") if (n.fillType === "radial-gradient") if (i instanceof CanvasCircleRenderer) i.update(n);
6857
6859
  else {
6858
6860
  i.destroy();
6859
- let t = new CanvasCircleRenderer(e, n, k, A, j, M);
6860
- R.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6861
+ let t = new CanvasCircleRenderer(e, n, O, k, A, j);
6862
+ L.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6861
6863
  }
6862
6864
  else if (i instanceof CircleRenderer) i.update(n);
6863
6865
  else {
6864
6866
  i.destroy();
6865
- let t = new CircleRenderer(e, n, k, A, j, M);
6866
- R.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6867
+ let t = new CircleRenderer(e, n, O, k, A, j);
6868
+ L.current.set(n.id, t), t.setSelected(r.has(String(n.id)));
6867
6869
  }
6868
6870
  else (n.type === "square" && i instanceof SquareRenderer || n.type === "rectangle" && i instanceof RectangleRenderer || n.type === "polyline" && i instanceof PolylineRenderer) && i.update(n);
6869
6871
  else {
6870
6872
  let t = null;
6871
- n.type === "radar" ? t = new CanvasRadarRenderer(e, n, k, A) : n.type === "image" ? t = new CanvasImageRenderer(e, n, k, A) : n.type === "marker" ? t = new MarkerRenderer(e, n, k, A) : n.type === "unit" ? t = new UnitRenderer(e, n, k, A) : n.type === "polygon" ? t = new PolygonRenderer(e, n, k, A, j, N) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, k, A, j, M) : new CircleRenderer(e, n, k, A, j, M) : n.type === "square" ? t = new SquareRenderer(e, n, k, A, j, N) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, k, A, j, N) : n.type === "polyline" && (t = new PolylineRenderer(e, n, k, A, N)), t && (R.current.set(n.id, t), t.setSelected(r.has(String(n.id))), vt.current.map(String).includes(String(n.id)) && t.setEditing?.(!0));
6873
+ n.type === "radar" ? t = new CanvasRadarRenderer(e, n, O, k) : n.type === "image" ? t = new CanvasImageRenderer(e, n, O, k) : n.type === "marker" ? t = new MarkerRenderer(e, n, O, k) : n.type === "unit" ? t = new UnitRenderer(e, n, O, k) : n.type === "polygon" ? t = new PolygonRenderer(e, n, O, k, A, M) : n.type === "circle" ? t = n.fillType === "radial-gradient" ? new CanvasCircleRenderer(e, n, O, k, A, j) : new CircleRenderer(e, n, O, k, A, j) : n.type === "square" ? t = new SquareRenderer(e, n, O, k, A, M) : n.type === "rectangle" ? t = new RectangleRenderer(e, n, O, k, A, M) : n.type === "polyline" && (t = new PolylineRenderer(e, n, O, k, M)), t && (L.current.set(n.id, t), t.setSelected(r.has(String(n.id))), yt.current.map(String).includes(String(n.id)) && t.setEditing?.(!0));
6872
6874
  }
6873
6875
  }
6874
- for (let e of vt.current) {
6875
- let t = R.current.get(e);
6876
+ for (let e of yt.current) {
6877
+ let t = L.current.get(e);
6876
6878
  t && t.setEditing?.(!0);
6877
6879
  }
6878
6880
  }, [
6881
+ T,
6879
6882
  E,
6880
6883
  D,
6881
6884
  O,
6882
6885
  k,
6883
6886
  A,
6884
6887
  j,
6885
- M,
6886
- N
6887
- ]), dn = useCallback(() => {
6888
- for (let e of R.current.values()) e.destroy();
6889
- R.current.clear();
6890
- }, []), fn = useCallback((e) => {
6888
+ M
6889
+ ]), fn = useCallback(() => {
6890
+ for (let e of L.current.values()) e.destroy();
6891
+ L.current.clear();
6892
+ }, []), pn = useCallback((e) => {
6891
6893
  let t = e.getStyle();
6892
6894
  if (!t?.layers) return;
6893
6895
  let n = [
@@ -6902,10 +6904,10 @@ const Mapbox = forwardRef((e, c) => {
6902
6904
  "marker-"
6903
6905
  ];
6904
6906
  for (let e of t.layers) if (n.some((t) => e.id.startsWith(t))) return e.id;
6905
- }, []), pn = useCallback((e) => {
6906
- let t = T, n = { "raster-opacity": e.opacity ?? 1 }, r = e.brightness ?? t?.brightness, i = e.saturation ?? t?.saturation, a = e.contrast ?? t?.contrast, o = e.hueRotate ?? t?.hueRotate;
6907
+ }, []), mn = useCallback((e) => {
6908
+ let t = w, n = { "raster-opacity": e.opacity ?? 1 }, r = e.brightness ?? t?.brightness, i = e.saturation ?? t?.saturation, a = e.contrast ?? t?.contrast, o = e.hueRotate ?? t?.hueRotate;
6907
6909
  return r !== void 0 && (n["raster-brightness-min"] = 0, n["raster-brightness-max"] = r), i !== void 0 && (n["raster-saturation"] = i), a !== void 0 && (n["raster-contrast"] = a), o !== void 0 && (n["raster-hue-rotate"] = o), n;
6908
- }, [T]), mn = useCallback((e, t) => {
6910
+ }, [w]), hn = useCallback((e, t) => {
6909
6911
  let n = `base-layer-source-${t.id}`, r = `base-layer-${t.id}`, i = {
6910
6912
  type: "raster",
6911
6913
  tiles: [t.url],
@@ -6915,27 +6917,28 @@ const Mapbox = forwardRef((e, c) => {
6915
6917
  scheme: t.scheme ?? "xyz"
6916
6918
  };
6917
6919
  t.bounds && (i.bounds = t.bounds), t.attribution && (i.attribution = t.attribution), e.addSource(n, i);
6918
- let a = fn(e);
6920
+ let a = pn(e);
6919
6921
  e.addLayer({
6920
6922
  id: r,
6921
6923
  type: "raster",
6922
6924
  source: n,
6923
- paint: pn(t),
6925
+ paint: mn(t),
6924
6926
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
6925
6927
  }, a);
6926
- }, [fn, pn]), hn = useCallback(async (e, t) => {
6928
+ }, [pn, mn]), gn = useCallback(async (e, t) => {
6927
6929
  try {
6928
6930
  let n = await (await fetch(t.url)).json(), r = `base-layer-source-${t.id}`, i = `base-layer-${t.id}`;
6929
- if (!Ue.current.has(t.id)) return;
6930
- let a = n.format === "pbf" || n.vector_layers, o = fn(e);
6931
- a ? (e.addSource(r, {
6932
- type: "vector",
6933
- tiles: n.tiles,
6934
- minzoom: n.minzoom ?? 0,
6935
- maxzoom: n.maxzoom ?? 22,
6936
- bounds: n.bounds,
6937
- attribution: n.attribution
6938
- }), console.warn(`TileJSON "${t.id}" 是矢量瓦片,建议使用 type: 'style' 加载完整样式`)) : (e.addSource(r, {
6931
+ if (!We.current.has(t.id)) return;
6932
+ let a = n.format === "pbf" || n.vector_layers, o = pn(e);
6933
+ if (a) {
6934
+ let t = {
6935
+ type: "vector",
6936
+ tiles: n.tiles,
6937
+ minzoom: n.minzoom ?? 0,
6938
+ maxzoom: n.maxzoom ?? 22
6939
+ };
6940
+ n.bounds && (t.bounds = n.bounds), n.attribution && (t.attribution = n.attribution), e.addSource(r, t);
6941
+ } else e.addSource(r, {
6939
6942
  type: "raster",
6940
6943
  tiles: n.tiles,
6941
6944
  tileSize: t.tileSize ?? n.tileSize ?? 256,
@@ -6947,21 +6950,21 @@ const Mapbox = forwardRef((e, c) => {
6947
6950
  id: i,
6948
6951
  type: "raster",
6949
6952
  source: r,
6950
- paint: pn(t),
6953
+ paint: mn(t),
6951
6954
  layout: { visibility: t.visible === !1 ? "none" : "visible" }
6952
- }, o));
6955
+ }, o);
6953
6956
  } catch (e) {
6954
6957
  console.error(`Failed to load TileJSON from ${t.url}:`, e);
6955
6958
  }
6956
- }, [fn, pn]), gn = useCallback(async (e, t) => {
6959
+ }, [pn, mn]), _n = useCallback(async (e, t) => {
6957
6960
  try {
6958
6961
  let n = await (await fetch(t.url)).json();
6959
- if (!Ue.current.has(t.id)) return;
6962
+ if (!We.current.has(t.id)) return;
6960
6963
  if (n.sources) for (let [r, i] of Object.entries(n.sources)) {
6961
6964
  let n = `base-layer-source-${t.id}-${r}`;
6962
6965
  e.getSource(n) || e.addSource(n, i);
6963
6966
  }
6964
- let r = fn(e);
6967
+ let r = pn(e);
6965
6968
  if (n.layers) for (let i of n.layers) {
6966
6969
  let n = `base-layer-${t.id}-${i.id}`;
6967
6970
  if (e.getLayer(n)) continue;
@@ -6972,7 +6975,7 @@ const Mapbox = forwardRef((e, c) => {
6972
6975
  };
6973
6976
  i.type === "raster" && (a.paint = {
6974
6977
  ...a.paint,
6975
- ...pn(t)
6978
+ ...mn(t)
6976
6979
  }), t.visible === !1 && (a.layout = {
6977
6980
  ...a.layout,
6978
6981
  visibility: "none"
@@ -6985,50 +6988,50 @@ const Mapbox = forwardRef((e, c) => {
6985
6988
  } catch (e) {
6986
6989
  console.error(`Failed to load Style JSON from ${t.url}:`, e);
6987
6990
  }
6988
- }, [fn, pn]), _n = useCallback((e, t) => {
6991
+ }, [pn, mn]), vn = useCallback((e, t) => {
6989
6992
  let n = e.getStyle();
6990
6993
  if (!n) return;
6991
6994
  let r = `base-layer-${t}`, i = n.layers?.filter((e) => e.id.startsWith(r)) ?? [];
6992
6995
  for (let t of i) e.getLayer(t.id) && e.removeLayer(t.id);
6993
6996
  let a = `base-layer-source-${t}`, o = n.sources ?? {};
6994
6997
  for (let t of Object.keys(o)) t.startsWith(a) && e.getSource(t) && e.removeSource(t);
6995
- }, []), vn = useCallback((e) => {
6996
- let t = L.current;
6998
+ }, []), yn = useCallback((e) => {
6999
+ let t = I.current;
6997
7000
  if (!t) return;
6998
- let n = new Set(e.map((e) => e.id)), r = Ue.current;
6999
- for (let e of r) n.has(e) || (_n(t, e), r.delete(e));
7001
+ let n = new Set(e.map((e) => e.id)), r = We.current;
7002
+ for (let e of r) n.has(e) || (vn(t, e), r.delete(e));
7000
7003
  for (let n of e) if (r.has(n.id)) {
7001
7004
  let e = `base-layer-${n.id}`;
7002
7005
  if (t.getLayer(e)) {
7003
- let r = pn(n);
7006
+ let r = mn(n);
7004
7007
  for (let [n, i] of Object.entries(r)) t.setPaintProperty(e, n, i);
7005
7008
  t.setLayoutProperty(e, "visibility", n.visible === !1 ? "none" : "visible");
7006
7009
  }
7007
7010
  } else switch (r.add(n.id), n.type) {
7008
7011
  case "raster":
7009
- mn(t, n);
7012
+ hn(t, n);
7010
7013
  break;
7011
7014
  case "tilejson":
7012
- hn(t, n);
7015
+ gn(t, n);
7013
7016
  break;
7014
7017
  case "style":
7015
- gn(t, n);
7018
+ _n(t, n);
7016
7019
  break;
7017
7020
  default: {
7018
7021
  let e = n;
7019
- e.url && mn(t, {
7022
+ e.url && hn(t, {
7020
7023
  ...e,
7021
7024
  type: "raster"
7022
7025
  });
7023
7026
  }
7024
7027
  }
7025
7028
  }, [
7026
- mn,
7027
7029
  hn,
7028
7030
  gn,
7029
7031
  _n,
7030
- pn
7031
- ]), yn = useCallback((e) => {
7032
+ vn,
7033
+ mn
7034
+ ]), bn = useCallback((e) => {
7032
7035
  let t = e;
7033
7036
  for (; t;) {
7034
7037
  let e = t.getAttribute?.("data-entity-id");
@@ -7036,158 +7039,158 @@ const Mapbox = forwardRef((e, c) => {
7036
7039
  t = t.parentElement;
7037
7040
  }
7038
7041
  return null;
7039
- }, []), bn = useCallback((e) => {
7042
+ }, []), xn = useCallback((e) => {
7040
7043
  let t = [e.lngLat.lng, e.lngLat.lat], n = {
7041
7044
  x: e.point.x,
7042
7045
  y: e.point.y
7043
- }, r = On.current;
7046
+ }, r = kn.current;
7044
7047
  if (r === "picker") {
7045
7048
  let e = {
7046
7049
  lng: t[0],
7047
7050
  lat: t[1]
7048
7051
  };
7049
- nt(e), kt(t), kn.current?.(e);
7052
+ rt(e), At(t), An.current?.(e);
7050
7053
  return;
7051
7054
  }
7052
- if (ht.current) return;
7055
+ if (gt.current) return;
7053
7056
  if (r === "edit") {
7054
- let e = jn.current;
7057
+ let e = Mn.current;
7055
7058
  if (e === "rectangle") {
7056
- let e = Mn.current;
7057
- if (!e) st(t);
7059
+ let e = Nn.current;
7060
+ if (!e) ct(t);
7058
7061
  else {
7059
- let n = G.current, r = applyEntityConfig({
7062
+ let n = W.current, r = applyEntityConfig({
7060
7063
  ...n,
7061
- id: n?.id ?? jt(),
7064
+ id: n?.id ?? Mt(),
7062
7065
  type: "rectangle",
7063
7066
  bounds: [e, t]
7064
- }, O);
7065
- It();
7066
- let i = L.current;
7067
- if (i && !R.current.has(r.id)) {
7068
- let e = new RectangleRenderer(i, r, k, A, j, N);
7069
- R.current.set(r.id, e);
7067
+ }, D);
7068
+ Lt();
7069
+ let i = I.current;
7070
+ if (i && !L.current.has(r.id)) {
7071
+ let e = new RectangleRenderer(i, r, O, k, A, M);
7072
+ L.current.set(r.id, e);
7070
7073
  }
7071
- $.current.onRectangleAdd?.(r), st(null), G.current = null, W.current && (W.current = !1, U(null), i && (i.getCanvas().style.cursor = ""));
7074
+ Q.current.onRectangleAdd?.(r), ct(null), W.current = null, U.current && (U.current = !1, H(null), i && (i.getCanvas().style.cursor = ""));
7072
7075
  }
7073
7076
  return;
7074
7077
  }
7075
7078
  if (e === "circle") {
7076
- let e = lt.current;
7077
- if (!e) lt.current = { center: t };
7079
+ let e = ut.current;
7080
+ if (!e) ut.current = { center: t };
7078
7081
  else {
7079
- let n = zt(e.center, t), r = K.current, i = applyEntityConfig({
7082
+ let n = Bt(e.center, t), r = G.current, i = applyEntityConfig({
7080
7083
  ...r,
7081
- id: r?.id ?? jt(),
7084
+ id: r?.id ?? Mt(),
7082
7085
  type: "circle",
7083
7086
  center: e.center,
7084
7087
  radius: n
7085
- }, O);
7086
- Vt();
7087
- let a = L.current;
7088
- if (a && !R.current.has(i.id)) {
7089
- let e = new CircleRenderer(a, i, k, A, j, M);
7090
- R.current.set(i.id, e);
7088
+ }, D);
7089
+ Ht();
7090
+ let a = I.current;
7091
+ if (a && !L.current.has(i.id)) {
7092
+ let e = new CircleRenderer(a, i, O, k, A, j);
7093
+ L.current.set(i.id, e);
7091
7094
  }
7092
- $.current.onCircleAdd?.(i), lt.current = null, K.current = null, W.current && (W.current = !1, U(null), a && (a.getCanvas().style.cursor = ""));
7095
+ Q.current.onCircleAdd?.(i), ut.current = null, G.current = null, U.current && (U.current = !1, H(null), a && (a.getCanvas().style.cursor = ""));
7093
7096
  }
7094
7097
  return;
7095
7098
  }
7096
7099
  if (e === "polygon") {
7097
- let e = ut.current;
7100
+ let e = dt.current;
7098
7101
  if (e.length >= 3) {
7099
7102
  let n = e[0];
7100
- if (zt(n, t) < 20) {
7101
- let t = q.current, n = applyEntityConfig({
7103
+ if (Bt(n, t) < 20) {
7104
+ let t = K.current, n = applyEntityConfig({
7102
7105
  ...t,
7103
- id: t?.id ?? jt(),
7106
+ id: t?.id ?? Mt(),
7104
7107
  type: "polygon",
7105
7108
  coordinates: [...e]
7106
- }, O);
7107
- Gt();
7108
- let r = L.current;
7109
- if (r && !R.current.has(n.id)) {
7110
- let e = new PolygonRenderer(r, n, k, A, j, N);
7111
- R.current.set(n.id, e);
7109
+ }, D);
7110
+ Kt();
7111
+ let r = I.current;
7112
+ if (r && !L.current.has(n.id)) {
7113
+ let e = new PolygonRenderer(r, n, O, k, A, M);
7114
+ L.current.set(n.id, e);
7112
7115
  }
7113
- $.current.onPolygonAdd?.(n), ut.current = [], q.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
7116
+ Q.current.onPolygonAdd?.(n), dt.current = [], K.current = null, U.current && (U.current = !1, H(null), r && (r.getCanvas().style.cursor = ""));
7114
7117
  return;
7115
7118
  }
7116
7119
  }
7117
- ut.current = [...e, t];
7120
+ dt.current = [...e, t];
7118
7121
  return;
7119
7122
  }
7120
7123
  if (e === "square") {
7121
- let e = dt.current;
7122
- if (!e) dt.current = { center: t };
7124
+ let e = ft.current;
7125
+ if (!e) ft.current = { center: t };
7123
7126
  else {
7124
- let n = zt(e.center, t) * 2, r = J.current, i = applyEntityConfig({
7127
+ let n = Bt(e.center, t) * 2, r = q.current, i = applyEntityConfig({
7125
7128
  ...r,
7126
- id: r?.id ?? jt(),
7129
+ id: r?.id ?? Mt(),
7127
7130
  type: "square",
7128
7131
  center: e.center,
7129
7132
  length: n
7130
- }, O);
7131
- Xt();
7132
- let a = L.current;
7133
- if (a && !R.current.has(i.id)) {
7134
- let e = new SquareRenderer(a, i, k, A, j, N);
7135
- R.current.set(i.id, e);
7133
+ }, D);
7134
+ Zt();
7135
+ let a = I.current;
7136
+ if (a && !L.current.has(i.id)) {
7137
+ let e = new SquareRenderer(a, i, O, k, A, M);
7138
+ L.current.set(i.id, e);
7136
7139
  }
7137
- $.current.onSquareAdd?.(i), dt.current = null, J.current = null, W.current && (W.current = !1, U(null), a && (a.getCanvas().style.cursor = ""));
7140
+ Q.current.onSquareAdd?.(i), ft.current = null, q.current = null, U.current && (U.current = !1, H(null), a && (a.getCanvas().style.cursor = ""));
7138
7141
  }
7139
7142
  return;
7140
7143
  }
7141
7144
  if (e === "polyline") {
7142
- pt.current = [...pt.current, t];
7145
+ mt.current = [...mt.current, t];
7143
7146
  return;
7144
7147
  }
7145
- let n = ct.current;
7148
+ let n = lt.current;
7146
7149
  if (n && n.src && n.width) {
7147
7150
  let e = {
7148
7151
  ...n,
7149
- id: n.id ?? jt(),
7152
+ id: n.id ?? Mt(),
7150
7153
  type: "marker",
7151
7154
  center: t,
7152
7155
  src: n.src,
7153
7156
  width: n.width
7154
7157
  };
7155
- $.current.onMarkerAdd?.(e), H(null), U(null), X(), ct.current = null, W.current = !1;
7158
+ Q.current.onMarkerAdd?.(e), V(null), H(null), Y(), lt.current = null, U.current = !1;
7156
7159
  return;
7157
7160
  }
7158
- let r = An.current;
7161
+ let r = jn.current;
7159
7162
  if (r) {
7160
7163
  let e = {
7161
- id: jt(),
7164
+ id: Mt(),
7162
7165
  type: "marker",
7163
7166
  name: r.name,
7164
7167
  center: t,
7165
7168
  src: r.icon,
7166
7169
  width: r.size || r.width || 32
7167
7170
  };
7168
- r.customData !== void 0 && (e.customData = r.customData), $.current.onMarkerAdd?.(e), H(null), U(null), X(), W.current = !1;
7171
+ r.customData !== void 0 && (e.customData = r.customData), Q.current.onMarkerAdd?.(e), V(null), H(null), Y(), U.current = !1;
7169
7172
  return;
7170
7173
  }
7171
7174
  }
7172
- if (vt.current.length > 0) {
7173
- let e = L.current?.getZoom() ?? 12;
7174
- if (Y.current) {
7175
- let { entityId: e, activeHandle: n } = Y.current, r = R.current.get(e);
7175
+ if (yt.current.length > 0) {
7176
+ let e = I.current?.getZoom() ?? 12;
7177
+ if (J.current) {
7178
+ let { entityId: e, activeHandle: n } = J.current, r = L.current.get(e);
7176
7179
  if (r?.applyHandleMove) {
7177
7180
  let e = r.applyHandleMove(n, t);
7178
- $.current.onEntityEdit?.(e);
7181
+ Q.current.onEntityEdit?.(e);
7179
7182
  }
7180
- Y.current = null;
7183
+ J.current = null;
7181
7184
  return;
7182
7185
  }
7183
- for (let n of vt.current) {
7184
- let r = R.current.get(n);
7186
+ for (let n of yt.current) {
7187
+ let r = L.current.get(n);
7185
7188
  if (!r?.getEditHandleAt) continue;
7186
7189
  let i = r.getEditHandleAt(t, e);
7187
7190
  if (i) {
7188
7191
  if (i.type === "midpoint" && r.addVertex) {
7189
7192
  let e = r.addVertex(i.index, i.position);
7190
- $.current.onEntityEdit?.(e), Y.current = {
7193
+ Q.current.onEntityEdit?.(e), J.current = {
7191
7194
  entityId: n,
7192
7195
  activeHandle: {
7193
7196
  type: "vertex",
@@ -7195,7 +7198,7 @@ const Mapbox = forwardRef((e, c) => {
7195
7198
  position: i.position
7196
7199
  }
7197
7200
  };
7198
- } else Y.current = {
7201
+ } else J.current = {
7199
7202
  entityId: n,
7200
7203
  activeHandle: i
7201
7204
  };
@@ -7203,186 +7206,186 @@ const Mapbox = forwardRef((e, c) => {
7203
7206
  }
7204
7207
  }
7205
7208
  }
7206
- let i = Tn.current, a = En.current, o = Dn.current, s = yn(e.originalEvent.target);
7209
+ let i = En.current, a = Dn.current, o = On.current, s = bn(e.originalEvent.target);
7207
7210
  if (s) {
7208
7211
  let e = i.find((e) => String(e.id) === s);
7209
7212
  if (e) {
7210
7213
  if (a?.(e), e.popup) {
7211
- let t = e.popup.content ?? Pe?.(e);
7212
- t && mergePopupConfig(e.popup, I, t).trigger === "click" && o(s, "click", n);
7214
+ let t = e.popup.content ?? Fe?.(e);
7215
+ t && mergePopupConfig(e.popup, F, t).trigger === "click" && o(s, "click", n);
7213
7216
  }
7214
7217
  return;
7215
7218
  }
7216
7219
  }
7217
- for (let [t, r] of R.current) {
7220
+ for (let [t, r] of L.current) {
7218
7221
  let s = r.getLabelLayerId();
7219
- if (s && L.current?.getLayer(s) && L.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7222
+ if (s && I.current?.getLayer(s) && I.current.queryRenderedFeatures(e.point, { layers: [s] }).length > 0) {
7220
7223
  let e = i.find((e) => e.id === t);
7221
7224
  if (e) {
7222
7225
  if (a?.(e), e.popup) {
7223
- let r = e.popup.content ?? Pe?.(e);
7224
- r && mergePopupConfig(e.popup, I, r).trigger === "click" && o(t, "click", n);
7226
+ let r = e.popup.content ?? Fe?.(e);
7227
+ r && mergePopupConfig(e.popup, F, r).trigger === "click" && o(t, "click", n);
7225
7228
  }
7226
7229
  return;
7227
7230
  }
7228
7231
  }
7229
7232
  }
7230
- for (let [e, r] of R.current) if (r.isPointInEntity(t)) {
7233
+ for (let [e, r] of L.current) if (r.isPointInEntity(t)) {
7231
7234
  let t = i.find((t) => t.id === e);
7232
7235
  if (t) {
7233
7236
  if (a?.(t), t.popup) {
7234
- let r = t.popup.content ?? Pe?.(t);
7235
- r && mergePopupConfig(t.popup, I, r).trigger === "click" && o(e, "click", n);
7237
+ let r = t.popup.content ?? Fe?.(t);
7238
+ r && mergePopupConfig(t.popup, F, r).trigger === "click" && o(e, "click", n);
7236
7239
  }
7237
7240
  return;
7238
7241
  }
7239
7242
  }
7240
7243
  }, [
7241
- I,
7242
- Pe,
7243
- yn
7244
- ]), xn = useCallback((e) => {
7244
+ F,
7245
+ Fe,
7246
+ bn
7247
+ ]), Sn = useCallback((e) => {
7245
7248
  let t = [e.lngLat.lng, e.lngLat.lat];
7246
- if (Y.current) {
7247
- let { entityId: e, activeHandle: n } = Y.current;
7248
- R.current.get(e)?.updateEditPreview?.(n, t);
7249
+ if (J.current) {
7250
+ let { entityId: e, activeHandle: n } = J.current;
7251
+ L.current.get(e)?.updateEditPreview?.(n, t);
7249
7252
  return;
7250
7253
  }
7251
- let n = jn.current, r = Mn.current;
7252
- n === "rectangle" && r && Ft(r, t);
7253
- let i = lt.current;
7254
- n === "circle" && i && Bt(i.center, t);
7255
- let a = ut.current;
7256
- n === "polygon" && a.length > 0 && Wt(a, t);
7257
- let o = dt.current;
7258
- n === "square" && o && Yt(o.center, t);
7259
- let s = pt.current;
7260
- n === "polyline" && s.length > 0 && $t(s, t);
7261
- let c = Tn.current, l = Dn.current;
7262
- for (let [e, n] of R.current) if (n.isPointInEntity(t)) {
7254
+ let n = Mn.current, r = Nn.current;
7255
+ n === "rectangle" && r && It(r, t);
7256
+ let i = ut.current;
7257
+ n === "circle" && i && Vt(i.center, t);
7258
+ let a = dt.current;
7259
+ n === "polygon" && a.length > 0 && Gt(a, t);
7260
+ let o = ft.current;
7261
+ n === "square" && o && Xt(o.center, t);
7262
+ let s = mt.current;
7263
+ n === "polyline" && s.length > 0 && en(s, t);
7264
+ let c = En.current, l = On.current;
7265
+ for (let [e, n] of L.current) if (n.isPointInEntity(t)) {
7263
7266
  let t = c.find((t) => t.id === e);
7264
7267
  if (!t?.popup) continue;
7265
- let n = t.popup.content ?? Pe?.(t);
7268
+ let n = t.popup.content ?? Fe?.(t);
7266
7269
  if (!n) continue;
7267
- let r = mergePopupConfig(t.popup, I, n);
7270
+ let r = mergePopupConfig(t.popup, F, n);
7268
7271
  if (r.trigger === "hover") {
7269
- qe.current && clearTimeout(qe.current), qe.current = window.setTimeout(() => {
7272
+ Je.current && clearTimeout(Je.current), Je.current = window.setTimeout(() => {
7270
7273
  l(e, "hover");
7271
7274
  }, r.hoverDelay);
7272
7275
  return;
7273
7276
  }
7274
7277
  }
7275
- if (qe.current &&= (clearTimeout(qe.current), null), B?.openedBy === "hover") {
7276
- let e = R.current.get(B.entityId);
7277
- e && !e.isPointInEntity(t) && wt(B.entityId);
7278
+ if (Je.current &&= (clearTimeout(Je.current), null), z?.openedBy === "hover") {
7279
+ let e = L.current.get(z.entityId);
7280
+ e && !e.isPointInEntity(t) && Tt(z.entityId);
7278
7281
  }
7279
7282
  }, [
7280
- I,
7281
- Pe,
7282
- B,
7283
- wt,
7284
- Ft,
7285
- Bt,
7286
- Wt,
7287
- Yt,
7288
- $t
7289
- ]), Sn = useCallback((e) => {
7290
- if (e.preventDefault(), ht.current) return;
7291
- if (vt.current.length > 0) {
7283
+ F,
7284
+ Fe,
7285
+ z,
7286
+ Tt,
7287
+ It,
7288
+ Vt,
7289
+ Gt,
7290
+ Xt,
7291
+ en
7292
+ ]), Cn = useCallback((e) => {
7293
+ if (e.preventDefault(), gt.current) return;
7294
+ if (yt.current.length > 0) {
7292
7295
  let t = [e.lngLat.lng, e.lngLat.lat];
7293
- if (Y.current) {
7294
- R.current.get(Y.current.entityId)?.cancelEditPreview?.(), Y.current = null;
7296
+ if (J.current) {
7297
+ L.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7295
7298
  return;
7296
7299
  }
7297
- let n = L.current?.getZoom() ?? 12;
7298
- for (let e of vt.current) {
7299
- let r = R.current.get(e);
7300
+ let n = I.current?.getZoom() ?? 12;
7301
+ for (let e of yt.current) {
7302
+ let r = L.current.get(e);
7300
7303
  if (!r?.getEditHandleAt || !r.deleteVertex) continue;
7301
7304
  let i = r.getEditHandleAt(t, n);
7302
7305
  if (i && i.type === "vertex") {
7303
7306
  let e = r.deleteVertex(i.index);
7304
- e && $.current.onEntityEdit?.(e);
7307
+ e && Q.current.onEntityEdit?.(e);
7305
7308
  return;
7306
7309
  }
7307
7310
  }
7308
7311
  }
7309
- if (On.current !== "edit") return;
7310
- if (An.current) {
7311
- H(null), U(null), X();
7312
+ if (kn.current !== "edit") return;
7313
+ if (jn.current) {
7314
+ V(null), H(null), Y();
7312
7315
  return;
7313
7316
  }
7314
- let t = jn.current;
7317
+ let t = Mn.current;
7315
7318
  if (t === "rectangle") {
7316
- if (Mn.current) st(null), It();
7319
+ if (Nn.current) ct(null), Lt();
7317
7320
  else {
7318
- U(null);
7319
- let e = L.current;
7321
+ H(null);
7322
+ let e = I.current;
7320
7323
  e && (e.getCanvas().style.cursor = "");
7321
7324
  }
7322
7325
  return;
7323
7326
  }
7324
7327
  if (t === "circle") {
7325
- if (lt.current) lt.current = null, Vt();
7328
+ if (ut.current) ut.current = null, Ht();
7326
7329
  else {
7327
- U(null);
7328
- let e = L.current;
7330
+ H(null);
7331
+ let e = I.current;
7329
7332
  e && (e.getCanvas().style.cursor = "");
7330
7333
  }
7331
7334
  return;
7332
7335
  }
7333
7336
  if (t === "polygon") {
7334
- let e = ut.current;
7337
+ let e = dt.current;
7335
7338
  if (e.length >= 3) {
7336
- let t = q.current, n = applyEntityConfig({
7339
+ let t = K.current, n = applyEntityConfig({
7337
7340
  ...t,
7338
- id: t?.id ?? jt(),
7341
+ id: t?.id ?? Mt(),
7339
7342
  type: "polygon",
7340
7343
  coordinates: [...e]
7341
- }, O);
7342
- Gt();
7343
- let r = L.current;
7344
- if (r && !R.current.has(n.id)) {
7345
- let e = new PolygonRenderer(r, n, k, A, j, N);
7346
- R.current.set(n.id, e);
7344
+ }, D);
7345
+ Kt();
7346
+ let r = I.current;
7347
+ if (r && !L.current.has(n.id)) {
7348
+ let e = new PolygonRenderer(r, n, O, k, A, M);
7349
+ L.current.set(n.id, e);
7347
7350
  }
7348
- $.current.onPolygonAdd?.(n), ut.current = [], q.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
7349
- } else if (e.length > 0) ut.current = [], Gt();
7351
+ Q.current.onPolygonAdd?.(n), dt.current = [], K.current = null, U.current && (U.current = !1, H(null), r && (r.getCanvas().style.cursor = ""));
7352
+ } else if (e.length > 0) dt.current = [], Kt();
7350
7353
  else {
7351
- U(null);
7352
- let e = L.current;
7354
+ H(null);
7355
+ let e = I.current;
7353
7356
  e && (e.getCanvas().style.cursor = "");
7354
7357
  }
7355
7358
  return;
7356
7359
  }
7357
7360
  if (t === "square") {
7358
- if (dt.current) dt.current = null, Xt();
7361
+ if (ft.current) ft.current = null, Zt();
7359
7362
  else {
7360
- U(null);
7361
- let e = L.current;
7363
+ H(null);
7364
+ let e = I.current;
7362
7365
  e && (e.getCanvas().style.cursor = "");
7363
7366
  }
7364
7367
  return;
7365
7368
  }
7366
7369
  if (t === "polyline") {
7367
- let e = pt.current;
7370
+ let e = mt.current;
7368
7371
  if (e.length >= 2) {
7369
- let t = ft.current, n = applyEntityConfig({
7372
+ let t = pt.current, n = applyEntityConfig({
7370
7373
  ...t,
7371
- id: t?.id ?? jt(),
7374
+ id: t?.id ?? Mt(),
7372
7375
  type: "polyline",
7373
7376
  coordinates: [...e]
7374
- }, O);
7375
- en();
7376
- let r = L.current;
7377
- if (r && !R.current.has(n.id)) {
7378
- let e = new PolylineRenderer(r, n, k, A, N);
7379
- R.current.set(n.id, e);
7377
+ }, D);
7378
+ tn();
7379
+ let r = I.current;
7380
+ if (r && !L.current.has(n.id)) {
7381
+ let e = new PolylineRenderer(r, n, O, k, M);
7382
+ L.current.set(n.id, e);
7380
7383
  }
7381
- $.current.onPolylineAdd?.(n), pt.current = [], ft.current = null, W.current && (W.current = !1, U(null), r && (r.getCanvas().style.cursor = ""));
7382
- } else if (e.length > 0) pt.current = [], en();
7384
+ Q.current.onPolylineAdd?.(n), mt.current = [], pt.current = null, U.current && (U.current = !1, H(null), r && (r.getCanvas().style.cursor = ""));
7385
+ } else if (e.length > 0) mt.current = [], tn();
7383
7386
  else {
7384
- U(null);
7385
- let e = L.current;
7387
+ H(null);
7388
+ let e = I.current;
7386
7389
  e && (e.getCanvas().style.cursor = "");
7387
7390
  }
7388
7391
  return;
@@ -7390,45 +7393,45 @@ const Mapbox = forwardRef((e, c) => {
7390
7393
  let n = [e.lngLat.lng, e.lngLat.lat], r = {
7391
7394
  x: e.point.x,
7392
7395
  y: e.point.y
7393
- }, i = Tn.current, a = yn(e.originalEvent.target);
7396
+ }, i = En.current, a = bn(e.originalEvent.target);
7394
7397
  if (a) {
7395
7398
  let e = i.find((e) => String(e.id) === a);
7396
7399
  if (e) {
7397
- Cn(e, r, n);
7400
+ wn(e, r, n);
7398
7401
  return;
7399
7402
  }
7400
7403
  }
7401
- for (let [t, a] of R.current) {
7404
+ for (let [t, a] of L.current) {
7402
7405
  let o = a.getLabelLayerId();
7403
- if (o && L.current?.getLayer(o) && L.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7406
+ if (o && I.current?.getLayer(o) && I.current.queryRenderedFeatures(e.point, { layers: [o] }).length > 0) {
7404
7407
  let e = i.find((e) => e.id === t);
7405
7408
  if (e) {
7406
- Cn(e, r, n);
7409
+ wn(e, r, n);
7407
7410
  return;
7408
7411
  }
7409
7412
  }
7410
7413
  }
7411
- for (let [e, t] of R.current) if (t.isPointInEntity(n)) {
7414
+ for (let [e, t] of L.current) if (t.isPointInEntity(n)) {
7412
7415
  let t = i.find((t) => t.id === e);
7413
7416
  if (t) {
7414
- Cn(t, r, n);
7417
+ wn(t, r, n);
7415
7418
  return;
7416
7419
  }
7417
7420
  }
7418
7421
  }, [
7419
- yn,
7420
- X,
7421
- It,
7422
- Vt,
7423
- Gt,
7424
- Xt,
7425
- en
7426
- ]), Cn = useCallback((e, t, n) => {
7427
- let r = Ve.current?.getBoundingClientRect(), i = r ? {
7422
+ bn,
7423
+ Y,
7424
+ Lt,
7425
+ Ht,
7426
+ Kt,
7427
+ Zt,
7428
+ tn
7429
+ ]), wn = useCallback((e, t, n) => {
7430
+ let r = He.current?.getBoundingClientRect(), i = r ? {
7428
7431
  x: t.x + r.left,
7429
7432
  y: t.y + r.top
7430
7433
  } : t;
7431
- Ye({
7434
+ Xe({
7432
7435
  position: i,
7433
7436
  lngLat: n,
7434
7437
  items: [{
@@ -7444,12 +7447,12 @@ const Mapbox = forwardRef((e, c) => {
7444
7447
  }),
7445
7448
  danger: !0,
7446
7449
  onClick: () => {
7447
- $.current.onEntityDelete?.(e);
7450
+ Q.current.onEntityDelete?.(e);
7448
7451
  }
7449
7452
  }]
7450
7453
  });
7451
- }, []), wn = useCallback(() => {
7452
- Ye(null);
7454
+ }, []), Tn = useCallback(() => {
7455
+ Xe(null);
7453
7456
  }, []);
7454
7457
  useEffect(() => {
7455
7458
  let e = document.createElement("div");
@@ -7460,11 +7463,11 @@ const Mapbox = forwardRef((e, c) => {
7460
7463
  width: 100%;
7461
7464
  pointer-events: none;
7462
7465
  height: 100%;
7463
- z-index: ${I?.zIndex ?? 1e3};
7464
- `, document.body.appendChild(e), Ge.current = e, () => {
7466
+ z-index: ${F?.zIndex ?? 1e3};
7467
+ `, document.body.appendChild(e), Ke.current = e, () => {
7465
7468
  document.body.contains(e) && document.body.removeChild(e);
7466
7469
  };
7467
- }, [I?.zIndex]), useEffect(() => {
7470
+ }, [F?.zIndex]), useEffect(() => {
7468
7471
  let e = document.createElement("div");
7469
7472
  return e.id = `mapbox-context-menu-container-${Date.now()}`, e.style.cssText = `
7470
7473
  position: fixed;
@@ -7473,65 +7476,65 @@ const Mapbox = forwardRef((e, c) => {
7473
7476
  width: 100%;
7474
7477
  pointer-events: none;
7475
7478
  height: 100%;
7476
- z-index: ${(I?.zIndex ?? 1e3) + 100};
7477
- `, document.body.appendChild(e), Xe.current = e, () => {
7479
+ z-index: ${(F?.zIndex ?? 1e3) + 100};
7480
+ `, document.body.appendChild(e), Ze.current = e, () => {
7478
7481
  document.body.contains(e) && document.body.removeChild(e);
7479
7482
  };
7480
- }, [I?.zIndex]);
7481
- let Tn = useRef(E);
7482
- Tn.current = E;
7483
- let En = useRef(Ie);
7484
- En.current = Ie;
7485
- let Dn = useRef(Ct);
7486
- Dn.current = Ct;
7487
- let On = useRef($e);
7488
- On.current = $e;
7489
- let kn = useRef(b);
7490
- kn.current = b;
7491
- let An = useRef(it);
7492
- An.current = it;
7483
+ }, [F?.zIndex]);
7484
+ let En = useRef(T);
7485
+ En.current = T;
7486
+ let Dn = useRef(Le);
7487
+ Dn.current = Le;
7488
+ let On = useRef(wt);
7489
+ On.current = wt;
7490
+ let kn = useRef(et);
7491
+ kn.current = et;
7492
+ let An = useRef(b);
7493
+ An.current = b;
7493
7494
  let jn = useRef(at);
7494
7495
  jn.current = at;
7495
7496
  let Mn = useRef(ot);
7496
7497
  Mn.current = ot;
7497
- let $ = useRef(v);
7498
- $.current = v;
7499
- let Nn = useRef(O);
7500
- Nn.current = O, useEffect(() => {
7498
+ let Nn = useRef(st);
7499
+ Nn.current = st;
7500
+ let Q = useRef(v);
7501
+ Q.current = v;
7502
+ let Pn = useRef(D);
7503
+ Pn.current = D, useEffect(() => {
7501
7504
  let e = (e) => {
7502
- if (e.key === "Escape" && Y.current) {
7503
- R.current.get(Y.current.entityId)?.cancelEditPreview?.(), Y.current = null;
7505
+ if (e.key === "Escape" && J.current) {
7506
+ L.current.get(J.current.entityId)?.cancelEditPreview?.(), J.current = null;
7504
7507
  return;
7505
7508
  }
7506
- if (e.key === "Escape" && $e === "edit") {
7507
- if (it && (H(null), U(null), X()), at === "rectangle") if (ot) st(null), It();
7509
+ if (e.key === "Escape" && et === "edit") {
7510
+ if (at && (V(null), H(null), Y()), ot === "rectangle") if (st) ct(null), Lt();
7508
7511
  else {
7509
- U(null);
7510
- let e = L.current;
7512
+ H(null);
7513
+ let e = I.current;
7511
7514
  e && (e.getCanvas().style.cursor = "");
7512
7515
  }
7513
- if (at === "circle") if (lt.current) lt.current = null, Vt();
7516
+ if (ot === "circle") if (ut.current) ut.current = null, Ht();
7514
7517
  else {
7515
- U(null);
7516
- let e = L.current;
7518
+ H(null);
7519
+ let e = I.current;
7517
7520
  e && (e.getCanvas().style.cursor = "");
7518
7521
  }
7519
- if (at === "polygon") if (ut.current.length > 0) ut.current = [], Gt();
7522
+ if (ot === "polygon") if (dt.current.length > 0) dt.current = [], Kt();
7520
7523
  else {
7521
- U(null);
7522
- let e = L.current;
7524
+ H(null);
7525
+ let e = I.current;
7523
7526
  e && (e.getCanvas().style.cursor = "");
7524
7527
  }
7525
- if (at === "square") if (dt.current) dt.current = null, Xt();
7528
+ if (ot === "square") if (ft.current) ft.current = null, Zt();
7526
7529
  else {
7527
- U(null);
7528
- let e = L.current;
7530
+ H(null);
7531
+ let e = I.current;
7529
7532
  e && (e.getCanvas().style.cursor = "");
7530
7533
  }
7531
- if (at === "polyline") if (pt.current.length > 0) pt.current = [], en();
7534
+ if (ot === "polyline") if (mt.current.length > 0) mt.current = [], tn();
7532
7535
  else {
7533
- U(null);
7534
- let e = L.current;
7536
+ H(null);
7537
+ let e = I.current;
7535
7538
  e && (e.getCanvas().style.cursor = "");
7536
7539
  }
7537
7540
  }
@@ -7540,56 +7543,56 @@ const Mapbox = forwardRef((e, c) => {
7540
7543
  document.removeEventListener("keydown", e);
7541
7544
  };
7542
7545
  }, [
7543
- $e,
7544
- it,
7546
+ et,
7545
7547
  at,
7546
7548
  ot,
7547
- X,
7548
- It,
7549
- Vt,
7550
- Gt,
7551
- Xt,
7552
- en
7549
+ st,
7550
+ Y,
7551
+ Lt,
7552
+ Ht,
7553
+ Kt,
7554
+ Zt,
7555
+ tn
7553
7556
  ]), useEffect(() => {
7554
- let e = L.current;
7555
- if (!e || !B) return;
7556
- let t = B.entityId, n = B.config, r = () => {
7557
- let r = Tn.current.find((e) => e.id === t);
7557
+ let e = I.current;
7558
+ if (!e || !z) return;
7559
+ let t = z.entityId, n = z.config, r = () => {
7560
+ let r = En.current.find((e) => e.id === t);
7558
7561
  if (!r) {
7559
- Tt();
7562
+ Et();
7560
7563
  return;
7561
7564
  }
7562
- let { position: i } = calculatePopupPosition(r, n, e, void 0, Ke.current);
7563
- Ke.current && (Ke.current.style.left = `${i.x}px`, Ke.current.style.top = `${i.y}px`);
7565
+ let { position: i } = calculatePopupPosition(r, n, e, void 0, qe.current);
7566
+ qe.current && (qe.current.style.left = `${i.x}px`, qe.current.style.top = `${i.y}px`);
7564
7567
  }, i = setTimeout(() => {
7565
7568
  r();
7566
7569
  }, 50);
7567
7570
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7568
7571
  clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7569
7572
  };
7570
- }, [B?.entityId, Tt]), useEffect(() => {
7571
- let e = L.current, t = Ve.current;
7572
- if (!e || !Je || !t) return;
7573
- let n = Je.lngLat, r = () => {
7573
+ }, [z?.entityId, Et]), useEffect(() => {
7574
+ let e = I.current, t = He.current;
7575
+ if (!e || !Ye || !t) return;
7576
+ let n = Ye.lngLat, r = () => {
7574
7577
  let r = e.project(n), i = t.clientWidth, a = t.clientHeight;
7575
7578
  if (r.x < 0 || r.x > i || r.y < 0 || r.y > a) {
7576
- wn();
7579
+ Tn();
7577
7580
  return;
7578
7581
  }
7579
7582
  let o = t.getBoundingClientRect(), s = r.x + o.left, c = r.y + o.top;
7580
- Ze.current && (Ze.current.style.left = `${s}px`, Ze.current.style.top = `${c}px`);
7583
+ Qe.current && (Qe.current.style.left = `${s}px`, Qe.current.style.top = `${c}px`);
7581
7584
  };
7582
7585
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
7583
7586
  e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
7584
7587
  };
7585
- }, [Je?.lngLat, wn]), useEffect(() => {
7586
- if (!Ve.current) return;
7588
+ }, [Ye?.lngLat, Tn]), useEffect(() => {
7589
+ if (!He.current) return;
7587
7590
  let e = {
7588
7591
  version: 8,
7589
7592
  sources: {},
7590
7593
  layers: []
7591
7594
  }, { dragPan: t = !0, scrollZoom: n = !0, doubleClickZoom: r = !0, touchZoomRotate: i = !0, keyboard: a = !0, dragRotate: o = !0, pitchWithRotate: c = !0, touchPitch: p = !0, boxZoom: m = !0 } = x, _ = new mapboxgl.Map({
7592
- container: Ve.current,
7595
+ container: He.current,
7593
7596
  style: h || e,
7594
7597
  center: l,
7595
7598
  zoom: u,
@@ -7616,98 +7619,98 @@ const Mapbox = forwardRef((e, c) => {
7616
7619
  return { url: e };
7617
7620
  }
7618
7621
  });
7619
- return L.current = _, _.on("load", () => {
7622
+ return I.current = _, _.on("load", () => {
7620
7623
  if (!_.getStyle().glyphs) {
7621
7624
  let e = _.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
7622
7625
  e.glyphs = t, e.stylesheet && (e.stylesheet.glyphs = t);
7623
7626
  }
7624
- z.current.clear(), E.forEach((e) => {
7625
- z.current.set(e.id, e);
7626
- }), vn(S), un(), Pt(), Lt(), Ut(), qt(), Qt(), Qe(_), Fe?.(_);
7627
- }), _.on("click", bn), _.on("mousemove", xn), _.on("contextmenu", Sn), () => {
7628
- _.off("click", bn), _.off("mousemove", xn), _.off("contextmenu", Sn), dn(), At(), X(), Z(), Q(), _.remove(), L.current = null;
7627
+ R.current.clear(), T.forEach((e) => {
7628
+ R.current.set(e.id, e);
7629
+ }), yn(S), dn(), Ft(), Rt(), Wt(), Jt(), $t(), $e(_), Ie?.(_);
7630
+ }), _.on("click", xn), _.on("mousemove", Sn), _.on("contextmenu", Cn), () => {
7631
+ _.off("click", xn), _.off("mousemove", Sn), _.off("contextmenu", Cn), fn(), jt(), Y(), X(), Z(), _.remove(), I.current = null;
7629
7632
  };
7630
7633
  }, []), useEffect(() => {
7631
- if (L.current) {
7632
- if (!L.current.isStyleLoaded()) {
7633
- L.current.once("load", () => {
7634
- z.current.clear(), E.forEach((e) => {
7635
- z.current.set(e.id, e);
7636
- }), un();
7634
+ if (I.current) {
7635
+ if (!I.current.isStyleLoaded()) {
7636
+ I.current.once("load", () => {
7637
+ R.current.clear(), T.forEach((e) => {
7638
+ R.current.set(e.id, e);
7639
+ }), dn();
7637
7640
  });
7638
7641
  return;
7639
7642
  }
7640
- z.current.clear(), E.forEach((e) => {
7641
- z.current.set(e.id, e);
7642
- }), un();
7643
+ R.current.clear(), T.forEach((e) => {
7644
+ R.current.set(e.id, e);
7645
+ }), dn();
7643
7646
  }
7644
- }, [E, un]), useEffect(() => {
7645
- !L.current || !L.current.isStyleLoaded() || (dn(), un());
7647
+ }, [T, dn]), useEffect(() => {
7648
+ !I.current || !I.current.isStyleLoaded() || (fn(), dn());
7646
7649
  }, [
7650
+ O,
7647
7651
  k,
7648
7652
  A,
7649
7653
  j,
7650
7654
  M,
7651
- N,
7652
- dn,
7653
- un
7655
+ fn,
7656
+ dn
7654
7657
  ]), useEffect(() => {
7655
- if (L.current) {
7656
- if (!L.current.isStyleLoaded()) {
7657
- L.current.once("load", () => {
7658
- vn(S);
7658
+ if (I.current) {
7659
+ if (!I.current.isStyleLoaded()) {
7660
+ I.current.once("load", () => {
7661
+ yn(S);
7659
7662
  });
7660
7663
  return;
7661
7664
  }
7662
- vn(S);
7663
- }
7664
- }, [S, vn]);
7665
- let Pn = useRef(void 0), Fn = useRef(!0), In = useRef(S);
7666
- In.current = S;
7667
- let Ln = useRef(vn);
7668
- Ln.current = vn;
7669
- let Rn = useRef(dn);
7670
- Rn.current = dn;
7671
- let zn = useRef(un);
7672
- zn.current = un;
7673
- let Bn = useRef(Pt);
7674
- Bn.current = Pt;
7675
- let Vn = useRef(Lt);
7676
- Vn.current = Lt;
7677
- let Hn = useRef(Ut);
7678
- Hn.current = Ut;
7679
- let Un = useRef(qt);
7680
- Un.current = qt;
7681
- let Wn = useRef(Qt);
7682
- Wn.current = Qt, useEffect(() => {
7683
- let e = L.current;
7665
+ yn(S);
7666
+ }
7667
+ }, [S, yn]);
7668
+ let Fn = useRef(void 0), In = useRef(!0), Ln = useRef(S);
7669
+ Ln.current = S;
7670
+ let Rn = useRef(yn);
7671
+ Rn.current = yn;
7672
+ let zn = useRef(fn);
7673
+ zn.current = fn;
7674
+ let Bn = useRef(dn);
7675
+ Bn.current = dn;
7676
+ let Vn = useRef(Ft);
7677
+ Vn.current = Ft;
7678
+ let Hn = useRef(Rt);
7679
+ Hn.current = Rt;
7680
+ let Un = useRef(Wt);
7681
+ Un.current = Wt;
7682
+ let Wn = useRef(Jt);
7683
+ Wn.current = Jt;
7684
+ let Gn = useRef($t);
7685
+ Gn.current = $t, useEffect(() => {
7686
+ let e = I.current;
7684
7687
  if (!e) return;
7685
7688
  let t = h || {
7686
7689
  version: 8,
7687
7690
  sources: {},
7688
7691
  layers: []
7689
7692
  };
7690
- if (Fn.current) {
7691
- Fn.current = !1, Pn.current = h;
7693
+ if (In.current) {
7694
+ In.current = !1, Fn.current = h;
7692
7695
  return;
7693
7696
  }
7694
- Pn.current !== h && (Pn.current = h, e.setStyle(t), e.once("style.load", () => {
7697
+ Fn.current !== h && (Fn.current = h, e.setStyle(t), e.once("style.load", () => {
7695
7698
  if (!e.getStyle().glyphs) {
7696
7699
  let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
7697
7700
  t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
7698
7701
  }
7699
- Ue.current.clear(), Ln.current(In.current), Rn.current(), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current();
7702
+ We.current.clear(), Rn.current(Ln.current), zn.current(), Bn.current(), Vn.current(), Hn.current(), Un.current(), Wn.current(), Gn.current();
7700
7703
  }));
7701
7704
  }, [h]), useEffect(() => {
7702
- let e = new Set(D.map(String));
7703
- for (let [t, n] of R.current) n.setSelected(e.has(String(t)));
7704
- }, [D]);
7705
- let Gn = useRef({});
7705
+ let e = new Set(E.map(String));
7706
+ for (let [t, n] of L.current) n.setSelected(e.has(String(t)));
7707
+ }, [E]);
7708
+ let Kn = useRef({});
7706
7709
  useEffect(() => {
7707
- let e = L.current;
7710
+ let e = I.current;
7708
7711
  if (!e) return;
7709
- let t = Gn.current, n = l && (t.center?.[0] !== l[0] || t.center?.[1] !== l[1]), r = t.zoom !== u, i = t.pitch !== d, a = t.bearing !== f;
7710
- !n && !r && !i && !a || (Gn.current = {
7712
+ let t = Kn.current, n = l && (t.center?.[0] !== l[0] || t.center?.[1] !== l[1]), r = t.zoom !== u, i = t.pitch !== d, a = t.bearing !== f;
7713
+ !n && !r && !i && !a || (Kn.current = {
7711
7714
  center: l,
7712
7715
  zoom: u,
7713
7716
  pitch: d,
@@ -7724,49 +7727,51 @@ const Mapbox = forwardRef((e, c) => {
7724
7727
  d,
7725
7728
  f
7726
7729
  ]);
7727
- let Kn = (() => Ce === !1 ? null : Ce === !0 ? { enabled: !0 } : Ce)(), qn = (() => P === !1 ? null : P === !0 ? { enabled: !0 } : P)(), Jn = (() => we === !1 ? null : we === !0 ? { enabled: !0 } : we)(), Yn = (() => {
7728
- if (Te === !1) return null;
7729
- let e, t;
7730
+ let qn = (() => we === !1 ? null : we === !0 ? { enabled: !0 } : we)(), Jn = (() => N === !1 ? null : N === !0 ? { enabled: !0 } : N)(), Yn = (() => Te === !1 ? null : Te === !0 ? { enabled: !0 } : Te)(), $ = (() => {
7731
+ if (Ee === !1) return null;
7732
+ let e, t, n;
7730
7733
  if (S && S.length > 0) {
7731
- let n = S.find((e) => e.hasRoadNetwork === !0) || S[0];
7732
- if (n.type === "style") {
7733
- let t = L.current?.getStyle();
7734
+ let r = S.find((e) => e.hasRoadNetwork === !0) || S[0];
7735
+ if (r.type === "style") {
7736
+ let t = I.current?.getStyle();
7734
7737
  if (t?.sources) {
7735
- let r = `base-layer-source-${n.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(r));
7738
+ let n = `base-layer-source-${r.id}-`, i = Object.keys(t.sources).find((e) => e.startsWith(n));
7736
7739
  i && (e = i);
7737
7740
  }
7738
- } else e = `base-layer-source-${n.id}`;
7739
- t = n.roadNetworkSourceLayer || "road";
7741
+ } else e = `base-layer-source-${r.id}`;
7742
+ t = r.roadNetworkSourceLayer || "road", n = r.roadNetworkClassField;
7740
7743
  }
7741
- return Te === !0 ? {
7744
+ return Ee === !0 ? {
7742
7745
  enabled: !0,
7743
7746
  source: e,
7744
- sourceLayer: t
7747
+ sourceLayer: t,
7748
+ classField: n
7745
7749
  } : {
7746
- ...Te,
7747
- source: Te.source || e,
7748
- sourceLayer: Te.sourceLayer || t
7750
+ ...Ee,
7751
+ source: Ee.source || e,
7752
+ sourceLayer: Ee.sourceLayer || t,
7753
+ classField: Ee.classField || n
7749
7754
  };
7750
- })(), Xn = (() => Ee ? Ee === !0 ? { enabled: !0 } : Ee : null)(), Zn = (() => Ae ? Ae === !0 ? { enabled: !0 } : Ae : null)(), Qn = (() => je || null)(), $n = useMemo(() => {
7755
+ })(), Xn = (() => De ? De === !0 ? { enabled: !0 } : De : null)(), Zn = (() => je ? je === !0 ? { enabled: !0 } : je : null)(), Qn = (() => Me || null)(), $n = useMemo(() => {
7751
7756
  let e = [];
7752
7757
  for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
7753
- let n = L.current;
7758
+ let n = I.current;
7754
7759
  if (n) {
7755
7760
  let r = `base-layer-${t.id}-`, i = n.getStyle();
7756
7761
  if (i?.layers) for (let t of i.layers) t.id.startsWith(r) && t.type === "raster" && e.push(t.id);
7757
7762
  }
7758
7763
  } else e.push(`base-layer-${t.id}`);
7759
7764
  return e;
7760
- }, [S, V]);
7765
+ }, [S, B]);
7761
7766
  return /* @__PURE__ */ jsxs("div", {
7762
- className: `comp-mapbox ${$e === "picker" ? "comp-mapbox--picker-mode" : ""} ${ze}`,
7763
- style: Be,
7767
+ className: `comp-mapbox ${et === "picker" ? "comp-mapbox--picker-mode" : ""} ${Be}`,
7768
+ style: Ve,
7764
7769
  children: [
7765
7770
  /* @__PURE__ */ jsx("div", {
7766
- ref: Ve,
7771
+ ref: He,
7767
7772
  className: "comp-mapbox__map"
7768
7773
  }),
7769
- $e === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7774
+ et === "picker" && y.showCrosshair === !0 && /* @__PURE__ */ jsxs("div", {
7770
7775
  className: "comp-mapbox__crosshair",
7771
7776
  children: [/* @__PURE__ */ jsx("div", {
7772
7777
  className: "comp-mapbox__crosshair-h",
@@ -7776,34 +7781,35 @@ const Mapbox = forwardRef((e, c) => {
7776
7781
  style: y.crosshairColor ? { backgroundColor: y.crosshairColor } : void 0
7777
7782
  })]
7778
7783
  }),
7779
- $e === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || Yn && Yn.enabled !== !1 || Qn && Qn.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
7784
+ et === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) || $ && $.enabled !== !1 || Qn && Qn.enabled !== !1 ? /* @__PURE__ */ jsxs("div", {
7780
7785
  className: "comp-mapbox__edit-controls",
7781
7786
  children: [
7782
- $e === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7787
+ et === "edit" && v.showEditTools !== !1 && (v.markerTemplates && v.markerTemplates.length > 0 || v.showRectangleTool || v.showCircleTool || v.showPolygonTool || v.showSquareTool || v.showPolylineTool) && /* @__PURE__ */ jsx(EditControl, {
7783
7788
  markerTemplates: v.markerTemplates || [],
7784
- selectedTemplate: it,
7785
- onTemplateSelect: tn,
7786
- drawMode: at,
7787
- onDrawModeChange: nn,
7789
+ selectedTemplate: at,
7790
+ onTemplateSelect: nn,
7791
+ drawMode: ot,
7792
+ onDrawModeChange: rn,
7788
7793
  showRectangleTool: v.showRectangleTool,
7789
7794
  showCircleTool: v.showCircleTool,
7790
7795
  showPolygonTool: v.showPolygonTool,
7791
7796
  showSquareTool: v.showSquareTool,
7792
7797
  showPolylineTool: v.showPolylineTool
7793
7798
  }),
7794
- Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(RoadHighlightControl, {
7795
- map: V,
7796
- highlightWidth: Yn.highlightWidth,
7797
- defaultRoadTypes: Yn.defaultRoadTypes,
7798
- defaultMinWidth: Yn.defaultMinWidth,
7799
- source: Yn.source,
7800
- sourceLayer: Yn.sourceLayer,
7801
- className: Yn.className,
7802
- style: Yn.style
7799
+ $ && $.enabled !== !1 && /* @__PURE__ */ jsx(RoadHighlightControl, {
7800
+ map: B,
7801
+ highlightWidth: $.highlightWidth,
7802
+ defaultRoadTypes: $.defaultRoadTypes,
7803
+ defaultMinWidth: $.defaultMinWidth,
7804
+ source: $.source,
7805
+ sourceLayer: $.sourceLayer,
7806
+ classField: $.classField,
7807
+ className: $.className,
7808
+ style: $.style
7803
7809
  }),
7804
7810
  Qn && Qn.enabled !== !1 && /* @__PURE__ */ jsx(RoutePlanningControl, {
7805
- ref: He,
7806
- map: V,
7811
+ ref: Ue,
7812
+ map: B,
7807
7813
  pointCount: Qn.pointCount,
7808
7814
  showPointCountInput: Qn.showPointCountInput,
7809
7815
  visualType: Qn.visualType,
@@ -7811,67 +7817,67 @@ const Mapbox = forwardRef((e, c) => {
7811
7817
  })
7812
7818
  ]
7813
7819
  }) : null,
7814
- (Kn?.enabled !== !1 || qn?.enabled !== !1 || Jn?.enabled !== !1 || Xn && Xn.enabled !== !1 || Zn && Zn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
7820
+ (qn?.enabled !== !1 || Jn?.enabled !== !1 || Yn?.enabled !== !1 || Xn && Xn.enabled !== !1 || Zn && Zn.enabled !== !1) && /* @__PURE__ */ jsxs("div", {
7815
7821
  className: "comp-mapbox__controls",
7816
7822
  children: [
7817
- Kn && Kn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7818
- map: V,
7819
- precision: Kn.precision,
7820
- className: Kn.className,
7821
- style: Kn.style
7822
- }),
7823
- qn && qn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7824
- map: V,
7825
- maxWidth: qn.maxWidth,
7826
- unit: qn.unit,
7823
+ qn && qn.enabled !== !1 && /* @__PURE__ */ jsx(CoordinateDisplay, {
7824
+ map: B,
7825
+ precision: qn.precision,
7827
7826
  className: qn.className,
7828
7827
  style: qn.style
7829
7828
  }),
7829
+ Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(ScaleControl, {
7830
+ map: B,
7831
+ maxWidth: Jn.maxWidth,
7832
+ unit: Jn.unit,
7833
+ className: Jn.className,
7834
+ style: Jn.style
7835
+ }),
7830
7836
  Xn && Xn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
7831
- map: V,
7832
- entityConfig: O,
7837
+ map: B,
7838
+ entityConfig: D,
7833
7839
  onDrawModeChange: (e) => {
7834
- ht.current = e;
7840
+ gt.current = e;
7835
7841
  },
7836
7842
  className: Xn.className,
7837
7843
  style: Xn.style
7838
7844
  }),
7839
7845
  Zn && Zn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
7840
- map: V,
7841
- value: T,
7842
- onChange: Me,
7846
+ map: B,
7847
+ value: w,
7848
+ onChange: Ne,
7843
7849
  rasterPaintLayerIds: $n,
7844
7850
  className: Zn.className,
7845
7851
  style: Zn.style
7846
7852
  }),
7847
- Jn && Jn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7848
- map: V,
7853
+ Yn && Yn.enabled !== !1 && /* @__PURE__ */ jsx(ResetViewControl, {
7854
+ map: B,
7849
7855
  initialCenter: l,
7850
7856
  initialZoom: u,
7851
7857
  initialPitch: d,
7852
7858
  initialBearing: f,
7853
- duration: Jn.duration,
7854
- className: Jn.className,
7855
- style: Jn.style
7859
+ duration: Yn.duration,
7860
+ className: Yn.className,
7861
+ style: Yn.style
7856
7862
  })
7857
7863
  ]
7858
7864
  }),
7859
7865
  !(Qn && Qn.enabled !== !1) && /* @__PURE__ */ jsx(RoutePlanningControl, {
7860
- ref: He,
7861
- map: V,
7866
+ ref: Ue,
7867
+ map: B,
7862
7868
  showButton: !1
7863
7869
  }),
7864
- B && Ge.current && /* @__PURE__ */ jsx(EntityPopup, {
7865
- popupState: B,
7866
- onClose: () => wt(B.entityId),
7867
- portalContainer: Ge.current,
7868
- popupRef: Ke
7870
+ z && Ke.current && /* @__PURE__ */ jsx(EntityPopup, {
7871
+ popupState: z,
7872
+ onClose: () => Tt(z.entityId),
7873
+ portalContainer: Ke.current,
7874
+ popupRef: qe
7869
7875
  }),
7870
- Je && Xe.current && /* @__PURE__ */ jsx(ContextMenu, {
7871
- menuState: Je,
7872
- onClose: wn,
7873
- portalContainer: Xe.current,
7874
- menuRef: Ze
7876
+ Ye && Ze.current && /* @__PURE__ */ jsx(ContextMenu, {
7877
+ menuState: Ye,
7878
+ onClose: Tn,
7879
+ portalContainer: Ze.current,
7880
+ menuRef: Qe
7875
7881
  })
7876
7882
  ]
7877
7883
  });