@signalk/freeboard-sk 2.2.4 → 2.2.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG: Freeboard
2
2
 
3
+ ### v2.2.6
4
+
5
+ - **Fixed**: Issue where anchor watch could not be set when Signal K server had security enabled. _(Requires signalk-anchoralarm-plugin v1.13.0 or later)_
6
+
7
+ ### v2.2.5
8
+
9
+ - **Added**: Ability to toggle AIS label color between dark and light to improve visibility on satellite imagery.
10
+ - **Fixed**: Authentication error on plugin startup on systems with security enabled.
11
+
12
+ ### v2.2.4
13
+
14
+ - **Fixed**: GPX Load errors caused by routes with no name and / or description causing validation errors.
15
+
3
16
  ### v2.2.3
4
17
 
5
18
  - **Fixed**: Do not make "Fixed Location" mode the default.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalk/freeboard-sk",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "Openlayers chart plotter implementation for Signal K",
5
5
  "keywords": [
6
6
  "signalk-webapp",
@@ -16,22 +16,34 @@ const initAnchorApi = async (app) => {
16
16
  server = app;
17
17
  server.debug(`** initAnchorApi() **`);
18
18
  // detect signalk-anchor-alarm plugin
19
- let port = 3000;
20
- if (typeof server.config?.getExternalPort === 'function') {
21
- server.debug('*** getExternalPort()', server.config.getExternalPort());
22
- port = server.config.getExternalPort();
23
- }
24
- hostPath = `${server.config.ssl ? 'https' : 'http'}://localhost:${port}`;
25
- const url = `${hostPath}/plugins`;
26
- const r = await (0, fetch_1.fetch)(url);
27
- r.forEach((plugin) => {
28
- if (plugin.id === 'anchoralarm') {
29
- pluginPath = `/plugins/${plugin.id}`;
30
- anchorPlugin.has = true;
31
- anchorPlugin.version = plugin.version;
32
- anchorPlugin.enabled = plugin.data.enabled;
19
+ anchorPlugin.has = true;
20
+ try {
21
+ let port = 3000;
22
+ if (typeof server.config?.getExternalPort === 'function') {
23
+ server.debug('*** getExternalPort()', server.config.getExternalPort());
24
+ port = server.config.getExternalPort();
33
25
  }
34
- });
26
+ hostPath = `${server.config.ssl ? 'https' : 'http'}://localhost:${port}`;
27
+ // temp patch for detection issue
28
+ pluginPath = `/plugins/anchoralarm`;
29
+ anchorPlugin.enabled = true;
30
+ /*
31
+ const url = `${hostPath}/plugins`;
32
+ const r: Array<{ id: string }> = await fetch(url);
33
+ r.forEach(
34
+ (plugin: { id: string; version: string; data: { enabled: boolean } }) => {
35
+ if (plugin.id === 'anchoralarm') {
36
+ pluginPath = `/plugins/${plugin.id}`;
37
+ anchorPlugin.has = true;
38
+ anchorPlugin.version = plugin.version;
39
+ anchorPlugin.enabled = plugin.data.enabled;
40
+ }
41
+ }
42
+ );*/
43
+ }
44
+ catch (e) {
45
+ anchorPlugin.has = false;
46
+ }
35
47
  server.debug('*** Anchor Alarm Plugin detected:', anchorPlugin.has);
36
48
  server.debug('*** Anchor Alarm Plugin enabled:', anchorPlugin.enabled);
37
49
  server.debug('*** Anchor Alarm Plugin API Path', `${hostPath}${pluginPath}`);
package/plugin/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const alarms_1 = require("./alarms/alarms");
4
- const anchor_api_1 = require("./anchor/anchor-api");
5
4
  const weather_1 = require("./weather");
6
5
  const pypilot_1 = require("./pypilot");
7
6
  const openapi = require("./openApi.json");
@@ -163,8 +162,6 @@ module.exports = (server) => {
163
162
  if (settings.pypilot.enable) {
164
163
  (0, pypilot_1.initPyPilot)(server, plugin.id, settings.pypilot);
165
164
  }
166
- // Anchor API facade
167
- (0, anchor_api_1.initAnchorApi)(server);
168
165
  server.setPluginStatus(msg);
169
166
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
167
  }
package/plugin/pypilot.js CHANGED
@@ -10,7 +10,8 @@ const apData = {
10
10
  },
11
11
  state: null,
12
12
  mode: null,
13
- target: null
13
+ target: null,
14
+ active: false
14
15
  };
15
16
  let server;
16
17
  let pluginId;
@@ -34,36 +35,22 @@ const closePyPilot = () => {
34
35
  if (socket) {
35
36
  socket.close();
36
37
  }
37
- if (server) {
38
- server.handleMessage(pluginId, {
39
- updates: [
40
- {
41
- values: [
42
- {
43
- path: 'steering.autopilot.href',
44
- value: null
45
- }
46
- ]
47
- }
48
- ]
49
- }, 'v2');
50
- }
51
38
  };
52
39
  exports.closePyPilot = closePyPilot;
53
40
  const initApiRoutes = () => {
54
41
  server.debug(`** Registering API endpoint(s): ${AUTOPILOT_API_PATH} **`);
55
- server.get(`${AUTOPILOT_API_PATH}/config`, (req, res) => {
56
- server.debug(`GET ${AUTOPILOT_API_PATH}/config`);
42
+ server.get(`${AUTOPILOT_API_PATH}`, (req, res) => {
43
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}`);
57
44
  res.status(200);
58
45
  res.json(apData);
59
46
  });
60
47
  server.get(`${AUTOPILOT_API_PATH}/state`, (req, res) => {
61
- server.debug(`GET ${AUTOPILOT_API_PATH}/state`);
48
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/state`);
62
49
  res.status(200);
63
50
  res.json(apData.state);
64
51
  });
65
52
  server.put(`${AUTOPILOT_API_PATH}/state`, (req, res) => {
66
- server.debug(`PUT ${AUTOPILOT_API_PATH}/state`);
53
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/state`);
67
54
  if (typeof req.body.value === 'undefined') {
68
55
  res.status(400).json({
69
56
  state: 'FAILED',
@@ -84,12 +71,12 @@ const initApiRoutes = () => {
84
71
  res.status(r.statusCode).json(r);
85
72
  });
86
73
  server.get(`${AUTOPILOT_API_PATH}/mode`, (req, res) => {
87
- server.debug(`GET ${AUTOPILOT_API_PATH}/mode`);
74
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/mode`);
88
75
  res.status(200);
89
76
  res.json(apData.mode);
90
77
  });
91
78
  server.put(`${AUTOPILOT_API_PATH}/mode`, (req, res) => {
92
- server.debug(`PUT ${AUTOPILOT_API_PATH}/mode`);
79
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/mode`);
93
80
  if (typeof req.body.value === 'undefined') {
94
81
  res.status(400).json({
95
82
  state: 'FAILED',
@@ -109,6 +96,83 @@ const initApiRoutes = () => {
109
96
  const r = sendToPyPilot('mode', req.body.value);
110
97
  res.status(r.statusCode).json(r);
111
98
  });
99
+ server.put(`${AUTOPILOT_API_PATH}/target`, (req, res) => {
100
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/target`);
101
+ if (typeof req.body.value !== 'number') {
102
+ res.status(400).json({
103
+ state: 'FAILED',
104
+ statusCode: 400,
105
+ message: `Error: Invalid value supplied!`
106
+ });
107
+ return;
108
+ }
109
+ let deg = req.body.value * (180 / Math.PI);
110
+ if (deg > 359) {
111
+ deg = 359;
112
+ }
113
+ else if (deg < -179) {
114
+ deg = -179;
115
+ }
116
+ const r = sendToPyPilot('target', deg);
117
+ res.status(r.statusCode).json(r);
118
+ });
119
+ server.put(`${AUTOPILOT_API_PATH}/target/adjust`, (req, res) => {
120
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/target/adjust`);
121
+ if (typeof req.body.value !== 'number') {
122
+ res.status(400).json({
123
+ state: 'FAILED',
124
+ statusCode: 400,
125
+ message: `Error: Invalid value supplied!`
126
+ });
127
+ return;
128
+ }
129
+ const v = req.body.value * (180 / Math.PI);
130
+ let deg = apData.target + v;
131
+ if (deg > 359) {
132
+ deg = 359;
133
+ }
134
+ else if (deg < -179) {
135
+ deg = -179;
136
+ }
137
+ const r = sendToPyPilot('target', deg);
138
+ res.status(r.statusCode).json(r);
139
+ });
140
+ server.post(`${AUTOPILOT_API_PATH}/engage`, (req, res) => {
141
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/engage`);
142
+ const r = sendToPyPilot('state', 'enabled');
143
+ res.status(r.statusCode).json(r);
144
+ });
145
+ server.post(`${AUTOPILOT_API_PATH}/disengage`, (req, res) => {
146
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/disengage`);
147
+ const r = sendToPyPilot('state', 'disabled');
148
+ res.status(r.statusCode).json(r);
149
+ });
150
+ server.post(`${AUTOPILOT_API_PATH}/tack/port`, (req, res) => {
151
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/tack/port`);
152
+ const r = sendToPyPilot('tack', 'port');
153
+ res.status(r.statusCode).json(r);
154
+ });
155
+ server.post(`${AUTOPILOT_API_PATH}/tack/starboard`, (req, res) => {
156
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/tack/starboard`);
157
+ const r = sendToPyPilot('tack', 'starboard');
158
+ res.status(r.statusCode).json(r);
159
+ });
160
+ server.post(`${AUTOPILOT_API_PATH}/gybe/port`, (req, res) => {
161
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/gybe/port`);
162
+ res.status(501).json({
163
+ state: 'COMPLETED',
164
+ statusCode: 501,
165
+ message: 'Not implemented!'
166
+ });
167
+ });
168
+ server.post(`${AUTOPILOT_API_PATH}/gybe/starboard`, (req, res) => {
169
+ server.debug(`${req.method} ${AUTOPILOT_API_PATH}/gybe/starboard`);
170
+ res.status(501).json({
171
+ state: 'COMPLETED',
172
+ statusCode: 501,
173
+ message: 'Not implemented!'
174
+ });
175
+ });
112
176
  };
113
177
  // PyPilot socket event listeners
114
178
  const initPyPilotListeners = () => {
@@ -123,19 +187,6 @@ const initPyPilotListeners = () => {
123
187
  socket.emit('pypilot', `watch={"ap.enabled": ${JSON.stringify(period)}}`);
124
188
  socket.emit('pypilot', `watch={"ap.mode": ${JSON.stringify(period)}}`);
125
189
  }, 1000);
126
- // flag pypilot as active pilot
127
- server.handleMessage(pluginId, {
128
- updates: [
129
- {
130
- values: [
131
- {
132
- path: 'steering.autopilot.href',
133
- value: `./pypilot`
134
- }
135
- ]
136
- }
137
- ]
138
- }, 'v2');
139
190
  });
