@idmwx/idmui-gl4 3.0.4 → 3.0.5

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.
@@ -1,4 +1,4 @@
1
- import { l as b } from "./index-76ef8dce.js";
1
+ import { l as b } from "./index-fc0a9238.js";
2
2
  function M(e) {
3
3
  return typeof e == "string" && /^data:image\/svg\+xml/i.test(e);
4
4
  }
@@ -1,4 +1,4 @@
1
- import { W as a } from "./chunk-3VYIPD3A-f7a04bda.js";
1
+ import { W as a } from "./chunk-3VYIPD3A-372674b9.js";
2
2
  async function o(r, t) {
3
3
  let i = await a(r, t), e = new Image();
4
4
  return e.src = i.toDataURL(`image/${t.format}`, t.quality), await e.decode(), e.style.width = `${i.width / t.dpr}px`, e.style.height = `${i.height / t.dpr}px`, e;
@@ -1,4 +1,4 @@
1
- import { W as m } from "./chunk-3VYIPD3A-f7a04bda.js";
1
+ import { W as m } from "./chunk-3VYIPD3A-372674b9.js";
2
2
  async function a(n, e) {
3
3
  let o = e.type;
4
4
  if (o === "svg") {
@@ -1,6 +1,6 @@
1
- import { m as d } from "./chunk-T4JIPPZO-4371933b.js";
2
- import { W as f } from "./chunk-3VYIPD3A-f7a04bda.js";
3
- import "./index-76ef8dce.js";
1
+ import { m as d } from "./chunk-T4JIPPZO-bdbd84b7.js";
2
+ import { W as f } from "./chunk-3VYIPD3A-372674b9.js";
3
+ import "./index-fc0a9238.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
@@ -6,7 +6,7 @@ import { useTheme as Ne } from "vuetify";
6
6
  import { openBlock as k, createElementBlock as I, resolveComponent as P, createBlock as W, normalizeClass as ge, withCtx as x, createVNode as b, withModifiers as Le, createElementVNode as n, createCommentVNode as N, toDisplayString as y, createTextVNode as O, Fragment as Te, renderList as De, withDirectives as et, vShow as tt, mergeProps as $, normalizeStyle as he } from "vue";
7
7
  import be from "mapbox-gl";
8
8
  import R from "moment";
9
- import { LngLatHelper as j, TropicalHelper as Di, LaneHelper as je, GeoJsonHelper as Ke } from "@idm-plugin/geo";
9
+ import { LngLatHelper as j, TropicalHelper as Di, LaneHelper as je, GeoJsonHelper as Je } from "@idm-plugin/geo";
10
10
  import { Meteo2Assist as Va, TidesAssist as er } from "@idm-plugin/meteo";
11
11
  import * as Ka from "echarts";
12
12
  import * as B from "@turf/turf";
@@ -14748,12 +14748,8 @@ const Lp = {
14748
14748
  return;
14749
14749
  const e = [], a = 2;
14750
14750
  t == null || t.forEach((o, r) => {
14751
- var l, c;
14752
- if (e.push(B.point(o)), r >= 1) {
14753
- const s = [(l = t == null ? void 0 : t[r - 1]) == null ? void 0 : l[0], (c = t == null ? void 0 : t[r - 1]) == null ? void 0 : c[1]], d = [o[0], o[1]], m = Ke.drawLine(s, d);
14754
- e.push(m);
14755
- }
14756
- });
14751
+ e.push(Je.drawPoint(o == null ? void 0 : o[1], o == null ? void 0 : o[0]));
14752
+ }), (t == null ? void 0 : t.length) >= 2 && e.push(Je.drawLine(t));
14757
14753
  const i = B.featureCollection(e);
14758
14754
  this.handleSetDrawSource(i), this.map.getLayer(this.drawLineLayer) ? (this.map.setPaintProperty(this.drawLineLayer, "line-color", this.form.color), this.map.setPaintProperty(this.drawLineLayer, "line-width", a), this.map.getLayer(this.drawPointLayer) && this.map.setPaintProperty(this.drawPointLayer, "circle-color", this.form.color)) : (this.map.addLayer({
14759
14755
  id: this.drawLineLayer,
@@ -14779,7 +14775,7 @@ const Lp = {
14779
14775
  }));
14780
14776
  },
14781
14777
  handleRenderTmpLine(t, e) {
14782
- const a = Ke.drawLine(t, e), i = B.featureCollection([a]);
14778
+ const a = Je.drawLine([t, e]), i = B.featureCollection([a]);
14783
14779
  this.map.getSource(this.drawTmpSource) ? this.map.getSource(this.drawTmpSource).setData(i) : this.map.addSource(this.drawTmpSource, { type: "geojson", data: i }), this.map.getLayer(this.drawTmpLayer) || this.map.addLayer({
14784
14780
  id: this.drawTmpLayer,
14785
14781
  type: "line",
@@ -14833,7 +14829,7 @@ const Lp = {
14833
14829
  e.push(B.point(r));
14834
14830
  }), (t == null ? void 0 : t.length) > 2) {
14835
14831
  const r = [...t, t[0]];
14836
- e.push(Ke.drawPolygon(r, { ...this.originalProperties }));
14832
+ e.push(Je.drawPolygon(r, { ...this.originalProperties }));
14837
14833
  }
14838
14834
  const a = B.featureCollection(e);
14839
14835
  this.handleSetDrawSource(a);
@@ -14920,14 +14916,14 @@ const Lp = {
14920
14916
  }
14921
14917
  }), this.handleRenderCircleCenterLabel([e, a]);
14922
14918
  } else {
14923
- const i = this.drawCoords[0], o = [e, a], r = B.distance(B.point(i), B.point(o), { units: "nauticalmiles" }), l = Ke.drawCircle(i[0], i[1], r), c = B.featureCollection([B.point(i), l]);
14919
+ const i = this.drawCoords[0], o = [e, a], r = B.distance(B.point(i), B.point(o), { units: "nauticalmiles" }), l = Je.drawCircle(i[0], i[1], r), c = B.featureCollection([B.point(i), l]);
14924
14920
  this.handleSetDrawSource(c), this.handleRenderAreaLayers(), this.handleRenderRadiusLine(i, o, r), this.drawCoords = [i, o], this.map.off("click", this.handleMapClickCircle), this.map.off("mousemove", this.handleMapMoveCircle);
14925
14921
  }
14926
14922
  },
14927
14923
  handleMapMoveCircle(t) {
14928
14924
  if (this.drawCoords.length !== 1)
14929
14925
  return;
14930
- const e = this.drawCoords[0], a = [t.lngLat.lng, t.lngLat.lat], i = B.distance(B.point(e), B.point(a), { units: "nauticalmiles" }), o = Ke.drawCircle(e[0], e[1], i), r = B.featureCollection([B.point(e), o]);
14926
+ const e = this.drawCoords[0], a = [t.lngLat.lng, t.lngLat.lat], i = B.distance(B.point(e), B.point(a), { units: "nauticalmiles" }), o = Je.drawCircle(e[0], e[1], i), r = B.featureCollection([B.point(e), o]);
14931
14927
  this.handleSetDrawSource(r), this.map.getLayer(this.drawFillLayer) || this.handleRenderAreaLayers(), this.handleRenderRadiusLine(e, a, i);
14932
14928
  },
