@idm-plugin/geo 1.7.6 → 1.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18,8 +18,8 @@ var j = { exports: {} };
18
18
  M.version === void 0 && M.default && (M = M.default);
19
19
  var z = "0.5.47", p = {}, O = {}, A = {}, b = {}, c = {}, o;
20
20
  (!M || typeof M.version != "string") && D("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");
21
- var q = M.version.split("."), d = +q[0], Y = +q[1];
22
- (d < 2 || d === 2 && Y < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
21
+ var q = M.version.split("."), Y = +q[0], d = +q[1];
22
+ (Y < 2 || Y === 2 && d < 6) && D("Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js " + M.version + ". See momentjs.com");
23
23
  function L(W) {
24
24
  return W > 96 ? W - 87 : W > 64 ? W - 29 : W - 48;
25
25
  }
@@ -275,7 +275,7 @@ var j = { exports: {} };
275
275
  };
276
276
  }
277
277
  m.zoneName = y(m.zoneName), m.zoneAbbr = y(m.zoneAbbr), m.utc = w(m.utc), m.local = w(m.local), m.utcOffset = d0(m.utcOffset), M.tz.setDefault = function(W) {
278
- return (d < 2 || d === 2 && Y < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = W ? g(W) : null, M;
278
+ return (Y < 2 || Y === 2 && d < 9) && D("Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js " + M.version + "."), M.defaultZone = W ? g(W) : null, M;
279
279
  };
280
280
  var h = M.momentProperties;
281
281
  return Object.prototype.toString.call(h) === "[object Array]" ? (h.push("_z"), h.push("_a")) : h && (h._z = null), M;
@@ -1144,10 +1144,10 @@ var x = { exports: {} };
1144
1144
  throw new RangeError("invalid coordinates");
1145
1145
  if (90 <= z)
1146
1146
  return "Etc/GMT";
1147
- var b = -1, c = 48 * (180 + p) / 360.00000000000006, o = 24 * (90 - z) / 180.00000000000003, q = 0 | c, d = 0 | o, Y = 96 * d + 2 * q;
1148
- for (Y = 56 * O.charCodeAt(Y) + O.charCodeAt(Y + 1) - 1995; Y + A.length < 3136; )
1149
- Y = 56 * O.charCodeAt(Y = 8 * (b = b + Y + 1) + 4 * (d = 0 | (o = 2 * (o - d) % 2)) + 2 * (q = 0 | (c = 2 * (c - q) % 2)) + 2304) + O.charCodeAt(Y + 1) - 1995;
1150
- return A[Y + A.length - 3136];
1147
+ var b = -1, c = 48 * (180 + p) / 360.00000000000006, o = 24 * (90 - z) / 180.00000000000003, q = 0 | c, Y = 0 | o, d = 96 * Y + 2 * q;
1148
+ for (d = 56 * O.charCodeAt(d) + O.charCodeAt(d + 1) - 1995; d + A.length < 3136; )
1149
+ d = 56 * O.charCodeAt(d = 8 * (b = b + d + 1) + 4 * (Y = 0 | (o = 2 * (o - Y) % 2)) + 2 * (q = 0 | (c = 2 * (c - q) % 2)) + 2304) + O.charCodeAt(d + 1) - 1995;
1150
+ return A[d + A.length - 3136];
1151
1151
  }
1152
1152
  E.exports = M;
1153
1153
  })(x);
