@idm-plugin/geo 1.4.5 → 1.4.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
@@ -53,11 +53,11 @@ class l {
53
53
  return i = i > 9 ? i : `0${i}`, e = e > 9 ? e : `0${e}`, t > 0 ? `+${e}:${i}` : `-${e}:${i}`;
54
54
  }
55
55
  static lng2pretty(t, e = 6, i = "H°M′") {
56
- t = l.convertToStdLng(t, e);
56
+ e = e < 6 ? 6 : e, t = l.convertToStdLng(t, e);
57
57
  let s = "E";
58
58
  t < 0 && (s = "W"), t = Math.abs(t), i = i.toUpperCase();
59
59
  let o = t * 3600, n, r, c, a, d, u;
60
- n = o % 3600 % 60, i.indexOf("S") !== -1 && (o = o - n, r = l.padNumber(n, 2, 2)), c = o / 60 % 60, i.indexOf("M") !== -1 && (i.indexOf("S") !== -1 ? a = l.roundPrecision(c, e).toString().padStart(2, "0") : a = l.padNumber(c, 2, 2), o = o - c * 60), d = o / 3600, i.indexOf("M") !== -1 ? u = l.roundPrecision(d, e).toString().padStart(3, "0") : u = l.padNumber(d, 3, 2);
60
+ n = o % 3600 % 60, i.indexOf("S") !== -1 && (o = o - n, r = l.padNumber(n, 2, 2)), c = o / 60 % 60, i.indexOf("M") !== -1 && (i.indexOf("S") !== -1 ? a = l.roundPrecision(c, e).toString().padStart(2, "0") : a = l.padNumber(c, 2, 2), o = o - c * 60), d = o / 3600, i.indexOf("M") !== -1 ? u = l.roundPrecision(d, e).toString().padStart(3, "0") : u = l.padNumber(d, 3, 2), Number(r) >= 60 && (a = Number(a) + 1, r = 0), Number(a) >= 60 && (u = Number(u) + 1, a = 0);
61
61
  const f = `${i.replace(/S+/gi, r).replace(/M+/gi, a).replace(/H+/gi, u)}${s}`;
62
62
  return {
63
63
  direction: s,
@@ -74,11 +74,11 @@ class l {
74
74
  * @param format 格式化
75
75
  */
76
76
  static lat2pretty(t, e = 6, i = "H°M′") {
77
- t = t % 180;
77
+ e = e < 6 ? 6 : e, t = t % 180;
78
78
  let s = "N";
79
79
  t < 0 && (s = "S"), t = Math.abs(t), i = i.toUpperCase();
80
80
  let o = t * 3600, n, r, c, a, d, u;
81
- n = o % 3600 % 60, i.indexOf("S") !== -1 && (o = o - n, r = l.padNumber(n, 2, 2)), c = o / 60 % 60, i.indexOf("M") !== -1 && (i.indexOf("S") !== -1 ? a = l.roundPrecision(c, e).toString().padStart(2, "0") : a = l.padNumber(c, 2, 2), o = o - c * 60), d = o / 3600, i.indexOf("M") !== -1 ? u = l.roundPrecision(d, e).toString().padStart(2, "0") : u = l.padNumber(d, 2, 2);
81
+ n = o % 3600 % 60, i.indexOf("S") !== -1 && (o = o - n, r = l.padNumber(n, 2, 2)), c = o / 60 % 60, i.indexOf("M") !== -1 && (i.indexOf("S") !== -1 ? a = l.roundPrecision(c, e).toString().padStart(2, "0") : a = l.padNumber(c, 2, 2), o = o - c * 60), d = o / 3600, i.indexOf("M") !== -1 ? u = l.roundPrecision(d, e).toString().padStart(2, "0") : u = l.padNumber(d, 2, 2), Number(r) >= 60 && (a = Number(a) + 1, r = 0), Number(a) >= 60 && (u = Number(u) + 1, a = 0);
82
82
  const f = `${i.replace(/S+/gi, r).replace(/M+/gi, a).replace(/H+/gi, u)}${s}`;
83
83
  return {
84
84
  direction: s,
@@ -178,8 +178,8 @@ class l {
178
178
  * @param dcmPrecision 小数位数
179
179
  */
180
180
  static padNumber(t, e = 2, i = 2) {
181
- const s = Math.trunc(t).toString().padStart(e, "0"), o = Math.trunc(l.roundPrecision(t - Math.trunc(t), i) * Math.pow(10, i)).toString().padStart(i, "0");
182
- return `${s}.${o}`;
181
+ const s = l.roundPrecision(t - Math.trunc(t), i), o = s >= 1 ? Math.trunc(t + 1).toString().padStart(e, "0") : Math.trunc(t).toString().padStart(e, "0");
182
+ return s >= 1 ? o : `${o}.${Math.trunc(s * Math.pow(10, i)).toString().padStart(i, "0")}`;
183
183
  }
184
184
  }
185
185
  class b {
@@ -635,9 +635,9 @@ class b {
635
635
  m.push(h[M]);
636
636
  else {
637
637
  S = { lng: h[M][0], lat: h[M][1] };
638
- const D = this.calculateDistance(t, S, !0, 8, s);
639
- if (a += D, a < e)
640
- d += D, n.push(S), t = S;
638
+ const N = this.calculateDistance(t, S, !0, 8, s);
639
+ if (a += N, a < e)
640
+ d += N, n.push(S), t = S;
641
641
  else {
642
642
  if (d = e, a === e)
643
643
  u = S, m.push([u.lng, u.lat]);
@@ -920,27 +920,27 @@ class q {
920
920
  const S = (n = t == null ? void 0 : t.data) == null ? void 0 : n.features.filter(
921
921
  (v) => v.geometry.type === "Point" && v.properties.type === "forecast" && v.properties.category === `${d}-${u}`
922
922
  );
923
- let M, D = T.clone().add(m, "minute").set({ minute: 0, second: 0, millisecond: 0 });
924
- for (; M = this.pickIndex(S, D), M <= S.length - 1; ) {
923
+ let M, N = T.clone().add(m, "minute").set({ minute: 0, second: 0, millisecond: 0 });
924
+ for (; M = this.pickIndex(S, N), M <= S.length - 1; ) {
925
925
  if (M > 0) {
926
- const v = S[M], p = M === 0 ? void 0 : S[M - 1], N = (m / 60 - ((r = p == null ? void 0 : p.properties) == null ? void 0 : r.hour)) / (v.properties.hour - ((c = p == null ? void 0 : p.properties) == null ? void 0 : c.hour)), I = this.computeNumber(p == null ? void 0 : p.geometry.coordinates[0], v.geometry.coordinates[0], N), $ = this.computeNumber(p == null ? void 0 : p.geometry.coordinates[1], v.geometry.coordinates[1], N), W = g.point([I, $], {
926
+ const v = S[M], p = M === 0 ? void 0 : S[M - 1], D = (m / 60 - ((r = p == null ? void 0 : p.properties) == null ? void 0 : r.hour)) / (v.properties.hour - ((c = p == null ? void 0 : p.properties) == null ? void 0 : c.hour)), I = this.computeNumber(p == null ? void 0 : p.geometry.coordinates[0], v.geometry.coordinates[0], D), $ = this.computeNumber(p == null ? void 0 : p.geometry.coordinates[1], v.geometry.coordinates[1], D), W = g.point([I, $], {
927
927
  name: d,
928
928
  model: u,
929
929
  category: v == null ? void 0 : v.properties.category,
930
- date: D.format(),
931
- format: D.format("MMM-DD/HHmm[Z]"),
932
- gusts: this.computeNumber(p == null ? void 0 : p.properties.gusts, v.properties.gusts, N),
933
- hour: this.computeNumber(p == null ? void 0 : p.properties.hour, v.properties.hour, N),
934
- movement: this.computeNumber(p == null ? void 0 : p.properties.movement, v.properties.movement, N),
935
- pressure: this.computeNumber(p == null ? void 0 : p.properties.pressure, v.properties.pressure, N),
936
- wind: this.computeNumber(p == null ? void 0 : p.properties.wind, v.properties.wind, N),
930
+ date: N.format(),
931
+ format: N.format("MMM-DD/HHmm[Z]"),
932
+ gusts: this.computeNumber(p == null ? void 0 : p.properties.gusts, v.properties.gusts, D),
933
+ hour: this.computeNumber(p == null ? void 0 : p.properties.hour, v.properties.hour, D),
934
+ movement: this.computeNumber(p == null ? void 0 : p.properties.movement, v.properties.movement, D),
935
+ pressure: this.computeNumber(p == null ? void 0 : p.properties.pressure, v.properties.pressure, D),
936
+ wind: this.computeNumber(p == null ? void 0 : p.properties.wind, v.properties.wind, D),
937
937
  type: "forecast",
938
938
  disabled: h,
939
939
  showCircle: f
940
940
  });
941
941
  s.push(W);
942
942
  }
943
- m += e * 60, D = T.clone().add(m, "minute").set({ minute: 0, second: 0, millisecond: 0 });
943
+ m += e * 60, N = T.clone().add(m, "minute").set({ minute: 0, second: 0, millisecond: 0 });
944
944
  }
945
945
  }
946
946
  return s;
@@ -1 +1 @@
1
- (function(M,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("@turf/turf"),require("moment"),require("moment-timezone"),require("tz-lookup")):typeof define=="function"&&define.amd?define(["exports","@turf/turf","moment","moment-timezone","tz-lookup"],x):(M=typeof globalThis<"u"?globalThis:M||self,x(M["idm-plugin-rabbitmq"]={},M["@turf/turf"],M.moment,M["moment-timezone"],M["tz-lookup"]))})(this,function(M,x,N,q,j){"use strict";function W(v){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const e in v)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(v,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>v[e]})}}return t.default=v,Object.freeze(t)}const g=W(x);function O(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}class I{log(){}isLevelEnabled(){return!1}addContext(){}removeContext(){}clearContext(){}}["Trace","Debug","Info","Warn","Error","Fatal","Mark"].forEach(v=>{I.prototype[v.toLowerCase()]=()=>{},I.prototype[`is${v}Enabled`]=()=>!1});const $=(()=>{try{return require("log4js")}catch{return null}})();var k={getLogger:$?$.getLogger:()=>new I};const A=O(k);class l{static guessTimeZoneOffset(t,e){const n=j(e,t),s=N().tz(n).utcOffset();return this.roundPrecision(s/60,1)}static prettyTimeZoneOffset(t){let e=Math.floor(Math.abs(t)),n=Math.round((Math.abs(t)-e)*60);return n=n>9?n:`0${n}`,e=e>9?e:`0${e}`,t>0?`+${e}:${n}`:`-${e}:${n}`}static lng2pretty(t,e=6,n="H°M′"){t=l.convertToStdLng(t,e);let s="E";t<0&&(s="W"),t=Math.abs(t),n=n.toUpperCase();let o=t*3600,i,r,c,a,d,u;i=o%3600%60,n.indexOf("S")!==-1&&(o=o-i,r=l.padNumber(i,2,2)),c=o/60%60,n.indexOf("M")!==-1&&(n.indexOf("S")!==-1?a=l.roundPrecision(c,e).toString().padStart(2,"0"):a=l.padNumber(c,2,2),o=o-c*60),d=o/3600,n.indexOf("M")!==-1?u=l.roundPrecision(d,e).toString().padStart(3,"0"):u=l.padNumber(d,3,2);const f=`${n.replace(/S+/gi,r).replace(/M+/gi,a).replace(/H+/gi,u)}${s}`;return{direction:s,degree:l.roundPrecision(d,e),minute:l.roundPrecision(c,e),second:l.roundPrecision(i,e),pretty:f}}static lat2pretty(t,e=6,n="H°M′"){t=t%180;let s="N";t<0&&(s="S"),t=Math.abs(t),n=n.toUpperCase();let o=t*3600,i,r,c,a,d,u;i=o%3600%60,n.indexOf("S")!==-1&&(o=o-i,r=l.padNumber(i,2,2)),c=o/60%60,n.indexOf("M")!==-1&&(n.indexOf("S")!==-1?a=l.roundPrecision(c,e).toString().padStart(2,"0"):a=l.padNumber(c,2,2),o=o-c*60),d=o/3600,n.indexOf("M")!==-1?u=l.roundPrecision(d,e).toString().padStart(2,"0"):u=l.padNumber(d,2,2);const f=`${n.replace(/S+/gi,r).replace(/M+/gi,a).replace(/H+/gi,u)}${s}`;return{direction:s,degree:l.roundPrecision(d,e),minute:l.roundPrecision(c,e),second:l.roundPrecision(i,e),pretty:f}}static str2Lng(t,e=6){let n;if(isNaN(t)){t=l.strReplace(t,"LNG");const s=t[t.length-1].toUpperCase();t=t.substring(0,t.length-1).trim();const o=t.split(" ").filter(c=>c!=="").map(c=>Number(c));let[i,r]=o;if(r=r>60?r/Math.pow(10,String(r).length-2):r,i>360&&!r){const c=this.roundPrecision(i/100,0);r=i-c*100,i=c}n=i+(r??0)/60,s==="W"&&(n=n*-1)}else n=Number(t);return l.convertToStdLng(n,e)}static str2Lat(t,e=6){let n;if(isNaN(t)){t=l.strReplace(t,"LAT");const s=t[t.length-1].toUpperCase();t=t.substring(0,t.length-1).trim();const o=t.split(" ").filter(c=>c!=="").map(c=>Number(c));let[i,r]=o;if(r=r>60?r/Math.pow(10,String(r).length-2):r,i>90&&!r){const c=this.roundPrecision(i/100,0);r=i-c*100,i=c}n=i+(r??0)/60,s==="S"&&(n=n*-1)}else n=Number(t);return l.roundPrecision(n,e)}static str2LngOrLat(t,e=6,n="LAT"){t=l.strReplace(t,n);const s=t[t.length-1].toUpperCase();return["N","S"].includes(s)?{lat:l.str2Lat(t,e)}:{lng:l.str2Lng(t,e)}}static convertToStdLng(t,e=6){return t>180?(t=t%360,t=t>180?t-360:t):t<-180&&(t=t%360,t=t<-180?t+360:t),l.roundPrecision(t,e)}static roundPrecision(t,e=4){if(typeof t=="number"){const n=Number("1".padEnd(e+1,"0"));return Math.round(t*n)/n}return t}static convertToMonotonicLng2(t){for(let e=1;e<t.length;e++)t[e][0]+=Math.round((t[e-1][0]-t[e][0])/360)*360;return t}static convertToMonotonicLng(t){for(let e=1;e<t.length;e++)t[e].lng+=Math.round((t[e-1].lng-t[e].lng)/360)*360;return t}static strReplace(t,e="LAT"){t=t.replace(/([0-9]+)\.([0-9]+\.[0-9]+)/g,"$1 $2").replace(/-/g," ").replace(/°/," ").replace(/'/g," ").replace(/′/g," ").replace(/"/g," ").replace(/∼/g," ").replace(/°/g," ").replace(/,/g,".").replace(/^ /g,"").replace(/ $/g,"").trim();const n=t[t.length-1].toUpperCase();if(!["N","S","E","W"].includes(n)){const s=t,o=Number(s.split(" ")[0]);if(isNaN(o))throw new Error(`invalid Lat/Lng: ${t}`);o>=90?t=`${s}E`:o<=-90?t=`${s}W`:["LAN","LNG"].includes(e==null?void 0:e.toUpperCase())?t=`${s}${o>0?"E":"W"}`:t=`${s}${o>0?"N":"S"}`}return t}static padNumber(t,e=2,n=2){const s=Math.trunc(t).toString().padStart(e,"0"),o=Math.trunc(l.roundPrecision(t-Math.trunc(t),n)*Math.pow(10,n)).toString().padStart(n,"0");return`${s}.${o}`}}class b{static calculateBearing(t,e,n=!0,s=4){const o=g.points([[t.lng,t.lat],[e.lng,e.lat]]);let i;return n?i=g.rhumbBearing(o.features[0],o.features[1]):i=g.bearing(o.features[0],o.features[1]),i<0&&(i+=360),l.roundPrecision(i,s)}static calculateDistance(t,e,n=!0,s=4,o="nauticalmiles"){t={...t},e={...e},t.lng=l.convertToStdLng(t.lng,s),e.lng=l.convertToStdLng(e.lng,s);const i=g.points([[t.lng,t.lat],[e.lng,e.lat]]);let r;return n?r=g.rhumbDistance(i.features[0],i.features[1],{units:o}):r=g.distance(i.features[0],i.features[1],{units:o}),l.roundPrecision(r,s)}static calculateRouteDistance(t,e=4,n="nauticalmiles"){let s=0,o;for(const i of t)for(let r=0;r<i.length-1;r++){const c={lng:i[r][0],lat:i[r][1]};r===0&&o&&(s+=this.calculateDistance(o,c,!0,e,n));const a={lng:i[r+1][0],lat:i[r+1][1]};s+=this.calculateDistance(c,a,!0,e,n),o=a}return l.roundPrecision(s,e)}static calculateCoordinate(t,e,n,s="nauticalmiles",o=!0){const i=g.point([t.lng,t.lat]);let r;o?r=g.rhumbDestination(i,n,e,{units:s}):r=g.destination(i,n,e,{units:s});const c=r.geometry.coordinates;return{lng:l.convertToStdLng(c[0],8),lat:l.roundPrecision(c[1],8)}}static interpolateCoordinates(t,e,n,s=!0,o=!0,i="nauticalmiles"){const r=[],c=this.calculateBearing(t,e,!1),a=this.calculateDistance(t,e,!1,8,i);s&&r.push({lng:t.lng,lat:t.lat});let d=0;for(;d<a;)d+=n,d<a&&r.push(this.calculateCoordinate(t,c,d,i,!1));return o&&r.push({lng:e.lng,lat:e.lat}),r}static divideAccordingToLng(t,e=!1){if((t==null?void 0:t.length)<2)return[];t=this.deduplicateCoordinates(t);let n=[];const s=[];let o,i;for(let r=0;r<t.length-1;r++){o=l.convertToStdLng(t[r].lng,8),i=l.convertToStdLng(t[r+1].lng,8),t[r].lat=l.roundPrecision(t[r].lat,8),t[r+1].lat=l.roundPrecision(t[r+1].lat,8),n.push([o,t[r].lat]);const c=o-i;if(Math.abs(c)>180){const a=l.convertToMonotonicLng2([[o,t[r].lat],[i,t[r+1].lat]]);let d,u;e?(d=g.lineString(a),u=g.lineString([[c>0?180:-180,89],[c>0?180:-180,-89]])):(d=g.greatCircle(a[0],a[1]),u=g.greatCircle([c>0?180:-180,89],[c>0?180:-180,-89]));const f=g.lineIntersect(d,u);let h;if(f.features.length){const P=g.getCoord(f.features[0]);h=l.roundPrecision(P[1],8)}else h=t[r].lat;c>0?(n.push([180-1e-6,h]),s.push([...n]),n=[],n.push([-(180-1e-6),h])):(n.push([-(180-1e-6),h]),s.push([...n]),n=[],n.push([180-1e-6,h]))}r===t.length-2&&n.push([i,t[r+1].lat])}return s.push(n),s}static deduplicateRoute(t){const e=[];for(const n of t){const s=n.reduce((o,i)=>(o.findIndex(r=>r[0]===i[0]&&r[1]===i[1])===-1&&o.push(i),o),[]);e.push(s)}return e}static deduplicateCoordinates(t){return t.reduce((e,n)=>(e.findIndex(s=>s.lat===n.lat&&s.lng===n.lng)===-1&&e.push(n),e),[])}static removeCoordinateFromRoute(t,e){t.lng=l.convertToStdLng(t.lng,8);for(const n of e)for(let s=n.length-1;s>=0;s--)l.roundPrecision(n[s][0],8)===t.lng&&l.roundPrecision(n[s][1],8)===l.roundPrecision(t.lat,8)&&n.splice(s,1);return e}static removeCoordinateFromWaypoints(t,e){t.lng=l.convertToStdLng(t.lng,8);for(let n=e.length-1;n>=0;n--)l.roundPrecision(e[n].lng,8)===t.lng&&l.roundPrecision(e[n].lat,8)===l.roundPrecision(t.lat,8)&&e.splice(n,1);return e}static mergeCoordinateToRoute(t,e){t.lng=l.convertToStdLng(t.lng,8);let n=Number.MAX_VALUE,s=0,o=0,i,r;return e.forEach((c,a)=>{for(let d=0;d<c.length-1;d++){const u={lng:c[d][0],lat:c[d][1]},f={lng:c[d+1][0],lat:c[d+1][1]},h=this.calculatePointToLineDistance(t,u,f);n>h&&(n=h,o=d,s=a,i=this.calculateDistance(u,t),r=this.calculateDistance(f,t))}}),i!==0&&r!==0?e[s].splice(o+1,0,[t.lng,t.lat]):i===0?e[s].splice(o,1,[t.lng,t.lat]):r===0&&e[s].splice(o+1,1,[t.lng,t.lat]),e}static appendCoordinateToRoute(t,e){t.lng=l.convertToStdLng(t.lng,8);const n=b.convertRouteToCoordinates(e);return n.push(t),b.divideAccordingToLng(n)}static unshiftCoordinateToRoute(t,e){const n=b.convertRouteToCoordinates(e);return n.unshift(t),b.divideAccordingToLng(n)}static mergeWaypointsToRoute(t,e){for(const n of t)e=this.mergeCoordinateToRoute(n,e);return e}static calculateRangeRoute(t,e,n){n=this.mergeWaypointsToRoute([t,e],n);const s=[];let o=0;return n.forEach(i=>{if(o===2)return;const r=[];for(const c of i){if(l.roundPrecision(e.lng,8)===l.roundPrecision(c[0],8)&&l.roundPrecision(e.lat,8)===l.roundPrecision(c[1],8)){r.push(c),o===0&&r.push([t.lng,t.lat]),o=2;break}o===1?r.push(c):l.roundPrecision(t.lng,8)===l.roundPrecision(c[0],8)&&l.roundPrecision(t.lat,8)===l.roundPrecision(c[1],8)&&(o=1,r.push(c))}r.length&&s.push(r)}),s}static calculateRangeWaypoints(t,e,n,s=[]){const o=this.convertRouteToCoordinates(n,0),i=this.mergeCoordinatesToWaypoints([t,e,...s],o),r=i.findIndex(d=>l.roundPrecision(t.lng,8)===l.roundPrecision(d.lng,8)&&l.roundPrecision(t.lat,8)===l.roundPrecision(d.lat,8)),c=i.findIndex(d=>l.roundPrecision(e.lng,8)===l.roundPrecision(d.lng,8)&&l.roundPrecision(e.lat,8)===l.roundPrecision(d.lat,8));return i.filter((d,u)=>u>=r&&u<=c)}static calculateMinDistanceToRoute(t,e){let n=Number.MAX_VALUE,s=0,o=0;return e.forEach((i,r)=>{for(let c=0;c<i.length-1;c++){const a={lng:i[c][0],lat:i[c][1]},d={lng:i[c+1][0],lat:i[c+1][1]},u=this.calculatePointToLineDistance(t,a,d);n>u&&(n=u,s=c,o=r)}}),{minDist:n,segIndex:o,minIndex:s}}static calculateSubRoute(t,e){const n=b.convertRouteToCoordinates(e);b.mergeCoordinateToWaypoints(t,n,!0),e=b.divideAccordingToLng(n);const{segIndex:s,minIndex:o}=this.calculateMinDistanceToRoute({...t},e);t.lng=l.convertToStdLng(t.lng);const i=[];let r=!0;for(let c=s;c<e.length;c++)if(r){const a=[];a.push([t.lng,t.lat]);for(let d=o+1;d<e[c].length;d++)t.lng===e[c][d][0]&&t.lat===e[c][d][1]||a.push(e[c][d]);i.push(a),r=!1}else i.push([...e[c]]);return i}static calculateSubWaypoints(t,e){let n=Number.MAX_VALUE,s=0;for(let i=0;i<e.length-1;i++){const r=e[i],c=e[i+1];if(this.calculateDistance(t,r)===0)return e;if(this.calculateDistance(t,c)===0)return e.filter((d,u)=>u>0);const a=this.calculatePointToLineDistance(t,r,c);n>a&&(n=a,s=i)}t.lng=l.convertToStdLng(t.lng);const o=[t];for(let i=s+1;i<e.length;i++)o.push(e[i]);return o}static calculatePointToLineDistance(t,e,n,s={units:"nauticalmiles",method:"geodesic"}){t.lng=l.convertToStdLng(t.lng,8),e={...e},n={...n},e.lng=l.convertToStdLng(e.lng,8),n.lng=l.convertToStdLng(n.lng,8);const o=l.convertToMonotonicLng([e,n]);e=o[0],n=o[1];const i=g.lineString([[e.lng,e.lat],[n.lng,n.lat]]),r=g.pointToLineDistance(g.point([t.lng,t.lat]),i,s),c=g.pointToLineDistance(g.point([t.lng>0?t.lng-360:t.lng+360,t.lat]),i,s);return l.roundPrecision(Math.min(r,c),6)}static calculateWaypointsPropInRoute(t,e){e=this.mergeWaypointsToRoute(t,e);for(let n=0;n<t.length-1;n++){const s=t[n],o=t[n+1],i=this.calculateRangeRoute(s,o,e);n===0&&(s.distanceFromPrevious=0,s.distanceFromStart=0),o.distanceFromPrevious=this.calculateRouteDistance(i),o.distanceFromStart=l.roundPrecision((s.distanceFromStart||0)+o.distanceFromPrevious)}return t}static mergeCoordinatesToWaypoints(t,e,n=!0){for(const s of t)this.mergeCoordinateToWaypoints(s,e,n);return e}static mergeCoordinateToWaypoints(t,e,n=!0){t.lng=l.convertToStdLng(t.lng,8);let s=Number.MAX_VALUE,o=0,i=0,r=0;for(let c=0;c<e.length-1;c++){const a={lng:e[c].lng,lat:e[c].lat},d={lng:e[c+1].lng,lat:e[c+1].lat},u=this.calculatePointToLineDistance(t,a,d);s>=u&&(s=u,o=c,i=this.calculateDistance(a,t,!1,6),r=this.calculateDistance(d,t,!1,6))}return i!==0&&r!==0?i<s||i===s&&o===0?e.unshift(t):r<s||r===s&&o===e.length-2?e.push(t):e.splice(o+1,0,t):i===0?n&&e.splice(o,1,t):r===0&&n&&e.splice(o+1,1,t),e.map(c=>(c.lng=l.convertToStdLng(c.lng),c))}static generateRouteAccordingToWaypoints(t){const e=[];for(let n=1;n<t.length;n++){const s=t[n-1],o=t[n];if(n===1&&e.push(s),o.gcToPrevious){const i=this.interpolateCoordinates(s,o,200,!1,!0,"nauticalmiles");e.push(...i)}else e.push(o)}return this.divideAccordingToLng(e,!0)}static nearestCoordinateInRoute(t,e){const n=g.point([t.lng,t.lat]),o=this.convertRouteToCoordinates(e).map(a=>[a.lng,a.lat]),i=g.lineString(o),r=g.nearestPointOnLine(i,n),c=g.getCoord(r);return{lng:l.roundPrecision(c[0],8),lat:l.roundPrecision(c[1],8)}}static calculatePrevWaypoint(t,e){let n=0;this.mergeCoordinateToWaypoints(t,e);for(let s=0;s<e.length-1;s++){const o=e[s],i=e[s+1];if(this.calculateDistance(t,o)===0){n=s;break}if(this.calculateDistance(t,i)===0){n=s+1;break}}return e[n===0?0:n-1]}static calculateNextCoordinateAlongRoute(t,e,n,s="nauticalmiles"){var f;const o=t.speed||12,i=[];let r=[],c=!1,a=0,d=0,u;if(e&&n.length?(i.push(t),n.forEach((h,P)=>{if(c)r.push(h);else{const m=[];let C;for(let D=0;D<h.length;D++)if(u)m.push(h[D]);else{C={lng:h[D][0],lat:h[D][1]};const y=this.calculateDistance(t,C,!0,8,s);if(a+=y,a<e)d+=y,i.push(C),t=C;else{if(d=e,a===e)u=C,m.push([u.lng,u.lat]);else{const S=a-e,p=this.calculateBearing(C,t);u=this.calculateCoordinate(C,p,S,s),m.push([u.lng,u.lat]),m.push([C.lng,C.lat])}c=!0}}m.length&&r.push(m),P===n.length-1&&!u&&(u=C)}})):(r=n,u={...t}),u)if(i.push(u),u.distanceFromPrevious=d,u.hourFromPrevious=Math.round(d/o*1e4)/1e4,((f=r[0])==null?void 0:f.length)>1){const h={lng:r[0][1][0],lat:r[0][1][1]};u.bearing=this.calculateBearing(u,h)}else u.bearing=0;return{coordinate:u,nextRoute:r,prevRoute:i}}static nearestCoordinateInLine(t,e,n){const s=l.convertToStdLng(t.lng,6),o=g.point([s,t.lat]),i=l.convertToStdLng(e.lng,6),r=l.convertToStdLng(n.lng,6),c=g.lineString([[i,e.lat],[r,n.lat]]),a=g.nearestPointOnLine(c,o),d=g.getCoord(a),u=l.roundPrecision(d[0],6),f=l.roundPrecision(d[1],6);return{lng:u,lat:f,inline:!(u===i&&f===e.lat)&&!(u===r&&f===n.lat)}}static convertRouteToCoordinates(t,e=0){const n=[];let s,o;return t.forEach(i=>{i.forEach(r=>{const c={lng:l.roundPrecision(r[0],8),lat:l.roundPrecision(r[1],8)};if(!o)n.push(c),o=c;else if(o.bearing===void 0)o.bearing=this.calculateBearing(o,c,!0);else{const a=this.calculateDistance(s,c,!0);a&&a>=e&&(s.bearing=this.calculateBearing(s,c,!0),n.push(s),o=s)}s=c})}),s&&n.push(s),n}static simplifyRouteToCoordinates(t,e,n=1){let s=this.convertRouteToCoordinates(t,n);return s=this.simplifyGCCoordinates(s,e),s}static simplifyGCCoordinates(t,e){e.forEach(s=>{this.mergeCoordinateToWaypoints(s,t,!0)});for(let s=1;s<e.length;s++){const o=e[s-1],i=e[s];if(i.gcToPrevious){const r=t.findIndex(a=>a.lng===o.lng&&a.lat===o.lat),c=t.findIndex(a=>a.lng===i.lng&&a.lat===i.lat);for(let a=c-1;a>r;a--)t.splice(a,1)}}let n=0;for(let s=1;s<t.length;s++){const o=t[s-1],i=t[s];i.gcToPrevious?(o.bearing=this.calculateBearing(o,i,!1),i.distanceFromPrevious=this.calculateDistance(o,i,!1)):(o.bearing=this.calculateBearing(o,i,!0),i.distanceFromPrevious=this.calculateDistance(o,i,!0)),n=l.roundPrecision(n+i.distanceFromPrevious),i.distanceFromStart=n}return t.map(s=>(s.lng=l.convertToStdLng(s.lng),s))}static calculateCenter(t){const e=[];for(const r of t)for(const c of r)e.push(c);const n=g.featureCollection([]),s=l.convertToMonotonicLng2(e);for(const r of s)n.features.push(g.point(r));const i=g.center(n).geometry.coordinates;return{lng:l.convertToStdLng(i[0],8),lat:l.roundPrecision(i[1],8)}}static calculateCenter2(t){const e=this.generateRouteAccordingToWaypoints(t);return this.calculateCenter(e)}static calculateBBox(t){const e=[];for(const o of t)for(const i of o)e.push(i);const n=l.convertToMonotonicLng2(e),s=g.lineString(n);return g.bbox(s)}static calculateBBox2(t){const e=this.generateRouteAccordingToWaypoints(t);return this.calculateBBox(e)}static simplifyCoordinates(t,e=10,n=160){const s=[];for(let o=1;o<t.length;o++){const i=t[o-1],r=t[o],c=t[o+1];let a=!1,d=!1;if((i.velocity||i.suspend||i.important||i.pilot||o===1)&&(a=!0,s.push(i)),r.gcToPrevious&&(a||(a=!0,s.push(i)),d=!0,s.push(r),o++),c){const u=b.calculateDistance(i,r,!0),f=b.calculateDistance(r,c,!0),h=b.calculateDistance(i,c,!0),P=(Math.pow(u,2)+Math.pow(f,2)-Math.pow(h,2))/(2*u*f);Math.round(Math.acos(P)*180/Math.PI)<n&&h>e&&!d&&(s.push(r),o++)}if(o>=t.length-1){const u=t.at(-1);u&&s.push(u)}}return s}static nearestTSPointInWaypoints(t,e,n){const s=N.unix(t),o=n.filter(i=>s.clone().subtract(e,"hour").unix()<=(i.positionTime||0)&&s.clone().add(e,"h").unix()>=(i.positionTime||0));return o.sort((i,r)=>(i.positionTime||0)-(r.positionTime||0)),o.at(-1)}}let T;try{T=A.getLogger("vessel")}catch{}finally{}class E{static convert2Geojson(t){var n;const e=g.featureCollection([]);for(const s of t){if(s.forecasts){const o=(n=s.history)==null?void 0:n[0];for(const i of s.forecasts){const r=[],c=N(i.date).utc(),a=`${s.name}-${i.model}`;if(o){const d=N(o.updated).utc(),u=g.point([o.lng,o.lat],{model:i.model,name:s.name,date:d.format(),hour:0,format:d.format("MMM-DD/HHmm[Z]"),pressure:o.pressure>1e4?l.roundPrecision(o.pressure/100,0):l.roundPrecision(o.pressure,0),wind:o==null?void 0:o.wind,category:a,type:"forecast"});e.features.push(u),r.push(u.geometry.coordinates)}for(const d in i==null?void 0:i.hours){const u=i.hours[d];u.wind.spd=u.wind.spd||u.wind.speed;const f=c.clone().add(Number(d),"hour"),h=g.point([u.lng,u.lat],{model:i.model,name:s.name,date:f.format(),hour:Number(d),format:f.format("MMM-DD/HHmm[Z]"),pressure:u.pressure>1e4?l.roundPrecision(u.pressure/100,0):l.roundPrecision(u.pressure,0),gusts:u.gusts,wind:u.wind||{},movement:u.movement,category:a,type:"forecast"});e.features.push(h),r.push(h.geometry.coordinates)}if((r==null?void 0:r.length)>1){const d=g.lineString(l.convertToMonotonicLng2(r),{date:i.date,id:s.id||s.name,model:i.model,name:s.name,category:a,type:"forecast"});e.features.push(d)}}}if(s.history){const o=[];for(const r of s.history){const c=N(r.updated).utc(),a=g.point([r.lng,r.lat],{name:s.name,date:c.format(),format:c.format("MMM-DD/HHmm[Z]"),pressure:r.pressure>1e4?l.roundPrecision(r.pressure/100,0):l.roundPrecision(r.pressure,0),spd:r.speed||r.spd,kts:r.kts,source:r.source,level:r.type,type:"history",category:`${s.name}-history`,wind:r.wind});e.features.push(a),o.push(a.geometry.coordinates)}const i=s.history[0];if(o.length===1&&o.push(o[0]),o.length>1){const r=g.lineString(l.convertToMonotonicLng2(o),{name:s.name,type:"history",updated:i==null?void 0:i.updated,pressure:(i==null?void 0:i.pressure)>1e4?l.roundPrecision((i==null?void 0:i.pressure)/100,0):l.roundPrecision(i==null?void 0:i.pressure,0),spd:(i==null?void 0:i.speed)||(i==null?void 0:i.spd),kts:i==null?void 0:i.kts,source:i==null?void 0:i.source,level:i==null?void 0:i.type});e.features.push(r)}}}return e}static interpolate(t,e=3){var o,i,r,c;const n=(o=t==null?void 0:t.data)==null?void 0:o.features.filter(a=>a.geometry.type==="LineString"&&a.properties.type==="forecast"),s=[];for(const a of n){const d=a.properties.name,u=a.properties.model,f=a.properties.showCircle,h=a.properties.disabled,P=N(a.properties.date).utc();let m=e*60-(P.get("hour")*60+P.get("minute"))%(e*60);const C=(i=t==null?void 0:t.data)==null?void 0:i.features.filter(S=>S.geometry.type==="Point"&&S.properties.type==="forecast"&&S.properties.category===`${d}-${u}`);let D,y=P.clone().add(m,"minute").set({minute:0,second:0,millisecond:0});for(;D=this.pickIndex(C,y),D<=C.length-1;){if(D>0){const S=C[D],p=D===0?void 0:C[D-1],R=(m/60-((r=p==null?void 0:p.properties)==null?void 0:r.hour))/(S.properties.hour-((c=p==null?void 0:p.properties)==null?void 0:c.hour)),F=this.computeNumber(p==null?void 0:p.geometry.coordinates[0],S.geometry.coordinates[0],R),L=this.computeNumber(p==null?void 0:p.geometry.coordinates[1],S.geometry.coordinates[1],R),B=g.point([F,L],{name:d,model:u,category:S==null?void 0:S.properties.category,date:y.format(),format:y.format("MMM-DD/HHmm[Z]"),gusts:this.computeNumber(p==null?void 0:p.properties.gusts,S.properties.gusts,R),hour:this.computeNumber(p==null?void 0:p.properties.hour,S.properties.hour,R),movement:this.computeNumber(p==null?void 0:p.properties.movement,S.properties.movement,R),pressure:this.computeNumber(p==null?void 0:p.properties.pressure,S.properties.pressure,R),wind:this.computeNumber(p==null?void 0:p.properties.wind,S.properties.wind,R),type:"forecast",disabled:h,showCircle:f});s.push(B)}m+=e*60,y=P.clone().add(m,"minute").set({minute:0,second:0,millisecond:0})}}return s}static accelPassageAt(t,e){const{t1:n,t2:s,hr:o,hours:i}=this.tropicalCenterTwin(t,24,e);return{t1:n,t2:s,hr:o,hours:i}}static diversionPassageAt(t,e,n,s={}){const{t1:o,t2:i,hr:r,hours:c}=this.tropicalCenterTwin(e,24,s);if(o&&i){if(!s.debug){const P=b.calculateDistance(t,o),m=b.calculateDistance(t,i);if(P>2*n&&m>2*n)return T==null||T.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j",s.requestId,P,m,{from:t,t1:o,t2:i,hr:r}),{}}const a=b.calculateBearing(t,o),d=b.calculateBearing(o,i),u=Math.abs(a-d);let f=0;u<180?f=u+90:u>=180&&(f=u-90);const h=b.calculateCoordinate(o,f,n);return T==null||T.info("[%s] the right tangent position: %j",s.requestId,{from:t,t1:o,t2:i,radius:n,bearing1:a,bearing2:d,right:h}),{at:h,t1:o,t2:i,hr:Number(r),hours:c}}return{}}static driftPassageAt(t,e,n,s={}){const{t1:o,t2:i,hr:r,hours:c}=this.tropicalCenterTwin(e,24,s);if(o&&i){if(!s.debug){const h=b.calculateDistance(t,o),P=b.calculateDistance(t,i);if(h>2*n&&P>2*n)return T==null||T.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j",s.requestId,h,P,{from:t,t1:o,t2:i,hr:r}),{}}const a=b.calculateBearing(t,o),d=b.calculateBearing(o,i),u=b.calculateDistance(t,o);return{at:b.calculateCoordinate(o,a-d+180,n<u?n:u),t1:o,t2:i,hr:Number(r),hours:c}}else return T==null||T.info("[%s] no need drift: %j",s.requestId,{from:t,t1:o,t2:i,hr:r}),{}}static tropicalCenterTwin(t,e=24,n={}){var d,u,f,h,P;let s={};(d=t.forecasts)==null||d.forEach(m=>{s={...m.hours,...s}});const o=((u=t==null?void 0:t.history)==null?void 0:u[0])||(s==null?void 0:s[(f=Object.keys(s))==null?void 0:f[0]]);T==null||T.info("[%s] the first tropical center: %j",n.requestId,o);let i=(h=Object.keys(s||{}).filter(m=>Number(m)<=(e<0?24:e)))==null?void 0:h.at(-1);i||(i=(P=Object.keys(s||{}).filter(m=>Number(m)<=(e<0?24:2*e)))==null?void 0:P.at(-1));const r=s==null?void 0:s[i||-1];T==null||T.info("[%s] the second tropical center: %j in %d hrs",n.requestId,r,i);const c=Object.keys(s||{}).filter(m=>Number(m)<=Number(i)),a={0:o};for(const m of c)a[m]=s[m];return{t1:o,t2:r,hr:Number(i),hours:a}}static pickIndex(t,e){let n=0;for(const s of t){if(N(s.properties.date).isAfter(e))return n===0?-1:n;n++}return n}static computeNumber(t,e,n){if(t)if(e){if(isNaN(t)&&isNaN(e)&&typeof t!="string"&&typeof e!="string"){const s={};for(const o in t)s[o]=this.computeNumber(t[o],e[o],n);return s}return Math.round((t+(e-t)*n)*100)/100}else return t;else return e}}M.LaneHelper=b,M.LngLatHelper=l,M.TropicalHelper=E,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
1
+ (function(C,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("@turf/turf"),require("moment"),require("moment-timezone"),require("tz-lookup")):typeof define=="function"&&define.amd?define(["exports","@turf/turf","moment","moment-timezone","tz-lookup"],x):(C=typeof globalThis<"u"?globalThis:C||self,x(C["idm-plugin-rabbitmq"]={},C["@turf/turf"],C.moment,C["moment-timezone"],C["tz-lookup"]))})(this,function(C,x,D,q,j){"use strict";function W(v){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const e in v)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(v,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>v[e]})}}return t.default=v,Object.freeze(t)}const g=W(x);function O(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}class I{log(){}isLevelEnabled(){return!1}addContext(){}removeContext(){}clearContext(){}}["Trace","Debug","Info","Warn","Error","Fatal","Mark"].forEach(v=>{I.prototype[v.toLowerCase()]=()=>{},I.prototype[`is${v}Enabled`]=()=>!1});const $=(()=>{try{return require("log4js")}catch{return null}})();var k={getLogger:$?$.getLogger:()=>new I};const A=O(k);class l{static guessTimeZoneOffset(t,e){const n=j(e,t),s=D().tz(n).utcOffset();return this.roundPrecision(s/60,1)}static prettyTimeZoneOffset(t){let e=Math.floor(Math.abs(t)),n=Math.round((Math.abs(t)-e)*60);return n=n>9?n:`0${n}`,e=e>9?e:`0${e}`,t>0?`+${e}:${n}`:`-${e}:${n}`}static lng2pretty(t,e=6,n="H°M′"){e=e<6?6:e,t=l.convertToStdLng(t,e);let s="E";t<0&&(s="W"),t=Math.abs(t),n=n.toUpperCase();let o=t*3600,i,r,c,a,d,u;i=o%3600%60,n.indexOf("S")!==-1&&(o=o-i,r=l.padNumber(i,2,2)),c=o/60%60,n.indexOf("M")!==-1&&(n.indexOf("S")!==-1?a=l.roundPrecision(c,e).toString().padStart(2,"0"):a=l.padNumber(c,2,2),o=o-c*60),d=o/3600,n.indexOf("M")!==-1?u=l.roundPrecision(d,e).toString().padStart(3,"0"):u=l.padNumber(d,3,2),Number(r)>=60&&(a=Number(a)+1,r=0),Number(a)>=60&&(u=Number(u)+1,a=0);const h=`${n.replace(/S+/gi,r).replace(/M+/gi,a).replace(/H+/gi,u)}${s}`;return{direction:s,degree:l.roundPrecision(d,e),minute:l.roundPrecision(c,e),second:l.roundPrecision(i,e),pretty:h}}static lat2pretty(t,e=6,n="H°M′"){e=e<6?6:e,t=t%180;let s="N";t<0&&(s="S"),t=Math.abs(t),n=n.toUpperCase();let o=t*3600,i,r,c,a,d,u;i=o%3600%60,n.indexOf("S")!==-1&&(o=o-i,r=l.padNumber(i,2,2)),c=o/60%60,n.indexOf("M")!==-1&&(n.indexOf("S")!==-1?a=l.roundPrecision(c,e).toString().padStart(2,"0"):a=l.padNumber(c,2,2),o=o-c*60),d=o/3600,n.indexOf("M")!==-1?u=l.roundPrecision(d,e).toString().padStart(2,"0"):u=l.padNumber(d,2,2),Number(r)>=60&&(a=Number(a)+1,r=0),Number(a)>=60&&(u=Number(u)+1,a=0);const h=`${n.replace(/S+/gi,r).replace(/M+/gi,a).replace(/H+/gi,u)}${s}`;return{direction:s,degree:l.roundPrecision(d,e),minute:l.roundPrecision(c,e),second:l.roundPrecision(i,e),pretty:h}}static str2Lng(t,e=6){let n;if(isNaN(t)){t=l.strReplace(t,"LNG");const s=t[t.length-1].toUpperCase();t=t.substring(0,t.length-1).trim();const o=t.split(" ").filter(c=>c!=="").map(c=>Number(c));let[i,r]=o;if(r=r>60?r/Math.pow(10,String(r).length-2):r,i>360&&!r){const c=this.roundPrecision(i/100,0);r=i-c*100,i=c}n=i+(r??0)/60,s==="W"&&(n=n*-1)}else n=Number(t);return l.convertToStdLng(n,e)}static str2Lat(t,e=6){let n;if(isNaN(t)){t=l.strReplace(t,"LAT");const s=t[t.length-1].toUpperCase();t=t.substring(0,t.length-1).trim();const o=t.split(" ").filter(c=>c!=="").map(c=>Number(c));let[i,r]=o;if(r=r>60?r/Math.pow(10,String(r).length-2):r,i>90&&!r){const c=this.roundPrecision(i/100,0);r=i-c*100,i=c}n=i+(r??0)/60,s==="S"&&(n=n*-1)}else n=Number(t);return l.roundPrecision(n,e)}static str2LngOrLat(t,e=6,n="LAT"){t=l.strReplace(t,n);const s=t[t.length-1].toUpperCase();return["N","S"].includes(s)?{lat:l.str2Lat(t,e)}:{lng:l.str2Lng(t,e)}}static convertToStdLng(t,e=6){return t>180?(t=t%360,t=t>180?t-360:t):t<-180&&(t=t%360,t=t<-180?t+360:t),l.roundPrecision(t,e)}static roundPrecision(t,e=4){if(typeof t=="number"){const n=Number("1".padEnd(e+1,"0"));return Math.round(t*n)/n}return t}static convertToMonotonicLng2(t){for(let e=1;e<t.length;e++)t[e][0]+=Math.round((t[e-1][0]-t[e][0])/360)*360;return t}static convertToMonotonicLng(t){for(let e=1;e<t.length;e++)t[e].lng+=Math.round((t[e-1].lng-t[e].lng)/360)*360;return t}static strReplace(t,e="LAT"){t=t.replace(/([0-9]+)\.([0-9]+\.[0-9]+)/g,"$1 $2").replace(/-/g," ").replace(/°/," ").replace(/'/g," ").replace(/′/g," ").replace(/"/g," ").replace(/∼/g," ").replace(/°/g," ").replace(/,/g,".").replace(/^ /g,"").replace(/ $/g,"").trim();const n=t[t.length-1].toUpperCase();if(!["N","S","E","W"].includes(n)){const s=t,o=Number(s.split(" ")[0]);if(isNaN(o))throw new Error(`invalid Lat/Lng: ${t}`);o>=90?t=`${s}E`:o<=-90?t=`${s}W`:["LAN","LNG"].includes(e==null?void 0:e.toUpperCase())?t=`${s}${o>0?"E":"W"}`:t=`${s}${o>0?"N":"S"}`}return t}static padNumber(t,e=2,n=2){const s=l.roundPrecision(t-Math.trunc(t),n),o=s>=1?Math.trunc(t+1).toString().padStart(e,"0"):Math.trunc(t).toString().padStart(e,"0");return s>=1?o:`${o}.${Math.trunc(s*Math.pow(10,n)).toString().padStart(n,"0")}`}}class b{static calculateBearing(t,e,n=!0,s=4){const o=g.points([[t.lng,t.lat],[e.lng,e.lat]]);let i;return n?i=g.rhumbBearing(o.features[0],o.features[1]):i=g.bearing(o.features[0],o.features[1]),i<0&&(i+=360),l.roundPrecision(i,s)}static calculateDistance(t,e,n=!0,s=4,o="nauticalmiles"){t={...t},e={...e},t.lng=l.convertToStdLng(t.lng,s),e.lng=l.convertToStdLng(e.lng,s);const i=g.points([[t.lng,t.lat],[e.lng,e.lat]]);let r;return n?r=g.rhumbDistance(i.features[0],i.features[1],{units:o}):r=g.distance(i.features[0],i.features[1],{units:o}),l.roundPrecision(r,s)}static calculateRouteDistance(t,e=4,n="nauticalmiles"){let s=0,o;for(const i of t)for(let r=0;r<i.length-1;r++){const c={lng:i[r][0],lat:i[r][1]};r===0&&o&&(s+=this.calculateDistance(o,c,!0,e,n));const a={lng:i[r+1][0],lat:i[r+1][1]};s+=this.calculateDistance(c,a,!0,e,n),o=a}return l.roundPrecision(s,e)}static calculateCoordinate(t,e,n,s="nauticalmiles",o=!0){const i=g.point([t.lng,t.lat]);let r;o?r=g.rhumbDestination(i,n,e,{units:s}):r=g.destination(i,n,e,{units:s});const c=r.geometry.coordinates;return{lng:l.convertToStdLng(c[0],8),lat:l.roundPrecision(c[1],8)}}static interpolateCoordinates(t,e,n,s=!0,o=!0,i="nauticalmiles"){const r=[],c=this.calculateBearing(t,e,!1),a=this.calculateDistance(t,e,!1,8,i);s&&r.push({lng:t.lng,lat:t.lat});let d=0;for(;d<a;)d+=n,d<a&&r.push(this.calculateCoordinate(t,c,d,i,!1));return o&&r.push({lng:e.lng,lat:e.lat}),r}static divideAccordingToLng(t,e=!1){if((t==null?void 0:t.length)<2)return[];t=this.deduplicateCoordinates(t);let n=[];const s=[];let o,i;for(let r=0;r<t.length-1;r++){o=l.convertToStdLng(t[r].lng,8),i=l.convertToStdLng(t[r+1].lng,8),t[r].lat=l.roundPrecision(t[r].lat,8),t[r+1].lat=l.roundPrecision(t[r+1].lat,8),n.push([o,t[r].lat]);const c=o-i;if(Math.abs(c)>180){const a=l.convertToMonotonicLng2([[o,t[r].lat],[i,t[r+1].lat]]);let d,u;e?(d=g.lineString(a),u=g.lineString([[c>0?180:-180,89],[c>0?180:-180,-89]])):(d=g.greatCircle(a[0],a[1]),u=g.greatCircle([c>0?180:-180,89],[c>0?180:-180,-89]));const h=g.lineIntersect(d,u);let f;if(h.features.length){const P=g.getCoord(h.features[0]);f=l.roundPrecision(P[1],8)}else f=t[r].lat;c>0?(n.push([180-1e-6,f]),s.push([...n]),n=[],n.push([-(180-1e-6),f])):(n.push([-(180-1e-6),f]),s.push([...n]),n=[],n.push([180-1e-6,f]))}r===t.length-2&&n.push([i,t[r+1].lat])}return s.push(n),s}static deduplicateRoute(t){const e=[];for(const n of t){const s=n.reduce((o,i)=>(o.findIndex(r=>r[0]===i[0]&&r[1]===i[1])===-1&&o.push(i),o),[]);e.push(s)}return e}static deduplicateCoordinates(t){return t.reduce((e,n)=>(e.findIndex(s=>s.lat===n.lat&&s.lng===n.lng)===-1&&e.push(n),e),[])}static removeCoordinateFromRoute(t,e){t.lng=l.convertToStdLng(t.lng,8);for(const n of e)for(let s=n.length-1;s>=0;s--)l.roundPrecision(n[s][0],8)===t.lng&&l.roundPrecision(n[s][1],8)===l.roundPrecision(t.lat,8)&&n.splice(s,1);return e}static removeCoordinateFromWaypoints(t,e){t.lng=l.convertToStdLng(t.lng,8);for(let n=e.length-1;n>=0;n--)l.roundPrecision(e[n].lng,8)===t.lng&&l.roundPrecision(e[n].lat,8)===l.roundPrecision(t.lat,8)&&e.splice(n,1);return e}static mergeCoordinateToRoute(t,e){t.lng=l.convertToStdLng(t.lng,8);let n=Number.MAX_VALUE,s=0,o=0,i,r;return e.forEach((c,a)=>{for(let d=0;d<c.length-1;d++){const u={lng:c[d][0],lat:c[d][1]},h={lng:c[d+1][0],lat:c[d+1][1]},f=this.calculatePointToLineDistance(t,u,h);n>f&&(n=f,o=d,s=a,i=this.calculateDistance(u,t),r=this.calculateDistance(h,t))}}),i!==0&&r!==0?e[s].splice(o+1,0,[t.lng,t.lat]):i===0?e[s].splice(o,1,[t.lng,t.lat]):r===0&&e[s].splice(o+1,1,[t.lng,t.lat]),e}static appendCoordinateToRoute(t,e){t.lng=l.convertToStdLng(t.lng,8);const n=b.convertRouteToCoordinates(e);return n.push(t),b.divideAccordingToLng(n)}static unshiftCoordinateToRoute(t,e){const n=b.convertRouteToCoordinates(e);return n.unshift(t),b.divideAccordingToLng(n)}static mergeWaypointsToRoute(t,e){for(const n of t)e=this.mergeCoordinateToRoute(n,e);return e}static calculateRangeRoute(t,e,n){n=this.mergeWaypointsToRoute([t,e],n);const s=[];let o=0;return n.forEach(i=>{if(o===2)return;const r=[];for(const c of i){if(l.roundPrecision(e.lng,8)===l.roundPrecision(c[0],8)&&l.roundPrecision(e.lat,8)===l.roundPrecision(c[1],8)){r.push(c),o===0&&r.push([t.lng,t.lat]),o=2;break}o===1?r.push(c):l.roundPrecision(t.lng,8)===l.roundPrecision(c[0],8)&&l.roundPrecision(t.lat,8)===l.roundPrecision(c[1],8)&&(o=1,r.push(c))}r.length&&s.push(r)}),s}static calculateRangeWaypoints(t,e,n,s=[]){const o=this.convertRouteToCoordinates(n,0),i=this.mergeCoordinatesToWaypoints([t,e,...s],o),r=i.findIndex(d=>l.roundPrecision(t.lng,8)===l.roundPrecision(d.lng,8)&&l.roundPrecision(t.lat,8)===l.roundPrecision(d.lat,8)),c=i.findIndex(d=>l.roundPrecision(e.lng,8)===l.roundPrecision(d.lng,8)&&l.roundPrecision(e.lat,8)===l.roundPrecision(d.lat,8));return i.filter((d,u)=>u>=r&&u<=c)}static calculateMinDistanceToRoute(t,e){let n=Number.MAX_VALUE,s=0,o=0;return e.forEach((i,r)=>{for(let c=0;c<i.length-1;c++){const a={lng:i[c][0],lat:i[c][1]},d={lng:i[c+1][0],lat:i[c+1][1]},u=this.calculatePointToLineDistance(t,a,d);n>u&&(n=u,s=c,o=r)}}),{minDist:n,segIndex:o,minIndex:s}}static calculateSubRoute(t,e){const n=b.convertRouteToCoordinates(e);b.mergeCoordinateToWaypoints(t,n,!0),e=b.divideAccordingToLng(n);const{segIndex:s,minIndex:o}=this.calculateMinDistanceToRoute({...t},e);t.lng=l.convertToStdLng(t.lng);const i=[];let r=!0;for(let c=s;c<e.length;c++)if(r){const a=[];a.push([t.lng,t.lat]);for(let d=o+1;d<e[c].length;d++)t.lng===e[c][d][0]&&t.lat===e[c][d][1]||a.push(e[c][d]);i.push(a),r=!1}else i.push([...e[c]]);return i}static calculateSubWaypoints(t,e){let n=Number.MAX_VALUE,s=0;for(let i=0;i<e.length-1;i++){const r=e[i],c=e[i+1];if(this.calculateDistance(t,r)===0)return e;if(this.calculateDistance(t,c)===0)return e.filter((d,u)=>u>0);const a=this.calculatePointToLineDistance(t,r,c);n>a&&(n=a,s=i)}t.lng=l.convertToStdLng(t.lng);const o=[t];for(let i=s+1;i<e.length;i++)o.push(e[i]);return o}static calculatePointToLineDistance(t,e,n,s={units:"nauticalmiles",method:"geodesic"}){t.lng=l.convertToStdLng(t.lng,8),e={...e},n={...n},e.lng=l.convertToStdLng(e.lng,8),n.lng=l.convertToStdLng(n.lng,8);const o=l.convertToMonotonicLng([e,n]);e=o[0],n=o[1];const i=g.lineString([[e.lng,e.lat],[n.lng,n.lat]]),r=g.pointToLineDistance(g.point([t.lng,t.lat]),i,s),c=g.pointToLineDistance(g.point([t.lng>0?t.lng-360:t.lng+360,t.lat]),i,s);return l.roundPrecision(Math.min(r,c),6)}static calculateWaypointsPropInRoute(t,e){e=this.mergeWaypointsToRoute(t,e);for(let n=0;n<t.length-1;n++){const s=t[n],o=t[n+1],i=this.calculateRangeRoute(s,o,e);n===0&&(s.distanceFromPrevious=0,s.distanceFromStart=0),o.distanceFromPrevious=this.calculateRouteDistance(i),o.distanceFromStart=l.roundPrecision((s.distanceFromStart||0)+o.distanceFromPrevious)}return t}static mergeCoordinatesToWaypoints(t,e,n=!0){for(const s of t)this.mergeCoordinateToWaypoints(s,e,n);return e}static mergeCoordinateToWaypoints(t,e,n=!0){t.lng=l.convertToStdLng(t.lng,8);let s=Number.MAX_VALUE,o=0,i=0,r=0;for(let c=0;c<e.length-1;c++){const a={lng:e[c].lng,lat:e[c].lat},d={lng:e[c+1].lng,lat:e[c+1].lat},u=this.calculatePointToLineDistance(t,a,d);s>=u&&(s=u,o=c,i=this.calculateDistance(a,t,!1,6),r=this.calculateDistance(d,t,!1,6))}return i!==0&&r!==0?i<s||i===s&&o===0?e.unshift(t):r<s||r===s&&o===e.length-2?e.push(t):e.splice(o+1,0,t):i===0?n&&e.splice(o,1,t):r===0&&n&&e.splice(o+1,1,t),e.map(c=>(c.lng=l.convertToStdLng(c.lng),c))}static generateRouteAccordingToWaypoints(t){const e=[];for(let n=1;n<t.length;n++){const s=t[n-1],o=t[n];if(n===1&&e.push(s),o.gcToPrevious){const i=this.interpolateCoordinates(s,o,200,!1,!0,"nauticalmiles");e.push(...i)}else e.push(o)}return this.divideAccordingToLng(e,!0)}static nearestCoordinateInRoute(t,e){const n=g.point([t.lng,t.lat]),o=this.convertRouteToCoordinates(e).map(a=>[a.lng,a.lat]),i=g.lineString(o),r=g.nearestPointOnLine(i,n),c=g.getCoord(r);return{lng:l.roundPrecision(c[0],8),lat:l.roundPrecision(c[1],8)}}static calculatePrevWaypoint(t,e){let n=0;this.mergeCoordinateToWaypoints(t,e);for(let s=0;s<e.length-1;s++){const o=e[s],i=e[s+1];if(this.calculateDistance(t,o)===0){n=s;break}if(this.calculateDistance(t,i)===0){n=s+1;break}}return e[n===0?0:n-1]}static calculateNextCoordinateAlongRoute(t,e,n,s="nauticalmiles"){var h;const o=t.speed||12,i=[];let r=[],c=!1,a=0,d=0,u;if(e&&n.length?(i.push(t),n.forEach((f,P)=>{if(c)r.push(f);else{const m=[];let M;for(let N=0;N<f.length;N++)if(u)m.push(f[N]);else{M={lng:f[N][0],lat:f[N][1]};const y=this.calculateDistance(t,M,!0,8,s);if(a+=y,a<e)d+=y,i.push(M),t=M;else{if(d=e,a===e)u=M,m.push([u.lng,u.lat]);else{const S=a-e,p=this.calculateBearing(M,t);u=this.calculateCoordinate(M,p,S,s),m.push([u.lng,u.lat]),m.push([M.lng,M.lat])}c=!0}}m.length&&r.push(m),P===n.length-1&&!u&&(u=M)}})):(r=n,u={...t}),u)if(i.push(u),u.distanceFromPrevious=d,u.hourFromPrevious=Math.round(d/o*1e4)/1e4,((h=r[0])==null?void 0:h.length)>1){const f={lng:r[0][1][0],lat:r[0][1][1]};u.bearing=this.calculateBearing(u,f)}else u.bearing=0;return{coordinate:u,nextRoute:r,prevRoute:i}}static nearestCoordinateInLine(t,e,n){const s=l.convertToStdLng(t.lng,6),o=g.point([s,t.lat]),i=l.convertToStdLng(e.lng,6),r=l.convertToStdLng(n.lng,6),c=g.lineString([[i,e.lat],[r,n.lat]]),a=g.nearestPointOnLine(c,o),d=g.getCoord(a),u=l.roundPrecision(d[0],6),h=l.roundPrecision(d[1],6);return{lng:u,lat:h,inline:!(u===i&&h===e.lat)&&!(u===r&&h===n.lat)}}static convertRouteToCoordinates(t,e=0){const n=[];let s,o;return t.forEach(i=>{i.forEach(r=>{const c={lng:l.roundPrecision(r[0],8),lat:l.roundPrecision(r[1],8)};if(!o)n.push(c),o=c;else if(o.bearing===void 0)o.bearing=this.calculateBearing(o,c,!0);else{const a=this.calculateDistance(s,c,!0);a&&a>=e&&(s.bearing=this.calculateBearing(s,c,!0),n.push(s),o=s)}s=c})}),s&&n.push(s),n}static simplifyRouteToCoordinates(t,e,n=1){let s=this.convertRouteToCoordinates(t,n);return s=this.simplifyGCCoordinates(s,e),s}static simplifyGCCoordinates(t,e){e.forEach(s=>{this.mergeCoordinateToWaypoints(s,t,!0)});for(let s=1;s<e.length;s++){const o=e[s-1],i=e[s];if(i.gcToPrevious){const r=t.findIndex(a=>a.lng===o.lng&&a.lat===o.lat),c=t.findIndex(a=>a.lng===i.lng&&a.lat===i.lat);for(let a=c-1;a>r;a--)t.splice(a,1)}}let n=0;for(let s=1;s<t.length;s++){const o=t[s-1],i=t[s];i.gcToPrevious?(o.bearing=this.calculateBearing(o,i,!1),i.distanceFromPrevious=this.calculateDistance(o,i,!1)):(o.bearing=this.calculateBearing(o,i,!0),i.distanceFromPrevious=this.calculateDistance(o,i,!0)),n=l.roundPrecision(n+i.distanceFromPrevious),i.distanceFromStart=n}return t.map(s=>(s.lng=l.convertToStdLng(s.lng),s))}static calculateCenter(t){const e=[];for(const r of t)for(const c of r)e.push(c);const n=g.featureCollection([]),s=l.convertToMonotonicLng2(e);for(const r of s)n.features.push(g.point(r));const i=g.center(n).geometry.coordinates;return{lng:l.convertToStdLng(i[0],8),lat:l.roundPrecision(i[1],8)}}static calculateCenter2(t){const e=this.generateRouteAccordingToWaypoints(t);return this.calculateCenter(e)}static calculateBBox(t){const e=[];for(const o of t)for(const i of o)e.push(i);const n=l.convertToMonotonicLng2(e),s=g.lineString(n);return g.bbox(s)}static calculateBBox2(t){const e=this.generateRouteAccordingToWaypoints(t);return this.calculateBBox(e)}static simplifyCoordinates(t,e=10,n=160){const s=[];for(let o=1;o<t.length;o++){const i=t[o-1],r=t[o],c=t[o+1];let a=!1,d=!1;if((i.velocity||i.suspend||i.important||i.pilot||o===1)&&(a=!0,s.push(i)),r.gcToPrevious&&(a||(a=!0,s.push(i)),d=!0,s.push(r),o++),c){const u=b.calculateDistance(i,r,!0),h=b.calculateDistance(r,c,!0),f=b.calculateDistance(i,c,!0),P=(Math.pow(u,2)+Math.pow(h,2)-Math.pow(f,2))/(2*u*h);Math.round(Math.acos(P)*180/Math.PI)<n&&f>e&&!d&&(s.push(r),o++)}if(o>=t.length-1){const u=t.at(-1);u&&s.push(u)}}return s}static nearestTSPointInWaypoints(t,e,n){const s=D.unix(t),o=n.filter(i=>s.clone().subtract(e,"hour").unix()<=(i.positionTime||0)&&s.clone().add(e,"h").unix()>=(i.positionTime||0));return o.sort((i,r)=>(i.positionTime||0)-(r.positionTime||0)),o.at(-1)}}let T;try{T=A.getLogger("vessel")}catch{}finally{}class E{static convert2Geojson(t){var n;const e=g.featureCollection([]);for(const s of t){if(s.forecasts){const o=(n=s.history)==null?void 0:n[0];for(const i of s.forecasts){const r=[],c=D(i.date).utc(),a=`${s.name}-${i.model}`;if(o){const d=D(o.updated).utc(),u=g.point([o.lng,o.lat],{model:i.model,name:s.name,date:d.format(),hour:0,format:d.format("MMM-DD/HHmm[Z]"),pressure:o.pressure>1e4?l.roundPrecision(o.pressure/100,0):l.roundPrecision(o.pressure,0),wind:o==null?void 0:o.wind,category:a,type:"forecast"});e.features.push(u),r.push(u.geometry.coordinates)}for(const d in i==null?void 0:i.hours){const u=i.hours[d];u.wind.spd=u.wind.spd||u.wind.speed;const h=c.clone().add(Number(d),"hour"),f=g.point([u.lng,u.lat],{model:i.model,name:s.name,date:h.format(),hour:Number(d),format:h.format("MMM-DD/HHmm[Z]"),pressure:u.pressure>1e4?l.roundPrecision(u.pressure/100,0):l.roundPrecision(u.pressure,0),gusts:u.gusts,wind:u.wind||{},movement:u.movement,category:a,type:"forecast"});e.features.push(f),r.push(f.geometry.coordinates)}if((r==null?void 0:r.length)>1){const d=g.lineString(l.convertToMonotonicLng2(r),{date:i.date,id:s.id||s.name,model:i.model,name:s.name,category:a,type:"forecast"});e.features.push(d)}}}if(s.history){const o=[];for(const r of s.history){const c=D(r.updated).utc(),a=g.point([r.lng,r.lat],{name:s.name,date:c.format(),format:c.format("MMM-DD/HHmm[Z]"),pressure:r.pressure>1e4?l.roundPrecision(r.pressure/100,0):l.roundPrecision(r.pressure,0),spd:r.speed||r.spd,kts:r.kts,source:r.source,level:r.type,type:"history",category:`${s.name}-history`,wind:r.wind});e.features.push(a),o.push(a.geometry.coordinates)}const i=s.history[0];if(o.length===1&&o.push(o[0]),o.length>1){const r=g.lineString(l.convertToMonotonicLng2(o),{name:s.name,type:"history",updated:i==null?void 0:i.updated,pressure:(i==null?void 0:i.pressure)>1e4?l.roundPrecision((i==null?void 0:i.pressure)/100,0):l.roundPrecision(i==null?void 0:i.pressure,0),spd:(i==null?void 0:i.speed)||(i==null?void 0:i.spd),kts:i==null?void 0:i.kts,source:i==null?void 0:i.source,level:i==null?void 0:i.type});e.features.push(r)}}}return e}static interpolate(t,e=3){var o,i,r,c;const n=(o=t==null?void 0:t.data)==null?void 0:o.features.filter(a=>a.geometry.type==="LineString"&&a.properties.type==="forecast"),s=[];for(const a of n){const d=a.properties.name,u=a.properties.model,h=a.properties.showCircle,f=a.properties.disabled,P=D(a.properties.date).utc();let m=e*60-(P.get("hour")*60+P.get("minute"))%(e*60);const M=(i=t==null?void 0:t.data)==null?void 0:i.features.filter(S=>S.geometry.type==="Point"&&S.properties.type==="forecast"&&S.properties.category===`${d}-${u}`);let N,y=P.clone().add(m,"minute").set({minute:0,second:0,millisecond:0});for(;N=this.pickIndex(M,y),N<=M.length-1;){if(N>0){const S=M[N],p=N===0?void 0:M[N-1],R=(m/60-((r=p==null?void 0:p.properties)==null?void 0:r.hour))/(S.properties.hour-((c=p==null?void 0:p.properties)==null?void 0:c.hour)),F=this.computeNumber(p==null?void 0:p.geometry.coordinates[0],S.geometry.coordinates[0],R),L=this.computeNumber(p==null?void 0:p.geometry.coordinates[1],S.geometry.coordinates[1],R),B=g.point([F,L],{name:d,model:u,category:S==null?void 0:S.properties.category,date:y.format(),format:y.format("MMM-DD/HHmm[Z]"),gusts:this.computeNumber(p==null?void 0:p.properties.gusts,S.properties.gusts,R),hour:this.computeNumber(p==null?void 0:p.properties.hour,S.properties.hour,R),movement:this.computeNumber(p==null?void 0:p.properties.movement,S.properties.movement,R),pressure:this.computeNumber(p==null?void 0:p.properties.pressure,S.properties.pressure,R),wind:this.computeNumber(p==null?void 0:p.properties.wind,S.properties.wind,R),type:"forecast",disabled:f,showCircle:h});s.push(B)}m+=e*60,y=P.clone().add(m,"minute").set({minute:0,second:0,millisecond:0})}}return s}static accelPassageAt(t,e){const{t1:n,t2:s,hr:o,hours:i}=this.tropicalCenterTwin(t,24,e);return{t1:n,t2:s,hr:o,hours:i}}static diversionPassageAt(t,e,n,s={}){const{t1:o,t2:i,hr:r,hours:c}=this.tropicalCenterTwin(e,24,s);if(o&&i){if(!s.debug){const P=b.calculateDistance(t,o),m=b.calculateDistance(t,i);if(P>2*n&&m>2*n)return T==null||T.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need diversion: %j",s.requestId,P,m,{from:t,t1:o,t2:i,hr:r}),{}}const a=b.calculateBearing(t,o),d=b.calculateBearing(o,i),u=Math.abs(a-d);let h=0;u<180?h=u+90:u>=180&&(h=u-90);const f=b.calculateCoordinate(o,h,n);return T==null||T.info("[%s] the right tangent position: %j",s.requestId,{from:t,t1:o,t2:i,radius:n,bearing1:a,bearing2:d,right:f}),{at:f,t1:o,t2:i,hr:Number(r),hours:c}}return{}}static driftPassageAt(t,e,n,s={}){const{t1:o,t2:i,hr:r,hours:c}=this.tropicalCenterTwin(e,24,s);if(o&&i){if(!s.debug){const f=b.calculateDistance(t,o),P=b.calculateDistance(t,i);if(f>2*n&&P>2*n)return T==null||T.info("[%s] the distance between from and t1(%d) and t2(%d) is enough, no need drifting: %j",s.requestId,f,P,{from:t,t1:o,t2:i,hr:r}),{}}const a=b.calculateBearing(t,o),d=b.calculateBearing(o,i),u=b.calculateDistance(t,o);return{at:b.calculateCoordinate(o,a-d+180,n<u?n:u),t1:o,t2:i,hr:Number(r),hours:c}}else return T==null||T.info("[%s] no need drift: %j",s.requestId,{from:t,t1:o,t2:i,hr:r}),{}}static tropicalCenterTwin(t,e=24,n={}){var d,u,h,f,P;let s={};(d=t.forecasts)==null||d.forEach(m=>{s={...m.hours,...s}});const o=((u=t==null?void 0:t.history)==null?void 0:u[0])||(s==null?void 0:s[(h=Object.keys(s))==null?void 0:h[0]]);T==null||T.info("[%s] the first tropical center: %j",n.requestId,o);let i=(f=Object.keys(s||{}).filter(m=>Number(m)<=(e<0?24:e)))==null?void 0:f.at(-1);i||(i=(P=Object.keys(s||{}).filter(m=>Number(m)<=(e<0?24:2*e)))==null?void 0:P.at(-1));const r=s==null?void 0:s[i||-1];T==null||T.info("[%s] the second tropical center: %j in %d hrs",n.requestId,r,i);const c=Object.keys(s||{}).filter(m=>Number(m)<=Number(i)),a={0:o};for(const m of c)a[m]=s[m];return{t1:o,t2:r,hr:Number(i),hours:a}}static pickIndex(t,e){let n=0;for(const s of t){if(D(s.properties.date).isAfter(e))return n===0?-1:n;n++}return n}static computeNumber(t,e,n){if(t)if(e){if(isNaN(t)&&isNaN(e)&&typeof t!="string"&&typeof e!="string"){const s={};for(const o in t)s[o]=this.computeNumber(t[o],e[o],n);return s}return Math.round((t+(e-t)*n)*100)/100}else return t;else return e}}C.LaneHelper=b,C.LngLatHelper=l,C.TropicalHelper=E,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idm-plugin/geo",
3
3
  "private": false,
4
- "version": "1.4.5",
4
+ "version": "1.4.7",
5
5
  "description": "idm plugin for geo",
6
6
  "type": "module",
7
7
  "keywords": [