@signalk/freeboard-sk 1.19.2 → 1.20.0
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 +20 -1
- package/package.json +3 -3
- package/public/194-es2015.345884571f5a570c50fd.js +1 -0
- package/public/{194-es5.a4a4a918d25771b9df8f.js → 194-es5.345884571f5a570c50fd.js} +1 -1
- package/public/MaterialIcons-Regular.b459c012769931f03de2.ttf +0 -0
- package/public/MaterialIconsOutlined-Regular.a00c84eae547b9547f8e.otf +0 -0
- package/public/MaterialIconsRound-Regular.2741b5779661d5283342.otf +0 -0
- package/public/MaterialIconsSharp-Regular.e41a2c48f5f63d85dce4.otf +0 -0
- package/public/MaterialIconsTwoTone-Regular.d575c3c486386645ac70.otf +0 -0
- package/public/assets/fonts/MaterialIcons-Regular.ttf +0 -0
- package/public/assets/fonts/MaterialIconsOutlined-Regular.otf +0 -0
- package/public/assets/fonts/MaterialIconsRound-Regular.otf +0 -0
- package/public/assets/fonts/MaterialIconsSharp-Regular.otf +0 -0
- package/public/assets/fonts/MaterialIconsTwoTone-Regular.otf +0 -0
- package/public/assets/fonts/material-icons.css +23 -7
- package/public/assets/help/index.html +43 -1
- package/public/index.html +2 -2
- package/public/main-es2015.50de96f6ac8ce07c1eb7.js +1 -0
- package/public/{main-es5.f20caf8fbfa58b4806ed.js → main-es5.50de96f6ac8ce07c1eb7.js} +1 -1
- package/public/{runtime-es2015.edd36b8cf30df9f0a82e.js → runtime-es2015.590ce0576882394cd0a4.js} +1 -1
- package/public/{runtime-es5.edd36b8cf30df9f0a82e.js → runtime-es5.590ce0576882394cd0a4.js} +1 -1
- package/public/{styles.36bd2e36f29be6040d29.css → styles.151f5917658613ff18bb.css} +1 -1
- package/public/194-es2015.a4a4a918d25771b9df8f.js +0 -1
- package/public/assets/fonts/material-icons.woff2 +0 -0
- package/public/main-es2015.f20caf8fbfa58b4806ed.js +0 -1
- package/public/material-icons.4a03f967ab2acff66587.woff2 +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
# CHANGELOG: Freeboard
|
|
2
2
|
|
|
3
|
+
### v1.20.0
|
|
4
|
+
|
|
5
|
+
- **Add**: Ability to supply url parameters to set the following configuration: `northup`, `zoom` and `movemap`. See Help for details. (closes #110)
|
|
6
|
+
|
|
7
|
+
- **Experiment**: View weather forecast information provided by `openweather-signalk` plugin.
|
|
8
|
+
|
|
9
|
+
### v1.19.4
|
|
10
|
+
|
|
11
|
+
- **Update**: Change select all/none on resource lists to only operate on the visible (filtered) list items. (closes #107)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### v1.19.3
|
|
15
|
+
|
|
16
|
+
- **Add**: Speed units selection option added to settings. (closes #104)
|
|
17
|
+
|
|
18
|
+
### v1.19.2
|
|
19
|
+
|
|
20
|
+
- **Fix**: Coordinate display issue when format is DegMinSec. (closes #105)
|
|
21
|
+
|
|
3
22
|
### v1.19.1
|
|
4
23
|
|
|
5
24
|
- **Fix**: Issue where vessel name and MMSI not being received in stream connection after upgrading to server version 1.41.0
|
|
6
25
|
|
|
7
26
|
### v1.19.0
|
|
8
27
|
|
|
9
|
-
- **Add**:
|
|
28
|
+
- **Add**: Apply a default name to imported GPX tracks when no name is defined in the source file.
|
|
10
29
|
|
|
11
30
|
- **New**: Attach notes to waypoints and routes.
|
|
12
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalk/freeboard-sk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Openlayers chartplotter implementation for Signal K",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"signalk-webapp",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"proj4": "2.6.2",
|
|
61
61
|
"protractor": "~7.0.0",
|
|
62
62
|
"rxjs": "~6.6.3",
|
|
63
|
-
"signalk-client-angular": "
|
|
64
|
-
"signalk-worker-angular": "
|
|
63
|
+
"signalk-client-angular": ">=1.8.2 <2.0.0",
|
|
64
|
+
"signalk-worker-angular": ">=1.1.3 <2.0.0",
|
|
65
65
|
"simplify-ts": "^1.0.2",
|
|
66
66
|
"ts-node": "~7.0.0",
|
|
67
67
|
"tslib": "^2.0.0",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){"use strict";function t(t){return"function"==typeof t}let e=!1;const s={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){const t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else e&&console.log("RxJS: Back to a better error behavior. Thank you. <3");e=t},get useDeprecatedSynchronousErrorHandling(){return e}};function n(t){setTimeout(()=>{throw t},0)}const i={closed:!0,next(t){},error(t){if(s.useDeprecatedSynchronousErrorHandling)throw t;n(t)},complete(){}},r=Array.isArray||(t=>t&&"number"==typeof t.length);function o(t){return null!==t&&"object"==typeof t}const a=(()=>{function t(t){return Error.call(this),this.message=t?`${t.length} errors occurred during unsubscription:\n${t.map((t,e)=>`${e+1}) ${t.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t})();class c{constructor(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}unsubscribe(){let e;if(this.closed)return;let{_parentOrParents:s,_ctorUnsubscribe:n,_unsubscribe:i,_subscriptions:l}=this;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,s instanceof c)s.remove(this);else if(null!==s)for(let t=0;t<s.length;++t)s[t].remove(this);if(t(i)){n&&(this._unsubscribe=void 0);try{i.call(this)}catch(h){e=h instanceof a?u(h.errors):[h]}}if(r(l)){let t=-1,s=l.length;for(;++t<s;){const s=l[t];if(o(s))try{s.unsubscribe()}catch(d){e=e||[],d instanceof a?e=e.concat(u(d.errors)):e.push(d)}}}if(e)throw new a(e)}add(t){let e=t;if(!t)return c.EMPTY;switch(typeof t){case"function":e=new c(t);case"object":if(e===this||e.closed||"function"!=typeof e.unsubscribe)return e;if(this.closed)return e.unsubscribe(),e;if(!(e instanceof c)){const t=e;e=new c,e._subscriptions=[t]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}let{_parentOrParents:s}=e;if(null===s)e._parentOrParents=this;else if(s instanceof c){if(s===this)return e;e._parentOrParents=[s,this]}else{if(-1!==s.indexOf(this))return e;s.push(this)}const n=this._subscriptions;return null===n?this._subscriptions=[e]:n.push(e),e}remove(t){const e=this._subscriptions;if(e){const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}}var l;function u(t){return t.reduce((t,e)=>t.concat(e instanceof a?e.errors:e),[])}c.EMPTY=((l=new c).closed=!0,l);const h="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random();class d extends c{constructor(t,e,s){switch(super(),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=i;break;case 1:if(!t){this.destination=i;break}if("object"==typeof t){t instanceof d?(this.syncErrorThrowable=t.syncErrorThrowable,this.destination=t,t.add(this)):(this.syncErrorThrowable=!0,this.destination=new p(this,t));break}default:this.syncErrorThrowable=!0,this.destination=new p(this,t,e,s)}}[h](){return this}static create(t,e,s){const n=new d(t,e,s);return n.syncErrorThrowable=!1,n}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 p extends d{constructor(e,s,n,r){super(),this._parentSubscriber=e;let o,a=this;t(s)?o=s:s&&(o=s.next,n=s.error,r=s.complete,s!==i&&(a=Object.create(s),t(a.unsubscribe)&&this.add(a.unsubscribe.bind(a)),a.unsubscribe=this.unsubscribe.bind(this))),this._context=a,this._next=o,this._error=n,this._complete=r}next(t){if(!this.isStopped&&this._next){const{_parentSubscriber:e}=this;s.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}}error(t){if(!this.isStopped){const{_parentSubscriber:e}=this,{useDeprecatedSynchronousErrorHandling:i}=s;if(this._error)i&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)i?(e.syncErrorValue=t,e.syncErrorThrown=!0):n(t),this.unsubscribe();else{if(this.unsubscribe(),i)throw t;n(t)}}}complete(){if(!this.isStopped){const{_parentSubscriber:t}=this;if(this._complete){const e=()=>this._complete.call(this._context);s.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}}__tryOrUnsub(t,e){try{t.call(this._context,e)}catch(i){if(this.unsubscribe(),s.useDeprecatedSynchronousErrorHandling)throw i;n(i)}}__tryOrSetError(t,e,i){if(!s.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,i)}catch(r){return s.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(n(r),!0)}return!1}_unsubscribe(){const{_parentSubscriber:t}=this;this._context=null,this._parentSubscriber=null,t.unsubscribe()}}const f="function"==typeof Symbol&&Symbol.observable||"@@observable";function b(t){return t}let g=(()=>{class t{constructor(t){this._isScalar=!1,t&&(this._subscribe=t)}lift(e){const s=new t;return s.source=this,s.operator=e,s}subscribe(t,e,n){const{operator:r}=this,o=function(t,e,s){if(t){if(t instanceof d)return t;if(t[h])return t[h]()}return t||e||s?new d(t,e,s):new d(i)}(t,e,n);if(o.add(r?r.call(o,this.source):this.source||s.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),s.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o}_trySubscribe(t){try{return this._subscribe(t)}catch(e){s.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){const{closed:e,destination:s,isStopped:n}=t;if(e||n)return!1;t=s&&s instanceof d?s:null}return!0}(t)?t.error(e):console.warn(e)}}forEach(t,e){return new(e=m(e))((e,s)=>{let n;n=this.subscribe(e=>{try{t(e)}catch(i){s(i),n&&n.unsubscribe()}},s,e)})}_subscribe(t){const{source:e}=this;return e&&e.subscribe(t)}[f](){return this}pipe(...t){return 0===t.length?this:function(t){return 0===t.length?b:1===t.length?t[0]:function(e){return t.reduce((t,e)=>e(t),e)}}(t)(this)}toPromise(t){return new(t=m(t))((t,e)=>{let s;this.subscribe(t=>s=t,t=>e(t),()=>t(s))})}}return t.create=e=>new t(e),t})();function m(t){if(t||(t=s.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const v=(()=>{function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t})();class y extends c{constructor(t,e){super(),this.subject=t,this.subscriber=e,this.closed=!1}unsubscribe(){if(this.closed)return;this.closed=!0;const t=this.subject,e=t.observers;if(this.subject=null,!e||0===e.length||t.isStopped||t.closed)return;const s=e.indexOf(this.subscriber);-1!==s&&e.splice(s,1)}}class w extends d{constructor(t){super(t),this.destination=t}}let _=(()=>{class t extends g{constructor(){super(),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}[h](){return new w(this)}lift(t){const e=new x(this,this);return e.operator=t,e}next(t){if(this.closed)throw new v;if(!this.isStopped){const{observers:e}=this,s=e.length,n=e.slice();for(let i=0;i<s;i++)n[i].next(t)}}error(t){if(this.closed)throw new v;this.hasError=!0,this.thrownError=t,this.isStopped=!0;const{observers:e}=this,s=e.length,n=e.slice();for(let i=0;i<s;i++)n[i].error(t);this.observers.length=0}complete(){if(this.closed)throw new v;this.isStopped=!0;const{observers:t}=this,e=t.length,s=t.slice();for(let n=0;n<e;n++)s[n].complete();this.observers.length=0}unsubscribe(){this.isStopped=!0,this.closed=!0,this.observers=null}_trySubscribe(t){if(this.closed)throw new v;return super._trySubscribe(t)}_subscribe(t){if(this.closed)throw new v;return this.hasError?(t.error(this.thrownError),c.EMPTY):this.isStopped?(t.complete(),c.EMPTY):(this.observers.push(t),new y(this,t))}asObservable(){const t=new g;return t.source=this,t}}return t.create=(t,e)=>new x(t,e),t})();class x extends _{constructor(t,e){super(),this.destination=t,this.source=e}next(t){const{destination:e}=this;e&&e.next&&e.next(t)}error(t){const{destination:e}=this;e&&e.error&&this.destination.error(t)}complete(){const{destination:t}=this;t&&t.complete&&this.destination.complete()}_subscribe(t){const{source:e}=this;return e?this.source.subscribe(t):c.EMPTY}}function E(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}"function"==typeof Symbol&&Symbol.iterator&&Symbol,Error;const k="undefined"!=typeof globalThis&&globalThis;"undefined"!=typeof window&&window,"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,k||"undefined"!=typeof global&&global,Symbol;class S{constructor(){this.version=4,this.hex="",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("-"),e=[],s=0;for(let n=0;n<t.length;n++)for(let i=0;i<t[n].length;i+=2)e[s++]=parseInt(t[n].substr(i,2),16);return e}maxFromBits(t){return Math.pow(2,t)}getRandomInt(t,e){return Math.floor(Math.random()*(e-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,e,s=null){s=s||"0";let n=e-(t=String(t)).length;for(;n>0;n>>>=1,s+=s)1&n&&(t=s+t);return t}fromParts(t,e,s,n,i,r){return this.version=s>>12&15,this.hex=this.paddedString(t.toString(16),8)+"-"+this.paddedString(e.toString(16),4)+"-"+this.paddedString(s.toString(16),4)+"-"+this.paddedString(n.toString(16),2)+this.paddedString(i.toString(16),2)+"-"+this.paddedString(r.toString(16),12),this}}class M{static updates(){return{context:null,updates:[]}}static subscribe(){return{context:null,subscribe:[]}}static unsubscribe(){return{context:null,unsubscribe:[]}}static request(){return{requestId:(new S).toString()}}}let T=(()=>{class t{constructor(){this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.endpoint="",this.selfId="",this._source=null,this._connect=new _,this.onConnect=this._connect.asObservable(),this._close=new _,this.onClose=this._close.asObservable(),this._error=new _,this.onError=this._error.asObservable(),this._message=new _,this.onMessage=this._message.asObservable()}set source(t){this._source||(this._source={}),this._source.label=t}set authToken(t){this._token=t}get connectionTimeout(){return this._wsTimeout}set connectionTimeout(t){this._wsTimeout=t<3e3?3e3:t>6e4?6e4:t}get isOpen(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}get filter(){return this._filter}set filter(t){this._filter=t&&-1!=t.indexOf("self")?this.selfId?this.selfId:"":t}get playbackMode(){return this._playbackMode}close(){this.ws&&(this.ws.close(),this.ws=null)}open(t,e,s){if(!(t=t||this.endpoint))return;let n=-1==t.indexOf("?")?"?":"&";e&&(t+=`${n}subscribe=${e}`),(this._token||s)&&(t+=`${e?"&":"?"}token=${this._token||s}`),this.close(),this.ws=new WebSocket(t),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=t=>{this._connect.next(t)},this.ws.onclose=t=>{this._close.next(t)},this.ws.onerror=t=>{this._error.next(t)},this.ws.onmessage=t=>{this.parseOnMessage(t)}}parseOnMessage(t){let e;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(s){return}this.isHello(e)?(this.selfId=e.self,this._playbackMode=void 0!==e.startTime,this._message.next(e)):this.isResponse(e)?(void 0!==e.login&&void 0!==e.login.token&&(this._token=e.login.token),this._message.next(e)):this._filter&&this.isDelta(e)?e.context==this._filter&&this._message.next(e):this._message.next(e)}sendRequest(t){if("object"!=typeof t)return"";let e=M.request();return void 0===t.login&&this._token&&(e.token=this._token),Object.keys(t).forEach(s=>{e[s]=t[s]}),this.send(e),e.requestId}put(t,e,s){return this.sendRequest({context:"self"==t?"vessels.self":t,put:{path:e,value:s}})}login(t,e){return this.sendRequest({login:{username:t,password:e}})}send(t){this.ws&&("object"==typeof t&&(t=JSON.stringify(t)),this.ws.send(t))}sendUpdate(t="self",e,s){let n=M.updates();this._token&&(n.token=this._token),n.context="self"==t?"vessels.self":t,this._token&&(n.token=this._token);let i=[];"string"==typeof e&&i.push({path:e,value:s}),"object"==typeof e&&Array.isArray(e)&&(i=e);let r={timestamp:(new Date).toISOString(),values:i};this._source&&(r.source=this._source),n.updates.push(r),this.send(n)}subscribe(t="*",e="*",s){let n=M.subscribe();if(this._token&&(n.token=this._token),n.context="self"==t?"vessels.self":t,this._token&&(n.token=this._token),"object"==typeof e&&Array.isArray(e)&&(n.subscribe=e),"string"==typeof e){let t={};t.path=e,s&&"object"==typeof s&&(s.period&&(t.period=s.period),s.minPeriod&&(t.minPeriod=s.period),s.format&&("delta"==s.format||"full"==s.format)&&(t.format=s.format),s.policy&&("instant"==s.policy||"ideal"==s.policy||"fixed"==s.policy)&&(t.policy=s.policy)),n.subscribe.push(t)}this.send(n)}unsubscribe(t="*",e="*"){let s=M.unsubscribe();this._token&&(s.token=this._token),s.context="self"==t?"vessels.self":t,this._token&&(s.token=this._token),"object"==typeof e&&Array.isArray(e)&&(s.unsubscribe=e),"string"==typeof e&&s.unsubscribe.push({path:e}),this.send(s)}raiseAlarm(t="*",e,s){let n;n="string"==typeof e&&-1==e.indexOf("notifications.")?`notifications.${e}`:e,this.put(t,n,s.value)}clearAlarm(t="*",e){let s=-1==e.indexOf("notifications.")?`notifications.${e}`:e;this.put(t,s,null)}isSelf(t){return t.context==this.selfId}isDelta(t){return void 0!==t.context}isHello(t){return void 0!==t.version&&void 0!==t.self}isResponse(t){return void 0!==t.requestId}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=E({token:t,factory:t.\u0275fac,providedIn:"root"}),t})();class O{constructor(t,e,s,n){this._method=[],this._message="",this._message=void 0!==t?t:"",this._state=void 0!==e?e:I.alarm,s&&this._method.push(P.visual),n&&this._method.push(P.sound)}get value(){return{message:this._message,state:this._state,method:this._method}}}var I=(()=>(function(t){t.normal="normal",t.alert="alert",t.warn="warn",t.alarm="alarm",t.emergency="emergency"}(I||(I={})),I))(),P=(()=>(function(t){t.visual="visual",t.sound="sound"}(P||(P={})),P))();class R{constructor(){this.obsList=[],this.stream=new T,this._connect=new _,this.onConnect=this._connect.asObservable(),this._close=new _,this.onClose=this._close.asObservable(),this._error=new _,this.onError=this._error.asObservable(),this._message=new _,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,e="none",s){this.obsList.push(this.stream.onConnect.subscribe(t=>this._connect.next(t))),this.obsList.push(this.stream.onClose.subscribe(t=>this._close.next(t))),this.obsList.push(this.stream.onError.subscribe(t=>this._error.next(t))),this.obsList.push(this.stream.onMessage.subscribe(t=>this._message.next(t))),this.stream.open(t,e,s)}close(){this.stream.close(),this.obsList.forEach(t=>t.unsubscribe()),this.obsList=[]}sendRequest(t){return this.stream.sendRequest(t)}put(t,e,s){return this.stream.put(t,e,s)}login(t,e){return this.stream.login(t,e)}send(t){this.stream.send(t)}sendUpdate(t="self",e,s){this.stream.sendUpdate(t,e,s)}subscribe(t="*",e="*",s){this.stream.subscribe(t,e,s)}unsubscribe(t="*",e="*"){this.stream.unsubscribe(t,e)}raiseAlarm(t="*",e,s){this.stream.raiseAlarm(t,e,s)}clearAlarm(t="*",e){this.stream.clearAlarm(t,e)}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)}}class U{constructor(){this.position=[0,0],this.headingTrue=null,this.headingMagnetic=null,this.cogTrue=null,this.cogMagnetic=null,this.wind={direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null},this.lastUpdated=new Date,this.orientation=0,this.buddy=!1,this.closestApproach=null,this.mode="day",this.anchor={maxRadius:null,radius:null,position:null},this.resourceUpdates=[],this.autopilot={},this.track=[],this.properties={}}}class A{constructor(){this.lastUpdated=new Date,this.position=[0,0],this.properties={}}}class D extends A{constructor(){super(),this.type={id:-1,name:""}}}class G extends A{constructor(){super(),this.orientation=0,this.sog=0,this.track=[]}}class C{constructor(){}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,e){let s=2*Math.PI;if(e||(e=0),t||(t=0),isNaN(e)||isNaN(t))return null;let n=e+t;return n>s?n-s:n<0?s+n:n}static directionToAngle(t,e){let s=2*Math.PI;if(e||(e=0),t||(t=0),isNaN(e)||isNaN(t))return null;let n,i=e-t;if(i>0)n=i>Math.PI?s-i:0-i;else if(i<0){let t=Math.abs(i);n=t>Math.PI?t-s:t}else n=i;return n}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 j={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},$={};$[j.DEGREES]=2*Math.PI*6370997/360,$[j.FEET]=.3048,$[j.METERS]=1,$[j.USFEET]=1200/3937;var F=j,W=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||$[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}(),H="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2};function q(t){return t*Math.PI/180}"log2"in Math&&Math;var B=function(){var t=function(e,s){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])})(e,s)};return function(e,s){function n(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(n.prototype=s.prototype,new n)}}(),L=6378137,N=Math.PI*L,K=[-N,-N,N,N],V=[-180,-85,180,85],X=L*Math.log(Math.tan(Math.PI/2)),J=function(t){function e(e){return t.call(this,{code:e,units:F.METERS,extent:K,global:!0,worldExtent:V,getPointResolution:function(t,e){return t/H(e[1]/L)}})||this}return B(e,t),e}(W),Y=[new J("EPSG:3857"),new J("EPSG:102100"),new J("EPSG:102113"),new J("EPSG:900913"),new J("http://www.opengis.net/gml/srs/epsg.xml#3857")],Z=function(){var t=function(e,s){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])})(e,s)};return function(e,s){function n(){this.constructor=e}t(e,s),e.prototype=null===s?Object.create(s):(n.prototype=s.prototype,new n)}}(),z=[-180,-90,180,90],Q=6378137*Math.PI/180,tt=function(t){function e(e,s){return t.call(this,{code:e,units:F.DEGREES,extent:z,axisOrientation:s,global:!0,metersPerUnit:Q,worldExtent:z})||this}return Z(e,t),e}(W),et=[new tt("CRS:84"),new tt("EPSG:4326","neu"),new tt("urn:ogc:def:crs:OGC:1.3:CRS84"),new tt("urn:ogc:def:crs:OGC:2:84"),new tt("http://www.opengis.net/gml/srs/epsg.xml#4326","neu")],st={},nt={};function it(t,e,s){var n=t.getCode(),i=e.getCode();n in nt||(nt[n]={}),nt[n][i]=s}function rt(t,e,s){var n=s||6371008.8,i=q(t[1]),r=q(e[1]),o=(r-i)/2,a=q(e[0]-t[0])/2,c=Math.sin(o)*Math.sin(o)+Math.sin(a)*Math.sin(a)*Math.cos(i)*Math.cos(r);return 2*n*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))}function ot(t,e,s){var n;if(void 0!==e){for(var i=0,r=t.length;i<r;++i)e[i]=t[i];n=e}else n=t.slice();return n}function at(t,e,s){if(void 0!==e&&t!==e){for(var n=0,i=t.length;n<i;++n)e[n]=t[n];t=e}return t}function ct(t){(function(t,e){st[t]=e})(t.getCode(),t),it(t,t,ot)}function lt(t){return"string"==typeof t?function(t){return st[t]||st[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}(t):t||null}function ut(t){(function(t){t.forEach(ct)})(t),t.forEach(function(e){t.forEach(function(t){e!==t&&it(e,t,ot)})})}function ht(t,e){var s=function(t,e){var s;return t in nt&&e in nt[t]&&(s=nt[t][e]),s}(t.getCode(),e.getCode());return s||(s=at),s}function dt(t,e,s){return function(t,e){return ht(lt(t),lt(e))}(e,s)(t,void 0,t.length)}ut(Y),ut(et),function(t,e,s,n){t.forEach(function(t){e.forEach(function(e){it(t,e,s),it(e,t,n)})})}(et,Y,function(t,e,s){var n=t.length,i=s>1?s:2,r=e;void 0===r&&(r=i>2?t.slice():new Array(n));for(var o=0;o<n;o+=i){r[o]=N*t[o]/180;var a=L*Math.log(Math.tan(Math.PI*(+t[o+1]+90)/360));a>X?a=X:a<-X&&(a=-X),r[o+1]=a}return r},function(t,e,s){var n=t.length,i=s>1?s:2,r=e;void 0===r&&(r=i>2?t.slice():new Array(n));for(var o=0;o<n;o+=i)r[o]=180*t[o]/N,r[o+1]=360*Math.atan(Math.exp(t[o+1]/L))/Math.PI-90;return r});class pt{constructor(){}static destCoordinate(t,e,s,n){let i=6378137,r=6356752.3142,o=1/298.257223563,a=n,c=s,l=Math.sin(c),u=Math.cos(c),h=(1-o)*Math.tan(C.degreesToRadians(t)),d=1/Math.sqrt(1+h*h),p=h*d,f=Math.atan2(h,u),b=d*l,g=1-b*b,m=g*(i*i-r*r)/(r*r),v=1+m/16384*(4096+m*(m*(320-175*m)-768)),y=m/1024*(256+m*(m*(74-47*m)-128)),w=a/(r*v),_=2*Math.PI;for(;Math.abs(w-_)>1e-12;){var x=Math.cos(2*f+w),E=Math.sin(w),k=Math.cos(w);_=w,w=a/(r*v)+y*E*(x+y/4*(k*(2*x*x-1)-y/6*x*(4*E*E-3)*(4*x*x-3)))}let S=p*E-d*k*u,M=Math.atan2(p*k+d*E*u,(1-o)*Math.sqrt(b*b+S*S)),T=o/16*g*(4+o*(4-3*g)),O=Math.atan2(E*l,d*k-p*E*u)-(1-T)*o*b*(w+T*E*(x+T*k*(2*x*x-1))),I=(Math.atan2(b,-S),C.radiansToDegrees(M));return[e+C.radiansToDegrees(O),I]}static toGo(t,e){return{bearing:pt.bearingTo(t,e),distance:pt.distanceTo(t,e)}}static distanceTo(t,e){let s=C.degreesToRadians(t[1]),n=C.degreesToRadians(t[0]),i=C.degreesToRadians(e[1]),r=C.degreesToRadians(e[0])-n,o=Math.pow(Math.sin((i-s)/2),2)+Math.cos(s)*Math.cos(i)*Math.pow(Math.sin(r/2),2);return 2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))*6373*1e3}static bearingTo(t,e){let s=C.degreesToRadians(t[1]),n=C.degreesToRadians(e[1]),i=C.degreesToRadians(e[0]-t[0]),r=Math.sin(i)*Math.cos(n),o=Math.cos(s)*Math.sin(n)-Math.sin(s)*Math.cos(n)*Math.cos(i);return Math.atan2(r,o)}static centreOfPolygon(t){let e=[-180,-90],s=[180,90];if(t.forEach(t=>{s[0]=t[0]<s[0]?t[0]:s[0],s[1]=t[1]<s[1]?t[1]:s[1],e[0]=t[0]>e[0]?t[0]:e[0],e[1]=t[1]>e[1]?t[1]:e[1]}),pt.inDLCrossingZone(s)||pt.inDLCrossingZone(e)){let t=s[0]>0&&e[0]<0?1:s[0]<0&&e[0]>0?-1:0;1==t&&(e[0]=e[0]+360),-1==t&&(e[0]=Math.abs(e[0])-360)}return[s[0]+(e[0]-s[0])/2,s[1]+(e[1]-s[1])/2]}static calulateExtent(t){let e=[180,90,-180,-90];return t.forEach(t=>{e[0]=t[0]<e[0]?t[0]:e[0],e[1]=t[1]<e[1]?t[1]:e[1],e[2]=t[0]>e[2]?t[0]:e[2],e[3]=t[1]>e[3]?t[1]:e[3]}),e}static inDLCrossingZone(t,e=170){return Math.abs(t[0])>=e}static mapifyCoords(t){if(0==t.length)return t;let e=0,s=t[0];for(let n=0;n<t.length;n++)(pt.inDLCrossingZone(t[n])||pt.inDLCrossingZone(s))&&(e=s[0]>0&&t[n][0]<0?1:s[0]<0&&t[n][0]>0?-1:0,1==e&&(t[n][0]=t[n][0]+360),-1==e&&(t[n][0]=Math.abs(t[n][0])-360));return t}static mapifyRadius(t,e){return void 0===t||void 0===e?t:t/function(t,e,s,n){var i,r=(t=lt(t)).getPointResolutionFunc();if(r)i=r(1,s);else{var o=t.getUnits();if(o==F.DEGREES||n==F.DEGREES)i=1;else{var a,c=ht(t,lt("EPSG:4326"));if(c===at&&o!==F.DEGREES)i=1*t.getMetersPerUnit();else{var l=[s[0]-.5,s[1],s[0]+.5,s[1],s[0],s[1]-.5,s[0],s[1]+.5];i=(rt((l=c(l,l,2)).slice(0,2),l.slice(2,4))+rt(l.slice(4,6),l.slice(6,8)))/2}void 0!==(a=t.getMetersPerUnit())&&(i/=a)}}return i}("EPSG:3857",0,function(t,e){return dt(t,"EPSG:4326","EPSG:3857")}(e))}static inBounds(t,e){let s=JSON.parse(JSON.stringify(e)),n=[t[0],t[1]];return s[0]>0&&s[2]<0&&(s[2]=360+s[2],n[0]<0&&(n[0]=360+n[0])),n[0]>s[0]&&n[0]<s[2]&&n[1]>s[1]&&n[1]<s[3]}static calcMapifiedExtent(t,e){const s=111111;let n=s*Math.cos(C.degreesToRadians(t[1])),i=[0,0,0,0];return i[1]=t[1]+(0-Math.abs(e))/s,i[3]=t[1]+Math.abs(e)/s,i[0]=t[0]+(0-Math.abs(e))/n,i[2]=t[0]+Math.abs(e)/n,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(t=>this.normaliseCoords(t)),t):void 0}}class ft{constructor(){this.action=null,this.playback=!1,this.result=null}}class bt extends ft{constructor(t){super(),this.action="notification",this.type=t}}class gt extends ft{constructor(){super(),this.action="update"}}const mt=["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 vt,yt,wt,_t,xt,Et=[],kt=[],St=!1,Mt=!1,Tt={signalk:{},aisState:[]},Ot=[0,0,0,0],It=60,Pt=0,Rt={},Ut=500,At=!1,Dt={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20};function Gt(){_t={updated:{},stale:{},expired:{}}}function Ct({action:t,msg:e}){switch(t){case"onConnect":postMessage({action:"open",playback:At,result:e.target.readyState});break;case"onClose":console.warn("streamEvent: ",e),$t(!1);break;case"onError":console.warn("streamEvent: ",e),postMessage({action:"error",playback:At,result:"Connection error!"});break;case"onMessage":!function(t){yt.isHello(t)?(postMessage({action:"hello",result:t,self:t.self,playback:At}),Ut&&qt()):yt.isDelta(t)?(St=!0,t.updates.forEach(e=>{!e.values||e.values.forEach(s=>{if(xt=e.timestamp,t.context)switch(t.context.split(".")[0]){case"shore":case"atons":(null==Tt?void 0:Tt.signalk.atons)&&function(t,e){let s=!1;if(-1!=t.indexOf("shore.basestations")&&(s=!0),!vt.atons.has(t)){let e=new D;e.id=t,e.position=null,s&&(e.type.id=-1,e.type.name="Basestation"),vt.atons.set(t,e)}let n=vt.atons.get(t);""==e.path?(void 0!==e.value.name&&(n.name=e.value.name),void 0!==e.value.mmsi&&(n.mmsi=e.value.mmsi),void 0!==e.value.atonType&&(n.type=e.value.atonType)):"atonType"==e.path?n.type=e.value:"navigation.position"==e.path?(n.position=[e.value.longitude,e.value.latitude],n.positionReceived=!0):n.properties[e.path]=e.value}(t.context,s),Wt(t.context,vt.atons,null==Tt?void 0:Tt.signalk.atons);break;case"sar":(null==Tt?void 0:Tt.signalk.sar)&&function(t,e){if(!vt.sar.has(t)){let e=new D;e.id=t,e.position=null,e.type.id=-1,e.type.name="SaR Beacon",vt.sar.set(t,e)}let s=vt.sar.get(t);""==e.path?(void 0!==e.value.name&&(s.name=e.value.name),void 0!==e.value.mmsi&&(s.mmsi=e.value.mmsi)):"communication.callsignVhf"==e.path?s.callsign=e.value:"navigation.position"==e.path&&e.value?(s.position=pt.normaliseCoords([e.value.longitude,e.value.latitude]),s.positionReceived=!0):s.properties[e.path]=e.value}(t.context,s),Wt(t.context,vt.sar,null==Tt?void 0:Tt.signalk.sar);break;case"aircraft":(null==Tt?void 0:Tt.signalk.aircraft)&&function(t,e){if(!vt.aircraft.has(t)){let e=new G;e.id=t,e.position=null,vt.aircraft.set(t,e)}let s=vt.aircraft.get(t);""==e.path?(void 0!==e.value.name&&(s.name=e.value.name),void 0!==e.value.mmsi&&(s.mmsi=e.value.mmsi)):"communication.callsignVhf"==e.path?s.callsign=e.value:"navigation.position"==e.path&&e.value?(s.position=pt.normaliseCoords([e.value.longitude,e.value.latitude]),s.positionReceived=!0,Nt(s)):"navigation.courseOverGroundTrue"==e.path?s.orientation=e.value:"navigation.speedOverGround"==e.path?s.sog=e.value:s.properties[e.path]=e.value}(t.context,s),Wt(t.context,vt.aircraft,null==Tt?void 0:Tt.signalk.aircraft);break;case"vessels":yt.isSelf(t)?(Lt(vt.self,s,!0),function(t,e){let s,n={path:t.path,value:t.value,context:null},i=t.path.split(".");if(("notifications.environment.depth.belowTransducer"==t.path||"notifications.environment.depth.belowSurface"==t.path||"notifications.environment.depth.belowKeel"==t.path)&&(s=i[2]),"notifications.navigation.anchor"==t.path&&(s=i[2]),-1!=["mob","sinking","fire","piracy","flooding","collision","grounding","listing","adrift","abandon"].indexOf(i[i.length-1])&&(s=i[i.length-1]),-1!=t.path.indexOf("notifications.navigation.closestApproach")&&(s=i[2],n.context=i[3]),-1!=t.path.indexOf("notifications.buddy")&&(s=i[1],n.context=i[2]),(-1!=t.path.indexOf("notifications.arrivalCircleEntered")||-1!=t.path.indexOf("notifications.navigation.course.arrivalCircleEntered"))&&(s=i[1],n.context=i[2]),s){let t=new bt(s);t.playback=At,t.result=n,postMessage(t)}}(s)):((null==Tt?void 0:Tt.signalk.vessels)&&Lt(function(t){if(!vt.aisTargets.has(t)){let e=new U;e.position=null,vt.aisTargets.set(t,e)}return vt.aisTargets.get(t)}(t.context),s),Wt(t.context,vt.aisTargets,null==Tt?void 0:Tt.signalk.vessels,null==Tt?void 0:Tt.aisState))}})}),Ht()):yt.isResponse(t)&&postMessage({action:"response",result:t})}(e)}}function jt(t={}){t.interval&&"number"==typeof t.interval&&(Ut=t.interval,Bt(),qt(),It=1/(Ut/1e3)*60),At=!!t.playback,t.selections&&(void 0!==t.selections.preferredPaths&&(Rt=t.selections.preferredPaths),t.selections.aisMaxAge&&"number"==typeof t.selections.aisMaxAge&&(Dt.maxAge=t.selections.aisMaxAge),t.selections.aisStaleAge&&"number"==typeof t.selections.aisStaleAge&&(Dt.staleAge=t.selections.aisStaleAge),"number"==typeof t.selections.signalk.maxRadius&&(Tt.signalk=t.selections.signalk),void 0!==t.selections.aisState&&Array.isArray(t.selections.aisState)&&(Tt.aisState=t.selections.aisState),console.log("Worker: AIS Filter...",Tt))}function $t(t=!1,e){Bt(),Et.forEach(t=>t.unsubscribe()),yt&&t&&yt.close(),yt=null,postMessage({action:"close",result:t,playback:At})}function Ft(){(function(t){return new Promise((e,s)=>{fetch(`${t}`).then(t=>{t.json().then(t=>e(t)).catch(t=>s(t))}).catch(t=>{s(t)})})})(wt+"/tracks"+(Tt&&Tt.signalk&&Tt.signalk.maxRadius?`?radius=${Tt.signalk.maxRadius}`:"?radius=10000")).then(t=>{Mt=!0,Object.entries(t).forEach(t=>{if(vt.aisTargets.has(t[0])){let e=vt.aisTargets.get(t[0]);e.track=t[1].coordinates,Nt(e)}})}).catch(t=>{Mt=!1,console.warn("Unable to fetch AIS tracks!")})}function Wt(t,e,s=!0,n=[]){if(s){let s=e.get(t);s&&n.includes(null==s?void 0:s.state)&&(console.log(`state match => ${n}, ${t}`),_t.expired[t]=!0,s=null),s&&Tt.signalk.maxRadius?s.positionReceived&&pt.inBounds(s.position,Ot)?_t.updated[t]=!0:(e.delete(t),_t.expired[t]=!0):_t.updated[t]=!0}else 0!=e.size&&(e.forEach((t,e)=>{_t.expired[e]=!0}),e.clear())}function Ht(t=!1){if(!Ut||t){let t=new gt;t.playback=At,vt.aisStatus.updated=Object.keys(_t.updated),vt.aisStatus.stale=Object.keys(_t.stale),vt.aisStatus.expired=Object.keys(_t.expired),t.result=vt,t.timestamp=At?xt:vt.self.lastUpdated.toISOString(),postMessage(t),Gt(),vt.self.resourceUpdates=[],0==Pt&&(function(){let t=(new Date).valueOf();vt.aisTargets.forEach((e,s)=>{e.lastUpdated<t-Dt.maxAge?(_t.expired[s]=!0,vt.aisTargets.delete(s)):e.lastUpdated<t-Dt.staleAge&&(_t.stale[s]=!0)}),vt.aircraft.forEach((e,s)=>{e.lastUpdated<t-Dt.maxAge?(_t.expired[s]=!0,vt.aircraft.delete(s)):e.lastUpdated<t-Dt.staleAge&&(_t.stale[s]=!0)}),vt.sar.forEach((e,s)=>{e.lastUpdated<t-Dt.maxAge?(_t.expired[s]=!0,vt.sar.delete(s)):e.lastUpdated<t-Dt.staleAge&&(_t.stale[s]=!0)})}(),vt.self.positionReceived&&(null==Tt?void 0:Tt.signalk.maxRadius)&&(Ot=pt.calcMapifiedExtent(vt.self.position,Tt.signalk.maxRadius),Pt++)),Pt=Pt>=It?0:Pt+1}}function qt(){Ut&&"number"==typeof Ut&&kt.push(setInterval(()=>{St&&(Ht(!0),St=!1)},Ut)),kt.push(setInterval(()=>{console.warn("hasTrackPlugin",Mt),Mt&&Ft()},6e4))}function Bt(){kt.forEach(t=>clearInterval(t)),kt=[]}function Lt(t,e,s=!1){if(t.lastUpdated=new Date,s&&-1!=mt.indexOf(e.path)&&(vt.paths[e.path]=e.value),""==e.path)void 0!==e.value.name&&(t.name=e.value.name),void 0!==e.value.mmsi&&(t.mmsi=e.value.mmsi),void 0!==e.value.buddy&&(t.buddy=e.value.buddy);else if("communication.callsignVhf"==e.path)t.callsign=e.value;else if("navigation.position"==e.path&&e.value){if(void 0===e.value.longitude)return;t.position=pt.normaliseCoords([e.value.longitude,e.value.latitude]),t.positionReceived=!0,s||Nt(t)}else"navigation.state"==e.path?t.state=e.value:"navigation.speedOverGround"==e.path?t.sog=e.value:"navigation.courseOverGroundTrue"==e.path?t.cogTrue=e.value:"navigation.courseOverGroundMagnetic"==e.path?t.cogMagnetic=e.value:"navigation.headingTrue"==e.path?t.headingTrue=e.value:"navigation.headingMagnetic"==e.path?t.headingMagnetic=e.value:"environment.wind.angleApparent"==e.path?t.wind.awa=e.value:"environment.wind.speedApparent"==e.path?t.wind.aws=e.value:"environment.wind.speedTrue"==e.path?t.wind.speedTrue=e.value:"environment.wind.speedOverGround"==e.path?t.wind.sog=e.value:"environment.wind.directionTrue"==e.path?t.wind.twd=e.value:"environment.wind.directionMagnetic"==e.path?t.wind.mwd=e.value:"environment.mode"==e.path?t.mode=e.value:-1!=e.path.indexOf("navigation.courseRhumbline")&&void 0!==Rt.course&&e.path.split(".").slice(0,2).join(".")==Rt.course||-1!=e.path.indexOf("navigation.courseGreatCircle")&&void 0!==Rt.course&&e.path.split(".").slice(0,2).join(".")==Rt.course?t["course."+e.path.split(".").slice(2).join(".")]=e.value:-1!=e.path.indexOf("navigation.closestApproach")?t.closestApproach=e.value:"navigation.anchor.position"==e.path?t.anchor.position=e.value:"navigation.anchor.maxRadius"==e.path?t.anchor.maxRadius=e.value:"navigation.anchor.currentRadius"==e.path?t.anchor.radius=e.value:-1!=e.path.indexOf("resources.")?t.resourceUpdates.push(e):"steering.autopilot.state"==e.path?t.autopilot.state=e.value:"steering.autopilot.mode"==e.path?t.autopilot.mode=e.value:t.properties[e.path]=e.value;t.heading=null==t.heading&&null!=t.cog?t.cog:t.heading,void 0!==Rt.heading&&e.path==Rt.heading&&(t.orientation=e.value),void 0!==Rt.tws&&e.path==Rt.tws&&(t.wind.tws=e.value),void 0!==Rt.twd&&e.path==Rt.twd&&(t.wind.direction="environment.wind.angleTrueGround"==e.path||"environment.wind.angleTrueWater"==e.path?C.angleToDirection(e.value,t.heading):e.value)}function Nt(t){if(t.track&&0==t.track.length)t.track.push([t.position]);else{let e=t.track[t.track.length-1][t.track[t.track.length-1].length-1];e[0]!=t.position[0]&&e[1]!=t.position[1]&&t.track[t.track.length-1].push(t.position)}t.track[t.track.length-1]=t.track[t.track.length-1].slice(0-Dt.maxTrack)}addEventListener("message",({data:t})=>{!function(t){if(t.cmd)switch(t.cmd){case"open":console.log("Worker control: opening stream..."),jt(t.options),function(t){if(yt)return;if(!t.url)return void postMessage({action:"error",result:"Valid options not provided!"});let e=t.url.split("/");if(e.pop(),e.push("api"),e[0]="wss:"==e[0]?"https:":"http:",wt=e.join("/"),vt={self:new U,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map},vt.self.positionReceived=!1,Gt(),yt=new R,Et.push(yt.onConnect.subscribe(t=>Ct({action:"onConnect",msg:t}))),Et.push(yt.onClose.subscribe(t=>Ct({action:"onClose",msg:t}))),Et.push(yt.onError.subscribe(t=>Ct({action:"onError",msg:t}))),Et.push(yt.onMessage.subscribe(t=>Ct({action:"onMessage",msg:t}))),t.playback){let e=t.playbackOptions.startTime?`?startTime=${t.playbackOptions.startTime}`:null,s=t.playbackOptions.playbackRate?`playbackRate=${t.playbackOptions.playbackRate}`:null;s=s?e?"&"+s:"?"+s:null,yt.open(`${t.url}${e||""}${s||""}`,t.playbackOptions.subscribe,t.token)}else yt.open(t.url,t.subscribe,t.token),Ft()}(t.options);break;case"close":console.log("Worker control: closing stream..."),$t(!0);break;case"subscribe":console.log("Worker control: subscribing to paths..."),yt.subscribe(t.options.context,t.options.path);break;case"settings":console.log("Worker control: settings..."),jt(t.options);break;case"alarm":console.log("Worker control: alarm action..."),function(t){let e=-1==t.type.indexOf("notifications.")?`notifications.${t.type}`:t.type;t.raise?yt.raiseAlarm("self",e,new O(t.message,t.state,!0,!0)):yt.clearAlarm("self",e)}(t.options);break;case"vessel":if(console.log("Worker control: vessel setting..."),t.options){let e;e="self"==t.options.context?vt.self:vt.aisTargets.get(t.options.context),e&&t.options.name&&(e.name=t.options.name)}break;case"auth":console.log("Worker control: auth token..."),t.options&&(yt.authToken=t.options.token)}}(t)})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){function t(){return(t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,n,i){var r=e(t,n);if(r){var o=Object.getOwnPropertyDescriptor(r,n);return o.get?o.get.call(arguments.length<3?t:i):o.value}}).apply(this,arguments)}function e(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var n,i=a(t);if(e){var r=a(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return o(this,n)}}function o(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}!function(){"use strict";function e(t){return"function"==typeof t}var i=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else i&&console.log("RxJS: Back to a better error behavior. Thank you. <3");i=t},get useDeprecatedSynchronousErrorHandling(){return i}};function c(t){setTimeout(function(){throw t},0)}var h={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;c(t)},complete:function(){}},f=Array.isArray||function(t){return t&&"number"==typeof t.length};function d(t){return null!==t&&"object"==typeof t}var p,v=function(){function t(t){return Error.call(this),this.message=t?"".concat(t.length," errors occurred during unsubscription:\n").concat(t.map(function(t,e){return"".concat(e+1,") ").concat(t.toString())}).join("\n ")):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),g=function(){function t(e){u(this,t),this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return l(t,[{key:"unsubscribe",value:function(){var n;if(!this.closed){var i=this._parentOrParents,r=this._ctorUnsubscribe,o=this._unsubscribe,s=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var a=0;a<i.length;++a)i[a].remove(this);if(e(o)){r&&(this._unsubscribe=void 0);try{o.call(this)}catch(a){n=a instanceof v?b(a.errors):[a]}}if(f(s))for(var u=-1,c=s.length;++u<c;){var l=s[u];if(d(l))try{l.unsubscribe()}catch(h){n=n||[],h instanceof v?n=n.concat(b(h.errors)):n.push(h)}}if(n)throw new v(n)}}},{key:"add",value:function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var i=n;(n=new t)._subscriptions=[i]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var r=n._parentOrParents;if(null===r)n._parentOrParents=this;else if(r instanceof t){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n}},{key:"remove",value:function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}}}]),t}();function b(t){return t.reduce(function(t,e){return t.concat(e instanceof v?e.errors:e)},[])}g.EMPTY=((p=new g).closed=!0,p);var y="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),m=function(e){n(o,e);var i=r(o);function o(t,e,n){var r;switch(u(this,o),(r=i.call(this)).syncErrorValue=null,r.syncErrorThrown=!1,r.syncErrorThrowable=!1,r.isStopped=!1,arguments.length){case 0:r.destination=h;break;case 1:if(!t){r.destination=h;break}if("object"==typeof t){t instanceof o?(r.syncErrorThrowable=t.syncErrorThrowable,r.destination=t,t.add(s(r))):(r.syncErrorThrowable=!0,r.destination=new k(s(r),t));break}default:r.syncErrorThrowable=!0,r.destination=new k(s(r),t,e,n)}return r}return l(o,[{key:y,value:function(){return this}},{key:"next",value:function(t){this.isStopped||this._next(t)}},{key:"error",value:function(t){this.isStopped||(this.isStopped=!0,this._error(t))}},{key:"complete",value:function(){this.isStopped||(this.isStopped=!0,this._complete())}},{key:"unsubscribe",value:function(){this.closed||(this.isStopped=!0,t(a(o.prototype),"unsubscribe",this).call(this))}},{key:"_next",value:function(t){this.destination.next(t)}},{key:"_error",value:function(t){this.destination.error(t),this.unsubscribe()}},{key:"_complete",value:function(){this.destination.complete(),this.unsubscribe()}},{key:"_unsubscribeAndRecycle",value:function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this}}],[{key:"create",value:function(t,e,n){var i=new o(t,e,n);return i.syncErrorThrowable=!1,i}}]),o}(g),k=function(t){n(a,t);var i=r(a);function a(t,n,r,o){var c;u(this,a),(c=i.call(this))._parentSubscriber=t;var l,f=s(c);return e(n)?l=n:n&&(l=n.next,r=n.error,o=n.complete,n!==h&&(e((f=Object.create(n)).unsubscribe)&&c.add(f.unsubscribe.bind(f)),f.unsubscribe=c.unsubscribe.bind(s(c)))),c._context=f,c._next=l,c._error=r,c._complete=o,c}return l(a,[{key:"next",value:function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}}},{key:"error",value:function(t){if(!this.isStopped){var e=this._parentSubscriber,n=o.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):c(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;c(t)}}}},{key:"complete",value:function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}}},{key:"__tryOrUnsub",value:function(t,e){try{t.call(this._context,e)}catch(n){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw n;c(n)}}},{key:"__tryOrSetError",value:function(t,e,n){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(i){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=i,t.syncErrorThrown=!0,!0):(c(i),!0)}return!1}},{key:"_unsubscribe",value:function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()}}]),a}(m),w="function"==typeof Symbol&&Symbol.observable||"@@observable";function _(t){return t}var x=function(){var t=function(){function t(e){u(this,t),this._isScalar=!1,e&&(this._subscribe=e)}return l(t,[{key:"lift",value:function(e){var n=new t;return n.source=this,n.operator=e,n}},{key:"subscribe",value:function(t,e,n){var i=this.operator,r=function(t,e,n){if(t){if(t instanceof m)return t;if(t[y])return t[y]()}return t||e||n?new m(t,e,n):new m(h)}(t,e,n);if(r.add(i?i.call(r,this.source):this.source||o.useDeprecatedSynchronousErrorHandling&&!r.syncErrorThrowable?this._subscribe(r):this._trySubscribe(r)),o.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable&&(r.syncErrorThrowable=!1,r.syncErrorThrown))throw r.syncErrorValue;return r}},{key:"_trySubscribe",value:function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,n=e.closed,i=e.destination,r=e.isStopped;if(n||r)return!1;t=i&&i instanceof m?i:null}return!0}(t)?t.error(e):console.warn(e)}}},{key:"forEach",value:function(t,e){var n=this;return new(e=E(e))(function(e,i){var r;r=n.subscribe(function(e){try{t(e)}catch(n){i(n),r&&r.unsubscribe()}},i,e)})}},{key:"_subscribe",value:function(t){var e=this.source;return e&&e.subscribe(t)}},{key:w,value:function(){return this}},{key:"pipe",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?this:function(t){return 0===t.length?_:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}(e)(this)}},{key:"toPromise",value:function(t){var e=this;return new(t=E(t))(function(t,n){var i;e.subscribe(function(t){return i=t},function(t){return n(t)},function(){return t(i)})})}}]),t}();return t.create=function(e){return new t(e)},t}();function E(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}var S=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),M=function(t){n(i,t);var e=r(i);function i(t,n){var r;return u(this,i),(r=e.call(this)).subject=t,r.subscriber=n,r.closed=!1,r}return l(i,[{key:"unsubscribe",value:function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}}}]),i}(g),T=function(t){n(i,t);var e=r(i);function i(t){var n;return u(this,i),(n=e.call(this,t)).destination=t,n}return l(i)}(m),O=function(){var e=function(e){n(o,e);var i=r(o);function o(){var t;return u(this,o),(t=i.call(this)).observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return l(o,[{key:y,value:function(){return new T(this)}},{key:"lift",value:function(t){var e=new P(this,this);return e.operator=t,e}},{key:"next",value:function(t){if(this.closed)throw new S;if(!this.isStopped)for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].next(t)}},{key:"error",value:function(t){if(this.closed)throw new S;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].error(t);this.observers.length=0}},{key:"complete",value:function(){if(this.closed)throw new S;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),i=0;i<e;i++)n[i].complete();this.observers.length=0}},{key:"unsubscribe",value:function(){this.isStopped=!0,this.closed=!0,this.observers=null}},{key:"_trySubscribe",value:function(e){if(this.closed)throw new S;return t(a(o.prototype),"_trySubscribe",this).call(this,e)}},{key:"_subscribe",value:function(t){if(this.closed)throw new S;return this.hasError?(t.error(this.thrownError),g.EMPTY):this.isStopped?(t.complete(),g.EMPTY):(this.observers.push(t),new M(this,t))}},{key:"asObservable",value:function(){var t=new x;return t.source=this,t}}]),o}(x);return e.create=function(t,e){return new P(t,e)},e}(),P=function(t){n(i,t);var e=r(i);function i(t,n){var r;return u(this,i),(r=e.call(this)).destination=t,r.source=n,r}return l(i,[{key:"next",value:function(t){var e=this.destination;e&&e.next&&e.next(t)}},{key:"error",value:function(t){var e=this.destination;e&&e.error&&this.destination.error(t)}},{key:"complete",value:function(){var t=this.destination;t&&t.complete&&this.destination.complete()}},{key:"_subscribe",value:function(t){return this.source?this.source.subscribe(t):g.EMPTY}}]),i}(O);"function"==typeof Symbol&&Symbol.iterator&&Symbol,Error;var R="undefined"!=typeof globalThis&&globalThis;"undefined"!=typeof window&&window,"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,R||"undefined"!=typeof global&&global,Symbol;var I=function(){function t(){u(this,t),this.version=4,this.hex="",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()}return l(t,[{key:"toString",value:function(){return this.hex}},{key:"toURN",value:function(){return"urn:uuid:"+this.hex}},{key:"toSignalK",value:function(){return"urn:mrn:signalk:uuid:".concat(this.hex)}},{key:"toBytes",value:function(){for(var t=this.hex.split("-"),e=[],n=0,i=0;i<t.length;i++)for(var r=0;r<t[i].length;r+=2)e[n++]=parseInt(t[i].substr(r,2),16);return e}},{key:"maxFromBits",value:function(t){return Math.pow(2,t)}},{key:"getRandomInt",value:function(t,e){return Math.floor(Math.random()*(e-t+1))+t}},{key:"randomUI04",value:function(){return this.getRandomInt(0,this.limitUI04-1)}},{key:"randomUI06",value:function(){return this.getRandomInt(0,this.limitUI06-1)}},{key:"randomUI08",value:function(){return this.getRandomInt(0,this.limitUI08-1)}},{key:"randomUI12",value:function(){return this.getRandomInt(0,this.limitUI12-1)}},{key:"randomUI14",value:function(){return this.getRandomInt(0,this.limitUI14-1)}},{key:"randomUI16",value:function(){return this.getRandomInt(0,this.limitUI16-1)}},{key:"randomUI32",value:function(){return this.getRandomInt(0,this.limitUI32-1)}},{key:"randomUI40",value:function(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)}},{key:"randomUI48",value:function(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)}},{key:"create",value:function(){this.fromParts(this.randomUI32(),this.randomUI16(),16384|this.randomUI12(),128|this.randomUI06(),this.randomUI08(),this.randomUI48())}},{key:"paddedString",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;n=n||"0";for(var i=e-(t=String(t)).length;i>0;i>>>=1,n+=n)1&i&&(t=n+t);return t}},{key:"fromParts",value:function(t,e,n,i,r,o){return this.version=n>>12&15,this.hex=this.paddedString(t.toString(16),8)+"-"+this.paddedString(e.toString(16),4)+"-"+this.paddedString(n.toString(16),4)+"-"+this.paddedString(i.toString(16),2)+this.paddedString(r.toString(16),2)+"-"+this.paddedString(o.toString(16),12),this}}]),t}(),U=function(){function t(){u(this,t)}return l(t,null,[{key:"updates",value:function(){return{context:null,updates:[]}}},{key:"subscribe",value:function(){return{context:null,subscribe:[]}}},{key:"unsubscribe",value:function(){return{context:null,unsubscribe:[]}}},{key:"request",value:function(){return{requestId:(new I).toString()}}}]),t}(),A=function(){var t=function(){function t(){u(this,t),this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.endpoint="",this.selfId="",this._source=null,this._connect=new O,this.onConnect=this._connect.asObservable(),this._close=new O,this.onClose=this._close.asObservable(),this._error=new O,this.onError=this._error.asObservable(),this._message=new O,this.onMessage=this._message.asObservable()}return l(t,[{key:"source",set:function(t){this._source||(this._source={}),this._source.label=t}},{key:"authToken",set:function(t){this._token=t}},{key:"connectionTimeout",get:function(){return this._wsTimeout},set:function(t){this._wsTimeout=t<3e3?3e3:t>6e4?6e4:t}},{key:"isOpen",get:function(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}},{key:"filter",get:function(){return this._filter},set:function(t){this._filter=t&&-1!=t.indexOf("self")?this.selfId?this.selfId:"":t}},{key:"playbackMode",get:function(){return this._playbackMode}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}},{key:"open",value:function(t,e,n){var i=this;if(t=t||this.endpoint){var r=-1==t.indexOf("?")?"?":"&";e&&(t+="".concat(r,"subscribe=").concat(e)),(this._token||n)&&(t+="".concat(e?"&":"?","token=").concat(this._token||n)),this.close(),this.ws=new WebSocket(t),setTimeout(function(){i.ws&&1!=i.ws.readyState&&3!=i.ws.readyState&&(console.warn("Connection watchdog expired (".concat(i._wsTimeout/1e3," sec): ").concat(i.ws.readyState,"... aborting connection...")),i.close())},this._wsTimeout),this.ws.onopen=function(t){i._connect.next(t)},this.ws.onclose=function(t){i._close.next(t)},this.ws.onerror=function(t){i._error.next(t)},this.ws.onmessage=function(t){i.parseOnMessage(t)}}}},{key:"parseOnMessage",value:function(t){var e;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(n){return}this.isHello(e)?(this.selfId=e.self,this._playbackMode=void 0!==e.startTime,this._message.next(e)):this.isResponse(e)?(void 0!==e.login&&void 0!==e.login.token&&(this._token=e.login.token),this._message.next(e)):this._filter&&this.isDelta(e)?e.context==this._filter&&this._message.next(e):this._message.next(e)}},{key:"sendRequest",value:function(t){if("object"!=typeof t)return"";var e=U.request();return void 0===t.login&&this._token&&(e.token=this._token),Object.keys(t).forEach(function(n){e[n]=t[n]}),this.send(e),e.requestId}},{key:"put",value:function(t,e,n){return this.sendRequest({context:"self"==t?"vessels.self":t,put:{path:e,value:n}})}},{key:"login",value:function(t,e){return this.sendRequest({login:{username:t,password:e}})}},{key:"send",value:function(t){this.ws&&("object"==typeof t&&(t=JSON.stringify(t)),this.ws.send(t))}},{key:"sendUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"self",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=U.updates();this._token&&(i.token=this._token),i.context="self"==t?"vessels.self":t,this._token&&(i.token=this._token);var r=[];"string"==typeof e&&r.push({path:e,value:n}),"object"==typeof e&&Array.isArray(e)&&(r=e);var o={timestamp:(new Date).toISOString(),values:r};this._source&&(o.source=this._source),i.updates.push(o),this.send(i)}},{key:"subscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=arguments.length>2?arguments[2]:void 0,i=U.subscribe();if(this._token&&(i.token=this._token),i.context="self"==t?"vessels.self":t,this._token&&(i.token=this._token),"object"==typeof e&&Array.isArray(e)&&(i.subscribe=e),"string"==typeof e){var r={};r.path=e,n&&"object"==typeof n&&(n.period&&(r.period=n.period),n.minPeriod&&(r.minPeriod=n.period),n.format&&("delta"==n.format||"full"==n.format)&&(r.format=n.format),n.policy&&("instant"==n.policy||"ideal"==n.policy||"fixed"==n.policy)&&(r.policy=n.policy)),i.subscribe.push(r)}this.send(i)}},{key:"unsubscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=U.unsubscribe();this._token&&(n.token=this._token),n.context="self"==t?"vessels.self":t,this._token&&(n.token=this._token),"object"==typeof e&&Array.isArray(e)&&(n.unsubscribe=e),"string"==typeof e&&n.unsubscribe.push({path:e}),this.send(n)}},{key:"raiseAlarm",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;t="string"==typeof n&&-1==n.indexOf("notifications.")?"notifications.".concat(n):n,this.put(e,t,i.value)}},{key:"clearAlarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1?arguments[1]:void 0,n=-1==e.indexOf("notifications.")?"notifications.".concat(e):e;this.put(t,n,null)}},{key:"isSelf",value:function(t){return t.context==this.selfId}},{key:"isDelta",value:function(t){return void 0!==t.context}},{key:"isHello",value:function(t){return void 0!==t.version&&void 0!==t.self}},{key:"isResponse",value:function(t){return void 0!==t.requestId}}]),t}();return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=function(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}({token:t,factory:t.\u0275fac,providedIn:"root"}),t}(),j=function(){function t(e,n,i,r){u(this,t),this._method=[],this._message="",this._message=void 0!==e?e:"",this._state=void 0!==n?n:D.alarm,i&&this._method.push(C.visual),r&&this._method.push(C.sound)}return l(t,[{key:"value",get:function(){return{message:this._message,state:this._state,method:this._method}}}]),t}(),D=(function(t){t.normal="normal",t.alert="alert",t.warn="warn",t.alarm="alarm",t.emergency="emergency"}(D||(D={})),D),C=(function(t){t.visual="visual",t.sound="sound"}(C||(C={})),C),G=function(){function t(){u(this,t),this.obsList=[],this.stream=new A,this._connect=new O,this.onConnect=this._connect.asObservable(),this._close=new O,this.onClose=this._close.asObservable(),this._error=new O,this.onError=this._error.asObservable(),this._message=new O,this.onMessage=this._message.asObservable()}return l(t,[{key:"endpoint",get:function(){return this.stream.endpoint},set:function(t){this.stream.endpoint=t}},{key:"selfId",get:function(){return this.stream.selfId},set:function(t){this.stream.selfId=t}},{key:"_source",get:function(){return this.stream._source},set:function(t){this.stream._source=t}},{key:"source",set:function(t){this.stream.source=t}},{key:"authToken",set:function(t){this.stream.authToken=t}},{key:"connectionTimeout",get:function(){return this.stream.connectionTimeout},set:function(t){this.stream.connectionTimeout=t}},{key:"isOpen",get:function(){return this.stream.isOpen}},{key:"filter",get:function(){return this.stream.filter},set:function(t){this.stream.filter=t}},{key:"playbackMode",get:function(){return this.stream.playbackMode}},{key:"open",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",i=arguments.length>2?arguments[2]:void 0;this.obsList.push(this.stream.onConnect.subscribe(function(t){return e._connect.next(t)})),this.obsList.push(this.stream.onClose.subscribe(function(t){return e._close.next(t)})),this.obsList.push(this.stream.onError.subscribe(function(t){return e._error.next(t)})),this.obsList.push(this.stream.onMessage.subscribe(function(t){return e._message.next(t)})),this.stream.open(t,n,i)}},{key:"close",value:function(){this.stream.close(),this.obsList.forEach(function(t){return t.unsubscribe()}),this.obsList=[]}},{key:"sendRequest",value:function(t){return this.stream.sendRequest(t)}},{key:"put",value:function(t,e,n){return this.stream.put(t,e,n)}},{key:"login",value:function(t,e){return this.stream.login(t,e)}},{key:"send",value:function(t){this.stream.send(t)}},{key:"sendUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"self",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;this.stream.sendUpdate(t,e,n)}},{key:"subscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=arguments.length>2?arguments[2]:void 0;this.stream.subscribe(t,e,n)}},{key:"unsubscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*";this.stream.unsubscribe(t,e)}},{key:"raiseAlarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;this.stream.raiseAlarm(t,e,n)}},{key:"clearAlarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1?arguments[1]:void 0;this.stream.clearAlarm(t,e)}},{key:"isSelf",value:function(t){return this.stream.isSelf(t)}},{key:"isDelta",value:function(t){return this.stream.isDelta(t)}},{key:"isHello",value:function(t){return this.stream.isHello(t)}},{key:"isResponse",value:function(t){return this.stream.isResponse(t)}}]),t}(),F=l(function t(){u(this,t),this.position=[0,0],this.headingTrue=null,this.headingMagnetic=null,this.cogTrue=null,this.cogMagnetic=null,this.wind={direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null},this.lastUpdated=new Date,this.orientation=0,this.buddy=!1,this.closestApproach=null,this.mode="day",this.anchor={maxRadius:null,radius:null,position:null},this.resourceUpdates=[],this.autopilot={},this.track=[],this.properties={}}),W=l(function t(){u(this,t),this.lastUpdated=new Date,this.position=[0,0],this.properties={}}),B=function(t){n(i,t);var e=r(i);function i(){var t;return u(this,i),(t=e.call(this)).type={id:-1,name:""},t}return l(i)}(W),H=function(t){n(i,t);var e=r(i);function i(){var t;return u(this,i),(t=e.call(this)).orientation=0,t.sog=0,t.track=[],t}return l(i)}(W),q=function(){function t(){u(this,t)}return l(t,null,[{key:"celciusToKelvin",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t+273.15}},{key:"kelvinToCelcius",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t-273.15}},{key:"kelvinToFarenheit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 1.8*t-459.67}},{key:"degreesToRadians",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t*Math.PI/180}},{key:"radiansToDegrees",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 180*t/Math.PI}},{key:"angleToDirection",value:function(t,e){var n=2*Math.PI;if(e||(e=0),t||(t=0),isNaN(e)||isNaN(t))return null;var i=e+t;return i>n?i-n:i<0?n+i:i}},{key:"directionToAngle",value:function(t,e){var n=2*Math.PI;if(e||(e=0),t||(t=0),isNaN(e)||isNaN(t))return null;var i,r=e-t;if(r>0)i=r>Math.PI?n-r:0-r;else if(r<0){var o=Math.abs(r);i=o>Math.PI?o-n:o}else i=r;return i}},{key:"knotsToKm",value:function(t){return 1.852*t}},{key:"nauticalMilesToKm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 1.852*t}},{key:"knotsToMSec",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return.51444325460445*t}},{key:"kmToKnots",value:function(t){return.539957*t}},{key:"kmToNauticalMiles",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return.539957*t}},{key:"kmToMiles",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return.621371*t}},{key:"msecToKnots",value:function(t){return 1.94384*t}},{key:"nauticalMilesToMiles",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 1.15078*t}},{key:"milesToKm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 1.60934*t}},{key:"milesToNauticalMiles",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return.868976*t}},{key:"rpmToHertz",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t/60}}]),t}(),L={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},N={};N[L.DEGREES]=2*Math.PI*6370997/360,N[L.FEET]=.3048,N[L.METERS]=1,N[L.USFEET]=1200/3937;var V=L,K=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||N[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}(),X="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2};function J(t){return t*Math.PI/180}"log2"in Math&&Math;var Y,Z,z=(Z=function(t,e){return(Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}Z(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),$=6378137,Q=Math.PI*$,tt=[-Q,-Q,Q,Q],et=[-180,-85,180,85],nt=$*Math.log(Math.tan(Math.PI/2)),it=function(t){function e(e){return t.call(this,{code:e,units:V.METERS,extent:tt,global:!0,worldExtent:et,getPointResolution:function(t,e){return t/X(e[1]/$)}})||this}return z(e,t),e}(K),rt=[new it("EPSG:3857"),new it("EPSG:102100"),new it("EPSG:102113"),new it("EPSG:900913"),new it("http://www.opengis.net/gml/srs/epsg.xml#3857")],ot=(Y=function(t,e){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),st=[-180,-90,180,90],at=6378137*Math.PI/180,ut=function(t){function e(e,n){return t.call(this,{code:e,units:V.DEGREES,extent:st,axisOrientation:n,global:!0,metersPerUnit:at,worldExtent:st})||this}return ot(e,t),e}(K),ct=[new ut("CRS:84"),new ut("EPSG:4326","neu"),new ut("urn:ogc:def:crs:OGC:1.3:CRS84"),new ut("urn:ogc:def:crs:OGC:2:84"),new ut("http://www.opengis.net/gml/srs/epsg.xml#4326","neu")],lt={},ht={};function ft(t,e,n){var i=t.getCode(),r=e.getCode();i in ht||(ht[i]={}),ht[i][r]=n}function dt(t,e,n){var i=n||6371008.8,r=J(t[1]),o=J(e[1]),s=(o-r)/2,a=J(e[0]-t[0])/2,u=Math.sin(s)*Math.sin(s)+Math.sin(a)*Math.sin(a)*Math.cos(r)*Math.cos(o);return 2*i*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))}function pt(t,e,n){var i;if(void 0!==e){for(var r=0,o=t.length;r<o;++r)e[r]=t[r];i=e}else i=t.slice();return i}function vt(t,e,n){if(void 0!==e&&t!==e){for(var i=0,r=t.length;i<r;++i)e[i]=t[i];t=e}return t}function gt(t){(function(t,e){lt[t]=e})(t.getCode(),t),ft(t,t,pt)}function bt(t){return"string"==typeof t?function(t){return lt[t]||lt[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}(t):t||null}function yt(t){(function(t){t.forEach(gt)})(t),t.forEach(function(e){t.forEach(function(t){e!==t&&ft(e,t,pt)})})}function mt(t,e){var n=function(t,e){var n;return t in ht&&e in ht[t]&&(n=ht[t][e]),n}(t.getCode(),e.getCode());return n||(n=vt),n}yt(rt),yt(ct),function(t,e,n,i){t.forEach(function(t){e.forEach(function(e){ft(t,e,n),ft(e,t,i)})})}(ct,rt,function(t,e,n){var i=t.length,r=n>1?n:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(i));for(var s=0;s<i;s+=r){o[s]=Q*t[s]/180;var a=$*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));a>nt?a=nt:a<-nt&&(a=-nt),o[s+1]=a}return o},function(t,e,n){var i=t.length,r=n>1?n:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(i));for(var s=0;s<i;s+=r)o[s]=180*t[s]/Q,o[s+1]=360*Math.atan(Math.exp(t[s+1]/$))/Math.PI-90;return o});var kt,wt,_t,xt,Et,St=function(){function t(){u(this,t)}return l(t,null,[{key:"destCoordinate",value:function(t,e,n,i){for(var r=6378137,o=6356752.3142,s=1/298.257223563,a=i,u=n,c=Math.sin(u),l=Math.cos(u),h=(1-s)*Math.tan(q.degreesToRadians(t)),f=1/Math.sqrt(1+h*h),d=h*f,p=Math.atan2(h,l),v=f*c,g=1-v*v,b=g*(r*r-o*o)/(o*o),y=1+b/16384*(4096+b*(b*(320-175*b)-768)),m=b/1024*(256+b*(b*(74-47*b)-128)),k=a/(o*y),w=2*Math.PI;Math.abs(k-w)>1e-12;){var _=Math.cos(2*p+k),x=Math.sin(k),E=Math.cos(k);w=k,k=a/(o*y)+m*x*(_+m/4*(E*(2*_*_-1)-m/6*_*(4*x*x-3)*(4*_*_-3)))}var S=d*x-f*E*l,M=Math.atan2(d*E+f*x*l,(1-s)*Math.sqrt(v*v+S*S)),T=s/16*g*(4+s*(4-3*g)),O=Math.atan2(x*c,f*E-d*x*l)-(1-T)*s*v*(k+T*x*(_+T*E*(2*_*_-1))),P=(Math.atan2(v,-S),q.radiansToDegrees(M));return[e+q.radiansToDegrees(O),P]}},{key:"toGo",value:function(e,n){return{bearing:t.bearingTo(e,n),distance:t.distanceTo(e,n)}}},{key:"distanceTo",value:function(t,e){var n=q.degreesToRadians(t[1]),i=q.degreesToRadians(t[0]),r=q.degreesToRadians(e[1]),o=q.degreesToRadians(e[0])-i,s=Math.pow(Math.sin((r-n)/2),2)+Math.cos(n)*Math.cos(r)*Math.pow(Math.sin(o/2),2);return 2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6373*1e3}},{key:"bearingTo",value:function(t,e){var n=q.degreesToRadians(t[1]),i=q.degreesToRadians(e[1]),r=q.degreesToRadians(e[0]-t[0]),o=Math.sin(r)*Math.cos(i),s=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(r);return Math.atan2(o,s)}},{key:"centreOfPolygon",value:function(e){var n=[-180,-90],i=[180,90];if(e.forEach(function(t){i[0]=t[0]<i[0]?t[0]:i[0],i[1]=t[1]<i[1]?t[1]:i[1],n[0]=t[0]>n[0]?t[0]:n[0],n[1]=t[1]>n[1]?t[1]:n[1]}),t.inDLCrossingZone(i)||t.inDLCrossingZone(n)){var r=i[0]>0&&n[0]<0?1:i[0]<0&&n[0]>0?-1:0;1==r&&(n[0]=n[0]+360),-1==r&&(n[0]=Math.abs(n[0])-360)}return[i[0]+(n[0]-i[0])/2,i[1]+(n[1]-i[1])/2]}},{key:"calulateExtent",value:function(t){var e=[180,90,-180,-90];return t.forEach(function(t){e[0]=t[0]<e[0]?t[0]:e[0],e[1]=t[1]<e[1]?t[1]:e[1],e[2]=t[0]>e[2]?t[0]:e[2],e[3]=t[1]>e[3]?t[1]:e[3]}),e}},{key:"inDLCrossingZone",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:170;return Math.abs(t[0])>=e}},{key:"mapifyCoords",value:function(e){if(0==e.length)return e;for(var n=0,i=e[0],r=0;r<e.length;r++)(t.inDLCrossingZone(e[r])||t.inDLCrossingZone(i))&&(1==(n=i[0]>0&&e[r][0]<0?1:i[0]<0&&e[r][0]>0?-1:0)&&(e[r][0]=e[r][0]+360),-1==n&&(e[r][0]=Math.abs(e[r][0])-360));return e}},{key:"mapifyRadius",value:function(t,e){return void 0===t||void 0===e?t:t/function(t,e,n,i){var r,o=(t=bt(t)).getPointResolutionFunc();if(o)r=o(1,n);else{var s=t.getUnits();if(s==V.DEGREES||null==V.DEGREES)r=1;else{var a,u=mt(t,bt("EPSG:4326"));if(u===vt&&s!==V.DEGREES)r=1*t.getMetersPerUnit();else{var c=[n[0]-.5,n[1],n[0]+.5,n[1],n[0],n[1]-.5,n[0],n[1]+.5];r=(dt((c=u(c,c,2)).slice(0,2),c.slice(2,4))+dt(c.slice(4,6),c.slice(6,8)))/2}void 0!==(a=t.getMetersPerUnit())&&(r/=a)}}return r}("EPSG:3857",0,function(t,e){return function(t,e,n){return function(t,e){return mt(bt(t),bt(e))}(e,n)(t,void 0,t.length)}(t,"EPSG:4326","EPSG:3857")}(e))}},{key:"inBounds",value:function(t,e){var n=JSON.parse(JSON.stringify(e)),i=[t[0],t[1]];return n[0]>0&&n[2]<0&&(n[2]=360+n[2],i[0]<0&&(i[0]=360+i[0])),i[0]>n[0]&&i[0]<n[2]&&i[1]>n[1]&&i[1]<n[3]}},{key:"calcMapifiedExtent",value:function(t,e){var n=111111,i=n*Math.cos(q.degreesToRadians(t[1])),r=[0,0,0,0];return r[1]=t[1]+(0-Math.abs(e))/n,r[3]=t[1]+Math.abs(e)/n,r[0]=t[0]+(0-Math.abs(e))/i,r[2]=t[0]+Math.abs(e)/i,r}},{key:"normaliseCoords",value:function(t){var e=this;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(function(t){return e.normaliseCoords(t)}),t):void 0}}]),t}(),Mt=l(function t(){u(this,t),this.action=null,this.playback=!1,this.result=null}),Tt=function(t){n(i,t);var e=r(i);function i(t){var n;return u(this,i),(n=e.call(this)).action="notification",n.type=t,n}return l(i)}(Mt),Ot=function(t){n(i,t);var e=r(i);function i(){var t;return u(this,i),(t=e.call(this)).action="update",t}return l(i)}(Mt),Pt=["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"],Rt=[],It=[],Ut=!1,At=!1,jt={signalk:{},aisState:[]},Dt=[0,0,0,0],Ct=60,Gt=0,Ft={},Wt=500,Bt=!1,Ht={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20};function qt(){xt={updated:{},stale:{},expired:{}}}function Lt(t){var e=t.action,n=t.msg;switch(e){case"onConnect":postMessage({action:"open",playback:Bt,result:n.target.readyState});break;case"onClose":console.warn("streamEvent: ",n),Vt(!1);break;case"onError":console.warn("streamEvent: ",n),postMessage({action:"error",playback:Bt,result:"Connection error!"});break;case"onMessage":!function(t){wt.isHello(t)?(postMessage({action:"hello",result:t,self:t.self,playback:Bt}),Wt&&Yt()):wt.isDelta(t)?(Ut=!0,t.updates.forEach(function(e){!e.values||e.values.forEach(function(n){if(Et=e.timestamp,t.context)switch(t.context.split(".")[0]){case"shore":case"atons":(null==jt?void 0:jt.signalk.atons)&&function(t,e){var n=!1;if(-1!=t.indexOf("shore.basestations")&&(n=!0),!kt.atons.has(t)){var i=new B;i.id=t,i.position=null,n&&(i.type.id=-1,i.type.name="Basestation"),kt.atons.set(t,i)}var r=kt.atons.get(t);""==e.path?(void 0!==e.value.name&&(r.name=e.value.name),void 0!==e.value.mmsi&&(r.mmsi=e.value.mmsi),void 0!==e.value.atonType&&(r.type=e.value.atonType)):"atonType"==e.path?r.type=e.value:"navigation.position"==e.path?(r.position=[e.value.longitude,e.value.latitude],r.positionReceived=!0):r.properties[e.path]=e.value}(t.context,n),Xt(t.context,kt.atons,null==jt?void 0:jt.signalk.atons);break;case"sar":(null==jt?void 0:jt.signalk.sar)&&function(t,e){if(!kt.sar.has(t)){var n=new B;n.id=t,n.position=null,n.type.id=-1,n.type.name="SaR Beacon",kt.sar.set(t,n)}var i=kt.sar.get(t);""==e.path?(void 0!==e.value.name&&(i.name=e.value.name),void 0!==e.value.mmsi&&(i.mmsi=e.value.mmsi)):"communication.callsignVhf"==e.path?i.callsign=e.value:"navigation.position"==e.path&&e.value?(i.position=St.normaliseCoords([e.value.longitude,e.value.latitude]),i.positionReceived=!0):i.properties[e.path]=e.value}(t.context,n),Xt(t.context,kt.sar,null==jt?void 0:jt.signalk.sar);break;case"aircraft":(null==jt?void 0:jt.signalk.aircraft)&&function(t,e){if(!kt.aircraft.has(t)){var n=new H;n.id=t,n.position=null,kt.aircraft.set(t,n)}var i=kt.aircraft.get(t);""==e.path?(void 0!==e.value.name&&(i.name=e.value.name),void 0!==e.value.mmsi&&(i.mmsi=e.value.mmsi)):"communication.callsignVhf"==e.path?i.callsign=e.value:"navigation.position"==e.path&&e.value?(i.position=St.normaliseCoords([e.value.longitude,e.value.latitude]),i.positionReceived=!0,$t(i)):"navigation.courseOverGroundTrue"==e.path?i.orientation=e.value:"navigation.speedOverGround"==e.path?i.sog=e.value:i.properties[e.path]=e.value}(t.context,n),Xt(t.context,kt.aircraft,null==jt?void 0:jt.signalk.aircraft);break;case"vessels":wt.isSelf(t)?(zt(kt.self,n,!0),function(t,e){var n,i={path:t.path,value:t.value,context:null},r=t.path.split(".");if(("notifications.environment.depth.belowTransducer"==t.path||"notifications.environment.depth.belowSurface"==t.path||"notifications.environment.depth.belowKeel"==t.path)&&(n=r[2]),"notifications.navigation.anchor"==t.path&&(n=r[2]),-1!=["mob","sinking","fire","piracy","flooding","collision","grounding","listing","adrift","abandon"].indexOf(r[r.length-1])&&(n=r[r.length-1]),-1!=t.path.indexOf("notifications.navigation.closestApproach")&&(n=r[2],i.context=r[3]),-1!=t.path.indexOf("notifications.buddy")&&(n=r[1],i.context=r[2]),(-1!=t.path.indexOf("notifications.arrivalCircleEntered")||-1!=t.path.indexOf("notifications.navigation.course.arrivalCircleEntered"))&&(n=r[1],i.context=r[2]),n){var o=new Tt(n);o.playback=Bt,o.result=i,postMessage(o)}}(n)):((null==jt?void 0:jt.signalk.vessels)&&zt(function(t){if(!kt.aisTargets.has(t)){var e=new F;e.position=null,kt.aisTargets.set(t,e)}return kt.aisTargets.get(t)}(t.context),n),Xt(t.context,kt.aisTargets,null==jt?void 0:jt.signalk.vessels,null==jt?void 0:jt.aisState))}})}),Jt()):wt.isResponse(t)&&postMessage({action:"response",result:t})}(n)}}function Nt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.interval&&"number"==typeof t.interval&&(Wt=t.interval,Zt(),Yt(),Ct=1/(Wt/1e3)*60),Bt=!!t.playback,t.selections&&(void 0!==t.selections.preferredPaths&&(Ft=t.selections.preferredPaths),t.selections.aisMaxAge&&"number"==typeof t.selections.aisMaxAge&&(Ht.maxAge=t.selections.aisMaxAge),t.selections.aisStaleAge&&"number"==typeof t.selections.aisStaleAge&&(Ht.staleAge=t.selections.aisStaleAge),"number"==typeof t.selections.signalk.maxRadius&&(jt.signalk=t.selections.signalk),void 0!==t.selections.aisState&&Array.isArray(t.selections.aisState)&&(jt.aisState=t.selections.aisState),console.log("Worker: AIS Filter...",jt))}function Vt(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Zt(),Rt.forEach(function(t){return t.unsubscribe()}),wt&&t&&wt.close(),wt=null,postMessage({action:"close",result:t,playback:Bt})}function Kt(){(function(t){return new Promise(function(e,n){fetch("".concat(t)).then(function(t){t.json().then(function(t){return e(t)}).catch(function(t){return n(t)})}).catch(function(t){n(t)})})})(_t+"/tracks"+(jt&&jt.signalk&&jt.signalk.maxRadius?"?radius=".concat(jt.signalk.maxRadius):"?radius=10000")).then(function(t){At=!0,Object.entries(t).forEach(function(t){if(kt.aisTargets.has(t[0])){var e=kt.aisTargets.get(t[0]);e.track=t[1].coordinates,$t(e)}})}).catch(function(t){At=!1,console.warn("Unable to fetch AIS tracks!")})}function Xt(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(n){var r=e.get(t);r&&i.includes(null==r?void 0:r.state)&&(console.log("state match => ".concat(i,", ").concat(t)),xt.expired[t]=!0,r=null),r&&jt.signalk.maxRadius?r.positionReceived&&St.inBounds(r.position,Dt)?xt.updated[t]=!0:(e.delete(t),xt.expired[t]=!0):xt.updated[t]=!0}else 0!=e.size&&(e.forEach(function(t,e){xt.expired[e]=!0}),e.clear())}function Jt(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!Wt||t){var e=new Ot;e.playback=Bt,kt.aisStatus.updated=Object.keys(xt.updated),kt.aisStatus.stale=Object.keys(xt.stale),kt.aisStatus.expired=Object.keys(xt.expired),e.result=kt,e.timestamp=Bt?Et:kt.self.lastUpdated.toISOString(),postMessage(e),qt(),kt.self.resourceUpdates=[],0==Gt&&(function(){var t=(new Date).valueOf();kt.aisTargets.forEach(function(e,n){e.lastUpdated<t-Ht.maxAge?(xt.expired[n]=!0,kt.aisTargets.delete(n)):e.lastUpdated<t-Ht.staleAge&&(xt.stale[n]=!0)}),kt.aircraft.forEach(function(e,n){e.lastUpdated<t-Ht.maxAge?(xt.expired[n]=!0,kt.aircraft.delete(n)):e.lastUpdated<t-Ht.staleAge&&(xt.stale[n]=!0)}),kt.sar.forEach(function(e,n){e.lastUpdated<t-Ht.maxAge?(xt.expired[n]=!0,kt.sar.delete(n)):e.lastUpdated<t-Ht.staleAge&&(xt.stale[n]=!0)})}(),kt.self.positionReceived&&(null==jt?void 0:jt.signalk.maxRadius)&&(Dt=St.calcMapifiedExtent(kt.self.position,jt.signalk.maxRadius),Gt++)),Gt=Gt>=Ct?0:Gt+1}}function Yt(){Wt&&"number"==typeof Wt&&It.push(setInterval(function(){Ut&&(Jt(!0),Ut=!1)},Wt)),It.push(setInterval(function(){console.warn("hasTrackPlugin",At),At&&Kt()},6e4))}function Zt(){It.forEach(function(t){return clearInterval(t)}),It=[]}function zt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.lastUpdated=new Date,n&&-1!=Pt.indexOf(e.path)&&(kt.paths[e.path]=e.value),""==e.path)void 0!==e.value.name&&(t.name=e.value.name),void 0!==e.value.mmsi&&(t.mmsi=e.value.mmsi),void 0!==e.value.buddy&&(t.buddy=e.value.buddy);else if("communication.callsignVhf"==e.path)t.callsign=e.value;else if("navigation.position"==e.path&&e.value){if(void 0===e.value.longitude)return;t.position=St.normaliseCoords([e.value.longitude,e.value.latitude]),t.positionReceived=!0,n||$t(t)}else"navigation.state"==e.path?t.state=e.value:"navigation.speedOverGround"==e.path?t.sog=e.value:"navigation.courseOverGroundTrue"==e.path?t.cogTrue=e.value:"navigation.courseOverGroundMagnetic"==e.path?t.cogMagnetic=e.value:"navigation.headingTrue"==e.path?t.headingTrue=e.value:"navigation.headingMagnetic"==e.path?t.headingMagnetic=e.value:"environment.wind.angleApparent"==e.path?t.wind.awa=e.value:"environment.wind.speedApparent"==e.path?t.wind.aws=e.value:"environment.wind.speedTrue"==e.path?t.wind.speedTrue=e.value:"environment.wind.speedOverGround"==e.path?t.wind.sog=e.value:"environment.wind.directionTrue"==e.path?t.wind.twd=e.value:"environment.wind.directionMagnetic"==e.path?t.wind.mwd=e.value:"environment.mode"==e.path?t.mode=e.value:-1!=e.path.indexOf("navigation.courseRhumbline")&&void 0!==Ft.course&&e.path.split(".").slice(0,2).join(".")==Ft.course||-1!=e.path.indexOf("navigation.courseGreatCircle")&&void 0!==Ft.course&&e.path.split(".").slice(0,2).join(".")==Ft.course?t["course."+e.path.split(".").slice(2).join(".")]=e.value:-1!=e.path.indexOf("navigation.closestApproach")?t.closestApproach=e.value:"navigation.anchor.position"==e.path?t.anchor.position=e.value:"navigation.anchor.maxRadius"==e.path?t.anchor.maxRadius=e.value:"navigation.anchor.currentRadius"==e.path?t.anchor.radius=e.value:-1!=e.path.indexOf("resources.")?t.resourceUpdates.push(e):"steering.autopilot.state"==e.path?t.autopilot.state=e.value:"steering.autopilot.mode"==e.path?t.autopilot.mode=e.value:t.properties[e.path]=e.value;t.heading=null==t.heading&&null!=t.cog?t.cog:t.heading,void 0!==Ft.heading&&e.path==Ft.heading&&(t.orientation=e.value),void 0!==Ft.tws&&e.path==Ft.tws&&(t.wind.tws=e.value),void 0!==Ft.twd&&e.path==Ft.twd&&(t.wind.direction="environment.wind.angleTrueGround"==e.path||"environment.wind.angleTrueWater"==e.path?q.angleToDirection(e.value,t.heading):e.value)}function $t(t){if(t.track&&0==t.track.length)t.track.push([t.position]);else{var e=t.track[t.track.length-1][t.track[t.track.length-1].length-1];e[0]!=t.position[0]&&e[1]!=t.position[1]&&t.track[t.track.length-1].push(t.position)}t.track[t.track.length-1]=t.track[t.track.length-1].slice(0-Ht.maxTrack)}addEventListener("message",function(t){!function(t){if(t.cmd)switch(t.cmd){case"open":console.log("Worker control: opening stream..."),Nt(t.options),function(t){if(!wt)if(t.url){var e=t.url.split("/");if(e.pop(),e.push("api"),e[0]="wss:"==e[0]?"https:":"http:",_t=e.join("/"),(kt={self:new F,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map}).self.positionReceived=!1,qt(),wt=new G,Rt.push(wt.onConnect.subscribe(function(t){return Lt({action:"onConnect",msg:t})})),Rt.push(wt.onClose.subscribe(function(t){return Lt({action:"onClose",msg:t})})),Rt.push(wt.onError.subscribe(function(t){return Lt({action:"onError",msg:t})})),Rt.push(wt.onMessage.subscribe(function(t){return Lt({action:"onMessage",msg:t})})),t.playback){var n=t.playbackOptions.startTime?"?startTime=".concat(t.playbackOptions.startTime):null,i=t.playbackOptions.playbackRate?"playbackRate=".concat(t.playbackOptions.playbackRate):null;i=i?n?"&"+i:"?"+i:null,wt.open("".concat(t.url).concat(n||"").concat(i||""),t.playbackOptions.subscribe,t.token)}else wt.open(t.url,t.subscribe,t.token),Kt()}else postMessage({action:"error",result:"Valid options not provided!"})}(t.options);break;case"close":console.log("Worker control: closing stream..."),Vt(!0);break;case"subscribe":console.log("Worker control: subscribing to paths..."),wt.subscribe(t.options.context,t.options.path);break;case"settings":console.log("Worker control: settings..."),Nt(t.options);break;case"alarm":console.log("Worker control: alarm action..."),function(t){var e=-1==t.type.indexOf("notifications.")?"notifications.".concat(t.type):t.type;t.raise?wt.raiseAlarm("self",e,new j(t.message,t.state,!0,!0)):wt.clearAlarm("self",e)}(t.options);break;case"vessel":var e;if(console.log("Worker control: vessel setting..."),t.options)(e="self"==t.options.context?kt.self:kt.aisTargets.get(t.options.context))&&t.options.name&&(e.name=t.options.name);break;case"auth":console.log("Worker control: auth token..."),t.options&&(wt.authToken=t.options.token)}}(t.data)})}()}();
|
|
1
|
+
!function(){function t(){return(t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,n,i){var r=e(t,n);if(r){var o=Object.getOwnPropertyDescriptor(r,n);return o.get?o.get.call(arguments.length<3?t:i):o.value}}).apply(this,arguments)}function e(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var n,i=a(t);if(e){var r=a(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return o(this,n)}}function o(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}!function(){"use strict";function e(t){return"function"==typeof t}var i=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){var e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else i&&console.log("RxJS: Back to a better error behavior. Thank you. <3");i=t},get useDeprecatedSynchronousErrorHandling(){return i}};function c(t){setTimeout(function(){throw t},0)}var h={closed:!0,next:function(t){},error:function(t){if(o.useDeprecatedSynchronousErrorHandling)throw t;c(t)},complete:function(){}},f=Array.isArray||function(t){return t&&"number"==typeof t.length};function d(t){return null!==t&&"object"==typeof t}var p,v=function(){function t(t){return Error.call(this),this.message=t?"".concat(t.length," errors occurred during unsubscription:\n").concat(t.map(function(t,e){return"".concat(e+1,") ").concat(t.toString())}).join("\n ")):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),g=function(){function t(e){u(this,t),this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}return l(t,[{key:"unsubscribe",value:function(){var n;if(!this.closed){var i=this._parentOrParents,r=this._ctorUnsubscribe,o=this._unsubscribe,s=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,i instanceof t)i.remove(this);else if(null!==i)for(var a=0;a<i.length;++a)i[a].remove(this);if(e(o)){r&&(this._unsubscribe=void 0);try{o.call(this)}catch(a){n=a instanceof v?b(a.errors):[a]}}if(f(s))for(var u=-1,c=s.length;++u<c;){var l=s[u];if(d(l))try{l.unsubscribe()}catch(h){n=n||[],h instanceof v?n=n.concat(b(h.errors)):n.push(h)}}if(n)throw new v(n)}}},{key:"add",value:function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var i=n;(n=new t)._subscriptions=[i]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var r=n._parentOrParents;if(null===r)n._parentOrParents=this;else if(r instanceof t){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}var o=this._subscriptions;return null===o?this._subscriptions=[n]:o.push(n),n}},{key:"remove",value:function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}}}]),t}();function b(t){return t.reduce(function(t,e){return t.concat(e instanceof v?e.errors:e)},[])}g.EMPTY=((p=new g).closed=!0,p);var y="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random(),m=function(e){n(o,e);var i=r(o);function o(t,e,n){var r;switch(u(this,o),(r=i.call(this)).syncErrorValue=null,r.syncErrorThrown=!1,r.syncErrorThrowable=!1,r.isStopped=!1,arguments.length){case 0:r.destination=h;break;case 1:if(!t){r.destination=h;break}if("object"==typeof t){t instanceof o?(r.syncErrorThrowable=t.syncErrorThrowable,r.destination=t,t.add(s(r))):(r.syncErrorThrowable=!0,r.destination=new k(s(r),t));break}default:r.syncErrorThrowable=!0,r.destination=new k(s(r),t,e,n)}return r}return l(o,[{key:y,value:function(){return this}},{key:"next",value:function(t){this.isStopped||this._next(t)}},{key:"error",value:function(t){this.isStopped||(this.isStopped=!0,this._error(t))}},{key:"complete",value:function(){this.isStopped||(this.isStopped=!0,this._complete())}},{key:"unsubscribe",value:function(){this.closed||(this.isStopped=!0,t(a(o.prototype),"unsubscribe",this).call(this))}},{key:"_next",value:function(t){this.destination.next(t)}},{key:"_error",value:function(t){this.destination.error(t),this.unsubscribe()}},{key:"_complete",value:function(){this.destination.complete(),this.unsubscribe()}},{key:"_unsubscribeAndRecycle",value:function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this}}],[{key:"create",value:function(t,e,n){var i=new o(t,e,n);return i.syncErrorThrowable=!1,i}}]),o}(g),k=function(t){n(a,t);var i=r(a);function a(t,n,r,o){var c;u(this,a),(c=i.call(this))._parentSubscriber=t;var l,f=s(c);return e(n)?l=n:n&&(l=n.next,r=n.error,o=n.complete,n!==h&&(e((f=Object.create(n)).unsubscribe)&&c.add(f.unsubscribe.bind(f)),f.unsubscribe=c.unsubscribe.bind(s(c)))),c._context=f,c._next=l,c._error=r,c._complete=o,c}return l(a,[{key:"next",value:function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}}},{key:"error",value:function(t){if(!this.isStopped){var e=this._parentSubscriber,n=o.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):c(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;c(t)}}}},{key:"complete",value:function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};o.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}}},{key:"__tryOrUnsub",value:function(t,e){try{t.call(this._context,e)}catch(n){if(this.unsubscribe(),o.useDeprecatedSynchronousErrorHandling)throw n;c(n)}}},{key:"__tryOrSetError",value:function(t,e,n){if(!o.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(i){return o.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=i,t.syncErrorThrown=!0,!0):(c(i),!0)}return!1}},{key:"_unsubscribe",value:function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()}}]),a}(m),w="function"==typeof Symbol&&Symbol.observable||"@@observable";function _(t){return t}var x=function(){var t=function(){function t(e){u(this,t),this._isScalar=!1,e&&(this._subscribe=e)}return l(t,[{key:"lift",value:function(e){var n=new t;return n.source=this,n.operator=e,n}},{key:"subscribe",value:function(t,e,n){var i=this.operator,r=function(t,e,n){if(t){if(t instanceof m)return t;if(t[y])return t[y]()}return t||e||n?new m(t,e,n):new m(h)}(t,e,n);if(r.add(i?i.call(r,this.source):this.source||o.useDeprecatedSynchronousErrorHandling&&!r.syncErrorThrowable?this._subscribe(r):this._trySubscribe(r)),o.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable&&(r.syncErrorThrowable=!1,r.syncErrorThrown))throw r.syncErrorValue;return r}},{key:"_trySubscribe",value:function(t){try{return this._subscribe(t)}catch(e){o.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){var e=t,n=e.closed,i=e.destination,r=e.isStopped;if(n||r)return!1;t=i&&i instanceof m?i:null}return!0}(t)?t.error(e):console.warn(e)}}},{key:"forEach",value:function(t,e){var n=this;return new(e=E(e))(function(e,i){var r;r=n.subscribe(function(e){try{t(e)}catch(n){i(n),r&&r.unsubscribe()}},i,e)})}},{key:"_subscribe",value:function(t){var e=this.source;return e&&e.subscribe(t)}},{key:w,value:function(){return this}},{key:"pipe",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return 0===e.length?this:function(t){return 0===t.length?_:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}(e)(this)}},{key:"toPromise",value:function(t){var e=this;return new(t=E(t))(function(t,n){var i;e.subscribe(function(t){return i=t},function(t){return n(t)},function(){return t(i)})})}}]),t}();return t.create=function(e){return new t(e)},t}();function E(t){if(t||(t=o.Promise||Promise),!t)throw new Error("no Promise impl found");return t}var S=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),M=function(t){n(i,t);var e=r(i);function i(t,n){var r;return u(this,i),(r=e.call(this)).subject=t,r.subscriber=n,r.closed=!1,r}return l(i,[{key:"unsubscribe",value:function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}}}]),i}(g),T=function(t){n(i,t);var e=r(i);function i(t){var n;return u(this,i),(n=e.call(this,t)).destination=t,n}return l(i)}(m),O=function(){var e=function(e){n(o,e);var i=r(o);function o(){var t;return u(this,o),(t=i.call(this)).observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return l(o,[{key:y,value:function(){return new T(this)}},{key:"lift",value:function(t){var e=new P(this,this);return e.operator=t,e}},{key:"next",value:function(t){if(this.closed)throw new S;if(!this.isStopped)for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].next(t)}},{key:"error",value:function(t){if(this.closed)throw new S;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].error(t);this.observers.length=0}},{key:"complete",value:function(){if(this.closed)throw new S;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),i=0;i<e;i++)n[i].complete();this.observers.length=0}},{key:"unsubscribe",value:function(){this.isStopped=!0,this.closed=!0,this.observers=null}},{key:"_trySubscribe",value:function(e){if(this.closed)throw new S;return t(a(o.prototype),"_trySubscribe",this).call(this,e)}},{key:"_subscribe",value:function(t){if(this.closed)throw new S;return this.hasError?(t.error(this.thrownError),g.EMPTY):this.isStopped?(t.complete(),g.EMPTY):(this.observers.push(t),new M(this,t))}},{key:"asObservable",value:function(){var t=new x;return t.source=this,t}}]),o}(x);return e.create=function(t,e){return new P(t,e)},e}(),P=function(t){n(i,t);var e=r(i);function i(t,n){var r;return u(this,i),(r=e.call(this)).destination=t,r.source=n,r}return l(i,[{key:"next",value:function(t){var e=this.destination;e&&e.next&&e.next(t)}},{key:"error",value:function(t){var e=this.destination;e&&e.error&&this.destination.error(t)}},{key:"complete",value:function(){var t=this.destination;t&&t.complete&&this.destination.complete()}},{key:"_subscribe",value:function(t){return this.source?this.source.subscribe(t):g.EMPTY}}]),i}(O);"function"==typeof Symbol&&Symbol.iterator&&Symbol,Error;var R="undefined"!=typeof globalThis&&globalThis;"undefined"!=typeof window&&window,"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,R||"undefined"!=typeof global&&global,Symbol;var I=function(){function t(){u(this,t),this.version=4,this.hex="",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()}return l(t,[{key:"toString",value:function(){return this.hex}},{key:"toURN",value:function(){return"urn:uuid:"+this.hex}},{key:"toSignalK",value:function(){return"urn:mrn:signalk:uuid:".concat(this.hex)}},{key:"toBytes",value:function(){for(var t=this.hex.split("-"),e=[],n=0,i=0;i<t.length;i++)for(var r=0;r<t[i].length;r+=2)e[n++]=parseInt(t[i].substr(r,2),16);return e}},{key:"maxFromBits",value:function(t){return Math.pow(2,t)}},{key:"getRandomInt",value:function(t,e){return Math.floor(Math.random()*(e-t+1))+t}},{key:"randomUI04",value:function(){return this.getRandomInt(0,this.limitUI04-1)}},{key:"randomUI06",value:function(){return this.getRandomInt(0,this.limitUI06-1)}},{key:"randomUI08",value:function(){return this.getRandomInt(0,this.limitUI08-1)}},{key:"randomUI12",value:function(){return this.getRandomInt(0,this.limitUI12-1)}},{key:"randomUI14",value:function(){return this.getRandomInt(0,this.limitUI14-1)}},{key:"randomUI16",value:function(){return this.getRandomInt(0,this.limitUI16-1)}},{key:"randomUI32",value:function(){return this.getRandomInt(0,this.limitUI32-1)}},{key:"randomUI40",value:function(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)}},{key:"randomUI48",value:function(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)}},{key:"create",value:function(){this.fromParts(this.randomUI32(),this.randomUI16(),16384|this.randomUI12(),128|this.randomUI06(),this.randomUI08(),this.randomUI48())}},{key:"paddedString",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;n=n||"0";for(var i=e-(t=String(t)).length;i>0;i>>>=1,n+=n)1&i&&(t=n+t);return t}},{key:"fromParts",value:function(t,e,n,i,r,o){return this.version=n>>12&15,this.hex=this.paddedString(t.toString(16),8)+"-"+this.paddedString(e.toString(16),4)+"-"+this.paddedString(n.toString(16),4)+"-"+this.paddedString(i.toString(16),2)+this.paddedString(r.toString(16),2)+"-"+this.paddedString(o.toString(16),12),this}}]),t}(),U=function(){function t(){u(this,t)}return l(t,null,[{key:"updates",value:function(){return{context:null,updates:[]}}},{key:"subscribe",value:function(){return{context:null,subscribe:[]}}},{key:"unsubscribe",value:function(){return{context:null,unsubscribe:[]}}},{key:"request",value:function(){return{requestId:(new I).toString()}}}]),t}(),A=function(){var t=function(){function t(){u(this,t),this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.endpoint="",this.selfId="",this._source=null,this._connect=new O,this.onConnect=this._connect.asObservable(),this._close=new O,this.onClose=this._close.asObservable(),this._error=new O,this.onError=this._error.asObservable(),this._message=new O,this.onMessage=this._message.asObservable()}return l(t,[{key:"source",set:function(t){this._source||(this._source={}),this._source.label=t}},{key:"authToken",set:function(t){this._token=t}},{key:"connectionTimeout",get:function(){return this._wsTimeout},set:function(t){this._wsTimeout=t<3e3?3e3:t>6e4?6e4:t}},{key:"isOpen",get:function(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}},{key:"filter",get:function(){return this._filter},set:function(t){this._filter=t&&-1!=t.indexOf("self")?this.selfId?this.selfId:"":t}},{key:"playbackMode",get:function(){return this._playbackMode}},{key:"close",value:function(){this.ws&&(this.ws.close(),this.ws=null)}},{key:"open",value:function(t,e,n){var i=this;if(t=t||this.endpoint){var r=-1==t.indexOf("?")?"?":"&";e&&(t+="".concat(r,"subscribe=").concat(e)),(this._token||n)&&(t+="".concat(e?"&":"?","token=").concat(this._token||n)),this.close(),this.ws=new WebSocket(t),setTimeout(function(){i.ws&&1!=i.ws.readyState&&3!=i.ws.readyState&&(console.warn("Connection watchdog expired (".concat(i._wsTimeout/1e3," sec): ").concat(i.ws.readyState,"... aborting connection...")),i.close())},this._wsTimeout),this.ws.onopen=function(t){i._connect.next(t)},this.ws.onclose=function(t){i._close.next(t)},this.ws.onerror=function(t){i._error.next(t)},this.ws.onmessage=function(t){i.parseOnMessage(t)}}}},{key:"parseOnMessage",value:function(t){var e;if("string"==typeof t.data)try{e=JSON.parse(t.data)}catch(n){return}this.isHello(e)?(this.selfId=e.self,this._playbackMode=void 0!==e.startTime,this._message.next(e)):this.isResponse(e)?(void 0!==e.login&&void 0!==e.login.token&&(this._token=e.login.token),this._message.next(e)):this._filter&&this.isDelta(e)?e.context==this._filter&&this._message.next(e):this._message.next(e)}},{key:"sendRequest",value:function(t){if("object"!=typeof t)return"";var e=U.request();return void 0===t.login&&this._token&&(e.token=this._token),Object.keys(t).forEach(function(n){e[n]=t[n]}),this.send(e),e.requestId}},{key:"put",value:function(t,e,n){return this.sendRequest({context:"self"==t?"vessels.self":t,put:{path:e,value:n}})}},{key:"login",value:function(t,e){return this.sendRequest({login:{username:t,password:e}})}},{key:"send",value:function(t){this.ws&&("object"==typeof t&&(t=JSON.stringify(t)),this.ws.send(t))}},{key:"sendUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"self",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=U.updates();this._token&&(i.token=this._token),i.context="self"==t?"vessels.self":t,this._token&&(i.token=this._token);var r=[];"string"==typeof e&&r.push({path:e,value:n}),"object"==typeof e&&Array.isArray(e)&&(r=e);var o={timestamp:(new Date).toISOString(),values:r};this._source&&(o.source=this._source),i.updates.push(o),this.send(i)}},{key:"subscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=arguments.length>2?arguments[2]:void 0,i=U.subscribe();if(this._token&&(i.token=this._token),i.context="self"==t?"vessels.self":t,this._token&&(i.token=this._token),"object"==typeof e&&Array.isArray(e)&&(i.subscribe=e),"string"==typeof e){var r={};r.path=e,n&&"object"==typeof n&&(n.period&&(r.period=n.period),n.minPeriod&&(r.minPeriod=n.period),n.format&&("delta"==n.format||"full"==n.format)&&(r.format=n.format),n.policy&&("instant"==n.policy||"ideal"==n.policy||"fixed"==n.policy)&&(r.policy=n.policy)),i.subscribe.push(r)}this.send(i)}},{key:"unsubscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=U.unsubscribe();this._token&&(n.token=this._token),n.context="self"==t?"vessels.self":t,this._token&&(n.token=this._token),"object"==typeof e&&Array.isArray(e)&&(n.unsubscribe=e),"string"==typeof e&&n.unsubscribe.push({path:e}),this.send(n)}},{key:"raiseAlarm",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0;t="string"==typeof n&&-1==n.indexOf("notifications.")?"notifications.".concat(n):n,this.put(e,t,i.value)}},{key:"clearAlarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1?arguments[1]:void 0,n=-1==e.indexOf("notifications.")?"notifications.".concat(e):e;this.put(t,n,null)}},{key:"isSelf",value:function(t){return t.context==this.selfId}},{key:"isDelta",value:function(t){return void 0!==t.context}},{key:"isHello",value:function(t){return void 0!==t.version&&void 0!==t.self}},{key:"isResponse",value:function(t){return void 0!==t.requestId}}]),t}();return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=function(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}({token:t,factory:t.\u0275fac,providedIn:"root"}),t}(),j=function(){function t(e,n,i,r){u(this,t),this._method=[],this._message="",this._message=void 0!==e?e:"",this._state=void 0!==n?n:D.alarm,i&&this._method.push(C.visual),r&&this._method.push(C.sound)}return l(t,[{key:"value",get:function(){return{message:this._message,state:this._state,method:this._method}}}]),t}(),D=(function(t){t.normal="normal",t.alert="alert",t.warn="warn",t.alarm="alarm",t.emergency="emergency"}(D||(D={})),D),C=(function(t){t.visual="visual",t.sound="sound"}(C||(C={})),C),G=function(){function t(){u(this,t),this.obsList=[],this.stream=new A,this._connect=new O,this.onConnect=this._connect.asObservable(),this._close=new O,this.onClose=this._close.asObservable(),this._error=new O,this.onError=this._error.asObservable(),this._message=new O,this.onMessage=this._message.asObservable()}return l(t,[{key:"endpoint",get:function(){return this.stream.endpoint},set:function(t){this.stream.endpoint=t}},{key:"selfId",get:function(){return this.stream.selfId},set:function(t){this.stream.selfId=t}},{key:"_source",get:function(){return this.stream._source},set:function(t){this.stream._source=t}},{key:"source",set:function(t){this.stream.source=t}},{key:"authToken",set:function(t){this.stream.authToken=t}},{key:"connectionTimeout",get:function(){return this.stream.connectionTimeout},set:function(t){this.stream.connectionTimeout=t}},{key:"isOpen",get:function(){return this.stream.isOpen}},{key:"filter",get:function(){return this.stream.filter},set:function(t){this.stream.filter=t}},{key:"playbackMode",get:function(){return this.stream.playbackMode}},{key:"open",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none",i=arguments.length>2?arguments[2]:void 0;this.obsList.push(this.stream.onConnect.subscribe(function(t){return e._connect.next(t)})),this.obsList.push(this.stream.onClose.subscribe(function(t){return e._close.next(t)})),this.obsList.push(this.stream.onError.subscribe(function(t){return e._error.next(t)})),this.obsList.push(this.stream.onMessage.subscribe(function(t){return e._message.next(t)})),this.stream.open(t,n,i)}},{key:"close",value:function(){this.stream.close(),this.obsList.forEach(function(t){return t.unsubscribe()}),this.obsList=[]}},{key:"sendRequest",value:function(t){return this.stream.sendRequest(t)}},{key:"put",value:function(t,e,n){return this.stream.put(t,e,n)}},{key:"login",value:function(t,e){return this.stream.login(t,e)}},{key:"send",value:function(t){this.stream.send(t)}},{key:"sendUpdate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"self",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;this.stream.sendUpdate(t,e,n)}},{key:"subscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*",n=arguments.length>2?arguments[2]:void 0;this.stream.subscribe(t,e,n)}},{key:"unsubscribe",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*";this.stream.unsubscribe(t,e)}},{key:"raiseAlarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;this.stream.raiseAlarm(t,e,n)}},{key:"clearAlarm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*",e=arguments.length>1?arguments[1]:void 0;this.stream.clearAlarm(t,e)}},{key:"isSelf",value:function(t){return this.stream.isSelf(t)}},{key:"isDelta",value:function(t){return this.stream.isDelta(t)}},{key:"isHello",value:function(t){return this.stream.isHello(t)}},{key:"isResponse",value:function(t){return this.stream.isResponse(t)}}]),t}(),F=l(function t(){u(this,t),this.position=[0,0],this.headingTrue=null,this.headingMagnetic=null,this.cogTrue=null,this.cogMagnetic=null,this.wind={direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null},this.lastUpdated=new Date,this.orientation=0,this.buddy=!1,this.closestApproach=null,this.mode="day",this.anchor={maxRadius:null,radius:null,position:null},this.resourceUpdates=[],this.autopilot={},this.track=[],this.properties={}}),W=l(function t(){u(this,t),this.lastUpdated=new Date,this.position=[0,0],this.properties={}}),B=function(t){n(i,t);var e=r(i);function i(){var t;return u(this,i),(t=e.call(this)).type={id:-1,name:""},t}return l(i)}(W),H=function(t){n(i,t);var e=r(i);function i(){var t;return u(this,i),(t=e.call(this)).orientation=0,t.sog=0,t.track=[],t}return l(i)}(W),q=function(){function t(){u(this,t)}return l(t,null,[{key:"celciusToKelvin",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t+273.15}},{key:"kelvinToCelcius",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t-273.15}},{key:"kelvinToFarenheit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 1.8*t-459.67}},{key:"degreesToRadians",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t*Math.PI/180}},{key:"radiansToDegrees",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return 180*t/Math.PI}},{key:"angleToDirection",value:function(t,e){var n=2*Math.PI;if(e||(e=0),t||(t=0),isNaN(e)||isNaN(t))return null;var i=e+t;return i>n?i-n:i<0?n+i:i}},{key:"directionToAngle",value:function(t,e){var n=2*Math.PI;if(e||(e=0),t||(t=0),isNaN(e)||isNaN(t))return null;var i,r=e-t;if(r>0)i=r>Math.PI?n-r:0-r;else if(r<0){var o=Math.abs(r);i=o>Math.PI?o-n:o}else i=r;return i}},{key:"knotsToKm",value:function(t){return 1.852*t}},{key:"nauticalMilesToKm",value:function(t){return 1.852*t}},{key:"knotsToMSec",value:function(t){return.51444325460445*t}},{key:"kmToKnots",value:function(t){return.539957*t}},{key:"kmToNauticalMiles",value:function(t){return.539957*t}},{key:"kmToMiles",value:function(t){return.621371*t}},{key:"msecToKnots",value:function(t){return 1.94384*t}},{key:"msecToKmh",value:function(t){return 3.6*t}},{key:"msecToMph",value:function(t){return 2.23694*t}},{key:"nauticalMilesToMiles",value:function(t){return 1.15078*t}},{key:"milesToKm",value:function(t){return 1.60934*t}},{key:"milesToNauticalMiles",value:function(t){return.868976*t}},{key:"rpmToHertz",value:function(t){return t/60}}]),t}(),L={DEGREES:"degrees",FEET:"ft",METERS:"m",PIXELS:"pixels",TILE_PIXELS:"tile-pixels",USFEET:"us-ft"},N={};N[L.DEGREES]=2*Math.PI*6370997/360,N[L.FEET]=.3048,N[L.METERS]=1,N[L.USFEET]=1200/3937;var K=L,V=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||N[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}(),X="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2};function J(t){return t*Math.PI/180}"log2"in Math&&Math;var Y,Z,z=(Z=function(t,e){return(Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}Z(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),$=6378137,Q=Math.PI*$,tt=[-Q,-Q,Q,Q],et=[-180,-85,180,85],nt=$*Math.log(Math.tan(Math.PI/2)),it=function(t){function e(e){return t.call(this,{code:e,units:K.METERS,extent:tt,global:!0,worldExtent:et,getPointResolution:function(t,e){return t/X(e[1]/$)}})||this}return z(e,t),e}(V),rt=[new it("EPSG:3857"),new it("EPSG:102100"),new it("EPSG:102113"),new it("EPSG:900913"),new it("http://www.opengis.net/gml/srs/epsg.xml#3857")],ot=(Y=function(t,e){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),st=[-180,-90,180,90],at=6378137*Math.PI/180,ut=function(t){function e(e,n){return t.call(this,{code:e,units:K.DEGREES,extent:st,axisOrientation:n,global:!0,metersPerUnit:at,worldExtent:st})||this}return ot(e,t),e}(V),ct=[new ut("CRS:84"),new ut("EPSG:4326","neu"),new ut("urn:ogc:def:crs:OGC:1.3:CRS84"),new ut("urn:ogc:def:crs:OGC:2:84"),new ut("http://www.opengis.net/gml/srs/epsg.xml#4326","neu")],lt={},ht={};function ft(t,e,n){var i=t.getCode(),r=e.getCode();i in ht||(ht[i]={}),ht[i][r]=n}function dt(t,e,n){var i=n||6371008.8,r=J(t[1]),o=J(e[1]),s=(o-r)/2,a=J(e[0]-t[0])/2,u=Math.sin(s)*Math.sin(s)+Math.sin(a)*Math.sin(a)*Math.cos(r)*Math.cos(o);return 2*i*Math.atan2(Math.sqrt(u),Math.sqrt(1-u))}function pt(t,e,n){var i;if(void 0!==e){for(var r=0,o=t.length;r<o;++r)e[r]=t[r];i=e}else i=t.slice();return i}function vt(t,e,n){if(void 0!==e&&t!==e){for(var i=0,r=t.length;i<r;++i)e[i]=t[i];t=e}return t}function gt(t){(function(t,e){lt[t]=e})(t.getCode(),t),ft(t,t,pt)}function bt(t){return"string"==typeof t?function(t){return lt[t]||lt[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}(t):t||null}function yt(t){(function(t){t.forEach(gt)})(t),t.forEach(function(e){t.forEach(function(t){e!==t&&ft(e,t,pt)})})}function mt(t,e){var n=function(t,e){var n;return t in ht&&e in ht[t]&&(n=ht[t][e]),n}(t.getCode(),e.getCode());return n||(n=vt),n}yt(rt),yt(ct),function(t,e,n,i){t.forEach(function(t){e.forEach(function(e){ft(t,e,n),ft(e,t,i)})})}(ct,rt,function(t,e,n){var i=t.length,r=n>1?n:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(i));for(var s=0;s<i;s+=r){o[s]=Q*t[s]/180;var a=$*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));a>nt?a=nt:a<-nt&&(a=-nt),o[s+1]=a}return o},function(t,e,n){var i=t.length,r=n>1?n:2,o=e;void 0===o&&(o=r>2?t.slice():new Array(i));for(var s=0;s<i;s+=r)o[s]=180*t[s]/Q,o[s+1]=360*Math.atan(Math.exp(t[s+1]/$))/Math.PI-90;return o});var kt,wt,_t,xt,Et,St=function(){function t(){u(this,t)}return l(t,null,[{key:"destCoordinate",value:function(t,e,n,i){for(var r=6378137,o=6356752.3142,s=1/298.257223563,a=i,u=n,c=Math.sin(u),l=Math.cos(u),h=(1-s)*Math.tan(q.degreesToRadians(t)),f=1/Math.sqrt(1+h*h),d=h*f,p=Math.atan2(h,l),v=f*c,g=1-v*v,b=g*(r*r-o*o)/(o*o),y=1+b/16384*(4096+b*(b*(320-175*b)-768)),m=b/1024*(256+b*(b*(74-47*b)-128)),k=a/(o*y),w=2*Math.PI;Math.abs(k-w)>1e-12;){var _=Math.cos(2*p+k),x=Math.sin(k),E=Math.cos(k);w=k,k=a/(o*y)+m*x*(_+m/4*(E*(2*_*_-1)-m/6*_*(4*x*x-3)*(4*_*_-3)))}var S=d*x-f*E*l,M=Math.atan2(d*E+f*x*l,(1-s)*Math.sqrt(v*v+S*S)),T=s/16*g*(4+s*(4-3*g)),O=Math.atan2(x*c,f*E-d*x*l)-(1-T)*s*v*(k+T*x*(_+T*E*(2*_*_-1))),P=(Math.atan2(v,-S),q.radiansToDegrees(M));return[e+q.radiansToDegrees(O),P]}},{key:"toGo",value:function(e,n){return{bearing:t.bearingTo(e,n),distance:t.distanceTo(e,n)}}},{key:"distanceTo",value:function(t,e){var n=q.degreesToRadians(t[1]),i=q.degreesToRadians(t[0]),r=q.degreesToRadians(e[1]),o=q.degreesToRadians(e[0])-i,s=Math.pow(Math.sin((r-n)/2),2)+Math.cos(n)*Math.cos(r)*Math.pow(Math.sin(o/2),2);return 2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6373*1e3}},{key:"bearingTo",value:function(t,e){var n=q.degreesToRadians(t[1]),i=q.degreesToRadians(e[1]),r=q.degreesToRadians(e[0]-t[0]),o=Math.sin(r)*Math.cos(i),s=Math.cos(n)*Math.sin(i)-Math.sin(n)*Math.cos(i)*Math.cos(r);return Math.atan2(o,s)}},{key:"centreOfPolygon",value:function(e){var n=[-180,-90],i=[180,90];if(e.forEach(function(t){i[0]=t[0]<i[0]?t[0]:i[0],i[1]=t[1]<i[1]?t[1]:i[1],n[0]=t[0]>n[0]?t[0]:n[0],n[1]=t[1]>n[1]?t[1]:n[1]}),t.inDLCrossingZone(i)||t.inDLCrossingZone(n)){var r=i[0]>0&&n[0]<0?1:i[0]<0&&n[0]>0?-1:0;1==r&&(n[0]=n[0]+360),-1==r&&(n[0]=Math.abs(n[0])-360)}return[i[0]+(n[0]-i[0])/2,i[1]+(n[1]-i[1])/2]}},{key:"calulateExtent",value:function(t){var e=[180,90,-180,-90];return t.forEach(function(t){e[0]=t[0]<e[0]?t[0]:e[0],e[1]=t[1]<e[1]?t[1]:e[1],e[2]=t[0]>e[2]?t[0]:e[2],e[3]=t[1]>e[3]?t[1]:e[3]}),e}},{key:"inDLCrossingZone",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:170;return Math.abs(t[0])>=e}},{key:"mapifyCoords",value:function(e){if(0==e.length)return e;for(var n=0,i=e[0],r=0;r<e.length;r++)(t.inDLCrossingZone(e[r])||t.inDLCrossingZone(i))&&(1==(n=i[0]>0&&e[r][0]<0?1:i[0]<0&&e[r][0]>0?-1:0)&&(e[r][0]=e[r][0]+360),-1==n&&(e[r][0]=Math.abs(e[r][0])-360));return e}},{key:"mapifyRadius",value:function(t,e){return void 0===t||void 0===e?t:t/function(t,e,n,i){var r,o=(t=bt(t)).getPointResolutionFunc();if(o)r=o(1,n);else{var s=t.getUnits();if(s==K.DEGREES||null==K.DEGREES)r=1;else{var a,u=mt(t,bt("EPSG:4326"));if(u===vt&&s!==K.DEGREES)r=1*t.getMetersPerUnit();else{var c=[n[0]-.5,n[1],n[0]+.5,n[1],n[0],n[1]-.5,n[0],n[1]+.5];r=(dt((c=u(c,c,2)).slice(0,2),c.slice(2,4))+dt(c.slice(4,6),c.slice(6,8)))/2}void 0!==(a=t.getMetersPerUnit())&&(r/=a)}}return r}("EPSG:3857",0,function(t,e){return function(t,e,n){return function(t,e){return mt(bt(t),bt(e))}(e,n)(t,void 0,t.length)}(t,"EPSG:4326","EPSG:3857")}(e))}},{key:"inBounds",value:function(t,e){var n=JSON.parse(JSON.stringify(e)),i=[t[0],t[1]];return n[0]>0&&n[2]<0&&(n[2]=360+n[2],i[0]<0&&(i[0]=360+i[0])),i[0]>n[0]&&i[0]<n[2]&&i[1]>n[1]&&i[1]<n[3]}},{key:"calcMapifiedExtent",value:function(t,e){var n=111111,i=n*Math.cos(q.degreesToRadians(t[1])),r=[0,0,0,0];return r[1]=t[1]+(0-Math.abs(e))/n,r[3]=t[1]+Math.abs(e)/n,r[0]=t[0]+(0-Math.abs(e))/i,r[2]=t[0]+Math.abs(e)/i,r}},{key:"normaliseCoords",value:function(t){var e=this;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(function(t){return e.normaliseCoords(t)}),t):void 0}}]),t}(),Mt=l(function t(){u(this,t),this.action=null,this.playback=!1,this.result=null}),Tt=function(t){n(i,t);var e=r(i);function i(t){var n;return u(this,i),(n=e.call(this)).action="notification",n.type=t,n}return l(i)}(Mt),Ot=function(t){n(i,t);var e=r(i);function i(){var t;return u(this,i),(t=e.call(this)).action="update",t}return l(i)}(Mt),Pt=["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"],Rt=[],It=[],Ut=!1,At=!1,jt={signalk:{},aisState:[]},Dt=[0,0,0,0],Ct=60,Gt=0,Ft={},Wt=500,Bt=!1,Ht={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20};function qt(){xt={updated:{},stale:{},expired:{}}}function Lt(t){var e=t.action,n=t.msg;switch(e){case"onConnect":postMessage({action:"open",playback:Bt,result:n.target.readyState});break;case"onClose":console.warn("streamEvent: ",n),Kt(!1);break;case"onError":console.warn("streamEvent: ",n),postMessage({action:"error",playback:Bt,result:"Connection error!"});break;case"onMessage":!function(t){wt.isHello(t)?(postMessage({action:"hello",result:t,self:t.self,playback:Bt}),Wt&&Yt()):wt.isDelta(t)?(Ut=!0,t.updates.forEach(function(e){!e.values||e.values.forEach(function(n){if(Et=e.timestamp,t.context)switch(t.context.split(".")[0]){case"shore":case"atons":(null==jt?void 0:jt.signalk.atons)&&function(t,e){var n=!1;if(-1!=t.indexOf("shore.basestations")&&(n=!0),!kt.atons.has(t)){var i=new B;i.id=t,i.position=null,n&&(i.type.id=-1,i.type.name="Basestation"),kt.atons.set(t,i)}var r=kt.atons.get(t);""==e.path?(void 0!==e.value.name&&(r.name=e.value.name),void 0!==e.value.mmsi&&(r.mmsi=e.value.mmsi),void 0!==e.value.atonType&&(r.type=e.value.atonType)):"atonType"==e.path?r.type=e.value:"navigation.position"==e.path?(r.position=[e.value.longitude,e.value.latitude],r.positionReceived=!0):r.properties[e.path]=e.value}(t.context,n),Xt(t.context,kt.atons,null==jt?void 0:jt.signalk.atons);break;case"sar":(null==jt?void 0:jt.signalk.sar)&&function(t,e){if(!kt.sar.has(t)){var n=new B;n.id=t,n.position=null,n.type.id=-1,n.type.name="SaR Beacon",kt.sar.set(t,n)}var i=kt.sar.get(t);""==e.path?(void 0!==e.value.name&&(i.name=e.value.name),void 0!==e.value.mmsi&&(i.mmsi=e.value.mmsi)):"communication.callsignVhf"==e.path?i.callsign=e.value:"navigation.position"==e.path&&e.value?(i.position=St.normaliseCoords([e.value.longitude,e.value.latitude]),i.positionReceived=!0):i.properties[e.path]=e.value}(t.context,n),Xt(t.context,kt.sar,null==jt?void 0:jt.signalk.sar);break;case"aircraft":(null==jt?void 0:jt.signalk.aircraft)&&function(t,e){if(!kt.aircraft.has(t)){var n=new H;n.id=t,n.position=null,kt.aircraft.set(t,n)}var i=kt.aircraft.get(t);""==e.path?(void 0!==e.value.name&&(i.name=e.value.name),void 0!==e.value.mmsi&&(i.mmsi=e.value.mmsi)):"communication.callsignVhf"==e.path?i.callsign=e.value:"navigation.position"==e.path&&e.value?(i.position=St.normaliseCoords([e.value.longitude,e.value.latitude]),i.positionReceived=!0,$t(i)):"navigation.courseOverGroundTrue"==e.path?i.orientation=e.value:"navigation.speedOverGround"==e.path?i.sog=e.value:i.properties[e.path]=e.value}(t.context,n),Xt(t.context,kt.aircraft,null==jt?void 0:jt.signalk.aircraft);break;case"vessels":wt.isSelf(t)?(zt(kt.self,n,!0),function(t,e){var n,i={path:t.path,value:t.value,context:null},r=t.path.split(".");if(("notifications.environment.depth.belowTransducer"==t.path||"notifications.environment.depth.belowSurface"==t.path||"notifications.environment.depth.belowKeel"==t.path)&&(n=r[2]),"notifications.navigation.anchor"==t.path&&(n=r[2]),-1!=["mob","sinking","fire","piracy","flooding","collision","grounding","listing","adrift","abandon"].indexOf(r[r.length-1])&&(n=r[r.length-1]),-1!=t.path.indexOf("notifications.navigation.closestApproach")&&(n=r[2],i.context=r[3]),-1!=t.path.indexOf("notifications.buddy")&&(n=r[1],i.context=r[2]),(-1!=t.path.indexOf("notifications.arrivalCircleEntered")||-1!=t.path.indexOf("notifications.navigation.course.arrivalCircleEntered"))&&(n=r[1],i.context=r[2]),n){var o=new Tt(n);o.playback=Bt,o.result=i,postMessage(o)}}(n)):((null==jt?void 0:jt.signalk.vessels)&&zt(function(t){if(!kt.aisTargets.has(t)){var e=new F;e.position=null,kt.aisTargets.set(t,e)}return kt.aisTargets.get(t)}(t.context),n),Xt(t.context,kt.aisTargets,null==jt?void 0:jt.signalk.vessels,null==jt?void 0:jt.aisState))}})}),Jt()):wt.isResponse(t)&&postMessage({action:"response",result:t})}(n)}}function Nt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.interval&&"number"==typeof t.interval&&(Wt=t.interval,Zt(),Yt(),Ct=1/(Wt/1e3)*60),Bt=!!t.playback,t.selections&&(void 0!==t.selections.preferredPaths&&(Ft=t.selections.preferredPaths),t.selections.aisMaxAge&&"number"==typeof t.selections.aisMaxAge&&(Ht.maxAge=t.selections.aisMaxAge),t.selections.aisStaleAge&&"number"==typeof t.selections.aisStaleAge&&(Ht.staleAge=t.selections.aisStaleAge),"number"==typeof t.selections.signalk.maxRadius&&(jt.signalk=t.selections.signalk),void 0!==t.selections.aisState&&Array.isArray(t.selections.aisState)&&(jt.aisState=t.selections.aisState),console.log("Worker: AIS Filter...",jt))}function Kt(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Zt(),Rt.forEach(function(t){return t.unsubscribe()}),wt&&t&&wt.close(),wt=null,postMessage({action:"close",result:t,playback:Bt})}function Vt(){(function(t){return new Promise(function(e,n){fetch("".concat(t)).then(function(t){t.json().then(function(t){return e(t)}).catch(function(t){return n(t)})}).catch(function(t){n(t)})})})(_t+"/tracks"+(jt&&jt.signalk&&jt.signalk.maxRadius?"?radius=".concat(jt.signalk.maxRadius):"?radius=10000")).then(function(t){At=!0,Object.entries(t).forEach(function(t){if(kt.aisTargets.has(t[0])){var e=kt.aisTargets.get(t[0]);e.track=t[1].coordinates,$t(e)}})}).catch(function(t){At=!1,console.warn("Unable to fetch AIS tracks!")})}function Xt(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(n){var r=e.get(t);r&&i.includes(null==r?void 0:r.state)&&(console.log("state match => ".concat(i,", ").concat(t)),xt.expired[t]=!0,r=null),r&&jt.signalk.maxRadius?r.positionReceived&&St.inBounds(r.position,Dt)?xt.updated[t]=!0:(e.delete(t),xt.expired[t]=!0):xt.updated[t]=!0}else 0!=e.size&&(e.forEach(function(t,e){xt.expired[e]=!0}),e.clear())}function Jt(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!Wt||t){var e=new Ot;e.playback=Bt,kt.aisStatus.updated=Object.keys(xt.updated),kt.aisStatus.stale=Object.keys(xt.stale),kt.aisStatus.expired=Object.keys(xt.expired),e.result=kt,e.timestamp=Bt?Et:kt.self.lastUpdated.toISOString(),postMessage(e),qt(),kt.self.resourceUpdates=[],0==Gt&&(function(){var t=(new Date).valueOf();kt.aisTargets.forEach(function(e,n){e.lastUpdated<t-Ht.maxAge?(xt.expired[n]=!0,kt.aisTargets.delete(n)):e.lastUpdated<t-Ht.staleAge&&(xt.stale[n]=!0)}),kt.aircraft.forEach(function(e,n){e.lastUpdated<t-Ht.maxAge?(xt.expired[n]=!0,kt.aircraft.delete(n)):e.lastUpdated<t-Ht.staleAge&&(xt.stale[n]=!0)}),kt.sar.forEach(function(e,n){e.lastUpdated<t-Ht.maxAge?(xt.expired[n]=!0,kt.sar.delete(n)):e.lastUpdated<t-Ht.staleAge&&(xt.stale[n]=!0)})}(),kt.self.positionReceived&&(null==jt?void 0:jt.signalk.maxRadius)&&(Dt=St.calcMapifiedExtent(kt.self.position,jt.signalk.maxRadius),Gt++)),Gt=Gt>=Ct?0:Gt+1}}function Yt(){Wt&&"number"==typeof Wt&&It.push(setInterval(function(){Ut&&(Jt(!0),Ut=!1)},Wt)),It.push(setInterval(function(){console.warn("hasTrackPlugin",At),At&&Vt()},6e4))}function Zt(){It.forEach(function(t){return clearInterval(t)}),It=[]}function zt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.lastUpdated=new Date,n&&-1!=Pt.indexOf(e.path)&&(kt.paths[e.path]=e.value),""==e.path)void 0!==e.value.name&&(t.name=e.value.name),void 0!==e.value.mmsi&&(t.mmsi=e.value.mmsi),void 0!==e.value.buddy&&(t.buddy=e.value.buddy);else if("communication.callsignVhf"==e.path)t.callsign=e.value;else if("navigation.position"==e.path&&e.value){if(void 0===e.value.longitude)return;t.position=St.normaliseCoords([e.value.longitude,e.value.latitude]),t.positionReceived=!0,n||$t(t)}else"navigation.state"==e.path?t.state=e.value:"navigation.speedOverGround"==e.path?t.sog=e.value:"navigation.courseOverGroundTrue"==e.path?t.cogTrue=e.value:"navigation.courseOverGroundMagnetic"==e.path?t.cogMagnetic=e.value:"navigation.headingTrue"==e.path?t.headingTrue=e.value:"navigation.headingMagnetic"==e.path?t.headingMagnetic=e.value:"environment.wind.angleApparent"==e.path?t.wind.awa=e.value:"environment.wind.speedApparent"==e.path?t.wind.aws=e.value:"environment.wind.speedTrue"==e.path?t.wind.speedTrue=e.value:"environment.wind.speedOverGround"==e.path?t.wind.sog=e.value:"environment.wind.directionTrue"==e.path?t.wind.twd=e.value:"environment.wind.directionMagnetic"==e.path?t.wind.mwd=e.value:"environment.mode"==e.path?t.mode=e.value:-1!=e.path.indexOf("navigation.courseRhumbline")&&void 0!==Ft.course&&e.path.split(".").slice(0,2).join(".")==Ft.course||-1!=e.path.indexOf("navigation.courseGreatCircle")&&void 0!==Ft.course&&e.path.split(".").slice(0,2).join(".")==Ft.course?t["course."+e.path.split(".").slice(2).join(".")]=e.value:-1!=e.path.indexOf("navigation.closestApproach")?t.closestApproach=e.value:"navigation.anchor.position"==e.path?t.anchor.position=e.value:"navigation.anchor.maxRadius"==e.path?t.anchor.maxRadius=e.value:"navigation.anchor.currentRadius"==e.path?t.anchor.radius=e.value:-1!=e.path.indexOf("resources.")?t.resourceUpdates.push(e):"steering.autopilot.state"==e.path?t.autopilot.state=e.value:"steering.autopilot.mode"==e.path?t.autopilot.mode=e.value:t.properties[e.path]=e.value;t.heading=null==t.heading&&null!=t.cog?t.cog:t.heading,void 0!==Ft.heading&&e.path==Ft.heading&&(t.orientation=e.value),void 0!==Ft.tws&&e.path==Ft.tws&&(t.wind.tws=e.value),void 0!==Ft.twd&&e.path==Ft.twd&&(t.wind.direction="environment.wind.angleTrueGround"==e.path||"environment.wind.angleTrueWater"==e.path?q.angleToDirection(e.value,t.heading):e.value)}function $t(t){if(t.track&&0==t.track.length)t.track.push([t.position]);else{var e=t.track[t.track.length-1][t.track[t.track.length-1].length-1];e[0]!=t.position[0]&&e[1]!=t.position[1]&&t.track[t.track.length-1].push(t.position)}t.track[t.track.length-1]=t.track[t.track.length-1].slice(0-Ht.maxTrack)}addEventListener("message",function(t){!function(t){if(t.cmd)switch(t.cmd){case"open":console.log("Worker control: opening stream..."),Nt(t.options),function(t){if(!wt)if(t.url){var e=t.url.split("/");if(e.pop(),e.push("api"),e[0]="wss:"==e[0]?"https:":"http:",_t=e.join("/"),(kt={self:new F,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map}).self.positionReceived=!1,qt(),wt=new G,Rt.push(wt.onConnect.subscribe(function(t){return Lt({action:"onConnect",msg:t})})),Rt.push(wt.onClose.subscribe(function(t){return Lt({action:"onClose",msg:t})})),Rt.push(wt.onError.subscribe(function(t){return Lt({action:"onError",msg:t})})),Rt.push(wt.onMessage.subscribe(function(t){return Lt({action:"onMessage",msg:t})})),t.playback){var n=t.playbackOptions.startTime?"?startTime=".concat(t.playbackOptions.startTime):null,i=t.playbackOptions.playbackRate?"playbackRate=".concat(t.playbackOptions.playbackRate):null;i=i?n?"&"+i:"?"+i:null,wt.open("".concat(t.url).concat(n||"").concat(i||""),t.playbackOptions.subscribe,t.token)}else wt.open(t.url,t.subscribe,t.token),Vt()}else postMessage({action:"error",result:"Valid options not provided!"})}(t.options);break;case"close":console.log("Worker control: closing stream..."),Kt(!0);break;case"subscribe":console.log("Worker control: subscribing to paths..."),wt.subscribe(t.options.context,t.options.path);break;case"settings":console.log("Worker control: settings..."),Nt(t.options);break;case"alarm":console.log("Worker control: alarm action..."),function(t){var e=-1==t.type.indexOf("notifications.")?"notifications.".concat(t.type):t.type;t.raise?wt.raiseAlarm("self",e,new j(t.message,t.state,!0,!0)):wt.clearAlarm("self",e)}(t.options);break;case"vessel":var e;if(console.log("Worker control: vessel setting..."),t.options)(e="self"==t.options.context?kt.self:kt.aisTargets.get(t.options.context))&&t.options.name&&(e.name=t.options.name);break;case"auth":console.log("Worker control: auth token..."),t.options&&(wt.authToken=t.options.token)}}(t.data)})}()}();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,23 +1,39 @@
|
|
|
1
|
-
/* fallback */
|
|
2
1
|
@font-face {
|
|
3
2
|
font-family: 'Material Icons';
|
|
4
3
|
font-style: normal;
|
|
5
4
|
font-weight: 400;
|
|
6
|
-
src: url(
|
|
5
|
+
src: url(https://example.com/MaterialIcons-Regular.eot); /* For IE6-8 */
|
|
6
|
+
src: local('Material Icons'),
|
|
7
|
+
local('MaterialIcons-Regular'),
|
|
8
|
+
url(./MaterialIconsRound-Regular.otf) format('otf'),
|
|
9
|
+
url(./MaterialIconsOutlined-Regular.otf) format('otf'),
|
|
10
|
+
url(./MaterialIconsSharp-Regular.otf) format('otf'),
|
|
11
|
+
url(./MaterialIconsTwoTone-Regular.otf) format('otf'),
|
|
12
|
+
url(./MaterialIcons-Regular.ttf) format('truetype');
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
.material-icons {
|
|
10
16
|
font-family: 'Material Icons';
|
|
11
17
|
font-weight: normal;
|
|
12
18
|
font-style: normal;
|
|
13
|
-
font-size: 24px;
|
|
19
|
+
font-size: 24px; /* Preferred icon size */
|
|
20
|
+
display: inline-block;
|
|
14
21
|
line-height: 1;
|
|
15
|
-
letter-spacing: normal;
|
|
16
22
|
text-transform: none;
|
|
17
|
-
|
|
18
|
-
white-space: nowrap;
|
|
23
|
+
letter-spacing: normal;
|
|
19
24
|
word-wrap: normal;
|
|
25
|
+
white-space: nowrap;
|
|
20
26
|
direction: ltr;
|
|
21
|
-
|
|
27
|
+
|
|
28
|
+
/* Support for all WebKit browsers. */
|
|
22
29
|
-webkit-font-smoothing: antialiased;
|
|
30
|
+
/* Support for Safari and Chrome. */
|
|
31
|
+
text-rendering: optimizeLegibility;
|
|
32
|
+
|
|
33
|
+
/* Support for Firefox. */
|
|
34
|
+
-moz-osx-font-smoothing: grayscale;
|
|
35
|
+
|
|
36
|
+
/* Support for IE. */
|
|
37
|
+
font-feature-settings: 'liga';
|
|
23
38
|
}
|
|
39
|
+
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
<li><a href="#alarms">- Alarms</a></li>
|
|
54
54
|
<li><a href="#playback">- Playback</a></li>
|
|
55
55
|
<li><a href="#settings">Settings</a></li>
|
|
56
|
+
<li><a href="#parameters">- URL parameters</a></li>
|
|
56
57
|
<li><a href="#experiments">- Experiments</a></li>
|
|
57
58
|
<li><a href="https://github.com/SignalK/freeboard-sk/" target="_fb">
|
|
58
59
|
<i class="fi-social-github"></i> GitHub</a>
|
|
@@ -1491,6 +1492,47 @@
|
|
|
1491
1492
|
</p>
|
|
1492
1493
|
</div>
|
|
1493
1494
|
|
|
1495
|
+
<div class="panel" id="parameters">
|
|
1496
|
+
<h4><i class="material-icons">tune</i> URL Parameters</h4>
|
|
1497
|
+
<p>
|
|
1498
|
+
The following url parameters can be used to initalise values for:
|
|
1499
|
+
<ul>
|
|
1500
|
+
<li>Zoom Level</li>
|
|
1501
|
+
<li>North / Heading Up</li>
|
|
1502
|
+
<li>Move Map</li>
|
|
1503
|
+
</ul>
|
|
1504
|
+
</p>
|
|
1505
|
+
<p>
|
|
1506
|
+
When one or more of these parameters are present, the supplied values will used to
|
|
1507
|
+
override stored configuration at start up.
|
|
1508
|
+
</p>
|
|
1509
|
+
<p>
|
|
1510
|
+
Example: Start Freebaord-SK at zoom level to 15. <br>
|
|
1511
|
+
<i>http://server:3000/@signalk/freeboard-sk?zoom=15</i>
|
|
1512
|
+
</p>
|
|
1513
|
+
<p>
|
|
1514
|
+
Example: Start Freebaord-SK in North up mode. <br>
|
|
1515
|
+
<i>http://server:3000/@signalk/freeboard-sk?northup=1</i><br>
|
|
1516
|
+
or<br>
|
|
1517
|
+
<i>http://server:3000/@signalk/freeboard-sk?northup</i>
|
|
1518
|
+
</p>
|
|
1519
|
+
<p>
|
|
1520
|
+
Example: Start Freebaord-SK in heading up mode. <br>
|
|
1521
|
+
<i>http://server:3000/@signalk/freeboard-sk?northup=0</i>
|
|
1522
|
+
</p>
|
|
1523
|
+
<p>
|
|
1524
|
+
Example: Start Freebaord-SK in moving map mode (keep vessel centered). <br>
|
|
1525
|
+
<i>http://server:3000/@signalk/freeboard-sk?movemap=1</i><br>
|
|
1526
|
+
or<br>
|
|
1527
|
+
<i>http://server:3000/@signalk/freeboard-sk?movemap</i>
|
|
1528
|
+
</p>
|
|
1529
|
+
<p>
|
|
1530
|
+
Example: Start Freebaord-SK with moving map mode turned off. <br>
|
|
1531
|
+
<i>http://server:3000/@signalk/freeboard-sk?movemap=0</i>
|
|
1532
|
+
</p>
|
|
1533
|
+
|
|
1534
|
+
</div>
|
|
1535
|
+
|
|
1494
1536
|
<div class="panel" id="experiments">
|
|
1495
1537
|
<h4><i class="material-icons">science</i> Experiments</h4>
|
|
1496
1538
|
<p>
|
|
@@ -1503,7 +1545,7 @@
|
|
|
1503
1545
|
When enabled these features can be acccessed via the <i class="material-icons">science</i> button.
|
|
1504
1546
|
</p>
|
|
1505
1547
|
<p><i>Note:</i> For experiments that require Signal K server support you will be required
|
|
1506
|
-
to have the <i>sk-
|
|
1548
|
+
to have the <i>freeboard-sk-helper</i> plugin installed on the Signal K server.
|
|
1507
1549
|
</p>
|
|
1508
1550
|
</div>
|
|
1509
1551
|
|
package/public/index.html
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<meta name="msapplication-TileColor" content="#ffffff">
|
|
63
63
|
<meta name="msapplication-TileImage" content="./assets/icons/ms-icon-192x192.png">
|
|
64
64
|
<!-- ******************** /Device Icons ******************** -->
|
|
65
|
-
<style>@-webkit-keyframes cdk-text-field-autofill-start{}@-webkit-keyframes cdk-text-field-autofill-end{}*{-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent}body{background-color:#fff;margin:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}b{font-weight:500}.loading{font-size:12pt;font-family:Arial,Helvetica,sans-serif;position:absolute;top:25%;left:0;right:0;margin-right:auto;color:#000;text-align:center}.loading img{border:5px solid hsla(0,0%,78%,0);border-radius:100px;-webkit-animation:colorchange 1s;animation:colorchange 1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}@keyframes colorchange{0%{border:3px solid rgba(8,85,178,.1)}25%{border:3px solid #7ab7ff}50%{border:3px solid #0855b2}75%{border:3px solid #7ab7ff}to{border:3px solid rgba(8,85,178,.1)}}</style><link rel="stylesheet" href="styles.
|
|
65
|
+
<style>@-webkit-keyframes cdk-text-field-autofill-start{}@-webkit-keyframes cdk-text-field-autofill-end{}*{-webkit-tap-highlight-color:transparent;tap-highlight-color:transparent}body{background-color:#fff;margin:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}b{font-weight:500}.loading{font-size:12pt;font-family:Arial,Helvetica,sans-serif;position:absolute;top:25%;left:0;right:0;margin-right:auto;color:#000;text-align:center}.loading img{border:5px solid hsla(0,0%,78%,0);border-radius:100px;-webkit-animation:colorchange 1s;animation:colorchange 1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}@keyframes colorchange{0%{border:3px solid rgba(8,85,178,.1)}25%{border:3px solid #7ab7ff}50%{border:3px solid #0855b2}75%{border:3px solid #7ab7ff}to{border:3px solid rgba(8,85,178,.1)}}</style><link rel="stylesheet" href="styles.151f5917658613ff18bb.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.151f5917658613ff18bb.css"></noscript></head>
|
|
66
66
|
<body>
|
|
67
67
|
<app-root>
|
|
68
68
|
<div class="loading">
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
</div>
|
|
73
73
|
</div>
|
|
74
74
|
</app-root>
|
|
75
|
-
<script src="runtime-es2015.
|
|
75
|
+
<script src="runtime-es2015.590ce0576882394cd0a4.js" type="module"></script><script src="runtime-es5.590ce0576882394cd0a4.js" nomodule defer></script><script src="polyfills-es5.db83d87fca4fca7bb07a.js" nomodule defer></script><script src="polyfills-es2015.c13136a48056748116fd.js" type="module"></script><script src="main-es2015.50de96f6ac8ce07c1eb7.js" type="module"></script><script src="main-es5.50de96f6ac8ce07c1eb7.js" nomodule defer></script>
|
|
76
76
|
|
|
77
77
|
</body></html>
|