@@ -1176,12 +1176,12 @@ class X {
1176
1176
  z = z < 6 ? 6 : z, M = X.convertToStdLng(M, z);
1177
1177
  let O = "E";
1178
1178
  M < 0 && (O = "W"), M = Math.abs(M), p = p.toUpperCase();
1179
- let A = M * 3600, b, c, o, q, d, Y;
1180
- b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), d = A / 3600, p.indexOf("M") !== -1 ? Y = X.roundPrecision(d, z).toString().padStart(3, "0") : Y = X.padNumber(d, 3, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (Y = Number(Y) + 1, q = 0);
1181
- const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, Y)}${O}`;
1179
+ let A = M * 3600, b, c, o, q, Y, d;
1180
+ b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), Y = A / 3600, p.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(3, "0") : d = X.padNumber(Y, 3, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1181
+ const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, d)}${O}`;
1182
1182
  return {
1183
1183
  direction: O,
1184
- degree: X.roundPrecision(d, z),
1184
+ degree: X.roundPrecision(Y, z),
1185
1185
  minute: X.roundPrecision(o, z),
1186
1186
  second: X.roundPrecision(b, z),
1187
1187
  pretty: L
@@ -1197,12 +1197,12 @@ class X {
1197
1197
  z = z < 6 ? 6 : z, M = M % 180;
1198
1198
  let O = "N";
1199
1199
  M < 0 && (O = "S"), M = Math.abs(M), p = p.toUpperCase();
1200
- let A = M * 3600, b, c, o, q, d, Y;
1201
- b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), d = A / 3600, p.indexOf("M") !== -1 ? Y = X.roundPrecision(d, z).toString().padStart(2, "0") : Y = X.padNumber(d, 2, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (Y = Number(Y) + 1, q = 0);
1202
- const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, Y)}${O}`;
1200
+ let A = M * 3600, b, c, o, q, Y, d;
1201
+ b = A % 3600 % 60, p.indexOf("S") !== -1 && (A = A - b, c = X.padNumber(b, 2, 2)), o = A / 60 % 60, p.indexOf("M") !== -1 && (p.indexOf("S") !== -1 ? q = X.roundPrecision(o, z).toString().padStart(2, "0") : q = X.padNumber(o, 2, 2), A = A - o * 60), Y = A / 3600, p.indexOf("M") !== -1 ? d = X.roundPrecision(Y, z).toString().padStart(2, "0") : d = X.padNumber(Y, 2, 2), Number(c) >= 60 && (q = Number(q) + 1, c = 0), Number(q) >= 60 && (d = Number(d) + 1, q = 0);
1202
+ const L = `${p.replace(/S+/gi, c).replace(/M+/gi, q).replace(/H+/gi, d)}${O}`;
1203
1203
  return {
1204
1204
  direction: O,
1205
- degree: X.roundPrecision(d, z),
1205
+ degree: X.roundPrecision(Y, z),
1206
1206
  minute: X.roundPrecision(o, z),
1207
1207
  second: X.roundPrecision(b, z),
1208
1208
  pretty: L
@@ -1389,9 +1389,9 @@ class N {
1389
1389
  static interpolateCoordinates(M, z, p, O = !0, A = !0, b = "nauticalmiles") {
1390
1390
  const c = [], o = this.calculateBearing(M, z, !1), q = this.calculateDistance(M, z, !1, 8, b);
1391
1391
  O && c.push({ lng: M.lng, lat: M.lat });
1392
- let d = 0;
1393
- for (; d < q; )
1394
- d += p, d < q && c.push(this.calculateCoordinate(M, o, d, b, !1));
1392
+ let Y = 0;
1393
+ for (; Y < q; )
1394
+ Y += p, Y < q && c.push(this.calculateCoordinate(M, o, Y, b, !1));
1395
1395
  return A && c.push({ lng: z.lng, lat: z.lat }), c;
1396
1396
  }
1397
1397
  /**
@@ -1420,12 +1420,12 @@ class N {
1420
1420
  [A, M[c].lat],
1421
1421
  [b, M[c + 1].lat]
1422
1422
  ]);
1423
- let d, Y;
1424
- z ? (d = e.lineString(q), Y = e.lineString([
1423
+ let Y, d;
1424
+ z ? (Y = e.lineString(q), d = e.lineString([
1425
1425
  [o > 0 ? 180 : -180, 89],
1426
1426
  [o > 0 ? 180 : -180, -89]
1427
- ])) : (d = e.greatCircle(q[0], q[1]), Y = e.greatCircle([o > 0 ? 180 : -180, 89], [o > 0 ? 180 : -180, -89]));
1428
- const L = e.lineIntersect(d, Y);
1427
+ ])) : (Y = e.greatCircle(q[0], q[1]), d = e.greatCircle([o > 0 ? 180 : -180, 89], [o > 0 ? 180 : -180, -89]));
1428
+ const L = e.lineIntersect(Y, d);
1429
1429
  let T;
1430
1430
  if (L.features.length) {
1431
1431
  const U = e.getCoord(L.features[0]);
@@ -1495,9 +1495,9 @@ class N {
1495
1495
  M.lng = X.convertToStdLng(M.lng, 8);
1496
1496
  let p = Number.MAX_VALUE, O = 0, A = 0, b, c;
1497
1497
  return z.forEach((o, q) => {
1498
- for (let d = 0; d < o.length - 1; d++) {
1499
- const Y = { lng: o[d][0], lat: o[d][1] }, L = { lng: o[d + 1][0], lat: o[d + 1][1] }, T = this.calculatePointToLineDistance(M, Y, L);
1500
- p > T && (p = T, A = d, O = q, b = this.calculateDistance(Y, M), c = this.calculateDistance(L, M));
1498
+ for (let Y = 0; Y < o.length - 1; Y++) {
1499
+ const d = { lng: o[Y][0], lat: o[Y][1] }, L = { lng: o[Y + 1][0], lat: o[Y + 1][1] }, T = this.calculatePointToLineDistance(M, d, L);
1500
+ p > T && (p = T, A = Y, O = q, b = this.calculateDistance(d, M), c = this.calculateDistance(L, M));
1501
1501
  }
1502
1502
  }), b !== 0 && c !== 0 ? z[O].splice(A + 1, 0, [M.lng, M.lat]) : b === 0 ? z[O].splice(A, 1, [M.lng, M.lat]) : c === 0 && z[O].splice(A + 1, 1, [M.lng, M.lat]), z;
1503
1503
  }
@@ -1565,11 +1565,11 @@ class N {
1565
1565
  */
1566
1566
  static calculateRangeWaypoints(M, z, p, O = []) {
1567
1567
  const A = this.convertRouteToCoordinates(p, 0), b = this.mergeCoordinatesToWaypoints([M, z], A.length ? A : O), c = b.findIndex(
1568
- (d) => X.roundPrecision(M.lng, 8) === X.roundPrecision(d.lng, 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(d.lat, 8)
1568
+ (Y) => X.roundPrecision(M.lng, 8) === X.roundPrecision(Y.lng, 8) && X.roundPrecision(M.lat, 8) === X.roundPrecision(Y.lat, 8)
1569
1569
  ), o = b.findIndex(
1570
- (d) => X.roundPrecision(z.lng, 8) === X.roundPrecision(d.lng, 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(d.lat, 8)
1570
+ (Y) => X.roundPrecision(z.lng, 8) === X.roundPrecision(Y.lng, 8) && X.roundPrecision(z.lat, 8) === X.roundPrecision(Y.lat, 8)
1571
1571
  );
1572
- return b.filter((d, Y) => Y >= c && Y <= o);
1572
+ return b.filter((Y, d) => d >= c && d <= o);
1573
1573
  }
1574
1574
  /**
1575
1575
  * 计算坐标到航路上的最短距离
@@ -1580,8 +1580,8 @@ class N {
1580
1580
  let p = Number.MAX_VALUE, O = 0, A = 0;
1581
1581
  return z.forEach((b, c) => {
1582
1582
  for (let o = 0; o < b.length - 1; o++) {
1583
- const q = { lng: b[o][0], lat: b[o][1] }, d = { lng: b[o + 1][0], lat: b[o + 1][1] }, Y = this.calculatePointToLineDistance(M, q, d);
1584
- p > Y && (p = Y, O = o, A = c);
1583
+ const q = { lng: b[o][0], lat: b[o][1] }, Y = { lng: b[o + 1][0], lat: b[o + 1][1] }, d = this.calculatePointToLineDistance(M, q, Y);
1584
+ p > d && (p = d, O = o, A = c);
1585
1585
  }
1586
1586
  }), { minDist: p, segIndex: A, minIndex: O };
1587
1587
  }
@@ -1602,8 +1602,8 @@ class N {
1602
1602
  if (c) {
1603
1603
  const q = [];
1604
1604
  q.push([M.lng, M.lat]);
1605
- for (let d = A + 1; d < z[o].length; d++)
1606
- M.lng === z[o][d][0] && M.lat === z[o][d][1] || q.push(z[o][d]);
1605
+ for (let Y = A + 1; Y < z[o].length; Y++)
1606
+ M.lng === z[o][Y][0] && M.lat === z[o][Y][1] || q.push(z[o][Y]);
1607
1607
  b.push(q), c = !1;
1608
1608
  } else
1609
1609
  b.push([...z[o]]);
@@ -1622,7 +1622,7 @@ class N {
1622
1622
  if (this.calculateDistance(M, c) === 0)
1623
1623
  return z;
1624
1624
  if (this.calculateDistance(M, o) === 0)
1625
- return z.filter((d, Y) => Y > 0);
1625
+ return z.filter((Y, d) => d > 0);
1626
1626
  const q = this.calculatePointToLineDistance(M, c, o);
1627
1627
  p > q && (p = q, O = b);
1628
1628
  }
@@ -1691,17 +1691,17 @@ class N {
1691
1691
  z.push(M);
1692
1692
  else {
1693
1693
  for (let o = 0; o < z.length - 1; o++) {
1694
- const q = { lng: z[o].lng, lat: z[o].lat }, d = { lng: z[o + 1].lng, lat: z[o + 1].lat }, Y = this.calculatePointToLineDistance(M, q, d);
1695
- O >= Y && (O = Y, A = o, b = this.calculateDistance(q, M, !1, 6), c = this.calculateDistance(d, M, !1, 6));
1694
+ const q = { lng: z[o].lng, lat: z[o].lat }, Y = { lng: z[o + 1].lng, lat: z[o + 1].lat }, d = this.calculatePointToLineDistance(M, q, Y);
1695
+ O >= d && (O = d, A = o, b = this.calculateDistance(q, M, !1, 6), c = this.calculateDistance(Y, M, !1, 6));
1696
1696
  }
1697
1697
  b !== 0 && c !== 0 ? b < O || b === O && A === 0 ? z.unshift(M) : c < O || c === O && A === z.length - 2 ? z.push(M) : z.splice(A + 1, 0, M) : b === 0 ? p ? z.splice(A, 1, M) : z.splice(A + 1, 0, M) : c === 0 && (p ? z.splice(A + 1, 1, M) : z.splice(A + 1, 0, M));
1698
1698
  }
1699
1699
  return z.map((o, q) => {
1700
1700
  o.lng = X.convertToStdLng(o.lng);
1701
- const d = z[q + 1];
1702
- if (d && (o.bearing || (o.bearing = this.calculateBearing(o, d, !0)), o.cog = o.cog || o.bearing, !o.sog && o.positionTime && d.positionTime)) {
1703
- const Y = this.calculateDistance(o, d, !0), L = Math.abs(d.positionTime - o.positionTime) / 3600;
1704
- o.sog = X.roundPrecision(Y / L, 2);
1701
+ const Y = z[q + 1];
1702
+ if (Y && (o.bearing || ((o.positionTime || 0) > (Y.positionTime || 0) ? o.bearing = this.calculateBearing(Y, o, !0) : o.bearing = this.calculateBearing(o, Y, !0)), o.cog = o.cog || o.bearing, !o.sog && o.positionTime && Y.positionTime)) {
1703
+ const d = this.calculateDistance(o, Y, !0), L = Math.abs(Y.positionTime - o.positionTime) / 3600;
1704
+ o.sog = X.roundPrecision(d / L, 2);
1705
1705
  }
1706
1706
  return o;
1707
1707
  });
@@ -1764,7 +1764,7 @@ class N {
1764
1764
  static calculateNextCoordinateAlongRoute(M, z, p, O = "nauticalmiles") {
1765
1765
  var L;
1766
1766
  const A = M.speed || 12, b = [];
1767
- let c = [], o = !1, q = 0, d = 0, Y;
1767
+ let c = [], o = !1, q = 0, Y = 0, d;
1768
1768
  if (z && p.length ? (b.push(M), p.forEach((T, U) => {
1769
1769
  if (o)
1770
1770
  c.push(T);
@@ -1772,32 +1772,32 @@ class N {
1772
1772
  const r = [];
1773
1773
  let s;
1774
1774
  for (let P = 0; P < T.length; P++)
1775
- if (Y)
1775
+ if (d)
1776
1776
  r.push(T[P]);
1777
1777
  else {
1778
1778
  s = { lng: T[P][0], lat: T[P][1] };
1779
1779
  const I = this.calculateDistance(M, s, !0, 8, O);
1780
1780
  if (q += I, q < z)
1781
- d += I, I && b.push(s), M = s;
1781
+ Y += I, I && b.push(s), M = s;
1782
1782
  else {
1783
- if (d = z, q === z)
1784
- Y = s, r.push([Y.lng, Y.lat]);
1783
+ if (Y = z, q === z)
1784
+ d = s, r.push([d.lng, d.lat]);
1785
1785
  else {
1786
1786
  const l = q - z, f = this.calculateBearing(s, M);
1787
- Y = this.calculateCoordinate(s, f, l, O), r.push([Y.lng, Y.lat]), r.push([s.lng, s.lat]);
1787
+ d = this.calculateCoordinate(s, f, l, O), r.push([d.lng, d.lat]), r.push([s.lng, s.lat]);
1788
1788
  }
1789
1789
  o = !0;
1790
1790
  }
1791
1791
  }
1792
- r.length && c.push(r), U === p.length - 1 && !Y && (Y = s);
1792
+ r.length && c.push(r), U === p.length - 1 && !d && (d = s);
1793
1793
  }
1794
- })) : (c = p, Y = { ...M }), Y)
1795
- if (b.push(Y), Y.distanceFromPrevious = d, Y.hourFromPrevious = Math.round(d / A * 1e4) / 1e4, ((L = c[0]) == null ? void 0 : L.length) > 1) {
1794
+ })) : (c = p, d = { ...M }), d)
1795
+ if (b.push(d), d.distanceFromPrevious = Y, d.hourFromPrevious = Math.round(Y / A * 1e4) / 1e4, ((L = c[0]) == null ? void 0 : L.length) > 1) {
1796
1796
  const T = { lng: c[0][1][0], lat: c[0][1][1] };
1797
- Y.bearing = this.calculateBearing(Y, T);
1797
+ d.bearing = this.calculateBearing(d, T);
1798
1798
  } else
1799
- Y.bearing = 0;
1800
- return { coordinate: Y, nextRoute: c, prevRoute: b };
1799
+ d.bearing = 0;
1800
+ return { coordinate: d, nextRoute: c, prevRoute: b };
1801
1801
  }
1802
1802
  /**
1803
1803
  * 返回最近点及其是否为垂足(最近点不是起点或终点)
@@ -1809,8 +1809,8 @@ class N {
1809
1809
  const O = X.convertToStdLng(M.lng, 6), A = e.point([O, M.lat]), b = X.convertToStdLng(z.lng, 6), c = X.convertToStdLng(p.lng, 6), o = e.lineString([
1810
1810
  [b, z.lat],
1811
1811
  [c, p.lat]
1812
- ]), q = e.nearestPointOnLine(o, A), d = e.getCoord(q), Y = X.roundPrecision(d[0], 6), L = X.roundPrecision(d[1], 6);
1813
- return { lng: Y, lat: L, inline: !(Y === b && L === z.lat) && !(Y === c && L === p.lat) };
1812
+ ]), q = e.nearestPointOnLine(o, A), Y = e.getCoord(q), d = X.roundPrecision(Y[0], 6), L = X.roundPrecision(Y[1], 6);
1813
+ return { lng: d, lat: L, inline: !(d === b && L === z.lat) && !(d === c && L === p.lat) };
1814
1814
  }
1815
1815
  /**
1816
1816
  * 将route转coordinate
@@ -1922,14 +1922,14 @@ class N {
1922
1922
  const O = [];
1923
1923
  for (let A = 1; A < M.length; A++) {
1924
1924
  const b = M[A - 1], c = M[A], o = M[A + 1];
1925
- let q = !1, d = !1;
1926
- if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (q = !0, O.push(b)), c.gcToPrevious && (q || (q = !0, O.push(b)), d = !0, O.push(c), A++), o) {
1927
- const Y = N.calculateDistance(b, c, !0), L = N.calculateDistance(c, o, !0), T = N.calculateDistance(b, o, !0), U = (Math.pow(Y, 2) + Math.pow(L, 2) - Math.pow(T, 2)) / (2 * Y * L);
1928
- Math.round(Math.acos(U) * 180 / Math.PI) < p && T > z && !d && (O.push(c), A++);
1925
+ let q = !1, Y = !1;
1926
+ if ((b.velocity || b.suspend || b.important || b.pilot || A === 1) && (q = !0, O.push(b)), c.gcToPrevious && (q || (q = !0, O.push(b)), Y = !0, O.push(c), A++), o) {
1927
+ const d = N.calculateDistance(b, c, !0), L = N.calculateDistance(c, o, !0), T = N.calculateDistance(b, o, !0), U = (Math.pow(d, 2) + Math.pow(L, 2) - Math.pow(T, 2)) / (2 * d * L);
1928
+ Math.round(Math.acos(U) * 180 / Math.PI) < p && T > z && !Y && (O.push(c), A++);
1929
1929
  }
1930
1930
  if (A >= M.length - 1) {
1931
- const Y = M.at(-1);
1932
- Y && O.push(Y);
1931
+ const d = M.at(-1);
1932
+ d && O.push(d);
1933
1933
  }
1934
1934
  }
1935
1935
  return O;
@@ -1957,12 +1957,12 @@ class N {
1957
1957
  const p = C.unix(M);
1958
1958
  let O = z.find((q) => q.positionTime === p.unix());
1959
1959
  if (!O) {
1960
- const q = (b = (A = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) < p.unix())) == null ? void 0 : A.sort((Y, L) => (Y.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : b.at(-1), d = (o = (c = z.filter((Y) => (Y == null ? void 0 : Y.positionTime) > p.unix())) == null ? void 0 : c.sort((Y, L) => (Y.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : o.at(0);
1961
- if (q && d) {
1962
- const Y = N.calculateBearing(q, d, !0), L = N.calculateDistance(q, d), T = (p.unix() - q.positionTime) / (d.positionTime - q.positionTime);
1963
- O = N.calculateCoordinate(q, Y, L * T), O.positionTime = p.unix(), O.utc = p.utc().format(), O.cog = Y, O.sog = Math.round(L / ((d.positionTime - q.positionTime) / 3600) * 100) / 100;
1960
+ const q = (b = (A = z.filter((d) => (d == null ? void 0 : d.positionTime) < p.unix())) == null ? void 0 : A.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : b.at(-1), Y = (o = (c = z.filter((d) => (d == null ? void 0 : d.positionTime) > p.unix())) == null ? void 0 : c.sort((d, L) => (d.positionTime || 0) - (L.positionTime || 0))) == null ? void 0 : o.at(0);
1961
+ if (q && Y) {
1962
+ const d = N.calculateBearing(q, Y, !0), L = N.calculateDistance(q, Y), T = (p.unix() - q.positionTime) / (Y.positionTime - q.positionTime);
1963
+ O = N.calculateCoordinate(q, d, L * T), O.positionTime = p.unix(), O.utc = p.utc().format(), O.cog = d, O.sog = Math.round(L / ((Y.positionTime - q.positionTime) / 3600) * 100) / 100;
1964
1964
  } else
1965
- O = q || d, O && (O.utc = C.unix(O == null ? void 0 : O.positionTime).utc().format());
1965
+ O = q || Y, O && (O.utc = C.unix(O == null ? void 0 : O.positionTime).utc().format());
1966
1966
  }
1967
1967
  return O;
1968
1968
  }
@@ -1972,10 +1972,10 @@ class N {
1972
1972
  * @param positions
1973
1973
  */
1974
1974
  static deadReckoningTime(M, z) {
1975
- z = JSON.parse(JSON.stringify(z)), z.sort((q, d) => q.positionTime - d.positionTime);
1975
+ z = JSON.parse(JSON.stringify(z)), z.sort((q, Y) => q.positionTime - Y.positionTime);
1976
1976
  let p = Number.MAX_SAFE_INTEGER, O = Number.MAX_SAFE_INTEGER;
1977
1977
  for (let q = 0; q < z.length - 1; q++) {
1978
- const d = z[q], Y = z[q + 1], L = N.calculatePointToLineDistance(M, d, Y);
1978
+ const Y = z[q], d = z[q + 1], L = N.calculatePointToLineDistance(M, Y, d);
1979
1979
  L < p && (p = L, O = q);
1980
1980
  }
1981
1981
  const A = z[O], b = z[O + 1], c = N.calculateDistance(A, M), o = N.calculateDistance(b, M);
@@ -1984,7 +1984,7 @@ class N {
1984
1984
  else if (o === 0)
1985
1985
  M = b;
1986
1986
  else {
1987
- const q = N.nearestCoordinateInLine(M, A, b), d = A.positionTime, Y = b.positionTime, L = N.calculateDistance(A, q), T = N.calculateDistance(A, b), U = Math.round(d + (Y - d) * (L / T));
1987
+ const q = N.nearestCoordinateInLine(M, A, b), Y = A.positionTime, d = b.positionTime, L = N.calculateDistance(A, q), T = N.calculateDistance(A, b), U = Math.round(Y + (d - Y) * (L / T));
1988
1988
  M.positionTime = U;
1989
1989
  }
1990
1990
  return M.utc = M.positionTime ? C.unix(M.positionTime).utc().format() : void 0, M.positionTime ? M : void 0;
@@ -2024,39 +2024,39 @@ class t0 {
2024
2024
  for (const b of O.forecasts) {
2025
2025
  const c = [], o = C(b.date).utc(), q = `${O.name}-${b.model}`;
2026
2026
  if (A) {
2027
- const d = C(A.updated).utc(), Y = e.point([A.lng, A.lat], {
2027
+ const Y = C(A.updated).utc(), d = e.point([A.lng, A.lat], {
2028
2028
  model: b.model,
2029
2029
  name: O.name,
2030
- date: d.format(),
2030
+ date: Y.format(),
2031
2031
  hour: 0,
2032
- format: d.format("MMM-DD/HHmm[Z]"),
2032
+ format: Y.format("MMM-DD/HHmm[Z]"),
2033
2033
  pressure: A.pressure > 1e4 ? X.roundPrecision(A.pressure / 100, 0) : X.roundPrecision(A.pressure, 0),
2034
2034
  wind: A == null ? void 0 : A.wind,
2035
2035
  category: q,
2036
2036
  type: "forecast"
2037
2037
  });
2038
- z.features.push(Y), c.push(Y.geometry.coordinates);
2038
+ z.features.push(d), c.push(d.geometry.coordinates);
2039
2039
  }
2040
- for (const d in b == null ? void 0 : b.hours) {
2041
- const Y = b.hours[d];
2042
- Y.wind.spd = Y.wind.spd || Y.wind.speed;
2043
- const L = o.clone().add(Number(d), "hour"), T = e.point([Y.lng, Y.lat], {
2040
+ for (const Y in b == null ? void 0 : b.hours) {
2041
+ const d = b.hours[Y];
2042
+ d.wind.spd = d.wind.spd || d.wind.speed;
2043
+ const L = o.clone().add(Number(Y), "hour"), T = e.point([d.lng, d.lat], {
2044
2044
  model: b.model,
2045
2045
  name: O.name,
2046
2046
  date: L.format(),
2047
- hour: Number(d),
2047
+ hour: Number(Y),
2048
2048
  format: L.format("MMM-DD/HHmm[Z]"),
2049
- pressure: Y.pressure > 1e4 ? X.roundPrecision(Y.pressure / 100, 0) : X.roundPrecision(Y.pressure, 0),
2050
- gusts: Y.gusts,
2051
- wind: Y.wind || {},
2052
- movement: Y.movement,
2049
+ pressure: d.pressure > 1e4 ? X.roundPrecision(d.pressure / 100, 0) : X.roundPrecision(d.pressure, 0),
2050
+ gusts: d.gusts,
2051
+ wind: d.wind || {},
2052
+ movement: d.movement,
2053
2053
  category: q,
2054
2054
  type: "forecast"
2055
2055
  });
2056
2056
  z.features.push(T), c.push(T.geometry.coordinates);
2057
2057
  }
2058
2058
  if ((c == null ? void 0 : c.length) > 1) {
2059
- const d = e.lineString(X.convertToMonotonicLng2(c), {
2059
+ const Y = e.lineString(X.convertToMonotonicLng2(c), {
2060
2060
  date: b.date,
2061
2061
  id: O.id || O.name,
2062
2062
  model: b.model,
@@ -2064,7 +2064,7 @@ class t0 {
2064
2064
  category: q,
2065
2065
  type: "forecast"
2066
2066
  });
2067
- z.features.push(d);
2067
+ z.features.push(Y);
2068
2068
  }
2069
2069
  }
2070
2070
  }
@@ -2113,17 +2113,17 @@ class t0 {
2113
2113
  var A, b, c, o;
2114
2114
  const p = (A = M == null ? void 0 : M.data) == null ? void 0 : A.features.filter((q) => q.geometry.type === "LineString" && q.properties.type === "forecast"), O = [];
2115
2115
  for (const q of p) {
2116
- const d = q.properties.name, Y = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, U = C(q.properties.date).utc();
2116
+ const Y = q.properties.name, d = q.properties.model, L = q.properties.showCircle, T = q.properties.disabled, U = C(q.properties.date).utc();
2117
2117
  let r = z * 60 - (U.get("hour") * 60 + U.get("minute")) % (z * 60);
2118
2118
  const s = (b = M == null ? void 0 : M.data) == null ? void 0 : b.features.filter(
2119
- (l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${d}-${Y}`
2119
+ (l) => l.geometry.type === "Point" && l.properties.type === "forecast" && l.properties.category === `${Y}-${d}`
2120
2120
  );