14933
14929
  handleRenderCircleCenterLabel(t) {
@@ -14978,7 +14974,7 @@ const Lp = {
14978
14974
  if (this.drawCoords.length === 0)
14979
14975
  this.drawCoords.push([e, a]);
14980
14976
  else {
14981
- const i = this.drawCoords[0], o = [e, a], r = Ke.drawRect(i, o);
14977
+ const i = this.drawCoords[0], o = [e, a], r = Je.drawRect(i, o);
14982
14978
  delete r.bbox;
14983
14979
  const l = this.buildRectFeatureCollection(i, o), c = B.featureCollection([r, ...l.map((s) => B.point(s))]);
14984
14980
  this.handleSetDrawSource(c), this.handleRenderRectLayers(), this.handleRenderRectCorners(i, o), this.drawCoords = [i, o], this.map.off("click", this.handleMapClickRect), this.map.off("mousemove", this.handleMapMoveRect);
@@ -14987,7 +14983,7 @@ const Lp = {
14987
14983
  handleMapMoveRect(t) {
14988
14984
  if (this.drawCoords.length !== 1)
14989
14985
  return;
14990
- const e = this.drawCoords[0], a = [t.lngLat.lng, t.lngLat.lat], i = Ke.drawRect(e, a), o = this.buildRectFeatureCollection(e, a), r = B.featureCollection([i, ...o.map((l) => B.point(l))]);
14986
+ const e = this.drawCoords[0], a = [t.lngLat.lng, t.lngLat.lat], i = Je.drawRect(e, a), o = this.buildRectFeatureCollection(e, a), r = B.featureCollection([i, ...o.map((l) => B.point(l))]);
14991
14987
  this.handleSetDrawSource(r), this.map.getLayer(this.drawFillLayer) || this.handleRenderRectLayers(), this.handleRenderRectCorners(e, a);
14992
14988
  },
14993
14989
  handleRenderRectLayers() {
@@ -15103,7 +15099,7 @@ const Lp = {
15103
15099
  return;
15104
15100
  const [l, c] = this.drawCoords[0];
15105
15101
  t = B.featureCollection([
15106
- Ke.drawPoint(c, l, { ...this.originalProperties, color: this.form.color, name: this.form.name })
15102
+ Je.drawPoint(c, l, { ...this.originalProperties, color: this.form.color, name: this.form.name })
15107
15103
  ]);
15108
15104
  }
15109
15105
  }) : this.markerType === "Line" ? await this.$refs.lineForm.validate().then((r) => {
@@ -17522,7 +17518,7 @@ function sg(t) {
17522
17518
  for (let a of e)
17523
17519
  a instanceof RegExp ? lo.push(a) : typeof a == "string" ? lo.push(new RegExp(a, "i")) : console.warn("[snapdom] Ignored invalid iconFont value:", a);
17524
17520
  }
17525
- function Je(t) {
17521
+ function Ke(t) {
17526
17522
  let e = typeof t == "string" ? t : "", a = [...ng, ...lo];
17527
17523
  for (let i of a)
17528
17524
  if (i instanceof RegExp && i.test(e))
@@ -17832,7 +17828,7 @@ async function mr(t, e, a = "") {
17832
17828
  p = new URL(p, e || location.href).href;
17833
17829
  } catch {
17834
17830
  }
17835
- if (!Je(p)) {
17831
+ if (!Ke(p)) {
17836
17832
  if ((o = V.resource) != null && o.has(p)) {
17837
17833
  (r = V.font) == null || r.add(p), i = i.replace(d[0], `url(${V.resource.get(p)})`);
17838
17834
  continue;
@@ -17927,7 +17923,7 @@ async function dr(t, e, a, i) {
17927
17923
  }
17928
17924
  if (l.type === CSSRule.FONT_FACE_RULE) {
17929
17925
  let c = (l.style.getPropertyValue("font-family") || "").trim(), s = to(c);
17930
- if (!s || Je(s))
17926
+ if (!s || Ke(s))
17931
17927
  continue;
17932
17928
  let d = (l.style.getPropertyValue("font-weight") || "400").trim(), m = (l.style.getPropertyValue("font-style") || "normal").trim(), p = (l.style.getPropertyValue("font-stretch") || "100%").trim(), f = (l.style.getPropertyValue("src") || "").trim(), w = (l.style.getPropertyValue("unicode-range") || "").trim();
17933
17929
  if (!i.faceMatchesRequired(s, m, d, p))
@@ -17992,7 +17988,7 @@ async function Sg({ required: t, usedCodepoints: e, exclude: a = void 0, localFo
17992
17988
  let J = F.textContent || "";
17993
17989
  for (let K of J.matchAll(p)) {
17994
17990
  let oe = (K[2] || K[4] || "").trim();
17995
- !oe || Je(oe) || document.querySelector(`link[rel="stylesheet"][href="${oe}"]`) || m.push(oe);
17991
+ !oe || Ke(oe) || document.querySelector(`link[rel="stylesheet"][href="${oe}"]`) || m.push(oe);
17996
17992
  }
17997
17993
  }
17998
17994
  m.length && await Promise.all(m.map((F) => new Promise((J) => {
@@ -18004,7 +18000,7 @@ async function Sg({ required: t, usedCodepoints: e, exclude: a = void 0, localFo
18004
18000
  let f = "", w = Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter((F) => !!F.href);
18005
18001
  for (let F of w)
18006
18002
  try {
18007
- if (Je(F.href))
18003
+ if (Ke(F.href))
18008
18004
  continue;
18009
18005
  let J = "", K = !1;
18010
18006
  try {
@@ -18022,13 +18018,13 @@ async function Sg({ required: t, usedCodepoints: e, exclude: a = void 0, localFo
18022
18018
  } catch {
18023
18019
  }
18024
18020
  }
18025
- if (!J && (J = (await $e(F.href, { as: "text", useProxy: o })).data, Je(F.href)))
18021
+ if (!J && (J = (await $e(F.href, { as: "text", useProxy: o })).data, Ke(F.href)))
18026
18022
  continue;
18027
18023
  J = await Lg(J, F.href, o);
18028
18024
  let oe = "";
18029
18025
  for (let Y of J.match(zg) || []) {
18030
18026
  let H = (((g = Y.match(/font-family:\s*([^;]+);/i)) == null ? void 0 : g[1]) || "").trim(), ee = to(H);
18031
- if (!ee || Je(ee))
18027
+ if (!ee || Ke(ee))
18032
18028
  continue;
18033
18029
  let G = (((_ = Y.match(/font-weight:\s*([^;]+);/i)) == null ? void 0 : _[1]) || "400").trim(), ne = (((T = Y.match(/font-style:\s*([^;]+);/i)) == null ? void 0 : T[1]) || "normal").trim(), fe = (((v = Y.match(/font-stretch:\s*([^;]+);/i)) == null ? void 0 : v[1]) || "100%").trim(), ke = (((M = Y.match(/unicode-range:\s*([^;]+);/i)) == null ? void 0 : M[1]) || "").trim(), ze = (((L = Y.match(/src\s*:\s*([^;}]+)[;}]/i)) == null ? void 0 : L[1]) || "").trim(), me = wo(ze, F.href);
18034
18030
  if (!l(ee, ne, G, fe))
@@ -18061,7 +18057,7 @@ async function Sg({ required: t, usedCodepoints: e, exclude: a = void 0, localFo
18061
18057
  if (!F || !F.family || F.status !== "loaded" || !F._snapdomSrc)
18062
18058
  continue;
18063
18059
  let J = String(F.family).replace(/^['"]+|['"]+$/g, "");
18064
- if (Je(J) || !r.has(J) || a != null && a.families && a.families.some((oe) => String(oe).toLowerCase() === J.toLowerCase()))
18060
+ if (Ke(J) || !r.has(J) || a != null && a.families && a.families.some((oe) => String(oe).toLowerCase() === J.toLowerCase()))
18065
18061
  continue;
18066
18062
  let K = F._snapdomSrc;
18067
18063
  if (!String(K).startsWith("data:")) {
@@ -18087,7 +18083,7 @@ async function Sg({ required: t, usedCodepoints: e, exclude: a = void 0, localFo
18087
18083
  if (!F || typeof F != "object")
18088
18084
  continue;
18089
18085
  let J = String(F.family || "").replace(/^['"]+|['"]+$/g, "");
18090
- if (!J || Je(J) || !r.has(J) || a != null && a.families && a.families.some((G) => String(G).toLowerCase() === J.toLowerCase()))
18086
+ if (!J || Ke(J) || !r.has(J) || a != null && a.families && a.families.some((G) => String(G).toLowerCase() === J.toLowerCase()))
18091
18087
  continue;
18092
18088
  let K = F.weight != null ? String(F.weight) : "normal", oe = F.style != null ? String(F.style) : "normal", Y = F.stretchPct != null ? `${F.stretchPct}%` : "100%", H = String(F.src || ""), ee = H;
18093
18089
  if (!ee.startsWith("data:")) {
@@ -19318,7 +19314,7 @@ async function fr(t, e, a, i) {
19318
19314
  e.replaceChild(me, H), e.insertBefore(fe, me);
19319
19315
  continue;
19320
19316
  }
19321
- let u = w.content ?? "", h = u === "" || u === "none" || u === "normal", { text: g, incs: _ } = k0(t, f, l), T = w.backgroundImage, v = w.backgroundColor, M = w.fontFamily, L = parseInt(w.fontSize) || 32, z = parseInt(w.fontWeight) || !1, S = w.color || "#000", D = w.borderStyle, A = parseFloat(w.borderWidth), E = w.transform, X = Je(M), Z = !h && g !== "", q = T && T !== "none", ae = v && v !== "transparent" && v !== "rgba(0, 0, 0, 0)", re = D && D !== "none" && A > 0, pe = E && E !== "none";
19317
+ let u = w.content ?? "", h = u === "" || u === "none" || u === "normal", { text: g, incs: _ } = k0(t, f, l), T = w.backgroundImage, v = w.backgroundColor, M = w.fontFamily, L = parseInt(w.fontSize) || 32, z = parseInt(w.fontWeight) || !1, S = w.color || "#000", D = w.borderStyle, A = parseFloat(w.borderWidth), E = w.transform, X = Ke(M), Z = !h && g !== "", q = T && T !== "none", ae = v && v !== "transparent" && v !== "rgba(0, 0, 0, 0)", re = D && D !== "none" && A > 0, pe = E && E !== "none";
19322
19318
  if (!(Z || q || ae || re || pe)) {
19323
19319
  if (_ && _.length && t.parentElement) {
19324
19320
  let Y = ct.get(t.parentElement) || /* @__PURE__ */ new Map();
@@ -20105,52 +20101,52 @@ Se.capture = async (t, e, a) => {
20105
20101
  if (a !== wr)
20106
20102
  throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");
20107
20103
  let i = await br(t, e), o = { img: async (u, h) => {
20108
- let { toImg: g } = await import("./toImg-fc72c6d6.js");
20104
+ let { toImg: g } = await import("./toImg-89c60f60.js");
20109
20105
  return g(i, { ...u, ...h || {} });
20110
20106
  }, svg: async (u, h) => {
20111
- let { toSvg: g } = await import("./toImg-fc72c6d6.js");
20107
+ let { toSvg: g } = await import("./toImg-89c60f60.js");
20112
20108
  return g(i, { ...u, ...h || {} });
20113
20109
  }, canvas: async (u, h) => {
20114
- let { toCanvas: g } = await import("./toCanvas-626b2252.js");
20110
+ let { toCanvas: g } = await import("./toCanvas-071a306f.js");
20115
20111
  return g(i, { ...u, ...h || {} });
20116
20112
  }, blob: async (u, h) => {
20117
- let { toBlob: g } = await import("./toBlob-aae3debb.js");
20113
+ let { toBlob: g } = await import("./toBlob-c7e61dbe.js");
20118
20114
  return g(i, { ...u, ...h || {} });
20119
20115
  }, png: async (u, h) => {
20120
- let { rasterize: g } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20116
+ let { rasterize: g } = await import("./rasterize-JS5G2XHH-fc278050.js");
20121
20117
  return g(i, { ...u, ...h || {}, format: "png" });
20122
20118
  }, jpeg: async (u, h) => {
20123
- let { rasterize: g } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20119
+ let { rasterize: g } = await import("./rasterize-JS5G2XHH-fc278050.js");
20124
20120
  return g(i, { ...u, ...h || {}, format: "jpeg" });
20125
20121
  }, webp: async (u, h) => {
20126
- let { rasterize: g } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20122
+ let { rasterize: g } = await import("./rasterize-JS5G2XHH-fc278050.js");
20127
20123
  return g(i, { ...u, ...h || {}, format: "webp" });
20128
20124
  }, download: async (u, h) => {
20129
- let { download: g } = await import("./download-c9e6d57b.js");
20125
+ let { download: g } = await import("./download-a5d9f6b1.js");
20130
20126
  return g(i, { ...u, ...h || {} });
20131
20127
  } }, r = { ...e, export: { url: i }, exports: { svg: async (u) => {
20132
- let { toSvg: h } = await import("./toImg-fc72c6d6.js");
20128
+ let { toSvg: h } = await import("./toImg-89c60f60.js");
20133
20129
  return h(i, { ...e, ...u || {}, [qe]: !0 });
20134
20130
  }, canvas: async (u) => {
20135
- let { toCanvas: h } = await import("./toCanvas-626b2252.js");
20131
+ let { toCanvas: h } = await import("./toCanvas-071a306f.js");
20136
20132
  return h(i, { ...e, ...u || {}, [qe]: !0 });
20137
20133
  }, png: async (u) => {
20138
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20134
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-fc278050.js");
20139
20135
  return h(i, { ...e, ...u || {}, format: "png", [qe]: !0 });
20140
20136
  }, jpeg: async (u) => {
20141
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20137
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-fc278050.js");
20142
20138
  return h(i, { ...e, ...u || {}, format: "jpeg", [qe]: !0 });
20143
20139
  }, jpg: async (u) => {
20144
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20140
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-fc278050.js");
20145
20141
  return h(i, { ...e, ...u || {}, format: "jpeg", [qe]: !0 });
20146
20142
  }, webp: async (u) => {
20147
- let { rasterize: h } = await import("./rasterize-JS5G2XHH-e01f0cec.js");
20143
+ let { rasterize: h } = await import("./rasterize-JS5G2XHH-fc278050.js");
20148
20144
  return h(i, { ...e, ...u || {}, format: "webp", [qe]: !0 });
20149
20145
  }, blob: async (u) => {
20150
- let { toBlob: h } = await import("./toBlob-aae3debb.js");
20146
+ let { toBlob: h } = await import("./toBlob-c7e61dbe.js");
20151
20147
  return h(i, { ...e, ...u || {}, [qe]: !0 });
20152
20148
  }, img: async (u) => {
20153
- let { toImg: h } = await import("./toImg-fc72c6d6.js");
20149
+ let { toImg: h } = await import("./toImg-89c60f60.js");
20154
20150
  return h(i, { ...e, ...u || {}, [qe]: !0 });
20155
20151
  } } }, l = await Fg("defineExports", r), c = Object.assign({}, ...l.filter((u) => u && typeof u == "object")), s = { ...o, ...c };
20156
20152
  s.jpeg && !s.jpg && (s.jpg = (u, h) => s.jpeg(u, h));
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as n, D as x, L as D, a as T, b as S, M as W, g as f, f as h, P as k, d as y, T as V, V as d, W as u, e as w } from "./index-76ef8dce.js";
1
+ import { c as n, D as x, L as D, a as T, b as S, M as W, g as f, f as h, P as k, d as y, T as V, V as d, W as u, e as w } from "./index-fc0a9238.js";
2
2
  import "axios";
3
3
  import "vuetify";
4
4
  import "vue";
@@ -214,7 +214,7 @@
214
214
  <path
215
215
  d="M420.66666667 959.17a16.08 16.08 0 0 1-15.91-13.49A15.89 15.89 0 0 1 415.50666667 928c1.49-0.55 38.88-14.76 72.79-65.52A354.55 354.55 0 0 1 162.66666667 509.17a450.14 450.14 0 0 1 450.5-450.5 16.07 16.07 0 0 1 15.91 13.48 15.88 15.88 0 0 1-10.75 17.66c-1.58 0.58-39.13 14.9-73.07 65.95A354.22 354.22 0 0 1 871.66666667 509.17a16 16 0 0 1-0.52 4.05A450.14 450.14 0 0 1 420.66666667 959.17zM554.80666667 94.72C351.57666667 123.2 194.66666667 298.21 194.66666667 509.17c0 177.08 144.06 321.74 321.13 322.48a16 16 0 0 1 14.07 23.49c-16.11 30.42-34.27 52.37-50.85 68C682.25666667 894.63 839.16666667 719.63 839.16666667 508.67a15.94 15.94 0 0 1 0.47-3.86C837.30666667 329.33 693.82666667 187 517.80666667 186.67A16 16 0 0 1 503.66666667 163.21c16.21-30.69 34.47-52.79 51.14-68.49z"
216
216
  fill="#ffffff" p-id="18386"></path>
217
- </svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${V.geometry.coordinates[1]>=0?"center north":"center south"}">${re}</div>`;const ge=new ne.Marker(he).setLngLat(V.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ge)}this.$emit("tropicalCenterPoints",j)}else(P=this.map)!=null&&P.getSource(this.interpolateSource)&&((G=this.map)==null||G.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,c,s,m,d,p,u,y,g;const e=t.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((p=e==null?void 0:e.properties)==null?void 0:p.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(g=(y=a[0])==null?void 0:y.properties)==null?void 0:g.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([t.lngLat.lng,t.lngLat.lat])},drawTropicalsInfoMaker(t){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(t).setOffset([220,0]):this.activeTropicalsMarker=new ne.Marker(e).setLngLat(t).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var t;(t=this.activeTropicalsMarker)==null||t.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(t){var r,i,l,n,c,s;t.disabled=!t.disabled;const e=`${t.name}-${t.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=t.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=t.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(E.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(E.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(t){this.$emit("tropicalProbability",t)},handleToggleCircles(t){var e,a;t.showCircle=!t.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===t.name&&(r.properties.showCircle=t.showCircle)}),this.handleRender()},handleComputePolygons(t){const e=[];for(const a of t){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(t,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=E.lineArc(t,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=E.lineArc(t,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=E.lineArc(t,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=E.lineArc(t,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=E.lineString(r);return E.lineToPolygon(i,{properties:a})},handleNotification(t){this.$emit("tropicalNotification",t)},handleHover(t){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(t.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new ne.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var t;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(t=this.hoverMarker)==null||t.remove(),this.hoverMarker=void 0}}},Lm={class:"idm-tropical-gl4"},zm={class:"pb-1"},Cm={class:"text-h5 font-weight-600"},vm={key:0,class:"text-h5 font-weight-600"},Sm={class:"text-body-1"},Nm={class:"text-label"},Pm={class:"d-flex justify-space-between align-center"},Vm={class:"w-60"},Mm={class:"text-label pr-1"},Tm={class:"flex-1-1-0"},Em={class:"text-label pr-1"},Dm={class:"py-2 d-flex justify-space-between align-center"},Rm={class:"w-60"},Bm={class:"text-label pr-1"},Im={class:"flex-1-1-0"},Am={class:"text-label pr-1"},Fm={class:"d-flex align-center flex-1-1-100 justify-space-between mt-n1"},Gm={class:"text-label pr-1",style:{width:"70px"}},Wm={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Zm={class:"more"},Om={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},jm={class:"pa-1"},Hm={class:"legend d-flex justify-start align-center py-2"},Xm={class:"label"},Ym={class:"legend d-flex justify-start align-center py-2"},Um={class:"label"},$m={class:"legend d-flex justify-start align-center py-2"},Jm={class:"label"},Km={class:"pa-1"},qm={class:"legend d-flex justify-start align-center py-2"},Qm={class:"label"},ed={class:"legend d-flex justify-start align-center py-2"},td={class:"label"},od={class:"legend d-flex justify-start align-center py-2"},ad={class:"label"},id={class:"pa-1"},rd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},ld={class:"label"},nd={class:"label"},sd={class:"w-100 legend d-flex justify-start align-center py-2"},cd={class:"label"},md={class:"w-100 legend d-flex justify-start align-center py-2"},dd={class:"label"},hd={key:1,class:"my-3 w-100",style:{height:"80px"}},pd={class:"legend d-flex justify-start align-center"},gd={class:"label"},ud={class:"legend d-flex justify-start align-center"},fd={class:"label"},yd={class:"legend d-flex justify-start align-center"},bd={class:"label"},wd={class:"legend d-flex justify-start align-center"},xd={class:"label"},kd={class:"legend d-flex justify-start align-center"},_d={class:"label"},Ld={class:"legend d-flex justify-start align-center"},zd={class:"label"},Cd={class:"legend d-flex justify-start align-center"},vd={class:"label"},Sd={class:"legend d-flex justify-start align-center"},Nd={class:"label"},Pd={class:"legend d-flex justify-start align-center"},Vd={class:"label"},Md={class:"legend d-flex justify-start align-center"},Td={class:"label"},Ed={class:"d-flex justify-star align-center"},Dd={class:"font-weight-600 mr-1"},Rd={class:""},Bd={class:"port-box d-flex flex-column justify-center align-start ga-2"},Id={key:0,class:"d-flex justify-start align-center"},Ad={class:"text-label pr-1"},Fd={key:1,class:"d-flex justify-start align-center"},Gd={class:"text-label pr-1"},Wd={key:2,class:"d-flex justify-start align-center"},Zd={class:"text-label pr-1"},Od={key:3,class:"d-flex justify-start align-center"},jd={class:"text-label pr-1"},Hd={key:4,class:"d-flex justify-start align-center"},Xd={class:"text-label pr-1"},Yd={key:5,class:"d-flex justify-start align-center"},Ud={class:"text-label pr-1"},$d={class:"d-flex justify-start align-center"},Jd={class:"text-label pr-1"},Kd={key:6,class:"d-flex justify-start align-center"},qd={class:"text-label pr-1"},Qd={key:7,class:"d-flex justify-start align-center"},eh={class:"text-label pr-1"},th={class:"d-flex justify-start align-center"},oh={class:"text-label pr-1"};function ah(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip"),s=o.resolveComponent("VCardText"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard"),u=o.resolveComponent("v-card-title"),y=o.resolveComponent("v-divider");return o.openBlock(),o.createElementBlock("div",Lm,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:g})=>[o.createVNode(n,o.mergeProps(g,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!t.$attrs.hideTropicalsLegend?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"tropicalsInfo",id:"idm-tropical-gl4-info",class:o.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[o.createVNode(p,{class:o.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k,C,S,N;return[o.createElementVNode("div",zm,[o.createElementVNode("span",Cm,o.toDisplayString(a.locale==="en"?(g=i.activeTropicals)==null?void 0:g.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((f=i.activeTropicals)==null?void 0:f.Name)||"-"),1),(z=(w=i.activeTropicals)==null?void 0:w.history)!=null&&z.levelI18n?(o.openBlock(),o.createElementBlock("span",vm," , "+o.toDisplayString(t.$t("tropical."+((L=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:L.levelI18n))),1)):o.createCommentVNode("",!0)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:o.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:o.withCtx(()=>e[3]||(e[3]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),o.createElementVNode("div",Sm,[o.createElementVNode("span",Nm,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((k=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:k.updated)||((N=(S=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:S.filter(T=>!T.disabled)[0])==null?void 0:N.date),a.timeZone)),1)])]}),_:1}),o.createVNode(m),o.createVNode(s,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k;return[o.createElementVNode("div",Pm,[o.createElementVNode("div",Vm,[o.createElementVNode("label",Mm,o.toDisplayString(t.$t("weather.windSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((h=(g=i.activeTropicals)==null?void 0:g.history)==null?void 0:h.kts)||"-")+" kts",1),o.createElementVNode("span",null,", BF "+o.toDisplayString(l.computeBF(((w=(f=i.activeTropicals)==null?void 0:f.history)==null?void 0:w.kts)||"-")),1)]),o.createElementVNode("div",Tm,[o.createElementVNode("label",Em,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(z=i.activeTropicals)==null?void 0:z.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",Dm,[o.createElementVNode("div",Rm,[o.createElementVNode("label",Bm,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=l.computeMovement(i.activeTropicals))==null?void 0:L.kts)||"-")+" kts",1)]),o.createElementVNode("div",Im,[o.createElementVNode("label",Am,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),o.createElementVNode("div",Fm,[o.createElementVNode("label",Gm,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",Wm,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((k=i.activeTropicals)==null?void 0:k.forecasts,(C,S)=>(o.openBlock(),o.createBlock(n,{key:S,density:"compact",variant:C.disabled?"text":"flat",color:C.disabled?"":"primary","min-width":30,class:o.normalizeClass(["model text-none text-body-1 px-1",C.disabled?"btn-border-1 btn-bg-1":""]),onClick:o.withModifiers(N=>l.handleForecastToggle(C),["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),o.createVNode(m),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=o.withModifiers(g=>i.showLegend=!i.showLegend,["stop"]))},{prepend:o.withCtx(()=>e[4]||(e[4]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("weather.legend")),1)]),_:1},8,["color"]),o.createElementVNode("div",Zm,[o.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=o.withModifiers(g=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(o.openBlock(),o.createElementBlock("div",Om,[o.createElementVNode("div",jm,[o.createElementVNode("div",Hm,[e[5]||(e[5]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Xm,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",Ym,[e[6]||(e[6]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Um,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",$m,[e[7]||(e[7]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",Jm,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",Km,[o.createElementVNode("div",qm,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",Qm,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",ed,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",td,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",od,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",ad,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",id,[o.createElementVNode("div",rd,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",ld,o.toDisplayString(t.$t("tropical.history")),1),e[12]||(e[12]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",nd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",sd,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",cd,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",md,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",dd,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",hd,[o.withDirectives(o.createVNode(p,{elevation:"16"},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",pd,[e[15]||(e[15]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",gd,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",ud,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",fd,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",yd,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",bd,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",wd,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",xd,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",kd,[e[19]||(e[19]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",_d,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",Ld,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",zd,o.toDisplayString(t.$t("tropical.superTy")),1)]),o.createElementVNode("div",Cd,[e[21]||(e[21]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",vd,o.toDisplayString(t.$t("tropical.history")),1)]),o.createElementVNode("div",Sd,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",Nd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Pd,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Vd,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",Md,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Td,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])],2),[[o.vShow,i.showLegend]])]),_:1})]),_:1},512),[[o.vShow,i.showLegend]])]))],2)):o.createCommentVNode("",!0),o.withDirectives(o.createVNode(p,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"280"},{default:o.withCtx(()=>[o.createVNode(u,null,{default:o.withCtx(()=>{var g,h,f,w;return[o.createElementVNode("div",Ed,[o.createElementVNode("span",Dd,o.toDisplayString(a.locale==="en"?(g=i.hoverPoint)==null?void 0:g.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((f=i.hoverPoint)==null?void 0:f.Name)),1),o.createElementVNode("span",Rd," ["+o.toDisplayString(t.$t("tropical."+((w=i.hoverPoint)==null?void 0:w.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(y),o.createVNode(s,{class:"text-body-1"},{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k,C,S,N,T,B,D,Z,X,$,ae,P;return[o.createElementVNode("div",Bd,[((g=i.hoverPoint)==null?void 0:g.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Id,[o.createElementVNode("label",Ad,o.toDisplayString(t.$t("tropical.updated"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((h=i.hoverPoint)==null?void 0:h.update,a.timeZone)),1)])):o.createCommentVNode("",!0),((f=i.hoverPoint)==null?void 0:f.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Fd,[o.createElementVNode("label",Gd,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((w=i.hoverPoint)==null?void 0:w.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(o.openBlock(),o.createElementBlock("div",Wd,[o.createElementVNode("label",Zd,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((L=i.hoverPoint)==null?void 0:L.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Od,[o.createElementVNode("label",jd,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):o.createCommentVNode("",!0),((k=i.hoverPoint)==null?void 0:k.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Hd,[o.createElementVNode("label",Xd,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((S=JSON.parse((C=i.hoverPoint)==null?void 0:C.wind))==null?void 0:S.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((N=i.hoverPoint)==null?void 0:N.type)==="history"?(o.openBlock(),o.createElementBlock("div",Yd,[o.createElementVNode("label",Ud,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",$d,[o.createElementVNode("label",Jd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((B=i.hoverPoint)==null?void 0:B.pressure)??"-")+" hPa",1)]),((D=i.hoverPoint)==null?void 0:D.type)==="history"?(o.openBlock(),o.createElementBlock("div",Kd,[o.createElementVNode("label",qd,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((X=JSON.parse((Z=i.hoverPoint)==null?void 0:Z.movement))==null?void 0:X.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),(($=i.hoverPoint)==null?void 0:$.type)==="history"?(o.openBlock(),o.createElementBlock("div",Qd,[o.createElementVNode("label",eh,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((P=JSON.parse((ae=i.hoverPoint)==null?void 0:ae.movement))==null?void 0:P.deg)??"-")+" °",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",th,[o.createElementVNode("label",oh,o.toDisplayString(t.$t("tropical.position"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[o.vShow,i.showHoverPoint]])])}const Ho=Y(_m,[["render",ah]]),Ry="",ih={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const t=this.width||220;if(this.position==="top")return{bottom:"40px",left:`-${(420-t)/2}px`};if(this.position==="bottom")return{top:"40px",left:`-${(420-t)/2}px`};if(this.position==="left")return{bottom:"-140px",left:"-428px"};if(this.position==="right")return{bottom:"-140px",right:"-428px"}},hourOptions(){const t=[];for(let e=0;e<24;e++)t.push(e<10?`0${e}:00`:`${e}:00`);return t.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(t,e){t!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(t,e){t&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(t,e){t!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(t){var i;const e=v(t).utc().date(),a=Math.ceil(v(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(t))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(!this.dayAbout.h||!this.dayAbout.f)return;const t=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:t,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:t+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:t+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(t){const e=t||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const t=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const t=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=t.clone().format("YYYY-MM-DD"),this.currentTime=t.clone().format("HH:00")},handleClickOutside(t){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(t.target)&&(this.showDatePicker=!1)}}},rh={class:"idm-gl4-time-picker",ref:"idmGl4Timepicker"},lh={class:"pa-0",style:{width:"320px"}},nh={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},sh={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function ch(t,e,a,r,i,l){const n=o.resolveComponent("VDatePicker"),c=o.resolveComponent("VDivider"),s=o.resolveComponent("VListItemTitle"),m=o.resolveComponent("VListItem"),d=o.resolveComponent("VList"),p=o.resolveComponent("VCardText"),u=o.resolveComponent("VBtn"),y=o.resolveComponent("VCardActions"),g=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",rh,[o.createElementVNode("div",{style:o.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:o.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},o.toDisplayString(i.currentDateTime)+" | UTC "+o.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(o.openBlock(),o.createBlock(g,{key:0,class:"card-box d-flex flex-column border elevation-12",style:o.normalizeStyle(l.getStyle)},{default:o.withCtx(()=>[o.createVNode(p,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",lh,[o.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),o.createVNode(c,{class:"h-100",vertical:""}),o.createElementVNode("div",nh,[o.createElementVNode("div",sh,o.toDisplayString(t.$t("time.time")),1),o.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.hourOptions,(h,f)=>(o.openBlock(),o.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:o.withCtx(()=>[o.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),o.createVNode(c),o.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:o.withCtx(()=>[o.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):o.createCommentVNode("",!0)],512)}const qe=Y(ih,[["render",ch]]),By="",mh={name:"IdmPoint",components:{DateTimePicker:qe},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,3}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=180||"0 ~ 180"],lngMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"],latDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,2}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=90||"0 ~ 90"],latMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>v.tz(v(t),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return t=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(+(((i=this.positionOffset)==null?void 0:i.slice(1))==="+")?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return t?v.tz(v(t),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(t){return!t||t.lng===null||t.lng===void 0||isNaN(t.lng)||t.lat===null||t.lat===void 0||isNaN(t.lat)?"-":M.LngLatHelper.lat2pretty(t==null?void 0:t.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(t==null?void 0:t.lng,2).pretty}},computeRoundPrecision(){return function(t,e=4){return t==null||isNaN(t)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(t,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.toggle=!1,this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?this.$nextTick(()=>{var t;(t=this.$refs.spotForm)==null||t.resetValidation()}):this.handleCloseForm()}},showMeteo:{handler(){var t,e,a,r,i,l;this.showMeteo?((a=(e=(t=this.$parent)==null?void 0:t.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(t,e){!t&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async t=>{t!=null&&t.valid&&this.fetchData()})},cancelForm(){var t;(t=this.$refs.spotForm)==null||t.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;if(isNaN(this.form.latDegree)||isNaN(this.form.latMinute)||isNaN(this.form.lngDegree)||isNaN(this.form.lngMinute))return!1;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const t=v();((a=v(this.realTime))==null?void 0:a.diff(t,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Ae.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:v(t.dateTime).utc().format(),forecastDays:t.day??3,weatherModels:e,marineModels:a};await le.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Ae.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:v(t.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await le.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(t){var a,r,i,l,n,c,s,m,d,p,u,y,g,h,f,w,z,b,L,x,k,C,S,N,T,B,D,Z,X,$,ae,P,G,W,U,A,I,j,V,q,re;this.currentHourData={},this.positionGmt=(r=(a=t==null?void 0:t.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=t==null?void 0:t.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Ae.Meteo2Assist.pickHourly(t,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=t.lat,this.currentHourData.lng=t.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((p=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:p.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((g=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:g.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((z=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:z.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((L=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:L.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(x=e==null?void 0:e.wave)==null?void 0:x.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(S=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:S.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(N=e==null?void 0:e.wave)==null?void 0:N.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((D=(B=e==null?void 0:e.wave)==null?void 0:B.wd)==null?void 0:D.height,1)??"-",this.currentHourData.windwaveDir=(X=(Z=e==null?void 0:e.wave)==null?void 0:Z.wd)==null?void 0:X.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((ae=($=e==null?void 0:e.wave)==null?void 0:$.wd)==null?void 0:ae.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((G=(P=e==null?void 0:e.wave)==null?void 0:P.swell)==null?void 0:G.height,1)??"-",this.currentHourData.swellDir=(U=(W=e==null?void 0:e.wave)==null?void 0:W.swell)==null?void 0:U.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((I=(A=e==null?void 0:e.wave)==null?void 0:A.swell)==null?void 0:I.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((j=e==null?void 0:e.current)==null?void 0:j.speed,1)??"-",this.currentHourData.currentDir=(V=e==null?void 0:e.current)==null?void 0:V.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((q=e==null?void 0:e.current)==null?void 0:q.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(re=e==null?void 0:e.weather)==null?void 0:re.url},handleBind(){var t,e;this.toggle?((t=this.map)==null||t.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(t){if(t.originalEvent.stopPropagation(),t.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(t.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(t){if(isNaN(t.lat)||isNaN(t.lng))return!1;this.form.latDegree=Number(M.LngLatHelper.lat2pretty(t.lat).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(t.lat).minute),this.form.latDirection=M.LngLatHelper.lat2pretty(t.lat).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(t.lng).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(t.lng).minute),this.form.lngDirection=M.LngLatHelper.lng2pretty(t.lng).direction},handleDrawInfoMarker(t){this.drawPositionMarker(t),this.simple||this.drawMeteoInfoMarker(t)},drawPositionMarker(t){t&&(this.map.flyTo({center:t,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new ne.Marker(e).setLngLat(t).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(t){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(t):this.meteoInfoMarker=new ne.Marker(e).setLngLat(t).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var t,e;(t=this.positionMarker)==null||t.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const t=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",t)}}},dh={class:"idm-gl4-spot"},hh={class:"d-flex justify-start align-center"},ph={class:"text-h6 font-weight-600"},gh={class:"d-flex justify-start align-center ga-1 mb-2"},uh={class:"text-label"},fh={class:"d-flex justify-start align-center ga-1 mb-2"},yh={class:"text-label"},bh={class:"d-flex justify-start align-center ga-1 mb-2"},wh={class:"text-label"},xh={class:"d-flex justify-start align-center ga-1 mb-2"},kh={class:"text-label"},_h={class:"d-flex justify-start align-center"},Lh={class:"mx-2"},zh={class:"mx-0 py-2 d-flex align-center justify-start"},Ch={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},vh={class:"pa-0 px-0"},Sh={class:"mx-0 py-2 d-flex align-center justify-start"},Nh={cols:"9",class:"pa-0 px-0"},Ph={class:"mx-0 py-2 d-flex align-center justify-start"},Vh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Mh={style:{width:"150px"},class:"pa-0 text-left"},Th={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Eh={cols:"3",class:"pa-0 px-0 text-left"},Dh={class:"mx-0 py-2 d-flex align-center justify-start"},Rh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Bh={style:{width:"150px"},class:"pa-0 text-left"},Ih={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Ah={cols:"3",class:"pa-0 text-left"},Fh={class:"mx-0 py-2 d-flex align-center justify-start"},Gh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Wh={style:{width:"150px"},class:"pa-0 text-left"},Zh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Oh={class:"pa-0 text-left"},jh={class:"d-flex justify-space-between align-center"},Hh={class:"d-flex justify-start align-center"},Xh={class:"mx-1"},Yh={class:"d-flex justify-end align-center"},Uh={class:"mx-0 py-1 d-flex align-center justify-start"},$h={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},Jh={class:"pa-0 px-0"},Kh={class:"mx-0 py-1 d-flex align-center justify-start"},qh={class:"pa-0 px-0"},Qh={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},ep={class:"d-flex flex-column align-start justify-center ga-3"},tp={class:"text-label pr-2"},op={class:"text-label pr-2"},ap={class:"text-label pr-2"},ip={class:"d-flex flex-column align-start justify-center ga-3"},rp={class:"text-label pr-2"},lp={class:"text-label pr-2"},np={class:"text-label pr-2"},sp={id:"idm-position-icon"},cp={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},mp=["xlink:href"];function dp(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip"),s=o.resolveComponent("VCardTitle"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VTextField"),p=o.resolveComponent("VCol"),u=o.resolveComponent("VRow"),y=o.resolveComponent("DateTimePicker"),g=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),f=o.resolveComponent("VCardActions"),w=o.resolveComponent("VForm"),z=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",dh,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:b})=>[o.createVNode(n,o.mergeProps(b,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[8]||(e[8]=[o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(o.openBlock(),o.createBlock(z,{key:0,class:"spot-form-card",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",hh,[o.createElementVNode("div",ph,o.toDisplayString(t.$t("spot.spotWeather")),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.submitForm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(h,{class:"text-body-1 pa-4"},{default:o.withCtx(()=>[o.createElementVNode("div",gh,[o.createElementVNode("div",uh,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=b=>i.form.latDegree=b),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[11]}),o.createVNode(p,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=b=>i.form.latMinute=b),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[12]}),o.createVNode(p,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=b=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDirection),1)]),_:1})]),_:1})]),_:1}),o.createElementVNode("div",fh,[o.createElementVNode("div",yh,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=b=>i.form.lngDegree=b),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[14]}),o.createVNode(p,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=b=>i.form.lngMinute=b),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[15]}),o.createVNode(p,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=b=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDirection),1)]),_:1})]),_:1})]),_:1}),o.createElementVNode("div",bh,[o.createElementVNode("div",wh,[o.createTextVNode(o.toDisplayString(t.$t("spot.dateTime")),1),e[16]||(e[16]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0 mb-4"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(y,o.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},t.$attrs,{onDateTime:e[6]||(e[6]=b=>i.form.dateTime=b)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),o.createElementVNode("div",xh,[o.createElementVNode("div",kh,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0 mb-2"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(g,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=b=>i.form.forecastModel=b),class:"w-100",rounded:"",height:"30",density:"compact",group:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"GFS",class:o.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:o.withCtx(()=>e[18]||(e[18]=[o.createTextVNode("NOAA",-1)])),_:1,__:[18]},8,["class","color"]),o.createVNode(n,{density:"compact",height:"30",class:o.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:o.withCtx(()=>e[19]||(e[19]=[o.createTextVNode("ECMWF",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.createVNode(m),o.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):o.createCommentVNode("",!0),i.showMeteo&&!a.simple?(o.openBlock(),o.createBlock(z,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",_h,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Lh,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:o.withCtx(()=>{var b,L;return[o.createElementVNode("div",zh,[o.createElementVNode("div",Ch,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",vh,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Sh,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Nh,o.toDisplayString(l.computedLocalTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),o.createElementVNode("div",Ph,[o.createElementVNode("div",Vh,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",Mh,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",Th,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",Eh,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",Dh,[o.createElementVNode("div",Rh,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",Bh,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1),o.createElementVNode("div",Ih,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",Ah,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",Fh,[o.createElementVNode("div",Gh,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",Wh,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",Zh,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",Oh,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)])]}),_:1}),o.createVNode(m),o.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(L=>{var x,k;return(L==null?void 0:L.id)===i.form.followId||((x=L==null?void 0:L.coordinate)==null?void 0:x.lng)===i.form.lng&&((k=L==null?void 0:L.coordinate)==null?void 0:k.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1",id:"idm-gl4-spot-meteo-follow",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{prepend:o.withCtx(()=>e[23]||(e[23]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleFollow,["stop"])},{prepend:o.withCtx(()=>e[24]||(e[24]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),o.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:o.withModifiers(l.handleMeteoMore,["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):o.createCommentVNode("",!0),i.showMeteo&&a.simple?(o.openBlock(),o.createBlock(z,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>{var b;return[o.createElementVNode("div",jh,[o.createElementVNode("div",Hh,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Xh,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",Yh,[(b=a.followList)!=null&&b.some(L=>{var x,k;return(L==null?void 0:L.id)===i.form.followId||((x=L==null?void 0:L.coordinate)==null?void 0:x.lng)===i.form.lng&&((k=L==null?void 0:L.coordinate)==null?void 0:k.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{default:o.withCtx(()=>e[26]||(e[26]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleFollow,["stop"])},{default:o.withCtx(()=>e[27]||(e[27]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[28]||(e[28]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=o.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:o.withCtx(()=>{var b,L;return[o.createElementVNode("div",Uh,[o.createElementVNode("div",$h,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",Jh,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Kh,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",qh,o.toDisplayString(l.computedLocalTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),o.createElementVNode("div",Qh,[o.createElementVNode("div",ep,[o.createElementVNode("div",null,[o.createElementVNode("span",tp,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1)]),o.createElementVNode("div",null,[o.createElementVNode("span",op,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",ap,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)])]),o.createElementVNode("div",ip,[o.createElementVNode("div",null,[o.createElementVNode("span",rp,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",lp,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",np,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)])])])]}),_:1})]),_:1},512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",sp,[(o.openBlock(),o.createElementBlock("svg",cp,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,mp)]))],512),[[o.vShow,i.showMeteo]])])}const hp=Y(mh,[["render",dp]]),Iy="",pp={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:we.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var t,e,a;if(this.toggle)this.handleBind();else{(t=this.map)==null||t.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var t,e,a,r,i;(t=this.map)==null||t.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var t,e,a,r,i;(t=this.map)==null||t.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(t){if(t.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(t){var a,r,i,l,n,c,s,m,d,p;const e=(r=(a=t.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=t.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let g;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){g=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[g-1],{lng:(m=(s=t.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(p=(d=t.target)==null?void 0:d._lngLat)==null?void 0:p.lat,properties:h[g].properties},g===h.length-1?void 0:h[g+1])}},handleDragEnd(t){var a,r,i,l,n,c,s,m,d,p;const e=(r=(a=t.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=t.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const g=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];g.geometry.coordinates=[(m=(s=t.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(p=(d=t.target)==null?void 0:d._lngLat)==null?void 0:p.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(t){var a,r,i,l;t.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=t.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${$t("actions.detele")}</span>`,this.contextmenu=new ne.Marker(m).setOffset([24,0]).setLngLat([t.lngLat.lng,t.lngLat.lat]).addTo(this.map)}}},handleClick(t){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=t.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=t.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=t.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=E.feature({type:"Point",coordinates:[t.lngLat.lng,t.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(t){const e=t.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=M.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),p=M.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=M.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=M.LngLatHelper.convertToMonotonicLng([s,m]):u=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(s,m,200));const y=E.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=p,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const g=e[i];g.properties.totalDist=M.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),g.properties.sumLabel=g.properties.totalDist+" nm"}e.push(...r),t.total=a}return this.handleRender(t),t},handleTmpPointUpdate(t,e,a,r){const i=E.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let p;s.mode==="RL"?p=M.LngLatHelper.convertToMonotonicLng([m,d]):p=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(p.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let p;s.mode==="RL"?p=M.LngLatHelper.convertToMonotonicLng([m,d]):p=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(p.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist} nm","text-rotation-alignment":"map","text-size":10,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=M.LngLatHelper.roundPrecision((t.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new ne.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(t){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(t){var e;if((e=t==null?void 0:t.features)!=null&&e.length){const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(t):this.map.addSource(a,{type:"geojson",data:t}),this.handleClear(t,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist} nm","text-rotation-alignment":"map","text-size":10,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=t.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${t.id}-${c.properties.id}`,s.className=`${t.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new ne.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[t.id]?this.pointMarkers[t.id].push(m):this.pointMarkers[t.id]=[m]}if(t.closed){const c=n.at(-1),m=t.features.filter(p=>p.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${t.id}" class="marker-close">X</div>`,this.closeMarkers[t.id]=new ne.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(t,e=!0){var n,c,s,m,d,p,u,y,g,h;const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(p=this.closeMarkers[t.id])==null||p.remove(),this.closeMarkers[t.id]=void 0,(u=this.pointMarkers[t.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[t.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((g=this.map)!=null&&g.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},gp={class:"idm-gl4-measure"};function up(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:s})=>[o.createVNode(n,o.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[0]||(e[0]=[o.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const fp=Y(pp,[["render",up]]),Ay="",yp={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},setup(){return{Theme:we.useTheme()}},emits:["close","save","hideLayer"],data(){var t;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(t=this.Theme.current.value.colors)==null?void 0:t["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var t;this.map&&(this.handleBindMap(),(t=this.editLayer)!=null&&t.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var t,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((t=this.editLayer)!=null&&t.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const t=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!t)return;this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.Theme.current.value.colors)==null?void 0:l["map-green"])||"#4CAF50";const a=(t.features||(t.type==="Feature"?[t]:[]))[0];if(!a)return;const r=(n=a.geometry)==null?void 0:n.type;if(this.originalProperties=a.properties||{},r==="Point"){this.markerType="Point";const[m,d]=a.geometry.coordinates;this.drawCoords=[[m,d]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(d).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(d).minute),this.form.latDir=M.LngLatHelper.lat2pretty(d).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(m).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(m).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(m).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(s=(c=this.originalProperties)==null?void 0:c.shape)==null?void 0:s.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(t),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){this.pointMarker&&(this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag))},handlePointDrag(){const{lng:t,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[t,e]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(e).minute),this.form.latDir=M.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(t).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(t).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(t).direction},clearEditMarkers(){this.editMarkers.forEach(t=>t.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(t){this.drawCoords=t.geometry.coordinates.map(r=>[...r]);const e=E.featureCollection([t,...this.drawCoords.map(r=>E.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new ne.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=E.point([a,r]),l=E.lineString(this.drawCoords),n=E.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",t),this._edgeContextMenuHandler=t},showDeleteButton(t,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(t);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(t){this.handleSetDrawSource(t);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(t){this.clearEditMarkers();const e=t.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new ne.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit(t)})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=E.point([i,l]),c=E.lineString([...this.drawCoords,this.drawCoords[0]]),s=E.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit(t)},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(a).minute),this.form.latDir=M.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:t,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(t),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),p=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[p,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(t,e){var i;if((i=this.pointMarker)==null||i.remove(),!t||!t.length)return;const[a,r]=t[0];this.pointMarker=new ne.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(t){t.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(t){if(!t||t.length<1)return;const e=[],a=2;t==null||t.forEach((i,l)=>{var n,c;if(e.push(E.point(i)),l>=1){const s=[(n=t==null?void 0:t[l-1])==null?void 0:n[0],(c=t==null?void 0:t[l-1])==null?void 0:c[1]],m=[i[0],i[1]],d=M.GeoJsonHelper.drawLine(s,m);e.push(d)}});const r=E.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(t,e){const a=M.GeoJsonHelper.drawLine(t,e),r=E.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:t[0],lat:t[1]},l={lng:e[0],lat:e[1]},n=M.LaneHelper.calculateDistance(i,l,!0,2),c=M.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const p={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=M.LaneHelper.calculateDistance(p,u,!0,4)}s=M.LngLatHelper.roundPrecision(s+n,1);const m=`
217
+ </svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${V.geometry.coordinates[1]>=0?"center north":"center south"}">${re}</div>`;const ge=new ne.Marker(he).setLngLat(V.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ge)}this.$emit("tropicalCenterPoints",j)}else(P=this.map)!=null&&P.getSource(this.interpolateSource)&&((G=this.map)==null||G.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,c,s,m,d,p,u,y,g;const e=t.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((p=e==null?void 0:e.properties)==null?void 0:p.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(g=(y=a[0])==null?void 0:y.properties)==null?void 0:g.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([t.lngLat.lng,t.lngLat.lat])},drawTropicalsInfoMaker(t){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(t).setOffset([220,0]):this.activeTropicalsMarker=new ne.Marker(e).setLngLat(t).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var t;(t=this.activeTropicalsMarker)==null||t.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(t){var r,i,l,n,c,s;t.disabled=!t.disabled;const e=`${t.name}-${t.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=t.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=t.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(E.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(E.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(t){this.$emit("tropicalProbability",t)},handleToggleCircles(t){var e,a;t.showCircle=!t.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===t.name&&(r.properties.showCircle=t.showCircle)}),this.handleRender()},handleComputePolygons(t){const e=[];for(const a of t){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(t,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=E.lineArc(t,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=E.lineArc(t,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=E.lineArc(t,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=E.lineArc(t,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=E.lineString(r);return E.lineToPolygon(i,{properties:a})},handleNotification(t){this.$emit("tropicalNotification",t)},handleHover(t){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(t.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new ne.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var t;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(t=this.hoverMarker)==null||t.remove(),this.hoverMarker=void 0}}},Lm={class:"idm-tropical-gl4"},zm={class:"pb-1"},Cm={class:"text-h5 font-weight-600"},vm={key:0,class:"text-h5 font-weight-600"},Sm={class:"text-body-1"},Nm={class:"text-label"},Pm={class:"d-flex justify-space-between align-center"},Vm={class:"w-60"},Mm={class:"text-label pr-1"},Tm={class:"flex-1-1-0"},Em={class:"text-label pr-1"},Dm={class:"py-2 d-flex justify-space-between align-center"},Rm={class:"w-60"},Bm={class:"text-label pr-1"},Im={class:"flex-1-1-0"},Am={class:"text-label pr-1"},Fm={class:"d-flex align-center flex-1-1-100 justify-space-between mt-n1"},Gm={class:"text-label pr-1",style:{width:"70px"}},Wm={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Zm={class:"more"},Om={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},jm={class:"pa-1"},Hm={class:"legend d-flex justify-start align-center py-2"},Xm={class:"label"},Ym={class:"legend d-flex justify-start align-center py-2"},Um={class:"label"},$m={class:"legend d-flex justify-start align-center py-2"},Jm={class:"label"},Km={class:"pa-1"},qm={class:"legend d-flex justify-start align-center py-2"},Qm={class:"label"},ed={class:"legend d-flex justify-start align-center py-2"},td={class:"label"},od={class:"legend d-flex justify-start align-center py-2"},ad={class:"label"},id={class:"pa-1"},rd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},ld={class:"label"},nd={class:"label"},sd={class:"w-100 legend d-flex justify-start align-center py-2"},cd={class:"label"},md={class:"w-100 legend d-flex justify-start align-center py-2"},dd={class:"label"},hd={key:1,class:"my-3 w-100",style:{height:"80px"}},pd={class:"legend d-flex justify-start align-center"},gd={class:"label"},ud={class:"legend d-flex justify-start align-center"},fd={class:"label"},yd={class:"legend d-flex justify-start align-center"},bd={class:"label"},wd={class:"legend d-flex justify-start align-center"},xd={class:"label"},kd={class:"legend d-flex justify-start align-center"},_d={class:"label"},Ld={class:"legend d-flex justify-start align-center"},zd={class:"label"},Cd={class:"legend d-flex justify-start align-center"},vd={class:"label"},Sd={class:"legend d-flex justify-start align-center"},Nd={class:"label"},Pd={class:"legend d-flex justify-start align-center"},Vd={class:"label"},Md={class:"legend d-flex justify-start align-center"},Td={class:"label"},Ed={class:"d-flex justify-star align-center"},Dd={class:"font-weight-600 mr-1"},Rd={class:""},Bd={class:"port-box d-flex flex-column justify-center align-start ga-2"},Id={key:0,class:"d-flex justify-start align-center"},Ad={class:"text-label pr-1"},Fd={key:1,class:"d-flex justify-start align-center"},Gd={class:"text-label pr-1"},Wd={key:2,class:"d-flex justify-start align-center"},Zd={class:"text-label pr-1"},Od={key:3,class:"d-flex justify-start align-center"},jd={class:"text-label pr-1"},Hd={key:4,class:"d-flex justify-start align-center"},Xd={class:"text-label pr-1"},Yd={key:5,class:"d-flex justify-start align-center"},Ud={class:"text-label pr-1"},$d={class:"d-flex justify-start align-center"},Jd={class:"text-label pr-1"},Kd={key:6,class:"d-flex justify-start align-center"},qd={class:"text-label pr-1"},Qd={key:7,class:"d-flex justify-start align-center"},eh={class:"text-label pr-1"},th={class:"d-flex justify-start align-center"},oh={class:"text-label pr-1"};function ah(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip"),s=o.resolveComponent("VCardText"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard"),u=o.resolveComponent("v-card-title"),y=o.resolveComponent("v-divider");return o.openBlock(),o.createElementBlock("div",Lm,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:g})=>[o.createVNode(n,o.mergeProps(g,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!t.$attrs.hideTropicalsLegend?(o.openBlock(),o.createElementBlock("div",{key:0,ref:"tropicalsInfo",id:"idm-tropical-gl4-info",class:o.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[o.createVNode(p,{class:o.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k,C,S,N;return[o.createElementVNode("div",zm,[o.createElementVNode("span",Cm,o.toDisplayString(a.locale==="en"?(g=i.activeTropicals)==null?void 0:g.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((f=i.activeTropicals)==null?void 0:f.Name)||"-"),1),(z=(w=i.activeTropicals)==null?void 0:w.history)!=null&&z.levelI18n?(o.openBlock(),o.createElementBlock("span",vm," , "+o.toDisplayString(t.$t("tropical."+((L=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:L.levelI18n))),1)):o.createCommentVNode("",!0)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:o.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:o.withCtx(()=>e[3]||(e[3]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),o.createElementVNode("div",Sm,[o.createElementVNode("span",Nm,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((k=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:k.updated)||((N=(S=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:S.filter(T=>!T.disabled)[0])==null?void 0:N.date),a.timeZone)),1)])]}),_:1}),o.createVNode(m),o.createVNode(s,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k;return[o.createElementVNode("div",Pm,[o.createElementVNode("div",Vm,[o.createElementVNode("label",Mm,o.toDisplayString(t.$t("weather.windSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((h=(g=i.activeTropicals)==null?void 0:g.history)==null?void 0:h.kts)||"-")+" kts",1),o.createElementVNode("span",null,", BF "+o.toDisplayString(l.computeBF(((w=(f=i.activeTropicals)==null?void 0:f.history)==null?void 0:w.kts)||"-")),1)]),o.createElementVNode("div",Tm,[o.createElementVNode("label",Em,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(z=i.activeTropicals)==null?void 0:z.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",Dm,[o.createElementVNode("div",Rm,[o.createElementVNode("label",Bm,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=l.computeMovement(i.activeTropicals))==null?void 0:L.kts)||"-")+" kts",1)]),o.createElementVNode("div",Im,[o.createElementVNode("label",Am,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),o.createElementVNode("div",Fm,[o.createElementVNode("label",Gm,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",Wm,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((k=i.activeTropicals)==null?void 0:k.forecasts,(C,S)=>(o.openBlock(),o.createBlock(n,{key:S,density:"compact",variant:C.disabled?"text":"flat",color:C.disabled?"":"primary","min-width":30,class:o.normalizeClass(["model text-none text-body-1 px-1",C.disabled?"btn-border-1 btn-bg-1":""]),onClick:o.withModifiers(N=>l.handleForecastToggle(C),["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),o.createVNode(m),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=o.withModifiers(g=>i.showLegend=!i.showLegend,["stop"]))},{prepend:o.withCtx(()=>e[4]||(e[4]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("weather.legend")),1)]),_:1},8,["color"]),o.createElementVNode("div",Zm,[o.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=o.withModifiers(g=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(o.openBlock(),o.createElementBlock("div",Om,[o.createElementVNode("div",jm,[o.createElementVNode("div",Hm,[e[5]||(e[5]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Xm,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",Ym,[e[6]||(e[6]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Um,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",$m,[e[7]||(e[7]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",Jm,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",Km,[o.createElementVNode("div",qm,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",Qm,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",ed,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",td,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",od,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",ad,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",id,[o.createElementVNode("div",rd,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",ld,o.toDisplayString(t.$t("tropical.history")),1),e[12]||(e[12]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",nd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",sd,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",cd,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",md,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",dd,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",hd,[o.withDirectives(o.createVNode(p,{elevation:"16"},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",pd,[e[15]||(e[15]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",gd,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",ud,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",fd,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",yd,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",bd,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",wd,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",xd,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",kd,[e[19]||(e[19]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",_d,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",Ld,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",zd,o.toDisplayString(t.$t("tropical.superTy")),1)]),o.createElementVNode("div",Cd,[e[21]||(e[21]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",vd,o.toDisplayString(t.$t("tropical.history")),1)]),o.createElementVNode("div",Sd,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",Nd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Pd,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Vd,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",Md,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Td,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])],2),[[o.vShow,i.showLegend]])]),_:1})]),_:1},512),[[o.vShow,i.showLegend]])]))],2)):o.createCommentVNode("",!0),o.withDirectives(o.createVNode(p,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"280"},{default:o.withCtx(()=>[o.createVNode(u,null,{default:o.withCtx(()=>{var g,h,f,w;return[o.createElementVNode("div",Ed,[o.createElementVNode("span",Dd,o.toDisplayString(a.locale==="en"?(g=i.hoverPoint)==null?void 0:g.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((f=i.hoverPoint)==null?void 0:f.Name)),1),o.createElementVNode("span",Rd," ["+o.toDisplayString(t.$t("tropical."+((w=i.hoverPoint)==null?void 0:w.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(y),o.createVNode(s,{class:"text-body-1"},{default:o.withCtx(()=>{var g,h,f,w,z,b,L,x,k,C,S,N,T,B,D,Z,X,$,ae,P;return[o.createElementVNode("div",Bd,[((g=i.hoverPoint)==null?void 0:g.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Id,[o.createElementVNode("label",Ad,o.toDisplayString(t.$t("tropical.updated"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((h=i.hoverPoint)==null?void 0:h.update,a.timeZone)),1)])):o.createCommentVNode("",!0),((f=i.hoverPoint)==null?void 0:f.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Fd,[o.createElementVNode("label",Gd,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((w=i.hoverPoint)==null?void 0:w.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(o.openBlock(),o.createElementBlock("div",Wd,[o.createElementVNode("label",Zd,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((L=i.hoverPoint)==null?void 0:L.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Od,[o.createElementVNode("label",jd,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):o.createCommentVNode("",!0),((k=i.hoverPoint)==null?void 0:k.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Hd,[o.createElementVNode("label",Xd,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((S=JSON.parse((C=i.hoverPoint)==null?void 0:C.wind))==null?void 0:S.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((N=i.hoverPoint)==null?void 0:N.type)==="history"?(o.openBlock(),o.createElementBlock("div",Yd,[o.createElementVNode("label",Ud,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",$d,[o.createElementVNode("label",Jd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((B=i.hoverPoint)==null?void 0:B.pressure)??"-")+" hPa",1)]),((D=i.hoverPoint)==null?void 0:D.type)==="history"?(o.openBlock(),o.createElementBlock("div",Kd,[o.createElementVNode("label",qd,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((X=JSON.parse((Z=i.hoverPoint)==null?void 0:Z.movement))==null?void 0:X.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),(($=i.hoverPoint)==null?void 0:$.type)==="history"?(o.openBlock(),o.createElementBlock("div",Qd,[o.createElementVNode("label",eh,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((P=JSON.parse((ae=i.hoverPoint)==null?void 0:ae.movement))==null?void 0:P.deg)??"-")+" °",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",th,[o.createElementVNode("label",oh,o.toDisplayString(t.$t("tropical.position"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[o.vShow,i.showHoverPoint]])])}const Ho=Y(_m,[["render",ah]]),Ry="",ih={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const t=this.width||220;if(this.position==="top")return{bottom:"40px",left:`-${(420-t)/2}px`};if(this.position==="bottom")return{top:"40px",left:`-${(420-t)/2}px`};if(this.position==="left")return{bottom:"-140px",left:"-428px"};if(this.position==="right")return{bottom:"-140px",right:"-428px"}},hourOptions(){const t=[];for(let e=0;e<24;e++)t.push(e<10?`0${e}:00`:`${e}:00`);return t.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(t,e){t!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(t,e){t&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(t,e){t!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(t){var i;const e=v(t).utc().date(),a=Math.ceil(v(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(t))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(!this.dayAbout.h||!this.dayAbout.f)return;const t=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:t,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:t+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:t+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(t){const e=t||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const t=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const t=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=t.clone().format("YYYY-MM-DD"),this.currentTime=t.clone().format("HH:00")},handleClickOutside(t){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(t.target)&&(this.showDatePicker=!1)}}},rh={class:"idm-gl4-time-picker",ref:"idmGl4Timepicker"},lh={class:"pa-0",style:{width:"320px"}},nh={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},sh={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function ch(t,e,a,r,i,l){const n=o.resolveComponent("VDatePicker"),c=o.resolveComponent("VDivider"),s=o.resolveComponent("VListItemTitle"),m=o.resolveComponent("VListItem"),d=o.resolveComponent("VList"),p=o.resolveComponent("VCardText"),u=o.resolveComponent("VBtn"),y=o.resolveComponent("VCardActions"),g=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",rh,[o.createElementVNode("div",{style:o.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:o.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},o.toDisplayString(i.currentDateTime)+" | UTC "+o.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(o.openBlock(),o.createBlock(g,{key:0,class:"card-box d-flex flex-column border elevation-12",style:o.normalizeStyle(l.getStyle)},{default:o.withCtx(()=>[o.createVNode(p,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",lh,[o.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),o.createVNode(c,{class:"h-100",vertical:""}),o.createElementVNode("div",nh,[o.createElementVNode("div",sh,o.toDisplayString(t.$t("time.time")),1),o.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.hourOptions,(h,f)=>(o.openBlock(),o.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:o.withCtx(()=>[o.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),o.createVNode(c),o.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:o.withCtx(()=>[o.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):o.createCommentVNode("",!0)],512)}const qe=Y(ih,[["render",ch]]),By="",mh={name:"IdmPoint",components:{DateTimePicker:qe},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,3}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=180||"0 ~ 180"],lngMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"],latDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,2}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=90||"0 ~ 90"],latMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>v.tz(v(t),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return t=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(+(((i=this.positionOffset)==null?void 0:i.slice(1))==="+")?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return t?v.tz(v(t),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(t){return!t||t.lng===null||t.lng===void 0||isNaN(t.lng)||t.lat===null||t.lat===void 0||isNaN(t.lat)?"-":M.LngLatHelper.lat2pretty(t==null?void 0:t.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(t==null?void 0:t.lng,2).pretty}},computeRoundPrecision(){return function(t,e=4){return t==null||isNaN(t)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(t,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.toggle=!1,this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?this.$nextTick(()=>{var t;(t=this.$refs.spotForm)==null||t.resetValidation()}):this.handleCloseForm()}},showMeteo:{handler(){var t,e,a,r,i,l;this.showMeteo?((a=(e=(t=this.$parent)==null?void 0:t.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(t,e){!t&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async t=>{t!=null&&t.valid&&this.fetchData()})},cancelForm(){var t;(t=this.$refs.spotForm)==null||t.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;if(isNaN(this.form.latDegree)||isNaN(this.form.latMinute)||isNaN(this.form.lngDegree)||isNaN(this.form.lngMinute))return!1;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const t=v();((a=v(this.realTime))==null?void 0:a.diff(t,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Ae.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:v(t.dateTime).utc().format(),forecastDays:t.day??3,weatherModels:e,marineModels:a};await le.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Ae.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:v(t.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await le.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(t){var a,r,i,l,n,c,s,m,d,p,u,y,g,h,f,w,z,b,L,x,k,C,S,N,T,B,D,Z,X,$,ae,P,G,W,U,A,I,j,V,q,re;this.currentHourData={},this.positionGmt=(r=(a=t==null?void 0:t.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=t==null?void 0:t.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Ae.Meteo2Assist.pickHourly(t,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=t.lat,this.currentHourData.lng=t.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((p=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:p.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((g=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:g.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((z=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:z.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((L=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:L.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(x=e==null?void 0:e.wave)==null?void 0:x.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(S=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:S.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(N=e==null?void 0:e.wave)==null?void 0:N.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((D=(B=e==null?void 0:e.wave)==null?void 0:B.wd)==null?void 0:D.height,1)??"-",this.currentHourData.windwaveDir=(X=(Z=e==null?void 0:e.wave)==null?void 0:Z.wd)==null?void 0:X.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((ae=($=e==null?void 0:e.wave)==null?void 0:$.wd)==null?void 0:ae.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((G=(P=e==null?void 0:e.wave)==null?void 0:P.swell)==null?void 0:G.height,1)??"-",this.currentHourData.swellDir=(U=(W=e==null?void 0:e.wave)==null?void 0:W.swell)==null?void 0:U.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((I=(A=e==null?void 0:e.wave)==null?void 0:A.swell)==null?void 0:I.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((j=e==null?void 0:e.current)==null?void 0:j.speed,1)??"-",this.currentHourData.currentDir=(V=e==null?void 0:e.current)==null?void 0:V.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((q=e==null?void 0:e.current)==null?void 0:q.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(re=e==null?void 0:e.weather)==null?void 0:re.url},handleBind(){var t,e;this.toggle?((t=this.map)==null||t.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(t){if(t.originalEvent.stopPropagation(),t.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(t.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(t){if(isNaN(t.lat)||isNaN(t.lng))return!1;this.form.latDegree=Number(M.LngLatHelper.lat2pretty(t.lat).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(t.lat).minute),this.form.latDirection=M.LngLatHelper.lat2pretty(t.lat).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(t.lng).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(t.lng).minute),this.form.lngDirection=M.LngLatHelper.lng2pretty(t.lng).direction},handleDrawInfoMarker(t){this.drawPositionMarker(t),this.simple||this.drawMeteoInfoMarker(t)},drawPositionMarker(t){t&&(this.map.flyTo({center:t,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new ne.Marker(e).setLngLat(t).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(t){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(t):this.meteoInfoMarker=new ne.Marker(e).setLngLat(t).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var t,e;(t=this.positionMarker)==null||t.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const t=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",t)}}},dh={class:"idm-gl4-spot"},hh={class:"d-flex justify-start align-center"},ph={class:"text-h6 font-weight-600"},gh={class:"d-flex justify-start align-center ga-1 mb-2"},uh={class:"text-label"},fh={class:"d-flex justify-start align-center ga-1 mb-2"},yh={class:"text-label"},bh={class:"d-flex justify-start align-center ga-1 mb-2"},wh={class:"text-label"},xh={class:"d-flex justify-start align-center ga-1 mb-2"},kh={class:"text-label"},_h={class:"d-flex justify-start align-center"},Lh={class:"mx-2"},zh={class:"mx-0 py-2 d-flex align-center justify-start"},Ch={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},vh={class:"pa-0 px-0"},Sh={class:"mx-0 py-2 d-flex align-center justify-start"},Nh={cols:"9",class:"pa-0 px-0"},Ph={class:"mx-0 py-2 d-flex align-center justify-start"},Vh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Mh={style:{width:"150px"},class:"pa-0 text-left"},Th={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Eh={cols:"3",class:"pa-0 px-0 text-left"},Dh={class:"mx-0 py-2 d-flex align-center justify-start"},Rh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Bh={style:{width:"150px"},class:"pa-0 text-left"},Ih={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Ah={cols:"3",class:"pa-0 text-left"},Fh={class:"mx-0 py-2 d-flex align-center justify-start"},Gh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Wh={style:{width:"150px"},class:"pa-0 text-left"},Zh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Oh={class:"pa-0 text-left"},jh={class:"d-flex justify-space-between align-center"},Hh={class:"d-flex justify-start align-center"},Xh={class:"mx-1"},Yh={class:"d-flex justify-end align-center"},Uh={class:"mx-0 py-1 d-flex align-center justify-start"},$h={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},Jh={class:"pa-0 px-0"},Kh={class:"mx-0 py-1 d-flex align-center justify-start"},qh={class:"pa-0 px-0"},Qh={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},ep={class:"d-flex flex-column align-start justify-center ga-3"},tp={class:"text-label pr-2"},op={class:"text-label pr-2"},ap={class:"text-label pr-2"},ip={class:"d-flex flex-column align-start justify-center ga-3"},rp={class:"text-label pr-2"},lp={class:"text-label pr-2"},np={class:"text-label pr-2"},sp={id:"idm-position-icon"},cp={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},mp=["xlink:href"];function dp(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip"),s=o.resolveComponent("VCardTitle"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VTextField"),p=o.resolveComponent("VCol"),u=o.resolveComponent("VRow"),y=o.resolveComponent("DateTimePicker"),g=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),f=o.resolveComponent("VCardActions"),w=o.resolveComponent("VForm"),z=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",dh,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:b})=>[o.createVNode(n,o.mergeProps(b,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[8]||(e[8]=[o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(o.openBlock(),o.createBlock(z,{key:0,class:"spot-form-card",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",hh,[o.createElementVNode("div",ph,o.toDisplayString(t.$t("spot.spotWeather")),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.submitForm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(h,{class:"text-body-1 pa-4"},{default:o.withCtx(()=>[o.createElementVNode("div",gh,[o.createElementVNode("div",uh,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=b=>i.form.latDegree=b),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[11]}),o.createVNode(p,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=b=>i.form.latMinute=b),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[12]}),o.createVNode(p,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=b=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDirection),1)]),_:1})]),_:1})]),_:1}),o.createElementVNode("div",fh,[o.createElementVNode("div",yh,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=b=>i.form.lngDegree=b),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[14]}),o.createVNode(p,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=b=>i.form.lngMinute=b),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[15]}),o.createVNode(p,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=b=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDirection),1)]),_:1})]),_:1})]),_:1}),o.createElementVNode("div",bh,[o.createElementVNode("div",wh,[o.createTextVNode(o.toDisplayString(t.$t("spot.dateTime")),1),e[16]||(e[16]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0 mb-4"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(y,o.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},t.$attrs,{onDateTime:e[6]||(e[6]=b=>i.form.dateTime=b)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),o.createElementVNode("div",xh,[o.createElementVNode("div",kh,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(u,{class:"ma-0 mb-2"},{default:o.withCtx(()=>[o.createVNode(p,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(g,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=b=>i.form.forecastModel=b),class:"w-100",rounded:"",height:"30",density:"compact",group:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"GFS",class:o.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:o.withCtx(()=>e[18]||(e[18]=[o.createTextVNode("NOAA",-1)])),_:1,__:[18]},8,["class","color"]),o.createVNode(n,{density:"compact",height:"30",class:o.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:o.withCtx(()=>e[19]||(e[19]=[o.createTextVNode("ECMWF",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.createVNode(m),o.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):o.createCommentVNode("",!0),i.showMeteo&&!a.simple?(o.openBlock(),o.createBlock(z,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",_h,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Lh,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:o.withCtx(()=>{var b,L;return[o.createElementVNode("div",zh,[o.createElementVNode("div",Ch,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",vh,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Sh,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Nh,o.toDisplayString(l.computedLocalTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),o.createElementVNode("div",Ph,[o.createElementVNode("div",Vh,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",Mh,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",Th,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",Eh,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",Dh,[o.createElementVNode("div",Rh,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",Bh,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1),o.createElementVNode("div",Ih,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",Ah,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",Fh,[o.createElementVNode("div",Gh,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",Wh,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",Zh,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",Oh,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)])]}),_:1}),o.createVNode(m),o.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(L=>{var x,k;return(L==null?void 0:L.id)===i.form.followId||((x=L==null?void 0:L.coordinate)==null?void 0:x.lng)===i.form.lng&&((k=L==null?void 0:L.coordinate)==null?void 0:k.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1",id:"idm-gl4-spot-meteo-follow",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{prepend:o.withCtx(()=>e[23]||(e[23]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleFollow,["stop"])},{prepend:o.withCtx(()=>e[24]||(e[24]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),o.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:o.withModifiers(l.handleMeteoMore,["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):o.createCommentVNode("",!0),i.showMeteo&&a.simple?(o.openBlock(),o.createBlock(z,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:o.withCtx(()=>[o.createVNode(s,null,{default:o.withCtx(()=>{var b;return[o.createElementVNode("div",jh,[o.createElementVNode("div",Hh,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Xh,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",Yh,[(b=a.followList)!=null&&b.some(L=>{var x,k;return(L==null?void 0:L.id)===i.form.followId||((x=L==null?void 0:L.coordinate)==null?void 0:x.lng)===i.form.lng&&((k=L==null?void 0:L.coordinate)==null?void 0:k.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{default:o.withCtx(()=>e[26]||(e[26]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleFollow,["stop"])},{default:o.withCtx(()=>e[27]||(e[27]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[28]||(e[28]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=o.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:o.withCtx(()=>{var b,L;return[o.createElementVNode("div",Uh,[o.createElementVNode("div",$h,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",Jh,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Kh,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",qh,o.toDisplayString(l.computedLocalTime((L=i.currentHourData)==null?void 0:L.utc)),1)]),o.createElementVNode("div",Qh,[o.createElementVNode("div",ep,[o.createElementVNode("div",null,[o.createElementVNode("span",tp,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1)]),o.createElementVNode("div",null,[o.createElementVNode("span",op,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",ap,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)])]),o.createElementVNode("div",ip,[o.createElementVNode("div",null,[o.createElementVNode("span",rp,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",lp,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",np,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)])])])]}),_:1})]),_:1},512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",sp,[(o.openBlock(),o.createElementBlock("svg",cp,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,mp)]))],512),[[o.vShow,i.showMeteo]])])}const hp=Y(mh,[["render",dp]]),Iy="",pp={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:we.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var t,e,a;if(this.toggle)this.handleBind();else{(t=this.map)==null||t.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var t,e,a,r,i;(t=this.map)==null||t.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var t,e,a,r,i;(t=this.map)==null||t.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(t){if(t.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(t){var a,r,i,l,n,c,s,m,d,p;const e=(r=(a=t.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=t.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let g;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){g=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[g-1],{lng:(m=(s=t.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(p=(d=t.target)==null?void 0:d._lngLat)==null?void 0:p.lat,properties:h[g].properties},g===h.length-1?void 0:h[g+1])}},handleDragEnd(t){var a,r,i,l,n,c,s,m,d,p;const e=(r=(a=t.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=t.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const g=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];g.geometry.coordinates=[(m=(s=t.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(p=(d=t.target)==null?void 0:d._lngLat)==null?void 0:p.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(t){var a,r,i,l;t.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=t.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${$t("actions.detele")}</span>`,this.contextmenu=new ne.Marker(m).setOffset([24,0]).setLngLat([t.lngLat.lng,t.lngLat.lat]).addTo(this.map)}}},handleClick(t){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=t.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=t.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=t.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=E.feature({type:"Point",coordinates:[t.lngLat.lng,t.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(t){const e=t.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=M.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),p=M.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=M.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=M.LngLatHelper.convertToMonotonicLng([s,m]):u=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(s,m,200));const y=E.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=p,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const g=e[i];g.properties.totalDist=M.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),g.properties.sumLabel=g.properties.totalDist+" nm"}e.push(...r),t.total=a}return this.handleRender(t),t},handleTmpPointUpdate(t,e,a,r){const i=E.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let p;s.mode==="RL"?p=M.LngLatHelper.convertToMonotonicLng([m,d]):p=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(p.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let p;s.mode==="RL"?p=M.LngLatHelper.convertToMonotonicLng([m,d]):p=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(p.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist} nm","text-rotation-alignment":"map","text-size":10,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=M.LngLatHelper.roundPrecision((t.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new ne.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(t){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(t){var e;if((e=t==null?void 0:t.features)!=null&&e.length){const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(t):this.map.addSource(a,{type:"geojson",data:t}),this.handleClear(t,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist} nm","text-rotation-alignment":"map","text-size":10,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=t.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${t.id}-${c.properties.id}`,s.className=`${t.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new ne.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[t.id]?this.pointMarkers[t.id].push(m):this.pointMarkers[t.id]=[m]}if(t.closed){const c=n.at(-1),m=t.features.filter(p=>p.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${t.id}" class="marker-close">X</div>`,this.closeMarkers[t.id]=new ne.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(t,e=!0){var n,c,s,m,d,p,u,y,g,h;const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(p=this.closeMarkers[t.id])==null||p.remove(),this.closeMarkers[t.id]=void 0,(u=this.pointMarkers[t.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[t.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((g=this.map)!=null&&g.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},gp={class:"idm-gl4-measure"};function up(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[o.createVNode(c,{text:t.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:s})=>[o.createVNode(n,o.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[0]||(e[0]=[o.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const fp=Y(pp,[["render",up]]),Ay="",yp={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},setup(){return{Theme:we.useTheme()}},emits:["close","save","hideLayer"],data(){var t;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(t=this.Theme.current.value.colors)==null?void 0:t["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var t;this.map&&(this.handleBindMap(),(t=this.editLayer)!=null&&t.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var t,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((t=this.editLayer)!=null&&t.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const t=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!t)return;this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.Theme.current.value.colors)==null?void 0:l["map-green"])||"#4CAF50";const a=(t.features||(t.type==="Feature"?[t]:[]))[0];if(!a)return;const r=(n=a.geometry)==null?void 0:n.type;if(this.originalProperties=a.properties||{},r==="Point"){this.markerType="Point";const[m,d]=a.geometry.coordinates;this.drawCoords=[[m,d]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(d).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(d).minute),this.form.latDir=M.LngLatHelper.lat2pretty(d).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(m).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(m).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(m).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(s=(c=this.originalProperties)==null?void 0:c.shape)==null?void 0:s.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(t),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){this.pointMarker&&(this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag))},handlePointDrag(){const{lng:t,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[t,e]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(e).minute),this.form.latDir=M.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(t).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(t).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(t).direction},clearEditMarkers(){this.editMarkers.forEach(t=>t.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(t){this.drawCoords=t.geometry.coordinates.map(r=>[...r]);const e=E.featureCollection([t,...this.drawCoords.map(r=>E.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new ne.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=E.point([a,r]),l=E.lineString(this.drawCoords),n=E.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",t),this._edgeContextMenuHandler=t},showDeleteButton(t,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(t);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(t){this.handleSetDrawSource(t);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(t){this.clearEditMarkers();const e=t.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new ne.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit(t)})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=E.point([i,l]),c=E.lineString([...this.drawCoords,this.drawCoords[0]]),s=E.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit(t)},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(a).minute),this.form.latDir=M.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:t,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(t),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),p=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[p,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(t,e){var i;if((i=this.pointMarker)==null||i.remove(),!t||!t.length)return;const[a,r]=t[0];this.pointMarker=new ne.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(t){t.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(t){if(!t||t.length<1)return;const e=[],a=2;t==null||t.forEach((i,l)=>{e.push(M.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(t==null?void 0:t.length)>=2&&e.push(M.GeoJsonHelper.drawLine(t));const r=E.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(t,e){const a=M.GeoJsonHelper.drawLine([t,e]),r=E.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:t[0],lat:t[1]},l={lng:e[0],lat:e[1]},n=M.LaneHelper.calculateDistance(i,l,!0,2),c=M.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const p={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=M.LaneHelper.calculateDistance(p,u,!0,4)}s=M.LngLatHelper.roundPrecision(s+n,1);const m=`
218
218
  <div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${c}</b>°</div>
219
219
  <div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=m,this.tipMarker.setLngLat([e[0],e[1]]);else{const d=document.createElement("div");d.className="idm-gl4-draw-tip-marker",d.innerHTML=m,this.tipMarker=new ne.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords.push([e,a]),this.drawCoords.length>=3&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupPolygonEdit()},handleMapMovePolygon(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(t){t.preventDefault(),this.drawCoords.length>=1&&this.drawCoords.pop(),this.drawCoords.length>=1&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon)},handleRenderPolygonFill(t){var i;let e=[];if(t==null||t.forEach((l,n)=>{e.push(E.point(l))}),(t==null?void 0:t.length)>2){const l=[...t,t[0]];e.push(M.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=E.featureCollection(e);this.handleSetDrawSource(a);const r=(i=this.editLayer)!=null&&i.id?3:2;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",r),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":r}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderVertexLabel(t,e=8){this.handleClearVertexLabels();const a=M.LngLatHelper.lat2pretty(t[1],4).pretty,r=M.LngLatHelper.lng2pretty(t[0],4).pretty,i=document.createElement("div");i.className="idm-gl4-draw-corner-label center",i.innerHTML=`<span class="corner-text">${a} <br/> ${r}</span>`;const l=new ne.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(t).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(t){this.handleClearVertexLabels();const e=t.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=t.length,e[1]/=t.length,t.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=M.LngLatHelper.lat2pretty(a[1],4).pretty,c=M.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const m=new ne.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(t){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(t);const a=M.LngLatHelper.lat2pretty(t[1],4).pretty,r=M.LngLatHelper.lng2pretty(t[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(t=>t.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=E.featureCollection([E.point([e,a])]);this.handleSetDrawSource(r),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),this.handleRenderCircleCenterLabel([e,a])}else{const r=this.drawCoords[0],i=[e,a],l=E.distance(E.point(r),E.point(i),{units:"nauticalmiles"}),n=M.GeoJsonHelper.drawCircle(r[0],r[1],l),c=E.featureCollection([E.point(r),n]);this.handleSetDrawSource(c),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=E.distance(E.point(e),E.point(a),{units:"nauticalmiles"}),i=M.GeoJsonHelper.drawCircle(e[0],e[1],r),l=E.featureCollection([E.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(t){const e=M.LngLatHelper.lat2pretty(t[1],4).pretty,a=M.LngLatHelper.lng2pretty(t[0],4).pretty,r=document.createElement("div");r.className="idm-gl4-draw-corner-label bottom-right",r.innerHTML=`<span class="corner-text">${e} <br/> ${a}</span>`;const i=new ne.Marker(r,{anchor:"bottom-right"}).setLngLat(t).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(t,e,a){const r=M.LngLatHelper.roundPrecision(a,2),i=E.featureCollection([E.lineString([t,e])]);this.map.getSource(this.drawRadiusSource)?this.map.getSource(this.drawRadiusSource).setData(i):this.map.addSource(this.drawRadiusSource,{type:"geojson",data:i}),this.map.getLayer(this.drawRadiusLayer)||this.map.addLayer({id:this.drawRadiusLayer,type:"line",source:this.drawRadiusSource,layout:{"line-cap":"round"},paint:{"line-color":this.form.color,"line-width":1.5,"line-dasharray":[4,3]}});const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],n=this.map.project(t),c=this.map.project(e),s=c.x-n.x,m=c.y-n.y;let d=Math.atan2(m,s)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const p=16,u=(d-90)*Math.PI/180,y=Math.round(Math.cos(u)*p),g=Math.round(Math.sin(u)*p);this.circleMarkers.length>1&&(this.circleMarkers[1].remove(),this.circleMarkers.splice(1,1));const h=document.createElement("div"),f=document.createElement("span");f.className="idm-gl4-draw-radius-label",f.style.transform=`rotate(${d}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new ne.Marker(h,{anchor:"center",offset:[y,g]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var t,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(t=this.map)!=null&&t.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=M.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=E.featureCollection([l,...n.map(s=>E.point(s))]);this.handleSetDrawSource(c),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=M.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=E.featureCollection([r,...i.map(n=>E.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const t=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",t):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":t}}),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}})},handleRenderRectCorners(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[1],e[1]),n=[{coord:[a,l],anchor:"bottom-right"},{coord:[r,l],anchor:"bottom-left"},{coord:[r,i],anchor:"top-left"},{coord:[a,i],anchor:"top-right"}];this.handleClearRectCorners(),n.forEach(({coord:c,anchor:s})=>{const m=M.LngLatHelper.lat2pretty(c[1],4).pretty,d=M.LngLatHelper.lng2pretty(c[0],4).pretty,p=document.createElement("div");p.className="idm-gl4-draw-corner-label "+s,p.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new ne.Marker(p,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(t=>t.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const t=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",t):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":t}})},handleSetDrawSource(t){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(t):this.map.addSource(this.drawSource,{type:"geojson",data:t})},handleClearTmp(){var t,e,a;(t=this.map)!=null&&t.getLayer(this.drawTmpLayer)&&this.map.removeLayer(this.drawTmpLayer),(e=this.map)!=null&&e.getSource(this.drawTmpSource)&&this.map.removeSource(this.drawTmpSource),(a=this.tipMarker)==null||a.remove(),this.tipMarker=null},handleUpdateLayerColors(){if(!this.map)return;const t=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",t),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",t),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",t),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",t),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",t),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=t)})},handleClearDraw(t=!1){var a,r,i,l;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const n of e)(a=this.map)!=null&&a.getLayer(n)&&((r=this.map)==null||r.removeLayer(n));(i=this.map)!=null&&i.getSource(this.drawSource)&&this.map.removeSource(this.drawSource),this.drawCoords=[],this.rectFirstPoint=null,this.originalProperties={},this.handleClearRectCorners(),this.handleClearVertexLabels(),this.handleClearCircleLabels(),(l=this.pointMarker)==null||l.remove(),this.pointMarker=null,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let t=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[n,c]=this.drawCoords[0];t=E.featureCollection([M.GeoJsonHelper.drawPoint(c,n,{...this.originalProperties,color:this.form.color,name:this.form.name})])}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=M.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(E.lineString(s,{...this.originalProperties,color:this.form.color,name:this.form.name}));t=E.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const m=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!m)return;const d=m._data;if(!((c=d==null?void 0:d.features)!=null&&c.length))return;let p=((s=d.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(p=p==null?void 0:p.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!p.length)return;t=E.featureCollection(p)}}),!t)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:t};this.saving=!0,await((r=this.editLayer)!=null&&r.id?le.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):le.post(`${this.gateway}/api/arc/lygroups/${(i=this.group)==null?void 0:i.id}/layers`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}})).then(l=>{var n,c,s,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((m=(s=l.data)==null?void 0:s.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},bp={class:"text-h6 font-weight-600"},wp={class:"text-label mb-1"},xp={class:"text-label mb-1"},kp={class:"mb-1"},_p={class:"text-label mb-1"},Lp={class:"mb-1"},zp={class:"text-label mb-1"},Cp={class:"mb-1"},vp={class:"text-label mb-1"},Sp={class:"color-picker-row d-flex align-start ga-2"},Np=["value"],Pp={class:"mb-n2"},Vp={class:"text-label mb-1"},Mp={class:"mb-1"},Tp={class:"text-label mb-1"},Ep={class:"color-picker-row d-flex align-start ga-2"},Dp=["value"],Rp={class:"mb-n2"},Bp={class:"text-label mb-1"},Ip={key:0,class:"mb-3"},Ap={class:"text-label mb-1"},Fp={class:"mb-1"},Gp={class:"text-label mb-1"},Wp={class:"color-picker-row d-flex align-start ga-2"},Zp=["value"],Op={class:"mb-n2"},jp={class:"text-label mb-1"};function Hp(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),m=o.resolveComponent("v-text-field"),d=o.resolveComponent("v-card-text"),p=o.resolveComponent("v-btn"),u=o.resolveComponent("v-btn-toggle"),y=o.resolveComponent("VTextField"),g=o.resolveComponent("v-col"),h=o.resolveComponent("v-row"),f=o.resolveComponent("VDivider"),w=o.resolveComponent("VCardActions"),z=o.resolveComponent("VForm"),b=o.resolveComponent("v-card");return o.openBlock(),o.createBlock(b,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:o.withCtx(()=>{var L;return[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("span",bp,o.toDisplayString((x=a.editLayer)!=null&&x.id?t.$t("actions.edit"):t.$t("actions.addMarker")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),o.createVNode(s),o.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",wp,o.toDisplayString(t.$t("marker.group")),1),o.createVNode(m,{"model-value":(x=a.group)==null?void 0:x.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(L=a.editLayer)!=null&&L.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",xp,[o.createTextVNode(o.toDisplayString(t.$t("marker.markerType")),1),e[22]||(e[22]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(u,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=k=>i.markerType=k),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((x=a.editLayer)!=null&&x.id)},{default:o.withCtx(()=>[o.createVNode(p,{value:"Point",class:o.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Point"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Point"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.point")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Line",class:o.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Line"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.markerType==="Line"?"primary":"",height:"32px","min-height":"32px"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.line")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Area",class:o.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Area"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Area"?"primary":"",height:"32px","min-height":"32px"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(o.openBlock(),o.createBlock(z,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",kp,[o.createElementVNode("div",_p,[o.createTextVNode(o.toDisplayString(t.$t("marker.lat")),1),e[23]||(e[23]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(h,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(g,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(y,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=x=>i.form.latDegree=x),e[2]||(e[2]=x=>l.handleChangePoint())],rules:i.formRules.latDegree,label:"",autocomplete:"off",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[24]||(e[24]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),o.createVNode(g,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(y,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=x=>i.form.latMinute=x),e[4]||(e[4]=x=>l.handleChangePoint())],rules:i.formRules.latMinute,label:"",height:"32px","min-height":"32px",autocomplete:"off",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[25]||(e[25]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),o.createVNode(g,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=x=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Lp,[o.createElementVNode("div",zp,[o.createTextVNode(o.toDisplayString(t.$t("marker.lng")),1),e[26]||(e[26]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(h,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(g,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=x=>i.form.lngDegree=x),e[7]||(e[7]=x=>l.handleChangePoint())],rules:i.formRules.lngDegree,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[27]||(e[27]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),o.createVNode(g,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=x=>i.form.lngMinute=x),e[9]||(e[9]=x=>l.handleChangePoint())],rules:i.formRules.lngMinute,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[28]||(e[28]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),o.createVNode(g,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[10]||(e[10]=x=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Cp,[o.createElementVNode("div",vp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[29]||(e[29]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Sp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=x=>i.form.color=x.target.value)},null,40,Np),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=x=>i.form.color=x),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",Pp,[o.createElementVNode("div",Vp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[30]||(e[30]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=x=>i.form.name=x),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(p,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Line"?(o.openBlock(),o.createBlock(z,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",Mp,[o.createElementVNode("div",Tp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[31]||(e[31]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Ep,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=x=>i.form.color=x.target.value)},null,40,Dp),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=x=>i.form.color=x),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",Rp,[o.createElementVNode("div",Bp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[32]||(e[32]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=x=>i.form.name=x),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(p,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Area"?(o.openBlock(),o.createBlock(z,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>{var x,k;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ip,[o.createElementVNode("div",Ap,[o.createTextVNode(o.toDisplayString(t.$t("marker.areaType")),1),e[33]||(e[33]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(u,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=C=>i.form.areaType=C),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((k=a.editLayer)!=null&&k.id)},{default:o.withCtx(()=>[o.createVNode(p,{value:"Polygon",class:o.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Polygon"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Polygon"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.polygon")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Circle",class:o.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Circle"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.form.areaType==="Circle"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.circle")),1)]),_:1},8,["class","color"]),o.createVNode(p,{value:"Rect",class:o.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Rect"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Rect"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),o.createElementVNode("div",Fp,[o.createElementVNode("div",Gp,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[34]||(e[34]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Wp,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=C=>i.form.color=C.target.value)},null,40,Zp),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=C=>i.form.color=C),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",Op,[o.createElementVNode("div",jp,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[35]||(e[35]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=C=>i.form.name=C),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),o.createVNode(f),o.createVNode(w,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>{var x;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(p,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"])),o.createVNode(p,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0)]}),_:1})}const Xp=Y(yp,[["render",Hp]]),Fy="",Yp={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},emits:["close","import"],data(){return{form:{groupName:"",name:"",file:null,format:"",extend:void 0},formRules:{groupName:[t=>t!=null&&t!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},mounted(){var t;this.form.groupName=((t=this.group)==null?void 0:t.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var t;this.form={groupName:((t=this.group)==null?void 0:t.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(t){const e=t.target.files[0];e&&this.onUpload(e)},handleDrop(t){this.isDragOver=!1;const e=t.dataTransfer.files[0];e&&this.onUpload(e)},onUpload(t){var i,l;if(t.size>10485760){this.$emit("error",this.$t("marker.fileTooLarge"));return}this.form.file=t,this.fileError="",this.form.name=(i=t.name.split("."))==null?void 0:i[0];const a=(l=t.name.split(".").pop())==null?void 0:l.toLowerCase(),r=new FileReader;r.onload=n=>{const c=new Uint8Array(n.target.result);if(c[0]===80&&c[1]===75){const d=new FileReader;d.onload=async p=>{try{const u=await wr(p.target.result),y=Array.isArray(u)?{type:"FeatureCollection",features:u.flatMap(g=>g.features||[])}:u;this.form.extend=y,this.form.format="geojson",this.handleDrawLayers()}catch(u){console.error("Shapefile parse error",u),this.$emit("error","Failed to parse shapefile"),this.fileError="Failed to parse shapefile",this.form.file=null}},d.readAsArrayBuffer(t);return}const m=new FileReader;m.onload=d=>{try{const p=d.target.result;if(a==="json"||a==="geojson")this.form.extend=JSON.parse(p),this.form.format="geojson";else if(a==="kml"){const u=new DOMParser().parseFromString(p,"text/xml");this.form.extend=this.kmlToGeoJSON(u),this.form.format="geojson"}else this.$emit("error","Unsupported format: "+a);this.handleDrawLayers()}catch(p){console.error("File parse error",p),this.$emit("error","Failed to parse file"),this.fileError="Failed to parse file"}},m.readAsText(t)},r.readAsArrayBuffer(t.slice(0,4))},kmlToGeoJSON(t){const e=[];return t.querySelectorAll("Placemark").forEach(r=>{var s;const i=((s=r.querySelector("name"))==null?void 0:s.textContent)||"",l=r.querySelector("Point > coordinates");if(l){const[m,d]=l.textContent.trim().split(",").map(Number);e.push({type:"Feature",geometry:{type:"Point",coordinates:[m,d]},properties:{name:i}});return}const n=r.querySelector("LineString > coordinates");if(n){const m=n.textContent.trim().split(/\s+/).map(d=>d.split(",").map(Number).slice(0,2));e.push({type:"Feature",geometry:{type:"LineString",coordinates:m},properties:{name:i}});return}const c=r.querySelector("outerBoundaryIs LinearRing coordinates");if(c){const m=c.textContent.trim().split(/\s+/).map(d=>d.split(",").map(Number).slice(0,2));e.push({type:"Feature",geometry:{type:"Polygon",coordinates:[m]},properties:{name:i}})}}),{type:"FeatureCollection",features:e}},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){const{valid:t}=await this.$refs.importForm.validate();if(!t)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await le.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i,l;((i=r.data)==null?void 0:i.code)===0&&(e=(l=r.data.data)==null?void 0:l.id)}),!e)return;const a={name:this.form.name,format:this.form.format,color:this.form.color||"#2aff00",extend:this.form.extend};await le.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,a,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i;((i=r.data)==null?void 0:i.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(r=>{this.uploading=!1})},handleDrawLayers(){if(!this.map||!this.form.extend)return;this.handleClearPreview();const t=this.form.extend,e=this.form.color||"#2aff00",a=this.previewSourceId,r=t.features||(t.type==="Feature"?[t]:[]),i=[];r.forEach(c=>{var d;const s=(d=c.geometry)==null?void 0:d.type;let m=[];s==="LineString"?m=c.geometry.coordinates:s==="MultiLineString"?m=c.geometry.coordinates.flat():s==="Polygon"?m=c.geometry.coordinates[0]:s==="MultiPolygon"&&(m=c.geometry.coordinates.flat(2)),m.forEach(p=>i.push(E.point(p,{_vertex:!0})))}),r.forEach(c=>{var s;if(((s=c.geometry)==null?void 0:s.type)==="Point"){const[m,d]=c.geometry.coordinates;this.previewMarkers.push(new ne.Marker({color:e}).setLngLat([m,d]).addTo(this.map))}});const l=E.featureCollection([...r.filter(c=>{var s;return((s=c.geometry)==null?void 0:s.type)!=="Point"}),...i]);this.map.getSource(a)?this.map.getSource(a).setData(l):this.map.addSource(a,{type:"geojson",data:l});const n=new Set(r.map(c=>{var s;return(s=c.geometry)==null?void 0:s.type}));(n.has("LineString")||n.has("MultiLineString"))&&!this.map.getLayer(`${a}-line`)&&this.map.addLayer({id:`${a}-line`,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":e,"line-width":2}}),(n.has("Polygon")||n.has("MultiPolygon"))&&(this.map.getLayer(`${a}-fill`)||this.map.addLayer({id:`${a}-fill`,type:"fill",source:a,filter:["==","$type","Polygon"],paint:{"fill-color":e,"fill-opacity":.35}}),this.map.getLayer(`${a}-outline`)||this.map.addLayer({id:`${a}-outline`,type:"line",source:a,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":e,"line-width":2}})),i.length&&!this.map.getLayer(`${a}-vertex`)&&this.map.addLayer({id:`${a}-vertex`,type:"circle",source:a,filter:["==",["get","_vertex"],!0],paint:{"circle-radius":4,"circle-color":e,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}})},handleClearPreview(){if(!this.map)return;this.previewMarkers.forEach(a=>a.remove()),this.previewMarkers=[];const t=this.previewSourceId;[`${t}-vertex`,`${t}-point`,`${t}-line`,`${t}-fill`,`${t}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(t)&&this.map.removeSource(t)}}},Up={class:"text-h6 font-weight-600"},$p={class:"mb-4"},Jp={class:"text-label mb-1"},Kp={class:"text-body-2 text-center text-label"},qp={class:"text-body-1 text-primary mt-2 cursor-pointer"},Qp={class:"text-body-2 text-left text-label mt-1"},eg={key:0,class:"text-body-2 text-left text-danger mt-1"},tg={key:1,class:"d-flex align-center justify-space-between mt-2 px-2"},og={class:"text-body-2 text-truncate"};function ag(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),m=o.resolveComponent("v-text-field"),d=o.resolveComponent("v-icon"),p=o.resolveComponent("v-card-text"),u=o.resolveComponent("VDivider"),y=o.resolveComponent("v-btn"),g=o.resolveComponent("VCardActions"),h=o.resolveComponent("VForm"),f=o.resolveComponent("v-card");return o.openBlock(),o.createBlock(f,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",Up,o.toDisplayString(t.$t("marker.importLayer")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[7]||(e[7]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[7]},8,["onClick"])]),_:1}),o.createVNode(s),o.createVNode(h,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleConfirm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(p,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",$p,[o.createElementVNode("div",Jp,[o.createTextVNode(o.toDisplayString(t.$t("marker.group")),1),e[8]||(e[8]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=w=>i.form.groupName=w),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),o.createElementVNode("div",{class:o.normalizeClass(["upload-area d-flex flex-column justify-center align-center pa-4",{"drag-over":i.isDragOver,"upload-error":i.fileError}]),onDragenter:e[2]||(e[2]=o.withModifiers(w=>i.isDragOver=!0,["prevent"])),onDragleave:e[3]||(e[3]=o.withModifiers(w=>i.isDragOver=!1,["prevent"])),onDragover:e[4]||(e[4]=o.withModifiers(()=>{},["prevent"])),onDrop:e[5]||(e[5]=o.withModifiers((...w)=>l.handleDrop&&l.handleDrop(...w),["prevent"])),onClick:e[6]||(e[6]=(...w)=>l.handleSelectFile&&l.handleSelectFile(...w))},[o.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:o.withCtx(()=>e[9]||(e[9]=[o.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[9]}),o.createElementVNode("div",Kp,o.toDisplayString(t.$t("marker.uploadHint")),1),o.createElementVNode("div",qp,o.toDisplayString(t.$t("marker.selectFile")),1),o.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[1]||(e[1]=(...w)=>l.handleFileChange&&l.handleFileChange(...w))},null,544)],34),o.createElementVNode("div",Qp,o.toDisplayString(t.$t("marker.uploadLimit")),1),i.fileError?(o.openBlock(),o.createElementBlock("div",eg,o.toDisplayString(i.fileError),1)):o.createCommentVNode("",!0),i.form.file?(o.openBlock(),o.createElementBlock("div",tg,[o.createElementVNode("span",og,o.toDisplayString(i.form.file.name),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",onClick:l.handleRemoveFile},{default:o.withCtx(()=>[o.createVNode(d,{size:"16"},{default:o.withCtx(()=>e[10]||(e[10]=[o.createTextVNode("mdi-close",-1)])),_:1,__:[10]})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),_:1}),o.createVNode(u),o.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.reset")),1)]),_:1},8,["onClick"]),o.createVNode(y,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const ig=Y(Yp,[["render",ag]]),Gy="",rg={name:"IdmGroupDialog",props:{modelValue:{type:Boolean,default:!1},group:{type:Object,default:null},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String}},emits:["update:modelValue","saved"],data(){return{localName:"",saving:!1}},watch:{group:{handler(t){this.localName=(t==null?void 0:t.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var t;!this.group||!((t=this.localName)!=null&&t.trim())||(this.saving=!0,await le.put(`${this.gateway}/api/arc/lygroups/${this.group.id}`,{name:this.localName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&this.$emit("saved")}).catch(()=>{}).finally(()=>{this.saving=!1}))}}},lg={class:"text-h6 font-weight-600"},ng={class:"text-label mb-2"};function sg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),c=o.resolveComponent("v-card-title"),s=o.resolveComponent("v-divider"),m=o.resolveComponent("v-text-field"),d=o.resolveComponent("v-card-text"),p=o.resolveComponent("VDivider"),u=o.resolveComponent("v-btn"),y=o.resolveComponent("VCardActions"),g=o.resolveComponent("v-card"),h=o.resolveComponent("v-dialog");return o.openBlock(),o.createBlock(h,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=f=>t.$emit("update:modelValue",f))},{default:o.withCtx(()=>[o.createVNode(g,{class:"",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",lg,o.toDisplayString(t.$t("actions.editGroup")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),o.createVNode(s),o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ng,[o.createTextVNode(o.toDisplayString(t.$t("marker.groupName")),1),e[3]||(e[3]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=f=>i.localName=f),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),o.createVNode(p),o.createVNode(y,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(u,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const cg=Y(rg,[["render",sg]]),mg={name:"DeleteDialog",props:{title:{type:String},tips:{type:String},loading:{type:Boolean,default:!1}},setup(){},emits:["close","delete"],data(){return{showDialog:!1}},watch:{},mounted(){},methods:{handleClose(){this.showDialog=!1},handleDelete(){this.$emit("delete")},open(){this.showDialog=!0}}},dg={class:"text-body-1 pb-1"},hg={class:"text-body-1"};function pg(t,e,a,r,i,l){const n=o.resolveComponent("v-icon"),c=o.resolveComponent("VBtn"),s=o.resolveComponent("v-card-title"),m=o.resolveComponent("v-card-text"),d=o.resolveComponent("v-card-actions"),p=o.resolveComponent("v-card"),u=o.resolveComponent("v-dialog");return o.openBlock(),o.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:o.withCtx(()=>[o.createVNode(p,{class:""},{default:o.withCtx(()=>[o.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:o.withCtx(()=>[o.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),o.createElementVNode("div",null,o.toDisplayString(a.title),1),o.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:o.withCtx(()=>e[1]||(e[1]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),o.createVNode(m,{class:"py-4 text-center"},{default:o.withCtx(()=>[o.createElementVNode("p",dg,o.toDisplayString(a.tips),1),o.createElementVNode("p",hg,o.toDisplayString(t.$t("tips.doYouWantToContinue")),1)]),_:1}),o.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:o.withCtx(()=>[o.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const gg=Y(mg,[["render",pg]]),Wy="",Zy="",ug={name:"IdmMarker",components:{IdmDrawMarker:Xp,IdmImportMarker:ig,IdmGroupDialog:cg,DeleteDialog:gg},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:we.useTheme()}},emits:["map","menuToggle","theme"],data(){return{right:10,toggle:!1,autoActive:!0,keyword:"",drawDialog:!1,importDialog:!1,loading:!1,deleteDialog:!1,deleteLoading:!1,layerGroup:[],layers:[],groupIndex:0,currentLayer:void 0,drawnLayerIds:[],layerMarkers:{},groupDialog:!1,currentGroup:null,currentGroupId:"",currentGroupName:""}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{async handler(){this.toggle}},autoActive:{async handler(){this.autoActive?this.layerGroup.length===0?await this.fetchAllLayers():this.handleDrawAllLayers():this.handleClearAllLayers()},immediate:!0},map:{handler(){this.map&&(this.handleDrawAllLayers(),this.map.on("zoom",this.handleZoomChange))}}},methods:{handleMenuToggle(){this.isLogin?(this.toggle=!this.toggle,this.$emit("menuToggle","markerLayers")):this.$emit("login")},handleEditGroup(t){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=t,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(t,e){t==="group"?(this.currentGroup=e,this.currentLayer=void 0):t==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var t;this.currentGroup?this.handleDeleteGroup((t=this.currentGroup)==null?void 0:t.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(t){t&&(this.deleteLoading=!0,await le.delete(`${this.gateway}/api/arc/lygroups/${t}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.fetchAllLayers(),this.currentGroup=void 0,this.$refs.deleteDialog.handleClose(),this.deleteLoading=!1)}).catch(()=>{this.deleteLoading=!1}))},handleOpenDrawMarkers(t){this.handleCloseDraw(),this.currentGroup=t||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(t){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=t||void 0,this.importDialog=!0},handleImportLayer(t){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(t){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(t,e){this.importDialog=!1,this.currentGroup=t,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await le.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(t=>{var e,a,r,i,l;if(((e=t.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=t.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const n=[];(l=this.layerGroup)==null||l.forEach(c=>{var s;c.show=!0,(s=c.layers)==null||s.forEach(m=>{m.layerGroupId=c.id,m.extend.features.forEach(d=>{d.properties.lgId=c.id,d.properties.layerId=m.id,d.properties.name||(d.properties.name=m.name)}),n.push(m)})}),this.layers=n,this.handleDrawAllLayers(),this.$refs.drawDialog.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(t){this.deleteLoading=!0,await le.delete(`${this.gateway}/api/arc/layers/${t.id}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.deleteLoading=!1,this.fetchAllLayers(),this.$refs.deleteDialog.handleClose())}).catch(()=>{this.deleteLoading=!1})},handleRenderLayer(t){if(!this.map||!(t!=null&&t.extend))return;const e=typeof t.extend=="string"?JSON.parse(t.extend):t.extend;if(!e)return;const a=`marker-layer-${t.id}`;this.handleClearLayerMarkers(t.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,m;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((m=c.geometry)==null?void 0:m.type)==="MultiPoint")&&c.properties.type==="point"})){const c=[];r.forEach(s=>{var u,y,g,h;const m=(u=s.geometry)==null?void 0:u.type,d=((y=s.properties)==null?void 0:y.name)||"",p=((g=s.properties)==null?void 0:g.color)||t.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[f,w]=s.geometry.coordinates,z=`<div style="font-size:12px;line-height:1.5;">
220
220
  <div style="font-weight:600;">${d}</div>
@@ -1,6 +1,6 @@
1
- import { d as l } from "./chunk-ANSXOGKI-17092f03.js";
2
- import "./chunk-3VYIPD3A-f7a04bda.js";
3
- import "./index-76ef8dce.js";
1
+ import { d as l } from "./chunk-ANSXOGKI-aa9c0ef0.js";
2
+ import "./chunk-3VYIPD3A-372674b9.js";
3
+ import "./index-fc0a9238.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
@@ -1,6 +1,6 @@
1
- import { m as k } from "./chunk-T4JIPPZO-4371933b.js";
2
- import "./chunk-3VYIPD3A-f7a04bda.js";
3
- import "./index-76ef8dce.js";
1
+ import { m as k } from "./chunk-T4JIPPZO-bdbd84b7.js";
2
+ import "./chunk-3VYIPD3A-372674b9.js";
3
+ import "./index-fc0a9238.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
@@ -1,5 +1,5 @@
1
- import { W as g } from "./chunk-3VYIPD3A-f7a04bda.js";
2
- import "./index-76ef8dce.js";
1
+ import { W as g } from "./chunk-3VYIPD3A-372674b9.js";
2
+ import "./index-fc0a9238.js";
3
3
  import "axios";
4
4
  import "vuetify";
5
5
  import "vue";
@@ -1,6 +1,6 @@
1
- import { d as u } from "./chunk-ANSXOGKI-17092f03.js";
2
- import { l as g } from "./index-76ef8dce.js";
3
- import "./chunk-3VYIPD3A-f7a04bda.js";
1
+ import { d as u } from "./chunk-ANSXOGKI-aa9c0ef0.js";
2
+ import { l as g } from "./index-fc0a9238.js";
3
+ import "./chunk-3VYIPD3A-372674b9.js";
4
4
  import "axios";
5
5
  import "vuetify";
6
6
  import "vue";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idmwx/idmui-gl4",
3
3
  "private": false,
4
- "version": "3.0.4",
4
+ "version": "3.0.5",
5
5
  "description": "idm webgl4",
6
6
  "type": "module",
7
7
  "keywords": [