@signalk/freeboard-sk 2.19.4-beta.1 → 2.19.4-beta.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.
@@ -407,7 +407,7 @@ ${s}`)!==100){let l=t.replace("{font-family}",s.replace(/ /g,"-").toLowerCase())
407
407
  `)return Bn.push(`
408
408
  `,""),Bn;if(X==2)return Bn.push(KP(Ao,Or),vn),Bn;Ao=XP(Ao,vn,Yh,Or).split(`
409
409
  `);for(let Xo=0,ml=Ao.length;Xo<ml;++Xo)Xo>0&&Bn.push(`
410
- `,""),Bn.push(Ao[Xo],vn);return Bn},[]):_r=oj(Yn,O).trim(),V=Ot(ke,"paint","text-opacity",ee,b,te)}if(_r&&V&&!Ul){hr||(++re,Xe=I[re],(!Xe||!Xe.getText()||Xe.getFill()||Xe.getStroke())&&(Xe=new Re,I[re]=Xe),Xe.setImage(void 0),Xe.setGeometry(void 0));let mr=xse(ke,ee,"text",b);Xe.getText()||Xe.setText(Wt),Wt=Xe.getText(),(!Wt||"getDeclutterMode"in Wt&&Wt.getDeclutterMode()!==mr)&&(Wt=new zi({padding:[2,2,2,2],declutterMode:mr}),Xe.setText(Wt));let Yn=Ot(ke,"layout","text-transform",ee,b,te);Yn=="uppercase"?_r=Array.isArray(_r)?_r.map((ar,Rs)=>Rs%2?ar:ar.toUpperCase()):_r.toUpperCase():Yn=="lowercase"&&(_r=Array.isArray(_r)?_r.map((ar,Rs)=>Rs%2?ar:ar.toLowerCase()):_r.toLowerCase());let Bn=Array.isArray(_r)?_r:X==2?KP(_r,Or):XP(_r,Ma,Yh,Or);if(Wt.setText(Bn),Wt.setFont(Ma),Wt.setRotation($P(Ot(ke,"layout","text-rotate",ee,b,te))),typeof Wt.setKeepUpright=="function"){let ar=Ot(ke,"layout","text-keep-upright",ee,b,te);Wt.setKeepUpright(ar)}let Wn=Ot(ke,"layout","text-anchor",ee,b,te),oo=hr||X==1?"point":Ot(ke,"layout","symbol-placement",ee,b,te),on;if(oo==="line-center"?(Wt.setPlacement("line"),on="center"):Wt.setPlacement(oo),oo==="line"&&typeof Wt.setRepeat=="function"){let ar=Ot(ke,"layout","symbol-spacing",ee,b,te);Wt.setRepeat(ar*2)}Wt.setOverflow(oo==="point");let vn=Ot(ke,"paint","text-halo-width",ee,b,te),Ao=Ot(ke,"layout","text-offset",ee,b,te),Xo=Ot(ke,"paint","text-translate",ee,b,te),ml=0,Os=0;if(oo=="point"){on="center",Wn.indexOf("left")!==-1?(on="left",Os=vn):Wn.indexOf("right")!==-1&&(on="right",Os=-vn);let ar=Ot(ke,"layout","text-rotation-alignment",ee,b,te);Wt.setRotateWithView(ar=="map")}else Wt.setMaxAngle($P(Ot(ke,"layout","text-max-angle",ee,b,te))*_r.length/Bn.length),Wt.setRotateWithView(!1);Wt.setTextAlign(on);let Yo="middle";Wn.indexOf("bottom")==0?(Yo="bottom",ml=-vn-.5*(ss-1)*ls):Wn.indexOf("top")==0&&(Yo="top",ml=vn+.5*(ss-1)*ls),Wt.setTextBaseline(Yo);let Ra=Ot(ke,"layout","text-justify",ee,b,te);Wt.setJustify(Ra==="auto"?void 0:Ra),Wt.setOffsetX(Ao[0]*ls+Os+Xo[0]),Wt.setOffsetY(Ao[1]*ls+ml+Xo[1]),P.setColor(mf(Ot(ke,"paint","text-color",ee,b,te),V)),Wt.setFill(P);let Rr=mf(Ot(ke,"paint","text-halo-color",ee,b,te),V);if(Rr&&vn>0){k.setColor(Rr),vn*=2;let ar=.5*ls;k.setWidth(vn<=ar?vn:ar),Wt.setStroke(k)}else Wt.setStroke(void 0);let Oo=Ot(ke,"layout","text-padding",ee,b,te),ca=Wt.getPadding();Oo!==ca[0]&&(ca[0]=Oo,ca[1]=Oo,ca[2]=Oo,ca[3]=Oo),Xe.setZIndex(yn)}}}if(re>-1)return I.length=re+1,W9e&&("set"in S?S.set("mapbox-layer",Me):S.getProperties()["mapbox-layer"]=Me),I};return n.setStyle(D),n.set("mapbox-layers",f),n.set("mapbox-source",E),n.set("mapbox-featurestate",n.get("mapbox-featurestate")||{}),D}function Sse(n,t){let e=n[0],i=e.width,r=e.height,o=e.data,a=new Uint8ClampedArray(o.length),s=t.resolution*2,l=i-1,c=r-1,d=[0,0,0,0],f=2*Math.PI,g=Math.PI/2,m=Math.PI*t.sunEl/180,b=Math.PI*t.sunAz/180,v=Math.cos(m),E=Math.sin(m),k=t.highlightColor,P=t.shadowColor,I=t.accentColor,D=t.encoding,S,A,z,O,W,j,$,X,Y,ee,te,re,Me,xe,ht,at,ke,He,Zt,mi,Ni,G;function V(we,J="mapbox"){if(J==="mapbox")return(we[0]*256*256+we[1]*256+we[2])*.1-1e4;if(J==="terrarium")return we[0]*256+we[1]+we[2]/256-32768}for(A=0;A<=c;++A)for(W=A===0?0:A-1,j=A===c?c:A+1,S=0;S<=l;++S)z=S===0?0:S-1,O=S===l?l:S+1,$=(A*i+z)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],X=t.vert*V(d,D),$=(A*i+O)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],Y=t.vert*V(d,D),ee=(Y-X)/s,$=(W*i+S)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],X=t.vert*V(d,D),$=(j*i+S)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],Y=t.vert*V(d,D),te=(Y-X)/s,Me=Math.atan2(te,-ee),Me<0?Me=g-Me:Me>g?Me=f-Me+g:Me=g-Me,re=Math.atan(Math.sqrt(ee*ee+te*te)),G=E*Math.cos(re)+v*Math.sin(re)*Math.cos(b-Me),xe=Math.cos(re),ht=255*G,Zt=Math.min(Math.max(2*t.sunEl,0),1),mi=1.875-t.opacity*1.75,Ni=t.opacity!==.5?g*((Math.pow(mi,re)-1)/(Math.pow(mi,g)-1)):re,ke={r:(1-xe)*I.r*Zt*255,g:(1-xe)*I.g*Zt*255,b:(1-xe)*I.b*Zt*255,a:(1-xe)*I.a*Zt*255},at=Math.abs(((Me+b)/Math.PI+.5)%2-1),He={r:(k.r*(1-at)+P.r*at)*ht,g:(k.g*(1-at)+P.g*at)*ht,b:(k.b*(1-at)+P.b*at)*ht,a:(k.a*(1-at)+P.a*at)*ht},$=(A*i+S)*4,a[$]=ke.r*(1-at)+He.r,a[$+1]=ke.g*(1-at)+He.g,a[$+2]=ke.b*(1-at)+He.b,a[$+3]=o[$+3]*t.opacity*Zt*Math.sin(Ni);return new ImageData(a,i,r)}function $9e(n,t=512){return n.getExtent()?Fu({extent:n.getExtent(),tileSize:t,maxZoom:22}).getResolutions():Ac}function Tse(n,t){return t.accessToken||(t=Object.assign({},t),new URL(n).searchParams.forEach((i,r)=>{t.accessToken=i,t.accessTokenParam=r})),t}function Gw(n,t,e="",i={},r=void 0){let o,a,s,l,c=!0;return typeof e!="string"&&!Array.isArray(e)?(s=e,l=s.source||s.layers,i=s):l=e,typeof i=="string"?(o=i,s={}):(o=i.styleUrl,s=i),s.updateSource===!1&&(c=!1),r||(r=s.resolutions),!o&&typeof t=="string"&&!t.trim().startsWith("{")&&(o=t),o&&(o=o.startsWith("data:")?location.href:Ny(o,s.accessToken),s=Tse(o,s)),new Promise(function(d,f){QB(t,s).then(function(g){if(g.version!=8)return f(new Error("glStyle version 8 required."));if(!(n instanceof cn||n instanceof Lu))return f(new Error("Can only apply to VectorLayer or VectorTileLayer"));let m=n instanceof Lu?"vector":"geojson";if(l?Array.isArray(l)?a=g.layers.find(function(D){return D.id===l[0]}).source:a=l:(a=g.layers.find(function(D){return D.source&&g.sources[D.source].type===m}).source,l=a),!a)return f(new Error(`No ${m} source found in the glStyle.`));function b(){if(!c)return Promise.resolve();if(n instanceof Lu)return Pse(g.sources[a],o,s).then(function(z){let O=n.getSource();O?z!==O&&(O.setTileUrlFunction(z.getTileUrlFunction()),typeof O.setUrls=="function"&&typeof z.getUrls=="function"&&O.setUrls(z.getUrls()),O.format_||(O.format_=z.format_),O.getAttributions()||O.setAttributions(z.getAttributions()),O.getTileLoadFunction()===bV&&O.setTileLoadFunction(z.getTileLoadFunction()),Un(O.getProjection(),z.getProjection())&&(O.tileGrid=z.getTileGrid())):n.setSource(z);let W=n.getSource().getTileGrid();!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())&&W.getMinZoom()>0&&n.setMaxResolution(zy(Math.max(0,W.getMinZoom()-1e-12),W.getResolutions()))});let D=g.sources[a],S=n.getSource();(!S||S.get("mapbox-source")!==D)&&(S=Rse(D,o,s));let A=n.getSource();return A?S!==A&&(A.getAttributions()||A.setAttributions(S.getAttributions()),A.format_||(A.format_=S.getFormat()),A.url_=S.getUrl()):n.setSource(S),Promise.resolve()}let v,E,k={},P={};function I(){if(!E&&(!g.sprite||k)){if(s.projection&&!r){let S=Ft(s.projection).getUnits();S!=="m"&&(r=Ac.map(A=>A/Ss[S]))}E=aj(n,g,l,r,k,P,(D,S=s.webfonts)=>Cse(D,S),s.getImage),n.getStyle()?b().then(d).catch(f):f(new Error(`Nothing to show for source [${a}]`))}else E?(n.setStyle(E),b().then(d).catch(f)):f(new Error("Something went wrong trying to apply style."))}if(g.sprite){let D=mse(g.sprite,s.accessToken,o||location.href);v=window.devicePixelRatio>=1.5?.5:1;let S=v==.5?"@2x":"";Promise.all(D.map(function(A){let z=new URL(A.url),O=z.origin+z.pathname+S+".json"+z.search;return new Promise(function(W,j){Ug("Sprite",O,s).then(W).catch(function($){O=z.origin+z.pathname+".json"+z.search,Ug("Sprite",O,s).then(W).catch(j)})}).then(function(W){W===void 0&&f(new Error("No sprites found."));let j;if(j=z.origin+z.pathname+S+".png"+z.search,s.transformRequest){let $=s.transformRequest(j,"SpriteImage")||j;($ instanceof Request||$ instanceof Promise)&&(j=$)}P[A.id]=j;for(let $ in W){let X=A.id=="default"?$:`${A.id}:${$}`;k[X]=W[$]}}).catch(function(W){f(new Error(`Sprites cannot be loaded: ${O}: ${W.message}`))})})).then(I).catch(f)}else I()}).catch(f)})}function Ise(n,t){let e;return n.some(function(i){if(i.id==t)return e=i.source,!0}),e}function q9e(n,t){let e=n.bounds;if(e){let i=Jt([e[0],e[1]],t),r=Jt([e[2],e[3]],t);return[i[0],i[1],r[0],r[1]]}return Ft(t).getExtent()}function kse(n,t,e){let i=new fy({tileJSON:t,tileSize:n.tileSize||t.tileSize||512}),r=i.getTileJSON(),o=i.getTileGrid(),a=Ft(e.projection||"EPSG:3857"),s=q9e(r,a),l=a.getExtent(),c=r.minzoom||0,d=r.maxzoom||22,f={attributions:i.getAttributions(),projection:a,tileGrid:new lf({origin:l?Go(l):o.getOrigin(0),extent:s||o.getExtent(),minZoom:c,resolutions:$9e(a,t.tileSize).slice(0,d+1),tileSize:o.getTileSize(0)})};return Array.isArray(r.tiles)?f.urls=r.tiles:f.url=r.tiles,f}function K9e(n,t,e,i){let r={id:n.id,type:n.type},o=n.layout||{},a=n.paint||{};r.paint=a,hl.zoom=Hw(t,e.resolutions||Ac),hl.distanceFromCenter=0;let s,l=Ot(r,"paint","background-color",jl,i);return a["background-opacity"]!==void 0&&(s=Ot(r,"paint","background-opacity",jl,i)),o.visibility=="none"?void 0:mf(l,s)}function X9e(n,t,e){let i=document.createElement("div");return i.className="ol-mapbox-style-background",i.style.position="absolute",i.style.width="100%",i.style.height="100%",new gd({source:new _d({}),render(r){let o=K9e(n,r.viewState.resolution,t,e);return i.style.backgroundColor=o,i}})}function Pse(n,t,e){return new Promise(function(i,r){JB(n,t,e).then(function({tileJson:o,tileLoadFunction:a}){let s=kse(n,o,e);s.tileLoadFunction=a,s.format=new ag;let l=new kg(s);l.set("mapbox-source",n),i(l)}).catch(r)})}function Y9e(n,t,e){let i=new Lu({declutter:!0,visible:!1});return Pse(n,t,e).then(function(r){i.setSource(r)}).catch(function(r){i.setSource(void 0)}),i}function Ase(n){return`{bbox-${(n?n.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function Z9e(n,t,e){return new Promise(function(i,r){JB(n,t,e).then(function({tileJson:o,tileLoadFunction:a}){let s=new fy({interpolate:e.interpolate===void 0?!0:e.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:o});s.tileGrid=kse(n,o,e).tileGrid,e.projection&&(s.projection=Ft(e.projection));let l=s.getTileUrlFunction();a&&s.setTileLoadFunction(a),s.setTileUrlFunction(function(c,d,f){let g=Ase(f),m=l(c,d,f);if(m.indexOf(g)!=-1){let b=s.getTileGrid().getTileCoordExtent(c);m=m.replace(g,b.toString())}return m}),s.set("mapbox-source",n),i(s)}).catch(function(o){r(o)})})}function Ose(n,t,e){let i=new Sd;return Z9e(n,t,e).then(function(r){i.setSource(r)}).catch(function(){i.setSource(void 0)}),i}function Q9e(n,t,e){let i=Ose(n,t,e);return new L3({source:new doe({operationType:"image",operation:Sse,sources:[i]})})}function Rse(n,t,e){let i=e.projection?new S8({dataProjection:e.projection}):new S8,r=n.data,o={};if(typeof r=="string"){let[s]=Vy(r,e.accessToken,e.accessTokenParam||"access_token",t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){let c=(f,g,m)=>{let b=Ase(m);return s.replace(b,`${f.join(",")}`)},d=new rn({attributions:n.attribution,format:i,loader:(f,g,m,b,v)=>{let E=typeof c=="function"?c(f,g,m):c;Ug("GeoJSON",E,e).then(k=>{let P=d.getFormat().readFeatures(k,{featureProjection:m});d.addFeatures(P),b(P)}).catch(k=>{d.removeLoadedExtent(f),v()})},strategy:wie});return d.set("mapbox-source",n),d}let l=new rn({attributions:n.attribution,format:i,url:s,loader:(c,d,f,g,m)=>{Ug("GeoJSON",s,e).then(b=>{let v=l.getFormat().readFeatures(b,{featureProjection:f});l.addFeatures(v),g(v)}).catch(b=>{l.removeLoadedExtent(c),m()})}});return l}o.features=i.readFeatures(r,{featureProjection:ka()||"EPSG:3857"});let a=new rn(Object.assign({attributions:n.attribution,format:i},o));return a.set("mapbox-source",n),a}function J9e(n,t,e){return new cn({declutter:!0,source:Rse(n,t,e),visible:!1})}function eVe(n,t,e){let i=null;return function(r){n.paint&&"raster-opacity"in n.paint&&r.frameState.viewState.zoom!==i&&(i=r.frameState.viewState.zoom,delete e[n.id],tVe(n,t,i,e))}}function tVe(n,t,e,i){hl.zoom=e,hl.distanceFromCenter=0;let r=Ot(n,"paint","raster-opacity",jl,i);t.setOpacity(r)}function iVe(n,t){function e(){let i=t.get("mapbox-style");if(!i)return;let r=PP(i.layers),o=n.get("mapbox-layers"),a=r.filter(function(s){return o.includes(s.id)}).some(function(s){return!s.layout||!s.layout.visibility||s.layout.visibility==="visible"});n.get("visible")!==a&&n.setVisible(a)}n.on("change",e),e()}function nVe(n,t,e,i){let r=WP(n),o=n.layers,a=e.type,s=e.source||Ise(o,e.ref),l=n.sources[s],c;if(a=="background")c=X9e(e,i,r);else if(l.type=="vector")c=Y9e(l,t,i);else if(l.type=="raster")c=Ose(l,t,i),c.setVisible(e.layout?e.layout.visibility!=="none":!0),c.on("prerender",eVe(e,c,r));else if(l.type=="geojson")c=J9e(l,t,i);else if(l.type=="raster-dem"&&e.type=="hillshade"){let f=Q9e(l,t,i);c=f,f.getSource().on("beforeoperations",function(g){let m=g.data;m.resolution=fu(i.projection||"EPSG:3857",g.resolution,Hr(g.extent),"m"),hl.zoom=Hw(g.resolution,i.resolutions||Ac),hl.distanceFromCenter=0,m.encoding=l.encoding,m.vert=5*Ot(e,"paint","hillshade-exaggeration",jl,r),m.sunAz=Ot(e,"paint","hillshade-illumination-direction",jl,r),m.sunEl=35,m.opacity=.3,m.highlightColor=Ot(e,"paint","hillshade-highlight-color",jl,r),m.shadowColor=Ot(e,"paint","hillshade-shadow-color",jl,r),m.accentColor=Ot(e,"paint","hillshade-accent-color",jl,r)}),c.setVisible(e.layout?e.layout.visibility!=="none":!0)}let d=s;return c&&c.set("mapbox-source",d),c}function Ese(n,t,e,i){let r=[],o=null;if(t instanceof Ah){if(o=t.getView(),!o.isDef()&&!o.getRotation()&&!o.getResolutions()){let f=i.projection?Ft(i.projection):o.getProjection();o=new Ds(Object.assign(o.getProperties(),{maxResolution:Ac[0]/Ss[f.getUnits()],projection:i.projection||o.getProjection()})),t.setView(o)}"center"in n&&!o.getCenter()&&o.setCenter(Jt(n.center,o.getProjection())),"zoom"in n&&o.getZoom()===void 0&&o.setResolution(Ac[0]/Ss[o.getProjection().getUnits()]/Math.pow(2,n.zoom)),(!o.getCenter()||o.getZoom()===void 0)&&o.fit(o.getProjection().getExtent(),{nearest:!0,size:t.getSize()})}t.set("mapbox-style",n),t.set("mapbox-metadata",{styleUrl:e,options:i});let a=n.layers,s=[],l,c,d;for(let f=0,g=a.length;f<g;++f){let m=a[f],b=m.type;if(b=="heatmap"){console.debug(`layers[${f}].type "${b}" not supported`);continue}else d=m.source||Ise(a,m.ref),(!d||d!=c)&&(s.length&&(r.push(Dse(l,s,n,e,t,i)),s=[]),l=nVe(n,e,m,i),l instanceof cn||l instanceof Lu||(s=[]),c=l.get("mapbox-source")),s.push(m.id)}return r.push(Dse(l,s,n,e,t,i)),Promise.all(r)}function ZP(n,t,e={}){let i,r;if(typeof n=="string"||n instanceof HTMLElement?r=new Ah({target:n}):r=n,typeof t=="string"){let o=t.startsWith("data:")?location.href:Ny(t,e.accessToken);e=Tse(o,e),i=new Promise(function(a,s){QB(t,e).then(function(l){Ese(l,r,o,e).then(function(){a(r)}).catch(s)}).catch(function(l){s(new Error(`Could not load ${t}: ${l.message}`))})})}else i=new Promise(function(o,a){Ese(t,r,!e.styleUrl||e.styleUrl.startsWith("data:")?location.href:Ny(e.styleUrl,e.accessToken),e).then(function(){o(r)}).catch(a)});return i}function Dse(n,t,e,i,r,o={}){let a=24,s=0,l=e.layers;for(let c=0,d=l.length;c<d;++c){let f=l[c];t.indexOf(f.id)!==-1&&(a=Math.min("minzoom"in f?f.minzoom:0,a),s=Math.max("maxzoom"in f?f.maxzoom:24,s))}return new Promise(function(c,d){let f=function(){let m=n.getSource();if(!m||m.getState()==="error"){d(new Error("Error accessing data for source "+n.get("mapbox-source")));return}if("getTileGrid"in m){let b=m.getTileGrid();if(b){let v=b.getMinZoom();(a>0||v>0)&&n.setMaxResolution(Math.min(zy(Math.max(0,a-1e-12),Ac),zy(Math.max(0,v-1e-12),b.getResolutions()))),s<24&&n.setMinResolution(zy(s,Ac))}}else a>0&&n.setMaxResolution(zy(Math.max(0,a-1e-12),Ac));m instanceof rn||m instanceof kg?Gw(n,e,t,Object.assign({styleUrl:i},o)).then(function(){iVe(n,r),c()}).catch(d):c()};n.set("mapbox-layers",t);let g=r.getLayers();g.getArray().indexOf(n)===-1&&g.push(n),n.getSource()?f():n.once("change:source",f)})}var Lse=Fs(UN());var oVe={shallowDepth:2,safetyDepth:3,deepDepth:6,graphicsStyle:"Paper",boundaries:"Plain",colors:4,colorTable:0};var gf=class n{constructor(t){this.http=t;t.get("assets/s57/chartsymbols.xml",{responseType:"text"}).subscribe(e=>{new Lse.Parser({strict:!1,trim:!0}).parseString(e,(o,a)=>{this.processSymbols(a),this.processLookup(a),this.processColors(a)}),this.refresh.next();let r=new Image;r.onload=()=>{this.chartSymbolsImage=r,this.refresh.next()},r.src="assets/s57/"+this.colorTables[this.selectedColorTable].symbolfile})}chartSymbols=new Map;colorTables=[];selectedColorTable=0;chartSymbolsImage;lookups=[];lookupStartIndex=new Map;styles=new Map;refresh=new ie;options=oVe;attMatch=new RegExp("([A-Za-z0-9]{6})([0-9,\\?]*)");setColorTable(t){t>=0&&t<=5&&this.selectedColorTable}getStyle(t){return this.styles[t]}setStyle(t,e){this.styles[t]=e}isChanged(t,e){let i=!1,r=Object.keys(e);for(let o=0;o<r.length;o++)if(t[r[o]]!==e[r[o]]){i=!0;break}return i}SetOptions(t){this.isChanged(this.options,t)&&(this.options=Object.assign({},t),this.refresh.next())}getLookup(t){return this.lookups[t]}getColor(t){return this.colorTables[this.selectedColorTable].colors.get(t)}processColors(t){t.CHARTSYMBOLS["COLOR-TABLES"][0]["COLOR-TABLE"].forEach(e=>{let i={symbolfile:e["GRAPHICS-FILE"][0].$.NAME,colors:new Map};e.COLOR.forEach(o=>{i.colors.set(o.$.NAME,"RGBA("+o.$.R+", "+o.$.G+", "+o.$.B+",1)")}),this.colorTables.push(i)})}processSymbols(t){t.CHARTSYMBOLS.SYMBOLS[0].SYMBOL.forEach(e=>{let i=e.BITMAP;i&&this.chartSymbols.set(e.NAME[0],{image:null,pivotX:parseInt(i[0].PIVOT[0].$.X),pivotY:parseInt(i[0].PIVOT[0].$.Y),originX:parseInt(i[0].ORIGIN[0].$.X),originY:parseInt(i[0].ORIGIN[0].$.Y),width:parseInt(i[0].$.WIDTH),height:parseInt(i[0].$.HEIGHT),locationX:parseInt(i[0]["GRAPHICS-LOCATION"][0].$.X),locationY:parseInt(i[0]["GRAPHICS-LOCATION"][0].$.Y)})})}compareLookup(t,e){let i=t.lookupTable-e.lookupTable;if(i!==0)return i;let r=t.name.localeCompare(e.name,"en",{sensitivity:"base"});if(r!==0)return r;let o=Object.keys(t.attributes).length,a=Object.keys(t.attributes).length;return o!==a?a-o:t.id-e.id}getGeometryType(t){switch(t){case"Line":return 1;case"Area":return 2;default:return 0}}getLookupTable(t){switch(t){case"Simplified":return 0;case"Paper":return 1;case"Lines":return 2;case"Plain":return 3;default:return 4}}processLookup(t){t.CHARTSYMBOLS.LOOKUPS[0].LOOKUP.forEach(i=>{let r={name:i.$.NAME,instruction:i.INSTRUCTION[0],lookupTable:this.getLookupTable(i["TABLE-NAME"][0]),geometryType:this.getGeometryType(i.TYPE[0]),displayCategory:this.getDisplayCategory(i["DISPLAY-CAT"][0]),attributes:{},id:parseInt(i.$.ID),displayPriority:this.getDisplayPriority(i["DISP-PRIO"][0])},o=i["ATTRIB-CODE"];o&&o.forEach(a=>{r.attributes[a.$.INDEX]=a._}),this.lookups.push(r)}),this.lookups=this.lookups.sort(this.compareLookup);let e="";this.lookups.forEach((i,r)=>{let o=i.lookupTable+","+i.name.toUpperCase()+","+i.geometryType;o!==e&&(this.lookupStartIndex.set(o,r),e=o)})}getSymbol(t){let e=this.chartSymbols.get(t);return e&&this.chartSymbolsImage?(e.image||(e.image=new Image(e.width,e.height),createImageBitmap(this.chartSymbolsImage,e.locationX,e.locationY,e.width,e.height).then(i=>{let r=document.createElement("CANVAS");r.height=e.height,r.width=e.width,r.getContext("2d").drawImage(i,0,0),e.image.src=r.toDataURL()})),e):null}propertyCompare(t,e){let i=typeof t,r;switch(i){case"number":return r=parseInt(e),t-r;case"string":return t.localeCompare(e);default:return-1}}selectLookup(t){let e=t.getProperties(),i={};Object.keys(e).forEach(g=>{i[g.toUpperCase()]=e[g]});let r=t.getGeometry(),o=i.LAYER,a=r.getType(),s=1,l=0;switch(a==="Polygon"?l=2:a==="LineString"&&(l=1),l){case 0:this.options.graphicsStyle==="Paper"?s=1:s=0;break;case 1:s=2;break;case 2:this.options.boundaries==="Plain"?s=3:s=4;break}let c=-1,d=this.lookupStartIndex.get(s+","+o.toUpperCase()+","+l),f=d;if(f){let g=this.lookups[f],m=0;for(;g.name.localeCompare(o,"en",{sensitivity:"base"})===0&&g.geometryType===l&&g.lookupTable===s;){let b=0;Object.keys(g.attributes).forEach(v=>{let E=g.attributes[v],k=this.attMatch.exec(E),P=k[1].toUpperCase(),I=k[2].toUpperCase();if(I===" "){b++;return}I!=="?"&&this.propertyCompare(i[P],I)===0&&b++}),Object.keys(g.attributes).length===b&&b>m&&(c=f,m=b),f++,g=this.lookups[f]}if(c===-1){let b=d,v=this.lookups[b];for(;v.name.localeCompare(o,"en",{sensitivity:"base"})===0&&v.geometryType===l&&v.lookupTable===s;){if(Object.keys(v.attributes).length===0){c=b;break}b++,v=this.lookups[b]}}return c}return-1}getDisplayCategory(t){switch(t){case"Displaybase":return 0;case"Standard":return 1;case"Mariners":return 3;default:return 2}}getDisplayPriority(t){switch(t){case"Group 1":return 1;case"Area 1":return 2;case"Area 2":return 3;case"Point Symbol":return 4;case"Line Symbol":return 5;case"Area Symbol":return 6;case"Routing":return 7;case"Hazards":return 8;case"Mariners":return 9;default:return 0}}static \u0275fac=function(e){return new(e||n)(je(pa))};static \u0275prov=ce({token:n,factory:n.\u0275fac,providedIn:"root"})};var aVe=46,sVe=42,Ww="$lupIndex",QP=class{s57Service;selectedSafeContour=1e3;instructionMatch=new RegExp("([A-Z][A-Z])\\((.*)\\)");constructor(t){this.s57Service=t}getSymbolStyle(t){let e=this.s57Service.getSymbol(t);return e?new Re({image:new nr({width:e.width,height:e.height,img:e.image,opacity:1,anchorXUnits:"pixels",anchorYUnits:"pixels",anchor:[e.pivotX,e.pivotY],declutterMode:"none"})}):null}getTextStyle(t){let e="middle",i=0;t[1]==="3"?(e="top",i=15):t[1]==="1"&&(e="bottom",i=-15);let r="left",o=15;t[0]==="2"?(r="right",o=-15):t[0]==="1"&&(r="center",o=0);let a=new Re({text:new zi({textAlign:r,textBaseline:e,scale:1.5,offsetX:o,offsetY:i})});return a.setZIndex(99),a}getTextStyleTXStyle(t,e){let i=e.split(",");return this.getTextStyle(i.slice(1))}getTextStyleTXText(t,e){let i=e.split(",");return t[i[0]]}stripQuotes(t){return t.substring(1).substring(0,t.length-2)}getTextStyleTEText(t,e){let i=e.split(","),r=t[this.stripQuotes(i[1])],o=this.stripQuotes(i[0]);return!r||!o?null:o.replace(/%[0-9]*.?[0-9]*l?[sfd]/,r)}getTextStyleTEStyle(t,e){let i=e.split(",");return this.getTextStyle(i.slice(2))}getDefaultStyle(){return new Re({fill:new ot({color:"rgba(#224, 209, 14, 0.8)"}),stroke:new Ge({color:"#444",width:1})})}getAreaStyle(t){let e=this.s57Service.getColor(t);return e?new Re({fill:new ot({color:e})}):null}getLineStyle(t){let e=t.split(","),i=this.s57Service.getColor(e[2]),r=parseInt(e[1]),o=e[0],a=null;switch(o){case"DASH":a=[4,4];break;case"SOLD":a=null;break;default:console.debug("Unsupported linestyle:",o)}return new Re({stroke:new Ge({color:i,width:r,lineDash:a})})}GetCSQQUALIN01(t){let e=[],i=t.getProperties(),r=0,o=!1;if(i.QUAPOS&&(r=parseFloat(i.QUAPOS),o=!0),o)2<=r&&r<10&&e.push("LC(LOWACC21");else if(i.layer==="COALNE"){let a=0,s=!1;i.CONRAD&&(r=parseFloat(i.CONRAD),o=!0),s&&a===1&&e.push("LS(SOLD,3,CHMGF)"),e.push("LS(SOLD,1,CSTLN)")}else e.push("LS(SOLD,1,CSTLN)");return e}GetCSQQUAPNT01(t){let e=[],i=t.getProperties(),r=!0,o=0,a=!1;if(i.QUAPOS&&(o=parseInt(i.QUAPOS),a=!0),a&&(2<=o&&o<10&&(r=!1),r))switch(o){case 4:e.push("SY(QUAPOS01)");break;case 5:e.push("SY(QUAPOS02)");break;case 7:case 8:e.push("SY(QUAPOS03)");break;default:e.push("SY(LOWACC03)");break}return e}GetCSQUAPOS01(t){return t.getGeometry().getType()==="LineString"?this.GetCSQQUALIN01(t):this.GetCSQQUAPNT01(t)}GetCSSLCONS03(t){let e=[],i=t.getProperties(),r=t.getGeometry(),o=0,a=!1;if(i.QUAPOS&&(o=parseFloat(i.QUAPOS),a=!0),r.getType()==="Point")a&&2<=o&&o<10&&e.push("SY(LOWACC01)");else if(r.getType()==="Polygon"&&e.push("AP(CROSSX01"),a)2<=o&&o<10&&e.push("LC(LOWACC01)");else{let s=!1,l=0;if(i.QUAPOS&&(l=parseInt(i.CONDTN),s=!0),s&&(l===1||l===2))e.push("LS(DASH,1,CSTLN)");else{let c=!1,d=0;if(i.CATSLC&&(d=parseInt(i.CATSLC),c=!0),c&&(d===6||d===15||d===16))e.push("LS(SOLD,4,CSTLN)");else{let f=!1,g=0;i.WATLEV&&(g=parseInt(i.WATLEV),f=!0),f&&g===2?e.push("LS(SOLD,2,CSTLN)"):f&&(g===3||g===4)?e.push("LS(DASH,2,CSTLN)"):e.push("LS(SOLD,2,CSTLN)")}}}return e}GetCSTOPMAR01(t){let e=null,i=t.getProperties();if(!i.TOPSHP)e="SY(QUESMRK1)";else{let r=!1,o=i.layer;(o==="LITFLT"||o==="LITVES"||o.startsWith("BOY"))&&(r=!0);let a=i.TOPSHP;if(r)switch(a){case 1:e="SY(TOPMAR02)";break;case 2:e="SY(TOPMAR04)";break;case 3:e="SY(TOPMAR10)";break;case 4:e="SY(TOPMAR12)";break;case 5:e="SY(TOPMAR13)";break;case 6:e="SY(TOPMAR14)";break;case 7:e="SY(TOPMAR65)";break;case 8:e="SY(TOPMAR17)";break;case 9:e="SY(TOPMAR16)";break;case 10:e="SY(TOPMAR08)";break;case 11:e="SY(TOPMAR07)";break;case 12:e="SY(TOPMAR14)";break;case 13:e="SY(TOPMAR05)";break;case 14:e="SY(TOPMAR06)";break;case 17:e="SY(TMARDEF2)";break;case 18:e="SY(TOPMAR10)";break;case 19:e="SY(TOPMAR13)";break;case 20:e="SY(TOPMAR14)";break;case 21:e="SY(TOPMAR13)";break;case 22:e="SY(TOPMAR14)";break;case 23:e="SY(TOPMAR14)";break;case 24:e="SY(TOPMAR02)";break;case 25:e="SY(TOPMAR04)";break;case 26:e="SY(TOPMAR10)";break;case 27:e="SY(TOPMAR17)";break;case 28:e="SY(TOPMAR18)";break;case 29:e="SY(TOPMAR02)";break;case 30:e="SY(TOPMAR17)";break;case 31:e="SY(TOPMAR14)";break;case 32:e="SY(TOPMAR10)";break;case 33:e="SY(TMARDEF2)";break;default:e="SY(TMARDEF2)";break}else switch(a){case 1:e="SY(TOPMAR22)";break;case 2:e="SY(TOPMAR24)";break;case 3:e="SY(TOPMAR30)";break;case 4:e="SY(TOPMAR32)";break;case 5:e="SY(TOPMAR33)";break;case 6:e="SY(TOPMAR34)";break;case 7:e="SY(TOPMAR85)";break;case 8:e="SY(TOPMAR86)";break;case 9:e="SY(TOPMAR36)";break;case 10:e="SY(TOPMAR28)";break;case 11:e="SY(TOPMAR27)";break;case 12:e="SY(TOPMAR14)";break;case 13:e="SY(TOPMAR25)";break;case 14:e="SY(TOPMAR26)";break;case 15:e="SY(TOPMAR88)";break;case 16:e="SY(TOPMAR87)";break;case 17:e="SY(TMARDEF1)";break;case 18:e="SY(TOPMAR30)";break;case 19:e="SY(TOPMAR33)";break;case 20:e="SY(TOPMAR34)";break;case 21:e="SY(TOPMAR33)";break;case 22:e="SY(TOPMAR34)";break;case 23:e="SY(TOPMAR34)";break;case 24:e="SY(TOPMAR22)";break;case 25:e="SY(TOPMAR24)";break;case 26:e="SY(TOPMAR30)";break;case 27:e="SY(TOPMAR86)";break;case 28:e="SY(TOPMAR89)";break;case 29:e="SY(TOPMAR22)";break;case 30:e="SY(TOPMAR86)";break;case 31:e="SY(TOPMAR14)";break;case 32:e="SY(TOPMAR30)";break;case 33:e="SY(TMARDEF1)";break;default:e="SY(TMARDEF1)";break}}return e?[e]:[]}GetCSLIGHTS05(t){let e=null,i=t.getProperties();if(i.COLOUR){let r=i.COLOUR.split(",");r.length===1?r[0]==="3"?e="SY(LIGHTS11)":r[0]==="4"?e="SY(LIGHTS12)":(r[0]==="1"||r[0]==="6"||r[0]==="13")&&(e="SY(LIGHTS13)"):r.length===2&&(r.includes("1")&&r.includes("3")?e="SY(LIGHTS11)":r.includes("1")&&r.includes("4")&&(e="SY(LIGHTS12)"))}return e?[e]:[]}GetSeabed01(t,e){let i=["AC(DEPIT)"];return t>=0&&e>0&&(i=["AC(DEPVS)"]),this.s57Service.options.colors===2?t>=this.s57Service.options.safetyDepth&&e>this.s57Service.options.safetyDepth&&(i=["AC(DEPDW)"]):(t>=this.s57Service.options.shallowDepth&&e>this.s57Service.options.shallowDepth&&(i=["AC(DEPMS)"]),t>=this.s57Service.options.safetyDepth&&e>this.s57Service.options.safetyDepth&&(i=["AC(DEPMD)"]),t>=this.s57Service.options.deepDepth&&e>this.s57Service.options.deepDepth&&(i=["AC(DEPDW)"])),i}GetCSDEPCNT02(t){let e=t.getProperties(),i=t.getGeometry(),r=[],o=0,a=-1,s=0,l=0,c=0;return e.OBJL&&(c=parseInt(e.OBJL)),sVe===c&&i.getType()==="LineString"?(e.DRVAL1&&(o=parseFloat(e.DRVAL1)),a=o):e.VALDCO&&(s=parseFloat(e.VALDCO),a=s),a<this.s57Service.options.safetyDepth?(r.push("LS(SOLD,1,DEPCN)"),r):(e.QUAPOS?(l=parseFloat(e.QUAPOS),l>2&&l<10&&(a===this.selectedSafeContour?r.push("LS(DASH,2,DEPSC)"):r.push("LS(DASH,1,DEPCN)"))):a===this.selectedSafeContour?r.push("LS(SOLD,2,DEPSC)"):r.push("LS(SOLD,1,DEPCN)"),r)}getCSDEPARE01(t){let e=[],i=t.getProperties(),r=-1,o=parseFloat(i.DRVAL1);Number.isNaN(o)||(r=o);let a=r+.01,s=parseFloat(i.DRVAL2);Number.isNaN(s)||(a=s),e=this.GetSeabed01(r,a);let l=i.OBJL;return parseInt(l)===aVe&&(e.push("AP(DRGARE01)"),e.push("LS(DASH,1,CHGRF)")),e}evalCS(t,e){let i=[],r=this.instructionMatch.exec(e);if(r&&r.length>1)switch(r[2]){case"LIGHTS05":i=this.GetCSLIGHTS05(t);break;case"DEPCNT02":i=this.GetCSDEPCNT02(t);break;case"DEPARE01":case"DEPARE02":i=this.getCSDEPARE01(t);break;case"TOPMAR01":i=this.GetCSTOPMAR01(t);break;case"SLCONS03":i=this.GetCSSLCONS03(t);break;case"QUAPOS01":i=this.GetCSQUAPOS01(t);break;default:console.debug("Unsupported CS:"+e)}return i}getStylesFromRules(t,e){let i=[];if(t){let r=e.getProperties(),o=t.instruction.split(";");for(let a=0;a<o.length;a++)if(o[a].startsWith("CS")){let s=this.evalCS(e,o[a]);o.splice(a,1,...s)}o.forEach(a=>{let s=this.instructionMatch.exec(a);if(s&&s.length>1){let l=null,c=s[1]+"_"+s[2];if(l=this.s57Service.getStyle(c),!l){switch(s[1]){case"SY":l=this.getSymbolStyle(s[2]);break;case"AC":l=this.getAreaStyle(s[2]);break;case"TX":l=this.getTextStyleTXStyle(r,s[2]);break;case"TE":l=this.getTextStyleTEStyle(r,s[2]);break;case"LS":l=this.getLineStyle(s[2]);break;default:console.debug("Unsupported instruction:"+a)}this.s57Service.setStyle(c,l)}l&&(s[1]==="TE"&&l.getText().setText(this.getTextStyleTEText(r,s[2])),s[1]==="TX"&&l.getText().setText(this.getTextStyleTXText(r,s[2])),i.push(l))}})}return i}layerOrder(t){switch(t.getProperties().layer){case"SEAARE":return 2;case"DEPARE":return 3;case"DEPCNT":return 4;case"LNDARE":return 5;case"BUAARE":return 6;default:return 99}}updateSafeContour(t){let e=t.getProperties();if(e.DRVAL1){let i=e.DRVAL1;return i>=this.s57Service.options.safetyDepth&&i<this.selectedSafeContour&&(this.selectedSafeContour=i),i}if(e.VALDCO){let i=e.VALDCO;return i>=this.s57Service.options.safetyDepth&&i<this.selectedSafeContour&&(this.selectedSafeContour=i),i}return 0}renderOrder=(t,e)=>{let i=this.layerOrder(t),r=this.layerOrder(e),o=this.updateSafeContour(t),a=this.updateSafeContour(e),s=t[Ww],l=t[Ww];if(s||(s=this.s57Service.selectLookup(t),t[Ww]=s),l||(l=this.s57Service.selectLookup(e),e[Ww]=l),i!==r)return i-r;if(s>=0&&l>=0){let c=this.s57Service.getLookup(s).displayPriority,d=this.s57Service.getLookup(s).displayPriority;if(c!==d)return c-d}return o!==a?o-a:0};getStyle=(t,e)=>{let i=t[Ww];if(i>=0){let r=this.s57Service.getLookup(i);if(r.displayCategory===0||r.displayCategory===1||r.displayCategory===3||r.name==="DEPCNT")return this.getStylesFromRules(r,t)}return null}};var JP=class{constructor(t){this.chart=t;this.MinZ=t.minZoom&&t.minZoom>=.1?t.minZoom-.1:t.minZoom,this.MaxZ=t.maxZoom}MinZ;MaxZ},sj=class extends JP{constructor(e,i){super(e);this.s57service=i}CreateLayer(){let e=null;return this.chart.bounds&&this.chart.bounds.length>0&&(e=va(this.chart.bounds,"EPSG:4326","EPSG:3857")),new Lu({declutter:!0,extent:e})}ApplyStyle(e){let i=new kg({url:this.chart.url,minZoom:this.chart.minZoom,maxZoom:this.chart.maxZoom,format:new ag({}),tileSize:256}),r=new QP(this.s57service);e.setSource(i),e.setPreload(0),e.setStyle(r.getStyle),e.setMinZoom(this.chart.minZoom),e.setMaxZoom(23),e.setRenderOrder(r.renderOrder),this.s57service.refresh.subscribe(()=>{i.refresh()})}},eA=class extends JP{constructor(t){super(t)}CreateLayer(){return new Lu}applyVectorStyle(){return new Re({fill:new ot({color:"rgba(#224, 209, 14, 0.8)"}),stroke:new Ge({color:"#444",width:1})})}ApplyStyle(t){let e=new kg({url:this.chart.url,format:new ag({layers:this.chart.layers&&this.chart.layers.length!==0?this.chart.layers:null})});t.setSource(e),t.setPreload(0),t.setStyle(this.applyVectorStyle),t.setMinZoom(this.MinZ),t.setMaxZoom(this.MaxZ)}},lj=class extends eA{constructor(t){super(t)}CreateLayer(){return new Lu({declutter:!0})}ApplyStyle(t){t.set("declutter",!0);let e=new vw(this.chart.url);function i(o,a){let s=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=a.match(s),c=+l[2],d=+l[3],f=+l[4];o.setLoader((g,m,b)=>{o.setState(1),e.getZxy(c,d,f).then(v=>{if(v){let k=o.getFormat().readFeatures(v.data,{extent:g,featureProjection:b});o.setFeatures(k),o.setState(2)}else o.setState(4)})})}let r=new kg({format:new ag,url:"pmtiles://"+this.chart.url+"/{z}/{x}/{y}",tileLoadFunction:i});t.setSource(r),t.setPreload(0),t.setStyle(this.applyVectorStyle),t.setMinZoom(this.chart.minZoom),t.setMaxZoom(this.chart.maxZoom)}},tA=class n{constructor(t){this.s57service=t}CreateVectorLayerStyler(t){return t.url.indexOf(".pmtiles")!==-1?new lj(t):t.type==="S-57"||t.type==="s-57"?new sj(t,this.s57service):new eA(t)}static \u0275fac=function(e){return new(e||n)(je(gf))};static \u0275prov=ce({token:n,factory:n.\u0275fac,providedIn:"root"})};var cVe=["*"],Uy=class n{constructor(t,e,i,r,o){this.changeDetectorRef=t;this.mapComponent=e;this.mapService=i;this.vectorLayerStyleFactory=r;this.s57=o;this.changeDetectorRef.detach()}layers=new Map;charts;zIndex=10;colorMode;wmtsCapabilitesMap=new Map;ngOnInit(){this.parseCharts(this.charts)}ngOnChanges(t){for(let e in t)e==="charts"&&!t[e].firstChange&&this.parseCharts(t[e].currentValue),e==="colorMode"&&this.parseColorMode(t[e].currentValue)}ngOnDestroy(){this.clearlayers()}parseColorMode(t){let e={day:0,dusk:3,sunrise:3,night:4};t in e&&this.s57.setColorTable(e[t])}clearlayers(){let t=this.mapComponent.getMap();this.layers&&t&&(this.layers.forEach(e=>t.removeLayer(e)),t.render(),this.layers.clear())}initPMTilesWebGLLayer(t,e,i,r){let o=new vw(t);function a(l){return new Promise((c,d)=>{let f=new Image;f.addEventListener("load",()=>c(f)),f.addEventListener("error",()=>d(new Error("load failed"))),f.src=l})}function s(l,c,d){return Ae(this,null,function*(){let f=yield o.getZxy(l,c,d),g=new Blob([f.data]),m=URL.createObjectURL(g),b=yield a(m);return URL.revokeObjectURL(m),b})}return new joe({source:new noe({loader:s,wrapX:!0,maxZoom:i,minZoom:e}),style:{},zIndex:r})}initPMTilesXYZLayer(t,e){let i=new vw(t.url);function r(o,a){o.setState(1);let s=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=a.match(s),c=+l[2],d=+l[3],f=+l[4];i.getZxy(c,d,f).then(g=>{if(g){let m=new Blob([g.data]),b=window.URL.createObjectURL(m);o.getImage().src=b,o.setState(2)}else o.setState(4)})}return new Sd({source:new Uh({tileLoadFunction:r,tileSize:[512,512],url:"pmtiles://"+t.url+"/{z}/{x}/{y}",wrapX:!0,maxZoom:t.maxZoom,minZoom:t.minZoom}),zIndex:e,opacity:t.defaultOpacity??1})}parseCharts(){return Ae(this,arguments,function*(t=this.charts){let e=this.mapComponent.getMap(),i=t.map(o=>o[0]),r=[];this.layers.forEach((o,a)=>{i.includes(a)||(e.removeLayer(o),r.push(a))}),r.forEach(o=>this.layers.delete(o));for(let o in t){let a=this.mapService.getLayerByKey("id",t[o][0]);if(a)a.setZIndex(this.zIndex+parseInt(o)),a.setOpacity(t[o][1].defaultOpacity??1);else{if(t[o][0]==="openstreetmap")a=NV(),a.setZIndex(this.zIndex+parseInt(o)),a.setMinZoom(t[o][1].minZoom),a.setMaxZoom(t[o][1].maxZoom),a.setOpacity(t[o][1].defaultOpacity??1);else{let s=t[o][1].minZoom&&t[o][1].minZoom>=.1?t[o][1].minZoom-.1:t[o][1].minZoom,l=t[o][1].maxZoom;if(t[o][1].type.toLowerCase()==="mapstylejson"){let c=new Yp({zIndex:this.zIndex+parseInt(o)});c.set("id",t[o][0]),c.setOpacity(t[o][1].defaultOpacity??1),ZP(c,`${t[o][1].url}`),e.addLayer(c),this.layers.set(t[o][0],c)}else if(t[o][1].format==="pbf"||t[o][1].format==="mvt"){let c=this.vectorLayerStyleFactory.CreateVectorLayerStyler(t[o][1]);a=c.CreateLayer(),c.ApplyStyle(a),a.setZIndex(this.zIndex+parseInt(o)),a.setOpacity(t[o][1].defaultOpacity??1),t[o][1].style&&Gw(a,t[o][1].style)}else{let c;if(t[o][1].type&&t[o][1].type.toLowerCase()==="wms")c=new cw({url:t[o][1].url,params:{LAYERS:t[o][1].layers?t[o][1].layers.join(","):""}});else if(t[o][1].type&&t[o][1].type.toLowerCase()==="wmts"){let d;if(this.wmtsCapabilitesMap.has(t[o][1].url))d=this.wmtsCapabilitesMap.get(t[o][1].url);else try{let m=yield(yield fetch(`${t[o][1].url}?request=GetCapabilities&service=wmts`)).text();if(!m){console.log("Error: GetCapabilities response is empty!");return}d=new sg().read(m),this.wmtsCapabilitesMap.set(t[o][1].url,d)}catch(g){console.log(g);return}let f=Z3(d,{layer:t[o][1].layers[0],matrixSet:"EPSG:3857"});c=new dw(f)}else t[o][1].type&&t[o][1].type.toLowerCase()==="tilejson"?c=new fy({url:t[o][1].url,crossOrigin:"anonymous"}):t[o][1].url.indexOf(".pmtiles")!==-1?a=this.initPMTilesXYZLayer(t[o][1],this.zIndex+parseInt(o)):c=new Uh({url:t[o][1].url});c&&(a=new Sd({source:c,preload:0,zIndex:this.zIndex+parseInt(o),minZoom:s,maxZoom:l,opacity:t[o][1].defaultOpacity??1}))}}a&&(a.set("id",t[o][0]),a.set("chartId",t[o][0]),this.layers.set(t[o][0],a),e.addLayer(a))}}e&&e.render()})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct),N(Eg),N(tA),N(gf))};static \u0275cmp=U({type:n,selectors:[["fb-charts"]],inputs:{charts:"charts",zIndex:"zIndex",colorMode:"colorMode"},standalone:!1,features:[be],ngContentSelectors:cVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var uVe=["*"],Hy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),this.refreshTimer=setInterval(()=>this.onTimerTick(),6e4),Ut(()=>{!this.layerMap||!Array.isArray(this.params())||this.params().forEach(i=>{let r=this.layerMap.get(i.id),o=r.layer.getSource();o&&r.infoLayer.values.sourceType.toLowerCase()==="wms"?o?.updateParams(i.param):o&&r.infoLayer.values.sourceType.toLowerCase()==="wmts"&&o?.updateDimensions(i.param)})})}layerDefs;zIndex=100;params=$t();layerGroup;wmtsCapabilitesMap=new Map;layerMap=new Map;refreshTimer;ngOnInit(){this.parseLayers(this.layerDefs)}ngOnChanges(t){for(let e in t)e==="layerDefs"&&!t[e].firstChange&&this.parseLayers(t[e].currentValue)}ngOnDestroy(){clearInterval(this.refreshTimer),this.clearlayers()}onTimerTick(){let t=Date.now();this.layerMap.forEach((e,i)=>{e.infoLayer.values?.refreshInterval>0&&t-e.lastRefresh>=e.infoLayer.values?.refreshInterval&&(e.layer.getSource()?.refresh(),e.lastRefresh=t)})}clearlayers(){let t=this.mapComponent.getMap();this.layerGroup&&t&&t.removeLayer(this.layerGroup)}parseLayers(){return Ae(this,arguments,function*(t=this.layerDefs){let e=this.mapComponent.getMap();if(!e)return;this.layerGroup||(this.layerGroup=new Yp({zIndex:this.zIndex}),this.layerGroup.set("id","infogroup"),e.addLayer(this.layerGroup));let i=new wr,r=[];for(let a in t){let s=t[a];if(r.push(s[0]),this.layerMap.has(s[0])){let l=this.layerMap.get(s[0]).layer;l.getOpacity()!==(s[1].values?.opacity??1)&&l.setOpacity(s[1].values?.opacity??1),l.getMinZoom()!==(s[1].values?.minZoom??1)&&l.setMinZoom(s[1].values?.minZoom??1),l.getMaxZoom()!==(s[1].values?.maxZoom??24)&&l.setMaxZoom(s[1].values?.maxZoom??24),this.layerMap.set(s[0],{layer:l,lastRefresh:Date.now(),infoLayer:s[1]}),i.push(l)}else{let l=yield this.buildLayer(s,a);l&&(this.layerMap.set(s[0],{layer:l,lastRefresh:Date.now(),infoLayer:s[1]}),i.push(l))}}this.layerGroup.setLayers(i),e.render(),Array.from(this.layerMap).map(a=>a[0]).forEach(a=>{r.includes(a)||this.layerMap.delete(a)})})}buildLayer(t,e){return Ae(this,null,function*(){let i;if(t[1].type==="InfoLayer"){t[1].values?.sourceType?.toLowerCase()==="wms"?i=this.setWMSSource(t):t[1].values?.sourceType?.toLowerCase()==="wmts"?i=yield this.setWMTSSource(t):t[1].values?.sourceType?.toLowerCase()==="xyz"&&(i=new Uh({url:t[1].values?.url}));let r=new Sd({source:i,preload:0,zIndex:this.zIndex+parseInt(e),minZoom:t[1].values?.minZoom??1,maxZoom:t[1].values?.maxZoom??24,opacity:t[1].values?.opacity??1});return r.set("id",t[0]),r}})}removeLayer(t){let e=this.mapComponent.getMap();if(!e||!this.layerMap.has(t))return;this.layerGroup.getLayers().remove(this.layerMap.get(t).layer),e.render()}setWMSSource(t){return new cw({url:t[1].values?.url,params:{LAYERS:t[1].values?.layers?t[1].values?.layers.join(","):""}})}setWMTSSource(t){return Ae(this,null,function*(){let e;if(this.wmtsCapabilitesMap.has(t[1].values?.url))e=this.wmtsCapabilitesMap.get(t[1].values?.url);else try{let o=yield(yield fetch(`${t[1].values?.url}?request=GetCapabilities&service=wmts`)).text();if(!o){console.log("Error: GetCapabilities response is empty!");return}e=new sg().read(o),this.wmtsCapabilitesMap.set(t[1].values?.url,e)}catch(r){console.log(r);return}let i=Z3(e,{layer:t[1].values?.layers[0],matrixSet:"EPSG:3857"});return new dw(i)})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-livelayer"]],inputs:{layerDefs:"layerDefs",zIndex:"zIndex",params:[1,"params"]},standalone:!1,features:[be],ngContentSelectors:uVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var fVe=["*"],Gy=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}charts=[];boundStyles=["red","magenta","blue","purple","green"];ngOnInit(){super.ngOnInit(),this.parseChartBounds(this.charts)}ngOnChanges(e){super.ngOnChanges(e),this.source&&"charts"in e&&(this.source.clear(),this.parseChartBounds(e.charts.currentValue))}parseChartBounds(e=this.charts){let i=[],r=0;i.push(this.buildBackdrop());for(let o of e){let a=this.parseBoundsCoordinates(o[1].bounds);if(a.length===0)continue;let s=new ut({geometry:new Io(a),name:o[1].name});s.setId("chart-bound."+o[0]);let l=[a[0][0][0]+(a[0][0][0]>a[0][1][0]?a[0][0][0]-a[0][1][0]:a[0][1][0]-a[0][0][0])/2,a[0][1][1]];s.set("labelPos",l),s.set("boundColor",this.boundStyles[r]),s.setStyle(this.buildStyle),i.push(s),r++,r=r===this.boundStyles.length?0:r}this.source.addFeatures(i)}buildBackdrop(){let e=new ut({geometry:new Io([Ri([[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]])]),name:""});return e.setId("chart-backdrop"),e.setStyle(new Re({fill:new ot({color:"rgba(255,255,255,0.4)"})})),e}buildStyle(e){return[new Re({stroke:new Ge({color:e.get("boundColor"),width:2}),fill:new ot({color:"rgba(255,255,255,0.1 )"})}),new Re({geometry:new kt(e.get("labelPos")),text:new zi({text:e.get("name"),overflow:!0,offsetX:0,offsetY:-10,fill:new ot({color:e.get("boundColor")}),justify:"left",textBaseline:"top"})})]}parseBoundsCoordinates(e){if(!Array.isArray(e)||e.length!==4||e[0]===-180&&e[1]===-90&&e[2]===180&&e[3]===90)return[];let i=In([[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]],[e[0],e[1]]],0);return[Ri(i)]}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["fb-chart-bounds"]],inputs:{charts:"charts"},standalone:!1,features:[Le,be],ngContentSelectors:fVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var mVe=["*"],Wy=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}tracks;trackStyles;ngOnInit(){super.ngOnInit(),this.labelPrefixes=["track"],this.parseTracks(this.tracks)}ngOnChanges(e){super.ngOnChanges(e),this.source&&"tracks"in e&&(this.source.clear(),this.parseTracks(e.tracks.currentValue))}parseTracks(e=this.tracks){let i=[];for(let r of e){let o=new ut({geometry:new Ca(this.parseCoordinates(r[1].feature.geometry.coordinates)),name:r[1].name});o.setId("track."+r[0]),o.setStyle(this.buildStyle(r[1])),i.push(o)}this.source.addFeatures(i)}buildStyle(e){if(typeof this.trackStyles<"u")return e.feature.properties.skType?this.setTextLabel(this.trackStyles[e.feature.properties.skType],e.feature.properties.name):this.setTextLabel(this.trackStyles.default,e.feature.properties.name);if(this.layerProperties&&this.layerProperties.style)return this.setTextLabel(this.layerProperties.style,e.feature.properties.name);{let i=new Re({stroke:new Ge({color:"rgb(146,11,153)",width:2,lineDash:[5,5]}),text:new zi({text:"",textAlign:"center"})});return this.setTextLabel(i,e.feature.properties.name)}}parseCoordinates(e){let i=[];return e.forEach(r=>i.push(In(r))),Ri(i)}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["fb-tracks"]],inputs:{tracks:"tracks",trackStyles:"trackStyles"},standalone:!1,features:[Le,be],ngContentSelectors:mVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var _Ve=["*"],$y=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}features;collection;resourceSets=[];ngOnInit(){super.ngOnInit(),this.labelPrefixes=["rset"],this.parseResourceSets(this.resourceSets)}ngOnChanges(e){super.ngOnChanges(e),this.source&&"resourceSets"in e&&(this.source.clear(),this.parseResourceSets(e.resourceSets.currentValue))}parseResourceSets(e){this.features=[];for(let i of e)i[2]&&this.parseResources(i[1]);this.source.addFeatures(this.features)}parseResources(e){let i=[],r=0;for(let o of e.values.features){let a;if(o.geometry.type==="Point"&&(a=new ut({geometry:new kt(Jt(o.geometry.coordinates)),name:o.properties.name??`Point ${r}`})),o.geometry.type==="MultiPoint"?a=new ut({geometry:new ud(Ri(o.geometry.coordinates)),name:o.properties.name??`Pt ${r}`}):o.geometry.type==="LineString"?a=new ut({geometry:new ki(Ri(o.geometry.coordinates)),name:o.properties.name??`L${r}`}):o.geometry.type==="MultiLineString"?a=new ut({geometry:new Ca(Ri(o.geometry.coordinates)),name:o.properties.name??`L${r}`}):o.geometry.type==="Polygon"?a=new ut({geometry:new Io(Ri(o.geometry.coordinates)),name:o.properties.name??`P${r}`}):o.geometry.type==="MultiPolygon"&&(a=new ut({geometry:new Pl(Ri(o.geometry.coordinates)),name:o.properties.name??`P${r}`})),!!a){if(a.setId(`rset.${this.collection}.${e.id}.${r}`),typeof e.styles<"u"){let s;typeof o.properties.styleRef<"u"?s=this.buildStyle(e.styles[o.properties.styleRef],o.geometry.type):typeof o.properties.style<"u"?s=this.buildStyle(o.properties.style,o.geometry.type):s=this.buildStyle(e.styles.default,o.geometry.type),a.setStyle(this.setTextLabel(s,o.properties.name))}i.push(a),r++}}this.features=this.features.concat(i)}buildStyle(e,i){let r=new Re;return i==="Point"||i==="MulitPoint"?(r.setImage(new On({radius:e.width??5,fill:new ot({color:e.fill??"blue"}),stroke:new Ge({color:e.stroke??"blue",width:2,lineDash:e.lineDash??[1]})})),r.setText(new zi({text:"",offsetY:-20}))):(r.setFill(new ot({color:e.fill??"blue"})),r.setStroke(new Ge({color:e.stroke??"blue",width:e.width??2,lineDash:e.lineDash??[1]}))),r}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["fb-resource-sets"]],inputs:{collection:"collection",resourceSets:"resourceSets"},standalone:!1,features:[Le,be],ngContentSelectors:_Ve,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var yVe=["*"],qy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.radius(),this.anchorPosition(),this.vesselPosition(),this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))})}layer;source;features;layerReady=new Cn;radius=$t();anchorPosition=$t();vesselPosition=$t();anchorStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedRadius=0;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){this.mapifiedRadius=hy(this.radius()<0?0:this.radius(),this.anchorPosition()),this.mapifiedLine=In([this.anchorPosition(),this.vesselPosition()]);let t=[],e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setStyle(this.buildStyle("line")),t.push(e);let i=new ut({geometry:new kp(Jt(this.anchorPosition()),this.mapifiedRadius)});i.setStyle(this.buildStyle("circle")),t.push(i);let r=new ut({geometry:new kt(Jt(this.anchorPosition()))});r.setId("anchor"),r.setStyle(this.buildStyle("anchor")),t.push(r),this.features=t}buildStyle(t){return this.anchorStyles&&this.anchorStyles[t]?this.anchorStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:new Re({stroke:new Ge({width:2,color:"black",lineDash:[5,5]}),fill:new ot({color:"rgba(0, 255, 0, .3)"})})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-anchor-alarm"]],inputs:{radius:[1,"radius"],anchorPosition:[1,"anchorPosition"],vesselPosition:[1,"vesselPosition"],anchorStyles:"anchorStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:yVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var CVe=["*"],Ky=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;alarms;alarmStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="alarms"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];this.alarms.forEach(e=>{if(!e||!e[1].properties.position)return;let i=new ut({geometry:new kt(Jt([e[1].properties.position.longitude,e[1].properties.position.latitude]))});i.setStyle(this.buildStyle(e[1].type)),i.setId(`alarm.${e[1].path}`),i.set("type",e[1].type),t.push(i)}),this.features=t}buildStyle(t){return this.alarmStyles&&this.alarmStyles[t]?this.alarmStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:new Re({image:new mo({points:3,radius:7,fill:new ot({color:"red"}),stroke:new Ge({color:"white",width:2}),rotateWithView:!1})})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-alarms"]],inputs:{alarms:"alarms",alarmStyles:"alarmStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:CVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var wVe=["*"],Xy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;cpaLines;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="cpaLines"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){if(!Array.isArray(this.cpaLines))return;let t=[];this.cpaLines.forEach(e=>{let i=In(e),r=new ut({geometry:new ki(Ri(i))});r.setStyle(this.buildStyle()),t.push(r);let o=new ut({geometry:new kt(Jt(i[0]))});o.setStyle(this.buildStyle()),t.push(o)}),this.features=t}buildStyle(){let t;return this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:t=new Re({image:new On({radius:10,stroke:new Ge({width:2,color:"red",lineDash:[2,3]}),fill:new ot({color:"rgba(255,0,0,.2)"})}),stroke:new Ge({width:2,color:"red",lineDash:[2,3]}),fill:new ot({color:"rgba(255,0,0,.2)"})}),t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-cpa-alarms"]],inputs:{cpaLines:"cpaLines",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:wVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var SVe=["*"],Yy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;position;radius;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="position"||i==="radius"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[],e=new ut({geometry:new kp(Jt(this.position),hy(this.radius,this.position))});e.setStyle(this.buildStyle()),t.push(e),this.features=t}buildStyle(){let t;return this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:t=new Re({fill:new ot({color:"rgba(255, 255, 255, .1)"}),stroke:new Ge({color:"rgba(242, 153, 10, 1)",width:2,lineDash:[5,5]})}),t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-arrival-circle"]],inputs:{position:"position",radius:"radius",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:SVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var DVe=["*"],Zy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.startPosition(),this.destPosition(),this.color(),this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))})}layer;source;features;layerReady=new Cn;startPosition=$t();destPosition=$t();color=$t();opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];if(Array.isArray(this.startPosition())&&Array.isArray(this.destPosition())){this.mapifiedLine=In([this.startPosition(),this.destPosition()]);let e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setStyle(this.buildStyle()),t.push(e)}this.features=t}buildStyle(){let t;if(this.layerProperties&&this.layerProperties.style)t=this.layerProperties.style;else{let e=this.color()??"gray";t=new Re({stroke:new Ge({width:1,color:e,lineDash:[5,5]}),fill:new ot({color:"rgba(255,0,0,.2)"})})}return t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-xte-path"]],inputs:{startPosition:[1,"startPosition"],destPosition:[1,"destPosition"],color:[1,"color"],opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:DVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var IVe=["*"],Qy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.markerPosition(),this.vesselPosition(),this.showMarker(),this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))}),Ut(()=>{this.labelMinZoom(),this.markerName(),typeof this.mapZoom<"u"&&this.updateLabel()})}layer;source;features=[];layerReady=new Cn;vesselPosition=$t();markerPosition=$t();showMarker=$t();labelMinZoom=$t(10);markerName=$t("");mapZoom=10;bearingStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedRadius=0;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="mapZoom"?this.handleLabelZoomChange(i,t[i]):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];if(Array.isArray(this.vesselPosition())&&Array.isArray(this.markerPosition())){this.mapifiedLine=In([this.vesselPosition(),this.markerPosition()]);let e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setStyle(this.buildStyle("line")),t.push(e);let i=new ut({geometry:new kt(Jt(this.markerPosition()))});i.setId("d.base"),i.setStyle(this.buildStyle("line")),this.updateLabel(i),t.push(i),this.showMarker&&(i=new ut({geometry:new kt(Jt(this.markerPosition()))}),i.setId("dest.point"),i.setStyle(this.buildStyle("marker")),t.push(i))}this.features=t}buildStyle(t){return this.bearingStyles&&this.bearingStyles[t]?this.bearingStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:[new Re({stroke:new Ge({color:"white",width:6})}),new Re({image:new On({radius:5,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"rgba(221, 149, 0, 1)"})}),stroke:new Ge({color:"rgba(221, 149, 0, 1)",width:2}),text:new zi({text:"",offsetX:0,offsetY:-29})})]}handleLabelZoomChange(t,e){t==="mapZoom"&&typeof this.labelMinZoom()<"u"&&(e.currentValue>=this.labelMinZoom()&&e.previousValue<this.labelMinZoom()||e.currentValue<this.labelMinZoom()&&e.previousValue>=this.labelMinZoom())&&this.updateLabel()}updateLabel(t){if(!t&&this.source&&(t=this.source.getFeatureById("d.base")),!!t)try{let e=t.getStyle();if(!e)return;e=Array.isArray(e)?e[1]:e;let i=e.getText();if(!i)return;i?.setText(Math.abs(this.mapZoom)>=this.labelMinZoom()?this.markerName()??"":""),e.setText(i),t.setStyle(e)}catch{}}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-bearing-line"]],inputs:{vesselPosition:[1,"vesselPosition"],markerPosition:[1,"markerPosition"],showMarker:[1,"showMarker"],labelMinZoom:[1,"labelMinZoom"],markerName:[1,"markerName"],mapZoom:"mapZoom",bearingStyles:"bearingStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:IVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var PVe=["*"],Jy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features=[];layerReady=new Cn;lines;mapZoom=10;laylineStyles;position;twd;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="lines"||i==="twd"||i==="position"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="mapZoom"||(i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue);this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[],e=0;this.lines&&(this.lines.port&&Array.isArray(this.lines.port)&&this.lines.port.forEach(i=>{let r=In(i),o=new ut({geometry:new ki(Ri(r))});o.setStyle(this.buildStyle(e===0?"port":"starboard")),t.push(o),e++}),e=0,this.lines.starboard&&Array.isArray(this.lines.starboard)&&this.lines.starboard.forEach(i=>{let r=In(i),o=new ut({geometry:new ki(Ri(r))});o.setStyle(this.buildStyle(e===0?"port":"starboard")),t.push(o),e++})),this.features=t}buildStyle(t){return this.laylineStyles&&this.laylineStyles[t]?this.laylineStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:void 0}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-layline"]],inputs:{lines:"lines",mapZoom:"mapZoom",laylineStyles:"laylineStyles",position:"position",twd:"twd",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:PVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var OVe=["*"],ev=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features=[];layerReady=new Cn;line;mapZoom=10;lineStyle;position;twd;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)["lines","position","twd"].includes(i)?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="mapZoom"||(i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue);this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];if(Array.isArray(this.line)){let e=In(this.line),i=new ut({geometry:new ki(Ri(e))});i.setStyle(this.buildStyle()),t.push(i)}this.features=t}buildStyle(){return this.lineStyle?this.lineStyle:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:void 0}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-target-angle"]],inputs:{line:"line",mapZoom:"mapZoom",lineStyle:"lineStyle",position:"position",twd:"twd",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:OVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var $w=Fs(au());var LVe=["*"],tv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features=[];layerReady=new Cn;points=[];reverse=!1;pointIndex=0;mapZoom=10;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="points"||i==="reverse"||i==="pointIndex"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="mapZoom"?this.handleLabelZoomChange(i):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[],e=[];if(this.points&&this.points.length!==0){if(this.points.length<4)e.push(0);else for(let i=1;i<this.points.length-2;i=i+2)e.push(i);e.forEach(i=>{let r=(0,$w.getCenter)(this.points.slice(i,i+2)),o=new ut({geometry:new kt(Jt([r.longitude,r.latitude]))});o.setId(`dot.${i}`),o.setStyle(this.buildStyle(i)),t.push(o)})}this.features=t}buildStyle(t){return new Re({image:new mo({points:3,radius:7,fill:new ot({color:"blue"}),stroke:new Ge({color:"white",width:1}),rotateWithView:!0,rotation:this.getOrientation(t)})})}setRotation(t,e){if(!t)return t;let i=t.clone(),r=i.getImage();if(r){let o=this.getOrientation(e);r.setRotation(o??0),i.setImage(r)}return i}getOrientation(t){let e=this.reverse?(0,$w.getRhumbLineBearing)(this.points[t+1],this.points[t]):(0,$w.getRhumbLineBearing)(this.points[t],this.points[t+1]);return Math.PI/180*e}handleLabelZoomChange(t){t==="labelMinZoom"&&typeof this.mapZoom<"u"}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-route-direction"]],inputs:{points:"points",reverse:"reverse",pointIndex:"pointIndex",mapZoom:"mapZoom",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:LVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var NVe=["*"],Nse={src:"./assets/img/vessels/self.png",anchor:[9.5,22.5],anchorXUnits:"pixels",anchorYUnits:"pixels",size:[50,50],scale:.9,rotateWithView:!0},VVe=new Re({image:new nr({src:"./assets/img/vessels/self_blur.png",anchor:[9.5,22.5],anchorXUnits:"pixels",anchorYUnits:"pixels",size:[50,50],scale:.75,rotateWithView:!0})}),BVe=new Re({image:new nr({src:"./assets/img/vessels/self_fixed.png",anchor:[22.5,50],anchorXUnits:"pixels",anchorYUnits:"pixels",size:[50,50],scale:.5,rotateWithView:!1})}),iv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;id;activeId;position;heading=0;vesselStyles;vesselLines;fixedLocation;iconScale=1;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;vessel;headingLine;selfStyle;ngOnInit(){let t=[];this.parseVessel(),this.vessel&&t.push(this.vessel),this.renderVesselLines(),this.headingLine&&t.push(this.headingLine),this.source=new rn({features:t}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let e=this.mapComponent.getMap();this.layer&&e&&(e.addLayer(this.layer),e.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="id"||i==="activeId"||i==="position"||i==="heading"?this.source&&this.parseVessel():i==="vesselLines"?this.source&&this.renderVesselLines():i==="vesselStyles"||i==="iconScale"?this.source&&(this.generateSelfStyle(),this.parseVessel()):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseVessel(){this.vessel||(this.vessel=new ut(new kt(Jt([this.position[0]??0,this.position[1]??0])))),this.position&&Array.isArray(this.position)&&this.position.length>1&&this.vessel.getGeometry().setCoordinates(Jt([this.position[0],this.position[1]])),this.vessel.setId(this.id??"self");let t=this.buildStyle();if(t){let e=t.getImage();e&&(this.fixedLocation?e.setRotation(0):e.setRotation(this.heading)),this.vessel.setStyle(t)}}generateSelfStyle(){this.iconScale&&(Nse.scale=Math.abs(this.iconScale)),this.selfStyle=new Re({image:new nr(Nse)})}buildStyle(){this.selfStyle||this.generateSelfStyle();let t=this.selfStyle;return this.vesselStyles?this.fixedLocation?this.vesselStyles.fixed&&(t=this.vesselStyles.fixed):this.activeId&&this.activeId!==this.id?this.vesselStyles.inactive&&(t=this.vesselStyles.inactive):this.vesselStyles.default&&(t=this.vesselStyles.default):this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:this.fixedLocation?t=BVe:this.activeId&&this.activeId!==this.id&&(t=VVe),t}removeFeature(t){this.source&&this.source.removeFeature(t)}renderVesselLines(){this.vesselLines&&("heading"in this.vesselLines?(this.headingLine=this.updateLine(this.headingLine,this.vesselLines.heading),this.headingLine.setStyle(new Re({stroke:new Ge({color:"rgba(221, 99, 0, 0.5)",width:4})}))):this.removeFeature(this.headingLine))}updateLine(t,e){if(!(!e||!Array.isArray(e)))return t?t.getGeometry().setCoordinates(Ri(In(e))):t=new ut(new ki(Ri(In(e)))),t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-vessel"]],inputs:{id:"id",activeId:"activeId",position:"position",heading:"heading",vesselStyles:"vesselStyles",vesselLines:"vesselLines",fixedLocation:"fixedLocation",iconScale:"iconScale",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:NVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var zVe=["*"],nv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;localTrail;serverTrail;trailStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;trailLocal;trailServer;ngOnInit(){let t=[];this.parseTrails(),this.trailLocal&&t.push(this.trailLocal),this.trailServer&&t.push(this.trailServer),this.source=new rn({features:t}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let e=this.mapComponent.getMap();this.layer&&e&&(e.addLayer(this.layer),e.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="localTrail"&&this.source&&this.parseLocalTrail(),i==="serverTrail"&&this.source&&this.parseServerTrail(),i==="trailStyles"?this.source&&this.parseTrails():i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseTrails(){this.parseLocalTrail(),this.parseServerTrail()}parseLocalTrail(){if(!this.localTrail)return;let t=Ri(In(this.localTrail));this.trailLocal?(this.trailLocal=this.source.getFeatureById("trail.self.local"),this.localTrail&&Array.isArray(this.localTrail)&&this.trailLocal.getGeometry().setCoordinates(t)):(this.trailLocal=new ut(new ki(t)),this.trailLocal.setId("trail.self.local"),this.trailLocal.setStyle(this.buildStyle("local")))}parseServerTrail(){if(!this.serverTrail)return;let t=this.serverTrail.map(e=>Ri(In(e)));this.trailServer?(this.trailServer=this.source.getFeatureById("trail.self.server"),this.serverTrail&&Array.isArray(this.serverTrail)&&this.trailServer.getGeometry().setCoordinates(t)):(this.trailServer=new ut(new Ca(t)),this.trailServer.setId("trail.self.server"),this.trailServer.setStyle(this.buildStyle("server")))}buildStyle(t="local"){let e;return t==="server"?this.trailStyles&&this.trailStyles.server?e=this.trailStyles.server:e=new Re({stroke:new Ge({color:"rgb(252, 3, 132)",width:1,lineDash:[4,4]})}):this.trailStyles&&this.trailStyles.local?e=this.trailStyles.local:e=new Re({stroke:new Ge({color:"rgb(252, 3, 132)",width:1,lineDash:[2,2]})}),e}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-vessel-trail"]],inputs:{localTrail:"localTrail",serverTrail:"serverTrail",trailStyles:"trailStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:zVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var HVe=["*"],rv=class n extends _o{constructor(e,i){super(i,e);this.changeDetectorRef=e;this.mapComponent=i;this.labelPrefixes=["race-startline"]}startLine;racecourseStyles;ngOnInit(){super.ngOnInit(),this.parseCourse()}ngOnChanges(e){super.ngOnChanges(e),["startLine"].some(i=>i in e)&&this.parseCourse()}parseCourse(){if(!this.source)return;this.source.clear();let e=[];if(Array.isArray(this.startLine)&&this.startLine.length===2){let i=new ut({geometry:new ki(Ri(In(this.startLine))),name:"start"});i.setId("race-start-line"),i.setStyle(this.buildStyle(i)),e.push(i),this.source.addFeatures(e),this.updateLabels()}}buildStyle(e){let i=e.getGeometry(),r=[],o,a;if(typeof this.racecourseStyles>"u")return this.layerProperties&&this.layerProperties.style?this.layerProperties.style:r;let s=Array.isArray(this.racecourseStyles.startLine)?this.racecourseStyles.startLine[this.racecourseStyles.startLine.length-1]:this.racecourseStyles.startLine;a=s.getStroke().getWidth()+1;let l="white";o=new ot({color:s?.getStroke().getColor()}),r.push(new Re({stroke:new Ge({color:l,width:a})})),r.push(this.racecourseStyles.startLine);let c=i.getCoordinates().length;return i.forEachSegment((d,f)=>{r.push(new Re({geometry:new kt(d),image:new mo({radius:4,stroke:new Ge({width:1,color:l}),fill:o,points:4,angle:Math.PI/4})})),r.push(new Re({geometry:new kt(f),image:new On({radius:3,stroke:new Ge({width:1,color:l}),fill:o})}))}),r}static \u0275fac=function(i){return new(i||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["racing-start-line"]],inputs:{startLine:"startLine",racecourseStyles:"racecourseStyles"},standalone:!1,features:[Le,be],ngContentSelectors:HVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var WVe=["*"],Oc=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i;this.labelPrefixes=[]}targets=new Map;targetContext;targetStyles;focusId;inactiveTime=18e4;filterByShipType;filterShipTypes;filterIds;updateIds=[];staleIds=[];removeIds=[];ngOnInit(){super.ngOnInit(),this.reloadTargets()}ngOnChanges(e){if(super.ngOnChanges(e),this.layer){let i=Object.keys(e);i.includes("targets")&&e.targets.previousValue.size===0||i.includes("filterShipTypes")||i.includes("filterByShipType")?this.reloadTargets():(i.includes("removeIds")&&this.removeTargetIds(e.removeIds.currentValue),i.includes("updateIds")&&this.updateTargetIds(e.updateIds.currentValue),i.includes("staleIds")&&this.updateTargetIds(e.staleIds.currentValue,!0),(i.includes("targetStyles")&&!e.targetStyles.firstChange||i.some(r=>["focusId","filterIds","inactiveTime"].includes(r)))&&this.updateTargetIds(this.extractKeys(this.targets)))}}extractKeys(e){let i=[];return e.forEach((r,o)=>{o.includes(this.targetContext)&&i.push(o)}),i}okToRenderTarget(e){let i=r=>Array.isArray(this.filterShipTypes)&&this.filterShipTypes.includes(-999)?"imo"in this.targets.get(r).registrations:!0;if(this.filterByShipType&&Array.isArray(this.filterShipTypes)){let r=Math.floor(this.targets.get(e).type.id/10)*10;return this.filterShipTypes.includes(r)&&i(e)}return this.filterIds&&Array.isArray(this.filterIds)?this.filterIds.includes(e)&&i(e):i(e)}isStale(e){if(isNaN(this.inactiveTime))return!1;let i=new Date().valueOf();return e.lastUpdated.valueOf()<i-this.inactiveTime}buildLabel(e){return e.name??e.callsignVhf??e.callsignHf??e.mmsi??""}reloadTargets(){!this.targets||!this.source||(this.source.clear(),this.onReloadTargets())}onReloadTargets(){}updateTargetIds(e,i=!1){!this.source||!Array.isArray(e)||this.onUpdateTargets(e,i)}onUpdateTargets(e,i){}removeTargetIds(e){!this.source||!Array.isArray(e)||this.onRemoveTargets(e)}onRemoveTargets(e){}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["sk-ais-target-base"]],inputs:{targets:"targets",targetContext:"targetContext",targetStyles:"targetStyles",focusId:"focusId",inactiveTime:"inactiveTime",filterByShipType:"filterByShipType",filterShipTypes:"filterShipTypes",filterIds:"filterIds",updateIds:"updateIds",staleIds:"staleIds",removeIds:"removeIds"},standalone:!1,features:[Le,be],ngContentSelectors:WVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var $Ve=["*"],ov=class n extends Oc{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}flagged;ngOnChanges(e){super.ngOnChanges(e),"flagged"in e&&this.updateFlags()}updateFlags(){this.flagged&&(this.source&&this.source.clear(),this.flagged.forEach(e=>{this.addFlagWithId(e)}))}addFlagWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e);if(this.okToRenderTarget(e)&&i.position){let r=i.callsignVhf??i.callsignHf??"......",o=new ut({geometry:new kt(Jt(i.position)),name:i.name});o.setId("flag-"+e),o.set("name",r,!0),o.setStyle(this.buildStyle(r).clone()),this.source.addFeature(o)}}buildStyle(e){return new Re({image:new nr({src:"./assets/img/vessels/ais_flag.svg",rotateWithView:!1,scale:.2,anchor:[27,187],anchorXUnits:"pixels",anchorYUnits:"pixels"}),text:new zi({text:e??"",offsetY:-25,offsetX:20})})}onReloadTargets(){this.flagged.forEach(e=>{this.addFlagWithId(e)})}onUpdateTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)&&this.flagged.includes(i)){let r=this.source.getFeatureById("flag-"+i);if(this.okToRenderTarget(i)){if(this.targets.has(i))if(r){let o=this.targets.get(i).position;o&&r.setGeometry(new kt(Jt(o)))}else this.addFlagWithId(i)}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{let r=this.source.getFeatureById("flag-"+i);r&&this.source.removeFeature(r)})}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["sk-ais-flags"]],inputs:{flagged:"flagged"},standalone:!1,features:[Le,be],ngContentSelectors:$Ve,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var KVe=["*"],av=class n extends Oc{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}vectorApparent=!1;ngOnChanges(e){super.ngOnChanges(e),"vectorApparent"in e&&this.onUpdateTargets(this.extractKeys(this.targets))}calcVector(e){let i=this.vectorApparent?typeof e.wind.awa<"u"?e.orientation+e.wind.awa:null:e.wind.direction;if(typeof i!="number")return[];let r=_n.destCoordinate(e.position,i,R3[Math.floor(this.mapZoom)]);return[Jt(e.position),Jt(r)]}addWindVectorWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e);if(this.okToRenderTarget(e)&&i.position){let r=this.calcVector(i);if(r.length!==2)return;let o=new ut(new ki(r));o.setId("wind-"+e),o.setStyle(this.buildVectorStyle()),this.source?.addFeature(o)}}buildVectorStyle(){let e=this.vectorApparent?"16, 75, 16":"128, 128, 0";return new Re({stroke:new Ge({width:2,color:`rgba(${e},1)`})})}onReloadTargets(){this.extractKeys(this.targets).forEach(e=>{this.addWindVectorWithId(e)})}onUpdateTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source?.getFeatureById("wind-"+i);if(this.okToRenderTarget(i)){if(this.targets.has(i))if(r){let o=this.targets.get(i),a=this.targets.get(i).position,s=this.calcVector(o);a&&s.length===2&&r.setGeometry(new ki(s)),r.setStyle(this.buildVectorStyle())}else this.addWindVectorWithId(i)}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{let r=this.source.getFeatureById("wind-"+i);r&&this.source.removeFeature(r)})}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["sk-ais-wind"]],inputs:{vectorApparent:"vectorApparent"},standalone:!1,features:[Le,be],ngContentSelectors:KVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var YVe=["*"],sv=class n extends Oc{constructor(e,i,r){super(e,i);this.mapComponent=e;this.changeDetectorRef=i;this.mapImages=r}ngOnInit(){super.ngOnInit(),this.labelPrefixes=[this.targetContext]}onReloadTargets(){this.extractKeys(this.targets).forEach(e=>{this.addTargetWithId(e)})}onUpdateTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById(i);if(this.okToRenderTarget(i)){if(this.targets.has(i))if(r){let o=this.targets.get(i),a=this.buildLabel(o);o.position&&r.setGeometry(new kt(Jt(o.position)));let s=this.buildStyle(o).clone();r.set("name",a,!0),r.setStyle(this.setTextLabel(this.setRotation(s,o.orientation),a))}else this.addTargetWithId(i)}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById(i);r&&this.source.removeFeature(r)}})}addTargetWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e),r=this.buildLabel(i);if(i.position){let o=new ut({geometry:new kt(Jt(i.position)),name:i.name});o.setId(e),o.set("name",r,!0);let a=this.buildStyle(i).clone();o.setStyle(this.setTextLabel(this.setRotation(a,i.orientation),r)),this.source.addFeature(o)}}buildStyle(e){let i=this.mapImages.getAtoN(e.type?.id,e.virtual);if(i&&typeof this.targetStyles>"u")return i?new Re({image:i,text:new zi({text:"",offsetX:0,offsetY:-18})}):void 0;let r,o=this.isStale(e);return typeof this.targetStyles<"u"?o?r=this.targetStyles.inactive??this.targetStyles.default:r=this.targetStyles.default:this.layerProperties&&this.layerProperties.style?r=this.layerProperties.style:r=new Re({image:new mo({points:3,radius:7,fill:new ot({color:"magenta"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}),r}static \u0275fac=function(i){return new(i||n)(N(ct),N(le),N(Vu))};static \u0275cmp=U({type:n,selectors:[["sk-ais-targets"]],standalone:!1,features:[Le],ngContentSelectors:YVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var QVe=["*"],lv=class n extends Oc{constructor(e,i,r){super(e,i);this.mapComponent=e;this.changeDetectorRef=i;this.mapImages=r}cogLineLength=0;ngOnInit(){super.ngOnInit(),this.labelPrefixes=["ais-"]}ngOnChanges(e){super.ngOnChanges(e),"cogLineLength"in e&&(this.cogLineLength=e.cogLineLength.currentValue??0,this.onUpdateTargets(this.extractKeys(this.targets)))}onReloadTargets(){this.extractKeys(this.targets).forEach(e=>{this.addTargetWithId(e)})}onUpdateTargets(e){this.source&&e.forEach(i=>{if(i.includes(this.targetContext))if(this.okToRenderTarget(i)){if(this.targets.has(i)){let r=this.source.getFeatureById("ais-"+i);if(r){let o=this.targets.get(i),a=this.buildLabel(o);o.position&&r.setGeometry(new kt(Jt(o.position)));let s=this.buildVesselStyle(o,a,this.isStale(o)).clone();r.set("name",a,!0),r.setStyle(this.setTextLabel(this.setRotation(s,o.orientation),a)),this.parseCogLine(i,o)}else this.addTargetWithId(i)}}else this.onRemoveTargets([i])})}onRemoveTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById("ais-"+i);r&&this.source.removeFeature(r),r=this.source.getFeatureById("cog-"+i),r&&this.source.removeFeature(r)}})}onLabelZoomThreshold(e){super.updateLabels(),this.toggleCogLines(e)}addTargetWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e);if(this.okToRenderTarget(e)&&i.position){let r=this.buildLabel(i),o=new ut({geometry:new kt(Jt(i.position)),name:i.name});o.setId("ais-"+e),o.set("name",r,!0);let a=this.buildVesselStyle(i,r,this.isStale(i)).clone();o.setStyle(this.setTextLabel(this.setRotation(a,i.orientation),r)),this.source.addFeature(o),this.parseCogLine(e,i)}}buildVesselStyle(e,i,r=!1){let o,a=e.state==="moored",s=e.type.id?Math.abs(Math.floor(e.type.id/10)*10):-1,l=e.id===this.focusId?this.mapImages.getVessel("focused"):r?this.mapImages.getVessel("inactive",a):e.buddy?this.mapImages.getVessel("buddy",a):s===-1?this.mapImages.getVessel("default",a):this.mapImages.getVessel(s,a);return l&&typeof this.targetStyles>"u"?l?new Re({image:l,text:new zi({text:"",offsetX:0,offsetY:a?12:22})}):void 0:(typeof this.targetStyles<"u"?e.id===this.focusId&&this.targetStyles.focus?o=this.targetStyles.focus:r?o=this.targetStyles.inactive??this.targetStyles.default:e.type&&this.targetStyles[s]?e.state&&this.targetStyles[s][e.state]?o=this.targetStyles[s][e.state]:o=this.targetStyles[s].default:e.buddy&&this.targetStyles.buddy?o=this.targetStyles.buddy:e.state&&this.targetStyles[e.state]?o=this.targetStyles[e.state]:o=this.targetStyles.default:this.layerProperties&&this.layerProperties.style?o=this.layerProperties.style:e.id===this.focusId?o=new Re({image:new mo({points:3,radius:4,fill:new ot({color:"red"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}):r?o=new Re({image:new mo({points:3,radius:4,fill:new ot({color:"orange"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}):o=new Re({image:new mo({points:3,radius:4,fill:new ot({color:"magenta"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}),o)}parseCogLine(e,i){if(!this.source||!i.vectors.cog)return;let r=this.source.getFeatureById("cog-"+e);if(!this.okToRenderCogLines||!this.okToRenderTarget(e)||!i.position){r&&this.source.removeFeature(r);return}r?(r.setGeometry(new ki(Ri(i.vectors.cog))),r.setStyle(this.buildCogLineStyle(e,r))):(r=new ut(new ki(Ri(i.vectors.cog))),r.setId("cog-"+e),r.setStyle(this.buildCogLineStyle(e,r)),this.source.addFeature(r))}toggleCogLines(e){e?this.targets.forEach((i,r)=>{this.parseCogLine(r,i)}):this.source.forEachFeature(i=>{i.getId().includes("cog-")&&this.source.removeFeature(i)})}buildCogLineStyle(e,i){let r=this.okToRenderTarget(e)&&this.okToRenderCogLines()?.7:0,o=i.getGeometry(),a=`rgba(0,0,0, ${r})`,s=[];return s.push(new Re({stroke:new Ge({color:a,width:1,lineDash:[5,5]})})),o.forEachSegment((l,c)=>{s.push(new Re({geometry:new kt(c),image:new On({radius:2,stroke:new Ge({color:a,width:1}),fill:new ot({color:"transparent"})})}))}),s}okToRenderCogLines(){return this.cogLineLength!==0&&this.mapZoom>=this.labelMinZoom}static \u0275fac=function(i){return new(i||n)(N(ct),N(le),N(Vu))};static \u0275cmp=U({type:n,selectors:[["sk-ais-vessels"]],inputs:{cogLineLength:"cogLineLength"},standalone:!1,features:[Le,be],ngContentSelectors:QVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var eBe=["*"],cv=class n extends Oc{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}tracks=new Map;tracksMinZoom=10;mapZoom=10;showTracks=!0;ngOnInit(){super.ngOnInit(),this.reloadTracks()}ngOnChanges(e){if(super.ngOnChanges(e),this.layer){let i=Object.keys(e);i.includes("tracks")&&e.tracks.previousValue.size===0?this.reloadTracks():(i.includes("tracksMinZoom")&&typeof this.mapZoom<"u"&&this.reloadTracks(),i.includes("mapZoom")&&typeof this.tracksMinZoom<"u"&&(e.mapZoom.currentValue>=this.tracksMinZoom&&e.mapZoom.previousValue<this.tracksMinZoom?this.reloadTracks():e.mapZoom.currentValue<this.tracksMinZoom&&e.mapZoom.previousValue>=this.tracksMinZoom&&this.source.clear()))}}okToRenderTracks(){return this.mapZoom>=this.tracksMinZoom}reloadTracks(){!this.tracks||!this.source||(this.source.clear(),this.okToRenderTracks&&this.onUpdateTargets(this.extractKeys(this.tracks)))}onUpdateTargets(e){this.okToRenderTracks&&e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById("track-"+i);if(this.okToRenderTarget(i)){if(this.tracks.has(i)){let o=this.tracks.get(i);r?(r.setGeometry(new Ca(this.parseCoordinates(o))),r.setStyle(this.buildStyle(i))):this.addTrackWithId(i)}}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{let r=this.source.getFeatureById("track-"+i);r&&this.source.removeFeature(r)})}addTrackWithId(e){if(!e.includes(this.targetContext)||!this.tracks.has(e))return;let i=this.tracks.get(e),r=new ut({geometry:new Ca(this.parseCoordinates(i))});r.setId("track-"+e),r.setStyle(this.buildStyle(e)),this.source.addFeature(r)}buildStyle(e){let i=e.indexOf("aircraft")!==-1?"0, 0, 255":"255, 0, 255",r=this.mapZoom<this.tracksMinZoom?`rgba(${i},0)`:`rgba(${i},1)`;if(r=this.showTracks?`rgba(${i},1)`:`rgba(${i},0)`,this.layerProperties&&this.layerProperties.style){let o=this.layerProperties.style.clone(),a=o.getStroke();return a.setColor(r),o.setStroke(a),o}else return new Re({stroke:new Ge({width:1,color:r,lineDash:[2,2]})})}parseCoordinates(e){let i=e.map(r=>{let o=[];return r.forEach(a=>o.push(In(a))),o});return Ri(i)}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["ais-targets-track"]],inputs:{tracks:"tracks",tracksMinZoom:"tracksMinZoom",mapZoom:"mapZoom",showTracks:"showTracks"},standalone:!1,features:[Le,be],ngContentSelectors:eBe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var Bse=Fs(au());var iBe=["*"],Vse={labelText:{color:"rgba(26, 26, 1, 1)"}},dv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.theme=this.darkMode()?Ag:Vse,this.parseValues()})}layer;source;features;theme=Vse;darkMode=$t(!1);layerReady=new Cn;position;maxCircles=4;minZoom;mapZoom;units="m";opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)["position","mapZoom","minZoom","units","maxCircles"].includes(i)?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let e=this.mapComponent.getMap().getView().getResolutionForZoom(this.mapZoom),i=[];if(this.mapZoom>=this.minZoom){let r=e>300?1e4:e>100?5e3:e>40?2e3:e>20?1e3:e>10?500:250,o=this.buildCircleStyle();for(let a=1;a<=this.maxCircles;++a){let s=r*a,l=new ut({geometry:new kp(Jt(this.position),hy(s,this.position))});l.setStyle(o),i.push(l);let c=(0,Bse.computeDestinationPoint)(this.position,s,180),d=new ut({geometry:new kt(Jt([c.longitude,c.latitude]))});d.setStyle(this.buildTextStyle(s)),i.push(d)}}this.features=i}buildCircleStyle(){let t;return this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:t=new Re({fill:new ot({color:"transparent"}),stroke:new Ge({color:"rgba(152, 153, 10, 1)",width:1.5,lineDash:[2,3]})}),t}buildTextStyle(t){return new Re({fill:new ot({color:"rgba(255, 255, 255, 0)"}),stroke:new Ge({color:"rgba(255, 255, 255, 0)"}),text:new zi({text:t?this.formatLabel(t):"",offsetX:0,offsetY:0,fill:new ot({color:this.theme.labelText.color})})})}formatLabel(t){return this.units==="m"?t>=1e3?`${(t/1e3).toFixed(1)} km`:`${t} m`:`${Ct.kmToNauticalMiles(t/1e3).toFixed(1)} NM`}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-range-circles"]],inputs:{darkMode:[1,"darkMode"],position:"position",maxCircles:"maxCircles",minZoom:"minZoom",mapZoom:"mapZoom",units:"units",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:iBe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var zse=Fs(au());var rBe=["*"],jse={labelText:{color:"rgba(26, 26, 1, 1)"}},uv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.coords(),this.cogTime(),this.parseInput(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))}),Ut(()=>{this.labelMinZoom(),typeof this.mapZoom<"u"&&this.updateLabel()}),Ut(()=>{this.theme=this.darkMode()?Ag:jse,this.updateLabel()})}layer;source;features=[];theme=jse;layerReady=new Cn;coords=$t();cogTime=$t();units=$t("m");labelMinZoom=$t(10);darkMode=$t(!1);mapZoom=10;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;labelText=oe("");mapifiedLine=[];ngOnInit(){this.parseInput(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="mapZoom"?this.handleLabelZoomChange(i,t[i]):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseInput(){let t=[];if(Array.isArray(this.coords())&&this.coords().length!==0){this.mapifiedLine=In(this.coords()),this.labelText.update(()=>`${this.formatNumber((0,zse.getDistance)(this.coords()[0],this.coords()[1]))} ${this.cogTime()>=60?this.cogTime()/60+"hr":this.cogTime()+"min"}`);let e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setId("cogSelf"),e.setStyle(i=>{let r="rgba(204, 12, 225, 0.7)",o=i.getGeometry(),a=[];return a.push(new Re({stroke:new Ge({color:r,width:1})})),o.forEachSegment((s,l)=>{a.push(new Re({geometry:new kt(l),image:new On({radius:2,stroke:new Ge({color:r,width:1}),fill:new ot({color:"transparent"})}),text:this.buildLabelStyle()}))}),a}),t.push(e)}this.features=t}formatNumber(t){return this.units()==="m"?t>=1e3?`${(t/1e3).toFixed(1)} km`:`${t} m`:`${Ct.kmToNauticalMiles(t/1e3).toFixed(1)} NM`}handleLabelZoomChange(t,e){t==="mapZoom"&&typeof this.labelMinZoom()<"u"&&(e.currentValue>=this.labelMinZoom()&&e.previousValue<this.labelMinZoom()||e.currentValue<this.labelMinZoom()&&e.previousValue>=this.labelMinZoom())&&this.updateLabel()}updateLabel(t){if(!t&&this.source&&(t=this.source.getFeatureById("cogSelf")),!!t)try{let e=t.getStyle();if(!e)return;e=Array.isArray(e)?e[1]:e,e.setText(this.buildLabelStyle()),t.setStyle(e)}catch{}}buildLabelStyle(){return new zi({text:Math.abs(this.mapZoom)>=this.labelMinZoom()?this.labelText()??"":"",offsetX:0,offsetY:-10,fill:new ot({color:this.theme.labelText.color})})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-cog-line"]],inputs:{coords:[1,"coords"],cogTime:[1,"cogTime"],units:[1,"units"],labelMinZoom:[1,"labelMinZoom"],darkMode:[1,"darkMode"],mapZoom:"mapZoom",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:rBe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var aBe=["*"],pv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.twd(),this.awa(),this.tws(),this.aws(),this.position(),this.parseInput(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))})}layer;source;features=[];layerReady=new Cn;twd=$t();awa=$t();tws=$t(0);aws=$t(0);position=$t();opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseInput(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseInput(){let t=[];if(Array.isArray(this.position())){if(typeof this.twd()=="number"&&this.tws()>0){let e=new ut({geometry:new kt(Jt(this.position()))});e.setId("twd"),e.setStyle(new Re({image:new nr({src:"./assets/img/wind/twd.svg",scale:5,anchor:[3.5,37],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!0,rotation:this.twd()})})),t.push(e)}if(typeof this.awa()=="number"&&this.aws()>0){let e=new ut({geometry:new kt(Jt(this.position()))});e.setId("awa"),e.setStyle(new Re({image:new nr({src:"./assets/img/wind/awa.svg",scale:5,anchor:[3.5,37],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!0,rotation:this.awa()})})),t.push(e)}}this.features=t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-wind-lines"]],inputs:{twd:[1,"twd"],awa:[1,"awa"],tws:[1,"tws"],aws:[1,"aws"],position:[1,"position"],opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:aBe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var fv=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Ze({type:n});static \u0275inj=Ye({})};var zl=Fs(au());var Use=[{name:"scaleline",options:{className:"ol-scale-line",bar:!0,steps:2,text:!1,minWidth:64,units:"nautical"}}],Hse={startLine:new Re({stroke:new Ge({color:"black",width:2,lineDash:[4,4]}),text:new zi({text:"START",offsetY:10})})},Gse={default:new Re({stroke:new Ge({color:"green",width:2,lineDash:[20,5,5,5]}),text:new zi({text:"",offsetY:10})}),active:new Re({stroke:new Ge({color:"blue",width:4})})},Wse={line:new Re({fill:new ot({color:"green"}),stroke:new Ge({color:"black",width:2,lineDash:[5,5]})}),circle:new Re({fill:new ot({color:"rgba(0, 255, 0, .3)"}),stroke:new Ge({color:"red",width:2,lineDash:[5,5]})}),anchor:new Re({image:new nr({src:"./assets/img/anchor.png",size:[26,26],scale:.75,anchor:[13,1],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!1})})},$se={"notice-to-mariners":new Re({stroke:new Ge({color:"rgb(206, 107, 132)",lineDash:[5,5],width:2}),fill:new ot({color:"rgba(206, 107, 132, 0.2)"}),text:new zi({text:"",offsetY:0})}),hazard:new Re({stroke:new Ge({color:"rgba(241, 60, 60, 1)",lineDash:[5,5,2],width:2}),fill:new ot({color:"rgba(241, 60, 60, 0.5)"}),text:new zi({text:"",offsetY:0,stroke:new Ge({color:"silver"}),padding:[2,2,2,2],backgroundFill:new ot({color:"white"}),backgroundStroke:new Ge({color:"rgba(241, 60, 60, 1)"})})})},qse={mob:new Re({image:new nr({src:"./assets/img/alarms/mob.svg",rotateWithView:!1,rotation:0,scale:1,anchor:[12,12],anchorXUnits:"pixels",anchorYUnits:"pixels"})})},Kse={marker:new Re({image:new nr({src:"./assets/img/waypoints/marker-green.png",anchor:[10.5,25],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!1}),text:new zi({text:"",offsetY:-30})})},dBe=new nr({src:"./assets/img/atons/basestation.svg",scale:.4,anchor:[23,49],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!1,rotation:0}),Xse={default:new Re({image:dBe,text:new zi({text:"",offsetX:0,offsetY:-20})})},uBe=new nr({src:"./assets/img/aircraft_active.png",rotateWithView:!0,rotation:0}),pBe=new nr({src:"./assets/img/aircraft_inactive.png",rotateWithView:!0,rotation:0}),Yse={default:new Re({image:uBe,text:new zi({text:"",offsetY:-12})}),inactive:new Re({image:pBe,text:new zi({text:"",offsetY:-12})})},fBe=new nr({src:"./assets/img/sar_active.png",rotateWithView:!1,rotation:0}),Zse={default:new Re({image:fBe,text:new zi({text:"",offsetY:-18})})},Qse={port:new Re({fill:new ot({color:"green"}),stroke:new Ge({color:"green",width:1,lineDash:[5,5]})}),starboard:new Re({fill:new ot({color:"red"}),stroke:new Ge({color:"red",width:1,lineDash:[5,5]})})},Jse=new Re({fill:new ot({color:"green"}),stroke:new Ge({color:"gray",width:1,lineDash:[15,5,3,5]})}),Gg={default:void 0,measure:[new Re({stroke:new Ge({color:"white",width:5,lineDash:[5,5]})}),new Re({image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"#3399CC"})}),fill:new ot({color:"#3399CC"}),stroke:new Ge({color:"#3399CC",width:3,lineDash:[5,5]})})],route:[new Re({stroke:new Ge({color:"white",width:5})}),new Re({image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"green"})}),stroke:new Ge({color:"green",width:3})})],region:[new Re({stroke:new Ge({color:"rgba(255,255,255,0.4)",width:5}),fill:new ot({color:"rgba(255,255,255,0.4)"})}),new Re({stroke:new Ge({color:"purple",width:2}),image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"purple"})})})],radius:[new Re({image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"rgba(25, 183, 211, 0.4)"})})}),new Re({fill:new ot({color:"rgba(25, 183, 211, 0.4)"}),stroke:new Ge({color:"white",width:3,lineDash:[5,5]})})]};var hBe=["olMap"],mBe=(n,t)=>t[0];function gBe(n,t){if(n&1){let e=H();u(0,"ol-dragbox",40),M("boxStart",function(r){C(e);let o=y();return x(o.onDragBoxStart(r))})("boxEnd",function(r){C(e);let o=y();return x(o.onDragBoxEnd(r))})("boxCancel",function(r){C(e);let o=y();return x(o.onDragBoxCancel(r))}),p()}}function _Be(n,t){if(n&1){let e=H();u(0,"ol-draw",41),M("drawStart",function(r){C(e);let o=y();return x(o.onMeasureStart(r))})("drawEnd",function(){C(e);let r=y();return x(r.onMeasureEnd())}),p()}if(n&2){let e=y();z0(e.mapInteract.draw.style),T("type",e.mapInteract.measureGeometryType)("stopClick",!1)}}function bBe(n,t){if(n&1){let e=H();u(0,"ol-draw",42),M("drawEnd",function(r){C(e);let o=y();return x(o.onDrawEnd(r))}),p()}if(n&2){let e=y();z0(e.mapInteract.draw.style),T("type",e.mapInteract.draw.featureType)("stopClick",e.mapInteract.draw.resourceType!=="route")}}function yBe(n,t){if(n&1){let e=H();u(0,"ol-modify",43),M("modifyStart",function(r){C(e);let o=y();return x(o.onModifyStart(r))})("modifyEnd",function(r){C(e);let o=y();return x(o.onModifyEnd(r))}),p()}if(n&2){let e=y();T("features",e.mapInteract.draw.features)}}function vBe(n,t){n&1&&(u(0,"span"),_(1,"Lat:\xA0"),p())}function CBe(n,t){n&1&&(u(0,"span"),_(1,"Lon:\xA0"),p())}function xBe(n,t){if(n&1&&B(0,"fb-tracks",14),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("tracks",e.skres.tracks())("labelMinZoom",0)("mapZoom",e.mapZoomLevel())("zIndex",100)}}function wBe(n,t){if(n&1&&B(0,"ais-targets-track",15),n&2){let e=y();T("tracks",e.app.data.vessels.aisTracks)("tracksMinZoom",10)("updateIds",e.skstream.aisStatus().updated)("removeIds",e.skstream.aisStatus().expired)("mapZoom",e.mapZoomLevel())}}function MBe(n,t){if(n&1&&(u(0,"div"),B(1,"fb-resource-sets",44),p()),n&2){let e=t.$implicit,i=t.$index,r=y();h(),T("darkMode",r.app.uiConfig().invertColor)("collection",e[0])("resourceSets",e[1])("labelMinZoom",r.app.config.map.labelsMinZoom)("mapZoom",r.mapZoomLevel())("zIndex",120+i)}}function SBe(n,t){if(n&1&&B(0,"fb-route-direction",17),n&2){let e=y();T("points",e.course.courseData().activeRoutePoints)("pointIndex",e.course.courseData().pointIndex)("reverse",e.app.data.activeRouteReversed)("zIndex",550)}}function EBe(n,t){if(n&1&&B(0,"sk-ais-targets",21),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.meteo)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",220)}}function DBe(n,t){if(n&1&&B(0,"sk-ais-wind",45),n&2){let e=y(2);T("targetContext","vessels")("targets",e.dfeat.ais)("vectorApparent",e.app.config.vessels.aisWindApparent)("mapZoom",e.mapZoomLevel())("labelMinZoom",e.app.config.map.labelsMinZoom)("focusId",e.app.data.vessels.activeId)("filterIds",e.app.config.selections.aisTargets)("filterByShipType",e.app.config.selections.aisFilterByShipType)("filterShipTypes",e.app.config.selections.aisTargetTypes)("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",900)("darkMode",e.app.uiConfig().invertColor)}}function TBe(n,t){if(n&1&&(u(0,"div"),R(1,DBe,1,15,"sk-ais-wind",45),B(2,"sk-ais-flags",46)(3,"sk-ais-vessels",47),p()),n&2){let e=y();h(),F(e.mapZoomLevel()>=e.app.config.vessels.aisWindMinZoom?1:-1),h(),T("flagged",e.app.data.vessels.flagged)("targetContext","vessels")("targets",e.dfeat.ais)("mapZoom",e.mapZoomLevel())("labelMinZoom",e.app.config.map.labelsMinZoom)("focusId",e.app.data.vessels.activeId)("filterIds",e.app.config.selections.aisTargets)("filterByShipType",e.app.config.selections.aisFilterByShipType)("filterShipTypes",e.app.config.selections.aisTargetTypes)("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",985)("darkMode",e.app.uiConfig().invertColor),h(),T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.ais)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",980)("focusId",e.app.data.vessels.activeId)("filterIds",e.app.config.selections.aisTargets)("filterByShipType",e.app.config.selections.aisFilterByShipType)("filterShipTypes",e.app.config.selections.aisTargetTypes)("cogLineLength",e.app.config.vessels.aisCogLine)}}function IBe(n,t){if(n&1&&B(0,"sk-ais-targets",22),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.aircraft)("targetStyles",e.featureStyles.aircraft)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",910)}}function kBe(n,t){if(n&1&&B(0,"sk-ais-targets",23),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.sar)("targetStyles",e.featureStyles.sar)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",920)}}function PBe(n,t){if(n&1&&B(0,"fb-notes",26),n&2){let e=y();T("notes",e.skres.notes())("zIndex",450)}}function ABe(n,t){if(n&1){let e=H();u(0,"ap-popover",56),M("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("title",e.overlay().title)("canClose",!1)("measure",!0)}}function OBe(n,t){if(n&1){let e=H();u(0,"chart-list-popover",57),M("selected",function(r){C(e);let o=y(2);return x(o.toggleFeatureSelection(r,"charts"))})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("features",e.overlay().content)}}function RBe(n,t){if(n&1){let e=H();u(0,"feature-list-popover",58),M("selected",function(r){C(e);let o=y(2);return x(o.featureListSelection(r))})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("title",e.overlay().title)("features",e.overlay().content)}}function LBe(n,t){if(n&1){let e=H();u(0,"resource-popover",59),M("modify",function(){C(e);let r=y(2);return r.modifyFeature(),x(r.popoverClosed())})("delete",function(){C(e);let r=y(2);return r.deleteFeature(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("addNote",function(){C(e);let r=y(2);return r.skres.showNoteEditor({type:r.overlay().type,href:{id:r.overlay().id,exists:!0}}),x(r.popoverClosed())})("activated",function(){C(e);let r=y(2);return r.setActiveFeature(),x(r.popoverClosed())})("deactivated",function(){C(e);let r=y(2);return r.clearActiveFeature(),x(r.popoverClosed())})("related",function(r){C(e);let o=y(2);return o.skres.showRelatedNotes(r,"group"),x(o.popoverClosed())})("notes",function(){C(e);let r=y(2);return r.skres.showRelatedNotes(r.overlay().id,r.overlay().type,r.overlay().readOnly),x(r.popoverClosed())})("info",function(){C(e);let r=y(2);return r.skres.resourceProperties(r.overlay()),x(r.popoverClosed())})("points",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("title",e.overlay().title)("type",e.overlay().type)("resource",e.overlay().resource)("active",e.app.data.activeWaypoint?e.app.data.activeWaypoint:e.app.data.activeRoute)("featureCount",e.overlay().featureCount)("units",e.scaleUnits())}}function FBe(n,t){if(n&1){let e=H();u(0,"resourceset-popover",60),M("modify",function(){C(e);let r=y(2);return r.modifyFeature(),x(r.popoverClosed())})("delete",function(){C(e);let r=y(2);return r.deleteFeature(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("title",e.overlay().title)("resource",e.overlay().resource)}}function NBe(n,t){if(n&1){let e=H();u(0,"div")(1,"vessel-popover",61),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type,r.overlay().isSelf),x(r.popoverClosed())})("focused",function(r){C(e);let o=y(2);return x(o.setActiveVessel(r?o.overlay().id:null))})("markPosition",function(r){C(e);let o=y(2);return o.skres.newWaypointAt(r),x(o.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()()}if(n&2){let e=y(2);h(),T("canClose",e.app.config.map.popoverMulti)("vessel",e.overlay().vessel)("useMagnetic",e.app.useMagnetic)("isActive",e.app.data.vessels.activeId===e.overlay().id)("isSelf",e.overlay().isSelf)}}function VBe(n,t){if(n&1){let e=H();u(0,"aton-popover",62),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("aton",e.overlay().aton)}}function BBe(n,t){if(n&1){let e=H();u(0,"aircraft-popover",63),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("aircraft",e.overlay().aircraft)}}function jBe(n,t){if(n&1){let e=H();u(0,"alarm-popover",64),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("goto",function(r){C(e);let o=y(2);return o.onContextMenuAction("nav_to",r),x(o.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("alarm",e.overlay().alarm)("id",e.overlay().id)}}function zBe(n,t){if(n&1&&(u(0,"ol-overlay",27),R(1,ABe,1,3,"ap-popover",48),R(2,OBe,1,2,"chart-list-popover",49),R(3,RBe,1,3,"feature-list-popover",50),R(4,LBe,1,7,"resource-popover",51),R(5,FBe,1,3,"resourceset-popover",52),R(6,NBe,2,5,"div"),R(7,VBe,1,2,"aton-popover",53),R(8,BBe,1,2,"aircraft-popover",54),R(9,jBe,1,3,"alarm-popover",55),p()),n&2){let e=y();T("position",e.overlay().position)("positioning","top-center"),h(),F(e.mapInteract.isMeasuring()?1:-1),h(),F(e.overlay().type==="chartlist"?2:-1),h(),F(e.overlay().type==="list"?3:-1),h(),F(e.overlay().type==="destination"||e.overlay().type==="waypoint"||e.overlay().type==="route"||e.overlay().type==="note"||e.overlay().type==="region"?4:-1),h(),F(e.overlay().type==="rset"?5:-1),h(),F(e.overlay().type==="ais"?6:-1),h(),F(e.overlay().type==="aton"||e.overlay().type==="meteo"?7:-1),h(),F(e.overlay().type==="aircraft"?8:-1),h(),F(e.overlay().type==="alarm"?9:-1)}}function UBe(n,t){if(n&1&&B(0,"fb-anchor-alarm",28),n&2){let e=y();T("radius",e.anchor.radius())("anchorPosition",e.anchor.position())("vesselPosition",e.dfeat.self.position)("anchorStyles",e.featureStyles.anchor)("zIndex",300)}}function HBe(n,t){if(n&1&&B(0,"fb-cpa-alarms",29),n&2){let e=y();T("cpaLines",e.dfeat.closest)("zIndex",350)}}function GBe(n,t){if(n&1&&B(0,"fb-xte-path",65),n&2){let e=y(2);T("startPosition",e.dfeat.navData.startPosition)("destPosition",e.dfeat.navData.position)("zIndex",340)("visible",!0)}}function WBe(n,t){if(n&1&&B(0,"fb-target-angle",68)(1,"fb-layline",69),n&2){let e=y(2);T("line",e.perfTargetAngle())("lineStyle",e.featureStyles.targetAngle)("position",e.app.data.vessels.active.position)("twd",e.app.data.vessels.self.wind.direction)("mapZoom",e.mapZoomLevel())("zIndex",345),h(),T("lines",e.perfLaylines())("laylineStyles",e.featureStyles.layline)("position",e.app.data.vessels.active.position)("twd",e.app.data.vessels.self.wind.direction)("mapZoom",e.mapZoomLevel())("zIndex",330)}}function $Be(n,t){if(n&1&&B(0,"fb-bearing-line",66),n&2){let e=y(2);T("markerPosition",e.dfeat.navData.position)("vesselPosition",e.dfeat.active.position)("showMarker",!e.app.data.activeWaypoint)("markerName",e.course.courseData().destPointName)("bearingStyles",e.featureStyles.destination)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("zIndex",335)}}function qBe(n,t){if(n&1&&B(0,"fb-arrival-circle",67),n&2){let e=y(2);T("radius",e.course.courseData().arrivalCircle)("position",e.dfeat.navData.position)("zIndex",335)}}function KBe(n,t){if(n&1&&(R(0,GBe,1,4,"fb-xte-path",65),R(1,WBe,2,12),R(2,$Be,1,8,"fb-bearing-line",66),R(3,qBe,1,3,"fb-arrival-circle",67)),n&2){let e=y();F(e.dfeat.navData.startPosition?0:-1),h(),F(e.app.config.vessels.laylines&&e.perfTargetAngle().length!==0?1:-1),h(),F(e.dfeat.navData.position?2:-1),h(),F(e.course.courseData().arrivalCircle?3:-1)}}function XBe(n,t){if(n&1&&B(0,"fb-range-circles",31),n&2){let e=y();T("position",e.dfeat.active.position)("maxCircles",e.app.config.vessels.rangeCircleCount)("mapZoom",e.mapZoomLevel())("darkMode",e.app.uiConfig().invertColor)("minZoom",e.app.config.vessels.rangeCircleMinZoom)("units",e.scaleUnits())("zIndex",340)}}function YBe(n,t){if(n&1&&B(0,"fb-cog-line",32),n&2){let e=y();T("coords",e.vesselLines().cog)("cogTime",e.app.config.vessels.cogLine)("units",e.app.config.units.distance)("darkMode",e.app.uiConfig().invertColor)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("zIndex",345)}}function ZBe(n,t){if(n&1&&B(0,"fb-wind-lines",33),n&2){let e=y();T("twd",e.dfeat.active.wind.direction)("tws",e.dfeat.active.wind.tws)("awa",e.dfeat.active.wind.awa+e.dfeat.active.orientation)("aws",e.dfeat.active.wind.aws)("position",e.dfeat.self.position)("zIndex",350)}}function QBe(n,t){if(n&1&&B(0,"fb-vessel-trail",35),n&2){let e=y();T("localTrail",e.app.selfTrail())("serverTrail",e.app.selfTrailFromServer())("zIndex",990)}}function JBe(n,t){if(n&1&&B(0,"fb-chart-bounds",36),n&2){let e=y();T("zIndex",250)("charts",e.app.data.chartBounds.charts)}}function eje(n,t){n&1&&(u(0,"span"),_(1,"Clear Active Route"),p())}function tje(n,t){n&1&&(u(0,"span"),_(1,"Clear Destination"),p())}function ije(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("cleardestination",r))}),u(1,"mat-icon"),_(2,"clear_all"),p(),R(3,eje,2,0,"span")(4,tje,2,0,"span"),p()}if(n&2){let e=y(2);h(3),F(e.app.data.activeRoute?3:4)}}function nje(n,t){if(n&1){let e=H();u(0,"button",72),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("add_note",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(1,"mat-icon"),_(2,"local_offer"),p(),_(3," Add Note here "),p()}}function rje(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("cleartrail",r))}),u(1,"mat-icon"),_(2,"clear_all"),p(),u(3,"span"),_(4),p()()}if(n&2){let e=y(2);h(4),Z("",e.app.data.serverTrail?"Refresh":"Clear"," Trail")}}function oje(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("weather_forecast",r))}),u(1,"mat-icon"),_(2,"air"),p(),u(3,"span"),_(4,"Weather Forecast"),p()()}}function aje(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("get_feature_info",r))}),u(1,"mat-icon"),_(2,"info"),p(),u(3,"span"),_(4,"Get Feature Info"),p()()}}function sje(n,t){if(n&1){let e=H();u(0,"button",70),M("contextmenu",function(r){return C(e),x(r.preventDefault())})("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("nav_to",r))}),u(1,"mat-icon"),_(2,"near_me"),p(),_(3," Navigate to here "),p(),R(4,ije,5,1,"button",71),B(5,"mat-divider"),u(6,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("add_wpt",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(7,"mat-icon",73),_(8,"add_location"),p(),_(9," Add Waypoint here "),p(),R(10,nje,4,0,"button",71),B(11,"mat-divider"),u(12,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("measure",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(13,"mat-icon"),_(14,"straighten"),p(),_(15," Measure "),p(),B(16,"mat-divider"),R(17,rje,5,1,"button",71),u(18,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("trail2route",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(19,"mat-icon"),_(20,"insights"),p(),_(21," Trail to Route "),p(),B(22,"mat-divider"),u(23,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("anchor",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(24,"mat-icon"),_(25,"anchor"),p(),_(26," Anchor Watch "),p(),R(27,oje,5,0,"button",71),R(28,aje,5,0,"button",71)}if(n&2){let e=y();h(4),F(e.course.courseData().position?4:-1),h(6),F(e.mapZoomLevel()>=e.app.config.resources.notes.minZoom?10:-1),h(7),F(e.app.config.vessels.trail&&e.app.selfTrail().length!==0?17:-1),h(10),F(e.app.featureFlags().weatherApi?27:-1),h(),F(e.app.config.experiments&&e.app.config.resources.featureServer.url?28:-1)}}var qw=class n{setFocus;mapCenter=[0,0];mapZoom=1;movingMap=!1;northUp=!0;measureMode;drawMode;modifyMode=!1;activeRoute;vesselTrail=[];dblClickZoom=!1;drawEnded=new q;activate=new q;deactivate=new q;info=new q;exitMovingMap=new q;focusVessel=new q;menuItemSelected=new q;contextMenu;olMap;scaleUnits=$t("");perfLaylines=oe({port:[],starboard:[]});perfTargetAngle=oe([]);vesselLines=oe({cog:[],heading:[]});overlay=oe({id:null,type:null,icon:null,position:[0,0],show:!1,title:"",content:null,featureCount:0,readOnly:!1,isSelf:!1});olMapControls=Use;olMapInteractions=oe([]);mapZoomLevel=oe(1);mapCenterPositon=oe([0,0]);mapRotation=oe(0);showNoteslayer=oe(!1);featureStyles={route:Gse,region:$se,anchor:Wse,alarm:qse,destination:Kse,basestation:Xse,aircraft:Yse,sar:Zse,layline:Qse,targetAngle:Jse,raceCourse:Hse};dfeat={aircraft:new Map,atons:new Map,sar:new Map,meteo:new Map,self:new xp,ais:new Map,active:new xp,navData:{position:null,startPosition:null},closest:[]};saveTimer;isDirty=!1;mouse={pixel:null,coords:[0,0],xy:null};contextMenuPosition={x:"0px",y:"0px"};obsList=[];http=w(pa);app=w(Ie);skres=w(Di);skresOther=w(cu);skstream=w(pc);anchor=w(yh);notiMgr=w(sl);course=w(Ys);mapInteract=w(vu);settings=w(Cu);bottomSheet=w(Om);constructor(){Ut(()=>{this.scaleUnits()&&this.setScaleUnits()}),this.toggleDblClickZoom()}ngAfterViewInit(){this.setScaleUnits(),setTimeout(()=>{this.setFocus="xxx"},500)}ngOnInit(){this.obsList.push(this.skstream.vessels$().subscribe(()=>this.onVessels())),this.obsList.push(this.settings.change$.subscribe(t=>{this.renderMapContents(t.includes("fetchNotes")),t.includes("trailFromServer")&&(this.app.config.vessels.trailFromServer||this.app.selfTrailFromServer.update(()=>[]))}))}ngOnDestroy(){this.stopSaveTimer(),this.obsList.forEach(t=>t.unsubscribe())}ngOnChanges(t){t.vesselTrail&&this.drawVesselLines(),t&&t.mapCenter&&t.mapCenter.currentValue&&this.mapCenterPositon.set(t.mapCenter.currentValue),t&&t.mapZoom&&typeof t.mapZoom.currentValue=="number"&&(this.mapZoomLevel.set(t.mapZoom.currentValue),this.renderMapContents(!0)),t&&t.movingMap&&!t.movingMap.firstChange&&(t.movingMap.currentValue?this.startSaveTimer():this.stopSaveTimer(),this.centerVessel()),t&&t.northUp&&this.rotateMap(),t&&t.measureMode&&this.applyInteractionMode(0,t.measureMode.currentValue),t&&t.drawMode&&this.applyInteractionMode(1,t.drawMode.currentValue),t&&t.modifyMode&&!t.modifyMode.firstChange&&this.applyInteractionMode(2,t.modifyMode.currentValue),t&&t.dblClickZoom&&this.toggleDblClickZoom(t.dblClickZoom.currentValue)}setScaleUnits(){try{let t=this.scaleUnits()==="m"?"metric":"nautical";this.olMap.getMap().getControls().getArray()[0].setUnits(t)}catch{}}wmsParams(t){return{LAYERS:t.layers?t.layers.join(","):""}}startSaveTimer(){this.saveTimer||(this.saveTimer=setInterval(()=>{this.isDirty&&(this.app.saveConfig(),this.isDirty=!1)},3e4))}stopSaveTimer(){this.saveTimer&&(clearInterval(this.saveTimer),this.saveTimer=null)}onVessels(){let t=this.dfeat.self.position;this.dfeat.self=this.app.data.vessels.self,(!this.dfeat.self.position||!Array.isArray(this.dfeat.self.position))&&(this.dfeat.self.position=t),this.dfeat.ais=this.app.data.vessels.aisTargets,this.dfeat.aircraft=this.app.data.aircraft,this.dfeat.sar=this.app.data.sar,this.dfeat.meteo=this.app.data.meteo,this.dfeat.atons=this.app.data.atons,this.dfeat.active=this.app.data.vessels.active,this.dfeat.navData.position=this.course.courseData().position,this.dfeat.navData.startPosition=this.course.courseData().startPosition;let e=()=>{let i=[];return this.app.data.vessels.self.position&&this.app.data.vessels.closest.forEach(r=>{if(this.app.data.vessels.aisTargets.has(r)){let o=this.app.data.vessels.aisTargets.get(r);i.push([o.position,this.app.data.vessels.self.position])}}),i};this.dfeat.closest=e(),this.dfeat.self.positionReceived&&(this.app.data.vessels.showSelf=!0),this.overlay().show&&["ais","aton","aircraft"].includes(this.overlay().type)&&(this.overlay().isSelf?this.overlay.update(i=>Object.assign({},i,{position:this.dfeat.self.position,vessel:this.dfeat.self})):this.overlay().type==="ais"&&!this.dfeat.ais.has(this.overlay().id)||this.overlay().type==="atons"&&!this.dfeat.atons.has(this.overlay().id)||this.overlay().type==="aircraft"&&!this.dfeat.aircraft.has(this.overlay().id)?this.overlay().show=!1:this.overlay().type==="ais"&&this.overlay.update(i=>Object.assign({},i,{position:this.dfeat.ais.get(i.id).position,vessel:this.dfeat.ais.get(i.id)})),this.app.mapExtent()[0]<180&&this.app.mapExtent()[2]>180&&this.overlay().position[0]<0&&this.overlay().position[0]>-180&&this.overlay.update(i=>Object.assign({},i,{position:[i.position[0]+360,i.position[1]]}))),this.drawVesselLines(this.app.data.vessels.self.positionReceived),this.rotateMap(),this.movingMap&&this.centerVessel()}toggleDblClickZoom(t){let e=[{name:"dragpan"},{name:"dragzoom"},{name:"keyboardpan"},{name:"keyboardzoom"},{name:"mousewheelzoom"},{name:"pinchzoom"}];this.olMapInteractions.update(()=>t?[{name:"doubleclickzoom"}].concat(e):[].concat(e))}onContextMenuAction(t,e){switch(t){case"add_wpt":this.skres.newWaypointAt(e);break;case"add_note":this.skres.showNoteEditor({position:e});break;case"nav_to":this.app.data.activeWaypoint=null,this.course.courseData().pointNames=[],this.course.setDestination({latitude:e[1],longitude:e[0]});break;case"weather_forecast":this.bottomSheet.open(hv,{disableClose:!0,data:{title:"Forecast",position:e,subTitle:"Location: Cursor Position"}});break;case"measure":this.mapInteract.startMeasuring();break;case"get_feature_info":this.getFeatureInfo(e);break;default:this.menuItemSelected.emit(t);break}}onMapMoveEnd(t){this.app.config.map.zoomLevel=t.zoom,this.app.mapExtent.update(()=>t.extent),this.app.config.map.center=t.lonlat,this.drawVesselLines(),this.movingMap?this.isDirty=!0:(this.app.saveConfig(),this.isDirty=!1),this.renderMapContents(t.zoomChanged)}onMapPointerMove(t){if(this.mouse.pixel=t.pixel,this.mouse.xy=t.coordinate,this.mouse.coords=_n.normaliseCoords(t.lonlat),this.mapInteract.isMeasuring()){if(this.mapInteract.measureGeometryType==="LineString"&&this.mapInteract.measurement().coords.length!==0){let e=t.lonlat,i=this.mapInteract.distanceFromLastPoint(e),r=(0,zl.getGreatCircleBearing)(this.mapInteract.measurement().coords.slice(-1)[0],e);this.overlay.update(o=>Object.assign({},o,{position:e,title:`${this.app.formatValueForDisplay(i,"m")} ${this.app.formatValueForDisplay(r,"deg")}`}))}else if(this.mapInteract.measureGeometryType==="Circle"){let e=t.lonlat,i=this.mapInteract.distanceFromCenter(e),r=(0,zl.getGreatCircleBearing)(this.mapInteract.measurement().center??e,e);this.overlay.update(o=>Object.assign({},o,{position:e,title:`${this.app.formatValueForDisplay(i,"m")} ${this.app.formatValueForDisplay(r,"deg")}`}))}}}onMapPointerDrag(){!this.app.config.map.lockMoveMap&&this.app.uiConfig().mapMove&&this.exitMovingMap.emit(!0)}onMapPointerDown(t){this.mouse.coords=_n.normaliseCoords(t.lonlat),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px"}onMapSingleClick(t){this.app.data.map.atClick={features:t.features,lonlat:t.lonlat},this.mapInteract.isMeasuring()?this.parseClickInMeasureMode(t.lonlat):this.mapInteract.isDrawing()&&this.mapInteract.draw.resourceType==="route"?this.onDrawClick(t.features):!this.mapInteract.isDrawing()&&!this.mapInteract.isModifying()&&(this.app.config.map.popoverMulti||this.overlay.update(e=>Object.assign({},e,{show:!1})),this.processMapClick(t))}onMapRightClick(t){this.app.data.map.atClick=t,this.app.debug("onRightClick()",this.app.data.map.atClick),this.mapInteract.isMeasuring()&&this.parseClickInMeasureMode(t.lonlat)}onMapContextMenu(t){this.app.debug("onMapContextMenu()",this.app.data.map.atClick),this.onContextMenu(t)}onContextMenu(t){if(this.app.debug("onContextMenu()",this.app.data.map.atClick),!this.app.uiCtrl().suppressContextMenu){if(t.preventDefault(),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px",this.contextMenu.menuData={item:this.mouse.coords},this.mapInteract.isMeasuring())this.parseClickInMeasureMode(this.mouse.xy.lonlat);else if(!this.modifyMode){if(!this.mouse.xy)return;this.contextMenu.openMenu(),document.getElementsByClassName("cdk-overlay-backdrop")[0].addEventListener("contextmenu",e=>{e.preventDefault(),this.contextMenu.closeMenu()})}}}parseClickInMeasureMode(t){this.mapInteract.measureGeometryType==="LineString"&&this.mapInteract.measurement().coords.length!==0&&this.onMeasureClick(t)}toggleFeatureSelection(t,e){e==="charts"&&this.skres.chartSelected(t)}onDragBoxStart(t){let e=Gr(t.coordinate);this.mapInteract.initBoxCoord(e)}onDragBoxEnd(t){let e=Gr(t.coordinate);this.mapInteract.stopBoxSelection(e)}onDragBoxCancel(t){this.app.debug("onDragBoxCancel()..."),this.mapInteract.stopBoxSelection()}onMeasureStart(t){this.app.debug("onMeasureStart()...",this.mapInteract.measureGeometryType);let e;if(this.mapInteract.measureGeometryType==="LineString"){let i=t.feature.getGeometry().getCoordinates().map(r=>Gr(r));i=i.slice(0,i.length-1),this.mapInteract.measurementCoords=i,e=i}else{let i=t.feature.getGeometry(),r=Gr(i.getCenter()),o=i.getRadius();this.mapInteract.measurementCenter=r,this.mapInteract.measurementRadius=o,e=this.mapInteract.measurementCenter,this.app.debug(this.mapInteract.measurement)}this.formatPopover(null,null),this.overlay.update(i=>Object.assign({},i,{position:e,title:"0",show:!0,type:"measure"}))}onMeasureClick(t){if(this.app.debug("onMeasureClick()..."),!Array.isArray(t))return;let e=this.mapInteract.measurement().coords[this.mapInteract.measurement().coords.length-1];if(t[0]===e[0]&&t[1]===e[1])return;let i=this.mapInteract.addMeasurementCoord(t),r=this.mapInteract.measurement().coords.slice(-2),o=(0,zl.getGreatCircleBearing)(r[0],r[1])??0;this.overlay.update(a=>Object.assign({},a,{position:t,title:`${this.app.formatValueForDisplay(i,"m")} ${this.app.formatValueForDisplay(o,"deg")}`}))}onMeasureEnd(){this.app.debug("onMeasureEnd()..."),this.overlay.update(t=>Object.assign({},t,{show:!1})),this.mapInteract.stopMeasuring()}onDrawClick(t){if(Array.isArray(t)&&this.mapInteract.draw.resourceType==="route"){let e;t.forEach(i=>{i.getGeometry().getType()==="LineString"&&(e=i.getGeometry().getCoordinates().map(r=>Gr(r)),e=e.slice(0,e.length-1))}),this.mapInteract.measurementCoords=e}}onDrawEnd(t){this.mapInteract.stopDrawing(t.feature),this.drawEnded.emit(this.mapInteract.draw)}modifyFeature(t){this.mapInteract.draw.features.getLength()!==0&&(this.mapInteract.startModifying(this.overlay()),this.overlay().type==="route"&&(this.mapInteract.measurementCoords=this.skres.fromCache("routes",this.overlay().id)[1].feature.geometry.coordinates),t==="anchor"&&(this.overlay().type=t,this.mapInteract.draw.forSave.id=t))}onModifyStart(t){let e=t.features.getArray()[0];if(this.mapInteract.draw.coordinates=e.getGeometry().getCoordinates(),this.mapInteract.draw.forSave.id||(this.mapInteract.draw.forSave.id=e.getId()),e.getGeometry().getType()==="LineString"){let i=e.get("pointMetadata");i&&(this.mapInteract.draw.forSave.coordsMetadata=i)}}onModifyEnd(t){let e=t.features.getArray()[0],i=e.getId(),r=e.getGeometry().getCoordinates();e.getGeometry().getType()==="LineString"&&this.updateCoordsMeta(this.mapInteract.draw.coordinates,r,this.mapInteract.draw.forSave.coordsMetadata);let o;if(i.split(".")[0]==="route")o=this.transformCoordsArray(r),this.mapInteract.measurementCoords=o;else if(i.split(".")[0]==="region"){for(let a=0;a<r.length;a++)if(this.isCoordsArray(r[a]))r[a]=this.transformCoordsArray(r[a]);else for(let s=0;s<r[a].length;s++)this.isCoordsArray(r[a][s])?r[a][s]=this.transformCoordsArray(r[a][s]):console.log("Invalid polygon coordinates!");o=r}else o=Gr(r),i==="anchor"&&this.anchor.setAnchorPosition(o).catch(a=>{this.app.parseHttpErrorResponse(a)});this.mapInteract.draw.forSave.coords=o,this.app.data.activeRoute&&this.mapInteract.draw.forSave.id.indexOf(this.app.data.activeRoute)!==-1?this.app.data.activeRouteIsEditing=!0:this.app.data.activeRouteIsEditing=!1,this.app.data.editingId=this.mapInteract.draw.forSave.id,this.app.debug(this.mapInteract.draw.forSave)}processMapClick(t){let e=new Map,i=new Map,r=[],o=!1;if(t.features.forEach(a=>{let s=a.getId(),l=!1,c,d,f,g,m;if(s&&typeof s=="string"){let b=s.split("."),v,E;if(b[0]==="chart-backdrop"){o=!0;return}switch(b[0]==="chart-bound"&&i.set(s,{id:b[1],coord:t.lonlat,icon:v,text:a.get("name")}),b[0]){case"rset":l=!0,v="star",E=a.get("name");break;case"alarm":l=!0,v="notification_important",E=`Alarm: ${a.get("type")}`;break;case"anchor":l=!0,v="anchor",E=`${b[0]}`;break;case"dest":l=!0,v="flag",E="Destination";break;case"note":v=a.get("icon"),l=!0,E=this.skres.fromCache("notes",b[1])[1].name??"";break;case"route":v="route",l=!0,E=this.skres.fromCache("routes",b[1])[1].name;break;case"waypoint":v="location_on",l=!0,E=this.skres.fromCache("waypoints",b[1])[1].name??"";break;case"atons":case"aton":case"shore":v="beenhere",l=!0,c=this.app.data.atons.get(s),E=c?c.name||c.mmsi:"";break;case"sar":v="tour",l=!0,d=this.app.data.sar.get(s),E=d?d.name||d.mmsi:"SaR Beacon";break;case"meteo":v="air",l=!0,f=this.app.data.meteo.get(s),E=f?f.name||f.mmsi:"Weather Station";break;case"ais-vessels":v="directions_boat",l=!0,m=this.dfeat.ais.get(`vessels.${b[1]}`),E=m?m.name||m.mmsi:"";break;case"vessels":v="directions_boat",l=!0,E=this.dfeat.self.name?this.dfeat.self.name+" (self)":"self";break;case"region":l=!0,v="tab_unselected",E=a.get("name");break;case"aircraft":v="airplanemode_active",l=!0,g=this.app.data.aircraft.get(s),E=g?g.name||g.mmsi:"";break}l&&!e.has(s)&&(e.set(s,{id:s,coord:t.lonlat,icon:v,text:E}),r.push(a))}}),i.size>0){this.formatPopover("chartlist.",t.lonlat,i);return}if(!o)if(this.mapInteract.draw.features=new wr(r),e.size===1){let a=e.values().next().value;this.formatPopover(a.id,a.coord)}else e.size>1&&this.formatPopover("list.",t.lonlat,e)}formatPopover(t,e,i){if(!t){this.overlay.update(l=>Object.assign({},l,{show:!1}));return}let r={show:!1,content:[],id:null,type:null,title:null,featureCount:this.mapInteract.draw.features?.getLength(),position:e,readOnly:!1,isSelf:!1},o=null,a=t.split("."),s;switch(a[0]){case"anchor":this.modifyFeature("anchor");return;case"list":r.type=a[0],r.title="Features",r.content=[],i.forEach(c=>r.content.push(c)),r.show=!0;break;case"chartlist":r.type=a[0],r.content=[],i.forEach(c=>r.content.push(c)),r.show=!0;break;case"alarm":s=t.split(".").slice(1).join(".");let l=this.notiMgr.getAlert(s);if(!l)return!1;r.type=a[0],r.alarm=l,r.id=s,r.show=!0;break;case"vessels":r.type="ais",r.isSelf=!0,r.vessel=this.dfeat.self,r.position=this.dfeat.self.position,r.show=!0;break;case"ais-vessels":if(s=t.slice(4),!this.dfeat.ais.has(s))return!1;r.type="ais",r.id=s,r.vessel=this.dfeat.ais.get(s),r.position=r.vessel.position,r.show=!0;break;case"atons":case"aton":case"shore":if(!this.app.data.atons.has(t))return!1;r.type="aton",r.id=t,r.aton=this.app.data.atons.get(t),r.position=r.aton.position,r.show=!0;break;case"sar":if(!this.app.data.sar.has(t))return!1;r.type="aton",r.id=t,r.aton=this.app.data.sar.get(t),r.position=r.aton.position,r.show=!0;break;case"meteo":if(!this.app.data.meteo.has(t))return!1;r.type=a[0],r.id=t,r.aton=this.app.data.meteo.get(t),r.position=r.aton.position,r.show=!0;break;case"aircraft":if(!this.app.data.aircraft.has(t))return!1;r.type=a[0],r.id=t,r.aircraft=this.app.data.aircraft.get(t),r.position=r.aircraft.position,r.show=!0;break;case"region":if(o=[this.skres.fromCache("regions",a[1])],!o)return!1;r.id=a[1],r.type=a[0],r.title="Region",r.resource=o[0],r.show=!0,r.readOnly=o[0][1]?.feature?.properties?.readOnly??!1;break;case"note":if(o=this.skres.fromCache("notes",a[1]),!o)return!1;r.readOnly=o[1]?.properties?.readOnly??!1,r.readOnly?(r.show=!1,this.skres.showNoteDetails(o[0])):(r.id=a[1],r.type=a[0],r.title="Note",r.resource=o,r.show=!0);break;case"route":if(o=[this.skres.fromCache("routes",a[1])],!o)return!1;r.id=a[1],r.type=a[0],r.title="Route",r.resource=o[0],r.show=!0,r.readOnly=o[0][1]?.feature?.properties?.readOnly??!1;break;case"waypoint":if(o=[this.skres.fromCache("waypoints",a[1])],!o)return!1;r.id=a[1],r.type=a[0],r.resource=o[0],r.title="Waypoint",r.show=!0,r.readOnly=o[0][1]?.feature?.properties?.readOnly??!1;break;case"dest":r.id=t,r.type="destination",r.resource=this.skres.buildWaypoint(e),r.title=this.course.courseData().destPointName??"Destination",r.show=!0;break;case"rset":r.id=t,r.type=a[0],r.resource=this.skresOther.fromResourceSetCache(t,!0),r.title=r.resource?.properties?.name??"Resource Set",r.show=!!r.resource;break;default:return}this.overlay.update(()=>r)}featureListSelection(t){let e=new wr;this.mapInteract.draw.features.forEach(i=>{i.getId()===t.id&&e.push(i)}),this.mapInteract.draw.features=e,this.formatPopover(t.id,t.coord)}popoverClosed(){this.overlay.update(t=>Object.assign({},t,{show:!1}))}updateCoordsMeta(t,e,i){if(!i)return;let r=e.length>t.length?"ADD":e.length<t.length?"DELETE":"MOVE";function o(a){return a.map(s=>`${s[0]} - ${s[1]}`)}if(r==="MOVE")return i;if(t=o(t),e=o(e),r==="DELETE"){for(let a=0;a<t.length;a++)e.includes(t[a])||i.splice(a,1);return i}else if(r==="ADD"){for(let a=0;a<e.length;a++)if(t[a]!==e[a]){i.splice(a,0,{name:""});break}return i}else return i}zoomMap(t){t?this.app.config.map.zoomLevel<this.app.MAP_ZOOM_EXTENT.max&&++this.app.config.map.zoomLevel:this.app.config.map.zoomLevel>this.app.MAP_ZOOM_EXTENT.min&&--this.app.config.map.zoomLevel}rotateMap(){this.northUp?this.mapRotation.set(0):this.mapRotation.update(()=>0-this.dfeat.active.orientation)}centerVessel(){let t=this.app.calcMapCenter(this.dfeat.active.position);this.mapCenterPositon.update(()=>t)}drawVesselLines(t=!1){let e=this.mapZoomLevel(),i=e<29?R3[Math.floor(e)]:60,r=10;t&&this.app.addToSelfTrail(this.dfeat.self.position),this.buildLaylines(),this.vesselLines.update(()=>{let o=this.dfeat.active.vectors.cog??[],a=this.dfeat.active.sog||0,s=0;this.app.config.vessels.headingLineSize===-1?s=(a>r?r:a)*i:s=Ct.nauticalMilesToKm(this.app.config.vessels.headingLineSize)*1e3;let l=[this.dfeat.active.position,_n.destCoordinate(this.dfeat.active.position,this.dfeat.active.orientation,s)];return{cog:o,heading:l}})}buildLaylines(){if(this.app.config.vessels.laylines&&Array.isArray(this.dfeat.navData.position)&&typeof this.dfeat.navData.position[0]=="number"&&typeof this.app.data.vessels.active.heading=="number"){let t=Ct.radiansToDegrees(this.app.data.vessels.self.wind.direction??0),e=Ka.add(t,180),i=Math.abs(Ka.difference(this.course.courseData().bearing.value,t))<90,r=Ct.radiansToDegrees(this.app.data.vessels.self.performance.beatAngle??Math.PI/4),o,a;typeof this.app.data.vessels.self.performance.gybeAngle=="number"&&(o=Ct.radiansToDegrees(this.app.data.vessels.self.performance.gybeAngle),a=180-Math.abs(o));let s=i?Math.abs(Ka.difference(this.course.courseData().bearing.value,t))<r:Math.abs(Ka.difference(this.course.courseData().bearing.value,e))<(a??0),l=this.app.config.units.distance==="m"?this.course.courseData().dtg*1e3:Ct.nauticalMilesToKm(this.course.courseData().dtg*1e3),c=[];if(i){let d=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,r)),f=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,0-r));c=[[d.longitude,d.latitude],this.dfeat.navData.position,[f.longitude,f.latitude]]}else if(typeof o=="number"){let d=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,o)),f=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,0-o));c=[[d.longitude,d.latitude],this.dfeat.navData.position,[f.longitude,f.latitude]]}if(this.perfTargetAngle.update(()=>c),s){let d=Ka.difference(t,this.course.courseData().bearing.value),f,g,m,b;if(i){let v=Ct.degreesToRadians(r-d),E=Ct.degreesToRadians(r+d),k=Math.PI-(E+v);f=l*Math.sin(E)/Math.sin(k),g=l*Math.sin(v)/Math.sin(k),m=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,f,Ka.add(t,r)),b=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,g,Ka.add(t,0-r))}else if(c.length!==0&&typeof a=="number"){let v=Ct.degreesToRadians(a-d),E=Ct.degreesToRadians(a+d),k=Math.PI-(E+v);f=l*Math.sin(E)/Math.sin(k),g=l*Math.sin(v)/Math.sin(k),m=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,f,Ka.add(t,a)),b=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,g,Ka.add(t,0-a))}this.perfLaylines.update(()=>({port:[[[b.longitude,b.latitude],this.app.data.vessels.active.position],[[m.longitude,m.latitude],this.app.data.vessels.active.position]],starboard:[[[m.longitude,m.latitude],c[1]],[c[1],[b.longitude,b.latitude]]]}))}}}deleteFeature(t,e){switch(e){case"waypoint":this.skres.deleteWaypoint(t);break;case"route":this.skres.deleteRoute(t);break;case"note":this.skres.deleteNote(t);break;case"region":this.skres.deleteRegion(t);break}}setActiveFeature(){this.overlay().type==="waypoint"?this.course.navigateToWaypoint(this.overlay().id):this.activate.emit(this.overlay().id)}clearActiveFeature(){this.deactivate.emit(this.overlay().id)}itemInfo(t,e,i=!1){e==="ais"&&i?this.info.emit({id:t,type:"self"}):this.info.emit({id:t,type:e})}setActiveVessel(t=null){this.focusVessel.emit(t)}applyInteractionMode(t,e){this.overlay.update(i=>Object.assign({},i,{show:!1})),t===0&&(this.mapInteract.draw.style=e?this.mapInteract.measureGeometryType==="Circle"?Gg.radius:Gg.measure:Gg.default),t===1&&(this.mapInteract.draw.style=this.mapInteract.draw.resourceType==="route"?Gg.route:this.mapInteract.draw.resourceType==="region"?Gg.region:Gg.default)}isCoordsArray(t){return Array.isArray(t)?Array.isArray(t[0])&&typeof t[0][0]=="number":!1}transformCoordsArray(t){return t.map(e=>Gr(e))}applyStyle(){return new Re({fill:new ot({color:"#e0d10e"}),stroke:new Ge({color:"#444",width:1})})}renderMapContents(t){this.shouldFetchNotes(t)&&(this.skres.refreshNotes(),this.app.debug("fetching Notes...")),this.shouldFetchResourceSets(t)&&(this.app.debug("fetching ResourceSets..."),this.skresOther.refreshResourceSetsInBounds())}mapMoveThresholdExceeded(t){if(!this.app.data.lastGet)return this.app.data.lastGet=this.app.config.map.center,!0;let e=_n.distanceTo(this.app.data.lastGet,this.app.config.map.center);this.app.debug(`distance map moved: ${e}`);let i=this.app.config.units.distance==="ft"?Ct.nauticalMilesToKm(t)*1e3:t*1e3;return this.app.debug(`mapMoveThresholdExceeded: ${e>=i/2}`),e>=i/2?(this.app.data.lastGet=this.app.config.map.center,!0):!1}shouldFetchResourceSets(t){return this.app.config.resources.fetchRadius!==0&&this.app.config.resources.fetchFilter&&this.skresOther.anyResourceSetSelection()?t?!0:this.mapMoveThresholdExceeded(50):!1}shouldFetchNotes(t){return this.showNoteslayer.update(()=>this.app.config.ui.showNotes&&this.app.config.map.zoomLevel>=this.app.config.resources.notes.minZoom),this.app.debug(`lastGet: ${this.app.data.lastGet}`),this.app.debug(`getRadius: ${this.app.config.resources.notes.getRadius}`),t?!(this.mapZoomLevel()<this.app.config.resources.notes.minZoom):this.mapMoveThresholdExceeded(this.app.config.resources.notes.getRadius)}getFeatureInfo(t){if(!this.app.config.resources.featureServer.url)return;let e=this.app.config.resources.featureServer.url.replaceAll("%longitude%",t[0].toString()).replaceAll("%latitude%",t[1].toString());this.http.get(e).subscribe(i=>{Array.isArray(i?.features)?this.bottomSheet.open(qD,{disableClose:!0,data:i.features}):this.app.showAlert("Invalid Response","Invalid data received!")},i=>{this.app.parseHttpErrorResponse(i)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=U({type:n,selectors:[["fb-map"]],viewQuery:function(e,i){if(e&1&&gt(Ga,7)(hBe,5),e&2){let r;de(r=ue())&&(i.contextMenu=r.first),de(r=ue())&&(i.olMap=r.first)}},inputs:{setFocus:"setFocus",mapCenter:"mapCenter",mapZoom:"mapZoom",movingMap:"movingMap",northUp:"northUp",measureMode:"measureMode",drawMode:"drawMode",modifyMode:"modifyMode",activeRoute:"activeRoute",vesselTrail:"vesselTrail",dblClickZoom:"dblClickZoom",scaleUnits:[1,"scaleUnits"]},outputs:{drawEnded:"drawEnded",activate:"activate",deactivate:"deactivate",info:"info",exitMovingMap:"exitMovingMap",focusVessel:"focusVessel",menuItemSelected:"menuItemSelected"},features:[be],decls:62,vars:113,consts:[["olMap",""],["contextMenu","matMenu"],["olView","",3,"mapMoveEnd","mapSingleClick","mapRightClick","mapPointerDown","mapPointerMove","mapPointerDrag","mapContextMenu","contextmenu","logo","olInteractions","olControls","setFocus","zoom","center","rotation","minZoom","maxZoom","enableAnimation"],[3,"type","style","stopClick"],[3,"type","stopClick","style"],[3,"features"],[1,"ol-zoom"],["mat-mini-fab","","matTooltip","Zoom out",1,"button-accent",3,"click","disabled"],["mat-mini-fab","","matTooltip","Zoom in",1,"button-accent",3,"click","disabled"],[1,"ol-mouse-position"],[2,"background-color","rgba(250, 250, 250, 0.7)","padding","0 5px 0 5px"],[3,"innerText"],[3,"zIndex","charts","colorMode"],[3,"params","layerDefs","zIndex"],[3,"darkMode","tracks","labelMinZoom","mapZoom","zIndex"],["targetContext","vessels","zIndex","110",3,"tracks","tracksMinZoom","updateIds","removeIds","mapZoom"],[3,"routes","routeStyles","activeRoute","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"points","pointIndex","reverse","zIndex"],[3,"darkMode","waypoints","activeWaypoint","labelMinZoom","mapZoom","zIndex"],["targetContext","atons",3,"darkMode","targets","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","shore.basestations",3,"darkMode","targets","targetStyles","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","meteo",3,"darkMode","targets","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","aircraft",3,"darkMode","targets","targetStyles","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","sar",3,"darkMode","targets","targetStyles","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],[3,"startLine","racecourseStyles","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"regions","regionStyles","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"notes","zIndex"],[3,"position","positioning"],[3,"radius","anchorPosition","vesselPosition","anchorStyles","zIndex"],[3,"cpaLines","zIndex"],[3,"alarms","alarmStyles","zIndex"],[3,"position","maxCircles","mapZoom","darkMode","minZoom","units","zIndex"],[3,"coords","cogTime","units","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"twd","tws","awa","aws","position","zIndex"],[3,"position","heading","id","activeId","vesselLines","iconScale","fixedLocation","zIndex"],[3,"localTrail","serverTrail","trailStyles","zIndex"],[3,"zIndex","charts"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],[3,"contextmenu"],["matMenuContent",""],[3,"boxStart","boxEnd","boxCancel"],[3,"drawStart","drawEnd","type","stopClick"],[3,"drawEnd","type","stopClick"],[3,"modifyStart","modifyEnd","features"],[3,"darkMode","collection","resourceSets","labelMinZoom","mapZoom","zIndex"],[3,"targetContext","targets","vectorApparent","mapZoom","labelMinZoom","focusId","filterIds","filterByShipType","filterShipTypes","updateIds","staleIds","removeIds","inactiveTime","zIndex","darkMode"],[3,"flagged","targetContext","targets","mapZoom","labelMinZoom","focusId","filterIds","filterByShipType","filterShipTypes","updateIds","staleIds","removeIds","inactiveTime","zIndex","darkMode"],["targetContext","vessels",3,"darkMode","targets","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex","focusId","filterIds","filterByShipType","filterShipTypes","cogLineLength"],[3,"title","canClose","measure"],[3,"canClose","features"],[3,"canClose","title","features"],[3,"canClose","title","type","resource","active","featureCount","units"],[3,"canClose","title","resource"],[3,"canClose","aton"],[3,"canClose","aircraft"],[3,"canClose","alarm","id"],[3,"closed","title","canClose","measure"],[3,"selected","closed","canClose","features"],[3,"selected","closed","canClose","title","features"],[3,"modify","delete","addNote","activated","deactivated","related","notes","info","points","closed","canClose","title","type","resource","active","featureCount","units"],[3,"modify","delete","info","closed","canClose","title","resource"],[3,"info","focused","markPosition","closed","canClose","vessel","useMagnetic","isActive","isSelf"],[3,"info","closed","canClose","aton"],[3,"info","closed","canClose","aircraft"],[3,"info","goto","closed","canClose","alarm","id"],[3,"color","startPosition","destPosition","zIndex","visible","layerProperties"],[3,"markerPosition","vesselPosition","showMarker","markerName","bearingStyles","labelMinZoom","mapZoom","zIndex"],[3,"radius","position","zIndex"],[3,"line","lineStyle","position","twd","mapZoom","zIndex"],[3,"lines","laylineStyles","position","twd","mapZoom","zIndex"],["mat-menu-item","",3,"contextmenu","click"],["mat-menu-item",""],["mat-menu-item","",3,"click","contextmenu"],[1,"icon-waypoint"],["mat-menu-item","",3,"click"]],template:function(e,i){if(e&1){let r=H();u(0,"ol-map",2,0),M("mapMoveEnd",function(a){return C(r),x(i.onMapMoveEnd(a))})("mapSingleClick",function(a){return C(r),x(i.onMapSingleClick(a))})("mapRightClick",function(a){return C(r),x(i.onMapRightClick(a))})("mapPointerDown",function(a){return C(r),x(i.onMapPointerDown(a))})("mapPointerMove",function(a){return C(r),x(i.onMapPointerMove(a))})("mapPointerDrag",function(){return C(r),x(i.onMapPointerDrag())})("mapContextMenu",function(a){return C(r),x(i.onMapContextMenu(a))})("contextmenu",function(a){return C(r),x(i.onContextMenu(a))}),R(2,gBe,1,0,"ol-dragbox"),R(3,_Be,1,4,"ol-draw",3),R(4,bBe,1,4,"ol-draw",4),R(5,yBe,1,1,"ol-modify",5),u(6,"ol-control")(7,"ol-content")(8,"div",6)(9,"button",7),M("click",function(){return C(r),x(i.zoomMap(!1))}),u(10,"mat-icon"),_(11,"remove"),p()(),_(12," \xA0 "),u(13,"button",8),M("click",function(){return C(r),x(i.zoomMap(!0))}),u(14,"mat-icon"),_(15,"add"),p()()()()(),u(16,"ol-control")(17,"ol-content")(18,"div",9)(19,"span",10),R(20,vBe,2,0,"span"),B(21,"span",11),Fi(22,"coords"),_(23," \xA0 "),R(24,CBe,2,0,"span"),B(25,"span",11),Fi(26,"coords"),_(27," \xA0 "),B(28,"span",11),p()()()(),B(29,"fb-charts",12)(30,"fb-livelayer",13),R(31,xBe,1,5,"fb-tracks",14),R(32,wBe,1,5,"ais-targets-track",15),ye(33,MBe,2,6,"div",null,mBe),B(35,"fb-routes",16),R(36,SBe,1,4,"fb-route-direction",17),B(37,"fb-waypoints",18)(38,"sk-ais-targets",19)(39,"sk-ais-targets",20),R(40,EBe,1,9,"sk-ais-targets",21),R(41,TBe,4,30,"div"),R(42,IBe,1,10,"sk-ais-targets",22),R(43,kBe,1,10,"sk-ais-targets",23),B(44,"racing-start-line",24)(45,"fb-regions",25),R(46,PBe,1,2,"fb-notes",26),R(47,zBe,10,11,"ol-overlay",27),R(48,UBe,1,5,"fb-anchor-alarm",28),R(49,HBe,1,2,"fb-cpa-alarms",29),B(50,"fb-alarms",30),R(51,KBe,4,4),R(52,XBe,1,7,"fb-range-circles",31),R(53,YBe,1,7,"fb-cog-line",32),R(54,ZBe,1,6,"fb-wind-lines",33),B(55,"fb-vessel",34),R(56,QBe,1,3,"fb-vessel-trail",35),R(57,JBe,1,2,"fb-chart-bounds",36),p(),B(58,"div",37),u(59,"mat-menu",38,1),M("contextmenu",function(a){return C(r),x(a.preventDefault())}),wt(61,sje,29,5,"ng-template",39),p()}if(e&2){let r=pe(60);Mi("cursor",i.mapInteract.isDrawing()||i.mapInteract.isModifying()||i.mapInteract.isMeasuring()?"crosshair":"initial"),T("logo",!1)("olInteractions",i.olMapInteractions())("olControls",i.olMapControls)("setFocus",i.setFocus)("zoom",i.mapZoomLevel())("center",i.mapCenterPositon())("rotation",i.mapRotation())("minZoom",i.app.MAP_ZOOM_EXTENT.min)("maxZoom",i.app.MAP_ZOOM_EXTENT.max)("enableAnimation",!1),h(2),F(i.mapInteract.isBoxSelecting()?2:-1),h(),F(i.mapInteract.isMeasuring()?3:-1),h(),F(i.mapInteract.isDrawing()?4:-1),h(),F(i.mapInteract.isModifying()&&i.mapInteract.draw.features?5:-1),h(4),T("disabled",i.mapZoomLevel()<=i.app.MAP_ZOOM_EXTENT.min),h(4),T("disabled",i.mapZoomLevel()>=i.app.MAP_ZOOM_EXTENT.max),h(7),F(i.app.config.units.positionFormat==="XY"?20:-1),h(),T("innerText",jn(22,106,i.mouse.coords[1],i.app.config.units.positionFormat,!0)),h(3),F(i.app.config.units.positionFormat==="XY"?24:-1),h(),T("innerText",Xr(26,110,i.mouse.coords[0],i.app.config.units.positionFormat)),h(3),T("innerText","Zm: "+i.mapZoomLevel().toFixed(1)),h(),T("zIndex",10)("charts",i.skres.charts())("colorMode",i.app.data.vessels.self.environment.sun),h(),T("params",i.skresOther.infoLayerParams())("layerDefs",i.skresOther.infoLayers())("zIndex",50),h(),F(i.app.featureFlags().resourceTracks?31:-1),h(),F(i.app.config.ui.showAisTargets&&i.app.config.vessels.aisShowTrack?32:-1),h(),ve(i.skresOther.resourceSets()),h(2),T("routes",i.skres.routes())("routeStyles",i.featureStyles.route)("activeRoute",i.activeRoute)("darkMode",i.app.uiConfig().invertColor)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",500),h(),F(i.activeRoute&&!i.app.data.activeRouteIsEditing?36:-1),h(),T("darkMode",i.app.uiConfig().invertColor)("waypoints",i.skres.waypoints())("activeWaypoint",i.app.data.activeWaypoint)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",600),h(),T("darkMode",i.app.uiConfig().invertColor)("targets",i.dfeat.atons)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("updateIds",i.skstream.aisStatus().updated)("staleIds",i.skstream.aisStatus().stale)("removeIds",i.skstream.aisStatus().expired)("inactiveTime",i.app.config.vessels.aisStaleAge)("zIndex",200),h(),T("darkMode",i.app.uiConfig().invertColor)("targets",i.dfeat.atons)("targetStyles",i.featureStyles.basestation)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("updateIds",i.skstream.aisStatus().updated)("staleIds",i.skstream.aisStatus().stale)("removeIds",i.skstream.aisStatus().expired)("inactiveTime",i.app.config.vessels.aisStaleAge)("zIndex",210),h(),F(i.app.config.ui.showAisTargets?40:-1),h(),F(i.app.config.ui.showAisTargets?41:-1),h(),F(i.app.config.ui.showAisTargets?42:-1),h(),F(i.app.config.ui.showAisTargets?43:-1),h(),T("startLine",i.app.data.racing.startLine)("racecourseStyles",i.featureStyles.raceCourse)("darkMode",i.app.uiConfig().invertColor)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",540),h(),T("regions",i.skres.regions())("regionStyles",i.featureStyles.region)("darkMode",i.app.uiConfig().invertColor)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",400),h(),F(i.showNoteslayer()?46:-1),h(),F(i.overlay().show&&!i.mapInteract.isModifying()?47:-1),h(),F(i.anchor.raised()?-1:48),h(),F(i.dfeat.closest.length!==0?49:-1),h(),T("alarms",i.notiMgr.mobAlerts())("alarmStyles",i.featureStyles.alarm)("zIndex",310),h(),F(i.anchor.raised()&&i.dfeat.navData.position?51:-1),h(),F(i.app.config.vessels.rangeCircles?52:-1),h(),F(i.app.config.vessels.cogLine!==0?53:-1),h(),F(i.app.config.vessels.windVectors?54:-1),h(),T("position",i.dfeat.self.position)("heading",i.dfeat.self.orientation)("id",""+i.app.data.selfId)("activeId",i.app.data.vessels.activeId)("vesselLines",i.vesselLines())("iconScale",i.app.config.vessels.iconScale)("fixedLocation",i.app.config.vessels.fixedLocationMode)("zIndex",999),h(),F(i.app.config.vessels.trail&&i.app.data.vessels.showSelf?56:-1),h(),F(i.app.data.chartBounds.show?57:-1),h(),Mi("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),T("matMenuTriggerFor",r)}},dependencies:[ze,$e,Ur,_p,me,he,ge,$s,ft,Wa,ha,Ea,lK,Ga,fv,oy,Lh,Rh,ct,ry,Fh,my,gy,_y,by,yy,vy,Gh,Cy,Wy,Uy,Hy,Gy,$y,qy,Ky,Xy,Yy,Zy,Qy,Jy,ev,iv,nv,tv,rv,ov,av,sv,lv,cv,dv,uv,pv,oa,Ok,Rk,Nk,Lk,Fk,Dk,Tk,Ak,Cr],styles:[".mapButton[_ngcontent-%COMP%]{position:fixed;z-index:4000}.control[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-start;margin:20px}.ol-mouse-position[_ngcontent-%COMP%]{width:100%;top:unset;bottom:10px;left:unset;right:unset;text-align:center;color:#1e1e1e;font-family:roboto}.ol-zoom[_ngcontent-%COMP%]{position:fixed;top:10px;left:60px;color:#1e1e1e;font-family:roboto;background-color:transparent;height:45px} .ol-dragbox{background-color:#fff6!important;border-color:#649600!important;border-style:solid;border-width:1px}.nosmall[_ngcontent-%COMP%]{display:block}@media only screen and (max-width:400px){.nosmall[_ngcontent-%COMP%]{display:none}.ol-mouse-position[_ngcontent-%COMP%]{bottom:2px}}"]})};var iA=class{symDegree="\xBA";availableUnits={distance:new Map([["m","Kilometres"],["ft","Nautical Miles"]]),depth:new Map([["m","metres"],["ft","feet"]]),speed:new Map([["kn","knots"],["msec","m/sec"],["kmh","km/h"],["mph","mph"]]),temperature:new Map([["c","Celsius"],["f","Fahrenheit"]])};preferredValues={heading:[["navigation.headingTrue","True"],["navigation.headingMagnetic","Magnetic"]],wind:new Map([[!1,"Wind True"],[!0,"Wind Apparent"]]),coords:[["XY","-128.12345"],["SHDd",`W-128.12345${this.symDegree}`],["DMdH",`128${this.symDegree} 15.34567' W`],["HDd",`W 128.12345${this.symDegree}`],["HDMS",`W 128${this.symDegree}15'46"123`],["DHMS",`128W15'46"123`]]};buttons={fab:new Map([["wpt","Waypoint at vessel"],["pob","Person Overboard"],["autopilot","Autopilot Console"]])};map={centerOffset:new Map([[0,"0%"],[.2,"20%"],[.3,"30%"],[.5,"50%"],[.7,"70%"]]),s57:{graphicsStyle:new Map([["Simplified","Simplified"],["Paper","Paper chart"]]),boundaries:new Map([["Symbolized","Symbolized"],["Plain","Plain"]]),colors:[2,4],shallowDepth:2,safetyDepth:3,deepDepth:6,colorTables:new Map([[0,"Day Bright"],[1,"Day Black Background"],[2,"Day White Background"],[3,"Dusk"],[4,"Night"]])}};trailIntervals={highResolution:new Map([["1s","1 sec"],["5s","5 secs"],["10s","10 secs"],["30s","30 secs"],["1m","1 min"]]),mediumResolution:new Map([["10s","10 secs"],["30s","30 secs"],["1m","1 min"],["2m","2 mins"],["5m","5 mins"],["10m","10 mins"],["15m","15 mins"],["30m","30 mins"]])};alarm={smoothing:new Map([[5e3,"5 secs"],[1e4,"10 secs"],[2e4,"20 secs"],[3e4,"30 secs"]])};darkMode=new Map([[0,"Use OS setting"],[1,"Use Signal K Mode"],[-1,"On"]]);vessel={selfIconScale:new Map([[.75,"S"],[.9,"M"],[1.15,"L"],[1.4,"XL"]]),headingLine:new Map([[-1,"Default"],[1,"1 NM (2km)"],[2,"2 NM (4km)"],[5,"5 NM (10km)"],[10,"10 NM (20km)"],[15,"15 NM (30km)"],[20,"20 NM (40km)"],[50,"50 NM (90km)"],[100,"100 NM (180km)"]]),cogLine:new Map([[0,"None"],[5,"5 min"],[10,"10 min"],[30,"30 min"],[60,"60 min"],[120,"2 hrs"],[1440,"24 hrs"]]),aisTimeouts:new Map([[6e4,"1 min"],[12e4,"2 min"],[18e4,"3 min"],[36e4,"6 min"],[54e4,"9 min"],[15*6e4,"15 min"],[30*6e4,"30 min"],[60*6e4,"1 hr"],[1440*6e4,"24 hrs"]]),aisMaxRadius:new Map([[0,"None"],[1e4,"5 NM (10km)"],[2e4,"10 NM (20km)"],[3e4,"15 NM (30km)"],[4e4,"20 NM (40km)"],[5e4,"25 NM (50km)"],[75e3,"40 NM (75km)"],[1e5,"55 NM (100km)"]]),aisCogLine:new Map([[0,"Off"],[10,"10 min"],[30,"30 min"],[60,"60 min"]])};rangeCircles={count:[4,5,6,7,8,9,10,15,20]};course={nextPointTrigger:["perpendicularPassed","arrivalCircleEntered"],nextPointDelay:this.alarm.smoothing};resources={noteRadius:[5,10,20,50,100,150,200,500],resSetRadius:[0,5,10,20,50,100,150,200,500]};zoomLevels=[8,9,10,11,12,13,14,15,16,17]},Cu=class n{constructor(t,e){this.app=t;this.signalk=e;this.changeEvent=new ie,this.change$=this.changeEvent.asObservable(),this.data=this.app.data,this.settings=this.app.config,this.fixedPosition=this.settings.vessels.fixedPosition.slice()}applicationList=[];favouritesList=[];resourcePathList=[];fixedPosition=[0,0];settings;data;changeEvent;change$;emitChangeEvent(t){let e=t?[t]:[];this.changeEvent.next(e)}clearToken(){this.app.persistToken(null)}refresh(){this.settings=this.app.config,this.fixedPosition=this.settings.vessels.fixedPosition.slice(),this.getApps(),this.getResourcePaths()}getResourcePaths(){this.signalk.api.get(this.app.skApiVersion,"resources").subscribe(t=>{this.resourcePathList=Object.keys(t).filter(e=>!this.app.IGNORE_RESOURCES.includes(e)).sort()},()=>this.resourcePathList=[])}getApps(){this.app.config.display.plugins.instruments&&this.applicationList.push(this.app.config.display.plugins.instruments),this.signalk.apps.list().subscribe(t=>{this.applicationList=t.map(e=>{if(e.name==="@signalk/freeboard-sk")return null;if(!e._location&&!e.location)return{name:e.name,description:e.description,url:`/${e.name}`};if(typeof e._location<"u"){let i=e._location.indexOf("/signalk-server/");return{name:e.name,description:e.description,url:i===-1?e._location:e._location.slice(15)}}else if(typeof e.location<"u")return{name:e.name,description:e.description,url:e.location}}).filter(e=>e),this.applicationList.unshift({name:"None",description:"",url:null}),this.buildFavouritesList()},()=>{this.app.debug("ERROR retrieving AppList!")})}buildFavouritesList(){this.favouritesList=this.applicationList.slice(1);let t=this.app.config.display.plugins.favourites.indexOf(this.app.config.display.plugins.instruments)}applySettings(){this.app.debug("Saving Settings.."),this.app.config.vessels.trail||(this.app.config.vessels.trailFromServer=!1),typeof this.fixedPosition[0]=="number"&&typeof this.fixedPosition[1]=="number"&&(this.settings.vessels.fixedPosition=this.fixedPosition.slice(),this.settings.vessels.fixedLocationMode&&(this.app.data.vessels.self.position=this.fixedPosition.slice())),this.app.saveConfig()}static \u0275fac=function(e){return new(e||n)(je(Ie),je(bi))};static \u0275prov=ce({token:n,factory:n.\u0275fac,providedIn:"root"})};var cje=(n,t)=>t[0];function dje(n,t){if(n&1){let e=H();u(0,"div",4)(1,"mat-radio-button",5,0),M("change",function(){C(e);let r=pe(2),o=y().$implicit,a=y();return o[1].current=r.value,x(a.save(!0))}),_(3),p()()}if(n&2){let e=t.$implicit,i=y().$implicit;h(),T("name",i[0])("value",e)("checked",e===i[1].current),h(2),Z(" ",e.split(".").slice(-1)," ")}}function uje(n,t){if(n&1&&(u(0,"div",2)(1,"div",3)(2,"div"),_(3),p()(),u(4,"div"),ye(5,dje,4,4,"div",4,rt),p()()),n&2){let e=t.$implicit;h(3),K(e[1].name),h(2),ve(e[1].available)}}var nA=class n{constructor(t){this.app=t}title="";chosen=new q;pathChoices={tws:{name:"True Wind Speed",choices:["environment.wind.speedTrue","environment.wind.speedOverGround"],available:[],current:""},twd:{name:"True Wind Direction",choices:["environment.wind.directionTrue","environment.wind.directionMagnetic","environment.wind.angleTrueGround","environment.wind.angleTrueWater"],available:[],current:""},heading:{name:"Heading / COG",choices:["navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.headingTrue","navigation.headingMagnetic"],available:[],current:""}};pathChoicesArray=Object.entries(this.pathChoices);availPaths;ngOnInit(){this.initEntries()}initEntries(){this.availPaths=new Map(Object.entries(this.app.data.vessels.prefAvailablePaths)),this.pathChoices.tws.current=this.app.config.units.preferredPaths.tws,this.pathChoices.twd.current=this.app.config.units.preferredPaths.twd,this.pathChoices.heading.current=this.app.config.units.preferredPaths.heading,Object.entries(this.pathChoices).forEach(e=>{let i=e[1];i.choices.forEach(r=>{this.availPaths.has(r)&&i.available.push(r)}),i.available.length===0&&i.available.push(i.choices[0])})}save(t){let e={};Object.entries(this.pathChoices).forEach(i=>{e[i[0]]=i[1].current}),this.chosen.emit({save:t,value:e})}static \u0275fac=function(e){return new(e||n)(N(Ie))};static \u0275cmp=U({type:n,selectors:[["signalk-preferred-paths"]],inputs:{title:"title"},outputs:{chosen:"chosen"},decls:6,vars:1,consts:[["pathopt",""],[2,"font-size","10pt"],[1,"sk-details"],[1,"title"],[2,"margin","5px 0 5px 0"],[3,"change","name","value","checked"]],template:function(e,i){e&1&&(u(0,"fieldset")(1,"legend",1),_(2),p(),u(3,"div"),ye(4,uje,7,1,"div",2,cje),p()()),e&2&&(h(2),K(i.title),h(2),ve(i.pathChoicesArray))},dependencies:[bb,_b],styles:[".sk-details[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;font-family:Roboto,Arial,Helvetica,sans-serif;font-size:10pt;max-height:100%;width:60vw;max-width:300px}.sk-details[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{background:left 1px -webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.18)),color-stop(.65,transparent)) #b2bbc2e3;padding:3px 5px 0;margin-top:3px;font-weight:500;line-height:23px;color:#000}.sk-details[_ngcontent-%COMP%] .content[_ngcontent-%COMP%]{padding:0;line-height:23px;margin:0;flex:1 1 auto;overflow:auto}.sk-details[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{display:flex;flex-direction:row;line-height:26px;border-width:0 0 0 0;border-style:solid;border-color:gray;padding-left:5px}.sk-details[_ngcontent-%COMP%] .content[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{border-width:0 0 1px 0}.sk-details[_ngcontent-%COMP%] .sectionname[_ngcontent-%COMP%]{text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;font-weight:500}.sk-details[_ngcontent-%COMP%] .pathvalue[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;width:100%;background-color:#fff}.sk-details[_ngcontent-%COMP%] .pathvalue[_ngcontent-%COMP%] .path[_ngcontent-%COMP%]{text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-style:italic}.sk-details[_ngcontent-%COMP%] .pathvalue[_ngcontent-%COMP%] .value[_ngcontent-%COMP%]{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"],changeDetection:0})};var yo=(n,t)=>t[0];function pje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function fje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function hje(n,t){if(n&1&&(u(0,"mat-option",102),_(1),p()),n&2){let e=t.$implicit;T("value",e.url)("matTooltip",e.description),h(),Z(" ",e.name," ")}}function mje(n,t){if(n&1){let e=H();u(0,"div",39)(1,"div",32)(2,"mat-form-field",33)(3,"mat-label"),_(4,"Select Instruments App"),p(),u(5,"mat-select",45),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.display.plugins.instruments,r)||(o.facade.settings.display.plugins.instruments=r),x(r)}),M("selectionChange",function(){C(e);let r=y();return x(r.onInstrumentApp())}),ye(6,hje,2,3,"mat-option",102,rt),p()()(),u(8,"div",32)(9,"mat-form-field",78)(10,"mat-label"),_(11,"Parameters"),p(),u(12,"input",103,16),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.display.plugins.parameters,r)||(o.facade.settings.display.plugins.parameters=r),x(r)}),M("change",function(){C(e);let r=y();return x(r.persistModel("pluginParameters"))}),p()()(),u(14,"div",32)(15,"mat-checkbox",104),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.display.plugins.startOnOpen,r)||(o.facade.settings.display.plugins.startOnOpen=r),x(r)}),M("change",function(){C(e);let r=y();return x(r.persistModel("pluginStartOnOpen"))}),_(16," Halt App on hide "),p()(),u(17,"div",32)(18,"button",105),M("click",function(){C(e);let r=y();return x(r.toggleFavourites())}),u(19,"mat-icon"),_(20,"star"),p(),_(21," FAVOURITES "),p()()()}if(n&2){let e=y();h(5),Se("ngModel",e.facade.settings.display.plugins.instruments),h(),ve(e.facade.applicationList),h(6),T("disabled",e.facade.settings.display.plugins.instruments===null),Se("ngModel",e.facade.settings.display.plugins.parameters),h(3),Se("ngModel",e.facade.settings.display.plugins.startOnOpen)}}function gje(n,t){if(n&1&&(u(0,"mat-list-option",107),_(1),p()),n&2){let e=t.$implicit,i=y(2);T("disabled",e.url==i.facade.settings.display.plugins.instruments)("selected",i.facade.settings.display.plugins.favourites.includes(e.url))("value",e.url),h(),Z(" ",e.name," ")}}function _je(n,t){if(n&1){let e=H();u(0,"div",31)(1,"div",32)(2,"div",84),B(3,"br"),_(4,"Select Favourite Apps: "),p(),B(5,"mat-divider"),u(6,"mat-selection-list",106,17),M("selectionChange",function(r){C(e);let o=pe(7),a=y();return x(a.onFavSelected(r,o))}),ye(8,gje,2,4,"mat-list-option",107,rt),p()()()}if(n&2){let e=y();h(8),ve(e.facade.favouritesList)}}function bje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function yje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function vje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Cje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function xje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function wje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Mje(n,t){if(n&1){let e=H();u(0,"div",32)(1,"mat-form-field",33)(2,"mat-label"),_(3,"Position display format"),p(),u(4,"mat-select",108),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.units.positionFormat,r)||(o.facade.settings.units.positionFormat=r),x(r)}),M("selectionChange",function(){C(e);let r=y();return x(r.persistModel())}),ye(5,wje,2,2,"mat-option",35,rt),p()()()}if(n&2){let e=y();h(4),Se("ngModel",e.facade.settings.units.positionFormat),h(),ve(e.options.preferredValues.coords)}}function Sje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Eje(n,t){if(n&1){let e=H();u(0,"div",32)(1,"mat-form-field",33)(2,"mat-label"),_(3,"Prefer True / Magnetic values"),p(),u(4,"mat-select",109),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.units.headingAttribute,r)||(o.facade.settings.units.headingAttribute=r),x(r)}),M("selectionChange",function(){C(e);let r=y();return x(r.persistModel("headingAttribute"))}),ye(5,Sje,2,2,"mat-option",35,rt),p()()()}if(n&2){let e=y();h(4),Se("ngModel",e.facade.settings.units.headingAttribute),h(),ve(e.options.preferredValues.heading)}}function Dje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Tje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Ije(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function kje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Pje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Aje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a positive number "),p())}function Oje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a positive number "),p())}function Rje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a positive number "),p())}function Lje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a number > 0 "),p())}function Fje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Nje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Vje(n,t){if(n&1&&(u(0,"mat-radio-button",35),B(1,"img",110),_(2),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),z0(`transform: scale(${e[0]})`),h(),Z(" (",e[1],") ")}}function Bje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a value between -90 and 90 (max 9 decimals) "),p())}function jje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a value between -180 and 180 (max 9 decimals) "),p())}function zje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Uje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Hje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Gje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Wje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function $je(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function qje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Kje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Xje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Yje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Zje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Qje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Jje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function eze(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function tze(n,t){if(n&1){let e=H();u(0,"button",111),M("click",function(){C(e),y();let r=pe(437);return x(r.value="")}),u(1,"mat-icon"),_(2,"close"),p()()}}function ize(n,t){if(n&1&&(u(0,"mat-list-option",86),_(1),p()),n&2){let e=t.$implicit,i=y();T("selected",i.facade.settings.resources.paths.includes(e))("value",e),h(),Z(" ",e," ")}}function nze(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function rze(n,t){n&1&&(u(0,"mat-error"),_(1," Value required. "),p())}function oze(n,t){n&1&&(u(0,"mat-error"),_(1," Value required. "),p())}var rA=class n{constructor(t,e,i,r,o){this.facade=t;this.myElement=e;this.dialogRef=i;this.wakeLock=r;this.s57=o;this.options=new iA}show={favourites:oe(!1)};options;aisStateFilter={moored:!1,anchored:!1};saveOnClose=!1;ngOnInit(){this.facade.refresh(),this.facade.settings.selections.aisState.forEach(t=>{t in this.aisStateFilter&&(this.aisStateFilter[t]=!0)})}handleClose(){this.saveOnClose&&this.persistModel(),this.dialogRef.close()}doWakelock(t){this.persistModel(),t?this.wakeLock.disable():this.wakeLock.enable()}doS57(t){t?this.parseNumber(t):this.persistModel(),this.s57.SetOptions(this.facade.settings.map.s57Options)}toggleFavourites(){this.show.favourites.update(t=>!t)}parseNumber(t,e){if(typeof t.model!="number"){t.reset(this.fallbackToDefault());return}!e&&t.model<0&&t.reset(Math.abs(t.model)),this.persistModel()}fallbackToDefault(){let t=fC();if(typeof this.facade.settings.map.s57Options.shallowDepth!="number")return t.map.s57Options.shallowDepth;if(typeof this.facade.settings.map.s57Options.safetyDepth!="number")return t.map.s57Options.safetyDepth;if(typeof this.facade.settings.map.s57Options.deepDepth!="number")return t.map.s57Options.deepDepth;if(typeof this.facade.fixedPosition[0]!="number"||typeof this.facade.fixedPosition[1]!="number")return 0;if(typeof this.facade.settings.course.arrivalCircle!="number")return t.course.arrivalCircle}persistModel(t){this.facade.applySettings(),this.facade.emitChangeEvent(t)}deferPersist(t){this.saveOnClose=!0,this.facade.emitChangeEvent(t)}onInstrumentApp(){this.persistModel("pluginInstruments"),this.facade.buildFavouritesList()}onPreferredPaths(t){t.save&&(this.facade.settings.units.preferredPaths=t.value,this.persistModel())}onFavSelected(t,e){this.facade.settings.display.plugins.favourites=e.selectedOptions.selected.map(i=>i.value),this.persistModel()}onAisStateFilter(){let t=[];for(let e in this.aisStateFilter)this.aisStateFilter[e]&&t.push(e);this.facade.settings.selections.aisState=[].concat(t),this.persistModel()}onResPathSelected(t){this.facade.settings.resources.paths=t.selectedOptions.selected.map(e=>e.value),this.facade.settings.resources.paths.forEach(e=>{e in this.facade.settings.selections.resourceSets||(this.facade.settings.selections.resourceSets[e]=[])}),this.persistModel()}clearAuthToken(){this.facade.clearToken()}static \u0275fac=function(e){return new(e||n)(N(Cu),N(Oe),N(Gt),N(P_),N(gf))};static \u0275cmp=U({type:n,selectors:[["settings-dialog"]],decls:539,vars:99,consts:[["distunits",""],["s57shallowDepth","ngModel"],["s57safetyDepth","ngModel"],["s57deepDepth","ngModel"],["coursearrivalcircle","ngModel"],["courseautoadvance",""],["courseautoadvanceon",""],["vesselfixedlocationmode",""],["fixedlat","ngModel"],["fixedlon","ngModel"],["notesrootfilter",""],["respath",""],["skmaxradius",""],["videourl","ngModel"],["experiments",""],["featureserverurl","ngModel"],["instparams","ngModel"],["favs",""],[2,"background-color","transparent"],[1,"dialog-icon"],[2,"flex","1 1 auto","text-align","center"],[2,"text-align","right"],["mat-icon-button","",3,"click"],["mat-dialog-content","",2,"display","flex"],["dynamicHeight","false","mat-stretch-tabs","false","mat-align-tabs","start"],["label","Display"],[1,"theme-page","settings"],[1,"theme-panel"],["id","sectDisplay",1,"setting-group"],[1,"setting-group-title"],[1,"setting-card"],[1,"setting-card-row",2,"padding-bottom","10px"],[1,"setting-card-row-item"],[2,"width","100%"],["matTooltip","Dark Mode setting.",3,"ngModelChange","selectionChange","ngModel"],[3,"value"],["label","after","matTooltip","Auto-set using environment.mode value.",3,"ngModelChange","change","ngModel"],["matTooltip","Action button selection.",3,"ngModelChange","selectionChange","ngModel"],["label","after","matTooltip","Disable wake lock.",3,"ngModelChange","change","disabled","ngModel"],[1,"setting-card-row"],["matTooltip","Do not play sounds","label","after",3,"ngModelChange","change","ngModel"],["label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Period of time out of alarm state before re-triggering.",3,"ngModelChange","selectionChange","ngModel","disabled"],["label","Units"],["id","sectUnits",1,"setting-group"],[3,"ngModelChange","selectionChange","ngModel"],["title","Preferred Paths",3,"chosen"],["label","Map"],["id","sectMap",1,"setting-group"],["matTooltip","Add close button to popovers","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Double Click map to zoom","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Do not exit follow vessel when map is panned.","label","after",3,"ngModelChange","change","ngModel"],["placeholder","Graphicsstyle",3,"ngModelChange","selectionChange","ngModel"],["placeholder","Boundaries",3,"ngModelChange","selectionChange","ngModel"],["placeholder","Colors",3,"ngModelChange","selectionChange","ngModel"],["matInput","","type","number","required","","min","0",3,"ngModelChange","change","ngModel"],["matSuffix",""],["label","Course"],["id","sectCourse",1,"setting-group"],["matTooltip","Select the trigger for advancing to next point.",3,"ngModelChange","selectionChange","disabled","ngModel"],["matTooltip","Period of time before destination is advanced to next waypoint.",3,"ngModelChange","selectionChange","disabled","ngModel"],["label","Vessels"],["id","sectVessels",1,"setting-group"],[3,"ngModelChange","change","ngModel"],["label","after","matTooltip","e.g. Building, Camp, etc.",3,"ngModelChange","change","ngModel"],["floatLabel","always"],["matInput","","type","number","required","","pattern","^-?([1-8]?[0-9])(\\.\\d{1,9})?$","min","-90","max","90",3,"ngModelChange","change","ngModel","disabled"],["matInput","","type","number","required","","pattern","^-?(1[0-7]?[0-9]|[1-9]?[0-9])(\\.\\d{1,9})?$","min","-180","max","180",3,"ngModelChange","change","ngModel","disabled"],["matTooltip","Length of heading line.",3,"ngModelChange","selectionChange","ngModel"],["matTooltip","Length of COG line.",3,"ngModelChange","selectionChange","ngModel"],[3,"ngModelChange","selectionChange","ngModel","disabled"],["matTooltip","Select to source trail data from the server","label","after",3,"ngModelChange","change","disabled","ngModel"],["discrete","","tickInterval","1","min","1","max","96",3,"disabled"],["matSliderThumb","",3,"ngModelChange","valueChange","ngModel"],["label","Resources"],["id","sectNotes",1,"setting-group"],[3,"valueChange","selectionChange","disabled","value"],[3,"ngModelChange","selectionChange","disabled","ngModel"],["floatLabel","always",2,"width","100%"],["matInput","","type","text","placeholder","?radius=%note:radius%","matTooltip","Filter to apply when retrieving notes",3,"ngModelChange","change","ngModel"],["matSuffix","","mat-icon-button",""],["matTooltip","Allow group name editing.","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Require position information when adding notes to a group.","label","after",3,"ngModelChange","change","ngModel"],["id","sectResLayers",1,"setting-group"],[2,"font-style","italic"],["matTooltip","Select resource layers to show.",3,"selectionChange"],[3,"selected","value"],["label","Signal K"],["id","sectSKConnection",1,"setting-group"],[2,"font-size","smaller"],["matToolTip","Check to receive other vessel data","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Check to receive AtoN data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Check to receive aircraft data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Check to receive SaR data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Check to receive Weather / Meteo data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Only include AIS targets within this distance","matTooltipPosition","below",3,"ngModelChange","selectionChange","ngModel"],["mat-icon-button","","matTooltip","Clear Auth Token",3,"click"],["label","Experiments"],["id","sectExperiments",1,"setting-group"],["matInput","","type","text","required","","placeholder","Video stream URL","matTooltip","Enter URL of video stream",3,"ngModelChange","change","disabled","ngModel"],["matTooltip","Enable ALL experimental Features","label","after",3,"ngModelChange","change","ngModel"],["matInput","","type","text","placeholder","e.g. http://host:port/path/?position=[%pointer:longitude%,%pointer:latitude%]","matTooltip","Enter URL of feature server",3,"ngModelChange","change","disabled","ngModel"],["matTooltipPosition","right",3,"value","matTooltip"],["matInput","","type","text","placeholder","e.g. ?layout=mylayout","matTooltip","Enter parameters to pass to Instrument App",3,"ngModelChange","change","disabled","ngModel"],["matTooltip","Stop instrument app when hidden","label","after",3,"ngModelChange","change","ngModel"],["mat-raised-button","","matTooltip","Favourite Apps","label","after",3,"click"],[3,"selectionChange"],[3,"disabled","selected","value"],["matTooltip","Display position in this format",3,"ngModelChange","selectionChange","ngModel"],["matTooltip","Preferred value type for paths not in Preferred Paths above",3,"ngModelChange","selectionChange","ngModel"],["src","./assets/img/vessels/self.png"],["matSuffix","","mat-icon-button","",3,"click"]],template:function(e,i){if(e&1){let r=H();u(0,"mat-toolbar",18)(1,"span",19)(2,"mat-icon"),_(3,"settings"),p()(),u(4,"span",20),_(5,"Settings"),p(),u(6,"span",21)(7,"button",22),M("click",function(){return C(r),x(i.handleClose())}),u(8,"mat-icon"),_(9,"close"),p()()()(),u(10,"div",23)(11,"mat-tab-group",24)(12,"mat-tab",25)(13,"div",26)(14,"div",27)(15,"div",28)(16,"div",29),_(17,"DISPLAY"),p(),u(18,"mat-card",30)(19,"mat-card-content")(20,"div",31)(21,"div",32)(22,"mat-form-field",33)(23,"mat-label"),_(24,"Dark Mode setting"),p(),u(25,"mat-select",34),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.darkMode.source,a)||(i.facade.settings.display.darkMode.source=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel("darkTheme"))}),ye(26,pje,2,2,"mat-option",35,yo),p()()(),u(28,"div",32)(29,"mat-checkbox",36),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.nightMode,a)||(i.facade.settings.display.nightMode=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(30," Auto-set Night Mode "),p()(),u(31,"div",32)(32,"mat-form-field",33)(33,"mat-label"),_(34,"Action Button"),p(),u(35,"mat-select",37),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.fab,a)||(i.facade.settings.display.fab=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(36,fje,2,2,"mat-option",35,yo),p()()(),u(38,"div",32)(39,"mat-checkbox",38),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.disableWakelock,a)||(i.facade.settings.display.disableWakelock=a),x(a)}),M("change",function(a){return C(r),x(i.doWakelock(a.checked))}),_(40," Allow Device to Sleep "),p()()()()(),B(41,"br"),u(42,"mat-card",30)(43,"mat-card-content"),R(44,mje,22,4,"div",39),R(45,_je,10,0,"div",31),p()(),B(46,"br"),p(),u(47,"div",28)(48,"div",29),_(49,"SOUND"),p(),u(50,"mat-card",30)(51,"mat-card-content")(52,"div",31)(53,"div",32)(54,"mat-checkbox",40),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.muteSound,a)||(i.facade.settings.display.muteSound=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(55," Do not Play Sounds "),p()(),u(56,"div",32)(57,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.depthAlarm.enabled,a)||(i.facade.settings.display.depthAlarm.enabled=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(58," Show DEPTH Alarms "),p()(),u(59,"div",32)(60,"mat-form-field",33)(61,"mat-label"),_(62,"Alarm Smoothing Time"),p(),u(63,"mat-select",42),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.depthAlarm.smoothing,a)||(i.facade.settings.display.depthAlarm.smoothing=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(64,bje,2,2,"mat-option",35,yo),p()()()()()()()()()(),u(66,"mat-tab",43)(67,"div",26)(68,"div",27)(69,"div",44)(70,"div",29),_(71,"UNITS & VALUES"),p(),u(72,"mat-card",30)(73,"mat-card-content")(74,"div",31)(75,"div",32)(76,"mat-form-field",33)(77,"mat-label"),_(78,"Distance units"),p(),u(79,"mat-select",45,0),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.distance,a)||(i.facade.settings.units.distance=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(81,yje,2,2,"mat-option",35,yo),p()()(),u(83,"div",32)(84,"mat-form-field",33)(85,"mat-label"),_(86,"Depth units"),p(),u(87,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.depth,a)||(i.facade.settings.units.depth=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(88,vje,2,2,"mat-option",35,yo),p()()(),u(90,"div",32)(91,"mat-form-field",33)(92,"mat-label"),_(93,"Speed units"),p(),u(94,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.speed,a)||(i.facade.settings.units.speed=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(95,Cje,2,2,"mat-option",35,yo),p()()(),u(97,"div",32)(98,"mat-form-field",33)(99,"mat-label"),_(100,"Temperature units"),p(),u(101,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.temperature,a)||(i.facade.settings.units.temperature=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(102,xje,2,2,"mat-option",35,yo),p()()(),R(104,Mje,7,1,"div",32),R(105,Eje,7,1,"div",32),u(106,"div",32)(107,"signalk-preferred-paths",46),M("chosen",function(a){return C(r),x(i.onPreferredPaths(a))}),p()()()()()()()()(),u(108,"mat-tab",47)(109,"div",26)(110,"div",27)(111,"div",48)(112,"div",29),_(113,"MAP"),p(),u(114,"mat-card")(115,"mat-card-content")(116,"div",31)(117,"div",32)(118,"mat-form-field",33)(119,"mat-label"),_(120,"Feature label zoom level"),p(),u(121,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.labelsMinZoom,a)||(i.facade.settings.map.labelsMinZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(122,Dje,2,2,"mat-option",35,rt),p()()(),u(124,"div",32)(125,"mat-form-field",33)(126,"mat-label"),_(127,"Offset Vessel Center"),p(),u(128,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.centerOffset,a)||(i.facade.settings.map.centerOffset=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(129,Tje,2,2,"mat-option",35,yo),p()()(),u(131,"div",32)(132,"mat-checkbox",49),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.popoverMulti,a)||(i.facade.settings.map.popoverMulti=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(133," Popovers close with button "),p()(),u(134,"div",32)(135,"mat-checkbox",50),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.doubleClickZoom,a)||(i.facade.settings.map.doubleClickZoom=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(136," Double click to Zoom "),p()(),u(137,"div",32)(138,"mat-checkbox",51),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.lockMoveMap,a)||(i.facade.settings.map.lockMoveMap=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(139," Lock Follow Vessel "),p()()()()(),u(140,"div",29),_(141,"VECTOR CHARTS"),p(),u(142,"mat-card")(143,"mat-card-content")(144,"div",31)(145,"div",32)(146,"mat-form-field",33)(147,"mat-label"),_(148,"Graphics Style"),p(),u(149,"mat-select",52),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.graphicsStyle,a)||(i.facade.settings.map.s57Options.graphicsStyle=a),x(a)}),M("selectionChange",function(){return C(r),x(i.doS57())}),ye(150,Ije,2,2,"mat-option",35,yo),p()()(),u(152,"div",32)(153,"mat-form-field",33)(154,"mat-label"),_(155,"Boundaries"),p(),u(156,"mat-select",53),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.boundaries,a)||(i.facade.settings.map.s57Options.boundaries=a),x(a)}),M("selectionChange",function(){return C(r),x(i.doS57())}),ye(157,kje,2,2,"mat-option",35,yo),p()()(),u(159,"div",32)(160,"mat-form-field",33)(161,"mat-label"),_(162,"Colors"),p(),u(163,"mat-select",54),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.colors,a)||(i.facade.settings.map.s57Options.colors=a),x(a)}),M("selectionChange",function(){return C(r),x(i.doS57())}),ye(164,Pje,2,2,"mat-option",35,rt),p()()()(),u(166,"div",31)(167,"div",32)(168,"mat-form-field",33)(169,"mat-label"),_(170,"Shallow depth"),p(),u(171,"input",55,1),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.shallowDepth,a)||(i.facade.settings.map.s57Options.shallowDepth=a),x(a)}),M("change",function(){C(r);let a=pe(172);return x(i.doS57(a))}),p(),R(173,Aje,2,0,"mat-error"),u(174,"span",56),_(175,"m"),p()()(),u(176,"div",32)(177,"mat-form-field",33)(178,"mat-label"),_(179,"Safety depth"),p(),u(180,"input",55,2),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.safetyDepth,a)||(i.facade.settings.map.s57Options.safetyDepth=a),x(a)}),M("change",function(){C(r);let a=pe(181);return x(i.doS57(a))}),p(),R(182,Oje,2,0,"mat-error"),u(183,"span",56),_(184,"m"),p()()(),u(185,"div",32)(186,"mat-form-field",33)(187,"mat-label"),_(188,"Deep depth"),p(),u(189,"input",55,3),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.deepDepth,a)||(i.facade.settings.map.s57Options.deepDepth=a),x(a)}),M("change",function(){C(r);let a=pe(190);return x(i.doS57(a))}),p(),R(191,Rje,2,0,"mat-error"),u(192,"span",56),_(193,"m"),p()()()()()()()()()(),u(194,"mat-tab",57)(195,"div",26)(196,"div",27)(197,"div",58)(198,"div",29),_(199,"COURSE"),p(),u(200,"mat-card",30)(201,"mat-card-content")(202,"div",31)(203,"div",32)(204,"mat-form-field",33)(205,"mat-label"),_(206,"Arrival Circle"),p(),u(207,"input",55,4),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.arrivalCircle,a)||(i.facade.settings.course.arrivalCircle=a),x(a)}),M("change",function(){C(r);let a=pe(208);return x(i.parseNumber(a))}),p(),R(209,Lje,2,0,"mat-error"),u(210,"span",56),_(211,"m"),p()()()(),u(212,"div",31)(213,"div",32)(214,"mat-checkbox",41,5),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.autoNextPointOnArrival,a)||(i.facade.settings.course.autoNextPointOnArrival=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(216," Auto-advance to next point on arrival "),p()()(),u(217,"div",31)(218,"div",32)(219,"mat-form-field",33)(220,"mat-label"),_(221,"Notification type to use"),p(),u(222,"mat-select",59,6),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.autoNextPointTrigger,a)||(i.facade.settings.course.autoNextPointTrigger=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(224,Fje,2,2,"mat-option",35,rt),p()()(),u(226,"div",32)(227,"mat-form-field",33)(228,"mat-label"),_(229,"Time to wait before advancing"),p(),u(230,"mat-select",60),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.autoNextPointDelay,a)||(i.facade.settings.course.autoNextPointDelay=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(231,Nje,2,2,"mat-option",35,yo),p()()()()()()()()()(),u(233,"mat-tab",61)(234,"div",26)(235,"div",27)(236,"div",62)(237,"div",29),_(238,"VESSEL"),p(),u(239,"mat-card",30)(240,"mat-card-content")(241,"div",31)(242,"div",32)(243,"fieldset")(244,"legend"),_(245,"Vessel Icon Size"),p(),u(246,"div",31)(247,"div",32)(248,"mat-radio-group",63),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.iconScale,a)||(i.facade.settings.vessels.iconScale=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),ye(249,Vje,3,4,"mat-radio-button",35,yo),p()()()()()(),u(251,"div",32)(252,"fieldset")(253,"legend")(254,"mat-checkbox",64,7),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.fixedLocationMode,a)||(i.facade.settings.vessels.fixedLocationMode=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(256," Fixed Location Mode "),p()(),u(257,"div",31)(258,"div",32)(259,"mat-form-field",65)(260,"mat-label"),_(261,"Latitude"),p(),u(262,"input",66,8),Ee("ngModelChange",function(a){return C(r),De(i.facade.fixedPosition[1],a)||(i.facade.fixedPosition[1]=a),x(a)}),M("change",function(){C(r);let a=pe(263);return x(i.parseNumber(a,!0))}),p(),R(264,Bje,2,0,"mat-error"),p(),u(265,"mat-form-field",65)(266,"mat-label"),_(267,"Longitude"),p(),u(268,"input",67,9),Ee("ngModelChange",function(a){return C(r),De(i.facade.fixedPosition[0],a)||(i.facade.fixedPosition[0]=a),x(a)}),M("change",function(){C(r);let a=pe(269);return x(i.parseNumber(a,!0))}),p(),R(270,jje,2,0,"mat-error"),p()()()()()()(),B(271,"br"),u(272,"mat-card",30)(273,"mat-card-content")(274,"div",32)(275,"fieldset")(276,"legend"),_(277,"Vessel Lines:"),p(),u(278,"div",31)(279,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.windVectors,a)||(i.facade.settings.vessels.windVectors=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(280," Display Wind Vectors "),p(),u(281,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.laylines,a)||(i.facade.settings.vessels.laylines=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(282," Display Laylines "),p()(),u(283,"div",31)(284,"div",32)(285,"mat-form-field",33)(286,"mat-label"),_(287,"Heading Line Length"),p(),u(288,"mat-select",68),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.headingLineSize,a)||(i.facade.settings.vessels.headingLineSize=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(289,zje,2,2,"mat-option",35,yo),p()()(),u(291,"div",32)(292,"mat-form-field",33)(293,"mat-label"),_(294,"COG Line Length"),p(),u(295,"mat-select",69),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.cogLine,a)||(i.facade.settings.vessels.cogLine=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(296,Uje,2,2,"mat-option",35,yo),p()()()(),u(298,"div",31)(299,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.rangeCircles,a)||(i.facade.settings.vessels.rangeCircles=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(300," Display Range Circles "),p()(),u(301,"div",31)(302,"div",32)(303,"mat-form-field",33)(304,"mat-label"),_(305,"Number of Range Circles"),p(),u(306,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.rangeCircleCount,a)||(i.facade.settings.vessels.rangeCircleCount=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(307,Hje,2,2,"mat-option",35,rt),p()()(),u(309,"div",32)(310,"mat-form-field",33)(311,"mat-label"),_(312,"Minimum Zoom Level"),p(),u(313,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.rangeCircleMinZoom,a)||(i.facade.settings.vessels.rangeCircleMinZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(314,Gje,2,2,"mat-option",35,rt),p()()()()()()()(),B(316,"br"),u(317,"mat-card",30)(318,"mat-card-content")(319,"div",31)(320,"fieldset")(321,"legend")(322,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trail,a)||(i.facade.settings.vessels.trail=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("vesselTrail"))}),_(323," Display Vessel Track "),p()(),u(324,"div",31)(325,"div",32)(326,"mat-checkbox",71),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailFromServer,a)||(i.facade.settings.vessels.trailFromServer=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("trailFromServer"))}),_(327," Get Track from server "),p(),_(328," \xA0\xA0 "),u(329,"mat-slider",72)(330,"input",73),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailDuration,a)||(i.facade.settings.vessels.trailDuration=a),x(a)}),M("valueChange",function(){return C(r),x(i.deferPersist())}),p()(),_(331),p()(),u(332,"div",31)(333,"div",32)(334,"mat-form-field",33)(335,"mat-label"),_(336,"Resolution: Last hour"),p(),u(337,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailResolution.lastHour,a)||(i.facade.settings.vessels.trailResolution.lastHour=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(338,Wje,2,2,"mat-option",35,yo),p()()(),u(340,"div",32)(341,"mat-form-field",33)(342,"mat-label"),_(343,"Resolution: 1 hr -> 24 hrs"),p(),u(344,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailResolution.next23,a)||(i.facade.settings.vessels.trailResolution.next23=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(345,$je,2,2,"mat-option",35,yo),p()()(),u(347,"div",32)(348,"mat-form-field",33)(349,"mat-label"),_(350,"Resolution: > 24 hrs"),p(),u(351,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailResolution.beyond24,a)||(i.facade.settings.vessels.trailResolution.beyond24=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(352,qje,2,2,"mat-option",35,yo),p()()()()()()()(),u(354,"div",29),_(355,"OTHER VESSELS"),p(),u(356,"mat-card",30)(357,"mat-card-content")(358,"div",31)(359,"div",32)(360,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisShowTrack,a)||(i.facade.settings.vessels.aisShowTrack=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(361," Show Track "),p(),_(362," \xA0 "),u(363,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.aisStateFilter.moored,a)||(i.aisStateFilter.moored=a),x(a)}),M("change",function(){return C(r),x(i.onAisStateFilter())}),_(364," Hide Moored "),p(),_(365," \xA0 "),u(366,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.aisStateFilter.anchored,a)||(i.aisStateFilter.anchored=a),x(a)}),M("change",function(){return C(r),x(i.onAisStateFilter())}),_(367," Hide Anchored "),p()()(),u(368,"div",31)(369,"div",32)(370,"mat-form-field",33)(371,"mat-label"),_(372,"Mark AIS target inactive after"),p(),u(373,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisStaleAge,a)||(i.facade.settings.vessels.aisStaleAge=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(374,Kje,2,2,"mat-option",35,yo),p()()(),u(376,"div",32)(377,"mat-form-field",33)(378,"mat-label"),_(379,"Remove AIS target after"),p(),u(380,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisMaxAge,a)||(i.facade.settings.vessels.aisMaxAge=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(381,Xje,2,2,"mat-option",35,yo),p()()(),u(383,"div",32)(384,"mat-form-field",33)(385,"mat-label"),_(386,"Wind Vector Value"),p(),u(387,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisWindApparent,a)||(i.facade.settings.vessels.aisWindApparent=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(388,Yje,2,2,"mat-option",35,yo),p()()(),u(390,"div",32)(391,"mat-form-field",33)(392,"mat-label"),_(393,"Wind / Track Zoom Level"),p(),u(394,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisWindMinZoom,a)||(i.facade.settings.vessels.aisWindMinZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(395,Zje,2,2,"mat-option",35,rt),p()()(),u(397,"div",32)(398,"mat-form-field",33)(399,"mat-label"),_(400,"COG Line"),p(),u(401,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisCogLine,a)||(i.facade.settings.vessels.aisCogLine=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(402,Qje,2,2,"mat-option",35,yo),p()()()()()()()()()(),u(404,"mat-tab",74)(405,"div",26)(406,"div",27)(407,"div",75)(408,"div",29),_(409,"NOTES"),p(),u(410,"mat-card",30)(411,"mat-card-content")(412,"div",39)(413,"div",32)(414,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.ui.showNotes,a)||(i.facade.settings.ui.showNotes=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(415," Display Notes on Map "),p()(),u(416,"div",32)(417,"mat-form-field",33)(418,"mat-label"),_(419,"Notes Zoom Level"),p(),u(420,"mat-select",76),Ee("valueChange",function(a){return C(r),De(i.facade.settings.resources.notes.minZoom,a)||(i.facade.settings.resources.notes.minZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel("fetchNotes"))}),ye(421,Jje,2,2,"mat-option",35,rt),p()()()(),u(423,"div",39)(424,"div",32)(425,"mat-form-field",33)(426,"mat-label"),_(427),p(),u(428,"mat-select",77),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.getRadius,a)||(i.facade.settings.resources.notes.getRadius=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel("fetchNotes"))}),ye(429,eze,2,2,"mat-option",35,rt),p()()()(),u(431,"div",39)(432,"div",32)(433,"mat-form-field",78)(434,"mat-label"),_(435,"Notes fetch filter:"),p(),u(436,"input",79,10),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.rootFilter,a)||(i.facade.settings.resources.notes.rootFilter=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("fetchNotes"))}),p(),R(438,tze,3,0,"button",80),p()()(),u(439,"div",39)(440,"div",32)(441,"mat-checkbox",81),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.groupNameEdit,a)||(i.facade.settings.resources.notes.groupNameEdit=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(442," Edit Group Names "),p()(),u(443,"div",32)(444,"mat-checkbox",82),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.groupRequiresPosition,a)||(i.facade.settings.resources.notes.groupRequiresPosition=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(445," Position Group Note "),p()()()()()(),u(446,"div",83)(447,"div",29),_(448,"CUSTOM RESOURCES"),p(),u(449,"mat-card",30)(450,"mat-card-content")(451,"div",39)(452,"div",32)(453,"div",84),_(454," Select custom resource types (./resources/<name>) "),p(),u(455,"mat-selection-list",85,11),M("selectionChange",function(){C(r);let a=pe(456);return x(i.onResPathSelected(a))}),ye(457,ize,2,3,"mat-list-option",86,rt),p()()()()()()()()(),u(459,"mat-tab",87)(460,"div",26)(461,"div",27)(462,"div",88)(463,"div",29),_(464,"SIGNAL K: CONNECTION"),p(),u(465,"mat-card",30)(466,"mat-card-content")(467,"div",39)(468,"fieldset")(469,"legend"),_(470,"Filter Stream data:"),p(),u(471,"span",89),_(472," Check to include Signal K schema groups on display."),B(473,"br"),u(474,"i"),_(475,"Use to manage display performance."),p()(),u(476,"div",32)(477,"mat-checkbox",90),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.vessels,a)||(i.facade.settings.signalk.vessels=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(478," Vessels (other than Self) "),p()(),u(479,"div",32)(480,"mat-checkbox",91),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.atons,a)||(i.facade.settings.signalk.atons=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(481," Aids to Navigation (AtoN) "),p()(),u(482,"div",32)(483,"mat-checkbox",92),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.aircraft,a)||(i.facade.settings.signalk.aircraft=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(484," Aircraft "),p()(),u(485,"div",32)(486,"mat-checkbox",93),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.sar,a)||(i.facade.settings.signalk.sar=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(487," Search and Rescue (SaR) "),p()(),u(488,"div",32)(489,"mat-checkbox",94),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.meteo,a)||(i.facade.settings.signalk.meteo=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(490," Weather (Meteo) "),p()(),u(491,"div",32),B(492,"br"),u(493,"mat-form-field",33)(494,"mat-label"),_(495,"Max. distance from vessel"),p(),u(496,"mat-select",95,12),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.maxRadius,a)||(i.facade.settings.signalk.maxRadius=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(498,nze,2,2,"mat-option",35,yo),p()()()()(),u(500,"div",39)(501,"div",32)(502,"button",96),M("click",function(){return C(r),x(i.clearAuthToken())}),u(503,"mat-icon"),_(504,"key_off"),p()()()()()()()()()(),u(505,"mat-tab",97)(506,"div",26)(507,"div",27)(508,"div",98)(509,"div",29),_(510,"EXPERIMENTS"),p(),u(511,"mat-card",30)(512,"mat-card-content")(513,"div",39)(514,"div",32)(515,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.video.enable,a)||(i.facade.settings.resources.video.enable=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(516," Enable Video "),p()(),u(517,"div",32)(518,"mat-form-field",78)(519,"mat-label"),_(520,"url:"),p(),u(521,"input",99,13),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.video.url,a)||(i.facade.settings.resources.video.url=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("videoUrl"))}),p(),R(523,rze,2,0,"mat-error"),p()()(),u(524,"div",39)(525,"div",32)(526,"mat-checkbox",100,14),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.experiments,a)||(i.facade.settings.experiments=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),u(528,"mat-icon"),_(529,"science"),p(),_(530," Experimental Features "),p()()(),u(531,"div",39)(532,"div",32)(533,"mat-form-field",78)(534,"mat-label"),_(535,"Feature Server url:"),p(),u(536,"input",101,15),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.featureServer.url,a)||(i.facade.settings.resources.featureServer.url=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("featureServerUrl"))}),p(),R(538,oze,2,0,"mat-error"),p()()()()()()()()()()()}if(e&2){let r=pe(80),o=pe(172),a=pe(181),s=pe(190),l=pe(208),c=pe(215),d=pe(255),f=pe(263),g=pe(269),m=pe(437),b=pe(522),v=pe(537);h(25),Se("ngModel",i.facade.settings.display.darkMode.source),h(),ve(i.options.darkMode),h(3),Se("ngModel",i.facade.settings.display.nightMode),h(6),Se("ngModel",i.facade.settings.display.fab),h(),ve(i.options.buttons.fab),h(3),T("disabled",!i.wakeLock.isAvailable),Se("ngModel",i.facade.settings.display.disableWakelock),h(5),F(i.facade.applicationList.length>1?44:-1),h(),F(i.show.favourites()?45:-1),h(9),Se("ngModel",i.facade.settings.display.muteSound),h(3),Se("ngModel",i.facade.settings.display.depthAlarm.enabled),h(6),Se("ngModel",i.facade.settings.display.depthAlarm.smoothing),T("disabled",!i.facade.settings.display.depthAlarm.enabled),h(),ve(i.options.alarm.smoothing),h(15),Se("ngModel",i.facade.settings.units.distance),h(2),ve(i.options.availableUnits.distance),h(6),Se("ngModel",i.facade.settings.units.depth),h(),ve(i.options.availableUnits.depth),h(6),Se("ngModel",i.facade.settings.units.speed),h(),ve(i.options.availableUnits.speed),h(6),Se("ngModel",i.facade.settings.units.temperature),h(),ve(i.options.availableUnits.temperature),h(2),F(i.options.preferredValues.coords.length!==0?104:-1),h(),F(i.options.preferredValues.heading.length!==0?105:-1),h(16),Se("ngModel",i.facade.settings.map.labelsMinZoom),h(),ve(i.options.zoomLevels),h(6),Se("ngModel",i.facade.settings.map.centerOffset),h(),ve(i.options.map.centerOffset),h(3),Se("ngModel",i.facade.settings.map.popoverMulti),h(3),Se("ngModel",i.facade.settings.map.doubleClickZoom),h(3),Se("ngModel",i.facade.settings.map.lockMoveMap),h(11),Se("ngModel",i.facade.settings.map.s57Options.graphicsStyle),h(),ve(i.options.map.s57.graphicsStyle),h(6),Se("ngModel",i.facade.settings.map.s57Options.boundaries),h(),ve(i.options.map.s57.boundaries),h(6),Se("ngModel",i.facade.settings.map.s57Options.colors),h(),ve(i.options.map.s57.colors),h(7),Se("ngModel",i.facade.settings.map.s57Options.shallowDepth),h(2),F(o.invalid&&(o.dirty||o.touched)?173:-1),h(7),Se("ngModel",i.facade.settings.map.s57Options.safetyDepth),h(2),F(a.invalid&&(a.dirty||a.touched)?182:-1),h(7),Se("ngModel",i.facade.settings.map.s57Options.deepDepth),h(2),F(s.invalid&&(s.dirty||s.touched)?191:-1),h(16),Se("ngModel",i.facade.settings.course.arrivalCircle),h(2),F(l.invalid&&(l.dirty||l.touched)?209:-1),h(5),Se("ngModel",i.facade.settings.course.autoNextPointOnArrival),h(8),T("disabled",c.checked===!1),Se("ngModel",i.facade.settings.course.autoNextPointTrigger),h(2),ve(i.options.course.nextPointTrigger),h(6),T("disabled",c.checked===!1),Se("ngModel",i.facade.settings.course.autoNextPointDelay),h(),ve(i.options.course.nextPointDelay),h(17),Se("ngModel",i.facade.settings.vessels.iconScale),h(),ve(i.options.vessel.selfIconScale),h(5),Se("ngModel",i.facade.settings.vessels.fixedLocationMode),h(8),Se("ngModel",i.facade.fixedPosition[1]),T("disabled",!d.checked),h(2),F(f.invalid&&(f.dirty||f.touched)?264:-1),h(4),Se("ngModel",i.facade.fixedPosition[0]),T("disabled",!d.checked),h(2),F(g.invalid&&(g.dirty||g.touched)?270:-1),h(9),Se("ngModel",i.facade.settings.vessels.windVectors),h(2),Se("ngModel",i.facade.settings.vessels.laylines),h(7),Se("ngModel",i.facade.settings.vessels.headingLineSize),h(),ve(i.options.vessel.headingLine),h(6),Se("ngModel",i.facade.settings.vessels.cogLine),h(),ve(i.options.vessel.cogLine),h(3),Se("ngModel",i.facade.settings.vessels.rangeCircles),h(7),Se("ngModel",i.facade.settings.vessels.rangeCircleCount),T("disabled",!i.facade.settings.vessels.rangeCircles),h(),ve(i.options.rangeCircles.count),h(6),Se("ngModel",i.facade.settings.vessels.rangeCircleMinZoom),T("disabled",!i.facade.settings.vessels.rangeCircles),h(),ve(i.options.zoomLevels),h(8),Se("ngModel",i.facade.settings.vessels.trail),h(4),T("disabled",!i.facade.settings.vessels.trail),Se("ngModel",i.facade.settings.vessels.trailFromServer),h(3),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),Se("ngModel",i.facade.settings.vessels.trailDuration),h(),Z(" Length (",i.facade.settings.vessels.trailDuration," hrs) "),h(6),Se("ngModel",i.facade.settings.vessels.trailResolution.lastHour),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),ve(i.options.trailIntervals.highResolution),h(6),Se("ngModel",i.facade.settings.vessels.trailResolution.next23),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),ve(i.options.trailIntervals.highResolution),h(6),Se("ngModel",i.facade.settings.vessels.trailResolution.beyond24),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),ve(i.options.trailIntervals.mediumResolution),h(8),Se("ngModel",i.facade.settings.vessels.aisShowTrack),h(3),Se("ngModel",i.aisStateFilter.moored),h(3),Se("ngModel",i.aisStateFilter.anchored),h(7),Se("ngModel",i.facade.settings.vessels.aisStaleAge),h(),ve(i.options.vessel.aisTimeouts),h(6),Se("ngModel",i.facade.settings.vessels.aisMaxAge),h(),ve(i.options.vessel.aisTimeouts),h(6),Se("ngModel",i.facade.settings.vessels.aisWindApparent),h(),ve(i.options.preferredValues.wind),h(6),Se("ngModel",i.facade.settings.vessels.aisWindMinZoom),h(),ve(i.options.zoomLevels),h(6),Se("ngModel",i.facade.settings.vessels.aisCogLine),h(),ve(i.options.vessel.aisCogLine),h(12),Se("ngModel",i.facade.settings.ui.showNotes),h(6),T("disabled",!i.facade.settings.ui.showNotes),Se("value",i.facade.settings.resources.notes.minZoom),h(),ve(i.options.zoomLevels),h(6),K("Fetch Notes radius: ("+i.options.availableUnits.distance.get(r.value)+")"),h(),T("disabled",!i.facade.settings.ui.showNotes),Se("ngModel",i.facade.settings.resources.notes.getRadius),h(),ve(i.options.resources.noteRadius),h(7),Se("ngModel",i.facade.settings.resources.notes.rootFilter),h(2),F(m.value?438:-1),h(3),Se("ngModel",i.facade.settings.resources.notes.groupNameEdit),h(3),Se("ngModel",i.facade.settings.resources.notes.groupRequiresPosition),h(13),ve(i.facade.resourcePathList),h(20),Se("ngModel",i.facade.settings.signalk.vessels),h(3),Se("ngModel",i.facade.settings.signalk.atons),h(3),Se("ngModel",i.facade.settings.signalk.aircraft),h(3),Se("ngModel",i.facade.settings.signalk.sar),h(3),Se("ngModel",i.facade.settings.signalk.meteo),h(7),Se("ngModel",i.facade.settings.signalk.maxRadius),h(2),ve(i.options.vessel.aisMaxRadius),h(17),Se("ngModel",i.facade.settings.resources.video.enable),h(6),T("disabled",!i.facade.settings.resources.video.enable),Se("ngModel",i.facade.settings.resources.video.url),h(2),F(b.invalid?523:-1),h(3),Se("ngModel",i.facade.settings.experiments),h(10),T("disabled",!i.facade.settings.experiments),Se("ngModel",i.facade.settings.resources.featureServer.url),h(2),F(v.invalid?538:-1)}},dependencies:[Pt,dr,Fm,An,Do,nF,Nm,G1,En,ri,ni,Si,en,bb,hN,_b,ft,Ht,ci,Ur,Bm,Vm,_p,ge,st,tt,me,he,ze,$e,bh,_h,jp,uc,Xs,di,oi,Qr,zn,Ks,ga,Sr,At,Ei,Wa,qt,fi,hT,yC,fT,nA],styles:["[_nghost-%COMP%] .mat-dialog-content{padding:0 4px}.settings[_ngcontent-%COMP%] .setting-group-title[_ngcontent-%COMP%]{font-weight:700;font-size:10pt;font-family:Arial,Helvetica,sans-serif;padding:10px 0}.setting-card-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.settings[_ngcontent-%COMP%] .setting-card-row-item[_ngcontent-%COMP%]{padding-right:15px;flex:1 1 auto}@media only screen and (max-width:599px){.settings[_ngcontent-%COMP%] .setting-group[_ngcontent-%COMP%]{padding:5px 5%}}@media only screen and (min-width:600px)and (max-width:959px),screen and (min-width:960px)and (max-width:1279px),screen and (min-width:1280px)and (max-width:1919px),screen and (min-width:1920px)and (max-width:5000px){.settings[_ngcontent-%COMP%] .setting-group[_ngcontent-%COMP%]{padding:5px 5%}}"]})};function aze(n,t){if(n&1){let e=H();u(0,"button",14),M("click",function(){C(e);let r=y(2);return x(r.currentPage=r.currentPage-1)}),u(1,"mat-icon"),_(2,"keyboard_arrow_left"),p()()}}function sze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Outlook:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),Z(" ",e.description," ")}}function lze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"device_thermostat"),p()(),u(4,"div",11),_(5,"Temp:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),Z(" ",e.temperature," ")}}function cze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Min:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),Z(" ",e.temperatureMax," ")}}function dze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Max:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),Z(" ",e.temperatureMax," ")}}function uze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"opacity"),p()(),u(4,"div",11),_(5,"Dew Point:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),K(e.dewPoint)}}function pze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"air"),p()(),u(4,"div",11),_(5,"Wind Speed:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),K(e.wind.speed)}}function fze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"air"),p()(),u(4,"div",11),_(5,"Wind Gust:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),K(e.wind.gust)}}function hze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"outbound"),p()(),u(4,"div",11),_(5,"Wind Direction:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),Z(" ",e.wind.direction," ")}}function mze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Humidity:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.humidity)}}function gze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Precipitation:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.rain)}}function _ze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Pressure:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.pressure)}}function bze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"UV Index:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.uvIndex)}}function yze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Cloud Cover:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.clouds)}}function vze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Visibility:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.visibility)}}function Cze(n,t){if(n&1){let e=H();u(0,"button",15),M("click",function(){C(e);let r=y(2);return x(r.currentPage=r.currentPage+1)}),u(1,"mat-icon"),_(2,"keyboard_arrow_right"),p()()}}function xze(n,t){if(n&1&&(u(0,"mat-step")(1,"div",5)(2,"div",6),R(3,aze,3,0,"button",7),p(),u(4,"div",8)(5,"mat-card")(6,"div",9)(7,"div",5)(8,"div",10)(9,"mat-icon"),_(10,"schedule"),p()(),u(11,"div",11),_(12,"Time:"),p(),u(13,"div",8),_(14),p()(),R(15,sze,6,1,"div",5),R(16,lze,8,1,"div",5),R(17,cze,6,1,"div",5),R(18,dze,6,1,"div",5),R(19,uze,8,1,"div",5),R(20,pze,8,1,"div",5),R(21,fze,8,1,"div",5),R(22,hze,8,1,"div",5),R(23,mze,6,1,"div",5),R(24,gze,6,1,"div",5),R(25,_ze,6,1,"div",5),R(26,bze,6,1,"div",5),R(27,yze,6,1,"div",5),R(28,vze,6,1,"div",5),p()()(),u(29,"div",12),R(30,Cze,3,0,"button",13),p()()()),n&2){let e=t.$implicit,i=t.$index,r=y();h(3),F(i!==0&&r.data.length>1?3:-1),h(11),Z(" ",e.time," "),h(),F(e.description?15:-1),h(),F(e.temperature?16:-1),h(),F(e.temperatureMin?17:-1),h(),F(e.temperatureMax?18:-1),h(),F(e.dewPoint?19:-1),h(),F(e.wind.speed?20:-1),h(),F(e.wind.gust?21:-1),h(),F(e.wind.direction?22:-1),h(),F(e.humidity?23:-1),h(),F(e.rain?24:-1),h(),F(e.pressure?25:-1),h(),F(e.uvIndex?26:-1),h(),F(e.clouds?27:-1),h(),F(e.visibility?28:-1),h(2),F(i!==r.data.length-1?30:-1)}}function wze(n,t){if(n&1&&(u(0,"mat-icon",16),_(1," fiber_manual_record "),p()),n&2){let e=t.$index,i=y();Mi("color",i.currentPage-1===e?"blue":"gray")}}var oA=class n{data;currentPage=1;ngAfterViewInit(){let t=document.getElementsByClassName("mat-horizontal-stepper-header-container");t[0].style.display="none"}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=U({type:n,selectors:[["weather-data"]],inputs:{data:"data"},decls:8,vars:1,consts:[["stepper",""],[1,"weather-data"],[3,"linear"],[2,"text-align","center","font-size","10pt","font-family","roboto"],[2,"font-size","8pt","width","12px",3,"color"],[2,"display","flex"],[2,"min-width","50px","text-align","left","padding-top","15%"],["mat-icon-button","","matStepperPrevious",""],[2,"flex","1 1 auto"],[2,"display","flex","flex-direction","column"],[1,"key-icon"],[1,"key-label"],[2,"min-width","50px","text-align","right","padding-top","15%"],["mat-icon-button","","matStepperNext",""],["mat-icon-button","","matStepperPrevious","",3,"click"],["mat-icon-button","","matStepperNext","",3,"click"],[2,"font-size","8pt","width","12px"]],template:function(e,i){e&1&&(u(0,"div",1)(1,"mat-horizontal-stepper",2,0),ye(3,xze,31,17,"mat-step",null,rt),p(),u(5,"div",3),ye(6,wze,2,2,"mat-icon",4,rt),p()()),e&2&&(h(),T("linear",!1),h(2),ve(i.data),h(3),ve(i.data))},dependencies:[ft,Ht,Ur,ge,tt,me,he,ze,n_,Sr,At,qt,ru,yp,vp,Yf,w_],styles:[".weather-data[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-weight:400!important}.weather-data-row[_ngcontent-%COMP%]{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-content:stretch;font-family:Arial,Helvetica,sans-serif}.weather-data-row[_ngcontent-%COMP%] .item.stretch[_ngcontent-%COMP%]{text-align:center;width:100%}.weather-data-row[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{padding-left:5px}.weather-data-row[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:42px}.weather-data-row[_ngcontent-%COMP%] .description[_ngcontent-%COMP%]{font-size:12pt}.weather-data[_ngcontent-%COMP%] .key-icon[_ngcontent-%COMP%]{width:30px;font-weight:700}.weather-data[_ngcontent-%COMP%] .key-label[_ngcontent-%COMP%]{width:150px;font-weight:700}"]})};function Mze(n,t){n&1&&B(0,"mat-progress-bar",4)}function Sze(n,t){if(n&1&&(u(0,"div",5),_(1),p()),n&2){let e=y(2);h(),K(e.errorText)}}function Eze(n,t){if(n&1&&(u(0,"div",6),B(1,"div",7),u(2,"div",8)(3,"span",9),_(4),p(),u(5,"div",10)(6,"div",7)(7,"span",11),_(8,"Lat:"),p(),_(9,"\xA0 "),B(10,"span",12),Fi(11,"coords"),_(12," \xA0 "),p(),u(13,"div",7)(14,"span",11),_(15,"Lon:"),p(),_(16,"\xA0 "),B(17,"span",12),Fi(18,"coords"),p()()(),B(19,"div",7),p(),B(20,"weather-data",13)),n&2){let e=y(2);h(4),K(e.data.subTitle),h(6),T("innerText",jn(11,4,e.data.position[1],e.app.config.units.positionFormat,!0)),h(7),T("innerText",jn(18,8,e.data.position[0],e.app.config.units.positionFormat,!1)),h(3),T("data",e.forecasts.slice(0,18))}}function Dze(n,t){if(n&1&&R(0,Sze,2,1,"div",5)(1,Eze,21,12),n&2){let e=y();F(!e.forecasts||e.forecasts.length===0?0:1)}}var hv=class n{constructor(t,e,i,r){this.app=t;this.sk=e;this.modalRef=i;this.data=r}forecasts=[];isFetching=!1;errorText="No weather data found!";ngOnInit(){this.getForecast(this.data.position)}formatTempDegreesC(t){return t?`${Ct.kelvinToCelsius(t).toFixed(1)} \xBA`:"0.0"}formatDegrees(t){return t?`${Ct.radiansToDegrees(t).toFixed(1)} \xBA`:"0.0"}formatKnots(t){return t?`${Ct.msecToKnots(t).toFixed(1)} kn`:"0.0"}dayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];getForecast(t){if(!this.app.featureFlags().weatherApi){this.errorText="Cannot retrieve forecasts as Weather API is not available!";return}if(!this.data.position){this.errorText="Cannot retrieve forecasts as location has not been supplied!";return}let e=`/weather/forecasts/point?lat=${t[1]}&lon=${t[0]}`;this.isFetching=!0,this.sk.api.get(2,e).subscribe(i=>{this.isFetching=!1,Object.values(i).forEach(r=>{let o={wind:{}};o.description=r.description??"";let a=new Date(r.date);o.time=a?`${this.dayNames[a.getDay()]} ${a.getHours()}:${("00"+a.getMinutes()).slice(-2)}`:"",typeof r.outside?.temperature<"u"&&(o.temperature=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.temperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.temperature).toFixed(1)+"\xBAC"),typeof r.outside?.minTemperature?.minimum<"u"&&(o.temperatureMin=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.minTemperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.minTemperature).toFixed(1)+"\xBAC"),typeof r.outside?.maxTemperature<"u"&&(o.temperatureMax=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.maxTemperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.maxTemperature).toFixed(1)+"\xBAC"),typeof r.outside?.dewPointTemperature<"u"&&(o.dewPoint=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.dewPointTemperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.dewPointTemperature).toFixed(1)+"\xBAC"),o.humidity=typeof r.outside?.absoluteHumility<"u"?`${r.outside?.absoluteHumility} (%)`:"",o.pressure=typeof r.outside?.pressure<"u"?`${Math.round(r.outside?.pressure)} (Pa)`:"",typeof r.outside?.uvIndex<"u"&&(o.uvIndex=r.outside?.uvIndex.toFixed(2)),typeof r.outside?.clouds<"u"&&(o.clouds=r.outside?.clouds.toFixed(1)+`${r.clouds.units?" ("+r.clouds.units+")":""}`),typeof r.outside?.visibility<"u"&&(o.visibility=r.outside?.visibility),typeof r.outside?.precipitationVolume<"u"&&(o.rain=`${(r.outside?.precipitationVolume*1e3).toFixed(2)} mm`),typeof r.wind<"u"&&(typeof r.wind.speedTrue<"u"&&(o.wind.speed=this.app.formatSpeed(r.wind.speedTrue,!0)+" "+this.app.formattedSpeedUnits),typeof r.wind.gust<"u"&&(o.wind.gust=this.app.formatSpeed(r.wind.gust,!0)+" "+this.app.formattedSpeedUnits),typeof r.wind.directionTrue<"u"&&(o.wind.direction=Ct.radiansToDegrees(r.wind.directionTrue).toFixed(0)+"\xBA")),this.forecasts.push(o)})},()=>{this.isFetching=!1,this.errorText="Error retrieving weather data!"})}static \u0275fac=function(e){return new(e||n)(N(Ie),N(bi),N(jr),N(Eo))};static \u0275cmp=U({type:n,selectors:[["weather-forecast-modal"]],decls:13,vars:2,consts:[[1,"_weather-forecast"],[2,"background-color","transparent"],[2,"flex","1 1 auto","padding-left","20px","text-align","center"],["mat-icon-button","","matTooltip","Close","matTooltipPosition","below",3,"click"],["mode","query"],[2,"text-align","center"],[2,"display","flex","flex-wrap","nowrap"],[2,"flex","1"],[2,"width","350px","text-align","center"],[2,"font-size","small"],[2,"font-size","small","text-align","left","display","flex","flex-wrap","wrap"],[2,"font-weight","bold"],[3,"innerText"],[3,"data"]],template:function(e,i){e&1&&(u(0,"div",0)(1,"mat-toolbar",1)(2,"span")(3,"mat-icon"),_(4,"air"),p()(),u(5,"span",2),_(6),p(),u(7,"span")(8,"button",3),M("click",function(){return i.modalRef.dismiss()}),u(9,"mat-icon"),_(10,"keyboard_arrow_down"),p()()()(),R(11,Mze,1,0,"mat-progress-bar",4)(12,Dze,2,1),p()),e&2&&(h(6),Z(" ",i.data.title," "),h(5),F(i.isFetching?11:12))},dependencies:[ft,Ur,ge,tt,me,he,ze,$e,n_,Sr,At,qt,fi,ru,qn,oA,Cr],styles:["._weather-forecast[_ngcontent-%COMP%]{font-family:arial}._weather-forecast[_ngcontent-%COMP%] .key-label[_ngcontent-%COMP%]{width:150px;font-weight:700}"]})};var aA=class n{selected=new q;handleSelect(t,e){this.selected.emit({choice:t,value:e})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=U({type:n,selectors:[["fb-experiments"]],outputs:{selected:"selected"},decls:11,vars:1,consts:[["experimentsmenu","matMenu"],["mat-menu-item","",3,"click"],["mat-mini-fab","","matTooltip","Experiments","matTooltipPosition","left",1,"button-toolbar",3,"matMenuTriggerFor"]],template:function(e,i){if(e&1){let r=H();u(0,"mat-menu",null,0)(2,"a",1),M("click",function(){return C(r),x(i.handleSelect("debugCapture"))}),u(3,"mat-icon"),_(4,"adb"),p(),u(5,"span"),_(6,"Capture Debug Info"),p()()(),u(7,"div")(8,"button",2)(9,"mat-icon"),_(10,"science"),p()()()}if(e&2){let r=pe(1);h(8),T("matMenuTriggerFor",r)}},dependencies:[Wa,ha,Ea,Ga,me,he,ge,$s,ze,$e],encapsulation:2})};var Tze=[{type:"signalk-server-node",title:"Deprecation Notice",message:`
410
+ `,""),Bn.push(Ao[Xo],vn);return Bn},[]):_r=oj(Yn,O).trim(),V=Ot(ke,"paint","text-opacity",ee,b,te)}if(_r&&V&&!Ul){hr||(++re,Xe=I[re],(!Xe||!Xe.getText()||Xe.getFill()||Xe.getStroke())&&(Xe=new Re,I[re]=Xe),Xe.setImage(void 0),Xe.setGeometry(void 0));let mr=xse(ke,ee,"text",b);Xe.getText()||Xe.setText(Wt),Wt=Xe.getText(),(!Wt||"getDeclutterMode"in Wt&&Wt.getDeclutterMode()!==mr)&&(Wt=new zi({padding:[2,2,2,2],declutterMode:mr}),Xe.setText(Wt));let Yn=Ot(ke,"layout","text-transform",ee,b,te);Yn=="uppercase"?_r=Array.isArray(_r)?_r.map((ar,Rs)=>Rs%2?ar:ar.toUpperCase()):_r.toUpperCase():Yn=="lowercase"&&(_r=Array.isArray(_r)?_r.map((ar,Rs)=>Rs%2?ar:ar.toLowerCase()):_r.toLowerCase());let Bn=Array.isArray(_r)?_r:X==2?KP(_r,Or):XP(_r,Ma,Yh,Or);if(Wt.setText(Bn),Wt.setFont(Ma),Wt.setRotation($P(Ot(ke,"layout","text-rotate",ee,b,te))),typeof Wt.setKeepUpright=="function"){let ar=Ot(ke,"layout","text-keep-upright",ee,b,te);Wt.setKeepUpright(ar)}let Wn=Ot(ke,"layout","text-anchor",ee,b,te),oo=hr||X==1?"point":Ot(ke,"layout","symbol-placement",ee,b,te),on;if(oo==="line-center"?(Wt.setPlacement("line"),on="center"):Wt.setPlacement(oo),oo==="line"&&typeof Wt.setRepeat=="function"){let ar=Ot(ke,"layout","symbol-spacing",ee,b,te);Wt.setRepeat(ar*2)}Wt.setOverflow(oo==="point");let vn=Ot(ke,"paint","text-halo-width",ee,b,te),Ao=Ot(ke,"layout","text-offset",ee,b,te),Xo=Ot(ke,"paint","text-translate",ee,b,te),ml=0,Os=0;if(oo=="point"){on="center",Wn.indexOf("left")!==-1?(on="left",Os=vn):Wn.indexOf("right")!==-1&&(on="right",Os=-vn);let ar=Ot(ke,"layout","text-rotation-alignment",ee,b,te);Wt.setRotateWithView(ar=="map")}else Wt.setMaxAngle($P(Ot(ke,"layout","text-max-angle",ee,b,te))*_r.length/Bn.length),Wt.setRotateWithView(!1);Wt.setTextAlign(on);let Yo="middle";Wn.indexOf("bottom")==0?(Yo="bottom",ml=-vn-.5*(ss-1)*ls):Wn.indexOf("top")==0&&(Yo="top",ml=vn+.5*(ss-1)*ls),Wt.setTextBaseline(Yo);let Ra=Ot(ke,"layout","text-justify",ee,b,te);Wt.setJustify(Ra==="auto"?void 0:Ra),Wt.setOffsetX(Ao[0]*ls+Os+Xo[0]),Wt.setOffsetY(Ao[1]*ls+ml+Xo[1]),P.setColor(mf(Ot(ke,"paint","text-color",ee,b,te),V)),Wt.setFill(P);let Rr=mf(Ot(ke,"paint","text-halo-color",ee,b,te),V);if(Rr&&vn>0){k.setColor(Rr),vn*=2;let ar=.5*ls;k.setWidth(vn<=ar?vn:ar),Wt.setStroke(k)}else Wt.setStroke(void 0);let Oo=Ot(ke,"layout","text-padding",ee,b,te),ca=Wt.getPadding();Oo!==ca[0]&&(ca[0]=Oo,ca[1]=Oo,ca[2]=Oo,ca[3]=Oo),Xe.setZIndex(yn)}}}if(re>-1)return I.length=re+1,W9e&&("set"in S?S.set("mapbox-layer",Me):S.getProperties()["mapbox-layer"]=Me),I};return n.setStyle(D),n.set("mapbox-layers",f),n.set("mapbox-source",E),n.set("mapbox-featurestate",n.get("mapbox-featurestate")||{}),D}function Sse(n,t){let e=n[0],i=e.width,r=e.height,o=e.data,a=new Uint8ClampedArray(o.length),s=t.resolution*2,l=i-1,c=r-1,d=[0,0,0,0],f=2*Math.PI,g=Math.PI/2,m=Math.PI*t.sunEl/180,b=Math.PI*t.sunAz/180,v=Math.cos(m),E=Math.sin(m),k=t.highlightColor,P=t.shadowColor,I=t.accentColor,D=t.encoding,S,A,z,O,W,j,$,X,Y,ee,te,re,Me,xe,ht,at,ke,He,Zt,mi,Ni,G;function V(we,J="mapbox"){if(J==="mapbox")return(we[0]*256*256+we[1]*256+we[2])*.1-1e4;if(J==="terrarium")return we[0]*256+we[1]+we[2]/256-32768}for(A=0;A<=c;++A)for(W=A===0?0:A-1,j=A===c?c:A+1,S=0;S<=l;++S)z=S===0?0:S-1,O=S===l?l:S+1,$=(A*i+z)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],X=t.vert*V(d,D),$=(A*i+O)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],Y=t.vert*V(d,D),ee=(Y-X)/s,$=(W*i+S)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],X=t.vert*V(d,D),$=(j*i+S)*4,d[0]=o[$],d[1]=o[$+1],d[2]=o[$+2],d[3]=o[$+3],Y=t.vert*V(d,D),te=(Y-X)/s,Me=Math.atan2(te,-ee),Me<0?Me=g-Me:Me>g?Me=f-Me+g:Me=g-Me,re=Math.atan(Math.sqrt(ee*ee+te*te)),G=E*Math.cos(re)+v*Math.sin(re)*Math.cos(b-Me),xe=Math.cos(re),ht=255*G,Zt=Math.min(Math.max(2*t.sunEl,0),1),mi=1.875-t.opacity*1.75,Ni=t.opacity!==.5?g*((Math.pow(mi,re)-1)/(Math.pow(mi,g)-1)):re,ke={r:(1-xe)*I.r*Zt*255,g:(1-xe)*I.g*Zt*255,b:(1-xe)*I.b*Zt*255,a:(1-xe)*I.a*Zt*255},at=Math.abs(((Me+b)/Math.PI+.5)%2-1),He={r:(k.r*(1-at)+P.r*at)*ht,g:(k.g*(1-at)+P.g*at)*ht,b:(k.b*(1-at)+P.b*at)*ht,a:(k.a*(1-at)+P.a*at)*ht},$=(A*i+S)*4,a[$]=ke.r*(1-at)+He.r,a[$+1]=ke.g*(1-at)+He.g,a[$+2]=ke.b*(1-at)+He.b,a[$+3]=o[$+3]*t.opacity*Zt*Math.sin(Ni);return new ImageData(a,i,r)}function $9e(n,t=512){return n.getExtent()?Fu({extent:n.getExtent(),tileSize:t,maxZoom:22}).getResolutions():Ac}function Tse(n,t){return t.accessToken||(t=Object.assign({},t),new URL(n).searchParams.forEach((i,r)=>{t.accessToken=i,t.accessTokenParam=r})),t}function Gw(n,t,e="",i={},r=void 0){let o,a,s,l,c=!0;return typeof e!="string"&&!Array.isArray(e)?(s=e,l=s.source||s.layers,i=s):l=e,typeof i=="string"?(o=i,s={}):(o=i.styleUrl,s=i),s.updateSource===!1&&(c=!1),r||(r=s.resolutions),!o&&typeof t=="string"&&!t.trim().startsWith("{")&&(o=t),o&&(o=o.startsWith("data:")?location.href:Ny(o,s.accessToken),s=Tse(o,s)),new Promise(function(d,f){QB(t,s).then(function(g){if(g.version!=8)return f(new Error("glStyle version 8 required."));if(!(n instanceof cn||n instanceof Lu))return f(new Error("Can only apply to VectorLayer or VectorTileLayer"));let m=n instanceof Lu?"vector":"geojson";if(l?Array.isArray(l)?a=g.layers.find(function(D){return D.id===l[0]}).source:a=l:(a=g.layers.find(function(D){return D.source&&g.sources[D.source].type===m}).source,l=a),!a)return f(new Error(`No ${m} source found in the glStyle.`));function b(){if(!c)return Promise.resolve();if(n instanceof Lu)return Pse(g.sources[a],o,s).then(function(z){let O=n.getSource();O?z!==O&&(O.setTileUrlFunction(z.getTileUrlFunction()),typeof O.setUrls=="function"&&typeof z.getUrls=="function"&&O.setUrls(z.getUrls()),O.format_||(O.format_=z.format_),O.getAttributions()||O.setAttributions(z.getAttributions()),O.getTileLoadFunction()===bV&&O.setTileLoadFunction(z.getTileLoadFunction()),Un(O.getProjection(),z.getProjection())&&(O.tileGrid=z.getTileGrid())):n.setSource(z);let W=n.getSource().getTileGrid();!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())&&W.getMinZoom()>0&&n.setMaxResolution(zy(Math.max(0,W.getMinZoom()-1e-12),W.getResolutions()))});let D=g.sources[a],S=n.getSource();(!S||S.get("mapbox-source")!==D)&&(S=Rse(D,o,s));let A=n.getSource();return A?S!==A&&(A.getAttributions()||A.setAttributions(S.getAttributions()),A.format_||(A.format_=S.getFormat()),A.url_=S.getUrl()):n.setSource(S),Promise.resolve()}let v,E,k={},P={};function I(){if(!E&&(!g.sprite||k)){if(s.projection&&!r){let S=Ft(s.projection).getUnits();S!=="m"&&(r=Ac.map(A=>A/Ss[S]))}E=aj(n,g,l,r,k,P,(D,S=s.webfonts)=>Cse(D,S),s.getImage),n.getStyle()?b().then(d).catch(f):f(new Error(`Nothing to show for source [${a}]`))}else E?(n.setStyle(E),b().then(d).catch(f)):f(new Error("Something went wrong trying to apply style."))}if(g.sprite){let D=mse(g.sprite,s.accessToken,o||location.href);v=window.devicePixelRatio>=1.5?.5:1;let S=v==.5?"@2x":"";Promise.all(D.map(function(A){let z=new URL(A.url),O=z.origin+z.pathname+S+".json"+z.search;return new Promise(function(W,j){Ug("Sprite",O,s).then(W).catch(function($){O=z.origin+z.pathname+".json"+z.search,Ug("Sprite",O,s).then(W).catch(j)})}).then(function(W){W===void 0&&f(new Error("No sprites found."));let j;if(j=z.origin+z.pathname+S+".png"+z.search,s.transformRequest){let $=s.transformRequest(j,"SpriteImage")||j;($ instanceof Request||$ instanceof Promise)&&(j=$)}P[A.id]=j;for(let $ in W){let X=A.id=="default"?$:`${A.id}:${$}`;k[X]=W[$]}}).catch(function(W){f(new Error(`Sprites cannot be loaded: ${O}: ${W.message}`))})})).then(I).catch(f)}else I()}).catch(f)})}function Ise(n,t){let e;return n.some(function(i){if(i.id==t)return e=i.source,!0}),e}function q9e(n,t){let e=n.bounds;if(e){let i=Jt([e[0],e[1]],t),r=Jt([e[2],e[3]],t);return[i[0],i[1],r[0],r[1]]}return Ft(t).getExtent()}function kse(n,t,e){let i=new fy({tileJSON:t,tileSize:n.tileSize||t.tileSize||512}),r=i.getTileJSON(),o=i.getTileGrid(),a=Ft(e.projection||"EPSG:3857"),s=q9e(r,a),l=a.getExtent(),c=r.minzoom||0,d=r.maxzoom||22,f={attributions:i.getAttributions(),projection:a,tileGrid:new lf({origin:l?Go(l):o.getOrigin(0),extent:s||o.getExtent(),minZoom:c,resolutions:$9e(a,t.tileSize).slice(0,d+1),tileSize:o.getTileSize(0)})};return Array.isArray(r.tiles)?f.urls=r.tiles:f.url=r.tiles,f}function K9e(n,t,e,i){let r={id:n.id,type:n.type},o=n.layout||{},a=n.paint||{};r.paint=a,hl.zoom=Hw(t,e.resolutions||Ac),hl.distanceFromCenter=0;let s,l=Ot(r,"paint","background-color",jl,i);return a["background-opacity"]!==void 0&&(s=Ot(r,"paint","background-opacity",jl,i)),o.visibility=="none"?void 0:mf(l,s)}function X9e(n,t,e){let i=document.createElement("div");return i.className="ol-mapbox-style-background",i.style.position="absolute",i.style.width="100%",i.style.height="100%",new gd({source:new _d({}),render(r){let o=K9e(n,r.viewState.resolution,t,e);return i.style.backgroundColor=o,i}})}function Pse(n,t,e){return new Promise(function(i,r){JB(n,t,e).then(function({tileJson:o,tileLoadFunction:a}){let s=kse(n,o,e);s.tileLoadFunction=a,s.format=new ag;let l=new kg(s);l.set("mapbox-source",n),i(l)}).catch(r)})}function Y9e(n,t,e){let i=new Lu({declutter:!0,visible:!1});return Pse(n,t,e).then(function(r){i.setSource(r)}).catch(function(r){i.setSource(void 0)}),i}function Ase(n){return`{bbox-${(n?n.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function Z9e(n,t,e){return new Promise(function(i,r){JB(n,t,e).then(function({tileJson:o,tileLoadFunction:a}){let s=new fy({interpolate:e.interpolate===void 0?!0:e.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:o});s.tileGrid=kse(n,o,e).tileGrid,e.projection&&(s.projection=Ft(e.projection));let l=s.getTileUrlFunction();a&&s.setTileLoadFunction(a),s.setTileUrlFunction(function(c,d,f){let g=Ase(f),m=l(c,d,f);if(m.indexOf(g)!=-1){let b=s.getTileGrid().getTileCoordExtent(c);m=m.replace(g,b.toString())}return m}),s.set("mapbox-source",n),i(s)}).catch(function(o){r(o)})})}function Ose(n,t,e){let i=new Sd;return Z9e(n,t,e).then(function(r){i.setSource(r)}).catch(function(){i.setSource(void 0)}),i}function Q9e(n,t,e){let i=Ose(n,t,e);return new L3({source:new doe({operationType:"image",operation:Sse,sources:[i]})})}function Rse(n,t,e){let i=e.projection?new S8({dataProjection:e.projection}):new S8,r=n.data,o={};if(typeof r=="string"){let[s]=Vy(r,e.accessToken,e.accessTokenParam||"access_token",t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){let c=(f,g,m)=>{let b=Ase(m);return s.replace(b,`${f.join(",")}`)},d=new rn({attributions:n.attribution,format:i,loader:(f,g,m,b,v)=>{let E=typeof c=="function"?c(f,g,m):c;Ug("GeoJSON",E,e).then(k=>{let P=d.getFormat().readFeatures(k,{featureProjection:m});d.addFeatures(P),b(P)}).catch(k=>{d.removeLoadedExtent(f),v()})},strategy:wie});return d.set("mapbox-source",n),d}let l=new rn({attributions:n.attribution,format:i,url:s,loader:(c,d,f,g,m)=>{Ug("GeoJSON",s,e).then(b=>{let v=l.getFormat().readFeatures(b,{featureProjection:f});l.addFeatures(v),g(v)}).catch(b=>{l.removeLoadedExtent(c),m()})}});return l}o.features=i.readFeatures(r,{featureProjection:ka()||"EPSG:3857"});let a=new rn(Object.assign({attributions:n.attribution,format:i},o));return a.set("mapbox-source",n),a}function J9e(n,t,e){return new cn({declutter:!0,source:Rse(n,t,e),visible:!1})}function eVe(n,t,e){let i=null;return function(r){n.paint&&"raster-opacity"in n.paint&&r.frameState.viewState.zoom!==i&&(i=r.frameState.viewState.zoom,delete e[n.id],tVe(n,t,i,e))}}function tVe(n,t,e,i){hl.zoom=e,hl.distanceFromCenter=0;let r=Ot(n,"paint","raster-opacity",jl,i);t.setOpacity(r)}function iVe(n,t){function e(){let i=t.get("mapbox-style");if(!i)return;let r=PP(i.layers),o=n.get("mapbox-layers"),a=r.filter(function(s){return o.includes(s.id)}).some(function(s){return!s.layout||!s.layout.visibility||s.layout.visibility==="visible"});n.get("visible")!==a&&n.setVisible(a)}n.on("change",e),e()}function nVe(n,t,e,i){let r=WP(n),o=n.layers,a=e.type,s=e.source||Ise(o,e.ref),l=n.sources[s],c;if(a=="background")c=X9e(e,i,r);else if(l.type=="vector")c=Y9e(l,t,i);else if(l.type=="raster")c=Ose(l,t,i),c.setVisible(e.layout?e.layout.visibility!=="none":!0),c.on("prerender",eVe(e,c,r));else if(l.type=="geojson")c=J9e(l,t,i);else if(l.type=="raster-dem"&&e.type=="hillshade"){let f=Q9e(l,t,i);c=f,f.getSource().on("beforeoperations",function(g){let m=g.data;m.resolution=fu(i.projection||"EPSG:3857",g.resolution,Hr(g.extent),"m"),hl.zoom=Hw(g.resolution,i.resolutions||Ac),hl.distanceFromCenter=0,m.encoding=l.encoding,m.vert=5*Ot(e,"paint","hillshade-exaggeration",jl,r),m.sunAz=Ot(e,"paint","hillshade-illumination-direction",jl,r),m.sunEl=35,m.opacity=.3,m.highlightColor=Ot(e,"paint","hillshade-highlight-color",jl,r),m.shadowColor=Ot(e,"paint","hillshade-shadow-color",jl,r),m.accentColor=Ot(e,"paint","hillshade-accent-color",jl,r)}),c.setVisible(e.layout?e.layout.visibility!=="none":!0)}let d=s;return c&&c.set("mapbox-source",d),c}function Ese(n,t,e,i){let r=[],o=null;if(t instanceof Ah){if(o=t.getView(),!o.isDef()&&!o.getRotation()&&!o.getResolutions()){let f=i.projection?Ft(i.projection):o.getProjection();o=new Ds(Object.assign(o.getProperties(),{maxResolution:Ac[0]/Ss[f.getUnits()],projection:i.projection||o.getProjection()})),t.setView(o)}"center"in n&&!o.getCenter()&&o.setCenter(Jt(n.center,o.getProjection())),"zoom"in n&&o.getZoom()===void 0&&o.setResolution(Ac[0]/Ss[o.getProjection().getUnits()]/Math.pow(2,n.zoom)),(!o.getCenter()||o.getZoom()===void 0)&&o.fit(o.getProjection().getExtent(),{nearest:!0,size:t.getSize()})}t.set("mapbox-style",n),t.set("mapbox-metadata",{styleUrl:e,options:i});let a=n.layers,s=[],l,c,d;for(let f=0,g=a.length;f<g;++f){let m=a[f],b=m.type;if(b=="heatmap"){console.debug(`layers[${f}].type "${b}" not supported`);continue}else d=m.source||Ise(a,m.ref),(!d||d!=c)&&(s.length&&(r.push(Dse(l,s,n,e,t,i)),s=[]),l=nVe(n,e,m,i),l instanceof cn||l instanceof Lu||(s=[]),c=l.get("mapbox-source")),s.push(m.id)}return r.push(Dse(l,s,n,e,t,i)),Promise.all(r)}function ZP(n,t,e={}){let i,r;if(typeof n=="string"||n instanceof HTMLElement?r=new Ah({target:n}):r=n,typeof t=="string"){let o=t.startsWith("data:")?location.href:Ny(t,e.accessToken);e=Tse(o,e),i=new Promise(function(a,s){QB(t,e).then(function(l){Ese(l,r,o,e).then(function(){a(r)}).catch(s)}).catch(function(l){s(new Error(`Could not load ${t}: ${l.message}`))})})}else i=new Promise(function(o,a){Ese(t,r,!e.styleUrl||e.styleUrl.startsWith("data:")?location.href:Ny(e.styleUrl,e.accessToken),e).then(function(){o(r)}).catch(a)});return i}function Dse(n,t,e,i,r,o={}){let a=24,s=0,l=e.layers;for(let c=0,d=l.length;c<d;++c){let f=l[c];t.indexOf(f.id)!==-1&&(a=Math.min("minzoom"in f?f.minzoom:0,a),s=Math.max("maxzoom"in f?f.maxzoom:24,s))}return new Promise(function(c,d){let f=function(){let m=n.getSource();if(!m||m.getState()==="error"){d(new Error("Error accessing data for source "+n.get("mapbox-source")));return}if("getTileGrid"in m){let b=m.getTileGrid();if(b){let v=b.getMinZoom();(a>0||v>0)&&n.setMaxResolution(Math.min(zy(Math.max(0,a-1e-12),Ac),zy(Math.max(0,v-1e-12),b.getResolutions()))),s<24&&n.setMinResolution(zy(s,Ac))}}else a>0&&n.setMaxResolution(zy(Math.max(0,a-1e-12),Ac));m instanceof rn||m instanceof kg?Gw(n,e,t,Object.assign({styleUrl:i},o)).then(function(){iVe(n,r),c()}).catch(d):c()};n.set("mapbox-layers",t);let g=r.getLayers();g.getArray().indexOf(n)===-1&&g.push(n),n.getSource()?f():n.once("change:source",f)})}var Lse=Fs(UN());var oVe={shallowDepth:2,safetyDepth:3,deepDepth:6,graphicsStyle:"Paper",boundaries:"Plain",colors:4,colorTable:0};var gf=class n{constructor(t){this.http=t;t.get("assets/s57/chartsymbols.xml",{responseType:"text"}).subscribe(e=>{new Lse.Parser({strict:!1,trim:!0}).parseString(e,(o,a)=>{this.processSymbols(a),this.processLookup(a),this.processColors(a)}),this.refresh.next();let r=new Image;r.onload=()=>{this.chartSymbolsImage=r,this.refresh.next()},r.src="assets/s57/"+this.colorTables[this.selectedColorTable].symbolfile})}chartSymbols=new Map;colorTables=[];selectedColorTable=0;chartSymbolsImage;lookups=[];lookupStartIndex=new Map;styles=new Map;refresh=new ie;options=oVe;attMatch=new RegExp("([A-Za-z0-9]{6})([0-9,\\?]*)");setColorTable(t){t>=0&&t<=5&&this.selectedColorTable}getStyle(t){return this.styles[t]}setStyle(t,e){this.styles[t]=e}isChanged(t,e){let i=!1,r=Object.keys(e);for(let o=0;o<r.length;o++)if(t[r[o]]!==e[r[o]]){i=!0;break}return i}SetOptions(t){this.isChanged(this.options,t)&&(this.options=Object.assign({},t),this.refresh.next())}getLookup(t){return this.lookups[t]}getColor(t){return this.colorTables[this.selectedColorTable].colors.get(t)}processColors(t){t.CHARTSYMBOLS["COLOR-TABLES"][0]["COLOR-TABLE"].forEach(e=>{let i={symbolfile:e["GRAPHICS-FILE"][0].$.NAME,colors:new Map};e.COLOR.forEach(o=>{i.colors.set(o.$.NAME,"RGBA("+o.$.R+", "+o.$.G+", "+o.$.B+",1)")}),this.colorTables.push(i)})}processSymbols(t){t.CHARTSYMBOLS.SYMBOLS[0].SYMBOL.forEach(e=>{let i=e.BITMAP;i&&this.chartSymbols.set(e.NAME[0],{image:null,pivotX:parseInt(i[0].PIVOT[0].$.X),pivotY:parseInt(i[0].PIVOT[0].$.Y),originX:parseInt(i[0].ORIGIN[0].$.X),originY:parseInt(i[0].ORIGIN[0].$.Y),width:parseInt(i[0].$.WIDTH),height:parseInt(i[0].$.HEIGHT),locationX:parseInt(i[0]["GRAPHICS-LOCATION"][0].$.X),locationY:parseInt(i[0]["GRAPHICS-LOCATION"][0].$.Y)})})}compareLookup(t,e){let i=t.lookupTable-e.lookupTable;if(i!==0)return i;let r=t.name.localeCompare(e.name,"en",{sensitivity:"base"});if(r!==0)return r;let o=Object.keys(t.attributes).length,a=Object.keys(t.attributes).length;return o!==a?a-o:t.id-e.id}getGeometryType(t){switch(t){case"Line":return 1;case"Area":return 2;default:return 0}}getLookupTable(t){switch(t){case"Simplified":return 0;case"Paper":return 1;case"Lines":return 2;case"Plain":return 3;default:return 4}}processLookup(t){t.CHARTSYMBOLS.LOOKUPS[0].LOOKUP.forEach(i=>{let r={name:i.$.NAME,instruction:i.INSTRUCTION[0],lookupTable:this.getLookupTable(i["TABLE-NAME"][0]),geometryType:this.getGeometryType(i.TYPE[0]),displayCategory:this.getDisplayCategory(i["DISPLAY-CAT"][0]),attributes:{},id:parseInt(i.$.ID),displayPriority:this.getDisplayPriority(i["DISP-PRIO"][0])},o=i["ATTRIB-CODE"];o&&o.forEach(a=>{r.attributes[a.$.INDEX]=a._}),this.lookups.push(r)}),this.lookups=this.lookups.sort(this.compareLookup);let e="";this.lookups.forEach((i,r)=>{let o=i.lookupTable+","+i.name.toUpperCase()+","+i.geometryType;o!==e&&(this.lookupStartIndex.set(o,r),e=o)})}getSymbol(t){let e=this.chartSymbols.get(t);return e&&this.chartSymbolsImage?(e.image||(e.image=new Image(e.width,e.height),createImageBitmap(this.chartSymbolsImage,e.locationX,e.locationY,e.width,e.height).then(i=>{let r=document.createElement("CANVAS");r.height=e.height,r.width=e.width,r.getContext("2d").drawImage(i,0,0),e.image.src=r.toDataURL()})),e):null}propertyCompare(t,e){let i=typeof t,r;switch(i){case"number":return r=parseInt(e),t-r;case"string":return t.localeCompare(e);default:return-1}}selectLookup(t){let e=t.getProperties(),i={};Object.keys(e).forEach(g=>{i[g.toUpperCase()]=e[g]});let r=t.getGeometry(),o=i.LAYER,a=r.getType(),s=1,l=0;switch(a==="Polygon"?l=2:a==="LineString"&&(l=1),l){case 0:this.options.graphicsStyle==="Paper"?s=1:s=0;break;case 1:s=2;break;case 2:this.options.boundaries==="Plain"?s=3:s=4;break}let c=-1,d=this.lookupStartIndex.get(s+","+o.toUpperCase()+","+l),f=d;if(f){let g=this.lookups[f],m=0;for(;g.name.localeCompare(o,"en",{sensitivity:"base"})===0&&g.geometryType===l&&g.lookupTable===s;){let b=0;Object.keys(g.attributes).forEach(v=>{let E=g.attributes[v],k=this.attMatch.exec(E),P=k[1].toUpperCase(),I=k[2].toUpperCase();if(I===" "){b++;return}I!=="?"&&this.propertyCompare(i[P],I)===0&&b++}),Object.keys(g.attributes).length===b&&b>m&&(c=f,m=b),f++,g=this.lookups[f]}if(c===-1){let b=d,v=this.lookups[b];for(;v.name.localeCompare(o,"en",{sensitivity:"base"})===0&&v.geometryType===l&&v.lookupTable===s;){if(Object.keys(v.attributes).length===0){c=b;break}b++,v=this.lookups[b]}}return c}return-1}getDisplayCategory(t){switch(t){case"Displaybase":return 0;case"Standard":return 1;case"Mariners":return 3;default:return 2}}getDisplayPriority(t){switch(t){case"Group 1":return 1;case"Area 1":return 2;case"Area 2":return 3;case"Point Symbol":return 4;case"Line Symbol":return 5;case"Area Symbol":return 6;case"Routing":return 7;case"Hazards":return 8;case"Mariners":return 9;default:return 0}}static \u0275fac=function(e){return new(e||n)(je(pa))};static \u0275prov=ce({token:n,factory:n.\u0275fac,providedIn:"root"})};var aVe=46,sVe=42,Ww="$lupIndex",QP=class{s57Service;selectedSafeContour=1e3;instructionMatch=new RegExp("([A-Z][A-Z])\\((.*)\\)");constructor(t){this.s57Service=t}getSymbolStyle(t){let e=this.s57Service.getSymbol(t);return e?new Re({image:new nr({width:e.width,height:e.height,img:e.image,opacity:1,anchorXUnits:"pixels",anchorYUnits:"pixels",anchor:[e.pivotX,e.pivotY],declutterMode:"none"})}):null}getTextStyle(t){let e="middle",i=0;t[1]==="3"?(e="top",i=15):t[1]==="1"&&(e="bottom",i=-15);let r="left",o=15;t[0]==="2"?(r="right",o=-15):t[0]==="1"&&(r="center",o=0);let a=new Re({text:new zi({textAlign:r,textBaseline:e,scale:1.5,offsetX:o,offsetY:i})});return a.setZIndex(99),a}getTextStyleTXStyle(t,e){let i=e.split(",");return this.getTextStyle(i.slice(1))}getTextStyleTXText(t,e){let i=e.split(",");return t[i[0]]}stripQuotes(t){return t.substring(1).substring(0,t.length-2)}getTextStyleTEText(t,e){let i=e.split(","),r=t[this.stripQuotes(i[1])],o=this.stripQuotes(i[0]);return!r||!o?null:o.replace(/%[0-9]*.?[0-9]*l?[sfd]/,r)}getTextStyleTEStyle(t,e){let i=e.split(",");return this.getTextStyle(i.slice(2))}getDefaultStyle(){return new Re({fill:new ot({color:"rgba(#224, 209, 14, 0.8)"}),stroke:new Ge({color:"#444",width:1})})}getAreaStyle(t){let e=this.s57Service.getColor(t);return e?new Re({fill:new ot({color:e})}):null}getLineStyle(t){let e=t.split(","),i=this.s57Service.getColor(e[2]),r=parseInt(e[1]),o=e[0],a=null;switch(o){case"DASH":a=[4,4];break;case"SOLD":a=null;break;default:console.debug("Unsupported linestyle:",o)}return new Re({stroke:new Ge({color:i,width:r,lineDash:a})})}GetCSQQUALIN01(t){let e=[],i=t.getProperties(),r=0,o=!1;if(i.QUAPOS&&(r=parseFloat(i.QUAPOS),o=!0),o)2<=r&&r<10&&e.push("LC(LOWACC21");else if(i.layer==="COALNE"){let a=0,s=!1;i.CONRAD&&(r=parseFloat(i.CONRAD),o=!0),s&&a===1&&e.push("LS(SOLD,3,CHMGF)"),e.push("LS(SOLD,1,CSTLN)")}else e.push("LS(SOLD,1,CSTLN)");return e}GetCSQQUAPNT01(t){let e=[],i=t.getProperties(),r=!0,o=0,a=!1;if(i.QUAPOS&&(o=parseInt(i.QUAPOS),a=!0),a&&(2<=o&&o<10&&(r=!1),r))switch(o){case 4:e.push("SY(QUAPOS01)");break;case 5:e.push("SY(QUAPOS02)");break;case 7:case 8:e.push("SY(QUAPOS03)");break;default:e.push("SY(LOWACC03)");break}return e}GetCSQUAPOS01(t){return t.getGeometry().getType()==="LineString"?this.GetCSQQUALIN01(t):this.GetCSQQUAPNT01(t)}GetCSSLCONS03(t){let e=[],i=t.getProperties(),r=t.getGeometry(),o=0,a=!1;if(i.QUAPOS&&(o=parseFloat(i.QUAPOS),a=!0),r.getType()==="Point")a&&2<=o&&o<10&&e.push("SY(LOWACC01)");else if(r.getType()==="Polygon"&&e.push("AP(CROSSX01"),a)2<=o&&o<10&&e.push("LC(LOWACC01)");else{let s=!1,l=0;if(i.QUAPOS&&(l=parseInt(i.CONDTN),s=!0),s&&(l===1||l===2))e.push("LS(DASH,1,CSTLN)");else{let c=!1,d=0;if(i.CATSLC&&(d=parseInt(i.CATSLC),c=!0),c&&(d===6||d===15||d===16))e.push("LS(SOLD,4,CSTLN)");else{let f=!1,g=0;i.WATLEV&&(g=parseInt(i.WATLEV),f=!0),f&&g===2?e.push("LS(SOLD,2,CSTLN)"):f&&(g===3||g===4)?e.push("LS(DASH,2,CSTLN)"):e.push("LS(SOLD,2,CSTLN)")}}}return e}GetCSTOPMAR01(t){let e=null,i=t.getProperties();if(!i.TOPSHP)e="SY(QUESMRK1)";else{let r=!1,o=i.layer;(o==="LITFLT"||o==="LITVES"||o.startsWith("BOY"))&&(r=!0);let a=i.TOPSHP;if(r)switch(a){case 1:e="SY(TOPMAR02)";break;case 2:e="SY(TOPMAR04)";break;case 3:e="SY(TOPMAR10)";break;case 4:e="SY(TOPMAR12)";break;case 5:e="SY(TOPMAR13)";break;case 6:e="SY(TOPMAR14)";break;case 7:e="SY(TOPMAR65)";break;case 8:e="SY(TOPMAR17)";break;case 9:e="SY(TOPMAR16)";break;case 10:e="SY(TOPMAR08)";break;case 11:e="SY(TOPMAR07)";break;case 12:e="SY(TOPMAR14)";break;case 13:e="SY(TOPMAR05)";break;case 14:e="SY(TOPMAR06)";break;case 17:e="SY(TMARDEF2)";break;case 18:e="SY(TOPMAR10)";break;case 19:e="SY(TOPMAR13)";break;case 20:e="SY(TOPMAR14)";break;case 21:e="SY(TOPMAR13)";break;case 22:e="SY(TOPMAR14)";break;case 23:e="SY(TOPMAR14)";break;case 24:e="SY(TOPMAR02)";break;case 25:e="SY(TOPMAR04)";break;case 26:e="SY(TOPMAR10)";break;case 27:e="SY(TOPMAR17)";break;case 28:e="SY(TOPMAR18)";break;case 29:e="SY(TOPMAR02)";break;case 30:e="SY(TOPMAR17)";break;case 31:e="SY(TOPMAR14)";break;case 32:e="SY(TOPMAR10)";break;case 33:e="SY(TMARDEF2)";break;default:e="SY(TMARDEF2)";break}else switch(a){case 1:e="SY(TOPMAR22)";break;case 2:e="SY(TOPMAR24)";break;case 3:e="SY(TOPMAR30)";break;case 4:e="SY(TOPMAR32)";break;case 5:e="SY(TOPMAR33)";break;case 6:e="SY(TOPMAR34)";break;case 7:e="SY(TOPMAR85)";break;case 8:e="SY(TOPMAR86)";break;case 9:e="SY(TOPMAR36)";break;case 10:e="SY(TOPMAR28)";break;case 11:e="SY(TOPMAR27)";break;case 12:e="SY(TOPMAR14)";break;case 13:e="SY(TOPMAR25)";break;case 14:e="SY(TOPMAR26)";break;case 15:e="SY(TOPMAR88)";break;case 16:e="SY(TOPMAR87)";break;case 17:e="SY(TMARDEF1)";break;case 18:e="SY(TOPMAR30)";break;case 19:e="SY(TOPMAR33)";break;case 20:e="SY(TOPMAR34)";break;case 21:e="SY(TOPMAR33)";break;case 22:e="SY(TOPMAR34)";break;case 23:e="SY(TOPMAR34)";break;case 24:e="SY(TOPMAR22)";break;case 25:e="SY(TOPMAR24)";break;case 26:e="SY(TOPMAR30)";break;case 27:e="SY(TOPMAR86)";break;case 28:e="SY(TOPMAR89)";break;case 29:e="SY(TOPMAR22)";break;case 30:e="SY(TOPMAR86)";break;case 31:e="SY(TOPMAR14)";break;case 32:e="SY(TOPMAR30)";break;case 33:e="SY(TMARDEF1)";break;default:e="SY(TMARDEF1)";break}}return e?[e]:[]}GetCSLIGHTS05(t){let e=null,i=t.getProperties();if(i.COLOUR){let r=i.COLOUR.split(",");r.length===1?r[0]==="3"?e="SY(LIGHTS11)":r[0]==="4"?e="SY(LIGHTS12)":(r[0]==="1"||r[0]==="6"||r[0]==="13")&&(e="SY(LIGHTS13)"):r.length===2&&(r.includes("1")&&r.includes("3")?e="SY(LIGHTS11)":r.includes("1")&&r.includes("4")&&(e="SY(LIGHTS12)"))}return e?[e]:[]}GetSeabed01(t,e){let i=["AC(DEPIT)"];return t>=0&&e>0&&(i=["AC(DEPVS)"]),this.s57Service.options.colors===2?t>=this.s57Service.options.safetyDepth&&e>this.s57Service.options.safetyDepth&&(i=["AC(DEPDW)"]):(t>=this.s57Service.options.shallowDepth&&e>this.s57Service.options.shallowDepth&&(i=["AC(DEPMS)"]),t>=this.s57Service.options.safetyDepth&&e>this.s57Service.options.safetyDepth&&(i=["AC(DEPMD)"]),t>=this.s57Service.options.deepDepth&&e>this.s57Service.options.deepDepth&&(i=["AC(DEPDW)"])),i}GetCSDEPCNT02(t){let e=t.getProperties(),i=t.getGeometry(),r=[],o=0,a=-1,s=0,l=0,c=0;return e.OBJL&&(c=parseInt(e.OBJL)),sVe===c&&i.getType()==="LineString"?(e.DRVAL1&&(o=parseFloat(e.DRVAL1)),a=o):e.VALDCO&&(s=parseFloat(e.VALDCO),a=s),a<this.s57Service.options.safetyDepth?(r.push("LS(SOLD,1,DEPCN)"),r):(e.QUAPOS?(l=parseFloat(e.QUAPOS),l>2&&l<10&&(a===this.selectedSafeContour?r.push("LS(DASH,2,DEPSC)"):r.push("LS(DASH,1,DEPCN)"))):a===this.selectedSafeContour?r.push("LS(SOLD,2,DEPSC)"):r.push("LS(SOLD,1,DEPCN)"),r)}getCSDEPARE01(t){let e=[],i=t.getProperties(),r=-1,o=parseFloat(i.DRVAL1);Number.isNaN(o)||(r=o);let a=r+.01,s=parseFloat(i.DRVAL2);Number.isNaN(s)||(a=s),e=this.GetSeabed01(r,a);let l=i.OBJL;return parseInt(l)===aVe&&(e.push("AP(DRGARE01)"),e.push("LS(DASH,1,CHGRF)")),e}evalCS(t,e){let i=[],r=this.instructionMatch.exec(e);if(r&&r.length>1)switch(r[2]){case"LIGHTS05":i=this.GetCSLIGHTS05(t);break;case"DEPCNT02":i=this.GetCSDEPCNT02(t);break;case"DEPARE01":case"DEPARE02":i=this.getCSDEPARE01(t);break;case"TOPMAR01":i=this.GetCSTOPMAR01(t);break;case"SLCONS03":i=this.GetCSSLCONS03(t);break;case"QUAPOS01":i=this.GetCSQUAPOS01(t);break;default:console.debug("Unsupported CS:"+e)}return i}getStylesFromRules(t,e){let i=[];if(t){let r=e.getProperties(),o=t.instruction.split(";");for(let a=0;a<o.length;a++)if(o[a].startsWith("CS")){let s=this.evalCS(e,o[a]);o.splice(a,1,...s)}o.forEach(a=>{let s=this.instructionMatch.exec(a);if(s&&s.length>1){let l=null,c=s[1]+"_"+s[2];if(l=this.s57Service.getStyle(c),!l){switch(s[1]){case"SY":l=this.getSymbolStyle(s[2]);break;case"AC":l=this.getAreaStyle(s[2]);break;case"TX":l=this.getTextStyleTXStyle(r,s[2]);break;case"TE":l=this.getTextStyleTEStyle(r,s[2]);break;case"LS":l=this.getLineStyle(s[2]);break;default:console.debug("Unsupported instruction:"+a)}this.s57Service.setStyle(c,l)}l&&(s[1]==="TE"&&l.getText().setText(this.getTextStyleTEText(r,s[2])),s[1]==="TX"&&l.getText().setText(this.getTextStyleTXText(r,s[2])),i.push(l))}})}return i}layerOrder(t){switch(t.getProperties().layer){case"SEAARE":return 2;case"DEPARE":return 3;case"DEPCNT":return 4;case"LNDARE":return 5;case"BUAARE":return 6;default:return 99}}updateSafeContour(t){let e=t.getProperties();if(e.DRVAL1){let i=e.DRVAL1;return i>=this.s57Service.options.safetyDepth&&i<this.selectedSafeContour&&(this.selectedSafeContour=i),i}if(e.VALDCO){let i=e.VALDCO;return i>=this.s57Service.options.safetyDepth&&i<this.selectedSafeContour&&(this.selectedSafeContour=i),i}return 0}renderOrder=(t,e)=>{let i=this.layerOrder(t),r=this.layerOrder(e),o=this.updateSafeContour(t),a=this.updateSafeContour(e),s=t[Ww],l=t[Ww];if(s||(s=this.s57Service.selectLookup(t),t[Ww]=s),l||(l=this.s57Service.selectLookup(e),e[Ww]=l),i!==r)return i-r;if(s>=0&&l>=0){let c=this.s57Service.getLookup(s).displayPriority,d=this.s57Service.getLookup(s).displayPriority;if(c!==d)return c-d}return o!==a?o-a:0};getStyle=(t,e)=>{let i=t[Ww];if(i>=0){let r=this.s57Service.getLookup(i);if(r.displayCategory===0||r.displayCategory===1||r.displayCategory===3||r.name==="DEPCNT")return this.getStylesFromRules(r,t)}return null}};var JP=class{constructor(t){this.chart=t;this.MinZ=t.minZoom&&t.minZoom>=.1?t.minZoom-.1:t.minZoom,this.MaxZ=t.maxZoom}MinZ;MaxZ},sj=class extends JP{constructor(e,i){super(e);this.s57service=i}CreateLayer(){let e=null;return this.chart.bounds&&this.chart.bounds.length>0&&(e=va(this.chart.bounds,"EPSG:4326","EPSG:3857")),new Lu({declutter:!0,extent:e})}ApplyStyle(e){let i=new kg({url:this.chart.url,minZoom:this.chart.minZoom,maxZoom:this.chart.maxZoom,format:new ag({}),tileSize:256}),r=new QP(this.s57service);e.setSource(i),e.setPreload(0),e.setStyle(r.getStyle),e.setMinZoom(this.chart.minZoom),e.setMaxZoom(23),e.setRenderOrder(r.renderOrder),this.s57service.refresh.subscribe(()=>{i.refresh()})}},eA=class extends JP{constructor(t){super(t)}CreateLayer(){return new Lu}applyVectorStyle(){return new Re({fill:new ot({color:"rgba(#224, 209, 14, 0.8)"}),stroke:new Ge({color:"#444",width:1})})}ApplyStyle(t){let e=new kg({url:this.chart.url,format:new ag({layers:this.chart.layers&&this.chart.layers.length!==0?this.chart.layers:null})});t.setSource(e),t.setPreload(0),t.setStyle(this.applyVectorStyle),t.setMinZoom(this.MinZ),t.setMaxZoom(this.MaxZ)}},lj=class extends eA{constructor(t){super(t)}CreateLayer(){return new Lu({declutter:!0})}ApplyStyle(t){t.set("declutter",!0);let e=new vw(this.chart.url);function i(o,a){let s=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=a.match(s),c=+l[2],d=+l[3],f=+l[4];o.setLoader((g,m,b)=>{o.setState(1),e.getZxy(c,d,f).then(v=>{if(v){let k=o.getFormat().readFeatures(v.data,{extent:g,featureProjection:b});o.setFeatures(k),o.setState(2)}else o.setState(4)})})}let r=new kg({format:new ag,url:"pmtiles://"+this.chart.url+"/{z}/{x}/{y}",tileLoadFunction:i});t.setSource(r),t.setPreload(0),t.setStyle(this.applyVectorStyle),t.setMinZoom(this.chart.minZoom),t.setMaxZoom(this.chart.maxZoom)}},tA=class n{constructor(t){this.s57service=t}CreateVectorLayerStyler(t){return t.url.indexOf(".pmtiles")!==-1?new lj(t):t.type==="S-57"||t.type==="s-57"?new sj(t,this.s57service):new eA(t)}static \u0275fac=function(e){return new(e||n)(je(gf))};static \u0275prov=ce({token:n,factory:n.\u0275fac,providedIn:"root"})};var cVe=["*"],Uy=class n{constructor(t,e,i,r,o){this.changeDetectorRef=t;this.mapComponent=e;this.mapService=i;this.vectorLayerStyleFactory=r;this.s57=o;this.changeDetectorRef.detach()}layers=new Map;charts;zIndex=10;colorMode;wmtsCapabilitesMap=new Map;ngOnInit(){this.parseCharts(this.charts)}ngOnChanges(t){for(let e in t)e==="charts"&&!t[e].firstChange&&this.parseCharts(t[e].currentValue),e==="colorMode"&&this.parseColorMode(t[e].currentValue)}ngOnDestroy(){this.clearlayers()}parseColorMode(t){let e={day:0,dusk:3,sunrise:3,night:4};t in e&&this.s57.setColorTable(e[t])}clearlayers(){let t=this.mapComponent.getMap();this.layers&&t&&(this.layers.forEach(e=>t.removeLayer(e)),t.render(),this.layers.clear())}initPMTilesWebGLLayer(t,e,i,r){let o=new vw(t);function a(l){return new Promise((c,d)=>{let f=new Image;f.addEventListener("load",()=>c(f)),f.addEventListener("error",()=>d(new Error("load failed"))),f.src=l})}function s(l,c,d){return Ae(this,null,function*(){let f=yield o.getZxy(l,c,d),g=new Blob([f.data]),m=URL.createObjectURL(g),b=yield a(m);return URL.revokeObjectURL(m),b})}return new joe({source:new noe({loader:s,wrapX:!0,maxZoom:i,minZoom:e}),style:{},zIndex:r})}initPMTilesXYZLayer(t,e){let i=new vw(t.url);function r(o,a){o.setState(1);let s=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=a.match(s),c=+l[2],d=+l[3],f=+l[4];i.getZxy(c,d,f).then(g=>{if(g){let m=new Blob([g.data]),b=window.URL.createObjectURL(m);o.getImage().src=b,o.setState(2)}else o.setState(4)})}return new Sd({source:new Uh({tileLoadFunction:r,tileSize:[512,512],url:"pmtiles://"+t.url+"/{z}/{x}/{y}",wrapX:!0,maxZoom:t.maxZoom,minZoom:t.minZoom}),zIndex:e,opacity:t.defaultOpacity??1})}parseCharts(){return Ae(this,arguments,function*(t=this.charts){let e=this.mapComponent.getMap(),i=t.map(o=>o[0]),r=[];this.layers.forEach((o,a)=>{i.includes(a)||(e.removeLayer(o),r.push(a))}),r.forEach(o=>this.layers.delete(o));for(let o in t){let a=this.mapService.getLayerByKey("id",t[o][0]);if(a)a.setZIndex(this.zIndex+parseInt(o)),a.setOpacity(t[o][1].defaultOpacity??1);else{if(t[o][0]==="openstreetmap")a=NV(),a.setZIndex(this.zIndex+parseInt(o)),a.setMinZoom(t[o][1].minZoom),a.setMaxZoom(t[o][1].maxZoom),a.setOpacity(t[o][1].defaultOpacity??1);else{let s=t[o][1].minZoom&&t[o][1].minZoom>=.1?t[o][1].minZoom-.1:t[o][1].minZoom,l=t[o][1].maxZoom;if(t[o][1].type.toLowerCase()==="mapstylejson"){let c=new Yp({zIndex:this.zIndex+parseInt(o)});c.set("id",t[o][0]),c.setOpacity(t[o][1].defaultOpacity??1),ZP(c,`${t[o][1].url}`),e.addLayer(c),this.layers.set(t[o][0],c)}else if(t[o][1].format==="pbf"||t[o][1].format==="mvt"){let c=this.vectorLayerStyleFactory.CreateVectorLayerStyler(t[o][1]);a=c.CreateLayer(),c.ApplyStyle(a),a.setZIndex(this.zIndex+parseInt(o)),a.setOpacity(t[o][1].defaultOpacity??1),t[o][1].style&&Gw(a,t[o][1].style)}else{let c;if(t[o][1].type&&t[o][1].type.toLowerCase()==="wms")c=new cw({url:t[o][1].url,params:{LAYERS:t[o][1].layers?t[o][1].layers.join(","):""}});else if(t[o][1].type&&t[o][1].type.toLowerCase()==="wmts"){let d;if(this.wmtsCapabilitesMap.has(t[o][1].url))d=this.wmtsCapabilitesMap.get(t[o][1].url);else try{let m=yield(yield fetch(`${t[o][1].url}?request=GetCapabilities&service=wmts`)).text();if(!m){console.log("Error: GetCapabilities response is empty!");return}d=new sg().read(m),this.wmtsCapabilitesMap.set(t[o][1].url,d)}catch(g){console.log(g);return}let f=Z3(d,{layer:t[o][1].layers[0],matrixSet:"EPSG:3857"});c=new dw(f)}else t[o][1].type&&t[o][1].type.toLowerCase()==="tilejson"?c=new fy({url:t[o][1].url,crossOrigin:"anonymous"}):t[o][1].url.indexOf(".pmtiles")!==-1?a=this.initPMTilesXYZLayer(t[o][1],this.zIndex+parseInt(o)):c=new Uh({url:t[o][1].url});c&&(a=new Sd({source:c,preload:0,zIndex:this.zIndex+parseInt(o),minZoom:s,maxZoom:l,opacity:t[o][1].defaultOpacity??1}))}}a&&(a.set("id",t[o][0]),a.set("chartId",t[o][0]),this.layers.set(t[o][0],a),e.addLayer(a))}}e&&e.render()})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct),N(Eg),N(tA),N(gf))};static \u0275cmp=U({type:n,selectors:[["fb-charts"]],inputs:{charts:"charts",zIndex:"zIndex",colorMode:"colorMode"},standalone:!1,features:[be],ngContentSelectors:cVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var uVe=["*"],Hy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),this.refreshTimer=setInterval(()=>this.onTimerTick(),6e4),Ut(()=>{!this.layerMap||!Array.isArray(this.params())||this.params().forEach(i=>{let r=this.layerMap.get(i.id),o=r.layer.getSource();o&&r.infoLayer.values.sourceType.toLowerCase()==="wms"?o?.updateParams(i.param):o&&r.infoLayer.values.sourceType.toLowerCase()==="wmts"&&o?.updateDimensions(i.param)})})}layerDefs;zIndex=100;params=$t();layerGroup;wmtsCapabilitesMap=new Map;layerMap=new Map;refreshTimer;ngOnInit(){this.parseLayers(this.layerDefs)}ngOnChanges(t){for(let e in t)e==="layerDefs"&&!t[e].firstChange&&this.parseLayers(t[e].currentValue)}ngOnDestroy(){clearInterval(this.refreshTimer),this.clearlayers()}onTimerTick(){let t=Date.now();this.layerMap.forEach((e,i)=>{e.infoLayer.values?.refreshInterval>0&&t-e.lastRefresh>=e.infoLayer.values?.refreshInterval&&(e.layer.getSource()?.refresh(),e.lastRefresh=t)})}clearlayers(){let t=this.mapComponent.getMap();this.layerGroup&&t&&t.removeLayer(this.layerGroup)}parseLayers(){return Ae(this,arguments,function*(t=this.layerDefs){let e=this.mapComponent.getMap();if(!e)return;this.layerGroup||(this.layerGroup=new Yp({zIndex:this.zIndex}),this.layerGroup.set("id","infogroup"),e.addLayer(this.layerGroup));let i=new wr,r=[];for(let a in t){let s=t[a];if(r.push(s[0]),this.layerMap.has(s[0])){let l=this.layerMap.get(s[0]).layer;l.getOpacity()!==(s[1].values?.opacity??1)&&l.setOpacity(s[1].values?.opacity??1),l.getMinZoom()!==(s[1].values?.minZoom??1)&&l.setMinZoom(s[1].values?.minZoom??1),l.getMaxZoom()!==(s[1].values?.maxZoom??24)&&l.setMaxZoom(s[1].values?.maxZoom??24),this.layerMap.set(s[0],{layer:l,lastRefresh:Date.now(),infoLayer:s[1]}),i.push(l)}else{let l=yield this.buildLayer(s,a);l&&(this.layerMap.set(s[0],{layer:l,lastRefresh:Date.now(),infoLayer:s[1]}),i.push(l))}}this.layerGroup.setLayers(i),e.render(),Array.from(this.layerMap).map(a=>a[0]).forEach(a=>{r.includes(a)||this.layerMap.delete(a)})})}buildLayer(t,e){return Ae(this,null,function*(){let i;if(t[1].type==="InfoLayer"){t[1].values?.sourceType?.toLowerCase()==="wms"?i=this.setWMSSource(t):t[1].values?.sourceType?.toLowerCase()==="wmts"?i=yield this.setWMTSSource(t):t[1].values?.sourceType?.toLowerCase()==="xyz"&&(i=new Uh({url:t[1].values?.url}));let r=new Sd({source:i,preload:0,zIndex:this.zIndex+parseInt(e),minZoom:t[1].values?.minZoom??1,maxZoom:t[1].values?.maxZoom??24,opacity:t[1].values?.opacity??1});return r.set("id",t[0]),r}})}removeLayer(t){let e=this.mapComponent.getMap();if(!e||!this.layerMap.has(t))return;this.layerGroup.getLayers().remove(this.layerMap.get(t).layer),e.render()}setWMSSource(t){return new cw({url:t[1].values?.url,params:{LAYERS:t[1].values?.layers?t[1].values?.layers.join(","):""}})}setWMTSSource(t){return Ae(this,null,function*(){let e;if(this.wmtsCapabilitesMap.has(t[1].values?.url))e=this.wmtsCapabilitesMap.get(t[1].values?.url);else try{let o=yield(yield fetch(`${t[1].values?.url}?request=GetCapabilities&service=wmts`)).text();if(!o){console.log("Error: GetCapabilities response is empty!");return}e=new sg().read(o),this.wmtsCapabilitesMap.set(t[1].values?.url,e)}catch(r){console.log(r);return}let i=Z3(e,{layer:t[1].values?.layers[0],matrixSet:"EPSG:3857"});return new dw(i)})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-livelayer"]],inputs:{layerDefs:"layerDefs",zIndex:"zIndex",params:[1,"params"]},standalone:!1,features:[be],ngContentSelectors:uVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var fVe=["*"],Gy=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}charts=[];boundStyles=["red","magenta","blue","purple","green"];ngOnInit(){super.ngOnInit(),this.parseChartBounds(this.charts)}ngOnChanges(e){super.ngOnChanges(e),this.source&&"charts"in e&&(this.source.clear(),this.parseChartBounds(e.charts.currentValue))}parseChartBounds(e=this.charts){let i=[],r=0;i.push(this.buildBackdrop());for(let o of e){let a=this.parseBoundsCoordinates(o[1].bounds);if(a.length===0)continue;let s=new ut({geometry:new Io(a),name:o[1].name});s.setId("chart-bound."+o[0]);let l=[a[0][0][0]+(a[0][0][0]>a[0][1][0]?a[0][0][0]-a[0][1][0]:a[0][1][0]-a[0][0][0])/2,a[0][1][1]];s.set("labelPos",l),s.set("boundColor",this.boundStyles[r]),s.setStyle(this.buildStyle),i.push(s),r++,r=r===this.boundStyles.length?0:r}this.source.addFeatures(i)}buildBackdrop(){let e=new ut({geometry:new Io([Ri([[-180,-90],[-180,90],[180,90],[180,-90],[-180,-90]])]),name:""});return e.setId("chart-backdrop"),e.setStyle(new Re({fill:new ot({color:"rgba(255,255,255,0.4)"})})),e}buildStyle(e){return[new Re({stroke:new Ge({color:e.get("boundColor"),width:2}),fill:new ot({color:"rgba(255,255,255,0.1 )"})}),new Re({geometry:new kt(e.get("labelPos")),text:new zi({text:e.get("name"),overflow:!0,offsetX:0,offsetY:-10,fill:new ot({color:e.get("boundColor")}),justify:"left",textBaseline:"top"})})]}parseBoundsCoordinates(e){if(!Array.isArray(e)||e.length!==4||e[0]===-180&&e[1]===-90&&e[2]===180&&e[3]===90)return[];let i=In([[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]],[e[0],e[1]]],0);return[Ri(i)]}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["fb-chart-bounds"]],inputs:{charts:"charts"},standalone:!1,features:[Le,be],ngContentSelectors:fVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var mVe=["*"],Wy=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}tracks;trackStyles;ngOnInit(){super.ngOnInit(),this.labelPrefixes=["track"],this.parseTracks(this.tracks)}ngOnChanges(e){super.ngOnChanges(e),this.source&&"tracks"in e&&(this.source.clear(),this.parseTracks(e.tracks.currentValue))}parseTracks(e=this.tracks){let i=[];for(let r of e){let o=new ut({geometry:new Ca(this.parseCoordinates(r[1].feature.geometry.coordinates)),name:r[1].name});o.setId("track."+r[0]),o.setStyle(this.buildStyle(r[1])),i.push(o)}this.source.addFeatures(i)}buildStyle(e){if(typeof this.trackStyles<"u")return e.feature.properties.skType?this.setTextLabel(this.trackStyles[e.feature.properties.skType],e.feature.properties.name):this.setTextLabel(this.trackStyles.default,e.feature.properties.name);if(this.layerProperties&&this.layerProperties.style)return this.setTextLabel(this.layerProperties.style,e.feature.properties.name);{let i=new Re({stroke:new Ge({color:"rgb(146,11,153)",width:2,lineDash:[5,5]}),text:new zi({text:"",textAlign:"center"})});return this.setTextLabel(i,e.feature.properties.name)}}parseCoordinates(e){let i=[];return e.forEach(r=>i.push(In(r))),Ri(i)}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["fb-tracks"]],inputs:{tracks:"tracks",trackStyles:"trackStyles"},standalone:!1,features:[Le,be],ngContentSelectors:mVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var _Ve=["*"],$y=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}features;collection;resourceSets=[];ngOnInit(){super.ngOnInit(),this.labelPrefixes=["rset"],this.parseResourceSets(this.resourceSets)}ngOnChanges(e){super.ngOnChanges(e),this.source&&"resourceSets"in e&&(this.source.clear(),this.parseResourceSets(e.resourceSets.currentValue))}parseResourceSets(e){this.features=[];for(let i of e)i[2]&&this.parseResources(i[1]);this.source.addFeatures(this.features)}parseResources(e){let i=[],r=0;for(let o of e.values.features){let a;if(o.geometry.type==="Point"&&(a=new ut({geometry:new kt(Jt(o.geometry.coordinates)),name:o.properties.name??`Point ${r}`})),o.geometry.type==="MultiPoint"?a=new ut({geometry:new ud(Ri(o.geometry.coordinates)),name:o.properties.name??`Pt ${r}`}):o.geometry.type==="LineString"?a=new ut({geometry:new ki(Ri(o.geometry.coordinates)),name:o.properties.name??`L${r}`}):o.geometry.type==="MultiLineString"?a=new ut({geometry:new Ca(Ri(o.geometry.coordinates)),name:o.properties.name??`L${r}`}):o.geometry.type==="Polygon"?a=new ut({geometry:new Io(Ri(o.geometry.coordinates)),name:o.properties.name??`P${r}`}):o.geometry.type==="MultiPolygon"&&(a=new ut({geometry:new Pl(Ri(o.geometry.coordinates)),name:o.properties.name??`P${r}`})),!!a){if(a.setId(`rset.${this.collection}.${e.id}.${r}`),typeof e.styles<"u"){let s;typeof o.properties.styleRef<"u"?s=this.buildStyle(e.styles[o.properties.styleRef],o.geometry.type):typeof o.properties.style<"u"?s=this.buildStyle(o.properties.style,o.geometry.type):s=this.buildStyle(e.styles.default,o.geometry.type),a.setStyle(this.setTextLabel(s,o.properties.name))}i.push(a),r++}}this.features=this.features.concat(i)}buildStyle(e,i){let r=new Re;return i==="Point"||i==="MulitPoint"?(r.setImage(new On({radius:e.width??5,fill:new ot({color:e.fill??"blue"}),stroke:new Ge({color:e.stroke??"blue",width:2,lineDash:e.lineDash??[1]})})),r.setText(new zi({text:"",offsetY:-20}))):(r.setFill(new ot({color:e.fill??"blue"})),r.setStroke(new Ge({color:e.stroke??"blue",width:e.width??2,lineDash:e.lineDash??[1]}))),r}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["fb-resource-sets"]],inputs:{collection:"collection",resourceSets:"resourceSets"},standalone:!1,features:[Le,be],ngContentSelectors:_Ve,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var yVe=["*"],qy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.radius(),this.anchorPosition(),this.vesselPosition(),this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))})}layer;source;features;layerReady=new Cn;radius=$t();anchorPosition=$t();vesselPosition=$t();anchorStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedRadius=0;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){this.mapifiedRadius=hy(this.radius()<0?0:this.radius(),this.anchorPosition()),this.mapifiedLine=In([this.anchorPosition(),this.vesselPosition()]);let t=[],e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setStyle(this.buildStyle("line")),t.push(e);let i=new ut({geometry:new kp(Jt(this.anchorPosition()),this.mapifiedRadius)});i.setStyle(this.buildStyle("circle")),t.push(i);let r=new ut({geometry:new kt(Jt(this.anchorPosition()))});r.setId("anchor"),r.setStyle(this.buildStyle("anchor")),t.push(r),this.features=t}buildStyle(t){return this.anchorStyles&&this.anchorStyles[t]?this.anchorStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:new Re({stroke:new Ge({width:2,color:"black",lineDash:[5,5]}),fill:new ot({color:"rgba(0, 255, 0, .3)"})})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-anchor-alarm"]],inputs:{radius:[1,"radius"],anchorPosition:[1,"anchorPosition"],vesselPosition:[1,"vesselPosition"],anchorStyles:"anchorStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:yVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var CVe=["*"],Ky=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;alarms;alarmStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="alarms"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];this.alarms.forEach(e=>{if(!e||!e[1].properties.position)return;let i=new ut({geometry:new kt(Jt([e[1].properties.position.longitude,e[1].properties.position.latitude]))});i.setStyle(this.buildStyle(e[1].type)),i.setId(`alarm.${e[1].path}`),i.set("type",e[1].type),t.push(i)}),this.features=t}buildStyle(t){return this.alarmStyles&&this.alarmStyles[t]?this.alarmStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:new Re({image:new mo({points:3,radius:7,fill:new ot({color:"red"}),stroke:new Ge({color:"white",width:2}),rotateWithView:!1})})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-alarms"]],inputs:{alarms:"alarms",alarmStyles:"alarmStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:CVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var wVe=["*"],Xy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;cpaLines;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="cpaLines"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){if(!Array.isArray(this.cpaLines))return;let t=[];this.cpaLines.forEach(e=>{let i=In(e),r=new ut({geometry:new ki(Ri(i))});r.setStyle(this.buildStyle()),t.push(r);let o=new ut({geometry:new kt(Jt(i[0]))});o.setStyle(this.buildStyle()),t.push(o)}),this.features=t}buildStyle(){let t;return this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:t=new Re({image:new On({radius:10,stroke:new Ge({width:2,color:"red",lineDash:[2,3]}),fill:new ot({color:"rgba(255,0,0,.2)"})}),stroke:new Ge({width:2,color:"red",lineDash:[2,3]}),fill:new ot({color:"rgba(255,0,0,.2)"})}),t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-cpa-alarms"]],inputs:{cpaLines:"cpaLines",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:wVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var SVe=["*"],Yy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;position;radius;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="position"||i==="radius"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[],e=new ut({geometry:new kp(Jt(this.position),hy(this.radius,this.position))});e.setStyle(this.buildStyle()),t.push(e),this.features=t}buildStyle(){let t;return this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:t=new Re({fill:new ot({color:"rgba(255, 255, 255, .1)"}),stroke:new Ge({color:"rgba(242, 153, 10, 1)",width:2,lineDash:[5,5]})}),t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-arrival-circle"]],inputs:{position:"position",radius:"radius",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:SVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var DVe=["*"],Zy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.startPosition(),this.destPosition(),this.color(),this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))})}layer;source;features;layerReady=new Cn;startPosition=$t();destPosition=$t();color=$t();opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];if(Array.isArray(this.startPosition())&&Array.isArray(this.destPosition())){this.mapifiedLine=In([this.startPosition(),this.destPosition()]);let e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setStyle(this.buildStyle()),t.push(e)}this.features=t}buildStyle(){let t;if(this.layerProperties&&this.layerProperties.style)t=this.layerProperties.style;else{let e=this.color()??"gray";t=new Re({stroke:new Ge({width:1,color:e,lineDash:[5,5]}),fill:new ot({color:"rgba(255,0,0,.2)"})})}return t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-xte-path"]],inputs:{startPosition:[1,"startPosition"],destPosition:[1,"destPosition"],color:[1,"color"],opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:DVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var IVe=["*"],Qy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.markerPosition(),this.vesselPosition(),this.showMarker(),this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))}),Ut(()=>{this.labelMinZoom(),this.markerName(),typeof this.mapZoom<"u"&&this.updateLabel()})}layer;source;features=[];layerReady=new Cn;vesselPosition=$t();markerPosition=$t();showMarker=$t();labelMinZoom=$t(10);markerName=$t("");mapZoom=10;bearingStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedRadius=0;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="mapZoom"?this.handleLabelZoomChange(i,t[i]):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];if(Array.isArray(this.vesselPosition())&&Array.isArray(this.markerPosition())){this.mapifiedLine=In([this.vesselPosition(),this.markerPosition()]);let e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setStyle(this.buildStyle("line")),t.push(e);let i=new ut({geometry:new kt(Jt(this.markerPosition()))});i.setId("d.base"),i.setStyle(this.buildStyle("line")),this.updateLabel(i),t.push(i),this.showMarker&&(i=new ut({geometry:new kt(Jt(this.markerPosition()))}),i.setId("dest.point"),i.setStyle(this.buildStyle("marker")),t.push(i))}this.features=t}buildStyle(t){return this.bearingStyles&&this.bearingStyles[t]?this.bearingStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:[new Re({stroke:new Ge({color:"white",width:6})}),new Re({image:new On({radius:5,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"rgba(221, 149, 0, 1)"})}),stroke:new Ge({color:"rgba(221, 149, 0, 1)",width:2}),text:new zi({text:"",offsetX:0,offsetY:-29})})]}handleLabelZoomChange(t,e){t==="mapZoom"&&typeof this.labelMinZoom()<"u"&&(e.currentValue>=this.labelMinZoom()&&e.previousValue<this.labelMinZoom()||e.currentValue<this.labelMinZoom()&&e.previousValue>=this.labelMinZoom())&&this.updateLabel()}updateLabel(t){if(!t&&this.source&&(t=this.source.getFeatureById("d.base")),!!t)try{let e=t.getStyle();if(!e)return;e=Array.isArray(e)?e[1]:e;let i=e.getText();if(!i)return;i?.setText(Math.abs(this.mapZoom)>=this.labelMinZoom()?this.markerName()??"":""),e.setText(i),t.setStyle(e)}catch{}}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-bearing-line"]],inputs:{vesselPosition:[1,"vesselPosition"],markerPosition:[1,"markerPosition"],showMarker:[1,"showMarker"],labelMinZoom:[1,"labelMinZoom"],markerName:[1,"markerName"],mapZoom:"mapZoom",bearingStyles:"bearingStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:IVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var PVe=["*"],Jy=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features=[];layerReady=new Cn;lines;mapZoom=10;laylineStyles;position;twd;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="lines"||i==="twd"||i==="position"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="mapZoom"||(i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue);this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[],e=0;this.lines&&(this.lines.port&&Array.isArray(this.lines.port)&&this.lines.port.forEach(i=>{let r=In(i),o=new ut({geometry:new ki(Ri(r))});o.setStyle(this.buildStyle(e===0?"port":"starboard")),t.push(o),e++}),e=0,this.lines.starboard&&Array.isArray(this.lines.starboard)&&this.lines.starboard.forEach(i=>{let r=In(i),o=new ut({geometry:new ki(Ri(r))});o.setStyle(this.buildStyle(e===0?"port":"starboard")),t.push(o),e++})),this.features=t}buildStyle(t){return this.laylineStyles&&this.laylineStyles[t]?this.laylineStyles[t]:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:void 0}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-layline"]],inputs:{lines:"lines",mapZoom:"mapZoom",laylineStyles:"laylineStyles",position:"position",twd:"twd",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:PVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var OVe=["*"],ev=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features=[];layerReady=new Cn;line;mapZoom=10;lineStyle;position;twd;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;mapifiedLine=[];ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)["lines","position","twd"].includes(i)?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="mapZoom"||(i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue);this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[];if(Array.isArray(this.line)){let e=In(this.line),i=new ut({geometry:new ki(Ri(e))});i.setStyle(this.buildStyle()),t.push(i)}this.features=t}buildStyle(){return this.lineStyle?this.lineStyle:this.layerProperties&&this.layerProperties.style?this.layerProperties.style:void 0}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-target-angle"]],inputs:{line:"line",mapZoom:"mapZoom",lineStyle:"lineStyle",position:"position",twd:"twd",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:OVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var $w=Fs(au());var LVe=["*"],tv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features=[];layerReady=new Cn;points=[];reverse=!1;pointIndex=0;mapZoom=10;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="points"||i==="reverse"||i==="pointIndex"?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="mapZoom"?this.handleLabelZoomChange(i):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let t=[],e=[];if(this.points&&this.points.length!==0){if(this.points.length<4)e.push(0);else for(let i=1;i<this.points.length-2;i=i+2)e.push(i);e.forEach(i=>{let r=(0,$w.getCenter)(this.points.slice(i,i+2)),o=new ut({geometry:new kt(Jt([r.longitude,r.latitude]))});o.setId(`dot.${i}`),o.setStyle(this.buildStyle(i)),t.push(o)})}this.features=t}buildStyle(t){return new Re({image:new mo({points:3,radius:7,fill:new ot({color:"blue"}),stroke:new Ge({color:"white",width:1}),rotateWithView:!0,rotation:this.getOrientation(t)})})}setRotation(t,e){if(!t)return t;let i=t.clone(),r=i.getImage();if(r){let o=this.getOrientation(e);r.setRotation(o??0),i.setImage(r)}return i}getOrientation(t){let e=this.reverse?(0,$w.getRhumbLineBearing)(this.points[t+1],this.points[t]):(0,$w.getRhumbLineBearing)(this.points[t],this.points[t+1]);return Math.PI/180*e}handleLabelZoomChange(t){t==="labelMinZoom"&&typeof this.mapZoom<"u"}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-route-direction"]],inputs:{points:"points",reverse:"reverse",pointIndex:"pointIndex",mapZoom:"mapZoom",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:LVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var NVe=["*"],Nse={src:"./assets/img/vessels/self.png",anchor:[9.5,22.5],anchorXUnits:"pixels",anchorYUnits:"pixels",size:[50,50],scale:.9,rotateWithView:!0},VVe=new Re({image:new nr({src:"./assets/img/vessels/self_blur.png",anchor:[9.5,22.5],anchorXUnits:"pixels",anchorYUnits:"pixels",size:[50,50],scale:.75,rotateWithView:!0})}),BVe=new Re({image:new nr({src:"./assets/img/vessels/self_fixed.png",anchor:[22.5,50],anchorXUnits:"pixels",anchorYUnits:"pixels",size:[50,50],scale:.5,rotateWithView:!1})}),iv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;id;activeId;position;heading=0;vesselStyles;vesselLines;fixedLocation;iconScale=1;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;vessel;headingLine;selfStyle;ngOnInit(){let t=[];this.parseVessel(),this.vessel&&t.push(this.vessel),this.renderVesselLines(),this.headingLine&&t.push(this.headingLine),this.source=new rn({features:t}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let e=this.mapComponent.getMap();this.layer&&e&&(e.addLayer(this.layer),e.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="id"||i==="activeId"||i==="position"||i==="heading"?this.source&&this.parseVessel():i==="vesselLines"?this.source&&this.renderVesselLines():i==="vesselStyles"||i==="iconScale"?this.source&&(this.generateSelfStyle(),this.parseVessel()):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseVessel(){this.vessel||(this.vessel=new ut(new kt(Jt([this.position[0]??0,this.position[1]??0])))),this.position&&Array.isArray(this.position)&&this.position.length>1&&this.vessel.getGeometry().setCoordinates(Jt([this.position[0],this.position[1]])),this.vessel.setId(this.id??"self");let t=this.buildStyle();if(t){let e=t.getImage();e&&(this.fixedLocation?e.setRotation(0):e.setRotation(this.heading)),this.vessel.setStyle(t)}}generateSelfStyle(){this.iconScale&&(Nse.scale=Math.abs(this.iconScale)),this.selfStyle=new Re({image:new nr(Nse)})}buildStyle(){this.selfStyle||this.generateSelfStyle();let t=this.selfStyle;return this.vesselStyles?this.fixedLocation?this.vesselStyles.fixed&&(t=this.vesselStyles.fixed):this.activeId&&this.activeId!==this.id?this.vesselStyles.inactive&&(t=this.vesselStyles.inactive):this.vesselStyles.default&&(t=this.vesselStyles.default):this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:this.fixedLocation?t=BVe:this.activeId&&this.activeId!==this.id&&(t=VVe),t}removeFeature(t){this.source&&this.source.removeFeature(t)}renderVesselLines(){this.vesselLines&&("heading"in this.vesselLines?(this.headingLine=this.updateLine(this.headingLine,this.vesselLines.heading),this.headingLine.setStyle(new Re({stroke:new Ge({color:"rgba(221, 99, 0, 0.5)",width:4})}))):this.removeFeature(this.headingLine))}updateLine(t,e){if(!(!e||!Array.isArray(e)))return t?t.getGeometry().setCoordinates(Ri(In(e))):t=new ut(new ki(Ri(In(e)))),t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-vessel"]],inputs:{id:"id",activeId:"activeId",position:"position",heading:"heading",vesselStyles:"vesselStyles",vesselLines:"vesselLines",fixedLocation:"fixedLocation",iconScale:"iconScale",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:NVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var zVe=["*"],nv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach()}layer;source;features;layerReady=new Cn;localTrail;serverTrail;trailStyles;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;trailLocal;trailServer;ngOnInit(){let t=[];this.parseTrails(),this.trailLocal&&t.push(this.trailLocal),this.trailServer&&t.push(this.trailServer),this.source=new rn({features:t}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let e=this.mapComponent.getMap();this.layer&&e&&(e.addLayer(this.layer),e.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="localTrail"&&this.source&&this.parseLocalTrail(),i==="serverTrail"&&this.source&&this.parseServerTrail(),i==="trailStyles"?this.source&&this.parseTrails():i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseTrails(){this.parseLocalTrail(),this.parseServerTrail()}parseLocalTrail(){if(!this.localTrail)return;let t=Ri(In(this.localTrail));this.trailLocal?(this.trailLocal=this.source.getFeatureById("trail.self.local"),this.localTrail&&Array.isArray(this.localTrail)&&this.trailLocal.getGeometry().setCoordinates(t)):(this.trailLocal=new ut(new ki(t)),this.trailLocal.setId("trail.self.local"),this.trailLocal.setStyle(this.buildStyle("local")))}parseServerTrail(){if(!this.serverTrail)return;let t=this.serverTrail.map(e=>Ri(In(e)));this.trailServer?(this.trailServer=this.source.getFeatureById("trail.self.server"),this.serverTrail&&Array.isArray(this.serverTrail)&&this.trailServer.getGeometry().setCoordinates(t)):(this.trailServer=new ut(new Ca(t)),this.trailServer.setId("trail.self.server"),this.trailServer.setStyle(this.buildStyle("server")))}buildStyle(t="local"){let e;return t==="server"?this.trailStyles&&this.trailStyles.server?e=this.trailStyles.server:e=new Re({stroke:new Ge({color:"rgb(252, 3, 132)",width:1,lineDash:[4,4]})}):this.trailStyles&&this.trailStyles.local?e=this.trailStyles.local:e=new Re({stroke:new Ge({color:"rgb(252, 3, 132)",width:1,lineDash:[2,2]})}),e}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-vessel-trail"]],inputs:{localTrail:"localTrail",serverTrail:"serverTrail",trailStyles:"trailStyles",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:zVe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var HVe=["*"],rv=class n extends _o{constructor(e,i){super(i,e);this.changeDetectorRef=e;this.mapComponent=i;this.labelPrefixes=["race-startline"]}startLine;racecourseStyles;ngOnInit(){super.ngOnInit(),this.parseCourse()}ngOnChanges(e){super.ngOnChanges(e),["startLine"].some(i=>i in e)&&this.parseCourse()}parseCourse(){if(!this.source)return;this.source.clear();let e=[];if(Array.isArray(this.startLine)&&this.startLine.length===2){let i=new ut({geometry:new ki(Ri(In(this.startLine))),name:"start"});i.setId("race-start-line"),i.setStyle(this.buildStyle(i)),e.push(i),this.source.addFeatures(e),this.updateLabels()}}buildStyle(e){let i=e.getGeometry(),r=[],o,a;if(typeof this.racecourseStyles>"u")return this.layerProperties&&this.layerProperties.style?this.layerProperties.style:r;let s=Array.isArray(this.racecourseStyles.startLine)?this.racecourseStyles.startLine[this.racecourseStyles.startLine.length-1]:this.racecourseStyles.startLine;a=s.getStroke().getWidth()+1;let l="white";o=new ot({color:s?.getStroke().getColor()}),r.push(new Re({stroke:new Ge({color:l,width:a})})),r.push(this.racecourseStyles.startLine);let c=i.getCoordinates().length;return i.forEachSegment((d,f)=>{r.push(new Re({geometry:new kt(d),image:new mo({radius:4,stroke:new Ge({width:1,color:l}),fill:o,points:4,angle:Math.PI/4})})),r.push(new Re({geometry:new kt(f),image:new On({radius:3,stroke:new Ge({width:1,color:l}),fill:o})}))}),r}static \u0275fac=function(i){return new(i||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["racing-start-line"]],inputs:{startLine:"startLine",racecourseStyles:"racecourseStyles"},standalone:!1,features:[Le,be],ngContentSelectors:HVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var WVe=["*"],Oc=class n extends _o{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i;this.labelPrefixes=[]}targets=new Map;targetContext;targetStyles;focusId;inactiveTime=18e4;filterByShipType;filterShipTypes;filterIds;updateIds=[];staleIds=[];removeIds=[];ngOnInit(){super.ngOnInit(),this.reloadTargets()}ngOnChanges(e){if(super.ngOnChanges(e),this.layer){let i=Object.keys(e);i.includes("targets")&&e.targets.previousValue.size===0||i.includes("filterShipTypes")||i.includes("filterByShipType")?this.reloadTargets():(i.includes("removeIds")&&this.removeTargetIds(e.removeIds.currentValue),i.includes("updateIds")&&this.updateTargetIds(e.updateIds.currentValue),i.includes("staleIds")&&this.updateTargetIds(e.staleIds.currentValue,!0),(i.includes("targetStyles")&&!e.targetStyles.firstChange||i.some(r=>["focusId","filterIds","inactiveTime"].includes(r)))&&this.updateTargetIds(this.extractKeys(this.targets)))}}extractKeys(e){let i=[];return e.forEach((r,o)=>{o.includes(this.targetContext)&&i.push(o)}),i}okToRenderTarget(e){let i=r=>Array.isArray(this.filterShipTypes)&&this.filterShipTypes.includes(-999)?"imo"in this.targets.get(r).registrations:!0;if(this.filterByShipType&&Array.isArray(this.filterShipTypes)){let r=Math.floor(this.targets.get(e).type.id/10)*10;return this.filterShipTypes.includes(r)&&i(e)}return this.filterIds&&Array.isArray(this.filterIds)?this.filterIds.includes(e)&&i(e):i(e)}isStale(e){if(isNaN(this.inactiveTime))return!1;let i=new Date().valueOf();return e.lastUpdated.valueOf()<i-this.inactiveTime}buildLabel(e){return e.name??e.callsignVhf??e.callsignHf??e.mmsi??""}reloadTargets(){!this.targets||!this.source||(this.source.clear(),this.onReloadTargets())}onReloadTargets(){}updateTargetIds(e,i=!1){!this.source||!Array.isArray(e)||this.onUpdateTargets(e,i)}onUpdateTargets(e,i){}removeTargetIds(e){!this.source||!Array.isArray(e)||this.onRemoveTargets(e)}onRemoveTargets(e){}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["sk-ais-target-base"]],inputs:{targets:"targets",targetContext:"targetContext",targetStyles:"targetStyles",focusId:"focusId",inactiveTime:"inactiveTime",filterByShipType:"filterByShipType",filterShipTypes:"filterShipTypes",filterIds:"filterIds",updateIds:"updateIds",staleIds:"staleIds",removeIds:"removeIds"},standalone:!1,features:[Le,be],ngContentSelectors:WVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var $Ve=["*"],ov=class n extends Oc{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}flagged;ngOnChanges(e){super.ngOnChanges(e),"flagged"in e&&this.updateFlags()}updateFlags(){this.flagged&&(this.source&&this.source.clear(),this.flagged.forEach(e=>{this.addFlagWithId(e)}))}addFlagWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e);if(this.okToRenderTarget(e)&&i.position){let r=i.callsignVhf??i.callsignHf??"......",o=new ut({geometry:new kt(Jt(i.position)),name:i.name});o.setId("flag-"+e),o.set("name",r,!0),o.setStyle(this.buildStyle(r).clone()),this.source.addFeature(o)}}buildStyle(e){return new Re({image:new nr({src:"./assets/img/vessels/ais_flag.svg",rotateWithView:!1,scale:.2,anchor:[27,187],anchorXUnits:"pixels",anchorYUnits:"pixels"}),text:new zi({text:e??"",offsetY:-25,offsetX:20})})}onReloadTargets(){this.flagged.forEach(e=>{this.addFlagWithId(e)})}onUpdateTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)&&this.flagged.includes(i)){let r=this.source.getFeatureById("flag-"+i);if(this.okToRenderTarget(i)){if(this.targets.has(i))if(r){let o=this.targets.get(i).position;o&&r.setGeometry(new kt(Jt(o)))}else this.addFlagWithId(i)}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{let r=this.source.getFeatureById("flag-"+i);r&&this.source.removeFeature(r)})}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["sk-ais-flags"]],inputs:{flagged:"flagged"},standalone:!1,features:[Le,be],ngContentSelectors:$Ve,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var KVe=["*"],av=class n extends Oc{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}vectorApparent=!1;ngOnChanges(e){super.ngOnChanges(e),"vectorApparent"in e&&this.onUpdateTargets(this.extractKeys(this.targets))}calcVector(e){let i=this.vectorApparent?typeof e.wind.awa<"u"?e.orientation+e.wind.awa:null:e.wind.direction;if(typeof i!="number")return[];let r=_n.destCoordinate(e.position,i,R3[Math.floor(this.mapZoom)]);return[Jt(e.position),Jt(r)]}addWindVectorWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e);if(this.okToRenderTarget(e)&&i.position){let r=this.calcVector(i);if(r.length!==2)return;let o=new ut(new ki(r));o.setId("wind-"+e),o.setStyle(this.buildVectorStyle()),this.source?.addFeature(o)}}buildVectorStyle(){let e=this.vectorApparent?"16, 75, 16":"128, 128, 0";return new Re({stroke:new Ge({width:2,color:`rgba(${e},1)`})})}onReloadTargets(){this.extractKeys(this.targets).forEach(e=>{this.addWindVectorWithId(e)})}onUpdateTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source?.getFeatureById("wind-"+i);if(this.okToRenderTarget(i)){if(this.targets.has(i))if(r){let o=this.targets.get(i),a=this.targets.get(i).position,s=this.calcVector(o);a&&s.length===2&&r.setGeometry(new ki(s)),r.setStyle(this.buildVectorStyle())}else this.addWindVectorWithId(i)}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{let r=this.source.getFeatureById("wind-"+i);r&&this.source.removeFeature(r)})}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["sk-ais-wind"]],inputs:{vectorApparent:"vectorApparent"},standalone:!1,features:[Le,be],ngContentSelectors:KVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var YVe=["*"],sv=class n extends Oc{constructor(e,i,r){super(e,i);this.mapComponent=e;this.changeDetectorRef=i;this.mapImages=r}ngOnInit(){super.ngOnInit(),this.labelPrefixes=[this.targetContext]}onReloadTargets(){this.extractKeys(this.targets).forEach(e=>{this.addTargetWithId(e)})}onUpdateTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById(i);if(this.okToRenderTarget(i)){if(this.targets.has(i))if(r){let o=this.targets.get(i),a=this.buildLabel(o);o.position&&r.setGeometry(new kt(Jt(o.position)));let s=this.buildStyle(o).clone();r.set("name",a,!0),r.setStyle(this.setTextLabel(this.setRotation(s,o.orientation),a))}else this.addTargetWithId(i)}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById(i);r&&this.source.removeFeature(r)}})}addTargetWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e),r=this.buildLabel(i);if(i.position){let o=new ut({geometry:new kt(Jt(i.position)),name:i.name});o.setId(e),o.set("name",r,!0);let a=this.buildStyle(i).clone();o.setStyle(this.setTextLabel(this.setRotation(a,i.orientation),r)),this.source.addFeature(o)}}buildStyle(e){let i=this.mapImages.getAtoN(e.type?.id,e.virtual);if(i&&typeof this.targetStyles>"u")return i?new Re({image:i,text:new zi({text:"",offsetX:0,offsetY:-18})}):void 0;let r,o=this.isStale(e);return typeof this.targetStyles<"u"?o?r=this.targetStyles.inactive??this.targetStyles.default:r=this.targetStyles.default:this.layerProperties&&this.layerProperties.style?r=this.layerProperties.style:r=new Re({image:new mo({points:3,radius:7,fill:new ot({color:"magenta"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}),r}static \u0275fac=function(i){return new(i||n)(N(ct),N(le),N(Vu))};static \u0275cmp=U({type:n,selectors:[["sk-ais-targets"]],standalone:!1,features:[Le],ngContentSelectors:YVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var QVe=["*"],lv=class n extends Oc{constructor(e,i,r){super(e,i);this.mapComponent=e;this.changeDetectorRef=i;this.mapImages=r}cogLineLength=0;ngOnInit(){super.ngOnInit(),this.labelPrefixes=["ais-"]}ngOnChanges(e){super.ngOnChanges(e),"cogLineLength"in e&&(this.cogLineLength=e.cogLineLength.currentValue??0,this.onUpdateTargets(this.extractKeys(this.targets)))}onReloadTargets(){this.extractKeys(this.targets).forEach(e=>{this.addTargetWithId(e)})}onUpdateTargets(e){this.source&&e.forEach(i=>{if(i.includes(this.targetContext))if(this.okToRenderTarget(i)){if(this.targets.has(i)){let r=this.source.getFeatureById("ais-"+i);if(r){let o=this.targets.get(i),a=this.buildLabel(o);o.position&&r.setGeometry(new kt(Jt(o.position)));let s=this.buildVesselStyle(o,a,this.isStale(o)).clone();r.set("name",a,!0),r.setStyle(this.setTextLabel(this.setRotation(s,o.orientation),a)),this.parseCogLine(i,o)}else this.addTargetWithId(i)}}else this.onRemoveTargets([i])})}onRemoveTargets(e){e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById("ais-"+i);r&&this.source.removeFeature(r),r=this.source.getFeatureById("cog-"+i),r&&this.source.removeFeature(r)}})}onLabelZoomThreshold(e){super.updateLabels(),this.toggleCogLines(e)}addTargetWithId(e){if(!e.includes(this.targetContext)||!this.targets.has(e))return;let i=this.targets.get(e);if(this.okToRenderTarget(e)&&i.position){let r=this.buildLabel(i),o=new ut({geometry:new kt(Jt(i.position)),name:i.name});o.setId("ais-"+e),o.set("name",r,!0);let a=this.buildVesselStyle(i,r,this.isStale(i)).clone();o.setStyle(this.setTextLabel(this.setRotation(a,i.orientation),r)),this.source.addFeature(o),this.parseCogLine(e,i)}}buildVesselStyle(e,i,r=!1){let o,a=e.state==="moored",s=e.type.id?Math.abs(Math.floor(e.type.id/10)*10):-1,l=e.id===this.focusId?this.mapImages.getVessel("focused"):r?this.mapImages.getVessel("inactive",a):e.buddy?this.mapImages.getVessel("buddy",a):s===-1?this.mapImages.getVessel("default",a):this.mapImages.getVessel(s,a);return l&&typeof this.targetStyles>"u"?l?new Re({image:l,text:new zi({text:"",offsetX:0,offsetY:a?12:22})}):void 0:(typeof this.targetStyles<"u"?e.id===this.focusId&&this.targetStyles.focus?o=this.targetStyles.focus:r?o=this.targetStyles.inactive??this.targetStyles.default:e.type&&this.targetStyles[s]?e.state&&this.targetStyles[s][e.state]?o=this.targetStyles[s][e.state]:o=this.targetStyles[s].default:e.buddy&&this.targetStyles.buddy?o=this.targetStyles.buddy:e.state&&this.targetStyles[e.state]?o=this.targetStyles[e.state]:o=this.targetStyles.default:this.layerProperties&&this.layerProperties.style?o=this.layerProperties.style:e.id===this.focusId?o=new Re({image:new mo({points:3,radius:4,fill:new ot({color:"red"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}):r?o=new Re({image:new mo({points:3,radius:4,fill:new ot({color:"orange"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}):o=new Re({image:new mo({points:3,radius:4,fill:new ot({color:"magenta"}),stroke:new Ge({color:"black",width:1}),rotateWithView:!0})}),o)}parseCogLine(e,i){if(!this.source||!i.vectors.cog)return;let r=this.source.getFeatureById("cog-"+e);if(!this.okToRenderCogLines||!this.okToRenderTarget(e)||!i.position){r&&this.source.removeFeature(r);return}r?(r.setGeometry(new ki(Ri(i.vectors.cog))),r.setStyle(this.buildCogLineStyle(e,r))):(r=new ut(new ki(Ri(i.vectors.cog))),r.setId("cog-"+e),r.setStyle(this.buildCogLineStyle(e,r)),this.source.addFeature(r))}toggleCogLines(e){e?this.targets.forEach((i,r)=>{this.parseCogLine(r,i)}):this.source.forEachFeature(i=>{i.getId().includes("cog-")&&this.source.removeFeature(i)})}buildCogLineStyle(e,i){let r=this.okToRenderTarget(e)&&this.okToRenderCogLines()?.7:0,o=i.getGeometry(),a=`rgba(0,0,0, ${r})`,s=[];return s.push(new Re({stroke:new Ge({color:a,width:1,lineDash:[5,5]})})),o.forEachSegment((l,c)=>{s.push(new Re({geometry:new kt(c),image:new On({radius:2,stroke:new Ge({color:a,width:1}),fill:new ot({color:"transparent"})})}))}),s}okToRenderCogLines(){return this.cogLineLength!==0&&this.mapZoom>=this.labelMinZoom}static \u0275fac=function(i){return new(i||n)(N(ct),N(le),N(Vu))};static \u0275cmp=U({type:n,selectors:[["sk-ais-vessels"]],inputs:{cogLineLength:"cogLineLength"},standalone:!1,features:[Le,be],ngContentSelectors:QVe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var eBe=["*"],cv=class n extends Oc{constructor(e,i){super(e,i);this.mapComponent=e;this.changeDetectorRef=i}tracks=new Map;tracksMinZoom=10;mapZoom=10;showTracks=!0;ngOnInit(){super.ngOnInit(),this.reloadTracks()}ngOnChanges(e){if(super.ngOnChanges(e),this.layer){let i=Object.keys(e);i.includes("tracks")&&e.tracks.previousValue.size===0?this.reloadTracks():(i.includes("tracksMinZoom")&&typeof this.mapZoom<"u"&&this.reloadTracks(),i.includes("mapZoom")&&typeof this.tracksMinZoom<"u"&&(e.mapZoom.currentValue>=this.tracksMinZoom&&e.mapZoom.previousValue<this.tracksMinZoom?this.reloadTracks():e.mapZoom.currentValue<this.tracksMinZoom&&e.mapZoom.previousValue>=this.tracksMinZoom&&this.source.clear()))}}okToRenderTracks(){return this.mapZoom>=this.tracksMinZoom}reloadTracks(){!this.tracks||!this.source||(this.source.clear(),this.okToRenderTracks&&this.onUpdateTargets(this.extractKeys(this.tracks)))}onUpdateTargets(e){this.okToRenderTracks&&e.forEach(i=>{if(i.includes(this.targetContext)){let r=this.source.getFeatureById("track-"+i);if(this.okToRenderTarget(i)){if(this.tracks.has(i)){let o=this.tracks.get(i);r?(r.setGeometry(new Ca(this.parseCoordinates(o))),r.setStyle(this.buildStyle(i))):this.addTrackWithId(i)}}else this.source.removeFeature(r)}})}onRemoveTargets(e){e.forEach(i=>{let r=this.source.getFeatureById("track-"+i);r&&this.source.removeFeature(r)})}addTrackWithId(e){if(!e.includes(this.targetContext)||!this.tracks.has(e))return;let i=this.tracks.get(e),r=new ut({geometry:new Ca(this.parseCoordinates(i))});r.setId("track-"+e),r.setStyle(this.buildStyle(e)),this.source.addFeature(r)}buildStyle(e){let i=e.indexOf("aircraft")!==-1?"0, 0, 255":"255, 0, 255",r=this.mapZoom<this.tracksMinZoom?`rgba(${i},0)`:`rgba(${i},1)`;if(r=this.showTracks?`rgba(${i},1)`:`rgba(${i},0)`,this.layerProperties&&this.layerProperties.style){let o=this.layerProperties.style.clone(),a=o.getStroke();return a.setColor(r),o.setStroke(a),o}else return new Re({stroke:new Ge({width:1,color:r,lineDash:[2,2]})})}parseCoordinates(e){let i=e.map(r=>{let o=[];return r.forEach(a=>o.push(In(a))),o});return Ri(i)}static \u0275fac=function(i){return new(i||n)(N(ct),N(le))};static \u0275cmp=U({type:n,selectors:[["ais-targets-track"]],inputs:{tracks:"tracks",tracksMinZoom:"tracksMinZoom",mapZoom:"mapZoom",showTracks:"showTracks"},standalone:!1,features:[Le,be],ngContentSelectors:eBe,decls:1,vars:0,template:function(i,r){i&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var Bse=Fs(au());var iBe=["*"],Vse={labelText:{color:"rgba(26, 26, 1, 1)"}},dv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.theme=this.darkMode()?Ag:Vse,this.parseValues()})}layer;source;features;theme=Vse;darkMode=$t(!1);layerReady=new Cn;position;maxCircles=4;minZoom;mapZoom;units="m";opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseValues(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)["position","mapZoom","minZoom","units","maxCircles"].includes(i)?(this.parseValues(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseValues(){let e=this.mapComponent.getMap().getView().getResolutionForZoom(this.mapZoom),i=[];if(this.mapZoom>=this.minZoom){let r=e>300?1e4:e>100?5e3:e>40?2e3:e>20?1e3:e>10?500:250,o=this.buildCircleStyle();for(let a=1;a<=this.maxCircles;++a){let s=r*a,l=new ut({geometry:new kp(Jt(this.position),hy(s,this.position))});l.setStyle(o),i.push(l);let c=(0,Bse.computeDestinationPoint)(this.position,s,180),d=new ut({geometry:new kt(Jt([c.longitude,c.latitude]))});d.setStyle(this.buildTextStyle(s)),i.push(d)}}this.features=i}buildCircleStyle(){let t;return this.layerProperties&&this.layerProperties.style?t=this.layerProperties.style:t=new Re({fill:new ot({color:"transparent"}),stroke:new Ge({color:"rgba(152, 153, 10, 1)",width:1.5,lineDash:[2,3]})}),t}buildTextStyle(t){return new Re({fill:new ot({color:"rgba(255, 255, 255, 0)"}),stroke:new Ge({color:"rgba(255, 255, 255, 0)"}),text:new zi({text:t?this.formatLabel(t):"",offsetX:0,offsetY:0,fill:new ot({color:this.theme.labelText.color})})})}formatLabel(t){return this.units==="m"?t>=1e3?`${(t/1e3).toFixed(1)} km`:`${t} m`:`${Ct.kmToNauticalMiles(t/1e3).toFixed(1)} NM`}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-range-circles"]],inputs:{darkMode:[1,"darkMode"],position:"position",maxCircles:"maxCircles",minZoom:"minZoom",mapZoom:"mapZoom",units:"units",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:iBe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var zse=Fs(au());var rBe=["*"],jse={labelText:{color:"rgba(26, 26, 1, 1)"}},uv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.coords(),this.cogTime(),this.parseInput(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))}),Ut(()=>{this.labelMinZoom(),typeof this.mapZoom<"u"&&this.updateLabel()}),Ut(()=>{this.theme=this.darkMode()?Ag:jse,this.updateLabel()})}layer;source;features=[];theme=jse;layerReady=new Cn;coords=$t();cogTime=$t();units=$t("m");labelMinZoom=$t(10);darkMode=$t(!1);mapZoom=10;opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;labelText=oe("");mapifiedLine=[];ngOnInit(){this.parseInput(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};for(let i in t)i==="mapZoom"?this.handleLabelZoomChange(i,t[i]):i==="layerProperties"?this.layer.setProperties(e,!1):e[i]=t[i].currentValue;this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseInput(){let t=[];if(Array.isArray(this.coords())&&this.coords().length!==0){this.mapifiedLine=In(this.coords()),this.labelText.update(()=>`${this.formatNumber((0,zse.getDistance)(this.coords()[0],this.coords()[1]))} ${this.cogTime()>=60?this.cogTime()/60+"hr":this.cogTime()+"min"}`);let e=new ut({geometry:new ki(Ri(this.mapifiedLine))});e.setId("cogSelf"),e.setStyle(i=>{let r="rgba(204, 12, 225, 0.7)",o=i.getGeometry(),a=[];return a.push(new Re({stroke:new Ge({color:r,width:1})})),o.forEachSegment((s,l)=>{a.push(new Re({geometry:new kt(l),image:new On({radius:2,stroke:new Ge({color:r,width:1}),fill:new ot({color:"transparent"})}),text:this.buildLabelStyle()}))}),a}),t.push(e)}this.features=t}formatNumber(t){return this.units()==="m"?t>=1e3?`${(t/1e3).toFixed(1)} km`:`${t} m`:`${Ct.kmToNauticalMiles(t/1e3).toFixed(1)} NM`}handleLabelZoomChange(t,e){t==="mapZoom"&&typeof this.labelMinZoom()<"u"&&(e.currentValue>=this.labelMinZoom()&&e.previousValue<this.labelMinZoom()||e.currentValue<this.labelMinZoom()&&e.previousValue>=this.labelMinZoom())&&this.updateLabel()}updateLabel(t){if(!t&&this.source&&(t=this.source.getFeatureById("cogSelf")),!!t)try{let e=t.getStyle();if(!e)return;e=Array.isArray(e)?e[1]:e,e.setText(this.buildLabelStyle()),t.setStyle(e)}catch{}}buildLabelStyle(){return new zi({text:Math.abs(this.mapZoom)>=this.labelMinZoom()?this.labelText()??"":"",offsetX:0,offsetY:-10,fill:new ot({color:this.theme.labelText.color})})}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-cog-line"]],inputs:{coords:[1,"coords"],cogTime:[1,"cogTime"],units:[1,"units"],labelMinZoom:[1,"labelMinZoom"],darkMode:[1,"darkMode"],mapZoom:"mapZoom",opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:rBe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var aBe=["*"],pv=class n{constructor(t,e){this.changeDetectorRef=t;this.mapComponent=e;this.changeDetectorRef.detach(),Ut(()=>{this.twd(),this.awa(),this.tws(),this.aws(),this.position(),this.parseInput(),this.source&&(this.source.clear(),this.source.addFeatures(this.features))})}layer;source;features=[];layerReady=new Cn;twd=$t();awa=$t();tws=$t(0);aws=$t(0);position=$t();opacity;visible;extent;zIndex;minResolution;maxResolution;layerProperties;ngOnInit(){this.parseInput(),this.source=new rn({features:this.features}),this.layer=new cn(Object.assign(this,Te({},this.layerProperties)));let t=this.mapComponent.getMap();this.layer&&t&&(t.addLayer(this.layer),t.render(),this.layerReady.next(this.layer),this.layerReady.complete())}ngOnChanges(t){if(this.layer){let e={};this.layer.setProperties(e,!1)}}ngOnDestroy(){let t=this.mapComponent.getMap();this.layer&&t&&(t.removeLayer(this.layer),t.render(),this.layer=null)}parseInput(){let t=[];if(Array.isArray(this.position())){if(typeof this.twd()=="number"&&this.tws()>0){let e=new ut({geometry:new kt(Jt(this.position()))});e.setId("twd"),e.setStyle(new Re({image:new nr({src:"./assets/img/wind/twd.svg",scale:5,anchor:[3.5,37],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!0,rotation:this.twd()})})),t.push(e)}if(typeof this.awa()=="number"&&this.aws()>0){let e=new ut({geometry:new kt(Jt(this.position()))});e.setId("awa"),e.setStyle(new Re({image:new nr({src:"./assets/img/wind/awa.svg",scale:5,anchor:[3.5,37],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!0,rotation:this.awa()})})),t.push(e)}}this.features=t}static \u0275fac=function(e){return new(e||n)(N(le),N(ct))};static \u0275cmp=U({type:n,selectors:[["fb-wind-lines"]],inputs:{twd:[1,"twd"],awa:[1,"awa"],tws:[1,"tws"],aws:[1,"aws"],position:[1,"position"],opacity:"opacity",visible:"visible",extent:"extent",zIndex:"zIndex",minResolution:"minResolution",maxResolution:"maxResolution",layerProperties:"layerProperties"},outputs:{layerReady:"layerReady"},standalone:!1,features:[be],ngContentSelectors:aBe,decls:1,vars:0,template:function(e,i){e&1&&(fe(),ne(0))},encapsulation:2,changeDetection:0})};var fv=class n{static \u0275fac=function(e){return new(e||n)};static \u0275mod=Ze({type:n});static \u0275inj=Ye({})};var zl=Fs(au());var Use=[{name:"scaleline",options:{className:"ol-scale-line",bar:!0,steps:2,text:!1,minWidth:64,units:"nautical"}}],Hse={startLine:new Re({stroke:new Ge({color:"black",width:2,lineDash:[4,4]}),text:new zi({text:"START",offsetY:10})})},Gse={default:new Re({stroke:new Ge({color:"green",width:2,lineDash:[20,5,5,5]}),text:new zi({text:"",offsetY:10})}),active:new Re({stroke:new Ge({color:"blue",width:4})})},Wse={line:new Re({fill:new ot({color:"green"}),stroke:new Ge({color:"black",width:2,lineDash:[5,5]})}),circle:new Re({fill:new ot({color:"rgba(0, 255, 0, .3)"}),stroke:new Ge({color:"red",width:2,lineDash:[5,5]})}),anchor:new Re({image:new nr({src:"./assets/img/anchor.png",size:[26,26],scale:.75,anchor:[13,1],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!1})})},$se={"notice-to-mariners":new Re({stroke:new Ge({color:"rgb(206, 107, 132)",lineDash:[5,5],width:2}),fill:new ot({color:"rgba(206, 107, 132, 0.2)"}),text:new zi({text:"",offsetY:0})}),hazard:new Re({stroke:new Ge({color:"rgba(241, 60, 60, 1)",lineDash:[5,5,2],width:2}),fill:new ot({color:"rgba(241, 60, 60, 0.5)"}),text:new zi({text:"",offsetY:0,stroke:new Ge({color:"silver"}),padding:[2,2,2,2],backgroundFill:new ot({color:"white"}),backgroundStroke:new Ge({color:"rgba(241, 60, 60, 1)"})})})},qse={mob:new Re({image:new nr({src:"./assets/img/alarms/mob.svg",rotateWithView:!1,rotation:0,scale:1,anchor:[12,12],anchorXUnits:"pixels",anchorYUnits:"pixels"})})},Kse={marker:new Re({image:new nr({src:"./assets/img/waypoints/marker-green.png",anchor:[10.5,25],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!1}),text:new zi({text:"",offsetY:-30})})},dBe=new nr({src:"./assets/img/atons/basestation.svg",scale:.4,anchor:[23,49],anchorXUnits:"pixels",anchorYUnits:"pixels",rotateWithView:!1,rotation:0}),Xse={default:new Re({image:dBe,text:new zi({text:"",offsetX:0,offsetY:-20})})},uBe=new nr({src:"./assets/img/aircraft_active.png",rotateWithView:!0,rotation:0}),pBe=new nr({src:"./assets/img/aircraft_inactive.png",rotateWithView:!0,rotation:0}),Yse={default:new Re({image:uBe,text:new zi({text:"",offsetY:-12})}),inactive:new Re({image:pBe,text:new zi({text:"",offsetY:-12})})},fBe=new nr({src:"./assets/img/sar_active.png",rotateWithView:!1,rotation:0}),Zse={default:new Re({image:fBe,text:new zi({text:"",offsetY:-18})})},Qse={port:new Re({fill:new ot({color:"green"}),stroke:new Ge({color:"green",width:1,lineDash:[5,5]})}),starboard:new Re({fill:new ot({color:"red"}),stroke:new Ge({color:"red",width:1,lineDash:[5,5]})})},Jse=new Re({fill:new ot({color:"green"}),stroke:new Ge({color:"gray",width:1,lineDash:[15,5,3,5]})}),Gg={default:void 0,measure:[new Re({stroke:new Ge({color:"white",width:5,lineDash:[5,5]})}),new Re({image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"#3399CC"})}),fill:new ot({color:"#3399CC"}),stroke:new Ge({color:"#3399CC",width:3,lineDash:[5,5]})})],route:[new Re({stroke:new Ge({color:"white",width:5})}),new Re({image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"green"})}),stroke:new Ge({color:"green",width:3})})],region:[new Re({stroke:new Ge({color:"rgba(255,255,255,0.4)",width:5}),fill:new ot({color:"rgba(255,255,255,0.4)"})}),new Re({stroke:new Ge({color:"purple",width:2}),image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"purple"})})})],radius:[new Re({image:new On({radius:6,stroke:new Ge({width:2,color:"white"}),fill:new ot({color:"rgba(25, 183, 211, 0.4)"})})}),new Re({fill:new ot({color:"rgba(25, 183, 211, 0.4)"}),stroke:new Ge({color:"white",width:3,lineDash:[5,5]})})]};var hBe=["olMap"],mBe=(n,t)=>t[0];function gBe(n,t){if(n&1){let e=H();u(0,"ol-dragbox",40),M("boxStart",function(r){C(e);let o=y();return x(o.onDragBoxStart(r))})("boxEnd",function(r){C(e);let o=y();return x(o.onDragBoxEnd(r))})("boxCancel",function(r){C(e);let o=y();return x(o.onDragBoxCancel(r))}),p()}}function _Be(n,t){if(n&1){let e=H();u(0,"ol-draw",41),M("drawStart",function(r){C(e);let o=y();return x(o.onMeasureStart(r))})("drawEnd",function(){C(e);let r=y();return x(r.onMeasureEnd())}),p()}if(n&2){let e=y();z0(e.mapInteract.draw.style),T("type",e.mapInteract.measureGeometryType)("stopClick",!1)}}function bBe(n,t){if(n&1){let e=H();u(0,"ol-draw",42),M("drawEnd",function(r){C(e);let o=y();return x(o.onDrawEnd(r))}),p()}if(n&2){let e=y();z0(e.mapInteract.draw.style),T("type",e.mapInteract.draw.featureType)("stopClick",e.mapInteract.draw.resourceType!=="route")}}function yBe(n,t){if(n&1){let e=H();u(0,"ol-modify",43),M("modifyStart",function(r){C(e);let o=y();return x(o.onModifyStart(r))})("modifyEnd",function(r){C(e);let o=y();return x(o.onModifyEnd(r))}),p()}if(n&2){let e=y();T("features",e.mapInteract.draw.features)}}function vBe(n,t){n&1&&(u(0,"span"),_(1,"Lat:\xA0"),p())}function CBe(n,t){n&1&&(u(0,"span"),_(1,"Lon:\xA0"),p())}function xBe(n,t){if(n&1&&B(0,"fb-tracks",14),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("tracks",e.skres.tracks())("labelMinZoom",0)("mapZoom",e.mapZoomLevel())("zIndex",100)}}function wBe(n,t){if(n&1&&B(0,"ais-targets-track",15),n&2){let e=y();T("tracks",e.app.data.vessels.aisTracks)("tracksMinZoom",10)("updateIds",e.skstream.aisStatus().updated)("removeIds",e.skstream.aisStatus().expired)("mapZoom",e.mapZoomLevel())}}function MBe(n,t){if(n&1&&(u(0,"div"),B(1,"fb-resource-sets",44),p()),n&2){let e=t.$implicit,i=t.$index,r=y();h(),T("darkMode",r.app.uiConfig().invertColor)("collection",e[0])("resourceSets",e[1])("labelMinZoom",r.app.config.map.labelsMinZoom)("mapZoom",r.mapZoomLevel())("zIndex",120+i)}}function SBe(n,t){if(n&1&&B(0,"fb-route-direction",17),n&2){let e=y();T("points",e.course.courseData().activeRoutePoints)("pointIndex",e.course.courseData().pointIndex)("reverse",e.app.data.activeRouteReversed)("zIndex",550)}}function EBe(n,t){if(n&1&&B(0,"sk-ais-targets",21),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.meteo)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",220)}}function DBe(n,t){if(n&1&&B(0,"sk-ais-wind",45),n&2){let e=y(2);T("targetContext","vessels")("targets",e.dfeat.ais)("vectorApparent",e.app.config.vessels.aisWindApparent)("mapZoom",e.mapZoomLevel())("labelMinZoom",e.app.config.map.labelsMinZoom)("focusId",e.app.data.vessels.activeId)("filterIds",e.app.config.selections.aisTargets)("filterByShipType",e.app.config.selections.aisFilterByShipType)("filterShipTypes",e.app.config.selections.aisTargetTypes)("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",900)("darkMode",e.app.uiConfig().invertColor)}}function TBe(n,t){if(n&1&&(u(0,"div"),R(1,DBe,1,15,"sk-ais-wind",45),B(2,"sk-ais-flags",46)(3,"sk-ais-vessels",47),p()),n&2){let e=y();h(),F(e.mapZoomLevel()>=e.app.config.vessels.aisWindMinZoom?1:-1),h(),T("flagged",e.app.data.vessels.flagged)("targetContext","vessels")("targets",e.dfeat.ais)("mapZoom",e.mapZoomLevel())("labelMinZoom",e.app.config.map.labelsMinZoom)("focusId",e.app.data.vessels.activeId)("filterIds",e.app.config.selections.aisTargets)("filterByShipType",e.app.config.selections.aisFilterByShipType)("filterShipTypes",e.app.config.selections.aisTargetTypes)("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",985)("darkMode",e.app.uiConfig().invertColor),h(),T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.ais)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",980)("focusId",e.app.data.vessels.activeId)("filterIds",e.app.config.selections.aisTargets)("filterByShipType",e.app.config.selections.aisFilterByShipType)("filterShipTypes",e.app.config.selections.aisTargetTypes)("cogLineLength",e.app.config.vessels.aisCogLine)}}function IBe(n,t){if(n&1&&B(0,"sk-ais-targets",22),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.aircraft)("targetStyles",e.featureStyles.aircraft)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",910)}}function kBe(n,t){if(n&1&&B(0,"sk-ais-targets",23),n&2){let e=y();T("darkMode",e.app.uiConfig().invertColor)("targets",e.dfeat.sar)("targetStyles",e.featureStyles.sar)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("updateIds",e.skstream.aisStatus().updated)("staleIds",e.skstream.aisStatus().stale)("removeIds",e.skstream.aisStatus().expired)("inactiveTime",e.app.config.vessels.aisStaleAge)("zIndex",920)}}function PBe(n,t){if(n&1&&B(0,"fb-notes",26),n&2){let e=y();T("notes",e.skres.notes())("zIndex",450)}}function ABe(n,t){if(n&1){let e=H();u(0,"ap-popover",56),M("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("title",e.overlay().title)("canClose",!1)("measure",!0)}}function OBe(n,t){if(n&1){let e=H();u(0,"chart-list-popover",57),M("selected",function(r){C(e);let o=y(2);return x(o.toggleFeatureSelection(r,"charts"))})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("features",e.overlay().content)}}function RBe(n,t){if(n&1){let e=H();u(0,"feature-list-popover",58),M("selected",function(r){C(e);let o=y(2);return x(o.featureListSelection(r))})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("title",e.overlay().title)("features",e.overlay().content)}}function LBe(n,t){if(n&1){let e=H();u(0,"resource-popover",59),M("modify",function(){C(e);let r=y(2);return r.modifyFeature(),x(r.popoverClosed())})("delete",function(){C(e);let r=y(2);return r.deleteFeature(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("addNote",function(){C(e);let r=y(2);return r.skres.showNoteEditor({type:r.overlay().type,href:{id:r.overlay().id,exists:!0}}),x(r.popoverClosed())})("activated",function(){C(e);let r=y(2);return r.setActiveFeature(),x(r.popoverClosed())})("deactivated",function(){C(e);let r=y(2);return r.clearActiveFeature(),x(r.popoverClosed())})("related",function(r){C(e);let o=y(2);return o.skres.showRelatedNotes(r,"group"),x(o.popoverClosed())})("notes",function(){C(e);let r=y(2);return r.skres.showRelatedNotes(r.overlay().id,r.overlay().type,r.overlay().readOnly),x(r.popoverClosed())})("info",function(){C(e);let r=y(2);return r.skres.resourceProperties(r.overlay()),x(r.popoverClosed())})("points",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("title",e.overlay().title)("type",e.overlay().type)("resource",e.overlay().resource)("active",e.app.data.activeWaypoint?e.app.data.activeWaypoint:e.app.data.activeRoute)("featureCount",e.overlay().featureCount)("units",e.scaleUnits())}}function FBe(n,t){if(n&1){let e=H();u(0,"resourceset-popover",60),M("modify",function(){C(e);let r=y(2);return r.modifyFeature(),x(r.popoverClosed())})("delete",function(){C(e);let r=y(2);return r.deleteFeature(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("title",e.overlay().title)("resource",e.overlay().resource)}}function NBe(n,t){if(n&1){let e=H();u(0,"div")(1,"vessel-popover",61),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type,r.overlay().isSelf),x(r.popoverClosed())})("focused",function(r){C(e);let o=y(2);return x(o.setActiveVessel(r?o.overlay().id:null))})("markPosition",function(r){C(e);let o=y(2);return o.skres.newWaypointAt(r),x(o.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()()}if(n&2){let e=y(2);h(),T("canClose",e.app.config.map.popoverMulti)("vessel",e.overlay().vessel)("useMagnetic",e.app.useMagnetic)("isActive",e.app.data.vessels.activeId===e.overlay().id)("isSelf",e.overlay().isSelf)}}function VBe(n,t){if(n&1){let e=H();u(0,"aton-popover",62),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("aton",e.overlay().aton)}}function BBe(n,t){if(n&1){let e=H();u(0,"aircraft-popover",63),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("aircraft",e.overlay().aircraft)}}function jBe(n,t){if(n&1){let e=H();u(0,"alarm-popover",64),M("info",function(){C(e);let r=y(2);return r.itemInfo(r.overlay().id,r.overlay().type),x(r.popoverClosed())})("goto",function(r){C(e);let o=y(2);return o.onContextMenuAction("nav_to",r),x(o.popoverClosed())})("closed",function(){C(e);let r=y(2);return x(r.popoverClosed())}),p()}if(n&2){let e=y(2);T("canClose",e.app.config.map.popoverMulti)("alarm",e.overlay().alarm)("id",e.overlay().id)}}function zBe(n,t){if(n&1&&(u(0,"ol-overlay",27),R(1,ABe,1,3,"ap-popover",48),R(2,OBe,1,2,"chart-list-popover",49),R(3,RBe,1,3,"feature-list-popover",50),R(4,LBe,1,7,"resource-popover",51),R(5,FBe,1,3,"resourceset-popover",52),R(6,NBe,2,5,"div"),R(7,VBe,1,2,"aton-popover",53),R(8,BBe,1,2,"aircraft-popover",54),R(9,jBe,1,3,"alarm-popover",55),p()),n&2){let e=y();T("position",e.overlay().position)("positioning","top-center"),h(),F(e.mapInteract.isMeasuring()?1:-1),h(),F(e.overlay().type==="chartlist"?2:-1),h(),F(e.overlay().type==="list"?3:-1),h(),F(e.overlay().type==="destination"||e.overlay().type==="waypoint"||e.overlay().type==="route"||e.overlay().type==="note"||e.overlay().type==="region"?4:-1),h(),F(e.overlay().type==="rset"?5:-1),h(),F(e.overlay().type==="ais"?6:-1),h(),F(e.overlay().type==="aton"||e.overlay().type==="meteo"?7:-1),h(),F(e.overlay().type==="aircraft"?8:-1),h(),F(e.overlay().type==="alarm"?9:-1)}}function UBe(n,t){if(n&1&&B(0,"fb-anchor-alarm",28),n&2){let e=y();T("radius",e.anchor.radius())("anchorPosition",e.anchor.position())("vesselPosition",e.dfeat.self.position)("anchorStyles",e.featureStyles.anchor)("zIndex",300)}}function HBe(n,t){if(n&1&&B(0,"fb-cpa-alarms",29),n&2){let e=y();T("cpaLines",e.dfeat.closest)("zIndex",350)}}function GBe(n,t){if(n&1&&B(0,"fb-xte-path",65),n&2){let e=y(2);T("startPosition",e.dfeat.navData.startPosition)("destPosition",e.dfeat.navData.position)("zIndex",340)("visible",!0)}}function WBe(n,t){if(n&1&&B(0,"fb-target-angle",68)(1,"fb-layline",69),n&2){let e=y(2);T("line",e.perfTargetAngle())("lineStyle",e.featureStyles.targetAngle)("position",e.app.data.vessels.active.position)("twd",e.app.data.vessels.self.wind.direction)("mapZoom",e.mapZoomLevel())("zIndex",345),h(),T("lines",e.perfLaylines())("laylineStyles",e.featureStyles.layline)("position",e.app.data.vessels.active.position)("twd",e.app.data.vessels.self.wind.direction)("mapZoom",e.mapZoomLevel())("zIndex",330)}}function $Be(n,t){if(n&1&&B(0,"fb-bearing-line",66),n&2){let e=y(2);T("markerPosition",e.dfeat.navData.position)("vesselPosition",e.dfeat.active.position)("showMarker",!e.app.data.activeWaypoint)("markerName",e.course.courseData().destPointName)("bearingStyles",e.featureStyles.destination)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("zIndex",335)}}function qBe(n,t){if(n&1&&B(0,"fb-arrival-circle",67),n&2){let e=y(2);T("radius",e.course.courseData().arrivalCircle)("position",e.dfeat.navData.position)("zIndex",335)}}function KBe(n,t){if(n&1&&(R(0,GBe,1,4,"fb-xte-path",65),R(1,WBe,2,12),R(2,$Be,1,8,"fb-bearing-line",66),R(3,qBe,1,3,"fb-arrival-circle",67)),n&2){let e=y();F(e.dfeat.navData.startPosition?0:-1),h(),F(e.app.config.vessels.laylines&&e.perfTargetAngle().length!==0?1:-1),h(),F(e.dfeat.navData.position?2:-1),h(),F(e.course.courseData().arrivalCircle?3:-1)}}function XBe(n,t){if(n&1&&B(0,"fb-range-circles",31),n&2){let e=y();T("position",e.dfeat.active.position)("maxCircles",e.app.config.vessels.rangeCircleCount)("mapZoom",e.mapZoomLevel())("darkMode",e.app.uiConfig().invertColor)("minZoom",e.app.config.vessels.rangeCircleMinZoom)("units",e.scaleUnits())("zIndex",340)}}function YBe(n,t){if(n&1&&B(0,"fb-cog-line",32),n&2){let e=y();T("coords",e.vesselLines().cog)("cogTime",e.app.config.vessels.cogLine)("units",e.app.config.units.distance)("darkMode",e.app.uiConfig().invertColor)("labelMinZoom",e.app.config.map.labelsMinZoom)("mapZoom",e.mapZoomLevel())("zIndex",345)}}function ZBe(n,t){if(n&1&&B(0,"fb-wind-lines",33),n&2){let e=y();T("twd",e.dfeat.active.wind.direction)("tws",e.dfeat.active.wind.tws)("awa",e.dfeat.active.wind.awa+e.dfeat.active.orientation)("aws",e.dfeat.active.wind.aws)("position",e.dfeat.self.position)("zIndex",350)}}function QBe(n,t){if(n&1&&B(0,"fb-vessel-trail",35),n&2){let e=y();T("localTrail",e.app.selfTrail())("serverTrail",e.app.selfTrailFromServer())("zIndex",990)}}function JBe(n,t){if(n&1&&B(0,"fb-chart-bounds",36),n&2){let e=y();T("zIndex",250)("charts",e.app.data.chartBounds.charts)}}function eje(n,t){n&1&&(u(0,"span"),_(1,"Clear Active Route"),p())}function tje(n,t){n&1&&(u(0,"span"),_(1,"Clear Destination"),p())}function ije(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("cleardestination",r))}),u(1,"mat-icon"),_(2,"clear_all"),p(),R(3,eje,2,0,"span")(4,tje,2,0,"span"),p()}if(n&2){let e=y(2);h(3),F(e.app.data.activeRoute?3:4)}}function nje(n,t){if(n&1){let e=H();u(0,"button",72),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("add_note",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(1,"mat-icon"),_(2,"local_offer"),p(),_(3," Add Note here "),p()}}function rje(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("cleartrail",r))}),u(1,"mat-icon"),_(2,"clear_all"),p(),u(3,"span"),_(4),p()()}if(n&2){let e=y(2);h(4),Z("",e.app.data.serverTrail?"Refresh":"Clear"," Trail")}}function oje(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("weather_forecast",r))}),u(1,"mat-icon"),_(2,"air"),p(),u(3,"span"),_(4,"Weather Forecast"),p()()}}function aje(n,t){if(n&1){let e=H();u(0,"button",74),M("click",function(){C(e);let r=y().item,o=y();return x(o.onContextMenuAction("get_feature_info",r))}),u(1,"mat-icon"),_(2,"info"),p(),u(3,"span"),_(4,"Get Feature Info"),p()()}}function sje(n,t){if(n&1){let e=H();u(0,"button",70),M("contextmenu",function(r){return C(e),x(r.preventDefault())})("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("nav_to",r))}),u(1,"mat-icon"),_(2,"near_me"),p(),_(3," Navigate to here "),p(),R(4,ije,5,1,"button",71),B(5,"mat-divider"),u(6,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("add_wpt",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(7,"mat-icon",73),_(8,"add_location"),p(),_(9," Add Waypoint here "),p(),R(10,nje,4,0,"button",71),B(11,"mat-divider"),u(12,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("measure",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(13,"mat-icon"),_(14,"straighten"),p(),_(15," Measure "),p(),B(16,"mat-divider"),R(17,rje,5,1,"button",71),u(18,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("trail2route",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(19,"mat-icon"),_(20,"insights"),p(),_(21," Trail to Route "),p(),B(22,"mat-divider"),u(23,"button",72),M("click",function(){let r=C(e).item,o=y();return x(o.onContextMenuAction("anchor",r))})("contextmenu",function(r){return C(e),x(r.preventDefault())}),u(24,"mat-icon"),_(25,"anchor"),p(),_(26," Anchor Watch "),p(),R(27,oje,5,0,"button",71),R(28,aje,5,0,"button",71)}if(n&2){let e=y();h(4),F(e.course.courseData().position?4:-1),h(6),F(e.mapZoomLevel()>=e.app.config.resources.notes.minZoom?10:-1),h(7),F(e.app.config.vessels.trail&&e.app.selfTrail().length!==0?17:-1),h(10),F(e.app.featureFlags().weatherApi?27:-1),h(),F(e.app.config.experiments&&e.app.config.resources.featureServer.url?28:-1)}}var qw=class n{setFocus;mapCenter=[0,0];mapZoom=1;movingMap=!1;northUp=!0;measureMode;drawMode;modifyMode=!1;activeRoute;vesselTrail=[];dblClickZoom=!1;drawEnded=new q;activate=new q;deactivate=new q;info=new q;exitMovingMap=new q;focusVessel=new q;menuItemSelected=new q;contextMenu;olMap;scaleUnits=$t("");perfLaylines=oe({port:[],starboard:[]});perfTargetAngle=oe([]);vesselLines=oe({cog:[],heading:[]});overlay=oe({id:null,type:null,icon:null,position:[0,0],show:!1,title:"",content:null,featureCount:0,readOnly:!1,isSelf:!1});olMapControls=Use;olMapInteractions=oe([]);mapZoomLevel=oe(1);mapCenterPositon=oe([0,0]);mapRotation=oe(0);showNoteslayer=oe(!1);featureStyles={route:Gse,region:$se,anchor:Wse,alarm:qse,destination:Kse,basestation:Xse,aircraft:Yse,sar:Zse,layline:Qse,targetAngle:Jse,raceCourse:Hse};dfeat={aircraft:new Map,atons:new Map,sar:new Map,meteo:new Map,self:new xp,ais:new Map,active:new xp,navData:{position:null,startPosition:null},closest:[]};saveTimer;isDirty=!1;mouse={pixel:null,coords:[0,0],xy:null};contextMenuPosition={x:"0px",y:"0px"};obsList=[];http=w(pa);app=w(Ie);skres=w(Di);skresOther=w(cu);skstream=w(pc);anchor=w(yh);notiMgr=w(sl);course=w(Ys);mapInteract=w(vu);settings=w(Cu);bottomSheet=w(Om);constructor(){Ut(()=>{this.scaleUnits()&&this.setScaleUnits()}),this.toggleDblClickZoom()}ngAfterViewInit(){this.setScaleUnits(),setTimeout(()=>{this.setFocus="xxx"},500)}ngOnInit(){this.obsList.push(this.skstream.vessels$().subscribe(()=>this.onVessels())),this.obsList.push(this.settings.change$.subscribe(t=>{this.renderMapContents(t.includes("fetchNotes")),t.includes("trailFromServer")&&(this.app.config.vessels.trailFromServer||this.app.selfTrailFromServer.update(()=>[]))}))}ngOnDestroy(){this.stopSaveTimer(),this.obsList.forEach(t=>t.unsubscribe())}ngOnChanges(t){t.vesselTrail&&this.drawVesselLines(),t&&t.mapCenter&&t.mapCenter.currentValue&&this.mapCenterPositon.set(t.mapCenter.currentValue),t&&t.mapZoom&&typeof t.mapZoom.currentValue=="number"&&(this.mapZoomLevel.set(t.mapZoom.currentValue),this.renderMapContents(!0)),t&&t.movingMap&&!t.movingMap.firstChange&&(t.movingMap.currentValue?this.startSaveTimer():this.stopSaveTimer(),this.centerVessel()),t&&t.northUp&&this.rotateMap(),t&&t.measureMode&&this.applyInteractionMode(0,t.measureMode.currentValue),t&&t.drawMode&&this.applyInteractionMode(1,t.drawMode.currentValue),t&&t.modifyMode&&!t.modifyMode.firstChange&&this.applyInteractionMode(2,t.modifyMode.currentValue),t&&t.dblClickZoom&&this.toggleDblClickZoom(t.dblClickZoom.currentValue)}setScaleUnits(){try{let t=this.scaleUnits()==="m"?"metric":"nautical";this.olMap.getMap().getControls().getArray()[0].setUnits(t)}catch{}}wmsParams(t){return{LAYERS:t.layers?t.layers.join(","):""}}startSaveTimer(){this.saveTimer||(this.saveTimer=setInterval(()=>{this.isDirty&&(this.app.saveConfig(),this.isDirty=!1)},3e4))}stopSaveTimer(){this.saveTimer&&(clearInterval(this.saveTimer),this.saveTimer=null)}onVessels(){let t=this.dfeat.self.position;this.dfeat.self=this.app.data.vessels.self,(!this.dfeat.self.position||!Array.isArray(this.dfeat.self.position))&&(this.dfeat.self.position=t),this.dfeat.ais=this.app.data.vessels.aisTargets,this.dfeat.aircraft=this.app.data.aircraft,this.dfeat.sar=this.app.data.sar,this.dfeat.meteo=this.app.data.meteo,this.dfeat.atons=this.app.data.atons,this.dfeat.active=this.app.data.vessels.active,this.dfeat.navData.position=this.course.courseData().position,this.dfeat.navData.startPosition=this.course.courseData().startPosition;let e=()=>{let i=[];return this.app.data.vessels.self.position&&this.app.data.vessels.closest.forEach(r=>{if(this.app.data.vessels.aisTargets.has(r)){let o=this.app.data.vessels.aisTargets.get(r);i.push([o.position,this.app.data.vessels.self.position])}}),i};this.dfeat.closest=e(),this.dfeat.self.positionReceived&&(this.app.data.vessels.showSelf=!0),this.overlay().show&&["ais","aton","aircraft"].includes(this.overlay().type)&&(this.overlay().isSelf?this.overlay.update(i=>Object.assign({},i,{position:this.dfeat.self.position,vessel:this.dfeat.self})):this.overlay().type==="ais"&&!this.dfeat.ais.has(this.overlay().id)||this.overlay().type==="atons"&&!this.dfeat.atons.has(this.overlay().id)||this.overlay().type==="aircraft"&&!this.dfeat.aircraft.has(this.overlay().id)?this.overlay().show=!1:this.overlay().type==="ais"&&this.overlay.update(i=>Object.assign({},i,{position:this.dfeat.ais.get(i.id).position,vessel:this.dfeat.ais.get(i.id)})),this.app.mapExtent()[0]<180&&this.app.mapExtent()[2]>180&&this.overlay().position[0]<0&&this.overlay().position[0]>-180&&this.overlay.update(i=>Object.assign({},i,{position:[i.position[0]+360,i.position[1]]}))),this.drawVesselLines(this.app.data.vessels.self.positionReceived),this.rotateMap(),this.movingMap&&this.centerVessel()}toggleDblClickZoom(t){let e=[{name:"dragpan"},{name:"dragzoom"},{name:"keyboardpan"},{name:"keyboardzoom"},{name:"mousewheelzoom"},{name:"pinchzoom"}];this.olMapInteractions.update(()=>t?[{name:"doubleclickzoom"}].concat(e):[].concat(e))}onContextMenuAction(t,e){switch(t){case"add_wpt":this.skres.newWaypointAt(e);break;case"add_note":this.skres.showNoteEditor({position:e});break;case"nav_to":this.app.data.activeWaypoint=null,this.course.courseData().pointNames=[],this.course.setDestination({latitude:e[1],longitude:e[0]});break;case"weather_forecast":this.bottomSheet.open(hv,{disableClose:!0,data:{title:"Forecast",position:e,subTitle:"Location: Cursor Position"}});break;case"measure":this.mapInteract.startMeasuring();break;case"get_feature_info":this.getFeatureInfo(e);break;default:this.menuItemSelected.emit(t);break}}onMapMoveEnd(t){this.app.config.map.zoomLevel=t.zoom,this.app.mapExtent.update(()=>t.extent),this.app.config.map.center=t.lonlat,this.drawVesselLines(),this.movingMap?this.isDirty=!0:(this.app.saveConfig(),this.isDirty=!1),this.renderMapContents(t.zoomChanged)}onMapPointerMove(t){if(this.mouse.pixel=t.pixel,this.mouse.xy=t.coordinate,this.mouse.coords=_n.normaliseCoords(t.lonlat),this.mapInteract.isMeasuring()){if(this.mapInteract.measureGeometryType==="LineString"&&this.mapInteract.measurement().coords.length!==0){let e=t.lonlat,i=this.mapInteract.distanceFromLastPoint(e),r=(0,zl.getGreatCircleBearing)(this.mapInteract.measurement().coords.slice(-1)[0],e);this.overlay.update(o=>Object.assign({},o,{position:e,title:`${this.app.formatValueForDisplay(i,"m")} ${this.app.formatValueForDisplay(r,"deg")}`}))}else if(this.mapInteract.measureGeometryType==="Circle"){let e=t.lonlat,i=this.mapInteract.distanceFromCenter(e),r=(0,zl.getGreatCircleBearing)(this.mapInteract.measurement().center??e,e);this.overlay.update(o=>Object.assign({},o,{position:e,title:`${this.app.formatValueForDisplay(i,"m")} ${this.app.formatValueForDisplay(r,"deg")}`}))}}}onMapPointerDrag(){!this.app.config.map.lockMoveMap&&this.app.uiConfig().mapMove&&this.exitMovingMap.emit(!0)}onMapPointerDown(t){this.mouse.coords=_n.normaliseCoords(t.lonlat),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px"}onMapSingleClick(t){this.app.data.map.atClick={features:t.features,lonlat:t.lonlat},this.mapInteract.isMeasuring()?this.parseClickInMeasureMode(t.lonlat):this.mapInteract.isDrawing()&&this.mapInteract.draw.resourceType==="route"?this.onDrawClick(t.features):!this.mapInteract.isDrawing()&&!this.mapInteract.isModifying()&&(this.app.config.map.popoverMulti||this.overlay.update(e=>Object.assign({},e,{show:!1})),this.processMapClick(t))}onMapRightClick(t){this.app.data.map.atClick=t,this.app.debug("onRightClick()",this.app.data.map.atClick),this.mapInteract.isMeasuring()&&this.parseClickInMeasureMode(t.lonlat)}onMapContextMenu(t){this.app.debug("onMapContextMenu()",this.app.data.map.atClick),this.onContextMenu(t)}onContextMenu(t){if(this.app.debug("onContextMenu()",this.app.data.map.atClick),!this.app.uiCtrl().suppressContextMenu){if(t.preventDefault(),this.contextMenuPosition.x=t.clientX+"px",this.contextMenuPosition.y=t.clientY+"px",this.contextMenu.menuData={item:this.mouse.coords},this.mapInteract.isMeasuring())this.parseClickInMeasureMode(this.mouse.xy.lonlat);else if(!this.modifyMode){if(!this.mouse.xy)return;this.contextMenu.openMenu(),document.getElementsByClassName("cdk-overlay-backdrop")[0].addEventListener("contextmenu",e=>{e.preventDefault(),this.contextMenu.closeMenu()})}}}parseClickInMeasureMode(t){this.mapInteract.measureGeometryType==="LineString"&&this.mapInteract.measurement().coords.length!==0&&this.onMeasureClick(t)}toggleFeatureSelection(t,e){e==="charts"&&this.skres.chartSelected(t)}onDragBoxStart(t){let e=Gr(t.coordinate);this.mapInteract.initBoxCoord(e)}onDragBoxEnd(t){let e=Gr(t.coordinate);this.mapInteract.stopBoxSelection(e)}onDragBoxCancel(t){this.app.debug("onDragBoxCancel()..."),this.mapInteract.stopBoxSelection()}onMeasureStart(t){this.app.debug("onMeasureStart()...",this.mapInteract.measureGeometryType);let e;if(this.mapInteract.measureGeometryType==="LineString"){let i=t.feature.getGeometry().getCoordinates().map(r=>Gr(r));i=i.slice(0,i.length-1),this.mapInteract.measurementCoords=i,e=i}else{let i=t.feature.getGeometry(),r=Gr(i.getCenter()),o=i.getRadius();this.mapInteract.measurementCenter=r,this.mapInteract.measurementRadius=o,e=this.mapInteract.measurementCenter,this.app.debug(this.mapInteract.measurement)}this.formatPopover(null,null),this.overlay.update(i=>Object.assign({},i,{position:e,title:"0",show:!0,type:"measure"}))}onMeasureClick(t){if(this.app.debug("onMeasureClick()..."),!Array.isArray(t))return;let e=this.mapInteract.measurement().coords[this.mapInteract.measurement().coords.length-1];if(t[0]===e[0]&&t[1]===e[1])return;let i=this.mapInteract.addMeasurementCoord(t),r=this.mapInteract.measurement().coords.slice(-2),o=(0,zl.getGreatCircleBearing)(r[0],r[1])??0;this.overlay.update(a=>Object.assign({},a,{position:t,title:`${this.app.formatValueForDisplay(i,"m")} ${this.app.formatValueForDisplay(o,"deg")}`}))}onMeasureEnd(){this.app.debug("onMeasureEnd()..."),this.overlay.update(t=>Object.assign({},t,{show:!1})),this.mapInteract.stopMeasuring()}onDrawClick(t){if(Array.isArray(t)&&this.mapInteract.draw.resourceType==="route"){let e;t.forEach(i=>{i.getGeometry().getType()==="LineString"&&(e=i.getGeometry().getCoordinates().map(r=>Gr(r)),e=e.slice(0,e.length-1))}),this.mapInteract.measurementCoords=e}}onDrawEnd(t){this.mapInteract.stopDrawing(t.feature),this.drawEnded.emit(this.mapInteract.draw)}modifyFeature(t){this.mapInteract.draw.features.getLength()!==0&&(this.mapInteract.startModifying(this.overlay()),this.overlay().type==="route"&&(this.mapInteract.measurementCoords=this.skres.fromCache("routes",this.overlay().id)[1].feature.geometry.coordinates),t==="anchor"&&(this.overlay().type=t,this.mapInteract.draw.forSave.id=t))}onModifyStart(t){let e=t.features.getArray()[0];if(this.mapInteract.draw.coordinates=e.getGeometry().getCoordinates(),this.mapInteract.draw.forSave.id||(this.mapInteract.draw.forSave.id=e.getId()),e.getGeometry().getType()==="LineString"){let i=e.get("pointMetadata");i&&(this.mapInteract.draw.forSave.coordsMetadata=i)}}onModifyEnd(t){let e=t.features.getArray()[0],i=e.getId(),r=e.getGeometry().getCoordinates();e.getGeometry().getType()==="LineString"&&this.updateCoordsMeta(this.mapInteract.draw.coordinates,r,this.mapInteract.draw.forSave.coordsMetadata);let o;if(i.split(".")[0]==="route")o=this.transformCoordsArray(r),this.mapInteract.measurementCoords=o;else if(i.split(".")[0]==="region"){for(let a=0;a<r.length;a++)if(this.isCoordsArray(r[a]))r[a]=this.transformCoordsArray(r[a]);else for(let s=0;s<r[a].length;s++)this.isCoordsArray(r[a][s])?r[a][s]=this.transformCoordsArray(r[a][s]):console.log("Invalid polygon coordinates!");o=r}else o=Gr(r),i==="anchor"&&this.anchor.setAnchorPosition(o).catch(a=>{this.app.parseHttpErrorResponse(a)});this.mapInteract.draw.forSave.coords=o,this.app.data.activeRoute&&this.mapInteract.draw.forSave.id.indexOf(this.app.data.activeRoute)!==-1?this.app.data.activeRouteIsEditing=!0:this.app.data.activeRouteIsEditing=!1,this.app.data.editingId=this.mapInteract.draw.forSave.id,this.app.debug(this.mapInteract.draw.forSave)}processMapClick(t){let e=new Map,i=new Map,r=[],o=!1;if(t.features.forEach(a=>{let s=a.getId(),l=!1,c,d,f,g,m;if(s&&typeof s=="string"){let b=s.split("."),v,E;if(b[0]==="chart-backdrop"){o=!0;return}switch(b[0]==="chart-bound"&&i.set(s,{id:b[1],coord:t.lonlat,icon:v,text:a.get("name")}),b[0]){case"rset":l=!0,v="star",E=a.get("name");break;case"alarm":l=!0,v="notification_important",E=`Alarm: ${a.get("type")}`;break;case"anchor":l=!0,v="anchor",E=`${b[0]}`;break;case"dest":l=!0,v="flag",E="Destination";break;case"note":v=a.get("icon"),l=!0,E=this.skres.fromCache("notes",b[1])[1].name??"";break;case"route":v="route",l=!0,E=this.skres.fromCache("routes",b[1])[1].name;break;case"waypoint":v="location_on",l=!0,E=this.skres.fromCache("waypoints",b[1])[1].name??"";break;case"atons":case"aton":case"shore":v="beenhere",l=!0,c=this.app.data.atons.get(s),E=c?c.name||c.mmsi:"";break;case"sar":v="tour",l=!0,d=this.app.data.sar.get(s),E=d?d.name||d.mmsi:"SaR Beacon";break;case"meteo":v="air",l=!0,f=this.app.data.meteo.get(s),E=f?f.name||f.mmsi:"Weather Station";break;case"ais-vessels":v="directions_boat",l=!0,m=this.dfeat.ais.get(`vessels.${b[1]}`),E=m?m.name||m.mmsi:"";break;case"vessels":v="directions_boat",l=!0,E=this.dfeat.self.name?this.dfeat.self.name+" (self)":"self";break;case"region":l=!0,v="tab_unselected",E=a.get("name");break;case"aircraft":v="airplanemode_active",l=!0,g=this.app.data.aircraft.get(s),E=g?g.name||g.mmsi:"";break}l&&!e.has(s)&&(e.set(s,{id:s,coord:t.lonlat,icon:v,text:E}),r.push(a))}}),i.size>0){this.formatPopover("chartlist.",t.lonlat,i);return}if(!o)if(this.mapInteract.draw.features=new wr(r),e.size===1){let a=e.values().next().value;this.formatPopover(a.id,a.coord)}else e.size>1&&this.formatPopover("list.",t.lonlat,e)}formatPopover(t,e,i){if(!t){this.overlay.update(l=>Object.assign({},l,{show:!1}));return}let r={show:!1,content:[],id:null,type:null,title:null,featureCount:this.mapInteract.draw.features?.getLength(),position:e,readOnly:!1,isSelf:!1},o=null,a=t.split("."),s;switch(a[0]){case"anchor":this.modifyFeature("anchor");return;case"list":r.type=a[0],r.title="Features",r.content=[],i.forEach(c=>r.content.push(c)),r.show=!0;break;case"chartlist":r.type=a[0],r.content=[],i.forEach(c=>r.content.push(c)),r.show=!0;break;case"alarm":s=t.split(".").slice(1).join(".");let l=this.notiMgr.getAlert(s);if(!l)return!1;r.type=a[0],r.alarm=l,r.id=s,r.show=!0;break;case"vessels":r.type="ais",r.isSelf=!0,r.vessel=this.dfeat.self,r.position=this.dfeat.self.position,r.show=!0;break;case"ais-vessels":if(s=t.slice(4),!this.dfeat.ais.has(s))return!1;r.type="ais",r.id=s,r.vessel=this.dfeat.ais.get(s),r.position=r.vessel.position,r.show=!0;break;case"atons":case"aton":case"shore":if(!this.app.data.atons.has(t))return!1;r.type="aton",r.id=t,r.aton=this.app.data.atons.get(t),r.position=r.aton.position,r.show=!0;break;case"sar":if(!this.app.data.sar.has(t))return!1;r.type="aton",r.id=t,r.aton=this.app.data.sar.get(t),r.position=r.aton.position,r.show=!0;break;case"meteo":if(!this.app.data.meteo.has(t))return!1;r.type=a[0],r.id=t,r.aton=this.app.data.meteo.get(t),r.position=r.aton.position,r.show=!0;break;case"aircraft":if(!this.app.data.aircraft.has(t))return!1;r.type=a[0],r.id=t,r.aircraft=this.app.data.aircraft.get(t),r.position=r.aircraft.position,r.show=!0;break;case"region":if(o=[this.skres.fromCache("regions",a[1])],!o)return!1;r.id=a[1],r.type=a[0],r.title="Region",r.resource=o[0],r.show=!0,r.readOnly=o[0][1]?.feature?.properties?.readOnly??!1;break;case"note":if(o=this.skres.fromCache("notes",a[1]),!o)return!1;r.readOnly=o[1]?.properties?.readOnly??!1,r.readOnly?(r.show=!1,this.skres.showNoteDetails(o[0])):(r.id=a[1],r.type=a[0],r.title="Note",r.resource=o,r.show=!0);break;case"route":if(o=[this.skres.fromCache("routes",a[1])],!o)return!1;r.id=a[1],r.type=a[0],r.title="Route",r.resource=o[0],r.show=!0,r.readOnly=o[0][1]?.feature?.properties?.readOnly??!1;break;case"waypoint":if(o=[this.skres.fromCache("waypoints",a[1])],!o)return!1;r.id=a[1],r.type=a[0],r.resource=o[0],r.title="Waypoint",r.show=!0,r.readOnly=o[0][1]?.feature?.properties?.readOnly??!1;break;case"dest":r.id=t,r.type="destination",r.resource=this.skres.buildWaypoint(e),r.title=this.course.courseData().destPointName??"Destination",r.show=!0;break;case"rset":r.id=t,r.type=a[0],r.resource=this.skresOther.fromResourceSetCache(t,!0),r.title=r.resource?.properties?.name??"Resource Set",r.show=!!r.resource;break;default:return}this.overlay.update(()=>r)}featureListSelection(t){let e=new wr;this.mapInteract.draw.features.forEach(i=>{i.getId()===t.id&&e.push(i)}),this.mapInteract.draw.features=e,this.formatPopover(t.id,t.coord)}popoverClosed(){this.overlay.update(t=>Object.assign({},t,{show:!1}))}updateCoordsMeta(t,e,i){if(!i)return;let r=e.length>t.length?"ADD":e.length<t.length?"DELETE":"MOVE";function o(a){return a.map(s=>`${s[0]} - ${s[1]}`)}if(r==="MOVE")return i;if(t=o(t),e=o(e),r==="DELETE"){for(let a=0;a<t.length;a++)e.includes(t[a])||i.splice(a,1);return i}else if(r==="ADD"){for(let a=0;a<e.length;a++)if(t[a]!==e[a]){i.splice(a,0,{name:""});break}return i}else return i}zoomMap(t){t?this.app.config.map.zoomLevel<this.app.MAP_ZOOM_EXTENT.max&&++this.app.config.map.zoomLevel:this.app.config.map.zoomLevel>this.app.MAP_ZOOM_EXTENT.min&&--this.app.config.map.zoomLevel}rotateMap(){this.northUp?this.mapRotation.set(0):this.mapRotation.update(()=>0-this.dfeat.active.orientation)}centerVessel(){let t=this.app.calcMapCenter(this.dfeat.active.position);this.mapCenterPositon.update(()=>t)}drawVesselLines(t=!1){let e=this.mapZoomLevel(),i=e<29?R3[Math.floor(e)]:60,r=10;t&&this.app.addToSelfTrail(this.dfeat.self.position),this.buildLaylines(),this.vesselLines.update(()=>{let o=this.dfeat.active.vectors.cog??[],a=this.dfeat.active.sog||0,s=0;this.app.config.vessels.headingLineSize===-1?s=(a>r?r:a)*i:s=Ct.nauticalMilesToKm(this.app.config.vessels.headingLineSize)*1e3;let l=[this.dfeat.active.position,_n.destCoordinate(this.dfeat.active.position,this.dfeat.active.orientation,s)];return{cog:o,heading:l}})}buildLaylines(){if(this.app.config.vessels.laylines&&Array.isArray(this.dfeat.navData.position)&&typeof this.dfeat.navData.position[0]=="number"&&typeof this.app.data.vessels.active.heading=="number"){let t=Ct.radiansToDegrees(this.app.data.vessels.self.wind.direction??0),e=Ka.add(t,180),i=Math.abs(Ka.difference(this.course.courseData().bearing.value,t))<90,r=Ct.radiansToDegrees(this.app.data.vessels.self.performance.beatAngle??Math.PI/4),o,a;typeof this.app.data.vessels.self.performance.gybeAngle=="number"&&(o=Ct.radiansToDegrees(this.app.data.vessels.self.performance.gybeAngle),a=180-Math.abs(o));let s=i?Math.abs(Ka.difference(this.course.courseData().bearing.value,t))<r:Math.abs(Ka.difference(this.course.courseData().bearing.value,e))<(a??0),l=this.app.config.units.distance==="m"?this.course.courseData().dtg*1e3:Ct.nauticalMilesToKm(this.course.courseData().dtg*1e3),c=[];if(i){let d=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,r)),f=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,0-r));c=[[d.longitude,d.latitude],this.dfeat.navData.position,[f.longitude,f.latitude]]}else if(typeof o=="number"){let d=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,o)),f=(0,zl.computeDestinationPoint)(this.dfeat.navData.position,l,Ka.add(e,0-o));c=[[d.longitude,d.latitude],this.dfeat.navData.position,[f.longitude,f.latitude]]}if(this.perfTargetAngle.update(()=>c),s){let d=Ka.difference(t,this.course.courseData().bearing.value),f,g,m,b;if(i){let v=Ct.degreesToRadians(r-d),E=Ct.degreesToRadians(r+d),k=Math.PI-(E+v);f=l*Math.sin(E)/Math.sin(k),g=l*Math.sin(v)/Math.sin(k),m=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,f,Ka.add(t,r)),b=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,g,Ka.add(t,0-r))}else if(c.length!==0&&typeof a=="number"){let v=Ct.degreesToRadians(a-d),E=Ct.degreesToRadians(a+d),k=Math.PI-(E+v);f=l*Math.sin(E)/Math.sin(k),g=l*Math.sin(v)/Math.sin(k),m=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,f,Ka.add(t,a)),b=(0,zl.computeDestinationPoint)(this.app.data.vessels.active.position,g,Ka.add(t,0-a))}this.perfLaylines.update(()=>({port:[[[b.longitude,b.latitude],this.app.data.vessels.active.position],[[m.longitude,m.latitude],this.app.data.vessels.active.position]],starboard:[[[m.longitude,m.latitude],c[1]],[c[1],[b.longitude,b.latitude]]]}))}}}deleteFeature(t,e){switch(e){case"waypoint":this.skres.deleteWaypoint(t);break;case"route":this.skres.deleteRoute(t);break;case"note":this.skres.deleteNote(t);break;case"region":this.skres.deleteRegion(t);break}}setActiveFeature(){this.overlay().type==="waypoint"?this.course.navigateToWaypoint(this.overlay().id):this.activate.emit(this.overlay().id)}clearActiveFeature(){this.deactivate.emit(this.overlay().id)}itemInfo(t,e,i=!1){e==="ais"&&i?this.info.emit({id:t,type:"self"}):this.info.emit({id:t,type:e})}setActiveVessel(t=null){this.focusVessel.emit(t)}applyInteractionMode(t,e){this.overlay.update(i=>Object.assign({},i,{show:!1})),t===0&&(this.mapInteract.draw.style=e?this.mapInteract.measureGeometryType==="Circle"?Gg.radius:Gg.measure:Gg.default),t===1&&(this.mapInteract.draw.style=this.mapInteract.draw.resourceType==="route"?Gg.route:this.mapInteract.draw.resourceType==="region"?Gg.region:Gg.default)}isCoordsArray(t){return Array.isArray(t)?Array.isArray(t[0])&&typeof t[0][0]=="number":!1}transformCoordsArray(t){return t.map(e=>Gr(e))}applyStyle(){return new Re({fill:new ot({color:"#e0d10e"}),stroke:new Ge({color:"#444",width:1})})}renderMapContents(t){this.shouldFetchNotes(t)&&(this.skres.refreshNotes(),this.app.debug("fetching Notes...")),this.shouldFetchResourceSets(t)&&(this.app.debug("fetching ResourceSets..."),this.skresOther.refreshResourceSetsInBounds())}mapMoveThresholdExceeded(t){if(!this.app.data.lastGet)return this.app.data.lastGet=this.app.config.map.center,!0;let e=_n.distanceTo(this.app.data.lastGet,this.app.config.map.center);this.app.debug(`distance map moved: ${e}`);let i=this.app.config.units.distance==="ft"?Ct.nauticalMilesToKm(t)*1e3:t*1e3;return this.app.debug(`mapMoveThresholdExceeded: ${e>=i/2}`),e>=i/2?(this.app.data.lastGet=this.app.config.map.center,!0):!1}shouldFetchResourceSets(t){return this.app.config.resources.fetchRadius!==0&&this.app.config.resources.fetchFilter&&this.skresOther.anyResourceSetSelection()?t?!0:this.mapMoveThresholdExceeded(50):!1}shouldFetchNotes(t){return this.showNoteslayer.update(()=>this.app.config.ui.showNotes&&this.app.config.map.zoomLevel>=this.app.config.resources.notes.minZoom),this.app.debug(`lastGet: ${this.app.data.lastGet}`),this.app.debug(`getRadius: ${this.app.config.resources.notes.getRadius}`),t?!(this.mapZoomLevel()<this.app.config.resources.notes.minZoom):this.mapMoveThresholdExceeded(this.app.config.resources.notes.getRadius)}getFeatureInfo(t){if(!this.app.config.resources.featureServer.url)return;let e=this.app.config.resources.featureServer.url.replaceAll("%longitude%",t[0].toString()).replaceAll("%latitude%",t[1].toString()).replaceAll("%map:zoom%",this.mapZoomLevel().toFixed(1));this.http.get(e).subscribe(i=>{Array.isArray(i?.features)?this.bottomSheet.open(qD,{disableClose:!0,data:i.features}):this.app.showAlert("Invalid Response","Invalid data received!")},i=>{this.app.parseHttpErrorResponse(i)})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=U({type:n,selectors:[["fb-map"]],viewQuery:function(e,i){if(e&1&&gt(Ga,7)(hBe,5),e&2){let r;de(r=ue())&&(i.contextMenu=r.first),de(r=ue())&&(i.olMap=r.first)}},inputs:{setFocus:"setFocus",mapCenter:"mapCenter",mapZoom:"mapZoom",movingMap:"movingMap",northUp:"northUp",measureMode:"measureMode",drawMode:"drawMode",modifyMode:"modifyMode",activeRoute:"activeRoute",vesselTrail:"vesselTrail",dblClickZoom:"dblClickZoom",scaleUnits:[1,"scaleUnits"]},outputs:{drawEnded:"drawEnded",activate:"activate",deactivate:"deactivate",info:"info",exitMovingMap:"exitMovingMap",focusVessel:"focusVessel",menuItemSelected:"menuItemSelected"},features:[be],decls:62,vars:113,consts:[["olMap",""],["contextMenu","matMenu"],["olView","",3,"mapMoveEnd","mapSingleClick","mapRightClick","mapPointerDown","mapPointerMove","mapPointerDrag","mapContextMenu","contextmenu","logo","olInteractions","olControls","setFocus","zoom","center","rotation","minZoom","maxZoom","enableAnimation"],[3,"type","style","stopClick"],[3,"type","stopClick","style"],[3,"features"],[1,"ol-zoom"],["mat-mini-fab","","matTooltip","Zoom out",1,"button-accent",3,"click","disabled"],["mat-mini-fab","","matTooltip","Zoom in",1,"button-accent",3,"click","disabled"],[1,"ol-mouse-position"],[2,"background-color","rgba(250, 250, 250, 0.7)","padding","0 5px 0 5px"],[3,"innerText"],[3,"zIndex","charts","colorMode"],[3,"params","layerDefs","zIndex"],[3,"darkMode","tracks","labelMinZoom","mapZoom","zIndex"],["targetContext","vessels","zIndex","110",3,"tracks","tracksMinZoom","updateIds","removeIds","mapZoom"],[3,"routes","routeStyles","activeRoute","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"points","pointIndex","reverse","zIndex"],[3,"darkMode","waypoints","activeWaypoint","labelMinZoom","mapZoom","zIndex"],["targetContext","atons",3,"darkMode","targets","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","shore.basestations",3,"darkMode","targets","targetStyles","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","meteo",3,"darkMode","targets","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","aircraft",3,"darkMode","targets","targetStyles","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],["targetContext","sar",3,"darkMode","targets","targetStyles","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex"],[3,"startLine","racecourseStyles","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"regions","regionStyles","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"notes","zIndex"],[3,"position","positioning"],[3,"radius","anchorPosition","vesselPosition","anchorStyles","zIndex"],[3,"cpaLines","zIndex"],[3,"alarms","alarmStyles","zIndex"],[3,"position","maxCircles","mapZoom","darkMode","minZoom","units","zIndex"],[3,"coords","cogTime","units","darkMode","labelMinZoom","mapZoom","zIndex"],[3,"twd","tws","awa","aws","position","zIndex"],[3,"position","heading","id","activeId","vesselLines","iconScale","fixedLocation","zIndex"],[3,"localTrail","serverTrail","trailStyles","zIndex"],[3,"zIndex","charts"],[2,"visibility","hidden","position","fixed",3,"matMenuTriggerFor"],[3,"contextmenu"],["matMenuContent",""],[3,"boxStart","boxEnd","boxCancel"],[3,"drawStart","drawEnd","type","stopClick"],[3,"drawEnd","type","stopClick"],[3,"modifyStart","modifyEnd","features"],[3,"darkMode","collection","resourceSets","labelMinZoom","mapZoom","zIndex"],[3,"targetContext","targets","vectorApparent","mapZoom","labelMinZoom","focusId","filterIds","filterByShipType","filterShipTypes","updateIds","staleIds","removeIds","inactiveTime","zIndex","darkMode"],[3,"flagged","targetContext","targets","mapZoom","labelMinZoom","focusId","filterIds","filterByShipType","filterShipTypes","updateIds","staleIds","removeIds","inactiveTime","zIndex","darkMode"],["targetContext","vessels",3,"darkMode","targets","labelMinZoom","mapZoom","updateIds","staleIds","removeIds","inactiveTime","zIndex","focusId","filterIds","filterByShipType","filterShipTypes","cogLineLength"],[3,"title","canClose","measure"],[3,"canClose","features"],[3,"canClose","title","features"],[3,"canClose","title","type","resource","active","featureCount","units"],[3,"canClose","title","resource"],[3,"canClose","aton"],[3,"canClose","aircraft"],[3,"canClose","alarm","id"],[3,"closed","title","canClose","measure"],[3,"selected","closed","canClose","features"],[3,"selected","closed","canClose","title","features"],[3,"modify","delete","addNote","activated","deactivated","related","notes","info","points","closed","canClose","title","type","resource","active","featureCount","units"],[3,"modify","delete","info","closed","canClose","title","resource"],[3,"info","focused","markPosition","closed","canClose","vessel","useMagnetic","isActive","isSelf"],[3,"info","closed","canClose","aton"],[3,"info","closed","canClose","aircraft"],[3,"info","goto","closed","canClose","alarm","id"],[3,"color","startPosition","destPosition","zIndex","visible","layerProperties"],[3,"markerPosition","vesselPosition","showMarker","markerName","bearingStyles","labelMinZoom","mapZoom","zIndex"],[3,"radius","position","zIndex"],[3,"line","lineStyle","position","twd","mapZoom","zIndex"],[3,"lines","laylineStyles","position","twd","mapZoom","zIndex"],["mat-menu-item","",3,"contextmenu","click"],["mat-menu-item",""],["mat-menu-item","",3,"click","contextmenu"],[1,"icon-waypoint"],["mat-menu-item","",3,"click"]],template:function(e,i){if(e&1){let r=H();u(0,"ol-map",2,0),M("mapMoveEnd",function(a){return C(r),x(i.onMapMoveEnd(a))})("mapSingleClick",function(a){return C(r),x(i.onMapSingleClick(a))})("mapRightClick",function(a){return C(r),x(i.onMapRightClick(a))})("mapPointerDown",function(a){return C(r),x(i.onMapPointerDown(a))})("mapPointerMove",function(a){return C(r),x(i.onMapPointerMove(a))})("mapPointerDrag",function(){return C(r),x(i.onMapPointerDrag())})("mapContextMenu",function(a){return C(r),x(i.onMapContextMenu(a))})("contextmenu",function(a){return C(r),x(i.onContextMenu(a))}),R(2,gBe,1,0,"ol-dragbox"),R(3,_Be,1,4,"ol-draw",3),R(4,bBe,1,4,"ol-draw",4),R(5,yBe,1,1,"ol-modify",5),u(6,"ol-control")(7,"ol-content")(8,"div",6)(9,"button",7),M("click",function(){return C(r),x(i.zoomMap(!1))}),u(10,"mat-icon"),_(11,"remove"),p()(),_(12," \xA0 "),u(13,"button",8),M("click",function(){return C(r),x(i.zoomMap(!0))}),u(14,"mat-icon"),_(15,"add"),p()()()()(),u(16,"ol-control")(17,"ol-content")(18,"div",9)(19,"span",10),R(20,vBe,2,0,"span"),B(21,"span",11),Fi(22,"coords"),_(23," \xA0 "),R(24,CBe,2,0,"span"),B(25,"span",11),Fi(26,"coords"),_(27," \xA0 "),B(28,"span",11),p()()()(),B(29,"fb-charts",12)(30,"fb-livelayer",13),R(31,xBe,1,5,"fb-tracks",14),R(32,wBe,1,5,"ais-targets-track",15),ye(33,MBe,2,6,"div",null,mBe),B(35,"fb-routes",16),R(36,SBe,1,4,"fb-route-direction",17),B(37,"fb-waypoints",18)(38,"sk-ais-targets",19)(39,"sk-ais-targets",20),R(40,EBe,1,9,"sk-ais-targets",21),R(41,TBe,4,30,"div"),R(42,IBe,1,10,"sk-ais-targets",22),R(43,kBe,1,10,"sk-ais-targets",23),B(44,"racing-start-line",24)(45,"fb-regions",25),R(46,PBe,1,2,"fb-notes",26),R(47,zBe,10,11,"ol-overlay",27),R(48,UBe,1,5,"fb-anchor-alarm",28),R(49,HBe,1,2,"fb-cpa-alarms",29),B(50,"fb-alarms",30),R(51,KBe,4,4),R(52,XBe,1,7,"fb-range-circles",31),R(53,YBe,1,7,"fb-cog-line",32),R(54,ZBe,1,6,"fb-wind-lines",33),B(55,"fb-vessel",34),R(56,QBe,1,3,"fb-vessel-trail",35),R(57,JBe,1,2,"fb-chart-bounds",36),p(),B(58,"div",37),u(59,"mat-menu",38,1),M("contextmenu",function(a){return C(r),x(a.preventDefault())}),wt(61,sje,29,5,"ng-template",39),p()}if(e&2){let r=pe(60);Mi("cursor",i.mapInteract.isDrawing()||i.mapInteract.isModifying()||i.mapInteract.isMeasuring()?"crosshair":"initial"),T("logo",!1)("olInteractions",i.olMapInteractions())("olControls",i.olMapControls)("setFocus",i.setFocus)("zoom",i.mapZoomLevel())("center",i.mapCenterPositon())("rotation",i.mapRotation())("minZoom",i.app.MAP_ZOOM_EXTENT.min)("maxZoom",i.app.MAP_ZOOM_EXTENT.max)("enableAnimation",!1),h(2),F(i.mapInteract.isBoxSelecting()?2:-1),h(),F(i.mapInteract.isMeasuring()?3:-1),h(),F(i.mapInteract.isDrawing()?4:-1),h(),F(i.mapInteract.isModifying()&&i.mapInteract.draw.features?5:-1),h(4),T("disabled",i.mapZoomLevel()<=i.app.MAP_ZOOM_EXTENT.min),h(4),T("disabled",i.mapZoomLevel()>=i.app.MAP_ZOOM_EXTENT.max),h(7),F(i.app.config.units.positionFormat==="XY"?20:-1),h(),T("innerText",jn(22,106,i.mouse.coords[1],i.app.config.units.positionFormat,!0)),h(3),F(i.app.config.units.positionFormat==="XY"?24:-1),h(),T("innerText",Xr(26,110,i.mouse.coords[0],i.app.config.units.positionFormat)),h(3),T("innerText","Zm: "+i.mapZoomLevel().toFixed(1)),h(),T("zIndex",10)("charts",i.skres.charts())("colorMode",i.app.data.vessels.self.environment.sun),h(),T("params",i.skresOther.infoLayerParams())("layerDefs",i.skresOther.infoLayers())("zIndex",50),h(),F(i.app.featureFlags().resourceTracks?31:-1),h(),F(i.app.config.ui.showAisTargets&&i.app.config.vessels.aisShowTrack?32:-1),h(),ve(i.skresOther.resourceSets()),h(2),T("routes",i.skres.routes())("routeStyles",i.featureStyles.route)("activeRoute",i.activeRoute)("darkMode",i.app.uiConfig().invertColor)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",500),h(),F(i.activeRoute&&!i.app.data.activeRouteIsEditing?36:-1),h(),T("darkMode",i.app.uiConfig().invertColor)("waypoints",i.skres.waypoints())("activeWaypoint",i.app.data.activeWaypoint)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",600),h(),T("darkMode",i.app.uiConfig().invertColor)("targets",i.dfeat.atons)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("updateIds",i.skstream.aisStatus().updated)("staleIds",i.skstream.aisStatus().stale)("removeIds",i.skstream.aisStatus().expired)("inactiveTime",i.app.config.vessels.aisStaleAge)("zIndex",200),h(),T("darkMode",i.app.uiConfig().invertColor)("targets",i.dfeat.atons)("targetStyles",i.featureStyles.basestation)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("updateIds",i.skstream.aisStatus().updated)("staleIds",i.skstream.aisStatus().stale)("removeIds",i.skstream.aisStatus().expired)("inactiveTime",i.app.config.vessels.aisStaleAge)("zIndex",210),h(),F(i.app.config.ui.showAisTargets?40:-1),h(),F(i.app.config.ui.showAisTargets?41:-1),h(),F(i.app.config.ui.showAisTargets?42:-1),h(),F(i.app.config.ui.showAisTargets?43:-1),h(),T("startLine",i.app.data.racing.startLine)("racecourseStyles",i.featureStyles.raceCourse)("darkMode",i.app.uiConfig().invertColor)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",540),h(),T("regions",i.skres.regions())("regionStyles",i.featureStyles.region)("darkMode",i.app.uiConfig().invertColor)("labelMinZoom",i.app.config.map.labelsMinZoom)("mapZoom",i.mapZoomLevel())("zIndex",400),h(),F(i.showNoteslayer()?46:-1),h(),F(i.overlay().show&&!i.mapInteract.isModifying()?47:-1),h(),F(i.anchor.raised()?-1:48),h(),F(i.dfeat.closest.length!==0?49:-1),h(),T("alarms",i.notiMgr.mobAlerts())("alarmStyles",i.featureStyles.alarm)("zIndex",310),h(),F(i.anchor.raised()&&i.dfeat.navData.position?51:-1),h(),F(i.app.config.vessels.rangeCircles?52:-1),h(),F(i.app.config.vessels.cogLine!==0?53:-1),h(),F(i.app.config.vessels.windVectors?54:-1),h(),T("position",i.dfeat.self.position)("heading",i.dfeat.self.orientation)("id",""+i.app.data.selfId)("activeId",i.app.data.vessels.activeId)("vesselLines",i.vesselLines())("iconScale",i.app.config.vessels.iconScale)("fixedLocation",i.app.config.vessels.fixedLocationMode)("zIndex",999),h(),F(i.app.config.vessels.trail&&i.app.data.vessels.showSelf?56:-1),h(),F(i.app.data.chartBounds.show?57:-1),h(),Mi("left",i.contextMenuPosition.x)("top",i.contextMenuPosition.y),T("matMenuTriggerFor",r)}},dependencies:[ze,$e,Ur,_p,me,he,ge,$s,ft,Wa,ha,Ea,lK,Ga,fv,oy,Lh,Rh,ct,ry,Fh,my,gy,_y,by,yy,vy,Gh,Cy,Wy,Uy,Hy,Gy,$y,qy,Ky,Xy,Yy,Zy,Qy,Jy,ev,iv,nv,tv,rv,ov,av,sv,lv,cv,dv,uv,pv,oa,Ok,Rk,Nk,Lk,Fk,Dk,Tk,Ak,Cr],styles:[".mapButton[_ngcontent-%COMP%]{position:fixed;z-index:4000}.control[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-start;margin:20px}.ol-mouse-position[_ngcontent-%COMP%]{width:100%;top:unset;bottom:10px;left:unset;right:unset;text-align:center;color:#1e1e1e;font-family:roboto}.ol-zoom[_ngcontent-%COMP%]{position:fixed;top:10px;left:60px;color:#1e1e1e;font-family:roboto;background-color:transparent;height:45px} .ol-dragbox{background-color:#fff6!important;border-color:#649600!important;border-style:solid;border-width:1px}.nosmall[_ngcontent-%COMP%]{display:block}@media only screen and (max-width:400px){.nosmall[_ngcontent-%COMP%]{display:none}.ol-mouse-position[_ngcontent-%COMP%]{bottom:2px}}"]})};var iA=class{symDegree="\xBA";availableUnits={distance:new Map([["m","Kilometres"],["ft","Nautical Miles"]]),depth:new Map([["m","metres"],["ft","feet"]]),speed:new Map([["kn","knots"],["msec","m/sec"],["kmh","km/h"],["mph","mph"]]),temperature:new Map([["c","Celsius"],["f","Fahrenheit"]])};preferredValues={heading:[["navigation.headingTrue","True"],["navigation.headingMagnetic","Magnetic"]],wind:new Map([[!1,"Wind True"],[!0,"Wind Apparent"]]),coords:[["XY","-128.12345"],["SHDd",`W-128.12345${this.symDegree}`],["DMdH",`128${this.symDegree} 15.34567' W`],["HDd",`W 128.12345${this.symDegree}`],["HDMS",`W 128${this.symDegree}15'46"123`],["DHMS",`128W15'46"123`]]};buttons={fab:new Map([["wpt","Waypoint at vessel"],["pob","Person Overboard"],["autopilot","Autopilot Console"]])};map={centerOffset:new Map([[0,"0%"],[.2,"20%"],[.3,"30%"],[.5,"50%"],[.7,"70%"]]),s57:{graphicsStyle:new Map([["Simplified","Simplified"],["Paper","Paper chart"]]),boundaries:new Map([["Symbolized","Symbolized"],["Plain","Plain"]]),colors:[2,4],shallowDepth:2,safetyDepth:3,deepDepth:6,colorTables:new Map([[0,"Day Bright"],[1,"Day Black Background"],[2,"Day White Background"],[3,"Dusk"],[4,"Night"]])}};trailIntervals={highResolution:new Map([["1s","1 sec"],["5s","5 secs"],["10s","10 secs"],["30s","30 secs"],["1m","1 min"]]),mediumResolution:new Map([["10s","10 secs"],["30s","30 secs"],["1m","1 min"],["2m","2 mins"],["5m","5 mins"],["10m","10 mins"],["15m","15 mins"],["30m","30 mins"]])};alarm={smoothing:new Map([[5e3,"5 secs"],[1e4,"10 secs"],[2e4,"20 secs"],[3e4,"30 secs"]])};darkMode=new Map([[0,"Use OS setting"],[1,"Use Signal K Mode"],[-1,"On"]]);vessel={selfIconScale:new Map([[.75,"S"],[.9,"M"],[1.15,"L"],[1.4,"XL"]]),headingLine:new Map([[-1,"Default"],[1,"1 NM (2km)"],[2,"2 NM (4km)"],[5,"5 NM (10km)"],[10,"10 NM (20km)"],[15,"15 NM (30km)"],[20,"20 NM (40km)"],[50,"50 NM (90km)"],[100,"100 NM (180km)"]]),cogLine:new Map([[0,"None"],[5,"5 min"],[10,"10 min"],[30,"30 min"],[60,"60 min"],[120,"2 hrs"],[1440,"24 hrs"]]),aisTimeouts:new Map([[6e4,"1 min"],[12e4,"2 min"],[18e4,"3 min"],[36e4,"6 min"],[54e4,"9 min"],[15*6e4,"15 min"],[30*6e4,"30 min"],[60*6e4,"1 hr"],[1440*6e4,"24 hrs"]]),aisMaxRadius:new Map([[0,"None"],[1e4,"5 NM (10km)"],[2e4,"10 NM (20km)"],[3e4,"15 NM (30km)"],[4e4,"20 NM (40km)"],[5e4,"25 NM (50km)"],[75e3,"40 NM (75km)"],[1e5,"55 NM (100km)"]]),aisCogLine:new Map([[0,"Off"],[10,"10 min"],[30,"30 min"],[60,"60 min"]])};rangeCircles={count:[4,5,6,7,8,9,10,15,20]};course={nextPointTrigger:["perpendicularPassed","arrivalCircleEntered"],nextPointDelay:this.alarm.smoothing};resources={noteRadius:[5,10,20,50,100,150,200,500],resSetRadius:[0,5,10,20,50,100,150,200,500]};zoomLevels=[8,9,10,11,12,13,14,15,16,17]},Cu=class n{constructor(t,e){this.app=t;this.signalk=e;this.changeEvent=new ie,this.change$=this.changeEvent.asObservable(),this.data=this.app.data,this.settings=this.app.config,this.fixedPosition=this.settings.vessels.fixedPosition.slice()}applicationList=[];favouritesList=[];resourcePathList=[];fixedPosition=[0,0];settings;data;changeEvent;change$;emitChangeEvent(t){let e=t?[t]:[];this.changeEvent.next(e)}clearToken(){this.app.persistToken(null)}refresh(){this.settings=this.app.config,this.fixedPosition=this.settings.vessels.fixedPosition.slice(),this.getApps(),this.getResourcePaths()}getResourcePaths(){this.signalk.api.get(this.app.skApiVersion,"resources").subscribe(t=>{this.resourcePathList=Object.keys(t).filter(e=>!this.app.IGNORE_RESOURCES.includes(e)).sort()},()=>this.resourcePathList=[])}getApps(){this.app.config.display.plugins.instruments&&this.applicationList.push(this.app.config.display.plugins.instruments),this.signalk.apps.list().subscribe(t=>{this.applicationList=t.map(e=>{if(e.name==="@signalk/freeboard-sk")return null;if(!e._location&&!e.location)return{name:e.name,description:e.description,url:`/${e.name}`};if(typeof e._location<"u"){let i=e._location.indexOf("/signalk-server/");return{name:e.name,description:e.description,url:i===-1?e._location:e._location.slice(15)}}else if(typeof e.location<"u")return{name:e.name,description:e.description,url:e.location}}).filter(e=>e),this.applicationList.unshift({name:"None",description:"",url:null}),this.buildFavouritesList()},()=>{this.app.debug("ERROR retrieving AppList!")})}buildFavouritesList(){this.favouritesList=this.applicationList.slice(1);let t=this.app.config.display.plugins.favourites.indexOf(this.app.config.display.plugins.instruments)}applySettings(){this.app.debug("Saving Settings.."),this.app.config.vessels.trail||(this.app.config.vessels.trailFromServer=!1),typeof this.fixedPosition[0]=="number"&&typeof this.fixedPosition[1]=="number"&&(this.settings.vessels.fixedPosition=this.fixedPosition.slice(),this.settings.vessels.fixedLocationMode&&(this.app.data.vessels.self.position=this.fixedPosition.slice())),this.app.saveConfig()}static \u0275fac=function(e){return new(e||n)(je(Ie),je(bi))};static \u0275prov=ce({token:n,factory:n.\u0275fac,providedIn:"root"})};var cje=(n,t)=>t[0];function dje(n,t){if(n&1){let e=H();u(0,"div",4)(1,"mat-radio-button",5,0),M("change",function(){C(e);let r=pe(2),o=y().$implicit,a=y();return o[1].current=r.value,x(a.save(!0))}),_(3),p()()}if(n&2){let e=t.$implicit,i=y().$implicit;h(),T("name",i[0])("value",e)("checked",e===i[1].current),h(2),Z(" ",e.split(".").slice(-1)," ")}}function uje(n,t){if(n&1&&(u(0,"div",2)(1,"div",3)(2,"div"),_(3),p()(),u(4,"div"),ye(5,dje,4,4,"div",4,rt),p()()),n&2){let e=t.$implicit;h(3),K(e[1].name),h(2),ve(e[1].available)}}var nA=class n{constructor(t){this.app=t}title="";chosen=new q;pathChoices={tws:{name:"True Wind Speed",choices:["environment.wind.speedTrue","environment.wind.speedOverGround"],available:[],current:""},twd:{name:"True Wind Direction",choices:["environment.wind.directionTrue","environment.wind.directionMagnetic","environment.wind.angleTrueGround","environment.wind.angleTrueWater"],available:[],current:""},heading:{name:"Heading / COG",choices:["navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.headingTrue","navigation.headingMagnetic"],available:[],current:""}};pathChoicesArray=Object.entries(this.pathChoices);availPaths;ngOnInit(){this.initEntries()}initEntries(){this.availPaths=new Map(Object.entries(this.app.data.vessels.prefAvailablePaths)),this.pathChoices.tws.current=this.app.config.units.preferredPaths.tws,this.pathChoices.twd.current=this.app.config.units.preferredPaths.twd,this.pathChoices.heading.current=this.app.config.units.preferredPaths.heading,Object.entries(this.pathChoices).forEach(e=>{let i=e[1];i.choices.forEach(r=>{this.availPaths.has(r)&&i.available.push(r)}),i.available.length===0&&i.available.push(i.choices[0])})}save(t){let e={};Object.entries(this.pathChoices).forEach(i=>{e[i[0]]=i[1].current}),this.chosen.emit({save:t,value:e})}static \u0275fac=function(e){return new(e||n)(N(Ie))};static \u0275cmp=U({type:n,selectors:[["signalk-preferred-paths"]],inputs:{title:"title"},outputs:{chosen:"chosen"},decls:6,vars:1,consts:[["pathopt",""],[2,"font-size","10pt"],[1,"sk-details"],[1,"title"],[2,"margin","5px 0 5px 0"],[3,"change","name","value","checked"]],template:function(e,i){e&1&&(u(0,"fieldset")(1,"legend",1),_(2),p(),u(3,"div"),ye(4,uje,7,1,"div",2,cje),p()()),e&2&&(h(2),K(i.title),h(2),ve(i.pathChoicesArray))},dependencies:[bb,_b],styles:[".sk-details[_ngcontent-%COMP%]{position:relative;display:flex;flex-direction:column;font-family:Roboto,Arial,Helvetica,sans-serif;font-size:10pt;max-height:100%;width:60vw;max-width:300px}.sk-details[_ngcontent-%COMP%] .title[_ngcontent-%COMP%]{background:left 1px -webkit-gradient(linear,left top,left bottom,from(rgba(0,0,0,.18)),color-stop(.65,transparent)) #b2bbc2e3;padding:3px 5px 0;margin-top:3px;font-weight:500;line-height:23px;color:#000}.sk-details[_ngcontent-%COMP%] .content[_ngcontent-%COMP%]{padding:0;line-height:23px;margin:0;flex:1 1 auto;overflow:auto}.sk-details[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{display:flex;flex-direction:row;line-height:26px;border-width:0 0 0 0;border-style:solid;border-color:gray;padding-left:5px}.sk-details[_ngcontent-%COMP%] .content[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{border-width:0 0 1px 0}.sk-details[_ngcontent-%COMP%] .sectionname[_ngcontent-%COMP%]{text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;font-weight:500}.sk-details[_ngcontent-%COMP%] .pathvalue[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;width:100%;background-color:#fff}.sk-details[_ngcontent-%COMP%] .pathvalue[_ngcontent-%COMP%] .path[_ngcontent-%COMP%]{text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-style:italic}.sk-details[_ngcontent-%COMP%] .pathvalue[_ngcontent-%COMP%] .value[_ngcontent-%COMP%]{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"],changeDetection:0})};var yo=(n,t)=>t[0];function pje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function fje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function hje(n,t){if(n&1&&(u(0,"mat-option",102),_(1),p()),n&2){let e=t.$implicit;T("value",e.url)("matTooltip",e.description),h(),Z(" ",e.name," ")}}function mje(n,t){if(n&1){let e=H();u(0,"div",39)(1,"div",32)(2,"mat-form-field",33)(3,"mat-label"),_(4,"Select Instruments App"),p(),u(5,"mat-select",45),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.display.plugins.instruments,r)||(o.facade.settings.display.plugins.instruments=r),x(r)}),M("selectionChange",function(){C(e);let r=y();return x(r.onInstrumentApp())}),ye(6,hje,2,3,"mat-option",102,rt),p()()(),u(8,"div",32)(9,"mat-form-field",78)(10,"mat-label"),_(11,"Parameters"),p(),u(12,"input",103,16),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.display.plugins.parameters,r)||(o.facade.settings.display.plugins.parameters=r),x(r)}),M("change",function(){C(e);let r=y();return x(r.persistModel("pluginParameters"))}),p()()(),u(14,"div",32)(15,"mat-checkbox",104),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.display.plugins.startOnOpen,r)||(o.facade.settings.display.plugins.startOnOpen=r),x(r)}),M("change",function(){C(e);let r=y();return x(r.persistModel("pluginStartOnOpen"))}),_(16," Halt App on hide "),p()(),u(17,"div",32)(18,"button",105),M("click",function(){C(e);let r=y();return x(r.toggleFavourites())}),u(19,"mat-icon"),_(20,"star"),p(),_(21," FAVOURITES "),p()()()}if(n&2){let e=y();h(5),Se("ngModel",e.facade.settings.display.plugins.instruments),h(),ve(e.facade.applicationList),h(6),T("disabled",e.facade.settings.display.plugins.instruments===null),Se("ngModel",e.facade.settings.display.plugins.parameters),h(3),Se("ngModel",e.facade.settings.display.plugins.startOnOpen)}}function gje(n,t){if(n&1&&(u(0,"mat-list-option",107),_(1),p()),n&2){let e=t.$implicit,i=y(2);T("disabled",e.url==i.facade.settings.display.plugins.instruments)("selected",i.facade.settings.display.plugins.favourites.includes(e.url))("value",e.url),h(),Z(" ",e.name," ")}}function _je(n,t){if(n&1){let e=H();u(0,"div",31)(1,"div",32)(2,"div",84),B(3,"br"),_(4,"Select Favourite Apps: "),p(),B(5,"mat-divider"),u(6,"mat-selection-list",106,17),M("selectionChange",function(r){C(e);let o=pe(7),a=y();return x(a.onFavSelected(r,o))}),ye(8,gje,2,4,"mat-list-option",107,rt),p()()()}if(n&2){let e=y();h(8),ve(e.facade.favouritesList)}}function bje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function yje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function vje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Cje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function xje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function wje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Mje(n,t){if(n&1){let e=H();u(0,"div",32)(1,"mat-form-field",33)(2,"mat-label"),_(3,"Position display format"),p(),u(4,"mat-select",108),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.units.positionFormat,r)||(o.facade.settings.units.positionFormat=r),x(r)}),M("selectionChange",function(){C(e);let r=y();return x(r.persistModel())}),ye(5,wje,2,2,"mat-option",35,rt),p()()()}if(n&2){let e=y();h(4),Se("ngModel",e.facade.settings.units.positionFormat),h(),ve(e.options.preferredValues.coords)}}function Sje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Eje(n,t){if(n&1){let e=H();u(0,"div",32)(1,"mat-form-field",33)(2,"mat-label"),_(3,"Prefer True / Magnetic values"),p(),u(4,"mat-select",109),Ee("ngModelChange",function(r){C(e);let o=y();return De(o.facade.settings.units.headingAttribute,r)||(o.facade.settings.units.headingAttribute=r),x(r)}),M("selectionChange",function(){C(e);let r=y();return x(r.persistModel("headingAttribute"))}),ye(5,Sje,2,2,"mat-option",35,rt),p()()()}if(n&2){let e=y();h(4),Se("ngModel",e.facade.settings.units.headingAttribute),h(),ve(e.options.preferredValues.heading)}}function Dje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Tje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Ije(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function kje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Pje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Aje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a positive number "),p())}function Oje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a positive number "),p())}function Rje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a positive number "),p())}function Lje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a number > 0 "),p())}function Fje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Nje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Vje(n,t){if(n&1&&(u(0,"mat-radio-button",35),B(1,"img",110),_(2),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),z0(`transform: scale(${e[0]})`),h(),Z(" (",e[1],") ")}}function Bje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a value between -90 and 90 (max 9 decimals) "),p())}function jje(n,t){n&1&&(u(0,"mat-error"),_(1," Please enter a value between -180 and 180 (max 9 decimals) "),p())}function zje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Uje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Hje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Gje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Wje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function $je(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function qje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Kje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Xje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Yje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Zje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function Qje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function Jje(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function eze(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e),h(),K(e)}}function tze(n,t){if(n&1){let e=H();u(0,"button",111),M("click",function(){C(e),y();let r=pe(437);return x(r.value="")}),u(1,"mat-icon"),_(2,"close"),p()()}}function ize(n,t){if(n&1&&(u(0,"mat-list-option",86),_(1),p()),n&2){let e=t.$implicit,i=y();T("selected",i.facade.settings.resources.paths.includes(e))("value",e),h(),Z(" ",e," ")}}function nze(n,t){if(n&1&&(u(0,"mat-option",35),_(1),p()),n&2){let e=t.$implicit;T("value",e[0]),h(),K(e[1])}}function rze(n,t){n&1&&(u(0,"mat-error"),_(1," Value required. "),p())}function oze(n,t){n&1&&(u(0,"mat-error"),_(1," Value required. "),p())}var rA=class n{constructor(t,e,i,r,o){this.facade=t;this.myElement=e;this.dialogRef=i;this.wakeLock=r;this.s57=o;this.options=new iA}show={favourites:oe(!1)};options;aisStateFilter={moored:!1,anchored:!1};saveOnClose=!1;ngOnInit(){this.facade.refresh(),this.facade.settings.selections.aisState.forEach(t=>{t in this.aisStateFilter&&(this.aisStateFilter[t]=!0)})}handleClose(){this.saveOnClose&&this.persistModel(),this.dialogRef.close()}doWakelock(t){this.persistModel(),t?this.wakeLock.disable():this.wakeLock.enable()}doS57(t){t?this.parseNumber(t):this.persistModel(),this.s57.SetOptions(this.facade.settings.map.s57Options)}toggleFavourites(){this.show.favourites.update(t=>!t)}parseNumber(t,e){if(typeof t.model!="number"){t.reset(this.fallbackToDefault());return}!e&&t.model<0&&t.reset(Math.abs(t.model)),this.persistModel()}fallbackToDefault(){let t=fC();if(typeof this.facade.settings.map.s57Options.shallowDepth!="number")return t.map.s57Options.shallowDepth;if(typeof this.facade.settings.map.s57Options.safetyDepth!="number")return t.map.s57Options.safetyDepth;if(typeof this.facade.settings.map.s57Options.deepDepth!="number")return t.map.s57Options.deepDepth;if(typeof this.facade.fixedPosition[0]!="number"||typeof this.facade.fixedPosition[1]!="number")return 0;if(typeof this.facade.settings.course.arrivalCircle!="number")return t.course.arrivalCircle}persistModel(t){this.facade.applySettings(),this.facade.emitChangeEvent(t)}deferPersist(t){this.saveOnClose=!0,this.facade.emitChangeEvent(t)}onInstrumentApp(){this.persistModel("pluginInstruments"),this.facade.buildFavouritesList()}onPreferredPaths(t){t.save&&(this.facade.settings.units.preferredPaths=t.value,this.persistModel())}onFavSelected(t,e){this.facade.settings.display.plugins.favourites=e.selectedOptions.selected.map(i=>i.value),this.persistModel()}onAisStateFilter(){let t=[];for(let e in this.aisStateFilter)this.aisStateFilter[e]&&t.push(e);this.facade.settings.selections.aisState=[].concat(t),this.persistModel()}onResPathSelected(t){this.facade.settings.resources.paths=t.selectedOptions.selected.map(e=>e.value),this.facade.settings.resources.paths.forEach(e=>{e in this.facade.settings.selections.resourceSets||(this.facade.settings.selections.resourceSets[e]=[])}),this.persistModel()}clearAuthToken(){this.facade.clearToken()}static \u0275fac=function(e){return new(e||n)(N(Cu),N(Oe),N(Gt),N(P_),N(gf))};static \u0275cmp=U({type:n,selectors:[["settings-dialog"]],decls:539,vars:99,consts:[["distunits",""],["s57shallowDepth","ngModel"],["s57safetyDepth","ngModel"],["s57deepDepth","ngModel"],["coursearrivalcircle","ngModel"],["courseautoadvance",""],["courseautoadvanceon",""],["vesselfixedlocationmode",""],["fixedlat","ngModel"],["fixedlon","ngModel"],["notesrootfilter",""],["respath",""],["skmaxradius",""],["videourl","ngModel"],["experiments",""],["featureserverurl","ngModel"],["instparams","ngModel"],["favs",""],[2,"background-color","transparent"],[1,"dialog-icon"],[2,"flex","1 1 auto","text-align","center"],[2,"text-align","right"],["mat-icon-button","",3,"click"],["mat-dialog-content","",2,"display","flex"],["dynamicHeight","false","mat-stretch-tabs","false","mat-align-tabs","start"],["label","Display"],[1,"theme-page","settings"],[1,"theme-panel"],["id","sectDisplay",1,"setting-group"],[1,"setting-group-title"],[1,"setting-card"],[1,"setting-card-row",2,"padding-bottom","10px"],[1,"setting-card-row-item"],[2,"width","100%"],["matTooltip","Dark Mode setting.",3,"ngModelChange","selectionChange","ngModel"],[3,"value"],["label","after","matTooltip","Auto-set using environment.mode value.",3,"ngModelChange","change","ngModel"],["matTooltip","Action button selection.",3,"ngModelChange","selectionChange","ngModel"],["label","after","matTooltip","Disable wake lock.",3,"ngModelChange","change","disabled","ngModel"],[1,"setting-card-row"],["matTooltip","Do not play sounds","label","after",3,"ngModelChange","change","ngModel"],["label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Period of time out of alarm state before re-triggering.",3,"ngModelChange","selectionChange","ngModel","disabled"],["label","Units"],["id","sectUnits",1,"setting-group"],[3,"ngModelChange","selectionChange","ngModel"],["title","Preferred Paths",3,"chosen"],["label","Map"],["id","sectMap",1,"setting-group"],["matTooltip","Add close button to popovers","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Double Click map to zoom","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Do not exit follow vessel when map is panned.","label","after",3,"ngModelChange","change","ngModel"],["placeholder","Graphicsstyle",3,"ngModelChange","selectionChange","ngModel"],["placeholder","Boundaries",3,"ngModelChange","selectionChange","ngModel"],["placeholder","Colors",3,"ngModelChange","selectionChange","ngModel"],["matInput","","type","number","required","","min","0",3,"ngModelChange","change","ngModel"],["matSuffix",""],["label","Course"],["id","sectCourse",1,"setting-group"],["matTooltip","Select the trigger for advancing to next point.",3,"ngModelChange","selectionChange","disabled","ngModel"],["matTooltip","Period of time before destination is advanced to next waypoint.",3,"ngModelChange","selectionChange","disabled","ngModel"],["label","Vessels"],["id","sectVessels",1,"setting-group"],[3,"ngModelChange","change","ngModel"],["label","after","matTooltip","e.g. Building, Camp, etc.",3,"ngModelChange","change","ngModel"],["floatLabel","always"],["matInput","","type","number","required","","pattern","^-?([1-8]?[0-9])(\\.\\d{1,9})?$","min","-90","max","90",3,"ngModelChange","change","ngModel","disabled"],["matInput","","type","number","required","","pattern","^-?(1[0-7]?[0-9]|[1-9]?[0-9])(\\.\\d{1,9})?$","min","-180","max","180",3,"ngModelChange","change","ngModel","disabled"],["matTooltip","Length of heading line.",3,"ngModelChange","selectionChange","ngModel"],["matTooltip","Length of COG line.",3,"ngModelChange","selectionChange","ngModel"],[3,"ngModelChange","selectionChange","ngModel","disabled"],["matTooltip","Select to source trail data from the server","label","after",3,"ngModelChange","change","disabled","ngModel"],["discrete","","tickInterval","1","min","1","max","96",3,"disabled"],["matSliderThumb","",3,"ngModelChange","valueChange","ngModel"],["label","Resources"],["id","sectNotes",1,"setting-group"],[3,"valueChange","selectionChange","disabled","value"],[3,"ngModelChange","selectionChange","disabled","ngModel"],["floatLabel","always",2,"width","100%"],["matInput","","type","text","placeholder","?radius=%note:radius%","matTooltip","Filter to apply when retrieving notes",3,"ngModelChange","change","ngModel"],["matSuffix","","mat-icon-button",""],["matTooltip","Allow group name editing.","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Require position information when adding notes to a group.","label","after",3,"ngModelChange","change","ngModel"],["id","sectResLayers",1,"setting-group"],[2,"font-style","italic"],["matTooltip","Select resource layers to show.",3,"selectionChange"],[3,"selected","value"],["label","Signal K"],["id","sectSKConnection",1,"setting-group"],[2,"font-size","smaller"],["matToolTip","Check to receive other vessel data","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Check to receive AtoN data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matTooltip","Check to receive aircraft data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Check to receive SaR data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Check to receive Weather / Meteo data","matTooltipPosition","below","label","after",3,"ngModelChange","change","ngModel"],["matToolTip","Only include AIS targets within this distance","matTooltipPosition","below",3,"ngModelChange","selectionChange","ngModel"],["mat-icon-button","","matTooltip","Clear Auth Token",3,"click"],["label","Experiments"],["id","sectExperiments",1,"setting-group"],["matInput","","type","text","required","","placeholder","Video stream URL","matTooltip","Enter URL of video stream",3,"ngModelChange","change","disabled","ngModel"],["matTooltip","Enable ALL experimental Features","label","after",3,"ngModelChange","change","ngModel"],["matInput","","type","text","placeholder","e.g. http://host:port/path/?position=[%pointer:longitude%,%pointer:latitude%]","matTooltip","Enter URL of feature server",3,"ngModelChange","change","disabled","ngModel"],["matTooltipPosition","right",3,"value","matTooltip"],["matInput","","type","text","placeholder","e.g. ?layout=mylayout","matTooltip","Enter parameters to pass to Instrument App",3,"ngModelChange","change","disabled","ngModel"],["matTooltip","Stop instrument app when hidden","label","after",3,"ngModelChange","change","ngModel"],["mat-raised-button","","matTooltip","Favourite Apps","label","after",3,"click"],[3,"selectionChange"],[3,"disabled","selected","value"],["matTooltip","Display position in this format",3,"ngModelChange","selectionChange","ngModel"],["matTooltip","Preferred value type for paths not in Preferred Paths above",3,"ngModelChange","selectionChange","ngModel"],["src","./assets/img/vessels/self.png"],["matSuffix","","mat-icon-button","",3,"click"]],template:function(e,i){if(e&1){let r=H();u(0,"mat-toolbar",18)(1,"span",19)(2,"mat-icon"),_(3,"settings"),p()(),u(4,"span",20),_(5,"Settings"),p(),u(6,"span",21)(7,"button",22),M("click",function(){return C(r),x(i.handleClose())}),u(8,"mat-icon"),_(9,"close"),p()()()(),u(10,"div",23)(11,"mat-tab-group",24)(12,"mat-tab",25)(13,"div",26)(14,"div",27)(15,"div",28)(16,"div",29),_(17,"DISPLAY"),p(),u(18,"mat-card",30)(19,"mat-card-content")(20,"div",31)(21,"div",32)(22,"mat-form-field",33)(23,"mat-label"),_(24,"Dark Mode setting"),p(),u(25,"mat-select",34),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.darkMode.source,a)||(i.facade.settings.display.darkMode.source=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel("darkTheme"))}),ye(26,pje,2,2,"mat-option",35,yo),p()()(),u(28,"div",32)(29,"mat-checkbox",36),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.nightMode,a)||(i.facade.settings.display.nightMode=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(30," Auto-set Night Mode "),p()(),u(31,"div",32)(32,"mat-form-field",33)(33,"mat-label"),_(34,"Action Button"),p(),u(35,"mat-select",37),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.fab,a)||(i.facade.settings.display.fab=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(36,fje,2,2,"mat-option",35,yo),p()()(),u(38,"div",32)(39,"mat-checkbox",38),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.disableWakelock,a)||(i.facade.settings.display.disableWakelock=a),x(a)}),M("change",function(a){return C(r),x(i.doWakelock(a.checked))}),_(40," Allow Device to Sleep "),p()()()()(),B(41,"br"),u(42,"mat-card",30)(43,"mat-card-content"),R(44,mje,22,4,"div",39),R(45,_je,10,0,"div",31),p()(),B(46,"br"),p(),u(47,"div",28)(48,"div",29),_(49,"SOUND"),p(),u(50,"mat-card",30)(51,"mat-card-content")(52,"div",31)(53,"div",32)(54,"mat-checkbox",40),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.muteSound,a)||(i.facade.settings.display.muteSound=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(55," Do not Play Sounds "),p()(),u(56,"div",32)(57,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.depthAlarm.enabled,a)||(i.facade.settings.display.depthAlarm.enabled=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(58," Show DEPTH Alarms "),p()(),u(59,"div",32)(60,"mat-form-field",33)(61,"mat-label"),_(62,"Alarm Smoothing Time"),p(),u(63,"mat-select",42),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.display.depthAlarm.smoothing,a)||(i.facade.settings.display.depthAlarm.smoothing=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(64,bje,2,2,"mat-option",35,yo),p()()()()()()()()()(),u(66,"mat-tab",43)(67,"div",26)(68,"div",27)(69,"div",44)(70,"div",29),_(71,"UNITS & VALUES"),p(),u(72,"mat-card",30)(73,"mat-card-content")(74,"div",31)(75,"div",32)(76,"mat-form-field",33)(77,"mat-label"),_(78,"Distance units"),p(),u(79,"mat-select",45,0),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.distance,a)||(i.facade.settings.units.distance=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(81,yje,2,2,"mat-option",35,yo),p()()(),u(83,"div",32)(84,"mat-form-field",33)(85,"mat-label"),_(86,"Depth units"),p(),u(87,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.depth,a)||(i.facade.settings.units.depth=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(88,vje,2,2,"mat-option",35,yo),p()()(),u(90,"div",32)(91,"mat-form-field",33)(92,"mat-label"),_(93,"Speed units"),p(),u(94,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.speed,a)||(i.facade.settings.units.speed=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(95,Cje,2,2,"mat-option",35,yo),p()()(),u(97,"div",32)(98,"mat-form-field",33)(99,"mat-label"),_(100,"Temperature units"),p(),u(101,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.units.temperature,a)||(i.facade.settings.units.temperature=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(102,xje,2,2,"mat-option",35,yo),p()()(),R(104,Mje,7,1,"div",32),R(105,Eje,7,1,"div",32),u(106,"div",32)(107,"signalk-preferred-paths",46),M("chosen",function(a){return C(r),x(i.onPreferredPaths(a))}),p()()()()()()()()(),u(108,"mat-tab",47)(109,"div",26)(110,"div",27)(111,"div",48)(112,"div",29),_(113,"MAP"),p(),u(114,"mat-card")(115,"mat-card-content")(116,"div",31)(117,"div",32)(118,"mat-form-field",33)(119,"mat-label"),_(120,"Feature label zoom level"),p(),u(121,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.labelsMinZoom,a)||(i.facade.settings.map.labelsMinZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(122,Dje,2,2,"mat-option",35,rt),p()()(),u(124,"div",32)(125,"mat-form-field",33)(126,"mat-label"),_(127,"Offset Vessel Center"),p(),u(128,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.centerOffset,a)||(i.facade.settings.map.centerOffset=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(129,Tje,2,2,"mat-option",35,yo),p()()(),u(131,"div",32)(132,"mat-checkbox",49),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.popoverMulti,a)||(i.facade.settings.map.popoverMulti=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(133," Popovers close with button "),p()(),u(134,"div",32)(135,"mat-checkbox",50),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.doubleClickZoom,a)||(i.facade.settings.map.doubleClickZoom=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(136," Double click to Zoom "),p()(),u(137,"div",32)(138,"mat-checkbox",51),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.lockMoveMap,a)||(i.facade.settings.map.lockMoveMap=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(139," Lock Follow Vessel "),p()()()()(),u(140,"div",29),_(141,"VECTOR CHARTS"),p(),u(142,"mat-card")(143,"mat-card-content")(144,"div",31)(145,"div",32)(146,"mat-form-field",33)(147,"mat-label"),_(148,"Graphics Style"),p(),u(149,"mat-select",52),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.graphicsStyle,a)||(i.facade.settings.map.s57Options.graphicsStyle=a),x(a)}),M("selectionChange",function(){return C(r),x(i.doS57())}),ye(150,Ije,2,2,"mat-option",35,yo),p()()(),u(152,"div",32)(153,"mat-form-field",33)(154,"mat-label"),_(155,"Boundaries"),p(),u(156,"mat-select",53),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.boundaries,a)||(i.facade.settings.map.s57Options.boundaries=a),x(a)}),M("selectionChange",function(){return C(r),x(i.doS57())}),ye(157,kje,2,2,"mat-option",35,yo),p()()(),u(159,"div",32)(160,"mat-form-field",33)(161,"mat-label"),_(162,"Colors"),p(),u(163,"mat-select",54),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.colors,a)||(i.facade.settings.map.s57Options.colors=a),x(a)}),M("selectionChange",function(){return C(r),x(i.doS57())}),ye(164,Pje,2,2,"mat-option",35,rt),p()()()(),u(166,"div",31)(167,"div",32)(168,"mat-form-field",33)(169,"mat-label"),_(170,"Shallow depth"),p(),u(171,"input",55,1),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.shallowDepth,a)||(i.facade.settings.map.s57Options.shallowDepth=a),x(a)}),M("change",function(){C(r);let a=pe(172);return x(i.doS57(a))}),p(),R(173,Aje,2,0,"mat-error"),u(174,"span",56),_(175,"m"),p()()(),u(176,"div",32)(177,"mat-form-field",33)(178,"mat-label"),_(179,"Safety depth"),p(),u(180,"input",55,2),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.safetyDepth,a)||(i.facade.settings.map.s57Options.safetyDepth=a),x(a)}),M("change",function(){C(r);let a=pe(181);return x(i.doS57(a))}),p(),R(182,Oje,2,0,"mat-error"),u(183,"span",56),_(184,"m"),p()()(),u(185,"div",32)(186,"mat-form-field",33)(187,"mat-label"),_(188,"Deep depth"),p(),u(189,"input",55,3),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.map.s57Options.deepDepth,a)||(i.facade.settings.map.s57Options.deepDepth=a),x(a)}),M("change",function(){C(r);let a=pe(190);return x(i.doS57(a))}),p(),R(191,Rje,2,0,"mat-error"),u(192,"span",56),_(193,"m"),p()()()()()()()()()(),u(194,"mat-tab",57)(195,"div",26)(196,"div",27)(197,"div",58)(198,"div",29),_(199,"COURSE"),p(),u(200,"mat-card",30)(201,"mat-card-content")(202,"div",31)(203,"div",32)(204,"mat-form-field",33)(205,"mat-label"),_(206,"Arrival Circle"),p(),u(207,"input",55,4),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.arrivalCircle,a)||(i.facade.settings.course.arrivalCircle=a),x(a)}),M("change",function(){C(r);let a=pe(208);return x(i.parseNumber(a))}),p(),R(209,Lje,2,0,"mat-error"),u(210,"span",56),_(211,"m"),p()()()(),u(212,"div",31)(213,"div",32)(214,"mat-checkbox",41,5),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.autoNextPointOnArrival,a)||(i.facade.settings.course.autoNextPointOnArrival=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(216," Auto-advance to next point on arrival "),p()()(),u(217,"div",31)(218,"div",32)(219,"mat-form-field",33)(220,"mat-label"),_(221,"Notification type to use"),p(),u(222,"mat-select",59,6),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.autoNextPointTrigger,a)||(i.facade.settings.course.autoNextPointTrigger=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(224,Fje,2,2,"mat-option",35,rt),p()()(),u(226,"div",32)(227,"mat-form-field",33)(228,"mat-label"),_(229,"Time to wait before advancing"),p(),u(230,"mat-select",60),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.course.autoNextPointDelay,a)||(i.facade.settings.course.autoNextPointDelay=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(231,Nje,2,2,"mat-option",35,yo),p()()()()()()()()()(),u(233,"mat-tab",61)(234,"div",26)(235,"div",27)(236,"div",62)(237,"div",29),_(238,"VESSEL"),p(),u(239,"mat-card",30)(240,"mat-card-content")(241,"div",31)(242,"div",32)(243,"fieldset")(244,"legend"),_(245,"Vessel Icon Size"),p(),u(246,"div",31)(247,"div",32)(248,"mat-radio-group",63),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.iconScale,a)||(i.facade.settings.vessels.iconScale=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),ye(249,Vje,3,4,"mat-radio-button",35,yo),p()()()()()(),u(251,"div",32)(252,"fieldset")(253,"legend")(254,"mat-checkbox",64,7),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.fixedLocationMode,a)||(i.facade.settings.vessels.fixedLocationMode=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(256," Fixed Location Mode "),p()(),u(257,"div",31)(258,"div",32)(259,"mat-form-field",65)(260,"mat-label"),_(261,"Latitude"),p(),u(262,"input",66,8),Ee("ngModelChange",function(a){return C(r),De(i.facade.fixedPosition[1],a)||(i.facade.fixedPosition[1]=a),x(a)}),M("change",function(){C(r);let a=pe(263);return x(i.parseNumber(a,!0))}),p(),R(264,Bje,2,0,"mat-error"),p(),u(265,"mat-form-field",65)(266,"mat-label"),_(267,"Longitude"),p(),u(268,"input",67,9),Ee("ngModelChange",function(a){return C(r),De(i.facade.fixedPosition[0],a)||(i.facade.fixedPosition[0]=a),x(a)}),M("change",function(){C(r);let a=pe(269);return x(i.parseNumber(a,!0))}),p(),R(270,jje,2,0,"mat-error"),p()()()()()()(),B(271,"br"),u(272,"mat-card",30)(273,"mat-card-content")(274,"div",32)(275,"fieldset")(276,"legend"),_(277,"Vessel Lines:"),p(),u(278,"div",31)(279,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.windVectors,a)||(i.facade.settings.vessels.windVectors=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(280," Display Wind Vectors "),p(),u(281,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.laylines,a)||(i.facade.settings.vessels.laylines=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(282," Display Laylines "),p()(),u(283,"div",31)(284,"div",32)(285,"mat-form-field",33)(286,"mat-label"),_(287,"Heading Line Length"),p(),u(288,"mat-select",68),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.headingLineSize,a)||(i.facade.settings.vessels.headingLineSize=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(289,zje,2,2,"mat-option",35,yo),p()()(),u(291,"div",32)(292,"mat-form-field",33)(293,"mat-label"),_(294,"COG Line Length"),p(),u(295,"mat-select",69),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.cogLine,a)||(i.facade.settings.vessels.cogLine=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(296,Uje,2,2,"mat-option",35,yo),p()()()(),u(298,"div",31)(299,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.rangeCircles,a)||(i.facade.settings.vessels.rangeCircles=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(300," Display Range Circles "),p()(),u(301,"div",31)(302,"div",32)(303,"mat-form-field",33)(304,"mat-label"),_(305,"Number of Range Circles"),p(),u(306,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.rangeCircleCount,a)||(i.facade.settings.vessels.rangeCircleCount=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(307,Hje,2,2,"mat-option",35,rt),p()()(),u(309,"div",32)(310,"mat-form-field",33)(311,"mat-label"),_(312,"Minimum Zoom Level"),p(),u(313,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.rangeCircleMinZoom,a)||(i.facade.settings.vessels.rangeCircleMinZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(314,Gje,2,2,"mat-option",35,rt),p()()()()()()()(),B(316,"br"),u(317,"mat-card",30)(318,"mat-card-content")(319,"div",31)(320,"fieldset")(321,"legend")(322,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trail,a)||(i.facade.settings.vessels.trail=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("vesselTrail"))}),_(323," Display Vessel Track "),p()(),u(324,"div",31)(325,"div",32)(326,"mat-checkbox",71),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailFromServer,a)||(i.facade.settings.vessels.trailFromServer=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("trailFromServer"))}),_(327," Get Track from server "),p(),_(328," \xA0\xA0 "),u(329,"mat-slider",72)(330,"input",73),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailDuration,a)||(i.facade.settings.vessels.trailDuration=a),x(a)}),M("valueChange",function(){return C(r),x(i.deferPersist())}),p()(),_(331),p()(),u(332,"div",31)(333,"div",32)(334,"mat-form-field",33)(335,"mat-label"),_(336,"Resolution: Last hour"),p(),u(337,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailResolution.lastHour,a)||(i.facade.settings.vessels.trailResolution.lastHour=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(338,Wje,2,2,"mat-option",35,yo),p()()(),u(340,"div",32)(341,"mat-form-field",33)(342,"mat-label"),_(343,"Resolution: 1 hr -> 24 hrs"),p(),u(344,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailResolution.next23,a)||(i.facade.settings.vessels.trailResolution.next23=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(345,$je,2,2,"mat-option",35,yo),p()()(),u(347,"div",32)(348,"mat-form-field",33)(349,"mat-label"),_(350,"Resolution: > 24 hrs"),p(),u(351,"mat-select",70),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.trailResolution.beyond24,a)||(i.facade.settings.vessels.trailResolution.beyond24=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(352,qje,2,2,"mat-option",35,yo),p()()()()()()()(),u(354,"div",29),_(355,"OTHER VESSELS"),p(),u(356,"mat-card",30)(357,"mat-card-content")(358,"div",31)(359,"div",32)(360,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisShowTrack,a)||(i.facade.settings.vessels.aisShowTrack=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(361," Show Track "),p(),_(362," \xA0 "),u(363,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.aisStateFilter.moored,a)||(i.aisStateFilter.moored=a),x(a)}),M("change",function(){return C(r),x(i.onAisStateFilter())}),_(364," Hide Moored "),p(),_(365," \xA0 "),u(366,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.aisStateFilter.anchored,a)||(i.aisStateFilter.anchored=a),x(a)}),M("change",function(){return C(r),x(i.onAisStateFilter())}),_(367," Hide Anchored "),p()()(),u(368,"div",31)(369,"div",32)(370,"mat-form-field",33)(371,"mat-label"),_(372,"Mark AIS target inactive after"),p(),u(373,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisStaleAge,a)||(i.facade.settings.vessels.aisStaleAge=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(374,Kje,2,2,"mat-option",35,yo),p()()(),u(376,"div",32)(377,"mat-form-field",33)(378,"mat-label"),_(379,"Remove AIS target after"),p(),u(380,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisMaxAge,a)||(i.facade.settings.vessels.aisMaxAge=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(381,Xje,2,2,"mat-option",35,yo),p()()(),u(383,"div",32)(384,"mat-form-field",33)(385,"mat-label"),_(386,"Wind Vector Value"),p(),u(387,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisWindApparent,a)||(i.facade.settings.vessels.aisWindApparent=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(388,Yje,2,2,"mat-option",35,yo),p()()(),u(390,"div",32)(391,"mat-form-field",33)(392,"mat-label"),_(393,"Wind / Track Zoom Level"),p(),u(394,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisWindMinZoom,a)||(i.facade.settings.vessels.aisWindMinZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(395,Zje,2,2,"mat-option",35,rt),p()()(),u(397,"div",32)(398,"mat-form-field",33)(399,"mat-label"),_(400,"COG Line"),p(),u(401,"mat-select",45),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.vessels.aisCogLine,a)||(i.facade.settings.vessels.aisCogLine=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(402,Qje,2,2,"mat-option",35,yo),p()()()()()()()()()(),u(404,"mat-tab",74)(405,"div",26)(406,"div",27)(407,"div",75)(408,"div",29),_(409,"NOTES"),p(),u(410,"mat-card",30)(411,"mat-card-content")(412,"div",39)(413,"div",32)(414,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.ui.showNotes,a)||(i.facade.settings.ui.showNotes=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(415," Display Notes on Map "),p()(),u(416,"div",32)(417,"mat-form-field",33)(418,"mat-label"),_(419,"Notes Zoom Level"),p(),u(420,"mat-select",76),Ee("valueChange",function(a){return C(r),De(i.facade.settings.resources.notes.minZoom,a)||(i.facade.settings.resources.notes.minZoom=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel("fetchNotes"))}),ye(421,Jje,2,2,"mat-option",35,rt),p()()()(),u(423,"div",39)(424,"div",32)(425,"mat-form-field",33)(426,"mat-label"),_(427),p(),u(428,"mat-select",77),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.getRadius,a)||(i.facade.settings.resources.notes.getRadius=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel("fetchNotes"))}),ye(429,eze,2,2,"mat-option",35,rt),p()()()(),u(431,"div",39)(432,"div",32)(433,"mat-form-field",78)(434,"mat-label"),_(435,"Notes fetch filter:"),p(),u(436,"input",79,10),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.rootFilter,a)||(i.facade.settings.resources.notes.rootFilter=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("fetchNotes"))}),p(),R(438,tze,3,0,"button",80),p()()(),u(439,"div",39)(440,"div",32)(441,"mat-checkbox",81),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.groupNameEdit,a)||(i.facade.settings.resources.notes.groupNameEdit=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(442," Edit Group Names "),p()(),u(443,"div",32)(444,"mat-checkbox",82),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.notes.groupRequiresPosition,a)||(i.facade.settings.resources.notes.groupRequiresPosition=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(445," Position Group Note "),p()()()()()(),u(446,"div",83)(447,"div",29),_(448,"CUSTOM RESOURCES"),p(),u(449,"mat-card",30)(450,"mat-card-content")(451,"div",39)(452,"div",32)(453,"div",84),_(454," Select custom resource types (./resources/<name>) "),p(),u(455,"mat-selection-list",85,11),M("selectionChange",function(){C(r);let a=pe(456);return x(i.onResPathSelected(a))}),ye(457,ize,2,3,"mat-list-option",86,rt),p()()()()()()()()(),u(459,"mat-tab",87)(460,"div",26)(461,"div",27)(462,"div",88)(463,"div",29),_(464,"SIGNAL K: CONNECTION"),p(),u(465,"mat-card",30)(466,"mat-card-content")(467,"div",39)(468,"fieldset")(469,"legend"),_(470,"Filter Stream data:"),p(),u(471,"span",89),_(472," Check to include Signal K schema groups on display."),B(473,"br"),u(474,"i"),_(475,"Use to manage display performance."),p()(),u(476,"div",32)(477,"mat-checkbox",90),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.vessels,a)||(i.facade.settings.signalk.vessels=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(478," Vessels (other than Self) "),p()(),u(479,"div",32)(480,"mat-checkbox",91),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.atons,a)||(i.facade.settings.signalk.atons=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(481," Aids to Navigation (AtoN) "),p()(),u(482,"div",32)(483,"mat-checkbox",92),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.aircraft,a)||(i.facade.settings.signalk.aircraft=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(484," Aircraft "),p()(),u(485,"div",32)(486,"mat-checkbox",93),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.sar,a)||(i.facade.settings.signalk.sar=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(487," Search and Rescue (SaR) "),p()(),u(488,"div",32)(489,"mat-checkbox",94),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.meteo,a)||(i.facade.settings.signalk.meteo=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(490," Weather (Meteo) "),p()(),u(491,"div",32),B(492,"br"),u(493,"mat-form-field",33)(494,"mat-label"),_(495,"Max. distance from vessel"),p(),u(496,"mat-select",95,12),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.signalk.maxRadius,a)||(i.facade.settings.signalk.maxRadius=a),x(a)}),M("selectionChange",function(){return C(r),x(i.persistModel())}),ye(498,nze,2,2,"mat-option",35,yo),p()()()()(),u(500,"div",39)(501,"div",32)(502,"button",96),M("click",function(){return C(r),x(i.clearAuthToken())}),u(503,"mat-icon"),_(504,"key_off"),p()()()()()()()()()(),u(505,"mat-tab",97)(506,"div",26)(507,"div",27)(508,"div",98)(509,"div",29),_(510,"EXPERIMENTS"),p(),u(511,"mat-card",30)(512,"mat-card-content")(513,"div",39)(514,"div",32)(515,"mat-checkbox",41),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.video.enable,a)||(i.facade.settings.resources.video.enable=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),_(516," Enable Video "),p()(),u(517,"div",32)(518,"mat-form-field",78)(519,"mat-label"),_(520,"url:"),p(),u(521,"input",99,13),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.video.url,a)||(i.facade.settings.resources.video.url=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("videoUrl"))}),p(),R(523,rze,2,0,"mat-error"),p()()(),u(524,"div",39)(525,"div",32)(526,"mat-checkbox",100,14),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.experiments,a)||(i.facade.settings.experiments=a),x(a)}),M("change",function(){return C(r),x(i.persistModel())}),u(528,"mat-icon"),_(529,"science"),p(),_(530," Experimental Features "),p()()(),u(531,"div",39)(532,"div",32)(533,"mat-form-field",78)(534,"mat-label"),_(535,"Feature Server url:"),p(),u(536,"input",101,15),Ee("ngModelChange",function(a){return C(r),De(i.facade.settings.resources.featureServer.url,a)||(i.facade.settings.resources.featureServer.url=a),x(a)}),M("change",function(){return C(r),x(i.persistModel("featureServerUrl"))}),p(),R(538,oze,2,0,"mat-error"),p()()()()()()()()()()()}if(e&2){let r=pe(80),o=pe(172),a=pe(181),s=pe(190),l=pe(208),c=pe(215),d=pe(255),f=pe(263),g=pe(269),m=pe(437),b=pe(522),v=pe(537);h(25),Se("ngModel",i.facade.settings.display.darkMode.source),h(),ve(i.options.darkMode),h(3),Se("ngModel",i.facade.settings.display.nightMode),h(6),Se("ngModel",i.facade.settings.display.fab),h(),ve(i.options.buttons.fab),h(3),T("disabled",!i.wakeLock.isAvailable),Se("ngModel",i.facade.settings.display.disableWakelock),h(5),F(i.facade.applicationList.length>1?44:-1),h(),F(i.show.favourites()?45:-1),h(9),Se("ngModel",i.facade.settings.display.muteSound),h(3),Se("ngModel",i.facade.settings.display.depthAlarm.enabled),h(6),Se("ngModel",i.facade.settings.display.depthAlarm.smoothing),T("disabled",!i.facade.settings.display.depthAlarm.enabled),h(),ve(i.options.alarm.smoothing),h(15),Se("ngModel",i.facade.settings.units.distance),h(2),ve(i.options.availableUnits.distance),h(6),Se("ngModel",i.facade.settings.units.depth),h(),ve(i.options.availableUnits.depth),h(6),Se("ngModel",i.facade.settings.units.speed),h(),ve(i.options.availableUnits.speed),h(6),Se("ngModel",i.facade.settings.units.temperature),h(),ve(i.options.availableUnits.temperature),h(2),F(i.options.preferredValues.coords.length!==0?104:-1),h(),F(i.options.preferredValues.heading.length!==0?105:-1),h(16),Se("ngModel",i.facade.settings.map.labelsMinZoom),h(),ve(i.options.zoomLevels),h(6),Se("ngModel",i.facade.settings.map.centerOffset),h(),ve(i.options.map.centerOffset),h(3),Se("ngModel",i.facade.settings.map.popoverMulti),h(3),Se("ngModel",i.facade.settings.map.doubleClickZoom),h(3),Se("ngModel",i.facade.settings.map.lockMoveMap),h(11),Se("ngModel",i.facade.settings.map.s57Options.graphicsStyle),h(),ve(i.options.map.s57.graphicsStyle),h(6),Se("ngModel",i.facade.settings.map.s57Options.boundaries),h(),ve(i.options.map.s57.boundaries),h(6),Se("ngModel",i.facade.settings.map.s57Options.colors),h(),ve(i.options.map.s57.colors),h(7),Se("ngModel",i.facade.settings.map.s57Options.shallowDepth),h(2),F(o.invalid&&(o.dirty||o.touched)?173:-1),h(7),Se("ngModel",i.facade.settings.map.s57Options.safetyDepth),h(2),F(a.invalid&&(a.dirty||a.touched)?182:-1),h(7),Se("ngModel",i.facade.settings.map.s57Options.deepDepth),h(2),F(s.invalid&&(s.dirty||s.touched)?191:-1),h(16),Se("ngModel",i.facade.settings.course.arrivalCircle),h(2),F(l.invalid&&(l.dirty||l.touched)?209:-1),h(5),Se("ngModel",i.facade.settings.course.autoNextPointOnArrival),h(8),T("disabled",c.checked===!1),Se("ngModel",i.facade.settings.course.autoNextPointTrigger),h(2),ve(i.options.course.nextPointTrigger),h(6),T("disabled",c.checked===!1),Se("ngModel",i.facade.settings.course.autoNextPointDelay),h(),ve(i.options.course.nextPointDelay),h(17),Se("ngModel",i.facade.settings.vessels.iconScale),h(),ve(i.options.vessel.selfIconScale),h(5),Se("ngModel",i.facade.settings.vessels.fixedLocationMode),h(8),Se("ngModel",i.facade.fixedPosition[1]),T("disabled",!d.checked),h(2),F(f.invalid&&(f.dirty||f.touched)?264:-1),h(4),Se("ngModel",i.facade.fixedPosition[0]),T("disabled",!d.checked),h(2),F(g.invalid&&(g.dirty||g.touched)?270:-1),h(9),Se("ngModel",i.facade.settings.vessels.windVectors),h(2),Se("ngModel",i.facade.settings.vessels.laylines),h(7),Se("ngModel",i.facade.settings.vessels.headingLineSize),h(),ve(i.options.vessel.headingLine),h(6),Se("ngModel",i.facade.settings.vessels.cogLine),h(),ve(i.options.vessel.cogLine),h(3),Se("ngModel",i.facade.settings.vessels.rangeCircles),h(7),Se("ngModel",i.facade.settings.vessels.rangeCircleCount),T("disabled",!i.facade.settings.vessels.rangeCircles),h(),ve(i.options.rangeCircles.count),h(6),Se("ngModel",i.facade.settings.vessels.rangeCircleMinZoom),T("disabled",!i.facade.settings.vessels.rangeCircles),h(),ve(i.options.zoomLevels),h(8),Se("ngModel",i.facade.settings.vessels.trail),h(4),T("disabled",!i.facade.settings.vessels.trail),Se("ngModel",i.facade.settings.vessels.trailFromServer),h(3),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),Se("ngModel",i.facade.settings.vessels.trailDuration),h(),Z(" Length (",i.facade.settings.vessels.trailDuration," hrs) "),h(6),Se("ngModel",i.facade.settings.vessels.trailResolution.lastHour),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),ve(i.options.trailIntervals.highResolution),h(6),Se("ngModel",i.facade.settings.vessels.trailResolution.next23),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),ve(i.options.trailIntervals.highResolution),h(6),Se("ngModel",i.facade.settings.vessels.trailResolution.beyond24),T("disabled",!i.facade.settings.vessels.trailFromServer||!i.facade.settings.vessels.trail),h(),ve(i.options.trailIntervals.mediumResolution),h(8),Se("ngModel",i.facade.settings.vessels.aisShowTrack),h(3),Se("ngModel",i.aisStateFilter.moored),h(3),Se("ngModel",i.aisStateFilter.anchored),h(7),Se("ngModel",i.facade.settings.vessels.aisStaleAge),h(),ve(i.options.vessel.aisTimeouts),h(6),Se("ngModel",i.facade.settings.vessels.aisMaxAge),h(),ve(i.options.vessel.aisTimeouts),h(6),Se("ngModel",i.facade.settings.vessels.aisWindApparent),h(),ve(i.options.preferredValues.wind),h(6),Se("ngModel",i.facade.settings.vessels.aisWindMinZoom),h(),ve(i.options.zoomLevels),h(6),Se("ngModel",i.facade.settings.vessels.aisCogLine),h(),ve(i.options.vessel.aisCogLine),h(12),Se("ngModel",i.facade.settings.ui.showNotes),h(6),T("disabled",!i.facade.settings.ui.showNotes),Se("value",i.facade.settings.resources.notes.minZoom),h(),ve(i.options.zoomLevels),h(6),K("Fetch Notes radius: ("+i.options.availableUnits.distance.get(r.value)+")"),h(),T("disabled",!i.facade.settings.ui.showNotes),Se("ngModel",i.facade.settings.resources.notes.getRadius),h(),ve(i.options.resources.noteRadius),h(7),Se("ngModel",i.facade.settings.resources.notes.rootFilter),h(2),F(m.value?438:-1),h(3),Se("ngModel",i.facade.settings.resources.notes.groupNameEdit),h(3),Se("ngModel",i.facade.settings.resources.notes.groupRequiresPosition),h(13),ve(i.facade.resourcePathList),h(20),Se("ngModel",i.facade.settings.signalk.vessels),h(3),Se("ngModel",i.facade.settings.signalk.atons),h(3),Se("ngModel",i.facade.settings.signalk.aircraft),h(3),Se("ngModel",i.facade.settings.signalk.sar),h(3),Se("ngModel",i.facade.settings.signalk.meteo),h(7),Se("ngModel",i.facade.settings.signalk.maxRadius),h(2),ve(i.options.vessel.aisMaxRadius),h(17),Se("ngModel",i.facade.settings.resources.video.enable),h(6),T("disabled",!i.facade.settings.resources.video.enable),Se("ngModel",i.facade.settings.resources.video.url),h(2),F(b.invalid?523:-1),h(3),Se("ngModel",i.facade.settings.experiments),h(10),T("disabled",!i.facade.settings.experiments),Se("ngModel",i.facade.settings.resources.featureServer.url),h(2),F(v.invalid?538:-1)}},dependencies:[Pt,dr,Fm,An,Do,nF,Nm,G1,En,ri,ni,Si,en,bb,hN,_b,ft,Ht,ci,Ur,Bm,Vm,_p,ge,st,tt,me,he,ze,$e,bh,_h,jp,uc,Xs,di,oi,Qr,zn,Ks,ga,Sr,At,Ei,Wa,qt,fi,hT,yC,fT,nA],styles:["[_nghost-%COMP%] .mat-dialog-content{padding:0 4px}.settings[_ngcontent-%COMP%] .setting-group-title[_ngcontent-%COMP%]{font-weight:700;font-size:10pt;font-family:Arial,Helvetica,sans-serif;padding:10px 0}.setting-card-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.settings[_ngcontent-%COMP%] .setting-card-row-item[_ngcontent-%COMP%]{padding-right:15px;flex:1 1 auto}@media only screen and (max-width:599px){.settings[_ngcontent-%COMP%] .setting-group[_ngcontent-%COMP%]{padding:5px 5%}}@media only screen and (min-width:600px)and (max-width:959px),screen and (min-width:960px)and (max-width:1279px),screen and (min-width:1280px)and (max-width:1919px),screen and (min-width:1920px)and (max-width:5000px){.settings[_ngcontent-%COMP%] .setting-group[_ngcontent-%COMP%]{padding:5px 5%}}"]})};function aze(n,t){if(n&1){let e=H();u(0,"button",14),M("click",function(){C(e);let r=y(2);return x(r.currentPage=r.currentPage-1)}),u(1,"mat-icon"),_(2,"keyboard_arrow_left"),p()()}}function sze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Outlook:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),Z(" ",e.description," ")}}function lze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"device_thermostat"),p()(),u(4,"div",11),_(5,"Temp:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),Z(" ",e.temperature," ")}}function cze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Min:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),Z(" ",e.temperatureMax," ")}}function dze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Max:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),Z(" ",e.temperatureMax," ")}}function uze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"opacity"),p()(),u(4,"div",11),_(5,"Dew Point:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),K(e.dewPoint)}}function pze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"air"),p()(),u(4,"div",11),_(5,"Wind Speed:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),K(e.wind.speed)}}function fze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"air"),p()(),u(4,"div",11),_(5,"Wind Gust:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),K(e.wind.gust)}}function hze(n,t){if(n&1&&(u(0,"div",5)(1,"div",10)(2,"mat-icon"),_(3,"outbound"),p()(),u(4,"div",11),_(5,"Wind Direction:"),p(),u(6,"div",8),_(7),p()()),n&2){let e=y().$implicit;h(7),Z(" ",e.wind.direction," ")}}function mze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Humidity:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.humidity)}}function gze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Precipitation:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.rain)}}function _ze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Pressure:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.pressure)}}function bze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"UV Index:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.uvIndex)}}function yze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Cloud Cover:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.clouds)}}function vze(n,t){if(n&1&&(u(0,"div",5),B(1,"div",10),u(2,"div",11),_(3,"Visibility:"),p(),u(4,"div",8),_(5),p()()),n&2){let e=y().$implicit;h(5),K(e.visibility)}}function Cze(n,t){if(n&1){let e=H();u(0,"button",15),M("click",function(){C(e);let r=y(2);return x(r.currentPage=r.currentPage+1)}),u(1,"mat-icon"),_(2,"keyboard_arrow_right"),p()()}}function xze(n,t){if(n&1&&(u(0,"mat-step")(1,"div",5)(2,"div",6),R(3,aze,3,0,"button",7),p(),u(4,"div",8)(5,"mat-card")(6,"div",9)(7,"div",5)(8,"div",10)(9,"mat-icon"),_(10,"schedule"),p()(),u(11,"div",11),_(12,"Time:"),p(),u(13,"div",8),_(14),p()(),R(15,sze,6,1,"div",5),R(16,lze,8,1,"div",5),R(17,cze,6,1,"div",5),R(18,dze,6,1,"div",5),R(19,uze,8,1,"div",5),R(20,pze,8,1,"div",5),R(21,fze,8,1,"div",5),R(22,hze,8,1,"div",5),R(23,mze,6,1,"div",5),R(24,gze,6,1,"div",5),R(25,_ze,6,1,"div",5),R(26,bze,6,1,"div",5),R(27,yze,6,1,"div",5),R(28,vze,6,1,"div",5),p()()(),u(29,"div",12),R(30,Cze,3,0,"button",13),p()()()),n&2){let e=t.$implicit,i=t.$index,r=y();h(3),F(i!==0&&r.data.length>1?3:-1),h(11),Z(" ",e.time," "),h(),F(e.description?15:-1),h(),F(e.temperature?16:-1),h(),F(e.temperatureMin?17:-1),h(),F(e.temperatureMax?18:-1),h(),F(e.dewPoint?19:-1),h(),F(e.wind.speed?20:-1),h(),F(e.wind.gust?21:-1),h(),F(e.wind.direction?22:-1),h(),F(e.humidity?23:-1),h(),F(e.rain?24:-1),h(),F(e.pressure?25:-1),h(),F(e.uvIndex?26:-1),h(),F(e.clouds?27:-1),h(),F(e.visibility?28:-1),h(2),F(i!==r.data.length-1?30:-1)}}function wze(n,t){if(n&1&&(u(0,"mat-icon",16),_(1," fiber_manual_record "),p()),n&2){let e=t.$index,i=y();Mi("color",i.currentPage-1===e?"blue":"gray")}}var oA=class n{data;currentPage=1;ngAfterViewInit(){let t=document.getElementsByClassName("mat-horizontal-stepper-header-container");t[0].style.display="none"}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=U({type:n,selectors:[["weather-data"]],inputs:{data:"data"},decls:8,vars:1,consts:[["stepper",""],[1,"weather-data"],[3,"linear"],[2,"text-align","center","font-size","10pt","font-family","roboto"],[2,"font-size","8pt","width","12px",3,"color"],[2,"display","flex"],[2,"min-width","50px","text-align","left","padding-top","15%"],["mat-icon-button","","matStepperPrevious",""],[2,"flex","1 1 auto"],[2,"display","flex","flex-direction","column"],[1,"key-icon"],[1,"key-label"],[2,"min-width","50px","text-align","right","padding-top","15%"],["mat-icon-button","","matStepperNext",""],["mat-icon-button","","matStepperPrevious","",3,"click"],["mat-icon-button","","matStepperNext","",3,"click"],[2,"font-size","8pt","width","12px"]],template:function(e,i){e&1&&(u(0,"div",1)(1,"mat-horizontal-stepper",2,0),ye(3,xze,31,17,"mat-step",null,rt),p(),u(5,"div",3),ye(6,wze,2,2,"mat-icon",4,rt),p()()),e&2&&(h(),T("linear",!1),h(2),ve(i.data),h(3),ve(i.data))},dependencies:[ft,Ht,Ur,ge,tt,me,he,ze,n_,Sr,At,qt,ru,yp,vp,Yf,w_],styles:[".weather-data[_ngcontent-%COMP%] h1[_ngcontent-%COMP%]{font-weight:400!important}.weather-data-row[_ngcontent-%COMP%]{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-content:stretch;font-family:Arial,Helvetica,sans-serif}.weather-data-row[_ngcontent-%COMP%] .item.stretch[_ngcontent-%COMP%]{text-align:center;width:100%}.weather-data-row[_ngcontent-%COMP%] .item[_ngcontent-%COMP%]{padding-left:5px}.weather-data-row[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:42px}.weather-data-row[_ngcontent-%COMP%] .description[_ngcontent-%COMP%]{font-size:12pt}.weather-data[_ngcontent-%COMP%] .key-icon[_ngcontent-%COMP%]{width:30px;font-weight:700}.weather-data[_ngcontent-%COMP%] .key-label[_ngcontent-%COMP%]{width:150px;font-weight:700}"]})};function Mze(n,t){n&1&&B(0,"mat-progress-bar",4)}function Sze(n,t){if(n&1&&(u(0,"div",5),_(1),p()),n&2){let e=y(2);h(),K(e.errorText)}}function Eze(n,t){if(n&1&&(u(0,"div",6),B(1,"div",7),u(2,"div",8)(3,"span",9),_(4),p(),u(5,"div",10)(6,"div",7)(7,"span",11),_(8,"Lat:"),p(),_(9,"\xA0 "),B(10,"span",12),Fi(11,"coords"),_(12," \xA0 "),p(),u(13,"div",7)(14,"span",11),_(15,"Lon:"),p(),_(16,"\xA0 "),B(17,"span",12),Fi(18,"coords"),p()()(),B(19,"div",7),p(),B(20,"weather-data",13)),n&2){let e=y(2);h(4),K(e.data.subTitle),h(6),T("innerText",jn(11,4,e.data.position[1],e.app.config.units.positionFormat,!0)),h(7),T("innerText",jn(18,8,e.data.position[0],e.app.config.units.positionFormat,!1)),h(3),T("data",e.forecasts.slice(0,18))}}function Dze(n,t){if(n&1&&R(0,Sze,2,1,"div",5)(1,Eze,21,12),n&2){let e=y();F(!e.forecasts||e.forecasts.length===0?0:1)}}var hv=class n{constructor(t,e,i,r){this.app=t;this.sk=e;this.modalRef=i;this.data=r}forecasts=[];isFetching=!1;errorText="No weather data found!";ngOnInit(){this.getForecast(this.data.position)}formatTempDegreesC(t){return t?`${Ct.kelvinToCelsius(t).toFixed(1)} \xBA`:"0.0"}formatDegrees(t){return t?`${Ct.radiansToDegrees(t).toFixed(1)} \xBA`:"0.0"}formatKnots(t){return t?`${Ct.msecToKnots(t).toFixed(1)} kn`:"0.0"}dayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];getForecast(t){if(!this.app.featureFlags().weatherApi){this.errorText="Cannot retrieve forecasts as Weather API is not available!";return}if(!this.data.position){this.errorText="Cannot retrieve forecasts as location has not been supplied!";return}let e=`/weather/forecasts/point?lat=${t[1]}&lon=${t[0]}`;this.isFetching=!0,this.sk.api.get(2,e).subscribe(i=>{this.isFetching=!1,Object.values(i).forEach(r=>{let o={wind:{}};o.description=r.description??"";let a=new Date(r.date);o.time=a?`${this.dayNames[a.getDay()]} ${a.getHours()}:${("00"+a.getMinutes()).slice(-2)}`:"",typeof r.outside?.temperature<"u"&&(o.temperature=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.temperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.temperature).toFixed(1)+"\xBAC"),typeof r.outside?.minTemperature?.minimum<"u"&&(o.temperatureMin=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.minTemperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.minTemperature).toFixed(1)+"\xBAC"),typeof r.outside?.maxTemperature<"u"&&(o.temperatureMax=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.maxTemperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.maxTemperature).toFixed(1)+"\xBAC"),typeof r.outside?.dewPointTemperature<"u"&&(o.dewPoint=this.app.config.units?.temperature==="f"?Ct.kelvinToFarenheit(r.outside.dewPointTemperature).toFixed(1)+"\xBAF":Ct.kelvinToCelsius(r.outside.dewPointTemperature).toFixed(1)+"\xBAC"),o.humidity=typeof r.outside?.absoluteHumility<"u"?`${r.outside?.absoluteHumility} (%)`:"",o.pressure=typeof r.outside?.pressure<"u"?`${Math.round(r.outside?.pressure)} (Pa)`:"",typeof r.outside?.uvIndex<"u"&&(o.uvIndex=r.outside?.uvIndex.toFixed(2)),typeof r.outside?.clouds<"u"&&(o.clouds=r.outside?.clouds.toFixed(1)+`${r.clouds.units?" ("+r.clouds.units+")":""}`),typeof r.outside?.visibility<"u"&&(o.visibility=r.outside?.visibility),typeof r.outside?.precipitationVolume<"u"&&(o.rain=`${(r.outside?.precipitationVolume*1e3).toFixed(2)} mm`),typeof r.wind<"u"&&(typeof r.wind.speedTrue<"u"&&(o.wind.speed=this.app.formatSpeed(r.wind.speedTrue,!0)+" "+this.app.formattedSpeedUnits),typeof r.wind.gust<"u"&&(o.wind.gust=this.app.formatSpeed(r.wind.gust,!0)+" "+this.app.formattedSpeedUnits),typeof r.wind.directionTrue<"u"&&(o.wind.direction=Ct.radiansToDegrees(r.wind.directionTrue).toFixed(0)+"\xBA")),this.forecasts.push(o)})},()=>{this.isFetching=!1,this.errorText="Error retrieving weather data!"})}static \u0275fac=function(e){return new(e||n)(N(Ie),N(bi),N(jr),N(Eo))};static \u0275cmp=U({type:n,selectors:[["weather-forecast-modal"]],decls:13,vars:2,consts:[[1,"_weather-forecast"],[2,"background-color","transparent"],[2,"flex","1 1 auto","padding-left","20px","text-align","center"],["mat-icon-button","","matTooltip","Close","matTooltipPosition","below",3,"click"],["mode","query"],[2,"text-align","center"],[2,"display","flex","flex-wrap","nowrap"],[2,"flex","1"],[2,"width","350px","text-align","center"],[2,"font-size","small"],[2,"font-size","small","text-align","left","display","flex","flex-wrap","wrap"],[2,"font-weight","bold"],[3,"innerText"],[3,"data"]],template:function(e,i){e&1&&(u(0,"div",0)(1,"mat-toolbar",1)(2,"span")(3,"mat-icon"),_(4,"air"),p()(),u(5,"span",2),_(6),p(),u(7,"span")(8,"button",3),M("click",function(){return i.modalRef.dismiss()}),u(9,"mat-icon"),_(10,"keyboard_arrow_down"),p()()()(),R(11,Mze,1,0,"mat-progress-bar",4)(12,Dze,2,1),p()),e&2&&(h(6),Z(" ",i.data.title," "),h(5),F(i.isFetching?11:12))},dependencies:[ft,Ur,ge,tt,me,he,ze,$e,n_,Sr,At,qt,fi,ru,qn,oA,Cr],styles:["._weather-forecast[_ngcontent-%COMP%]{font-family:arial}._weather-forecast[_ngcontent-%COMP%] .key-label[_ngcontent-%COMP%]{width:150px;font-weight:700}"]})};var aA=class n{selected=new q;handleSelect(t,e){this.selected.emit({choice:t,value:e})}static \u0275fac=function(e){return new(e||n)};static \u0275cmp=U({type:n,selectors:[["fb-experiments"]],outputs:{selected:"selected"},decls:11,vars:1,consts:[["experimentsmenu","matMenu"],["mat-menu-item","",3,"click"],["mat-mini-fab","","matTooltip","Experiments","matTooltipPosition","left",1,"button-toolbar",3,"matMenuTriggerFor"]],template:function(e,i){if(e&1){let r=H();u(0,"mat-menu",null,0)(2,"a",1),M("click",function(){return C(r),x(i.handleSelect("debugCapture"))}),u(3,"mat-icon"),_(4,"adb"),p(),u(5,"span"),_(6,"Capture Debug Info"),p()()(),u(7,"div")(8,"button",2)(9,"mat-icon"),_(10,"science"),p()()()}if(e&2){let r=pe(1);h(8),T("matMenuTriggerFor",r)}},dependencies:[Wa,ha,Ea,Ga,me,he,ge,$s,ze,$e],encapsulation:2})};var Tze=[{type:"signalk-server-node",title:"Deprecation Notice",message:`
411
411
  The built-in <b>Weather Service</b> has been removed!
412
412
  <br>&nbsp;<br>
413
413
  Weather forecast functionality remains available when using
@@ -444,7 +444,7 @@ ${s}`)!==100){let l=t.replace("{font-family}",s.replace(/ /g,"-").toLowerCase())
444
444
  You can enable Experiments in <b><i>Settings</i></b>.
445
445
  <br>&nbsp;<br>
446
446
  Check out <a href="assets/help/index.html#experiments" target="help">HELP</a>
447
- for more details.`},"whats-new":Tze};var ele={id:"freeboard",name:"Freeboard-SK",description:"Signal K Chart Plotter.",version:"2.19.4-beta.1",url:"https://github.com/signalk/freeboard-sk",logo:"./assets/img/app_logo.png"},Ize="1.0.0",Kw={host:"localhost",port:3e3,ssl:!1},Ie=class n extends HE{skApiVersion=2;hostDef={name:void 0,port:void 0,ssl:!1,url:void 0,params:{}};STANDARD_RESOURCES=["routes","waypoints","regions","notes","charts"];CUSTOM_RESOURCES=[{name:"tracks",description:"Freeboard GPX track imports.",featureKey:"resourceTracks"},{name:"infolayers",description:"Freeboard map overlays.",featureKey:"infoLayers"},{name:"groups",description:"Freeboard resource groups.",featureKey:"resourceGroups"}];get IGNORE_RESOURCES(){return this.STANDARD_RESOURCES.concat(this.CUSTOM_RESOURCES.map(t=>t.name),["buddies"])}MAP_ZOOM_EXTENT={min:2,max:28};fbAudioContext=window.AudioContext||window.webkitAudioContext;audio={context:new this.fbAudioContext};db;watchingSKLogin;kioskMode=oe(!1);hasAuthToken=oe(!1);isLoggedIn=oe(!1);instrumentPanelAvailable=oe(!0);skAuthChange=oe(void 0);sIsFetching=oe(!1);sTrueMagChoice=oe("");uiCtrl=oe({alertList:!1,autopilotConsole:!1,routeBuilder:!1,suppressContextMenu:!1});uiConfig=oe({mapNorthUp:!0,mapMove:!1,mapConstrainZoom:!1,toolbarButtons:!1,invertColor:!1,showCourseData:!0,showAisTargets:!0,showNotes:!0});featureFlags=oe({anchorApi:!0,autopilotApi:!1,weatherApi:!1,resourceGroups:!1,resourceTracks:!1,infoLayers:!1,buddyList:!1});selfTrail=oe([]);selfTrailFromServer=oe([]);mapExtent=oe([]);signalk=w(bi);worker=w(fo);dialog=w(Br);snackbar=w(PK);iconReg=w(GS);dom=w(Xc);constructor(){super(ele),this.config=fC(),this.data=GY(),this.suppressPersist=!0,this.db=new cj,this.db.dbUpdate$.subscribe(t=>{if(t.action)switch(t.action){case"db_init":t.value&&this.config.vessels.trail&&this.db.getTrail().then(e=>{this.selfTrail.update(()=>e&&e.value?e.value:[])});break;case"trail_save":t.value||this.debug("app.trail.save.error","warn");break}}),this.signalk.setAppId(ele.id),this.signalk.setAppVersion(Ize),this.initAppIcons(),this.parseLaunchUrl(),this.instrumentPanelAvailable.update(()=>this.isTopWindow()),this.isTopWindow()||window.addEventListener("message",t=>{this.parseMessageFromParent(t)}),this.testForInternet(),this.loadConfig(),this.parseLoadedConfig(),Ut(()=>{this.uiConfig(),this.debug("AppFacade.effect().uiConfig",this.uiConfig()),this.config.ui=this.uiConfig(),this.saveConfig()})}parseMessageFromParent(t){if(U0()||t.origin===this.hostDef.url){this.debug("parseMessageFromParent()",t.origin,t.data);let{settings:e}=t.data;if(!e){this.debug("parseMessageFromParent() - invalid data!");return}typeof e.autoNightMode=="boolean"&&(this.config.display.nightMode=e.autoNightMode)}else{this.debug("parseMessageFromParent() - untrusted origin!",t.origin);return}}parseLoadedConfig(){M6(this.config,this.hostDef.params),this.doPostConfigLoad()}doPostConfigLoad(){this.uiConfig.update(()=>this.config.ui),this.config.vessels.fixedLocationMode&&(this.data.vessels.self.position=[...this.config.vessels.fixedPosition],this.data.vessels.showSelf=!0,this.config.map.center=[...this.config.vessels.fixedPosition]),this.sTrueMagChoice.set(this.config.units.headingAttribute),this.debug("doPostConfigLoad(): emit config$.ready"),this.emitConfigEvent("ready"),this.suppressPersist=!1}loadSettingsfromServer(){this.signalk.isLoggedIn().subscribe(t=>{this.isLoggedIn.set(t),t?(this.debug("loadSettingsfromServer(): Is authenticated. Fetching config from SK Server..."),this.signalk.appDataGet("/").subscribe(e=>{Object.keys(e).length!==0&&(M6(e,this.hostDef.params),HY(e)&&(this.config=e,this.doPostConfigLoad(),this.alignCustomResourcesPaths(),this.saveConfig()))},()=>{console.info("applicationData: Unable to retrieve settings from server!")})):this.debug("loadSettingsfromServer(): Not authenticated to SK Server!")},()=>{this.isLoggedIn.set(!1),this.debug("loadSettingsfromServer(): Error fetching loginStatus!")})}initAppIcons(){$E().forEach(t=>{this.iconReg.addSvgIcon(t.id,this.dom.bypassSecurityTrustResourceUrl(t.path))})}parseLaunchUrl(){window.location.search&&window.location.search.slice(1).split("&").forEach(e=>{let i=e.split("=");this.hostDef.params[i[0]]=i.length>1?i[1]:null}),this.hostDef.name=typeof this.hostDef.params?.host<"u"?this.hostDef.params.host:this.devMode&&Kw.host?Kw.host:window.location.hostname,this.hostDef.ssl=!!(window.location.protocol==="https:"||this.devMode&&Kw.ssl),this.hostDef.port=typeof this.hostDef.params.port<"u"?parseInt(this.hostDef.params.port):this.devMode&&Kw.port?Kw.port:parseInt(window.location.port),this.hostDef.port=isNaN(this.hostDef.port)?this.hostDef.ssl?443:80:this.hostDef.port,this.hostDef.url=`${this.hostDef.ssl?"https:":"http:"}//${this.hostDef.name}:${this.hostDef.port}`,this.kioskMode.update(()=>typeof this.hostDef.params.kiosk<"u"),typeof this.hostDef.params.token<"u"&&this.persistToken(this.hostDef.params.token),this.debug("host:",this.hostDef)}testForInternet(){window.fetch("https://tile.openstreetmap.org").then(()=>{console.info("Internet connection detected.")}).catch(()=>{console.warn("No Internet connection detected!");let t=this.config.selections.charts;(t.includes("openstreetmap")||t.includes("openseamap"))&&(this.kioskMode()||this.showAlert("Internet Map Service Unavailable: ",`Unable to display Open Street / Sea Maps!
447
+ for more details.`},"whats-new":Tze};var ele={id:"freeboard",name:"Freeboard-SK",description:"Signal K Chart Plotter.",version:"2.19.4-beta.2",url:"https://github.com/signalk/freeboard-sk",logo:"./assets/img/app_logo.png"},Ize="1.0.0",Kw={host:"localhost",port:3e3,ssl:!1},Ie=class n extends HE{skApiVersion=2;hostDef={name:void 0,port:void 0,ssl:!1,url:void 0,params:{}};STANDARD_RESOURCES=["routes","waypoints","regions","notes","charts"];CUSTOM_RESOURCES=[{name:"tracks",description:"Freeboard GPX track imports.",featureKey:"resourceTracks"},{name:"infolayers",description:"Freeboard map overlays.",featureKey:"infoLayers"},{name:"groups",description:"Freeboard resource groups.",featureKey:"resourceGroups"}];get IGNORE_RESOURCES(){return this.STANDARD_RESOURCES.concat(this.CUSTOM_RESOURCES.map(t=>t.name),["buddies"])}MAP_ZOOM_EXTENT={min:2,max:28};fbAudioContext=window.AudioContext||window.webkitAudioContext;audio={context:new this.fbAudioContext};db;watchingSKLogin;kioskMode=oe(!1);hasAuthToken=oe(!1);isLoggedIn=oe(!1);instrumentPanelAvailable=oe(!0);skAuthChange=oe(void 0);sIsFetching=oe(!1);sTrueMagChoice=oe("");uiCtrl=oe({alertList:!1,autopilotConsole:!1,routeBuilder:!1,suppressContextMenu:!1});uiConfig=oe({mapNorthUp:!0,mapMove:!1,mapConstrainZoom:!1,toolbarButtons:!1,invertColor:!1,showCourseData:!0,showAisTargets:!0,showNotes:!0});featureFlags=oe({anchorApi:!0,autopilotApi:!1,weatherApi:!1,resourceGroups:!1,resourceTracks:!1,infoLayers:!1,buddyList:!1});selfTrail=oe([]);selfTrailFromServer=oe([]);mapExtent=oe([]);signalk=w(bi);worker=w(fo);dialog=w(Br);snackbar=w(PK);iconReg=w(GS);dom=w(Xc);constructor(){super(ele),this.config=fC(),this.data=GY(),this.suppressPersist=!0,this.db=new cj,this.db.dbUpdate$.subscribe(t=>{if(t.action)switch(t.action){case"db_init":t.value&&this.config.vessels.trail&&this.db.getTrail().then(e=>{this.selfTrail.update(()=>e&&e.value?e.value:[])});break;case"trail_save":t.value||this.debug("app.trail.save.error","warn");break}}),this.signalk.setAppId(ele.id),this.signalk.setAppVersion(Ize),this.initAppIcons(),this.parseLaunchUrl(),this.instrumentPanelAvailable.update(()=>this.isTopWindow()),this.isTopWindow()||window.addEventListener("message",t=>{this.parseMessageFromParent(t)}),this.testForInternet(),this.loadConfig(),this.parseLoadedConfig(),Ut(()=>{this.uiConfig(),this.debug("AppFacade.effect().uiConfig",this.uiConfig()),this.config.ui=this.uiConfig(),this.saveConfig()})}parseMessageFromParent(t){if(U0()||t.origin===this.hostDef.url){this.debug("parseMessageFromParent()",t.origin,t.data);let{settings:e}=t.data;if(!e){this.debug("parseMessageFromParent() - invalid data!");return}typeof e.autoNightMode=="boolean"&&(this.config.display.nightMode=e.autoNightMode)}else{this.debug("parseMessageFromParent() - untrusted origin!",t.origin);return}}parseLoadedConfig(){M6(this.config,this.hostDef.params),this.doPostConfigLoad()}doPostConfigLoad(){this.uiConfig.update(()=>this.config.ui),this.config.vessels.fixedLocationMode&&(this.data.vessels.self.position=[...this.config.vessels.fixedPosition],this.data.vessels.showSelf=!0,this.config.map.center=[...this.config.vessels.fixedPosition]),this.sTrueMagChoice.set(this.config.units.headingAttribute),this.debug("doPostConfigLoad(): emit config$.ready"),this.emitConfigEvent("ready"),this.suppressPersist=!1}loadSettingsfromServer(){this.signalk.isLoggedIn().subscribe(t=>{this.isLoggedIn.set(t),t?(this.debug("loadSettingsfromServer(): Is authenticated. Fetching config from SK Server..."),this.signalk.appDataGet("/").subscribe(e=>{Object.keys(e).length!==0&&(M6(e,this.hostDef.params),HY(e)&&(this.config=e,this.doPostConfigLoad(),this.alignCustomResourcesPaths(),this.saveConfig()))},()=>{console.info("applicationData: Unable to retrieve settings from server!")})):this.debug("loadSettingsfromServer(): Not authenticated to SK Server!")},()=>{this.isLoggedIn.set(!1),this.debug("loadSettingsfromServer(): Error fetching loginStatus!")})}initAppIcons(){$E().forEach(t=>{this.iconReg.addSvgIcon(t.id,this.dom.bypassSecurityTrustResourceUrl(t.path))})}parseLaunchUrl(){window.location.search&&window.location.search.slice(1).split("&").forEach(e=>{let i=e.split("=");this.hostDef.params[i[0]]=i.length>1?i[1]:null}),this.hostDef.name=typeof this.hostDef.params?.host<"u"?this.hostDef.params.host:this.devMode&&Kw.host?Kw.host:window.location.hostname,this.hostDef.ssl=!!(window.location.protocol==="https:"||this.devMode&&Kw.ssl),this.hostDef.port=typeof this.hostDef.params.port<"u"?parseInt(this.hostDef.params.port):this.devMode&&Kw.port?Kw.port:parseInt(window.location.port),this.hostDef.port=isNaN(this.hostDef.port)?this.hostDef.ssl?443:80:this.hostDef.port,this.hostDef.url=`${this.hostDef.ssl?"https:":"http:"}//${this.hostDef.name}:${this.hostDef.port}`,this.kioskMode.update(()=>typeof this.hostDef.params.kiosk<"u"),typeof this.hostDef.params.token<"u"&&this.persistToken(this.hostDef.params.token),this.debug("host:",this.hostDef)}testForInternet(){window.fetch("https://tile.openstreetmap.org").then(()=>{console.info("Internet connection detected.")}).catch(()=>{console.warn("No Internet connection detected!");let t=this.config.selections.charts;(t.includes("openstreetmap")||t.includes("openseamap"))&&(this.kioskMode()||this.showAlert("Internet Map Service Unavailable: ",`Unable to display Open Street / Sea Maps!
448
448
 
449
449
  Please check your Internet connection or select maps from the local network.
450
450