2121
2121
  let P, I = U.clone().add(r, "minute").set({ minute: 0, second: 0, millisecond: 0 });
2122
2122
  for (; P = this.pickIndex(s, I), P <= s.length - 1; ) {
2123
2123
  if (P > 0) {
2124
2124
  const l = s[P], f = P === 0 ? void 0 : s[P - 1], G = (r / 60 - ((c = f == null ? void 0 : f.properties) == null ? void 0 : c.hour)) / (l.properties.hour - ((o = f == null ? void 0 : f.properties) == null ? void 0 : o.hour)), H = this.computeNumber(f == null ? void 0 : f.geometry.coordinates[0], l.geometry.coordinates[0], G), Q = this.computeNumber(f == null ? void 0 : f.geometry.coordinates[1], l.geometry.coordinates[1], G), F = e.point([H, Q], {
2125
- name: d,
2126
- model: Y,
2125
+ name: Y,
2126
+ model: d,
2127
2127
  category: l == null ? void 0 : l.properties.category,
2128
2128
  date: I.format(),
2129
2129
  format: I.format("MMM-DD/HHmm[Z]"),
@@ -2177,9 +2177,9 @@ class t0 {
2177
2177
  hr: c
2178
2178
  }), {};
2179
2179
  }
2180
- const q = N.calculateBearing(M, A), d = N.calculateBearing(A, b), Y = Math.abs(q - d);
2180
+ const q = N.calculateBearing(M, A), Y = N.calculateBearing(A, b), d = Math.abs(q - Y);
2181
2181
  let L = 0;
2182
- Y < 180 ? L = Y + 90 : Y >= 180 && (L = Y - 90);
2182
+ d < 180 ? L = d + 90 : d >= 180 && (L = d - 90);
2183
2183
  const T = N.calculateCoordinate(A, L, p);
2184
2184
  return Z == null || Z.info("[%s] the right tangent position: %j", O.requestId, {
2185
2185
  from: M,
@@ -2187,7 +2187,7 @@ class t0 {
2187
2187
  t2: b,
2188
2188
  radius: p,
2189
2189
  bearing1: q,
2190
- bearing2: d,
2190
+ bearing2: Y,
2191
2191
  right: T
2192
2192
  }), { at: T, t1: A, t2: b, hr: Number(c), hours: o };
2193
2193
  }
@@ -2216,8 +2216,8 @@ class t0 {
2216
2216
  hr: c
2217
2217
  }), {};
2218
2218
  }
