bbl-mapbox-react 0.0.14 → 0.0.15

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
@@ -3181,9 +3181,9 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
3181
3181
  b,
3182
3182
  D
3183
3183
  ]);
3184
- let be = (e, t) => {
3184
+ let ve = (e, t) => {
3185
3185
  y((n) => t ? [...n, e] : n.filter((t) => t !== e));
3186
- }, xe = (e) => {
3186
+ }, ye = (e) => {
3187
3187
  y(e ? ROAD_TYPE_OPTIONS.map((e) => e.class) : []);
3188
3188
  }, k = v.length > 0;
3189
3189
  return /* @__PURE__ */ jsxs("div", {
@@ -3211,7 +3211,7 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
3211
3211
  }), /* @__PURE__ */ jsx(Checkbox, {
3212
3212
  checked: v.length === ROAD_TYPE_OPTIONS.length,
3213
3213
  indeterminate: v.length > 0 && v.length < ROAD_TYPE_OPTIONS.length,
3214
- onChange: xe,
3214
+ onChange: ye,
3215
3215
  style: {
3216
3216
  "--color-text-1": "#fff",
3217
3217
  "--color-border-2": "rgba(255, 255, 255, 0.3)"
@@ -3228,11 +3228,11 @@ function RoadHighlightControl({ map: e, highlightWidth: r = 3, defaultRoadTypes:
3228
3228
  className: "mapbox-road-highlight-control__type-list",
3229
3229
  children: ROAD_TYPE_OPTIONS.map((e) => /* @__PURE__ */ jsxs("div", {
3230
3230
  className: "mapbox-road-highlight-control__type-item",
3231
- onClick: () => be(e.class, !v.includes(e.class)),
3231
+ onClick: () => ve(e.class, !v.includes(e.class)),
3232
3232
  children: [
3233
3233
  /* @__PURE__ */ jsx(Checkbox, {
3234
3234
  checked: v.includes(e.class),
3235
- onChange: (t) => be(e.class, t),
3235
+ onChange: (t) => ve(e.class, t),
3236
3236
  onClick: (e) => e.stopPropagation(),
3237
3237
  style: {
3238
3238
  "--color-text-1": "#fff",
@@ -3367,7 +3367,14 @@ function clearPreviewSource(e, t) {
3367
3367
  features: []
3368
3368
  });
3369
3369
  }
3370
+ function ensureGlyphs(e) {
3371
+ if (!e.getStyle().glyphs) {
3372
+ let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
3373
+ t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
3374
+ }
3375
+ }
3370
3376
  function initAllPreviewLayers(e) {
3377
+ ensureGlyphs(e);
3371
3378
  for (let t of [
3372
3379
  "rect",
3373
3380
  "circle",
@@ -3498,57 +3505,61 @@ function clearAllPreviewSources(e) {
3498
3505
  "polyline-vertices-source"
3499
3506
  ]) clearPreviewSource(e, `${PREVIEW_PREFIX}${t}`);
3500
3507
  }
3501
- function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", style: s }) {
3502
- let [c, l] = useState(!1), [u, d] = useState(null), [f, g] = useState({
3503
- showArea: r?.showArea ?? !0,
3504
- showLength: r?.showLength ?? !0,
3505
- showRadius: r?.showRadius ?? !0
3506
- }), [_, v] = useState([]), y = useRef(/* @__PURE__ */ new Map()), b = useRef(0), x = useRef(null), S = useRef(null), C = useRef(null), T = useRef(null), E = useRef(null), D = useRef([]), O = useRef([]), k = useRef(f);
3507
- k.current = f;
3508
- let A = useRef(u);
3509
- A.current = u;
3510
- let j = useCallback(() => `measure-${++b.current}`, []), M = useRef(!1), Se = useCallback(() => {
3511
- !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), M.current = !0);
3508
+ function MeasureControl({ map: e, entityConfig: r, onEntityConfigChange: i, className: s = "", style: c }) {
3509
+ let [l, u] = useState(!1), [d, f] = useState(null), [g, _] = useState({
3510
+ showArea: !0,
3511
+ showLength: !0,
3512
+ showRadius: !0
3513
+ }), v = r !== void 0, y = v ? {
3514
+ showArea: r.showArea ?? !0,
3515
+ showLength: r.showLength ?? !0,
3516
+ showRadius: r.showRadius ?? !0
3517
+ } : g, [b, x] = useState([]), S = useRef(/* @__PURE__ */ new Map()), C = useRef(0), T = useRef(null), E = useRef(null), D = useRef(null), O = useRef(null), k = useRef(null), A = useRef([]), j = useRef([]), M = useRef(y);
3518
+ M.current = y;
3519
+ let be = useRef(d);
3520
+ be.current = d;
3521
+ let xe = useCallback(() => `measure-${++C.current}`, []), Se = useRef(!1), Ce = useCallback(() => {
3522
+ !e || !e.isStyleLoaded() || (initAllPreviewLayers(e), Se.current = !0);
3512
3523
  }, [e]);
3513
3524
  useEffect(() => {
3514
3525
  if (!e) return;
3515
3526
  let t = () => {
3516
- initAllPreviewLayers(e), M.current = !0;
3527
+ initAllPreviewLayers(e), Se.current = !0;
3517
3528
  };
3518
3529
  e.isStyleLoaded() ? t() : e.once("load", t);
3519
3530
  let n = () => {
3520
- M.current = !1;
3531
+ Se.current = !1;
3521
3532
  };
3522
3533
  return e.on("style.load", n), () => {
3523
3534
  e.off("style.load", n);
3524
3535
  };
3525
3536
  }, [e]), useEffect(() => {
3526
3537
  let e = (e) => {
3527
- x.current && !x.current.contains(e.target) && S.current && !S.current.contains(e.target) && l(!1);
3538
+ T.current && !T.current.contains(e.target) && E.current && !E.current.contains(e.target) && u(!1);
3528
3539
  };
3529
3540
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
3530
3541
  }, []);
3531
- let Ce = useCallback((t) => {
3542
+ let we = useCallback((t) => {
3532
3543
  if (!e) return;
3533
- let n = applyEntityConfig(t, k.current), r = null;
3544
+ let n = applyEntityConfig(t, M.current), r = null;
3534
3545
  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) {
3535
- y.current.set(n.id, r);
3546
+ S.current.set(n.id, r);
3536
3547
  let e = {
3537
3548
  entity: n,
3538
3549
  shapeLabel: SHAPE_LABELS[n.type] || n.type,
3539
3550
  area: computeEntityArea(n),
3540
3551
  lengthOrRadius: computeEntityLengthOrRadius(n)
3541
3552
  };
3542
- v((t) => [...t, e]);
3553
+ x((t) => [...t, e]);
3543
3554
  }
3544
- }, [e]), we = useCallback((e) => {
3545
- let t = y.current.get(e);
3546
- t && (t.destroy(), y.current.delete(e)), v((t) => t.filter((t) => t.entity.id !== e));
3547
- }, []), Te = useCallback(() => {
3548
- y.current.forEach((e) => e.destroy()), y.current.clear(), v([]);
3549
- }, []), Ee = useCallback((t) => {
3555
+ }, [e]), Te = useCallback((e) => {
3556
+ let t = S.current.get(e);
3557
+ t && (t.destroy(), S.current.delete(e)), x((t) => t.filter((t) => t.entity.id !== e));
3558
+ }, []), Ee = useCallback(() => {
3559
+ S.current.forEach((e) => e.destroy()), S.current.clear(), x([]);
3560
+ }, []), De = useCallback((t) => {
3550
3561
  if (!e) return;
3551
- let n = y.current.get(t);
3562
+ let n = S.current.get(t);
3552
3563
  if (!n) return;
3553
3564
  let r = n.getBounds();
3554
3565
  e.fitBounds(r, {
@@ -3556,23 +3567,21 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3556
3567
  maxZoom: 18,
3557
3568
  duration: 1e3
3558
3569
  });
3559
- }, [e]), De = useCallback((e, t) => {
3560
- g((n) => {
3561
- let r = {
3562
- ...n,
3563
- [e]: t
3570
+ }, [e]), Oe = useCallback((e, t) => {
3571
+ let n = {
3572
+ ...M.current,
3573
+ [e]: t
3574
+ };
3575
+ v ? i?.({ ...n }) : _(n), x((t) => t.map((t) => {
3576
+ let r = { ...t.entity };
3577
+ r[e] = void 0;
3578
+ let i = applyEntityConfig(r, n), a = S.current.get(t.entity.id);
3579
+ return a && a.update(i), {
3580
+ ...t,
3581
+ entity: i
3564
3582
  };
3565
- return v((t) => t.map((t) => {
3566
- let n = { ...t.entity };
3567
- n[e] = void 0;
3568
- let i = applyEntityConfig(n, r), a = y.current.get(t.entity.id);
3569
- return a && a.update(i), {
3570
- ...t,
3571
- entity: i
3572
- };
3573
- })), r;
3574
- });
3575
- }, []), Oe = useCallback((t, n) => {
3583
+ }));
3584
+ }, [v, i]), ke = useCallback((t, n) => {
3576
3585
  if (!e) return;
3577
3586
  let [r, i] = t, [a, o] = n, s = [
3578
3587
  [Math.min(r, a), Math.max(i, o)],
@@ -3591,7 +3600,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3591
3600
  });
3592
3601
  let l = e.getSource(`${PREVIEW_PREFIX}rect-preview-measure-source`);
3593
3602
  if (l) {
3594
- let e = k.current, t = [], n = s[0], r = s[1], i = s[2];
3603
+ let e = M.current, t = [], n = s[0], r = s[1], i = s[2];
3595
3604
  if (e?.showArea) {
3596
3605
  let e = distance(n, r), a = distance(r, i);
3597
3606
  t.push({
@@ -3622,7 +3631,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3622
3631
  features: t
3623
3632
  });
3624
3633
  }
3625
- }, [e]), ke = useCallback((t, n) => {
3634
+ }, [e]), Ae = useCallback((t, n) => {
3626
3635
  if (!e) return;
3627
3636
  let r = calculateDistance(t, n), i = createCirclePolygon(t, r), a = e.getSource(`${PREVIEW_PREFIX}circle-preview-source`);
3628
3637
  a && a.setData({
@@ -3633,7 +3642,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3633
3642
  },
3634
3643
  properties: {}
3635
3644
  });
3636
- let o = k.current, s = [], c = [];
3645
+ let o = M.current, s = [], c = [];
3637
3646
  if (o?.showArea && s.push({
3638
3647
  type: "Feature",
3639
3648
  geometry: {
@@ -3669,7 +3678,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3669
3678
  type: "FeatureCollection",
3670
3679
  features: c
3671
3680
  });
3672
- }, [e]), Ae = useCallback((t, n) => {
3681
+ }, [e]), je = useCallback((t, n) => {
3673
3682
  if (!e) return;
3674
3683
  let r = calculateDistance(t, n) * 2, i = createSquareCoords(t, r), a = e.getSource(`${PREVIEW_PREFIX}square-preview-source`);
3675
3684
  a && a.setData({
@@ -3682,7 +3691,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3682
3691
  });
3683
3692
  let o = e.getSource(`${PREVIEW_PREFIX}square-preview-measure-source`);
3684
3693
  if (o) {
3685
- let e = k.current, n = [];
3694
+ let e = M.current, n = [];
3686
3695
  if (e?.showArea && n.push({
3687
3696
  type: "Feature",
3688
3697
  geometry: {
@@ -3706,7 +3715,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3706
3715
  features: n
3707
3716
  });
3708
3717
  }
3709
- }, [e]), je = useCallback((t, n) => {
3718
+ }, [e]), Me = useCallback((t, n) => {
3710
3719
  if (!e) return;
3711
3720
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polygon-preview-source`);
3712
3721
  i && (r.length >= 3 ? i.setData({
@@ -3741,7 +3750,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3741
3750
  });
3742
3751
  let o = e.getSource(`${PREVIEW_PREFIX}polygon-preview-measure-source`);
3743
3752
  if (o) {
3744
- let e = k.current, t = [];
3753
+ let e = M.current, t = [];
3745
3754
  if (e?.showArea && r.length >= 3) {
3746
3755
  let e = polygonArea([...r, r[0]]), n = 0, i = 0;
3747
3756
  for (let e of r) n += e[0], i += e[1];
@@ -3783,7 +3792,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3783
3792
  features: t
3784
3793
  });
3785
3794
  }
3786
- }, [e]), Me = useCallback((t, n) => {
3795
+ }, [e]), N = useCallback((t, n) => {
3787
3796
  if (!e) return;
3788
3797
  let r = [...t, n], i = e.getSource(`${PREVIEW_PREFIX}polyline-preview-source`);
3789
3798
  i && (r.length >= 2 ? i.setData({
@@ -3811,7 +3820,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3811
3820
  });
3812
3821
  let o = e.getSource(`${PREVIEW_PREFIX}polyline-preview-measure-source`);
3813
3822
  if (o) {
3814
- let e = k.current, t = [];
3823
+ let e = M.current, t = [];
3815
3824
  if (e?.showLength && r.length >= 2) for (let e = 0; e < r.length - 1; e++) {
3816
3825
  let n = r[e], i = r[e + 1];
3817
3826
  t.push({
@@ -3830,118 +3839,118 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3830
3839
  }
3831
3840
  }, [e]);
3832
3841
  useEffect(() => {
3833
- if (!e || !u) return;
3834
- Se(), e.getCanvas().style.cursor = "crosshair";
3842
+ if (!e || !d) return;
3843
+ Ce(), e.getCanvas().style.cursor = "crosshair";
3835
3844
  let t = (t) => {
3836
- let n = [t.lngLat.lng, t.lngLat.lat], r = A.current;
3845
+ let n = [t.lngLat.lng, t.lngLat.lat], r = be.current;
3837
3846
  if (r === "rectangle") {
3838
- let t = C.current;
3839
- if (!t) C.current = n;
3847
+ let t = D.current;
3848
+ if (!t) D.current = n;
3840
3849
  else {
3841
3850
  let r = {
3842
- id: j(),
3851
+ id: xe(),
3843
3852
  type: "rectangle",
3844
3853
  bounds: [t, n]
3845
3854
  };
3846
- Ce(r), C.current = null, clearAllPreviewSources(e), d(null);
3855
+ we(r), D.current = null, clearAllPreviewSources(e), f(null);
3847
3856
  }
3848
3857
  } else if (r === "circle") {
3849
- let t = T.current;
3850
- if (!t) T.current = { center: n };
3858
+ let t = O.current;
3859
+ if (!t) O.current = { center: n };
3851
3860
  else {
3852
3861
  let r = calculateDistance(t.center, n), i = {
3853
- id: j(),
3862
+ id: xe(),
3854
3863
  type: "circle",
3855
3864
  center: t.center,
3856
3865
  radius: r
3857
3866
  };
3858
- Ce(i), T.current = null, clearAllPreviewSources(e), d(null);
3867
+ we(i), O.current = null, clearAllPreviewSources(e), f(null);
3859
3868
  }
3860
3869
  } else if (r === "square") {
3861
- let t = E.current;
3862
- if (!t) E.current = { center: n };
3870
+ let t = k.current;
3871
+ if (!t) k.current = { center: n };
3863
3872
  else {
3864
3873
  let r = calculateDistance(t.center, n) * 2, i = {
3865
- id: j(),
3874
+ id: xe(),
3866
3875
  type: "square",
3867
3876
  center: t.center,
3868
3877
  length: r
3869
3878
  };
3870
- Ce(i), E.current = null, clearAllPreviewSources(e), d(null);
3879
+ we(i), k.current = null, clearAllPreviewSources(e), f(null);
3871
3880
  }
3872
3881
  } else if (r === "polygon") {
3873
- let t = D.current;
3882
+ let t = A.current;
3874
3883
  if (t.length >= 3 && calculateDistance(t[0], n) < 20) {
3875
3884
  let n = {
3876
- id: j(),
3885
+ id: xe(),
3877
3886
  type: "polygon",
3878
3887
  coordinates: [...t]
3879
3888
  };
3880
- Ce(n), D.current = [], clearAllPreviewSources(e), d(null);
3889
+ we(n), A.current = [], clearAllPreviewSources(e), f(null);
3881
3890
  return;
3882
3891
  }
3883
- D.current = [...t, n];
3884
- } else r === "polyline" && (O.current = [...O.current, n]);
3892
+ A.current = [...t, n];
3893
+ } else r === "polyline" && (j.current = [...j.current, n]);
3885
3894
  }, n = (e) => {
3886
- let t = [e.lngLat.lng, e.lngLat.lat], n = A.current;
3887
- if (n === "rectangle" && C.current) Oe(C.current, t);
3888
- else if (n === "circle" && T.current) ke(T.current.center, t);
3889
- else if (n === "square" && E.current) Ae(E.current.center, t);
3895
+ let t = [e.lngLat.lng, e.lngLat.lat], n = be.current;
3896
+ if (n === "rectangle" && D.current) ke(D.current, t);
3897
+ else if (n === "circle" && O.current) Ae(O.current.center, t);
3898
+ else if (n === "square" && k.current) je(k.current.center, t);
3890
3899
  else if (n === "polygon") {
3891
- let e = D.current;
3892
- e.length > 0 && je(e, t);
3893
- } else if (n === "polyline") {
3894
- let e = O.current;
3900
+ let e = A.current;
3895
3901
  e.length > 0 && Me(e, t);
3902
+ } else if (n === "polyline") {
3903
+ let e = j.current;
3904
+ e.length > 0 && N(e, t);
3896
3905
  }
3897
3906
  }, r = (t) => {
3898
3907
  t.preventDefault();
3899
- let n = A.current;
3908
+ let n = be.current;
3900
3909
  if (n === "polygon") {
3901
- let t = D.current;
3910
+ let t = A.current;
3902
3911
  if (t.length >= 3) {
3903
3912
  let n = {
3904
- id: j(),
3913
+ id: xe(),
3905
3914
  type: "polygon",
3906
3915
  coordinates: [...t]
3907
3916
  };
3908
- Ce(n), D.current = [], clearAllPreviewSources(e), d(null);
3909
- } else D.current = [], clearAllPreviewSources(e);
3917
+ we(n), A.current = [], clearAllPreviewSources(e), f(null);
3918
+ } else A.current = [], clearAllPreviewSources(e);
3910
3919
  } else if (n === "polyline") {
3911
- let t = O.current;
3920
+ let t = j.current;
3912
3921
  if (t.length >= 2) {
3913
3922
  let n = {
3914
- id: j(),
3923
+ id: xe(),
3915
3924
  type: "polyline",
3916
3925
  coordinates: [...t]
3917
3926
  };
3918
- Ce(n), O.current = [], clearAllPreviewSources(e), d(null);
3919
- } else O.current = [], clearAllPreviewSources(e);
3927
+ we(n), j.current = [], clearAllPreviewSources(e), f(null);
3928
+ } else j.current = [], clearAllPreviewSources(e);
3920
3929
  }
3921
3930
  }, i = (t) => {
3922
- t.key === "Escape" && (C.current = null, T.current = null, E.current = null, D.current = [], O.current = [], clearAllPreviewSources(e), d(null));
3931
+ t.key === "Escape" && (D.current = null, O.current = null, k.current = null, A.current = [], j.current = [], clearAllPreviewSources(e), f(null));
3923
3932
  }, a = (t) => {
3924
3933
  t.preventDefault();
3925
- let n = A.current;
3934
+ let n = be.current;
3926
3935
  if (n === "polygon") {
3927
- let t = D.current;
3936
+ let t = A.current;
3928
3937
  if (t.length >= 3) {
3929
3938
  let n = {
3930
- id: j(),
3939
+ id: xe(),
3931
3940
  type: "polygon",
3932
3941
  coordinates: [...t]
3933
3942
  };
3934
- Ce(n), D.current = [], clearAllPreviewSources(e), d(null);
3943
+ we(n), A.current = [], clearAllPreviewSources(e), f(null);
3935
3944
  }
3936
3945
  } else if (n === "polyline") {
3937
- let t = O.current;
3946
+ let t = j.current;
3938
3947
  if (t.length >= 2) {
3939
3948
  let n = {
3940
- id: j(),
3949
+ id: xe(),
3941
3950
  type: "polyline",
3942
3951
  coordinates: [...t]
3943
3952
  };
3944
- Ce(n), O.current = [], clearAllPreviewSources(e), d(null);
3953
+ we(n), j.current = [], clearAllPreviewSources(e), f(null);
3945
3954
  }
3946
3955
  }
3947
3956
  };
@@ -3950,28 +3959,28 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3950
3959
  };
3951
3960
  }, [
3952
3961
  e,
3953
- u,
3954
- j,
3962
+ d,
3963
+ xe,
3964
+ we,
3955
3965
  Ce,
3956
- Se,
3957
- Oe,
3958
3966
  ke,
3959
3967
  Ae,
3960
3968
  je,
3961
- Me
3969
+ Me,
3970
+ N
3962
3971
  ]), useEffect(() => () => {
3963
- y.current.forEach((e) => e.destroy()), y.current.clear();
3972
+ S.current.forEach((e) => e.destroy()), S.current.clear();
3964
3973
  }, []);
3965
3974
  let Ne = useCallback((t) => {
3966
- d((e) => e === t ? null : t), C.current = null, T.current = null, E.current = null, D.current = [], O.current = [], e && clearAllPreviewSources(e);
3975
+ f((e) => e === t ? null : t), D.current = null, O.current = null, k.current = null, A.current = [], j.current = [], e && clearAllPreviewSources(e);
3967
3976
  }, [e]);
3968
3977
  return e ? /* @__PURE__ */ jsxs("div", {
3969
- className: `mapbox-measure-control ${i}`,
3970
- style: s,
3978
+ className: `mapbox-measure-control ${s}`,
3979
+ style: c,
3971
3980
  children: [/* @__PURE__ */ jsxs("button", {
3972
- ref: S,
3973
- className: `mapbox-control-btn mapbox-measure-control__btn ${c ? "mapbox-measure-control__btn--active" : ""}`,
3974
- onClick: () => l(!c),
3981
+ ref: E,
3982
+ className: `mapbox-control-btn mapbox-measure-control__btn ${l ? "mapbox-measure-control__btn--active" : ""}`,
3983
+ onClick: () => u(!l),
3975
3984
  title: "测量",
3976
3985
  children: [
3977
3986
  /* @__PURE__ */ jsx("img", {
@@ -3980,14 +3989,14 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3980
3989
  className: "mapbox-measure-control__btn-icon"
3981
3990
  }),
3982
3991
  /* @__PURE__ */ jsx("span", { children: "测量" }),
3983
- _.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
3992
+ b.length > 0 && /* @__PURE__ */ jsxs("span", { children: [
3984
3993
  "(",
3985
- _.length,
3994
+ b.length,
3986
3995
  ")"
3987
3996
  ] })
3988
3997
  ]
3989
- }), c && /* @__PURE__ */ jsxs("div", {
3990
- ref: x,
3998
+ }), l && /* @__PURE__ */ jsxs("div", {
3999
+ ref: T,
3991
4000
  className: "mapbox-measure-control__panel",
3992
4001
  children: [
3993
4002
  /* @__PURE__ */ jsx("div", {
@@ -3998,18 +4007,18 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
3998
4007
  className: "mapbox-measure-control__settings",
3999
4008
  children: [
4000
4009
  /* @__PURE__ */ jsx(Checkbox, {
4001
- checked: f.showArea,
4002
- onChange: (e) => De("showArea", e),
4010
+ checked: y.showArea,
4011
+ onChange: (e) => Oe("showArea", e),
4003
4012
  children: "面积"
4004
4013
  }),
4005
4014
  /* @__PURE__ */ jsx(Checkbox, {
4006
- checked: f.showLength,
4007
- onChange: (e) => De("showLength", e),
4015
+ checked: y.showLength,
4016
+ onChange: (e) => Oe("showLength", e),
4008
4017
  children: "长度"
4009
4018
  }),
4010
4019
  /* @__PURE__ */ jsx(Checkbox, {
4011
- checked: f.showRadius,
4012
- onChange: (e) => De("showRadius", e),
4020
+ checked: y.showRadius,
4021
+ onChange: (e) => Oe("showRadius", e),
4013
4022
  children: "半径"
4014
4023
  })
4015
4024
  ]
@@ -4021,16 +4030,16 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
4021
4030
  /* @__PURE__ */ jsxs("div", {
4022
4031
  className: "mapbox-measure-control__tools",
4023
4032
  children: [DRAW_TOOLS.map((e) => /* @__PURE__ */ jsx("button", {
4024
- className: `mapbox-measure-control__tool-btn ${u === e.mode ? "mapbox-measure-control__tool-btn--active" : ""}`,
4033
+ className: `mapbox-measure-control__tool-btn ${d === e.mode ? "mapbox-measure-control__tool-btn--active" : ""}`,
4025
4034
  onClick: () => Ne(e.mode),
4026
4035
  title: e.label,
4027
4036
  children: /* @__PURE__ */ jsx("img", {
4028
4037
  src: e.icon,
4029
4038
  alt: e.label
4030
4039
  })
4031
- }, e.mode)), _.length > 0 && /* @__PURE__ */ jsx("button", {
4040
+ }, e.mode)), b.length > 0 && /* @__PURE__ */ jsx("button", {
4032
4041
  className: "mapbox-measure-control__tool-btn mapbox-measure-control__tool-btn--danger",
4033
- onClick: Te,
4042
+ onClick: Ee,
4034
4043
  title: "清除全部",
4035
4044
  children: /* @__PURE__ */ jsx("img", {
4036
4045
  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",
@@ -4038,7 +4047,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
4038
4047
  })
4039
4048
  })]
4040
4049
  }),
4041
- _.length > 0 ? /* @__PURE__ */ jsx("div", {
4050
+ b.length > 0 ? /* @__PURE__ */ jsx("div", {
4042
4051
  className: "mapbox-measure-control__list",
4043
4052
  children: /* @__PURE__ */ jsxs("table", {
4044
4053
  className: "mapbox-measure-control__table",
@@ -4048,9 +4057,9 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
4048
4057
  /* @__PURE__ */ jsx("th", { children: "面积" }),
4049
4058
  /* @__PURE__ */ jsx("th", { children: "长度/半径" }),
4050
4059
  /* @__PURE__ */ jsx("th", {})
4051
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: _.map((e) => /* @__PURE__ */ jsxs("tr", {
4060
+ ] }) }), /* @__PURE__ */ jsx("tbody", { children: b.map((e) => /* @__PURE__ */ jsxs("tr", {
4052
4061
  className: "mapbox-measure-control__table-row",
4053
- onClick: () => Ee(e.entity.id),
4062
+ onClick: () => De(e.entity.id),
4054
4063
  children: [
4055
4064
  /* @__PURE__ */ jsx("td", { children: e.shapeLabel }),
4056
4065
  /* @__PURE__ */ jsx("td", { children: String(e.entity.id) }),
@@ -4059,7 +4068,7 @@ function MeasureControl({ map: e, defaultEntityConfig: r, className: i = "", sty
4059
4068
  /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("button", {
4060
4069
  className: "mapbox-measure-control__delete-btn",
4061
4070
  onClick: (t) => {
4062
- t.stopPropagation(), we(e.entity.id);
4071
+ t.stopPropagation(), Te(e.entity.id);
4063
4072
  },
4064
4073
  title: "删除",
4065
4074
  children: /* @__PURE__ */ jsx("img", {
@@ -4199,7 +4208,8 @@ function RasterPaintControl({ map: e, value: r, onChange: s, rasterPaintLayerIds
4199
4208
  max: r,
4200
4209
  step: i,
4201
4210
  value: x[e],
4202
- onChange: (t) => w(e, t)
4211
+ onChange: (t) => w(e, t),
4212
+ tooltipVisible: !1
4203
4213
  }),
4204
4214
  /* @__PURE__ */ jsx("span", {
4205
4215
  className: "mapbox-raster-paint-control__value",
@@ -4243,7 +4253,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
4243
4253
  } : {
4244
4254
  width: e.width || 32,
4245
4255
  height: e.height || 32
4246
- }, E = h || t, D = i === "rectangle", O = i === "circle", be = i === "polygon", xe = i === "square", k = i === "polyline";
4256
+ }, E = h || t, D = i === "rectangle", O = i === "circle", ve = i === "polygon", ye = i === "square", k = i === "polyline";
4247
4257
  return /* @__PURE__ */ jsxs("div", {
4248
4258
  ref: _,
4249
4259
  className: "mapbox-edit-control",
@@ -4265,7 +4275,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
4265
4275
  }), /* @__PURE__ */ jsx("span", { children: t ? t.name : "Marker" })]
4266
4276
  }),
4267
4277
  d && /* @__PURE__ */ jsxs("button", {
4268
- className: `mapbox-control-btn ${xe ? "mapbox-control-btn--active" : ""}`,
4278
+ className: `mapbox-control-btn ${ye ? "mapbox-control-btn--active" : ""}`,
4269
4279
  onClick: S,
4270
4280
  title: "绘制正方形",
4271
4281
  children: [/* @__PURE__ */ jsx("img", {
@@ -4295,7 +4305,7 @@ const EditControl = ({ markerTemplates: e, selectedTemplate: t, onTemplateSelect
4295
4305
  }), /* @__PURE__ */ jsx("span", { children: "圆形" })]
4296
4306
  }),
4297
4307
  u && /* @__PURE__ */ jsxs("button", {
4298
- className: `mapbox-control-btn ${be ? "mapbox-control-btn--active" : ""}`,
4308
+ className: `mapbox-control-btn ${ve ? "mapbox-control-btn--active" : ""}`,
4299
4309
  onClick: x,
4300
4310
  title: "绘制多边形",
4301
4311
  children: [/* @__PURE__ */ jsx("img", {
@@ -4540,11 +4550,11 @@ function adjustPopupForBounds(e, t) {
4540
4550
  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;
4541
4551
  }
4542
4552
  const Mapbox = forwardRef((e, c) => {
4543
- 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: C, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: A, circleConfig: j, lengthConfig: M, showCoordinates: Se = !0, showScale: we = !0, showResetView: Oe = !0, showRoadHighlight: ke = !1, showMeasure: Ae = !1, showRasterPaint: Me = !1, onRasterPaintChange: Ne, popupDefaults: N, renderPopup: Pe, onMapLoad: Fe, onEntityClick: Ie, onPopupOpen: Le, onPopupClose: Re, className: ze = "", containerStyle: Be } = e, Ve = useRef(null), P = useRef(null), F = useRef(/* @__PURE__ */ new Map()), I = useRef(/* @__PURE__ */ new Map()), He = useRef(/* @__PURE__ */ new Set()), [L, Ue] = useState(null), We = useRef(null), Ge = useRef(null), Ke = useRef(null), [qe, Je] = useState(null), Ye = useRef(null), Xe = useRef(null), [Ze, Qe] = useState(null), [R, $e] = useState(_), [et, tt] = useState(null), nt = useRef(null), [rt, z] = useState(null), [it, B] = useState(null), [at, ot] = useState(null), V = useRef(!1), H = useRef(null), U = useRef(null), W = useRef(null), st = useRef(null), G = useRef(null), K = useRef([]), q = useRef(null), ct = useRef(null), J = useRef(null), lt = useRef([]), Y = useRef(null);
4553
+ 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: C, entities: T = [], selectedIds: E = [], entityConfig: D, nameConfig: O, selectNameConfig: k, areaConfig: A, circleConfig: j, lengthConfig: M, showCoordinates: be = !0, showScale: Se = !0, showResetView: Ee = !0, showRoadHighlight: De = !1, showMeasure: Oe = !1, showRasterPaint: Ae = !1, onRasterPaintChange: je, popupDefaults: N, renderPopup: Pe, onMapLoad: Fe, onEntityClick: Ie, onPopupOpen: Le, onPopupClose: Re, className: ze = "", containerStyle: Be } = e, Ve = useRef(null), P = useRef(null), F = useRef(/* @__PURE__ */ new Map()), I = useRef(/* @__PURE__ */ new Map()), He = useRef(/* @__PURE__ */ new Set()), [L, Ue] = useState(null), We = useRef(null), Ge = useRef(null), Ke = useRef(null), [qe, Je] = useState(null), Ye = useRef(null), Xe = useRef(null), [Ze, Qe] = useState(null), [R, $e] = useState(_), [et, tt] = useState(null), nt = useRef(null), [rt, z] = useState(null), [it, B] = useState(null), [at, ot] = useState(null), V = useRef(!1), H = useRef(null), U = useRef(null), W = useRef(null), st = useRef(null), G = useRef(null), ct = useRef([]), K = useRef(null), lt = useRef(null), q = useRef(null), ut = useRef([]), J = useRef(null);
4544
4554
  useEffect(() => {
4545
4555
  $e(_);
4546
4556
  }, [_]);
4547
- let ut = useCallback((e) => {
4557
+ let dt = useCallback((e) => {
4548
4558
  let t = F.current.get(e), n = I.current.get(e);
4549
4559
  if (t && n) {
4550
4560
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
@@ -4561,7 +4571,7 @@ const Mapbox = forwardRef((e, c) => {
4561
4571
  I.current.set(e, r), t.startAnimation();
4562
4572
  }
4563
4573
  }
4564
- }, []), dt = useCallback((e) => {
4574
+ }, []), ft = useCallback((e) => {
4565
4575
  let t = F.current.get(e), n = I.current.get(e);
4566
4576
  if (t && n) {
4567
4577
  if (n.type === "radar" && t instanceof CanvasRadarRenderer) {
@@ -4578,10 +4588,10 @@ const Mapbox = forwardRef((e, c) => {
4578
4588
  I.current.set(e, r), t.stopAnimation();
4579
4589
  }
4580
4590
  }
4581
- }, []), ft = useCallback((e) => {
4591
+ }, []), pt = useCallback((e) => {
4582
4592
  let t = I.current.get(e);
4583
- t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? dt(e) : ut(e));
4584
- }, [ut, dt]), pt = useCallback((e) => {
4593
+ t && (t.type === "radar" || t.type === "circle") && (t.type, t.isAnimating ? ft(e) : dt(e));
4594
+ }, [dt, ft]), mt = useCallback((e) => {
4585
4595
  if (e === void 0) {
4586
4596
  let e = !1;
4587
4597
  for (let [, t] of F.current) if (t instanceof UnitRenderer) {
@@ -4597,7 +4607,7 @@ const Mapbox = forwardRef((e, c) => {
4597
4607
  let t = new Set(e.map(String));
4598
4608
  for (let [e, n] of F.current) n instanceof UnitRenderer && n.setShowTrajectory(t.has(String(e)) ? "all" : 0);
4599
4609
  }
4600
- }, []), mt = useCallback((e, t, n) => {
4610
+ }, []), ht = useCallback((e, t, n) => {
4601
4611
  let r = T.find((t) => String(t.id) === String(e));
4602
4612
  if (!r?.popup || !P.current) return;
4603
4613
  let i = r.popup.content ?? Pe?.(r);
@@ -4615,18 +4625,18 @@ const Mapbox = forwardRef((e, c) => {
4615
4625
  N,
4616
4626
  Pe,
4617
4627
  Le
4618
- ]), ht = useCallback((e) => {
4628
+ ]), gt = useCallback((e) => {
4619
4629
  L?.entityId === e && (Ue(null), Re?.(e));
4620
- }, [L, Re]), gt = useCallback(() => {
4630
+ }, [L, Re]), _t = useCallback(() => {
4621
4631
  Ue((e) => (e && Re?.(e.entityId), null));
4622
- }, [Re]), _t = useCallback((e) => L?.entityId === e, [L]), vt = useCallback((e, t, n) => {
4632
+ }, [Re]), vt = useCallback((e) => L?.entityId === e, [L]), yt = useCallback((e, t, n) => {
4623
4633
  let r = P.current;
4624
4634
  r && r.flyTo({
4625
4635
  center: e,
4626
4636
  zoom: t ?? r.getZoom(),
4627
4637
  ...n
4628
4638
  });
4629
- }, []), yt = useCallback((e, t, n) => {
4639
+ }, []), bt = useCallback((e, t, n) => {
4630
4640
  let r = P.current;
4631
4641
  if (!r || e.length === 0) return;
4632
4642
  let i = [];
@@ -4653,7 +4663,7 @@ const Mapbox = forwardRef((e, c) => {
4653
4663
  pitch: n?.pitch ?? r.getPitch()
4654
4664
  };
4655
4665
  t !== void 0 && (p.maxZoom = t), n?.essential !== void 0 && (p.essential = n.essential), r.fitBounds(f, p);
4656
- }, []), bt = useCallback((e) => {
4666
+ }, []), xt = useCallback((e) => {
4657
4667
  let t = P.current;
4658
4668
  if (!t || !t.getContainer()) return;
4659
4669
  let { showMarker: n = !0, markerColor: r = "#3388ff" } = y;
@@ -4671,62 +4681,68 @@ const Mapbox = forwardRef((e, c) => {
4671
4681
  anchor: "bottom"
4672
4682
  }).setLngLat(e).addTo(t);
4673
4683
  }
4674
- }, [y]), xt = useCallback(() => {
4684
+ }, [y]), St = useCallback(() => {
4675
4685
  nt.current &&= (nt.current.remove(), null);
4676
- }, []), St = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), Ct = useCallback((e) => {
4686
+ }, []), Ct = useCallback(() => `marker-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`, []), wt = useCallback((e) => {
4677
4687
  let t = P.current;
4678
- if (Ve.current) if (Y.current &&= (Y.current.remove(), null), e && t) {
4688
+ if (Ve.current) if (J.current &&= (J.current.remove(), null), e && t) {
4679
4689
  t.getCanvas().style.cursor = "none";
4680
4690
  let n = document.createElement("div");
4681
4691
  n.className = "mapbox-custom-cursor";
4682
4692
  let r = e.size || e.width || 32;
4683
4693
  n.style.cssText = "\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n transform: translate(-50%, -50%);\n opacity: 0.8;\n ";
4684
4694
  let i = document.createElement("img");
4685
- 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), Y.current = n;
4695
+ 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), J.current = n;
4686
4696
  let a = (e) => {
4687
- Y.current && (Y.current.style.left = `${e.clientX}px`, Y.current.style.top = `${e.clientY}px`);
4697
+ J.current && (J.current.style.left = `${e.clientX}px`, J.current.style.top = `${e.clientY}px`);
4688
4698
  };
4689
4699
  document.addEventListener("mousemove", a), n.dataset.cleanup = "true", n._cleanup = () => {
4690
4700
  document.removeEventListener("mousemove", a);
4691
4701
  };
4692
4702
  } else t && (t.getCanvas().style.cursor = "");
4693
- }, []), X = useCallback(() => {
4694
- if (Y.current) {
4695
- let e = Y.current._cleanup;
4696
- e && e(), Y.current.remove(), Y.current = null;
4703
+ }, []), Y = useCallback(() => {
4704
+ if (J.current) {
4705
+ let e = J.current._cleanup;
4706
+ e && e(), J.current.remove(), J.current = null;
4697
4707
  }
4698
4708
  let e = P.current;
4699
4709
  e && (e.getCanvas().style.cursor = "");
4700
- }, []), wt = useCallback((e, t, n) => {
4701
- e.getSource(t) || (e.addSource(t, {
4702
- type: "geojson",
4703
- data: {
4704
- type: "FeatureCollection",
4705
- features: []
4710
+ }, []), X = useCallback((e, t, n) => {
4711
+ if (!e.getSource(t)) {
4712
+ if (!e.getStyle().glyphs) {
4713
+ let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
4714
+ t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
4706
4715
  }
4707
- }), e.addLayer({
4708
- id: n,
4709
- type: "symbol",
4710
- source: t,
4711
- filter: [
4712
- "==",
4713
- "$type",
4714
- "Point"
4715
- ],
4716
- layout: {
4717
- "text-field": ["get", "label"],
4718
- "text-size": 12,
4719
- "text-font": ["Open Sans Bold", "Arial Unicode MS Bold"],
4720
- "text-allow-overlap": !0,
4721
- "text-rotation-alignment": "map",
4722
- "text-offset": [0, -.8]
4723
- },
4724
- paint: {
4725
- "text-color": "#ffffff",
4726
- "text-halo-color": "rgba(0, 0, 0, 0.8)",
4727
- "text-halo-width": 1
4728
- }
4729
- }));
4716
+ e.addSource(t, {
4717
+ type: "geojson",
4718
+ data: {
4719
+ type: "FeatureCollection",
4720
+ features: []
4721
+ }
4722
+ }), e.addLayer({
4723
+ id: n,
4724
+ type: "symbol",
4725
+ source: t,
4726
+ filter: [
4727
+ "==",
4728
+ "$type",
4729
+ "Point"
4730
+ ],
4731
+ layout: {
4732
+ "text-field": ["get", "label"],
4733
+ "text-size": 12,
4734
+ "text-font": ["Open Sans Bold", "Arial Unicode MS Bold"],
4735
+ "text-allow-overlap": !0,
4736
+ "text-rotation-alignment": "map",
4737
+ "text-offset": [0, -.8]
4738
+ },
4739
+ paint: {
4740
+ "text-color": "#ffffff",
4741
+ "text-halo-color": "rgba(0, 0, 0, 0.8)",
4742
+ "text-halo-width": 1
4743
+ }
4744
+ });
4745
+ }
4730
4746
  }, []), Tt = useCallback(() => {
4731
4747
  let e = P.current;
4732
4748
  e && (e.getSource("rect-preview-source") || (e.addSource("rect-preview-source", {
@@ -4752,8 +4768,8 @@ const Mapbox = forwardRef((e, c) => {
4752
4768
  "line-width": 2,
4753
4769
  "line-dasharray": [4, 4]
4754
4770
  }
4755
- }), wt(e, "rect-preview-measure-source", "rect-preview-measure-label")));
4756
- }, [wt]), Et = useCallback((e, t) => {
4771
+ }), X(e, "rect-preview-measure-source", "rect-preview-measure-label")));
4772
+ }, [X]), Et = useCallback((e, t) => {
4757
4773
  let n = P.current;
4758
4774
  if (!n) return;
4759
4775
  let r = n.getSource("rect-preview-source");
@@ -4854,7 +4870,7 @@ const Mapbox = forwardRef((e, c) => {
4854
4870
  "line-width": 2,
4855
4871
  "line-dasharray": [4, 4]
4856
4872
  }
4857
- }), wt(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
4873
+ }), X(e, "circle-preview-measure-source", "circle-preview-measure-label"), e.getSource("circle-preview-radius-source") || (e.addSource("circle-preview-radius-source", {
4858
4874
  type: "geojson",
4859
4875
  data: {
4860
4876
  type: "FeatureCollection",
@@ -4871,7 +4887,7 @@ const Mapbox = forwardRef((e, c) => {
4871
4887
  "line-dasharray": [4, 4]
4872
4888
  }
4873
4889
  }))));
4874
- }, [wt]), kt = useCallback((e, t, n = 64) => {
4890
+ }, [X]), kt = useCallback((e, t, n = 64) => {
4875
4891
  let [r, i] = e, a = [], o = t / 6371e3, s = i * Math.PI / 180;
4876
4892
  for (let e = 0; e <= n; e++) {
4877
4893
  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;
@@ -4998,8 +5014,8 @@ const Mapbox = forwardRef((e, c) => {
4998
5014
  "circle-stroke-color": "#ffffff",
4999
5015
  "circle-stroke-width": 2
5000
5016
  }
5001
- }), wt(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
5002
- }, [wt]), Ft = useCallback((e, t) => {
5017
+ }), X(e, "polygon-preview-measure-source", "polygon-preview-measure-label")));
5018
+ }, [X]), Ft = useCallback((e, t) => {
5003
5019
  let n = P.current;
5004
5020
  if (!n) return;
5005
5021
  let r = n.getSource("polygon-preview-source"), i = n.getSource("polygon-vertices-source");
@@ -5102,7 +5118,7 @@ const Mapbox = forwardRef((e, c) => {
5102
5118
  features: []
5103
5119
  });
5104
5120
  }, []), Lt = useCallback(() => {
5105
- K.current = [], It();
5121
+ ct.current = [], It();
5106
5122
  }, [It]), Rt = useCallback(() => {
5107
5123
  let e = P.current;
5108
5124
  e && (e.getSource("square-preview-source") || (e.addSource("square-preview-source", {
@@ -5128,8 +5144,8 @@ const Mapbox = forwardRef((e, c) => {
5128
5144
  "line-width": 2,
5129
5145
  "line-dasharray": [4, 4]
5130
5146
  }
5131
- }), wt(e, "square-preview-measure-source", "square-preview-measure-label")));
5132
- }, [wt]), zt = useCallback((e, t) => {
5147
+ }), X(e, "square-preview-measure-source", "square-preview-measure-label")));
5148
+ }, [X]), zt = useCallback((e, t) => {
5133
5149
  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);
5134
5150
  return [
5135
5151
  [n - s, r + o],
@@ -5152,7 +5168,7 @@ const Mapbox = forwardRef((e, c) => {
5152
5168
  },
5153
5169
  properties: {}
5154
5170
  });
5155
- let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
5171
+ let o = K.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2, l = o?.fillColor ?? "#3388ff", u = o?.fillOpacity ?? .1;
5156
5172
  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));
5157
5173
  let d = n.getSource("square-preview-measure-source");
5158
5174
  if (d) {
@@ -5194,7 +5210,7 @@ const Mapbox = forwardRef((e, c) => {
5194
5210
  features: []
5195
5211
  });
5196
5212
  }, []), Ht = useCallback(() => {
5197
- ct.current = null, Vt();
5213
+ lt.current = null, Vt();
5198
5214
  }, [Vt]), Ut = useCallback(() => {
5199
5215
  let e = P.current;
5200
5216
  e && (e.getSource("polyline-preview-source") || (e.addSource("polyline-preview-source", {
@@ -5228,8 +5244,8 @@ const Mapbox = forwardRef((e, c) => {
5228
5244
  "circle-stroke-color": "#ffffff",
5229
5245
  "circle-stroke-width": 2
5230
5246
  }
5231
- }), wt(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
5232
- }, [wt]), Wt = useCallback((e, t) => {
5247
+ }), X(e, "polyline-preview-measure-source", "polyline-preview-measure-label")));
5248
+ }, [X]), Wt = useCallback((e, t) => {
5233
5249
  let n = P.current;
5234
5250
  if (!n) return;
5235
5251
  let r = n.getSource("polyline-preview-source"), i = n.getSource("polyline-vertices-source");
@@ -5256,7 +5272,7 @@ const Mapbox = forwardRef((e, c) => {
5256
5272
  properties: {}
5257
5273
  }))
5258
5274
  });
5259
- let o = J.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
5275
+ let o = q.current, s = o?.strokeColor ?? "#3388ff", c = o?.strokeWidth ?? 2;
5260
5276
  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);
5261
5277
  let l = n.getSource("polyline-preview-measure-source");
5262
5278
  if (l) {
@@ -5296,11 +5312,11 @@ const Mapbox = forwardRef((e, c) => {
5296
5312
  features: []
5297
5313
  });
5298
5314
  }, []), Q = useCallback(() => {
5299
- lt.current = [], Gt();
5315
+ ut.current = [], Gt();
5300
5316
  }, [Gt]), Kt = useCallback((e) => {
5301
- z(e), Ct(e), e ? (B("marker"), Z(), Nt(), Lt(), Ht(), Q()) : B(null);
5317
+ z(e), wt(e), e ? (B("marker"), Z(), Nt(), Lt(), Ht(), Q()) : B(null);
5302
5318
  }, [
5303
- Ct,
5319
+ wt,
5304
5320
  Z,
5305
5321
  Nt,
5306
5322
  Lt,
@@ -5308,103 +5324,103 @@ const Mapbox = forwardRef((e, c) => {
5308
5324
  Q
5309
5325
  ]), qt = useCallback((e) => {
5310
5326
  if (B(e), e === "rectangle") {
5311
- z(null), X(), Nt(), Lt(), Ht(), Q();
5327
+ z(null), Y(), Nt(), Lt(), Ht(), Q();
5312
5328
  let e = P.current;
5313
5329
  e && (e.getCanvas().style.cursor = "crosshair");
5314
5330
  } else if (e === "circle") {
5315
- z(null), X(), Z(), Lt(), Ht(), Q();
5331
+ z(null), Y(), Z(), Lt(), Ht(), Q();
5316
5332
  let e = P.current;
5317
5333
  e && (e.getCanvas().style.cursor = "crosshair");
5318
5334
  } else if (e === "polygon") {
5319
- z(null), X(), Z(), Nt(), Ht(), Q();
5335
+ z(null), Y(), Z(), Nt(), Ht(), Q();
5320
5336
  let e = P.current;
5321
5337
  e && (e.getCanvas().style.cursor = "crosshair");
5322
5338
  } else if (e === "square") {
5323
- z(null), X(), Z(), Nt(), Lt(), Q();
5339
+ z(null), Y(), Z(), Nt(), Lt(), Q();
5324
5340
  let e = P.current;
5325
5341
  e && (e.getCanvas().style.cursor = "crosshair");
5326
5342
  } else if (e === "polyline") {
5327
- z(null), X(), Z(), Nt(), Lt(), Ht();
5343
+ z(null), Y(), Z(), Nt(), Lt(), Ht();
5328
5344
  let e = P.current;
5329
5345
  e && (e.getCanvas().style.cursor = "crosshair");
5330
- } else e === "marker" ? (Z(), Nt(), Lt(), Ht(), Q()) : (z(null), X(), Z(), Nt(), Lt(), Ht(), Q());
5346
+ } else e === "marker" ? (Z(), Nt(), Lt(), Ht(), Q()) : (z(null), Y(), Z(), Nt(), Lt(), Ht(), Q());
5331
5347
  }, [
5332
- X,
5348
+ Y,
5333
5349
  Z,
5334
5350
  Nt,
5335
5351
  Lt,
5336
5352
  Ht,
5337
5353
  Q
5338
5354
  ]), Jt = useCallback((e) => {
5339
- e !== "picker" && (xt(), tt(null)), e !== "edit" && (z(null), B(null), Z(), Q(), X()), $e(e);
5355
+ e !== "picker" && (St(), tt(null)), e !== "edit" && (z(null), B(null), Z(), Q(), Y()), $e(e);
5340
5356
  }, [
5341
- xt,
5342
- X,
5357
+ St,
5358
+ Y,
5343
5359
  Z,
5344
5360
  Q
5345
5361
  ]), Yt = useCallback(() => R, [R]), Xt = useCallback(() => et, [et]), Zt = useCallback(() => {
5346
- xt(), tt(null);
5347
- }, [xt]);
5362
+ St(), tt(null);
5363
+ }, [St]);
5348
5364
  useEffect(() => {
5349
5365
  if (!Ze || R !== "picker") return;
5350
5366
  let e = y.value;
5351
5367
  if (e) {
5352
5368
  let t = [e.lng, e.lat];
5353
- tt(e), bt(t);
5369
+ tt(e), xt(t);
5354
5370
  }
5355
5371
  }, [
5356
5372
  y.value,
5357
5373
  R,
5358
- bt,
5374
+ xt,
5359
5375
  Ze
5360
5376
  ]);
5361
5377
  let Qt = (e) => "mode" in e, $t = useCallback((e) => {
5362
- if ($e("edit"), xt(), tt(null), V.current = !0, Qt(e)) {
5363
- if (e.mode === "marker") e.markerStyle ? (U.current = e.markerStyle, H.current = null, W.current = null, G.current = null, q.current = null, J.current = null, z(null), B("marker"), e.markerStyle.src && e.markerStyle.width ? Ct({
5378
+ if ($e("edit"), St(), tt(null), V.current = !0, Qt(e)) {
5379
+ if (e.mode === "marker") e.markerStyle ? (U.current = e.markerStyle, H.current = null, W.current = null, G.current = null, K.current = null, q.current = null, z(null), B("marker"), e.markerStyle.src && e.markerStyle.width ? wt({
5364
5380
  id: "custom",
5365
5381
  name: e.markerStyle.name || "Marker",
5366
5382
  icon: e.markerStyle.src,
5367
5383
  width: e.markerStyle.width
5368
- }) : X()) : e.template && (U.current = null, H.current = null, W.current = null, G.current = null, q.current = null, J.current = null, z(e.template), B("marker"), Ct(e.template));
5384
+ }) : Y()) : e.template && (U.current = null, H.current = null, W.current = null, G.current = null, K.current = null, q.current = null, z(e.template), B("marker"), wt(e.template));
5369
5385
  else if (e.mode === "rectangle") {
5370
- H.current = e.rectangleStyle || null, U.current = null, W.current = null, G.current = null, q.current = null, J.current = null, z(null), B("rectangle"), X();
5386
+ H.current = e.rectangleStyle || null, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null, z(null), B("rectangle"), Y();
5371
5387
  let t = P.current;
5372
5388
  t && (t.getCanvas().style.cursor = "crosshair");
5373
5389
  } else if (e.mode === "circle") {
5374
- W.current = e.circleStyle || null, H.current = null, U.current = null, G.current = null, q.current = null, J.current = null, z(null), B("circle"), X();
5390
+ W.current = e.circleStyle || null, H.current = null, U.current = null, G.current = null, K.current = null, q.current = null, z(null), B("circle"), Y();
5375
5391
  let t = P.current;
5376
5392
  t && (t.getCanvas().style.cursor = "crosshair");
5377
5393
  } else if (e.mode === "polygon") {
5378
- G.current = e.polygonStyle || null, H.current = null, U.current = null, W.current = null, q.current = null, J.current = null, z(null), B("polygon"), X();
5394
+ G.current = e.polygonStyle || null, H.current = null, U.current = null, W.current = null, K.current = null, q.current = null, z(null), B("polygon"), Y();
5379
5395
  let t = P.current;
5380
5396
  t && (t.getCanvas().style.cursor = "crosshair");
5381
5397
  } else if (e.mode === "square") {
5382
- q.current = e.squareStyle || null, H.current = null, U.current = null, W.current = null, G.current = null, J.current = null, z(null), B("square"), X();
5398
+ K.current = e.squareStyle || null, H.current = null, U.current = null, W.current = null, G.current = null, q.current = null, z(null), B("square"), Y();
5383
5399
  let t = P.current;
5384
5400
  t && (t.getCanvas().style.cursor = "crosshair");
5385
5401
  } else if (e.mode === "polyline") {
5386
- J.current = e.polylineStyle || null, H.current = null, U.current = null, W.current = null, G.current = null, q.current = null, z(null), B("polyline"), X();
5402
+ q.current = e.polylineStyle || null, H.current = null, U.current = null, W.current = null, G.current = null, K.current = null, z(null), B("polyline"), Y();
5387
5403
  let t = P.current;
5388
5404
  t && (t.getCanvas().style.cursor = "crosshair");
5389
5405
  }
5390
- } else z(e), B("marker"), Ct(e), H.current = null, U.current = null, W.current = null, G.current = null, q.current = null, J.current = null;
5406
+ } else z(e), B("marker"), wt(e), H.current = null, U.current = null, W.current = null, G.current = null, K.current = null, q.current = null;
5391
5407
  }, [
5392
- xt,
5393
- Ct,
5394
- X
5408
+ St,
5409
+ wt,
5410
+ Y
5395
5411
  ]);
5396
5412
  useImperativeHandle(c, () => ({
5397
- startAnimation: ut,
5398
- stopAnimation: dt,
5399
- toggleAnimation: ft,
5413
+ startAnimation: dt,
5414
+ stopAnimation: ft,
5415
+ toggleAnimation: pt,
5400
5416
  getMap: () => P.current,
5401
- openPopup: (e) => mt(e, "programmatic"),
5402
- closePopup: ht,
5403
- closeAllPopups: gt,
5404
- isPopupOpen: _t,
5405
- toggleUnitTrajectory: pt,
5406
- flyTo: vt,
5407
- flyToEntities: yt,
5417
+ openPopup: (e) => ht(e, "programmatic"),
5418
+ closePopup: gt,
5419
+ closeAllPopups: _t,
5420
+ isPopupOpen: vt,
5421
+ toggleUnitTrajectory: mt,
5422
+ flyTo: yt,
5423
+ flyToEntities: bt,
5408
5424
  getMode: Yt,
5409
5425
  setMode: Jt,
5410
5426
  getPickedLocation: Xt,
@@ -5412,16 +5428,16 @@ const Mapbox = forwardRef((e, c) => {
5412
5428
  startDrawing: $t,
5413
5429
  getRenderer: (e) => F.current.get(e)
5414
5430
  }), [
5415
- ut,
5416
5431
  dt,
5417
5432
  ft,
5418
- mt,
5433
+ pt,
5419
5434
  ht,
5420
5435
  gt,
5421
5436
  _t,
5422
- pt,
5423
5437
  vt,
5438
+ mt,
5424
5439
  yt,
5440
+ bt,
5425
5441
  Yt,
5426
5442
  Jt,
5427
5443
  Xt,
@@ -5562,7 +5578,10 @@ const Mapbox = forwardRef((e, c) => {
5562
5578
  visibility: "none"
5563
5579
  }), e.addLayer(a, r);
5564
5580
  }
5565
- n.glyphs && (e.getStyle().glyphs || (e.style.glyphs = n.glyphs));
5581
+ if (n.glyphs && !e.getStyle().glyphs) {
5582
+ let t = e.style;
5583
+ t.glyphs = n.glyphs, t.stylesheet && (t.stylesheet.glyphs = n.glyphs);
5584
+ }
5566
5585
  } catch (e) {
5567
5586
  console.error(`Failed to load Style JSON from ${t.url}:`, e);
5568
5587
  }
@@ -5627,7 +5646,7 @@ const Mapbox = forwardRef((e, c) => {
5627
5646
  lng: t[0],
5628
5647
  lat: t[1]
5629
5648
  };
5630
- tt(e), bt(t), bn.current?.(e);
5649
+ tt(e), xt(t), bn.current?.(e);
5631
5650
  return;
5632
5651
  }
5633
5652
  if (r === "edit") {
@@ -5638,7 +5657,7 @@ const Mapbox = forwardRef((e, c) => {
5638
5657
  else {
5639
5658
  let n = H.current, r = applyEntityConfig({
5640
5659
  ...n,
5641
- id: n?.id ?? St(),
5660
+ id: n?.id ?? Ct(),
5642
5661
  type: "rectangle",
5643
5662
  bounds: [e, t]
5644
5663
  }, D);
@@ -5658,7 +5677,7 @@ const Mapbox = forwardRef((e, c) => {
5658
5677
  else {
5659
5678
  let n = At(e.center, t), r = W.current, i = applyEntityConfig({
5660
5679
  ...r,
5661
- id: r?.id ?? St(),
5680
+ id: r?.id ?? Ct(),
5662
5681
  type: "circle",
5663
5682
  center: e.center,
5664
5683
  radius: n
@@ -5674,13 +5693,13 @@ const Mapbox = forwardRef((e, c) => {
5674
5693
  return;
5675
5694
  }
5676
5695
  if (e === "polygon") {
5677
- let e = K.current;
5696
+ let e = ct.current;
5678
5697
  if (e.length >= 3) {
5679
5698
  let n = e[0];
5680
5699
  if (At(n, t) < 20) {
5681
5700
  let t = G.current, n = applyEntityConfig({
5682
5701
  ...t,
5683
- id: t?.id ?? St(),
5702
+ id: t?.id ?? Ct(),
5684
5703
  type: "polygon",
5685
5704
  coordinates: [...e]
5686
5705
  }, D);
@@ -5690,20 +5709,20 @@ const Mapbox = forwardRef((e, c) => {
5690
5709
  let e = new PolygonRenderer(r, n, O, k, A, M);
5691
5710
  F.current.set(n.id, e);
5692
5711
  }
5693
- wn.current.onPolygonAdd?.(n), K.current = [], G.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5712
+ wn.current.onPolygonAdd?.(n), ct.current = [], G.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5694
5713
  return;
5695
5714
  }
5696
5715
  }
5697
- K.current = [...e, t];
5716
+ ct.current = [...e, t];
5698
5717
  return;
5699
5718
  }
5700
5719
  if (e === "square") {
5701
- let e = ct.current;
5702
- if (!e) ct.current = { center: t };
5720
+ let e = lt.current;
5721
+ if (!e) lt.current = { center: t };
5703
5722
  else {
5704
- let n = At(e.center, t) * 2, r = q.current, i = applyEntityConfig({
5723
+ let n = At(e.center, t) * 2, r = K.current, i = applyEntityConfig({
5705
5724
  ...r,
5706
- id: r?.id ?? St(),
5725
+ id: r?.id ?? Ct(),
5707
5726
  type: "square",
5708
5727
  center: e.center,
5709
5728
  length: n
@@ -5714,38 +5733,38 @@ const Mapbox = forwardRef((e, c) => {
5714
5733
  let e = new SquareRenderer(a, i, O, k, A, M);
5715
5734
  F.current.set(i.id, e);
5716
5735
  }
5717
- wn.current.onSquareAdd?.(i), ct.current = null, q.current = null, V.current && (V.current = !1, B(null), a && (a.getCanvas().style.cursor = ""));
5736
+ wn.current.onSquareAdd?.(i), lt.current = null, K.current = null, V.current && (V.current = !1, B(null), a && (a.getCanvas().style.cursor = ""));
5718
5737
  }
5719
5738
  return;
5720
5739
  }
5721
5740
  if (e === "polyline") {
5722
- lt.current = [...lt.current, t];
5741
+ ut.current = [...ut.current, t];
5723
5742
  return;
5724
5743
  }
5725
5744
  let n = U.current;
5726
5745
  if (n && n.src && n.width) {
5727
5746
  let e = {
5728
5747
  ...n,
5729
- id: n.id ?? St(),
5748
+ id: n.id ?? Ct(),
5730
5749
  type: "marker",
5731
5750
  center: t,
5732
5751
  src: n.src,
5733
5752
  width: n.width
5734
5753
  };
5735
- wn.current.onMarkerAdd?.(e), z(null), B(null), X(), U.current = null, V.current = !1;
5754
+ wn.current.onMarkerAdd?.(e), z(null), B(null), Y(), U.current = null, V.current = !1;
5736
5755
  return;
5737
5756
  }
5738
5757
  let r = xn.current;
5739
5758
  if (r) {
5740
5759
  let e = {
5741
- id: St(),
5760
+ id: Ct(),
5742
5761
  type: "marker",
5743
5762
  name: r.name,
5744
5763
  center: t,
5745
5764
  src: r.icon,
5746
5765
  width: r.size || r.width || 32
5747
5766
  };
5748
- r.customData !== void 0 && (e.customData = r.customData), wn.current.onMarkerAdd?.(e), z(null), B(null), X(), V.current = !1;
5767
+ r.customData !== void 0 && (e.customData = r.customData), wn.current.onMarkerAdd?.(e), z(null), B(null), Y(), V.current = !1;
5749
5768
  return;
5750
5769
  }
5751
5770
  }
@@ -5792,11 +5811,11 @@ const Mapbox = forwardRef((e, c) => {
5792
5811
  n === "rectangle" && r && Et(r, t);
5793
5812
  let i = st.current;
5794
5813
  n === "circle" && i && jt(i.center, t);
5795
- let a = K.current;
5814
+ let a = ct.current;
5796
5815
  n === "polygon" && a.length > 0 && Ft(a, t);
5797
- let o = ct.current;
5816
+ let o = lt.current;
5798
5817
  n === "square" && o && Bt(o.center, t);
5799
- let s = lt.current;
5818
+ let s = ut.current;
5800
5819
  n === "polyline" && s.length > 0 && Wt(s, t);
5801
5820
  let c = gn.current, l = vn.current;
5802
5821
  for (let [e, n] of F.current) if (n.isPointInEntity(t)) {
@@ -5814,13 +5833,13 @@ const Mapbox = forwardRef((e, c) => {
5814
5833
  }
5815
5834
  if (Ke.current &&= (clearTimeout(Ke.current), null), L?.openedBy === "hover") {
5816
5835
  let e = F.current.get(L.entityId);
5817
- e && !e.isPointInEntity(t) && ht(L.entityId);
5836
+ e && !e.isPointInEntity(t) && gt(L.entityId);
5818
5837
  }
5819
5838
  }, [
5820
5839
  N,
5821
5840
  Pe,
5822
5841
  L,
5823
- ht,
5842
+ gt,
5824
5843
  Et,
5825
5844
  jt,
5826
5845
  Ft,
@@ -5829,7 +5848,7 @@ const Mapbox = forwardRef((e, c) => {
5829
5848
  ]), pn = useCallback((e) => {
5830
5849
  if (e.preventDefault(), yn.current !== "edit") return;
5831
5850
  if (xn.current) {
5832
- z(null), B(null), X();
5851
+ z(null), B(null), Y();
5833
5852
  return;
5834
5853
  }
5835
5854
  let t = Sn.current;
@@ -5852,11 +5871,11 @@ const Mapbox = forwardRef((e, c) => {
5852
5871
  return;
5853
5872
  }
5854
5873
  if (t === "polygon") {
5855
- let e = K.current;
5874
+ let e = ct.current;
5856
5875
  if (e.length >= 3) {
5857
5876
  let t = G.current, n = applyEntityConfig({
5858
5877
  ...t,
5859
- id: t?.id ?? St(),
5878
+ id: t?.id ?? Ct(),
5860
5879
  type: "polygon",
5861
5880
  coordinates: [...e]
5862
5881
  }, D);
@@ -5866,8 +5885,8 @@ const Mapbox = forwardRef((e, c) => {
5866
5885
  let e = new PolygonRenderer(r, n, O, k, A, M);
5867
5886
  F.current.set(n.id, e);
5868
5887
  }
5869
- wn.current.onPolygonAdd?.(n), K.current = [], G.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5870
- } else if (e.length > 0) K.current = [], It();
5888
+ wn.current.onPolygonAdd?.(n), ct.current = [], G.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5889
+ } else if (e.length > 0) ct.current = [], It();
5871
5890
  else {
5872
5891
  B(null);
5873
5892
  let e = P.current;
@@ -5876,7 +5895,7 @@ const Mapbox = forwardRef((e, c) => {
5876
5895
  return;
5877
5896
  }
5878
5897
  if (t === "square") {
5879
- if (ct.current) ct.current = null, Vt();
5898
+ if (lt.current) lt.current = null, Vt();
5880
5899
  else {
5881
5900
  B(null);
5882
5901
  let e = P.current;
@@ -5885,11 +5904,11 @@ const Mapbox = forwardRef((e, c) => {
5885
5904
  return;
5886
5905
  }
5887
5906
  if (t === "polyline") {
5888
- let e = lt.current;
5907
+ let e = ut.current;
5889
5908
  if (e.length >= 2) {
5890
- let t = J.current, n = applyEntityConfig({
5909
+ let t = q.current, n = applyEntityConfig({
5891
5910
  ...t,
5892
- id: t?.id ?? St(),
5911
+ id: t?.id ?? Ct(),
5893
5912
  type: "polyline",
5894
5913
  coordinates: [...e]
5895
5914
  }, D);
@@ -5899,8 +5918,8 @@ const Mapbox = forwardRef((e, c) => {
5899
5918
  let e = new PolylineRenderer(r, n, O, k, M);
5900
5919
  F.current.set(n.id, e);
5901
5920
  }
5902
- wn.current.onPolylineAdd?.(n), lt.current = [], J.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5903
- } else if (e.length > 0) lt.current = [], Gt();
5921
+ wn.current.onPolylineAdd?.(n), ut.current = [], q.current = null, V.current && (V.current = !1, B(null), r && (r.getCanvas().style.cursor = ""));
5922
+ } else if (e.length > 0) ut.current = [], Gt();
5904
5923
  else {
5905
5924
  B(null);
5906
5925
  let e = P.current;
@@ -5938,7 +5957,7 @@ const Mapbox = forwardRef((e, c) => {
5938
5957
  }
5939
5958
  }, [
5940
5959
  un,
5941
- X,
5960
+ Y,
5942
5961
  Dt,
5943
5962
  Mt,
5944
5963
  It,
@@ -6003,8 +6022,8 @@ const Mapbox = forwardRef((e, c) => {
6003
6022
  gn.current = T;
6004
6023
  let _n = useRef(Ie);
6005
6024
  _n.current = Ie;
6006
- let vn = useRef(mt);
6007
- vn.current = mt;
6025
+ let vn = useRef(ht);
6026
+ vn.current = ht;
6008
6027
  let yn = useRef(R);
6009
6028
  yn.current = R;
6010
6029
  let bn = useRef(b);
@@ -6021,7 +6040,7 @@ const Mapbox = forwardRef((e, c) => {
6021
6040
  Tn.current = D, useEffect(() => {
6022
6041
  let e = (e) => {
6023
6042
  if (e.key === "Escape" && R === "edit") {
6024
- if (rt && (z(null), B(null), X()), it === "rectangle") if (at) ot(null), Dt();
6043
+ if (rt && (z(null), B(null), Y()), it === "rectangle") if (at) ot(null), Dt();
6025
6044
  else {
6026
6045
  B(null);
6027
6046
  let e = P.current;
@@ -6033,19 +6052,19 @@ const Mapbox = forwardRef((e, c) => {
6033
6052
  let e = P.current;
6034
6053
  e && (e.getCanvas().style.cursor = "");
6035
6054
  }
6036
- if (it === "polygon") if (K.current.length > 0) K.current = [], It();
6055
+ if (it === "polygon") if (ct.current.length > 0) ct.current = [], It();
6037
6056
  else {
6038
6057
  B(null);
6039
6058
  let e = P.current;
6040
6059
  e && (e.getCanvas().style.cursor = "");
6041
6060
  }
6042
- if (it === "square") if (ct.current) ct.current = null, Vt();
6061
+ if (it === "square") if (lt.current) lt.current = null, Vt();
6043
6062
  else {
6044
6063
  B(null);
6045
6064
  let e = P.current;
6046
6065
  e && (e.getCanvas().style.cursor = "");
6047
6066
  }
6048
- if (it === "polyline") if (lt.current.length > 0) lt.current = [], Gt();
6067
+ if (it === "polyline") if (ut.current.length > 0) ut.current = [], Gt();
6049
6068
  else {
6050
6069
  B(null);
6051
6070
  let e = P.current;
@@ -6061,7 +6080,7 @@ const Mapbox = forwardRef((e, c) => {
6061
6080
  rt,
6062
6081
  it,
6063
6082
  at,
6064
- X,
6083
+ Y,
6065
6084
  Dt,
6066
6085
  Mt,
6067
6086
  It,
@@ -6073,7 +6092,7 @@ const Mapbox = forwardRef((e, c) => {
6073
6092
  let t = L.entityId, n = L.config, r = () => {
6074
6093
  let r = gn.current.find((e) => e.id === t);
6075
6094
  if (!r) {
6076
- gt();
6095
+ _t();
6077
6096
  return;
6078
6097
  }
6079
6098
  let { position: i } = calculatePopupPosition(r, n, e, void 0, Ge.current);
@@ -6084,7 +6103,7 @@ const Mapbox = forwardRef((e, c) => {
6084
6103
  return e.on("move", r), e.on("zoom", r), e.on("rotate", r), e.on("pitch", r), () => {
6085
6104
  clearTimeout(i), e.off("move", r), e.off("zoom", r), e.off("rotate", r), e.off("pitch", r);
6086
6105
  };
6087
- }, [L?.entityId, gt]), useEffect(() => {
6106
+ }, [L?.entityId, _t]), useEffect(() => {
6088
6107
  let e = P.current, t = Ve.current;
6089
6108
  if (!e || !qe || !t) return;
6090
6109
  let n = qe.lngLat, r = () => {
@@ -6134,11 +6153,15 @@ const Mapbox = forwardRef((e, c) => {
6134
6153
  }
6135
6154
  });
6136
6155
  return P.current = _, _.on("load", () => {
6156
+ if (!_.getStyle().glyphs) {
6157
+ let e = _.style, t = "/gis-fonts/{fontstack}/{range}.pbf";
6158
+ e.glyphs = t, e.stylesheet && (e.stylesheet.glyphs = t);
6159
+ }
6137
6160
  I.current.clear(), T.forEach((e) => {
6138
6161
  I.current.set(e.id, e);
6139
6162
  }), ln(S), en(), Tt(), Ot(), Pt(), Rt(), Ut(), Qe(_), Fe?.(_);
6140
6163
  }), _.on("click", dn), _.on("mousemove", fn), _.on("contextmenu", pn), () => {
6141
- _.off("click", dn), _.off("mousemove", fn), _.off("contextmenu", pn), tn(), xt(), X(), Z(), Q(), _.remove(), P.current = null;
6164
+ _.off("click", dn), _.off("mousemove", fn), _.off("contextmenu", pn), tn(), St(), Y(), Z(), Q(), _.remove(), P.current = null;
6142
6165
  };
6143
6166
  }, []), useEffect(() => {
6144
6167
  if (P.current) {
@@ -6205,6 +6228,10 @@ const Mapbox = forwardRef((e, c) => {
6205
6228
  return;
6206
6229
  }
6207
6230
  En.current !== h && (En.current = h, e.setStyle(t), e.once("style.load", () => {
6231
+ if (!e.getStyle().glyphs) {
6232
+ let t = e.style, n = "/gis-fonts/{fontstack}/{range}.pbf";
6233
+ t.glyphs = n, t.stylesheet && (t.stylesheet.glyphs = n);
6234
+ }
6208
6235
  He.current.clear(), kn.current(On.current), An.current(), jn.current(), Mn.current(), Nn.current(), Pn.current(), Fn.current(), In.current();
6209
6236
  }));
6210
6237
  }, [h]), useEffect(() => {
@@ -6233,8 +6260,8 @@ const Mapbox = forwardRef((e, c) => {
6233
6260
  d,
6234
6261
  f
6235
6262
  ]);
6236
- let Rn = (() => Se === !1 ? null : Se === !0 ? { enabled: !0 } : Se)(), zn = (() => we === !1 ? null : we === !0 ? { enabled: !0 } : we)(), Bn = (() => Oe === !1 ? null : Oe === !0 ? { enabled: !0 } : Oe)(), $ = (() => {
6237
- if (ke === !1) return null;
6263
+ let Rn = (() => be === !1 ? null : be === !0 ? { enabled: !0 } : be)(), zn = (() => Se === !1 ? null : Se === !0 ? { enabled: !0 } : Se)(), Bn = (() => Ee === !1 ? null : Ee === !0 ? { enabled: !0 } : Ee)(), $ = (() => {
6264
+ if (De === !1) return null;
6238
6265
  let e, t;
6239
6266
  if (S && S.length > 0) {
6240
6267
  let n = S.find((e) => e.hasRoadNetwork === !0) || S[0];
@@ -6247,16 +6274,16 @@ const Mapbox = forwardRef((e, c) => {
6247
6274
  } else e = `base-layer-source-${n.id}`;
6248
6275
  t = n.roadNetworkSourceLayer || "road";
6249
6276
  }
6250
- return ke === !0 ? {
6277
+ return De === !0 ? {
6251
6278
  enabled: !0,
6252
6279
  source: e,
6253
6280
  sourceLayer: t
6254
6281
  } : {
6255
- ...ke,
6256
- source: ke.source || e,
6257
- sourceLayer: ke.sourceLayer || t
6282
+ ...De,
6283
+ source: De.source || e,
6284
+ sourceLayer: De.sourceLayer || t
6258
6285
  };
6259
- })(), Vn = (() => Ae ? Ae === !0 ? { enabled: !0 } : Ae : null)(), Hn = (() => Me ? Me === !0 ? { enabled: !0 } : Me : null)(), Un = useMemo(() => {
6286
+ })(), Vn = (() => Oe ? Oe === !0 ? { enabled: !0 } : Oe : null)(), Hn = (() => Ae ? Ae === !0 ? { enabled: !0 } : Ae : null)(), Un = useMemo(() => {
6260
6287
  let e = [];
6261
6288
  for (let t of S) if (t.applyRasterPaint) if (t.type === "style") {
6262
6289
  let n = P.current;
@@ -6327,14 +6354,14 @@ const Mapbox = forwardRef((e, c) => {
6327
6354
  }),
6328
6355
  Vn && Vn.enabled !== !1 && /* @__PURE__ */ jsx(MeasureControl, {
6329
6356
  map: Ze,
6330
- defaultEntityConfig: Vn.defaultEntityConfig,
6357
+ entityConfig: D,
6331
6358
  className: Vn.className,
6332
6359
  style: Vn.style
6333
6360
  }),
6334
6361
  Hn && Hn.enabled !== !1 && /* @__PURE__ */ jsx(RasterPaintControl, {
6335
6362
  map: Ze,
6336
6363
  value: C,
6337
- onChange: Ne,
6364
+ onChange: je,
6338
6365
  rasterPaintLayerIds: Un,
6339
6366
  className: Hn.className,
6340
6367
  style: Hn.style
@@ -6353,7 +6380,7 @@ const Mapbox = forwardRef((e, c) => {
6353
6380
  }),
6354
6381
  L && We.current && /* @__PURE__ */ jsx(EntityPopup, {
6355
6382
  popupState: L,
6356
- onClose: () => ht(L.entityId),
6383
+ onClose: () => gt(L.entityId),
6357
6384
  portalContainer: We.current,
6358
6385
  popupRef: Ge
6359
6386
  }),