140
191
  socket.on('connect_error', () => {
141
192
  server.debug('socket connect_error!');
@@ -208,7 +259,7 @@ const handlePyPilotUpdateMsg = (data) => {
208
259
  const heading = data['ap.heading_command'] === false ? null : data['ap.heading_command'];
209
260
  if (heading !== apData.heading_command) {
210
261
  apData.target = heading;
211
- emitAPDelta('target', (Math.PI / 180) * apData.heading_command);
262
+ emitAPDelta('target', (Math.PI / 180) * apData.target);
212
263
  }
213
264
  }
214
265
  if (typeof data['ap.mode'] !== 'undefined') {
@@ -221,6 +272,7 @@ const handlePyPilotUpdateMsg = (data) => {
221
272
  if (typeof data['ap.enabled'] !== 'undefined') {
222
273
  if (data['ap.enabled'] !== apData.state) {
223
274
  apData.state = data['ap.enabled'] ? 'enabled' : 'disabled';
275
+ apData.active = apData.state === 'enabled' ? true : false;
224
276
  emitAPDelta('state', apData.state);
225
277
  }
226
278
  }
@@ -1 +1 @@
1
- (()=>{"use strict";var lm={1924:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(6953)),N=E(v(5794)),w=E(v(7176)),x=E(v(3620)),D=v(5419);function E(p){return p&&p.__esModule?p:{default:p}}f.default=function(y,b,_){var T=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,O=(0,C.default)(y),L=(0,N.default)(y),Y=b/T,ce=(0,w.default)(_),ve=(0,w.default)(O),ae=(0,w.default)(L),ke=Math.asin(Math.sin(ve)*Math.cos(Y)+Math.cos(ve)*Math.sin(Y)*Math.cos(ce)),Ne=ae+Math.atan2(Math.sin(ce)*Math.sin(Y)*Math.cos(ve),Math.cos(Y)-Math.sin(ve)*Math.sin(ke)),he=(0,x.default)(Ne);return(he<D.MINLON||he>D.MAXLON)&&(Ne=(Ne+3*Math.PI)%(2*Math.PI)-Math.PI,he=(0,x.default)(Ne)),{latitude:(0,x.default)(ke),longitude:he}}},5419:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.areaConversion=f.timeConversion=f.distanceConversion=f.altitudeKeys=f.latitudeKeys=f.longitudeKeys=f.MAXLON=f.MINLON=f.MAXLAT=f.MINLAT=f.earthRadius=f.sexagesimalPattern=void 0,f.sexagesimalPattern=/^([0-9]{1,3})\xb0\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['\u2032]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["\u2033]\s*)?([NEOSW]?)$/,f.earthRadius=6378137,f.MINLAT=-90,f.MAXLAT=90,f.MINLON=-180,f.MAXLON=180,f.longitudeKeys=["lng","lon","longitude",0],f.latitudeKeys=["lat","latitude",1],f.altitudeKeys=["alt","altitude","elevation","elev",2],f.distanceConversion={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},f.timeConversion={m:60,h:3600,d:86400};var b={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};f.areaConversion=b,b.sqm=b.m2,b.sqkm=b.km2,b.sqft=b.ft2,b.sqyd=b.yd2,b.sqin=b.in2},1572:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){var h=C.areaConversion[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m"];if(h)return D*h;throw new Error("Invalid unit used for area conversion.")}},3394:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){var h=C.distanceConversion[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m"];if(h)return D*h;throw new Error("Invalid unit used for distance conversion.")}},3418:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh"){case"kmh":return D*C.timeConversion.h*C.distanceConversion.km;case"mph":return D*C.timeConversion.h*C.distanceConversion.mi;default:return D}}},3370:(F,f)=>{function v(p,y){return function D(p){if(Array.isArray(p))return p}(p)||function x(p,y){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(p)){var b=[],_=!0,T=!1,O=void 0;try{for(var Y,L=p[Symbol.iterator]();!(_=(Y=L.next()).done)&&(b.push(Y.value),!y||b.length!==y);_=!0);}catch(ce){T=!0,O=ce}finally{try{!_&&null!=L.return&&L.return()}finally{if(T)throw O}}return b}}(p,y)||function N(p,y){if(p){if("string"==typeof p)return w(p,y);var b=Object.prototype.toString.call(p).slice(8,-1);if("Object"===b&&p.constructor&&(b=p.constructor.name),"Map"===b||"Set"===b)return Array.from(p);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return w(p,y)}}(p,y)||function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(p,y){(null==y||y>p.length)&&(y=p.length);for(var b=0,_=new Array(y);b<y;b++)_[b]=p[b];return _}Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(y){var _=v(y.toString().split("."),2),O=_[1],L=Math.abs(Number(_[0])),Y=60*+("0."+(O||0)),ce=Y.toString().split("."),ve=Math.floor(Y),ae=function(y){var _=Math.pow(10,arguments.length>1&&void 0!==arguments[1]?arguments[1]:4);return Math.round(y*_)/_}(60*+("0."+(ce[1]||0))).toString(),Ne=v(ae.split("."),2),he=Ne[0],pe=Ne[1],ye=void 0===pe?"0":pe;return L+"\xb0 "+ve.toString().padStart(2,"0")+"' "+he.padStart(2,"0")+"."+ye.padEnd(1,"0")+'"'}},427:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(5548));f.default=function(E,h){return(0,C.default)(E,h)[0]}},9913:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(7176)),N=D(v(6953)),w=D(v(5794)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p){var y=0;if(p.length>2){for(var b,_,T,O=0;O<p.length;O++){O===p.length-2?(b=p.length-2,_=p.length-1,T=0):O===p.length-1?(b=p.length-1,_=0,T=1):(b=O,_=O+1,T=O+2);var L=(0,w.default)(p[b]),Y=(0,N.default)(p[_]),ce=(0,w.default)(p[T]);y+=((0,C.default)(ce)-(0,C.default)(L))*Math.sin((0,C.default)(Y))}y=y*x.earthRadius*x.earthRadius/2}return Math.abs(y)}},2968:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(6953)),N=w(v(5794));function w(E){return E&&E.__esModule?E:{default:E}}f.default=function(h){if(!1===Array.isArray(h)||0===h.length)throw new Error("No points were given.");return h.reduce(function(g,p){var y=(0,C.default)(p),b=(0,N.default)(p);return{maxLat:Math.max(y,g.maxLat),minLat:Math.min(y,g.minLat),maxLng:Math.max(b,g.maxLng),minLng:Math.min(b,g.minLng)}},{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})}},2477:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(6953)),N=E(v(5794)),w=E(v(7176)),x=E(v(3620)),D=v(5419);function E(p){return p&&p.__esModule?p:{default:p}}f.default=function(y,b){var pe,ye,_=(0,C.default)(y),T=(0,N.default)(y),O=(0,w.default)(_),L=(0,w.default)(T),Y=b/D.earthRadius,ce=O-Y,ve=O+Y,ae=(0,w.default)(D.MAXLAT),ke=(0,w.default)(D.MINLAT),Ne=(0,w.default)(D.MAXLON),he=(0,w.default)(D.MINLON);if(ce>ke&&ve<ae){var De=Math.asin(Math.sin(Y)/Math.cos(O));(pe=L-De)<he&&(pe+=2*Math.PI),(ye=L+De)>Ne&&(ye-=2*Math.PI)}else ce=Math.max(ce,ke),ve=Math.min(ve,ae),pe=he,ye=Ne;return[{latitude:(0,x.default)(ce),longitude:(0,x.default)(pe)},{latitude:(0,x.default)(ve),longitude:(0,x.default)(ye)}]}},7977:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=D(v(3620));function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p){if(!1===Array.isArray(p)||0===p.length)return!1;var y=p.length,b=p.reduce(function(L,Y){var ce=(0,w.default)((0,C.default)(Y)),ve=(0,w.default)((0,N.default)(Y));return{X:L.X+Math.cos(ce)*Math.cos(ve),Y:L.Y+Math.cos(ce)*Math.sin(ve),Z:L.Z+Math.sin(ce)}},{X:0,Y:0,Z:0}),_=b.X/y,T=b.Y/y,O=b.Z/y;return{longitude:(0,x.default)(Math.atan2(T,_)),latitude:(0,x.default)(Math.atan2(O,Math.sqrt(_*_+T*T)))}}},1102:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(2968));f.default=function(E){var h=(0,C.default)(E),p=h.minLng+(h.maxLng-h.minLng)/2;return{latitude:parseFloat((h.minLat+(h.maxLat-h.minLat)/2).toFixed(6)),longitude:parseFloat(p.toFixed(6))}}},1345:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(4539));f.default=function(E,h){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default,p="function"==typeof g?g(E,h):(0,C.default)(E,h);if(isNaN(p))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(p/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}}},8954:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w,x){return x.reduce(function(D,E){if(typeof w>"u"||null===w)throw new Error("'".concat(w,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(w,E)&&typeof E<"u"&&typeof D>"u"?(D=E,E):D},void 0)}},999:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419),N=function w(p){return p&&p.__esModule?p:{default:p}}(v(8954));function x(p,y){var b=Object.keys(p);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(p);y&&(_=_.filter(function(T){return Object.getOwnPropertyDescriptor(p,T).enumerable})),b.push.apply(b,_)}return b}function E(p,y,b){return y in p?Object.defineProperty(p,y,{value:b,enumerable:!0,configurable:!0,writable:!0}):p[y]=b,p}f.default=function(y){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:C.longitudeKeys,latitude:C.latitudeKeys,altitude:C.altitudeKeys},_=(0,N.default)(y,b.longitude),T=(0,N.default)(y,b.latitude),O=(0,N.default)(y,b.altitude);return function D(p){for(var y=1;y<arguments.length;y++){var b=null!=arguments[y]?arguments[y]:{};y%2?x(Object(b),!0).forEach(function(_){E(p,_,b[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(b)):x(Object(b)).forEach(function(_){Object.defineProperty(p,_,Object.getOwnPropertyDescriptor(b,_))})}return p}({latitude:T,longitude:_},O?{altitude:O}:{})}},7842:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(6953)),N=E(v(5794)),w=E(v(7176)),x=E(v(5012)),D=v(5419);function E(p){return p&&p.__esModule?p:{default:p}}f.default=function(y,b){var _=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;_=typeof _<"u"&&!isNaN(_)?_:1;var T=(0,C.default)(y),O=(0,N.default)(y),L=(0,C.default)(b),Y=(0,N.default)(b),ce=Math.acos((0,x.default)(Math.sin((0,w.default)(L))*Math.sin((0,w.default)(T))+Math.cos((0,w.default)(L))*Math.cos((0,w.default)(T))*Math.cos((0,w.default)(O)-(0,w.default)(Y))))*D.earthRadius;return Math.round(ce/_)*_}},5868:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(7842)),N=w(v(5012));function w(E){return E&&E.__esModule?E:{default:E}}f.default=function(h,g,p){var y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,b=(0,C.default)(g,h,y),_=(0,C.default)(h,p,y),T=(0,C.default)(g,p,y),O=Math.acos((0,N.default)((b*b+T*T-_*_)/(2*b*T))),L=Math.acos((0,N.default)((_*_+T*T-b*b)/(2*_*T)));return O>Math.PI/2?b:L>Math.PI/2?_:Math.sin(O)*b}},3466:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=D(v(3620));function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p,y){var b=(0,C.default)(y),_=(0,N.default)(y),T=(0,C.default)(p),O=(0,N.default)(p);return((0,x.default)(Math.atan2(Math.sin((0,w.default)(_)-(0,w.default)(O))*Math.cos((0,w.default)(b)),Math.cos((0,w.default)(T))*Math.sin((0,w.default)(b))-Math.sin((0,w.default)(T))*Math.cos((0,w.default)(b))*Math.cos((0,w.default)(_)-(0,w.default)(O))))+360)%360}},6953:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419),N=x(v(8954)),w=x(v(6232));function x(h){return h&&h.__esModule?h:{default:h}}f.default=function(g,p){var y=(0,N.default)(g,C.latitudeKeys);if(!(typeof y>"u"||null===y)){var b=g[y];return!0===p?b:(0,w.default)(b)}}},5794:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419),N=x(v(8954)),w=x(v(6232));function x(h){return h&&h.__esModule?h:{default:h}}f.default=function(g,p){var y=(0,N.default)(g,C.longitudeKeys);if(!(typeof y>"u"||null===y)){var b=g[y];return!0===p?b:(0,w.default)(b)}}},1931:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(E){return E&&E.__esModule?E:{default:E}}(v(7842));function w(E){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"==typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g})(E)}f.default=function(h){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C.default;return h.reduce(function(p,y){return"object"===w(p)&&null!==p.last&&(p.distance+=g(y,p.last)),p.last=y,p},{last:null,distance:0}).distance}},3502:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p,y){var b=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;b=typeof b<"u"&&!isNaN(b)?b:1;var ae,ke,Ne,he,pe,ye,nn,_=(0,C.default)(p),T=(0,N.default)(p),O=(0,C.default)(y),L=(0,N.default)(y),Y=6356752.314245,ce=1/298.257223563,ve=(0,w.default)(L-T),De=Math.atan((1-ce)*Math.tan((0,w.default)(parseFloat(_)))),tn=Math.atan((1-ce)*Math.tan((0,w.default)(parseFloat(O)))),Gt=Math.sin(De),Nt=Math.cos(De),Pt=Math.sin(tn),gt=Math.cos(tn),xt=ve,In=100;do{var rn=Math.sin(xt),mt=Math.cos(xt);if(0===(ye=Math.sqrt(gt*rn*(gt*rn)+(Nt*Pt-Gt*gt*mt)*(Nt*Pt-Gt*gt*mt))))return 0;ae=Gt*Pt+Nt*gt*mt,ke=Math.atan2(ye,ae),pe=ae-2*Gt*Pt/(he=1-(Ne=Nt*gt*rn/ye)*Ne),isNaN(pe)&&(pe=0);var _n=ce/16*he*(4+ce*(4-3*he));nn=xt,xt=ve+(1-_n)*ce*Ne*(ke+_n*ye*(pe+_n*ae*(2*pe*pe-1)))}while(Math.abs(xt-nn)>1e-12&&--In>0);if(0===In)return NaN;var st=he*(x.earthRadius*x.earthRadius-Y*Y)/(Y*Y),qt=st/1024*(256+st*(st*(74-47*st)-128));return Math.round(Y*(1+st/16384*(4096+st*(st*(320-175*st)-768)))*(ke-qt*ye*(pe+qt/4*(ae*(2*pe*pe-1)-qt/6*pe*(4*ye*ye-3)*(4*pe*pe-3))))/b)*b}},4539:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=D(v(3620));function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p,y){var b=(0,w.default)((0,N.default)(y))-(0,w.default)((0,N.default)(p)),_=Math.log(Math.tan((0,w.default)((0,C.default)(y))/2+Math.PI/4)/Math.tan((0,w.default)((0,C.default)(p))/2+Math.PI/4));return Math.abs(b)>Math.PI&&(b=b>0?-1*(2*Math.PI-b):2*Math.PI+b),((0,x.default)(Math.atan2(b,_))+360)%360}},3467:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return/^(NNE|NE|NNW|N)$/.test(w)?"N":/^(ENE|E|ESE|SE)$/.test(w)?"E":/^(SSE|S|SSW|SW)$/.test(w)?"S":/^(WSW|W|WNW|NW)$/.test(w)?"W":void 0}},393:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default)(E,h)/(Number(h.time)-Number(E.time))*1e3}},939:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0});var C={computeDestinationPoint:!0,convertArea:!0,convertDistance:!0,convertSpeed:!0,decimalToSexagesimal:!0,findNearest:!0,getAreaOfPolygon:!0,getBounds:!0,getBoundsOfDistance:!0,getCenter:!0,getCenterOfBounds:!0,getCompassDirection:!0,getCoordinateKey:!0,getCoordinateKeys:!0,getDistance:!0,getDistanceFromLine:!0,getGreatCircleBearing:!0,getLatitude:!0,getLongitude:!0,getPathLength:!0,getPreciseDistance:!0,getRhumbLineBearing:!0,getRoughCompassDirection:!0,getSpeed:!0,isDecimal:!0,isPointInLine:!0,isPointInPolygon:!0,isPointNearLine:!0,isPointWithinRadius:!0,isSexagesimal:!0,isValidCoordinate:!0,isValidLatitude:!0,isValidLongitude:!0,orderByDistance:!0,sexagesimalToDecimal:!0,toDecimal:!0,toRad:!0,toDeg:!0,wktToPolygon:!0};Object.defineProperty(f,"computeDestinationPoint",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(f,"convertArea",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(f,"convertDistance",{enumerable:!0,get:function(){return x.default}}),Object.defineProperty(f,"convertSpeed",{enumerable:!0,get:function(){return D.default}}),Object.defineProperty(f,"decimalToSexagesimal",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(f,"findNearest",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(f,"getAreaOfPolygon",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(f,"getBounds",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(f,"getBoundsOfDistance",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(f,"getCenter",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(f,"getCenterOfBounds",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(f,"getCompassDirection",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(f,"getCoordinateKey",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(f,"getCoordinateKeys",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(f,"getDistance",{enumerable:!0,get:function(){return Y.default}}),Object.defineProperty(f,"getDistanceFromLine",{enumerable:!0,get:function(){return ce.default}}),Object.defineProperty(f,"getGreatCircleBearing",{enumerable:!0,get:function(){return ve.default}}),Object.defineProperty(f,"getLatitude",{enumerable:!0,get:function(){return ae.default}}),Object.defineProperty(f,"getLongitude",{enumerable:!0,get:function(){return ke.default}}),Object.defineProperty(f,"getPathLength",{enumerable:!0,get:function(){return Ne.default}}),Object.defineProperty(f,"getPreciseDistance",{enumerable:!0,get:function(){return he.default}}),Object.defineProperty(f,"getRhumbLineBearing",{enumerable:!0,get:function(){return pe.default}}),Object.defineProperty(f,"getRoughCompassDirection",{enumerable:!0,get:function(){return ye.default}}),Object.defineProperty(f,"getSpeed",{enumerable:!0,get:function(){return De.default}}),Object.defineProperty(f,"isDecimal",{enumerable:!0,get:function(){return tn.default}}),Object.defineProperty(f,"isPointInLine",{enumerable:!0,get:function(){return Gt.default}}),Object.defineProperty(f,"isPointInPolygon",{enumerable:!0,get:function(){return Nt.default}}),Object.defineProperty(f,"isPointNearLine",{enumerable:!0,get:function(){return Pt.default}}),Object.defineProperty(f,"isPointWithinRadius",{enumerable:!0,get:function(){return gt.default}}),Object.defineProperty(f,"isSexagesimal",{enumerable:!0,get:function(){return xt.default}}),Object.defineProperty(f,"isValidCoordinate",{enumerable:!0,get:function(){return nn.default}}),Object.defineProperty(f,"isValidLatitude",{enumerable:!0,get:function(){return In.default}}),Object.defineProperty(f,"isValidLongitude",{enumerable:!0,get:function(){return rn.default}}),Object.defineProperty(f,"orderByDistance",{enumerable:!0,get:function(){return mt.default}}),Object.defineProperty(f,"sexagesimalToDecimal",{enumerable:!0,get:function(){return _n.default}}),Object.defineProperty(f,"toDecimal",{enumerable:!0,get:function(){return st.default}}),Object.defineProperty(f,"toRad",{enumerable:!0,get:function(){return hr.default}}),Object.defineProperty(f,"toDeg",{enumerable:!0,get:function(){return qt.default}}),Object.defineProperty(f,"wktToPolygon",{enumerable:!0,get:function(){return Dn.default}});var N=Z(v(1924)),w=Z(v(1572)),x=Z(v(3394)),D=Z(v(3418)),E=Z(v(3370)),h=Z(v(427)),g=Z(v(9913)),p=Z(v(2968)),y=Z(v(2477)),b=Z(v(7977)),_=Z(v(1102)),T=Z(v(1345)),O=Z(v(8954)),L=Z(v(999)),Y=Z(v(7842)),ce=Z(v(5868)),ve=Z(v(3466)),ae=Z(v(6953)),ke=Z(v(5794)),Ne=Z(v(1931)),he=Z(v(3502)),pe=Z(v(4539)),ye=Z(v(3467)),De=Z(v(393)),tn=Z(v(8155)),Gt=Z(v(909)),Nt=Z(v(7349)),Pt=Z(v(5942)),gt=Z(v(3609)),xt=Z(v(5099)),nn=Z(v(9345)),In=Z(v(1041)),rn=Z(v(2816)),mt=Z(v(5548)),_n=Z(v(2402)),st=Z(v(6232)),hr=Z(v(7176)),qt=Z(v(3620)),Dn=Z(v(3498)),on=v(5419);function Z($){return $&&$.__esModule?$:{default:$}}Object.keys(on).forEach(function($){"default"===$||"__esModule"===$||Object.prototype.hasOwnProperty.call(C,$)||Object.defineProperty(f,$,{enumerable:!0,get:function(){return on[$]}})})},8155:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){var x=w.toString().trim();return!isNaN(parseFloat(x))&&parseFloat(x)===Number(x)}},909:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h,g){return(0,C.default)(h,E)+(0,C.default)(E,g)===(0,C.default)(h,g)}},7349:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(6953)),N=w(v(5794));function w(E){return E&&E.__esModule?E:{default:E}}f.default=function(h,g){for(var p=!1,y=g.length,b=-1,_=y-1;++b<y;_=b)((0,N.default)(g[b])<=(0,N.default)(h)&&(0,N.default)(h)<(0,N.default)(g[_])||(0,N.default)(g[_])<=(0,N.default)(h)&&(0,N.default)(h)<(0,N.default)(g[b]))&&(0,C.default)(h)<((0,C.default)(g[_])-(0,C.default)(g[b]))*((0,N.default)(h)-(0,N.default)(g[b]))/((0,N.default)(g[_])-(0,N.default)(g[b]))+(0,C.default)(g[b])&&(p=!p);return p}},5942:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(5868));f.default=function(E,h,g,p){return(0,C.default)(E,h,g)<p}},3609:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h,g){return(0,C.default)(E,h,.01)<g}},5099:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){return C.sexagesimalPattern.test(D.toString().trim())}},9345:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=x(v(999)),N=x(v(1041)),w=x(v(2816));function x(h){return h&&h.__esModule?h:{default:h}}f.default=function(g){var p=(0,C.default)(g),y=p.latitude,b=p.longitude;if(Array.isArray(g)&&g.length>=2)return(0,w.default)(g[0])&&(0,N.default)(g[1]);if(typeof y>"u"||typeof b>"u")return!1;var _=g[b],T=g[y];return!(typeof T>"u"||typeof _>"u"||!1===(0,N.default)(T)||!1===(0,w.default)(_))}},1041:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(8155)),N=D(v(5099)),w=D(v(2402)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function g(p){return(0,C.default)(p)?!(parseFloat(p)>x.MAXLAT||p<x.MINLAT):!!(0,N.default)(p)&&g((0,w.default)(p))}},2816:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(8155)),N=D(v(5099)),w=D(v(2402)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function g(p){return(0,C.default)(p)?!(parseFloat(p)>x.MAXLON||p<x.MINLON):!!(0,N.default)(p)&&g((0,w.default)(p))}},5548:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default;return g="function"==typeof g?g:C.default,h.slice().sort(function(p,y){return g(E,p)-g(E,y)})}},5012:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return w>1?1:w<-1?-1:w}},2402:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){var E=new RegExp(C.sexagesimalPattern).exec(D.toString().trim());if(typeof E>"u"||null===E)throw new Error("Given value is not in sexagesimal format");var h=Number(E[2])/60||0,g=Number(E[4])/3600||0,p=parseFloat(E[1])+h+g;return["S","W"].includes(E[7])?-p:p}},6232:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(8155)),N=E(v(5099)),w=E(v(2402)),x=E(v(9345)),D=E(v(999));function E(_){return _&&_.__esModule?_:{default:_}}function h(_,T){var O=Object.keys(_);if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(_);T&&(L=L.filter(function(Y){return Object.getOwnPropertyDescriptor(_,Y).enumerable})),O.push.apply(O,L)}return O}function g(_){for(var T=1;T<arguments.length;T++){var O=null!=arguments[T]?arguments[T]:{};T%2?h(Object(O),!0).forEach(function(L){p(_,L,O[L])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(O)):h(Object(O)).forEach(function(L){Object.defineProperty(_,L,Object.getOwnPropertyDescriptor(O,L))})}return _}function p(_,T,O){return T in _?Object.defineProperty(_,T,{value:O,enumerable:!0,configurable:!0,writable:!0}):_[T]=O,_}f.default=function _(T){if((0,C.default)(T))return Number(T);if((0,N.default)(T))return(0,w.default)(T);if((0,x.default)(T)){var O=(0,D.default)(T);return Array.isArray(T)?T.map(function(L,Y){return[0,1].includes(Y)?_(L):L}):g(g(g({},T),O.latitude&&p({},O.latitude,_(T[O.latitude]))),O.longitude&&p({},O.longitude,_(T[O.longitude])))}return Array.isArray(T)?T.map(function(L){return(0,x.default)(L)?_(L):L}):T}},3620:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return 180*w/Math.PI}},7176:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return w*Math.PI/180}},3498:(F,f)=>{function w(g,p){(null==p||p>g.length)&&(p=g.length);for(var y=0,b=new Array(p);y<p;y++)b[y]=g[y];return b}Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(p){if(!p.startsWith("POLYGON"))throw new Error("Invalid wkt.");return p.slice(p.indexOf("(")+2,p.indexOf(")")).split(", ").map(function(_){var O=function v(g,p){return function D(g){if(Array.isArray(g))return g}(g)||function x(g,p){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(g)){var y=[],b=!0,_=!1,T=void 0;try{for(var L,O=g[Symbol.iterator]();!(b=(L=O.next()).done)&&(y.push(L.value),!p||y.length!==p);b=!0);}catch(Y){_=!0,T=Y}finally{try{!b&&null!=O.return&&O.return()}finally{if(_)throw T}}return y}}(g,p)||function N(g,p){if(g){if("string"==typeof g)return w(g,p);var y=Object.prototype.toString.call(g).slice(8,-1);if("Object"===y&&g.constructor&&(y=g.constructor.name),"Map"===y||"Set"===y)return Array.from(g);if("Arguments"===y||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(y))return w(g,p)}}(g,p)||function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(_.split(" "),2),Y=O[1];return{longitude:parseFloat(O[0]),latitude:parseFloat(Y)}})}},5365:(F,f)=>{function v(h,g){return h*h+g*g}function C(h,g){return v(h[0]-g[0],h[1]-g[1])}function N(h,g,p){var y=g[0],b=g[1],_=p[0]-y,T=p[1]-b;if(0!==_||0!==T){var O=((h[0]-y)*_+(h[1]-b)*T)/v(_,T);O>1?(y=p[0],b=p[1]):O>0&&(y+=_*O,b+=T*O)}return v(h[0]-y,h[1]-b)}function x(h,g,p,y,b){for(var T,_=y,O=g+1;O<p;O++){var L=N(h[O],h[g],h[p]);L>_&&(T=O,_=L)}_>y&&(T-g>1&&x(h,g,T,y,b),b.push(h[T]),p-T>1&&x(h,T,p,y,b))}function D(h,g){var p=h.length-1,y=[h[0]];return x(h,0,p,g,y),y.push(h[p]),y}f.__esModule=!0,f.SimplifyAP=function E(h,g,p){if(void 0===g&&(g=1),void 0===p&&(p=!1),h.length<=2)return h;var y=g*g;return D(h=p?h:function w(h,g){for(var y,p=h[0],b=[p],_=1,T=h.length;_<T;_++)C(y=h[_],p)>g&&(b.push(y),p=y);return p!==y&&b.push(y),b}(h,y),y)}},1275:(F,f,v)=>{var N=v(5365);f.EK=N.SimplifyAP,v(4046),v(6861)},4046:(F,f)=>{function v(h,g){return h*h+g*g}function C(h,g){return v(h.longitude-g.longitude,h.latitude-g.latitude)}function N(h,g,p){var y=g.longitude,b=g.latitude,_=p.longitude-y,T=p.latitude-b;if(0!==_||0!==T){var O=((h.longitude-y)*_+(h.latitude-b)*T)/v(_,T);O>1?(y=p.longitude,b=p.latitude):O>0&&(y+=_*O,b+=T*O)}return v(h.longitude-y,h.latitude-b)}function x(h,g,p,y,b){for(var T,_=y,O=g+1;O<p;O++){var L=N(h[O],h[g],h[p]);L>_&&(T=O,_=L)}_>y&&(T-g>1&&x(h,g,T,y,b),b.push(h[T]),p-T>1&&x(h,T,p,y,b))}function D(h,g){var p=h.length-1,y=[h[0]];return x(h,0,p,g,y),y.push(h[p]),y}f.__esModule=!0,f.SimplifyLL=function E(h,g,p){if(void 0===g&&(g=1),void 0===p&&(p=!1),h.length<=2)return h;var y=g*g;return D(h=p?h:function w(h,g){for(var y,p=h[0],b=[p],_=1,T=h.length;_<T;_++)C(y=h[_],p)>g&&(b.push(y),p=y);return p!==y&&b.push(y),b}(h,y),y)}},6861:(F,f)=>{function v(h,g){return h*h+g*g}function C(h,g){return v(h.x-g.x,h.y-g.y)}function N(h,g,p){var y=g.x,b=g.y,_=p.x-y,T=p.y-b;if(0!==_||0!==T){var O=((h.x-y)*_+(h.y-b)*T)/v(_,T);O>1?(y=p.x,b=p.y):O>0&&(y+=_*O,b+=T*O)}return v(h.x-y,h.y-b)}function x(h,g,p,y,b){for(var T,_=y,O=g+1;O<p;O++){var L=N(h[O],h[g],h[p]);L>_&&(T=O,_=L)}_>y&&(T-g>1&&x(h,g,T,y,b),b.push(h[T]),p-T>1&&x(h,T,p,y,b))}function D(h,g){var p=h.length-1,y=[h[0]];return x(h,0,p,g,y),y.push(h[p]),y}f.__esModule=!0,f.Simplify=function E(h,g,p){if(void 0===g&&(g=1),void 0===p&&(p=!1),h.length<=2)return h;var y=g*g;return D(h=p?h:function w(h,g){for(var y,p=h[0],b=[p],_=1,T=h.length;_<T;_++)C(y=h[_],p)>g&&(b.push(y),p=y);return p!==y&&b.push(y),b}(h,y),y)}}},Yl={};function es(F){var f=Yl[F];if(void 0!==f)return f.exports;var v=Yl[F]={exports:{}};return lm[F](v,v.exports,es),v.exports}(()=>{function F(e){return"function"==typeof e}let f=!1;const v={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){const t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else f&&console.log("RxJS: Back to a better error behavior. Thank you. <3");f=e},get useDeprecatedSynchronousErrorHandling(){return f}};function C(e){setTimeout(()=>{throw e},0)}const N={closed:!0,next(e){},error(e){if(v.useDeprecatedSynchronousErrorHandling)throw e;C(e)},complete(){}},w=Array.isArray||(e=>e&&"number"==typeof e.length);function x(e){return null!==e&&"object"==typeof e}const E=(()=>{function e(t){return Error.call(this),this.message=t?`${t.length} errors occurred during unsubscription:\n${t.map((n,r)=>`${r+1}) ${n.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=t,this}return e.prototype=Object.create(Error.prototype),e})();class h{constructor(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}unsubscribe(){let t;if(this.closed)return;let{_parentOrParents:n,_ctorUnsubscribe:r,_unsubscribe:o,_subscriptions:i}=this;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof h)n.remove(this);else if(null!==n)for(let s=0;s<n.length;++s)n[s].remove(this);if(F(o)){r&&(this._unsubscribe=void 0);try{o.call(this)}catch(s){t=s instanceof E?g(s.errors):[s]}}if(w(i)){let s=-1,a=i.length;for(;++s<a;){const l=i[s];if(x(l))try{l.unsubscribe()}catch(u){t=t||[],u instanceof E?t=t.concat(g(u.errors)):t.push(u)}}}if(t)throw new E(t)}add(t){let n=t;if(!t)return h.EMPTY;switch(typeof t){case"function":n=new h(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof h)){const i=n;n=new h,n._subscriptions=[i]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}let{_parentOrParents:r}=n;if(null===r)n._parentOrParents=this;else if(r instanceof h){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}const o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n}remove(t){const n=this._subscriptions;if(n){const r=n.indexOf(t);-1!==r&&n.splice(r,1)}}}var e;function g(e){return e.reduce((t,n)=>t.concat(n instanceof E?n.errors:n),[])}h.EMPTY=((e=new h).closed=!0,e);const p="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random();class b extends h{constructor(t,n,r){switch(super(),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=N;break;case 1:if(!t){this.destination=N;break}if("object"==typeof t){t instanceof b?(this.syncErrorThrowable=t.syncErrorThrowable,this.destination=t,t.add(this)):(this.syncErrorThrowable=!0,this.destination=new _(this,t));break}default:this.syncErrorThrowable=!0,this.destination=new _(this,t,n,r)}}[p](){return this}static create(t,n,r){const o=new b(t,n,r);return o.syncErrorThrowable=!1,o}next(t){this.isStopped||this._next(t)}error(t){this.isStopped||(this.isStopped=!0,this._error(t))}complete(){this.isStopped||(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}_next(t){this.destination.next(t)}_error(t){this.destination.error(t),this.unsubscribe()}_complete(){this.destination.complete(),this.unsubscribe()}_unsubscribeAndRecycle(){const{_parentOrParents:t}=this;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this}}class _ extends b{constructor(t,n,r,o){super(),this._parentSubscriber=t;let i,s=this;F(n)?i=n:n&&(i=n.next,r=n.error,o=n.complete,n!==N&&(s=Object.create(n),F(s.unsubscribe)&&this.add(s.unsubscribe.bind(s)),s.unsubscribe=this.unsubscribe.bind(this))),this._context=s,this._next=i,this._error=r,this._complete=o}next(t){if(!this.isStopped&&this._next){const{_parentSubscriber:n}=this;v.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable?this.__tryOrSetError(n,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}}error(t){if(!this.isStopped){const{_parentSubscriber:n}=this,{useDeprecatedSynchronousErrorHandling:r}=v;if(this._error)r&&n.syncErrorThrowable?(this.__tryOrSetError(n,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(n.syncErrorThrowable)r?(n.syncErrorValue=t,n.syncErrorThrown=!0):C(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;C(t)}}}complete(){if(!this.isStopped){const{_parentSubscriber:t}=this;if(this._complete){const n=()=>this._complete.call(this._context);v.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}}__tryOrUnsub(t,n){try{t.call(this._context,n)}catch(r){if(this.unsubscribe(),v.useDeprecatedSynchronousErrorHandling)throw r;C(r)}}__tryOrSetError(t,n,r){if(!v.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{n.call(this._context,r)}catch(o){return v.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=o,t.syncErrorThrown=!0,!0):(C(o),!0)}return!1}_unsubscribe(){const{_parentSubscriber:t}=this;this._context=null,this._parentSubscriber=null,t.unsubscribe()}}const L="function"==typeof Symbol&&Symbol.observable||"@@observable";function Y(e){return e}let ae=(()=>{class e{constructor(n){this._isScalar=!1,n&&(this._subscribe=n)}lift(n){const r=new e;return r.source=this,r.operator=n,r}subscribe(n,r,o){const{operator:i}=this,s=function O(e,t,n){if(e){if(e instanceof b)return e;if(e[p])return e[p]()}return e||t||n?new b(e,t,n):new b(N)}(n,r,o);if(s.add(i?i.call(s,this.source):this.source||v.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),v.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s}_trySubscribe(n){try{return this._subscribe(n)}catch(r){v.useDeprecatedSynchronousErrorHandling&&(n.syncErrorThrown=!0,n.syncErrorValue=r),function T(e){for(;e;){const{closed:t,destination:n,isStopped:r}=e;if(t||r)return!1;e=n&&n instanceof b?n:null}return!0}(n)?n.error(r):console.warn(r)}}forEach(n,r){return new(r=ke(r))((o,i)=>{let s;s=this.subscribe(a=>{try{n(a)}catch(l){i(l),s&&s.unsubscribe()}},i,o)})}_subscribe(n){const{source:r}=this;return r&&r.subscribe(n)}[L](){return this}pipe(...n){return 0===n.length?this:function ve(e){return 0===e.length?Y:1===e.length?e[0]:function(n){return e.reduce((r,o)=>o(r),n)}}(n)(this)}toPromise(n){return new(n=ke(n))((r,o)=>{let i;this.subscribe(s=>i=s,s=>o(s),()=>r(i))})}}return e.create=t=>new e(t),e})();function ke(e){if(e||(e=v.Promise||Promise),!e)throw new Error("no Promise impl found");return e}const he=(()=>{function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e})();class pe extends h{constructor(t,n){super(),this.subject=t,this.subscriber=n,this.closed=!1}unsubscribe(){if(this.closed)return;this.closed=!0;const t=this.subject,n=t.observers;if(this.subject=null,!n||0===n.length||t.isStopped||t.closed)return;const r=n.indexOf(this.subscriber);-1!==r&&n.splice(r,1)}}class ye extends b{constructor(t){super(t),this.destination=t}}let De=(()=>{class e extends ae{constructor(){super(),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}[p](){return new ye(this)}lift(n){const r=new tn(this,this);return r.operator=n,r}next(n){if(this.closed)throw new he;if(!this.isStopped){const{observers:r}=this,o=r.length,i=r.slice();for(let s=0;s<o;s++)i[s].next(n)}}error(n){if(this.closed)throw new he;this.hasError=!0,this.thrownError=n,this.isStopped=!0;const{observers:r}=this,o=r.length,i=r.slice();for(let s=0;s<o;s++)i[s].error(n);this.observers.length=0}complete(){if(this.closed)throw new he;this.isStopped=!0;const{observers:n}=this,r=n.length,o=n.slice();for(let i=0;i<r;i++)o[i].complete();this.observers.length=0}unsubscribe(){this.isStopped=!0,this.closed=!0,this.observers=null}_trySubscribe(n){if(this.closed)throw new he;return super._trySubscribe(n)}_subscribe(n){if(this.closed)throw new he;return this.hasError?(n.error(this.thrownError),h.EMPTY):this.isStopped?(n.complete(),h.EMPTY):(this.observers.push(n),new pe(this,n))}asObservable(){const n=new ae;return n.source=this,n}}return e.create=(t,n)=>new tn(t,n),e})();class tn extends De{constructor(t,n){super(),this.destination=t,this.source=n}next(t){const{destination:n}=this;n&&n.next&&n.next(t)}error(t){const{destination:n}=this;n&&n.error&&this.destination.error(t)}complete(){const{destination:t}=this;t&&t.complete&&this.destination.complete()}_subscribe(t){const{source:n}=this;return n?this.source.subscribe(t):h.EMPTY}}!function rn(){"function"==typeof Symbol&&Symbol.iterator&&Symbol}();function we(e){return{token:e.token,providedIn:e.providedIn||null,factory:e.factory,value:void 0}}Error,globalThis;class eT{constructor(){this.limitUI04=this.maxFromBits(4),this.limitUI06=this.maxFromBits(6),this.limitUI08=this.maxFromBits(8),this.limitUI12=this.maxFromBits(12),this.limitUI14=this.maxFromBits(14),this.limitUI16=this.maxFromBits(16),this.limitUI32=this.maxFromBits(32),this.limitUI40=this.maxFromBits(40),this.limitUI48=this.maxFromBits(48),this.create()}toString(){return this.hex}toURN(){return"urn:uuid:"+this.hex}toSignalK(){return`urn:mrn:signalk:uuid:${this.hex}`}toBytes(){let t=this.hex.split("-"),n=[],r=0;for(let o=0;o<t.length;o++)for(let i=0;i<t[o].length;i+=2)n[r++]=parseInt(t[o].substr(i,2),16);return n}maxFromBits(t){return Math.pow(2,t)}getRandomInt(t,n){return Math.floor(Math.random()*(n-t+1))+t}randomUI04(){return this.getRandomInt(0,this.limitUI04-1)}randomUI06(){return this.getRandomInt(0,this.limitUI06-1)}randomUI08(){return this.getRandomInt(0,this.limitUI08-1)}randomUI12(){return this.getRandomInt(0,this.limitUI12-1)}randomUI14(){return this.getRandomInt(0,this.limitUI14-1)}randomUI16(){return this.getRandomInt(0,this.limitUI16-1)}randomUI32(){return this.getRandomInt(0,this.limitUI32-1)}randomUI40(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)}randomUI48(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)}create(){this.fromParts(this.randomUI32(),this.randomUI16(),16384|this.randomUI12(),128|this.randomUI06(),this.randomUI08(),this.randomUI48())}paddedString(t,n,r=null){r=r||"0";let o=n-(t=String(t)).length;for(;o>0;o>>>=1,r+=r)1&o&&(t=r+t);return t}fromParts(t,n,r,o,i,s){return this.version=r>>12&15,this.hex=this.paddedString(t.toString(16),8)+"-"+this.paddedString(n.toString(16),4)+"-"+this.paddedString(r.toString(16),4)+"-"+this.paddedString(o.toString(16),2)+this.paddedString(i.toString(16),2)+"-"+this.paddedString(s.toString(16),12),this}}class Qi{static updates(){return{context:null,updates:[]}}static subscribe(){return{context:null,subscribe:[]}}static unsubscribe(){return{context:null,unsubscribe:[]}}static request(){return{requestId:(new eT).toString()}}}let nT=(()=>{class e{constructor(){this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.version=1,this.endpoint="",this.selfId="",this._source=null,this._connect=new De,this.onConnect=this._connect.asObservable(),this._close=new De,this.onClose=this._close.asObservable(),this._error=new De,this.onError=this._error.asObservable(),this._message=new De,this.onMessage=this._message.asObservable()}set source(n){this._source||(this._source={}),this._source.label=n}set authToken(n){this._token=n}get connectionTimeout(){return this._wsTimeout}set connectionTimeout(n){this._wsTimeout=n<3e3?3e3:n>6e4?6e4:n}get isOpen(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}get filter(){return this._filter}set filter(n){this._filter=n&&-1!=n.indexOf("self")?this.selfId?this.selfId:"":n}get playbackMode(){return this._playbackMode}close(){this.ws&&(this.ws.close(),this.ws=null)}open(n,r,o){if(!(n=n||this.endpoint))return;let i=-1==n.indexOf("?")?"?":"&";r&&(n+=`${i}subscribe=${r}`),(this._token||o)&&(n+=`${r?"&":"?"}token=${this._token||o}`),this.close(),this.ws=new WebSocket(n),setTimeout(()=>{this.ws&&1!=this.ws.readyState&&3!=this.ws.readyState&&(console.warn(`Connection watchdog expired (${this._wsTimeout/1e3} sec): ${this.ws.readyState}... aborting connection...`),this.close())},this._wsTimeout),this.ws.onopen=s=>{this._connect.next(s)},this.ws.onclose=s=>{this._close.next(s)},this.ws.onerror=s=>{this._error.next(s)},this.ws.onmessage=s=>{this.parseOnMessage(s)}}parseOnMessage(n){let r;if("string"==typeof n.data)try{r=JSON.parse(n.data)}catch{return}this.isHello(r)?(this.selfId=r.self,this._playbackMode=typeof r.startTime<"u",this._message.next(r)):this.isResponse(r)?(typeof r.login<"u"&&typeof r.login.token<"u"&&(this._token=r.login.token),this._message.next(r)):this._filter&&this.isDelta(r)?r.context==this._filter&&this._message.next(r):this._message.next(r)}sendRequest(n){if("object"!=typeof n)return"";let r=Qi.request();return typeof n.login>"u"&&this._token&&(r.token=this._token),Object.keys(n).forEach(i=>{r[i]=n[i]}),this.send(r),r.requestId}put(n,r,o){return this.sendRequest({context:"self"==n?"vessels.self":n,put:{path:r,value:o}})}login(n,r){return this.sendRequest({login:{username:n,password:r}})}send(n){this.ws&&("object"==typeof n&&(n=JSON.stringify(n)),this.ws.send(n))}sendUpdate(n="self",r,o){let i=Qi.updates();this._token&&(i.token=this._token),i.context="self"==n?"vessels.self":n,this._token&&(i.token=this._token);let s=[];"string"==typeof r&&s.push({path:r,value:o}),"object"==typeof r&&Array.isArray(r)&&(s=r);let a={timestamp:(new Date).toISOString(),values:s};this._source&&(a.source=this._source),i.updates.push(a),this.send(i)}subscribe(n="*",r="*",o){let i=Qi.subscribe();if(this._token&&(i.token=this._token),i.context="self"==n?"vessels.self":n,this._token&&(i.token=this._token),"object"==typeof r&&Array.isArray(r)&&(i.subscribe=r),"string"==typeof r){let s={};s.path=r,o&&"object"==typeof o&&(o.period&&(s.period=o.period),o.minPeriod&&(s.minPeriod=o.period),o.format&&("delta"==o.format||"full"==o.format)&&(s.format=o.format),o.policy&&("instant"==o.policy||"ideal"==o.policy||"fixed"==o.policy)&&(s.policy=o.policy)),i.subscribe.push(s)}this.send(i)}unsubscribe(n="*",r="*"){let o=Qi.unsubscribe();this._token&&(o.token=this._token),o.context="self"==n?"vessels.self":n,this._token&&(o.token=this._token),"object"==typeof r&&Array.isArray(r)&&(o.unsubscribe=r),"string"==typeof r&&o.unsubscribe.push({path:r}),this.send(o)}raiseAlarm(n="*",r,o){let i;i="string"==typeof r&&-1==r.indexOf("notifications.")?`notifications.${r}`:r,this.put(n,i,o.value)}clearAlarm(n="*",r){let o=-1==r.indexOf("notifications.")?`notifications.${r}`:r;this.put(n,o,null)}isSelf(n){return n.context==this.selfId}isDelta(n){return typeof n.context<"u"}isHello(n){return typeof n.version<"u"&&typeof n.self<"u"}isResponse(n){return typeof n.requestId<"u"}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=we({token:e,factory:e.\u0275fac,providedIn:"root"}),e})();class oT{constructor(t,n,r,o){this._method=[],this._message="",this._message=typeof t<"u"?t:"",this._state=typeof n<"u"?n:qg.alarm,r&&this._method.push(Gl.visual),o&&this._method.push(Gl.sound)}get value(){return{message:this._message,state:this._state,method:this._method}}}var qg=function(e){return e.normal="normal",e.alert="alert",e.warn="warn",e.alarm="alarm",e.emergency="emergency",e}(qg||{}),Gl=function(e){return e.visual="visual",e.sound="sound",e}(Gl||{});class sT{constructor(){this.obsList=[],this.stream=new nT,this._connect=new De,this.onConnect=this._connect.asObservable(),this._close=new De,this.onClose=this._close.asObservable(),this._error=new De,this.onError=this._error.asObservable(),this._message=new De,this.onMessage=this._message.asObservable()}get endpoint(){return this.stream.endpoint}set endpoint(t){this.stream.endpoint=t}get selfId(){return this.stream.selfId}set selfId(t){this.stream.selfId=t}get _source(){return this.stream._source}set _source(t){this.stream._source=t}set source(t){this.stream.source=t}set authToken(t){this.stream.authToken=t}get connectionTimeout(){return this.stream.connectionTimeout}set connectionTimeout(t){this.stream.connectionTimeout=t}get isOpen(){return this.stream.isOpen}get filter(){return this.stream.filter}set filter(t){this.stream.filter=t}get playbackMode(){return this.stream.playbackMode}open(t,n="none",r){this.obsList.push(this.stream.onConnect.subscribe(o=>this._connect.next(o))),this.obsList.push(this.stream.onClose.subscribe(o=>this._close.next(o))),this.obsList.push(this.stream.onError.subscribe(o=>this._error.next(o))),this.obsList.push(this.stream.onMessage.subscribe(o=>this._message.next(o))),this.stream.open(t,n,r)}close(){this.stream.close(),this.obsList.forEach(t=>t.unsubscribe()),this.obsList=[]}sendRequest(t){return this.stream.sendRequest(t)}put(t,n,r){return this.stream.put(t,n,r)}login(t,n){return this.stream.login(t,n)}send(t){this.stream.send(t)}sendUpdate(t="self",n,r){this.stream.sendUpdate(t,n,r)}subscribe(t="*",n="*",r){this.stream.subscribe(t,n,r)}unsubscribe(t="*",n="*"){this.stream.unsubscribe(t,n)}raiseAlarm(t="*",n,r){this.stream.raiseAlarm(t,n,r)}clearAlarm(t="*",n){this.stream.clearAlarm(t,n)}isSelf(t){return this.stream.isSelf(t)}isDelta(t){return this.stream.isDelta(t)}isHello(t){return this.stream.isHello(t)}isResponse(t){return this.stream.isResponse(t)}}function po(e){return(po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function H(e,t,n){return(t=function lT(e){var t=function aT(e,t){if("object"!==po(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==po(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===po(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class zg{constructor(){H(this,"id",void 0),H(this,"position",[0,0]),H(this,"heading",void 0),H(this,"headingTrue",null),H(this,"headingMagnetic",null),H(this,"cog",void 0),H(this,"cogTrue",null),H(this,"cogMagnetic",null),H(this,"sog",void 0),H(this,"name",void 0),H(this,"mmsi",void 0),H(this,"callsign",void 0),H(this,"state",void 0),H(this,"wind",{direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null}),H(this,"lastUpdated",new Date),H(this,"orientation",0),H(this,"buddy",!1),H(this,"closestApproach",null),H(this,"mode","day"),H(this,"anchor",{maxRadius:null,radius:null,position:null}),H(this,"resourceUpdates",[]),H(this,"autopilot",{}),H(this,"track",[]),H(this,"courseApi",{arrivalCircle:0,activeRoute:{},nextPoint:{},previousPoint:{}}),H(this,"properties",{})}}class Kg{constructor(){H(this,"id",void 0),H(this,"lastUpdated",new Date),H(this,"name",void 0),H(this,"mmsi",void 0),H(this,"position",[0,0]),H(this,"properties",{}),H(this,"state",void 0)}}class Qg extends Kg{constructor(){super(),H(this,"type",{id:-1,name:""})}}class uT extends Qg{constructor(){super(),H(this,"callsign",void 0)}}class cT extends Kg{constructor(){super(),H(this,"orientation",0),H(this,"sog",0),H(this,"callsign",void 0),H(this,"track",[])}}class ql{static celciusToKelvin(t=0){return t+273.15}static kelvinToCelcius(t=0){return t-273.15}static kelvinToFarenheit(t=0){return 1.8*t-459.67}static degreesToRadians(t=0){return t*Math.PI/180}static radiansToDegrees(t=0){return 180*t/Math.PI}static angleToDirection(t,n){const r=2*Math.PI;if(n||(n=0),t||(t=0),isNaN(n)||isNaN(t))return null;const o=n+t;return o>r?o-r:o<0?r+o:o}static directionToAngle(t,n){const r=2*Math.PI;if(n||(n=0),t||(t=0),isNaN(n)||isNaN(t))return null;const o=n-t;let i;if(o>0)i=o>Math.PI?r-o:0-o;else if(o<0){const s=Math.abs(o);i=s>Math.PI?s-r:s}else i=o;return i}static knotsToKm(t){return 1.852*t}static nauticalMilesToKm(t){return 1.852*t}static knotsToMSec(t){return.51444325460445*t}static kmToKnots(t){return.539957*t}static kmToNauticalMiles(t){return.539957*t}static kmToMiles(t){return.621371*t}static msecToKnots(t){return 1.94384*t}static msecToKmh(t){return 3.6*t}static msecToMph(t){return 2.23694*t}static nauticalMilesToMiles(t){return 1.15078*t}static milesToKm(t){return 1.60934*t}static milesToNauticalMiles(t){return.868976*t}static rpmToHertz(t){return t/60}}var ho=es(939);class go{static destCoordinate(t,n,r){const o=(0,ho.computeDestinationPoint)(t,r,ql.radiansToDegrees(n));return[o.longitude,o.latitude]}static distanceTo(t,n){return(0,ho.getDistance)(t,n)}static routeLength(t){return(0,ho.getPathLength)(t)}static centreOfPolygon(t){const n=(0,ho.getCenter)(t);return[n.longitude,n.latitude]}static inDLCrossingZone(t,n=170){return Math.abs(t[0])>=n}static inBounds(t,n){return(0,ho.isPointInPolygon)(t,[[n[0],n[1]],[n[0],n[3]],[n[2],n[3]],[n[2],n[1]],[n[0],n[1]]])}static calcMapifiedExtent(t,n){const o=111111*Math.cos(ql.degreesToRadians(t[1])),i=[0,0,0,0];return i[1]=t[1]+(0-Math.abs(n))/111111,i[3]=t[1]+Math.abs(n)/111111,i[0]=t[0]+(0-Math.abs(n))/o,i[2]=t[0]+Math.abs(n)/o,i}static normaliseCoords(t){if(!Array.isArray(t))return[0,0];if("number"==typeof t[0]){if(t[0]>180)for(;t[0]>180;)t[0]=t[0]-360;else if(t[0]<-180)for(;t[0]<-180;)t[0]=360+t[0];return t}return Array.isArray(t[0])?(t.forEach(n=>this.normaliseCoords(n)),t):void 0}}class dT{constructor(t){H(this,"action",void 0),H(this,"playback",!1),H(this,"result",null),H(this,"type",void 0),H(this,"self",null),H(this,"timestamp",void 0),this.action="notification",this.type=t}}class Zg{constructor(){H(this,"action",void 0),H(this,"playback",!1),H(this,"result",null),H(this,"timestamp",void 0),H(this,"self",null),this.action="update"}}class fT extends Zg{constructor(){super(),this.action="trail"}}var pT=es(1275);const hT=["environment.wind.speedTrue","environment.wind.speedOverGround","environment.wind.angleTrueGround","environment.wind.angleTrueWater","environment.wind.directionTrue","environment.wind.directionMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.headingTrue","navigation.headingMagnetic"];let X,Te;const mo=[];let Kl,Zi=[],zl=!1,Yi=!1;const Se={signalk:{},aisState:[]};let Ge,Xg,Yg=[0,0,0,0],Jg=60,vo=0,yn={},bn=500,Ut=!1;const Bt={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20},yo={trailDuration:24,trailResolution:{lastHour:"5s",next23:"10s",beyond24:"1m"}};function em(){Ge={updated:{},stale:{},expired:{}}}function Ji({action:e,msg:t}){switch(e){case"onConnect":postMessage({action:"open",playback:Ut,result:t.target.readyState});break;case"onClose":console.warn("streamEvent: ",t),nm(!1);break;case"onError":console.warn("streamEvent: ",t),postMessage({action:"error",playback:Ut,result:"Connection error!"});break;case"onMessage":!function IT(e){Te.isHello(e)?(postMessage({action:"hello",result:e,self:e.self,playback:Ut}),bn&&im()):Te.isDelta(e)?(zl=!0,e.updates.forEach(t=>{t.values&&t.values.forEach(n=>{if(Xg=t.timestamp,e.context)switch(e.context.split(".")[0]){case"shore":case"atons":Se?.signalk.atons&&function MT(e,t){let n=!1;if(-1!=e.indexOf("shore.basestations")&&(n=!0),!X.atons.has(e)){const o=new Qg;o.id=e,o.position=null,n&&(o.type.id=-1,o.type.name="Basestation"),X.atons.set(e,o)}const r=X.atons.get(e);""===t.path?(typeof t.value.name<"u"&&(r.name=t.value.name),typeof t.value.mmsi<"u"&&(r.mmsi=t.value.mmsi),typeof t.value.atonType<"u"&&(r.type=t.value.atonType)):"atonType"===t.path?r.type=t.value:"navigation.position"===t.path?(r.position=[t.value.longitude,t.value.latitude],r.positionReceived=!0):r.properties[t.path]=t.value}(e.context,n),Xi(e.context,X.atons,Se?.signalk.atons);break;case"sar":Se?.signalk.sar&&function ET(e,t){if(!X.sar.has(e)){const r=new uT;r.id=e,r.position=null,r.type.id=-1,r.type.name="SaR Beacon",X.sar.set(e,r)}const n=X.sar.get(e);""===t.path?(typeof t.value.name<"u"&&(n.name=t.value.name),typeof t.value.mmsi<"u"&&(n.mmsi=t.value.mmsi)):"communication.callsignVhf"===t.path?n.callsign=t.value:"navigation.position"===t.path&&t.value?(n.position=go.normaliseCoords([t.value.longitude,t.value.latitude]),n.positionReceived=!0):n.properties[t.path]=t.value}(e.context,n),Xi(e.context,X.sar,Se?.signalk.sar);break;case"aircraft":Se?.signalk.aircraft&&function CT(e,t){if(!X.aircraft.has(e)){const r=new cT;r.id=e,r.position=null,X.aircraft.set(e,r)}const n=X.aircraft.get(e);""===t.path?(typeof t.value.name<"u"&&(n.name=t.value.name),typeof t.value.mmsi<"u"&&(n.mmsi=t.value.mmsi)):"communication.callsignVhf"===t.path?n.callsign=t.value:"navigation.position"===t.path&&t.value?(n.position=go.normaliseCoords([t.value.longitude,t.value.latitude]),n.positionReceived=!0,Ql(n)):"navigation.courseOverGroundTrue"===t.path?n.orientation=t.value:"navigation.speedOverGround"===t.path?n.sog=t.value:n.properties[t.path]=t.value}(e.context,n),Xi(e.context,X.aircraft,Se?.signalk.aircraft);break;case"vessels":if(Te.isSelf(e))am(X.self,n,!0),function DT(e,t){const n={path:e.path,value:e.value,context:t||null};let r;const o=e.path.split(".");if(("notifications.environment.depth.belowTransducer"===e.path||"notifications.environment.depth.belowSurface"===e.path||"notifications.environment.depth.belowKeel"===e.path)&&(r=o[2]),"notifications.navigation.anchor"===e.path&&(r=o[2]),-1!=["mob","sinking","fire","piracy","flooding","collision","grounding","listing","adrift","abandon"].indexOf(o[o.length-1])&&(r=o[o.length-1]),-1!=e.path.indexOf("notifications.navigation.closestApproach")&&(r=o[2],n.context=o[3]),-1!=e.path.indexOf("notifications.buddy")&&(r=o[1],n.context=o[2]),-1!=e.path.indexOf("notifications.navigation.course.arrivalCircleEntered")&&(r=o[3]),-1!=e.path.indexOf("notifications.navigation.course.perpendicularPassed")&&(r=o[3]),-1!=e.path.indexOf("notifications.environment.weather.warning")&&(r=o[2]),r){const i=new dT(r);i.playback=Ut,i.result=n,postMessage(i)}}(n);else{if(Se?.signalk.vessels){const r=function _T(e){if(!X.aisTargets.has(e)){const t=new zg;t.position=null,X.aisTargets.set(e,t)}return X.aisTargets.get(e)}(e.context);am(r,n)}Xi(e.context,X.aisTargets,Se?.signalk.vessels,Se?.aisState)}}})}),om()):Te.isResponse(e)&&postMessage({action:"response",result:e})}(t)}}function tm(e={}){e.interval&&"number"==typeof e.interval&&(bn=e.interval,sm(),im(),Jg=1/(bn/1e3)*60),Ut=!!e.playback,e.selections&&(typeof e.selections.preferredPaths<"u"&&(yn=e.selections.preferredPaths),e.selections.aisMaxAge&&"number"==typeof e.selections.aisMaxAge&&(Bt.maxAge=e.selections.aisMaxAge),e.selections.aisStaleAge&&"number"==typeof e.selections.aisStaleAge&&(Bt.staleAge=e.selections.aisStaleAge),"number"==typeof e.selections.signalk.maxRadius&&(Se.signalk=e.selections.signalk),typeof e.selections.aisState<"u"&&Array.isArray(e.selections.aisState)&&(Se.aisState=e.selections.aisState),console.log("Worker: AIS Filter...",Se))}function nm(e=!1){sm(),mo.forEach(t=>t.unsubscribe()),Te&&e&&Te.close(),Te=null,postMessage({action:"close",result:e,playback:Ut})}function bo(e){return new Promise((t,n)=>{fetch(`${e}`).then(r=>{r.json().then(o=>t(o)).catch(o=>n(o))}).catch(r=>{n(r)})})}function rm(){bo(Kl+"/tracks"+(Se&&Se.signalk&&Se.signalk.maxRadius?`?radius=${Se.signalk.maxRadius}`:"?radius=10000")).then(t=>{Yi=!0,Object.entries(t).forEach(n=>{if(X.aisTargets.has(n[0])){const r=X.aisTargets.get(n[0]);r.track=n[1].coordinates,Ql(r)}})}).catch(()=>{Yi=!1,console.warn("Unable to fetch AIS tracks!")})}function Xi(e,t,n=!0,r=[]){if(n){let o=t.get(e);o&&r.includes(o?.state)&&(console.log(`state match => ${r}, ${e}`),Ge.expired[e]=!0,o=null),o&&Se.signalk.maxRadius?o.positionReceived&&go.inBounds(o.position,Yg)?Ge.updated[e]=!0:(t.delete(e),Ge.expired[e]=!0):Ge.updated[e]=!0}else 0!=t.size&&(t.forEach((o,i)=>{Ge.expired[i]=!0}),t.clear())}function om(e=!1){if(!bn||e){const t=new Zg;t.playback=Ut,X.aisStatus.updated=Object.keys(Ge.updated),X.aisStatus.stale=Object.keys(Ge.stale),X.aisStatus.expired=Object.keys(Ge.expired),t.result=X,t.timestamp=Ut?Xg:X.self.lastUpdated.toISOString(),postMessage(t),em(),X.self.resourceUpdates=[],0===vo&&(function wT(){const e=(new Date).valueOf();X.aisTargets.forEach((t,n)=>{t.lastUpdated.valueOf()<e-Bt.maxAge?(Ge.expired[n]=!0,X.aisTargets.delete(n)):t.lastUpdated.valueOf()<e-Bt.staleAge&&(Ge.stale[n]=!0)}),X.aircraft.forEach((t,n)=>{t.lastUpdated.valueOf()<e-Bt.maxAge?(Ge.expired[n]=!0,X.aircraft.delete(n)):t.lastUpdated.valueOf()<e-Bt.staleAge&&(Ge.stale[n]=!0)}),X.sar.forEach((t,n)=>{t.lastUpdated.valueOf()<e-Bt.maxAge?(Ge.expired[n]=!0,X.sar.delete(n)):t.lastUpdated.valueOf()<e-Bt.staleAge&&(Ge.stale[n]=!0)})}(),X.self.positionReceived&&Se?.signalk.maxRadius&&(Yg=go.calcMapifiedExtent(X.self.position,Se.signalk.maxRadius),vo++)),vo=vo>=Jg?0:vo+1}}function im(){bn&&"number"==typeof bn&&Zi.push(setInterval(()=>{zl&&(om(!0),zl=!1)},bn)),Zi.push(setInterval(()=>{console.warn("hasTrackPlugin",Yi),Yi&&rm()},6e4))}function sm(){Zi.forEach(e=>clearInterval(e)),Zi=[]}function am(e,t,n=!1){if(e.lastUpdated=new Date,n){const r=-1!==t.path.indexOf("course")?t.path.split(".").slice(0,2).join("."):t.path;-1!=hT.indexOf(r)&&(X.paths[r]=null)}if(""===t.path)typeof t.value.name<"u"&&(e.name=t.value.name),typeof t.value.mmsi<"u"&&(e.mmsi=t.value.mmsi),typeof t.value.buddy<"u"&&(e.buddy=t.value.buddy);else if("communication.callsignVhf"===t.path)e.callsign=t.value;else if("navigation.position"===t.path&&t.value){if(typeof t.value.longitude>"u")return;e.position=go.normaliseCoords([t.value.longitude,t.value.latitude]),e.positionReceived=!0,n||Ql(e)}else"navigation.state"===t.path?e.state=t.value:"navigation.speedOverGround"===t.path?e.sog=t.value:"navigation.courseOverGroundTrue"===t.path?e.cogTrue=t.value:"navigation.courseOverGroundMagnetic"===t.path?e.cogMagnetic=t.value:"navigation.headingTrue"===t.path?e.headingTrue=t.value:"navigation.headingMagnetic"===t.path?e.headingMagnetic=t.value:"environment.wind.angleApparent"===t.path?e.wind.awa=t.value:"environment.wind.speedApparent"===t.path?e.wind.aws=t.value:"environment.wind.speedTrue"===t.path?e.wind.speedTrue=t.value:"environment.wind.speedOverGround"===t.path?e.wind.sog=t.value:"environment.wind.directionTrue"===t.path?e.wind.twd=t.value:"environment.wind.directionMagnetic"===t.path?e.wind.mwd=t.value:"environment.mode"===t.path?e.mode=t.value:-1!==t.path.indexOf("navigation.course.")?-1!==t.path.indexOf("navigation.course.calcValues")?-1===t.path.indexOf("navigation.course.calcValues.previousPoint")&&(e[`course.${t.path.split(".").slice(-1)[0]}`]=t.value):-1!==t.path.indexOf("navigation.course.activeRoute")?e.courseApi.activeRoute=t.value:-1!==t.path.indexOf("navigation.course.nextPoint")?e.courseApi.nextPoint=t.value:-1!==t.path.indexOf("navigation.course.previousPoint")?e.courseApi.previousPoint=t.value:"navigation.course.arrivalCircle"===t.path&&(e.courseApi.arrivalCircle=t.value):-1!=t.path.indexOf("navigation.closestApproach")?e.closestApproach=t.value:"navigation.anchor.position"===t.path?e.anchor.position=t.value:"navigation.anchor.maxRadius"===t.path?e.anchor.maxRadius=t.value:"navigation.anchor.currentRadius"===t.path?e.anchor.radius=t.value:-1!=t.path.indexOf("resources.")?e.resourceUpdates.push(t):"steering.autopilot.state"===t.path?e.autopilot.state=t.value:"steering.autopilot.mode"===t.path?e.autopilot.mode=t.value:"steering.autopilot.enabled"===t.path?e.autopilot.enabled=t.value:e.properties[t.path]=t.value;e.heading=null===e.heading&&null!=e.cog?e.cog:e.heading,typeof yn.heading<"u"&&t.path===yn.heading&&(e.orientation=t.value),typeof yn.tws<"u"&&t.path===yn.tws&&(e.wind.tws=t.value),typeof yn.twd<"u"&&t.path===yn.twd&&(e.wind.direction="environment.wind.angleTrueGround"===t.path||"environment.wind.angleTrueWater"===t.path?ql.angleToDirection(t.value,e.heading):t.value)}function Ql(e){if(e.track&&0===e.track.length)e.track.push([e.position]);else{const n=e.track[e.track.length-1][e.track[e.track.length-1].length-1];n[0]!=e.position[0]&&n[1]!=e.position[1]&&e.track[e.track.length-1].push(e.position)}e.track[e.track.length-1]=e.track[e.track.length-1].slice(0-Bt.maxTrack)}addEventListener("message",({data:e})=>{!function mT(e){if(e.cmd)switch(e.cmd){case"open":console.log("Worker control: opening stream..."),tm(e.options),function yT(e){if(Te)return;if(!e.url)return void postMessage({action:"error",result:"Valid options not provided!"});const t=e.url.split("/");if(t.pop(),t.push("api"),t[0]="wss:"===t[0]?"https:":"http:",Kl=t.join("/"),function gT(){X={self:new zg,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map},X.self.positionReceived=!1,em()}(),Te=new sT,mo.push(Te.onConnect.subscribe(n=>Ji({action:"onConnect",msg:n}))),mo.push(Te.onClose.subscribe(n=>Ji({action:"onClose",msg:n}))),mo.push(Te.onError.subscribe(n=>Ji({action:"onError",msg:n}))),mo.push(Te.onMessage.subscribe(n=>Ji({action:"onMessage",msg:n}))),e.playback){const n=e.playbackOptions.startTime?`?startTime=${e.playbackOptions.startTime}`:null;let r=e.playbackOptions.playbackRate?`playbackRate=${e.playbackOptions.playbackRate}`:null;r=r?n?"&"+r:"?"+r:null,Te.open(`${e.url}${n||""}${r||""}`,e.playbackOptions.subscribe,e.token)}else Te.open(e.url,e.subscribe,e.token),rm()}(e.options);break;case"close":console.log("Worker control: closing stream..."),nm(!0);break;case"subscribe":console.log("Worker control: subscribing to paths..."),Te.subscribe(e.options.context,e.options.path);break;case"settings":console.log("Worker control: settings..."),tm(e.options);break;case"alarm":console.log("Worker control: alarm action..."),function bT(e){const t=-1===e.type.indexOf("notifications.")?`notifications.${e.type}`:e.type;e.raise?Te.raiseAlarm("self",t,new oT(e.message,e.state,!0,!0)):Te.clearAlarm("self",t)}(e.options);break;case"vessel":if(console.log("Worker control: vessel setting..."),e.options){let t;t="self"===e.options.context?X.self:X.aisTargets.get(e.options.context),t&&e.options.name&&(t.name=e.options.name)}break;case"auth":console.log("Worker control: auth token..."),e.options&&(Te.authToken=e.options.token);break;case"trail":console.log("Worker control: Fetch vessel trail from server..."),e.options&&(yo.trailDuration=e.options.trailDuration??24,e.options.trailResolution&&(yo.trailResolution.lastHour=e.options.trailResolution.lastHour??"5s",yo.trailResolution.next23=e.options.trailResolution.next23??"1m",yo.trailResolution.beyond24=e.options.trailResolution.beyond24??"5m")),function vT(e){console.info("Worker: Fetching vessel trail from server",e);const t=Kl+"/self/track?",n=[];e.trailDuration>24&&(n.push(bo(`${t}timespan=${e.trailDuration-24}h&resolution=${e.trailResolution.beyond24}&timespanOffset=24`)),n.push(bo(`${t}timespan=23h&resolution=${e.trailResolution.next23}&timespanOffset=1`))),e.trailDuration>1&&e.trailDuration<25&&n.push(bo(`${t}timespan=${e.trailDuration-1}h&resolution=${e.trailResolution.next23}&timespanOffset=1`)),n.push(bo(`${t}timespan=1h&resolution=${e.trailResolution.lastHour}`));let i=[];const s=new fT;s.playback=Ut,Promise.all(n).then(a=>{let l=0;const u=n.length-1;a.forEach(d=>{if(d.type&&"MultiLineString"===d.type&&d.coordinates&&Array.isArray(d.coordinates))if(l!=u){let m=[];for(d.coordinates.forEach(I=>{m=m.concat(I)}),m=(0,pT.EK)(m,5e-4,true);m.length>60;){const I=m.slice(0,60);i.push(I),m=m.slice(59),m[0]=[m[0][0]+5e-9,m[0][1]+5e-9]}0!==m.length&&i.push(m)}else i=i.concat(d.coordinates);l++}),s.result=i,postMessage(s)}).catch(()=>{s.result=null,postMessage(s)})}(yo)}}(e)})})()})();
1
+ (()=>{"use strict";var lm={1924:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(6953)),N=E(v(5794)),w=E(v(7176)),x=E(v(3620)),D=v(5419);function E(p){return p&&p.__esModule?p:{default:p}}f.default=function(y,b,_){var T=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,O=(0,C.default)(y),L=(0,N.default)(y),Y=b/T,ce=(0,w.default)(_),ve=(0,w.default)(O),ae=(0,w.default)(L),ke=Math.asin(Math.sin(ve)*Math.cos(Y)+Math.cos(ve)*Math.sin(Y)*Math.cos(ce)),Ne=ae+Math.atan2(Math.sin(ce)*Math.sin(Y)*Math.cos(ve),Math.cos(Y)-Math.sin(ve)*Math.sin(ke)),he=(0,x.default)(Ne);return(he<D.MINLON||he>D.MAXLON)&&(Ne=(Ne+3*Math.PI)%(2*Math.PI)-Math.PI,he=(0,x.default)(Ne)),{latitude:(0,x.default)(ke),longitude:he}}},5419:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.areaConversion=f.timeConversion=f.distanceConversion=f.altitudeKeys=f.latitudeKeys=f.longitudeKeys=f.MAXLON=f.MINLON=f.MAXLAT=f.MINLAT=f.earthRadius=f.sexagesimalPattern=void 0,f.sexagesimalPattern=/^([0-9]{1,3})\xb0\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['\u2032]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["\u2033]\s*)?([NEOSW]?)$/,f.earthRadius=6378137,f.MINLAT=-90,f.MAXLAT=90,f.MINLON=-180,f.MAXLON=180,f.longitudeKeys=["lng","lon","longitude",0],f.latitudeKeys=["lat","latitude",1],f.altitudeKeys=["alt","altitude","elevation","elev",2],f.distanceConversion={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},f.timeConversion={m:60,h:3600,d:86400};var b={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};f.areaConversion=b,b.sqm=b.m2,b.sqkm=b.km2,b.sqft=b.ft2,b.sqyd=b.yd2,b.sqin=b.in2},1572:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){var h=C.areaConversion[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m"];if(h)return D*h;throw new Error("Invalid unit used for area conversion.")}},3394:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){var h=C.distanceConversion[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m"];if(h)return D*h;throw new Error("Invalid unit used for distance conversion.")}},3418:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh"){case"kmh":return D*C.timeConversion.h*C.distanceConversion.km;case"mph":return D*C.timeConversion.h*C.distanceConversion.mi;default:return D}}},3370:(F,f)=>{function v(p,y){return function D(p){if(Array.isArray(p))return p}(p)||function x(p,y){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(p)){var b=[],_=!0,T=!1,O=void 0;try{for(var Y,L=p[Symbol.iterator]();!(_=(Y=L.next()).done)&&(b.push(Y.value),!y||b.length!==y);_=!0);}catch(ce){T=!0,O=ce}finally{try{!_&&null!=L.return&&L.return()}finally{if(T)throw O}}return b}}(p,y)||function N(p,y){if(p){if("string"==typeof p)return w(p,y);var b=Object.prototype.toString.call(p).slice(8,-1);if("Object"===b&&p.constructor&&(b=p.constructor.name),"Map"===b||"Set"===b)return Array.from(p);if("Arguments"===b||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(b))return w(p,y)}}(p,y)||function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(p,y){(null==y||y>p.length)&&(y=p.length);for(var b=0,_=new Array(y);b<y;b++)_[b]=p[b];return _}Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(y){var _=v(y.toString().split("."),2),O=_[1],L=Math.abs(Number(_[0])),Y=60*+("0."+(O||0)),ce=Y.toString().split("."),ve=Math.floor(Y),ae=function(y){var _=Math.pow(10,arguments.length>1&&void 0!==arguments[1]?arguments[1]:4);return Math.round(y*_)/_}(60*+("0."+(ce[1]||0))).toString(),Ne=v(ae.split("."),2),he=Ne[0],pe=Ne[1],ye=void 0===pe?"0":pe;return L+"\xb0 "+ve.toString().padStart(2,"0")+"' "+he.padStart(2,"0")+"."+ye.padEnd(1,"0")+'"'}},427:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(5548));f.default=function(E,h){return(0,C.default)(E,h)[0]}},9913:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(7176)),N=D(v(6953)),w=D(v(5794)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p){var y=0;if(p.length>2){for(var b,_,T,O=0;O<p.length;O++){O===p.length-2?(b=p.length-2,_=p.length-1,T=0):O===p.length-1?(b=p.length-1,_=0,T=1):(b=O,_=O+1,T=O+2);var L=(0,w.default)(p[b]),Y=(0,N.default)(p[_]),ce=(0,w.default)(p[T]);y+=((0,C.default)(ce)-(0,C.default)(L))*Math.sin((0,C.default)(Y))}y=y*x.earthRadius*x.earthRadius/2}return Math.abs(y)}},2968:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(6953)),N=w(v(5794));function w(E){return E&&E.__esModule?E:{default:E}}f.default=function(h){if(!1===Array.isArray(h)||0===h.length)throw new Error("No points were given.");return h.reduce(function(g,p){var y=(0,C.default)(p),b=(0,N.default)(p);return{maxLat:Math.max(y,g.maxLat),minLat:Math.min(y,g.minLat),maxLng:Math.max(b,g.maxLng),minLng:Math.min(b,g.minLng)}},{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})}},2477:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(6953)),N=E(v(5794)),w=E(v(7176)),x=E(v(3620)),D=v(5419);function E(p){return p&&p.__esModule?p:{default:p}}f.default=function(y,b){var pe,ye,_=(0,C.default)(y),T=(0,N.default)(y),O=(0,w.default)(_),L=(0,w.default)(T),Y=b/D.earthRadius,ce=O-Y,ve=O+Y,ae=(0,w.default)(D.MAXLAT),ke=(0,w.default)(D.MINLAT),Ne=(0,w.default)(D.MAXLON),he=(0,w.default)(D.MINLON);if(ce>ke&&ve<ae){var De=Math.asin(Math.sin(Y)/Math.cos(O));(pe=L-De)<he&&(pe+=2*Math.PI),(ye=L+De)>Ne&&(ye-=2*Math.PI)}else ce=Math.max(ce,ke),ve=Math.min(ve,ae),pe=he,ye=Ne;return[{latitude:(0,x.default)(ce),longitude:(0,x.default)(pe)},{latitude:(0,x.default)(ve),longitude:(0,x.default)(ye)}]}},7977:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=D(v(3620));function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p){if(!1===Array.isArray(p)||0===p.length)return!1;var y=p.length,b=p.reduce(function(L,Y){var ce=(0,w.default)((0,C.default)(Y)),ve=(0,w.default)((0,N.default)(Y));return{X:L.X+Math.cos(ce)*Math.cos(ve),Y:L.Y+Math.cos(ce)*Math.sin(ve),Z:L.Z+Math.sin(ce)}},{X:0,Y:0,Z:0}),_=b.X/y,T=b.Y/y,O=b.Z/y;return{longitude:(0,x.default)(Math.atan2(T,_)),latitude:(0,x.default)(Math.atan2(O,Math.sqrt(_*_+T*T)))}}},1102:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(2968));f.default=function(E){var h=(0,C.default)(E),p=h.minLng+(h.maxLng-h.minLng)/2;return{latitude:parseFloat((h.minLat+(h.maxLat-h.minLat)/2).toFixed(6)),longitude:parseFloat(p.toFixed(6))}}},1345:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(4539));f.default=function(E,h){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default,p="function"==typeof g?g(E,h):(0,C.default)(E,h);if(isNaN(p))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(p/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}}},8954:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w,x){return x.reduce(function(D,E){if(typeof w>"u"||null===w)throw new Error("'".concat(w,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(w,E)&&typeof E<"u"&&typeof D>"u"?(D=E,E):D},void 0)}},999:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419),N=function w(p){return p&&p.__esModule?p:{default:p}}(v(8954));function x(p,y){var b=Object.keys(p);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(p);y&&(_=_.filter(function(T){return Object.getOwnPropertyDescriptor(p,T).enumerable})),b.push.apply(b,_)}return b}function E(p,y,b){return y in p?Object.defineProperty(p,y,{value:b,enumerable:!0,configurable:!0,writable:!0}):p[y]=b,p}f.default=function(y){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:C.longitudeKeys,latitude:C.latitudeKeys,altitude:C.altitudeKeys},_=(0,N.default)(y,b.longitude),T=(0,N.default)(y,b.latitude),O=(0,N.default)(y,b.altitude);return function D(p){for(var y=1;y<arguments.length;y++){var b=null!=arguments[y]?arguments[y]:{};y%2?x(Object(b),!0).forEach(function(_){E(p,_,b[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(b)):x(Object(b)).forEach(function(_){Object.defineProperty(p,_,Object.getOwnPropertyDescriptor(b,_))})}return p}({latitude:T,longitude:_},O?{altitude:O}:{})}},7842:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(6953)),N=E(v(5794)),w=E(v(7176)),x=E(v(5012)),D=v(5419);function E(p){return p&&p.__esModule?p:{default:p}}f.default=function(y,b){var _=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;_=typeof _<"u"&&!isNaN(_)?_:1;var T=(0,C.default)(y),O=(0,N.default)(y),L=(0,C.default)(b),Y=(0,N.default)(b),ce=Math.acos((0,x.default)(Math.sin((0,w.default)(L))*Math.sin((0,w.default)(T))+Math.cos((0,w.default)(L))*Math.cos((0,w.default)(T))*Math.cos((0,w.default)(O)-(0,w.default)(Y))))*D.earthRadius;return Math.round(ce/_)*_}},5868:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(7842)),N=w(v(5012));function w(E){return E&&E.__esModule?E:{default:E}}f.default=function(h,g,p){var y=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,b=(0,C.default)(g,h,y),_=(0,C.default)(h,p,y),T=(0,C.default)(g,p,y),O=Math.acos((0,N.default)((b*b+T*T-_*_)/(2*b*T))),L=Math.acos((0,N.default)((_*_+T*T-b*b)/(2*_*T)));return O>Math.PI/2?b:L>Math.PI/2?_:Math.sin(O)*b}},3466:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=D(v(3620));function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p,y){var b=(0,C.default)(y),_=(0,N.default)(y),T=(0,C.default)(p),O=(0,N.default)(p);return((0,x.default)(Math.atan2(Math.sin((0,w.default)(_)-(0,w.default)(O))*Math.cos((0,w.default)(b)),Math.cos((0,w.default)(T))*Math.sin((0,w.default)(b))-Math.sin((0,w.default)(T))*Math.cos((0,w.default)(b))*Math.cos((0,w.default)(_)-(0,w.default)(O))))+360)%360}},6953:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419),N=x(v(8954)),w=x(v(6232));function x(h){return h&&h.__esModule?h:{default:h}}f.default=function(g,p){var y=(0,N.default)(g,C.latitudeKeys);if(!(typeof y>"u"||null===y)){var b=g[y];return!0===p?b:(0,w.default)(b)}}},5794:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419),N=x(v(8954)),w=x(v(6232));function x(h){return h&&h.__esModule?h:{default:h}}f.default=function(g,p){var y=(0,N.default)(g,C.longitudeKeys);if(!(typeof y>"u"||null===y)){var b=g[y];return!0===p?b:(0,w.default)(b)}}},1931:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(E){return E&&E.__esModule?E:{default:E}}(v(7842));function w(E){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"==typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g})(E)}f.default=function(h){var g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:C.default;return h.reduce(function(p,y){return"object"===w(p)&&null!==p.last&&(p.distance+=g(y,p.last)),p.last=y,p},{last:null,distance:0}).distance}},3502:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p,y){var b=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;b=typeof b<"u"&&!isNaN(b)?b:1;var ae,ke,Ne,he,pe,ye,nn,_=(0,C.default)(p),T=(0,N.default)(p),O=(0,C.default)(y),L=(0,N.default)(y),Y=6356752.314245,ce=1/298.257223563,ve=(0,w.default)(L-T),De=Math.atan((1-ce)*Math.tan((0,w.default)(parseFloat(_)))),tn=Math.atan((1-ce)*Math.tan((0,w.default)(parseFloat(O)))),Gt=Math.sin(De),Nt=Math.cos(De),Pt=Math.sin(tn),gt=Math.cos(tn),xt=ve,In=100;do{var rn=Math.sin(xt),mt=Math.cos(xt);if(0===(ye=Math.sqrt(gt*rn*(gt*rn)+(Nt*Pt-Gt*gt*mt)*(Nt*Pt-Gt*gt*mt))))return 0;ae=Gt*Pt+Nt*gt*mt,ke=Math.atan2(ye,ae),pe=ae-2*Gt*Pt/(he=1-(Ne=Nt*gt*rn/ye)*Ne),isNaN(pe)&&(pe=0);var _n=ce/16*he*(4+ce*(4-3*he));nn=xt,xt=ve+(1-_n)*ce*Ne*(ke+_n*ye*(pe+_n*ae*(2*pe*pe-1)))}while(Math.abs(xt-nn)>1e-12&&--In>0);if(0===In)return NaN;var st=he*(x.earthRadius*x.earthRadius-Y*Y)/(Y*Y),qt=st/1024*(256+st*(st*(74-47*st)-128));return Math.round(Y*(1+st/16384*(4096+st*(st*(320-175*st)-768)))*(ke-qt*ye*(pe+qt/4*(ae*(2*pe*pe-1)-qt/6*pe*(4*ye*ye-3)*(4*pe*pe-3))))/b)*b}},4539:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(6953)),N=D(v(5794)),w=D(v(7176)),x=D(v(3620));function D(g){return g&&g.__esModule?g:{default:g}}f.default=function(p,y){var b=(0,w.default)((0,N.default)(y))-(0,w.default)((0,N.default)(p)),_=Math.log(Math.tan((0,w.default)((0,C.default)(y))/2+Math.PI/4)/Math.tan((0,w.default)((0,C.default)(p))/2+Math.PI/4));return Math.abs(b)>Math.PI&&(b=b>0?-1*(2*Math.PI-b):2*Math.PI+b),((0,x.default)(Math.atan2(b,_))+360)%360}},3467:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return/^(NNE|NE|NNW|N)$/.test(w)?"N":/^(ENE|E|ESE|SE)$/.test(w)?"E":/^(SSE|S|SSW|SW)$/.test(w)?"S":/^(WSW|W|WNW|NW)$/.test(w)?"W":void 0}},393:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default)(E,h)/(Number(h.time)-Number(E.time))*1e3}},939:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0});var C={computeDestinationPoint:!0,convertArea:!0,convertDistance:!0,convertSpeed:!0,decimalToSexagesimal:!0,findNearest:!0,getAreaOfPolygon:!0,getBounds:!0,getBoundsOfDistance:!0,getCenter:!0,getCenterOfBounds:!0,getCompassDirection:!0,getCoordinateKey:!0,getCoordinateKeys:!0,getDistance:!0,getDistanceFromLine:!0,getGreatCircleBearing:!0,getLatitude:!0,getLongitude:!0,getPathLength:!0,getPreciseDistance:!0,getRhumbLineBearing:!0,getRoughCompassDirection:!0,getSpeed:!0,isDecimal:!0,isPointInLine:!0,isPointInPolygon:!0,isPointNearLine:!0,isPointWithinRadius:!0,isSexagesimal:!0,isValidCoordinate:!0,isValidLatitude:!0,isValidLongitude:!0,orderByDistance:!0,sexagesimalToDecimal:!0,toDecimal:!0,toRad:!0,toDeg:!0,wktToPolygon:!0};Object.defineProperty(f,"computeDestinationPoint",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(f,"convertArea",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(f,"convertDistance",{enumerable:!0,get:function(){return x.default}}),Object.defineProperty(f,"convertSpeed",{enumerable:!0,get:function(){return D.default}}),Object.defineProperty(f,"decimalToSexagesimal",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(f,"findNearest",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(f,"getAreaOfPolygon",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(f,"getBounds",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(f,"getBoundsOfDistance",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(f,"getCenter",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(f,"getCenterOfBounds",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(f,"getCompassDirection",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(f,"getCoordinateKey",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(f,"getCoordinateKeys",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(f,"getDistance",{enumerable:!0,get:function(){return Y.default}}),Object.defineProperty(f,"getDistanceFromLine",{enumerable:!0,get:function(){return ce.default}}),Object.defineProperty(f,"getGreatCircleBearing",{enumerable:!0,get:function(){return ve.default}}),Object.defineProperty(f,"getLatitude",{enumerable:!0,get:function(){return ae.default}}),Object.defineProperty(f,"getLongitude",{enumerable:!0,get:function(){return ke.default}}),Object.defineProperty(f,"getPathLength",{enumerable:!0,get:function(){return Ne.default}}),Object.defineProperty(f,"getPreciseDistance",{enumerable:!0,get:function(){return he.default}}),Object.defineProperty(f,"getRhumbLineBearing",{enumerable:!0,get:function(){return pe.default}}),Object.defineProperty(f,"getRoughCompassDirection",{enumerable:!0,get:function(){return ye.default}}),Object.defineProperty(f,"getSpeed",{enumerable:!0,get:function(){return De.default}}),Object.defineProperty(f,"isDecimal",{enumerable:!0,get:function(){return tn.default}}),Object.defineProperty(f,"isPointInLine",{enumerable:!0,get:function(){return Gt.default}}),Object.defineProperty(f,"isPointInPolygon",{enumerable:!0,get:function(){return Nt.default}}),Object.defineProperty(f,"isPointNearLine",{enumerable:!0,get:function(){return Pt.default}}),Object.defineProperty(f,"isPointWithinRadius",{enumerable:!0,get:function(){return gt.default}}),Object.defineProperty(f,"isSexagesimal",{enumerable:!0,get:function(){return xt.default}}),Object.defineProperty(f,"isValidCoordinate",{enumerable:!0,get:function(){return nn.default}}),Object.defineProperty(f,"isValidLatitude",{enumerable:!0,get:function(){return In.default}}),Object.defineProperty(f,"isValidLongitude",{enumerable:!0,get:function(){return rn.default}}),Object.defineProperty(f,"orderByDistance",{enumerable:!0,get:function(){return mt.default}}),Object.defineProperty(f,"sexagesimalToDecimal",{enumerable:!0,get:function(){return _n.default}}),Object.defineProperty(f,"toDecimal",{enumerable:!0,get:function(){return st.default}}),Object.defineProperty(f,"toRad",{enumerable:!0,get:function(){return hr.default}}),Object.defineProperty(f,"toDeg",{enumerable:!0,get:function(){return qt.default}}),Object.defineProperty(f,"wktToPolygon",{enumerable:!0,get:function(){return Dn.default}});var N=Z(v(1924)),w=Z(v(1572)),x=Z(v(3394)),D=Z(v(3418)),E=Z(v(3370)),h=Z(v(427)),g=Z(v(9913)),p=Z(v(2968)),y=Z(v(2477)),b=Z(v(7977)),_=Z(v(1102)),T=Z(v(1345)),O=Z(v(8954)),L=Z(v(999)),Y=Z(v(7842)),ce=Z(v(5868)),ve=Z(v(3466)),ae=Z(v(6953)),ke=Z(v(5794)),Ne=Z(v(1931)),he=Z(v(3502)),pe=Z(v(4539)),ye=Z(v(3467)),De=Z(v(393)),tn=Z(v(8155)),Gt=Z(v(909)),Nt=Z(v(7349)),Pt=Z(v(5942)),gt=Z(v(3609)),xt=Z(v(5099)),nn=Z(v(9345)),In=Z(v(1041)),rn=Z(v(2816)),mt=Z(v(5548)),_n=Z(v(2402)),st=Z(v(6232)),hr=Z(v(7176)),qt=Z(v(3620)),Dn=Z(v(3498)),on=v(5419);function Z($){return $&&$.__esModule?$:{default:$}}Object.keys(on).forEach(function($){"default"===$||"__esModule"===$||Object.prototype.hasOwnProperty.call(C,$)||Object.defineProperty(f,$,{enumerable:!0,get:function(){return on[$]}})})},8155:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){var x=w.toString().trim();return!isNaN(parseFloat(x))&&parseFloat(x)===Number(x)}},909:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h,g){return(0,C.default)(h,E)+(0,C.default)(E,g)===(0,C.default)(h,g)}},7349:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=w(v(6953)),N=w(v(5794));function w(E){return E&&E.__esModule?E:{default:E}}f.default=function(h,g){for(var p=!1,y=g.length,b=-1,_=y-1;++b<y;_=b)((0,N.default)(g[b])<=(0,N.default)(h)&&(0,N.default)(h)<(0,N.default)(g[_])||(0,N.default)(g[_])<=(0,N.default)(h)&&(0,N.default)(h)<(0,N.default)(g[b]))&&(0,C.default)(h)<((0,C.default)(g[_])-(0,C.default)(g[b]))*((0,N.default)(h)-(0,N.default)(g[b]))/((0,N.default)(g[_])-(0,N.default)(g[b]))+(0,C.default)(g[b])&&(p=!p);return p}},5942:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(5868));f.default=function(E,h,g,p){return(0,C.default)(E,h,g)<p}},3609:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h,g){return(0,C.default)(E,h,.01)<g}},5099:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){return C.sexagesimalPattern.test(D.toString().trim())}},9345:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=x(v(999)),N=x(v(1041)),w=x(v(2816));function x(h){return h&&h.__esModule?h:{default:h}}f.default=function(g){var p=(0,C.default)(g),y=p.latitude,b=p.longitude;if(Array.isArray(g)&&g.length>=2)return(0,w.default)(g[0])&&(0,N.default)(g[1]);if(typeof y>"u"||typeof b>"u")return!1;var _=g[b],T=g[y];return!(typeof T>"u"||typeof _>"u"||!1===(0,N.default)(T)||!1===(0,w.default)(_))}},1041:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(8155)),N=D(v(5099)),w=D(v(2402)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function g(p){return(0,C.default)(p)?!(parseFloat(p)>x.MAXLAT||p<x.MINLAT):!!(0,N.default)(p)&&g((0,w.default)(p))}},2816:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=D(v(8155)),N=D(v(5099)),w=D(v(2402)),x=v(5419);function D(g){return g&&g.__esModule?g:{default:g}}f.default=function g(p){return(0,C.default)(p)?!(parseFloat(p)>x.MAXLON||p<x.MINLON):!!(0,N.default)(p)&&g((0,w.default)(p))}},5548:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=function N(D){return D&&D.__esModule?D:{default:D}}(v(7842));f.default=function(E,h){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:C.default;return g="function"==typeof g?g:C.default,h.slice().sort(function(p,y){return g(E,p)-g(E,y)})}},5012:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return w>1?1:w<-1?-1:w}},2402:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=v(5419);f.default=function(D){var E=new RegExp(C.sexagesimalPattern).exec(D.toString().trim());if(typeof E>"u"||null===E)throw new Error("Given value is not in sexagesimal format");var h=Number(E[2])/60||0,g=Number(E[4])/3600||0,p=parseFloat(E[1])+h+g;return["S","W"].includes(E[7])?-p:p}},6232:(F,f,v)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0;var C=E(v(8155)),N=E(v(5099)),w=E(v(2402)),x=E(v(9345)),D=E(v(999));function E(_){return _&&_.__esModule?_:{default:_}}function h(_,T){var O=Object.keys(_);if(Object.getOwnPropertySymbols){var L=Object.getOwnPropertySymbols(_);T&&(L=L.filter(function(Y){return Object.getOwnPropertyDescriptor(_,Y).enumerable})),O.push.apply(O,L)}return O}function g(_){for(var T=1;T<arguments.length;T++){var O=null!=arguments[T]?arguments[T]:{};T%2?h(Object(O),!0).forEach(function(L){p(_,L,O[L])}):Object.getOwnPropertyDescriptors?Object.defineProperties(_,Object.getOwnPropertyDescriptors(O)):h(Object(O)).forEach(function(L){Object.defineProperty(_,L,Object.getOwnPropertyDescriptor(O,L))})}return _}function p(_,T,O){return T in _?Object.defineProperty(_,T,{value:O,enumerable:!0,configurable:!0,writable:!0}):_[T]=O,_}f.default=function _(T){if((0,C.default)(T))return Number(T);if((0,N.default)(T))return(0,w.default)(T);if((0,x.default)(T)){var O=(0,D.default)(T);return Array.isArray(T)?T.map(function(L,Y){return[0,1].includes(Y)?_(L):L}):g(g(g({},T),O.latitude&&p({},O.latitude,_(T[O.latitude]))),O.longitude&&p({},O.longitude,_(T[O.longitude])))}return Array.isArray(T)?T.map(function(L){return(0,x.default)(L)?_(L):L}):T}},3620:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return 180*w/Math.PI}},7176:(F,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(w){return w*Math.PI/180}},3498:(F,f)=>{function w(g,p){(null==p||p>g.length)&&(p=g.length);for(var y=0,b=new Array(p);y<p;y++)b[y]=g[y];return b}Object.defineProperty(f,"__esModule",{value:!0}),f.default=void 0,f.default=function(p){if(!p.startsWith("POLYGON"))throw new Error("Invalid wkt.");return p.slice(p.indexOf("(")+2,p.indexOf(")")).split(", ").map(function(_){var O=function v(g,p){return function D(g){if(Array.isArray(g))return g}(g)||function x(g,p){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(g)){var y=[],b=!0,_=!1,T=void 0;try{for(var L,O=g[Symbol.iterator]();!(b=(L=O.next()).done)&&(y.push(L.value),!p||y.length!==p);b=!0);}catch(Y){_=!0,T=Y}finally{try{!b&&null!=O.return&&O.return()}finally{if(_)throw T}}return y}}(g,p)||function N(g,p){if(g){if("string"==typeof g)return w(g,p);var y=Object.prototype.toString.call(g).slice(8,-1);if("Object"===y&&g.constructor&&(y=g.constructor.name),"Map"===y||"Set"===y)return Array.from(g);if("Arguments"===y||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(y))return w(g,p)}}(g,p)||function C(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(_.split(" "),2),Y=O[1];return{longitude:parseFloat(O[0]),latitude:parseFloat(Y)}})}},5365:(F,f)=>{function v(h,g){return h*h+g*g}function C(h,g){return v(h[0]-g[0],h[1]-g[1])}function N(h,g,p){var y=g[0],b=g[1],_=p[0]-y,T=p[1]-b;if(0!==_||0!==T){var O=((h[0]-y)*_+(h[1]-b)*T)/v(_,T);O>1?(y=p[0],b=p[1]):O>0&&(y+=_*O,b+=T*O)}return v(h[0]-y,h[1]-b)}function x(h,g,p,y,b){for(var T,_=y,O=g+1;O<p;O++){var L=N(h[O],h[g],h[p]);L>_&&(T=O,_=L)}_>y&&(T-g>1&&x(h,g,T,y,b),b.push(h[T]),p-T>1&&x(h,T,p,y,b))}function D(h,g){var p=h.length-1,y=[h[0]];return x(h,0,p,g,y),y.push(h[p]),y}f.__esModule=!0,f.SimplifyAP=function E(h,g,p){if(void 0===g&&(g=1),void 0===p&&(p=!1),h.length<=2)return h;var y=g*g;return D(h=p?h:function w(h,g){for(var y,p=h[0],b=[p],_=1,T=h.length;_<T;_++)C(y=h[_],p)>g&&(b.push(y),p=y);return p!==y&&b.push(y),b}(h,y),y)}},1275:(F,f,v)=>{var N=v(5365);f.EK=N.SimplifyAP,v(4046),v(6861)},4046:(F,f)=>{function v(h,g){return h*h+g*g}function C(h,g){return v(h.longitude-g.longitude,h.latitude-g.latitude)}function N(h,g,p){var y=g.longitude,b=g.latitude,_=p.longitude-y,T=p.latitude-b;if(0!==_||0!==T){var O=((h.longitude-y)*_+(h.latitude-b)*T)/v(_,T);O>1?(y=p.longitude,b=p.latitude):O>0&&(y+=_*O,b+=T*O)}return v(h.longitude-y,h.latitude-b)}function x(h,g,p,y,b){for(var T,_=y,O=g+1;O<p;O++){var L=N(h[O],h[g],h[p]);L>_&&(T=O,_=L)}_>y&&(T-g>1&&x(h,g,T,y,b),b.push(h[T]),p-T>1&&x(h,T,p,y,b))}function D(h,g){var p=h.length-1,y=[h[0]];return x(h,0,p,g,y),y.push(h[p]),y}f.__esModule=!0,f.SimplifyLL=function E(h,g,p){if(void 0===g&&(g=1),void 0===p&&(p=!1),h.length<=2)return h;var y=g*g;return D(h=p?h:function w(h,g){for(var y,p=h[0],b=[p],_=1,T=h.length;_<T;_++)C(y=h[_],p)>g&&(b.push(y),p=y);return p!==y&&b.push(y),b}(h,y),y)}},6861:(F,f)=>{function v(h,g){return h*h+g*g}function C(h,g){return v(h.x-g.x,h.y-g.y)}function N(h,g,p){var y=g.x,b=g.y,_=p.x-y,T=p.y-b;if(0!==_||0!==T){var O=((h.x-y)*_+(h.y-b)*T)/v(_,T);O>1?(y=p.x,b=p.y):O>0&&(y+=_*O,b+=T*O)}return v(h.x-y,h.y-b)}function x(h,g,p,y,b){for(var T,_=y,O=g+1;O<p;O++){var L=N(h[O],h[g],h[p]);L>_&&(T=O,_=L)}_>y&&(T-g>1&&x(h,g,T,y,b),b.push(h[T]),p-T>1&&x(h,T,p,y,b))}function D(h,g){var p=h.length-1,y=[h[0]];return x(h,0,p,g,y),y.push(h[p]),y}f.__esModule=!0,f.Simplify=function E(h,g,p){if(void 0===g&&(g=1),void 0===p&&(p=!1),h.length<=2)return h;var y=g*g;return D(h=p?h:function w(h,g){for(var y,p=h[0],b=[p],_=1,T=h.length;_<T;_++)C(y=h[_],p)>g&&(b.push(y),p=y);return p!==y&&b.push(y),b}(h,y),y)}}},Yl={};function es(F){var f=Yl[F];if(void 0!==f)return f.exports;var v=Yl[F]={exports:{}};return lm[F](v,v.exports,es),v.exports}(()=>{function F(e){return"function"==typeof e}let f=!1;const v={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){const t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else f&&console.log("RxJS: Back to a better error behavior. Thank you. <3");f=e},get useDeprecatedSynchronousErrorHandling(){return f}};function C(e){setTimeout(()=>{throw e},0)}const N={closed:!0,next(e){},error(e){if(v.useDeprecatedSynchronousErrorHandling)throw e;C(e)},complete(){}},w=Array.isArray||(e=>e&&"number"==typeof e.length);function x(e){return null!==e&&"object"==typeof e}const E=(()=>{function e(t){return Error.call(this),this.message=t?`${t.length} errors occurred during unsubscription:\n${t.map((n,r)=>`${r+1}) ${n.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=t,this}return e.prototype=Object.create(Error.prototype),e})();class h{constructor(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}unsubscribe(){let t;if(this.closed)return;let{_parentOrParents:n,_ctorUnsubscribe:r,_unsubscribe:o,_subscriptions:i}=this;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof h)n.remove(this);else if(null!==n)for(let s=0;s<n.length;++s)n[s].remove(this);if(F(o)){r&&(this._unsubscribe=void 0);try{o.call(this)}catch(s){t=s instanceof E?g(s.errors):[s]}}if(w(i)){let s=-1,a=i.length;for(;++s<a;){const l=i[s];if(x(l))try{l.unsubscribe()}catch(u){t=t||[],u instanceof E?t=t.concat(g(u.errors)):t.push(u)}}}if(t)throw new E(t)}add(t){let n=t;if(!t)return h.EMPTY;switch(typeof t){case"function":n=new h(t);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof h)){const i=n;n=new h,n._subscriptions=[i]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}let{_parentOrParents:r}=n;if(null===r)n._parentOrParents=this;else if(r instanceof h){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}const o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n}remove(t){const n=this._subscriptions;if(n){const r=n.indexOf(t);-1!==r&&n.splice(r,1)}}}var e;function g(e){return e.reduce((t,n)=>t.concat(n instanceof E?n.errors:n),[])}h.EMPTY=((e=new h).closed=!0,e);const p="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random();class b extends h{constructor(t,n,r){switch(super(),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=N;break;case 1:if(!t){this.destination=N;break}if("object"==typeof t){t instanceof b?(this.syncErrorThrowable=t.syncErrorThrowable,this.destination=t,t.add(this)):(this.syncErrorThrowable=!0,this.destination=new _(this,t));break}default:this.syncErrorThrowable=!0,this.destination=new _(this,t,n,r)}}[p](){return this}static create(t,n,r){const o=new b(t,n,r);return o.syncErrorThrowable=!1,o}next(t){this.isStopped||this._next(t)}error(t){this.isStopped||(this.isStopped=!0,this._error(t))}complete(){this.isStopped||(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}_next(t){this.destination.next(t)}_error(t){this.destination.error(t),this.unsubscribe()}_complete(){this.destination.complete(),this.unsubscribe()}_unsubscribeAndRecycle(){const{_parentOrParents:t}=this;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this}}class _ extends b{constructor(t,n,r,o){super(),this._parentSubscriber=t;let i,s=this;F(n)?i=n:n&&(i=n.next,r=n.error,o=n.complete,n!==N&&(s=Object.create(n),F(s.unsubscribe)&&this.add(s.unsubscribe.bind(s)),s.unsubscribe=this.unsubscribe.bind(this))),this._context=s,this._next=i,this._error=r,this._complete=o}next(t){if(!this.isStopped&&this._next){const{_parentSubscriber:n}=this;v.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable?this.__tryOrSetError(n,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}}error(t){if(!this.isStopped){const{_parentSubscriber:n}=this,{useDeprecatedSynchronousErrorHandling:r}=v;if(this._error)r&&n.syncErrorThrowable?(this.__tryOrSetError(n,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(n.syncErrorThrowable)r?(n.syncErrorValue=t,n.syncErrorThrown=!0):C(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;C(t)}}}complete(){if(!this.isStopped){const{_parentSubscriber:t}=this;if(this._complete){const n=()=>this._complete.call(this._context);v.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}}__tryOrUnsub(t,n){try{t.call(this._context,n)}catch(r){if(this.unsubscribe(),v.useDeprecatedSynchronousErrorHandling)throw r;C(r)}}__tryOrSetError(t,n,r){if(!v.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{n.call(this._context,r)}catch(o){return v.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=o,t.syncErrorThrown=!0,!0):(C(o),!0)}return!1}_unsubscribe(){const{_parentSubscriber:t}=this;this._context=null,this._parentSubscriber=null,t.unsubscribe()}}const L="function"==typeof Symbol&&Symbol.observable||"@@observable";function Y(e){return e}let ae=(()=>{class e{constructor(n){this._isScalar=!1,n&&(this._subscribe=n)}lift(n){const r=new e;return r.source=this,r.operator=n,r}subscribe(n,r,o){const{operator:i}=this,s=function O(e,t,n){if(e){if(e instanceof b)return e;if(e[p])return e[p]()}return e||t||n?new b(e,t,n):new b(N)}(n,r,o);if(s.add(i?i.call(s,this.source):this.source||v.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),v.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s}_trySubscribe(n){try{return this._subscribe(n)}catch(r){v.useDeprecatedSynchronousErrorHandling&&(n.syncErrorThrown=!0,n.syncErrorValue=r),function T(e){for(;e;){const{closed:t,destination:n,isStopped:r}=e;if(t||r)return!1;e=n&&n instanceof b?n:null}return!0}(n)?n.error(r):console.warn(r)}}forEach(n,r){return new(r=ke(r))((o,i)=>{let s;s=this.subscribe(a=>{try{n(a)}catch(l){i(l),s&&s.unsubscribe()}},i,o)})}_subscribe(n){const{source:r}=this;return r&&r.subscribe(n)}[L](){return this}pipe(...n){return 0===n.length?this:function ve(e){return 0===e.length?Y:1===e.length?e[0]:function(n){return e.reduce((r,o)=>o(r),n)}}(n)(this)}toPromise(n){return new(n=ke(n))((r,o)=>{let i;this.subscribe(s=>i=s,s=>o(s),()=>r(i))})}}return e.create=t=>new e(t),e})();function ke(e){if(e||(e=v.Promise||Promise),!e)throw new Error("no Promise impl found");return e}const he=(()=>{function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e})();class pe extends h{constructor(t,n){super(),this.subject=t,this.subscriber=n,this.closed=!1}unsubscribe(){if(this.closed)return;this.closed=!0;const t=this.subject,n=t.observers;if(this.subject=null,!n||0===n.length||t.isStopped||t.closed)return;const r=n.indexOf(this.subscriber);-1!==r&&n.splice(r,1)}}class ye extends b{constructor(t){super(t),this.destination=t}}let De=(()=>{class e extends ae{constructor(){super(),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}[p](){return new ye(this)}lift(n){const r=new tn(this,this);return r.operator=n,r}next(n){if(this.closed)throw new he;if(!this.isStopped){const{observers:r}=this,o=r.length,i=r.slice();for(let s=0;s<o;s++)i[s].next(n)}}error(n){if(this.closed)throw new he;this.hasError=!0,this.thrownError=n,this.isStopped=!0;const{observers:r}=this,o=r.length,i=r.slice();for(let s=0;s<o;s++)i[s].error(n);this.observers.length=0}complete(){if(this.closed)throw new he;this.isStopped=!0;const{observers:n}=this,r=n.length,o=n.slice();for(let i=0;i<r;i++)o[i].complete();this.observers.length=0}unsubscribe(){this.isStopped=!0,this.closed=!0,this.observers=null}_trySubscribe(n){if(this.closed)throw new he;return super._trySubscribe(n)}_subscribe(n){if(this.closed)throw new he;return this.hasError?(n.error(this.thrownError),h.EMPTY):this.isStopped?(n.complete(),h.EMPTY):(this.observers.push(n),new pe(this,n))}asObservable(){const n=new ae;return n.source=this,n}}return e.create=(t,n)=>new tn(t,n),e})();class tn extends De{constructor(t,n){super(),this.destination=t,this.source=n}next(t){const{destination:n}=this;n&&n.next&&n.next(t)}error(t){const{destination:n}=this;n&&n.error&&this.destination.error(t)}complete(){const{destination:t}=this;t&&t.complete&&this.destination.complete()}_subscribe(t){const{source:n}=this;return n?this.source.subscribe(t):h.EMPTY}}!function rn(){"function"==typeof Symbol&&Symbol.iterator&&Symbol}();function we(e){return{token:e.token,providedIn:e.providedIn||null,factory:e.factory,value:void 0}}Error,globalThis;class eT{constructor(){this.limitUI04=this.maxFromBits(4),this.limitUI06=this.maxFromBits(6),this.limitUI08=this.maxFromBits(8),this.limitUI12=this.maxFromBits(12),this.limitUI14=this.maxFromBits(14),this.limitUI16=this.maxFromBits(16),this.limitUI32=this.maxFromBits(32),this.limitUI40=this.maxFromBits(40),this.limitUI48=this.maxFromBits(48),this.create()}toString(){return this.hex}toURN(){return"urn:uuid:"+this.hex}toSignalK(){return`urn:mrn:signalk:uuid:${this.hex}`}toBytes(){let t=this.hex.split("-"),n=[],r=0;for(let o=0;o<t.length;o++)for(let i=0;i<t[o].length;i+=2)n[r++]=parseInt(t[o].substr(i,2),16);return n}maxFromBits(t){return Math.pow(2,t)}getRandomInt(t,n){return Math.floor(Math.random()*(n-t+1))+t}randomUI04(){return this.getRandomInt(0,this.limitUI04-1)}randomUI06(){return this.getRandomInt(0,this.limitUI06-1)}randomUI08(){return this.getRandomInt(0,this.limitUI08-1)}randomUI12(){return this.getRandomInt(0,this.limitUI12-1)}randomUI14(){return this.getRandomInt(0,this.limitUI14-1)}randomUI16(){return this.getRandomInt(0,this.limitUI16-1)}randomUI32(){return this.getRandomInt(0,this.limitUI32-1)}randomUI40(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)}randomUI48(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)}create(){this.fromParts(this.randomUI32(),this.randomUI16(),16384|this.randomUI12(),128|this.randomUI06(),this.randomUI08(),this.randomUI48())}paddedString(t,n,r=null){r=r||"0";let o=n-(t=String(t)).length;for(;o>0;o>>>=1,r+=r)1&o&&(t=r+t);return t}fromParts(t,n,r,o,i,s){return this.version=r>>12&15,this.hex=this.paddedString(t.toString(16),8)+"-"+this.paddedString(n.toString(16),4)+"-"+this.paddedString(r.toString(16),4)+"-"+this.paddedString(o.toString(16),2)+this.paddedString(i.toString(16),2)+"-"+this.paddedString(s.toString(16),12),this}}class Qi{static updates(){return{context:null,updates:[]}}static subscribe(){return{context:null,subscribe:[]}}static unsubscribe(){return{context:null,unsubscribe:[]}}static request(){return{requestId:(new eT).toString()}}}let nT=(()=>{class e{constructor(){this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.version=1,this.endpoint="",this.selfId="",this._source=null,this._connect=new De,this.onConnect=this._connect.asObservable(),this._close=new De,this.onClose=this._close.asObservable(),this._error=new De,this.onError=this._error.asObservable(),this._message=new De,this.onMessage=this._message.asObservable()}set source(n){this._source||(this._source={}),this._source.label=n}set authToken(n){this._token=n}get connectionTimeout(){return this._wsTimeout}set connectionTimeout(n){this._wsTimeout=n<3e3?3e3:n>6e4?6e4:n}get isOpen(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}get filter(){return this._filter}set filter(n){this._filter=n&&-1!=n.indexOf("self")?this.selfId?this.selfId:"":n}get playbackMode(){return this._playbackMode}close(){this.ws&&(this.ws.close(),this.ws=null)}open(n,r,o){if(!(n=n||this.endpoint))return;let i=-1==n.indexOf("?")?"?":"&";r&&(n+=`${i}subscribe=${r}`),(this._token||o)&&(n+=`${r?"&":"?"}token=${this._token||o}`),this.close(),this.ws=new WebSocket(n),setTimeout(()=>{this.ws&&1!=this.ws.readyState&&3!=this.ws.readyState&&(console.warn(`Connection watchdog expired (${this._wsTimeout/1e3} sec): ${this.ws.readyState}... aborting connection...`),this.close())},this._wsTimeout),this.ws.onopen=s=>{this._connect.next(s)},this.ws.onclose=s=>{this._close.next(s)},this.ws.onerror=s=>{this._error.next(s)},this.ws.onmessage=s=>{this.parseOnMessage(s)}}parseOnMessage(n){let r;if("string"==typeof n.data)try{r=JSON.parse(n.data)}catch{return}this.isHello(r)?(this.selfId=r.self,this._playbackMode=typeof r.startTime<"u",this._message.next(r)):this.isResponse(r)?(typeof r.login<"u"&&typeof r.login.token<"u"&&(this._token=r.login.token),this._message.next(r)):this._filter&&this.isDelta(r)?r.context==this._filter&&this._message.next(r):this._message.next(r)}sendRequest(n){if("object"!=typeof n)return"";let r=Qi.request();return typeof n.login>"u"&&this._token&&(r.token=this._token),Object.keys(n).forEach(i=>{r[i]=n[i]}),this.send(r),r.requestId}put(n,r,o){return this.sendRequest({context:"self"==n?"vessels.self":n,put:{path:r,value:o}})}login(n,r){return this.sendRequest({login:{username:n,password:r}})}send(n){this.ws&&("object"==typeof n&&(n=JSON.stringify(n)),this.ws.send(n))}sendUpdate(n="self",r,o){let i=Qi.updates();this._token&&(i.token=this._token),i.context="self"==n?"vessels.self":n,this._token&&(i.token=this._token);let s=[];"string"==typeof r&&s.push({path:r,value:o}),"object"==typeof r&&Array.isArray(r)&&(s=r);let a={timestamp:(new Date).toISOString(),values:s};this._source&&(a.source=this._source),i.updates.push(a),this.send(i)}subscribe(n="*",r="*",o){let i=Qi.subscribe();if(this._token&&(i.token=this._token),i.context="self"==n?"vessels.self":n,this._token&&(i.token=this._token),"object"==typeof r&&Array.isArray(r)&&(i.subscribe=r),"string"==typeof r){let s={};s.path=r,o&&"object"==typeof o&&(o.period&&(s.period=o.period),o.minPeriod&&(s.minPeriod=o.period),o.format&&("delta"==o.format||"full"==o.format)&&(s.format=o.format),o.policy&&("instant"==o.policy||"ideal"==o.policy||"fixed"==o.policy)&&(s.policy=o.policy)),i.subscribe.push(s)}this.send(i)}unsubscribe(n="*",r="*"){let o=Qi.unsubscribe();this._token&&(o.token=this._token),o.context="self"==n?"vessels.self":n,this._token&&(o.token=this._token),"object"==typeof r&&Array.isArray(r)&&(o.unsubscribe=r),"string"==typeof r&&o.unsubscribe.push({path:r}),this.send(o)}raiseAlarm(n="*",r,o){let i;i="string"==typeof r&&-1==r.indexOf("notifications.")?`notifications.${r}`:r,this.put(n,i,o.value)}clearAlarm(n="*",r){let o=-1==r.indexOf("notifications.")?`notifications.${r}`:r;this.put(n,o,null)}isSelf(n){return n.context==this.selfId}isDelta(n){return typeof n.context<"u"}isHello(n){return typeof n.version<"u"&&typeof n.self<"u"}isResponse(n){return typeof n.requestId<"u"}}return e.\u0275fac=function(n){return new(n||e)},e.\u0275prov=we({token:e,factory:e.\u0275fac,providedIn:"root"}),e})();class oT{constructor(t,n,r,o){this._method=[],this._message="",this._message=typeof t<"u"?t:"",this._state=typeof n<"u"?n:qg.alarm,r&&this._method.push(Gl.visual),o&&this._method.push(Gl.sound)}get value(){return{message:this._message,state:this._state,method:this._method}}}var qg=function(e){return e.normal="normal",e.alert="alert",e.warn="warn",e.alarm="alarm",e.emergency="emergency",e}(qg||{}),Gl=function(e){return e.visual="visual",e.sound="sound",e}(Gl||{});class sT{constructor(){this.obsList=[],this.stream=new nT,this._connect=new De,this.onConnect=this._connect.asObservable(),this._close=new De,this.onClose=this._close.asObservable(),this._error=new De,this.onError=this._error.asObservable(),this._message=new De,this.onMessage=this._message.asObservable()}get endpoint(){return this.stream.endpoint}set endpoint(t){this.stream.endpoint=t}get selfId(){return this.stream.selfId}set selfId(t){this.stream.selfId=t}get _source(){return this.stream._source}set _source(t){this.stream._source=t}set source(t){this.stream.source=t}set authToken(t){this.stream.authToken=t}get connectionTimeout(){return this.stream.connectionTimeout}set connectionTimeout(t){this.stream.connectionTimeout=t}get isOpen(){return this.stream.isOpen}get filter(){return this.stream.filter}set filter(t){this.stream.filter=t}get playbackMode(){return this.stream.playbackMode}open(t,n="none",r){this.obsList.push(this.stream.onConnect.subscribe(o=>this._connect.next(o))),this.obsList.push(this.stream.onClose.subscribe(o=>this._close.next(o))),this.obsList.push(this.stream.onError.subscribe(o=>this._error.next(o))),this.obsList.push(this.stream.onMessage.subscribe(o=>this._message.next(o))),this.stream.open(t,n,r)}close(){this.stream.close(),this.obsList.forEach(t=>t.unsubscribe()),this.obsList=[]}sendRequest(t){return this.stream.sendRequest(t)}put(t,n,r){return this.stream.put(t,n,r)}login(t,n){return this.stream.login(t,n)}send(t){this.stream.send(t)}sendUpdate(t="self",n,r){this.stream.sendUpdate(t,n,r)}subscribe(t="*",n="*",r){this.stream.subscribe(t,n,r)}unsubscribe(t="*",n="*"){this.stream.unsubscribe(t,n)}raiseAlarm(t="*",n,r){this.stream.raiseAlarm(t,n,r)}clearAlarm(t="*",n){this.stream.clearAlarm(t,n)}isSelf(t){return this.stream.isSelf(t)}isDelta(t){return this.stream.isDelta(t)}isHello(t){return this.stream.isHello(t)}isResponse(t){return this.stream.isResponse(t)}}function po(e){return(po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function H(e,t,n){return(t=function lT(e){var t=function aT(e,t){if("object"!==po(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==po(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===po(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class zg{constructor(){H(this,"id",void 0),H(this,"position",[0,0]),H(this,"heading",void 0),H(this,"headingTrue",null),H(this,"headingMagnetic",null),H(this,"cog",void 0),H(this,"cogTrue",null),H(this,"cogMagnetic",null),H(this,"sog",void 0),H(this,"name",void 0),H(this,"mmsi",void 0),H(this,"callsign",void 0),H(this,"state",void 0),H(this,"wind",{direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null}),H(this,"lastUpdated",new Date),H(this,"orientation",0),H(this,"buddy",!1),H(this,"closestApproach",null),H(this,"mode","day"),H(this,"anchor",{maxRadius:null,radius:null,position:null}),H(this,"resourceUpdates",[]),H(this,"autopilot",{}),H(this,"track",[]),H(this,"courseApi",{arrivalCircle:0,activeRoute:{},nextPoint:{},previousPoint:{}}),H(this,"properties",{})}}class Kg{constructor(){H(this,"id",void 0),H(this,"lastUpdated",new Date),H(this,"name",void 0),H(this,"mmsi",void 0),H(this,"position",[0,0]),H(this,"properties",{}),H(this,"state",void 0)}}class Qg extends Kg{constructor(){super(),H(this,"type",{id:-1,name:""})}}class uT extends Qg{constructor(){super(),H(this,"callsign",void 0)}}class cT extends Kg{constructor(){super(),H(this,"orientation",0),H(this,"sog",0),H(this,"callsign",void 0),H(this,"track",[])}}class ql{static celciusToKelvin(t=0){return t+273.15}static kelvinToCelcius(t=0){return t-273.15}static kelvinToFarenheit(t=0){return 1.8*t-459.67}static degreesToRadians(t=0){return t*Math.PI/180}static radiansToDegrees(t=0){return 180*t/Math.PI}static angleToDirection(t,n){const r=2*Math.PI;if(n||(n=0),t||(t=0),isNaN(n)||isNaN(t))return null;const o=n+t;return o>r?o-r:o<0?r+o:o}static directionToAngle(t,n){const r=2*Math.PI;if(n||(n=0),t||(t=0),isNaN(n)||isNaN(t))return null;const o=n-t;let i;if(o>0)i=o>Math.PI?r-o:0-o;else if(o<0){const s=Math.abs(o);i=s>Math.PI?s-r:s}else i=o;return i}static knotsToKm(t){return 1.852*t}static nauticalMilesToKm(t){return 1.852*t}static knotsToMSec(t){return.51444325460445*t}static kmToKnots(t){return.539957*t}static kmToNauticalMiles(t){return.539957*t}static kmToMiles(t){return.621371*t}static msecToKnots(t){return 1.94384*t}static msecToKmh(t){return 3.6*t}static msecToMph(t){return 2.23694*t}static nauticalMilesToMiles(t){return 1.15078*t}static milesToKm(t){return 1.60934*t}static milesToNauticalMiles(t){return.868976*t}static rpmToHertz(t){return t/60}}var ho=es(939);class go{static destCoordinate(t,n,r){const o=(0,ho.computeDestinationPoint)(t,r,ql.radiansToDegrees(n));return[o.longitude,o.latitude]}static distanceTo(t,n){return(0,ho.getDistance)(t,n)}static routeLength(t){return(0,ho.getPathLength)(t)}static centreOfPolygon(t){const n=(0,ho.getCenter)(t);return[n.longitude,n.latitude]}static inDLCrossingZone(t,n=170){return Math.abs(t[0])>=n}static inBounds(t,n){return(0,ho.isPointInPolygon)(t,[[n[0],n[1]],[n[0],n[3]],[n[2],n[3]],[n[2],n[1]],[n[0],n[1]]])}static calcMapifiedExtent(t,n){const o=111111*Math.cos(ql.degreesToRadians(t[1])),i=[0,0,0,0];return i[1]=t[1]+(0-Math.abs(n))/111111,i[3]=t[1]+Math.abs(n)/111111,i[0]=t[0]+(0-Math.abs(n))/o,i[2]=t[0]+Math.abs(n)/o,i}static normaliseCoords(t){if(!Array.isArray(t))return[0,0];if("number"==typeof t[0]){if(t[0]>180)for(;t[0]>180;)t[0]=t[0]-360;else if(t[0]<-180)for(;t[0]<-180;)t[0]=360+t[0];return t}return Array.isArray(t[0])?(t.forEach(n=>this.normaliseCoords(n)),t):void 0}}class dT{constructor(t){H(this,"action",void 0),H(this,"playback",!1),H(this,"result",null),H(this,"type",void 0),H(this,"self",null),H(this,"timestamp",void 0),this.action="notification",this.type=t}}class Zg{constructor(){H(this,"action",void 0),H(this,"playback",!1),H(this,"result",null),H(this,"timestamp",void 0),H(this,"self",null),this.action="update"}}class fT extends Zg{constructor(){super(),this.action="trail"}}var pT=es(1275);const hT=["environment.wind.speedTrue","environment.wind.speedOverGround","environment.wind.angleTrueGround","environment.wind.angleTrueWater","environment.wind.directionTrue","environment.wind.directionMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.headingTrue","navigation.headingMagnetic"];let X,Te;const mo=[];let Kl,Zi=[],zl=!1,Yi=!1;const Se={signalk:{},aisState:[]};let Ge,Xg,Yg=[0,0,0,0],Jg=60,vo=0,yn={},bn=500,Ut=!1;const Bt={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20},yo={trailDuration:24,trailResolution:{lastHour:"5s",next23:"10s",beyond24:"1m"}};function em(){Ge={updated:{},stale:{},expired:{}}}function Ji({action:e,msg:t}){switch(e){case"onConnect":postMessage({action:"open",playback:Ut,result:t.target.readyState});break;case"onClose":console.warn("streamEvent: ",t),nm(!1);break;case"onError":console.warn("streamEvent: ",t),postMessage({action:"error",playback:Ut,result:"Connection error!"});break;case"onMessage":!function IT(e){Te.isHello(e)?(postMessage({action:"hello",result:e,self:e.self,playback:Ut}),bn&&im()):Te.isDelta(e)?(zl=!0,e.updates.forEach(t=>{t.values&&t.values.forEach(n=>{if(Xg=t.timestamp,e.context)switch(e.context.split(".")[0]){case"shore":case"atons":Se?.signalk.atons&&function MT(e,t){let n=!1;if(-1!=e.indexOf("shore.basestations")&&(n=!0),!X.atons.has(e)){const o=new Qg;o.id=e,o.position=null,n&&(o.type.id=-1,o.type.name="Basestation"),X.atons.set(e,o)}const r=X.atons.get(e);""===t.path?(typeof t.value.name<"u"&&(r.name=t.value.name),typeof t.value.mmsi<"u"&&(r.mmsi=t.value.mmsi),typeof t.value.atonType<"u"&&(r.type=t.value.atonType)):"atonType"===t.path?r.type=t.value:"navigation.position"===t.path?(r.position=[t.value.longitude,t.value.latitude],r.positionReceived=!0):r.properties[t.path]=t.value}(e.context,n),Xi(e.context,X.atons,Se?.signalk.atons);break;case"sar":Se?.signalk.sar&&function ET(e,t){if(!X.sar.has(e)){const r=new uT;r.id=e,r.position=null,r.type.id=-1,r.type.name="SaR Beacon",X.sar.set(e,r)}const n=X.sar.get(e);""===t.path?(typeof t.value.name<"u"&&(n.name=t.value.name),typeof t.value.mmsi<"u"&&(n.mmsi=t.value.mmsi)):"communication.callsignVhf"===t.path?n.callsign=t.value:"navigation.position"===t.path&&t.value?(n.position=go.normaliseCoords([t.value.longitude,t.value.latitude]),n.positionReceived=!0):n.properties[t.path]=t.value}(e.context,n),Xi(e.context,X.sar,Se?.signalk.sar);break;case"aircraft":Se?.signalk.aircraft&&function CT(e,t){if(!X.aircraft.has(e)){const r=new cT;r.id=e,r.position=null,X.aircraft.set(e,r)}const n=X.aircraft.get(e);""===t.path?(typeof t.value.name<"u"&&(n.name=t.value.name),typeof t.value.mmsi<"u"&&(n.mmsi=t.value.mmsi)):"communication.callsignVhf"===t.path?n.callsign=t.value:"navigation.position"===t.path&&t.value?(n.position=go.normaliseCoords([t.value.longitude,t.value.latitude]),n.positionReceived=!0,Ql(n)):"navigation.courseOverGroundTrue"===t.path?n.orientation=t.value:"navigation.speedOverGround"===t.path?n.sog=t.value:n.properties[t.path]=t.value}(e.context,n),Xi(e.context,X.aircraft,Se?.signalk.aircraft);break;case"vessels":if(Te.isSelf(e))am(X.self,n,!0),function DT(e,t){const n={path:e.path,value:e.value,context:t||null};let r;const o=e.path.split(".");if(("notifications.environment.depth.belowTransducer"===e.path||"notifications.environment.depth.belowSurface"===e.path||"notifications.environment.depth.belowKeel"===e.path)&&(r=o[2]),"notifications.navigation.anchor"===e.path&&(r=o[2]),-1!=["mob","sinking","fire","piracy","flooding","collision","grounding","listing","adrift","abandon"].indexOf(o[o.length-1])&&(r=o[o.length-1]),-1!=e.path.indexOf("notifications.navigation.closestApproach")&&(r=o[2],n.context=o[3]),-1!=e.path.indexOf("notifications.buddy")&&(r=o[1],n.context=o[2]),-1!=e.path.indexOf("notifications.navigation.course.arrivalCircleEntered")&&(r=o[3]),-1!=e.path.indexOf("notifications.navigation.course.perpendicularPassed")&&(r=o[3]),-1!=e.path.indexOf("notifications.environment.weather.warning")&&(r=o[2]),r){const i=new dT(r);i.playback=Ut,i.result=n,postMessage(i)}}(n);else{if(Se?.signalk.vessels){const r=function _T(e){if(!X.aisTargets.has(e)){const t=new zg;t.position=null,X.aisTargets.set(e,t)}return X.aisTargets.get(e)}(e.context);am(r,n)}Xi(e.context,X.aisTargets,Se?.signalk.vessels,Se?.aisState)}}})}),om()):Te.isResponse(e)&&postMessage({action:"response",result:e})}(t)}}function tm(e={}){e.interval&&"number"==typeof e.interval&&(bn=e.interval,sm(),im(),Jg=1/(bn/1e3)*60),Ut=!!e.playback,e.selections&&(typeof e.selections.preferredPaths<"u"&&(yn=e.selections.preferredPaths),e.selections.aisMaxAge&&"number"==typeof e.selections.aisMaxAge&&(Bt.maxAge=e.selections.aisMaxAge),e.selections.aisStaleAge&&"number"==typeof e.selections.aisStaleAge&&(Bt.staleAge=e.selections.aisStaleAge),"number"==typeof e.selections.signalk.maxRadius&&(Se.signalk=e.selections.signalk),typeof e.selections.aisState<"u"&&Array.isArray(e.selections.aisState)&&(Se.aisState=e.selections.aisState),console.log("Worker: AIS Filter...",Se))}function nm(e=!1){sm(),mo.forEach(t=>t.unsubscribe()),Te&&e&&Te.close(),Te=null,postMessage({action:"close",result:e,playback:Ut})}function bo(e){return new Promise((t,n)=>{fetch(`${e}`).then(r=>{r.json().then(o=>t(o)).catch(o=>n(o))}).catch(r=>{n(r)})})}function rm(){bo(Kl+"/tracks"+(Se&&Se.signalk&&Se.signalk.maxRadius?`?radius=${Se.signalk.maxRadius}`:"?radius=10000")).then(t=>{Yi=!0,Object.entries(t).forEach(n=>{if(X.aisTargets.has(n[0])){const r=X.aisTargets.get(n[0]);r.track=n[1].coordinates,Ql(r)}})}).catch(()=>{Yi=!1,console.warn("Unable to fetch AIS tracks!")})}function Xi(e,t,n=!0,r=[]){if(n){let o=t.get(e);o&&r.includes(o?.state)&&(console.log(`state match => ${r}, ${e}`),Ge.expired[e]=!0,o=null),o&&Se.signalk.maxRadius?o.positionReceived&&go.inBounds(o.position,Yg)?Ge.updated[e]=!0:(t.delete(e),Ge.expired[e]=!0):Ge.updated[e]=!0}else 0!=t.size&&(t.forEach((o,i)=>{Ge.expired[i]=!0}),t.clear())}function om(e=!1){if(!bn||e){const t=new Zg;t.playback=Ut,X.aisStatus.updated=Object.keys(Ge.updated),X.aisStatus.stale=Object.keys(Ge.stale),X.aisStatus.expired=Object.keys(Ge.expired),t.result=X,t.timestamp=Ut?Xg:X.self.lastUpdated.toISOString(),postMessage(t),em(),X.self.resourceUpdates=[],0===vo&&(function wT(){const e=(new Date).valueOf();X.aisTargets.forEach((t,n)=>{t.lastUpdated.valueOf()<e-Bt.maxAge?(Ge.expired[n]=!0,X.aisTargets.delete(n)):t.lastUpdated.valueOf()<e-Bt.staleAge&&(Ge.stale[n]=!0)}),X.aircraft.forEach((t,n)=>{t.lastUpdated.valueOf()<e-Bt.maxAge?(Ge.expired[n]=!0,X.aircraft.delete(n)):t.lastUpdated.valueOf()<e-Bt.staleAge&&(Ge.stale[n]=!0)}),X.sar.forEach((t,n)=>{t.lastUpdated.valueOf()<e-Bt.maxAge?(Ge.expired[n]=!0,X.sar.delete(n)):t.lastUpdated.valueOf()<e-Bt.staleAge&&(Ge.stale[n]=!0)})}(),X.self.positionReceived&&Se?.signalk.maxRadius&&(Yg=go.calcMapifiedExtent(X.self.position,Se.signalk.maxRadius),vo++)),vo=vo>=Jg?0:vo+1}}function im(){bn&&"number"==typeof bn&&Zi.push(setInterval(()=>{zl&&(om(!0),zl=!1)},bn)),Zi.push(setInterval(()=>{console.warn("hasTrackPlugin",Yi),Yi&&rm()},6e4))}function sm(){Zi.forEach(e=>clearInterval(e)),Zi=[]}function am(e,t,n=!1){if(e.lastUpdated=new Date,n){const r=-1!==t.path.indexOf("course")?t.path.split(".").slice(0,2).join("."):t.path;-1!=hT.indexOf(r)&&(X.paths[r]=null)}if(""===t.path)typeof t.value.name<"u"&&(e.name=t.value.name),typeof t.value.mmsi<"u"&&(e.mmsi=t.value.mmsi),typeof t.value.buddy<"u"&&(e.buddy=t.value.buddy);else if("communication.callsignVhf"===t.path)e.callsign=t.value;else if("navigation.position"===t.path&&t.value){if(typeof t.value.longitude>"u")return;e.position=go.normaliseCoords([t.value.longitude,t.value.latitude]),e.positionReceived=!0,n||Ql(e)}else"navigation.state"===t.path?e.state=t.value:"navigation.speedOverGround"===t.path?e.sog=t.value:"navigation.courseOverGroundTrue"===t.path?e.cogTrue=t.value:"navigation.courseOverGroundMagnetic"===t.path?e.cogMagnetic=t.value:"navigation.headingTrue"===t.path?e.headingTrue=t.value:"navigation.headingMagnetic"===t.path?e.headingMagnetic=t.value:"environment.wind.angleApparent"===t.path?e.wind.awa=t.value:"environment.wind.speedApparent"===t.path?e.wind.aws=t.value:"environment.wind.speedTrue"===t.path?e.wind.speedTrue=t.value:"environment.wind.speedOverGround"===t.path?e.wind.sog=t.value:"environment.wind.directionTrue"===t.path?e.wind.twd=t.value:"environment.wind.directionMagnetic"===t.path?e.wind.mwd=t.value:"environment.mode"===t.path?e.mode=t.value:-1!==t.path.indexOf("navigation.course.")?-1!==t.path.indexOf("navigation.course.calcValues")?-1===t.path.indexOf("navigation.course.calcValues.previousPoint")&&(e[`course.${t.path.split(".").slice(-1)[0]}`]=t.value):-1!==t.path.indexOf("navigation.course.activeRoute")?e.courseApi.activeRoute=t.value:-1!==t.path.indexOf("navigation.course.nextPoint")?e.courseApi.nextPoint=t.value:-1!==t.path.indexOf("navigation.course.previousPoint")?e.courseApi.previousPoint=t.value:"navigation.course.arrivalCircle"===t.path&&(e.courseApi.arrivalCircle=t.value):-1!=t.path.indexOf("navigation.closestApproach")?e.closestApproach=t.value:"navigation.anchor.position"===t.path?e.anchor.position=t.value:"navigation.anchor.maxRadius"===t.path?e.anchor.maxRadius=t.value:"navigation.anchor.currentRadius"===t.path?e.anchor.radius=t.value:-1!=t.path.indexOf("resources.")?e.resourceUpdates.push(t):"steering.autopilot.state"===t.path?e.autopilot.state=t.value:"steering.autopilot.mode"===t.path?e.autopilot.mode=t.value:"steering.autopilot.target"===t.path?e.autopilot.target=t.value:"steering.autopilot.enabled"===t.path?e.autopilot.enabled=t.value:e.properties[t.path]=t.value;e.heading=null===e.heading&&null!=e.cog?e.cog:e.heading,typeof yn.heading<"u"&&t.path===yn.heading&&(e.orientation=t.value),typeof yn.tws<"u"&&t.path===yn.tws&&(e.wind.tws=t.value),typeof yn.twd<"u"&&t.path===yn.twd&&(e.wind.direction="environment.wind.angleTrueGround"===t.path||"environment.wind.angleTrueWater"===t.path?ql.angleToDirection(t.value,e.heading):t.value)}function Ql(e){if(e.track&&0===e.track.length)e.track.push([e.position]);else{const n=e.track[e.track.length-1][e.track[e.track.length-1].length-1];n[0]!=e.position[0]&&n[1]!=e.position[1]&&e.track[e.track.length-1].push(e.position)}e.track[e.track.length-1]=e.track[e.track.length-1].slice(0-Bt.maxTrack)}addEventListener("message",({data:e})=>{!function mT(e){if(e.cmd)switch(e.cmd){case"open":console.log("Worker control: opening stream..."),tm(e.options),function yT(e){if(Te)return;if(!e.url)return void postMessage({action:"error",result:"Valid options not provided!"});const t=e.url.split("/");if(t.pop(),t.push("api"),t[0]="wss:"===t[0]?"https:":"http:",Kl=t.join("/"),function gT(){X={self:new zg,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map},X.self.positionReceived=!1,em()}(),Te=new sT,mo.push(Te.onConnect.subscribe(n=>Ji({action:"onConnect",msg:n}))),mo.push(Te.onClose.subscribe(n=>Ji({action:"onClose",msg:n}))),mo.push(Te.onError.subscribe(n=>Ji({action:"onError",msg:n}))),mo.push(Te.onMessage.subscribe(n=>Ji({action:"onMessage",msg:n}))),e.playback){const n=e.playbackOptions.startTime?`?startTime=${e.playbackOptions.startTime}`:null;let r=e.playbackOptions.playbackRate?`playbackRate=${e.playbackOptions.playbackRate}`:null;r=r?n?"&"+r:"?"+r:null,Te.open(`${e.url}${n||""}${r||""}`,e.playbackOptions.subscribe,e.token)}else Te.open(e.url,e.subscribe,e.token),rm()}(e.options);break;case"close":console.log("Worker control: closing stream..."),nm(!0);break;case"subscribe":console.log("Worker control: subscribing to paths..."),Te.subscribe(e.options.context,e.options.path);break;case"settings":console.log("Worker control: settings..."),tm(e.options);break;case"alarm":console.log("Worker control: alarm action..."),function bT(e){const t=-1===e.type.indexOf("notifications.")?`notifications.${e.type}`:e.type;e.raise?Te.raiseAlarm("self",t,new oT(e.message,e.state,!0,!0)):Te.clearAlarm("self",t)}(e.options);break;case"vessel":if(console.log("Worker control: vessel setting..."),e.options){let t;t="self"===e.options.context?X.self:X.aisTargets.get(e.options.context),t&&e.options.name&&(t.name=e.options.name)}break;case"auth":console.log("Worker control: auth token..."),e.options&&(Te.authToken=e.options.token);break;case"trail":console.log("Worker control: Fetch vessel trail from server..."),e.options&&(yo.trailDuration=e.options.trailDuration??24,e.options.trailResolution&&(yo.trailResolution.lastHour=e.options.trailResolution.lastHour??"5s",yo.trailResolution.next23=e.options.trailResolution.next23??"1m",yo.trailResolution.beyond24=e.options.trailResolution.beyond24??"5m")),function vT(e){console.info("Worker: Fetching vessel trail from server",e);const t=Kl+"/self/track?",n=[];e.trailDuration>24&&(n.push(bo(`${t}timespan=${e.trailDuration-24}h&resolution=${e.trailResolution.beyond24}&timespanOffset=24`)),n.push(bo(`${t}timespan=23h&resolution=${e.trailResolution.next23}&timespanOffset=1`))),e.trailDuration>1&&e.trailDuration<25&&n.push(bo(`${t}timespan=${e.trailDuration-1}h&resolution=${e.trailResolution.next23}&timespanOffset=1`)),n.push(bo(`${t}timespan=1h&resolution=${e.trailResolution.lastHour}`));let i=[];const s=new fT;s.playback=Ut,Promise.all(n).then(a=>{let l=0;const u=n.length-1;a.forEach(d=>{if(d.type&&"MultiLineString"===d.type&&d.coordinates&&Array.isArray(d.coordinates))if(l!=u){let m=[];for(d.coordinates.forEach(I=>{m=m.concat(I)}),m=(0,pT.EK)(m,5e-4,true);m.length>60;){const I=m.slice(0,60);i.push(I),m=m.slice(59),m[0]=[m[0][0]+5e-9,m[0][1]+5e-9]}0!==m.length&&i.push(m)}else i=i.concat(d.coordinates);l++}),s.result=i,postMessage(s)}).catch(()=>{s.result=null,postMessage(s)})}(yo)}}(e)})})()})();