2219
- const q = N.calculateBearing(M, A), d = N.calculateBearing(A, b), Y = N.calculateDistance(M, A);
2220
- return { at: N.calculateCoordinate(A, q - d + 180, p < Y ? p : Y), t1: A, t2: b, hr: Number(c), hours: o };
2219
+ const q = N.calculateBearing(M, A), Y = N.calculateBearing(A, b), d = N.calculateDistance(M, A);
2220
+ return { at: N.calculateCoordinate(A, q - Y + 180, p < d ? p : d), t1: A, t2: b, hr: Number(c), hours: o };
2221
2221
  } else
2222
2222
  return Z == null || Z.info("[%s] no need drift: %j", O.requestId, { from: M, t1: A, t2: b, hr: c }), {};
2223
2223
  }
@@ -2230,12 +2230,12 @@ class t0 {
2230
2230
  * @private
2231
2231
  */
2232
2232
  static tropicalCenterTwin(M, z = 24, p = {}) {
2233
- var d, Y, L, T, U;
2233
+ var Y, d, L, T, U;
2234
2234
  let O = {};
2235
- (d = M.forecasts) == null || d.forEach((r) => {
2235
+ (Y = M.forecasts) == null || Y.forEach((r) => {
2236
2236
  O = { ...r.hours, ...O };
2237
2237
  });
2238
- const A = ((Y = M == null ? void 0 : M.history) == null ? void 0 : Y[0]) || (O == null ? void 0 : O[(L = Object.keys(O)) == null ? void 0 : L[0]]);
2238
+ const A = ((d = M == null ? void 0 : M.history) == null ? void 0 : d[0]) || (O == null ? void 0 : O[(L = Object.keys(O)) == null ? void 0 : L[0]]);
2239
2239
  Z == null || Z.info("[%s] the first tropical center: %j", p.requestId, A);
2240
2240
  let b = (T = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : z))) == null ? void 0 : T.at(-1);
2241
2241
  b || (b = (U = Object.keys(O || {}).filter((r) => Number(r) <= (z < 0 ? 24 : 2 * z))) == null ? void 0 : U.at(-1));
@@ -2277,7 +2277,7 @@ class V0 {
2277
2277
  return `${M.lat}|${M.lng}|${M.positionTime}|${M.sog}|${M.cog}|${M.hdg}|${M.draught}|${z}|${JSON.stringify(M.meteo || {})}|${M.vendor}|${M.deleted}`;
2278
2278
  }
2279
2279
  static str2Json(M) {
2280
- const [z, p, O, A, b, c, o, q, d, Y, L] = M.split("|");
2280
+ const [z, p, O, A, b, c, o, q, Y, d, L] = M.split("|");
2281
2281
  return {
2282
2282
  lat: Number(z),
2283
2283
  lng: Number(p),
@@ -2289,8 +2289,8 @@ class V0 {
2289
2289
  draught: isNaN(o) ? null : Number(o),
2290
2290
  type: q,
2291
2291
  important: q !== "A",
2292
- meteo: d ? JSON.parse(d) : void 0,
2293
- vendor: Y,
2292
+ meteo: Y ? JSON.parse(Y) : void 0,
2293
+ vendor: d,
2294
2294
  deleted: L === "true"
2295
2295
  };
2296
2296
  }
@@ -2302,20 +2302,20 @@ class V0 {
2302
2302
  for (let o = 0; o < M.length - 1; o++) {
2303
2303
  const q = M[o];
2304
2304
  if (!(p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))) {
2305
- for (let d = o + 1; d < M.length; d++) {
2306
- const Y = M[d - 1], L = M[d];
2305
+ for (let Y = o + 1; Y < M.length; Y++) {
2306
+ const d = M[Y - 1], L = M[Y];
2307
2307
  if (p && ["N", "B", "E", "NOON", "BOSP", "EOSP"].includes(q.type))
2308
2308
  continue;
2309
- const T = L.positionTime - Y.positionTime;
2310
- if (N.calculateDistance(L, Y, !0, 4) / (T / 3600) < z)
2311
- b || (b = q), d === M.length - 1 && (c = L, o = d);
2309
+ const T = L.positionTime - d.positionTime;
2310
+ if (N.calculateDistance(L, d, !0, 4) / (T / 3600) < z)
2311
+ b || (b = q), Y === M.length - 1 && (c = L, o = Y);
2312
2312
  else {
2313
- b && (c = M[d - 1], o = d);
2313
+ b && (c = M[Y - 1], o = Y);
2314
2314
  break;
2315
2315
  }
2316
2316
  }
2317
2317
  if ((c == null ? void 0 : c.positionTime) > (b == null ? void 0 : b.positionTime) && b) {
2318
- const d = {
2318
+ const Y = {
2319
2319
  start: {
2320
2320
  lat: b.lat,
2321
2321
  lng: b.lng,
@@ -2331,8 +2331,8 @@ class V0 {
2331
2331
  utc: C.unix(c.positionTime).utc().format()
2332
2332
  },
2333
2333
  duration: c.positionTime - b.positionTime
2334
- }, Y = M.filter((T) => T.positionTime >= d.start.positionTime && T.positionTime <= d.end.positionTime), L = N.divideAccordingToLng(Y);
2335
- d.distance = N.calculateRouteDistance(L), d.hours = Math.round(d.duration / 3600 * 10) / 10, d.avgSog = Math.round(d.distance / d.hours * 10) / 10, A.push(d);
2334
+ }, d = M.filter((T) => T.positionTime >= Y.start.positionTime && T.positionTime <= Y.end.positionTime), L = N.divideAccordingToLng(d);
2335
+ Y.distance = N.calculateRouteDistance(L), Y.hours = Math.round(Y.duration / 3600 * 10) / 10, Y.avgSog = Math.round(Y.distance / Y.hours * 10) / 10, A.push(Y);
2336
2336
  }
2337
2337
  b = void 0, c = void 0;
2338
2338
  }