@signalk/freeboard-sk 2.19.1 → 2.19.2
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/package.json +25 -29
- package/plugin/alarms/alarms.js +2 -1
- package/plugin/index.js +2 -1
- package/plugin/lib/fetch.js +6 -5
- package/public/381.a1a010c6a447d5a9.js +1 -0
- package/public/3rdpartylicenses.txt +89 -63
- package/public/assets/help/index.html +1 -1
- package/public/index.html +3 -3
- package/public/main.7a0bece8599aa203.js +1 -0
- package/public/polyfills.6bdae4f01ab4e532.js +1 -0
- package/public/runtime.88a8f6e5bca88ee7.js +1 -0
- package/public/styles.2dfca2dcfc8d165a.css +1 -0
- package/public/755.4207d8d82b9aa7ac.js +0 -1
- package/public/main.baeb5cbd226626c9.js +0 -1
- package/public/polyfills.0823dc027f0a1d2e.js +0 -1
- package/public/runtime.e598c35c8d15b7e2.js +0 -1
- package/public/styles.73e91a24a0abdc6a.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var Pr={179:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636);e.default=function(d){var o=r.areaConversion[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m"];if(o)return d*o;throw new Error("Invalid unit used for area conversion.")}},190:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=h(n(7029)),i=h(n(3100)),s=h(n(5705)),l=h(n(942)),d=n(7636);function h(a){return a&&a.__esModule?a:{default:a}}e.default=function(c,f){var M,C,p=(0,r.default)(c),g=(0,i.default)(c),m=(0,s.default)(p),v=(0,s.default)(g),E=f/d.earthRadius,S=m-E,N=m+E,F=(0,s.default)(d.MAXLAT),$=(0,s.default)(d.MINLAT),L=(0,s.default)(d.MAXLON),x=(0,s.default)(d.MINLON);if(S>$&&N<F){var ae=Math.asin(Math.sin(E)/Math.cos(m));(M=v-ae)<x&&(M+=2*Math.PI),(C=v+ae)>L&&(C-=2*Math.PI)}else S=Math.max(S,$),N=Math.min(N,F),M=x,C=L;return[{latitude:(0,l.default)(S),longitude:(0,l.default)(M)},{latitude:(0,l.default)(N),longitude:(0,l.default)(C)}]}},202:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(8674));e.default=function(h,o,u){return(0,r.default)(h,o,.01)<u}},266:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(3026)),i=d(n(4902)),s=d(n(1532)),l=n(7636);function d(u){return u&&u.__esModule?u:{default:u}}e.default=function u(a){return(0,r.default)(a)?!(parseFloat(a)>l.MAXLON||a<l.MINLON):!!(0,i.default)(a)&&u((0,s.default)(a))}},354:(t,e)=>{function s(u,a){(null==a||a>u.length)&&(a=u.length);for(var c=0,f=new Array(a);c<a;c++)f[c]=u[c];return f}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(a){if(!a.startsWith("POLYGON"))throw new Error("Invalid wkt.");return a.slice(a.indexOf("(")+2,a.indexOf(")")).split(", ").map(function(p){var m=function n(u,a){return function d(u){if(Array.isArray(u))return u}(u)||function l(u,a){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(u)){var c=[],f=!0,p=!1,g=void 0;try{for(var v,m=u[Symbol.iterator]();!(f=(v=m.next()).done)&&(c.push(v.value),!a||c.length!==a);f=!0);}catch(E){p=!0,g=E}finally{try{!f&&null!=m.return&&m.return()}finally{if(p)throw g}}return c}}(u,a)||function i(u,a){if(u){if("string"==typeof u)return s(u,a);var c=Object.prototype.toString.call(u).slice(8,-1);if("Object"===c&&u.constructor&&(c=u.constructor.name),"Map"===c||"Set"===c)return Array.from(u);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return s(u,a)}}(u,a)||function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(p.split(" "),2),E=m[1];return{longitude:parseFloat(m[0]),latitude:parseFloat(E)}})}},884:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(7029)),i=d(n(3100)),s=d(n(5705)),l=d(n(942));function d(u){return u&&u.__esModule?u:{default:u}}e.default=function(a,c){var f=(0,r.default)(c),p=(0,i.default)(c),g=(0,r.default)(a),m=(0,i.default)(a);return((0,l.default)(Math.atan2(Math.sin((0,s.default)(p)-(0,s.default)(m))*Math.cos((0,s.default)(f)),Math.cos((0,s.default)(g))*Math.sin((0,s.default)(f))-Math.sin((0,s.default)(g))*Math.cos((0,s.default)(f))*Math.cos((0,s.default)(p)-(0,s.default)(m))))+360)%360}},917:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636);e.default=function(d){var o=r.distanceConversion[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"m"];if(o)return d*o;throw new Error("Invalid unit used for distance conversion.")}},939:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(7029)),i=d(n(3100)),s=d(n(5705)),l=d(n(942));function d(u){return u&&u.__esModule?u:{default:u}}e.default=function(a,c){var f=(0,s.default)((0,i.default)(c))-(0,s.default)((0,i.default)(a)),p=Math.log(Math.tan((0,s.default)((0,r.default)(c))/2+Math.PI/4)/Math.tan((0,s.default)((0,r.default)(a))/2+Math.PI/4));return Math.abs(f)>Math.PI&&(f=f>0?-1*(2*Math.PI-f):2*Math.PI+f),((0,l.default)(Math.atan2(f,p))+360)%360}},942:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(s){return 180*s/Math.PI}},1118:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(2447));e.default=function(h,o){return(0,r.default)(h,o)[0]}},1167:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636);e.default=function(d){switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kmh"){case"kmh":return d*r.timeConversion.h*r.distanceConversion.km;case"mph":return d*r.timeConversion.h*r.distanceConversion.mi;default:return d}}},1532:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636);e.default=function(d){var h=new RegExp(r.sexagesimalPattern).exec(d.toString().trim());if(typeof h>"u"||null===h)throw new Error("Given value is not in sexagesimal format");var o=Number(h[2])/60||0,u=Number(h[4])/3600||0,a=parseFloat(h[1])+o+u;return["S","W"].includes(h[7])?-a:a}},1691:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(5705)),i=d(n(7029)),s=d(n(3100)),l=n(7636);function d(u){return u&&u.__esModule?u:{default:u}}e.default=function(a){var c=0;if(a.length>2){for(var f,p,g,m=0;m<a.length;m++){m===a.length-2?(f=a.length-2,p=a.length-1,g=0):m===a.length-1?(f=a.length-1,p=0,g=1):(f=m,p=m+1,g=m+2);var v=(0,s.default)(a[f]),E=(0,i.default)(a[p]),S=(0,s.default)(a[g]);c+=((0,r.default)(S)-(0,r.default)(v))*Math.sin((0,r.default)(E))}c=c*l.earthRadius*l.earthRadius/2}return Math.abs(c)}},2222:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=h(n(7029)),i=h(n(3100)),s=h(n(5705)),l=h(n(942)),d=n(7636);function h(a){return a&&a.__esModule?a:{default:a}}e.default=function(c,f,p){var g=arguments.length>3&&void 0!==arguments[3]?arguments[3]:6371e3,m=(0,r.default)(c),v=(0,i.default)(c),E=f/g,S=(0,s.default)(p),N=(0,s.default)(m),F=(0,s.default)(v),$=Math.asin(Math.sin(N)*Math.cos(E)+Math.cos(N)*Math.sin(E)*Math.cos(S)),L=F+Math.atan2(Math.sin(S)*Math.sin(E)*Math.cos(N),Math.cos(E)-Math.sin(N)*Math.sin($)),x=(0,l.default)(L);return(x<d.MINLON||x>d.MAXLON)&&(L=(L+3*Math.PI)%(2*Math.PI)-Math.PI,x=(0,l.default)(L)),{latitude:(0,l.default)($),longitude:x}}},2447:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(8674));e.default=function(h,o){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.default;return u="function"==typeof u?u:r.default,o.slice().sort(function(a,c){return u(h,a)-u(h,c)})}},2541:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var r={computeDestinationPoint:!0,convertArea:!0,convertDistance:!0,convertSpeed:!0,decimalToSexagesimal:!0,findNearest:!0,getAreaOfPolygon:!0,getBounds:!0,getBoundsOfDistance:!0,getCenter:!0,getCenterOfBounds:!0,getCompassDirection:!0,getCoordinateKey:!0,getCoordinateKeys:!0,getDistance:!0,getDistanceFromLine:!0,getGreatCircleBearing:!0,getLatitude:!0,getLongitude:!0,getPathLength:!0,getPreciseDistance:!0,getRhumbLineBearing:!0,getRoughCompassDirection:!0,getSpeed:!0,isDecimal:!0,isPointInLine:!0,isPointInPolygon:!0,isPointNearLine:!0,isPointWithinRadius:!0,isSexagesimal:!0,isValidCoordinate:!0,isValidLatitude:!0,isValidLongitude:!0,orderByDistance:!0,sexagesimalToDecimal:!0,toDecimal:!0,toRad:!0,toDeg:!0,wktToPolygon:!0};Object.defineProperty(e,"computeDestinationPoint",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(e,"convertArea",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(e,"convertDistance",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(e,"convertSpeed",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(e,"decimalToSexagesimal",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(e,"findNearest",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(e,"getAreaOfPolygon",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(e,"getBounds",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(e,"getBoundsOfDistance",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(e,"getCenter",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(e,"getCenterOfBounds",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(e,"getCompassDirection",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(e,"getCoordinateKey",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(e,"getCoordinateKeys",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(e,"getDistance",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(e,"getDistanceFromLine",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(e,"getGreatCircleBearing",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(e,"getLatitude",{enumerable:!0,get:function(){return F.default}}),Object.defineProperty(e,"getLongitude",{enumerable:!0,get:function(){return $.default}}),Object.defineProperty(e,"getPathLength",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(e,"getPreciseDistance",{enumerable:!0,get:function(){return x.default}}),Object.defineProperty(e,"getRhumbLineBearing",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(e,"getRoughCompassDirection",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(e,"getSpeed",{enumerable:!0,get:function(){return ae.default}}),Object.defineProperty(e,"isDecimal",{enumerable:!0,get:function(){return tt.default}}),Object.defineProperty(e,"isPointInLine",{enumerable:!0,get:function(){return ge.default}}),Object.defineProperty(e,"isPointInPolygon",{enumerable:!0,get:function(){return me.default}}),Object.defineProperty(e,"isPointNearLine",{enumerable:!0,get:function(){return ve.default}}),Object.defineProperty(e,"isPointWithinRadius",{enumerable:!0,get:function(){return te.default}}),Object.defineProperty(e,"isSexagesimal",{enumerable:!0,get:function(){return ue.default}}),Object.defineProperty(e,"isValidCoordinate",{enumerable:!0,get:function(){return nt.default}}),Object.defineProperty(e,"isValidLatitude",{enumerable:!0,get:function(){return rt.default}}),Object.defineProperty(e,"isValidLongitude",{enumerable:!0,get:function(){return Re.default}}),Object.defineProperty(e,"orderByDistance",{enumerable:!0,get:function(){return Le.default}}),Object.defineProperty(e,"sexagesimalToDecimal",{enumerable:!0,get:function(){return xe.default}}),Object.defineProperty(e,"toDecimal",{enumerable:!0,get:function(){return z.default}}),Object.defineProperty(e,"toRad",{enumerable:!0,get:function(){return Yt.default}}),Object.defineProperty(e,"toDeg",{enumerable:!0,get:function(){return ke.default}}),Object.defineProperty(e,"wktToPolygon",{enumerable:!0,get:function(){return Zt.default}});var i=I(n(2222)),s=I(n(179)),l=I(n(917)),d=I(n(1167)),h=I(n(8948)),o=I(n(1118)),u=I(n(1691)),a=I(n(9144)),c=I(n(190)),f=I(n(5524)),p=I(n(7088)),g=I(n(9952)),m=I(n(8744)),v=I(n(4695)),E=I(n(8674)),S=I(n(7504)),N=I(n(884)),F=I(n(7029)),$=I(n(3100)),L=I(n(5378)),x=I(n(2671)),M=I(n(939)),C=I(n(2845)),ae=I(n(8950)),tt=I(n(3026)),ge=I(n(4194)),me=I(n(3536)),ve=I(n(2787)),te=I(n(202)),ue=I(n(4902)),nt=I(n(7637)),rt=I(n(6563)),Re=I(n(266)),Le=I(n(2447)),xe=I(n(1532)),z=I(n(5101)),Yt=I(n(5705)),ke=I(n(942)),Zt=I(n(354)),it=n(7636);function I(y){return y&&y.__esModule?y:{default:y}}Object.keys(it).forEach(function(y){"default"===y||"__esModule"===y||Object.prototype.hasOwnProperty.call(r,y)||Object.defineProperty(e,y,{enumerable:!0,get:function(){return it[y]}})})},2671:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(7029)),i=d(n(3100)),s=d(n(5705)),l=n(7636);function d(u){return u&&u.__esModule?u:{default:u}}e.default=function(a,c){var f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;f=typeof f<"u"&&!isNaN(f)?f:1;var F,$,L,x,M,C,nt,p=(0,r.default)(a),g=(0,i.default)(a),m=(0,r.default)(c),v=(0,i.default)(c),E=6356752.314245,S=1/298.257223563,N=(0,s.default)(v-g),ae=Math.atan((1-S)*Math.tan((0,s.default)(parseFloat(p)))),tt=Math.atan((1-S)*Math.tan((0,s.default)(parseFloat(m)))),ge=Math.sin(ae),me=Math.cos(ae),ve=Math.sin(tt),te=Math.cos(tt),ue=N,rt=100;do{var Re=Math.sin(ue),Le=Math.cos(ue);if(0===(C=Math.sqrt(te*Re*(te*Re)+(me*ve-ge*te*Le)*(me*ve-ge*te*Le))))return 0;F=ge*ve+me*te*Le,$=Math.atan2(C,F),M=F-2*ge*ve/(x=1-(L=me*te*Re/C)*L),isNaN(M)&&(M=0);var xe=S/16*x*(4+S*(4-3*x));nt=ue,ue=N+(1-xe)*S*L*($+xe*C*(M+xe*F*(2*M*M-1)))}while(Math.abs(ue-nt)>1e-12&&--rt>0);if(0===rt)return NaN;var z=x*(l.earthRadius*l.earthRadius-E*E)/(E*E),ke=z/1024*(256+z*(z*(74-47*z)-128));return Math.round(E*(1+z/16384*(4096+z*(z*(320-175*z)-768)))*($-ke*C*(M+ke/4*(F*(2*M*M-1)-ke/6*M*(4*C*C-3)*(4*M*M-3))))/f)*f}},2787:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(7504));e.default=function(h,o,u,a){return(0,r.default)(h,o,u)<a}},2845:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(s){return/^(NNE|NE|NNW|N)$/.test(s)?"N":/^(ENE|E|ESE|SE)$/.test(s)?"E":/^(SSE|S|SSW|SW)$/.test(s)?"S":/^(WSW|W|WNW|NW)$/.test(s)?"W":void 0}},3026:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(s){var l=s.toString().trim();return!isNaN(parseFloat(l))&&parseFloat(l)===Number(l)}},3100:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636),i=l(n(8744)),s=l(n(5101));function l(o){return o&&o.__esModule?o:{default:o}}e.default=function(u,a){var c=(0,i.default)(u,r.longitudeKeys);if(!(typeof c>"u"||null===c)){var f=u[c];return!0===a?f:(0,s.default)(f)}}},3536:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=s(n(7029)),i=s(n(3100));function s(h){return h&&h.__esModule?h:{default:h}}e.default=function(o,u){for(var a=!1,c=u.length,f=-1,p=c-1;++f<c;p=f)((0,i.default)(u[f])<=(0,i.default)(o)&&(0,i.default)(o)<(0,i.default)(u[p])||(0,i.default)(u[p])<=(0,i.default)(o)&&(0,i.default)(o)<(0,i.default)(u[f]))&&(0,r.default)(o)<((0,r.default)(u[p])-(0,r.default)(u[f]))*((0,i.default)(o)-(0,i.default)(u[f]))/((0,i.default)(u[p])-(0,i.default)(u[f]))+(0,r.default)(u[f])&&(a=!a);return a}},4194:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(8674));e.default=function(h,o,u){return(0,r.default)(o,h)+(0,r.default)(h,u)===(0,r.default)(o,u)}},4695:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636),i=function s(a){return a&&a.__esModule?a:{default:a}}(n(8744));function l(a,c){var f=Object.keys(a);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(a);c&&(p=p.filter(function(g){return Object.getOwnPropertyDescriptor(a,g).enumerable})),f.push.apply(f,p)}return f}function h(a,c,f){return c in a?Object.defineProperty(a,c,{value:f,enumerable:!0,configurable:!0,writable:!0}):a[c]=f,a}e.default=function(c){var f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{longitude:r.longitudeKeys,latitude:r.latitudeKeys,altitude:r.altitudeKeys},p=(0,i.default)(c,f.longitude),g=(0,i.default)(c,f.latitude),m=(0,i.default)(c,f.altitude);return function d(a){for(var c=1;c<arguments.length;c++){var f=null!=arguments[c]?arguments[c]:{};c%2?l(Object(f),!0).forEach(function(p){h(a,p,f[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(f)):l(Object(f)).forEach(function(p){Object.defineProperty(a,p,Object.getOwnPropertyDescriptor(f,p))})}return a}({latitude:g,longitude:p},m?{altitude:m}:{})}},4902:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636);e.default=function(d){return r.sexagesimalPattern.test(d.toString().trim())}},5101:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=h(n(3026)),i=h(n(4902)),s=h(n(1532)),l=h(n(7637)),d=h(n(4695));function h(p){return p&&p.__esModule?p:{default:p}}function o(p,g){var m=Object.keys(p);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(p);g&&(v=v.filter(function(E){return Object.getOwnPropertyDescriptor(p,E).enumerable})),m.push.apply(m,v)}return m}function u(p){for(var g=1;g<arguments.length;g++){var m=null!=arguments[g]?arguments[g]:{};g%2?o(Object(m),!0).forEach(function(v){a(p,v,m[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(m)):o(Object(m)).forEach(function(v){Object.defineProperty(p,v,Object.getOwnPropertyDescriptor(m,v))})}return p}function a(p,g,m){return g in p?Object.defineProperty(p,g,{value:m,enumerable:!0,configurable:!0,writable:!0}):p[g]=m,p}e.default=function p(g){if((0,r.default)(g))return Number(g);if((0,i.default)(g))return(0,s.default)(g);if((0,l.default)(g)){var m=(0,d.default)(g);return Array.isArray(g)?g.map(function(v,E){return[0,1].includes(E)?p(v):v}):u(u(u({},g),m.latitude&&a({},m.latitude,p(g[m.latitude]))),m.longitude&&a({},m.longitude,p(g[m.longitude])))}return Array.isArray(g)?g.map(function(v){return(0,l.default)(v)?p(v):v}):g}},5378:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(h){return h&&h.__esModule?h:{default:h}}(n(8674));function s(h){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(u){return typeof u}:function(u){return u&&"function"==typeof Symbol&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u})(h)}e.default=function(o){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.default;return o.reduce(function(a,c){return"object"===s(a)&&null!==a.last&&(a.distance+=u(c,a.last)),a.last=c,a},{last:null,distance:0}).distance}},5524:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(7029)),i=d(n(3100)),s=d(n(5705)),l=d(n(942));function d(u){return u&&u.__esModule?u:{default:u}}e.default=function(a){if(!1===Array.isArray(a)||0===a.length)return!1;var c=a.length,f=a.reduce(function(v,E){var S=(0,s.default)((0,r.default)(E)),N=(0,s.default)((0,i.default)(E));return{X:v.X+Math.cos(S)*Math.cos(N),Y:v.Y+Math.cos(S)*Math.sin(N),Z:v.Z+Math.sin(S)}},{X:0,Y:0,Z:0}),p=f.X/c,g=f.Y/c,m=f.Z/c;return{longitude:(0,l.default)(Math.atan2(g,p)),latitude:(0,l.default)(Math.atan2(m,Math.sqrt(p*p+g*g)))}}},5551:(t,e)=>{function n(o,u){return o*o+u*u}function r(o,u){return n(o.longitude-u.longitude,o.latitude-u.latitude)}function i(o,u,a){var c=u.longitude,f=u.latitude,p=a.longitude-c,g=a.latitude-f;if(0!==p||0!==g){var m=((o.longitude-c)*p+(o.latitude-f)*g)/n(p,g);m>1?(c=a.longitude,f=a.latitude):m>0&&(c+=p*m,f+=g*m)}return n(o.longitude-c,o.latitude-f)}function l(o,u,a,c,f){for(var g,p=c,m=u+1;m<a;m++){var v=i(o[m],o[u],o[a]);v>p&&(g=m,p=v)}p>c&&(g-u>1&&l(o,u,g,c,f),f.push(o[g]),a-g>1&&l(o,g,a,c,f))}function d(o,u){var a=o.length-1,c=[o[0]];return l(o,0,a,u,c),c.push(o[a]),c}e.__esModule=!0,e.SimplifyLL=function h(o,u,a){if(void 0===u&&(u=1),void 0===a&&(a=!1),o.length<=2)return o;var c=u*u;return d(o=a?o:function s(o,u){for(var c,a=o[0],f=[a],p=1,g=o.length;p<g;p++)r(c=o[p],a)>u&&(f.push(c),a=c);return a!==c&&f.push(c),f}(o,c),c)}},5705:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(s){return s*Math.PI/180}},6380:(t,e,n)=>{var i=n(6729);e.p$=i.SimplifyAP,n(5551),n(6413)},6413:(t,e)=>{function n(o,u){return o*o+u*u}function r(o,u){return n(o.x-u.x,o.y-u.y)}function i(o,u,a){var c=u.x,f=u.y,p=a.x-c,g=a.y-f;if(0!==p||0!==g){var m=((o.x-c)*p+(o.y-f)*g)/n(p,g);m>1?(c=a.x,f=a.y):m>0&&(c+=p*m,f+=g*m)}return n(o.x-c,o.y-f)}function l(o,u,a,c,f){for(var g,p=c,m=u+1;m<a;m++){var v=i(o[m],o[u],o[a]);v>p&&(g=m,p=v)}p>c&&(g-u>1&&l(o,u,g,c,f),f.push(o[g]),a-g>1&&l(o,g,a,c,f))}function d(o,u){var a=o.length-1,c=[o[0]];return l(o,0,a,u,c),c.push(o[a]),c}e.__esModule=!0,e.Simplify=function h(o,u,a){if(void 0===u&&(u=1),void 0===a&&(a=!1),o.length<=2)return o;var c=u*u;return d(o=a?o:function s(o,u){for(var c,a=o[0],f=[a],p=1,g=o.length;p<g;p++)r(c=o[p],a)>u&&(f.push(c),a=c);return a!==c&&f.push(c),f}(o,c),c)}},6522:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(s){return s>1?1:s<-1?-1:s}},6563:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=d(n(3026)),i=d(n(4902)),s=d(n(1532)),l=n(7636);function d(u){return u&&u.__esModule?u:{default:u}}e.default=function u(a){return(0,r.default)(a)?!(parseFloat(a)>l.MAXLAT||a<l.MINLAT):!!(0,i.default)(a)&&u((0,s.default)(a))}},6729:(t,e)=>{function n(o,u){return o*o+u*u}function r(o,u){return n(o[0]-u[0],o[1]-u[1])}function i(o,u,a){var c=u[0],f=u[1],p=a[0]-c,g=a[1]-f;if(0!==p||0!==g){var m=((o[0]-c)*p+(o[1]-f)*g)/n(p,g);m>1?(c=a[0],f=a[1]):m>0&&(c+=p*m,f+=g*m)}return n(o[0]-c,o[1]-f)}function l(o,u,a,c,f){for(var g,p=c,m=u+1;m<a;m++){var v=i(o[m],o[u],o[a]);v>p&&(g=m,p=v)}p>c&&(g-u>1&&l(o,u,g,c,f),f.push(o[g]),a-g>1&&l(o,g,a,c,f))}function d(o,u){var a=o.length-1,c=[o[0]];return l(o,0,a,u,c),c.push(o[a]),c}e.__esModule=!0,e.SimplifyAP=function h(o,u,a){if(void 0===u&&(u=1),void 0===a&&(a=!1),o.length<=2)return o;var c=u*u;return d(o=a?o:function s(o,u){for(var c,a=o[0],f=[a],p=1,g=o.length;p<g;p++)r(c=o[p],a)>u&&(f.push(c),a=c);return a!==c&&f.push(c),f}(o,c),c)}},7029:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=n(7636),i=l(n(8744)),s=l(n(5101));function l(o){return o&&o.__esModule?o:{default:o}}e.default=function(u,a){var c=(0,i.default)(u,r.latitudeKeys);if(!(typeof c>"u"||null===c)){var f=u[c];return!0===a?f:(0,s.default)(f)}}},7088:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(9144));e.default=function(h){var o=(0,r.default)(h),a=o.minLng+(o.maxLng-o.minLng)/2;return{latitude:parseFloat((o.minLat+(o.maxLat-o.minLat)/2).toFixed(6)),longitude:parseFloat(a.toFixed(6))}}},7504:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=s(n(8674)),i=s(n(6522));function s(h){return h&&h.__esModule?h:{default:h}}e.default=function(o,u,a){var c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,f=(0,r.default)(u,o,c),p=(0,r.default)(o,a,c),g=(0,r.default)(u,a,c),m=Math.acos((0,i.default)((f*f+g*g-p*p)/(2*f*g))),v=Math.acos((0,i.default)((p*p+g*g-f*f)/(2*p*g)));return m>Math.PI/2?f:v>Math.PI/2?p:Math.sin(m)*f}},7636:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.areaConversion=e.timeConversion=e.distanceConversion=e.altitudeKeys=e.latitudeKeys=e.longitudeKeys=e.MAXLON=e.MINLON=e.MAXLAT=e.MINLAT=e.earthRadius=e.sexagesimalPattern=void 0,e.sexagesimalPattern=/^([0-9]{1,3})\xb0\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['\u2032]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["\u2033]\s*)?([NEOSW]?)$/,e.earthRadius=6378137,e.MINLAT=-90,e.MAXLAT=90,e.MINLON=-180,e.MAXLON=180,e.longitudeKeys=["lng","lon","longitude",0],e.latitudeKeys=["lat","latitude",1],e.altitudeKeys=["alt","altitude","elevation","elev",2],e.distanceConversion={m:1,km:.001,cm:100,mm:1e3,mi:1/1609.344,sm:1/1852.216,ft:100/30.48,in:100/2.54,yd:1/.9144},e.timeConversion={m:60,h:3600,d:86400};var f={m2:1,km2:1e-6,ha:1e-4,a:.01,ft2:10.763911,yd2:1.19599,in2:1550.0031};e.areaConversion=f,f.sqm=f.m2,f.sqkm=f.km2,f.sqft=f.ft2,f.sqyd=f.yd2,f.sqin=f.in2},7637:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=l(n(4695)),i=l(n(6563)),s=l(n(266));function l(o){return o&&o.__esModule?o:{default:o}}e.default=function(u){var a=(0,r.default)(u),c=a.latitude,f=a.longitude;if(Array.isArray(u)&&u.length>=2)return(0,s.default)(u[0])&&(0,i.default)(u[1]);if(typeof c>"u"||typeof f>"u")return!1;var p=u[f],g=u[c];return!(typeof g>"u"||typeof p>"u"||!1===(0,i.default)(g)||!1===(0,s.default)(p))}},8674:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=h(n(7029)),i=h(n(3100)),s=h(n(5705)),l=h(n(6522)),d=n(7636);function h(a){return a&&a.__esModule?a:{default:a}}e.default=function(c,f){var p=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;p=typeof p<"u"&&!isNaN(p)?p:1;var g=(0,r.default)(c),m=(0,i.default)(c),v=(0,r.default)(f),E=(0,i.default)(f),S=Math.acos((0,l.default)(Math.sin((0,s.default)(v))*Math.sin((0,s.default)(g))+Math.cos((0,s.default)(v))*Math.cos((0,s.default)(g))*Math.cos((0,s.default)(m)-(0,s.default)(E))))*d.earthRadius;return Math.round(S/p)*p}},8744:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(s,l){return l.reduce(function(d,h){if(typeof s>"u"||null===s)throw new Error("'".concat(s,"' is no valid coordinate."));return Object.prototype.hasOwnProperty.call(s,h)&&typeof h<"u"&&typeof d>"u"?(d=h,h):d},void 0)}},8948:(t,e)=>{function n(a,c){return function d(a){if(Array.isArray(a))return a}(a)||function l(a,c){if(!(typeof Symbol>"u")&&Symbol.iterator in Object(a)){var f=[],p=!0,g=!1,m=void 0;try{for(var E,v=a[Symbol.iterator]();!(p=(E=v.next()).done)&&(f.push(E.value),!c||f.length!==c);p=!0);}catch(S){g=!0,m=S}finally{try{!p&&null!=v.return&&v.return()}finally{if(g)throw m}}return f}}(a,c)||function i(a,c){if(a){if("string"==typeof a)return s(a,c);var f=Object.prototype.toString.call(a).slice(8,-1);if("Object"===f&&a.constructor&&(f=a.constructor.name),"Map"===f||"Set"===f)return Array.from(a);if("Arguments"===f||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(f))return s(a,c)}}(a,c)||function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(a,c){(null==c||c>a.length)&&(c=a.length);for(var f=0,p=new Array(c);f<c;f++)p[f]=a[f];return p}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,e.default=function(c){var p=n(c.toString().split("."),2),m=p[1],v=Math.abs(Number(p[0])),E=60*+("0."+(m||0)),S=E.toString().split("."),N=Math.floor(E),F=function(c){var p=Math.pow(10,arguments.length>1&&void 0!==arguments[1]?arguments[1]:4);return Math.round(c*p)/p}(60*+("0."+(S[1]||0))).toString(),L=n(F.split("."),2),x=L[0],M=L[1],C=void 0===M?"0":M;return v+"\xb0 "+N.toString().padStart(2,"0")+"' "+x.padStart(2,"0")+"."+C.padEnd(1,"0")+'"'}},8950:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(8674));e.default=function(h,o){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.default)(h,o)/(Number(o.time)-Number(h.time))*1e3}},9144:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=s(n(7029)),i=s(n(3100));function s(h){return h&&h.__esModule?h:{default:h}}e.default=function(o){if(!1===Array.isArray(o)||0===o.length)throw new Error("No points were given.");return o.reduce(function(u,a){var c=(0,r.default)(a),f=(0,i.default)(a);return{maxLat:Math.max(c,u.maxLat),minLat:Math.min(c,u.minLat),maxLng:Math.max(f,u.maxLng),minLng:Math.min(f,u.minLng)}},{maxLat:-1/0,minLat:1/0,maxLng:-1/0,minLng:1/0})}},9952:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=function i(d){return d&&d.__esModule?d:{default:d}}(n(939));e.default=function(h,o){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.default,a="function"==typeof u?u(h,o):(0,r.default)(h,o);if(isNaN(a))throw new Error("Could not calculate bearing for given points. Check your bearing function");switch(Math.round(a/22.5)){case 1:return"NNE";case 2:return"NE";case 3:return"ENE";case 4:return"E";case 5:return"ESE";case 6:return"SE";case 7:return"SSE";case 8:return"S";case 9:return"SSW";case 10:return"SW";case 11:return"WSW";case 12:return"W";case 13:return"WNW";case 14:return"NW";case 15:return"NNW";default:return"N"}}}},Xt={};function st(t){var e=Xt[t];if(void 0!==e)return e.exports;var n=Xt[t]={exports:{}};return Pr[t](n,n.exports,st),n.exports}function ot(t){return"function"==typeof t}let at=!1;const U={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){const e=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+e.stack)}else at&&console.log("RxJS: Back to a better error behavior. Thank you. <3");at=t},get useDeprecatedSynchronousErrorHandling(){return at}};function ye(t){setTimeout(()=>{throw t},0)}const Ae={closed:!0,next(t){},error(t){if(U.useDeprecatedSynchronousErrorHandling)throw t;ye(t)},complete(){}},Or=Array.isArray||(t=>t&&"number"==typeof t.length);function Nr(t){return null!==t&&"object"==typeof t}const je=(()=>{function t(e){return Error.call(this),this.message=e?`${e.length} errors occurred during unsubscription:\n${e.map((n,r)=>`${r+1}) ${n.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=e,this}return t.prototype=Object.create(Error.prototype),t})();class A{constructor(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}unsubscribe(){let e;if(this.closed)return;let{_parentOrParents:n,_ctorUnsubscribe:r,_unsubscribe:i,_subscriptions:s}=this;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof A)n.remove(this);else if(null!==n)for(let l=0;l<n.length;++l)n[l].remove(this);if(ot(i)){r&&(this._unsubscribe=void 0);try{i.call(this)}catch(l){e=l instanceof je?qt(l.errors):[l]}}if(Or(s)){let l=-1,d=s.length;for(;++l<d;){const h=s[l];if(Nr(h))try{h.unsubscribe()}catch(o){e=e||[],o instanceof je?e=e.concat(qt(o.errors)):e.push(o)}}}if(e)throw new je(e)}add(e){let n=e;if(!e)return A.EMPTY;switch(typeof e){case"function":n=new A(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof A)){const s=n;n=new A,n._subscriptions=[s]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}let{_parentOrParents:r}=n;if(null===r)n._parentOrParents=this;else if(r instanceof A){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}const i=this._subscriptions;return null===i?this._subscriptions=[n]:i.push(n),n}remove(e){const n=this._subscriptions;if(n){const r=n.indexOf(e);-1!==r&&n.splice(r,1)}}}var t;function qt(t){return t.reduce((e,n)=>e.concat(n instanceof je?n.errors:n),[])}A.EMPTY=((t=new A).closed=!0,t);const Fe="function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random();class J extends A{constructor(e,n,r){switch(super(),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=Ae;break;case 1:if(!e){this.destination=Ae;break}if("object"==typeof e){e instanceof J?(this.syncErrorThrowable=e.syncErrorThrowable,this.destination=e,e.add(this)):(this.syncErrorThrowable=!0,this.destination=new Qt(this,e));break}default:this.syncErrorThrowable=!0,this.destination=new Qt(this,e,n,r)}}[Fe](){return this}static create(e,n,r){const i=new J(e,n,r);return i.syncErrorThrowable=!1,i}next(e){this.isStopped||this._next(e)}error(e){this.isStopped||(this.isStopped=!0,this._error(e))}complete(){this.isStopped||(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}_next(e){this.destination.next(e)}_error(e){this.destination.error(e),this.unsubscribe()}_complete(){this.destination.complete(),this.unsubscribe()}_unsubscribeAndRecycle(){const{_parentOrParents:e}=this;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this}}class Qt extends J{constructor(e,n,r,i){super(),this._parentSubscriber=e;let s,l=this;ot(n)?s=n:n&&(s=n.next,r=n.error,i=n.complete,n!==Ae&&(l=Object.create(n),ot(l.unsubscribe)&&this.add(l.unsubscribe.bind(l)),l.unsubscribe=this.unsubscribe.bind(this))),this._context=l,this._next=s,this._error=r,this._complete=i}next(e){if(!this.isStopped&&this._next){const{_parentSubscriber:n}=this;U.useDeprecatedSynchronousErrorHandling&&n.syncErrorThrowable?this.__tryOrSetError(n,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}}error(e){if(!this.isStopped){const{_parentSubscriber:n}=this,{useDeprecatedSynchronousErrorHandling:r}=U;if(this._error)r&&n.syncErrorThrowable?(this.__tryOrSetError(n,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(n.syncErrorThrowable)r?(n.syncErrorValue=e,n.syncErrorThrown=!0):ye(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;ye(e)}}}complete(){if(!this.isStopped){const{_parentSubscriber:e}=this;if(this._complete){const n=()=>this._complete.call(this._context);U.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}}__tryOrUnsub(e,n){try{e.call(this._context,n)}catch(r){if(this.unsubscribe(),U.useDeprecatedSynchronousErrorHandling)throw r;ye(r)}}__tryOrSetError(e,n,r){if(!U.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{n.call(this._context,r)}catch(i){return U.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=i,e.syncErrorThrown=!0,!0):(ye(i),!0)}return!1}_unsubscribe(){const{_parentSubscriber:e}=this;this._context=null,this._parentSubscriber=null,e.unsubscribe()}}const Lr="function"==typeof Symbol&&Symbol.observable||"@@observable";function xr(t){return t}let tn=(()=>{class t{constructor(n){this._isScalar=!1,n&&(this._subscribe=n)}lift(n){const r=new t;return r.source=this,r.operator=n,r}subscribe(n,r,i){const{operator:s}=this,l=function Rr(t,e,n){if(t){if(t instanceof J)return t;if(t[Fe])return t[Fe]()}return t||e||n?new J(t,e,n):new J(Ae)}(n,r,i);if(l.add(s?s.call(l,this.source):this.source||U.useDeprecatedSynchronousErrorHandling&&!l.syncErrorThrowable?this._subscribe(l):this._trySubscribe(l)),U.useDeprecatedSynchronousErrorHandling&&l.syncErrorThrowable&&(l.syncErrorThrowable=!1,l.syncErrorThrown))throw l.syncErrorValue;return l}_trySubscribe(n){try{return this._subscribe(n)}catch(r){U.useDeprecatedSynchronousErrorHandling&&(n.syncErrorThrown=!0,n.syncErrorValue=r),function Cr(t){for(;t;){const{closed:e,destination:n,isStopped:r}=t;if(e||r)return!1;t=n&&n instanceof J?n:null}return!0}(n)?n.error(r):console.warn(r)}}forEach(n,r){return new(r=nn(r))((i,s)=>{let l;l=this.subscribe(d=>{try{n(d)}catch(h){s(h),l&&l.unsubscribe()}},s,i)})}_subscribe(n){const{source:r}=this;return r&&r.subscribe(n)}[Lr](){return this}pipe(...n){return 0===n.length?this:function en(t){return 0===t.length?xr:1===t.length?t[0]:function(n){return t.reduce((r,i)=>i(r),n)}}(n)(this)}toPromise(n){return new(n=nn(n))((r,i)=>{let s;this.subscribe(l=>s=l,l=>i(l),()=>r(s))})}}return t.create=e=>new t(e),t})();function nn(t){if(t||(t=U.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const be=(()=>{function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t})();class kr extends A{constructor(e,n){super(),this.subject=e,this.subscriber=n,this.closed=!1}unsubscribe(){if(this.closed)return;this.closed=!0;const e=this.subject,n=e.observers;if(this.subject=null,!n||0===n.length||e.isStopped||e.closed)return;const r=n.indexOf(this.subscriber);-1!==r&&n.splice(r,1)}}class Ar extends J{constructor(e){super(e),this.destination=e}}let Y=(()=>{class t extends tn{constructor(){super(),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}[Fe](){return new Ar(this)}lift(n){const r=new rn(this,this);return r.operator=n,r}next(n){if(this.closed)throw new be;if(!this.isStopped){const{observers:r}=this,i=r.length,s=r.slice();for(let l=0;l<i;l++)s[l].next(n)}}error(n){if(this.closed)throw new be;this.hasError=!0,this.thrownError=n,this.isStopped=!0;const{observers:r}=this,i=r.length,s=r.slice();for(let l=0;l<i;l++)s[l].error(n);this.observers.length=0}complete(){if(this.closed)throw new be;this.isStopped=!0;const{observers:n}=this,r=n.length,i=n.slice();for(let s=0;s<r;s++)i[s].complete();this.observers.length=0}unsubscribe(){this.isStopped=!0,this.closed=!0,this.observers=null}_trySubscribe(n){if(this.closed)throw new be;return super._trySubscribe(n)}_subscribe(n){if(this.closed)throw new be;return this.hasError?(n.error(this.thrownError),A.EMPTY):this.isStopped?(n.complete(),A.EMPTY):(this.observers.push(n),new kr(this,n))}asObservable(){const n=new tn;return n.source=this,n}}return t.create=(e,n)=>new rn(e,n),t})();class rn extends Y{constructor(e,n){super(),this.destination=e,this.source=n}next(e){const{destination:n}=this;n&&n.next&&n.next(e)}error(e){const{destination:n}=this;n&&n.error&&this.destination.error(e)}complete(){const{destination:e}=this;e&&e.complete&&this.destination.complete()}_subscribe(e){const{source:n}=this;return n?this.source.subscribe(e):A.EMPTY}}function ft(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}Error,Error,globalThis;class ls{constructor(){this.limitUI04=this.maxFromBits(4),this.limitUI06=this.maxFromBits(6),this.limitUI08=this.maxFromBits(8),this.limitUI12=this.maxFromBits(12),this.limitUI14=this.maxFromBits(14),this.limitUI16=this.maxFromBits(16),this.limitUI32=this.maxFromBits(32),this.limitUI40=this.maxFromBits(40),this.limitUI48=this.maxFromBits(48),this.create()}toString(){return this.hex}toURN(){return"urn:uuid:"+this.hex}toSignalK(){return`urn:mrn:signalk:uuid:${this.hex}`}toBytes(){let e=this.hex.split("-"),n=[],r=0;for(let i=0;i<e.length;i++)for(let s=0;s<e[i].length;s+=2)n[r++]=parseInt(e[i].substr(s,2),16);return n}maxFromBits(e){return Math.pow(2,e)}getRandomInt(e,n){return Math.floor(Math.random()*(n-e+1))+e}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(e,n,r=null){r=r||"0";let i=n-(e=String(e)).length;for(;i>0;i>>>=1,r+=r)1&i&&(e=r+e);return e}fromParts(e,n,r,i,s,l){return this.version=r>>12&15,this.hex=this.paddedString(e.toString(16),8)+"-"+this.paddedString(n.toString(16),4)+"-"+this.paddedString(r.toString(16),4)+"-"+this.paddedString(i.toString(16),2)+this.paddedString(s.toString(16),2)+"-"+this.paddedString(l.toString(16),12),this}}class Xe{static updates(){return{context:null,updates:[]}}static subscribe(){return{context:null,subscribe:[]}}static unsubscribe(){return{context:null,unsubscribe:[]}}static request(){return{requestId:(new ls).toString()}}}let ds=(()=>{class t{constructor(){this._filter="",this._wsTimeout=2e4,this._token="",this._playbackMode=!1,this.version=1,this.endpoint="",this.selfId="",this._source=null,this._connect=new Y,this.onConnect=this._connect.asObservable(),this._close=new Y,this.onClose=this._close.asObservable(),this._error=new Y,this.onError=this._error.asObservable(),this._message=new Y,this.onMessage=this._message.asObservable()}set source(n){this._source||(this._source={}),this._source.label=n}set authToken(n){this._token=n}get connectionTimeout(){return this._wsTimeout}set connectionTimeout(n){this._wsTimeout=n<3e3?3e3:n>6e4?6e4:n}get isOpen(){return!(!this.ws||1==this.ws.readyState||3==this.ws.readyState)}get filter(){return this._filter}set filter(n){this._filter=n&&-1!=n.indexOf("self")?this.selfId?this.selfId:"":n}get playbackMode(){return this._playbackMode}close(){this.ws&&(this.ws.close(),this.ws=null)}open(n,r,i){if(!(n=n||this.endpoint))return;let s=-1==n.indexOf("?")?"?":"&";r&&(n+=`${s}subscribe=${r}`),(this._token||i)&&(n+=`${r?"&":"?"}token=${this._token||i}`),this.close(),this.ws=new WebSocket(n),setTimeout(()=>{this.ws&&1!=this.ws.readyState&&3!=this.ws.readyState&&(console.warn(`Connection watchdog expired (${this._wsTimeout/1e3} sec): ${this.ws.readyState}... aborting connection...`),this.close())},this._wsTimeout),this.ws.onopen=l=>{this._connect.next(l)},this.ws.onclose=l=>{this._close.next(l)},this.ws.onerror=l=>{this._error.next(l)},this.ws.onmessage=l=>{this.parseOnMessage(l)}}parseOnMessage(n){let r;if("string"==typeof n.data)try{r=JSON.parse(n.data)}catch{return}this.isHello(r)?(this.selfId=r.self,this._playbackMode=typeof r.startTime<"u",this._message.next(r)):this.isResponse(r)?(typeof r.login<"u"&&typeof r.login.token<"u"&&(this._token=r.login.token),this._message.next(r)):this._filter&&this.isDelta(r)?r.context==this._filter&&this._message.next(r):this._message.next(r)}sendRequest(n){if("object"!=typeof n)return"";let r=Xe.request();return typeof n.login>"u"&&this._token&&(r.token=this._token),Object.keys(n).forEach(s=>{r[s]=n[s]}),this.send(r),r.requestId}put(n,r,i){return this.sendRequest({context:"self"==n?"vessels.self":n,put:{path:r,value:i}})}login(n,r){return this.sendRequest({login:{username:n,password:r}})}send(n){this.ws&&("object"==typeof n&&(n=JSON.stringify(n)),this.ws.send(n))}sendUpdate(n="self",r,i){let s=Xe.updates();this._token&&(s.token=this._token),s.context="self"==n?"vessels.self":n,this._token&&(s.token=this._token);let l=[];"string"==typeof r&&l.push({path:r,value:i}),"object"==typeof r&&Array.isArray(r)&&(l=r);let d={timestamp:(new Date).toISOString(),values:l};this._source&&(d.source=this._source),s.updates.push(d),this.send(s)}subscribe(n="*",r="*",i){let s=Xe.subscribe();if(this._token&&(s.token=this._token),s.context="self"==n?"vessels.self":n,this._token&&(s.token=this._token),"object"==typeof r&&Array.isArray(r)&&(s.subscribe=r),"string"==typeof r){let l={};l.path=r,i&&"object"==typeof i&&(i.period&&(l.period=i.period),i.minPeriod&&(l.minPeriod=i.period),i.format&&("delta"==i.format||"full"==i.format)&&(l.format=i.format),i.policy&&("instant"==i.policy||"ideal"==i.policy||"fixed"==i.policy)&&(l.policy=i.policy)),s.subscribe.push(l)}this.send(s)}unsubscribe(n="*",r="*"){let i=Xe.unsubscribe();this._token&&(i.token=this._token),i.context="self"==n?"vessels.self":n,this._token&&(i.token=this._token),"object"==typeof r&&Array.isArray(r)&&(i.unsubscribe=r),"string"==typeof r&&i.unsubscribe.push({path:r}),this.send(i)}raiseAlarm(n="*",r,i){let s;s="string"==typeof r&&-1==r.indexOf("notifications.")?`notifications.${r}`:r,this.put(n,s,i.value)}clearAlarm(n="*",r){let i=-1==r.indexOf("notifications.")?`notifications.${r}`:r;this.put(n,i,null)}isSelf(n){return n.context==this.selfId}isDelta(n){return typeof n.context<"u"}isHello(n){return typeof n.version<"u"&&typeof n.self<"u"}isResponse(n){return typeof n.requestId<"u"}}return t.\u0275fac=function(n){return new(n||t)},t.\u0275prov=ft({token:t,factory:t.\u0275fac,providedIn:"root"}),t})();class hs{constructor(e,n,r,i){this._method=[],this._message="",this._message=typeof e<"u"?e:"",this._state=typeof n<"u"?n:fr.alarm,r&&this._method.push(Vt.visual),i&&this._method.push(Vt.sound)}get value(){return{message:this._message,state:this._state,method:this._method}}}var fr=function(t){return t.normal="normal",t.alert="alert",t.warn="warn",t.alarm="alarm",t.emergency="emergency",t}(fr||{}),Vt=function(t){return t.visual="visual",t.sound="sound",t}(Vt||{});class gs{constructor(){this.obsList=[],this.stream=new ds,this._connect=new Y,this.onConnect=this._connect.asObservable(),this._close=new Y,this.onClose=this._close.asObservable(),this._error=new Y,this.onError=this._error.asObservable(),this._message=new Y,this.onMessage=this._message.asObservable()}get endpoint(){return this.stream.endpoint}set endpoint(e){this.stream.endpoint=e}get selfId(){return this.stream.selfId}set selfId(e){this.stream.selfId=e}get _source(){return this.stream._source}set _source(e){this.stream._source=e}set source(e){this.stream.source=e}set authToken(e){this.stream.authToken=e}get connectionTimeout(){return this.stream.connectionTimeout}set connectionTimeout(e){this.stream.connectionTimeout=e}get isOpen(){return this.stream.isOpen}get filter(){return this.stream.filter}set filter(e){this.stream.filter=e}get playbackMode(){return this.stream.playbackMode}open(e,n="none",r){this.obsList.push(this.stream.onConnect.subscribe(i=>this._connect.next(i))),this.obsList.push(this.stream.onClose.subscribe(i=>this._close.next(i))),this.obsList.push(this.stream.onError.subscribe(i=>this._error.next(i))),this.obsList.push(this.stream.onMessage.subscribe(i=>this._message.next(i))),this.stream.open(e,n,r)}close(){this.stream.close(),this.obsList.forEach(e=>e.unsubscribe()),this.obsList=[]}sendRequest(e){return this.stream.sendRequest(e)}put(e,n,r){return this.stream.put(e,n,r)}login(e,n){return this.stream.login(e,n)}send(e){this.stream.send(e)}sendUpdate(e="self",n,r){this.stream.sendUpdate(e,n,r)}subscribe(e="*",n="*",r){this.stream.subscribe(e,n,r)}unsubscribe(e="*",n="*"){this.stream.unsubscribe(e,n)}raiseAlarm(e="*",n,r){this.stream.raiseAlarm(e,n,r)}clearAlarm(e="*",n){this.stream.clearAlarm(e,n)}isSelf(e){return this.stream.isSelf(e)}isDelta(e){return this.stream.isDelta(e)}isHello(e){return this.stream.isHello(e)}isResponse(e){return this.stream.isResponse(e)}}class qe{id;name;mmsi;position=[0,0];positionReceived=!1;state;type={id:-1,name:""};properties={};lastUpdated=new Date;callsignVhf;callsignHf;orientation=0;virtual}class hr extends qe{anchor={maxRadius:null,radius:null,position:null};autopilot={state:null,mode:null,target:null,enabled:!1,default:null,availableActions:[]};buddy=!1;cog;cogTrue=null;cogMagnetic=null;courseApi={arrivalCircle:0,activeRoute:{},nextPoint:{},previousPoint:{}};courseCalcs={};distanceToSelf;environment={mode:null,sun:null};heading;headingTrue=null;headingMagnetic=null;performance={beatAngle:null,gybeAngle:null};racing;registrations={};resourceUpdates=[];sog;track=[];vectors={cog:[]};wind={direction:null,mwd:null,twd:null,tws:null,speedTrue:null,sog:null,awa:null,aws:null};design={airHeight:null,beam:null,draft:{current:null,maximum:null},length:null};destination={name:null,eta:null};flag;port}class ms extends qe{constructor(){super()}}class vs extends qe{sog=0;track=[];constructor(){super()}}class pr extends qe{constructor(){super()}}class ys extends pr{twd;tws;temperature;constructor(){super()}}class Ht{static celsiusToKelvin(e=0){return e+273.15}static kelvinToCelsius(e=0){return e-273.15}static kelvinToFarenheit(e=0){return 1.8*e-459.67}static degreesToRadians(e=0){return e*Math.PI/180}static radiansToDegrees(e=0){return 180*e/Math.PI}static angleToDirection(e,n){const r=2*Math.PI;if(n||(n=0),e||(e=0),isNaN(n)||isNaN(e))return null;const i=n+e;return i>r?i-r:i<0?r+i:i}static directionToAngle(e,n){const r=2*Math.PI;if(n||(n=0),e||(e=0),isNaN(n)||isNaN(e))return null;const i=n-e;let s;if(i>0)s=i>Math.PI?r-i:0-i;else if(i<0){const l=Math.abs(i);s=l>Math.PI?l-r:l}else s=i;return s}static knotsToKm(e){return 1.852*e}static nauticalMilesToKm(e){return 1.852*e}static knotsToMSec(e){return.51444325460445*e}static kmToKnots(e){return.539957*e}static kmToNauticalMiles(e){return.539957*e}static kmToMiles(e){return.621371*e}static metersToFeet(e){return 3.28084*e}static msecToKnots(e){return 1.94384*e}static msecToKmh(e){return 3.6*e}static msecToMph(e){return 2.23694*e}static nauticalMilesToMiles(e){return 1.15078*e}static milesToKm(e){return 1.60934*e}static milesToNauticalMiles(e){return.868976*e}static rpmToHertz(e){return e/60}}var ie=st(2541);class W{static destCoordinate(e,n,r){const i=(0,ie.computeDestinationPoint)(e,r,Ht.radiansToDegrees(n));return[i.longitude,i.latitude]}static distanceTo(e,n){return(0,ie.getDistance)(e,n)}static routeLength(e){return(0,ie.getPathLength)(e)}static routeLegs(e,n){if(e.length<2)return[];const r=[];r.push(n?{bearing:(0,ie.getGreatCircleBearing)(n,e[0]),distance:W.distanceTo(n,e[0])}:{bearing:0,distance:0});for(let i=1;i<e.length;++i){const s={bearing:(0,ie.getGreatCircleBearing)(e[i-1],e[i]),distance:W.distanceTo(e[i-1],e[i])};r.push(s)}return r}static centreOfPolygon(e){const n=(0,ie.getCenter)(e);return[n.longitude,n.latitude]}static inDLCrossingZone(e,n=170){return Math.abs(e[0])>=n}static inBounds(e,n){return(0,ie.isPointInPolygon)(e,[[n[0],n[1]],[n[0],n[3]],[n[2],n[3]],[n[2],n[1]],[n[0],n[1]]])}static calcMapifiedExtent(e,n){const i=111111*Math.cos(Ht.degreesToRadians(e[1])),s=[0,0,0,0];return s[1]=e[1]+(0-Math.abs(n))/111111,s[3]=e[1]+Math.abs(n)/111111,s[0]=e[0]+(0-Math.abs(n))/i,s[2]=e[0]+Math.abs(n)/i,s}static normaliseCoords(e){if(!Array.isArray(e))return[0,0];if("number"==typeof e[0]){if(e[0]>180)for(;e[0]>180;)e[0]=e[0]-360;else if(e[0]<-180)for(;e[0]<-180;)e[0]=360+e[0];return e}return Array.isArray(e[0])?(e.forEach(n=>this.normaliseCoords(n)),e):void 0}}class bs{action="notification";playback=!1;result=null;self=null;timestamp=(new Date).toISOString();sourceRef}class Kt{action;playback=!1;result=null;timestamp;self=null;constructor(){this.action="update"}}class _s extends Kt{constructor(){super(),this.action="resource"}}class Is extends Kt{constructor(){super(),this.action="trail"}}var Ds=st(6380);const Es=["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 _,O,gr;const Te=[];let Wt,Qe=[],Bt=!1,Gt=!1;const T={signalk:{},aisState:[]};let k,yr,mr=[0,0,0,0],vr=60,Pe=0,se={},oe=500,G=!1;const Z={maxAge:54e4,staleAge:36e4,lastTick:(new Date).valueOf(),maxTrack:20};let zt={cogLine:10,aisCogLine:10};const Oe={trailDuration:24,trailResolution:{lastHour:"5s",next23:"10s",beyond24:"1m"}};let ee,pe="freeboard-sk";function br(){k={updated:{},stale:{},expired:{}}}function et({action:t,msg:e}){switch(t){case"onConnect":postMessage({action:"open",playback:G,result:e.target.readyState});break;case"onClose":Ir(!1);break;case"onError":postMessage({action:"error",playback:G,result:"Connection error!"});break;case"onMessage":!function Os(t){O.isHello(t)?(postMessage({action:"hello",result:t,self:t.self,playback:G}),oe&&wr()):O.isDelta(t)?(Bt=!0,t.updates.forEach(e=>{e.values&&(ee=e.$source,e.values.forEach(n=>{if(yr=e.timestamp,t.context)switch(t.context.split(".")[0]){case"shore":case"atons":T?.signalk.atons&&function Ls(t,e){let n=!1;if(-1!==t.indexOf("shore.basestations")&&(n=!0),!_.atons.has(t)){const i=new pr;i.id=t,i.position=null,n&&(i.type.id=-1,i.type.name="Basestation"),_.atons.set(t,i)}const r=_.atons.get(t);""===e.path?(typeof e.value.name<"u"&&(r.name=e.value.name),typeof e.value.mmsi<"u"&&(r.mmsi=e.value.mmsi),typeof e.value.atonType<"u"&&(r.type=e.value.atonType)):"atonType"===e.path?r.type=e.value:"virtual"===e.path?r.virtual=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),Ce(t.context,_.atons,T?.signalk.atons);break;case"sar":T?.signalk.sar&&function xs(t,e){if(!_.sar.has(t)){const r=new ms;r.id=t,r.position=null,r.type.id=-1,r.type.name="SaR Beacon",_.sar.set(t,r)}const n=_.sar.get(t);""===e.path?(typeof e.value.name<"u"&&(n.name=e.value.name),typeof e.value.mmsi<"u"&&(n.mmsi=e.value.mmsi),typeof e.value.communication<"u"&&(n.callsignVhf=e.value.communication.callsignVhf??"",n.callsignHf=e.value.communication.callsignHf??"")):"communication.callsignVhf"===e.path?n.callsignVhf=e.value:"communication.callsignHf"===e.path?n.callsignHf=e.value:"navigation.position"===e.path&&e.value&&(n.position=W.normaliseCoords([e.value.longitude,e.value.latitude]),n.positionReceived=!0)}(t.context,n),Ce(t.context,_.sar,T?.signalk.sar);break;case"aircraft":T?.signalk.aircraft&&function As(t,e){if(!_.aircraft.has(t)){const r=new vs;r.id=t,r.position=null,_.aircraft.set(t,r)}const n=_.aircraft.get(t);""===e.path?(typeof e.value.name<"u"&&(n.name=e.value.name),typeof e.value.mmsi<"u"&&(n.mmsi=e.value.mmsi),typeof e.value.communication<"u"&&(n.callsignVhf=e.value.communication.callsignVhf??"",n.callsignHf=e.value.communication.callsignHf??"")):"communication.callsignVhf"===e.path?n.callsignVhf=e.value:"communication.callsignHf"===e.path?n.callsignHf=e.value:"navigation.position"===e.path&&e.value?(n.position=W.normaliseCoords([e.value.longitude,e.value.latitude]),n.positionReceived=!0,Jt(n)):"navigation.courseOverGroundTrue"===e.path?n.orientation=e.value:"navigation.speedOverGround"===e.path&&(n.sog=e.value)}(t.context,n),Ce(t.context,_.aircraft,T?.signalk.aircraft);break;case"meteo":T?.signalk.meteo&&(function ks(t,e){if(!_.meteo.has(t)){const r=new ys;r.id=t,r.position=null,r.type.id=-1,r.type.name="Weather Station",_.meteo.set(t,r)}const n=_.meteo.get(t);if(""===e.path){if(typeof e.value.name<"u"&&(n.name=e.value.name),typeof e.value.mmsi<"u"){const r=t.split(":").slice(-2);n.mmsi=2===r.length?`${r[0]}:${r[1]}`:e.value.mmsi}typeof e.value.communication<"u"&&(n.callsignVhf=e.value.communication.callsignVhf??"",n.callsignHf=e.value.communication.callsignHf??"")}else"communication.callsignVhf"===e.path?n.callsignVhf=e.value:"communication.callsignHf"===e.path?n.callsignHf=e.value:"environment.outside.temperature"===e.path?n.temperature=e.value:"environment.wind.directionTrue"===e.path?n.twd=e.value:"environment.wind.averageSpeed"===e.path?n.tws=e.value:"navigation.position"===e.path&&e.value&&(n.position=W.normaliseCoords([e.value.longitude,e.value.latitude]),n.positionReceived=!0)}(t.context,n),Tr(n)),Ce(t.context,_.meteo,T?.signalk.meteo);break;case"vessels":if(O.isSelf(t))_.self.id||(_.self.id=t.context),Mr(_.self,n,!0),Tr(n);else{if(T?.signalk.vessels){const r=function Ns(t){if(!_.aisTargets.has(t)){const e=new hr;e.id=t,e.position=null,_.aisTargets.set(t,e)}return _.aisTargets.get(t)}(t.context);Mr(r,n)}Ce(t.context,_.aisTargets,T?.signalk.vessels,T?.aisState)}}}))}),Er()):O.isResponse(t)&&postMessage({action:"response",result:t})}(e)}}function _r(t={config:{}}){t.interval&&"number"==typeof t.interval&&(oe=t.interval,Sr(),wr(),vr=1/(oe/1e3)*60),G=!!t.playback,t.config&&(typeof t.config.units.preferredPaths<"u"&&(se=t.config.units.preferredPaths),t.config.vessels.aisMaxAge&&"number"==typeof t.config.vessels.aisMaxAge&&(Z.maxAge=t.config.vessels.aisMaxAge),t.config.vessels.aisStaleAge&&"number"==typeof t.config.vessels.aisStaleAge&&(Z.staleAge=t.config.vessels.aisStaleAge),"number"==typeof t.config.signalk.maxRadius&&(T.signalk=t.config.signalk),typeof t.config.selections.aisState<"u"&&Array.isArray(t.config.selections.aisState)&&(T.aisState=t.config.selections.aisState),zt=t.config.vessels)}function Ir(t=!1){Sr(),Te.forEach(e=>e.unsubscribe()),O&&t&&O.close(),O=null,postMessage({action:"close",result:t,playback:G})}function Ne(t){return new Promise((e,n)=>{fetch(`${t}`).then(r=>{r.json().then(i=>e(i)).catch(i=>n(i))}).catch(r=>{n(r)})})}function Dr(){Ne(Wt+"/tracks"+(T&&T.signalk&&T.signalk.maxRadius?`?radius=${T.signalk.maxRadius}`:"?radius=10000")).then(e=>{Gt=!0,Object.entries(e).forEach(n=>{if(_.aisTargets.has(n[0])){const r=_.aisTargets.get(n[0]);r.track=n[1].coordinates,Jt(r)}})}).catch(()=>{Gt=!1})}function Ce(t,e,n=!0,r=[]){if(n){let i=e.get(t);i&&r.includes(i?.state)&&(k.expired[t]=!0,i=null),i&&T.signalk.maxRadius?i.positionReceived&&W.inBounds(i.position,mr)?k.updated[t]=!0:(e.delete(t),k.expired[t]=!0):k.updated[t]=!0}else 0!==e.size&&(e.forEach((i,s)=>{k.expired[s]=!0}),e.clear())}function Er(t=!1){if(!oe||t){const e=new Kt;e.playback=G,_.aisStatus.updated=Object.keys(k.updated),_.aisStatus.stale=Object.keys(k.stale),_.aisStatus.expired=Object.keys(k.expired),e.result=_,e.timestamp=G?yr:_.self.lastUpdated.toISOString(),postMessage(e),br(),_.self.resourceUpdates=[],0===Pe&&(function Rs(){const t=(new Date).valueOf();_.aisTargets.forEach((e,n)=>{e.lastUpdated.valueOf()<t-Z.maxAge?(k.expired[n]=!0,_.aisTargets.delete(n)):e.lastUpdated.valueOf()<t-Z.staleAge&&(k.stale[n]=!0)}),_.aircraft.forEach((e,n)=>{e.lastUpdated.valueOf()<t-Z.maxAge?(k.expired[n]=!0,_.aircraft.delete(n)):e.lastUpdated.valueOf()<t-Z.staleAge&&(k.stale[n]=!0)}),_.sar.forEach((e,n)=>{e.lastUpdated.valueOf()<t-Z.maxAge?(k.expired[n]=!0,_.sar.delete(n)):e.lastUpdated.valueOf()<t-Z.staleAge&&(k.stale[n]=!0)})}(),_.self.positionReceived&&T?.signalk.maxRadius&&(mr=W.calcMapifiedExtent(_.self.position,T.signalk.maxRadius),Pe++)),Pe=Pe>=vr?0:Pe+1}}function wr(){oe&&"number"==typeof oe&&Qe.push(setInterval(()=>{Bt&&(Er(!0),Bt=!1)},oe)),Qe.push(setInterval(()=>{Gt&&Dr()},6e4))}function Sr(){Qe.forEach(t=>clearInterval(t)),Qe=[]}function Mr(t,e,n=!1){if(t.lastUpdated=new Date,n){if(e.path.startsWith("resources."))t.resourceUpdates.push(e),function Cs(t){const e=new _s;e.playback=G,e.result={path:t.path,value:t.value,sourceRef:ee},postMessage(e)}(e);else if(e.path.startsWith("navigation.racing"))t.properties[e.path]=e.value;else if("performance.beatAngle"===e.path)t.performance.beatAngle=e.value;else if("performance.gybeAngle"===e.path)t.performance.gybeAngle=e.value;else if(e.path.startsWith("navigation.course."))if(e.path.startsWith("navigation.course.calcValues.")){const s=e.path.split(".").slice(3).join(".");t.courseCalcs[s]=e.value}else e.path.includes("activeRoute")?t.courseApi.activeRoute=e.value:e.path.includes("nextPoint")?t.courseApi.nextPoint=e.value:e.path.includes("previousPoint")?t.courseApi.previousPoint=e.value:e.path.includes("arrivalCircle")&&(t.courseApi.arrivalCircle=e.value);const i=-1!==e.path.indexOf("course")?e.path.split(".").slice(0,2).join("."):e.path;-1!==Es.indexOf(i)&&(_.paths[i]=null)}else"navigation.distanceToSelf"===e.path&&(t.distanceToSelf=e.value);if(""===e.path)typeof e.value.name<"u"&&(t.name=e.value.name),typeof e.value.mmsi<"u"&&(t.mmsi=e.value.mmsi),typeof e.value.registrations<"u"&&(t.registrations=e.value.registrations),typeof e.value.buddy<"u"&&(t.buddy=e.value.buddy),typeof e.value.communication<"u"&&(t.callsignVhf=e.value.communication.callsignVhf??"",t.callsignHf=e.value.communication.callsignHf??"");else if("communication.callsignVhf"===e.path)t.callsignVhf=e.value;else if("communication.callsignHf"===e.path)t.callsignHf=e.value;else if("design.aisShipType"===e.path)t.type=e.value;else if("navigation.position"===e.path&&e.value){if(typeof e.value.latitude>"u"||typeof e.value.longitude>"u")return;t.position=W.normaliseCoords([e.value.longitude,e.value.latitude]),t.positionReceived=!0,n||Jt(t)}else"navigation.state"===e.path?t.state=e.value:"navigation.speedOverGround"===e.path?t.sog=e.value:"environment.mode"===e.path?t.environment.mode=e.value:"environment.sun"===e.path?t.environment.sun=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:"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:"steering.autopilot.state"===e.path&&ee===pe?t.autopilot.state=e.value:"steering.autopilot.mode"===e.path&&ee===pe?t.autopilot.mode=e.value:"steering.autopilot.target"===e.path&&ee===pe?t.autopilot.target=e.value:"steering.autopilot.engaged"===e.path&&ee===pe?t.autopilot.enabled=e.value:"steering.autopilot.defaultPilot"===e.path?(t.autopilot.default=e.value,pe=e.value):"steering.autopilot.availableActions"===e.path&&ee===pe?t.autopilot.availableActions=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);typeof se.heading<"u"&&e.path===se.heading&&(t.orientation=e.value),typeof se.tws<"u"&&e.path===se.tws&&(t.wind.tws=e.value),typeof se.twd<"u"&&e.path===se.twd&&(t.wind.direction="environment.wind.angleTrueGround"===e.path||"environment.wind.angleTrueWater"===e.path?Ht.angleToDirection(e.value,t.orientation??0):e.value);const r=t.cogTrue??t.cogMagnetic??void 0;typeof r<"u"&&t.position&&(t.vectors.cog=[t.position,W.destCoordinate(t.position,r,(t.sog??0)*(60*(n?zt.cogLine:zt.aisCogLine)))])}function Tr(t){if(t.path.includes("notifications.")){const e=new bs;e.playback=G,e.result={path:t.path,value:t.value,sourceRef:ee},postMessage(e)}}function Jt(t){if(t.track&&0===t.track.length)t.track.push([t.position]);else{const n=t.track[t.track.length-1][t.track[t.track.length-1].length-1];n[0]!==t.position[0]&&n[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-Z.maxTrack)}addEventListener("message",({data:t})=>{!function Ss(t){if(t.cmd)switch(t.cmd){case"open":_r(t.options),function Ts(t){if(O)return;if(!t.url)return void postMessage({action:"error",result:"Valid options not provided!"});const e=t.url.split("/");if(e.pop(),e.push("api"),e[0]="wss:"===e[0]?"https:":"http:",Wt=e.join("/"),function ws(){_={self:new hr,aisTargets:new Map,aisStatus:{updated:[],stale:[],expired:[]},paths:{},atons:new Map,aircraft:new Map,sar:new Map,meteo:new Map},_.self.positionReceived=!1,br()}(),O=new gs,Te.push(O.onConnect.subscribe(n=>et({action:"onConnect",msg:n}))),Te.push(O.onClose.subscribe(n=>et({action:"onClose",msg:n}))),Te.push(O.onError.subscribe(n=>et({action:"onError",msg:n}))),Te.push(O.onMessage.subscribe(n=>et({action:"onMessage",msg:n}))),O.authToken=gr,t.playback){const n=t.playbackOptions.startTime?`?startTime=${t.playbackOptions.startTime}`:null;let r=t.playbackOptions.playbackRate?`playbackRate=${t.playbackOptions.playbackRate}`:null;r=r?n?"&"+r:"?"+r:null,O.open(`${t.url}${n||""}${r||""}`,t.playbackOptions.subscribe,t.token)}else O.open(t.url,t.subscribe,t.token),Dr()}(t.options);break;case"close":Ir(!0);break;case"subscribe":O.subscribe(t.options.context,t.options.path);break;case"settings":_r(t.options);break;case"alarm":!function Ps(t){const e=-1===t.type.indexOf("notifications.")?`notifications.${t.type}`:t.type;t.raise?O.raiseAlarm("self",e,new hs(t.message,t.state,!0,!0)):O.clearAlarm("self",e)}(t.options);break;case"vessel":if(t.options){let e;e="self"===t.options.context?_.self:_.aisTargets.get(t.options.context),e&&t.options.name&&(e.name=t.options.name)}break;case"auth":t.options&&typeof t.options.token<"u"&&(gr=t.options.token);break;case"trail":t.options&&(Oe.trailDuration=t.options.trailDuration??24,t.options.trailResolution&&(Oe.trailResolution.lastHour=t.options.trailResolution.lastHour??"5s",Oe.trailResolution.next23=t.options.trailResolution.next23??"1m",Oe.trailResolution.beyond24=t.options.trailResolution.beyond24??"5m")),function Ms(t){const e=Wt+"/self/track?",n=[];t.trailDuration>24&&(n.push(Ne(`${e}timespan=${t.trailDuration-24}h&resolution=${t.trailResolution.beyond24}×panOffset=24`)),n.push(Ne(`${e}timespan=23h&resolution=${t.trailResolution.next23}×panOffset=1`))),t.trailDuration>1&&t.trailDuration<25&&n.push(Ne(`${e}timespan=${t.trailDuration-1}h&resolution=${t.trailResolution.next23}×panOffset=1`)),n.push(Ne(`${e}timespan=1h&resolution=${t.trailResolution.lastHour}`));let s=[];const l=new Is;l.playback=G,Promise.all(n).then(d=>{let h=0;const o=n.length-1;d.forEach(a=>{if(a.type&&"MultiLineString"===a.type&&a.coordinates&&Array.isArray(a.coordinates))if(h!==o){let c=[];for(a.coordinates.forEach(f=>{c=c.concat(f)}),c=(0,Ds.p$)(c,5e-4,true);c.length>60;){const f=c.slice(0,60);s.push(f),c=c.slice(59),c[0]=[c[0][0]+5e-9,c[0][1]+5e-9]}0!==c.length&&s.push(c)}else s=s.concat(a.coordinates);h++}),l.result=s,postMessage(l)}).catch(()=>{l.result=null,postMessage(l)})}(Oe)}}(t)})})();
|