@mxtommy/kip 4.8.0-beta.1 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +0,0 @@
1
- import{$ as os,A as ns,B as Ja,C as Ui,D as _l,E as as,F as Uo,G as Ml,H as Ho,I as qo,J as eo,K as to,L as kl,M as Tl,N as io,O as $o,P as Dl,Q as ku,R as Tu,S as Du,T as qn,U as $n,V as no,W as Ct,X as jn,Y as Yn,Z as ao,_ as Eu,a as Yt,aa as rs,b as li,ba as Pu,c as Ii,ca as Iu,d as yu,da as Zn,e as xu,ea as un,f as Cu,g as es,h as Su,i as wu,j as _u,k as Mu,l as ht,m as va,n as Bi,o as Un,p as ba,q as Cn,r as dn,s as cn,t as zi,u as Hn,v as gi,w as ts,x as is,y as Ka,z as Aa}from"./chunk-XBOM6DMF.js";import{a as Au,b as Jr,c as di}from"./chunk-W6MCE3GH.js";import{a as Nu,b as Ou,c as Ru,d as Vu,e as Lu}from"./chunk-JMZYPL54.js";import{a as jt,b as Pi,c as it,e as oo,f as ro}from"./chunk-HXR2BKDL.js";import{a as mu,b as hu,c as pu,d as Qa,e as gu,f as Nt,g as fu,h as vu,k as bu,m as zo,o as ve,p as wl,r as Ot}from"./chunk-IXUKD73N.js";import{b as eu,e as tu,f as Zr}from"./chunk-VFJD3XKT.js";import{a as sn,b as ln}from"./chunk-HF7V6XFA.js";import{a as nu,b as au,c as ou,d as an,e as ri,g as ru,h as ki,i as Ti,j as Di,k as Ln,l as Ht,n as vt,o as Bn,p as cu,q as zn,s as uu,u as bt,v as qt,w as At,x as $t}from"./chunk-ILQQCGMJ.js";import{A as Fn,B as Ya,C as Ei,D as du,E as Sl,F as on,G as Za,H as Kr,I as si,J as ut,K as Xa,L as rn,M as kt,O as Gn,P as It,Q as ft,a as wi,b as wc,d as Ft,e as _i,f as Xc,i as Yr,j as Qc,k as Kc,l as Jc,m as Wt,n as nn,o as Xr,p as gt,r as _t,t as rt,u as Mt,v as su,w as Wn,x as Qr,y as lu,z as tt}from"./chunk-2TP7C66X.js";import{$ as Mr,$a as Or,$b as Rt,Aa as hc,Ab as Jt,Ad as Hr,Ba as ze,Bb as Ae,Bc as G,Be as zc,Cb as ye,Cc as X,D as ic,Da as oi,Db as R,Dc as bc,Dd as $a,De as Uc,E as nc,Ea as qe,Eb as d,Ec as Ac,Ee as Hc,Fb as u,Fc as mt,Fe as qc,Ga as w,Gb as W,Gc as x,H as ma,Ha as L,Hb as E,Hc as he,I as Sr,Ia as Qi,Ib as O,Id as ja,Ie as $c,J as bi,Jb as Q,Jc as Br,Je as jc,K as Ai,Kb as Ji,La as Ke,Lb as en,Lc as Si,Ld as Pc,Le as Yc,Mb as Lr,Nb as we,Nc as St,O as ac,Ob as Wi,Od as Ic,P as In,Pb as U,Pd as fa,Pe as Zc,Q as ai,Qa as Ir,Qb as Fo,Qd as Rn,Qe as Le,Ra as Nr,Rb as k,Rd as Nc,Re as Mi,S as oc,Sa as ha,Sb as Wr,Se as iu,T as rc,Tb as Fr,Td as Cl,Te as Xe,U as wr,Ub as Gr,Ud as qr,Ue as et,V as _r,Vb as Nn,Vd as Oc,Wa as f,Wb as xi,Xb as Ci,Xc as yc,Xd as Gi,Ya as pc,Yc as xc,Z as sc,Za as gc,Zb as Me,Zc as Cc,Zd as tn,_ as lc,_b as ke,a as ne,aa as kr,ab as pa,ac as xe,ad as zr,b as ge,ba as dc,bc as dt,bd as On,ca as za,cc as Ua,ce as Rc,d as Hf,da as Tr,db as Rr,dc as at,dd as Ha,de as Vc,e as Xd,ea as Dr,ec as c,ee as Pt,f as Re,fa as Er,fc as K,fd as Sc,fe as $r,g as Ba,ga as cc,gb as H,gc as fe,ge as Vn,ha as uc,hb as Ki,hc as Ut,he as Lc,ib as Lt,ie as wt,j as Al,jb as Vr,k as zt,ka as Pr,kb as fc,kc as fn,ke as jr,la as lt,lb as Wo,lc as vn,ld as _c,le as ot,m as Zi,ma as Xi,mb as yi,mc as bn,md as Mc,n as Qd,nb as vc,nc as ga,nd as kc,ne as Wc,oa as gn,oc as An,pc as yn,q as Kd,qa as y,qc as Fi,r as Jd,rc as xl,rd as Tc,re as Fc,s as yl,sc as Go,se as Gc,t as ec,ta as mc,tc as Bo,td as Ur,ud as Dc,va as ee,vb as J,vc as ct,vd as Ec,w as Cr,wa as te,wc as Et,x as Pn,xa as ie,xb as I,xc as xn,xd as qa,y as tc,ya as Be,yb as N,z as Kt,za as Lo,zb as Ne,ze as Bc}from"./chunk-LEY6MANN.js";var bd=Hf((xL,tl)=>{(function(n){"use strict";function o(p){if(Array.isArray(p)){for(var h=0,b=Array(p.length);h<p.length;h++)b[h]=p[h];return b}return Array.from(p)}function e(p,h){if(!p)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!h||typeof h!="object"&&typeof h!="function"?p:h}function t(p,h){if(typeof h!="function"&&h!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof h);p.prototype=Object.create(h&&h.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}),h&&(Object.setPrototypeOf?Object.setPrototypeOf(p,h):p.__proto__=h)}function i(p,h){if(!(p instanceof h))throw new TypeError("Cannot call a class as a function")}function a(p,h){if(h||(h=typeof window>"u"?global:window),h[p]!==void 0)return h[p];if(xr===null){var b=window.getComputedStyle(document.documentElement,"");xr=(Array.prototype.slice.call(b).join("").match(/-(moz|webkit|ms)-/)||b.OLink===""&&["","o"]||["",""])[1]}if(xr==="")return null;var S=p.charAt(0).toUpperCase()+p.substr(1),T=h[xr+S];return T!==void 0?T:null}function r(p,h,b,S,T,P,z){if(typeof S!="function")throw new TypeError("Invalid animation rule:",S);var $=p-b,q=$/T,Z=0;q>1&&(q=1),q!==1&&(Z=S(q),isFinite(Z)&&!isNaN(Z)&&(q=Z)),h&&h(q),$<T?z.frame=qd(function(ue){return r(ue,h,b,S,T,P,z)}):(P&&P(),z.inProgress=!1)}function s(){Array.prototype.constructor.apply(this,arguments)}function l(p){if(!(p instanceof DOMException&&p.result===2152923147))throw p}function m(p,h){return h.replace(Bf,function(b,S){var T=p[S];return T!==void 0?T:b})}function g(p){return p.majorTicks instanceof Array||(p.majorTicks=p.majorTicks?[p.majorTicks]:[]),p.majorTicks.length||(p.majorTicks.push(_e.formatMajorTickNumber(p.minValue,p)),p.majorTicks.push(_e.formatMajorTickNumber(p.maxValue,p))),[p.tickSide!=="right",p.tickSide!=="left"]}function v(p,h,b,S,T,P){p.beginPath(),p.moveTo(h+P,b),p.lineTo(h+S-P,b),p.quadraticCurveTo(h+S,b,h+S,b+P),p.lineTo(h+S,b+T-P),p.quadraticCurveTo(h+S,b+T,h+S-P,b+T),p.lineTo(h+P,b+T),p.quadraticCurveTo(h,b+T,h,b+T-P),p.lineTo(h,b+P),p.quadraticCurveTo(h,b,h+P,b),p.closePath()}function A(p,h){var b=h.valueDec,S=h.valueInt,T=0,P=void 0,z=void 0,$=void 0;if(p=parseFloat(p),$=p<0,p=Math.abs(p),b>0){for(z=p.toFixed(b).toString().split("."),P=S-z[0].length;T<P;++T)z[0]="0"+z[0];z=($?"-":"")+z[0]+"."+z[1]}else{for(z=Math.round(p).toString(),P=S-z.length;T<P;++T)z="0"+z;z=($?"-":"")+z}return z}function C(p,h){var b=void 0,S=!1;return b=h.majorTicksDec===0?Math.round(p).toString():p.toFixed(h.majorTicksDec),h.majorTicksInt>1?(S=~b.indexOf("."),~b.indexOf("-")?"-"+[h.majorTicksInt+h.majorTicksDec+2+(S?1:0)-b.length].join("0")+b.replace("-",""):[h.majorTicksInt+h.majorTicksDec+1+(S?1:0)-b.length].join("0")+b):b}function _(p){return p*Math.PI/180}function M(p,h){return{x:-p*Math.sin(h),y:p*Math.cos(h)}}function B(p,h,b,S){var T=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],P=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,z=p.createLinearGradient(T?0:P,T?P:0,T?0:S,T?S:0);return z.addColorStop(0,h),z.addColorStop(1,b),z}function D(p,h){h.needleShadow&&(p.shadowOffsetX=2,p.shadowOffsetY=2,p.shadowBlur=10,p.shadowColor=h.colorNeedleShadowDown)}function V(p,h,b){return p["font"+h+"Style"]+" "+p["font"+h+"Weight"]+" "+p["font"+h+"Size"]*b+"px "+p["font"+h]}function F(p){p.shadowOffsetX=null,p.shadowOffsetY=null,p.shadowBlur=null,p.shadowColor="",p.strokeStyle=null,p.lineWidth=0,p.save()}function Y(p,h,b,S){h.valueTextShadow&&(p.shadowOffsetX=b,p.shadowOffsetY=b,p.shadowBlur=S,p.shadowColor=h.colorValueTextShadow)}function j(p,h,b,S,T,P){if(h.valueBox){F(p);var z=h.valueDec?1+h.valueDec:0,$="9".repeat(Math.max.apply(null,[String(parseInt(b)).length+z].concat(h.majorTicks.map(function(je){return String(parseInt(je,10)).length+z})))),q=h.valueText||A(b,h),Z=P/200,ue=P/100,pe=.4*ue,De=1.2*ue;p.font=V(h,"Value",Z),Y(p,h,pe,De);var Ee=p.measureText(h.valueText?q:"-"+A(Number($),h)).width;F(p);var Oe=parseFloat(h.fontValueSize)*Z+pe+De,Qe=ue*parseFloat(h.valueBoxStroke),Ie=2*P-2*Qe,Ye=Ee+10*ue,Ze=1.1*Oe+pe+De,Je=ue*h.valueBoxBorderRadius,He=(parseFloat(h.valueBoxWidth)||0)/100*Ie;He>Ye&&(Ye=He),Ye>Ie&&(Ye=Ie);var $e=S-Ye/2,Ge=T-Ze/2,Pe=T-5.75*ue;if(p.beginPath(),Je?v(p,$e,Ge,Ye,Ze,Je):p.rect($e,Ge,Ye,Ze),Qe){var Ve=p.createRadialGradient(S,Pe,10*ue,S,Pe,20*ue);Ve.addColorStop(0,h.colorValueBoxRect),Ve.addColorStop(1,h.colorValueBoxRectEnd),p.strokeStyle=Ve,p.lineWidth=Qe,p.stroke()}h.colorValueBoxShadow&&(p.shadowBlur=1.2*ue,p.shadowColor=h.colorValueBoxShadow),h.colorValueBoxBackground&&(p.fillStyle=h.colorValueBoxBackground,p.fill()),p.closePath(),p.restore(),Y(p,h,pe,De),p.fillStyle=h.colorValueText,p.textAlign="center",p.textBaseline="alphabetic",p.fillText(q,$e+Ye/2,T+Ze/2-Oe/3),p.restore()}}function Ce(p){var h=p.value,b=p.minValue,S=p.maxValue,T=.01*(S-b);return{normal:h<b?b:h>S?S:h,indented:h<b?b-T:h>S?S+T:h}}function me(p,h,b,S,T){b.beginPath(),b.arc(0,0,Li(p),0,2*Ro,!0),b.lineWidth=h,b.strokeStyle=T?_e.linearGradient(b,S,T,p):S,b.stroke(),b.closePath()}function ae(p,h){var b=Vi.pixelRatio;return p.maxRadius||(p.maxRadius=p.max-h.borderShadowWidth-h.borderOuterWidth*b-h.borderMiddleWidth*b-h.borderInnerWidth*b+(h.borderOuterWidth?.5:0)+(h.borderMiddleWidth?.5:0)+(h.borderInnerWidth?.5:0)),p.maxRadius}function se(p,h){function b(pe,De,Ee,Oe,Qe,Ie){return De&&(!Ie&&h.borderShadowWidth&&(Ee.save(),Ee.shadowBlur=h.borderShadowWidth,Ee.shadowColor=h.colorBorderShadow),me(pe,De*S,Ee,Oe,Qe),!Ie&&h.borderShadowWidth&&(Ie=!0,Ee.restore())),Ie}var S=Vi.pixelRatio,T=h.borderShadowWidth*S,P=p.max-T-h.borderOuterWidth*S/2,z=P-h.borderOuterWidth*S/2-h.borderMiddleWidth*S/2+.5,$=z-h.borderMiddleWidth*S/2-h.borderInnerWidth*S/2+.5,q=ae(p,h),Z=void 0,ue=!1;p.save(),ue=b(P,h.borderOuterWidth,p,h.colorBorderOuter,h.colorBorderOuterEnd,ue),ue=b(z,h.borderMiddleWidth,p,h.colorBorderMiddle,h.colorBorderMiddleEnd,ue),ue=b($,h.borderInnerWidth,p,h.colorBorderInner,h.colorBorderInnerEnd,ue),!ue&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),p.beginPath(),p.arc(0,0,Li(q),0,2*Ro,!0),h.colorPlateEnd?(Z=p.createRadialGradient(0,0,q/2,0,0,q),Z.addColorStop(0,h.colorPlate),Z.addColorStop(1,h.colorPlateEnd)):Z=h.colorPlate,p.fillStyle=Z,p.fill(),p.closePath(),p.restore()}function ce(p,h){if(h.highlights!=="false"&&h.highlights.length&&h.highlightsWidth!==0){var b=p.max*(parseFloat(h.highlightsWidth)||0)/100,S=Li(de(p,h)-b/2),T=h.highlights.length,P=(h.maxValue-h.minValue)/h.ticksAngle;p.save();for(var z=0;z<T;z++){var $=h.highlights[z];p.lineWidth=b,p.lineCap=h.highlightsLineCap,p.strokeStyle=$.color,p.beginPath(),p.rotate(bl),p.arc(0,0,S,_e.radians(h.startAngle+($.from-h.minValue)/P),_e.radians(h.startAngle+($.to-h.minValue)/P),!1),p.stroke(),p.closePath(),p.restore(),p.save()}p.restore()}}function oe(p,h){var b=de(p,h),S=void 0,T=void 0,P=void 0,z=0,$=Math.abs(h.minorTicks)||0,q=h.ticksAngle/(h.maxValue-h.minValue);h.exactTicks?(T=h.maxValue-h.minValue,S=$?T/$:0,z=(Yi.mod(h.majorTicks[0],$)||0)*q):S=$*(h.majorTicks.length-1),p.lineWidth=Vi.pixelRatio,p.strokeStyle=h.colorMinorTicks||h.colorStrokeTicks,p.save();for(var Z=0;Z<S;++Z)(P=h.startAngle+z+Z*(h.ticksAngle/S))<=h.ticksAngle+h.startAngle&&(p.rotate(_e.radians(P)),p.beginPath(),p.moveTo(0,b),p.lineTo(0,b-.075*p.max),Ue(p));p.restore()}function de(p,h){var b=p.max/100;return ae(p,h)-5*b-(h.barWidth?2*(parseFloat(h.barStrokeWidth)||0)+((parseFloat(h.barWidth)||0)+5)*b:0)}function le(p,h){_e.prepareTicks(h);var b=Li(de(p,h)),S=void 0,T=h.majorTicks.length,P=Vi.pixelRatio;p.lineWidth=2*P,S=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(T).fill(h.colorStrokeTicks||h.colorMajorTicks);for(var z=0;z<T;++z)p.save(),p.strokeStyle=S[z],p.rotate(_e.radians(be(h,h.exactTicks?h.majorTicks[z]:z,T))),p.beginPath(),p.moveTo(0,b),p.lineTo(0,b-.15*p.max),p.stroke(),p.closePath(),p.restore();h.strokeTicks&&(p.save(),p.strokeStyle=h.colorStrokeTicks||S[0],p.rotate(bl),p.beginPath(),p.arc(0,0,b,_e.radians(h.startAngle),_e.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore())}function be(p,h,b){if(p.exactTicks){var S=p.ticksAngle/(p.maxValue-p.minValue);return p.startAngle+S*(h-p.minValue)}return p.startAngle+h*(p.ticksAngle/(b-1))}function Ue(p){p.stroke(),p.restore(),p.closePath(),p.save()}function st(p,h){var b=de(p,h)-.15*p.max,S={},T=0,P=h.majorTicks.length,z=h.animationTarget!=="needle",$=h.colorNumbers instanceof Array?h.colorNumbers:new Array(P).fill(h.colorNumbers),q=z?-(h.value-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle:0;for(z&&(p.save(),p.rotate(-_e.radians(q))),p.font=_e.font(h,"Numbers",p.max/200),p.lineWidth=0,p.textAlign="center",p.textBaseline="middle";T<P;++T){var Z=q+be(h,h.exactTicks?h.majorTicks[T]:T,P),ue=p.measureText(h.majorTicks[T]).width,pe=h.fontNumbersSize,De=Math.sqrt(ue*ue+pe*pe)/2,Ee=_e.radialPoint(b-De-h.numbersMargin/100*p.max,_e.radians(Z));Z===360&&(Z=0),S[Z]||(S[Z]=!0,p.fillStyle=$[T],p.fillText(h.majorTicks[T],Ee.x,Ee.y))}z&&p.restore()}function Dt(p,h){h.title&&(p.save(),p.font=_e.font(h,"Title",p.max/200),p.fillStyle=h.colorTitle,p.textAlign="center",p.fillText(h.title,0,-p.max/4.25,.8*p.max),p.restore())}function Qt(p,h){h.units&&(p.save(),p.font=_e.font(h,"Units",p.max/200),p.fillStyle=h.colorUnits,p.textAlign="center",p.fillText(_e.formatContext(h,h.units),0,p.max/3.25,.8*p.max),p.restore())}function pi(p,h){if(h.needle){var b=h.animationTarget!=="needle",S=h.ticksAngle<360?_e.normalizedValue(h).indented:h.value,T=b?h.startAngle:h.startAngle+(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle;h.barStartPosition==="right"&&(T=h.startAngle+h.ticksAngle-(S-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle);var P=ae(p,h),z=Li(P/100*h.needleCircleSize),$=Li(P/100*h.needleCircleSize*.75),q=Li(P/100*h.needleEnd),Z=Li(h.needleStart?P/100*h.needleStart:0),ue=P/100*h.needleWidth,pe=P/100*h.needleWidth/2,De=Vi.pixelRatio;p.save(),_e.drawNeedleShadow(p,h),p.rotate(_e.radians(T)),p.fillStyle=_e.linearGradient(p,h.colorNeedle,h.colorNeedleEnd,q-Z),h.needleType==="arrow"?(p.beginPath(),p.moveTo(-pe,-Z),p.lineTo(-ue,0),p.lineTo(-1*De,q),p.lineTo(De,q),p.lineTo(ue,0),p.lineTo(pe,-Z),p.closePath(),p.fill(),p.beginPath(),p.lineTo(-.5*De,q),p.lineTo(-1*De,q),p.lineTo(-ue,0),p.lineTo(-pe,-Z),p.lineTo(pe/2*De-2*De,-Z),p.closePath(),p.fillStyle=h.colorNeedleShadowUp,p.fill()):(p.beginPath(),p.moveTo(-pe,q),p.lineTo(-pe,Z),p.lineTo(pe,Z),p.lineTo(pe,q),p.closePath(),p.fill()),p.restore(),h.needleCircleSize&&(p.save(),_e.drawNeedleShadow(p,h),h.needleCircleOuter&&(p.beginPath(),p.arc(0,0,z,0,2*Ro,!0),p.fillStyle=_e.linearGradient(p,h.colorNeedleCircleOuter,h.colorNeedleCircleOuterEnd,z),p.fill(),p.closePath()),h.needleCircleInner&&(p.beginPath(),p.arc(0,0,$,0,2*Ro,!0),p.fillStyle=_e.linearGradient(p,h.colorNeedleCircleInner,h.colorNeedleCircleInnerEnd,$),p.fill(),p.closePath()),p.restore())}}function la(p,h,b){_e.drawValueBox(p,h,b,0,p.max-.33*p.max,p.max)}function La(p){var h=p.startAngle,b=p.startAngle+p.ticksAngle,S=h,T=h+(_e.normalizedValue(p).normal-p.minValue)/(p.maxValue-p.minValue)*p.ticksAngle;if(p.barStartPosition==="middle"){var P=.5*(p.minValue+p.maxValue);p.value<P?(S=180-(P-_e.normalizedValue(p).normal)/(p.maxValue-p.minValue)*p.ticksAngle,T=180):(S=180,T=180+(_e.normalizedValue(p).normal-P)/(p.maxValue-p.minValue)*p.ticksAngle)}else p.barStartPosition==="right"&&(S=b-T+h,T=b);return{startAngle:S,endAngle:T}}function da(p,h){var b=p.max/100,S=ae(p,h)-5*b,T=parseFloat(h.barStrokeWidth+"")||0,P=(parseFloat(h.barWidth+"")||0)*b,z=S-2*T-P,$=(S-z)/2,q=z+$,Z=T/q,ue=h.startAngle,pe=h.startAngle+h.ticksAngle;if(p.save(),p.rotate(bl),T&&(p.beginPath(),p.arc(0,0,q,_e.radians(ue)-Z,_e.radians(pe)+Z,!1),p.strokeStyle=h.colorBarStroke,p.lineWidth=2*$,p.stroke(),p.closePath()),P&&(p.beginPath(),p.arc(0,0,q,_e.radians(ue),_e.radians(pe),!1),p.strokeStyle=h.colorBar,p.lineWidth=P,p.stroke(),p.closePath(),h.barShadow&&(p.save(),p.beginPath(),p.arc(0,0,S,_e.radians(ue),_e.radians(pe),!1),p.clip(),p.beginPath(),p.strokeStyle=h.colorBar,p.lineWidth=1,p.shadowBlur=h.barShadow,p.shadowColor=h.colorBarShadow,p.shadowOffsetX=0,p.shadowOffsetY=0,p.arc(0,0,S,_e.radians(h.startAngle),_e.radians(h.startAngle+h.ticksAngle),!1),p.stroke(),p.closePath(),p.restore()),h.barProgress)){var De=La(h),Ee=De.startAngle,Oe=De.endAngle;p.beginPath(),p.arc(0,0,q,_e.radians(Ee),_e.radians(Oe),!1),p.strokeStyle=h.colorBarProgress,p.lineWidth=P,p.stroke(),p.closePath()}p.restore()}function Wa(p){return p.options.animatedValue?p.options.value:p.value}function To(p,h,b,S,T,P,z,$){p.beginPath(),p.fillStyle=$?_e.linearGradient(p,z,$,T>P?T:P,P>T,T>P?b:S):z,h>0?_e.roundRect(p,b,S,T,P,h):p.rect(b,S,T,P),p.fill(),p.closePath()}function Ri(p,h,b,S,T,P,z,$,q){p.beginPath(),p.lineWidth=h,p.strokeStyle=q?_e.linearGradient(p,$,q,z,!0,T):$,b>0?_e.roundRect(p,S,T,P,z,b):p.rect(S,T,P,z),p.stroke(),p.closePath()}function Do(p,h,b,S,T,P){function z(je,nt,pt,ni){return je&&(!ni&&h.borderShadowWidth&&(p.save(),p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),Ri(p,je*$,q,b+je*$/2-Pe,S+je*$/2-Pe,Z,Ee,nt,pt),Pe+=.5*$,!ni&&h.borderShadowWidth&&(ni=!0,p.restore())),ni}var $=Vi.pixelRatio,q=h.borderRadius*$,Z=T-h.borderShadowWidth-h.borderOuterWidth*$,ue=Z-h.borderOuterWidth*$-h.borderMiddleWidth*$,pe=ue-h.borderMiddleWidth*$-h.borderInnerWidth*$,De=pe-h.borderInnerWidth*$,Ee=P-h.borderShadowWidth-h.borderOuterWidth*$,Oe=Ee-h.borderOuterWidth*$-h.borderMiddleWidth*$,Qe=Oe-h.borderMiddleWidth*$-h.borderInnerWidth*$,Ie=Qe-h.borderInnerWidth*$,Ye=b-(ue-Z)/2,Ze=Ye-(pe-ue)/2,Je=Ze-(De-pe)/2,He=S-(Oe-Ee)/2,$e=He-(Qe-Oe)/2,Ge=$e-(Ie-Qe)/2,Pe=0,Ve=!1;return p.save(),Ve=z(h.borderOuterWidth,h.colorBorderOuter,h.colorBorderOuterEnd,Ve),Ve=z(h.borderMiddleWidth,h.colorBorderMiddle,h.colorBorderMiddleEnd,Ve),Ve=z(h.borderInnerWidth,h.colorBorderInner,h.colorBorderInnerEnd,Ve),!Ve&&h.borderShadowWidth&&(p.shadowBlur=h.borderShadowWidth,p.shadowColor=h.colorBorderShadow),To(p,q,Je,Ge,De+2*Pe,Ie+2*Pe,h.colorPlate,h.colorPlateEnd),p.restore(),[Je,Ge,De,Ie]}function Eo(p,h,b,S,T,P){var z=Vi.pixelRatio,$=P>=T,q=$?.85*T:P,Z=$?P:T;b=$?Fe(b+(T-q)/2):b;var ue=!!h.title,pe=!!h.units,De=!!h.valueBox,Ee=void 0,Oe=void 0,Qe=void 0;$?(Oe=Fe(.05*Z),Ee=Fe(.075*Z),Qe=Fe(.11*Z),ue&&(Z-=Ee,S+=Ee),pe&&(Z-=Oe),De&&(Z-=Qe)):(Oe=Ee=Fe(.15*q),ue&&(q-=Ee,S+=Ee),pe&&(q-=Oe));var Ie=2*h.barStrokeWidth,Ye=h.barBeginCircle?Fe(q*h.barBeginCircle/200-Ie/2):0,Ze=Fe(q*h.barWidth/100-Ie),Je=Fe(Z*h.barLength/100-Ie),He=Fe((Z-Je)/2),$e=Fe(b+($?q/2:He+Ye)),Ge=Fe(S+($?Z-He-Ye+Ie/2:q/2)),Pe=!$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*q,Ve=$||h.hasLeft&&h.hasRight?0:(h.hasRight?-1:1)*h.ticksWidth/100*q;return p.barDimensions={isVertical:$,width:q,length:Z,barWidth:Ze,barLength:Je,strokeWidth:Ie,barMargin:He,radius:Ye,pixelRatio:z,barOffset:null,titleMargin:ue?Ee:0,unitsMargin:pe?Oe:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:b+Pe,Y:S+Ve,x0:$e+Pe,y0:Ge+Ve,baseX:b,baseY:S,ticksPadding:h.ticksPadding/100},p.barDimensions}function Fa(p,h,b,S,T,P,z){var $=Eo(p,h,S,T,P,z),q=$.isVertical,Z=$.width,ue=$.barWidth,pe=$.barLength,De=$.strokeWidth,Ee=$.barMargin,Oe=$.radius,Qe=$.x0,Ie=$.y0,Ye=$.X,Ze=$.Y,Je=pe;p.save(),p.beginPath();var He=null;if(h.barBeginCircle){var $e=_e.radians(q?270:0),Ge=Math.asin(ue/2/Oe),Pe=Math.cos(Ge),Ve=Math.sin(Ge),je=Qe+(q?Oe*Ve:Oe*Pe-De/2),nt=q?Ie-Oe*Pe:Ie+Oe*Ve,pt=Li(q?nt-Ie:je-Qe);He=Fe(pt+Oe);var ni=q?Fe(Qe-Oe*Ve):je,vi=q?nt:Fe(Ie-Oe*Ve);b==="progress"&&(pe=He+(pe-He)*(_e.normalizedValue(h).normal-h.minValue)/(h.maxValue-h.minValue));var Vo=Fe(je+pe-He+De/2),ua=Fe(nt-pe+He-De/2);p.arc(Qe,Ie,Oe,$e+Ge,$e-Ge),q?(p.moveTo(je,vi),p.lineTo(je,ua),p.lineTo(ni,ua),p.lineTo(ni,vi)):(p.moveTo(je,vi),p.lineTo(Vo,vi),p.lineTo(Vo,nt),p.lineTo(je,nt))}else{var Yd=Fe(q?Ye+(Z-ue)/2:Ye+Ee),Zd=Fe(q?Ze+pe+Ee:Ze+(Z-ue)/2);b==="progress"&&(pe*=(h.value-h.minValue)/(h.maxValue-h.minValue)),q?p.rect(Yd,Zd,ue,-pe):p.rect(Yd,Zd,pe,ue)}b!=="progress"&&h.barStrokeWidth&&(p.lineWidth=De,p.strokeStyle=h.colorBarStroke,p.stroke()),b!=="progress"&&h.colorBar?(p.fillStyle=h.colorBarEnd?_e.linearGradient(p,h.colorBar,h.colorBarEnd,pe,q,q?Ze:Ye):h.colorBar,p.fill()):b==="progress"&&h.colorBarProgress&&(p.fillStyle=h.colorBarProgressEnd?_e.linearGradient(p,h.colorBarProgress,h.colorBarProgressEnd,Je,q,q?Ze:Ye):h.colorBarProgress,p.fill()),p.closePath(),p.restore(),h.barBeginCircle&&(p.barDimensions.radius+=De),p.barDimensions.barOffset=He,p.barDimensions.barWidth+=De,p.barDimensions.barLength+=De}function Po(p,h,b,S,T,P){Fa(p,h,"",b,S,T,P)}function Io(p,h){return h.needleSide!==p||h.tickSide!==p||h.numberSide!==p}function br(p,h,b,S,T,P){h.barProgress&&Fa(p,h,"progress",b,S,T,P)}function Df(p,h){var b=p.barDimensions,S=b.isVertical,T=b.width,P=b.length,z=b.barWidth,$=b.barOffset,q=b.barMargin,Z=b.X,ue=b.Y,pe=b.ticksLength,De=b.ticksPadding,Ee=T*(parseFloat(h.highlightsWidth)||0)/100;if(h.highlights&&Ee){var Oe=h.tickSide!=="right",Qe=h.tickSide!=="left",Ie=0,Ye=h.highlights.length,Ze=(T-z)/2,Je=h.maxValue-h.minValue,He=Fe(S?Z+Ze:Z+q+$),$e=Ee,Ge=S?ue+P-q-$:ue+Ze,Pe=Fe((h.ticksWidth/100+De)*T)+(Ee-h.ticksWidth/100*T),Ve=Fe(z+De*T);for(p.save();Ie<Ye;Ie++){var je=h.highlights[Ie],nt=pe*Li(h.minValue-je.from)/Je,pt=pe*Li((je.to-je.from)/Je);p.beginPath(),p.fillStyle=je.color,S?(Oe&&p.rect(He-Pe,Ge-nt,$e,-pt),Qe&&p.rect(He+Ve,Ge-nt,$e,-pt)):(Oe&&p.rect(He+nt,Ge-Pe,pt,$e),Qe&&p.rect(He+nt,Ge+Ve,pt,$e)),p.fill(),p.closePath()}p.restore()}}function Ar(p,h,b,S,T){p.beginPath(),p.moveTo(h,b),p.lineTo(S,T),p.stroke(),p.closePath()}function zd(p,h,b,S,T,P,z,$,q){var Z=p.barDimensions,ue=Z.isVertical,pe=Z.length,De=Z.barWidth,Ee=Z.barOffset,Oe=Z.barMargin,Qe=Z.pixelRatio,Ie=Z.width,Ye=Z.X,Ze=Z.Y,Je=Z.ticksLength,He=Z.ticksPadding,$e=(Ie-De)/2,Ge=void 0,Pe=void 0,Ve=0,je=b.length,nt=void 0,pt=q*Ie,ni=$e-He*Ie,vi=$e+De+pt+He*Ie,Vo=h instanceof Array?h:new Array(b.length).fill(h);p.save(),p.lineWidth=$*Qe;for(var ua=Je/(T-S);Ve<je;Ve++)nt=b[Ve],p.strokeStyle=Vo[Ve],ue?(Pe=Ze+pe-Oe-Ee+(S-nt)*ua,P&&(Ge=Ye+ni,Ar(p,Ge,Pe,Fe(Ge-pt),Pe)),z&&(Ge=Ye+vi,Ar(p,Ge,Pe,Fe(Ge-pt),Pe))):(Ge=Ye+Oe+Ee-(S-nt)*ua,P&&(Pe=Ze+ni,Ar(p,Ge,Pe,Ge,Fe(Pe-pt))),z&&(Pe=Ze+vi,Ar(p,Ge,Fe(Pe),Ge,Pe-pt)));p.restore()}function Ef(p,h){var b=_e.prepareTicks(h),S=Hd(b,2),T=S[0],P=S[1],z=2,$=(h.maxValue-h.minValue)/(h.majorTicks.length-1),q=h.colorMajorTicks instanceof Array?h.colorMajorTicks:new Array(h.majorTicks.length).fill(h.colorStrokeTicks||h.colorMajorTicks);if(zd(p,q,h.exactTicks?h.majorTicks:h.majorTicks.map(function(pt,ni){return h.minValue+$*ni}),h.minValue,h.maxValue,T,P,z,h.ticksWidth/100),h.strokeTicks){var Z=p.barDimensions,ue=Z.isVertical,pe=Z.length,De=Z.width,Ee=Z.barWidth,Oe=Z.barMargin,Qe=Z.barOffset,Ie=Z.X,Ye=Z.Y,Ze=Z.ticksLength,Je=Z.pixelRatio,He=Z.ticksPadding,$e=(De-Ee)/2+Ee+He*De,Ge=(De-Ee)/2-He*De,Pe=void 0,Ve=void 0,je=void 0,nt=void 0;p.strokeStyle=h.colorStrokeTicks||q[0],z*=Je,ue?(Ve=Ye+pe-Oe-Qe+z/2,nt=Ve-Ze-z,T&&(je=Pe=Fe(Ie+Ge),yr(p,Pe,Ve,je,nt)),P&&(je=Pe=Fe(Ie+$e),yr(p,Pe,Ve,je,nt))):(Pe=Ie+Oe+Qe-z/2,je=Pe+Ze+z,T&&(nt=Ve=Fe(Ye+Ge),yr(p,Pe,Ve,je,nt)),P&&(nt=Ve=Fe(Ye+$e),yr(p,Pe,Ve,je,nt)))}}function yr(p,h,b,S,T){p.beginPath(),p.moveTo(h,b),p.lineTo(S,T),p.stroke(),p.closePath()}function Pf(p,h){var b=_e.prepareTicks(h),S=Hd(b,2),T=S[0],P=S[1],z=[],$=h.minValue,q=Math.abs(h.minorTicks)||0,Z=q?(h.maxValue-h.minValue)/(q*(h.majorTicks.length-1)):0;if(q)if(h.exactTicks)for(var ue=Yi.mod(h.majorTicks[0],q)||0;$<h.maxValue;$+=q)ue+$<h.maxValue&&z.push(ue+$);else for(;$<h.maxValue;$+=Z)z.push($);zd(p,h.colorMinorTicks||h.colorStrokeTicks,z,h.minValue,h.maxValue,T,P,1,h.ticksWidthMinor/100)}function If(p,h){var b=p.barDimensions,S=b.isVertical,T=b.length,P=b.width,z=b.barWidth,$=b.barMargin,q=b.barOffset,Z=b.X,ue=b.Y,pe=b.ticksLength,De=b.ticksPadding,Ee=h.maxValue-h.minValue,Oe=Ee/(h.majorTicks.length-1),Qe=h.exactTicks?h.majorTicks:h.majorTicks.map(function(Vo,ua){return h.minValue+Oe*ua}),Ie=Qe.length,Ye=h.numberSide!=="right",Ze=h.numberSide!=="left",Je=h.fontNumbersSize*P/200,He=0,$e=(h.ticksWidth/100+2*De)*P,Ge=(P-z)/2-$e,Pe=(P-z)/2+z+$e,Ve=void 0,je=void 0,nt=void 0,pt=void 0,ni=h.colorNumbers instanceof Array?h.colorNumbers:new Array(Ie).fill(h.colorNumbers),vi=h.numbersMargin/100*P;for(p.font=_e.font(h,"Numbers",P/200),p.lineWidth=0,p.textAlign="center";He<Ie;He++)p.fillStyle=ni[He],pt=h.majorTicks[He],nt=h.exactTicks?pe*((Qe[He]-h.minValue)/Ee):He*pe/(Ie-1),S?(je=ue+T-$-q-nt+Je/3,Ye&&(p.textAlign="right",p.fillText(pt,Z+Ge-vi,je)),Ze&&(p.textAlign="left",p.fillText(pt,Z+Pe+vi,je))):(p.measureText(pt).width,Ve=Z+$+q+nt,Ye&&p.fillText(pt,Ve,ue+Ge-vi),Ze&&p.fillText(pt,Ve,ue+Pe+Je+vi))}function Nf(p,h){if(h.title){var b=p.barDimensions,S=b.isVertical,T=b.width,P=b.length,z=b.baseX,$=b.baseY,q=b.titleMargin,Z=h.fontTitleSize*T/200,ue=Fe(z+(S?T:P)/2),pe=Fe($+q/2-(S?Z:Z/2)-.025*(S?P:T));p.save(),p.textAlign="center",p.fillStyle=h.colorTitle,p.font=_e.font(h,"Title",T/200),p.lineWidth=0,p.fillText(h.title,ue,pe,S?T:P),p.restore()}}function Of(p,h){if(h.units){var b=p.barDimensions,S=b.isVertical,T=b.width,P=b.length,z=b.baseX,$=b.baseY,q=b.unitsMargin,Z=h.fontUnitsSize*T/200,ue=Fe(z+(S?T:P)/2),pe=Fe($+(S?P:T)+q/2-Z/2);p.save(),p.textAlign="center",p.fillStyle=h.colorUnits,p.font=_e.font(h,"Units",T/200),p.lineWidth=0,p.fillText(_e.formatContext(h,h.units),ue,pe,S?T:P),p.restore()}}function Rf(p,h){if(h.needle){var b=p.barDimensions,S=b.isVertical,T=b.width,P=b.length,z=b.barWidth,$=b.barOffset,q=b.barMargin,Z=b.ticksLength,ue=b.X,pe=b.Y,De=b.ticksPadding,Ee=h.needleSide!=="right",Oe=h.needleSide!=="left",Qe=Z*(_e.normalizedValue(h).indented-h.minValue)/(h.maxValue-h.minValue),Ie=(h.ticksWidth/100+De)*T,Ye=z/2+Ie,Ze=Ye*(h.needleEnd/100),Je=void 0,He=void 0,$e=void 0,Ge=void 0,Pe=h.needleType.toLowerCase()==="arrow"?Lf:Vf,Ve=(T-z)/2,je=Ye*(h.needleStart/100),nt=Ve-Ie-je,pt=Ve+z+Ie+je;p.save(),_e.drawNeedleShadow(p,h),S?($e=Fe(pe+P-q-$-Qe),Ee&&(Je=Fe(ue+nt),He=Je+Ze,Pe(p,h,Je,$e,He,$e,Ze)),Oe&&(Je=Fe(ue+pt),He=Je-Ze,Pe(p,h,Je,$e,He,$e,Ze,!0))):(Je=Fe(ue+q+$+Qe),Ee&&($e=Fe(pe+nt),Ge=$e+Ze,Pe(p,h,Je,$e,Je,Ge,Ze)),Oe&&($e=Fe(pe+pt),Ge=$e-Ze,Pe(p,h,Je,$e,Je,Ge,Ze,!0))),p.restore()}}function Ud(p,h,b,S){return h.colorNeedleEnd?_e.linearGradient(p,S?h.colorNeedleEnd:h.colorNeedle,S?h.colorNeedle:h.colorNeedleEnd,b,!p.barDimensions.isVertical):h.colorNeedle}function Vf(p,h,b,S,T,P,z,$){p.lineWidth=h.needleWidth,p.strokeStyle=Ud(p,h,z,$),p.beginPath(),p.moveTo(b,S),p.lineTo(T,P),p.stroke(),p.closePath()}function Lf(p,h,b,S,T,P,z,$){var q=Fe(.4*z),Z=z-q,ue=b===T,pe=h.needleWidth/2;p.fillStyle=Ud(p,h,z,$),p.beginPath(),ue?(S>P&&(Z*=-1),p.moveTo(b-pe,S),p.lineTo(b+pe,S),p.lineTo(b+pe,S+Z),p.lineTo(b,P),p.lineTo(b-pe,S+Z),p.lineTo(b-pe,S)):(b>T&&(Z*=-1),p.moveTo(b,S-pe),p.lineTo(b,S+pe),p.lineTo(b+Z,S+pe),p.lineTo(T,S),p.lineTo(b+Z,S-pe),p.lineTo(b,S-pe)),p.fill(),p.closePath()}function Wf(p,h,b,S,T,P,z){var $=(parseFloat(h.fontValueSize)||0)*P/200,q=(.11*z-$)/2;p.barDimensions.isVertical&&_e.drawValueBox(p,h,b,S+P/2,T+z-$-q,P)}var Hd=(function(){function p(h,b){var S=[],T=!0,P=!1,z=void 0;try{for(var $,q=h[Symbol.iterator]();!(T=($=q.next()).done)&&(S.push($.value),!b||S.length!==b);T=!0);}catch(Z){P=!0,z=Z}finally{try{!T&&q.return&&q.return()}finally{if(P)throw z}}return S}return function(h,b){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return p(h,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),pl=function p(h,b,S){h===null&&(h=Function.prototype);var T=Object.getOwnPropertyDescriptor(h,b);if(T===void 0){var P=Object.getPrototypeOf(h);return P===null?void 0:p(P,b,S)}if("value"in T)return T.value;var z=T.get;if(z!==void 0)return z.call(S)},Ff=function p(h,b,S,T){var P=Object.getOwnPropertyDescriptor(h,b);if(P===void 0){var z=Object.getPrototypeOf(h);z!==null&&p(z,b,S,T)}else if("value"in P&&P.writable)P.value=S;else{var $=P.set;$!==void 0&&$.call(T,S)}return S},ca=(function(){function p(h,b){for(var S=0;S<b.length;S++){var T=b[S];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(h,T.key,T)}}return function(h,b,S){return b&&p(h.prototype,b),S&&p(h,S),h}})(),xr=null,Gf=(function(){function p(){i(this,p),this._events={},this.addListener=this.on,this.removeListener=this.off}return ca(p,[{key:"emit",value:function(h){if(this._events[h]){for(var b=0,S=this._events[h].length,T=arguments.length,P=Array(T>1?T-1:0),z=1;z<T;z++)P[z-1]=arguments[z];for(;b<S;b++)this._events[h][b]&&this._events[h][b].apply(this,P)}}},{key:"once",value:function(h){for(var b=arguments.length,S=Array(b>1?b-1:0),T=1;T<b;T++)S[T-1]=arguments[T];for(var P=0,z=S.length,$=this;P<z;P++)(function(){var q=S[P],Z=function ue(){$.off(h,ue),q.apply($,arguments)};S[P]=Z})();this.on.apply(this,[h].concat(S))}},{key:"on",value:function(h){this._events[h]||(this._events[h]=[]);for(var b=0,S=arguments.length<=1?0:arguments.length-1;b<S;b++)this._events[h].push(arguments.length<=b+1?void 0:arguments[b+1])}},{key:"off",value:function(h){if(this._events[h])for(var b=0,S=arguments.length<=1?0:arguments.length-1;b<S;b++)for(var T=arguments.length<=b+1?void 0:arguments[b+1],P=void 0;~(P=this._events[h].indexOf(T));)this._events[h].splice(P,1)}},{key:"removeAllListeners",value:function(h){delete this._events[h]}},{key:"listeners",get:function(){return this._events}}]),p})(),qd=a("requestAnimationFrame")||function(p){return setTimeout(function(){return p(new Date().getTime())},1e3/60)},No={linear:function(p){return p},quad:function(p){return Math.pow(p,2)},dequad:function(p){return 1-No.quad(1-p)},quint:function(p){return Math.pow(p,5)},dequint:function(p){return 1-Math.pow(1-p,5)},cycle:function(p){return 1-Math.sin(Math.acos(p))},decycle:function(p){return Math.sin(Math.acos(1-p))},bounce:function(p){return 1-No.debounce(1-p)},debounce:function(p){for(var h=0,b=1;;h+=b,b/=2)if(p>=(7-4*h)/11)return-Math.pow((11-6*h-11*p)/4,2)+Math.pow(b,2)},elastic:function(p){return 1-No.delastic(1-p)},delastic:function(p){return Math.pow(2,10*(p-1))*Math.cos(20*Math.PI*1.5/3*p)}},gl=(function(){function p(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"linear",b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:250,S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},T=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){};if(i(this,p),this.duration=b,this.rule=h,this.draw=S,this.end=T,typeof this.draw!="function")throw new TypeError("Invalid animation draw callback:",S);if(typeof this.end!="function")throw new TypeError("Invalid animation end callback:",T)}return ca(p,[{key:"animate",value:function(h,b){var S=this;this.frame&&this.cancel();var T=window.performance&&window.performance.now?window.performance.now():a("animationStartTime")||Date.now();h=h||this.draw,b=b||this.end,this.draw=h,this.end=b,this.frame=qd(function(P){return r(P,h,T,No[S.rule]||S.rule,S.duration,b,S)})}},{key:"cancel",value:function(){this.frame&&((a("cancelAnimationFrame")||function(h){})(this.frame),this.frame=null)}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),p})();gl.rules=No;var Ga=(function(){function p(h,b,S){i(this,p),this.options=h,this.element=b.toLowerCase(),this.type=p.toDashed(S),this.Type=n[S],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||p.domReady(this.traverse.bind(this))}return ca(p,[{key:"isValidNode",value:function(h){return!(!h.tagName||h.tagName.toLowerCase()!==this.element||h.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var h=document.getElementsByTagName(this.element),b=0,S=h.length;b<S;b++)this.process(h[b]);this.isObservable&&!this.mutationsObserved&&(new MutationObserver(this.observe.bind(this)).observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeOldValue:!0,characterDataOldValue:!0}),this.mutationsObserved=!0)}},{key:"observe",value:function(h){for(var b=0,S=h.length;b<S;b++){var T=h[b];if(T.type==="attributes"&&T.attributeName==="data-type"&&this.isValidNode(T.target)&&T.oldValue!==this.type)setTimeout(this.process.bind(this,T.target));else if(T.addedNodes&&T.addedNodes.length)for(var P=0,z=T.addedNodes.length;P<z;P++)setTimeout(this.process.bind(this,T.addedNodes[P]))}}},{key:"process",value:function(h){var b=this;if(!this.isValidNode(h))return null;var S=void 0,T=JSON.parse(JSON.stringify(this.options)),P=null;for(S in T)if(T.hasOwnProperty(S)){var z=p.toAttributeName(S),$=p.parse(h.getAttribute(z));$!=null&&(T[S]=$)}return T.renderTo=h,P=new this.Type(T),P.draw&&P.draw(),this.isObservable&&(P.observer=new MutationObserver(function(q){q.forEach(function(Z){if(Z.type==="attributes"){var ue=Z.attributeName.toLowerCase(),pe=h.getAttribute(ue).toLowerCase();if(ue==="data-type"&&pe&&pe!==b.type)P.observer.disconnect(),delete P.observer,P.destroy&&P.destroy();else if(ue.substr(0,5)==="data-"){var De=ue.substr(5).split("-").map(function(Oe,Qe){return Qe?Oe.charAt(0).toUpperCase()+Oe.substr(1):Oe}).join(""),Ee={};Ee[De]=p.parse(h.getAttribute(Z.attributeName)),De==="value"?P&&(P.value=Ee[De]):P.update&&P.update(Ee)}}})}),P.observer.observe(h,{attributes:!0})),P}}],[{key:"parse",value:function(h){if(h==="true")return!0;if(h==="false")return!1;if(h!=="undefined"){if(h==="null")return null;if(/^[-+#.\w\d\s]+(?:,[-+#.\w\d\s]*)+$/.test(h))return h.split(",");try{return JSON.parse(h)}catch(b){}return h}}},{key:"toDashed",value:function(h){for(var b=h.split(/(?=[A-Z])/),S=1,T=b.length,P=b[0].toLowerCase();S<T;S++)P+="-"+b[S].toLowerCase();return P}},{key:"toCamelCase",value:function(h){for(var b=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],S=h.split(/-/),T=0,P=S.length,z="";T<P;T++)z+=T||b?S[T][0].toUpperCase()+S[T].substr(1).toLowerCase():S[T].toLowerCase();return z}},{key:"toAttributeName",value:function(h){return"data-"+p.toDashed(h)}},{key:"domReady",value:function(h){if(/comp|inter|loaded/.test((window.document||{}).readyState+""))return h();window.addEventListener?window.addEventListener("DOMContentLoaded",h,!1):window.attachEvent&&window.attachEvent("onload",h)}}]),p})(),Vi=(function(){function p(h,b,S){i(this,p),p.collection.push(this),this.width=b||0,this.height=S||0,this.element=h,this.init()}return ca(p,[{key:"init",value:function(){var h=p.pixelRatio;this.element.width=this.width*h,this.element.height=this.height*h,this.element.style.width=this.width+"px",this.element.style.height=this.height+"px",this.elementClone=this.element.cloneNode(!0),this.context=this.element.getContext("2d"),this.contextClone=this.elementClone.getContext("2d"),this.drawWidth=this.element.width,this.drawHeight=this.element.height,this.drawX=this.drawWidth/2,this.drawY=this.drawHeight/2,this.minSide=this.drawX<this.drawY?this.drawX:this.drawY,this.contextClone.translate(this.drawX,this.drawY),this.elementClone.initialized=!1,this.context.translate(this.drawX,this.drawY),this.context.max=this.contextClone.max=this.minSide,this.context.maxRadius=this.contextClone.maxRadius=null}},{key:"destroy",value:function(){var h=p.collection.indexOf(this);~h&&p.collection.splice(h,1),this.context.clearRect(-this.drawX,-this.drawY,this.drawWidth,this.drawHeight),this.context.max=null,delete this.context.max,this.context.maxRadius=null,delete this.context.maxRadius,this.context=null,this.contextClone=null,this.elementClone=null,this.element=null,this.onRedraw=null}},{key:"commit",value:function(){var h=p.pixelRatio;return h!==1&&this.contextClone.scale(h,h),this}},{key:"redraw",value:function(){return this.init(),this.onRedraw&&this.onRedraw(),this}}],[{key:"redraw",value:function(){for(var h=0,b=p.collection.length;h<b;h++)p.collection[h].redraw()}},{key:"pixelRatio",get:function(){return window.devicePixelRatio||1}}]),p})();Vi.collection=[],window.matchMedia&&window.matchMedia("screen and (min-resolution: 2dppx)").addListener(Vi.redraw);var fl={renderTo:null,width:0,height:0,minValue:0,maxValue:100,value:0,units:!1,exactTicks:!1,majorTicks:[0,20,40,60,80,100],minorTicks:10,strokeTicks:!0,animatedValue:!1,animateOnInit:!1,title:!1,borders:!0,numbersMargin:1,listeners:null,valueInt:3,valueDec:2,majorTicksInt:1,majorTicksDec:0,animation:!0,animationDuration:500,animationRule:"cycle",colorPlate:"#fff",colorPlateEnd:"",colorMajorTicks:"#444",colorMinorTicks:"#666",colorStrokeTicks:"",colorTitle:"#888",colorUnits:"#888",colorNumbers:"#444",colorNeedle:"rgba(240,128,128,1)",colorNeedleEnd:"rgba(255,160,122,.9)",colorValueText:"#444",colorValueTextShadow:"rgba(0,0,0,0.3)",colorBorderShadow:"rgba(0,0,0,0.5)",colorBorderOuter:"#ddd",colorBorderOuterEnd:"#aaa",colorBorderMiddle:"#eee",colorBorderMiddleEnd:"#f0f0f0",colorBorderInner:"#fafafa",colorBorderInnerEnd:"#ccc",colorValueBoxRect:"#888",colorValueBoxRectEnd:"#666",colorValueBoxBackground:"#babab2",colorValueBoxShadow:"rgba(0,0,0,1)",colorNeedleShadowUp:"rgba(2,255,255,0.2)",colorNeedleShadowDown:"rgba(188,143,143,0.45)",colorBarStroke:"#222",colorBar:"#ccc",colorBarProgress:"#888",colorBarShadow:"#000",fontNumbers:"Arial",fontTitle:"Arial",fontUnits:"Arial",fontValue:"Arial",fontNumbersSize:20,fontTitleSize:24,fontUnitsSize:22,fontValueSize:26,fontNumbersStyle:"normal",fontTitleStyle:"normal",fontUnitsStyle:"normal",fontValueStyle:"normal",fontNumbersWeight:"normal",fontTitleWeight:"normal",fontUnitsWeight:"normal",fontValueWeight:"normal",needle:!0,needleShadow:!0,needleType:"arrow",needleStart:5,needleEnd:85,needleWidth:4,borderOuterWidth:3,borderMiddleWidth:3,borderInnerWidth:3,borderShadowWidth:3,valueBox:!0,valueBoxStroke:5,valueBoxWidth:0,valueText:"",valueTextShadow:!0,valueBoxBorderRadius:2.5,highlights:[{from:20,to:60,color:"#eee"},{from:60,to:80,color:"#ccc"},{from:80,to:100,color:"#999"}],highlightsWidth:15,highlightsLineCap:"butt",barWidth:20,barStrokeWidth:0,barProgress:!0,barShadow:0};s.prototype=Object.create(Array.prototype),s.prototype.constructor=s,s.prototype.get=function(p){if(typeof p=="string")for(var h=0,b=this.length;h<b;h++){var S=this[h].options.renderTo.tagName?this[h].options.renderTo:document.getElementById(this[h].options.renderTo||"");if(S.getAttribute("id")===p)return this[h]}else if(typeof p=="number")return this[p];return null};var vl="2.2.1",Fe=Math.round,Li=Math.abs,Oo=new s;Oo.version=vl;var Yi=(function(p){function h(b){i(this,h);var S=e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this)),T=S.constructor.name;if(T==="BaseGauge")throw new TypeError("Attempt to instantiate abstract class!");if(Oo.push(S),b.listeners&&Object.keys(b.listeners).forEach(function(z){(b.listeners[z]instanceof Array?b.listeners[z]:[b.listeners[z]]).forEach(function($){S.on(z,$)})}),S.version=vl,S.type=n[T]||h,S.initialized=!1,b.minValue=parseFloat(b.minValue),b.maxValue=parseFloat(b.maxValue),b.value=parseFloat(b.value)||0,b.borders||(b.borderInnerWidth=b.borderMiddleWidth=b.borderOuterWidth=0),!b.renderTo)throw TypeError("Canvas element was not specified when creating the Gauge object!");var P=b.renderTo.tagName?b.renderTo:document.getElementById(b.renderTo);if(!(P instanceof HTMLCanvasElement))throw TypeError("Given gauge canvas element is invalid!");return b.width=parseFloat(b.width)||0,b.height=parseFloat(b.height)||0,b.width&&b.height||(b.width||(b.width=P.parentNode?P.parentNode.offsetWidth:P.offsetWidth),b.height||(b.height=P.parentNode?P.parentNode.offsetHeight:P.offsetHeight)),S.options=b||{},S.options.animateOnInit&&(S._value=S.options.value,S.options.value=S.options.minValue),S.canvas=new Vi(P,b.width,b.height),S.canvas.onRedraw=S.draw.bind(S),S.animation=new gl(b.animationRule,b.animationDuration),S}return t(h,p),ca(h,[{key:"update",value:function(b){return Object.assign(this.options,this.type.configure(b||{})),this.canvas.width=this.options.width,this.canvas.height=this.options.height,this.animation.rule=this.options.animationRule,this.animation.duration=this.options.animationDuration,this.canvas.redraw(),this}},{key:"destroy",value:function(){var b=Oo.indexOf(this);~b&&Oo.splice(b,1),this.canvas.destroy(),this.canvas=null,this.animation.destroy(),this.animation=null,this.emit("destroy")}},{key:"draw",value:function(){return this.options.animateOnInit&&!this.initialized&&(this.value=this._value,this.initialized=!0,this.emit("init")),this.emit("render"),this}},{key:"value",set:function(b){var S=this;b=h.ensureValue(b,this.options.minValue);var T=this.options.value;if(b!==T)if(this.options.animation){if(this.animation.frame&&(this.options.value=this._value,this._value===b))return this.animation.cancel(),void delete this._value;this._value===void 0&&(this._value=b),this.emit("animationStart"),this.animation.animate(function(P){var z=T+(b-T)*P;S.options.animatedValue&&S.emit("value",z,S.value),S.options.value=z,S.draw(),S.emit("animate",P,S.options.value)},function(){S._value!==void 0&&(S.emit("value",S._value,S.value),S.options.value=S._value,delete S._value),S.draw(),S.emit("animationEnd"),S.animation.frame=null})}else this.emit("value",b,this.value),this.options.value=b,this.draw()},get:function(){return this._value===void 0?this.options.value:this._value}}],[{key:"configure",value:function(b){return b}},{key:"initialize",value:function(b,S){return new Ga(S,"canvas",b)}},{key:"fromElement",value:function(b){var S=Ga.toCamelCase(b.getAttribute("data-type")),T=b.attributes,P=0,z=T.length,$={};if(S){for(/Gauge$/.test(S)||(S+="Gauge");P<z;P++)$[Ga.toCamelCase(T[P].name.replace(/^data-/,""),!1)]=Ga.parse(T[P].value);new Ga($,b.tagName,S).process(b)}}},{key:"ensureValue",value:function(b){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return b=parseFloat(b),!isNaN(b)&&isFinite(b)||(b=parseFloat(S)||0),b}},{key:"mod",value:function(b,S){return(b%S+S)%S}},{key:"version",get:function(){return vl}}]),h})(Gf);n!==void 0&&(n.BaseGauge=Yi,n.gauges=(window.document||{}).gauges=Oo);var Bf=/{([_a-zA-Z]+[_a-zA-Z0-9]*)}/g,_e={roundRect:v,padValue:A,formatMajorTickNumber:C,radians:_,radialPoint:M,linearGradient:B,drawNeedleShadow:D,drawValueBox:j,verifyError:l,prepareTicks:g,font:V,normalizedValue:Ce,formatContext:m},Ro=Math.PI,bl=Ro/2,$d=Object.assign({},fl,{ticksAngle:270,startAngle:45,colorNeedleCircleOuter:"#f0f0f0",colorNeedleCircleOuterEnd:"#ccc",colorNeedleCircleInner:"#e8e8e8",colorNeedleCircleInnerEnd:"#f5f5f5",needleCircleSize:10,needleCircleInner:!0,needleCircleOuter:!0,needleStart:20,animationTarget:"needle",useMinPath:!1,barWidth:0,barStartPosition:"left"}),zf=(function(p){function h(b){return i(this,h),b=Object.assign({},$d,b||{}),e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,h.configure(b)))}return t(h,p),ca(h,[{key:"draw",value:function(){try{var b=this.canvas,S=[-b.drawX,-b.drawY,b.drawWidth,b.drawHeight],T=S[0],P=S[1],z=S[2],$=S[3],q=this.options;if(q.animationTarget==="needle"){if(!b.elementClone.initialized){var Z=b.contextClone;Z.clearRect(T,P,z,$),this.emit("beforePlate"),se(Z,q),this.emit("beforeHighlights"),ce(Z,q),this.emit("beforeMinorTicks"),oe(Z,q),this.emit("beforeMajorTicks"),le(Z,q),this.emit("beforeNumbers"),st(Z,q),this.emit("beforeTitle"),Dt(Z,q),this.emit("beforeUnits"),Qt(Z,q),b.elementClone.initialized=!0}this.canvas.commit(),b.context.clearRect(T,P,z,$),b.context.drawImage(b.elementClone,T,P,z,$),this.emit("beforeProgressBar"),da(b.context,q),this.emit("beforeValueBox"),la(b.context,q,Wa(this)),this.emit("beforeNeedle"),pi(b.context,q)}else{var ue=-_e.radians((q.value-q.minValue)/(q.maxValue-q.minValue)*q.ticksAngle);if(b.context.clearRect(T,P,z,$),this.emit("beforePlate"),se(b.context,q),b.context.rotate(ue),this.emit("beforeHighlights"),ce(b.context,q),this.emit("beforeMinorTicks"),oe(b.context,q),this.emit("beforeMajorTicks"),le(b.context,q),this.emit("beforeNumbers"),st(b.context,q),this.emit("beforeProgressBar"),da(b.context,q),b.context.rotate(-ue),!b.elementClone.initialized){var pe=b.contextClone;pe.clearRect(T,P,z,$),this.emit("beforeTitle"),Dt(pe,q),this.emit("beforeUnits"),Qt(pe,q),this.emit("beforeNeedle"),pi(pe,q),b.elementClone.initialized=!0}b.context.drawImage(b.elementClone,T,P,z,$)}this.emit("beforeValueBox"),la(b.context,q,Wa(this)),pl(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(De){_e.verifyError(De)}return this}},{key:"value",set:function(b){b=Yi.ensureValue(b,this.options.minValue),this.options.animation&&this.options.ticksAngle===360&&this.options.useMinPath&&(this._value=b,b=this.options.value+((b-this.options.value)%360+540)%360-180),Ff(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"value",b,this)},get:function(){return pl(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"value",this)}}],[{key:"configure",value:function(b){return b.barWidth>50&&(b.barWidth=50),isNaN(b.startAngle)&&(b.startAngle=45),isNaN(b.ticksAngle)&&(b.ticksAngle=270),b.ticksAngle>360&&(b.ticksAngle=360),b.ticksAngle<0&&(b.ticksAngle=0),b.startAngle<0&&(b.startAngle=0),b.startAngle>360&&(b.startAngle=360),b}}]),h})(Yi);n!==void 0&&(n.RadialGauge=zf),Yi.initialize("RadialGauge",$d);var jd=Object.assign({},fl,{borderRadius:0,barBeginCircle:30,colorBarEnd:"",colorBarProgressEnd:"",needleWidth:6,tickSide:"both",needleSide:"both",numberSide:"both",ticksWidth:10,ticksWidthMinor:5,ticksPadding:5,barLength:85,fontTitleSize:26,highlightsWidth:10}),Uf=(function(p){function h(b){return i(this,h),b=Object.assign({},jd,b||{}),e(this,(h.__proto__||Object.getPrototypeOf(h)).call(this,h.configure(b)))}return t(h,p),ca(h,[{key:"draw",value:function(){try{var b=this.canvas,S=[-b.drawX,-b.drawY,b.drawWidth,b.drawHeight],T=S[0],P=S[1],z=S[2],$=S[3],q=this.options;if(!b.elementClone.initialized){var Z=b.contextClone;Z.clearRect(T,P,z,$),this.emit("beforePlate"),this.drawBox=Do(Z,q,T,P,z,$),this.emit("beforeBar"),Po.apply(void 0,[Z,q].concat(o(this.drawBox))),b.contextClone.barDimensions=Z.barDimensions,this.emit("beforeHighlights"),Df(Z,q),this.emit("beforeMinorTicks"),Pf(Z,q),this.emit("beforeMajorTicks"),Ef(Z,q),this.emit("beforeNumbers"),If(Z,q),this.emit("beforeTitle"),Nf(Z,q),this.emit("beforeUnits"),Of(Z,q),b.elementClone.initialized=!0}this.canvas.commit(),b.context.clearRect(T,P,z,$),b.context.drawImage(b.elementClone,T,P,z,$),this.emit("beforeProgressBar"),br.apply(void 0,[b.context,q].concat(o(this.drawBox))),this.emit("beforeNeedle"),Rf(b.context,q),this.emit("beforeValueBox"),Wf.apply(void 0,[b.context,q,q.animatedValue?this.options.value:this.value].concat(o(this.drawBox))),pl(h.prototype.__proto__||Object.getPrototypeOf(h.prototype),"draw",this).call(this)}catch(ue){_e.verifyError(ue)}return this}}],[{key:"configure",value:function(b){return b.barStrokeWidth>=b.barWidth&&(b.barStrokeWidth=Fe(b.barWidth/2)),b.hasLeft=Io("right",b),b.hasRight=Io("left",b),b.value>b.maxValue&&(b.value=b.maxValue),b.value<b.minValue&&(b.value=b.minValue),Yi.configure(b)}}]),h})(Yi);n!==void 0&&(n.LinearGauge=Uf),Yi.initialize("LinearGauge",jd),typeof tl<"u"&&Object.assign(n,{Collection:s,GenericOptions:fl,Animation:gl,BaseGauge:Yi,drawings:_e,SmartCanvas:Vi,DomObserver:Ga,vendorize:a})})(typeof tl<"u"?tl.exports:window)});var Wu=[{id:null,name:"Dashboard 1",icon:"dashboard-dashboard",configuration:[{w:24,h:24,id:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc",selector:"widget-host2",input:{widgetProperties:{type:"widget-tutorial",uuid:"d1d58e6f-f8b4-4a72-9597-7f92aa6776fc"}},x:0,y:0}],collapseSplitShell:!1}];var yt=(()=>{class n{_settings=y(Wt);_router=y(tu);_destroyRef=y(ze);dashboards=w([],{equal:_i});activeDashboard=w(null);_widgetAction=new Zi(null);widgetAction$=this._widgetAction.asObservable();isDashboardStatic=w(!0);widgetClipboard=w(null);layoutEditSaved=w(0);layoutEditCanceled=w(0);constructor(){let e=this._settings.getDashboardConfig();if(!e||e.length===0){console.warn("[Dashboard Service] No dashboards found in settings, creating blank dashboard");let i=Wu.map(a=>ge(ne({},a),{id:wi.create()}));this.dashboards.set([...i])}else this.dashboards.set(e);this.applyDashboardParam(this.getRouteParam("id"),!1);let t=this._router.events.pipe(Ai(i=>i instanceof eu),Mr({bufferSize:1,refCount:!0}),Le(this._destroyRef));t.pipe(ai(1),Kt(()=>this.getRouteParam("id"))).subscribe(i=>this.applyDashboardParam(i,!0)),t.pipe(kr(1),Kt(()=>this.getRouteParam("id")),wr()).subscribe(i=>this.applyDashboardParam(i,!1)),L(()=>{let i=this.dashboards();G(()=>{this._settings.saveDashboards(i)})})}getRouteParam(e){let t=this._router.routerState.snapshot.root;for(;t;){if(t.paramMap.has(e))return t.paramMap.get(e);t=t.firstChild??null}return null}applyDashboardParam(e,t){if(e===null||e===""){t&&this.setActiveDashboardIndex(0);return}let i=Number(e);if(Number.isNaN(i)){t&&this.setActiveDashboardIndex(0);return}this.setActiveDashboardIndex(i)}setActiveDashboardIndex(e){e!==this.activeDashboard()&&(e>=0&&e<this.dashboards().length?this.activeDashboard.set(e):console.error(`[Dashboard Service] Invalid dashboard ID: ${e}`))}toggleStaticDashboard(){this.isDashboardStatic.set(!this.isDashboardStatic())}add(e,t,i,a){let r=0;return this.dashboards.update(s=>{let l=[...s,{id:wi.create(),name:e,icon:i??"dashboard-dashboard",configuration:t,collapseSplitShell:a??!1}];return r=l.length-1,l}),r}update(e,t,i,a){this.dashboards.update(r=>r.map((s,l)=>l===e?ge(ne({},s),{name:t,icon:i??"dashboard-dashboard",collapseSplitShell:a??!1}):s))}delete(e){this.dashboards.update(t=>t.filter((i,a)=>a!==e)),this.dashboards().length===0?(this.add("Dashboard "+(this.dashboards().length+1),[]),this.activeDashboard.set(0)):this.activeDashboard()>this.dashboards().length-1&&this.activeDashboard.set(this.dashboards().length-1)}duplicate(e,t,i,a){if(e<0||e>=this.dashboards().length)return console.error(`[Dashboard Service] Invalid itemIndex: ${e}`),-1;let r=this.dashboards()[e],s=Ft(r);s.id=wi.create(),s.name=t,s.icon=i||"dashboard-dashboard",s.collapseSplitShell=a??!1,Array.isArray(s.configuration)?s.configuration.forEach(m=>{m&&m.input?.widgetProperties?(m.id=wi.create(),m.input.widgetProperties.uuid=m.id):console.error("Dashboard Service] Widget configuration is missing required properties:",m)}):(console.error("Dashboard Service] Dashboard configuration is not an array:",s.configuration),s.configuration=[]);let l=-1;return this.dashboards.update(m=>{let g=[...m,s];return l=g.length-1,g}),l}updateConfiguration(e,t){let i=Ft(t??[]);this.dashboards.update(a=>a.map((r,s)=>s===e?_i(r.configuration,i)?r:ge(ne({},r),{configuration:i}):r))}previousDashboard(){this.activeDashboard()+1>this.dashboards().length-1?this.activeDashboard.set(0):this.activeDashboard.set(this.activeDashboard()+1)}nextDashboard(){this.activeDashboard()-1<0?this.activeDashboard.set(this.dashboards().length-1):this.activeDashboard.set(this.activeDashboard()-1)}navigateToActive(){this._router.navigate(["/dashboard",this.activeDashboard()])}navigateTo(e){e>=0&&e<this.dashboards().length?this._router.navigate(["/dashboard",e]):console.error(`[Dashboard Service] Invalid dashboard ID: ${e}`)}navigateToNextDashboard(){let e=null;this.activeDashboard()-1<0?e=this.dashboards().length-1:e=this.activeDashboard()-1,this._router.navigate(["/dashboard",e])}navigateToPreviousDashboard(){let e=null;this.activeDashboard()+1>=this.dashboards().length?e=0:e=this.activeDashboard()+1,this._router.navigate(["/dashboard",e])}deleteWidget(e){this._widgetAction.next({id:e,operation:"delete"})}duplicateWidget(e){this._widgetAction.next({id:e,operation:"duplicate"})}copyWidget(e){this._widgetAction.next({id:e,operation:"copy"})}cutWidget(e){this._widgetAction.next({id:e,operation:"cut"})}setWidgetClipboardFromNode(e){let t=e?.input?.widgetProperties,i=t?.type;i&&this.widgetClipboard.set({w:e.w,h:e.h,selector:e.selector,input:{widgetProperties:{type:i,uuid:"clipboard",config:Ft(t.config)}}})}clearWidgetClipboard(){this.widgetClipboard.set(null)}setStaticDashboard(e){this.isDashboardStatic.set(e)}notifyLayoutEditSaved(){this.layoutEditSaved.update(e=>e+1)}notifyLayoutEditCanceled(){this.layoutEditCanceled.update(e=>e+1)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ss=(()=>{class n{http=y($a);connection=y(Yr);destroyRef=y(ze);historyServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe(Le(this.destroyRef)).subscribe(e=>{let t=e?.httpServiceUrl||null;this.historyServiceUrl=t?t.replace("/v1/","/v2/"):null,this.historyServiceUrl||console.warn("[HistoryApiClientService] History API endpoint not available; history service is disabled")})}getPaths(e){return Re(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/paths`,i=new Hr;e?.from&&(i=i.set("from",e.from)),e?.to&&(i=i.set("to",e.to)),e?.duration&&(i=i.set("duration",e.duration.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield Pn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available paths`),r}catch(t){return console.error("[HistoryApiClientService] History API /paths request failed:",t),null}})}getContexts(e){return Re(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/contexts`,i=new Hr;e?.from&&(i=i.set("from",e.from)),e?.to&&(i=i.set("to",e.to)),e?.duration&&(i=i.set("duration",e.duration.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield Pn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] Retrieved ${r?.length??0} available contexts`),r}catch(t){return console.error("[HistoryApiClientService] History API /contexts request failed:",t),null}})}getValues(e){return Re(this,null,function*(){try{if(!this.historyServiceUrl)return console.warn("[HistoryApiClientService] No HTTP service URL available"),null;let t=`${this.historyServiceUrl}history/values`,i=new Hr;i=i.set("paths",e.paths),e.context&&(i=i.set("context",e.context)),e.from&&(i=i.set("from",e.from)),e.to&&(i=i.set("to",e.to)),e.duration&&(i=i.set("duration",e.duration.toString())),e.resolution!==void 0&&e.resolution!==null&&(i=i.set("resolution",e.resolution.toString()));let a=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${a}`);let r=yield Pn(this.http.get(t,{params:i}));return console.log(`[HistoryApiClientService] History fetch successful, received ${r.data?.length??0} data points`),r}catch(t){return console.error("[HistoryApiClientService] History API request failed:",t),null}})}getProviders(){return Re(this,null,function*(){let e=`${this.historyServiceUrl}history/_providers`;return yield Pn(this.http.get(e)),["kip"]})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ls=(()=>{class n{mapValuesToChartDatapoints(e,t){let i=e?.data;if(!i||i.length===0)return[];let a=-1,r=-1;if(e.values&&Array.isArray(e.values)){for(let D=0;D<e.values.length;D++){let V=e.values[D]?.method,F=typeof V=="string"?V.toLowerCase():V;if(!F)continue;let Y=D+1;F==="sma"?a=Y:(F==="avg"||F==="average")&&(r=Y)}r<0&&e.values.length===1&&(r=1)}else i[0]?.length>1&&(r=1);let s=t.unit==="rad",l=s?t.domain==="signed"?this.normalizeToSigned.bind(this):this.normalizeToDirection.bind(this):null,m=[],g=0,v=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,C=0,_=0,M=0,B=[];for(let D of i){if(!Array.isArray(D)||D.length===0)continue;let V=Date.parse(D[0]),F=a>=0?D[a]:null,Y=r>=0?D[r]:null;if(s?(F=Number.isFinite(F)?l(F):null,Y=Number.isFinite(Y)?l(Y):null):(F=Number.isFinite(F)?F:null,Y=Number.isFinite(Y)?Y:null),Number.isFinite(Y)){let j=Y;s?(B.push(j),_+=Math.sin(j),M+=Math.cos(j)):(C++,g+=j,j<v&&(v=j),j>A&&(A=j))}m.push({timestamp:V,data:{value:Y,sma:F,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}})}if(m.length>0){let D=null,V=null,F=null;if(s&&B.length>0){D=Math.atan2(_/B.length,M/B.length);let{min:Y,max:j}=this.circularMinMaxRad(B);t.domain==="signed"?(D=this.normalizeToSigned(D),V=this.normalizeToSigned(Y),F=this.normalizeToSigned(j)):(D=this.normalizeToDirection(D),V=this.normalizeToDirection(Y),F=this.normalizeToDirection(j))}else!s&&C>0&&(D=g/C,V=v,F=A);if(D!==null&&V!==null&&F!==null){let Y=m[m.length-1];Y.data.lastAverage=D,Y.data.lastMinimum=V,Y.data.lastMaximum=F}}return m}circularMinMaxRad(e){if(e.length===0)return{min:0,max:0};let t=e.map(r=>(r*180/Math.PI+360)%360).sort((r,s)=>r-s),i=0,a=0;for(let r=0;r<t.length;r++){let s=(r+1)%t.length,l=(t[s]-t[r]+360)%360;l>i&&(i=l,a=s)}return{min:t[a]*Math.PI/180,max:t[(a-1+t.length)%t.length]*Math.PI/180}}mod(e,t){return(e%t+t)%t}normalizeToDirection(e){let t=2*Math.PI;return this.mod(e,t)}normalizeToSigned(e){let t=2*Math.PI;return this.mod(e+Math.PI,t)-Math.PI}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var mn=(()=>{class n{appSettings=y(Wt);data=y(Ot);history=y(ss);historyChartAdapter=y(ls);historyMinSampleTimeMs=1e3;_svcDatasetConfigs=[];_svcDataSource=[];_svcSubjectObserverRegistry=[];_startAllPromise;signedAnglePaths=new Set(["self.navigation.attitude.roll","self.navigation.attitude.pitch","self.navigation.attitude.yaw","self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.steering.rudderAngle"]);constructor(){this._svcDatasetConfigs=this.appSettings.getDataSets(),this.cleanupDatasets(),this._startAllPromise=this.startAll()}cleanupDatasets(){if(this.appSettings.configUpgrade()||this.appSettings.getAppConfig().configVersion<12)return;let t=this.appSettings.getDashboardConfig(),i=new Set;t.forEach(l=>{l.configuration?.length&&l.configuration?.forEach(m=>{m?.id&&i.add(m.id)})});function a(l){let m=l.match(/^(windtrends|speedtrends)-(.+)$/);return m?m[2]:null}let r=[],s=[];for(let l of this._svcDatasetConfigs){let m=l.label||"",g=!1;if(m.startsWith("windtrends-")||m.startsWith("speedtrends-")){let v=a(m);g=!!(v&&i.has(v))}else(m.startsWith("simple-chart-")||(m.match(/\|/g)||[]).length===4)&&(g=i.has(l.uuid));g?s.push(l):r.push(l)}r.length&&(r.forEach(l=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${l.uuid}, label="${l.label}"`)}),this._svcDatasetConfigs=s,this.appSettings.saveDataSets(this._svcDatasetConfigs))}setupServiceSubjectRegistry(e,t){let i=this._svcSubjectObserverRegistry.findIndex(a=>a.datasetUuid==e);i>=0&&(this._svcSubjectObserverRegistry[i].rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(i,1)),this._svcSubjectObserverRegistry.push({datasetUuid:e,rxjsSubject:new Qd(t)})}createDataSourceConfiguration(e){let r={uuid:e.uuid,pathObserverSubscription:null,sampleTime:null,maxDataPoints:null,smoothingPeriod:null,historicalData:[]},s=m(e.timeScaleFormat,e.period),l=s>0?Math.max(100,Math.round(s/120)):1e3;return r.sampleTime=l,r.maxDataPoints=Math.max(1,Math.ceil(s/l)),r.smoothingPeriod=Math.max(1,Math.floor(r.maxDataPoints*.25)),(!r.maxDataPoints||r.maxDataPoints<1)&&(r.maxDataPoints=1),(!r.sampleTime||r.sampleTime<1)&&(r.sampleTime=1),r;function m(g,v){switch(g){case"Last Minute":return 6e4;case"Last 5 Minutes":return 5*6e4;case"Last 30 Minutes":return 30*6e4;case"day":return Math.max(0,v)*24*60*6e4;case"hour":return Math.max(0,v)*60*6e4;case"minute":return Math.max(0,v)*6e4;case"second":return Math.max(0,v)*1e3;default:return 0}}}waitUntilReady(){return Re(this,null,function*(){return this._startAllPromise})}startAll(){return Re(this,null,function*(){console.log("[DatasetStreamService] Auto Starting "+this._svcDatasetConfigs.length.toString()+" Datasets");for(let e of this._svcDatasetConfigs)yield this.start(e.uuid)})}start(e){return Re(this,null,function*(){let t=this._svcDatasetConfigs.find(v=>v.uuid==e);if(!t){console.warn(`[DatasetStreamService] Dataset UUID:${e} not found`);return}let i=this.createDataSourceConfiguration(t);this.setupServiceSubjectRegistry(i.uuid,i.maxDataPoints);let a=this._svcDataSource[this._svcDataSource.push(i)-1];console.log(`[DatasetStreamService] Starting recording process: ${t.path}, Scale: ${t.timeScaleFormat}, Period: ${t.period}, Datapoints: ${i.maxDataPoints}`);let r=this.resolveAngleDomain(t.path,t.baseUnit),s=Math.max(1,Math.round(i.sampleTime/1e3));this.shouldSeedHistory(i.sampleTime)&&(yield this.seedHistoryData(a,t,s,r));let l=this.data.subscribePath(t.path,t.pathSource).pipe(Ai(v=>v?.data?.value!==null),Mr({bufferSize:1,refCount:!0})),m=l.pipe(ai(1)),g=ma(i.sampleTime,i.sampleTime).pipe(uc(l,(v,A)=>A));a.pathObserverSubscription=bi(m,g).subscribe(v=>{a.maxDataPoints>0&&a.historicalData.length>=a.maxDataPoints&&a.historicalData.shift(),a.historicalData.push(v.data.value);let A=this.updateDataset(a,t.baseUnit,r);this._svcSubjectObserverRegistry.find(C=>C.datasetUuid===a.uuid).rxjsSubject.next(A)})})}seedHistoryData(e,t,i,a){return Re(this,null,function*(){try{let r=this.buildHistoryPathString(t.path,e.smoothingPeriod),s=(()=>{switch(t.timeScaleFormat){case"Last Minute":return 6e4;case"Last 5 Minutes":return 5*6e4;case"Last 30 Minutes":return 30*6e4;case"day":return Math.max(0,t.period)*24*60*6e4;case"hour":return Math.max(0,t.period)*60*6e4;case"minute":return Math.max(0,t.period)*6e4;case"second":return Math.max(0,t.period)*1e3;default:return 0}})(),l=new Date,m={paths:r,from:new Date(l.getTime()-s).toISOString(),resolution:i},g=yield this.history.getValues(m);if(!g||!g.data||g.data.length===0){console.log(`[DatasetStreamService] No history data available for ${t.path}`);return}let v=this.convertHistoryToDatapoints(g,t.baseUnit,a),A=this._svcSubjectObserverRegistry.find(C=>C.datasetUuid===e.uuid)?.rxjsSubject;if(A&&v.length>0){let C=[];e.historicalData=[],v.forEach(_=>{let M=_.data.value;if(!Number.isFinite(M))return;e.maxDataPoints>0&&e.historicalData.length>=e.maxDataPoints&&e.historicalData.shift(),e.historicalData.push(M);let B=this.updateDataset(e,t.baseUnit,a);B.timestamp=_.timestamp,C.push(B)}),C.forEach(_=>A.next(_)),console.log(`[DatasetStreamService] Seeded ${C.length} history datapoints for ${t.path}`)}}catch(r){console.warn(`[DatasetStreamService] Failed to seed history data for ${t.path}:`,r)}})}stop(e){let t=this._svcDataSource.findIndex(i=>i.uuid==e);console.log(`[DatasetStreamService] Stopping Dataset ${e} data capture`),this._svcDataSource[t].pathObserverSubscription.unsubscribe(),this._svcDataSource.splice(t,1)}list(){return Ft(this._svcDatasetConfigs)}getDatasetConfig(e){return this._svcDatasetConfigs.find(t=>t.uuid===e)}getDataSourceInfo(e){return this._svcDataSource.find(t=>t.uuid===e)}create(e,t,i,a,r,s=!0,l=!0,m){if(!e||!t||!i||!a||!r)return null;let g=m||wi.create(),v={uuid:g,path:e,pathSource:t,baseUnit:this.data.getPathUnitType(e),timeScaleFormat:i,period:a,label:r,editable:l};return console.log(`[DatasetStreamService] Creating ${s?"":"non-"}persistent ${l?"":"hidden "}dataset: ${v.uuid}, Path: ${v.path}, Source: ${v.pathSource} Scale: ${v.timeScaleFormat}, Period: ${v.period}`),this._svcDatasetConfigs.push(v),this.start(g),s===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),g}edit(e,t=!0){let i=this._svcDatasetConfigs.find(a=>a.uuid===e.uuid);return i?JSON.stringify(i)===JSON.stringify(e)?(console.log(`[DatasetStreamService] No changes detected for Dataset ${e.uuid}.`),!1):(this.stop(e.uuid),console.log(`[DatasetStreamService] Updating Dataset: ${e.uuid}`),e.baseUnit=this.data.getPathUnitType(e.path),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(a=>a.uuid===e.uuid),1,e),this.start(e.uuid),t===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),!0):!1}remove(e,t=!0){return!e||e===""||this._svcDatasetConfigs.findIndex(i=>i.uuid===e)===-1?!1:(this.stop(e),console.log(`[DatasetStreamService] Removing ${t?"":"non-"}persistent Dataset: ${e}`),this._svcDatasetConfigs.splice(this._svcDatasetConfigs.findIndex(i=>i.uuid===e),1),this._svcSubjectObserverRegistry.find(i=>i.datasetUuid===e).rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(this._svcSubjectObserverRegistry.findIndex(i=>i.datasetUuid===e),1),t===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),!0)}getDatasetObservable(e){let t=this._svcSubjectObserverRegistry.find(i=>i.datasetUuid==e);return t?t.rxjsSubject.asObservable():null}getDatasetBatchThenLiveObservable(e){let t=this._svcSubjectObserverRegistry.find(l=>l.datasetUuid==e);if(!t)return null;let i=t.rxjsSubject,a=i._buffer?i._buffer.slice():[],r=Jd([a]),s=i.pipe(kr(a.length));return ic(r,s)}updateDataset(e,t,i="scalar"){let a=null,r=null,s=null,l=null;if(t==="rad"){a=this.circularMeanRad(e.historicalData);let A=e.historicalData.slice(-e.smoothingPeriod);r=this.circularMeanRad(A);let{min:C,max:_}=this.circularMinMaxRad(e.historicalData);i==="direction"?(a=this.normalizeToDirection(a),r=this.normalizeToDirection(r),s=this.normalizeToDirection(C),l=this.normalizeToDirection(_)):i==="signed"?(a=this.normalizeToSigned(a),r=this.normalizeToSigned(r),s=this.normalizeToSigned(C),l=this.normalizeToSigned(_)):(s=C,l=_)}else a=g(e.historicalData),r=v(e.historicalData,e.smoothingPeriod),s=Math.min(...e.historicalData),l=Math.max(...e.historicalData);return{timestamp:Date.now(),data:{value:t==="rad"?i==="signed"?this.normalizeToSigned(e.historicalData[e.historicalData.length-1]):this.normalizeToDirection(e.historicalData[e.historicalData.length-1]):e.historicalData[e.historicalData.length-1],sma:r,ema:null,doubleEma:null,lastAverage:a,lastMinimum:s,lastMaximum:l}};function g(A){return A.length===0?null:A.reduce((_,M)=>_+M,0)/A.length}function v(A,C){A.length<C&&(C=A.length);let _=0;for(let M=A.length-C;M<A.length;M++)_+=A[M];return _/C}}circularMeanRad(e){if(e.length===0)return 0;let t=e.reduce((a,r)=>a+Math.sin(r),0),i=e.reduce((a,r)=>a+Math.cos(r),0);return Math.atan2(t/e.length,i/e.length)}circularMinMaxRad(e){if(e.length===0)return{min:0,max:0};let t=e.map(l=>(l*180/Math.PI+360)%360).sort((l,m)=>l-m),i=0,a=0;for(let l=0;l<t.length;l++){let m=(l+1)%t.length,g=(t[m]-t[l]+360)%360;g>i&&(i=g,a=m)}let r=t[a]*Math.PI/180,s=t[(a-1+t.length)%t.length]*Math.PI/180;return{min:r,max:s}}resolveAngleDomain(e,t){if(t!=="rad")return"scalar";let i=this.normalizePathKey(e);for(let a of this.signedAnglePaths)if(i===this.normalizePathKey(a))return"signed";return"direction"}normalizePathKey(e){return e.replace(/^vessels\.self\./,"").replace(/^self\./,"")}mod(e,t){return(e%t+t)%t}normalizeToDirection(e){let t=2*Math.PI;return this.mod(e,t)}normalizeToSigned(e){let t=2*Math.PI;return this.mod(e+Math.PI,t)-Math.PI}removeIfExists(e,t=!0){return!e||this._svcDatasetConfigs.findIndex(i=>i.uuid===e)===-1?!1:this.remove(e,t)}shouldSeedHistory(e){return e>=this.historyMinSampleTimeMs}buildHistoryPathString(e,t){let i=e.replace(/^(vessels\.)?self\./,"");return[`${i}:sma:${t}`,`${i}:avg`,`${i}:min`,`${i}:max`].join(",")}convertHistoryToDatapoints(e,t,i){return this.historyChartAdapter.mapValuesToChartDatapoints(e,{unit:t,domain:i})}ngOnDestroy(){[...this._svcDataSource].forEach(e=>{try{this.stop(e.uuid)}catch(t){}}),this._svcSubjectObserverRegistry.forEach(e=>e.rxjsSubject.complete()),this._svcSubjectObserverRegistry=[]}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Fu=(()=>{class n{kipTimers={};constructor(){}createTimer(e,t,i){return e in this.kipTimers?this.kipTimers[e].currentValue.asObservable():(this.kipTimers[e]={currentValue:new Zi(t),timeoutID:null,intervalMS:i},this.kipTimers[e].currentValue.asObservable())}startTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].timeoutID===null&&(this.kipTimers[e].timeoutID=setInterval(()=>{this.kipTimers[e].currentValue.next(this.kipTimers[e].currentValue.value+1)},this.kipTimers[e].intervalMS))}stopTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].timeoutID!==null&&(clearInterval(this.kipTimers[e].timeoutID),this.kipTimers[e].timeoutID=null)}setTimer(e,t){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&this.kipTimers[e].currentValue.next(t)}deleteTimer(e){Object.prototype.hasOwnProperty.call(this.kipTimers,e)&&(this.stopTimer(e),this.kipTimers[e].currentValue.complete(),delete this.kipTimers[e])}isRunning(e){let t=!1;return e in this.kipTimers&&(t=this.kipTimers[e].timeoutID!==null),t}ngOnDestroy(){Object.keys(this.kipTimers).forEach(e=>{this.kipTimers[e].timeoutID&&(clearInterval(this.kipTimers[e].timeoutID),this.kipTimers[e].timeoutID=null),this.kipTimers[e].currentValue.complete()}),this.kipTimers={}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Gu=(()=>{class n{sanitizer=y(ja);transform(e){return this.sanitizer.bypassSecurityTrustResourceUrl(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Vr({name:"safe",type:n,pure:!0})}return n})();var qf={minDist:230,maxDur:550,minVelocity:1.5,axisDominance:1.8,deadzoneMs:160,purityRatio:.8,lockThreshold:28,directionLockAngle:25,reversalPrimaryThreshold:34};function so(n){let o=ne(ne({},qf),n);return`(() => {
2
- if (window.__kipSwipeInit) return; window.__kipSwipeInit = true;
3
- const instanceId='${o.instanceId}';
4
- let pointerId=null; let startX=0; let startY=0; let startT=0; let peakPrimary=0; let peakCross=0; let cancelled=false;
5
- let lockedAxis=null; let lockedPrimarySign=0; let reversed=false;
6
- const minDist=${o.minDist};
7
- const maxDur=${o.maxDur};
8
- const minVelocity=${o.minVelocity};
9
- const axisDominance=${o.axisDominance};
10
- const deadzoneMs=${o.deadzoneMs};
11
- const purityRatio=${o.purityRatio};
12
- const lockThreshold=${o.lockThreshold};
13
- const directionLockAngle=${o.directionLockAngle};
14
- const reversalPrimaryThreshold=${o.reversalPrimaryThreshold};
15
- function reset(){pointerId=null; cancelled=false; lockedAxis=null; lockedPrimarySign=0; reversed=false;}
16
- function onDown(e){ if(pointerId!==null) return; pointerId=e.pointerId; startX=e.clientX; startY=e.clientY; startT=performance.now(); peakPrimary=0; peakCross=0; cancelled=false; lockedAxis=null; lockedPrimarySign=0; reversed=false; }
17
- function track(e){ if(e.pointerId!==pointerId||cancelled) return; const dx=e.clientX-startX; const dy=e.clientY-startY; const adx=Math.abs(dx); const ady=Math.abs(dy); const primary=adx>ady?adx:ady; const cross=adx>ady?ady:adx; peakPrimary=Math.max(peakPrimary,primary); peakCross=Math.max(peakCross,cross);
18
- if(!lockedAxis && primary>=lockThreshold){ lockedAxis = adx>ady?'x':'y'; lockedPrimarySign = lockedAxis==='x' ? (Math.sign(dx)||1) : (Math.sign(dy)||1); }
19
- if(lockedAxis){
20
- const angleRad = Math.atan2(lockedAxis==='x'?ady:adx, lockedAxis==='x'?adx:ady); // angle from primary axis
21
- const angleDeg = angleRad * 180 / Math.PI;
22
- if(angleDeg > directionLockAngle){ cancelled=true; return; }
23
- if(lockedAxis==='x' && Math.sign(dx) && Math.sign(dx)!==lockedPrimarySign && Math.abs(dx) > reversalPrimaryThreshold){ reversed=true; cancelled=true; return; }
24
- if(lockedAxis==='y' && Math.sign(dy) && Math.sign(dy)!==lockedPrimarySign && Math.abs(dy) > reversalPrimaryThreshold){ reversed=true; cancelled=true; return; }
25
- }
26
- if (!cancelled && peakCross>42 && peakCross*axisDominance>peakPrimary) { cancelled=true; }
27
- }
28
- function onUp(e){ if(e.pointerId!==pointerId) return; const endT=performance.now(); const dt=endT-startT; const dx=e.clientX-startX; const dy=e.clientY-startY; const adx=Math.abs(dx); const ady=Math.abs(dy); const dist=Math.hypot(dx,dy); const velocity=dist/dt; const primary=adx>ady?adx:ady; const cross=adx>ady?ady:adx; const purity= primary? (primary/dist):0; if(!cancelled && !reversed && dt>=deadzoneMs && dt<=maxDur && dist>=minDist && velocity>=minVelocity && purity>=purityRatio && primary/Math.max(cross,1)>=axisDominance){ if(adx>ady){ window.parent.postMessage({gesture: dx>0?'swiperight':'swipeleft', eventData:{dx,dy,duration:dt,velocity,instanceId}}, '*'); } else { window.parent.postMessage({gesture: dy>0?'swipedown':'swipeup', eventData:{dx,dy,duration:dt,velocity,instanceId}}, '*'); } } reset(); }
29
- function onCancel(e){ if(e.pointerId===pointerId) reset(); }
30
- document.addEventListener('pointerdown', onDown, {passive:true});
31
- document.addEventListener('pointermove', track, {passive:true});
32
- document.addEventListener('pointerup', onUp, {passive:true});
33
- document.addEventListener('pointercancel', onCancel, {passive:true});
34
- document.addEventListener('keydown', (event) => {
35
- if (event.ctrlKey && event.shiftKey && ['ArrowLeft','ArrowRight','ArrowUp','ArrowDown','E','F','N'].includes(event.key)) {
36
- window.parent.postMessage({ type:'keydown', keyEventData:{ key:event.key, ctrlKey:event.ctrlKey, shiftKey:event.shiftKey, instanceId }}, '*');
37
- }
38
- });
39
- })();`}var Se=(()=>{class n{config=x();defaultConfig=w(void 0);runtimeConfig=mt();_runtimeConfig=w(void 0);lastBaseRef;lastUserRef;lastMergedRef;options=X(()=>{let e=this.defaultConfig(),t=this._runtimeConfig();if(this.lastMergedRef&&e===this.lastBaseRef&&t===this.lastUserRef)return this.lastMergedRef;let i;return e&&t?i=Xc(Ft(e),Ft(t)):e&&!t?i=Ft(e):!e&&t?i=Ft(t):i=void 0,this.lastBaseRef=e,this.lastUserRef=t,this.lastMergedRef=i,this.runtimeConfig.emit(i),i});firstPathKey=X(()=>{let e=this.options();if(!e?.paths)return;let t=Object.keys(e.paths);return t.length?t[0]:void 0});constructor(){L(()=>{let e=this.config();G(()=>{e&&this.setRuntimeConfig(e)})})}getPathCfg(e){return this.options()?.paths?.[e]}setRuntimeConfig(e){this._runtimeConfig.set(e)}initialize(e,t){e&&this.defaultConfig.set(e),t&&this._runtimeConfig.set(t)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["","widget-runtime",""]],inputs:{config:[1,"config"]},outputs:{runtimeConfig:"runtimeConfig"},exportAs:["widgetRuntime"]})}return n})();var jf=["freeboardSkIframe"];function Yf(n,o){if(n&1&&(Q(0,"iframe",1,0),ct(2,"safe")),n&2){let e=k();Wi("src",Et(2,1,e.widgetUrl),ha)}}function Zf(n,o){n&1&&Q(0,"div",4)}function Xf(n,o){if(n&1&&(E(0,"div",2),Q(1,"iframe",3,0),ct(3,"safe"),I(4,Zf,1,0,"div",4),O()),n&2){let e=k();f(),Wi("src",Et(3,2,e.widgetUrl),ha),f(3),N(e.dashboard.isDashboardStatic()?-1:4)}}var Bu=(()=>{class n{id=x();type=x();theme=x();disableWidgetShell=x(!1);swipeDisabled=x(!1);runtime=y(Se,{optional:!0});appSettings=y(Wt);app=y(Ii);auth=y(Kc);dashboard=y(yt);iframe=he.required("freeboardSkIframe");authToken=Mi(this.auth.authToken$,{initialValue:null});viewReady=!1;iframeLoaded=!1;widgetUrl=null;static DEFAULT_CONFIG={};constructor(){window.addEventListener("message",this.handleIframeGesture),L(()=>{let e=this.authToken();G(()=>{let t=e?.token;this.widgetUrl=t?`${this.appSettings.signalkUrl.url}/@signalk/freeboard-sk/?token=${t}`:`${this.appSettings.signalkUrl.url}/@signalk/freeboard-sk/`})}),L(()=>{let e=this.app.isNightMode();G(()=>{!this.iframeLoaded||!this.viewReady||this.appSettings.getRedNightMode()&&this.sendMessage({commands:{nightModeEnable:e}})})})}ngAfterViewInit(){this.viewReady=!0;try{this.iframe().nativeElement.onload=()=>{this.iframeLoaded=!0,this.sendMessage({settings:{autoNightMode:!1}}),this.injectSwipeScript()}}catch(e){}}sendMessage(e,t="*"){let i=this.iframe()?.nativeElement?.contentWindow;i&&this.iframeLoaded&&i.postMessage(e,t)}injectSwipeScript(){if(this.swipeDisabled())return;let e=this.iframe().nativeElement.contentWindow,t=this.iframe().nativeElement.contentDocument;if(!t||!e){console.error("[FSK Widget] Iframe contentDocument or contentWindow is undefined.");return}try{let i=`kip-gesture-inject-${this.id()}`;if(t.getElementById(i))return;let a=so({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=a,t.body.appendChild(r)}catch(i){console.warn("[FSK Widget] Failed to inject swipe script into iframe:",i)}}handleIframeGesture=e=>{if(!e.data||!this.viewReady)return;let t=null;try{t=this.iframe()?.nativeElement?.contentWindow??null}catch(r){t=null}if(!t||e.source!==t)return;let i=this.getExpectedIframeOrigin();if(i&&e.origin!==i)return;let a=this.id();if(e.data.gesture&&e.data.eventData?.instanceId===a)switch(e.data.gesture){case"swipeup":this.dashboard.isDashboardStatic()&&this.dashboard.navigateToPreviousDashboard();break;case"swipedown":this.dashboard.isDashboardStatic()&&this.dashboard.navigateToNextDashboard();break;case"swipeleft":window.document.dispatchEvent(new Event("openLeftSidenav",{bubbles:!0,cancelable:!0}));break;case"swiperight":window.document.dispatchEvent(new Event("openRightSidenav",{bubbles:!0,cancelable:!0}));break}if(e.data.type==="keydown"&&e.data.keyEventData?.instanceId===a){let{key:r,ctrlKey:s,shiftKey:l}=e.data.keyEventData,m=new KeyboardEvent("keydown",{key:r,ctrlKey:s,shiftKey:l,bubbles:!0,cancelable:!0});document.dispatchEvent(m)}};getExpectedIframeOrigin(){let e=this.widgetUrl||this.appSettings.signalkUrl.url;if(!e)return null;try{return new URL(e).origin}catch(t){return null}}ngOnDestroy(){if(window.removeEventListener("message",this.handleIframeGesture),this.iframe){try{this.iframe().nativeElement.onload=null}catch(e){}try{let e=this.iframe()?.nativeElement.contentDocument;if(e){let t=`kip-gesture-inject-${this.id()}`,i=e.getElementById(t);i&&i.parentNode&&i.parentNode.removeChild(i)}}catch(e){}}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-freeboardsk"]],viewQuery:function(t,i){t&1&&Me(i.iframe,jf,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],disableWidgetShell:[1,"disableWidgetShell"],swipeDisabled:[1,"swipeDisabled"]},decls:2,vars:1,consts:[["freeboardSkIframe",""],["width","100%","height","100%","frameborder","0","sandbox","allow-same-origin allow-scripts allow-forms",1,"freeboardsk-iframe","no-shell",3,"src"],[1,"widget-shell",2,"overflow","clip","position","relative","width","100%","height","100%"],["width","100%","height","100%","frameborder","0","sandbox","allow-same-origin allow-scripts allow-forms",1,"freeboardsk-iframe",3,"src"],[1,"widgetOverlay"]],template:function(t,i){t&1&&I(0,Yf,3,3,"iframe",1)(1,Xf,5,4,"div",2),t&2&&N(i.disableWidgetShell()?0:1)},dependencies:[Gu],styles:[".widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"],changeDetection:0})}return n})();var Qf={1e3:"notification",1001:"alert",1002:"warn",1003:"alarm",1004:"emergency"},zu=(()=>{class n{settings=y(Wt);toastService=y(nn);audioBlockedNotificationShown=!1;data=y(Ot);requests=y(di);static ALARM_SEVERITIES={normal:{sound:0,visual:0},nominal:{sound:0,visual:0},alert:{sound:1,visual:0},warn:{sound:2,visual:1},alarm:{sound:3,visual:2},emergency:{sound:4,visual:2}};_notificationSettingsSubscription=null;_notificationDataStreamSubscription=null;_notificationMetaStreamSubscription=null;_resetServiceSubscription=null;_notificationConfig;_notificationConfig$=new Zi(wc);_notifications=[];_notifications$=new Zi([]);_alarmsInfo$=new Zi({audioSev:0,visualSev:0,alarmCount:0,isMuted:!1});_players=new Map;_activeAlarmSoundtrack=null;_isMuted=!1;_lastEmittedValue=null;constructor(){this._notificationSettingsSubscription=this.settings.getNotificationServiceConfigAsO().subscribe(e=>{this._notificationConfig=e,this.reset(),this._notificationConfig$.next(e),this._notificationConfig.disableNotifications&&!this._notificationDataStreamSubscription?.closed&&this.stopNotificationStream(),!this._notificationConfig.disableNotifications&&(this._notificationDataStreamSubscription===null||this._notificationDataStreamSubscription?.closed)&&this.startNotificationStream(),this._notificationConfig.sound.disableSound?this.playAlarm(1e3):this.updateNotificationsState()}),this._resetServiceSubscription=this.data.isResetService().subscribe(e=>{e&&this.reset()}),this.getPlayer(1e3)}startNotificationStream(){this._notificationDataStreamSubscription=this.data.getNotificationMsgObservable().subscribe(e=>this.processNotificationDeltaMsg(e)),this._notificationMetaStreamSubscription=this.data.getNotificationMetaObservable().subscribe(e=>this.processNotificationDeltaMeta(e))}stopNotificationStream(){this._notificationDataStreamSubscription?.unsubscribe(),this._notificationMetaStreamSubscription?.unsubscribe(),this.reset()}reset(){this._notificationConfig.disableNotifications&&(this._notifications=[],this._notifications$.next([])),this.updateNotificationsState()}emitNotifications(){this._notifications$.next([...this._notifications])}observeNotifications(){return this._notifications$.asObservable()}addValue(e){this._notifications.push({path:e.path,value:e.value}),this.updateNotificationsState(),this.emitNotifications()}updateValue(e){let t=this._notifications.findIndex(i=>i.path==e.path);if(t>=0){let i=this._notifications[t];this._notifications[t]=ge(ne({},i),{value:ne({},e.value)}),this.updateNotificationsState(),this.emitNotifications()}else console.log("[Notification Service] Update path not found for: "+e.path)}deleteValue(e){let t=this._notifications.findIndex(i=>i.path==e);if(t>=0){let i=this._notifications[t];this._notifications[t]=ge(ne({},i),{value:void 0}),this.updateNotificationsState(),this.emitNotifications()}else console.log("[Notification Service] Notification to delete not found for: "+e)}updateNotificationsState(){let e=0,t=0,i=0;for(let r of this._notifications){if(!r.value||!("method"in r.value)||r.value.method.length===0||r.value.state===ve.Normal&&!this._notificationConfig.devices.showNormalState||r.value.state===ve.Nominal&&!this._notificationConfig.devices.showNominalState)continue;i++;let{aSev:s,vSev:l}=this.getNotificationSeverity(r);e=Math.max(e,s),t=Math.max(t,l)}this._notificationConfig.sound.disableSound||this.playAlarm(1e3+e);let a={audioSev:e,visualSev:t,alarmCount:i,isMuted:this._isMuted};_i(a,this._lastEmittedValue)||(this._alarmsInfo$.next(a),this._lastEmittedValue=a)}processNotificationDeltaMsg(e){if(!e.path.startsWith("notifications.security"))if(e.value===null)this.deleteValue(e.path);else{let t=this._notifications.find(i=>i.path==e.path);t?(!t.value||t.value.state!==e.value.state||t.value.message!==e.value.message||!_i(t.value.method,e.value.method))&&this.updateValue(e):this.addValue(e)}}processNotificationDeltaMeta(e){let t=this._notifications.findIndex(i=>i.path==e.path);if(t>=0){let i=this._notifications[t];this._notifications[t]=ge(ne({},i),{meta:e.meta})}else this._notifications.push({path:e.path,meta:e.meta});this.emitNotifications()}getNotificationSeverity(e){let t=e.value.state,i=n.ALARM_SEVERITIES[t];if(!i)return console.log(`[Notification Service] Unknown Notification State
40
- `+JSON.stringify(e)),{aSev:0,vSev:0};let a=i.sound,r=i.visual;return(!e.value.method.includes(wl.Sound)||this._notificationConfig.sound[`mute${t.charAt(0).toUpperCase()+t.slice(1)}`]||this._isMuted)&&(a=0),e.value.method.includes(wl.Visual)||(r=0),{aSev:a,vSev:r}}setSkMethod(e,t){this.requests.putRequest(`${e}.method`,t,wi.create())}setSkState(e,t){this.requests.putRequest(`${e}.state`,t,wi.create())}observerNotificationsInfo(){return this._alarmsInfo$.pipe(Kt(e=>{let t=!1,i=!1;switch(e.visualSev){case 1:t=!0;break;case 2:i=!0;break}return ge(ne({},e),{isWarn:t,isAlarmEmergency:i})}))}getPlayer(e){let t=this._players.get(e);if(t)return t;let i=Qf[e];if(!i)return console.warn("[Notification Service] Unknown track id",e),this.getPlayer(1e3);let a=new Audio(`assets/${i}.mp3`);return a.preload="auto",a.loop=!0,a.muted=this._isMuted,this._players.set(e,a),a}mutePlayer(e){if(this._activeAlarmSoundtrack!=null&&this._activeAlarmSoundtrack!==1e3){let t=this._players.get(this._activeAlarmSoundtrack);t&&(t.muted=e)}this._isMuted=e,this.updateNotificationsState()}playAlarm(e){if(this._activeAlarmSoundtrack===e)return;if(this._activeAlarmSoundtrack!=null){let i=this._players.get(this._activeAlarmSoundtrack);i&&(i.pause(),i.currentTime=0)}if(e===1e3){this._activeAlarmSoundtrack=1e3;return}let t=this.getPlayer(e);this._activeAlarmSoundtrack=e,t.muted=this._isMuted,t.currentTime=0,t.play().catch(i=>{console.debug("Alarm audio playback blocked:",i.message),this.audioBlockedNotificationShown||(this.audioBlockedNotificationShown=!0,this.toastService.show("Alarm sounds blocked by browser. Closing this message will enable audio.",0,!0,"warn").afterDismissed().subscribe(()=>{this.audioBlockedNotificationShown=!1}))})}observeNotificationConfiguration(){return this._notificationConfig$.asObservable()}ngOnDestroy(){this._notificationSettingsSubscription?.unsubscribe(),this._resetServiceSubscription?.unsubscribe(),this._notificationDataStreamSubscription?.unsubscribe(),this._notificationMetaStreamSubscription?.unsubscribe(),this._notificationConfig$.complete(),this._notifications$.complete(),this._alarmsInfo$.complete();for(let e of this._players.values())try{e.pause(),e.currentTime=0,e.src=""}catch(t){}this._players.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ds=class n{static DEBUG=!1;isChromeOnMac;isFirefox;static _suppressAllGesturesUntil=0;static _instanceCounter=0;_instanceId;static _laneOwners=new Map;static _activePointers=new Set;static _multiPointerActive=!1;static _instanceToEl=new Map;swipeMinDistance=x(30);swipeMaxDuration=x(600);longPressMs=x(500);doubleTapInterval=x(300);tapSlop=x(20);pressMoveSlop=x(10);mode=x("all");disableGestures=x(!1);enablePress=x(!0);enableDoubleTap=x(!0);bridgeUiEvents=x(!1);_swipeMinDistance=30;_swipeMaxDuration=600;_longPressMs=500;_doubleTapInterval=300;_tapSlop=20;_pressMoveSlop=10;swipeleft=mt();swiperight=mt();swipeup=mt();swipedown=mt();press=mt();doubletap=mt();destroyRef=y(ze);host=y(Ke);pointerId=null;startX=0;startY=0;startTime=0;tracking=!1;longPressTimer=null;pressFired=!1;ownedLanes={h:!1,v:!1,p:!1};cancelLongpressHandlers=[];lastTapTime=0;lastTapX=0;lastTapY=0;currentPointerType=null;lastTapUpTime=0;lastTapUpX=0;lastTapUpY=0;potentialDoubleTap=!1;onContextMenu=o=>{o.preventDefault()};lockedAxis=null;axisLockThreshold=6;captureEl=null;static MOVES_BUFFER_SIZE=120;moveSamples=[];constructor(){this.isChromeOnMac=(()=>{let i=navigator.userAgent,a=navigator.platform;return/Chrome\//.test(i)&&/Mac/.test(a)&&!/Edg\//.test(i)&&!/OPR\//.test(i)})(),this.isFirefox=/Firefox\//.test(navigator.userAgent),this._instanceId=++n._instanceCounter,this.debug("GestureDirective instance created",{instanceId:this._instanceId});try{n._instanceToEl.set(this._instanceId,this.host.nativeElement)}catch(i){}let o=this.host.nativeElement;o.style.touchAction||(o.style.touchAction="none","webkitTouchCallout"in o.style&&(o.style.webkitTouchCallout="none"),o.style.userSelect||(o.style.userSelect="none"),o.style.webkitUserSelect===""&&(o.style.webkitUserSelect="none"),o.style.webkitTapHighlightColor="transparent"),o.addEventListener("pointerdown",this.onPointerDown,{passive:!1,capture:!0}),o.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),o.addEventListener("pointerrawupdate",this.onPointerRawUpdate,{passive:!0,capture:!0}),o.addEventListener("pointerup",this.onPointerUp,{passive:!0}),o.addEventListener("pointercancel",this.onPointerCancel,{passive:!0,capture:!0}),o.addEventListener("lostpointercapture",this.onLostPointerCapture,{passive:!0,capture:!0}),o.addEventListener("dblclick",this.onNativeDblClick,{passive:!0});let e=i=>{let a=i;if(a.detail?.__gid===this._instanceId||this.disableGestures())return;let s=a.target,l=!!(s&&s!==this.host.nativeElement&&this.host.nativeElement.contains(s)),m=this.modeAllowsHorizontal(),g=this.modeAllowsVertical(),v=this.modeAllowsPress(),A=this.modeAllowsDoubleTap();if(l&&(a.type==="press"||a.type==="doubletap")&&(v=v||a.type==="press",A=A||a.type==="doubletap"),a.type==="press"||a.type==="doubletap"){let C=this.host.nativeElement,_=s&&typeof s.closest=="function"?s.closest(".widget-container"):null;_&&_!==C&&(v=!1,A=!1);let M=C.classList?.contains("grid-stack")||C.tagName?.toLowerCase()==="gridstack",B=s&&typeof s.closest=="function"?s.closest(".grid-stack-item"):null;M&&B&&(v=!1,A=!1,this.debug("suppress grid-root rebroadcast for press/doubletap inside grid-stack-item",{host:this.elDesc(C),target:this.elDesc(s??void 0),inGridItem:this.elDesc(B)}))}switch(this.debug("rebroadcast gate",{type:a.type,allowH:m,allowV:g,allowP:v,allowDT:A,fromChild:l,target:this.elDesc(s??void 0),host:this.elDesc(this.host.nativeElement),mode:this.mode()}),a.type){case"press":v&&(this.debug("rebroadcast emit: press"),this.press.emit(a));break;case"doubletap":A&&(this.debug("rebroadcast emit: doubletap"),this.doubletap.emit(a));break;case"swipeleft":m&&(this.debug("rebroadcast emit: swipeleft"),this.swipeleft.emit(a));break;case"swiperight":m&&(this.debug("rebroadcast emit: swiperight"),this.swiperight.emit(a));break;case"swipeup":g&&(this.debug("rebroadcast emit: swipeup"),this.swipeup.emit(a));break;case"swipedown":g&&(this.debug("rebroadcast emit: swipedown"),this.swipedown.emit(a));break}},t={passive:!0};o.addEventListener("press",e,t),o.addEventListener("doubletap",e,t),o.addEventListener("swipeleft",e,t),o.addEventListener("swiperight",e,t),o.addEventListener("swipeup",e,t),o.addEventListener("swipedown",e,t),o.addEventListener("contextmenu",this.onContextMenu,{passive:!1}),this.destroyRef.onDestroy(()=>{o.removeEventListener("pointerdown",this.onPointerDown,{capture:!0}),o.removeEventListener("pointermove",this.onPointerMove,{capture:!0}),o.removeEventListener("pointerrawupdate",this.onPointerRawUpdate,{capture:!0}),o.removeEventListener("pointerup",this.onPointerUp),o.removeEventListener("pointercancel",this.onPointerCancel,{capture:!0}),o.removeEventListener("lostpointercapture",this.onLostPointerCapture,{capture:!0}),o.removeEventListener("dblclick",this.onNativeDblClick),o.removeEventListener("press",e,t),o.removeEventListener("doubletap",e,t),o.removeEventListener("swipeleft",e,t),o.removeEventListener("swiperight",e,t),o.removeEventListener("swipeup",e,t),o.removeEventListener("swipedown",e,t),o.removeEventListener("contextmenu",this.onContextMenu),this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null),this.removeLongpressCancelListeners();try{if(this.pointerId!==null){let i=this.constructor._laneOwners,a=i.get(this.pointerId);a&&(this.debug("onDestroy: releasing lane ownership",{pointerId:this.pointerId,ownersBefore:a,ownedByThis:this.ownedLanes,instanceId:this._instanceId}),this.ownedLanes.h&&a.h===this._instanceId&&delete a.h,this.ownedLanes.v&&a.v===this._instanceId&&delete a.v,this.ownedLanes.p&&a.p===this._instanceId&&delete a.p,!a.h&&!a.v&&!a.p?i.delete(this.pointerId):i.set(this.pointerId,a),this.debug("onDestroy: lane owners after release",{pointerId:this.pointerId,owners:a}));let r=this.constructor._activePointers.delete(this.pointerId);this.debug("onDestroy: activePointers delete",{pointerId:this.pointerId,deleted:r})}}catch(i){}try{this.pointerId!==null&&this.captureEl&&"releasePointerCapture"in this.captureEl&&this.captureEl.releasePointerCapture(this.pointerId)}catch(i){}this.pointerId=null,this.captureEl=null,this.tracking=!1;try{n._instanceToEl.delete(this._instanceId)}catch(i){}})}onNativeDblClick=o=>{if(this.disableGestures()||!this.modeAllowsDoubleTap())return;let e=new CustomEvent("doubletap",{detail:{x:o.clientX,y:o.clientY,dt:0}});this.doubletap.emit(e),this.lastTapTime=0};onPointerDown=o=>{let e=this.constructor._activePointers,t=e.has(o.pointerId);t||e.add(o.pointerId);let i=this.constructor._multiPointerActive;if(i||e.size>1){!i&&e.size>1&&this.debug("multi-pointer detected; blocking gestures",{activeCount:e.size,pointerId:o.pointerId}),this.constructor._multiPointerActive=!0,this.tracking&&this.reset(!0);return}(this.tracking||this.pressFired||this.longPressTimer)&&(this.debug("pointerdown with stale state; force reset",{tracking:this.tracking,pressFired:this.pressFired,hasTimer:!!this.longPressTimer}),this.reset());let a=performance.now(),r=this.constructor._suppressAllGesturesUntil;if(a<r){this.debug("pointerdown suppressed by global window after longpress",{now:Math.round(a),suppressUntil:Math.round(r),remainingMs:Math.round(r-a)});return}if(this.disableGestures()||(this.debug("pointerdown",{x:o.clientX,y:o.clientY,pointerId:o.pointerId,pointerType:o.pointerType,sourceElement:o.target instanceof Element?o.target.outerHTML:String(o.target)}),this.pointerId!==null))return;let s=this.modeAllowsHorizontal(),l=this.modeAllowsVertical(),m=this.modeAllowsPress(),g=this.modeAllowsDoubleTap();{let D=o.target,V=this.host.nativeElement,F=D&&typeof D.closest=="function"?D.closest(".widget-container"):null;F&&F!==V&&(m=!1,g=!1);let Y=V.classList?.contains("grid-stack")||V.tagName?.toLowerCase()==="gridstack",j=D&&typeof D.closest=="function"?D.closest(".grid-stack-item"):null;Y&&j&&(m=!1,g=!1,this.debug("suppress grid-root press/doubletap for event inside grid-stack-item",{host:this.elDesc(V),target:this.elDesc(D??void 0),inGridItem:this.elDesc(j)}))}if(!s&&!l&&!m&&!g){this.debug("ignoring pointerdown: no gestures enabled for current mode");return}let v=m||g,A=this.constructor._laneOwners;!t&&A.has(o.pointerId)&&(this.debug("new pointer sequence; clearing stale lane owners",{pointerId:o.pointerId,prevOwners:A.get(o.pointerId)}),A.delete(o.pointerId));let C=A.get(o.pointerId)??{};if(C.p!==void 0){let D=C.p,V=this.constructor._instanceToEl.get(D),F=this.host.nativeElement,Y=o.target??null,j=this.ownerRelationshipSummary(V??null,F,Y);this.debug("pre-acquire owners (press lane already owned)",{owners:C,ownerId:D,ownerEl:this.elDesc(V),hostEl:this.elDesc(F),targetEl:this.elDesc(Y),rel:j})}else this.debug("pre-acquire owners",{owners:C});if(this.ownedLanes={h:!1,v:!1,p:!1},s&&C.h===void 0&&(C.h=this._instanceId,this.ownedLanes.h=!0,this.debug("lane acquired",{lane:"horizontal",pointerId:o.pointerId,instanceId:this._instanceId,owners:C})),l&&C.v===void 0&&(C.v=this._instanceId,this.ownedLanes.v=!0,this.debug("lane acquired",{lane:"vertical",pointerId:o.pointerId,instanceId:this._instanceId,owners:C})),v&&C.p===void 0&&(C.p=this._instanceId,this.ownedLanes.p=!0,this.debug("lane acquired",{lane:"press",pointerId:o.pointerId,instanceId:this._instanceId,owners:C})),this.debug("lane acquisition",{allowH:s,allowV:l,allowPress:m,allowDT:g,wantP:v,acquired:this.ownedLanes,existingOwners:C}),!this.ownedLanes.h&&!this.ownedLanes.v&&!this.ownedLanes.p){if(v&&C.p!==void 0){let D=C.p,V=this.constructor._instanceToEl.get(D),F=this.host.nativeElement,Y=o.target??null,j=this.ownerRelationshipSummary(V??null,F,Y);this.debug("ignoring pointerdown: press lane not owned",{owners:C,ownerId:D,ownerEl:this.elDesc(V),hostEl:this.elDesc(F),targetEl:this.elDesc(Y),rel:j})}else this.debug("ignoring pointerdown: other instance owns relevant lanes",{owners:C});return}switch(this.pointerId=o.pointerId,A.set(o.pointerId,C),this.tracking=!0,this.pressFired=!1,this.currentPointerType=o.pointerType||null,this.lockedAxis=null,this.captureEl=null,this.isDebugEnabled()&&(this.moveSamples=[{t:performance.now(),x:o.clientX,y:o.clientY,source:"move"}]),o.pointerType){case"touch":this._swipeMinDistance=this.isChromeOnMac?Math.min(25,this.swipeMinDistance()):this.swipeMinDistance(),this._swipeMaxDuration=this.isChromeOnMac?Math.max(850,this.swipeMaxDuration()):this.swipeMaxDuration(),this._longPressMs=this.longPressMs(),this._doubleTapInterval=this.doubleTapInterval(),this._tapSlop=this.tapSlop(),this._pressMoveSlop=Math.max(this.pressMoveSlop(),16);break;case"pen":this._swipeMinDistance=20,this._swipeMaxDuration=500,this._longPressMs=500,this._doubleTapInterval=250,this._tapSlop=10,this._pressMoveSlop=2;break;default:this._swipeMinDistance=15,this._swipeMaxDuration=400,this._longPressMs=500,this._doubleTapInterval=250,this._tapSlop=8,this._pressMoveSlop=2;break}this.debug("thresholds",{pointerType:o.pointerType,swipeMinDistance:this._swipeMinDistance,swipeMaxDuration:this._swipeMaxDuration,longPressMs:this._longPressMs,doubleTapInterval:this._doubleTapInterval,tapSlop:this._tapSlop,pressMoveSlop:this._pressMoveSlop,axisLockThreshold:this.axisLockThreshold});let M=performance.now()-this.lastTapUpTime,B=Math.hypot(o.clientX-this.lastTapUpX,o.clientY-this.lastTapUpY);if(this.potentialDoubleTap=g&&M<=this._doubleTapInterval&&B<=this._tapSlop,this.startX=o.clientX,this.startY=o.clientY,this.startTime=performance.now(),o.pointerType!=="mouse"){let V=o.target??null??this.host.nativeElement;try{"setPointerCapture"in V?(V.setPointerCapture(o.pointerId),this.captureEl=V,this.debug("setPointerCapture success",{pointerId:o.pointerId,pointerType:o.pointerType,captureElement:this.elDesc(V)})):(this.captureEl=null,this.debug("setPointerCapture unavailable on element"))}catch(F){this.captureEl=null,this.debug("setPointerCapture failed",{pointerId:o.pointerId,pointerType:o.pointerType})}}if(this.longPressTimer&&(this.debug("longpress timer cleared on pointerdown"),window.clearTimeout(this.longPressTimer)),!this.potentialDoubleTap&&m&&this.ownedLanes.p){if(this.currentPointerType!=="mouse")try{o.preventDefault()}catch(D){}this.addLongpressCancelListeners(),this.debug("longpress timer scheduled",{scheduleAt:Math.round(performance.now()),firesAt:Math.round(performance.now()+this._longPressMs),longPressMs:this._longPressMs,pressMoveSlop:this._pressMoveSlop,ownedLanes:this.ownedLanes,pointerType:this.currentPointerType}),this.longPressTimer=window.setTimeout(()=>{if(this.debug("longpress timer fired",{tracking:this.tracking,firedAt:Math.round(performance.now())}),this.constructor._multiPointerActive){this.debug("longpress cancelled: multi-pointer active"),this.reset(!0),this.longPressTimer=null,this.removeLongpressCancelListeners();return}if(!this.tracking){this.debug("longpress cancelled: not tracking");return}let D=o.clientX-this.startX,V=o.clientY-this.startY;if(Math.abs(D)<=this._pressMoveSlop&&Math.abs(V)<=this._pressMoveSlop){this.debug("longpress recognized",{x:this.startX,y:this.startY}),this.isFirefox&&this.currentPointerType!=="mouse"&&this.suppressNextClick(500),this.currentPointerType!=="mouse"&&(this.constructor._suppressAllGesturesUntil=performance.now()+600,this.debug("set global suppression window after longpress",{until:Math.round(this.constructor._suppressAllGesturesUntil)})),this.pressFired=!0;let F={x:this.startX,y:this.startY,center:{x:this.startX,y:this.startY}};this.emitPressEvent(F),this.reset()}this.longPressTimer=null,this.removeLongpressCancelListeners()},this._longPressMs)}else this.debug("longpress not scheduled",{potentialDoubleTap:this.potentialDoubleTap,allowPress:m,ownedPressLane:this.ownedLanes.p,reason:this.potentialDoubleTap?"awaiting doubletap":m?this.ownedLanes.p?"unknown":"press lane not owned":"press disabled by mode/flag",ownersForPointer:C})};onLostPointerCapture=o=>{if(o.pointerId===this.pointerId){if(this.currentPointerType!=="mouse"&&this.longPressTimer){this.debug("ignore lostpointercapture during active touch/pen long-press");return}this.onPointerCancel(o)}};suppressNextClick(o=500){this.debug("suppressNextClick (Firefox)",{timeoutMs:o});let e={capture:!0,passive:!1},t=["click","pointerup","mouseup","mousedown","auxclick","touchend","touchstart","contextmenu"],i=s=>{this.debug("suppress ghost event",s.type),s.preventDefault(),s.stopPropagation();let l=s;typeof l.stopImmediatePropagation=="function"&&l.stopImmediatePropagation()},a=()=>{t.forEach(s=>document.removeEventListener(s,i,e)),window.clearTimeout(r)};t.forEach(s=>document.addEventListener(s,i,e));let r=window.setTimeout(a,o)}onPointerMove=o=>this.handlePointerMotion(o,"move");onPointerRawUpdate=o=>this.handlePointerMotion(o,"raw");handlePointerMotion(o,e){if(!(!this.tracking||o.pointerId!==this.pointerId)){if(this.constructor._multiPointerActive){this.debug("multi-pointer block active; cancelling motion",{pointerId:o.pointerId,source:e}),this.reset(!0);return}if(!this.pressFired){if(this.recordMove(o,e),this.longPressTimer){let t=Math.abs(o.clientX-this.startX),i=Math.abs(o.clientY-this.startY);(t>this._pressMoveSlop||i>this._pressMoveSlop)&&(this.debug(`longpress cancelled by pointer${e==="raw"?"rawupdate":"move"}: moved beyond slop`,{dx:t,dy:i,slop:this._pressMoveSlop}),window.clearTimeout(this.longPressTimer),this.longPressTimer=null,this.removeLongpressCancelListeners())}if(!this.lockedAxis){let t=o.clientX-this.startX,i=o.clientY-this.startY,a=Math.abs(t),r=Math.abs(i);(a>=this.axisLockThreshold||r>=this.axisLockThreshold)&&(this.lockedAxis=a>=r?"x":"y",this.debug(`axis locked${e==="raw"?" (raw)":""}`,{axis:this.lockedAxis,dx:t,dy:i}))}}}}onPointerUp=o=>{if(this.debug("pointerup",{x:o.clientX,y:o.clientY,pointerId:o.pointerId}),!this.tracking||o.pointerId!==this.pointerId){this.cleanupActivePointer(o.pointerId);return}this.finishGesture(o,!1)};onPointerCancel=o=>{let e=this.host.nativeElement;if(this.debug("pointercancel",{pointerId:o.pointerId,pointerType:o.pointerType,event:o,documentActiveElement:document.activeElement,elementIsConnected:e.isConnected,elementVisibility:e.offsetParent!==null,hasPointerCapture:typeof e.hasPointerCapture=="function"?e.hasPointerCapture(o.pointerId):void 0,documentHidden:document.hidden}),!this.tracking||o.pointerId!==this.pointerId){this.cleanupActivePointer(o.pointerId);return}this.finishGesture(o,!0)};finishGesture(o,e){if(this.debug("finishGesture begin",{cancelled:e,hasTimer:!!this.longPressTimer,pressFired:this.pressFired,ownedLanes:this.ownedLanes}),this.cleanupActivePointer(o.pointerId),this.constructor._multiPointerActive){this.debug("multi-pointer block active; ignoring finishGesture",{pointerId:o.pointerId}),this.reset(!0);return}let t=performance.now(),i=t-this.startTime,a=o.clientX-this.startX,r=o.clientY-this.startY,s=Math.abs(a),l=Math.abs(r);if(this.longPressTimer&&(this.debug(`longpress cancelled by ${e?"pointercancel":"pointerup"}`,{durationMs:Math.round(i),absDx:s,absDy:l,pressMoveSlop:this._pressMoveSlop}),window.clearTimeout(this.longPressTimer),this.longPressTimer=null,this.removeLongpressCancelListeners()),this.pressFired){this.debug(`${e?"pointercancel":"pointerup"} after longpress: resetting gesture state`),this.reset();return}if(i<=this._swipeMaxDuration){let g=this.modeAllowsHorizontal(),v=this.modeAllowsVertical(),A=g&&this.ownedLanes.h&&(this.lockedAxis==="x"&&s>=this._swipeMinDistance||!this.lockedAxis&&s>=this._swipeMinDistance&&s>=l),C=v&&this.ownedLanes.v&&(this.lockedAxis==="y"&&l>=this._swipeMinDistance||!this.lockedAxis&&l>=this._swipeMinDistance&&l>s);if(this.debug("swipe gating",{allowH:g,allowV:v,owned:this.ownedLanes,lockedAxis:this.lockedAxis,horizontalOk:A,verticalOk:C}),A){this.debugSwipeDecision({phase:"recognized",axis:"x",dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:e?"horizontal swipe (on cancel)":"horizontal swipe"}),this.debug("swipe detected",{direction:a>0?"right":"left",dx:a,dy:r,duration:i}),a>0?this.emitSwipeEvent("swiperight",{dx:a,dy:r,duration:i}):this.emitSwipeEvent("swipeleft",{dx:a,dy:r,duration:i}),this.reset();return}else if(C){this.debugSwipeDecision({phase:"recognized",axis:"y",dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:e?"vertical swipe (on cancel)":"vertical swipe"}),this.debug("swipe detected",{direction:r>0?"down":"up",dx:a,dy:r,duration:i}),r>0?this.emitSwipeEvent("swipedown",{dx:a,dy:r,duration:i}):this.emitSwipeEvent("swipeup",{dx:a,dy:r,duration:i}),this.reset();return}if(!e){let _=this.lockedAxis??(s>=l?"x":"y"),M=_==="x"?s:l,B=[];M<this._swipeMinDistance&&B.push(`distance ${Math.round(M)}px < min ${this._swipeMinDistance}px`),!this.lockedAxis&&(_==="x"&&l>s||_==="y"&&s>l)&&B.push("orthogonal movement dominated"),this.debugSwipeDecision({phase:"rejected",axis:_,dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:B.join("; ")||"fell through conditions"})}}else e||this.debugSwipeDecision({phase:"rejected",axis:this.lockedAxis??(s>=l?"x":"y"),dx:a,dy:r,absDx:s,absDy:l,duration:i,reason:`duration ${Math.round(i)}ms exceeds max ${this._swipeMaxDuration}ms`});if(!e&&this.ownedLanes.p&&this.modeAllowsDoubleTap()&&this.currentPointerType!=="mouse"&&s<=this._tapSlop&&l<=this._tapSlop&&i<this._longPressMs){let g=t,v=g-this.lastTapTime,A=Math.hypot(o.clientX-this.lastTapX,o.clientY-this.lastTapY);v<=this._doubleTapInterval&&A<=this._tapSlop?(this.emitDoubleTapEvent({x:o.clientX,y:o.clientY,dt:v}),this.lastTapTime=0,this.potentialDoubleTap=!1):(this.lastTapTime=g,this.lastTapX=o.clientX,this.lastTapY=o.clientY)}!e&&!this.pressFired&&s<=this._tapSlop&&l<=this._tapSlop&&i<this._longPressMs?(this.lastTapUpTime=t,this.lastTapUpX=o.clientX,this.lastTapUpY=o.clientY):this.potentialDoubleTap=!1,this.reset()}addLongpressCancelListeners(){this.debug("addLongpressCancelListeners");let o=r=>{this.debug("longpress cancelled by event",r?.type),this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null),this.removeLongpressCancelListeners()},e=this.host.nativeElement,t=document,i={capture:!0},a=[{type:"pointercancel",handler:o,opts:i,targets:["el","doc"]}];this.currentPointerType!=="mouse"&&a.push({type:"blur",handler:o,opts:i,targets:["window"]}),this.cancelLongpressHandlers=a;for(let r of this.cancelLongpressHandlers){let{type:s,handler:l,opts:m,targets:g}=r;g&&g.includes("el")&&e.addEventListener(s,l,m),g&&g.includes("doc")&&t.addEventListener(s,l,m),g&&g.includes("window")&&window.addEventListener(s,l,m)}}removeLongpressCancelListeners(){this.debug("removeLongpressCancelListeners");let o=this.host.nativeElement,e=document;for(let t of this.cancelLongpressHandlers){let{type:i,handler:a,opts:r,targets:s}=t;s&&s.includes("el")&&o.removeEventListener(i,a,r),s&&s.includes("doc")&&e.removeEventListener(i,a,r),s&&s.includes("window")&&window.removeEventListener(i,a,r)}this.cancelLongpressHandlers=[]}reset(o=!1){this.debug("reset gesture state"),this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null);try{this.pointerId!==null&&this.captureEl&&"releasePointerCapture"in this.captureEl&&this.captureEl.releasePointerCapture(this.pointerId)}catch(e){}try{if(this.pointerId!==null){let e=this.constructor._laneOwners,t=e.get(this.pointerId);t&&(this.debug("releasing lane ownership",{pointerId:this.pointerId,ownersBefore:t,ownedByThis:this.ownedLanes,instanceId:this._instanceId}),this.ownedLanes.h&&t.h===this._instanceId&&delete t.h,this.ownedLanes.v&&t.v===this._instanceId&&delete t.v,this.ownedLanes.p&&t.p===this._instanceId&&delete t.p,!t.h&&!t.v&&!t.p?e.delete(this.pointerId):e.set(this.pointerId,t),this.debug("lane owners after release",{pointerId:this.pointerId,owners:t}))}}catch(e){}this.pointerId!==null&&!o&&this.cleanupActivePointer(this.pointerId),this.pointerId=null,this.captureEl=null,this.tracking=!1,this.pressFired=!1,this.currentPointerType=null,this.lockedAxis=null,this.ownedLanes={h:!1,v:!1,p:!1},this.removeLongpressCancelListeners()}isDebugEnabled(){try{return this.constructor.DEBUG}catch(o){return this.constructor.DEBUG}}recordMove(o,e){this.isDebugEnabled()&&(this.moveSamples.push({t:performance.now(),x:o.clientX,y:o.clientY,source:e}),this.moveSamples.length>this.constructor.MOVES_BUFFER_SIZE&&this.moveSamples.shift())}debugSwipeDecision(o){if(!this.isDebugEnabled())return;let e=this.moveSamples,t=e[e.length-1],i;if(e.length>=2){let a=t?.t??performance.now(),r=100,s=e.length-2;for(;s>=0&&a-e[s].t<r;)s--;s=Math.max(0,s);let l=e[s],m=Math.max(1,(t?.t??a)-l.t),g=(t?.x??0)-l.x,v=(t?.y??0)-l.y;i=(o.axis==="x"?Math.abs(g):Math.abs(v))/m}this.debug("swipe decision",{phase:o.phase,axis:o.axis,dx:o.dx,dy:o.dy,absDx:o.absDx,absDy:o.absDy,durationMs:Math.round(o.duration),velocityAvgPxPerMs:o.velocity??(o.axis==="x"?o.absDx:o.absDy)/Math.max(1,o.duration),recentVelocity100msPxPerMs:i,minDistance:this._swipeMinDistance,maxDuration:this._swipeMaxDuration,lockedAxis:this.lockedAxis,reason:o.reason,samplesCount:e.length,firstSample:e[0],lastSample:e[e.length-1]})}debug(...o){this.isDebugEnabled()&&console.debug(`[GestureDirective][#${this._instanceId}]`,...o)}cleanupActivePointer(o){try{let e=this.constructor._activePointers;e.delete(o)&&this.debug("activePointers delete",{pointerId:o,activeCount:e.size}),this.constructor._multiPointerActive&&e.size===0&&(this.constructor._multiPointerActive=!1,this.debug("multi-pointer block lifted",{activeCount:e.size}))}catch(e){}}emitSwipeEvent(o,e){e.__gid=this._instanceId;let t=new CustomEvent(o,{detail:e,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(t)}catch(i){}if(this.debug("emitSwipeEvent",{name:o,detail:e}),this.bridgeUiEvents()&&(o==="swipeleft"||o==="swiperight"))try{let i=o==="swipeleft"?"openLeftSidenav":"openRightSidenav";document.dispatchEvent(new CustomEvent(i,{detail:e}))}catch(i){}switch(o){case"swipeleft":this.swipeleft.emit(t);break;case"swiperight":this.swiperight.emit(t);break;case"swipeup":this.swipeup.emit(t);break;case"swipedown":this.swipedown.emit(t);break}}emitPressEvent(o){let e=performance.now();if(e-this._lastPressEmitTs<80){this.debug("press emit suppressed by cooldown");return}this._lastPressEmitTs=e,o.__gid=this._instanceId;let t=new CustomEvent("press",{detail:o,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(t)}catch(i){}this.debug("emitPressEvent",{detail:o}),this.press.emit(t)}emitDoubleTapEvent(o){o.__gid=this._instanceId;let e=new CustomEvent("doubletap",{detail:o,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(e)}catch(t){}this.doubletap.emit(e)}modeAllowsHorizontal(){let o=this.mode();return this.disableGestures()?!1:o==="all"||o==="horizontal"}modeAllowsVertical(){let o=this.mode();return this.disableGestures()?!1:o==="all"||o==="dashboard"}modeAllowsPress(){let o=this.mode();return this.disableGestures()?!1:(o==="all"||o==="dashboard"||o==="press"||o==="editor")&&this.enablePress()}modeAllowsDoubleTap(){let o=this.mode();return this.disableGestures()?!1:(o==="all"||o==="dashboard"||o==="press"||o==="editor")&&this.enableDoubleTap()}elDesc(o){if(!o)return null;try{let e=o,t=o.tagName?.toLowerCase?.()??"node",i=e.id?`#${e.id}`:"",a=e.className&&typeof e.className=="string"?e.className:"",r=a?"."+a.split(/\s+/).filter(Boolean).slice(0,4).join("."):"";return`${t}${i}${r}`}catch(e){return"node"}}ownerRelationshipSummary(o,e,t){try{return{owner:this.elDesc(o),host:this.elDesc(e),target:this.elDesc(t),ownerIsConnected:o?o.isConnected:null,hostIsConnected:e.isConnected,targetIsConnected:t?t.isConnected:null,targetInOwner:o&&t?o.contains(t):null,targetInHost:t?e.contains(t):null,ownerInHost:o?e.contains(o):null,hostInOwner:o?o.contains(e):null}}catch(i){return{}}}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Lt({type:n,selectors:[["","kipGestures",""]],inputs:{swipeMinDistance:[1,"swipeMinDistance"],swipeMaxDuration:[1,"swipeMaxDuration"],longPressMs:[1,"longPressMs"],doubleTapInterval:[1,"doubleTapInterval"],tapSlop:[1,"tapSlop"],pressMoveSlop:[1,"pressMoveSlop"],mode:[1,"mode"],disableGestures:[1,"disableGestures"],enablePress:[1,"enablePress"],enableDoubleTap:[1,"enableDoubleTap"],bridgeUiEvents:[1,"bridgeUiEvents"]},outputs:{swipeleft:"swipeleft",swiperight:"swiperight",swipeup:"swipeup",swipedown:"swipedown",press:"press",doubletap:"doubletap"}})};(()=>{try{(typeof localStorage<"u"?localStorage.getItem("kip:gesturesDebug"):null)==="1"&&(ds.DEBUG=!0);let o=window;o.kipGesturesDebug=e=>{let t=ds;typeof e=="boolean"?t.DEBUG=e:t.DEBUG=!t.DEBUG;try{localStorage.setItem("kip:gesturesDebug",t.DEBUG?"1":"0")}catch(i){}return console.info("KIP gestures debug:",t.DEBUG),t.DEBUG}}catch(n){}})();var lo=(()=>{class n{dataset=y(mn);syncDataChartDataset(e,t,i){let a=typeof t?.datachartPath=="string"?t.datachartPath.trim():"";if(!a)return;let r=typeof t?.datachartSource=="string"&&t.datachartSource.trim().length>0?t.datachartSource.trim():"default",s=t?.timeScale,l=Number(t?.period??0),m=i??"";this.upsertDataset({uuid:e,path:a,source:r,timeScale:s,period:l,label:m,serialize:!0,editable:!1})}syncNumericMiniChartDataset(e,t,i){let a=typeof t=="string"?t.trim():"";if(!a)return;let r=typeof i=="string"&&i.trim().length>0?i.trim():"default";this.upsertDataset({uuid:e,path:a,source:r,timeScale:"minute",period:.2,label:`simple-chart-${e}`,serialize:!1,editable:!1})}syncWindTrendsDatasets(e,t){!t||String(t).trim().length===0||(this.upsertDataset({uuid:`${e}-twd`,path:"self.environment.wind.directionTrue",source:"default",timeScale:t,period:30,label:`windtrends-${e}`,serialize:!0,editable:!1}),this.upsertDataset({uuid:`${e}-tws`,path:"self.environment.wind.speedTrue",source:"default",timeScale:t,period:30,label:`speedtrends-${e}`,serialize:!0,editable:!1}))}removeDatasetIfExists(e,t=!1){this.dataset.removeIfExists(e,t)}removeOwnedDatasets(e,t=!0){let i=typeof e=="string"?e.trim():"";if(!i)return;this.dataset.list().filter(s=>s.uuid===i||s.uuid?.startsWith(`${i}-`)).forEach(s=>{this.dataset.removeIfExists(s.uuid,t)})}upsertDataset(e){let t=this.dataset.getDatasetConfig(e.uuid);if(!t){this.dataset.create(e.path,e.source,e.timeScale,e.period,e.label,e.serialize,e.editable,e.uuid);return}if(!(t.path!==e.path||t.pathSource!==e.source||t.timeScaleFormat!==e.timeScale||t.period!==e.period||t.label!==e.label))return;let a=ge(ne({},t),{path:e.path,pathSource:e.source,timeScaleFormat:e.timeScale,period:e.period,label:e.label,editable:e.editable});this.dataset.edit(a,e.serialize)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Uu=(()=>{class n{_storage=y(Jc);_settings=y(Wt);upgrading=w(!1);error=w(null);messages=w([]);legacyFileVersion=9;legacyConfigVersion=10;targetConfigVersion=12;static widgetTypeToSelectorMap={WidgetNumeric:"widget-numeric",WidgetTextGeneric:"widget-text",WidgetDateGeneric:"widget-datetime",WidgetBooleanSwitch:"widget-boolean-switch",WidgetBlank:"widget-blank",WidgetStateComponent:"widget-button",WidgetSimpleLinearComponent:"widget-simple-linear",WidgetGaugeNgLinearComponent:"widget-gauge-ng-linear",WidgetGaugeNgRadialComponent:"widget-gauge-ng-radial",WidgetGaugeNgCompassComponent:"widget-gauge-ng-compass",WidgetGaugeComponent:"widget-gauge-steel",WidgetWindComponent:"widget-wind-steer",WidgetFreeboardskComponent:"widget-freeboardsk",WidgetAutopilotComponent:"widget-autopilot",WidgetDataChart:"widget-data-chart",WidgetRaceTimerComponent:"widget-racetimer",WidgetIframeComponent:"widget-iframe",WidgetTutorial:"widget-tutorial"};runUpgrade(e){return Re(this,null,function*(){if(this.error.set(null),this.upgrading.set(!0),this.messages.set([]),e===void 0)try{let t=yield this._storage.listConfigs(this.legacyFileVersion);for(let i of t){let a=yield this.transformConfig(i);if(a)try{yield this._storage.setConfig(a.scope,a.name,a.newConfiguration),yield this._storage.setConfig(a.scope,a.name,a.oldConfiguration,this.legacyFileVersion),this.pushMsg(`[Upgrade] Configuration ${a.scope}/${a.name} upgraded to version ${this.targetConfigVersion}. Old configuration patched to version 0.`)}catch(r){this.pushError(`[Upgrade] Error saving configuration for ${i.name}: ${r.message}`)}}setTimeout(()=>this._settings.reloadApp(),1500)}catch(t){this.pushError("Error fetching configuration data: "+t.message)}else if(e===11&&this._settings.useSharedConfig)try{let t=yield this._storage.listConfigs(11);for(let i of t)try{let a=yield this._storage.getConfig(i.scope,i.name,11),r=Ft(a);this.pushMsg(`[Upgrade] Saving configuration backup to file ${i.scope}/${i.name}...`),yield this._storage.setConfig(i.scope,i.name,r,11.99),this.pushMsg(`[Upgrade] ${i.scope}/${i.name} -> v${this.targetConfigVersion}.`);let s=this.upgradeConfig(a);if(!s)continue;this.pushMsg("[Upgrade] Saving upgraded configurations..."),yield this._storage.setConfig(i.scope,i.name,s)}catch(a){this.pushError(`[Upgrade] Error upgrading ${i.scope}/${i.name}: ${a.message}`)}this.pushMsg("[Upgrade] Reloading app to finalize upgrade..."),setTimeout(()=>this._settings.reloadApp(),1500)}catch(t){this.pushError("Error fetching configuration data. Aborting upgrade. Details: "+t.message)}else if(e===11&&!this._settings.useSharedConfig){let t={app:null,dashboards:null,theme:null};t.app=this._settings.getAppConfig(),t.dashboards=this._settings.getDashboardConfig(),t.theme=this._settings.getThemeConfig(),t.app.configVersion=this.targetConfigVersion,this.addSplitShellConfigKeys(t.app);let i=this.extractAppDatasets(t.app);this.upgradeDashboardWidgets(t.dashboards),this.migrateDatasetsToDataCharts(i,t.dashboards),this.migrateUseNeedleToEnableNeedle(t.dashboards),localStorage.setItem("appConfig",JSON.stringify(t.app)),localStorage.setItem("dashboardsConfig",JSON.stringify(t.dashboards)),localStorage.setItem("themeConfig",JSON.stringify(t.theme)),setTimeout(()=>this._settings.reloadApp(),1500),this.upgrading.set(!1)}else{let t={app:null,widget:null,layout:null,theme:null};t.app=this._settings.loadConfigFromLocalStorage("appConfig"),t.widget=this._settings.loadConfigFromLocalStorage("widgetConfig"),t.layout=this._settings.loadConfigFromLocalStorage("layoutConfig"),t.theme=this._settings.loadConfigFromLocalStorage("themeConfig");let i=this.transformApp(t.app),a=this.extractAppDatasets(i),r=this.transformTheme(t.theme),s=t.layout?.rootSplits||[],l=t.layout?.splitSets||[],m=t.widget?.widgets||[],g=s.map((v,A)=>{let C=this.extractWidgetsFromSplitSets(l,m,v);return{id:v,name:`Dashboard ${A+1}`,configuration:C}});this.migrateDatasetsToDataCharts(a,g),this.migrateUseNeedleToEnableNeedle(g),localStorage.setItem("appConfig",JSON.stringify(i)),localStorage.setItem("dashboardsConfig",JSON.stringify(g)),localStorage.setItem("themeConfig",JSON.stringify(r)),setTimeout(()=>this._settings.reloadApp(),1500),this.upgrading.set(!1)}})}startFresh(){if(this.error.set(null),this.upgrading.set(!0),this._storage.initConfig===null)this._storage.listConfigs(this.legacyFileVersion).then(e=>Re(this,null,function*(){for(let t of e){let i=yield this._storage.getConfig(t.scope,t.name,this.legacyFileVersion);if(i.app.configVersion=0,t.scope==="global")try{setTimeout(()=>{this._storage.patchGlobal(t.name,t.scope,i,"replace",this.legacyFileVersion),this.pushMsg(`[Retired] Configuration ${t.scope}/${t.name} patched to version 0.`)},750)}catch(a){this.pushError(`[Upgrade] Error saving configuration for ${t.name}.`)}else try{yield this._storage.setConfig(t.scope,t.name,i,this.legacyFileVersion),this.pushMsg(`[Retired] Configuration ${t.scope}/${t.name} patched to version 0.`)}catch(a){this.pushError(`[Upgrade] Error saving configuration for ${t.name}.`)}}})).catch(e=>this.pushError("Error fetching configuration data: "+e.message)).finally(()=>{this.upgrading.set(!1),this._settings.resetSettings()});else{let e={app:null,dashboards:null,theme:null};e.app=this._settings.loadConfigFromLocalStorage("appConfig"),e.theme=this._settings.loadConfigFromLocalStorage("themeConfig"),e.app.configVersion=this.targetConfigVersion,e.app.nightModeBrightness=.27,e.theme.themeName="",localStorage.setItem("appConfig",JSON.stringify(e.app)),localStorage.setItem("themeConfig",JSON.stringify(e.theme)),localStorage.removeItem("widgetConfig"),localStorage.removeItem("layoutConfig"),this.upgrading.set(!1)}}transformConfig(e){return Re(this,null,function*(){let t=yield this._storage.getConfig(e.scope,e.name,this.legacyFileVersion);if(t.app.configVersion!==this.legacyConfigVersion)return this.pushError(`[Upgrade Service] ${e.scope}/${e.name} is not an upgradable version ${this.legacyConfigVersion} config. Skipping.`),null;let i=this.transformApp(t.app),a=this.extractAppDatasets(i),r=this.transformTheme(t.theme),s=t.layout?.rootSplits||[],l=t.layout?.splitSets||[],m=t.widget?.widgets||[],g=s.map((A,C)=>{let _=this.extractWidgetsFromSplitSets(l,m,A);return{id:A,name:`Dashboard ${C+1}`,configuration:_}});this.migrateDatasetsToDataCharts(a,g),this.migrateUseNeedleToEnableNeedle(g);let v=Ft(t);return v.app.configVersion=0,{scope:e.scope,name:e.name,newConfiguration:{app:i,theme:r,dashboards:g},oldConfiguration:v}})}extractAppDatasets(e){if(!e||!Array.isArray(e.dataSets))return[];let t=0,i=[],a=[];e.dataSets.forEach((r,s)=>{(r.editable===!0||r.editable===void 0)&&(a.push({period:r.period,datachartPath:r.path,datachartSource:r.pathSource,timeScale:r.timeScaleFormat,datasetUUID:r.uuid}),i.push(s),t++)});for(let r=i.length-1;r>=0;r--)e.dataSets.splice(i[r],1);return t&&this.pushMsg(`[Upgrade] Retired ${t} Dataset(s).`),a}migrateDatasetsToDataCharts(e,t){!Array.isArray(e)||e.length===0||Array.isArray(t)&&t.forEach(i=>{let a=0;i&&Array.isArray(i.configuration)&&(i.configuration.forEach(r=>{if(r&&typeof r=="object"&&r.input?.widgetProperties?.config){let s=e.find(l=>l.datasetUUID===r.input?.widgetProperties?.config.datasetUUID);s&&(Object.entries(s).forEach(([l,m])=>{l!=="datasetUUID"&&(r.input.widgetProperties.config[l]=m)}),delete r.input.widgetProperties.config?.datasetUUID,delete r.input.widgetProperties.config?.timeScaleFormat,a++)}}),a&&this.pushMsg(`[Upgrade] Migrated ${a} Realtime Data Chart widget(s).`))})}transformWidget(e,t){if(e.color==="white"&&(e.color="contrast"),e.textColor){switch(e.textColor){case"text":e.color="contrast";break;case"primary":e.color="blue";break;case"accent":e.color="yellow";break;case"warn":e.color="purple";break;case"nobar":t==="WidgetGaugeNgLinearComponent"&&(e.color="blue",e.gauge=e.gauge||{},e.gauge.useNeedle=!1);break;default:e.color=e.textColor}delete e.textColor}return e}transformApp(e){if(!e)return null;let t=Ft(e);return t.configVersion=this.targetConfigVersion,t.nightModeBrightness=.27,t.splitShellEnabled=!1,t.splitShellSide="left",t.splitShellWidth=.2,t.splitShellSwipeDisabled=!1,t}transformTheme(e){return e?{themeName:""}:null}upgradeConfig(e){try{if(e.app.configVersion!==11)return this.pushError(`[Upgrade Service] Config version ${e.app.configVersion} upgrade is not supported. Skipping...`),null;this.addSplitShellConfigKeys(e.app);let t=this.extractAppDatasets(e.app);this.migrateDatasetsToDataCharts(t,e.dashboards),this.migrateUseNeedleToEnableNeedle(e.dashboards);let i=0,a=0;if(Array.isArray(e.dashboards)){for(let r of e.dashboards)if(r&&Array.isArray(r.configuration)){for(let s of r.configuration)if(s&&typeof s=="object"){s.selector!=="widget-host2"&&(s.selector="widget-host2",i++);let l=m=>{let g=s[m],v=typeof g=="string"?Number(g):g;Number.isFinite(v)&&v!==0&&(s[m]=v*2,a++)};if(l("w"),l("h"),l("x"),l("y"),s.w===void 0||s.w===null){let m=s.minW,g=m||2;s.w=g,a++}if(s.h===void 0||s.h===null){let m=s.minH,g=m||2;s.h=g,a++}}}}return i&&this.pushMsg(`[Upgrade] Updated ${i} widget selector(s) to 'widget-host2'.`),a&&this.pushMsg(`[Upgrade] Doubled widget grid metrics for ${a} non-zero (w/h/x/y) entries.`),e.app.configVersion=12,{app:e.app,theme:e.theme,dashboards:e.dashboards}}catch(t){return this.pushError(`[Upgrade Service] Error upgrading ${e.app.configVersion}: ${t.message}`),null}}migrateUseNeedleToEnableNeedle(e){if(!Array.isArray(e))return;let t=0;for(let i of e)if(!(!i||!Array.isArray(i.configuration)))for(let a of i.configuration){let l=a.input?.widgetProperties?.config?.gauge;!l||typeof l!="object"||Object.prototype.hasOwnProperty.call(l,"useNeedle")&&(l.enableNeedle===void 0?l.enableNeedle=!!l.useNeedle:l.enableNeedle=!!l.enableNeedle,delete l.useNeedle,t++)}t&&this.pushMsg(`[Upgrade] Renamed gauge.useNeedle -> gauge.enableNeedle on ${t} widget(s).`)}addSplitShellConfigKeys(e){e&&(e.splitShellEnabled===void 0&&(e.splitShellEnabled=!1),e.splitShellSide===void 0&&(e.splitShellSide="left"),e.splitShellWidth===void 0&&(e.splitShellWidth=.2),e.splitShellSwipeDisabled===void 0&&(e.splitShellSwipeDisabled=!1))}upgradeDashboardWidgets(e){let t=0,i=0;if(Array.isArray(e)){for(let a of e)if(!(!a||!Array.isArray(a.configuration)))for(let r of a.configuration){if(!r||typeof r!="object")continue;r.selector!=="widget-host2"&&(r.selector="widget-host2",t++);let s=l=>{let m=r[l],g=typeof m=="string"?Number(m):m;Number.isFinite(g)&&g!==0&&(r[l]=g*2,i++)};if(s("w"),s("h"),s("x"),s("y"),r.w===void 0||r.w===null){let l=r.minW,m=typeof l=="string"?Number(l):l,g=Number.isFinite(m)&&m>0?m:2;r.w=g*2,i++}if(r.h===void 0||r.h===null){let l=r.minH,m=typeof l=="string"?Number(l):l,g=Number.isFinite(m)&&m>0?m:2;r.h=g*2,i++}}}t&&this.pushMsg(`[Upgrade] Updated ${t} localStorage widget selector(s) to 'widget-host2'.`),i&&this.pushMsg(`[Upgrade] Doubled grid metrics for ${i} non-zero (w/h/x/y) entries.`)}extractWidgetsFromSplitSets(e,t,i){let a=new Map(t.map(M=>[M.uuid,M])),r=[],s=[],l=0,m=0,g=24,v=24,A=3,C=3,_=M=>{let B=e.find(D=>D.uuid===M);if(!B){s.push(`Missing splitSet with UUID: ${M}`);return}B.splitAreas.forEach(D=>{if(D.type==="widget"){let V=a.get(D.uuid);if(V){if(V.type==="WidgetBlank")return;if(m+C>v){s.push(`No space left for widget: ${V.uuid}`);return}let F=n.widgetTypeToSelectorMap[V.type]||"widget-unknown",Y=this.transformWidget(V.config,V.type);r.push({id:V.uuid,selector:"widget-host2",input:{widgetProperties:{type:F,uuid:V.uuid,config:Y}},x:l,y:m,w:A,h:C}),l+=A,l>=g&&(l=0,m+=C)}else s.push(`Missing widget with UUID: ${D.uuid}`)}else D.type==="splitSet"&&_(D.uuid)})};return _(i),s.length&&this.pushMsg("Transformation Issues: "+s.join("; ")),r}pushMsg(e){this.messages.update(t=>[...t,e])}pushError(e){this.error.set(e),this.pushMsg(e)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function Kf(n,o){if(n&1&&W(0,"img",3),n&2){let e=k();J("src",e.data.iconHref,Nr)}}function Jf(n,o){n&1&&Lr(0)}var El=(()=>{class n{data=y(ri);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["dialog-frame"]],decls:10,vars:4,consts:[[1,"dialogue-header"],[1,"dialog-title"],["mat-dialog-title",""],["alt","","aria-hidden","true",1,"dialog-title-icon"],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"dialog-content-padding"],[4,"ngComponentOutlet"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"h5",2),I(3,Kf,1,1,"img",3),c(4),u()(),d(5,"button",4)(6,"mat-icon"),c(7,"close"),u()()(),d(8,"mat-dialog-content",5),yi(9,Jf,1,0,"ng-container",6),u()),t&2&&(f(3),N(i.data.iconHref?3:-1),f(),fe(" ",i.data.title),f(),R("mat-dialog-close",!1),f(4),R("ngComponentOutlet",i.data.componentType))},dependencies:[Xe,Ht,ki,Ti,Di,ot,Pt,Cc],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.dialog-title[_ngcontent-%COMP%]{display:flex;align-items:center}.dialog-title-icon[_ngcontent-%COMP%]{position:relative;top:12px;width:42px;height:42px;object-fit:contain}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}"]})}return n})();function e0(n,o){if(n&1&&(d(0,"button",4),c(1),u()),n&2){let e=k();R("mat-dialog-close",!0),f(),K(e.data.confirmBtnText)}}var Hu=(()=>{class n{data=y(ri);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["dialog-confirmation"]],decls:12,vars:6,consts:[[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"h5",1),c(2),u(),d(3,"button",2)(4,"mat-icon"),c(5,"close"),u()()(),d(6,"mat-dialog-content"),c(7),u(),d(8,"mat-dialog-actions",3)(9,"button",4),c(10),u(),I(11,e0,2,2,"button",4),u()),t&2&&(f(2),K(i.data.title),f(),R("mat-dialog-close",!1),f(4),fe(" ",i.data.message,`
41
- `),f(2),R("mat-dialog-close",!1),f(),K(i.data.cancelBtnText),f(),N(i.data.confirmBtnText?11:-1))},dependencies:[Xe,Ht,ki,Ti,Ln,Di,ot,wt,Pt],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}"]})}return n})();function t0(n,o){if(n&1&&(d(0,"button",9),c(1),u()),n&2){let e=k(),t=Rt(1);R("disabled",!t.valid),f(),K(e.data.confirmBtnText)}}var qu=(()=>{class n{dialogRef=y(an);data=y(ri);saveName(){this.dialogRef.close(this.data)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["dialog-name"]],decls:19,vars:6,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-margin"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(t,i){if(t&1){let a=we();d(0,"form",1,0),U("ngSubmit",function(){return i.saveName()}),d(2,"div",2)(3,"h5",3),c(4),u(),d(5,"button",4)(6,"mat-icon"),c(7,"close"),u()()(),d(8,"mat-dialog-content")(9,"mat-form-field",5)(10,"mat-label"),c(11,"Name"),u(),d(12,"input",6),bn("ngModelChange",function(s){return ee(a),vn(i.data.name,s)||(i.data.name=s),te(s)}),u(),d(13,"mat-error"),c(14," A name is required "),u()()(),d(15,"mat-dialog-actions",7)(16,"button",8),c(17),u(),I(18,t0,2,2,"button",9),u()()}t&2&&(f(4),K(i.data.title),f(),R("mat-dialog-close",!1),f(7),fn("ngModel",i.data.name),f(4),R("mat-dialog-close",!1),f(),K(i.data.cancelBtnText),f(),N(i.data.confirmBtnText?18:-1))},dependencies:[Ht,ki,Ti,Ln,Di,et,Xe,qt,bt,vt,Bn,$t,At,ot,wt,Pt,It,Ya,gt,rt,Mt,kt,Fn,Qr],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}"]})}return n})();function i0(n,o){n&1&&(d(0,"mat-option",19),c(1,"Toggle"),u(),d(2,"mat-option",20),c(3,"Push"),u(),d(4,"mat-option",21),c(5,"Indicator"),u())}function n0(n,o){n&1&&(d(0,"mat-option",8),c(1,"Zone State"),u())}function a0(n,o){if(n&1&&(d(0,"mat-option",10),c(1),u()),n&2){let e=o.$implicit;R("value",Fi(e.value)),f(),K(e.label)}}function o0(n,o){n&1&&(d(0,"mat-checkbox",12),c(1," Use numeric path "),u())}function r0(n,o){if(n&1){let e=we();d(0,"button",22),U("click",function(){ee(e);let i=k();return te(i.moveCtrlUp())}),d(1,"mat-icon"),c(2,"arrow_drop_up"),u()()}}function s0(n,o){if(n&1){let e=we();d(0,"button",23),U("click",function(){ee(e);let i=k();return te(i.moveCtrlDown())}),d(1,"mat-icon"),c(2,"arrow_drop_down"),u()()}}var $u=(()=>{class n{app=y(Ii);ctrlFormGroup=x.required();controlIndex=x(void 0);arrayLength=x(void 0);deleteCtrl=mt();moveUp=mt();moveDown=mt();colors=[];ngOnInit(){this.colors=this.app.configurableThemeColors}deleteControl(){let e={ctrlIndex:this.controlIndex(),pathID:this.ctrlFormGroup().get("pathID").value};this.deleteCtrl.emit(e)}moveCtrlUp(){this.moveUp.emit(this.controlIndex())}moveCtrlDown(){this.moveDown.emit(this.controlIndex())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["boolean-control-config"]],inputs:{ctrlFormGroup:[1,"ctrlFormGroup"],controlIndex:[1,"controlIndex"],arrayLength:[1,"arrayLength"]},outputs:{deleteCtrl:"deleteCtrl",moveUp:"moveUp",moveDown:"moveDown"},decls:31,vars:5,consts:[[1,"ctrl-grid","rounded-card","rounded-card-color",3,"formGroup"],[1,"controls","flex-container"],[1,"flex-label"],[1,"full-width"],["matInput","","type","string","placeholder","Enter a display label...","formControlName","ctrlLabel"],[1,"flex-settings"],[1,"settings"],["placeholder","Select Type...","formControlName","type","name","type","required",""],["value","4"],["placeholder","Select Color...","formControlName","color","name","color","required",""],[3,"value"],[1,"flex-full-width"],["formControlName","isNumeric"],[1,"actions"],[1,"flex-actions"],[1,"btn-grid"],["mat-icon-button","","type","button","aria-label","Move control up in the list",1,"up"],["mat-icon-button","","type","button","aria-label","Move control down in the list",1,"down"],["mat-icon-button","","type","button","aria-label","Delete control",1,"delete",3,"click"],["value","1"],["value","2"],["value","3"],["mat-icon-button","","type","button","aria-label","Move control up in the list",1,"up",3,"click"],["mat-icon-button","","type","button","aria-label","Move control down in the list",1,"down",3,"click"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-form-field",3)(4,"mat-label"),c(5,"Label"),u(),W(6,"input",4),u()(),d(7,"div",5)(8,"mat-form-field",6)(9,"mat-label"),c(10,"Type"),u(),d(11,"mat-select",7),I(12,i0,6,0)(13,n0,2,0,"mat-option",8),u()()(),d(14,"div",5)(15,"mat-form-field",6)(16,"mat-label"),c(17,"Color"),u(),d(18,"mat-select",9),Ae(19,a0,2,3,"mat-option",10,Ne),u()()(),d(21,"div",11),I(22,o0,2,0,"mat-checkbox",12),u()(),d(23,"div",13)(24,"div",14)(25,"div",15),I(26,r0,3,0,"button",16),I(27,s0,3,0,"button",17),d(28,"button",18),U("click",function(){return i.deleteControl()}),d(29,"mat-icon"),c(30,"delete"),u()()()()()()),t&2&&(R("formGroup",i.ctrlFormGroup()),f(12),N(i.ctrlFormGroup().value.type!=="4"?12:13),f(7),ye(i.colors),f(3),N(i.ctrlFormGroup().value.type!=="4"?22:-1),f(4),N(i.controlIndex()!==0?26:-1),f(),N(i.controlIndex()!==i.arrayLength()-1?27:-1))},dependencies:[It,gt,rt,Mt,kt,ft,ut,si,bt,vt,At,jt,Nt,Pt,li,Yt,et,Xe],styles:['.ctrl-grid[_ngcontent-%COMP%]{display:grid;width:auto;height:auto;margin:0 0 10px;grid-template-columns:[col-start] calc(100% - 90px) [col1-end] 80px [col2-end];grid-template-areas:"controls actions";row-gap:0px;column-gap:10px;justify-items:center;align-items:center;justify-content:center;align-content:center;padding-top:20px}.controls[_ngcontent-%COMP%]{grid-area:controls;width:100%}.actions[_ngcontent-%COMP%]{grid-area:actions}.btn-grid[_ngcontent-%COMP%]{display:grid;width:80px;height:80px;margin:0;grid-template-columns:[col-start] 50% [col1-end] 50% [col2-end];grid-template-rows:[row-start] 50% [row1-end] 50% [row2-end];grid-template-areas:"up delete" "down delete";row-gap:0px;column-gap:0px;justify-items:center;align-items:center;justify-content:center;align-content:center}.up[_ngcontent-%COMP%]{grid-area:up}.down[_ngcontent-%COMP%]{grid-area:down}.delete[_ngcontent-%COMP%]{grid-area:delete}.flex-label[_ngcontent-%COMP%]{flex-grow:2;flex-shrink:2}.flex-settings[_ngcontent-%COMP%]{flex-grow:1;flex-shrink:1}.settings[_ngcontent-%COMP%]{min-width:100px}.flex-actions[_ngcontent-%COMP%]{flex-grow:0;flex-shrink:0}.flex-full-width[_ngcontent-%COMP%]{width:100%}']})}return n})();function l0(n,o){if(n&1){let e=we();d(0,"boolean-control-config",4),U("moveUp",function(i){ee(e);let a=k();return te(a.moveUp(i))})("moveDown",function(i){ee(e);let a=k();return te(a.moveDown(i))})("deleteCtrl",function(i){ee(e);let a=k();return te(a.deletePath(i))}),u()}if(n&2){let e=o.$implicit,t=o.$index,i=k();R("ctrlFormGroup",i.getFormGroup(e))("controlIndex",t)("arrayLength",i.arrayLength)}}var ju=(()=>{class n{fb=y(Gn);multiCtrlArray=x.required();zonesOnlyPaths=x.required();addPath=mt();updatePath=mt();delPath=mt();multiFormGroup=null;arrayLength=0;multiCtrlArraySubscription=null;ngOnInit(){this.arrayLength=this.multiCtrlArray().length,this.multiFormGroup=new su({multiCtrlArray:this.multiCtrlArray()}),this.multiCtrlArraySubscription=this.multiCtrlArray().valueChanges.pipe(In(350)).subscribe(e=>{this.updatePath.emit(e)})}addCtrlGroup(){let e=wi.create();this.multiCtrlArray().push(this.fb.group({ctrlLabel:[null,_t.required],type:[this.zonesOnlyPaths()?"4":"1",_t.required],pathID:[e],color:["contrast"],isNumeric:[!!this.zonesOnlyPaths()],value:[null]})),this.arrayLength=this.multiCtrlArray().length;let t={path:{description:null,path:null,pathID:e,source:"default",pathType:this.zonesOnlyPaths()?"number":"boolean",zonesOnlyPaths:this.zonesOnlyPaths(),supportsPut:!this.zonesOnlyPaths(),isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,convertUnitTo:null,sampleTime:500},ctrlType:this.zonesOnlyPaths()?4:3};this.addPath.emit(t)}moveUp(e){let t=this.multiCtrlArray().at(e);this.multiCtrlArray().removeAt(e,{emitEvent:!1}),this.multiCtrlArray().insert(e-1,t,{emitEvent:!1})}moveDown(e){let t=this.multiCtrlArray().at(e);this.multiCtrlArray().removeAt(e,{emitEvent:!1}),this.multiCtrlArray().insert(e+1,t,{emitEvent:!1})}deletePath(e){this.delPath.emit(e),this.arrayLength=this.multiCtrlArray().length}getFormGroup(e){return e}ngOnDestroy(){this.multiCtrlArraySubscription?.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["boolean-multicontrol-options"]],inputs:{multiCtrlArray:[1,"multiCtrlArray"],zonesOnlyPaths:[1,"zonesOnlyPaths"]},outputs:{addPath:"addPath",updatePath:"updatePath",delPath:"delPath"},decls:7,vars:1,consts:[[3,"formGroup"],["formArrayName","multiCtrlArray"],[1,"full-width",3,"ctrlFormGroup","controlIndex","arrayLength"],["type","button","mat-mini-fab","","color","primary","aria-label","Add control down in the list",1,"add-btn",3,"click"],[1,"full-width",3,"moveUp","moveDown","deleteCtrl","ctrlFormGroup","controlIndex","arrayLength"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1),Ae(2,l0,1,3,"boolean-control-config",2,Jt),d(4,"button",3),U("click",function(){return i.addCtrlGroup()}),d(5,"mat-icon"),c(6,"add"),u()()()()),t&2&&(R("formGroup",i.multiFormGroup),f(2),ye(i.multiCtrlArray().controls))},dependencies:[It,Mt,ft,ut,Kr,$u,ot,jr,et,Xe],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;padding-top:15px;padding-bottom:15px}.add-btn[_ngcontent-%COMP%]{margin-left:calc(50% - 20px)}"]})}return n})();function d0(n,o){if(n&1&&(d(0,"mat-option",8),c(1),u()),n&2){let e=o.$implicit;R("value",Fi(e.value)),f(),K(e.label)}}var Yu=(()=>{class n{app=y(Ii);displayName=x.required();showLabel=x.required();convertUnitTo=x.required();datasetUUID=x.required();datasetAverageArray=x.required();showAverageData=x.required();showDataPoints=x.required();trackAgainstAverage=x.required();showDatasetMinimumValueLine=x.required();showDatasetMaximumValueLine=x.required();showDatasetAverageValueLine=x.required();showDatasetAngleAverageValueLine=x.required();verticalChart=x.required();inverseYAxis=x.required();showTimeScale=x.required();showYScale=x.required();startScaleAtZero=x.required();yScaleSuggestedMin=x.required();yScaleSuggestedMax=x.required();enableMinMaxScaleLimit=x.required();yScaleMin=x.required();yScaleMax=x.required();numDecimal=x.required();color=x.required();colors=[];ngOnInit(){this.colors=this.app.configurableThemeColors,this.showAverageData()&&!this.showAverageData()?.value&&this.trackAgainstAverage().disable(),this.enableMinMaxScaleLimit()&&this.setValueScaleOptionsControls(this.enableMinMaxScaleLimit().value)}setValueScaleOptionsControls(e){e?(this.yScaleMin()?.enable(),this.yScaleMax()?.enable(),this.yScaleSuggestedMin()?.disable(),this.yScaleSuggestedMax()?.disable()):(this.yScaleMin()?.disable(),this.yScaleMax()?.disable(),this.yScaleSuggestedMin()?.enable(),this.yScaleSuggestedMax()?.enable())}setScaleControls(e){this.setValueScaleOptionsControls(e.value)}enableTrackAgainstMovingAverage(e){e.checked?this.trackAgainstAverage().enable():(this.trackAgainstAverage().setValue(e.checked),this.trackAgainstAverage().disable())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["config-display-chart-options"]],inputs:{displayName:[1,"displayName"],showLabel:[1,"showLabel"],convertUnitTo:[1,"convertUnitTo"],datasetUUID:[1,"datasetUUID"],datasetAverageArray:[1,"datasetAverageArray"],showAverageData:[1,"showAverageData"],showDataPoints:[1,"showDataPoints"],trackAgainstAverage:[1,"trackAgainstAverage"],showDatasetMinimumValueLine:[1,"showDatasetMinimumValueLine"],showDatasetMaximumValueLine:[1,"showDatasetMaximumValueLine"],showDatasetAverageValueLine:[1,"showDatasetAverageValueLine"],showDatasetAngleAverageValueLine:[1,"showDatasetAngleAverageValueLine"],verticalChart:[1,"verticalChart"],inverseYAxis:[1,"inverseYAxis"],showTimeScale:[1,"showTimeScale"],showYScale:[1,"showYScale"],startScaleAtZero:[1,"startScaleAtZero"],yScaleSuggestedMin:[1,"yScaleSuggestedMin"],yScaleSuggestedMax:[1,"yScaleSuggestedMax"],enableMinMaxScaleLimit:[1,"enableMinMaxScaleLimit"],yScaleMin:[1,"yScaleMin"],yScaleMax:[1,"yScaleMax"],numDecimal:[1,"numDecimal"],color:[1,"color"]},decls:85,vars:21,consts:[["minLine",""],[1,"tab-content"],[1,"chart-flex-container"],[1,"chart-panel-group"],[1,"full-width"],["matInput","","placeholder","Enter a label to display","name","displayName",3,"formControl"],["name","showLabel",1,"full-width",3,"formControl"],["placeholder","Select Color...","name","color","required","",3,"formControl"],[3,"value"],[1,"flex-item-rounded-card","rounded-card-color"],[2,"margin-left","10px"],["matInput","","type","number","min","0","max","5","placeholder","Enter or select number...","name","numDecimal","required","",3,"formControl"],["name","showDataPoints",1,"full-width",2,"margin-top","10px",3,"formControl"],["name","showAverageData",1,"full-width",3,"change","formControl"],["name","trackAgainstAverage",1,"full-width",2,"margin-left","25px",3,"formControl"],["name","verticalChart",3,"formControl"],[1,"no-margin"],[1,"mat-caption"],["aria-label","Select an option","name","enableMinMaxScaleLimit",1,"chart-option-radio-group",3,"formControl"],[1,"chart-option-radio-button",3,"change","value"],[1,"chart-option-radio-button-config"],[1,"chart-option-radio-button-config-form-field"],["matInput","","type","number","name","yScaleSuggestedMin",3,"formControl"],["matInput","","type","number","name","yScaleSuggestedMax",3,"formControl"],[1,"chart-option-radio-button-config-item"],["matInput","","type","number","name","yScaleMin","required","",3,"formControl"],["matInput","","type","number","name","yScaleMax","required","",3,"formControl"],["name","showYScale",1,"full-width",3,"formControl"],["name","inverseYAxis",3,"formControl"],["name","showTimeScale",1,"full-width",3,"formControl"],["name","showDatasetMaximumValueLine",1,"full-width",3,"formControl"],["name","showDatasetAverageValueLine",1,"full-width",3,"formControl"],["name","showDatasetMinimumValueLine",1,"full-width",3,"formControl"]],template:function(t,i){t&1&&(d(0,"div",1)(1,"div",2)(2,"div",3)(3,"mat-form-field",4)(4,"mat-label"),c(5,"Widget Label"),u(),W(6,"input",5),u()(),d(7,"div",3)(8,"mat-checkbox",6),c(9," Show Label "),u()()(),d(10,"div",2)(11,"mat-form-field",4)(12,"mat-label"),c(13,"Color"),u(),d(14,"mat-select",7),Ae(15,d0,2,3,"mat-option",8,Ne),u()()(),d(17,"div",2)(18,"div",9)(19,"p"),c(20,"Series"),u(),d(21,"mat-form-field",10)(22,"mat-label"),c(23,"Value Decimal Places"),u(),W(24,"input",11),u(),d(25,"mat-checkbox",12),c(26," Display Data Points "),u(),d(27,"mat-checkbox",13),U("change",function(r){return i.enableTrackAgainstMovingAverage(r)}),c(28," Display Moving Average "),u(),d(29,"mat-checkbox",14),c(30," Track Against Moving Average "),u(),d(31,"mat-checkbox",15),c(32," Vertical Data Graph "),u()(),d(33,"div",9)(34,"div")(35,"p",16),c(36,"Data Scale"),u(),d(37,"span",17),c(38,"(Default node is automatic scale)"),u(),d(39,"mat-radio-group",18)(40,"mat-radio-button",19),U("change",function(r){return i.setScaleControls(r)}),c(41,"Auto Scale"),u(),d(42,"div",20)(43,"mat-form-field",21)(44,"mat-label"),c(45,"Suggested Min"),u(),W(46,"input",22),u(),d(47,"mat-form-field",21)(48,"mat-label"),c(49,"Suggested Max"),u(),W(50,"input",23),u()(),d(51,"mat-radio-button",19),U("change",function(r){return i.setScaleControls(r)}),c(52," Fixed Scale "),u(),d(53,"div",20)(54,"div",24)(55,"mat-form-field",21)(56,"mat-label"),c(57,"Min"),u(),W(58,"input",25),u()(),d(59,"div",24)(60,"mat-form-field",21)(61,"mat-label"),c(62,"Max"),u(),W(63,"input",26),u()()()(),d(64,"mat-checkbox",27),c(65," Show Scale Ticks "),u(),d(66,"mat-checkbox",28),c(67," Inverse Scale "),u()()(),d(68,"div",9)(69,"div")(70,"p",16),c(71,"Time Scale"),u(),d(72,"mat-checkbox",29),c(73," Show Scale Ticks "),u()()(),d(74,"div",9)(75,"div")(76,"p",16),c(77,"Dataset"),u(),d(78,"mat-checkbox",30),c(79," Show Maximum Line "),u(),d(80,"mat-checkbox",31),c(81," Show Average Line "),u(),d(82,"mat-checkbox",32,0),c(84," Show Minimum Line "),u()()()()()),t&2&&(f(6),R("formControl",i.displayName()),f(2),R("formControl",i.showLabel()),f(6),R("formControl",i.color()),f(),ye(i.colors),f(9),R("formControl",i.numDecimal()),f(),R("formControl",i.showDataPoints()),f(2),R("formControl",i.showAverageData()),f(2),R("formControl",i.trackAgainstAverage()),f(2),R("formControl",i.verticalChart()),f(8),R("formControl",i.enableMinMaxScaleLimit()),f(),R("value",!1),f(6),R("formControl",i.yScaleSuggestedMin()),f(4),R("formControl",i.yScaleSuggestedMax()),f(),R("value",!0),f(7),R("formControl",i.yScaleMin()),f(5),R("formControl",i.yScaleMax()),f(),R("formControl",i.showYScale()),f(2),R("formControl",i.inverseYAxis()),f(6),R("formControl",i.showTimeScale()),f(6),R("formControl",i.showDatasetMaximumValueLine()),f(2),R("formControl",i.showDatasetAverageValueLine()),f(2),R("formControl",i.showDatasetMinimumValueLine()))},dependencies:[Jr,qt,bt,vt,li,Yt,Pi,jt,Nt,zo,$t,At,Cu,yu,xu,ft,gt,Ei,rt,kt,rn,Xa,on],styles:[".chart-flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;margin:15px 0;gap:15px;align-items:stretch}.chart-panel-group[_ngcontent-%COMP%]{min-width:250px;flex-grow:1}.no-margin[_ngcontent-%COMP%]{margin:0}.chart-option-radio-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;margin:0;align-items:flex-start}.chart-option-radio-button[_ngcontent-%COMP%]{margin:0}.chart-option-radio-button-config[_ngcontent-%COMP%]{margin-left:35px;display:flex;flex-direction:row;flex-wrap:wrap;gap:10px;align-items:flex-start}.chart-option-radio-button-config-item[_ngcontent-%COMP%]{flex-grow:0;flex-shrink:1;min-width:50px}.chart-option-radio-button-config-form-field[_ngcontent-%COMP%]{display:block;max-width:118px}"]})}return n})();var u0=["panel"],m0=["*"];function h0(n,o){if(n&1&&(E(0,"div",1,0),Fr(2),O()),n&2){let e=o.id,t=k();at(t._classList),dt("mat-mdc-autocomplete-visible",t.showPanel)("mat-mdc-autocomplete-hidden",!t.showPanel)("mat-autocomplete-panel-animations-enabled",!t._animationsDisabled)("mat-primary",t._color==="primary")("mat-accent",t._color==="accent")("mat-warn",t._color==="warn"),Wi("id",t.id),J("aria-label",t.ariaLabel||null)("aria-labelledby",t._getPanelAriaLabelledby(e))}}var Pl=class{source;option;constructor(o,e){this.source=o,this.option=e}},Zu=new gn("mat-autocomplete-default-options",{providedIn:"root",factory:()=>({autoActiveFirstOption:!1,autoSelectActiveOption:!1,hideSingleSelectionIndicator:!1,requireSelection:!1,hasBackdrop:!1})}),ho=(()=>{class n{_changeDetectorRef=y(Si);_elementRef=y(Ke);_defaults=y(Zu);_animationsDisabled=tn();_activeOptionChanges=Ba.EMPTY;_keyManager;showPanel=!1;get isOpen(){return this._isOpen&&this.showPanel}_isOpen=!1;_latestOpeningTrigger;_setColor(e){this._color=e,this._changeDetectorRef.markForCheck()}_color;template;panel;options;optionGroups;ariaLabel;ariaLabelledby;displayWith=null;autoActiveFirstOption;autoSelectActiveOption;requireSelection;panelWidth;disableRipple=!1;optionSelected=new oi;opened=new oi;closed=new oi;optionActivated=new oi;set classList(e){this._classList=e,this._elementRef.nativeElement.className=""}_classList;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._syncParentProperties()}_hideSingleSelectionIndicator;_syncParentProperties(){if(this.options)for(let e of this.options)e._changeDetectorRef.markForCheck()}id=y(fa).getId("mat-autocomplete-");inertGroups;constructor(){let e=y(kc);this.inertGroups=e?.SAFARI||!1,this.autoActiveFirstOption=!!this._defaults.autoActiveFirstOption,this.autoSelectActiveOption=!!this._defaults.autoSelectActiveOption,this.requireSelection=!!this._defaults.requireSelection,this._hideSingleSelectionIndicator=this._defaults.hideSingleSelectionIndicator??!1}ngAfterContentInit(){this._keyManager=new Nc(this.options).withWrap().skipPredicate(this._skipPredicate),this._activeOptionChanges=this._keyManager.change.subscribe(e=>{this.isOpen&&this.optionActivated.emit({source:this,option:this.options.toArray()[e]||null})}),this._setVisibility()}ngOnDestroy(){this._keyManager?.destroy(),this._activeOptionChanges.unsubscribe()}_setScrollTop(e){this.panel&&(this.panel.nativeElement.scrollTop=e)}_getScrollTop(){return this.panel?this.panel.nativeElement.scrollTop:0}_setVisibility(){this.showPanel=!!this.options?.length,this._changeDetectorRef.markForCheck()}_emitSelectEvent(e){let t=new Pl(this,e);this.optionSelected.emit(t)}_getPanelAriaLabelledby(e){if(this.ariaLabel)return null;let t=e?e+" ":"";return this.ariaLabelledby?t+this.ariaLabelledby:e}_skipPredicate(){return!1}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["mat-autocomplete"]],contentQueries:function(t,i,a){if(t&1&&Gr(a,Nt,5)(a,pu,5),t&2){let r;xi(r=Ci())&&(i.options=r),xi(r=Ci())&&(i.optionGroups=r)}},viewQuery:function(t,i){if(t&1&&Nn(gc,7)(u0,5),t&2){let a;xi(a=Ci())&&(i.template=a.first),xi(a=Ci())&&(i.panel=a.first)}},hostAttrs:[1,"mat-mdc-autocomplete"],inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],displayWith:"displayWith",autoActiveFirstOption:[2,"autoActiveFirstOption","autoActiveFirstOption",St],autoSelectActiveOption:[2,"autoSelectActiveOption","autoSelectActiveOption",St],requireSelection:[2,"requireSelection","requireSelection",St],panelWidth:"panelWidth",disableRipple:[2,"disableRipple","disableRipple",St],classList:[0,"class","classList"],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",St]},outputs:{optionSelected:"optionSelected",opened:"opened",closed:"closed",optionActivated:"optionActivated"},exportAs:["matAutocomplete"],features:[Go([{provide:hu,useExisting:n}])],ngContentSelectors:m0,decls:1,vars:0,consts:[["panel",""],["role","listbox",1,"mat-mdc-autocomplete-panel","mdc-menu-surface","mdc-menu-surface--open",3,"id"]],template:function(t,i){t&1&&(Wr(),vc(0,h0,3,17,"ng-template"))},styles:[`div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:relative;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden,.cdk-overlay-pane:has(>.mat-mdc-autocomplete-hidden){visibility:hidden;pointer-events:none}@keyframes _mat-autocomplete-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}.mat-autocomplete-panel-animations-enabled{animation:_mat-autocomplete-enter 120ms cubic-bezier(0, 0, 0.2, 1)}mat-autocomplete{display:none}
42
- `],encapsulation:2,changeDetection:0})}return n})();var p0={provide:Xr,useExisting:Pr(()=>xa),multi:!0};var g0=new gn("mat-autocomplete-scroll-strategy",{providedIn:"root",factory:()=>{let n=y(Lo);return()=>Hc(n)}}),xa=(()=>{class n{_environmentInjector=y(mc);_element=y(Ke);_injector=y(Lo);_viewContainerRef=y(Rr);_zone=y(qe);_changeDetectorRef=y(Si);_dir=y($r,{optional:!0});_formField=y(uu,{optional:!0,host:!0});_viewportRuler=y(Bc);_scrollStrategy=y(g0);_renderer=y(Or);_animationsDisabled=tn();_defaults=y(Zu,{optional:!0});_overlayRef=null;_portal;_componentDestroyed=!1;_initialized=new zt;_keydownSubscription;_outsideClickSubscription;_cleanupWindowBlur;_previousValue=null;_valueOnAttach=null;_valueOnLastKeydown=null;_positionStrategy;_manuallyFloatingLabel=!1;_closingActionsSubscription;_viewportSubscription=Ba.EMPTY;_breakpointObserver=y(qa);_handsetLandscapeSubscription=Ba.EMPTY;_canOpenOnNextFocus=!0;_valueBeforeAutoSelection;_pendingAutoselectedOption=null;_closeKeyEventStream=new zt;_overlayPanelClass=Ec(this._defaults?.overlayPanelClass||[]);_windowBlurHandler=()=>{this._canOpenOnNextFocus=this.panelOpen||!this._hasFocus()};_onChange=()=>{};_onTouched=()=>{};autocomplete;position="auto";connectedTo;autocompleteAttribute="off";autocompleteDisabled=!1;constructor(){}_aboveClass="mat-mdc-autocomplete-panel-above";ngAfterViewInit(){this._initialized.next(),this._initialized.complete(),this._cleanupWindowBlur=this._renderer.listen("window","blur",this._windowBlurHandler)}ngOnChanges(e){e.position&&this._positionStrategy&&(this._setStrategyPositions(this._positionStrategy),this.panelOpen&&this._overlayRef.updatePosition())}ngOnDestroy(){this._cleanupWindowBlur?.(),this._handsetLandscapeSubscription.unsubscribe(),this._viewportSubscription.unsubscribe(),this._componentDestroyed=!0,this._destroyPanel(),this._closeKeyEventStream.complete(),this._clearFromModal()}get panelOpen(){return this._overlayAttached&&this.autocomplete.showPanel}_overlayAttached=!1;openPanel(){this._openPanelInternal()}closePanel(){this._resetLabel(),this._overlayAttached&&(this.panelOpen&&this._zone.run(()=>{this.autocomplete.closed.emit()}),this.autocomplete._latestOpeningTrigger===this&&(this.autocomplete._isOpen=!1,this.autocomplete._latestOpeningTrigger=null),this._overlayAttached=!1,this._pendingAutoselectedOption=null,this._overlayRef&&this._overlayRef.hasAttached()&&(this._overlayRef.detach(),this._closingActionsSubscription.unsubscribe()),this._updatePanelState(),this._componentDestroyed||this._changeDetectorRef.detectChanges(),this._trackedModal&&qr(this._trackedModal,"aria-owns",this.autocomplete.id))}updatePosition(){this._overlayAttached&&this._overlayRef.updatePosition()}get panelClosingActions(){return bi(this.optionSelections,this.autocomplete._keyManager.tabOut.pipe(Ai(()=>this._overlayAttached)),this._closeKeyEventStream,this._getOutsideClickStream(),this._overlayRef?this._overlayRef.detachments().pipe(Ai(()=>this._overlayAttached)):yl()).pipe(Kt(e=>e instanceof gu?e:null))}optionSelections=nc(()=>{let e=this.autocomplete?this.autocomplete.options:null;return e?e.changes.pipe(za(e),Tr(()=>bi(...e.map(t=>t.onSelectionChange)))):this._initialized.pipe(Tr(()=>this.optionSelections))});get activeOption(){return this.autocomplete&&this.autocomplete._keyManager?this.autocomplete._keyManager.activeItem:null}_getOutsideClickStream(){return new Al(e=>{let t=a=>{let r=Mc(a),s=this._formField?this._formField.getConnectedOverlayOrigin().nativeElement:null,l=this.connectedTo?this.connectedTo.elementRef.nativeElement:null;this._overlayAttached&&r!==this._element.nativeElement&&!this._hasFocus()&&(!s||!s.contains(r))&&(!l||!l.contains(r))&&this._overlayRef&&!this._overlayRef.overlayElement.contains(r)&&e.next(a)},i=[this._renderer.listen("document","click",t),this._renderer.listen("document","auxclick",t),this._renderer.listen("document","touchend",t)];return()=>{i.forEach(a=>a())}})}writeValue(e){Promise.resolve(null).then(()=>this._assignOptionValue(e))}registerOnChange(e){this._onChange=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this._element.nativeElement.disabled=e}_handleKeydown(e){let t=e,i=t.keyCode,a=Rn(t);if(i===27&&!a&&t.preventDefault(),this._valueOnLastKeydown=this._element.nativeElement.value,this.activeOption&&i===13&&this.panelOpen&&!a)this.activeOption._selectViaInteraction(),this._resetActiveItem(),t.preventDefault();else if(this.autocomplete){let r=this.autocomplete._keyManager.activeItem,s=i===38||i===40;i===9||s&&!a&&this.panelOpen?this.autocomplete._keyManager.onKeydown(t):s&&this._canOpen()&&this._openPanelInternal(this._valueOnLastKeydown),(s||this.autocomplete._keyManager.activeItem!==r)&&(this._scrollToOption(this.autocomplete._keyManager.activeItemIndex||0),this.autocomplete.autoSelectActiveOption&&this.activeOption&&(this._pendingAutoselectedOption||(this._valueBeforeAutoSelection=this._valueOnLastKeydown),this._pendingAutoselectedOption=this.activeOption,this._assignOptionValue(this.activeOption.value)))}}_handleInput(e){let t=e.target,i=t.value;if(t.type==="number"&&(i=i==""?null:parseFloat(i)),this._previousValue!==i){if(this._previousValue=i,this._pendingAutoselectedOption=null,(!this.autocomplete||!this.autocomplete.requireSelection)&&this._onChange(i),!i)this._clearPreviousSelectedOption(null,!1);else if(this.panelOpen&&!this.autocomplete.requireSelection){let a=this.autocomplete.options?.find(r=>r.selected);if(a){let r=this._getDisplayValue(a.value);i!==r&&a.deselect(!1)}}if(this._canOpen()&&this._hasFocus()){let a=this._valueOnLastKeydown??this._element.nativeElement.value;this._valueOnLastKeydown=null,this._openPanelInternal(a)}}}_handleFocus(){this._canOpenOnNextFocus?this._canOpen()&&(this._previousValue=this._element.nativeElement.value,this._attachOverlay(this._previousValue),this._floatLabel(!0)):this._canOpenOnNextFocus=!0}_handleClick(){this._canOpen()&&!this.panelOpen&&this._openPanelInternal()}_hasFocus(){return _c()===this._element.nativeElement}_floatLabel(e=!1){this._formField&&this._formField.floatLabel==="auto"&&(e?this._formField._animateAndLockLabel():this._formField.floatLabel="always",this._manuallyFloatingLabel=!0)}_resetLabel(){this._manuallyFloatingLabel&&(this._formField&&(this._formField.floatLabel="auto"),this._manuallyFloatingLabel=!1)}_subscribeToClosingActions(){let e=new Al(i=>{pc(()=>{i.next()},{injector:this._environmentInjector})}),t=this.autocomplete.options?.changes.pipe(Er(()=>this._positionStrategy.reapplyLastPosition()),rc(0))??yl();return bi(e,t).pipe(Tr(()=>this._zone.run(()=>{let i=this.panelOpen;return this._resetActiveItem(),this._updatePanelState(),this._changeDetectorRef.detectChanges(),this.panelOpen&&this._overlayRef.updatePosition(),i!==this.panelOpen&&(this.panelOpen?this._emitOpened():this.autocomplete.closed.emit()),this.panelClosingActions})),ai(1)).subscribe(i=>this._setValueAndClose(i))}_emitOpened(){this.autocomplete.opened.emit()}_destroyPanel(){this._overlayRef&&(this.closePanel(),this._overlayRef.dispose(),this._overlayRef=null)}_getDisplayValue(e){let t=this.autocomplete;return t&&t.displayWith?t.displayWith(e):e}_assignOptionValue(e){let t=this._getDisplayValue(e);e==null&&this._clearPreviousSelectedOption(null,!1),this._updateNativeInputValue(t??"")}_updateNativeInputValue(e){this._formField?this._formField._control.value=e:this._element.nativeElement.value=e,this._previousValue=e}_setValueAndClose(e){let t=this.autocomplete,i=e?e.source:this._pendingAutoselectedOption;i?(this._clearPreviousSelectedOption(i),this._assignOptionValue(i.value),this._onChange(i.value),t._emitSelectEvent(i),this._element.nativeElement.focus()):t.requireSelection&&this._element.nativeElement.value!==this._valueOnAttach&&(this._clearPreviousSelectedOption(null),this._assignOptionValue(null),this._onChange(null)),this.closePanel()}_clearPreviousSelectedOption(e,t){this.autocomplete?.options?.forEach(i=>{i!==e&&i.selected&&i.deselect(t)})}_openPanelInternal(e=this._element.nativeElement.value){if(this._attachOverlay(e),this._floatLabel(),this._trackedModal){let t=this.autocomplete.id;Cl(this._trackedModal,"aria-owns",t)}}_attachOverlay(e){if(!this.autocomplete)return;let t=this._overlayRef;t?(this._positionStrategy.setOrigin(this._getConnectedElement()),t.updateSize({width:this._getPanelWidth()})):(this._portal=new Wc(this.autocomplete.template,this._viewContainerRef,{id:this._formField?.getLabelId()}),t=Yc(this._injector,this._getOverlayConfig()),this._overlayRef=t,this._viewportSubscription=this._viewportRuler.change().subscribe(()=>{this.panelOpen&&t&&t.updateSize({width:this._getPanelWidth()})}),this._handsetLandscapeSubscription=this._breakpointObserver.observe(Gi.HandsetLandscape).subscribe(a=>{a.matches?this._positionStrategy.withFlexibleDimensions(!0).withGrowAfterOpen(!0).withViewportMargin(8):this._positionStrategy.withFlexibleDimensions(!1).withGrowAfterOpen(!1).withViewportMargin(0)})),t&&!t.hasAttached()&&(t.attach(this._portal),this._valueOnAttach=e,this._valueOnLastKeydown=null,this._closingActionsSubscription=this._subscribeToClosingActions());let i=this.panelOpen;this.autocomplete._isOpen=this._overlayAttached=!0,this.autocomplete._latestOpeningTrigger=this,this.autocomplete._setColor(this._formField?.color),this._updatePanelState(),this._applyModalPanelOwnership(),this.panelOpen&&i!==this.panelOpen&&this._emitOpened()}_handlePanelKeydown=e=>{(e.keyCode===27&&!Rn(e)||e.keyCode===38&&Rn(e,"altKey"))&&(this._pendingAutoselectedOption&&(this._updateNativeInputValue(this._valueBeforeAutoSelection??""),this._pendingAutoselectedOption=null),this._closeKeyEventStream.next(),this._resetActiveItem(),e.stopPropagation(),e.preventDefault())};_updatePanelState(){if(this.autocomplete._setVisibility(),this.panelOpen){let e=this._overlayRef;this._keydownSubscription||(this._keydownSubscription=e.keydownEvents().subscribe(this._handlePanelKeydown)),this._outsideClickSubscription||(this._outsideClickSubscription=e.outsidePointerEvents().subscribe())}else this._keydownSubscription?.unsubscribe(),this._outsideClickSubscription?.unsubscribe(),this._keydownSubscription=this._outsideClickSubscription=void 0}_getOverlayConfig(){return new qc({positionStrategy:this._getOverlayPosition(),scrollStrategy:this._scrollStrategy(),width:this._getPanelWidth(),direction:this._dir??void 0,hasBackdrop:this._defaults?.hasBackdrop,backdropClass:this._defaults?.backdropClass||"cdk-overlay-transparent-backdrop",panelClass:this._overlayPanelClass,disableAnimations:this._animationsDisabled})}_getOverlayPosition(){let e=$c(this._injector,this._getConnectedElement()).withFlexibleDimensions(!1).withPush(!1).withPopoverLocation("inline");return this._setStrategyPositions(e),this._positionStrategy=e,e}_setStrategyPositions(e){let t=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top"},{originX:"end",originY:"bottom",overlayX:"end",overlayY:"top"}],i=this._aboveClass,a=[{originX:"start",originY:"top",overlayX:"start",overlayY:"bottom",panelClass:i},{originX:"end",originY:"top",overlayX:"end",overlayY:"bottom",panelClass:i}],r;this.position==="above"?r=a:this.position==="below"?r=t:r=[...t,...a],e.withPositions(r)}_getConnectedElement(){return this.connectedTo?this.connectedTo.elementRef:this._formField?this._formField.getConnectedOverlayOrigin():this._element}_getPanelWidth(){return this.autocomplete.panelWidth||this._getHostWidth()}_getHostWidth(){return this._getConnectedElement().nativeElement.getBoundingClientRect().width}_resetActiveItem(){let e=this.autocomplete;if(e.autoActiveFirstOption){let t=-1;for(let i=0;i<e.options.length;i++)if(!e.options.get(i).disabled){t=i;break}e._keyManager.setActiveItem(t)}else e._keyManager.setActiveItem(-1)}_canOpen(){let e=this._element.nativeElement;return!e.readOnly&&!e.disabled&&!this.autocompleteDisabled}_scrollToOption(e){let t=this.autocomplete,i=fu(e,t.options,t.optionGroups);if(e===0&&i===1)t._setScrollTop(0);else if(t.panel){let a=t.options.toArray()[e];if(a){let r=a._getHostElement(),s=vu(r.offsetTop,r.offsetHeight,t._getScrollTop(),t.panel.nativeElement.offsetHeight);t._setScrollTop(s)}}}_trackedModal=null;_applyModalPanelOwnership(){let e=this._element.nativeElement.closest('body > .cdk-overlay-container [aria-modal="true"]');if(!e)return;let t=this.autocomplete.id;this._trackedModal&&qr(this._trackedModal,"aria-owns",t),Cl(e,"aria-owns",t),this._trackedModal=e}_clearFromModal(){if(this._trackedModal){let e=this.autocomplete.id;qr(this._trackedModal,"aria-owns",e),this._trackedModal=null}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["input","matAutocomplete",""],["textarea","matAutocomplete",""]],hostAttrs:[1,"mat-mdc-autocomplete-trigger"],hostVars:7,hostBindings:function(t,i){t&1&&U("focusin",function(){return i._handleFocus()})("blur",function(){return i._onTouched()})("input",function(r){return i._handleInput(r)})("keydown",function(r){return i._handleKeydown(r)})("click",function(){return i._handleClick()}),t&2&&J("autocomplete",i.autocompleteAttribute)("role",i.autocompleteDisabled?null:"combobox")("aria-autocomplete",i.autocompleteDisabled?null:"list")("aria-activedescendant",i.panelOpen&&i.activeOption?i.activeOption.id:null)("aria-expanded",i.autocompleteDisabled?null:i.panelOpen.toString())("aria-controls",i.autocompleteDisabled||!i.panelOpen||i.autocomplete==null?null:i.autocomplete.id)("aria-haspopup",i.autocompleteDisabled?null:"listbox")},inputs:{autocomplete:[0,"matAutocomplete","autocomplete"],position:[0,"matAutocompletePosition","position"],connectedTo:[0,"matAutocompleteConnectedTo","connectedTo"],autocompleteAttribute:[0,"autocomplete","autocompleteAttribute"],autocompleteDisabled:[2,"matAutocompleteDisabled","autocompleteDisabled",St]},exportAs:["matAutocompleteTrigger"],features:[Go([p0]),Qi]})}return n})(),ms=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ki({type:n});static \u0275inj=Xi({imports:[Zc,zo,zc,zo,Vn]})}return n})();var f0=(n,o)=>o.path;function v0(n,o){if(n&1){let e=we();d(0,"button",24),U("click",function(){ee(e);let i=k();return te(i.clearPathInputField())}),d(1,"mat-icon"),c(2,"close"),u()()}}function b0(n,o){n&1&&(d(0,"mat-error"),c(1," Path is required. Please enter a valid Signal K path. "),u())}function A0(n,o){n&1&&(d(0,"mat-error"),c(1," Path not recognized. Please enter a path from the server's published list. "),u())}function y0(n,o){if(n&1&&(d(0,"span"),c(1),u(),W(2,"br"),d(3,"small",25),c(4),u()),n&2){let e=k().$implicit;f(),K(e.path),f(3),K(e.meta.description)}}function x0(n,o){if(n&1&&c(0),n&2){let e=k().$implicit;fe(" ",e.path," ")}}function C0(n,o){if(n&1&&(d(0,"mat-option",8),I(1,y0,5,2)(2,x0,1,1),u()),n&2){let e=o.$implicit;R("value",e.path),f(),N(e.meta!==void 0?1:2)}}function S0(n,o){if(n&1&&(d(0,"mat-option",12),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),fe(" ",e," ")}}function w0(n,o){if(n&1&&(d(0,"mat-option",12),c(1),u()),n&2){let e=o.$implicit;R("value",e.measure),f(),fe(" ",e.description," ")}}function _0(n,o){if(n&1&&(d(0,"mat-optgroup",14),Ae(1,w0,2,2,"mat-option",12,Ne),u()),n&2){let e=o.$implicit;R("label",e.group),f(),ye(e.units)}}function M0(n){return o=>{let e=o.parent?.value?.pathRequired!==!1,t=o.value;return e?t===null||t===""?{requireMatch:!0}:n().some(r=>r.path===t)?null:{requireMatch:!0}:t===null||t===""||n().some(r=>r.path===t)?null:{requireMatch:!0}}}var Qu=(()=>{class n{convertUnitTo=x.required();filterSelfPaths=x.required();datachartPath=x.required();datachartSource=x.required();timeScale=x.required();period=x.required();data=y(Ot);units=y(it);_destroyRef=y(ze);numericPaths=w([]);filteredNumericPaths=w([]);unitList=w({});pathSources=w([]);maxDuration=X(()=>this.timeScale().value==="day"?365:60);ngOnInit(){if(this.numericPaths.set(this.data.getPathsAndMetaByType("number",!1,!1,this.filterSelfPaths().value).sort()),this.filteredNumericPaths.set(this.numericPaths()),this.datachartPath().valueChanges.pipe(In(300),Le(this._destroyRef)).subscribe(e=>{let t=(e||"").toLowerCase().trim();t?this.filteredNumericPaths.set(this.numericPaths().filter(i=>i.path.toLowerCase().includes(t))):this.filteredNumericPaths.set(this.numericPaths())}),this.datachartPath().setValidators([M0(()=>this.getPaths())]),this.datachartPath()?.value){let e=this.data.getPathObject(this.datachartPath().value);this.setPathSources(e),this.unitList.set(this.units.getConversionsForPath(this.datachartPath().value))}this.setInitFormState()}setInitFormState(e=!1){this.datachartSource().value&&!e?this.datachartSource().enable():(this.datachartSource().reset(),this.datachartSource().disable()),this.convertUnitTo().value&&!e?this.convertUnitTo().enable():(this.convertUnitTo().reset(),this.convertUnitTo().disable()),this.timeScale().value?this.timeScale().enable():this.timeScale().disable(),this.period().value?this.period().enable():this.period().disable()}getPaths(){return this.data.getPathsAndMetaByType("number",!1,!1,this.filterSelfPaths().value).sort()}clearPathInputField(){this.datachartPath().setValue(""),this.setInitFormState(!0)}changePath(e){let t=this.data.getPathObject(e.option.value);if(t===null){this.pathSources.set([]),this.datachartSource().reset(),this.datachartSource().disable(),this.convertUnitTo().reset(),this.convertUnitTo().disable(),this.setPathUnits();return}this.setPathSources(t),this.setPathUnits(t.path)}setPathSources(e){Object.keys(e.sources).length==1?(this.pathSources.set(["default"]),this.datachartSource().setValue("default"),this.datachartSource().enable()):Object.keys(e.sources).length>1&&(this.pathSources.set(Object.keys(e.sources).sort()),this.datachartSource().value?this.datachartSource().setValue(this.datachartSource().value):this.datachartSource().reset(),this.datachartSource().enable())}setPathUnits(e){e?(this.unitList.set(this.units.getConversionsForPath(e)),this.convertUnitTo().reset(),this.convertUnitTo()?.enable()):(this.unitList.set(this.units.getConversionsForPath("")),this.convertUnitTo().reset(),this.convertUnitTo()?.disable())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["config-dataset-chart-options"]],inputs:{convertUnitTo:[1,"convertUnitTo"],filterSelfPaths:[1,"filterSelfPaths"],datachartPath:[1,"datachartPath"],datachartSource:[1,"datachartSource"],timeScale:[1,"timeScale"],period:[1,"period"]},decls:60,vars:10,consts:[["pathInput",""],["pathAutoComplete","matAutocomplete"],[1,"display-content","tab-content"],[1,"flex-container",2,"margin-top","10px"],[1,"full-width"],["type","text","matInput","","placeholder","Type to use autocomplete or select from list","required","",3,"formControl","matAutocomplete"],["mat-icon-button","","matIconSuffix","","aria-label","Clear"],[3,"optionSelected"],[2,"min-height","48px","line-height","1.15","height","auto","padding","8px 16px","white-space","normal",3,"value"],[3,"formControl"],[1,"flex-field-50"],["placeholder","Select data source","name","sourceControl","required","",3,"formControl"],[3,"value"],["placeholder","Select unit...","name","convertUnitTo","required","",3,"formControl"],[3,"label"],[2,"margin-top","10px"],["placeholder","Select dataset time scale","name","timeScaleFormat","required","",3,"formControl"],["value","day"],["value","hour"],["value","minute"],["value","second"],["matInput","","type","number","min","1","step","1","placeholder","Enter or select number...","required","",3,"max","formControl"],[2,"grid-column","1 / -1","font-size","0.9em","color","var(--mat-sys-outline)"],["routerLink","/help/history-data-charts",2,"color","var(--kip-blue-color)","cursor","pointer","text-decoration","underline"],["mat-icon-button","","matIconSuffix","","aria-label","Clear",3,"click"],[1,"pathMetaDescription"]],template:function(t,i){if(t&1&&(d(0,"div",2)(1,"div",3)(2,"mat-form-field",4)(3,"mat-label"),c(4," Signal K Path "),u(),W(5,"input",5,0),I(7,v0,3,0,"button",6),I(8,b0,2,0,"mat-error")(9,A0,2,0,"mat-error"),d(10,"mat-autocomplete",7,1),U("optionSelected",function(r){return i.changePath(r)}),Ae(12,C0,3,2,"mat-option",8,f0),u()()(),d(14,"div",3)(15,"mat-checkbox",9),c(16," Restrict to own vessel "),u()(),d(17,"div",3)(18,"div",10)(19,"mat-form-field",4)(20,"mat-label"),c(21,"Source"),u(),d(22,"mat-select",11),Ae(23,S0,2,2,"mat-option",12,Jt),u()()(),d(25,"div",10)(26,"mat-form-field",4)(27,"mat-label"),c(28,"Display Format"),u(),d(29,"mat-select",13),Ae(30,_0,3,1,"mat-optgroup",14,Ne),u()()()(),W(32,"br"),d(33,"p",15),c(34," Time scale and duration set how much history the chart shows (the chart window). Data is sampled to keep roughly 120 points across the window; very short windows may show fewer points for performance. "),u(),d(35,"div",3)(36,"div",10)(37,"mat-form-field",4)(38,"mat-label"),c(39,"Time Scale"),u(),d(40,"mat-select",16)(41,"mat-option",17),c(42,"Days"),u(),d(43,"mat-option",18),c(44,"Hours"),u(),d(45,"mat-option",19),c(46,"Minutes"),u(),d(47,"mat-option",20),c(48,"Seconds"),u()()()(),d(49,"div",10)(50,"mat-form-field",4)(51,"mat-label"),c(52,"Duration"),u(),W(53,"input",21),u()(),d(54,"div",22)(55,"strong"),c(56,"History API:"),u(),c(57," When the time scale is minutes or longer, the Data Chart can be pre-filled with historical data. "),d(58,"a",23),c(59,"Learn more"),u()()()()),t&2){let a=Rt(6),r=Rt(11);f(5),R("formControl",i.datachartPath())("matAutocomplete",r),f(2),N(a.value?7:-1),f(),N(a.validity.valueMissing?8:i.datachartPath().errors?9:-1),f(4),ye(i.filteredNumericPaths()),f(3),R("formControl",i.filterSelfPaths()),f(7),R("formControl",i.datachartSource()),f(),ye(i.pathSources()),f(6),R("formControl",i.convertUnitTo()),f(),ye(i.unitList().conversions),f(10),R("formControl",i.timeScale()),f(13),R("max",i.maxDuration())("formControl",i.period())}},dependencies:[et,Xe,ms,ho,Nt,Qa,xa,li,Yt,qt,bt,vt,Bn,zn,Pi,jt,$t,At,ot,Pt,ft,gt,Ei,rt,kt,rn,Xa,on,Zr],styles:[".display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}"]})}return n})();var Ku=(()=>{class n{transform(e){return Object.keys(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=Vr({name:"objectKeys",type:n,pure:!0})}return n})();var k0=(n,o)=>o.path;function T0(n,o){n&1&&W(0,"i",18)}function D0(n,o){n&1&&W(0,"i",19)}function E0(n,o){if(n&1&&(d(0,"mat-option",16),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),Ut("",e.properties.quantity,": ",e.properties.display)}}function P0(n,o){if(n&1){let e=we();d(0,"div",5)(1,"mat-form-field",17)(2,"mat-label"),I(3,T0,1,0,"i",18)(4,D0,1,0,"i",19),c(5," Filter"),u(),d(6,"mat-select",20,2),U("selectionChange",function(){ee(e),k();let i=Rt(11),a=k();return te(a.pathFormGroup().controls.path.setValue(i.value))}),d(8,"mat-option"),c(9,"All"),u(),Ae(10,E0,2,3,"mat-option",16,Ne),u()()()}if(n&2){let e=Rt(7),t=k(2);f(3),N(e.value?4:3),f(3),R("formControl",t.pathSkUnitsFilterControl),f(4),ye(t.pathSkUnitsFiltersList)}}function I0(n,o){n&1&&(d(0,"span",8),c(1,"(optional)"),u())}function N0(n,o){n&1&&(d(0,"mat-hint"),c(1,"Leave blank to disable this path."),u())}function O0(n,o){if(n&1){let e=we();d(0,"button",21),U("click",function(){ee(e);let i=k(2);return te(i.pathFormGroup().controls.path.setValue(""))}),d(1,"mat-icon"),c(2,"close"),u()()}}function R0(n,o){n&1&&(d(0,"mat-error"),c(1," Path is required. Please enter a valid Signal K path. "),u())}function V0(n,o){n&1&&(d(0,"mat-error"),c(1," Path not recognized. Please enter a path from the server's published list. "),u())}function L0(n,o){if(n&1&&(d(0,"span"),c(1),u(),W(2,"br"),d(3,"small",22),c(4),u()),n&2){let e=k().$implicit;f(),K(e.path),f(3),K(e.meta.description)}}function W0(n,o){if(n&1&&c(0),n&2){let e=k().$implicit;fe(" ",e.path," ")}}function F0(n,o){if(n&1&&(d(0,"mat-option",11),I(1,L0,5,2)(2,W0,1,1),u()),n&2){let e=o.$implicit;R("value",e.path),f(),N(e.meta!==void 0?1:2)}}function G0(n,o){if(n&1&&(d(0,"mat-option",16),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),fe(" ",e," ")}}function B0(n,o){if(n&1&&(d(0,"mat-option",16),c(1),u()),n&2){let e=o.$implicit;R("value",e.measure),f(),fe(" ",e.description," ")}}function z0(n,o){if(n&1&&(d(0,"mat-optgroup",28),Ae(1,B0,2,2,"mat-option",16,Ne),u()),n&2){let e=o.$implicit;R("label",e.group),f(),ye(e.units)}}function U0(n,o){if(n&1&&(d(0,"mat-form-field",26)(1,"mat-label"),c(2,"Display Format"),u(),d(3,"mat-select",27),Ae(4,z0,3,1,"mat-optgroup",28,Ne),u()()),n&2){let e=k(3);f(4),ye(e.unitList.conversions)}}function H0(n,o){if(n&1&&(d(0,"div",23)(1,"mat-form-field",14)(2,"mat-label"),c(3,"Sample Time"),u(),W(4,"input",24),u()(),d(5,"div",25),I(6,U0,6,0,"mat-form-field",26),u()),n&2){let e=k(2);f(6),N(e.pathFormGroup().value.pathType==="number"&&e.pathFormGroup().value.showConvertUnitTo===void 0||e.pathFormGroup().value.pathType==="number"&&e.pathFormGroup().value.showConvertUnitTo===!0?6:-1)}}function q0(n,o){if(n&1&&(d(0,"div",3)(1,"div",4)(2,"span"),c(3),u()(),I(4,P0,12,2,"div",5),d(5,"div",6)(6,"mat-form-field",7)(7,"mat-label"),c(8," Signal K Path "),I(9,I0,2,0,"span",8),u(),W(10,"input",9,0),I(12,N0,2,0,"mat-hint"),I(13,O0,3,0,"button",10),I(14,R0,2,0,"mat-error")(15,V0,2,0,"mat-error"),d(16,"mat-autocomplete",null,1),Ae(18,F0,3,2,"mat-option",11,k0),ct(20,"async"),u()()(),d(21,"div",12)(22,"div",13)(23,"mat-form-field",14)(24,"mat-label"),c(25,"Data Source"),u(),d(26,"mat-select",15),Ae(27,G0,2,2,"mat-option",16,Ne),u()()(),I(29,H0,7,1),u()()),n&2){let e,t=Rt(17),i=k();R("formGroup",i.pathFormGroup()),f(2),xe("color",i.pathFormGroup().enabled?"":"rgba(255,255,255,0.5)"),f(),K(i.pathFormGroup().value.description),f(),N(i.pathFormGroup().value.pathType==="number"&&i.showPathSkUnitsFilter?4:-1),f(5),N(i.pathFormGroup().value.pathRequired===!1?9:-1),f(),R("matAutocomplete",t),f(2),N(i.pathFormGroup().value.pathRequired===!1?12:-1),f(),N(i.pathFormGroup().value.path?13:-1),f(),N((e=i.pathFormGroup().controls.path.errors)!=null&&e.required?14:(e=i.pathFormGroup().controls.path.errors)!=null&&e.requireMatch?15:-1),f(4),ye(Et(20,11,i.filteredPaths)),f(9),ye(i.availableSources),f(2),N(i.pathFormGroup().value.zonesOnlyPaths?-1:29)}}function $0(n){return o=>{let e=o.parent?.value?.pathRequired!==!1,t=o.value;return e?t===null||t===""?{requireMatch:!0}:n().some(r=>r.path===t)?null:{requireMatch:!0}:t===null||t===""||n().some(r=>r.path===t)?null:{requireMatch:!0}}}var Ju=(()=>{class n{_data=y(Ot);_units=y(it);_connection=y(Yr);_destroyRef=y(ze);pathFormGroup=x.required();multiCTRLArray=x.required();filterSelfPaths=x.required();availablePaths;filteredPaths=new Zi(null);availableSources;unitList={base:"",conversions:[]};showPathSkUnitsFilter=!1;pathSkUnitsFilterControl=new lu(null);pathSkUnitsFiltersList;unitlessUnit={unit:"unitless",properties:{display:"(null)",quantity:"Unitless",quantityDisplay:"(null)",description:""}};ngOnInit(){let e=this.pathFormGroup();e.controls.path.disabled||(this.pathSkUnitsFiltersList=this._units.skBaseUnits.sort((t,i)=>t.properties.quantity>i.properties.quantity?1:-1),this.pathSkUnitsFiltersList.unshift(this.unitlessUnit),e.value.pathSkUnitsFilter&&this.pathSkUnitsFilterControl.setValue(this.pathSkUnitsFiltersList.find(t=>t.unit===this.pathFormGroup().value.pathSkUnitsFilter),{onlySelf:!0}),e.value.showPathSkUnitsFilter&&(this.showPathSkUnitsFilter=e.value.showPathSkUnitsFilter),e.controls.path.setValidators([$0(()=>this.getPaths())]),e.controls.path.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),e.controls.pathRequired&&e.controls.pathRequired.valueChanges.pipe(Le(this._destroyRef)).subscribe(()=>{this.pathFormGroup().controls.path.updateValueAndValidity()}),e.controls.path.valid?this.enableFormFields(!1):this.disablePathFields(),e.controls.sampleTime||(e.addControl("sampleTime",new tt("500",_t.required)),e.controls.sampleTime.updateValueAndValidity({onlySelf:!0,emitEvent:!1})),e.controls.path.valueChanges.pipe(ac(t=>t===""?ma(0):ma(350)),za(""),Kt(t=>this.filterPaths(t||""))).pipe(Le(this._destroyRef)).subscribe(()=>{let t=this.pathFormGroup();t.controls.path.pristine||(t.controls.path.valid?(this.enableFormFields(!0),this.updatePathMetaBoundDisplayName(t.controls.path.value),this.updatePathMetaBoundDisplayScale(t.controls.path.value)):this.disablePathFields())}),e.controls.pathType.valueChanges.pipe(Le(this._destroyRef)).subscribe(()=>{let t=this.pathFormGroup();t.value.showPathSkUnitsFilter?this.pathSkUnitsFilterControl.setValue(this.unitlessUnit):this.pathSkUnitsFilterControl.setValue(null),t.controls.path.updateValueAndValidity()}))}ngOnChanges(e){e.filterSelfPaths&&!e.filterSelfPaths.firstChange&&this.pathFormGroup().controls.path.updateValueAndValidity()}getPaths(){let e=this.pathFormGroup().controls.pathType.value,t=this.filterSelfPaths(),i=!1,a=this.pathFormGroup();if(a.value.supportsPut){let s=!1;this.multiCTRLArray().length>0&&(s=this.multiCTRLArray().some(l=>l.pathID===this.pathFormGroup().value.pathID&&l.type==="3")),s?i=!1:i=Qc(this._connection.skServerVersion,"2.12.0",">=")?a.value.supportsPut:!1}let r=a.value.zonesOnlyPaths??!1;return this._data.getPathsAndMetaByType(e,i,r,t).sort()}filterPaths(e){let t=e.toLowerCase(),i=this.getPaths();if(this.pathSkUnitsFilterControl.value){let a=this.pathSkUnitsFilterControl.value.unit;i=i.filter(r=>{let s=!!r.meta&&!!r.meta.units,l=a==="unitless";return s&&r.meta.units===a||!s&&l})}i=i.filter(a=>a.path.toLowerCase().includes(t)),this.filteredPaths.next(i)}enableFormFields(e){let t=this._data.getPathObject(this.pathFormGroup().controls.path.value);if(t!=null){this.pathFormGroup().controls.sampleTime.enable({onlySelf:!1});let i=this.pathFormGroup();i.controls.pathType.value=="number"&&(this.unitList=this._units.getConversionsForPath(i.controls.path.value),e&&i.controls.convertUnitTo.setValue(this.unitList.base,{onlySelf:!0}),i.controls.convertUnitTo.enable({onlySelf:!1})),Object.keys(t.sources).length==1?(this.availableSources=["default"],e?i.controls.source.value!="default"&&i.controls.source.setValue("default",{onlySelf:!0}):i.controls.source.value!="default"&&i.controls.source.setValue("",{onlySelf:!0})):Object.keys(t.sources).length>1&&(this.availableSources=Object.keys(t.sources),i.controls.source.value=="default"&&i.controls.source.reset()),i.controls.source.enable({onlySelf:!1})}else this.disablePathFields()}disablePathFields(){this.pathFormGroup().controls.source.reset("",{onlySelf:!0}),this.pathFormGroup().controls.source.disable({onlySelf:!1}),this.pathFormGroup().controls.sampleTime.disable({onlySelf:!1});let e=this.pathFormGroup();e.controls.pathType.value=="number"&&(e.controls.convertUnitTo.reset("",{onlySelf:!0}),e.controls.convertUnitTo.disable({onlySelf:!1}))}updatePathMetaBoundDisplayName(e){let t=this.pathFormGroup();if(!Object.prototype.hasOwnProperty.call(t.parent.parent.value,"displayName"))return;let i=this._data.getPathMeta(e);i?.displayName&&t.parent.parent.controls.displayName.setValue(i.displayName)}updatePathMetaBoundDisplayScale(e){let t=this.pathFormGroup();if(!Object.prototype.hasOwnProperty.call(t.parent.parent.value,"displayScale"))return;let i=this._data.getPathMeta(e);if(i?.displayScale){let a=t.parent.parent.get("displayScale"),r=t.controls.convertUnitTo.value;i.displayScale.lower!==null&&i.displayScale.lower!==void 0&&a.controls.lower.setValue(this._units.convertToUnit(r,i.displayScale.lower)),i.displayScale.upper!==null&&i.displayScale.upper!==void 0&&a.controls.upper.setValue(this._units.convertToUnit(r,i.displayScale.upper)),i.displayScale.type!==null&&i.displayScale.type!==void 0&&a.controls.type.setValue(i.displayScale.type),i.displayScale.power!==null&&i.displayScale.power!==void 0&&a.controls.power.setValue(i.displayScale.power)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["path-control-config"]],inputs:{pathFormGroup:[1,"pathFormGroup"],multiCTRLArray:[1,"multiCTRLArray"],filterSelfPaths:[1,"filterSelfPaths"]},features:[Qi],decls:1,vars:1,consts:[["pathInput",""],["pathAutoComplete","matAutocomplete"],["pathUnitsFilter",""],[1,"flex-container","rounded-card","rounded-card-color",3,"formGroup"],[1,"flex-field-100"],[1,"flex-field-fixed"],[1,"flex-field-to-100"],["floatLabel","auto","appearance","fill",1,"pathField"],[1,"optional-label"],["type","text","matInput","","placeholder","Type to use autocomplete or select from list","formControlName","path",3,"matAutocomplete"],["mat-icon-button","","matIconSuffix","","aria-label","Clear"],[2,"min-height","48px","line-height","1.15","height","auto","padding","8px 16px","white-space","normal",3,"value"],[1,"pathProperties"],[1,"sourceField"],["appearance","outline","floatLabel","always",1,"fields"],["placeholder","Select source","formControlName","source","required",""],[3,"value"],["floatLabel","auto","appearance","fill",1,"filter-path"],[1,"fa-solid","fa-filter"],[1,"fa-solid","fa-filter-circle-xmark"],["panelWidth","",3,"selectionChange","formControl"],["mat-icon-button","","matIconSuffix","","aria-label","Clear",3,"click"],[1,"pathMetaDescription"],[1,"sampleTimeField"],["matInput","","type","number","placeholder","Sample time in milliseconds","formControlName","sampleTime","required",""],[1,"unitField"],[1,"fields"],["placeholder","Select unit","formControlName","convertUnitTo","required",""],[3,"label"]],template:function(t,i){t&1&&I(0,q0,30,13,"div",3),t&2&&N(i.pathFormGroup().value.isPathConfigurable?0:-1)},dependencies:[It,gt,Ei,rt,Mt,kt,ft,on,ut,si,bt,vt,At,ms,ho,Nt,Qa,xa,Pt,zn,Bn,jt,et,Xe,cu,zr],styles:[".pathGroup[_ngcontent-%COMP%]{width:100%}.pathGroupFields[_ngcontent-%COMP%]{display:block;width:calc(100% - 5px)}.pathField[_ngcontent-%COMP%]{width:100%}.pathProperties[_ngcontent-%COMP%]{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center;align-content:flex-start;gap:10px}.fields[_ngcontent-%COMP%]{width:100%}.sourceField[_ngcontent-%COMP%]{flex:3 1}.sampleTimeField[_ngcontent-%COMP%]{flex:1 3}.unitField[_ngcontent-%COMP%]{flex:3 1}"]})}return n})();function j0(n,o){if(n&1&&W(0,"path-control-config",6),n&2){let e=o.$implicit,t=k(2);R("pathFormGroup",e)("filterSelfPaths",t.filterSelfPaths().value)("multiCTRLArray",t.multiCTRLArray)}}function Y0(n,o){if(n&1&&Ae(0,j0,1,3,"path-control-config",6,Ne),n&2){let e=k();ye(e.pathsFormGroup.controls)}}function Z0(n,o){if(n&1&&W(0,"path-control-config",6),n&2){let e=o.$implicit,t=k(2);R("pathFormGroup",t.pathsFormGroup.get(e))("filterSelfPaths",t.filterSelfPaths().value)("multiCTRLArray",t.multiCTRLArray)}}function X0(n,o){if(n&1&&(Ae(0,Z0,1,3,"path-control-config",6,Ne),ct(2,"objectKeys")),n&2){let e=k();ye(Et(2,0,e.pathsFormGroup.controls))}}var em=(()=>{class n{rootFormGroup=y(ut);fb=y(Gn);formGroupName=x.required();isArray=x.required();enableTimeout=x.required();dataTimeout=x.required();filterSelfPaths=x.required();addPathEvent=x(void 0);delPathEvent=x(void 0);updatePathEvent=x(void 0);pathsFormGroup;multiCTRLArray=[];ngOnInit(){this.isArray()?(this.pathsFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls").value):this.pathsFormGroup=this.rootFormGroup.control.get(this.formGroupName())}addPath(e){this.pathsFormGroup.push(this.fb.group({description:[e.path.description],path:[e.path.path,_t.required],pathID:[e.path.pathID],source:[e.path.source,_t.required],pathType:[e.path.pathType],zonesOnlyPaths:[e.path.zonesOnlyPaths??!1],isPathConfigurable:[e.path.isPathConfigurable],showPathSkUnitsFilter:[e.path.showPathSkUnitsFilter],pathSkUnitsFilter:[e.path.pathSkUnitsFilter],convertUnitTo:[e.path.convertUnitTo],sampleTime:[e.path.sampleTime],supportsPut:[e.path.supportsPut]})),this.pathsFormGroup.updateValueAndValidity(),this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls").value}delPath(){this.multiCTRLArray=this.rootFormGroup.control.get("multiChildCtrls").value}updatePath(e){this.multiCTRLArray=e}ngOnChanges(e){e.addPathEvent&&!e.addPathEvent.firstChange&&this.addPath(e.addPathEvent.currentValue),e.delPathEvent&&!e.delPathEvent.firstChange&&this.delPath(),e.updatePathEvent&&!e.updatePathEvent.firstChange&&this.updatePath(e.updatePathEvent.currentValue)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["paths-options"]],inputs:{formGroupName:[1,"formGroupName"],isArray:[1,"isArray"],enableTimeout:[1,"enableTimeout"],dataTimeout:[1,"dataTimeout"],filterSelfPaths:[1,"filterSelfPaths"],addPathEvent:[1,"addPathEvent"],delPathEvent:[1,"delPathEvent"],updatePathEvent:[1,"updatePathEvent"]},features:[Qi],decls:14,vars:5,consts:[[1,"widget-options-grid"],["name","enableTimeout",3,"formControl"],["type","number","matNativeControl","","placeholder","Time in seconds...","name","dataTimeout","min","2","required","",3,"formControl"],["matTextSuffix",""],[3,"formGroup"],["name","filterSelfPaths",3,"formControl"],[2,"display","block",3,"pathFormGroup","filterSelfPaths","multiCTRLArray"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"mat-checkbox",1),c(2," Enable Widget Data TTL "),u(),d(3,"mat-form-field")(4,"mat-label"),c(5,"TTL Timeout For Paths"),u(),W(6,"input",2),d(7,"span",3),c(8,"Seconds"),u()()(),Ji(9,4),I(10,Y0,2,0)(11,X0,3,2),en(),d(12,"mat-checkbox",5),c(13,` Restrict to own vessel
43
- `),u()),t&2&&(f(),R("formControl",i.enableTimeout()),f(5),R("formControl",i.dataTimeout()),f(3),R("formGroup",i.pathsFormGroup),f(),N(i.isArray()?10:11),f(2),R("formControl",i.filterSelfPaths()))},dependencies:[Yt,It,gt,Ei,rt,Mt,kt,rn,ft,on,ut,bt,vt,At,zn,Ju,Ku],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:5px}"]})}return n})();function Q0(n,o){if(n&1){let e=we();d(0,"button",7),U("click",function(){ee(e);let i=k();return te(i.dateTimezone().setValue(""))}),W(1,"span",8),u()}}function K0(n,o){if(n&1&&(d(0,"mat-option",6),c(1),u()),n&2){let e=o.$implicit;R("value",e.label),f(),Ut(" ",e.offset," - ",e.label," ")}}function J0(n){return o=>n.some(t=>t.label===o.value)?null:{requireMatch:!0}}var ev=()=>{let n=Intl.supportedValuesOf("timeZone"),o=new Date;return n.map(e=>({offset:new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(o).find(r=>r.type==="timeZoneName")?.value||"",label:e}))},tm=(()=>{class n{_destroyRef=y(ze);dateFormat=x(void 0);dateTimezone=x(void 0);tz=[];filteredTZ;filteredTZSubscription=null;constructor(){}ngOnInit(){typeof Intl.supportedValuesOf<"u"?this.tz=ev().sort((e,t)=>this.compareOffsets(e.offset,t.offset)):(console.log("[Widget Options] Feature not supported. Using static Time Zone list"),this.tz=[{offset:"GMT",label:"Africa/Abidjan"},{offset:"GMT",label:"Africa/Accra"},{offset:"GMT+3",label:"Africa/Addis_Ababa"},{offset:"GMT+1",label:"Africa/Algiers"},{offset:"GMT+3",label:"Africa/Asmera"},{offset:"GMT",label:"Africa/Bamako"},{offset:"GMT+1",label:"Africa/Bangui"},{offset:"GMT",label:"Africa/Banjul"},{offset:"GMT",label:"Africa/Bissau"},{offset:"GMT+2",label:"Africa/Blantyre"},{offset:"GMT+1",label:"Africa/Brazzaville"},{offset:"GMT+2",label:"Africa/Bujumbura"},{offset:"GMT+2",label:"Africa/Cairo"},{offset:"GMT",label:"Africa/Casablanca"},{offset:"GMT+2",label:"Africa/Ceuta"},{offset:"GMT",label:"Africa/Conakry"},{offset:"GMT",label:"Africa/Dakar"},{offset:"GMT+3",label:"Africa/Dar_es_Salaam"},{offset:"GMT+3",label:"Africa/Djibouti"},{offset:"GMT+1",label:"Africa/Douala"},{offset:"GMT",label:"Africa/El_Aaiun"},{offset:"GMT",label:"Africa/Freetown"},{offset:"GMT+2",label:"Africa/Gaborone"},{offset:"GMT+2",label:"Africa/Harare"},{offset:"GMT+2",label:"Africa/Johannesburg"},{offset:"GMT+2",label:"Africa/Juba"},{offset:"GMT+3",label:"Africa/Kampala"},{offset:"GMT+2",label:"Africa/Khartoum"},{offset:"GMT+2",label:"Africa/Kigali"},{offset:"GMT+1",label:"Africa/Kinshasa"},{offset:"GMT+1",label:"Africa/Lagos"},{offset:"GMT+1",label:"Africa/Libreville"},{offset:"GMT",label:"Africa/Lome"},{offset:"GMT+1",label:"Africa/Luanda"},{offset:"GMT+2",label:"Africa/Lubumbashi"},{offset:"GMT+2",label:"Africa/Lusaka"},{offset:"GMT+1",label:"Africa/Malabo"},{offset:"GMT+2",label:"Africa/Maputo"},{offset:"GMT+2",label:"Africa/Maseru"},{offset:"GMT+2",label:"Africa/Mbabane"},{offset:"GMT+3",label:"Africa/Mogadishu"},{offset:"GMT",label:"Africa/Monrovia"},{offset:"GMT+3",label:"Africa/Nairobi"},{offset:"GMT+1",label:"Africa/Ndjamena"},{offset:"GMT+1",label:"Africa/Niamey"},{offset:"GMT",label:"Africa/Nouakchott"},{offset:"GMT",label:"Africa/Ouagadougou"},{offset:"GMT+1",label:"Africa/Porto-Novo"},{offset:"GMT",label:"Africa/Sao_Tome"},{offset:"GMT+2",label:"Africa/Tripoli"},{offset:"GMT+1",label:"Africa/Tunis"},{offset:"GMT+2",label:"Africa/Windhoek"},{offset:"GMT-9",label:"America/Adak"},{offset:"GMT-8",label:"America/Anchorage"},{offset:"GMT-4",label:"America/Anguilla"},{offset:"GMT-4",label:"America/Antigua"},{offset:"GMT-3",label:"America/Araguaina"},{offset:"GMT-3",label:"America/Argentina/La_Rioja"},{offset:"GMT-3",label:"America/Argentina/Rio_Gallegos"},{offset:"GMT-3",label:"America/Argentina/Salta"},{offset:"GMT-3",label:"America/Argentina/San_Juan"},{offset:"GMT-3",label:"America/Argentina/San_Luis"},{offset:"GMT-3",label:"America/Argentina/Tucuman"},{offset:"GMT-3",label:"America/Argentina/Ushuaia"},{offset:"GMT-4",label:"America/Aruba"},{offset:"GMT-3",label:"America/Asuncion"},{offset:"GMT-3",label:"America/Bahia"},{offset:"GMT-6",label:"America/Bahia_Banderas"},{offset:"GMT-4",label:"America/Barbados"},{offset:"GMT-3",label:"America/Belem"},{offset:"GMT-6",label:"America/Belize"},{offset:"GMT-4",label:"America/Blanc-Sablon"},{offset:"GMT-4",label:"America/Boa_Vista"},{offset:"GMT-5",label:"America/Bogota"},{offset:"GMT-6",label:"America/Boise"},{offset:"GMT-3",label:"America/Buenos_Aires"},{offset:"GMT-6",label:"America/Cambridge_Bay"},{offset:"GMT-4",label:"America/Campo_Grande"},{offset:"GMT-5",label:"America/Cancun"},{offset:"GMT-4",label:"America/Caracas"},{offset:"GMT-3",label:"America/Catamarca"},{offset:"GMT-3",label:"America/Cayenne"},{offset:"GMT-5",label:"America/Cayman"},{offset:"GMT-5",label:"America/Chicago"},{offset:"GMT-6",label:"America/Chihuahua"},{offset:"GMT-6",label:"America/Ciudad_Juarez"},{offset:"GMT-5",label:"America/Coral_Harbour"},{offset:"GMT-3",label:"America/Cordoba"},{offset:"GMT-6",label:"America/Costa_Rica"},{offset:"GMT-7",label:"America/Creston"},{offset:"GMT-4",label:"America/Cuiaba"},{offset:"GMT-4",label:"America/Curacao"},{offset:"GMT",label:"America/Danmarkshavn"},{offset:"GMT-7",label:"America/Dawson"},{offset:"GMT-7",label:"America/Dawson_Creek"},{offset:"GMT-6",label:"America/Denver"},{offset:"GMT-4",label:"America/Detroit"},{offset:"GMT-4",label:"America/Dominica"},{offset:"GMT-6",label:"America/Edmonton"},{offset:"GMT-5",label:"America/Eirunepe"},{offset:"GMT-6",label:"America/El_Salvador"},{offset:"GMT-7",label:"America/Fort_Nelson"},{offset:"GMT-3",label:"America/Fortaleza"},{offset:"GMT-3",label:"America/Glace_Bay"},{offset:"GMT-1",label:"America/Godthab"},{offset:"GMT-3",label:"America/Goose_Bay"},{offset:"GMT-4",label:"America/Grand_Turk"},{offset:"GMT-4",label:"America/Grenada"},{offset:"GMT-4",label:"America/Guadeloupe"},{offset:"GMT-6",label:"America/Guatemala"},{offset:"GMT-5",label:"America/Guayaquil"},{offset:"GMT-4",label:"America/Guyana"},{offset:"GMT-3",label:"America/Halifax"},{offset:"GMT-4",label:"America/Havana"},{offset:"GMT-7",label:"America/Hermosillo"},{offset:"GMT-5",label:"America/Indiana/Knox"},{offset:"GMT-4",label:"America/Indiana/Marengo"},{offset:"GMT-4",label:"America/Indiana/Petersburg"},{offset:"GMT-5",label:"America/Indiana/Tell_City"},{offset:"GMT-4",label:"America/Indiana/Vevay"},{offset:"GMT-4",label:"America/Indiana/Vincennes"},{offset:"GMT-4",label:"America/Indiana/Winamac"},{offset:"GMT-4",label:"America/Indianapolis"},{offset:"GMT-6",label:"America/Inuvik"},{offset:"GMT-4",label:"America/Iqaluit"},{offset:"GMT-5",label:"America/Jamaica"},{offset:"GMT-3",label:"America/Jujuy"},{offset:"GMT-8",label:"America/Juneau"},{offset:"GMT-4",label:"America/Kentucky/Monticello"},{offset:"GMT-4",label:"America/Kralendijk"},{offset:"GMT-4",label:"America/La_Paz"},{offset:"GMT-5",label:"America/Lima"},{offset:"GMT-7",label:"America/Los_Angeles"},{offset:"GMT-4",label:"America/Louisville"},{offset:"GMT-4",label:"America/Lower_Princes"},{offset:"GMT-3",label:"America/Maceio"},{offset:"GMT-6",label:"America/Managua"},{offset:"GMT-4",label:"America/Manaus"},{offset:"GMT-4",label:"America/Marigot"},{offset:"GMT-4",label:"America/Martinique"},{offset:"GMT-5",label:"America/Matamoros"},{offset:"GMT-7",label:"America/Mazatlan"},{offset:"GMT-3",label:"America/Mendoza"},{offset:"GMT-5",label:"America/Menominee"},{offset:"GMT-6",label:"America/Merida"},{offset:"GMT-8",label:"America/Metlakatla"},{offset:"GMT-6",label:"America/Mexico_City"},{offset:"GMT-2",label:"America/Miquelon"},{offset:"GMT-3",label:"America/Moncton"},{offset:"GMT-6",label:"America/Monterrey"},{offset:"GMT-3",label:"America/Montevideo"},{offset:"GMT-4",label:"America/Montserrat"},{offset:"GMT-4",label:"America/Nassau"},{offset:"GMT-4",label:"America/New_York"},{offset:"GMT-8",label:"America/Nome"},{offset:"GMT-2",label:"America/Noronha"},{offset:"GMT-5",label:"America/North_Dakota/Beulah"},{offset:"GMT-5",label:"America/North_Dakota/Center"},{offset:"GMT-5",label:"America/North_Dakota/New_Salem"},{offset:"GMT-5",label:"America/Ojinaga"},{offset:"GMT-5",label:"America/Panama"},{offset:"GMT-3",label:"America/Paramaribo"},{offset:"GMT-7",label:"America/Phoenix"},{offset:"GMT-4",label:"America/Port-au-Prince"},{offset:"GMT-4",label:"America/Port_of_Spain"},{offset:"GMT-4",label:"America/Porto_Velho"},{offset:"GMT-4",label:"America/Puerto_Rico"},{offset:"GMT-3",label:"America/Punta_Arenas"},{offset:"GMT-5",label:"America/Rankin_Inlet"},{offset:"GMT-3",label:"America/Recife"},{offset:"GMT-6",label:"America/Regina"},{offset:"GMT-5",label:"America/Resolute"},{offset:"GMT-5",label:"America/Rio_Branco"},{offset:"GMT-3",label:"America/Santarem"},{offset:"GMT-3",label:"America/Santiago"},{offset:"GMT-4",label:"America/Santo_Domingo"},{offset:"GMT-3",label:"America/Sao_Paulo"},{offset:"GMT-1",label:"America/Scoresbysund"},{offset:"GMT-8",label:"America/Sitka"},{offset:"GMT-4",label:"America/St_Barthelemy"},{offset:"GMT-2:30",label:"America/St_Johns"},{offset:"GMT-4",label:"America/St_Kitts"},{offset:"GMT-4",label:"America/St_Lucia"},{offset:"GMT-4",label:"America/St_Thomas"},{offset:"GMT-4",label:"America/St_Vincent"},{offset:"GMT-6",label:"America/Swift_Current"},{offset:"GMT-6",label:"America/Tegucigalpa"},{offset:"GMT-3",label:"America/Thule"},{offset:"GMT-7",label:"America/Tijuana"},{offset:"GMT-4",label:"America/Toronto"},{offset:"GMT-4",label:"America/Tortola"},{offset:"GMT-7",label:"America/Vancouver"},{offset:"GMT-7",label:"America/Whitehorse"},{offset:"GMT-5",label:"America/Winnipeg"},{offset:"GMT-8",label:"America/Yakutat"},{offset:"GMT+8",label:"Antarctica/Casey"},{offset:"GMT+7",label:"Antarctica/Davis"},{offset:"GMT+10",label:"Antarctica/DumontDUrville"},{offset:"GMT+11",label:"Antarctica/Macquarie"},{offset:"GMT+5",label:"Antarctica/Mawson"},{offset:"GMT+13",label:"Antarctica/McMurdo"},{offset:"GMT-3",label:"Antarctica/Palmer"},{offset:"GMT-3",label:"Antarctica/Rothera"},{offset:"GMT+3",label:"Antarctica/Syowa"},{offset:"GMT+2",label:"Antarctica/Troll"},{offset:"GMT+5",label:"Antarctica/Vostok"},{offset:"GMT+2",label:"Arctic/Longyearbyen"},{offset:"GMT+3",label:"Asia/Aden"},{offset:"GMT+5",label:"Asia/Almaty"},{offset:"GMT+3",label:"Asia/Amman"},{offset:"GMT+12",label:"Asia/Anadyr"},{offset:"GMT+5",label:"Asia/Aqtau"},{offset:"GMT+5",label:"Asia/Aqtobe"},{offset:"GMT+5",label:"Asia/Ashgabat"},{offset:"GMT+5",label:"Asia/Atyrau"},{offset:"GMT+3",label:"Asia/Baghdad"},{offset:"GMT+3",label:"Asia/Bahrain"},{offset:"GMT+4",label:"Asia/Baku"},{offset:"GMT+7",label:"Asia/Bangkok"},{offset:"GMT+7",label:"Asia/Barnaul"},{offset:"GMT+3",label:"Asia/Beirut"},{offset:"GMT+6",label:"Asia/Bishkek"},{offset:"GMT+8",label:"Asia/Brunei"},{offset:"GMT+5:30",label:"Asia/Calcutta"},{offset:"GMT+9",label:"Asia/Chita"},{offset:"GMT+5:30",label:"Asia/Colombo"},{offset:"GMT+3",label:"Asia/Damascus"},{offset:"GMT+6",label:"Asia/Dhaka"},{offset:"GMT+9",label:"Asia/Dili"},{offset:"GMT+4",label:"Asia/Dubai"},{offset:"GMT+5",label:"Asia/Dushanbe"},{offset:"GMT+3",label:"Asia/Famagusta"},{offset:"GMT+2",label:"Asia/Gaza"},{offset:"GMT+2",label:"Asia/Hebron"},{offset:"GMT+8",label:"Asia/Hong_Kong"},{offset:"GMT+7",label:"Asia/Hovd"},{offset:"GMT+8",label:"Asia/Irkutsk"},{offset:"GMT+7",label:"Asia/Jakarta"},{offset:"GMT+9",label:"Asia/Jayapura"},{offset:"GMT+3",label:"Asia/Jerusalem"},{offset:"GMT+4:30",label:"Asia/Kabul"},{offset:"GMT+12",label:"Asia/Kamchatka"},{offset:"GMT+5",label:"Asia/Karachi"},{offset:"GMT+5:45",label:"Asia/Katmandu"},{offset:"GMT+9",label:"Asia/Khandyga"},{offset:"GMT+7",label:"Asia/Krasnoyarsk"},{offset:"GMT+8",label:"Asia/Kuala_Lumpur"},{offset:"GMT+8",label:"Asia/Kuching"},{offset:"GMT+3",label:"Asia/Kuwait"},{offset:"GMT+8",label:"Asia/Macau"},{offset:"GMT+11",label:"Asia/Magadan"},{offset:"GMT+8",label:"Asia/Makassar"},{offset:"GMT+8",label:"Asia/Manila"},{offset:"GMT+4",label:"Asia/Muscat"},{offset:"GMT+3",label:"Asia/Nicosia"},{offset:"GMT+7",label:"Asia/Novokuznetsk"},{offset:"GMT+7",label:"Asia/Novosibirsk"},{offset:"GMT+6",label:"Asia/Omsk"},{offset:"GMT+5",label:"Asia/Oral"},{offset:"GMT+7",label:"Asia/Phnom_Penh"},{offset:"GMT+7",label:"Asia/Pontianak"},{offset:"GMT+9",label:"Asia/Pyongyang"},{offset:"GMT+3",label:"Asia/Qatar"},{offset:"GMT+5",label:"Asia/Qostanay"},{offset:"GMT+5",label:"Asia/Qyzylorda"},{offset:"GMT+6:30",label:"Asia/Rangoon"},{offset:"GMT+3",label:"Asia/Riyadh"},{offset:"GMT+7",label:"Asia/Saigon"},{offset:"GMT+11",label:"Asia/Sakhalin"},{offset:"GMT+5",label:"Asia/Samarkand"},{offset:"GMT+9",label:"Asia/Seoul"},{offset:"GMT+8",label:"Asia/Shanghai"},{offset:"GMT+8",label:"Asia/Singapore"},{offset:"GMT+11",label:"Asia/Srednekolymsk"},{offset:"GMT+8",label:"Asia/Taipei"},{offset:"GMT+5",label:"Asia/Tashkent"},{offset:"GMT+4",label:"Asia/Tbilisi"},{offset:"GMT+3:30",label:"Asia/Tehran"},{offset:"GMT+6",label:"Asia/Thimphu"},{offset:"GMT+9",label:"Asia/Tokyo"},{offset:"GMT+7",label:"Asia/Tomsk"},{offset:"GMT+8",label:"Asia/Ulaanbaatar"},{offset:"GMT+6",label:"Asia/Urumqi"},{offset:"GMT+10",label:"Asia/Ust-Nera"},{offset:"GMT+7",label:"Asia/Vientiane"},{offset:"GMT+10",label:"Asia/Vladivostok"},{offset:"GMT+9",label:"Asia/Yakutsk"},{offset:"GMT+5",label:"Asia/Yekaterinburg"},{offset:"GMT+4",label:"Asia/Yerevan"},{offset:"GMT",label:"Atlantic/Azores"},{offset:"GMT-3",label:"Atlantic/Bermuda"},{offset:"GMT+1",label:"Atlantic/Canary"},{offset:"GMT-1",label:"Atlantic/Cape_Verde"},{offset:"GMT+1",label:"Atlantic/Faeroe"},{offset:"GMT+1",label:"Atlantic/Madeira"},{offset:"GMT",label:"Atlantic/Reykjavik"},{offset:"GMT-2",label:"Atlantic/South_Georgia"},{offset:"GMT",label:"Atlantic/St_Helena"},{offset:"GMT-3",label:"Atlantic/Stanley"},{offset:"GMT+10:30",label:"Australia/Adelaide"},{offset:"GMT+10",label:"Australia/Brisbane"},{offset:"GMT+10:30",label:"Australia/Broken_Hill"},{offset:"GMT+9:30",label:"Australia/Darwin"},{offset:"GMT+8:45",label:"Australia/Eucla"},{offset:"GMT+11",label:"Australia/Hobart"},{offset:"GMT+10",label:"Australia/Lindeman"},{offset:"GMT+11",label:"Australia/Lord_Howe"},{offset:"GMT+11",label:"Australia/Melbourne"},{offset:"GMT+8",label:"Australia/Perth"},{offset:"GMT+11",label:"Australia/Sydney"},{offset:"GMT+2",label:"Europe/Amsterdam"},{offset:"GMT+2",label:"Europe/Andorra"},{offset:"GMT+4",label:"Europe/Astrakhan"},{offset:"GMT+3",label:"Europe/Athens"},{offset:"GMT+2",label:"Europe/Belgrade"},{offset:"GMT+2",label:"Europe/Berlin"},{offset:"GMT+2",label:"Europe/Bratislava"},{offset:"GMT+2",label:"Europe/Brussels"},{offset:"GMT+3",label:"Europe/Bucharest"},{offset:"GMT+2",label:"Europe/Budapest"},{offset:"GMT+2",label:"Europe/Busingen"},{offset:"GMT+3",label:"Europe/Chisinau"},{offset:"GMT+2",label:"Europe/Copenhagen"},{offset:"GMT+1",label:"Europe/Dublin"},{offset:"GMT+2",label:"Europe/Gibraltar"},{offset:"GMT+1",label:"Europe/Guernsey"},{offset:"GMT+3",label:"Europe/Helsinki"},{offset:"GMT+1",label:"Europe/Isle_of_Man"},{offset:"GMT+3",label:"Europe/Istanbul"},{offset:"GMT+1",label:"Europe/Jersey"},{offset:"GMT+2",label:"Europe/Kaliningrad"},{offset:"GMT+3",label:"Europe/Kiev"},{offset:"GMT+3",label:"Europe/Kirov"},{offset:"GMT+1",label:"Europe/Lisbon"},{offset:"GMT+2",label:"Europe/Ljubljana"},{offset:"GMT+1",label:"Europe/London"},{offset:"GMT+2",label:"Europe/Luxembourg"},{offset:"GMT+2",label:"Europe/Madrid"},{offset:"GMT+2",label:"Europe/Malta"},{offset:"GMT+3",label:"Europe/Mariehamn"},{offset:"GMT+3",label:"Europe/Minsk"},{offset:"GMT+2",label:"Europe/Monaco"},{offset:"GMT+3",label:"Europe/Moscow"},{offset:"GMT+2",label:"Europe/Oslo"},{offset:"GMT+2",label:"Europe/Paris"},{offset:"GMT+2",label:"Europe/Podgorica"},{offset:"GMT+2",label:"Europe/Prague"},{offset:"GMT+3",label:"Europe/Riga"},{offset:"GMT+2",label:"Europe/Rome"},{offset:"GMT+4",label:"Europe/Samara"},{offset:"GMT+2",label:"Europe/San_Marino"},{offset:"GMT+2",label:"Europe/Sarajevo"},{offset:"GMT+4",label:"Europe/Saratov"},{offset:"GMT+3",label:"Europe/Simferopol"},{offset:"GMT+2",label:"Europe/Skopje"},{offset:"GMT+3",label:"Europe/Sofia"},{offset:"GMT+2",label:"Europe/Stockholm"},{offset:"GMT+3",label:"Europe/Tallinn"},{offset:"GMT+2",label:"Europe/Tirane"},{offset:"GMT+4",label:"Europe/Ulyanovsk"},{offset:"GMT+2",label:"Europe/Vaduz"},{offset:"GMT+2",label:"Europe/Vatican"},{offset:"GMT+2",label:"Europe/Vienna"},{offset:"GMT+3",label:"Europe/Vilnius"},{offset:"GMT+3",label:"Europe/Volgograd"},{offset:"GMT+2",label:"Europe/Warsaw"},{offset:"GMT+2",label:"Europe/Zagreb"},{offset:"GMT+2",label:"Europe/Zurich"},{offset:"GMT+3",label:"Indian/Antananarivo"},{offset:"GMT+6",label:"Indian/Chagos"},{offset:"GMT+7",label:"Indian/Christmas"},{offset:"GMT+6:30",label:"Indian/Cocos"},{offset:"GMT+3",label:"Indian/Comoro"},{offset:"GMT+5",label:"Indian/Kerguelen"},{offset:"GMT+4",label:"Indian/Mahe"},{offset:"GMT+5",label:"Indian/Maldives"},{offset:"GMT+4",label:"Indian/Mauritius"},{offset:"GMT+3",label:"Indian/Mayotte"},{offset:"GMT+4",label:"Indian/Reunion"},{offset:"GMT+13",label:"Pacific/Apia"},{offset:"GMT+13",label:"Pacific/Auckland"},{offset:"GMT+11",label:"Pacific/Bougainville"},{offset:"GMT+13:45",label:"Pacific/Chatham"},{offset:"GMT-5",label:"Pacific/Easter"},{offset:"GMT+11",label:"Pacific/Efate"},{offset:"GMT+13",label:"Pacific/Enderbury"},{offset:"GMT+13",label:"Pacific/Fakaofo"},{offset:"GMT+12",label:"Pacific/Fiji"},{offset:"GMT+12",label:"Pacific/Funafuti"},{offset:"GMT-6",label:"Pacific/Galapagos"},{offset:"GMT-9",label:"Pacific/Gambier"},{offset:"GMT+11",label:"Pacific/Guadalcanal"},{offset:"GMT+10",label:"Pacific/Guam"},{offset:"GMT-10",label:"Pacific/Honolulu"},{offset:"GMT+14",label:"Pacific/Kiritimati"},{offset:"GMT+11",label:"Pacific/Kosrae"},{offset:"GMT+12",label:"Pacific/Kwajalein"},{offset:"GMT+12",label:"Pacific/Majuro"},{offset:"GMT-9:30",label:"Pacific/Marquesas"},{offset:"GMT-11",label:"Pacific/Midway"},{offset:"GMT+12",label:"Pacific/Nauru"},{offset:"GMT-11",label:"Pacific/Niue"},{offset:"GMT+12",label:"Pacific/Norfolk"},{offset:"GMT+11",label:"Pacific/Noumea"},{offset:"GMT-11",label:"Pacific/Pago_Pago"},{offset:"GMT+9",label:"Pacific/Palau"},{offset:"GMT-8",label:"Pacific/Pitcairn"},{offset:"GMT+11",label:"Pacific/Ponape"},{offset:"GMT+10",label:"Pacific/Port_Moresby"},{offset:"GMT-10",label:"Pacific/Rarotonga"},{offset:"GMT+10",label:"Pacific/Saipan"},{offset:"GMT-10",label:"Pacific/Tahiti"},{offset:"GMT+12",label:"Pacific/Tarawa"},{offset:"GMT+13",label:"Pacific/Tongatapu"},{offset:"GMT+10",label:"Pacific/Truk"},{offset:"GMT+12",label:"Pacific/Wake"},{offset:"GMT+12",label:"Pacific/Wallis"}].sort((e,t)=>this.compareOffsets(e.offset,t.offset))),this.tz.unshift({offset:"",label:"System Timezone -"}),this.dateTimezone().setValidators([_t.required,J0(this.tz)]),this.filteredTZ=this.dateTimezone().valueChanges.pipe(In(500),za(""),Kt(e=>this.filterTZ(e||""))),this.filteredTZSubscription=this.filteredTZ.pipe(Le(this._destroyRef)).subscribe()}filterTZ(e){let t=e.toLowerCase();return this.tz.filter(i=>i.label.toLowerCase().includes(t))}compareOffsets(e,t){let i=a=>{let r=a.match(/([+-]?)(\d+)(?::(\d+))?/);if(!r)return 0;let s=r[1]==="-"?-1:1,l=parseInt(r[2],10),m=r[3]?parseInt(r[3],10):0;return s*(l*60+m)};return i(e)-i(t)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["display-datetime-options"]],inputs:{dateFormat:[1,"dateFormat"],dateTimezone:[1,"dateTimezone"]},decls:15,vars:6,consts:[["timeZoneAutoComplete","matAutocomplete"],[1,"widget-options-grid"],[1,"options-grid-span2"],["matInput","","placeholder","dd/MM/yyyy HH:mm:ss","name","dateFormat","required","",3,"formControl"],["type","text","matInput","","placeholder","Type to use autocomplete","name","dateTimezone","required","",3,"formControl","matAutocomplete"],["mat-icon-button","","matSuffix","","aria-label","Clear"],[3,"value"],["mat-icon-button","","matSuffix","","aria-label","Clear",3,"click"],[1,"fa-solid","fa-close"]],template:function(t,i){if(t&1&&(d(0,"div",1)(1,"mat-form-field",2)(2,"mat-label"),c(3,"Date & Time Format"),u(),W(4,"input",3),u(),d(5,"mat-form-field",2)(6,"mat-label"),c(7,"Adjust Value to Time Zone"),u(),W(8,"input",4),I(9,Q0,2,0,"button",5),d(10,"mat-autocomplete",null,0),Ae(12,K0,2,3,"mat-option",6,Jt),ct(14,"async"),u()()()),t&2){let a=Rt(11);f(4),R("formControl",i.dateFormat()),f(4),R("formControl",i.dateTimezone())("matAutocomplete",a),f(),N(i.dateTimezone().value?9:-1),f(3),ye(Et(14,4,i.filteredTZ))}},dependencies:[bt,vt,At,It,gt,rt,kt,ft,on,xa,Pt,zn,ho,Nt,zr],encapsulation:2})}return n})();function tv(n,o){if(n&1&&(d(0,"mat-option",6),c(1),ct(2,"titlecase"),u()),n&2){let e=o.$implicit;R("value",Fi(e)),f(),K(Et(2,3,e))}}var Ol={V1_PLUGIN:"autopilot",V2_BASE:"/signalk/v2/api",V2_AUTOPILOTS:"/signalk/v2/api/vessels/self/autopilots",V2_DEFAULT_AUTOPILOT_ID:"/signalk/v2/api/vessels/self/autopilots/_providers/_default"},im={options:{modes:[],states:[]},state:null,mode:"off-line",target:null,engaged:!1},nm=(()=>{class n{formGroupName=x.required();_pluginConfig=y(es);_destroyRef=y(ze);http=y($a);rootFormGroup=y(ut);autopilotFormGroup;apiVersion=w(null);availableAutopilots=w({});autopilotPlugin=w(null);discoveryInProgress=w(!1);apiDetectionError=w(null);apInstances=X(()=>{let e=this.availableAutopilots();return e?Object.keys(e):[]});modes=w(null);pluginId=w(null);currentRequests=new Set;constructor(){L(()=>{this.autopilotFormGroup.get("apiVersion")?.setValue(this.apiVersion(),{emitEvent:!1})})}ngOnInit(){this.autopilotFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.modes.set(this.autopilotFormGroup.value.modes||null),this.detectAutopilotApi()}detectAutopilotApi(){return Re(this,null,function*(){this.discoveryInProgress.set(!0),console.log("[Autopilot Options] Starting API detection...");try{if(yield this.checkV2Api())if(this.apiVersion.set("v2"),this.autopilotFormGroup.get("apiVersion")?.setValue("v2",{emitEvent:!1}),this.availableAutopilots()&&Object.keys(this.availableAutopilots()).length>0){this.pluginId.set(Object.values(this.availableAutopilots())[0]?.provider??null),this.autopilotFormGroup.get("pluginId")?.setValue(this.pluginId(),{emitEvent:!1}),this.discoveryInProgress.set(!1);return}else console.warn("[Autopilot Options] No V2 autopilot provider found")}catch(e){console.error("[Autopilot Options] Error checking V2 API, checking V1...",e)}try{let e=yield this._pluginConfig.getPlugin(Ol.V1_PLUGIN);if(e.ok&&e.data.state.enabled){this.apiVersion.set("v1"),this.autopilotFormGroup.get("apiVersion")?.setValue("v1",{emitEvent:!1}),this.availableAutopilots.set({"Default Autopilot":{provider:"Signal K Autopilot",isDefault:!0}}),this.pluginId.set("Signal K Autopilot"),this.autopilotFormGroup.get("pluginId")?.setValue("Signal K Autopilot",{emitEvent:!1}),console.log("[Autopilot Options] V1 API Signal K Autopilot plugin detected"),this.discoveryInProgress.set(!1);return}console.log("[Autopilot Options] V1 API plugin (signalk-autopilot) not found")}catch(e){console.error("[Autopilot Options] V1 plugin detection failed:",e)}console.warn("[Autopilot Options] No Autopilot detected"),this.discoveryInProgress.set(!1)})}checkV2Api(){return Re(this,null,function*(){try{let e=yield Pn(this.makeHttpRequest(this.http.get(Ol.V2_AUTOPILOTS,{observe:"response",responseType:"json"})));return e&&e.body&&Object.keys(e.body).length>0?(this.availableAutopilots.set(e.body),console.log("[Autopilot Options] Discovered V2 API autopilot providers:",JSON.stringify(e.body))):(this.availableAutopilots.set({}),console.warn("[Autopilot Options] No V2 autopilot provider plugin found.")),e?.status===200}catch(e){if(e&&typeof e=="object"&&"status"in e){let t=e;t.status===404?console.log("[Autopilot Options] V2 API endpoint not found (404)"):t.status>=500?console.warn("[Autopilot Options] V2 API server error:",t.status,t.statusText):console.log("[Autopilot Options] V2 API call to discover Autopilot Providers failed:",t.status,t.statusText)}else console.log("[Autopilot Options] V2 API network error:",e);return!1}})}discoverV2AutopilotOptions(e){return Re(this,null,function*(){let t;try{try{this.discoveryInProgress.set(!0),t=yield Pn(this.makeHttpRequest(this.http.get(`${Ol.V2_AUTOPILOTS}/${e}`))),console.log("[Autopilot Options] V2 Autopilot Options response:",JSON.stringify(t))}catch(i){t=im,console.log(`[Autopilot Options] Default AP discovery endpoint error for instance '${e}'`)}return this.discoveryInProgress.set(!1),t}catch(i){return console.error("[Autopilot Options] Failed to discover V2 endpoints:",i),console.log(`[Autopilot Options] Using fallback V2 endpoints for instance '${e}'`),im}})}onAutopilotInstanceIdChange(e){let t=e.value;if(e.value===""){this.modes.set(""),this.autopilotFormGroup.get("modes")?.setValue("",{emitEvent:!1});return}console.log("[Autopilot Options] Selected Autopilot Instance ID:",t),this.apiVersion()==="v2"?this.discoverV2AutopilotOptions(t).then(i=>{let a=i.options.modes||[];this.modes.set(a.join(", ")),this.autopilotFormGroup.get("modes")?.setValue(a,{emitEvent:!1}),console.log("[Autopilot Options] Autopilot plugin supported modes :",a.join(", "))}).catch(i=>{console.error("[Autopilot Options] Error requesting autopilot modes:",i),this.autopilotFormGroup.get("modes")?.setValue([],{emitEvent:!1})}):this.apiVersion()==="v1"&&(this.modes.set("standby, auto, wind, route"),this.autopilotFormGroup.get("modes")?.setValue("standby, auto, wind, route",{emitEvent:!1}),console.log("[Autopilot Options] Autopilot mode set to Raymarine v1 API modes: standby, auto, wind, route"))}makeHttpRequest(e){let t=e.pipe(Le(this._destroyRef));return this.currentRequests.add(t),t.pipe(_r(()=>this.currentRequests.delete(t)))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["select-autopilot"]],inputs:{formGroupName:[1,"formGroupName"]},decls:30,vars:4,consts:[[1,"display-content","tab-content"],[1,"autopilot-options",3,"formGroup"],[1,"flex-item-rounded-card","rounded-card-color",2,"margin-block","10px"],[2,"margin-block-start","0px"],["placeholder","Select autopilot...","formControlName","instanceId","name","instanceId","required","",3,"selectionChange"],["value",""],[3,"value"],[1,"flex-item-rounded-card","rounded-card-color",2,"margin-block","10px","margin-left","10px","margin-right","10px"],["name","headingDirectionTrue","formControlName","headingDirectionTrue"],["name","invertRudder","formControlName","invertRudder"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),c(4,"Signal K Service Discovery"),u(),d(5,"ul")(6,"li")(7,"b"),c(8,"API Version:"),u(),c(9),u(),d(10,"li")(11,"b"),c(12,"Plugin:"),u(),c(13),u()()(),d(14,"mat-form-field")(15,"mat-label"),c(16,"Target Autopilot"),u(),d(17,"mat-select",4),U("selectionChange",function(r){return i.onAutopilotInstanceIdChange(r)}),d(18,"mat-option",5),c(19,"No autopilot"),u(),Ae(20,tv,3,5,"mat-option",6,Ne),u()(),d(22,"div",7)(23,"b"),c(24,"Supported modes:"),u(),c(25),u(),d(26,"mat-checkbox",8),c(27," Display True Heading "),u(),d(28,"mat-checkbox",9),c(29," Invert Rudder Angle Indicator "),u()()()),t&2&&(f(),R("formGroup",i.autopilotFormGroup),f(8),fe(" ",i.apiVersion()),f(4),fe(" ",i.pluginId()),f(7),ye(i.apInstances()),f(5),fe(" ",i.modes()," "))},dependencies:[ft,rt,Mt,kt,ut,si,qt,bt,vt,li,Yt,Pi,jt,Nt,$t,On],styles:[".autopilot-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px}"]})}return n})();var hs=(()=>{class n{data=y(Ot);destroyRef=y(ze);allPaths=new Set;registrations=new Map;constructor(){this.seedFromDataCache(),this.data.observePathUpdates().pipe(Le(this.destroyRef)).subscribe(e=>this.applyPathUpdate(e)),this.data.isResetService().pipe(Le(this.destroyRef)).subscribe(()=>this.reset())}seedFromDataCache(){for(let e of this.data.getCachedPaths())this.addPath(e)}register(e){this.assertHasCriteria(e);let t=this.createToken(e.id),i=this.compileCriteria(e),a=new Set;for(let r of this.allPaths)this.matchesCriteria(r,i)&&a.add(r);return this.registrations.set(t,{criteria:i,matches:a,changes$:new zt}),t}unregister(e){let t=this.registrations.get(e);t&&(t.changes$.complete(),this.registrations.delete(e))}changes(e){return this.registrations.get(e)?.changes$.asObservable()??Kd}activePaths(e){return this.registrations.get(e)?.matches??new Set}match(e){this.assertHasCriteria(e);let t=this.compileCriteria(e);return Array.from(this.allPaths).filter(i=>this.matchesCriteria(i,t))}applyPathUpdate(e){let t=e?.fullPath;t&&(e.kind==="data"&&e.update?.value===null||this.addPath(t))}addPath(e){if(!this.allPaths.has(e)){this.allPaths.add(e);for(let t of this.registrations.values())this.matchesCriteria(e,t.criteria)&&(t.matches.add(e),t.changes$.next({type:"add",path:e}))}}removePath(e){if(this.allPaths.delete(e))for(let t of this.registrations.values())t.matches.delete(e)&&t.changes$.next({type:"remove",path:e})}reset(){for(let e of this.registrations.values()){for(let t of e.matches)e.changes$.next({type:"remove",path:t});e.matches.clear()}this.allPaths.clear()}compileCriteria(e){let t=e.patterns?.length?e.patterns:[];return ge(ne({},e),{patterns:t,compiled:{patterns:t.map(i=>this.globToRegex(i)),contextTypes:e.contextTypes??[],prefixGuards:e.pathPrefixes??[],suffixGuards:e.pathSuffixes??[]}})}matchesCriteria(e,t){let i=t.compiled,a=this.getContextType(e);if(i.contextTypes.length&&(!a||!i.contextTypes.includes(a)))return!1;let r=this.getPathPart(e,a);return i.prefixGuards.length&&!i.prefixGuards.some(s=>r.startsWith(s))||i.suffixGuards.length&&!this.matchesSuffix(r,i.suffixGuards)?!1:i.patterns.length?i.patterns.some(s=>s.test(e)):!0}getPathPart(e,t){if(t==="self"){let a=e.indexOf(".");return a===-1?e:e.slice(a+1)}if(t==="vessels"||t==="atons"){let a=`${t}.urn:mrn:imo:mmsi:`;if(!e.startsWith(a))return e;let r=e.indexOf(".",a.length);return r===-1?"":e.slice(r+1)}let i=e.indexOf(".");return i===-1?e:e.slice(i+1)}getContextType(e){return e.startsWith("self.")?"self":e.startsWith("vessels.urn:mrn:imo:mmsi:")?"vessels":e.startsWith("atons.urn:mrn:imo:mmsi:")?"atons":null}globToRegex(e){let i="^"+e.replace(/[-/\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";return new RegExp(i)}matchesSuffix(e,t){if(!t.length)return!0;let i=e.lastIndexOf("."),a=i===-1?`.${e}`:e.slice(i);return t.some(r=>e.endsWith(r)||a===r)}createToken(e){let t=e??"token",i=`${t}-${Math.random().toString(36).slice(2,10)}`;for(;this.registrations.has(i);)i=`${t}-${Math.random().toString(36).slice(2,10)}`;return i}assertHasCriteria(e){let t=Array.isArray(e.patterns)&&e.patterns.length>0,i=Array.isArray(e.contextTypes)&&e.contextTypes.length>0,a=Array.isArray(e.pathPrefixes)&&e.pathPrefixes.length>0,r=Array.isArray(e.pathSuffixes)&&e.pathSuffixes.length>0;if(!t&&!i&&!a&&!r)throw new Error("PathDiscoveryService.register requires at least one criteria (pattern or guard).")}ngOnDestroy(){for(let e of this.registrations.values())e.changes$.complete();this.registrations.clear(),this.allPaths.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function iv(n,o){if(n&1&&(d(0,"mat-option",4),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),K(e)}}function nv(n,o){n&1&&(d(0,"div",5),c(1,"No banks configured yet."),u())}function av(n,o){if(n&1&&(d(0,"mat-option",4),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),K(e)}}function ov(n,o){if(n&1&&(d(0,"mat-option",4),c(1),ct(2,"titlecase"),u()),n&2){let e=o.$implicit;R("value",e),f(),K(Et(2,2,e))}}function rv(n,o){if(n&1){let e=we();d(0,"div",9)(1,"div",10)(2,"mat-form-field",11)(3,"mat-label"),c(4,"Bank Name"),u(),W(5,"input",12),u(),d(6,"button",13),U("click",function(){let i=ee(e).$index,a=k();return te(a.removeBank(i))}),d(7,"mat-icon"),c(8,"delete"),u()()(),d(9,"mat-form-field",2)(10,"mat-label"),c(11,"Battery Members"),u(),d(12,"mat-select",14),Ae(13,av,2,2,"mat-option",4,Ne),u()(),d(15,"mat-form-field",2)(16,"mat-label"),c(17,"Connection Mode"),u(),d(18,"mat-select",15),Ae(19,ov,3,4,"mat-option",4,Jt),u()()()}if(n&2){let e=o.$index,t=k();R("formGroupName",e),f(13),ye(t.discoveredBatteryIds()),f(6),ye(t.connectionModes)}}var am=(()=>{class n{connectionModes=["parallel","series"];formGroupName=x.required();rootFormGroup=y(ut);discovery=y(hs);destroyRef=y(ze);bmsFormGroup;banksFormArray;trackedBatteryIdsControl;discoveredBatteryIds=w([]);hasBanks=X(()=>this.banksFormArray?.length>0);discoveryToken;ngOnInit(){this.bmsFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.bmsFormGroup&&(this.ensureTrackedControl(),this.ensureBanksArray(),this.initializeDiscovery())}addBank(){let e={id:`bank-${Date.now()}`,name:"New Bank",batteryIds:[],connectionMode:"parallel"};this.banksFormArray.push(this.createBankGroup(e)),this.banksFormArray.markAsDirty()}removeBank(e){this.banksFormArray.removeAt(e),this.banksFormArray.markAsDirty()}ngOnDestroy(){this.discoveryToken&&this.discovery.unregister(this.discoveryToken)}ensureTrackedControl(){let e=this.bmsFormGroup.get("trackedBatteryIds");if(e instanceof tt){this.trackedBatteryIdsControl=e;return}this.trackedBatteryIdsControl=new tt([]),this.bmsFormGroup.addControl("trackedBatteryIds",this.trackedBatteryIdsControl)}ensureBanksArray(){let e=this.bmsFormGroup.get("banks");if(e instanceof du||e instanceof Sl){this.banksFormArray=e;return}let t=Array.isArray(e?.value)?e.value:[];this.banksFormArray=new Sl(t.map(i=>this.createBankGroup(i))),this.bmsFormGroup.setControl("banks",this.banksFormArray)}createBankGroup(e){return new Wn({id:new tt(e.id,_t.required),name:new tt(e.name,_t.required),batteryIds:new tt(e.batteryIds??[]),connectionMode:new tt(e.connectionMode??"parallel",_t.required)})}initializeDiscovery(){this.discoveryToken=this.discovery.register({id:"bms-batteries",patterns:["self.electrical.batteries.*"],contextTypes:["self"],pathPrefixes:["electrical.batteries."]}),this.updateDiscoveredBatteryIds(),this.discovery.changes(this.discoveryToken).pipe(Le(this.destroyRef)).subscribe(()=>this.updateDiscoveredBatteryIds())}updateDiscoveredBatteryIds(){if(!this.discoveryToken)return;let e=Array.from(this.discovery.activePaths(this.discoveryToken)).map(t=>this.extractBatteryId(t)).filter(t=>!!t);this.discoveredBatteryIds.set([...new Set(e)].sort())}extractBatteryId(e){let t=e.match(/self\.electrical\.batteries\.([^.]+)\./);return t?t[1]:null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["bms-bank-setup"]],inputs:{formGroupName:[1,"formGroupName"]},decls:23,vars:2,consts:[[1,"bms-config",3,"formGroup"],[1,"bms-config-section"],["appearance","outline",1,"full-width"],["formControlName","trackedBatteryIds","multiple",""],[3,"value"],[1,"hint"],[1,"section-header"],["mat-raised-button","","color","primary","type","button",3,"click"],["formArrayName","banks",1,"bank-list"],[1,"bank-card",3,"formGroupName"],[1,"bank-row"],["appearance","outline",1,"bank-name"],["matInput","","formControlName","name"],["mat-icon-button","","type","button","aria-label","Remove bank",3,"click"],["formControlName","batteryIds","multiple",""],["formControlName","connectionMode"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Tracked Batteries"),u(),d(4,"mat-form-field",2)(5,"mat-label"),c(6,"Battery Instances"),u(),d(7,"mat-select",3),Ae(8,iv,2,2,"mat-option",4,Ne),u()(),d(10,"div",5),c(11," Leave empty to display all discovered batteries. "),u()(),W(12,"mat-divider"),d(13,"div",1)(14,"div",6)(15,"h3"),c(16,"Battery Banks"),u(),d(17,"button",7),U("click",function(){return i.addBank()}),c(18," Add Bank "),u()(),d(19,"div",8),I(20,nv,2,0,"div",5),Ae(21,rv,21,1,"div",9,Ne),u()()()),t&2&&(R("formGroup",i.bmsFormGroup),f(8),ye(i.discoveredBatteryIds()),f(12),N(i.hasBanks()?-1:20),f(),ye(i.banksFormArray.controls))},dependencies:[ft,gt,rt,Mt,ut,si,Za,Kr,qt,bt,vt,$t,At,Pi,jt,Nt,ot,wt,Pt,et,Xe,ln,sn,On],styles:["[_nghost-%COMP%]{display:block;width:100%}.bms-config[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:12px 4px}.bms-config-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.section-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.full-width[_ngcontent-%COMP%]{width:100%}.bank-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.bank-card[_ngcontent-%COMP%]{border:1px solid var(--kip-widget-card-border-color);border-radius:12px;padding:12px;background:var(--kip-contrast-dimmer-color);display:flex;flex-direction:column;gap:10px}.bank-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px}.bank-name[_ngcontent-%COMP%]{flex:1}.hint[_ngcontent-%COMP%]{font-size:12px;opacity:.7}"]})}return n})();var om={fill:"#b1b1b1",stroke:"#50505f"},sv=24,lv=1.6,dv="#e6e6e6",cv=.15,uv=1,mv=1,Vl=15e3,fs=25e3,hv=.9,pv=1.25;function rm(n){let o=n.baseSizePx??sv,e=n.unconfirmedFill??dv,t=n.unconfirmedOpacity??cv,i=n.targetState==="confirmed",a=i?gv(n.collisionRiskRating):"none",r=o,s,l,m,g,v,A,C;return i||(s=e,m=t,g=t),i&&n.isStationary&&(m=0),n.targetKind==="moving"&&a!=="none"?(A=a==="high"?"red":"yellow",C=hv,{fill:s,stroke:l,auraColor:A,auraOpacity:C,fillOpacity:m,strokeOpacity:g,strokeWidth:v,sizePx:Math.round(o*pv)}):{fill:s,stroke:l,auraColor:A,auraOpacity:C,fillOpacity:m,strokeOpacity:g,strokeWidth:v,sizePx:r}}function sm(n,o){let e=vv(n,o),t=fv(n,o.sizePx),i=o.auraColor?xv(t):t;return Sv(i,yv(e))}function Ll(n){return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(n).replace(/%0A/g,"").replace(/%0D/g,"")}`}function gv(n){return typeof n!="number"||!Number.isFinite(n)?"none":n<Vl?"high":n<fs?"low":"none"}function fv(n,o){let e=`${o}px`;return/<svg[^>]*\bwidth=/.test(n)?n=n.replace(/\bwidth="[^"]*"/i,`width="${e}"`):n=n.replace(/<svg\b/i,`<svg width="${e}"`),/<svg[^>]*\bheight=/.test(n)?n=n.replace(/\bheight="[^"]*"/i,`height="${e}"`):n=n.replace(/<svg\b/i,`<svg height="${e}"`),n}function vv(n,o){let e=bv(n);return{fill:Xn(o.fill,e.fill,om.fill),stroke:Xn(o.stroke,e.stroke,om.stroke),strokeDasharray:Xn(o.strokeStyle,e.strokeStyle,"solid"),auraColor:Xn(o.auraColor,e.auraColor,"transparent"),auraOpacity:Xn(o.auraOpacity,e.auraOpacity,0),strokeWidth:Xn(o.strokeWidth,e.strokeWidth,lv),fillOpacity:Xn(o.fillOpacity,e.fillOpacity,uv),strokeOpacity:Xn(o.strokeOpacity,e.strokeOpacity,mv)}}function bv(n){return{fill:Yo(n,"--icon-fill"),stroke:Yo(n,"--icon-stroke"),strokeStyle:Yo(n,"--icon-stroke-dasharray"),auraColor:Yo(n,"--icon-aura-color"),auraOpacity:gs(n,"--icon-aura-opacity"),strokeWidth:gs(n,"--icon-stroke-width"),fillOpacity:gs(n,"--icon-fill-opacity"),strokeOpacity:gs(n,"--icon-stroke-opacity")}}function Yo(n,o){let e=n.match(new RegExp(`${Av(o)}:\\s*([^;]+);`,"i"));return e?e[1].trim():void 0}function gs(n,o){let e=Yo(n,o);if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function Av(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xn(n,o,e){return n!==void 0?n:o!==void 0?o:e}function yv(n){return[":root {",`--icon-fill: ${n.fill};`,`--icon-fill-opacity: ${Rl(n.fillOpacity)};`,`--icon-stroke: ${n.stroke};`,`--icon-stroke-dasharray: ${n.strokeDasharray};`,`--icon-aura-color: ${n.auraColor};`,`--icon-aura-opacity: ${Rl(n.auraOpacity)};`,`--icon-stroke-width: ${n.strokeWidth};`,`--icon-stroke-opacity: ${Rl(n.strokeOpacity)};`,"}"].join("")}function xv(n){if(n.includes('id="icon-aura"')||n.includes("id='icon-aura'"))return n;let o=Cv(n)??{minX:0,minY:0,width:24,height:24},e=o.minX+o.width/2,t=o.minY+o.height/2,i=Math.min(o.width,o.height)/2,a=["<defs>",'<radialGradient id="icon-aura" cx="50%" cy="50%" r="50%">','<stop offset="0%" stop-color="var(--icon-aura-color)" stop-opacity="var(--icon-aura-opacity)" />','<stop offset="100%" stop-color="var(--icon-aura-color)" stop-opacity="0" />',"</radialGradient>","</defs>"].join(""),r=`<circle class="icon-aura" cx="${e}" cy="${t}" r="${i}" fill="url(#icon-aura)" />`;return n.replace(/<svg[^>]*>/i,s=>`${s}${a}${r}`)}function Cv(n){let o=n.match(/viewBox="([^"]+)"/i);if(!o)return null;let e=o[1].trim().split(/\s+/).map(t=>Number(t));return e.length!==4||e.some(t=>!Number.isFinite(t))?null:{minX:e[0],minY:e[1],width:e[2],height:e[3]}}function Sv(n,o){let e=n.match(/(<style[^>]*>)([\s\S]*?)(<\/style>)/i);if(e){let[,t,,i]=e;return n.replace(e[0],`${t}${o}${i}`)}return n.replace(/<svg[^>]*>/i,t=>`${t}<style>${o}</style>`)}function Rl(n){return Number.isFinite(n)?Math.min(1,Math.max(0,n)):1}var lm=new Map,Wl=new Map,dm=new Map,cm=new Map,um=new Map,mm='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="#12f802" stroke="#fb05eb" stroke-width="1.4"/></svg>',wv={"aton/other":"assets/svg/AtoN/other/aton.svg","aton/basestation":"assets/svg/AtoN/other/basestation.svg","aton/east-beacon":"assets/svg/AtoN/cardinal/east_beacon.svg","aton/east-mark":"assets/svg/AtoN/cardinal/east_mark.svg","aton/west-beacon":"assets/svg/AtoN/cardinal/west_beacon.svg","aton/west-mark":"assets/svg/AtoN/cardinal/west_mark.svg","aton/north-beacon":"assets/svg/AtoN/cardinal/north_beacon.svg","aton/north-mark":"assets/svg/AtoN/cardinal/north_mark.svg","aton/south-beacon":"assets/svg/AtoN/cardinal/south_beacon.svg","aton/south-mark":"assets/svg/AtoN/cardinal/south_mark.svg","aton/port-beacon":"assets/svg/AtoN/lateral/port_beacon.svg","aton/starboard-beacon":"assets/svg/AtoN/lateral/starboard_beacon.svg","aton/port-preferred-beacon":"assets/svg/AtoN/lateral/port_preferred_beacon.svg","aton/starboard-preferred-beacon":"assets/svg/AtoN/lateral/starboard_preferred_beacon.svg","aton/port-mark":"assets/svg/AtoN/lateral/port_mark.svg","aton/starboard-mark":"assets/svg/AtoN/lateral/starboard_mark.svg","aton/port-preferred-mark":"assets/svg/AtoN/lateral/port_preferred_mark.svg","aton/starboard-preferred-mark":"assets/svg/AtoN/lateral/starboard_preferred_mark.svg","aton/special-beacon":"assets/svg/AtoN/special/special_beacon.svg","aton/special-mark":"assets/svg/AtoN/special/special_mark.svg","aton/safewater-beacon":"assets/svg/AtoN/dangerSafe/safewater_beacon.svg","aton/safewater-mark":"assets/svg/AtoN/dangerSafe/safewater_mark.svg","aton/isolateddanger-beacon":"assets/svg/AtoN/dangerSafe/isolateddanger_beacon.svg","aton/isolateddanger-mark":"assets/svg/AtoN/dangerSafe/isolateddanger_mark.svg","aton/unknown":"assets/svg/AtoN/other/unknown.svg"},hm={"vessel/fishing":"assets/svg/vessel/fishing.svg","vessel/diving":"assets/svg/vessel/diving-ops.svg","vessel/military":"assets/svg/vessel/military-ops.svg","vessel/sailing":"assets/svg/vessel/sailing.svg","vessel/pleasurecraft":"assets/svg/vessel/pleasurecraft.svg","vessel/highspeed":"assets/svg/vessel/highspeed.svg","vessel/pilot":"assets/svg/vessel/pilot.svg","vessel/sar":"assets/svg/vessel/sar.svg","vessel/tug":"assets/svg/vessel/tug.svg","vessel/law":"assets/svg/vessel/law-enforcement.svg","vessel/spare":"assets/svg/vessel/other.svg","vessel/passenger":"assets/svg/vessel/passenger.svg","vessel/cargo":"assets/svg/vessel/cargo.svg","vessel/tanker":"assets/svg/vessel/tanker.svg","vessel/other":"assets/svg/vessel/other.svg","vessel/unknown":"assets/svg/vessel/unknown.svg","vessel/self":"assets/svg/vessel/self.svg"},vs=Object.keys(hm),_v={"beacon/sart":"assets/svg/sar-distress-device/sart-eprib-mob.svg","beacon/mob":"assets/svg/sar-distress-device/sart-eprib-mob.svg","beacon/epirb":"assets/svg/sar-distress-device/sart-eprib-mob.svg"},Mv=ne(ne(ne({},wv),hm),_v),kv=[{code:0,key:"aton/other"},{code:1,key:"aton/other"},{code:2,key:"aton/other"},{code:3,key:"aton/other"},{code:4,key:"aton/other"},{code:5,key:"aton/other"},{code:6,key:"aton/other"},{code:7,key:"aton/other"},{code:8,key:"aton/other"},{code:9,key:"aton/north-beacon"},{code:10,key:"aton/east-beacon"},{code:11,key:"aton/south-beacon"},{code:12,key:"aton/west-beacon"},{code:13,key:"aton/port-beacon"},{code:14,key:"aton/starboard-beacon"},{code:15,key:"aton/port-preferred-beacon"},{code:16,key:"aton/starboard-preferred-beacon"},{code:17,key:"aton/isolateddanger-beacon"},{code:18,key:"aton/safewater-beacon"},{code:19,key:"aton/special-beacon"},{code:20,key:"aton/north-mark"},{code:21,key:"aton/east-mark"},{code:22,key:"aton/south-mark"},{code:23,key:"aton/west-mark"},{code:24,key:"aton/port-mark"},{code:25,key:"aton/starboard-mark"},{code:26,key:"aton/port-preferred-mark"},{code:27,key:"aton/starboard-preferred-mark"},{code:28,key:"aton/isolateddanger-mark"},{code:29,key:"aton/safewater-mark"},{code:30,key:"aton/special-mark"},{code:31,key:"aton/other"}],Tv=[{min:0,max:9,key:"vessel/other"},{min:10,max:19,key:"vessel/other"},{min:20,max:29,key:"vessel/highspeed"},{min:30,max:30,key:"vessel/fishing"},{min:31,max:31,key:"vessel/tug"},{min:32,max:32,key:"vessel/tug"},{min:33,max:33,key:"vessel/tug"},{min:34,max:34,key:"vessel/diving"},{min:35,max:35,key:"vessel/military"},{min:36,max:36,key:"vessel/sailing"},{min:37,max:37,key:"vessel/pleasurecraft"},{min:38,max:39,key:"vessel/other"},{min:40,max:49,key:"vessel/highspeed"},{min:50,max:50,key:"vessel/pilot"},{min:51,max:51,key:"vessel/sar"},{min:52,max:52,key:"vessel/tug"},{min:53,max:53,key:"vessel/tug"},{min:54,max:54,key:"vessel/tug"},{min:55,max:55,key:"vessel/law"},{min:56,max:56,key:"vessel/other"},{min:57,max:57,key:"vessel/other"},{min:58,max:58,key:"vessel/tug"},{min:59,max:59,key:"vessel/tug"},{min:60,max:69,key:"vessel/passenger"},{min:70,max:79,key:"vessel/cargo"},{min:80,max:89,key:"vessel/tanker"},{min:90,max:99,key:"vessel/other"}];function pm(n){return Re(this,null,function*(){let o=rm(Lv(n));return Pv(Gl(n),o)})}function gm(){return Re(this,null,function*(){return Dv("vessel/self")})}function fm(n){return Re(this,null,function*(){let o=lm.get(n);if(o)return o;let e=Wl.get(n);if(e)return e;let t=Mv[n],i=fetch(t).then(a=>a.ok?a.text():mm).catch(a=>(console.warn("[ais-icon-registry] Icon fetch error, using fallback.",{key:n,url:t,error:a}),mm)).then(a=>(lm.set(n,a),Wl.delete(n),a));return Wl.set(n,i),i})}function Dv(n){return Re(this,null,function*(){let o=dm.get(n);if(o)return o;let e=yield fm(n),t=Ll(e);return dm.set(n,t),t})}function Ev(n,o){return Re(this,null,function*(){let e=vm(n,o),t=cm.get(e);if(t)return t;let i=yield fm(n),a=sm(i,o);return cm.set(e,a),a})}function Pv(n,o){return Re(this,null,function*(){let e=vm(n,o),t=um.get(e);if(t)return t;let i=yield Ev(n,o),a=Ll(i);return um.set(e,a),a})}function vm(n,o){return`${n}|${Iv(o)}`}function Iv(n){return[Fl(n.fill),Fl(n.stroke),Fl(n.auraColor),Zo(n.fillOpacity),Zo(n.strokeOpacity),Zo(n.auraOpacity),Zo(n.strokeWidth),Zo(n.sizePx)].join("|")}function Fl(n){return n??""}function Zo(n){return n===void 0||!Number.isFinite(n)?"":n.toFixed(4)}function Gl(n){let o=Ov(Nv(n.mmsi));if(o)return o;switch(n.type){case"aton":return Rv(n.atonTypeId??null);case"basestation":return"aton/basestation";case"sar":return"vessel/sar";case"vessel":return Vv(n.aisShipTypeId??null);default:return"vessel/unknown"}}function Nv(n){if(n==null)return null;let o=typeof n=="number"?String(n):n;return o.length?o:null}function Ov(n){return n?n.startsWith("970")?"beacon/sart":n.startsWith("972")?"beacon/mob":n.startsWith("974")?"beacon/epirb":null:null}function Rv(n){let o=typeof n=="number"&&Number.isFinite(n)?n:null,t=(o===null?void 0:kv.find(i=>i.code===o))?.key??"aton/unknown";return t}function Vv(n){if(n!==null){for(let o of Tv)if(n>=o.min&&n<=o.max)return o.key}return"vessel/other"}function Lv(n){let o=Fv(n.navState),e=n.targetKind??(o?"fixed":Wv(n.type)),t=n.status==="unconfirmed"||n.status==="lost"?"unconfirmed":"confirmed";return ne({targetKind:e,targetState:t,isStationary:o,collisionRiskRating:n.collisionRiskRating},n.themeOverrides)}function Wv(n){switch(n){case"aton":case"basestation":return"fixed";default:return"moving"}}function Fv(n){let o=Gv(n);if(o!==void 0)return o===1||o===5;let e=Bv(n);return e?e.includes("moored")||e.includes("anchored")||e.includes("at anchor"):!1}function Gv(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let o=n.trim();if(!o.length)return;let e=Number(o);return Number.isFinite(e)?e:void 0}}function Bv(n){if(typeof n!="string")return;let o=n.trim().toLowerCase();return o.length?o.replace(/\s+/g," "):void 0}function zv(n,o){if(n&1){let e=we();d(0,"mat-checkbox",8),U("change",function(){let i=ee(e).$implicit,a=k(2);return te(a.toggleVesselType(i))}),c(1),u()}if(n&2){let e=o.$implicit,t=k(2);R("checked",t.isVesselTypeSelected(e)),f(),fe(" ",t.formatVesselTypeLabel(e)," ")}}function Uv(n,o){if(n&1&&(d(0,"div",0)(1,"p",1),c(2,"Categories"),u(),d(3,"mat-checkbox",2),c(4,"Anchored/Moored"),u(),d(5,"mat-checkbox",3),c(6,"All AtoN"),u(),d(7,"mat-checkbox",4),c(8,"All but SAR"),u(),d(9,"mat-checkbox",5),c(10,"All Vessels"),u(),W(11,"mat-divider",6),d(12,"p",1),c(13,"Types of vessels"),u(),Ae(14,zv,2,2,"mat-checkbox",7,Jt),u()),n&2){let e=k();R("formGroup",e.filtersGroup),f(14),ye(e.vesselTypeFilters)}}var bm=(()=>{class n{formGroupName=x.required();rootFormGroup=y(ut);fb=y(Gn);aisFormGroup=null;filtersGroup=null;vesselTypeFilters=vs.filter(e=>e!=="vessel/self"&&e!=="vessel/unknown"&&e!=="vessel/spare");ngOnInit(){if(this.aisFormGroup=this.rootFormGroup.control.get(this.formGroupName()),!this.aisFormGroup){console.warn(`AIS form group "${this.formGroupName()}" not found for target options.`);return}this.filtersGroup=this.ensureFiltersGroup(this.aisFormGroup)}isVesselTypeSelected(e){let t=this.vesselTypesControl();if(!t)return!1;let i=t.value;return Array.isArray(i)&&i.includes(e)}toggleVesselType(e){let t=this.vesselTypesControl();if(!t)return;let i=Array.isArray(t.value)?t.value:[],a=new Set(i);a.has(e)?a.delete(e):a.add(e),t.setValue(Array.from(a))}formatVesselTypeLabel(e){let t=e.replace("vessel/","");switch(t){case"pleasurecraft":return"Pleasure Craft";case"highspeed":return"High Speed";case"sar":return"SAR";case"law":return"Law Enforcement";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}}ensureFiltersGroup(e){let t=e.get("filters");if(!t)return t=this.buildDefaultFiltersGroup(),e.addControl("filters",t),t;this.ensureControl(t,"anchoredMoored",!1),this.ensureControl(t,"noCollisionRisk",!1),this.ensureControl(t,"allAton",!1),this.ensureControl(t,"allButSar",!1),this.ensureControl(t,"allVessels",!1);let i=this.ensureControl(t,"vesselTypes",[]);return Array.isArray(i.value)||i.setValue([]),t}buildDefaultFiltersGroup(){return this.fb.group({anchoredMoored:new tt(!1),noCollisionRisk:new tt(!1),allAton:new tt(!1),allButSar:new tt(!1),allVessels:new tt(!1),vesselTypes:new tt([])})}ensureControl(e,t,i){let a=e.get(t);return a||(a=new tt(i),e.addControl(t,a)),a}vesselTypesControl(){return this.filtersGroup?.get("vesselTypes")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["ais-target-options"]],inputs:{formGroupName:[1,"formGroupName"]},decls:1,vars:1,consts:[[1,"vessel-type-grid",3,"formGroup"],[1,"span-all"],["formControlName","anchoredMoored"],["formControlName","allAton"],["formControlName","allButSar"],["formControlName","allVessels"],[1,"span-all","ais-target-divider"],[3,"checked"],[3,"change","checked"]],template:function(t,i){t&1&&I(0,Uv,16,1,"div",0),t&2&&N(i.filtersGroup?0:-1)},dependencies:[ft,rt,Mt,ut,si,li,Yt,ln,sn],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;overflow:hidden}.ais-target-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px}.vessel-type-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:0px 12px}.span-all[_ngcontent-%COMP%]{grid-column:1/-1}.ais-target-divider[_ngcontent-%COMP%]{margin:4px 0}"],changeDetection:0})}return n})();function Hv(n,o){if(n&1&&(d(0,"mat-option",4),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),K(e)}}function qv(n,o){n&1&&(d(0,"div",5),c(1,"No chargers discovered yet."),u())}function $v(n,o){if(n&1&&(d(0,"div",8)(1,"div",9),c(2),u(),d(3,"mat-form-field",2)(4,"mat-label"),c(5,"Array Rated Power (W)"),u(),W(6,"input",10),u()()),n&2){let e=o.$implicit;R("formGroupName",e),f(2),K(e)}}var Am=(()=>{class n{formGroupName=x.required();rootFormGroup=y(ut);discovery=y(hs);destroyRef=y(ze);solarFormGroup;trackedSolarIdsControl;solarOptionsGroup;discoveredSolarIds=w([]);optionIds=X(()=>{let e=this.discoveredSolarIds(),t=Object.keys(this.solarOptionsGroup?.controls??{});return[...new Set([...t,...e])].sort()});discoveryToken;ngOnInit(){this.solarFormGroup=this.rootFormGroup.control.get(this.formGroupName()),this.solarFormGroup&&(this.ensureTrackedControl(),this.ensureOptionsGroup(),this.initializeDiscovery())}ngOnDestroy(){this.discoveryToken&&this.discovery.unregister(this.discoveryToken)}ensureSolarOption(e){this.solarOptionsGroup.get(e)||this.solarOptionsGroup.addControl(e,this.createOptionGroup({arrayRatedPowerW:null}))}ensureTrackedControl(){let e=this.solarFormGroup.get("trackedSolarIds");if(e instanceof tt){this.trackedSolarIdsControl=e;return}this.trackedSolarIdsControl=new tt([]),this.solarFormGroup.addControl("trackedSolarIds",this.trackedSolarIdsControl)}ensureOptionsGroup(){let e=this.solarFormGroup.get("solarOptionsById");if(e instanceof Wn){this.solarOptionsGroup=e;return}this.solarOptionsGroup=new Wn({}),this.solarFormGroup.addControl("solarOptionsById",this.solarOptionsGroup)}createOptionGroup(e){return new Wn({arrayRatedPowerW:new tt(e.arrayRatedPowerW,[_t.min(0)])})}initializeDiscovery(){this.discoveryToken=this.discovery.register({id:"solar-chargers",patterns:["self.electrical.solar.*"],contextTypes:["self"],pathPrefixes:["electrical.solar."]}),this.updateDiscoveredSolarIds(),this.discovery.changes(this.discoveryToken).pipe(Le(this.destroyRef)).subscribe(()=>this.updateDiscoveredSolarIds())}updateDiscoveredSolarIds(){if(!this.discoveryToken)return;let e=Array.from(this.discovery.activePaths(this.discoveryToken)).map(i=>this.extractSolarId(i)).filter(i=>!!i),t=[...new Set(e)].sort();for(let i of t)this.ensureSolarOption(i);this.discoveredSolarIds.set(t)}extractSolarId(e){let t=e.match(/self\.electrical\.solar\.([^.]+)\./);return t?t[1]:null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["solar-charger-setup"]],inputs:{formGroupName:[1,"formGroupName"]},decls:22,vars:2,consts:[[1,"solar-config",3,"formGroup"],[1,"solar-config-section"],["appearance","outline",1,"full-width"],["formControlName","trackedSolarIds","multiple",""],[3,"value"],[1,"hint"],["formGroupName","solarOptionsById",1,"solar-config-section"],[1,"option-list"],[1,"option-card",3,"formGroupName"],[1,"option-title"],["matInput","","type","number","required","","min","0","formControlName","arrayRatedPowerW","placeholder","e.g. 800"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"h3"),c(3,"Tracked Solar Chargers"),u(),d(4,"mat-form-field",2)(5,"mat-label"),c(6,"Charger Instances"),u(),d(7,"mat-select",3),Ae(8,Hv,2,2,"mat-option",4,Jt),u()(),d(10,"div",5),c(11,"Leave empty to display all discovered chargers."),u()(),W(12,"mat-divider"),d(13,"div",6)(14,"h3"),c(15,"Solar Array Rated Power"),u(),d(16,"div",5),c(17,"Set each charger's panel/array rated capacity in watts (W)."),u(),d(18,"div",7),I(19,qv,2,0,"div",5),Ae(20,$v,7,2,"div",8,Jt),u()()()),t&2&&(R("formGroup",i.solarFormGroup),f(8),ye(i.discoveredSolarIds()),f(11),N(i.optionIds().length?-1:19),f(),ye(i.optionIds()))},dependencies:[ft,gt,Ei,rt,Mt,kt,rn,ut,si,Za,qt,bt,vt,$t,At,Pi,jt,Nt,ln,sn],styles:["[_nghost-%COMP%]{display:block;width:100%}.solar-config[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:16px;padding:12px 4px}.solar-config-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.full-width[_ngcontent-%COMP%]{width:100%}.option-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.option-card[_ngcontent-%COMP%]{border:1px solid var(--kip-widget-card-border-color);border-radius:12px;padding:12px;background:var(--kip-contrast-dimmer-color);display:flex;flex-direction:column;gap:10px}.option-title[_ngcontent-%COMP%]{font-weight:600;font-size:14px}.hint[_ngcontent-%COMP%]{font-size:12px;opacity:.7}"]})}return n})();var ym=()=>["measuring","capacity"],jv=()=>["marineCompass","baseplateCompass"],Yv=()=>["measuring"];function Zv(n,o){if(n&1&&W(0,"config-display-chart-options",5),n&2){let e=k();R("displayName",e.displayNameToControl)("datasetUUID",e.datasetUUIDToControl)("convertUnitTo",e.convertUnitToControl)("showDataPoints",e.showDataPointsToControl)("showAverageData",e.showAverageDataToControl)("trackAgainstAverage",e.trackAgainstAverageToControl)("datasetAverageArray",e.datasetAverageArrayToControl)("showDatasetMinimumValueLine",e.showDatasetMinimumValueLineToControl)("showDatasetMaximumValueLine",e.showDatasetMaximumValueLineToControl)("showDatasetAverageValueLine",e.showDatasetAverageValueLineToControl)("showDatasetAngleAverageValueLine",e.showDatasetAngleAverageValueLineToControl)("startScaleAtZero",e.startScaleAtZeroToControl)("showLabel",e.showLabelToControl)("showTimeScale",e.showTimeScaleToControl)("showYScale",e.showYScaleToControl)("yScaleSuggestedMin",e.yScaleSuggestedMinToControl)("yScaleSuggestedMax",e.yScaleSuggestedMaxToControl)("enableMinMaxScaleLimit",e.enableMinMaxScaleLimitToControl)("yScaleMin",e.yScaleMinToControl)("yScaleMax",e.yScaleMaxToControl)("numDecimal",e.numDecimalToControl)("verticalChart",e.verticalChartToControl)("inverseYAxis",e.inverseYAxisToControl)("color",e.colorToControl)}}function Xv(n,o){n&1&&W(0,"select-autopilot",6)}function Qv(n,o){n&1&&(d(0,"mat-form-field",19)(1,"mat-label"),c(2,"URL"),u(),W(3,"input",44),u())}function Kv(n,o){n&1&&(d(0,"mat-checkbox",20),c(1," Allow pointer events on embedded content. WARNING: this may prevent swipe gestures over the Embed widget or keyboard events, while the focus is in the embed, from triggering normal KIP interactions. "),u())}function Jv(n,o){n&1&&(d(0,"div",45)(1,"div",46)(2,"mat-form-field",47)(3,"mat-label"),c(4,"Widget Label"),u(),W(5,"input",48),u()(),d(6,"div",46)(7,"mat-checkbox",49),c(8," Show Label "),u()()())}function eb(n,o){n&1&&(d(0,"mat-form-field",19)(1,"mat-label"),c(2,"Widget Label"),u(),W(3,"input",48),u())}function tb(n,o){if(n&1&&I(0,Jv,9,0,"div",45)(1,eb,4,0,"mat-form-field",19),n&2){let e=k(2);N((e.widgetConfig==null?null:e.widgetConfig.showLabel)!==void 0?0:1)}}function ib(n,o){n&1&&(d(0,"mat-form-field",50)(1,"mat-label"),c(2,"Scale Start"),u(),W(3,"input",51),u(),d(4,"mat-form-field",50)(5,"mat-label"),c(6,"Scale End"),u(),W(7,"input",52),u())}function nb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Integer Places"),u(),W(3,"input",53),u())}function ab(n,o){if(n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Decimal Places"),u(),W(3,"input",54),u()),n&2){let e=k(2);at(e.widgetConfig.showMiniChart!==void 0?"options-grid-span2":"")}}function ob(n,o){n&1&&(d(0,"mat-checkbox",22),c(1," Show Min recorded value "),u())}function rb(n,o){n&1&&(d(0,"mat-checkbox",23),c(1," Show Max recorded value "),u())}function sb(n,o){if(n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Next Dashboard after start"),u(),W(3,"input",55),u()),n&2){let e=k(2);dt("options-grid-span2",!e.widgetConfig.numInt)}}function lb(n,o){if(n&1&&(d(0,"mat-option",58),c(1),u()),n&2){let e=o.$implicit;R("value",e.measure),f(),fe(" ",e.description," ")}}function db(n,o){if(n&1&&(d(0,"mat-optgroup",57),Ae(1,lb,2,2,"mat-option",58,Ne),u()),n&2){let e=k().$implicit;R("label",e.group),f(),ye(e.units)}}function cb(n,o){if(n&1&&I(0,db,3,1,"mat-optgroup",57),n&2){let e=o.$implicit,t=k(3);N(!t.widgetConfig.convertUnitToGroup||t.widgetConfig.convertUnitToGroup===""||t.widgetConfig.convertUnitToGroup===e.group?0:-1)}}function ub(n,o){if(n&1&&(d(0,"mat-form-field",25)(1,"mat-label"),c(2,"Display Units"),u(),d(3,"mat-select",56),Ae(4,cb,1,1,null,null,Ne),u()()),n&2){let e=k(2);f(4),ye(e.unitList.conversions)}}function mb(n,o){n&1&&(d(0,"mat-checkbox",26),c(1," Enable beeps on count down "),u())}function hb(n,o){if(n&1&&W(0,"display-datetime-options",27),n&2){let e=k(2);R("dateFormat",e.dateFormatToControl)("dateTimezone",e.dateTimezoneToControl)}}function pb(n,o){n&1&&(d(0,"mat-checkbox",28),c(1," Enable Advanced Compass Mode "),u())}function gb(n,o){n&1&&(d(0,"mat-checkbox",29),c(1," Close-hauled Lines "),u())}function fb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Optimal Close-hauled Angle"),u(),W(3,"input",59),u())}function vb(n,o){n&1&&(d(0,"mat-checkbox",30),c(1," Wind Sectors "),u())}function bb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Sector Duration (sec)"),u(),W(3,"input",60),u())}function Ab(n,o){n&1&&(d(0,"mat-checkbox",31),c(1," Apparent Wind Speed Value "),u())}function yb(n,o){n&1&&(d(0,"mat-checkbox",32),c(1," True Wind Speed Value "),u())}function xb(n,o){n&1&&(d(0,"mat-checkbox",33),c(1," Course Over Ground "),u())}function Cb(n,o){n&1&&(d(0,"mat-checkbox",34),c(1," True Wind Angle Indicator "),u())}function Sb(n,o){n&1&&(d(0,"mat-checkbox",35),c(1," Next Waypoint "),u())}function wb(n,o){n&1&&(d(0,"mat-checkbox",36),c(1," Drift "),u())}function _b(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Minimum Value"),u(),W(3,"input",61),u())}function Mb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Maximum Value"),u(),W(3,"input",62),u())}function kb(n,o){n&1&&(d(0,"mat-checkbox",37),c(1," Ignore Zones configuration "),u())}function Tb(n,o){n&1&&(d(0,"div",63)(1,"mat-checkbox",64),c(2," Show Heeling Side Label "),u()(),d(3,"div",63)(4,"mat-checkbox",65),c(5," Reverse Angle "),u()())}function Db(n,o){n&1&&(d(0,"div",63)(1,"mat-checkbox",68),c(2," Show Progress Bar "),u()(),d(3,"div",38)(4,"mat-checkbox",69),c(5," Show Ticks "),u()())}function Eb(n,o){n&1&&(d(0,"div",63)(1,"mat-checkbox",69),c(2," Show Ticks "),u()())}function Pb(n,o){if(n&1&&(d(0,"mat-form-field",63)(1,"mat-label"),c(2,"Highlights Width"),u(),W(3,"input",66),u(),d(4,"div",63)(5,"mat-checkbox",67),c(6," Show Needle Indicator "),u()(),I(7,Db,6,0)(8,Eb,3,0,"div",63)),n&2){let e=k(2);f(7),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"?7:8)}}function Ib(n,o){n&1&&(d(0,"mat-form-field",38)(1,"mat-label"),c(2,"Rotation Element"),u(),d(3,"mat-select",70)(4,"mat-option",71),c(5,"Dial (Marine Compass)"),u(),d(6,"mat-option",72),c(7,"Needle (Base plate compass)"),u()()(),d(8,"div",63)(9,"mat-checkbox",73),c(10," Show value box "),u()(),d(11,"div",63)(12,"mat-checkbox",74),c(13," Show cardinal degrees "),u()())}function Nb(n,o){n&1&&(d(0,"mat-form-field",63)(1,"mat-label"),c(2,"Progress Bar Start Position"),u(),d(3,"mat-select",77)(4,"mat-option",78),c(5,"Left"),u(),d(6,"mat-option",79),c(7,"Middle"),u(),d(8,"mat-option",80),c(9,"Right"),u()()())}function Ob(n,o){n&1&&(d(0,"mat-form-field",63)(1,"mat-label"),c(2,"Progress Bar Start Angle"),u(),W(3,"input",81),u())}function Rb(n,o){if(n&1&&(d(0,"mat-form-field",63)(1,"mat-label"),c(2,"Gauge Type"),u(),d(3,"mat-select",70)(4,"mat-option",75),c(5,"Measuring"),u(),d(6,"mat-option",76),c(7,"Capacity"),u()()(),I(8,Nb,10,0,"mat-form-field",63),I(9,Ob,4,0,"mat-form-field",63)),n&2){let e=k(3);f(8),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"&&Bo(2,Yv).includes(e.formMaster.value.gauge.subType)?8:-1),f(),N(e.formMaster.value.gauge.subType==="capacity"?9:-1)}}function Vb(n,o){if(n&1&&I(0,Ib,14,0)(1,Rb,10,3),n&2){let e=k(2);N(Bo(1,jv).indexOf(e.formMaster.value.gauge.subType)>-1?0:Bo(2,ym).indexOf(e.formMaster.value.gauge.subType)>-1?1:-1)}}function Lb(n,o){n&1&&(d(0,"mat-form-field",38)(1,"mat-label"),c(2,"Orientation"),u(),d(3,"mat-select",82)(4,"mat-option",83),c(5,"Vertical"),u(),d(6,"mat-option",84),c(7,"Horizontal"),u()()())}function Wb(n,o){n&1&&(d(0,"mat-form-field",38)(1,"mat-label"),c(2,"Unit Label"),u(),d(3,"mat-select",85)(4,"mat-option",86),c(5,"Full Label"),u(),d(6,"mat-option",87),c(7,"First Letter Only"),u()()())}function Fb(n,o){if(n&1&&(d(0,"mat-option",58),c(1),u()),n&2){let e=o.$implicit;R("value",Fi(e.value)),f(),K(e.label)}}function Gb(n,o){if(n&1&&(d(0,"mat-form-field",19)(1,"mat-label"),c(2,"Color"),u(),d(3,"mat-select",88),Ae(4,Fb,2,3,"mat-option",58,Ne),u()()),n&2){let e=k(2);f(4),ye(e.colors)}}function Bb(n,o){n&1&&(d(0,"mat-form-field",19)(1,"mat-label"),c(2,"Scale Span"),u(),d(3,"mat-select",89)(4,"mat-option",90),c(5,"1 Minute"),u(),d(6,"mat-option",91),c(7,"5 Minutes"),u(),d(8,"mat-option",92),c(9,"30 Minutes"),u()()(),d(10,"div",93)(11,"strong"),c(12,"History API:"),u(),c(13," Wind Trends can be pre-filled with historical data from the Signal K History API. "),d(14,"a",94),c(15,"Learn more"),u()())}function zb(n,o){n&1&&(d(0,"mat-checkbox",39),c(1," Show Background Graph "),d(2,"i"),c(3,"(Too many graphs may affect performance)"),u()())}function Ub(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Suggested Scale Start"),u(),W(3,"input",95),u())}function Hb(n,o){n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Suggested Scale End"),u(),W(3,"input",96),u())}function qb(n,o){n&1&&(d(0,"mat-checkbox",40),c(1," Inverse Scale Axis "),u())}function $b(n,o){n&1&&(d(0,"mat-checkbox",41),c(1," Vertical Data Graph "),u())}function jb(n,o){n&1&&(d(0,"mat-checkbox",42),c(1," Disable background color "),u())}function Yb(n,o){if(n&1&&(d(0,"mat-option",58),c(1),u()),n&2){let e=o.$implicit;R("value",Fi(e.value)),f(),K(e.label)}}function Zb(n,o){if(n&1&&(d(0,"mat-form-field")(1,"mat-label"),c(2,"Background Color"),u(),d(3,"mat-select",97),Ae(4,Yb,2,3,"mat-option",58,Ne),u()()),n&2){let e=k(2);f(4),ye(e.colors)}}function Xb(n,o){n&1&&(Ji(0,43),d(1,"mat-form-field")(2,"mat-label"),c(3,"View Mode"),u(),d(4,"mat-select",98)(5,"mat-option",99),c(6,"North Up"),u(),d(7,"mat-option",100),c(8,"Course Up"),u()()(),d(9,"mat-form-field")(10,"mat-label"),c(11,"Fully Visible Rings Range"),u(),d(12,"mat-select",101)(13,"mat-option",102),c(14,"1 miles"),u(),d(15,"mat-option",103),c(16,"3 miles"),u(),d(17,"mat-option",104),c(18,"6 miles"),u(),d(19,"mat-option",105),c(20,"12 miles"),u(),d(21,"mat-option",106),c(22,"24 miles"),u(),d(23,"mat-option",107),c(24,"48 miles"),u()()(),d(25,"mat-checkbox",108),c(26," Plot target COG vector "),u(),d(27,"mat-form-field")(28,"mat-label"),c(29,"COG plot length (minutes)"),u(),W(30,"input",109),u(),d(31,"mat-checkbox",110),c(32," Show unconfirmed targets "),u(),d(33,"mat-checkbox",111),c(34," Show lost targets "),u(),d(35,"mat-checkbox",112),c(36," Show own ship icon "),u(),en())}function Qb(n,o){n&1&&(d(0,"mat-form-field",63)(1,"mat-label"),c(2,"Background Style"),u(),d(3,"mat-select",125)(4,"mat-option",126),c(5,"Dark Gray"),u(),d(6,"mat-option",127),c(7,"Satin Gray"),u(),d(8,"mat-option",128),c(9,"Light Gray"),u(),d(10,"mat-option",129),c(11,"White"),u(),d(12,"mat-option",130),c(13,"Black"),u(),d(14,"mat-option",131),c(15,"Beige"),u(),d(16,"mat-option",132),c(17,"Brown"),u(),d(18,"mat-option",133),c(19,"Red"),u(),d(20,"mat-option",134),c(21,"Green"),u(),d(22,"mat-option",135),c(23,"Blue"),u(),d(24,"mat-option",121),c(25,"Anthracite"),u(),d(26,"mat-option",136),c(27,"Mud"),u(),d(28,"mat-option",137),c(29,"Punched Sheet"),u(),d(30,"mat-option",138),c(31,"Carbon"),u(),d(32,"mat-option",139),c(33,"Stainless"),u(),d(34,"mat-option",140),c(35,"Brushed Metal"),u(),d(36,"mat-option",141),c(37,"Brushed Stainless"),u(),d(38,"mat-option",142),c(39,"Turned"),u()()())}function Kb(n,o){n&1&&(d(0,"div",63)(1,"mat-checkbox",143),c(2," Reverse Pitch Axis "),u()(),d(3,"div",63)(4,"mat-checkbox",144),c(5," Reverse Roll Axis "),u()(),d(6,"div",63)(7,"mat-checkbox",145),c(8," Show Frame "),u()())}function Jb(n,o){if(n&1&&(I(0,Qb,40,0,"mat-form-field",63),I(1,Kb,9,0),d(2,"mat-form-field",63)(3,"mat-label"),c(4,"Frame Style"),u(),d(5,"mat-select",113)(6,"mat-option",114),c(7,"Black Metal"),u(),d(8,"mat-option",115),c(9,"Metal"),u(),d(10,"mat-option",116),c(11,"Shiny Metal"),u(),d(12,"mat-option",117),c(13,"Brass"),u(),d(14,"mat-option",118),c(15,"Steel"),u(),d(16,"mat-option",119),c(17,"Chrome"),u(),d(18,"mat-option",120),c(19,"Gold"),u(),d(20,"mat-option",121),c(21,"Anthracite"),u(),d(22,"mat-option",122),c(23,"Tilted Gray"),u(),d(24,"mat-option",123),c(25,"Tilted Black"),u(),d(26,"mat-option",124),c(27,"Glossy Metal"),u()()()),n&2){let e=k(2);N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)!=="horizon"?0:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="horizon"?1:-1)}}function e1(n,o){if(n&1&&(d(0,"div",7)(1,"div",18),I(2,Qv,4,0,"mat-form-field",19),I(3,Kv,2,0,"mat-checkbox",20),I(4,tb,2,1),I(5,ib,8,0),I(6,nb,4,0,"mat-form-field"),I(7,ab,4,2,"mat-form-field",21),I(8,ob,2,0,"mat-checkbox",22),I(9,rb,2,0,"mat-checkbox",23),I(10,sb,4,2,"mat-form-field",24),I(11,ub,6,0,"mat-form-field",25),I(12,mb,2,0,"mat-checkbox",26),I(13,hb,1,2,"display-datetime-options",27),I(14,pb,2,0,"mat-checkbox",28),I(15,gb,2,0,"mat-checkbox",29),I(16,fb,4,0,"mat-form-field"),I(17,vb,2,0,"mat-checkbox",30),I(18,bb,4,0,"mat-form-field"),I(19,Ab,2,0,"mat-checkbox",31),I(20,yb,2,0,"mat-checkbox",32),I(21,xb,2,0,"mat-checkbox",33),I(22,Cb,2,0,"mat-checkbox",34),I(23,Sb,2,0,"mat-checkbox",35),I(24,wb,2,0,"mat-checkbox",36),I(25,_b,4,0,"mat-form-field"),I(26,Mb,4,0,"mat-form-field"),I(27,kb,2,0,"mat-checkbox",37),I(28,Tb,6,0),I(29,Pb,9,1),I(30,Vb,2,3),I(31,Lb,8,0,"mat-form-field",38),I(32,Wb,8,0,"mat-form-field",38),I(33,Gb,6,0,"mat-form-field",19),I(34,Bb,16,0),I(35,zb,4,0,"mat-checkbox",39),I(36,Ub,4,0,"mat-form-field"),I(37,Hb,4,0,"mat-form-field"),I(38,qb,2,0,"mat-checkbox",40),I(39,$b,2,0,"mat-checkbox",41),I(40,jb,2,0,"mat-checkbox",42),I(41,Zb,6,0,"mat-form-field"),I(42,Xb,37,0,"ng-container",43),I(43,Jb,28,2),u()()),n&2){let e=k();f(2),N((e.widgetConfig==null?null:e.widgetConfig.widgetUrl)!==void 0?2:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.allowInput)!==void 0?3:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.displayName)!==void 0?4:-1),f(),N(e.formMaster.get("displayScale")?5:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.numInt)!==void 0?6:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.numDecimal)!==void 0?7:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.showMin)!==void 0?8:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.showMax)!==void 0?9:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.nextDashboard)!==void 0?10:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.convertUnitTo)!==void 0?11:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.playBeeps)!==void 0?12:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.dateFormat)!==void 0?13:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.compassModeEnabled)!==void 0?14:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?15:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?16:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?17:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?18:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.awsEnable)!==void 0?19:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.twsEnable)!==void 0?20:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.courseOverGroundEnable)!==void 0?21:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.twaEnable)!==void 0?22:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.waypointEnable)!==void 0?23:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.driftEnable)!==void 0?24:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.minValue)!==void 0&&!e.formMaster.get("displayScale")?25:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.maxValue)!==void 0&&!e.formMaster.get("displayScale")?26:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.ignoreZones)!==void 0?27:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="angle"?28:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"&&Bo(42,ym).includes(e.formMaster.value.gauge.subType)||(e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngLinear"?29:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"?30:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngLinear"?31:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="simpleLinear"?32:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.color)!==void 0?33:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.timeScale)!==void 0?34:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.showMiniChart)!==void 0?35:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.yScaleMin)!==void 0?36:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.yScaleMax)!==void 0?37:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.inverseYAxis)!==void 0?38:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.verticalChart)!==void 0?39:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.noBgColor)!==void 0?40:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.bgColor)!==void 0?41:-1),f(),N((e.widgetConfig==null?null:e.widgetConfig.ais)!==void 0?42:-1),f(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="steel"||(e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="horizon"?43:-1)}}function t1(n,o){n&1&&(d(0,"mat-tab",8),W(1,"ais-target-options",43),u())}function i1(n,o){if(n&1&&(W(0,"span",149),c(1,"\xA0Controls ")),n&2){let e=k(2);Ua(e.formMaster.controls.multiChildCtrls.valid?"display: none":"display: block")}}function n1(n,o){if(n&1){let e=we();d(0,"mat-tab",9)(1,"div",146)(2,"div"),yi(3,i1,2,2,"ng-template",147),u(),d(4,"boolean-multicontrol-options",148),U("addPath",function(i){ee(e);let a=k();return te(a.addPathGroup(i))})("updatePath",function(i){ee(e);let a=k();return te(a.updatePath(i))})("delPath",function(i){ee(e);let a=k();return te(a.deletePath(i))}),u()()()}if(n&2){let e=k();f(4),R("multiCtrlArray",e.multiChildCtrlsToControl)("zonesOnlyPaths",(e.widgetConfig==null?null:e.widgetConfig.zonesOnlyPaths)??!1)}}function a1(n,o){if(n&1&&(d(0,"span",151),c(1," error "),u(),c(2," \xA0Paths ")),n&2){let e=k(2);Ua(e.formMaster.controls.paths.valid||e.formMaster.controls.paths.disabled?"display: none":"display: block")}}function o1(n,o){if(n&1&&(d(0,"mat-tab",10)(1,"div",146)(2,"div"),yi(3,a1,3,2,"ng-template",147),u(),W(4,"paths-options",150),u()()),n&2){let e=k();f(4),R("isArray",e.isPathArray)("enableTimeout",e.enableTimeoutToControl)("dataTimeout",e.dataTimeoutToControl)("filterSelfPaths",e.filterSelfPathsToControl)("addPathEvent",e.addPathEvent)("delPathEvent",e.delPathEvent)("updatePathEvent",e.updatePathEvent)}}function r1(n,o){n&1&&(d(0,"p")(1,"mat-checkbox",154),c(2," Digital display "),u()())}function s1(n,o){n&1&&(d(0,"mat-form-field",19)(1,"mat-label"),c(2,"Dial Size"),u(),d(3,"mat-select",155)(4,"mat-option",156),c(5,"1/4"),u(),d(6,"mat-option",157),c(7,"1/2"),u(),d(8,"mat-option",158),c(9,"3/4"),u(),d(10,"mat-option",86),c(11,"Full"),u()()())}function l1(n,o){if(n&1&&(d(0,"mat-tab",11)(1,"div",7)(2,"mat-form-field",19)(3,"mat-label"),c(4,"Gauge Type"),u(),d(5,"mat-select",82)(6,"mat-option",152),c(7,"Linear"),u(),d(8,"mat-option",153),c(9,"Radial"),u()()(),I(10,r1,3,0,"p"),I(11,s1,12,0,"mat-form-field",19),u()()),n&2){let e=k();f(10),N(e.formMaster.value.gauge.subType==="linear"?10:-1),f(),N(e.formMaster.value.gauge.subType==="radial"?11:-1)}}function d1(n,o){n&1&&(d(0,"p")(1,"mat-checkbox",161),c(2," Value to send on button push (checked = on, unchecked = off) "),u()())}function c1(n,o){if(n&1&&(d(0,"mat-tab",12)(1,"div",146)(2,"p")(3,"mat-checkbox",159),c(4," Enable Put Requests "),u()(),d(5,"p")(6,"mat-checkbox",160),c(7," Momentary mode (instead of switching between on/off) "),u()(),I(8,d1,3,0,"p"),u()()),n&2){let e=k();f(8),N(e.formMaster.controls.putMomentary.value?8:-1)}}function u1(n,o){n&1&&W(0,"span",149)}function m1(n,o){if(n&1&&(I(0,u1,1,0,"span",149),c(1," Dataset ")),n&2){let e=k(2);N(e.formMaster.controls.datachartPath.valid?-1:0)}}function h1(n,o){if(n&1&&(d(0,"mat-tab",13),yi(1,m1,2,1,"ng-template",147),W(2,"config-dataset-chart-options",162),u()),n&2){let e=k();f(2),R("filterSelfPaths",e.filterSelfPathsToControl)("datachartPath",e.datachartPathControl)("datachartSource",e.datachartSourceControl)("convertUnitTo",e.convertUnitToControl)("timeScale",e.timeScaleControl)("period",e.periodControl)}}function p1(n,o){n&1&&(d(0,"mat-tab",14),W(1,"bms-bank-setup",163),u())}function g1(n,o){n&1&&(d(0,"mat-tab",15),W(1,"solar-charger-setup",164),u())}var xm=(()=>{class n{static KEY_MULTI_CHILD_CTRLS="multiChildCtrls";static KEY_DISPLAY_SCALE="displayScale";static KEY_GAUGE="gauge";static KEY_AUTOPILOT="autopilot";static KEY_PATHS="paths";static KEY_AIS="ais";static KEY_CONVERT_UNIT_TO="convertUnitTo";dialogRef=y(an);fb=y(Gn);DatasetStreamService=y(mn);units=y(it);app=y(Ii);destroyRef=y(ze);widgetConfig=y(ri);titleDialog="Widget Options";formMaster;availableDataSets;unitList={};isPathArray=!1;addPathEvent;delPathEvent;updatePathEvent;colors=[];saveDisabled=w(!0);ngOnInit(){if(!this.widgetConfig){console.error("Widget configuration data is missing. Closing dialog."),this.dialogRef.close();return}this.availableDataSets=this.DatasetStreamService.list().sort((e,t)=>{let i=e.label||"",a=t.label||"";return i.localeCompare(a,void 0,{sensitivity:"base"})}),this.unitList=this.units.getConversionsForPath(""),this.formMaster=this.generateFormGroups(this.widgetConfig),this.formMaster.statusChanges.pipe(Le(this.destroyRef)).subscribe(()=>this.saveDisabled.set(this.formMaster.invalid)),queueMicrotask(()=>this.saveDisabled.set(this.formMaster.invalid)),this.colors=this.app.configurableThemeColors}isPlainObject(e){return Object.prototype.toString.call(e)==="[object Object]"}generateFormGroups(e,t){let i=this.fb.group({});return Object.keys(e).forEach(a=>{let r=e[a];if(r!==null&&(Array.isArray(r)||this.isPlainObject(r))){if(a===n.KEY_MULTI_CHILD_CTRLS){i.addControl(a,this.fb.array([]));let s=i.get(a);r.forEach(l=>{s.push(this.generateCtrlArray(l))})}else if(a===n.KEY_DISPLAY_SCALE)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_GAUGE)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_AUTOPILOT)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_AIS)i.addControl(a,this.generateFormGroups(r,a));else if(a===n.KEY_PATHS){let s=r;if(this.widgetConfig.multiChildCtrls!==void 0){this.isPathArray=!0,i.addControl(a,this.fb.array([]));let l=i.get(a);Object.keys(s).forEach(m=>{let g=s[m];if(g){let v=this.generatePathArray(m,g);g.isPathConfigurable===!1&&v.disable(),l.push(v)}})}else{let l=this.fb.group({});Object.keys(s).forEach(m=>{let g=s[m];if(g){let v=this.generateFormGroups(g,m);g.isPathConfigurable===!1&&v.disable(),l.addControl(m,v)}}),i.addControl(a,l)}}else Array.isArray(r)?i.addControl(a,new tt(r)):i.addControl(a,this.generateFormGroups(r,a));t===n.KEY_PATHS&&i.addControl(a,this.generateFormGroups(r,a))}else if(t===n.KEY_CONVERT_UNIT_TO){let s=e[a];(s&&s.pathType=="number"||"datasetUUID"in this.widgetConfig)&&i.addControl(a,new tt(r))}else switch(a){case"path":i.addControl(a,new tt(r));break;case"datasetUUID":i.addControl(a,new tt(r,_t.required));break;case"dataTimeout":i.addControl(a,new tt(r,_t.required));break;default:i.addControl(a,new tt(r));break}}),i}generatePathArray(e,t){let i=new Wn({});return Object.keys(t).forEach(a=>{i.addControl(a,this.generatePathFields(a,t[a]))}),i}generatePathFields(e,t){let i=null;switch(e){case"path":i=new tt(t);break;case"source":i=new tt(t,_t.required);break;case"sampleTime":i=new tt(t,_t.required);break;default:i=new tt(t);break}return i}generateCtrlArray(e){let t=this.fb.group(e);return t.get("ctrlLabel").addValidators(_t.required),t}addPathGroup(e){this.addPathEvent=e}updatePath(e){e.forEach(t=>{this.formMaster.get("paths").controls.forEach(a=>{a.get("pathID").value==t.pathID&&(a.controls.description.setValue(t.ctrlLabel),a.controls.pathType.setValue(t.isNumeric?"number":"boolean"),this.updatePathEvent=e)})})}deletePath(e){let t=this.formMaster.get("paths"),i=0;t.controls.forEach(r=>{r.get("pathID").value==e.pathID?t.removeAt(i):i++}),this.formMaster.get("multiChildCtrls").removeAt(e.ctrlIndex),this.delPathEvent=e.pathID,this.formMaster.updateValueAndValidity()}get datachartPathControl(){return this.formMaster.get("datachartPath")}get datachartSourceControl(){return this.formMaster.get("datachartSource")}get convertUnitToControl(){return this.formMaster.get("convertUnitTo")}get timeScaleControl(){return this.formMaster.get("timeScale")}get periodControl(){return this.formMaster.get("period")}get datasetUUIDToControl(){return this.formMaster.get("datasetUUID")}get filterSelfPathsToControl(){return this.formMaster.get("filterSelfPaths")}get dataTimeoutToControl(){return this.formMaster.get("dataTimeout")}get enableTimeoutToControl(){return this.formMaster.get("enableTimeout")}get dateTimezoneToControl(){return this.formMaster.get("dateTimezone")}get yScaleSuggestedMaxToControl(){return this.formMaster.get("yScaleSuggestedMax")}get enableMinMaxScaleLimitToControl(){return this.formMaster.get("enableMinMaxScaleLimit")}get showDatasetMinimumValueLineToControl(){return this.formMaster.get("showDatasetMinimumValueLine")}get showDatasetMaximumValueLineToControl(){return this.formMaster.get("showDatasetMaximumValueLine")}get showDatasetAverageValueLineToControl(){return this.formMaster.get("showDatasetAverageValueLine")}get showDatasetAngleAverageValueLineToControl(){return this.formMaster.get("showDatasetAngleAverageValueLine")}get startScaleAtZeroToControl(){return this.formMaster.get("startScaleAtZero")}get showLabelToControl(){return this.formMaster.get("showLabel")}get showTimeScaleToControl(){return this.formMaster.get("showTimeScale")}get showYScaleToControl(){return this.formMaster.get("showYScale")}get yScaleSuggestedMinToControl(){return this.formMaster.get("yScaleSuggestedMin")}get yScaleMinToControl(){return this.formMaster.get("yScaleMin")}get yScaleMaxToControl(){return this.formMaster.get("yScaleMax")}get datasetAverageArrayToControl(){return this.formMaster.get("datasetAverageArray")}get trackAgainstAverageToControl(){return this.formMaster.get("trackAgainstAverage")}get showDataPointsToControl(){return this.formMaster.get("showDataPoints")}get showAverageDataToControl(){return this.formMaster.get("showAverageData")}get displayNameToControl(){return this.formMaster.get("displayName")}get numDecimalToControl(){return this.formMaster.get("numDecimal")}get verticalChartToControl(){return this.formMaster.get("verticalChart")}get inverseYAxisToControl(){return this.formMaster.get("inverseYAxis")}get colorToControl(){return this.formMaster.get("color")}get dateFormatToControl(){return this.formMaster.get("dateFormat")}get multiChildCtrlsToControl(){return this.formMaster.get("multiChildCtrls")}submitConfig(){this.dialogRef.close(this.formMaster.getRawValue())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["modal-widget-config"]],decls:23,vars:12,consts:[[3,"ngSubmit","formGroup"],["mat-dialog-title",""],[1,"widget-config-dialog-content"],[1,"tab-group-content"],["label","Display"],[1,"tab-content",3,"displayName","datasetUUID","convertUnitTo","showDataPoints","showAverageData","trackAgainstAverage","datasetAverageArray","showDatasetMinimumValueLine","showDatasetMaximumValueLine","showDatasetAverageValueLine","showDatasetAngleAverageValueLine","startScaleAtZero","showLabel","showTimeScale","showYScale","yScaleSuggestedMin","yScaleSuggestedMax","enableMinMaxScaleLimit","yScaleMin","yScaleMax","numDecimal","verticalChart","inverseYAxis","color"],["formGroupName","autopilot",1,"tab-content"],[1,"display-content","tab-content"],["label","Filter"],["label","Controls"],["label","Paths"],["label","Settings","formGroupName","gauge"],["label","Put Request"],["label","Dataset"],["label","BMS"],["label","Solar Chargers"],["type","button","mat-dialog-close","","mat-flat-button",""],["mat-flat-button","","type","submit",3,"disabled"],[1,"widget-options-grid"],[1,"options-grid-span2"],["name","allowInput","formControlName","allowInput",1,"options-grid-span2"],[3,"class"],["name","showMin","formControlName","showMin"],["name","showMax","formControlName","showMax"],[3,"options-grid-span2"],[1,"fields"],["name","playBeeps","formControlName","playBeeps"],[1,"options-grid-span2",3,"dateFormat","dateTimezone"],["name","compassModeEnabled","formControlName","compassModeEnabled",1,"fields","options-grid-span2"],["name","laylineEnable","formControlName","laylineEnable",1,"fields"],["name","windSectorEnable","formControlName","windSectorEnable"],["name","awsEnable","formControlName","awsEnable"],["name","twsEnable","formControlName","twsEnable"],["name","courseOverGroundEnable","formControlName","courseOverGroundEnable"],["name","twaEnable","formControlName","twaEnable"],["name","waypointEnable","formControlName","waypointEnable"],["name","driftEnable","formControlName","driftEnable"],["name","ignoreZones","formControlName","ignoreZones"],["formGroupName","gauge",1,"options-grid-span2"],["name","showMiniChart","formControlName","showMiniChart",1,"options-grid-span2"],["name","inverseYAxis","formControlName","inverseYAxis"],["name","verticalChart","formControlName","verticalChart"],["name","noBgColor","formControlName","noBgColor"],["formGroupName","ais"],["type","url","matInput","","placeholder","Enter URL to page/resource","name","widgetUrl","formControlName","widgetUrl"],[1,"flex-container","options-grid-span2"],[1,"panel-group"],[1,"full-width"],["matInput","","placeholder","Enter a label to display","name","displayName","formControlName","displayName"],["name","showLabel","formControlName","showLabel",1,"full-width"],["formGroupName","displayScale","appearance","outline"],["matNativeControl","","type","number","name","lower","formControlName","lower","placeholder","Enter number..."],["matInput","","type","number","name","upper","formControlName","upper","placeholder","Enter number..."],["type","number","min","1","max","5","matInput","","placeholder","Enter or select number...","name","numInt","formControlName","numInt","required",""],["type","number","min","0","max","5","matInput","","placeholder","Enter or select number...","name","numDecimal","formControlName","numDecimal","required",""],["type","number","min","0","max","99","matInput","","placeholder","Enter or select number...","name","nextDashboard","formControlName","nextDashboard"],["placeholder","Select unit","formControlName","convertUnitTo","required",""],[3,"label"],[3,"value"],["type","number","min","10","max","90","matInput","","placeholder","Select angle...","name","laylineAngle","formControlName","laylineAngle"],["type","number","min","1","max","90","matInput","","placeholder","Select or enter duration...","name","windSectorWindowSeconds","formControlName","windSectorWindowSeconds"],["matInput","","type","number","name","minValue","formControlName","minValue","placeholder","Enter or select number..."],["matInput","","type","number","name","maxValue","formControlName","maxValue","placeholder","Enter or select number..."],["formGroupName","gauge"],["name","sideLabel","formControlName","sideLabel"],["name","invertAngle","formControlName","invertAngle"],["type","number","min","0","max","25","matInput","","placeholder","Enter or select number...","name","highlightsWidth","formControlName","highlightsWidth","required",""],["name","enableNeedle","formControlName","enableNeedle"],["name","enableProgressbar","formControlName","enableProgressbar"],["name","enableTicks","formControlName","enableTicks"],["placeholder","Select Gauge Type...","formControlName","subType","name","subType"],["value","marineCompass"],["value","baseplateCompass"],["name","showValueBox","formControlName","showValueBox"],["name","compassUseNumbers","formControlName","compassUseNumbers"],["value","measuring"],["value","capacity"],["placeholder","Select start position...","formControlName","barStartPosition","name","barStartPosition"],["value","left"],["value","middle"],["value","right"],["type","number","min","1","max","360","matInput","","placeholder","Enter or select number...","name","scaleStart","formControlName","scaleStart","required",""],["placeholder","Select type...","formControlName","subType","name","subType"],["value","vertical"],["value","horizontal"],["placeholder","Select label format","formControlName","unitLabelFormat","name","unitLabelFormat"],["value","full"],["value","abr"],["placeholder","Select Color...","formControlName","color","name","color","required",""],["placeholder","Select span duration...","formControlName","timeScale","name","timeScale","required",""],["value","Last Minute"],["value","Last 5 Minutes"],["value","Last 30 Minutes"],[2,"grid-column","1 / -1","font-size","0.9em","color","var(--mat-sys-outline)"],["routerLink","/help",2,"color","var(--kip-blue-color)","cursor","pointer","text-decoration","underline"],["type","number","matInput","","placeholder","Enter or select number...","name","yScaleMin","formControlName","yScaleMin","required",""],["type","number","matInput","","placeholder","Enter or select number...","name","yScaleMax","formControlName","yScaleMax","required",""],["placeholder","Select Color...","formControlName","bgColor","name","bgColor","required",""],["placeholder","Select view mode...","formControlName","viewMode","name","viewMode","required",""],["value","north-up"],["value","course-up"],["placeholder","Select AIS range...","formControlName","rangeIndex","name","rangeIndex","required",""],["value","0"],["value","1"],["value","2"],["value","3"],["value","4"],["value","5"],["name","showCogVectors","formControlName","showCogVectors"],["type","number","min","1","max","120","matInput","","placeholder","Enter or select duration...","name","cogVectorsMinutes","formControlName","cogVectorsMinutes"],["name","showUnconfirmedTargets","formControlName","showUnconfirmedTargets"],["name","showLostTargets","formControlName","showLostTargets"],["name","showSelf","formControlName","showSelf"],["placeholder","Select style...","formControlName","faceColor","name","faceColor"],["value","blackMetal"],["value","metal"],["value","shinyMetal"],["value","brass"],["value","steel"],["value","chrome"],["value","gold"],["value","anthracite"],["value","tiltedGray"],["value","tiltedBlack"],["value","glossyMetal"],["placeholder","Select style...","formControlName","backgroundColor","name","backgroundColor"],["value","darkGray"],["value","satinGray"],["value","lightGray"],["value","white"],["value","black"],["value","beige"],["value","brown"],["value","red"],["value","green"],["value","blue"],["value","mud"],["value","punchedSheet"],["value","carbon"],["value","stainless"],["value","brushedMetal"],["value","brushedStainless"],["value","turned"],["name","invertPitch","formControlName","invertPitch"],["name","invertRoll","formControlName","invertRoll"],["name","noFrameVisible","formControlName","noFrameVisible"],[1,"tab-content"],["mat-tab-label",""],[3,"addPath","updatePath","delPath","multiCtrlArray","zonesOnlyPaths"],[1,"warning","fa","fa-exclamation-circle"],["formGroupName","paths",3,"isArray","enableTimeout","dataTimeout","filterSelfPaths","addPathEvent","delPathEvent","updatePathEvent"],[1,"warning","material-icons"],["value","linear"],["value","radial"],["formControlName","digitalMeter","name","digitalMeter"],["placeholder","Select size...","formControlName","radialSize","name","radialSize"],["value","quarter"],["value","half"],["value","three-quarter"],["formControlName","putEnable","name","putEnable"],["formControlName","putMomentary","name","putMomentary"],["formControlName","putMomentaryValue","name","putMomentaryValue"],[3,"filterSelfPaths","datachartPath","datachartSource","convertUnitTo","timeScale","period"],["formGroupName","bms",1,"tab-content"],["formGroupName","solarCharger",1,"tab-content"]],template:function(t,i){t&1&&(d(0,"form",0),U("ngSubmit",function(){return i.submitConfig()}),d(1,"h6",1),c(2),u(),d(3,"mat-dialog-content",2)(4,"mat-tab-group",3)(5,"mat-tab",4),I(6,Zv,1,24,"config-display-chart-options",5)(7,Xv,1,0,"select-autopilot",6)(8,e1,44,43,"div",7),u(),I(9,t1,2,0,"mat-tab",8),I(10,n1,5,2,"mat-tab",9),I(11,o1,5,7,"mat-tab",10),I(12,l1,12,2,"mat-tab",11),I(13,c1,9,1,"mat-tab",12),I(14,h1,3,6,"mat-tab",13),I(15,p1,2,0,"mat-tab",14),I(16,g1,2,0,"mat-tab",15),u()(),W(17,"mat-divider"),d(18,"mat-dialog-actions")(19,"button",16),c(20,"Cancel"),u(),d(21,"button",17),c(22," Save "),u()()()),t&2&&(R("formGroup",i.formMaster),f(2),K(i.titleDialog),f(4),N((i.widgetConfig==null?null:i.widgetConfig.datachartPath)!==void 0?6:i.widgetConfig!=null&&i.widgetConfig.autopilot?7:8),f(3),N((i.widgetConfig==null?null:i.widgetConfig.ais)!==void 0?9:-1),f(),N((i.widgetConfig==null?null:i.widgetConfig.multiChildCtrls)!==void 0?10:-1),f(),N((i.widgetConfig==null?null:i.widgetConfig.paths)!==void 0?11:-1),f(),N((i.widgetConfig==null||i.widgetConfig.gauge==null?null:i.widgetConfig.gauge.type)==="steel"?12:-1),f(),N((i.widgetConfig==null?null:i.widgetConfig.putEnable)!==void 0&&(i.widgetConfig==null?null:i.widgetConfig.multiChildCtrls)===void 0?13:-1),f(),N((i.widgetConfig==null?null:i.widgetConfig.datachartPath)!==void 0?14:-1),f(),N(i.widgetConfig!=null&&i.widgetConfig.bms?15:-1),f(),N(i.widgetConfig!=null&&i.widgetConfig.solarCharger?16:-1),f(5),R("disabled",i.saveDisabled()))},dependencies:[It,Ya,gt,Ei,rt,Mt,kt,rn,Xa,ft,ut,si,Za,Ht,ki,Ti,Ln,Di,qt,bt,vt,$t,At,Mu,Su,wu,_u,li,Yt,Pi,jt,Nt,Qa,ln,sn,ot,wt,tm,Yu,Qu,ju,em,nm,bm,am,Am],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.widget-config-dialog-content[_ngcontent-%COMP%]{height:100%}.display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}.warning[_ngcontent-%COMP%]{color:var(--mat-sys-error-container)}.tab-group-content[_ngcontent-%COMP%]{overflow:hidden;width:100%}.flex-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;margin:15px 0;gap:15px;align-items:stretch}.panel-group[_ngcontent-%COMP%]{min-width:250px;flex-grow:1}"]})}return n})();var A1=["button"],y1=["*"];function x1(n,o){if(n&1&&(d(0,"div",2),W(1,"mat-pseudo-checkbox",6),u()),n&2){let e=k();f(),R("disabled",e.disabled)}}var Cm=new gn("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1})}),Sm=new gn("MatButtonToggleGroup"),C1={provide:Xr,useExisting:Pr(()=>Xo),multi:!0},bs=class{source;value;constructor(o,e){this.source=o,this.value=e}},Xo=(()=>{class n{_changeDetector=y(Si);_dir=y($r,{optional:!0});_multiple=!1;_disabled=!1;_disabledInteractive=!1;_selectionModel;_rawValue;_controlValueAccessorChangeFn=()=>{};_onTouched=()=>{};_buttonToggles;appearance;get name(){return this._name}set name(e){this._name=e,this._markButtonsForCheck()}_name=y(fa).getId("mat-button-toggle-group-");vertical=!1;get value(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e.map(t=>t.value):e[0]?e[0].value:void 0}set value(e){this._setSelectionByValue(e),this.valueChange.emit(this.value)}valueChange=new oi;get selected(){let e=this._selectionModel?this._selectionModel.selected:[];return this.multiple?e:e[0]||null}get multiple(){return this._multiple}set multiple(e){this._multiple=e,this._markButtonsForCheck()}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._markButtonsForCheck()}get disabledInteractive(){return this._disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e,this._markButtonsForCheck()}get dir(){return this._dir&&this._dir.value==="rtl"?"rtl":"ltr"}change=new oi;get hideSingleSelectionIndicator(){return this._hideSingleSelectionIndicator}set hideSingleSelectionIndicator(e){this._hideSingleSelectionIndicator=e,this._markButtonsForCheck()}_hideSingleSelectionIndicator;get hideMultipleSelectionIndicator(){return this._hideMultipleSelectionIndicator}set hideMultipleSelectionIndicator(e){this._hideMultipleSelectionIndicator=e,this._markButtonsForCheck()}_hideMultipleSelectionIndicator;constructor(){let e=y(Cm,{optional:!0});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??!1,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new bu(this.multiple,void 0,!1)}ngAfterContentInit(){this._selectionModel.select(...this._buttonToggles.filter(e=>e.checked)),this.multiple||this._initializeTabIndex()}writeValue(e){this.value=e,this._changeDetector.markForCheck()}registerOnChange(e){this._controlValueAccessorChangeFn=e}registerOnTouched(e){this._onTouched=e}setDisabledState(e){this.disabled=e}_keydown(e){if(this.multiple||this.disabled||Rn(e))return;let i=e.target.id,a=this._buttonToggles.toArray().findIndex(s=>s.buttonId===i),r=null;switch(e.keyCode){case 32:case 13:r=this._buttonToggles.get(a)||null;break;case 38:r=this._getNextButton(a,-1);break;case 37:r=this._getNextButton(a,this.dir==="ltr"?-1:1);break;case 40:r=this._getNextButton(a,1);break;case 39:r=this._getNextButton(a,this.dir==="ltr"?1:-1);break;default:return}r&&(e.preventDefault(),r._onButtonClick(),r.focus())}_emitChangeEvent(e){let t=new bs(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t)}_syncButtonToggle(e,t,i=!1,a=!1){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=!1),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):a=!0,a?Promise.resolve().then(()=>this._updateModelValue(e,i)):this._updateModelValue(e,i)}_isSelected(e){return this._selectionModel&&this._selectionModel.isSelected(e)}_isPrechecked(e){return typeof this._rawValue>"u"?!1:this.multiple&&Array.isArray(this._rawValue)?this._rawValue.some(t=>e.value!=null&&t===e.value):e.value===this._rawValue}_initializeTabIndex(){if(this._buttonToggles.forEach(e=>{e.tabIndex=-1}),this.selected)this.selected.tabIndex=0;else for(let e=0;e<this._buttonToggles.length;e++){let t=this._buttonToggles.get(e);if(!t.disabled){t.tabIndex=0;break}}}_getNextButton(e,t){let i=this._buttonToggles;for(let a=1;a<=i.length;a++){let r=(e+t*a+i.length)%i.length,s=i.get(r);if(s&&!s.disabled)return s}return null}_setSelectionByValue(e){if(this._rawValue=e,!this._buttonToggles)return;let t=this._buttonToggles.toArray();if(this.multiple&&e?(Array.isArray(e),this._clearSelection(),e.forEach(i=>this._selectValue(i,t))):(this._clearSelection(),this._selectValue(e,t)),!this.multiple&&t.every(i=>i.tabIndex===-1)){for(let i of t)if(!i.disabled){i.tabIndex=0;break}}}_clearSelection(){this._selectionModel.clear(),this._buttonToggles.forEach(e=>{e.checked=!1,this.multiple||(e.tabIndex=-1)})}_selectValue(e,t){for(let i of t)if(i.value===e){i.checked=!0,this._selectionModel.select(i),this.multiple||(i.tabIndex=0);break}}_updateModelValue(e,t){t&&this._emitChangeEvent(e),this.valueChange.emit(this.value)}_markButtonsForCheck(){this._buttonToggles?.forEach(e=>e._markForCheck())}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,i,a){if(t&1&&Gr(a,po,5),t&2){let r;xi(r=Ci())&&(i._buttonToggles=r)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,i){t&1&&U("keydown",function(r){return i._keydown(r)}),t&2&&(J("role",i.multiple?"group":"radiogroup")("aria-disabled",i.disabled),dt("mat-button-toggle-vertical",i.vertical)("mat-button-toggle-group-appearance-standard",i.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",St],value:"value",multiple:[2,"multiple","multiple",St],disabled:[2,"disabled","disabled",St],disabledInteractive:[2,"disabledInteractive","disabledInteractive",St],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",St],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",St]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[Go([C1,{provide:Sm,useExisting:n}])]})}return n})(),po=(()=>{class n{_changeDetectorRef=y(Si);_elementRef=y(Ke);_focusMonitor=y(Tc);_idGenerator=y(fa);_animationDisabled=tn();_checked=!1;ariaLabel;ariaLabelledby=null;_buttonElement;buttonToggleGroup;get buttonId(){return`${this.id}-button`}id;name;value;get tabIndex(){return this._tabIndex()}set tabIndex(e){this._tabIndex.set(e)}_tabIndex;disableRipple=!1;get appearance(){return this.buttonToggleGroup?this.buttonToggleGroup.appearance:this._appearance}set appearance(e){this._appearance=e}_appearance;get checked(){return this.buttonToggleGroup?this.buttonToggleGroup._isSelected(this):this._checked}set checked(e){e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&this.buttonToggleGroup._syncButtonToggle(this,this._checked),this._changeDetectorRef.markForCheck())}get disabled(){return this._disabled||this.buttonToggleGroup&&this.buttonToggleGroup.disabled}set disabled(e){this._disabled=e}_disabled=!1;get disabledInteractive(){return this._disabledInteractive||this.buttonToggleGroup!==null&&this.buttonToggleGroup.disabledInteractive}set disabledInteractive(e){this._disabledInteractive=e}_disabledInteractive;change=new oi;constructor(){y(Ur).load(Vc);let e=y(Sm,{optional:!0}),t=y(new Ac("tabindex"),{optional:!0})||"",i=y(Cm,{optional:!0});this._tabIndex=w(parseInt(t)||0),this.buttonToggleGroup=e,this._appearance=i&&i.appearance?i.appearance:"standard",this._disabledInteractive=i?.disabledInteractive??!1}ngOnInit(){let e=this.buttonToggleGroup;this.id=this.id||this._idGenerator.getId("mat-button-toggle-"),e&&(e._isPrechecked(this)?this.checked=!0:e._isSelected(this)!==this._checked&&e._syncButtonToggle(this,this._checked))}ngAfterViewInit(){this._animationDisabled||this._elementRef.nativeElement.classList.add("mat-button-toggle-animations-enabled"),this._focusMonitor.monitor(this._elementRef,!0)}ngOnDestroy(){let e=this.buttonToggleGroup;this._focusMonitor.stopMonitoring(this._elementRef),e&&e._isSelected(this)&&e._syncButtonToggle(this,!1,!1,!0)}focus(e){this._buttonElement.nativeElement.focus(e)}_onButtonClick(){if(this.disabled)return;let e=this.isSingleSelector()?!0:!this._checked;if(e!==this._checked&&(this._checked=e,this.buttonToggleGroup&&(this.buttonToggleGroup._syncButtonToggle(this,this._checked,!0),this.buttonToggleGroup._onTouched())),this.isSingleSelector()){let t=this.buttonToggleGroup._buttonToggles.find(i=>i.tabIndex===0);t&&(t.tabIndex=-1),this.tabIndex=0}this.change.emit(new bs(this,this.value))}_markForCheck(){this._changeDetectorRef.markForCheck()}_getButtonName(){return this.isSingleSelector()?this.buttonToggleGroup.name:this.name||null}isSingleSelector(){return this.buttonToggleGroup&&!this.buttonToggleGroup.multiple}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["mat-button-toggle"]],viewQuery:function(t,i){if(t&1&&Nn(A1,5),t&2){let a;xi(a=Ci())&&(i._buttonElement=a.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,i){t&1&&U("focus",function(){return i.focus()}),t&2&&(J("aria-label",null)("aria-labelledby",null)("id",i.id)("name",null),dt("mat-button-toggle-standalone",!i.buttonToggleGroup)("mat-button-toggle-checked",i.checked)("mat-button-toggle-disabled",i.disabled)("mat-button-toggle-disabled-interactive",i.disabledInteractive)("mat-button-toggle-appearance-standard",i.appearance==="standard"))},inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],id:"id",name:"name",value:"value",tabIndex:"tabIndex",disableRipple:[2,"disableRipple","disableRipple",St],appearance:"appearance",checked:[2,"checked","checked",St],disabled:[2,"disabled","disabled",St],disabledInteractive:[2,"disabledInteractive","disabledInteractive",St]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:y1,decls:7,vars:13,consts:[["button",""],["type","button",1,"mat-button-toggle-button","mat-focus-indicator",3,"click","id","disabled"],[1,"mat-button-toggle-checkbox-wrapper"],[1,"mat-button-toggle-label-content"],[1,"mat-button-toggle-focus-overlay"],["matRipple","",1,"mat-button-toggle-ripple",3,"matRippleTrigger","matRippleDisabled"],["state","checked","aria-hidden","true","appearance","minimal",3,"disabled"]],template:function(t,i){if(t&1&&(Wr(),d(0,"button",1,0),U("click",function(){return i._onButtonClick()}),I(2,x1,2,1,"div",2),d(3,"span",3),Fr(4),u()(),W(5,"span",4)(6,"span",5)),t&2){let a=Rt(1);R("id",i.buttonId)("disabled",i.disabled&&!i.disabledInteractive||null),J("role",i.isSingleSelector()?"radio":"button")("tabindex",i.disabled&&!i.disabledInteractive?-1:i.tabIndex)("aria-pressed",i.isSingleSelector()?null:i.checked)("aria-checked",i.isSingleSelector()?i.checked:null)("name",i._getButtonName())("aria-label",i.ariaLabel)("aria-labelledby",i.ariaLabelledby)("aria-disabled",i.disabled&&i.disabledInteractive?"true":null),f(2),N(i.buttonToggleGroup&&(!i.buttonToggleGroup.multiple&&!i.buttonToggleGroup.hideSingleSelectionIndicator||i.buttonToggleGroup.multiple&&!i.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),f(4),R("matRippleTrigger",a)("matRippleDisabled",i.disableRipple||i.disabled)}},dependencies:[Rc,mu],styles:[`.mat-button-toggle-standalone,.mat-button-toggle-group{position:relative;display:inline-flex;flex-direction:row;white-space:nowrap;overflow:hidden;-webkit-tap-highlight-color:rgba(0,0,0,0);border-radius:var(--mat-button-toggle-legacy-shape);transform:translateZ(0)}.mat-button-toggle-standalone:not([class*=mat-elevation-z]),.mat-button-toggle-group:not([class*=mat-elevation-z]){box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}@media(forced-colors: active){.mat-button-toggle-standalone,.mat-button-toggle-group{outline:solid 1px}}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{border-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard .mat-pseudo-checkbox,.mat-button-toggle-group-appearance-standard .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container))}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard:not([class*=mat-elevation-z]),.mat-button-toggle-group-appearance-standard:not([class*=mat-elevation-z]){box-shadow:none}@media(forced-colors: active){.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,.mat-button-toggle-group-appearance-standard{outline:0}}.mat-button-toggle-vertical{flex-direction:column}.mat-button-toggle-vertical .mat-button-toggle-label-content{display:block}.mat-button-toggle{white-space:nowrap;position:relative;color:var(--mat-button-toggle-legacy-text-color);font-family:var(--mat-button-toggle-legacy-label-text-font);font-size:var(--mat-button-toggle-legacy-label-text-size);line-height:var(--mat-button-toggle-legacy-label-text-line-height);font-weight:var(--mat-button-toggle-legacy-label-text-weight);letter-spacing:var(--mat-button-toggle-legacy-label-text-tracking);--mat-pseudo-checkbox-minimal-selected-checkmark-color: var(--mat-button-toggle-legacy-selected-state-text-color)}.mat-button-toggle.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-legacy-focus-state-layer-opacity)}.mat-button-toggle .mat-icon svg{vertical-align:top}.mat-button-toggle-checkbox-wrapper{display:inline-block;justify-content:flex-start;align-items:center;width:0;height:18px;line-height:18px;overflow:hidden;box-sizing:border-box;position:absolute;top:50%;left:16px;transform:translate3d(0, -50%, 0)}[dir=rtl] .mat-button-toggle-checkbox-wrapper{left:auto;right:16px}.mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:12px}[dir=rtl] .mat-button-toggle-appearance-standard .mat-button-toggle-checkbox-wrapper{left:auto;right:12px}.mat-button-toggle-checked .mat-button-toggle-checkbox-wrapper{width:18px}.mat-button-toggle-animations-enabled .mat-button-toggle-checkbox-wrapper{transition:width 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-checkbox-wrapper{transition:none}.mat-button-toggle-checked{color:var(--mat-button-toggle-legacy-selected-state-text-color);background-color:var(--mat-button-toggle-legacy-selected-state-background-color)}.mat-button-toggle-disabled{pointer-events:none;color:var(--mat-button-toggle-legacy-disabled-state-text-color);background-color:var(--mat-button-toggle-legacy-disabled-state-background-color);--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-legacy-disabled-state-text-color)}.mat-button-toggle-disabled.mat-button-toggle-checked{background-color:var(--mat-button-toggle-legacy-disabled-selected-state-background-color)}.mat-button-toggle-disabled-interactive{pointer-events:auto}.mat-button-toggle-appearance-standard{color:var(--mat-button-toggle-text-color, var(--mat-sys-on-surface));background-color:var(--mat-button-toggle-background-color, transparent);font-family:var(--mat-button-toggle-label-text-font, var(--mat-sys-label-large-font));font-size:var(--mat-button-toggle-label-text-size, var(--mat-sys-label-large-size));line-height:var(--mat-button-toggle-label-text-line-height, var(--mat-sys-label-large-line-height));font-weight:var(--mat-button-toggle-label-text-weight, var(--mat-sys-label-large-weight));letter-spacing:var(--mat-button-toggle-label-text-tracking, var(--mat-sys-label-large-tracking))}.mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}[dir=rtl] .mat-button-toggle-group-appearance-standard .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle-appearance-standard+.mat-button-toggle-appearance-standard{border-left:none;border-right:none;border-top:solid 1px var(--mat-button-toggle-divider-color, var(--mat-sys-outline))}.mat-button-toggle-appearance-standard.mat-button-toggle-checked{color:var(--mat-button-toggle-selected-state-text-color, var(--mat-sys-on-secondary-container));background-color:var(--mat-button-toggle-selected-state-background-color, var(--mat-sys-secondary-container))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled{color:var(--mat-button-toggle-disabled-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-state-background-color, transparent)}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled .mat-pseudo-checkbox{--mat-pseudo-checkbox-minimal-disabled-selected-checkmark-color: var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-button-toggle-appearance-standard.mat-button-toggle-disabled.mat-button-toggle-checked{color:var(--mat-button-toggle-disabled-selected-state-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent));background-color:var(--mat-button-toggle-disabled-selected-state-background-color, color-mix(in srgb, var(--mat-sys-on-surface) 12%, transparent))}.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{background-color:var(--mat-button-toggle-state-layer-color, var(--mat-sys-on-surface))}.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-hover-state-layer-opacity, var(--mat-sys-hover-state-layer-opacity))}.mat-button-toggle-appearance-standard.cdk-keyboard-focused .mat-button-toggle-focus-overlay{opacity:var(--mat-button-toggle-focus-state-layer-opacity, var(--mat-sys-focus-state-layer-opacity))}@media(hover: none){.mat-button-toggle-appearance-standard:hover .mat-button-toggle-focus-overlay{display:none}}.mat-button-toggle-label-content{-webkit-user-select:none;user-select:none;display:inline-block;padding:0 16px;line-height:var(--mat-button-toggle-legacy-height);position:relative}.mat-button-toggle-appearance-standard .mat-button-toggle-label-content{padding:0 12px;line-height:var(--mat-button-toggle-height, 40px)}.mat-button-toggle-label-content>*{vertical-align:middle}.mat-button-toggle-focus-overlay{top:0;left:0;right:0;bottom:0;position:absolute;border-radius:inherit;pointer-events:none;opacity:0;background-color:var(--mat-button-toggle-legacy-state-layer-color)}@media(forced-colors: active){.mat-button-toggle-checked .mat-button-toggle-focus-overlay{border-bottom:solid 500px;opacity:.5;height:0}.mat-button-toggle-checked:hover .mat-button-toggle-focus-overlay{opacity:.6}.mat-button-toggle-checked.mat-button-toggle-appearance-standard .mat-button-toggle-focus-overlay{border-bottom:solid 500px}}.mat-button-toggle .mat-button-toggle-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-button-toggle-button{border:0;background:none;color:inherit;padding:0;margin:0;font:inherit;outline:none;width:100%;cursor:pointer}.mat-button-toggle-animations-enabled .mat-button-toggle-button{transition:padding 150ms 45ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-button-toggle-vertical .mat-button-toggle-button{transition:none}.mat-button-toggle-disabled .mat-button-toggle-button{cursor:default}.mat-button-toggle-button::-moz-focus-inner{border:0}.mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:30px}[dir=rtl] .mat-button-toggle-checked .mat-button-toggle-button:has(.mat-button-toggle-checkbox-wrapper){padding-left:0;padding-right:30px}.mat-button-toggle-standalone.mat-button-toggle-appearance-standard{--mat-focus-indicator-border-radius: var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard:not(.mat-button-toggle-vertical) .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:last-of-type .mat-button-toggle-button::before{border-bottom-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-bottom-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical .mat-button-toggle:first-of-type .mat-button-toggle-button::before{border-top-right-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large));border-top-left-radius:var(--mat-button-toggle-shape, var(--mat-sys-corner-extra-large))}
44
- `],encapsulation:2,changeDetection:0})}return n})(),As=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ki({type:n});static \u0275inj=Xi({imports:[Lc,po,Vn]})}return n})();var S1="3.5.1";function Bl(n,o,e){return Math.min(Math.max(n,o),e)}function xt(n,o){let e=n.options.realtime,t=n.chart.options.plugins?.streaming;return Cn(e?.[o],t?.[o])}function zl(n,{x:o,y:e},{xAxisID:t,yAxisID:i}){let a={};for(let r=0,s=o.length;r<s;++r)a[o[r]]={axisId:t};for(let r=0,s=e.length;r<s;++r)a[e[r]]={axisId:i};return a}var w1=typeof window>"u"?va:window.cancelAnimationFrame;function _m(n){let o=n.frameRequestID;o&&(w1.call(window,o),delete n.frameRequestID)}function Dm(n){let o=n.refreshTimerID;o&&(clearInterval(o),delete n.refreshTimerID,delete n.refreshInterval)}function Em(n,o,e){n.refreshTimerID||(n.refreshTimerID=setInterval(()=>{if(typeof document<"u"&&document.hidden)return;let t=dn(o,[],n);n.refreshInterval===t||isNaN(t)||(Dm(n),Em(n,o,t))},e||0),n.refreshInterval=e||0)}function Hi(n,o,e){return o=typeof o=="number"?o:n.parse(o),ba(o)?{value:n.getPixelForValue(o),transitionable:!0}:{value:e,transitionable:!1}}function _1(){let n=no.getElement("boxAnnotation"),o=no.getElement("lineAnnotation"),e=no.getElement("pointAnnotation");if(!n||!o||!e)return;let t=n.prototype.resolveElementProperties,i=o.prototype.resolveElementProperties,a=e.prototype.resolveElementProperties;n.prototype.resolveElementProperties=function(r,s){return(function(l,m,g){let{scales:v,chartArea:A}=m,{xScaleID:C,yScaleID:_,xMin:M,xMax:B,yMin:D,yMax:V}=g,F=v[C],Y=v[_],{top:j,left:Ce,bottom:me,right:ae}=A,se=l.$streaming={};if(F){let ce=Hi(F,M,Ce),oe=Hi(F,B,ae),de=ce.value>oe.value;ce.transitionable&&(se[de?"x2":"x"]={axisId:C}),oe.transitionable&&(se[de?"x":"x2"]={axisId:C}),ce.transitionable!==oe.transitionable&&(se.width={axisId:C,reverse:ce.transitionable})}if(Y){let ce=Hi(Y,D,j),oe=Hi(Y,V,me),de=ce.value>oe.value;ce.transitionable&&(se[de?"y2":"y"]={axisId:_}),oe.transitionable&&(se[de?"y":"y2"]={axisId:_}),ce.transitionable!==oe.transitionable&&(se.height={axisId:_,reverse:ce.transitionable})}})(this,r,s),t.call(this,r,s)},o.prototype.resolveElementProperties=function(r,s){let l=r.chartArea;r.chartArea=(function(g,v,A){let{scales:C,chartArea:_}=v,{scaleID:M,value:B}=A,D=C[M],{top:V,left:F,bottom:Y,right:j}=_,Ce=g.$streaming={};if(D){let st=D.isHorizontal();return Hi(D,B,0).transitionable&&(Ce[st?"x":"y"]={axisId:M},Ce[st?"x2":"y2"]={axisId:M}),st?{top:V,bottom:Y}:{left:F,right:j}}let{xScaleID:me,yScaleID:ae,xMin:se,xMax:ce,yMin:oe,yMax:de}=A,le=C[me],be=C[ae],Ue={};if(le){let st=Hi(le,se,F),Dt=Hi(le,ce,j);st.transitionable?Ce.x={axisId:me}:Ue.left=F,Dt.transitionable?Ce.x2={axisId:me}:Ue.right=j}if(be){let st=Hi(be,oe,V),Dt=Hi(be,de,Y);st.transitionable?Ce.y={axisId:ae}:Ue.top=V,Dt.transitionable?Ce.y2={axisId:ae}:Ue.bottom=Y}return Ue})(this,r,s);let m=i.call(this,r,s);return r.chartArea=l,m},e.prototype.resolveElementProperties=function(r,s){return(function(l,m,g){let v=m.scales,{xScaleID:A,yScaleID:C,xValue:_,yValue:M}=g,B=v[A],D=v[C],V=l.$streaming={};B&&Hi(B,_,0).transitionable&&(V.x={axisId:A}),D&&Hi(D,M,0).transitionable&&(V.y={axisId:C})})(this,r,s),a.call(this,r,s)}}var M1={x:["x","caretX"],y:["y","caretY"]};function k1(...n){let o=this,e=o.getActiveElements()[0];if(e){let t=o.chart.getDatasetMeta(e.datasetIndex);o.$streaming=zl(0,M1,t)}else o.$streaming={};o.constructor.prototype.update.call(o,...n)}var Ul=new WeakMap;function Hl(n){let{originalScaleOptions:o}=(function(t){let i=Ul.get(t);return i||(i={originalScaleOptions:{}},Ul.set(t,i)),i})(n),e=n.scales;return cn(e,t=>{let i=t.id;o[i]||(o[i]={duration:xt(t,"duration"),delay:xt(t,"delay")})}),cn(o,(t,i)=>{e&&e[i]||delete o[i]}),o}function T1(n,o,e,t){let{chart:i}=n,a=n.id,{minDuration:r=0,maxDuration:s=1/0,minDelay:l=-1/0,maxDelay:m=1/0}=t?.[a]||{},g=n.options.realtime,v=xt(n,"duration"),A=xt(n,"delay"),C=Bl(v*(2-o),r,s),_,M;return Hl(i),_=n.isHorizontal()?(n.right-e.x)/(n.right-n.left):(n.bottom-e.y)/(n.bottom-n.top),M=A+_*(v-C),g.duration=C,g.delay=Bl(M,l,m),C!==n.max-n.min}function D1(n,o,e){let{chart:t}=n,i=n.id,{minDelay:a=-1/0,maxDelay:r=1/0}=e?.[i]||{},s=xt(n,"delay")+((n.getValueForPixel(o)||0)-(n.getValueForPixel(0)||0));return Hl(t),n.options.realtime.delay=Bl(s,a,r),!0}function E1(n,o){let e=o.$streaming;if(e.zoomPlugin!==n){let t=e.resetZoom=o.resetZoom;(function(i){i.zoomFunctions.realtime=T1,i.panFunctions.realtime=D1})(n),o.resetZoom=i=>{(function(a){let r=Hl(a);cn(a.scales,s=>{let l=s.options.realtime;if(l){let m=r[s.id];m?(l.duration=m.duration,l.delay=m.delay):(delete l.duration,delete l.delay)}})})(o),t(i)},e.zoomPlugin=n}}function P1(n){let o=n.$streaming;o.zoomPlugin&&(n.resetZoom=o.resetZoom,(function(e){Ul.delete(e)})(n),delete o.resetZoom,delete o.zoomPlugin)}var Qo={millisecond:{common:!0,size:1,steps:[1,2,5,10,20,50,100,250,500]},second:{common:!0,size:1e3,steps:[1,2,5,10,15,30]},minute:{common:!0,size:6e4,steps:[1,2,5,10,15,30]},hour:{common:!0,size:36e5,steps:[1,2,3,6,12]},day:{common:!0,size:864e5,steps:[1,2,5]},week:{common:!1,size:6048e5,steps:[1,2,3,4]},month:{common:!0,size:2628e6,steps:[1,2,3]},quarter:{common:!1,size:7884e6,steps:[1,2,3,4]},year:{common:!0,size:3154e7}},Ca=Object.keys(Qo);function Mm(n,o,e){if(e){if(e.length){let{lo:t,hi:i}=Ml(e,o);n[e[t]>=o?e[t]:e[i]]=!0}}else n[o]=!0}var km=["pointBackgroundColor","pointBorderColor","pointBorderWidth","pointRadius","pointRotation","pointStyle","pointHitRadius","pointHoverBackgroundColor","pointHoverBorderColor","pointHoverBorderWidth","pointHoverRadius","backgroundColor","borderColor","borderSkipped","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","radius","rotation"];function ys(n,o,e){let t=n.$streaming;if(!t)return;let i=n.$animations||{},a=e;for(let r in t){let s=t[r];if(s.axisId===o){let l=s.reverse?-a:a,m=i[r];ba(n[r])&&(n[r]-=l),m&&(m._from-=l,m._to-=l)}}}var Sn=class extends un{constructor(o){super(o),this.$realtime={}}init(o,e){let t=this;super.init.call(t,o),(function(i){if(typeof console<"u"&&console.warn){let a=xt(i,"duration"),r=xt(i,"delay"),s=xt(i,"frameRate"),l=xt(i,"refresh");(typeof a!="number"||a<=0)&&console.warn("Chart streaming: duration should be a positive number"),typeof r!="number"&&console.warn("Chart streaming: delay should be a number"),(typeof s!="number"||s<=0)&&console.warn("Chart streaming: frameRate should be a positive number"),(typeof l!="number"||l<=0)&&console.warn("Chart streaming: refresh should be a positive number")}})(t),Em(t.$realtime,()=>{let i=t.chart;try{let a=xt(t,"onRefresh");return typeof a=="function"&&dn(a,[i],t),(function(r){let{chart:s,id:l,max:m}=r,g=xt(r,"duration"),v=xt(r,"delay"),A=xt(r,"ttl"),C=xt(r,"pause"),_=Date.now()-(isNaN(A)?g+v:A),M,B,D,V;cn(s.data.datasets,(F,Y)=>{let j=s.getDatasetMeta(Y),Ce=l===j.xAxisID?"x":l===j.yAxisID&&"y";if(Ce){let me=j.controller,ae=F.data,se=ae.length;if(C){for(M=0;M<se;++M){let ce=me.getParsed&&typeof me.getParsed=="function"?me.getParsed(M):Array.isArray(ae[M])?{x:ae[M][0],y:ae[M][1]}:ae[M];if(ce&&!(ce[Ce]<m))break}B=M+2}else B=0;for(M=B;M<se;++M){let ce=me.getParsed&&typeof me.getParsed=="function"?me.getParsed(M):Array.isArray(ae[M])?{x:ae[M][0],y:ae[M][1]}:ae[M];if(!(ce&&ce[Ce]<=_))break}if(D=M-B,isNaN(A)&&(D=Math.max(D-2,0)),D>0){ae.splice(B,D);for(let de=0,le=km.length;de<le;++de){let be=km[de];Bi(F[be])&&F[be].splice(B,D)}let ce=F.datalabels;if(ce)for(let de in ce)Bi(ce[de])&&ce[de].splice(B,D);typeof ae[0]!="object"&&(V={start:B,count:D});let oe=s._active;if(oe&&oe.length>0)for(let de=oe.length-1;de>=0;de--){let le=oe[de];le.datasetIndex===Y&&(le.index>=B+D?le.index-=D:le.index>=B&&oe.splice(de,1))}}}}),V&&s.data.labels?.splice(V.start,V.count)})(t),i.update("quiet"),xt(t,"refresh")}catch(a){return typeof console<"u"&&console.error&&console.error("Error in streaming refresh:",a),1e3}})}update(o,e,t){let i=this,{$realtime:a,options:r}=i,{bounds:s,offset:l,ticks:m}=r,{autoSkip:g,source:v,major:A}=m,C=A.enabled;xt(i,"pause")?_m(a):(a.frameRequestID||(a.head=Date.now()),(function(_,M){if(!_.frameRequestID){let B=()=>{if(typeof document<"u"&&document.hidden)return void(_.frameRequestID=Ho.call(window,B));let D=_.nextRefresh||0,V=Date.now();if(D<=V){let F=dn(M,[],_),Y=1e3/(Math.max(F,0)||30),j=(_.nextRefresh||0)+Y||0;_.nextRefresh=j>V?j:V+Y}_.frameRequestID=Ho.call(window,B)};_.frameRequestID=Ho.call(window,B)}})(a,()=>{let _=i.chart,M=_.$streaming;return(function(B){let{chart:D,id:V,$realtime:F}=B,Y=xt(B,"duration"),j=xt(B,"delay"),Ce=B.isHorizontal(),me=Ce?B.width:B.height,ae=Date.now(),se=D.tooltip,ce=(function(be){let Ue=be.$streaming?.annotationPlugin;return Ue?Ue.getAnnotations(be):[]})(D),oe=me*(ae-F.head)/Y;Ce===!!B.options.reverse&&(oe=-oe);let de=D.data.datasets.length;for(let be=0;be<de;++be){let Ue=D.getDatasetMeta(be),{data:st=[],dataset:Dt}=Ue,Qt=st.length;for(let pi=0;pi<Qt;++pi)ys(st[pi],V,oe);Dt&&(ys(Dt,V,oe),delete Dt._path)}let le=ce.length;for(let be=0;be<le;++be)ys(ce[be],V,oe);se&&ys(se,V,oe),B.max=ae-j,B.min=B.max-Y,F.head=ae})(i),M&&dn(M.render,[_]),xt(i,"frameRate")})),r.bounds=void 0,r.offset=!1,m.autoSkip=!1,m.source=v==="auto"?"":v,A.enabled=!0,super.update.call(i,o,e,t),r.bounds=s,r.offset=l,m.autoSkip=g,m.source=v,A.enabled=C}buildTicks(){let o=this,e=xt(o,"duration"),t=xt(o,"delay"),i=o.$realtime.head-t,a=i-e,r=[1e15,i],s=[-1e15,a];Object.defineProperty(o,"min",{get:()=>s.shift(),set:va,configurable:!0}),Object.defineProperty(o,"max",{get:()=>r.shift(),set:va,configurable:!0});let l=super.buildTicks.call(o);return delete o.min,delete o.max,o.min=a,o.max=i,l}calculateLabelRotation(){let o=this.options.ticks,e=o.maxRotation;o.maxRotation=o.minRotation||0,super.calculateLabelRotation.call(this),o.maxRotation=e}fit(){let o=this,e=o.options;super.fit.call(o),e.ticks.display&&e.display&&o.isHorizontal()&&(o.paddingLeft=3,o.paddingRight=3,o._handleMargins())}draw(o){let e=this,{chart:t,ctx:i}=e,a=e.isHorizontal()?{left:o.left,top:0,right:o.right,bottom:t.height}:{left:0,top:o.top,right:t.width,bottom:o.bottom};e._gridLineItems=null,e._labelItems=null,eo(i,a),super.draw.call(e,o),to(i)}destroy(){let o=this.$realtime;_m(o),Dm(o)}_generate(){let o=this,e=o._adapter,t=xt(o,"duration"),i=xt(o,"delay"),a=xt(o,"refresh"),r=o.$realtime.head-i,s=r-t,l=o._getLabelCapacity(s),{time:m,ticks:g}=o.options,v=m.unit||(function(me,ae,se,ce){let oe=se-ae,de=Ca.length;for(let le=Ca.indexOf(me);le<de-1;++le){let be=Ca[le],Ue=Qo[be];if(!Ue)continue;let{common:st,size:Dt,steps:Qt}=Ue,pi=Qt?Qt[Qt.length-1]:Number.MAX_SAFE_INTEGER;if(st&&Math.ceil(oe/(pi*Dt))<=ce)return be}return Ca[de-1]})(m.minUnit,s,r,l),A=(function(me){for(let ae=Ca.indexOf(me)+1,se=Ca.length;ae<se;++ae){let ce=Ca[ae];if(Qo[ce]?.common)return ce}})(v),C=m.stepSize||(function(me,ae,se,ce){let oe=ae-me,de=Qo[se];if(!de)return 1;let{size:le,steps:be}=de,Ue=1;if(!be)return Math.ceil(oe/(ce*le));for(let st=0,Dt=be.length;st<Dt&&(Ue=be[st],!(Math.ceil(oe/(le*Ue))<=ce));++st);return Ue||1})(s,r,v,l),_=v==="week"&&m.isoWeekday,M=g.major.enabled,B=Ja(_)||_===!0,D=Qo[v],V={},F,Y,j=s;if(B&&(j=+e.startOf(j,"isoWeek",_)),j=+e.startOf(j,B?"day":v),e.diff(r,s,v)>1e5*C)throw new Error(s+" and "+r+" are too far apart with stepSize of "+C+" "+v);F=j,M&&A&&!B&&!m.round&&(F=+e.startOf(F,A),F=+e.add(F,~~((j-F)/(D.size*C))*C,v));let Ce=g.source==="data"&&o.getDataTimestamps();for(Y=0;F<r+a;F=+e.add(F,C,v),Y++)Mm(V,F,Ce);return F!==r+a&&Y!==1||Mm(V,F,Ce),Object.keys(V).sort((me,ae)=>+me-+ae).map(me=>+me)}};Sn.id="realtime",Sn.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},realtime:{},ticks:{autoSkip:!1,source:"auto",major:{enabled:!0}}},qo.describe("scale.realtime",{_scriptable:n=>n!=="onRefresh"});var I1=S1;qo.set("transitions",{quiet:{animation:{duration:0}}});var Tm={x:["x","cp1x","cp2x"],y:["y","cp1y","cp2y"]};function N1(n){let o=this;n==="quiet"&&cn(o.data.datasets,(e,t)=>{let i=o.getDatasetMeta(t).controller;i&&(i._setStyle=function(a,r,s,l){Tu.prototype._setStyle.call(this,a,r,"quiet",l)})}),Ct.prototype.update.call(o,n),n==="quiet"&&cn(o.data.datasets,(e,t)=>{let i=o.getDatasetMeta(t).controller;i&&delete i._setStyle})}function O1(n){let o=n.$streaming;n.render(),o.lastMouseEvent&&setTimeout(()=>{let e=o.lastMouseEvent;e&&n._eventHandler(e)},0)}var R1={id:"streaming",version:I1,beforeInit(n){let o=n.$streaming=n.$streaming||{render:O1},e=o.canvas=n.canvas,t=o.mouseEventListener=i=>{let a=Dl(i,n);o.lastMouseEvent={type:"mousemove",chart:n,native:i,x:a.x,y:a.y}};if(e.addEventListener("mousedown",t),e.addEventListener("mouseup",t),typeof document<"u"&&document.addEventListener){let i=()=>{if(!document.hidden){let a=n.scales;a&&Object.keys(a).forEach(r=>{let s=a[r];s&&s instanceof Sn&&s.$realtime&&(s.$realtime.head=Date.now())})}};document.addEventListener("visibilitychange",i),o.visibilityChangeListener=i}},afterInit(n){n.update=N1},beforeUpdate(n){let{scales:o,elements:e}=n.options,t=n.tooltip;o&&cn(o,i=>{i?.type==="realtime"&&e&&(e.line.capBezierPoints=!1)}),t&&(t.update=k1);try{let i=no.getPlugin("annotation");i&&(function(a,r){let s=r.$streaming;if(s.annotationPlugin!==a){let l=a.afterUpdate;_1(),s.annotationPlugin=a,a.afterUpdate=function(m,g,v){let A=g.mode,C=v.animation;A==="quiet"&&(v.animation=!1),l.call(this,m,g,v),A==="quiet"&&(v.animation=C)}}})(i,n)}catch(i){(function(a){delete a.$streaming.annotationPlugin})(n)}try{let i=no.getPlugin("zoom");i&&E1(i,n)}catch(i){P1(n)}},beforeDatasetUpdate(n,o){let{meta:e,mode:t}=o;if(t==="quiet"){let{controller:i,$animations:a}=e;a&&a.visible&&a.visible._active&&(i.updateElement=va,i.updateSharedOptions=va)}},afterDatasetUpdate(n,o){let{meta:e,mode:t}=o,{data:i=[],dataset:a,controller:r}=e;for(let s=0,l=i.length;s<l;++s)i[s].$streaming=zl(i[s],Tm,e);a&&(a.$streaming=zl(0,Tm,e)),t==="quiet"&&(delete r.updateElement,delete r.updateSharedOptions)},beforeDatasetDraw(n,o){let{ctx:e,chartArea:t,width:i,height:a}=n,{xAxisID:r,yAxisID:s,controller:l}=o.meta,m={left:0,top:0,right:i,bottom:a};r&&l.getScaleForId(r)instanceof Sn&&(m.left=t.left,m.right=t.right),s&&l.getScaleForId(s)instanceof Sn&&(m.top=t.top,m.bottom=t.bottom),eo(e,m)},afterDatasetDraw(n){to(n.ctx)},beforeEvent(n,o){let e=n.$streaming,t=o.event;t?.type==="mousemove"?e.lastMouseEvent=t:t?.type==="mouseout"&&delete e.lastMouseEvent},afterDestroy(n){let{scales:o,tooltip:e}=n,t=n.$streaming,{canvas:i,mouseEventListener:a,visibilityChangeListener:r}=t;delete n.update,e&&delete e.update,i.removeEventListener("mousedown",a),i.removeEventListener("mouseup",a),r&&typeof document<"u"&&document.removeEventListener&&document.removeEventListener("visibilitychange",r),cn(o,s=>{s instanceof Sn&&s.destroy()})},defaults:{duration:1e4,delay:0,frameRate:30,refresh:1e3,onRefresh:null,pause:!1,ttl:void 0},descriptors:{_scriptable:n=>n!=="onRefresh"}},Sa=[R1,Sn];Ct.register(Sa);var V1=["widgetDataChart"];Ct.register(Sa,un,Zn,qn,Yn,jn,ao,Iu);var xs=(()=>{class n{theme=x.required();color=null;dataPath=null;dataSource=null;convertUnitTo=null;numDecimal=null;yScaleMin=null;yScaleMax=null;inverseYAxis=!1;verticalChart=null;datasetUUID=null;unitsService=y(it);dsService=y(mn);ngZone=y(qe);canvasService=y(ht);widgetDataChart=he("widgetDataChart",{read:Ke});lineChartData={datasets:[]};lineChartOptions={parsing:!1,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;isDestroyed=!1;lastChartSignature=null;config={datasetAverageArray:"sma",showAverageData:!1,trackAgainstAverage:!1,startScaleAtZero:!1,yScaleSuggestedMin:null,yScaleSuggestedMax:null,enableMinMaxScaleLimit:!1};constructor(){L(()=>{this.theme()&&G(()=>{this.datasetConfig&&(this.setChartOptions(),this.setDatasetsColors())})})}startChart(){if(!(this.isDestroyed||!this.datasetUUID)&&(this.datasetConfig=this.dsService.getDatasetConfig(this.datasetUUID),this.dataSourceInfo=this.dsService.getDataSourceInfo(this.datasetUUID),this.datasetConfig)){let e=this.buildChartSignature();if(this.chart&&e===this.lastChartSignature)return;this.chart&&e!==this.lastChartSignature&&this.destroyChart(),this.setChartOptions(),this.createDatasets();let i=this.widgetDataChart()?.nativeElement?.getContext("2d");if(!i)return;this.chart=new Ct(i,{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.lastChartSignature=e,this.startStreaming()}}buildChartSignature(){return[this.datasetUUID,this.dataPath,this.dataSource,this.convertUnitTo,this.numDecimal,this.yScaleMin,this.yScaleMax,this.inverseYAxis?"1":"0",this.verticalChart?"1":"0",this.color].join("|")}setChartOptions(){this.lineChartOptions.maintainAspectRatio=!1,this.lineChartOptions.animation=!1,this.lineChartOptions.indexAxis=this.verticalChart?"y":"x",this.verticalChart?this.lineChartOptions.scales={x:{display:!1,position:"right",suggestedMin:this.config.enableMinMaxScaleLimit?null:this.yScaleMin,suggestedMax:this.config.enableMinMaxScaleLimit?null:this.yScaleMax,min:this.config.enableMinMaxScaleLimit?this.yScaleMin:null,max:this.config.enableMinMaxScaleLimit?this.yScaleMax:null,beginAtZero:this.config.startScaleAtZero,reverse:this.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center"},ticks:{maxTicksLimit:8,precision:this.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}},y:{type:"realtime",display:!1,title:{display:!1},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!1,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:!1,title:{display:!1},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!1,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}},y:{display:!1,position:"right",suggestedMin:this.config.enableMinMaxScaleLimit?null:this.yScaleMin,suggestedMax:this.config.enableMinMaxScaleLimit?null:this.yScaleMax,min:this.config.enableMinMaxScaleLimit?this.yScaleMin:null,max:this.config.enableMinMaxScaleLimit?this.yScaleMax:null,beginAtZero:this.config.startScaleAtZero,reverse:this.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center"},ticks:{maxTicksLimit:8,precision:this.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!1,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={legend:{display:!1},streaming:{duration:this.dataSourceInfo.maxDataPoints*this.dataSourceInfo.sampleTime,delay:this.dataSourceInfo.sampleTime,frameRate:this.datasetConfig.timeScaleFormat==="day"?5:this.datasetConfig.timeScaleFormat==="hour"?8:this.datasetConfig.timeScaleFormat==="minute"?15:30}}}createDatasets(){let e=this.lineChartOptions.scales?.y?.reverse?"start":!0;this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:0,parsing:!1,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:e}),this.lineChartData.datasets.push({label:"Average",data:[],order:1,parsing:!1,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:e}),this.setDatasetsColors()}setDatasetsColors(){this.lineChartData.datasets.forEach(e=>{e.borderColor=this.getThemeColors().averageLine,e.backgroundColor=this.getThemeColors().averageFill})}getThemeColors(){let e=this.color,t={valueLine:null,valueFill:null,averageLine:null,averageFill:null,averageChartLine:null,chartLabel:null,chartValue:null};switch(e){case"contrast":this.config.trackAgainstAverage?(t.valueLine=this.theme().contrastDimmer,t.valueFill=this.theme().contrastDimmer,t.averageLine=this.theme().contrast,t.averageFill=this.theme().contrast,t.chartValue=t.averageLine):(t.valueLine=this.theme().contrast,t.valueFill=this.theme().contrast,t.averageLine=this.theme().contrastDimmer,t.averageFill=this.theme().contrastDimmer,t.chartValue=this.theme().contrast),t.averageChartLine=this.theme().contrastDim,t.chartLabel=this.theme().contrastDim;break;case"blue":this.config.trackAgainstAverage?(t.valueLine=this.theme().blueDimmer,t.valueFill=this.theme().blueDimmer,t.averageLine=this.theme().blue,t.averageFill=this.theme().blue,t.chartValue=t.averageLine):(t.valueLine=this.theme().blue,t.valueFill=this.theme().blue,t.averageLine=this.theme().blueDimmer,t.averageFill=this.theme().blueDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().blueDim,t.chartLabel=this.theme().contrastDim;break;case"green":this.config.trackAgainstAverage?(t.valueLine=this.theme().greenDimmer,t.valueFill=this.theme().greenDimmer,t.averageLine=this.theme().green,t.averageFill=this.theme().green,t.chartValue=t.averageLine):(t.valueLine=this.theme().green,t.valueFill=this.theme().green,t.averageLine=this.theme().greenDimmer,t.averageFill=this.theme().greenDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greenDim,t.chartLabel=this.theme().contrastDim;break;case"pink":this.config.trackAgainstAverage?(t.valueLine=this.theme().pinkDimmer,t.valueFill=this.theme().pinkDimmer,t.averageLine=this.theme().pink,t.averageFill=this.theme().pink,t.chartValue=t.averageLine):(t.valueLine=this.theme().pink,t.valueFill=this.theme().pink,t.averageLine=this.theme().pinkDimmer,t.averageFill=this.theme().pinkDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().pinkDim,t.chartLabel=this.theme().contrastDim;break;case"orange":this.config.trackAgainstAverage?(t.valueLine=this.theme().orangeDimmer,t.valueFill=this.theme().orangeDimmer,t.averageLine=this.theme().orange,t.averageFill=this.theme().orange,t.chartValue=t.averageLine):(t.valueLine=this.theme().orange,t.valueFill=this.theme().orange,t.averageLine=this.theme().orangeDimmer,t.averageFill=this.theme().orangeDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().orangeDim,t.chartLabel=this.theme().contrastDim;break;case"purple":this.config.trackAgainstAverage?(t.valueLine=this.theme().purpleDimmer,t.valueFill=this.theme().purpleDimmer,t.averageLine=this.theme().purple,t.averageFill=this.theme().purple,t.chartValue=t.averageLine):(t.valueLine=this.theme().purple,t.valueFill=this.theme().purple,t.averageLine=this.theme().purpleDimmer,t.averageFill=this.theme().purpleDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().purpleDim,t.chartLabel=this.theme().contrastDim;break;case"grey":this.config.trackAgainstAverage?(t.valueLine=this.theme().greyDimmer,t.valueFill=this.theme().greyDimmer,t.averageLine=this.theme().grey,t.averageFill=this.theme().grey,t.chartValue=t.averageLine):(t.valueLine=this.theme().grey,t.valueFill=this.theme().grey,t.averageLine=this.theme().greyDimmer,t.averageFill=this.theme().greyDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greyDim,t.chartLabel=this.theme().contrastDim;break;case"yellow":this.config.trackAgainstAverage?(t.valueLine=this.theme().yellowDimmer,t.valueFill=this.theme().yellowDimmer,t.averageLine=this.theme().yellow,t.averageFill=this.theme().yellow,t.chartValue=t.averageLine):(t.valueLine=this.theme().yellow,t.valueFill=this.theme().yellow,t.averageLine=this.theme().yellowDimmer,t.averageFill=this.theme().yellowDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().yellowDim,t.chartLabel=this.theme().contrastDim;break}return t}startStreaming(){this.dsServiceSub?.unsubscribe();let e=this.dsService.getDatasetBatchThenLiveObservable(this.datasetUUID);this.dsServiceSub=e?.subscribe(t=>{if(!(this.isDestroyed||!this.chart||!this.chart.ctx)){if(Array.isArray(t)){let a=this.transformDatasetRows(t,0);if(this.chart.data.datasets[0].data.push(...a),this.config.showAverageData){let r=this.transformDatasetRows(t,this.config.datasetAverageArray);this.chart.data.datasets[1].data.push(...r)}}else{let a=this.transformDatasetRows([t],0)[0];if(this.chart.data.datasets[0].data.push(a),this.config.showAverageData){let r=this.transformDatasetRows([t],this.config.datasetAverageArray)[0];this.chart.data.datasets[1].data.push(r)}}this.ngZone.runOutsideAngular(()=>{if(this.isDestroyed||!this.chart)return;let a=this.chart;a.ctx&&a.update("none")})}})}destroyChart(){this.dsServiceSub?.unsubscribe(),this.dsServiceSub=null,this.chart?.destroy(),this.chart=null,this.lastChartSignature=null}transformDatasetRows(e,t){let i=s=>this.unitsService.convertToUnit(this.convertUnitTo,s),a=this.verticalChart,r=this.config.datasetAverageArray;return e.map(s=>{if(a){if(t===0)return{x:i(s.data.value),y:s.timestamp};{let l={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return{x:i(l[r]),y:s.timestamp}}}else{if(t===0)return{x:s.timestamp,y:i(s.data.value)};{let l={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return{x:s.timestamp,y:i(l[r])}}}})}ngOnDestroy(){this.isDestroyed=!0,this.destroyChart();let e=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(e,{clear:!0,removeFromDom:!0})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["minichart"]],viewQuery:function(t,i){t&1&&Me(i.widgetDataChart,V1,5,Ke),t&2&&ke()},inputs:{theme:[1,"theme"]},decls:2,vars:0,consts:[["widgetDataChart",""],[2,"z-index","inherit"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:calc(90% - 10px);position:absolute;bottom:0;border-radius:12px;overflow:hidden}"],changeDetection:0})}return n})();var We=(()=>{class n{_streamsConfig=w(void 0);dataService=y(Ot);unitsService=y(it);destroyRef=y(ze);streams;registrations=[];subscriptions=new Map;baseSignatures=new Map;reset$=new zt;rootSignature;buildObserver(e,t){return{next:i=>t(i),error:i=>console.error("[Widget] Observer got an error: "+i),complete:()=>{}}}computePathSignature(e){let t=this.normalizePath(e.path)??"",i=e.source?.trim()||"default";return[t,e.pathType,e.sampleTime,e.convertUnitTo,i,e.suppressBootstrapNull?"1":"0"].join("|")}computeBaseKey(e,t){let i=this.normalizePath(e)??"",a=t?.trim()||"default";return`${i}|${a}`}normalizePath(e){if(typeof e!="string")return;let t=e.trim();return t.length?t:void 0}computeRootSignature(e){return e?`timeout:${e.enableTimeout?"1":"0"}:${e.dataTimeout??""}`:"none"}ensureStreamsMap(){this.streams||(this.streams=new Map)}buildAndSubscribe(e,t,i,a){let r=this.normalizePath(a.path);if(!r){let de=this.subscriptions.get(e);de&&de.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e);return}this.ensureStreamsMap();let s=this.computeBaseKey(r,a.source),l=this.baseSignatures.get(e);(!this.streams.has(e)||l!==s)&&(this.streams.set(e,this.dataService.subscribePath(r,a.source?.trim()||"default")),this.baseSignatures.set(e,s));let m=this.streams.get(e),g=!!i.enableTimeout,v=(i.dataTimeout??5)*1e3,A=5e3,C=`[Widget] ${i.displayName} - ${v/1e3} second data update timeout reached for `,_=`[Widget] ${i.displayName} - Retrying in ${A/1e3} seconds`,M=a.pathType,B=a.convertUnitTo,D=!!a.suppressBootstrapNull,V=Number(a.sampleTime);(!Number.isFinite(V)||V<=0)&&(V=1e3);let F=de=>B?this.unitsService.convertToUnit(B,de):de,Y=m;M==="number"&&(Y=Y.pipe(Kt(de=>({data:{value:de.data.value==null?null:F(de.data.value),timestamp:de.data.timestamp},state:de.state})))),D&&(Y=Y.pipe(dc(de=>de?.data?.value==null)));let j=Y.pipe(ai(1)),Ce=Y.pipe(lc(V));Y=bi(j,Ce),g&&(Y=Y.pipe(tc({each:v,with:()=>ec(()=>{console.log(C+r),this.dataService.timeoutPathObservable(r,M)})}),sc(de=>de.pipe(Er(()=>console.log(_)),oc(()=>ma(A))))));let me=this.buildObserver(e,t),ae=Y.pipe(Dr(this.reset$),Le(this.destroyRef)).subscribe(me),se=ge(ne({},a),{path:r}),ce=this.computePathSignature(se),oe=this.subscriptions.get(e);oe&&oe.sub.unsubscribe(),this.subscriptions.set(e,{sub:ae,signature:ce})}setStreamsConfig(e){this._streamsConfig.set(e),this.rootSignature=this.computeRootSignature(e)}applyStreamsConfigDiff(e){let t=this._streamsConfig(),i=this.rootSignature,a=this.computeRootSignature(e);if(this._streamsConfig.set(e),this.rootSignature=a,!t||!t.paths||!Object.keys(t.paths).length)return;if(!e||!e.paths){this.subscriptions.forEach(g=>g.sub.unsubscribe()),this.subscriptions.clear(),this.streams=void 0,this.baseSignatures.clear(),this.registrations=[];return}let r=Object.keys(t.paths),s=Object.keys(e.paths),l=r.filter(g=>!s.includes(g));for(let g of l){let v=this.subscriptions.get(g);v&&v.sub.unsubscribe(),this.subscriptions.delete(g),this.streams?.delete(g),this.baseSignatures.delete(g),this.registrations=this.registrations.filter(A=>A.pathName!==g)}let m=i!==a;for(let g of s){let v=e.paths[g],A=this.normalizePath(v?.path);if(!A){let B=this.subscriptions.get(g);B&&B.sub.unsubscribe(),this.subscriptions.delete(g),this.streams?.delete(g),this.baseSignatures.delete(g);continue}let C=ge(ne({},v),{path:A}),_=this.computePathSignature(C),M=this.subscriptions.get(g);if(!M||M.signature!==_||m){M&&(M.sub.unsubscribe(),this.subscriptions.delete(g));let B=this.registrations.find(D=>D.pathName===g);B&&this.buildAndSubscribe(g,B.next,e,C)}}}observe(e,t){let i=this.registrations.find(v=>v.pathName===e)?.next;this.registrations=this.registrations.filter(v=>v.pathName!==e),this.registrations.push({pathName:e,next:t});let a=this._streamsConfig();if(!a||!a.paths?.[e]){let v=this.subscriptions.get(e);v&&(v.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e));return}let r=a.paths[e],s=this.normalizePath(r?.path);if(!s){let v=this.subscriptions.get(e);v&&(v.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e)),this.registrations=this.registrations.filter(A=>A.pathName!==e);return}let l=ge(ne({},r),{path:s}),m=this.computePathSignature(l),g=this.subscriptions.get(e);g&&g.signature===m&&i===t||this.buildAndSubscribe(e,t,a,l)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["","widget-streams",""]],exportAs:["widgetStreams"]})}return n})();function Te(n,o){return{contrast:{color:o.contrast,dim:o.contrastDim,dimmer:o.contrastDimmer},blue:{color:o.blue,dim:o.blueDim,dimmer:o.blueDimmer},green:{color:o.green,dim:o.greenDim,dimmer:o.greenDimmer},pink:{color:o.pink,dim:o.pinkDim,dimmer:o.pinkDimmer},orange:{color:o.orange,dim:o.orangeDim,dimmer:o.orangeDimmer},purple:{color:o.purple,dim:o.purpleDim,dimmer:o.purpleDimmer},yellow:{color:o.yellow,dim:o.yellowDim,dimmer:o.yellowDimmer},grey:{color:o.grey,dim:o.greyDim,dimmer:o.greyDimmer}}[n]}var W1=["canvasMainRef"];function F1(n,o){if(n&1&&W(0,"minichart",1),n&2){let e=k();R("theme",e.theme())}}var Pm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{numericPath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,convertUnitTo:"unitless",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,showMiniChart:!1,yScaleMin:0,yScaleMax:10,inverseYAxis:!1,verticalChart:!1,color:"contrast",enableTimeout:!1,dataTimeout:5,ignoreZones:!1};runtime=y(Se);stream=y(We);canvas=y(ht);datasetLifecycle=y(lo);miniChart=he(xs);canvasMainRef=he.required("canvasMainRef");showMiniChart=w(!1);labelColor=w(void 0);canvasElement;canvasCtx;cssWidth=0;cssHeight=0;backgroundBitmap=null;backgroundBitmapText=null;dataValue=null;maxValue=null;minValue=null;valueColor=void 0;valueStateColor=void 0;maxValueTextWidth=0;maxValueTextHeight=0;maxMinMaxTextWidth=0;maxMinMaxTextHeight=0;streamRegistered=!1;pathDataState=null;isDestroyed=!1;lastSubscriptionSignature=null;subscriptionSignature=X(()=>{let t=this.runtime?.options()?.paths?.numericPath;if(!t?.path)return null;let i=t.source?.trim()||"default";return[t.path,t.pathType,t.sampleTime,t.convertUnitTo,i,t.suppressBootstrapNull?"1":"0"].join("|")});onNumericValue=e=>{if(this.dataValue=e.data.value,this.minValue===null||this.dataValue<this.minValue?this.minValue=this.dataValue:(this.maxValue===null||this.dataValue>this.maxValue)&&(this.maxValue=this.dataValue),!this.runtime?.options().ignoreZones&&this.pathDataState!==e.state)switch(this.pathDataState=e.state,e.state){case ve.Alarm:this.valueStateColor=this.theme().zoneAlarm;break;case ve.Warn:this.valueStateColor=this.theme().zoneWarn;break;case ve.Alert:this.valueStateColor=this.theme().zoneAlert;break;default:this.valueStateColor=this.valueColor;break}this.drawWidget()};constructor(){this.showMiniChart.set(this.runtime.options().showMiniChart),L(()=>{let e=this.theme(),t=this.runtime?.options()?.color;G(()=>{e&&t!==void 0&&(this.setColors(),this.drawWidget())})}),L(()=>{let e=this.subscriptionSignature();G(()=>{this.isDestroyed||!this.canvasCtx||e===this.lastSubscriptionSignature&&this.streamRegistered||(this.minValue=null,this.maxValue=null,this.dataValue=null,this.pathDataState=null,this.lastSubscriptionSignature=e,e&&(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=!0,this.manageDatasetAndChart()))})}),L(()=>{let e=this.showMiniChart(),t=this.miniChart(),i=this.runtime?.options(),a=i?.paths?.numericPath;[i?.showMiniChart?"1":"0",a?.path??"",a?.source??"default",a?.convertUnitTo??"",i?.numDecimal??"",i?.yScaleMin??"",i?.yScaleMax??"",i?.inverseYAxis?"1":"0",i?.verticalChart?"1":"0",i?.color??""].join("|")&&e&&t&&(this.setMiniChart(),this.miniChart().startChart())})}ngOnInit(){this.setColors(),this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.calculateMaxMinTextDimensions(),this.drawWidget()}})}ngAfterViewInit(){this.isDestroyed||!this.streamRegistered&&this.subscriptionSignature()&&(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=!0,this.manageDatasetAndChart())}calculateMaxMinTextDimensions(){this.maxValueTextWidth=Math.floor(this.cssWidth*.85),this.maxValueTextHeight=Math.floor(this.cssHeight*.7),this.maxMinMaxTextWidth=Math.floor(this.cssWidth*.57),this.maxMinMaxTextHeight=Math.floor(this.cssHeight*.1)}manageDatasetAndChart(){let e=this.runtime.options(),t=e.paths.numericPath,i=!!e.showMiniChart;if(this.showMiniChart.set(i),!i){this.datasetLifecycle.removeDatasetIfExists(this.id(),!1);return}if(!t||!t.path)return;let a=t.source??"default";this.datasetLifecycle.syncNumericMiniChartDataset(this.id(),t.path,a)}setMiniChart(){let e=this.runtime.options(),t=e.paths.numericPath;this.miniChart().dataPath=t?.path??null,this.miniChart().dataSource=t?.source??"default",this.miniChart().color=e.color,this.miniChart().convertUnitTo=t?.convertUnitTo,this.miniChart().numDecimal=e.numDecimal,this.miniChart().yScaleMin=e.yScaleMin,this.miniChart().yScaleMax=e.yScaleMax,this.miniChart().inverseYAxis=e.inverseYAxis,this.miniChart().verticalChart=e.verticalChart,this.miniChart().datasetUUID=this.id()}setColors(){let e=this.runtime.options();e&&(this.labelColor.set(Te(e.color,this.theme()).dim),this.valueStateColor=this.valueColor=Te(e.color,this.theme()).color,this.backgroundBitmap=null,this.backgroundBitmapText=null)}drawWidget(){if(!this.canvasCtx)return;let e=this.runtime.options();if(!e)return;let t=e.paths.numericPath.convertUnitTo,i=10*this.canvas.scaleFactor,a=5*this.canvas.scaleFactor,r=e.displayName+"|"+t;(!this.backgroundBitmap||this.backgroundBitmap.width!==this.canvasElement.width||this.backgroundBitmap.height!==this.canvasElement.height||this.backgroundBitmapText!==r)&&(this.backgroundBitmap=this.canvas.renderStaticToBitmap(this.canvasCtx,this.cssWidth,this.cssHeight,s=>{this.canvas.drawTitleInternal(s,e.displayName,this.labelColor(),"normal",this.cssWidth,this.cssHeight,.1),["unitless","percent","ratio","latitudeSec","latitudeMin","longitudeSec","longitudeMin"].includes(t)||this.canvas.drawText(s,t,this.cssWidth-i,this.cssHeight-a,Math.floor(this.cssWidth*.25),Math.floor(this.cssHeight*.15),"bold",this.valueColor,"end","bottom")}),this.backgroundBitmapText=r),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.backgroundBitmap&&this.backgroundBitmap.width>0&&this.backgroundBitmap.height>0&&this.canvasCtx.drawImage(this.backgroundBitmap,0,0,this.cssWidth,this.cssHeight),this.drawValue(),(e.showMax||e.showMin)&&this.drawMinMax()}drawValue(){let e=this.getValueText();this.canvas.drawText(this.canvasCtx,e,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2*1.15),this.maxValueTextWidth,this.maxValueTextHeight,"bold",this.valueStateColor)}getValueText(){if(this.dataValue===null)return"--";let e=this.runtime.options().paths.numericPath.convertUnitTo;return["latitudeSec","latitudeMin","longitudeSec","longitudeMin","D HH:MM:SS"].includes(e)?this.dataValue.toString():this.applyDecorations(this.dataValue.toFixed(this.runtime.options().numDecimal))}drawMinMax(){let e=this.runtime.options();if(!e.showMin&&!e.showMax)return;let t="";e.showMin&&(t=this.minValue!=null?` Min: ${this.applyDecorations(this.minValue.toFixed(e.numDecimal))}`:" Min: --"),e.showMax&&(t+=this.maxValue!=null?` Max: ${this.applyDecorations(this.maxValue.toFixed(e.numDecimal))}`:" Max: --"),t=t.trim();let i=10*this.canvas.scaleFactor,a=5*this.canvas.scaleFactor;this.canvas.drawText(this.canvasCtx,t,i,Math.floor(this.cssHeight-a),this.maxMinMaxTextWidth,this.maxMinMaxTextHeight,"normal",this.valueColor,"start","bottom")}applyDecorations(e){switch(this.runtime.options().paths.numericPath.convertUnitTo){case"percent":case"percentraw":e+="%";break}return e}ngOnDestroy(){this.isDestroyed=!0,this.datasetLifecycle.removeDatasetIfExists(this.id(),!1);try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-numeric"]],viewQuery:function(t,i){t&1&&Me(i.miniChart,xs,5)(i.canvasMainRef,W1,5),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[["canvasMainRef",""],[3,"theme"],[1,"numeric-canvas"]],template:function(t,i){t&1&&(I(0,F1,1,1,"minichart",1),W(1,"canvas",2,0)),t&2&&N(i.showMiniChart()?0:-1)},dependencies:[xs],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.numeric-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.numeric-canvas[_ngcontent-%COMP%]{position:relative;width:100%!important;height:100%!important;display:block}"],changeDetection:0})}return n})();var G1=["canvasMainRef"],Im=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Gauge Label",filterSelfPaths:!0,paths:{stringPath:{description:"String Data",path:null,source:null,pathType:"string",isPathConfigurable:!0,sampleTime:500}},color:"contrast",enableTimeout:!1,dataTimeout:5};runtime=y(Se);stream=y(We);canvas=y(ht);canvasMainRef=he.required("canvasMainRef");canvasElement;canvasCtx;titleBitmap=null;titleBitmapText=null;cssWidth=0;cssHeight=0;dataValue=null;labelColor=w(void 0);valueColor=void 0;isDestroyed=!1;streamRegistered=!1;constructor(){L(()=>{let e=this.theme();G(()=>{this.runtime?.options()&&e&&(this.setColors(),this.drawWidget())})}),L(()=>{this.runtime?.options()&&(this.isDestroyed||!this.canvasCtx||G(()=>{this.setColors(),this.startWidget(),this.drawWidget()}))})}ngOnInit(){this.setColors()}ngAfterViewInit(){this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.drawWidget()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),!this.isDestroyed&&this.startWidget()}startWidget(){this.dataValue=null,this.streamRegistered||(this.runtime?.options()?.paths?.stringPath?.path?(this.stream.observe("stringPath",t=>{this.dataValue=t.data.value,this.drawWidget()}),this.streamRegistered=!0):this.drawWidget())}setColors(){let e=this.runtime?.options();e&&(this.labelColor.set(Te(e.color,this.theme()).dim),this.valueColor=Te(e.color,this.theme()).color)}ngOnDestroy(){this.isDestroyed=!0;try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}drawWidget(){if(!this.canvasCtx)return;let e=Math.floor(this.cssHeight*.1),t=this.runtime.options(),i=t.displayName+"|"+this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t.displayName,this.labelColor(),"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t.displayName+"|"+this.labelColor()),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.canvasCtx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight);let a=this.dataValue===null?"--":this.dataValue,r=this.canvas.EDGE_BUFFER||10,s=Math.max(0,this.cssHeight-e-2*r),l=Math.max(0,Math.floor(this.cssWidth-2*r)),m=Math.max(0,Math.floor(s)),g=Math.floor(this.cssWidth/2),v=Math.floor(e+r+s/2);this.canvas.drawText(this.canvasCtx,a,g,v,l,m,"bold",this.valueColor,"center","middle")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-text"]],viewQuery:function(t,i){t&1&&Me(i.canvasMainRef,G1,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"text-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.text-canvas[_ngcontent-%COMP%]{display:block;width:100%!important;height:100%!important;min-height:1px}"],changeDetection:0})}return n})();var B1=["widgetDataChart"];Ct.register(Sa,un,Zn,qn,Yn,jn,ao,os,rs);var Nm=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se,{optional:!0});static DEFAULT_CONFIG={filterSelfPaths:!0,color:"contrast",timeScale:"Last 30 Minutes"};ngZone=y(qe);_dataset=y(mn);datasetLifecycle=y(lo);canvasService=y(ht);unitsService=y(it);responsive=y(qa);isPhonePortrait;widgetDataChart=he("widgetDataChart",{read:Ke});lineChartData={datasets:[]};lineChartOptions={parsing:!1,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.3}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart;_dsDirectionSub=null;_dsSpeedSub=null;datasetConfig=null;dataSourceInfo=null;xCenter=null;xStep=null;xCenterSpeed=null;xStepSpeed=null;CENTER_LINE_WIDTH=4;GRID_LINE_WIDTH=1;EDGE_EXTEND_UP_PX=42;EDGE_SPEED_LABEL_OFFSET=5;EDGE_DIR_LABEL_OFFSET=5;TICK_LABEL_FONT_SIZE=20;TICK_LABEL_PHONE_PORTRAIT_FONT_SIZE=11;CENTER_LABEL_FONT_SIZE=22;CENTER_LABEL_PHONE_PORTRAIT_FONT_SIZE=13;SPEED_VALUE_FONT_SIZE=62;SPEED_VALUE_PHONE_PORTRAIT_FONT_SIZE=32;TOP_VALUE_Y_OFFSET=62;TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET=44;TOP_UNIT_Y_OFFSET=51;TOP_UNIT_PHONE_PORTRAIT_Y_OFFSET=38;UNIT_FONT_SIZE=28;UNIT_PHONE_PORTRAIT_FONT_SIZE=14;UNIT_PADDING=8;UNIT_PHONE_PORTRAIT_PADDING=3;gridBackgroundPlugin={id:"xSpeedGridBackground",beforeDraw:e=>{let t=e.chartArea;if(!t)return;let i=e.ctx,a=this.theme();i.save(),i.globalCompositeOperation="destination-over",i.fillStyle=a.background,i.fillRect(t.left,t.top,t.width/2,t.height),i.restore()}};centerTickPlugin={id:"centerTickStyle",afterDraw:e=>{let t=e.ctx,i=e.chartArea,a=this.theme(),r=this.getThemeColors(),s=Ct.defaults.font,l=e.scales,m=e.options?.scales,g=e.data?.datasets?.[0]?.data,v=e.data?.datasets?.[5]?.data,A=(g?.length??0)>=2&&(v?.length??0)>=2,C=(me,ae)=>{let se=l?.[me],ce=m;if(!se)return;let oe=se,de=ce?.[me]?.min??oe.min,le=ce?.[me]?.max??oe.max;if(typeof de!="number"||typeof le!="number"||!isFinite(de)||!isFinite(le))return;let be=(de+le)/2,Ue=se.getPixelForValue(be);t.save(),t.strokeStyle=a.contrastDim,t.lineWidth=this.CENTER_LINE_WIDTH,t.beginPath(),t.moveTo(Ue,i.top),t.lineTo(Ue,i.bottom),t.stroke(),t.restore(),t.save(),t.fillStyle=a.contrastDim,t.font=this.isPhonePortrait().matches?`bold ${this.CENTER_LABEL_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.CENTER_LABEL_FONT_SIZE}px ${s.family}`,t.textAlign="center",t.textBaseline="top";let st=this.axisTopLabelY(se);t.fillText(ae(be),Ue,st),t.restore()};C("x",me=>`${((me%360+360)%360).toFixed(0)}\xB0`),C("xSpeed",me=>`${me.toFixed(1)}`);let _=l?.xSpeed;if(_){let me=m,ae=_,se=me?.xSpeed?.max??ae.max;if(typeof se=="number"&&isFinite(se)){let ce=_.getPixelForValue(se);t.save(),t.fillStyle=this.resolveTickColor(e,_,se),t.font=this.isPhonePortrait().matches?`normal ${this.TICK_LABEL_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`normal ${this.TICK_LABEL_FONT_SIZE}px ${s.family}`,t.textAlign="right",t.textBaseline="top";let oe=this.axisTopLabelY(_),de=this.xStepSpeed??1,le=Math.max(0,Math.min(3,Math.ceil(-Math.log10(de))));t.fillText(`${se.toFixed(le)}`,ce-this.EDGE_SPEED_LABEL_OFFSET,oe),t.restore(),t.save(),t.strokeStyle=a.contrastDim,t.lineWidth=this.GRID_LINE_WIDTH,t.beginPath();let be=Math.round(ce)+.5;t.moveTo(be,i.bottom),t.lineTo(be,i.top-this.EDGE_EXTEND_UP_PX),t.stroke(),t.restore()}}let M=l?.x;if(M){let me=m,ae=M,se=me?.x?.min??ae.min;if(typeof se=="number"&&isFinite(se)){let ce=M.getPixelForValue(se);t.save(),t.fillStyle=this.resolveTickColor(e,M,se),t.font=this.isPhonePortrait().matches?`normal ${this.TICK_LABEL_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`normal ${this.TICK_LABEL_FONT_SIZE}px ${s.family}`,t.textAlign="left",t.textBaseline="top";let oe=this.axisTopLabelY(M),de=this.normalizeAngle(se);t.fillText(`${de.toFixed(0)}\xB0`,ce+this.EDGE_DIR_LABEL_OFFSET,oe),t.restore()}}let B=e.data?.datasets,D=B?.[5]?.data,V=D?.length?D.length-1:-1,F=V>=0?D[V]?.x:void 0;if(typeof F=="number"&&isFinite(F)){t.save(),t.fillStyle=r.chartValue,t.font=this.isPhonePortrait().matches?`bold ${this.SPEED_VALUE_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.SPEED_VALUE_FONT_SIZE}px ${s.family}`,t.textAlign="center",t.textBaseline="middle";let me=`${F.toFixed(1)}`,ae=i.left+i.width/4,se=i.top-(this.isPhonePortrait().matches?this.TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET:this.TOP_VALUE_Y_OFFSET);t.fillText(me,ae,se);let ce=t.measureText(me),oe=ae+ce.width/2+(this.isPhonePortrait().matches?this.UNIT_PHONE_PORTRAIT_PADDING:this.UNIT_PADDING),de=i.top-(this.isPhonePortrait().matches?this.TOP_UNIT_PHONE_PORTRAIT_Y_OFFSET:this.TOP_UNIT_Y_OFFSET);t.font=this.isPhonePortrait().matches?`bold ${this.UNIT_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.UNIT_FONT_SIZE}px ${s.family}`,t.textAlign="left",t.fillText("kts",oe,de),t.restore()}let Y=B?.[0]?.data,j=Y?.length?Y.length-1:-1,Ce=j>=0?Y[j]?.x:void 0;if(typeof Ce=="number"&&isFinite(Ce)){let me=this.normalizeAngle(Ce);t.save(),t.fillStyle=r.chartValue,t.font=this.isPhonePortrait().matches?`bold ${this.SPEED_VALUE_PHONE_PORTRAIT_FONT_SIZE}px ${s.family}`:`bold ${this.SPEED_VALUE_FONT_SIZE}px ${s.family}`,t.textAlign="center",t.textBaseline="middle",t.fillText(`${me.toFixed(0)}\xB0`,i.left+3*i.width/4,i.top-(this.isPhonePortrait().matches?this.TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET:this.TOP_VALUE_Y_OFFSET)),t.restore()}if(!A){let me=Math.min(i.width*.7,420),ae=90,se=i.left+(i.width-me)/2,ce=i.top+(i.height-ae)/2;t.save(),t.globalAlpha=.82,t.fillStyle=a.background,t.fillRect(se,ce,me,ae),t.restore(),t.save(),t.strokeStyle=a.contrastDim,t.lineWidth=2,t.strokeRect(se,ce,me,ae),t.restore(),t.save(),t.fillStyle=this.getThemeColors().chartLabel,t.textAlign="center",t.textBaseline="middle",t.font=`bold 18px ${s.family}`,t.fillText("Data acquisition...",se+me/2,ce+ae/2),t.restore()}}};constructor(){this.isPhonePortrait=Mi(this.responsive.observe(Gi.HandsetPortrait)),L(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||G(()=>{this.datasetConfig&&this.chart&&(this.setChartOptions(),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")))})}),L(()=>{let e=this.runtime?.options();if(!e)return;!this.datasetConfig||this.datasetConfig.timeScaleFormat!==e.timeScale?(this.syncServiceDatasets(),this.startWidget()):this.chart&&this.setChartOptions()})}startWidget(){this.widgetDataChart()&&(this.datasetConfig=this._dataset.getDatasetConfig(`${this.id()}-twd`),this.dataSourceInfo=this._dataset.getDataSourceInfo(`${this.id()}-twd`),this.datasetConfig&&(this.createDatasets(),this.setChartOptions(),this.chart?this.ngZone.runOutsideAngular(()=>this.chart?.update("none")):(this.chart=new Ct(this.widgetDataChart().nativeElement.getContext("2d"),{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions,plugins:[this.gridBackgroundPlugin,this.centerTickPlugin]}),this.ngZone.runOutsideAngular(()=>this.chart?.update("none"))),this.startStreaming()))}syncServiceDatasets(){let e=this.runtime?.options();!e||e.timeScale===""||this.datasetLifecycle.syncWindTrendsDatasets(this.id(),e.timeScale)}setChartOptions(){this.lineChartOptions.maintainAspectRatio=!1,this.lineChartOptions.animation=!1,this.lineChartOptions.indexAxis="y";let e=0,t=360,i=(t-e)/4,a=0,r=20,s=(r-a)/4;this.lineChartOptions.scales={y:{type:"linear",display:!0,position:"right",reverse:!0,title:{display:!0,text:`${this.datasetConfig.timeScaleFormat}`,align:"center"},ticks:{count:6,autoSkip:!1,includeBounds:!0,align:"inner",major:{enabled:!0},font:this.isPhonePortrait().matches?{size:12}:{size:16},callback:l=>{let m=Number(l),g=this.datasetConfig?.timeScaleFormat,v=this.getWindowMs(g);return g==="Last 5 Minutes"?`${Math.round(m/6e4)}'`:v>=10*6e4?`${Math.round(m/6e4)}'`:`${Math.round(m/1e3)}"`}},grid:{display:!0,color:this.theme().contrastDimmer}},x:{type:"linear",position:"top",stack:"trends",beginAtZero:!1,bounds:"ticks",min:e,max:t,title:{display:!1},ticks:{count:5,align:"inner",autoSkip:!1,includeBounds:!0,stepSize:i,minRotation:0,maxRotation:0,callback:l=>{let m=this.xCenter??Number.NaN;if(this.nearlyEqual(l,m))return"";let v=this.chart?.options?.scales?.x?.min;return typeof v=="number"&&this.nearlyEqual(l,v)?"":`${((l%360+360)%360).toFixed(0)}\xB0`},font:l=>{let m=l.tick?.value??Number.NaN,g=this.xCenter??Number.NaN,v=this.nearlyEqual(m,g);return this.isPhonePortrait().matches?{size:11,weight:v?"bold":"normal"}:{size:20,weight:v?"bold":"normal"}},color:l=>{let m=l.tick?.value??Number.NaN,g=this.xCenter??Number.NaN;return this.nearlyEqual(m,g)?this.theme().contrast:void 0}},grid:{display:!0,color:l=>{let m=l.tick?.value??Number.NaN,g=l.scale,v=this.chart?.options?.scales,A=g,C=v?.x?.min??A.min;return this.nearlyEqual(m,C)?"rgba(0,0,0,0)":this.theme().contrastDimmer},lineWidth:1}},xSpeed:{type:"linear",position:"top",stack:"trends",beginAtZero:!1,bounds:"ticks",min:a,max:r,title:{display:!1},ticks:{count:5,align:"inner",autoSkip:!1,includeBounds:!0,stepSize:s,minRotation:0,maxRotation:0,callback:l=>{let m=this.xCenterSpeed??Number.NaN;if(this.nearlyEqual(l,m))return"";let v=this.chart?.options?.scales?.xSpeed?.max;if(typeof v=="number"&&this.nearlyEqual(l,v))return"";let A=this.xStepSpeed??Number.NaN,C=Number.isFinite(A)?A:1,_=Math.max(0,Math.min(3,Math.ceil(-Math.log10(C))));return`${l.toFixed(_)}`},font:l=>{let m=l.tick?.value??Number.NaN,g=this.xCenterSpeed??Number.NaN,v=this.nearlyEqual(m,g);return this.isPhonePortrait().matches?{size:11,weight:v?"bold":"normal"}:{size:20,weight:v?"bold":"normal"}},color:l=>{let m=l.tick?.value??Number.NaN,g=this.xCenterSpeed??Number.NaN;return this.nearlyEqual(m,g)?this.theme().contrast:void 0}},grid:{display:!0,color:l=>{let m=l.tick?.value??Number.NaN,g=l.scale,v=this.chart?.options?.scales,A=g,C=v?.xSpeed?.max??A.max;return this.nearlyEqual(m,C)?"rgba(0,0,0,0)":this.theme().contrastDimmer},lineWidth:1}}},this.lineChartOptions.plugins={title:{display:!0,align:"end",text:"TWD ",color:this.getThemeColors().chartLabel,padding:this.isPhonePortrait().matches?{top:3,bottom:0}:{top:3,bottom:0},font:this.isPhonePortrait().matches?{size:16,weight:"normal"}:{size:35,weight:"normal"}},subtitle:{display:!0,align:"start",text:" TWS",color:this.getThemeColors().chartLabel,padding:this.isPhonePortrait().matches?{top:-18,bottom:12}:{top:-41,bottom:12},font:this.isPhonePortrait().matches?{size:16}:{size:35}},legend:{display:!1},streaming:{duration:this.dataSourceInfo.maxDataPoints*this.dataSourceInfo.sampleTime,delay:this.dataSourceInfo.sampleTime,frameRate:this.datasetConfig.timeScaleFormat==="day"?5:this.datasetConfig.timeScaleFormat==="hour"?8:this.datasetConfig.timeScaleFormat==="minute"?15:30}},this.xCenter=(e+t)/2,this.xStep=i,this.xCenterSpeed=(a+r)/2,this.xStepSpeed=s}createDatasets(){this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:2,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:1,fill:!1,xAxisID:"x"},{label:"SMA",data:[],order:0,parsing:!1,normalized:!0,tension:.3,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:10,fill:!1,borderColor:e=>{let t=e.chart,{ctx:i}=t;return this.lineGradientForAxis(i,t,"x")},backgroundColor:"red",xAxisID:"x"},{label:"lastAverage",data:[],order:1,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:0,borderColor:"",fill:!1,hidden:!0,xAxisID:"x"},{label:"lastMinimum",data:[],order:3,parsing:!1,normalized:!0,hidden:!0,xAxisID:"x"},{label:"lastMaximum",data:[],order:4,parsing:!1,normalized:!0,hidden:!0,xAxisID:"x"},{label:"Value Speed",data:[],order:2,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:1,fill:!1,xAxisID:"xSpeed"},{label:"SMA Speed",data:[],order:0,parsing:!1,normalized:!0,tension:.2,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:3,fill:!1,borderColor:e=>{let t=e.chart,{ctx:i}=t;return this.lineGradientForAxis(i,t,"xSpeed")},xAxisID:"xSpeed"},{label:"lastAverage Speed",data:[],order:1,parsing:!1,normalized:!0,tension:0,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:0,borderColor:"",fill:!1,hidden:!0,xAxisID:"xSpeed"},{label:"lastMinimum Speed",data:[],order:3,parsing:!1,normalized:!0,hidden:!0,xAxisID:"xSpeed"},{label:"lastMaximum Speed",data:[],order:4,parsing:!1,normalized:!0,hidden:!0,xAxisID:"xSpeed"}),this.setDatasetsColors()}startStreaming(){this._dsDirectionSub?.unsubscribe(),this._dsSpeedSub?.unsubscribe();let e=this._dataset.getDatasetBatchThenLiveObservable(`${this.id()}-twd`),t=this._dataset.getDatasetBatchThenLiveObservable(`${this.id()}-tws`);this._dsDirectionSub=e?.subscribe(i=>{if(Array.isArray(i))this.pushRowsToDatasets(i);else if(this.pushRowsToDatasets([i]),this.chart.data.datasets[0].data.length>this.dataSourceInfo.maxDataPoints)for(let a=0;a<=4;a++)this.chart.data.datasets[a].data.shift();this.updateChartAfterDataChange(),this.ngZone.runOutsideAngular(()=>{this.chart?.update("none")})}),this._dsSpeedSub=t?.subscribe(i=>{if(Array.isArray(i))this.pushRowsToSpeedDatasets(i);else if(this.pushRowsToSpeedDatasets([i]),this.chart.data.datasets[5].data.length>this.dataSourceInfo.maxDataPoints)for(let a=5;a<=9;a++)this.chart.data.datasets[a].data.shift();this.updateChartAfterDataChange(),this.ngZone.runOutsideAngular(()=>{this.chart?.update("none")})})}unwrapAngles(e){if(e.length===0)return[];let t=[],i=null;for(let a of e){if(a==null){t.push(null);continue}if(i==null){t.push(a),i=a;continue}let r=a-i;r>180&&(r-=360),r<-180&&(r+=360),t.push(t[t.length-1]+r),i=a}return t}pushRowsToDatasets(e){this.pushRowsGeneric(e,0,"deg",!0)}pushRowsToSpeedDatasets(e){this.pushRowsGeneric(e,5,"knots",!1)}getRowValue(e,t){switch(t){case"value":return e.data.value??null;case"sma":return e.data.sma??null;case"ema":return e.data.ema??null;case"dema":return e.data.doubleEma??null;case"avg":return e.data.lastAverage??null;case"min":return e.data.lastMinimum??null;case"max":return e.data.lastMaximum??null;default:return null}}transformRows(e,t,i,a){let r=e.map(l=>{let m=this.getRowValue(l,t);return m==null?null:this.unitsService.convertToUnit(i,m)}),s=a?this.unwrapAngles(r):r;return e.map((l,m)=>({x:s[m],y:l.timestamp,ts:l.timestamp}))}pushRowsGeneric(e,t,i,a){["value","sma","avg","min","max"].forEach((s,l)=>{this.chart.data.datasets[t+l].data.push(...this.transformRows(e,s,i,a))})}normalizeAngle(e){return(e%360+360)%360}angularDiff(e,t){let i=(e-t+540)%360-180;return Math.abs(i)}niceStepFromMantissas(e,t){if(!isFinite(e)||e<=0)return 1;let i=Math.floor(Math.log10(e)),a=e/Math.pow(10,i);return(t.find(s=>a<=s)??t[t.length-1])*Math.pow(10,i)}updateChartAfterDataChange(){let e=this.chart.data.datasets[2]?.data,t=this.chart.data.datasets[1]?.data,i=this.chart.data.datasets[0]?.data,a=!!e?.length,r=!!t?.length,s=!!i?.length,l=a?e[e.length-1].x:r?t[t.length-1].x:s?i[i.length-1].x:void 0;if(typeof l=="number"&&isFinite(l)){let A=this.chart.data.datasets[3]?.data,C=this.chart.data.datasets[4]?.data,_=A?.length?A[A.length-1].x:void 0,M=C?.length?C[C.length-1].x:void 0,B=typeof _=="number"&&isFinite(_)?this.angularDiff(l,_):Number.NaN,D=typeof M=="number"&&isFinite(M)?this.angularDiff(l,M):Number.NaN,V=Number.isFinite(B)||Number.isFinite(D)?Math.max(Number.isFinite(B)?B:0,Number.isFinite(D)?D:0):Number.NaN;if(!Number.isFinite(V)){let se=a?e:r?t:i,ce=Math.min(30,se?.length??0);if(ce>1){let de=se.slice(se.length-ce).map(le=>le.x).filter(le=>typeof le=="number"&&isFinite(le));de.length&&(V=de.reduce((le,be)=>Math.max(le,this.angularDiff(l,be)),0))}}V=Math.max(V||0,15);let Y=2*V/4,j=this.niceStepFromMantissas(Y,[1,1.5,2,2.5,5,7.5,10]),Ce=l-2*j,me=l+2*j;this.chart.options.scales.x.min=Ce,this.chart.options.scales.x.max=me;let ae=this.chart.options.scales;ae.x.ticks=ge(ne({},ae.x.ticks??{}),{stepSize:j}),this.xCenter=l,this.xStep=j}let m=this.chart.data.datasets[7]?.data;if(m&&m.length){let A=m.length-1,C=m[A]?.x??0,_=this.chart.data.datasets[8].data[A]?.x??C,M=this.chart.data.datasets[9].data[A]?.x??C,B=Math.abs(C-_),D=Math.abs(M-C),V=Math.max(B,D);V=Math.max(V,.5);let Y=2*V/4,j=this.niceStepFromMantissas(Y,[1,2,2.5,5,10]),Ce=C-2*j,me=C+2*j,ae=this.chart.options.scales;ae.xSpeed.min=Ce,ae.xSpeed.max=me,ae.xSpeed.ticks=ge(ne({},ae.xSpeed.ticks??{}),{stepSize:j}),this.xCenterSpeed=C,this.xStepSpeed=j}let g=this.getWindowMs(this.datasetConfig?.timeScaleFormat);if(this.chart.data.datasets[0].data.length>0){let A=Date.now();this.chart.data.datasets.forEach(D=>{D.data.forEach(V=>{let F=V.ts??V.y;V.y=Math.max(0,Math.min(g,A-F))})}),this.chart.options.scales.y.min=0,this.chart.options.scales.y.max=g;let C;switch(this.datasetConfig?.timeScaleFormat){case"Last Minute":C=15e3;break;case"Last 5 Minutes":C=6e4;break;case"Last 30 Minutes":C=5*6e4;break;default:C=g/5;break}let M=this.chart.options.scales,B=ne({},M.y.ticks??{});delete B.count,B.stepSize=C,M.y.ticks=B}}getWindowMs(e){switch(e){case"Last 30 Minutes":return 30*6e4;case"Last 5 Minutes":return 5*6e4;case"Last Minute":return 6e4;default:return 6e4}}lineGradientForAxis(e,t,i){let a=t.chartArea;if(!a)return null;let r=t.scales?.[i];if(!r)return null;let s=t.options?.scales,l=r,m=s?.[i]?.min??l.min,g=s?.[i]?.max??l.max;if(typeof m!="number"||typeof g!="number"||!isFinite(m)||!isFinite(g))return null;let v=(m+g)/2,A=r.getPixelForValue(v),C=Math.max(0,Math.min(1,(A-a.left)/a.width)),_=e.createLinearGradient(a.left,0,a.right,0);return _.addColorStop(0,this.theme().port),_.addColorStop(C,this.theme().port),_.addColorStop(C,this.theme().starboard),_.addColorStop(1,this.theme().starboard),_}setDatasetsColors(){this.lineChartData.datasets.forEach(e=>{e.label==="Value"&&(e.borderColor=this.getThemeColors().valueLine,e.backgroundColor=this.getThemeColors().valueFill),e.label==="Value Speed"&&(e.borderColor=this.getThemeColors().valueLine,e.backgroundColor=this.getThemeColors().valueFill)})}getThemeColors(){let e=this.runtime?.options()?.color,t={valueLine:null,valueFill:null,averageLine:null,averageFill:null,averageChartLine:null,chartLabel:null,chartValue:null};switch(e){case"contrast":t.valueLine=this.theme().contrastDim,t.valueFill=this.theme().contrastDimmer,t.averageLine=this.theme().contrast,t.averageFill=this.theme().contrast,t.chartValue=this.theme().contrast,t.averageChartLine=this.theme().contrast,t.chartLabel=this.theme().contrastDim;break;case"blue":t.valueLine=this.theme().blueDim,t.valueFill=this.theme().blueDimmer,t.averageLine=this.theme().blue,t.averageFill=this.theme().blue,t.chartValue=this.theme().blue,t.averageChartLine=this.theme().blueDim,t.chartLabel=this.theme().blueDim;break;case"green":t.valueLine=this.theme().greenDim,t.valueFill=this.theme().greenDimmer,t.averageLine=this.theme().green,t.averageFill=this.theme().green,t.chartValue=this.theme().green,t.averageChartLine=this.theme().greenDim,t.chartLabel=this.theme().greenDim;break;case"pink":t.valueLine=this.theme().pinkDim,t.valueFill=this.theme().pinkDimmer,t.averageLine=this.theme().pink,t.averageFill=this.theme().pink,t.chartValue=this.theme().pink,t.averageChartLine=this.theme().pinkDim,t.chartLabel=this.theme().pinkDim;break;case"orange":t.valueLine=this.theme().orangeDim,t.valueFill=this.theme().orangeDimmer,t.averageLine=this.theme().orange,t.averageFill=this.theme().orange,t.chartValue=this.theme().orange,t.averageChartLine=this.theme().orangeDim,t.chartLabel=this.theme().orangeDim;break;case"purple":t.valueLine=this.theme().purpleDim,t.valueFill=this.theme().purpleDimmer,t.averageLine=this.theme().purple,t.averageFill=this.theme().purple,t.chartValue=this.theme().purple,t.averageChartLine=this.theme().purpleDim,t.chartLabel=this.theme().purpleDim;break;case"grey":t.valueLine=this.theme().greyDim,t.valueFill=this.theme().greyDimmer,t.averageLine=this.theme().grey,t.averageFill=this.theme().grey,t.chartValue=this.theme().grey,t.averageChartLine=this.theme().greyDim,t.chartLabel=this.theme().greyDim;break;case"yellow":t.valueLine=this.theme().yellowDim,t.valueFill=this.theme().yellowDimmer,t.averageLine=this.theme().yellow,t.averageFill=this.theme().yellow,t.chartValue=this.theme().yellow,t.averageChartLine=this.theme().yellowDim,t.chartLabel=this.theme().yellowDim;break}return t}nearlyEqual(e,t,i=1e-6){if(!Number.isFinite(e)||!Number.isFinite(t))return!1;let a=Math.max(1,Math.max(Math.abs(e),Math.abs(t)));return Math.abs(e-t)<=i*a}resolveTickColor(e,t,i){let r=t.options.ticks?.color;return typeof r=="function"?r({chart:e,scale:t,tick:{value:i}})??Ct.defaults.color:typeof r=="string"?r:Ct.defaults.color}axisTopLabelY(e){return e.options?.position==="top"?e.top+4:e.bottom+2}ngOnDestroy(){this._dsDirectionSub?.unsubscribe(),this._dsSpeedSub?.unsubscribe(),this.chart?.destroy();let e=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(e,{clear:!0,removeFromDom:!0})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-windtrends-chart"]],viewQuery:function(t,i){t&1&&Me(i.widgetDataChart,B1,5,Ke),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["widgetDataChart",""],[2,"z-index","inherit"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"],changeDetection:0})}return n})();function Zt(n,o,e,t=1e3,i,a,r=[500,500],s){if(a){let _=a.get(n);_&&cancelAnimationFrame(_)}o=(()=>{let _=n.getAttribute("transform");if(_){let M=/rotate\((-?\d+(\.\d+)?)/.exec(_);if(M)return parseFloat(M[1])}return o})();let m=_=>(_+360)%360;o=m(o),e=m(e);let g=e-o;g>180&&(g-=360),g<-180&&(g+=360);let v=_=>_<.5?4*_*_*_:1-Math.pow(-2*_+2,3)/2,A=_=>s?s.runOutsideAngular(_):_(),C=_=>s?s.run(_):_();A(()=>{let _=performance.now(),M=D=>{let V=D-_,F=Math.min(V/t,1),Y=v(F),j=o+g*Y;if(n.setAttribute("transform",`rotate(${j} ${r[0]} ${r[1]})`),F<1){let Ce=requestAnimationFrame(M);a&&a.set(n,Ce)}else n.setAttribute("transform",`rotate(${e} ${r[0]} ${r[1]})`),i&&C(i),a&&a.delete(n)},B=requestAnimationFrame(M);a&&a.set(n,B)})}function Ko(n,o,e,t=500,i,a,r){if(a){let m=a.get(n);m&&cancelAnimationFrame(m)}let s=m=>r?r.runOutsideAngular(m):m(),l=m=>r?r.run(m):m();s(()=>{let m=performance.now(),g=e-o,v=_=>_<.5?4*_*_*_:1-Math.pow(-2*_+2,3)/2,A=_=>{let M=_-m,B=Math.min(M/t,1),D=v(B),V=o+g*D;if(n.setAttribute("width",V.toString()),B<1){let F=requestAnimationFrame(A);a&&a.set(n,F)}else n.setAttribute("width",e.toString()),i&&l(i),a&&a.delete(n)},C=requestAnimationFrame(A);a&&a.set(n,C)})}var Om=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,Cs=n=>(n%360+360)%360,z1=(n,o)=>{let e=Cs(o)-Cs(n);return e>180&&(e-=360),e<=-180&&(e+=360),e};function Ss(n,o,e,t,i,a){let r=m=>a?a.runOutsideAngular(m):m(),s=m=>a?a.run(m):m(),l=0;return r(()=>{let m=performance.now(),g=z1(n,o),v=Cs(n),A=C=>{let _=Math.min((C-m)/e,1),M=Om(_),B=v+g*M;t(Cs(B)),_<1?l=requestAnimationFrame(A):i&&s(i)};l=requestAnimationFrame(A)}),l}var U1=(n,o,e)=>({min:n.min+(o.min-n.min)*e,mid:n.mid+(o.mid-n.mid)*e,max:n.max+(o.max-n.max)*e});function ws(n,o,e,t,i,a){let r=m=>a?a.runOutsideAngular(m):m(),s=m=>a?a.run(m):m(),l=0;return r(()=>{let m=performance.now(),g=v=>{let A=Math.min((v-m)/e,1),C=Om(A);t(U1(n,o,C)),A<1?l=requestAnimationFrame(g):i&&s(i)};l=requestAnimationFrame(g)}),l}var H1=["rotatingDial"],q1=["awaIndicator"],$1=["twaIndicator"],j1=["wptIndicator"],Y1=["setIndicator"],Z1=["cogIndicator"];function X1(n,o){n&1&&(ie(),E(0,"g",69)(1,"text",100)(2,"tspan",101),c(3,"330"),O()(),E(4,"text",102)(5,"tspan",103),c(6,"300"),O()(),E(7,"text",104)(8,"tspan",105),c(9,"W"),O()(),E(10,"text",106)(11,"tspan",107),c(12,"240"),O()(),E(13,"text",108)(14,"tspan",109),c(15,"210"),O()(),E(16,"text",110)(17,"tspan",111),c(18,"S"),O()(),E(19,"text",112)(20,"tspan",113),c(21,"150"),O()(),E(22,"text",114)(23,"tspan",115),c(24,"120"),O()(),E(25,"text",116)(26,"tspan",117),c(27,"E"),O()(),E(28,"text",118)(29,"tspan",119),c(30,"60"),O()(),E(31,"text",120)(32,"tspan",121),c(33,"30"),O()(),E(34,"text",122)(35,"tspan",123),c(36,"N"),O()()())}function Q1(n,o){n&1&&(ie(),E(0,"g",70)(1,"text",100)(2,"tspan",101),c(3,"30"),O()(),E(4,"text",102)(5,"tspan",103),c(6,"60"),O()(),E(7,"text",104)(8,"tspan",105),c(9,"90"),O()(),E(10,"text",106)(11,"tspan",107),c(12,"120"),O()(),E(13,"text",108)(14,"tspan",109),c(15,"150"),O()(),E(16,"text",110)(17,"tspan",111),c(18,"180"),O()(),E(19,"text",112)(20,"tspan",113),c(21,"150"),O()(),E(22,"text",114)(23,"tspan",115),c(24,"120"),O()(),E(25,"text",116)(26,"tspan",117),c(27,"90"),O()(),E(28,"text",118)(29,"tspan",119),c(30,"60"),O()(),E(31,"text",120)(32,"tspan",121),c(33,"30"),O()(),E(34,"text",122)(35,"tspan",123),c(36,"0"),O()()())}var Rm=([n,o],[e,t],[i,a])=>(Math.atan2(a-t,i-e)-Math.atan2(o-t,n-e)+3*Math.PI)%(2*Math.PI)-Math.PI,Vm=(()=>{class n{rotatingDial=he.required("rotatingDial");awaIndicator=he.required("awaIndicator");twaIndicator=he.required("twaIndicator");wptIndicator=he.required("wptIndicator");setIndicator=he.required("setIndicator");cogIndicator=he.required("cogIndicator");compassHeading=x.required();compassModeEnabled=x.required();courseOverGroundAngle=x(void 0);courseOverGroundEnabled=x.required();trueWindAngle=x.required();twsEnabled=x.required();twaEnabled=x.required();trueWindSpeed=x.required();trueWindSpeedUnit=x.required();appWindAngle=x.required();awsEnabled=x.required();appWindSpeed=x.required();appWindSpeedUnit=x.required();laylineAngle=x(void 0);closeHauledLineEnabled=x.required();sailSetupEnabled=x.required();windSectorEnabled=x.required();driftEnabled=x.required();driftSet=x(void 0);driftFlow=x(void 0);waypointAngle=x(void 0);waypointEnabled=x.required();trueWindMinHistoric=x(void 0);trueWindMidHistoric=x(void 0);trueWindMaxHistoric=x(void 0);compass={oldValue:0,newValue:0};twa={oldValue:0,newValue:0};awa={oldValue:0,newValue:0};wpt={oldValue:0,newValue:0};cog={oldValue:0,newValue:0};set={oldValue:0,newValue:0};compassInitialized=!1;twaInitialized=!1;awaInitialized=!1;wptInitialized=!1;cogInitialized=!1;setInitialized=!1;headingValue=w("--");trueWindHeading=0;waypointActive=w(!1);portLaylinePrev=0;stbdLaylinePrev=0;portLaylineAnimId=null;stbdLaylineAnimId=null;closeHauledLinePortPath=w("M 500,500 500,500");closeHauledLineStbdPath=w("M 500,500 500,500");portSectorPrev={min:0,mid:0,max:0};stbdSectorPrev={min:0,mid:0,max:0};portSectorAnimId=null;stbdSectorAnimId=null;portWindSectorPath=w("");stbdWindSectorPath=w("");animationFrameIds=new WeakMap;CENTER=500;RADIUS=350;ANIMATION_DURATION=900;EPS_ANGLE=1;ngZone=y(qe);setRotationImmediate(e,t){e.setAttribute("transform",`rotate(${t} 500 500)`)}constructor(){L(()=>{let e=this.waypointEnabled();G(()=>{this.waypointActive.set(e)})}),L(()=>{let e=this.compassModeEnabled(),t=this.compassHeading(),i=Number.isFinite(t)?Math.round(t):null;i!=null&&G(()=>{let a=e?i:0,r=!this.compassInitialized;r?(this.compass.oldValue=a,this.compass.newValue=a,this.compassInitialized=!0):(this.compass.oldValue=this.compass.newValue,this.compass.newValue=a),this.headingValue.set(i.toString()),this.rotatingDial()?.nativeElement&&(r||this.compass.oldValue===this.compass.newValue?this.setRotationImmediate(this.rotatingDial().nativeElement,-this.compass.newValue):Zt(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone),this.updateCloseHauledLines(!1),this.updateWindSectors(!1))})}),L(()=>{let e=this.courseOverGroundAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassModeEnabled();t!=null&&G(()=>{let a=i?this.compass.newValue:0,r=t-a,s=!this.cogInitialized;s?(this.cog.oldValue=r,this.cog.newValue=r,this.cogInitialized=!0):(this.cog.oldValue=this.cog.newValue,this.cog.newValue=r),this.cogIndicator()?.nativeElement&&(s||this.cog.oldValue===this.cog.newValue?this.setRotationImmediate(this.cogIndicator().nativeElement,this.cog.newValue):Zt(this.cogIndicator().nativeElement,this.cog.oldValue,this.cog.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{let e=this.waypointAngle();G(()=>{if(e==null||!Number.isFinite(e)){this.waypointActive.set(!1);return}this.waypointEnabled()?this.waypointActive.set(!0):this.waypointActive.set(!1);let t=!this.wptInitialized;t?(this.wpt.oldValue=e,this.wpt.newValue=e,this.wptInitialized=!0):(this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=e),this.wptIndicator()?.nativeElement&&(t||this.wpt.oldValue===this.wpt.newValue?this.setRotationImmediate(this.wptIndicator().nativeElement,this.wpt.newValue):Zt(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{let e=this.appWindAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&G(()=>{let i=!this.awaInitialized;i?(this.awa.oldValue=t,this.awa.newValue=t,this.awaInitialized=!0):(this.awa.oldValue=this.awa.newValue,this.awa.newValue=t),this.awaIndicator()?.nativeElement&&(i||this.awa.oldValue===this.awa.newValue?this.setRotationImmediate(this.awaIndicator().nativeElement,this.awa.newValue):Zt(this.awaIndicator().nativeElement,this.awa.oldValue,this.awa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone)),this.updateCloseHauledLines(!i)})}),L(()=>{let e=this.trueWindAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassModeEnabled();t!=null&&G(()=>{this.trueWindHeading=t;let a=i?this.compass.newValue*-1:0,r=this.addHeading(this.trueWindHeading,a);this.twaInitialized?(this.twa.oldValue=this.twa.newValue,this.twa.newValue=r):(this.twa.oldValue=r,this.twa.newValue=r,this.twaInitialized=!0),this.twaIndicator()?.nativeElement&&(!this.twaInitialized||this.twa.oldValue===this.twa.newValue?this.setRotationImmediate(this.twaIndicator().nativeElement,this.twa.newValue):Zt(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{this.laylineAngle(),this.closeHauledLineEnabled()&&G(()=>this.updateCloseHauledLines())}),L(()=>{let e=this.driftSet(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&G(()=>{this.setInitialized?(this.set.oldValue=this.set.newValue,this.set.newValue=t):(this.set.oldValue=t,this.set.newValue=t,this.setInitialized=!0),this.setIndicator()?.nativeElement&&(!this.setInitialized||this.set.oldValue===this.set.newValue?this.setRotationImmediate(this.setIndicator().nativeElement,this.set.newValue):Zt(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone))})}),L(()=>{let e=this.windSectorEnabled();this.trueWindMinHistoric(),this.trueWindMidHistoric(),this.trueWindMaxHistoric(),this.laylineAngle(),G(()=>{if(!e){this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.portSectorAnimId=null,this.stbdSectorAnimId=null,this.portWindSectorPath.set(""),this.stbdWindSectorPath.set("");return}this.updateWindSectors(!0)})})}updateCloseHauledLines(e=!0){if(!this.closeHauledLineEnabled())return;let t=this.compassModeEnabled(),i=t&&Number(this.compass.newValue)||0,a=t&&Number(this.awa.newValue)||0,r=Number(this.laylineAngle())||0,s=t?this.addHeading(i,this.addHeading(a,r*-1)):this.addHeading(a,r*-1);this.animateLayline(this.portLaylinePrev,s,!0,e),this.portLaylinePrev=s;let l=t?this.addHeading(i,this.addHeading(a,r)):this.addHeading(a,r);this.animateLayline(this.stbdLaylinePrev,l,!1,e),this.stbdLaylinePrev=l}animateLayline(e,t,i,a=!0){if(i&&this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),!i&&this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId),this.angleDelta(e,t)<this.EPS_ANGLE){this.drawLayline(t,i),i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;return}if(!a){this.drawLayline(t,i),i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;return}let r=Ss(e,t,this.ANIMATION_DURATION,s=>this.drawLayline(s,i),()=>{i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null},this.ngZone);i?this.portLaylineAnimId=r:this.stbdLaylineAnimId=r}drawLayline(e,t){let i=e*Math.PI/180,a=Math.floor(this.RADIUS*Math.sin(i)+this.CENTER),r=Math.floor(this.RADIUS*Math.cos(i)*-1+this.CENTER);t?this.closeHauledLinePortPath.set(`M ${this.CENTER},${this.CENTER} L ${a},${r}`):this.closeHauledLineStbdPath.set(`M ${this.CENTER},${this.CENTER} L ${a},${r}`)}windSectorsInitialized=!1;updateWindSectors(e=!0){if(!this.windSectorEnabled()||this.trueWindMinHistoric()==null||this.trueWindMidHistoric()==null||this.trueWindMaxHistoric()==null)return;let t={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()},i={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()};if(!this.windSectorsInitialized){this.windSectorsInitialized=!0,e?(this.animateWindSector(t,t,!0),this.animateWindSector(i,i,!1)):(this.portWindSectorPath.set(this.computeSectorPath(t,!0)),this.stbdWindSectorPath.set(this.computeSectorPath(i,!1))),this.portSectorPrev=t,this.stbdSectorPrev=i;return}e?this.angleDelta(this.portSectorPrev.min,t.min)<this.EPS_ANGLE&&this.angleDelta(this.portSectorPrev.mid,t.mid)<this.EPS_ANGLE&&this.angleDelta(this.portSectorPrev.max,t.max)<this.EPS_ANGLE?(this.portWindSectorPath.set(this.computeSectorPath(t,!0)),this.stbdWindSectorPath.set(this.computeSectorPath(i,!1))):(this.animateWindSector(this.portSectorPrev,t,!0),this.animateWindSector(this.stbdSectorPrev,i,!1)):(this.portWindSectorPath.set(this.computeSectorPath(t,!0)),this.stbdWindSectorPath.set(this.computeSectorPath(i,!1))),this.portSectorPrev=t,this.stbdSectorPrev=i}animateWindSector(e,t,i){if(i&&this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),!i&&this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.angleDelta(e.min,t.min)<this.EPS_ANGLE&&this.angleDelta(e.mid,t.mid)<this.EPS_ANGLE&&this.angleDelta(e.max,t.max)<this.EPS_ANGLE){let s=this.computeSectorPath(t,i);i?this.portWindSectorPath.set(s):this.stbdWindSectorPath.set(s),i?this.portSectorAnimId=null:this.stbdSectorAnimId=null;return}let r=ws(e,t,this.ANIMATION_DURATION,s=>{let l=this.computeSectorPath(s,i);i?this.portWindSectorPath.set(l):this.stbdWindSectorPath.set(l)},()=>{i?this.portSectorAnimId=null:this.stbdSectorAnimId=null},this.ngZone);i?this.portSectorAnimId=r:this.stbdSectorAnimId=r}addHeading(e=0,t=0){let i=(e+t)%360;return i<0&&(i+=360),i}ngOnDestroy(){this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId),this.portLaylineAnimId=null,this.stbdLaylineAnimId=null,this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.portSectorAnimId=null,this.stbdSectorAnimId=null;let e=[this.rotatingDial(),this.awaIndicator(),this.twaIndicator(),this.wptIndicator(),this.setIndicator(),this.cogIndicator()];for(let t of e){let i=t?.nativeElement;if(!i)continue;let a=this.animationFrameIds.get(i);a&&cancelAnimationFrame(a),this.animationFrameIds.delete(i)}}angleDelta(e,t){let i=(t-e+540)%360-180;return Math.abs(i)}computeSectorPath(e,t){let a=(Number(this.laylineAngle())||0)*(t?-1:1),r=this.compassModeEnabled(),s=r&&Number(this.compass.newValue)||0,l=Number(this.awa.newValue)||0,m=r?this.addHeading(s,this.addHeading(e.min,a)):this.addHeading(a,this.addHeading(e.min,l*-1)),g=r?this.addHeading(s,this.addHeading(e.mid,a)):this.addHeading(a,this.addHeading(e.mid,l*-1)),v=r?this.addHeading(s,this.addHeading(e.max,a)):this.addHeading(a,this.addHeading(e.max,l*-1)),A=this.RADIUS*Math.sin(m*Math.PI/180)+this.CENTER,C=this.RADIUS*Math.cos(m*Math.PI/180)*-1+this.CENTER,_=this.RADIUS*Math.sin(g*Math.PI/180)+this.CENTER,M=this.RADIUS*Math.cos(g*Math.PI/180)*-1+this.CENTER,B=this.RADIUS*Math.sin(v*Math.PI/180)+this.CENTER,D=this.RADIUS*Math.cos(v*Math.PI/180)*-1+this.CENTER,V=Math.abs(Rm([A,C],[_,M],[B,D]))>Math.PI/2?0:1,F=Rm([B,D],[A,C],[_,M])>0?0:1;return`M ${this.CENTER},${this.CENTER} L ${A},${C} A ${this.RADIUS},${this.RADIUS} 0 ${V} ${F} ${B},${D} z`}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["svg-windsteer"]],viewQuery:function(t,i){t&1&&Me(i.rotatingDial,H1,5)(i.awaIndicator,q1,5)(i.twaIndicator,$1,5)(i.wptIndicator,j1,5)(i.setIndicator,Y1,5)(i.cogIndicator,Z1,5),t&2&&ke(6)},inputs:{compassHeading:[1,"compassHeading"],compassModeEnabled:[1,"compassModeEnabled"],courseOverGroundAngle:[1,"courseOverGroundAngle"],courseOverGroundEnabled:[1,"courseOverGroundEnabled"],trueWindAngle:[1,"trueWindAngle"],twsEnabled:[1,"twsEnabled"],twaEnabled:[1,"twaEnabled"],trueWindSpeed:[1,"trueWindSpeed"],trueWindSpeedUnit:[1,"trueWindSpeedUnit"],appWindAngle:[1,"appWindAngle"],awsEnabled:[1,"awsEnabled"],appWindSpeed:[1,"appWindSpeed"],appWindSpeedUnit:[1,"appWindSpeedUnit"],laylineAngle:[1,"laylineAngle"],closeHauledLineEnabled:[1,"closeHauledLineEnabled"],sailSetupEnabled:[1,"sailSetupEnabled"],windSectorEnabled:[1,"windSectorEnabled"],driftEnabled:[1,"driftEnabled"],driftSet:[1,"driftSet"],driftFlow:[1,"driftFlow"],waypointAngle:[1,"waypointAngle"],waypointEnabled:[1,"waypointEnabled"],trueWindMinHistoric:[1,"trueWindMinHistoric"],trueWindMidHistoric:[1,"trueWindMidHistoric"],trueWindMaxHistoric:[1,"trueWindMaxHistoric"]},decls:124,vars:44,consts:[["rotatingDial",""],["wptIndicator",""],["setIndicator",""],["cogIndicator",""],["awaIndicator",""],["twaIndicator",""],["viewBox","0 0 1000 1000"],["id","defs1"],["id","linearGradient18"],["offset","0",1,"boat",2,"stop-opacity","0.71372495"],["offset","1",1,"boat",2,"stop-opacity","0"],["id","linearGradient16"],["id","linearGradient13"],["offset","0.41176471",1,"drift-arrow",2,"stop-opacity","1"],["offset","1",1,"drift-arrow",2,"stop-opacity","0"],["id","swatch4"],["offset","0","id","stop4",2,"stop-color","#000000","stop-opacity","1"],["clipPathUnits","userSpaceOnUse","id","clipPath16"],["id","ellipse16","cx","311.24539","cy","-1516.3778","rx","194.27342","ry","181.83022",2,"display","inline","fill","#9a9300","fill-opacity","1","stroke","none","stroke-width","55","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[0,"xlink","href","#linearGradient13","id","linearGradient14","x1","453.48047","y1","583.62891","x2","638.11328","y2","583.62891","gradientUnits","userSpaceOnUse","gradientTransform","matrix(0.00723393,1.2388183,-1.0538241,0.00615367,1111.2051,-179.73465)"],[0,"xlink","href","#linearGradient16","id","linearGradient17","x1","-502.04896","y1","439.35551","x2","-316","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],[0,"xlink","href","#linearGradient18","id","linearGradient19","x1","495.83999","y1","439.35551","x2","681.88895","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],["id","layerBackground",2,"display","inline"],["id","boat",2,"display","inline"],["id","portSide","d","M 498.75049,208.89453 A 267.09439,554.67401 0 0 1 678.45974,767.81661",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient19)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","starboardSide","d","m -499.13846,208.89453 a 267.09439,554.67401 0 0 1 179.70925,558.92208","transform","scale(-1,1)",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient17)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","layerCompass"],["id","fixedDial"],["id","portStarboardBackground","d","M 499.99997,10.520805 A 489.47916,489.47916 0 0 0 10.520805,499.99997 489.47916,489.47916 0 0 0 499.99997,989.47913 489.47916,489.47916 0 0 0 989.47913,499.99997 489.47916,489.47916 0 0 0 499.99997,10.520805 Z m 0,132.291665 a 357.1875,357.1875 0 0 1 357.18749,357.1875 357.1875,357.1875 0 0 1 -357.18749,357.18749 357.1875,357.1875 0 0 1 -357.1875,-357.18749 357.1875,357.1875 0 0 1 357.1875,-357.1875 z",1,"fixed-dial-background",2,"display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","port","d","M 93.283801,265.18231 A 469.63541,469.63541 0 0 1 339.37522,58.687079",1,"port",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],["id","starboard","d","M 660.62476,58.687069 A 469.63541,469.63541 0 0 1 906.71619,265.18228",1,"starboard",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],["id","barsAndText",1,"contrast-stroke",2,"display","inline"],["d","m 416.35095,19.837399 2.78142,15.77426","id","path199",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 334.23173,41.658798 5.47834,15.051615","id","path200",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 260.27336,81.806174 12.55151,21.739856","id","path37",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 187.44581,126.00035 10.29591,12.2702","id","path197",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 127.23918,185.95785 12.27019,10.29591","id","path198",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 83.252815,257.66724 21.739865,12.55151","id","path166",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 42.289518,332.39273 15.05162,5.47835","id","path195",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 20.127799,414.42077 15.774251,2.78142","id","path196",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 17.879075,498.47765 H 42.982096","id","path167",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 19.776759,583.71187 15.77426,-2.78142","id","path193",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 41.598167,665.8311 15.051615,-5.47834","id","path194",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 81.668963,739.71246 103.40883,727.16095","id","path168",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 125.93981,812.61701 12.2702,-10.29591","id","path191",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 185.89732,872.82365 10.29591,-12.27019","id","path192",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 257.53004,916.73298 12.55151,-21.73985","id","path169",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 332.33219,957.7732 5.47835,-15.05162","id","path189",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 414.36024,979.93493 2.78142,-15.77425","id","path190",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 498.34046,982.10672 V 957.0037","id","path170",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 583.65133,980.28596 580.86991,964.5117","id","path187",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 665.77057,958.46456 -5.47834,-15.05161","id","path188",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 739.57526,918.31683 727.02375,896.57698","id","path171",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 812.55647,874.12301 802.26056,861.85282","id","path185",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 872.76312,814.16551 860.49293,803.8696","id","path186",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 916.59579,742.45577 894.85593,729.90426","id","path172",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 957.71266,667.73063 -15.05161,-5.47834","id","path183",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 979.8744,585.70259 -15.77425,-2.78142","id","path184",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 981.96954,501.64535 -25.10304,10e-6","id","path173",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 980.22542,416.41149 -15.77425,2.78143","id","path181",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 958.40403,334.29226 -15.05161,5.47834","id","path182",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 918.17964,260.41055 -21.73986,12.55151","id","path174",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 874.06247,187.50636 -12.27018,10.29591","id","path180",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 817.34594,130.05494 -10.40259,12.17987","id","path179",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 742.31857,83.390025 729.76706,105.12988","id","path175",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 667.6701,42.350172 -5.47834,15.051615","id","path178",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 585.64206,20.188432 -2.78142,15.77425","id","path176",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 501.50816,18.016286 V 43.119307","id","path177",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["cx","500","cy","500","r","404",1,"rotating-dial-Backplate"],["id","dialLabelsCompass"],["id","dialLabelsPortStbd"],["id","LayerLayline"],["id","PortLayline",1,"laylines",2,"fill","none","stroke-width","5","stroke-dasharray","40, 20","stroke-dashoffset","0","stroke-opacity","0.6"],["id","StbdLayline",1,"laylines",2,"fill","none","stroke-width","5","stroke-dasharray","40, 20","stroke-dashoffset","0","stroke-opacity","0.6"],["id","LayerWindShift"],["id","portSectorShift",1,"wind-sector-port",2,"fill-opacity","0.5","stroke","none"],["id","StbdSectorShift",1,"wind-sector-stbd",2,"fill-opacity","0.5","stroke","none"],["clip-path","url(#clipPath16)","d","m 416.36313,-1521.3937 c 371.15015,24.6522 731.95257,192.9774 983.98757,467.456 227.2972,244.24389 363.1732,572.3808 369.4045,906.42978 15.9331,499.10271 -269.2071,986.17861 -700.5178,1232.88522 -485.08308,290.4843 -1134.555606,269.7346 -1599.2788,-52.7169 -404.5062,-269.24461 -653.2224,-759.35388 -614.1746,-1245.84043 30.2148,-487.61814 344.18931,-937.89997 780.52695,-1152.15867 176.96718,-89.2092 371.8823084,-142.3103 569.54914,-156.0363","transform","matrix(0.28310615,0,0,0.32000828,411.88452,661.64815)",1,"next-waypoint-bar",2,"display","inline","fill","none","stroke-width","30","stroke-miterlimit","0"],["id","path6341","cx","500","cy","175.00002","rx","17.361122","ry","17.361118",1,"next-waypoint",2,"display","inline","fill","none","stroke-width","15.2778","stroke-dasharray","none"],["id","setArrow","d","m 563.93337,480.60403 -64.4901,-94.9673 -63.37665,95.71396 58.48691,-30.71299 0.77713,133.08346 c 0.0992,16.99331 2.52916,30.65913 5.44822,30.64209 2.91911,-0.0171 5.18926,-13.71032 5.09001,-30.70362 l -0.77782,-133.20444 z",2,"fill","url(#linearGradient14)","stroke","none","stroke-width","1.18648"],["id","layerCounter"],["id","twsCounter"],[0,"xml","space","preserve","x","904.27722","y","150.88913","id","text43",1,"true-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","903.84814","y","114.73512","id","text42",1,"true-wind",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","905.25897","y","52.894646","id","text41",1,"true-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],["id","awsCounter"],[0,"xml","space","preserve","x","94.554222","y","150.88913","id","text39",1,"app-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","94.580925","y","114.63747","id","text40",1,"app-wind",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],[0,"xml","space","preserve","x","95.967644","y","52.894646","id","text39-7",1,"app-wind-label",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","14.5521","stroke-miterlimit","0"],["id","layerCurrent"],["id","text11",0,"xml","space","preserve","x","499.78842","y","523.55145",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["id","layerIndicators",2,"display","inline"],["d","m 506.20767,172.99458 a 6.3888631,8.8250643 0 0 1 -6.38888,8.82508 6.3888631,8.8250643 0 0 1 -6.38888,-8.82508 6.3888631,8.8250643 0 0 1 6.38888,-8.82509 6.3888631,8.8250643 0 0 1 6.38888,8.82509 z M 476.25472,30.811298 493.47058,13.265068 c 3.6173,-3.6867571 9.44162,-3.6867571 13.05892,0 l 17.21586,17.546106 c 3.6173,3.686743 3.6173,9.622786 0,13.309544 l -17.21595,17.54623 c -3.61721,3.686757 -9.44153,3.686757 -13.05893,0 L 476.25472,44.120841 c -3.6174,-3.686743 -3.6174,-9.622924 0,-13.309543 z m 17.20533,-16.510116 h 12.77766 V 173.26408 h -12.77766 z",1,"course-over-ground",2,"stroke-width","14.7329","stroke-linecap","square"],["d","m 451.77021,55.078207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,279.76529 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,70.966036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.7935953,0,0,0.92686935,101.84848,11.000842)",1,"app-wind",2,"display","inline","stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","500","y","110",1,"card-color",2,"font-weight","bold","font-size","70px","font-family","Roboto","text-align","center","text-anchor","middle","display","inline","stroke","none"],["d","m 451.77021,55.078207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,279.76529 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,70.966036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.60410307,0,0,0.70555435,196.91787,21.152867)",1,"true-wind",2,"display","inline","stroke","none","stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","500","y","110","id","text10",1,"card-color",2,"font-weight","bold","font-size","60px","font-family","Roboto","text-align","center","text-anchor","middle","display","inline","stroke","none"],["id","layerHeading",2,"display","inline"],["id","rect1","width","256.47919","height","108.5428","x","371.76041","y","10.805443","rx","23.757372",1,"heading-background",2,"stroke-width","4.43107","stroke-linejoin","bevel","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","0.509946"],["x","511.29395","y","102.86786",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","106.667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","5","stroke-linejoin","bevel","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[0,"xml","space","preserve","x","181.91386","y","284.25186","id","text3","transform","rotate(-30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan3","x","181.91386","y","284.25186",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-183.53558","y","283.74811","id","text14","transform","rotate(-60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan14","x","-183.53558","y","283.74811",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-499.70761","y","100.95312","id","text15","transform","rotate(-90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan15","x","-499.70761","y","100.95312",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.66119","y","-216.36243","id","text16","transform","rotate(-120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["x","-681.66119","y","-216.36243","id","tspan25",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.06616","y","-581.71271","id","text17","transform","rotate(-150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan17","x","-681.06616","y","-581.71271",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-498.3313","y","-897.40875","id","text18","transform","scale(-1)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan18","x","-498.3313","y","-897.40875",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-184.41313","y","-1080.8452","id","text19","transform","rotate(150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan19","x","-184.41313","y","-1080.8452",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","181.57225","y","-1080.8853","id","text20","transform","rotate(120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan20","x","181.57225","y","-1080.8853",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","501.42661","y","-896.93701","id","text21","transform","rotate(90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan21","x","501.42661","y","-896.93701",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","682.35815","y","-579.63336","id","text22","transform","rotate(60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan22","x","682.35815","y","-579.63336",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","681.81525","y","-214.27321","id","text23","transform","rotate(30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan23","x","681.81525","y","-214.27321",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","500.15503","y","101.96342","id","text24",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan24","x","500.15503","y","101.96342",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"]],template:function(t,i){t&1&&(ie(),E(0,"svg",6)(1,"defs",7)(2,"linearGradient",8),Q(3,"stop",9)(4,"stop",10),O(),E(5,"linearGradient",11),Q(6,"stop",9)(7,"stop",10),O(),E(8,"linearGradient",12),Q(9,"stop",13)(10,"stop",14),O(),E(11,"linearGradient",15),Q(12,"stop",16),O(),E(13,"clipPath",17),Q(14,"ellipse",18),O(),Q(15,"linearGradient",19)(16,"linearGradient",20)(17,"linearGradient",21),O(),E(18,"g",22)(19,"g",23),Q(20,"path",24)(21,"path",25),O()(),E(22,"g",26)(23,"g",27),Q(24,"path",28)(25,"path",29)(26,"path",30),O(),E(27,"g",null,0)(29,"g",31),Q(30,"path",32)(31,"path",33)(32,"path",34)(33,"path",35)(34,"path",36)(35,"path",37)(36,"path",38)(37,"path",39)(38,"path",40)(39,"path",41)(40,"path",42)(41,"path",43)(42,"path",44)(43,"path",45)(44,"path",46)(45,"path",47)(46,"path",48)(47,"path",49)(48,"path",50)(49,"path",51)(50,"path",52)(51,"path",53)(52,"path",54)(53,"path",55)(54,"path",56)(55,"path",57)(56,"path",58)(57,"path",59)(58,"path",60)(59,"path",61)(60,"path",62)(61,"path",63)(62,"path",64)(63,"path",65)(64,"path",66)(65,"path",67)(66,"circle",68),I(67,X1,37,0,":svg:g",69)(68,Q1,37,0,":svg:g",70),O(),E(69,"g",71),Q(70,"path",72)(71,"path",73),O(),E(72,"g",74),Q(73,"path",75)(74,"path",76),O(),E(75,"g",null,1),Q(77,"path",77)(78,"ellipse",78),O(),E(79,"g",null,2),Q(81,"path",79),O()()(),E(82,"g",80)(83,"g",81)(84,"text",82),c(85),O(),E(86,"text",83),c(87),ct(88,"number"),O(),E(89,"text",84),c(90,"TWS"),O()(),E(91,"g",85)(92,"text",86),c(93),O(),E(94,"text",87),c(95),ct(96,"number"),O(),E(97,"text",88),c(98,"AWS"),O()()(),E(99,"g",89)(100,"text",90),c(101),ct(102,"number"),O()(),E(103,"g",91)(104,"g",null,3),Q(106,"path",92),O(),E(107,"g",null,4),Q(109,"path",93),E(110,"text",94),c(111,"A"),O()(),E(112,"g",null,5),Q(114,"path",95),E(115,"text",96),c(116,"T"),O()()(),E(117,"g",97),Q(118,"rect",98),E(119,"text",99)(120,"tspan"),c(121),E(122,"tspan"),c(123,"\xB0"),O()()()()()),t&2&&(f(67),N(i.compassModeEnabled()?67:68),f(2),xe("display",i.closeHauledLineEnabled()?"inline":"none"),f(),xe("display",i.appWindAngle()!=null?"inline":"none"),J("d",i.closeHauledLineStbdPath()),f(),xe("display",i.appWindAngle()!=null?"inline":"none"),J("d",i.closeHauledLinePortPath()),f(),xe("display",i.windSectorEnabled()?"inline":"none"),f(),xe("display",i.portWindSectorPath()?"inline":"none"),J("d",i.portWindSectorPath()||null),f(),xe("display",i.stbdWindSectorPath()?"inline":"none"),J("d",i.stbdWindSectorPath()||null),f(),J("display",i.waypointActive()?"inline":"none"),f(4),xe("display",i.driftEnabled()?"inline":"none"),f(4),xe("display",i.twsEnabled()?"inline":"none"),f(2),K(i.trueWindSpeedUnit()),f(2),K(xn(88,35,i.trueWindSpeed(),"1.1-1")??"--"),f(4),xe("display",i.awsEnabled()?"inline":"none"),f(2),K(i.appWindSpeedUnit()),f(2),K(xn(96,38,i.appWindSpeed(),"1.1-1")??"--"),f(4),xe("display",i.driftEnabled()?"inline":"none"),f(2),K(xn(102,41,i.driftFlow(),"1.1-1")??"--"),f(3),J("display",i.courseOverGroundEnabled()?"inline":"none"),f(8),xe("display",i.twaEnabled()?"inline":"none"),f(9),K(i.headingValue()))},dependencies:[Ha],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;left:0;top:0}.fixed-dial-background[_ngcontent-%COMP%]{fill:var(--kip-grey-color)}.rotating-dial-Backplate[_ngcontent-%COMP%]{stroke:var(--mat-sys-background);fill:none;stroke-width:95}.starboard[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color)}.port[_ngcontent-%COMP%]{stroke:var(--kip-port-color)}.heading-background[_ngcontent-%COMP%]{stroke:var(--kip-grey-color);fill:var(--kip-widget-card-background-color)}.boat[_ngcontent-%COMP%]{stop-color:var(--kip-grey-color)!important}.contrast-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.contrast-stroke[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color)}.card-color[_ngcontent-%COMP%]{fill:var(--kip-widget-card-background-color)}.true-wind[_ngcontent-%COMP%]{fill:var(--kip-yellow-color)}.true-wind-label[_ngcontent-%COMP%]{fill:var(--kip-yellow-dim-color)}.app-wind[_ngcontent-%COMP%]{fill:var(--kip-orange-color)}.app-wind-label[_ngcontent-%COMP%]{fill:var(--kip-orange-dim-color)}.course-over-ground[_ngcontent-%COMP%]{fill:var(--kip-pink-color)}.next-waypoint[_ngcontent-%COMP%]{stroke:var(--kip-green-color)}.next-waypoint-bar[_ngcontent-%COMP%]{stroke:var(--kip-grey-color)}.laylines[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color)}.wind-sector-port[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.wind-sector-stbd[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.drift-arrow[_ngcontent-%COMP%]{stop-color:var(--kip-blue-color)}"],changeDetection:0})}return n})();var Lm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,filterSelfPaths:!0,paths:{headingPath:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},appWindAngle:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},appWindSpeed:{description:"Apparent Wind Speed",path:"self.environment.wind.speedApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:1e3},trueWindAngle:{description:"True Wind Angle",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},trueWindSpeed:{description:"True Wind Speed",path:"self.environment.wind.speedTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:1e3},courseOverGround:{description:"True Course Over Ground",path:"self.navigation.courseOverGroundTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,convertUnitTo:"deg",sampleTime:1e3},nextWaypointBearing:{description:"Next Waypoint True Bearing",path:"self.navigation.course.calcValues.bearingTrue",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},set:{description:"True Drift Set",path:"self.environment.current.setTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",showConvertUnitTo:!1,sampleTime:1e3},drift:{description:"Drift Speed Impact",path:"self.environment.current.drift",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:1e3}},compassModeEnabled:!0,windSectorEnable:!0,windSectorWindowSeconds:5,laylineEnable:!0,laylineAngle:40,waypointEnable:!0,courseOverGroundEnable:!0,driftEnable:!0,awsEnable:!0,twsEnable:!0,twaEnable:!0,sailSetupEnable:!1,enableTimeout:!1,dataTimeout:5};runtime=y(Se);stream=y(We);zones=y(qe);cdr=y(Si);hasHeading=!1;hasCOG=!1;hasAWA=!1;hasAWS=!1;hasTWA=!1;hasTWS=!1;hasSet=!1;hasDrift=!1;hasWPT=!1;currentHeading=w(0);courseOverGroundAngle=w(0);appWindAngle=w(0);appWindSpeed=w(0);appWindSpeedUnit=w("");trueWindAngle=w(0);trueWindSpeed=w(0);trueWindSpeedUnit=w("");driftFlow=w(0);driftSet=w(0);waypointAngle=w(0);historicalWindDirection=[];trueWindMinHistoric=w(void 0);trueWindMidHistoric=w(void 0);trueWindMaxHistoric=w(void 0);windSectorObservableSub=null;windSamples=[];windMinDeque=[];windMaxDeque=[];windSampleIndex=0;lastUnwrapped=null;lastSector={};markScheduled=!1;scheduleRafId=null;DEG_EPSILON=1;SPEED_EPSILON=.1;constructor(){L(()=>{let e=this.runtime.options();e&&G(()=>{this.appWindSpeedUnit.set(e.paths.appWindSpeed.convertUnitTo),this.trueWindSpeedUnit.set(e.paths.trueWindSpeed.convertUnitTo),this.registerStreams(),this.stopWindSectors(),this.startWindSectors()})})}onHeadingUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=this.normalizeAngle(e.data.value);(!this.hasHeading||this.angleDelta(this.currentHeading(),t)>=this.DEG_EPSILON)&&(this.currentHeading.set(t),this.hasHeading=!0,this.scheduleMarkForCheck())};onCOGUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=this.normalizeAngle(e.data.value);(!this.hasCOG||this.angleDelta(this.courseOverGroundAngle(),t)>=this.DEG_EPSILON)&&(this.courseOverGroundAngle.set(t),this.hasCOG=!0,this.scheduleMarkForCheck())};onDriftUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value;(!this.hasDrift||Math.abs(this.driftFlow()-t)>=this.SPEED_EPSILON)&&(this.driftFlow.set(t),this.hasDrift=!0,this.scheduleMarkForCheck())};onSetUpdate=e=>{e.data.value==null&&(e.data.value=0);let t=this.normalizeAngle(e.data.value);(!this.hasSet||this.angleDelta(this.driftSet(),t)>=this.DEG_EPSILON)&&(this.driftSet.set(t),this.hasSet=!0,this.scheduleMarkForCheck())};onWaypointUpdate=e=>{let t=e.data.value,i=this.normalizeAngle(t);(!this.hasWPT||this.angleDelta(this.waypointAngle(),i)>=this.DEG_EPSILON)&&(this.waypointAngle.set(i),this.hasWPT=!0,this.scheduleMarkForCheck())};onAppWindAngle=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value,i=this.normalizeAngle(t);(!this.hasAWA||this.angleDelta(this.appWindAngle(),i)>=this.DEG_EPSILON)&&(this.appWindAngle.set(i),this.hasAWA=!0,this.runtime.options()?.windSectorEnable&&this.addHistoricalWindDirection(this.normalizeAngle(t)),this.scheduleMarkForCheck())};onAppWindSpeed=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value;(!this.hasAWS||Math.abs(this.appWindSpeed()-t)>=this.SPEED_EPSILON)&&(this.appWindSpeed.set(t),this.hasAWS=!0,this.scheduleMarkForCheck())};onTrueWindSpeed=e=>{e.data.value==null&&(e.data.value=0);let t=e.data.value;(!this.hasTWS||Math.abs(this.trueWindSpeed()-t)>=this.SPEED_EPSILON)&&(this.trueWindSpeed.set(t),this.hasTWS=!0,this.scheduleMarkForCheck())};onTrueWindAngle=e=>{e.data.value==null&&(e.data.value=0);let i=this.runtime.options()?.paths.trueWindAngle.path||"",a=i.includes("angleTrueWater")||i.includes("angleTrueGround")?this.addHeading(this.currentHeading(),e.data.value):e.data.value,r=this.normalizeAngle(a);(!this.hasTWA||this.angleDelta(this.trueWindAngle(),r)>=this.DEG_EPSILON)&&(this.trueWindAngle.set(r),this.hasTWA=!0,this.scheduleMarkForCheck())};registerStreams(){this.runtime.options()&&this.zones.runOutsideAngular(()=>{this.stream.observe("headingPath",this.onHeadingUpdate),this.stream.observe("courseOverGround",this.onCOGUpdate),this.stream.observe("drift",this.onDriftUpdate),this.stream.observe("set",this.onSetUpdate),this.stream.observe("nextWaypointBearing",this.onWaypointUpdate),this.stream.observe("appWindAngle",this.onAppWindAngle),this.stream.observe("appWindSpeed",this.onAppWindSpeed),this.stream.observe("trueWindSpeed",this.onTrueWindSpeed),this.stream.observe("trueWindAngle",this.onTrueWindAngle)})}ngOnDestroy(){this.stopWindSectors(),this.scheduleRafId!=null&&(cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=null)}startWindSectors(){if(this.windSamples=[],this.windMinDeque=[],this.windMaxDeque=[],this.windSampleIndex=0,this.lastUnwrapped=null,this.lastSector={},!this.runtime.options()?.windSectorEnable){this.trueWindMinHistoric.set(void 0),this.trueWindMidHistoric.set(void 0),this.trueWindMaxHistoric.set(void 0),this.lastSector={},this.scheduleMarkForCheck();return}this.zones.runOutsideAngular(()=>{this.windSectorObservableSub=Sr(1e3).subscribe(()=>{this.historicalCleanup()})})}addHistoricalWindDirection(e){let t=Date.now(),i=this.unwrapAngle(e),a=this.windSampleIndex++;for(this.windSamples.push({t,u:i,i:a});this.windMinDeque.length&&this.windMinDeque[this.windMinDeque.length-1].u>=i;)this.windMinDeque.pop();for(this.windMinDeque.push({i:a,u:i});this.windMaxDeque.length&&this.windMaxDeque[this.windMaxDeque.length-1].u<=i;)this.windMaxDeque.pop();this.windMaxDeque.push({i:a,u:i})}historicalCleanup(){if(!this.runtime.options()?.windSectorEnable)return;let e=Date.now()-this.runtime.options().windSectorWindowSeconds*1e3;for(;this.windSamples.length&&this.windSamples[0].t<e;){let g=this.windSamples.shift();if(!g)break;this.windMinDeque.length&&this.windMinDeque[0].i===g.i&&this.windMinDeque.shift(),this.windMaxDeque.length&&this.windMaxDeque[0].i===g.i&&this.windMaxDeque.shift()}if(!this.windSamples.length||!this.windMinDeque.length||!this.windMaxDeque.length){(this.trueWindMinHistoric()!==void 0||this.trueWindMidHistoric()!==void 0||this.trueWindMaxHistoric()!==void 0)&&(this.trueWindMinHistoric.set(void 0),this.trueWindMidHistoric.set(void 0),this.trueWindMaxHistoric.set(void 0),this.lastSector={},this.scheduleMarkForCheck());return}let t=this.windMinDeque[0].u,i=this.windMaxDeque[0].u,a=(t+i)/2,r=this.normalizeAngle(t),s=this.normalizeAngle(a),l=this.normalizeAngle(i);(this.lastSector.min===void 0||this.angleDelta(this.lastSector.min,r)>=this.DEG_EPSILON||this.lastSector.mid===void 0||this.angleDelta(this.lastSector.mid,s)>=this.DEG_EPSILON||this.lastSector.max===void 0||this.angleDelta(this.lastSector.max,l)>=this.DEG_EPSILON)&&(this.trueWindMinHistoric.set(r),this.trueWindMidHistoric.set(s),this.trueWindMaxHistoric.set(l),this.lastSector={min:r,mid:s,max:l},this.scheduleMarkForCheck())}stopWindSectors(){this.windSectorObservableSub?.unsubscribe()}unwrapAngle(e){if(this.lastUnwrapped==null)return this.lastUnwrapped=e,e;let t=this.lastUnwrapped,i=(t%360+360)%360,a=(e-i+540)%360-180,r=t+a;return this.lastUnwrapped=r,r}normalizeAngle(e){return(e%360+360)%360}addHeading(e,t){let i=(e+t)%360;return i<0&&(i+=360),i}angleDelta(e,t){let i=(t-e+540)%360-180;return Math.abs(i)}scheduleMarkForCheck(){this.markScheduled||(this.markScheduled=!0,this.zones.runOutsideAngular(()=>{this.scheduleRafId=requestAnimationFrame(()=>{this.zones.run(()=>{this.cdr.markForCheck()}),this.markScheduled=!1,this.scheduleRafId=null})}))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-wind-steer"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:25,consts:[[3,"compassHeading","compassModeEnabled","courseOverGroundAngle","courseOverGroundEnabled","trueWindAngle","twsEnabled","twaEnabled","trueWindSpeed","trueWindSpeedUnit","appWindAngle","awsEnabled","appWindSpeed","appWindSpeedUnit","laylineAngle","closeHauledLineEnabled","windSectorEnabled","driftEnabled","driftFlow","driftSet","waypointAngle","waypointEnabled","trueWindMinHistoric","trueWindMidHistoric","trueWindMaxHistoric","sailSetupEnabled"]],template:function(t,i){if(t&1&&W(0,"svg-windsteer",0),t&2){let a,r,s,l,m,g,v,A,C,_,M;R("compassHeading",i.currentHeading())("compassModeEnabled",(a=i.runtime.options())==null?null:a.compassModeEnabled)("courseOverGroundAngle",i.courseOverGroundAngle())("courseOverGroundEnabled",(r=i.runtime.options())==null?null:r.courseOverGroundEnable)("trueWindAngle",i.trueWindAngle())("twsEnabled",(s=i.runtime.options())==null?null:s.twsEnable)("twaEnabled",(l=i.runtime.options())==null?null:l.twaEnable)("trueWindSpeed",i.trueWindSpeed())("trueWindSpeedUnit",i.trueWindSpeedUnit())("appWindAngle",i.appWindAngle())("awsEnabled",(m=i.runtime.options())==null?null:m.awsEnable)("appWindSpeed",i.appWindSpeed())("appWindSpeedUnit",i.appWindSpeedUnit())("laylineAngle",(g=i.runtime.options())==null?null:g.laylineAngle)("closeHauledLineEnabled",(v=i.runtime.options())==null?null:v.laylineEnable)("windSectorEnabled",(A=i.runtime.options())==null?null:A.windSectorEnable)("driftEnabled",(C=i.runtime.options())==null?null:C.driftEnable)("driftFlow",i.driftFlow())("driftSet",i.driftSet())("waypointAngle",i.waypointAngle())("waypointEnabled",(_=i.runtime.options())==null?null:_.waypointEnable)("trueWindMinHistoric",i.trueWindMinHistoric())("trueWindMidHistoric",i.trueWindMidHistoric())("trueWindMaxHistoric",i.trueWindMaxHistoric())("sailSetupEnabled",((M=i.runtime.options())==null?null:M.sailSetupEnable)??!1)}},dependencies:[Vm],encapsulation:2,changeDetection:0})}return n})();function K1(n,o){if(n&1){let e=we();d(0,"h3"),c(1,"Getting Started"),u(),d(2,"p"),c(3,"Welcome to KIP! Here are some basic gestures to help you navigate the application. Access the "),d(4,"a",1),c(5,"KIP Help"),u(),c(6," documentation to learn more about KIP."),u(),d(7,"table",2)(8,"thead")(9,"tr")(10,"th"),c(11,"Actions"),u(),d(12,"th"),c(13,"Touch"),u(),d(14,"th"),c(15,"Mouse"),u(),d(16,"th"),c(17,"Keyboard Shortcuts"),u()()(),d(18,"tbody")(19,"tr")(20,"td"),c(21,"Open Actions menu"),u(),d(22,"td"),c(23,"Swipe left"),u(),d(24,"td"),c(25,"Click, drag left, and release"),u(),d(26,"td")(27,"kbd"),c(28,"Shift"),u(),c(29," + "),d(30,"kbd"),c(31,"Ctrl"),u(),c(32," + "),d(33,"kbd",3),c(34,"\u2190"),u(),c(35," (Left Arrow)"),u()(),d(36,"tr")(37,"td"),c(38,"Open Notification menu"),u(),d(39,"td"),c(40,"Swipe right"),u(),d(41,"td"),c(42,"Click, drag right, and release"),u(),d(43,"td")(44,"kbd"),c(45,"Shift"),u(),c(46," + "),d(47,"kbd"),c(48,"Ctrl"),u(),c(49," + "),d(50,"kbd",3),c(51,"\u2192"),u(),c(52," (Right Arrow)"),u()(),d(53,"tr")(54,"td"),c(55,"Cycle through dashboards"),u(),d(56,"td"),c(57,"Swipe up/down"),u(),d(58,"td"),c(59,"Click, drag up/down, and release"),u(),d(60,"td")(61,"kbd"),c(62,"Shift"),u(),c(63," + "),d(64,"kbd"),c(65,"Ctrl"),u(),c(66," + "),d(67,"kbd",3),c(68,"\u2191"),u(),c(69,"/"),d(70,"kbd",3),c(71,"\u2193"),u(),c(72," (Up/Down Arrow)"),u()(),d(73,"tr")(74,"td"),c(75,"Toggle Fullscreen"),u(),d(76,"td"),c(77,"N/A"),u(),d(78,"td"),c(79,"N/A"),u(),d(80,"td")(81,"kbd"),c(82,"Shift"),u(),c(83," + "),d(84,"kbd"),c(85,"Ctrl"),u(),c(86," + "),d(87,"kbd"),c(88,"F"),u()()(),d(89,"tr")(90,"td"),c(91,"Toggle Night mode"),u(),d(92,"td"),c(93,"N/A"),u(),d(94,"td"),c(95,"N/A"),u(),d(96,"td")(97,"kbd"),c(98,"Shift"),u(),c(99," + "),d(100,"kbd"),c(101,"Ctrl"),u(),c(102," + "),d(103,"kbd"),c(104,"N"),u()()(),d(105,"tr")(106,"td"),c(107,"Toggle dashboard edit mode"),u(),d(108,"td"),c(109,"N/A"),u(),d(110,"td"),c(111,"N/A"),u(),d(112,"td")(113,"kbd"),c(114,"Shift"),u(),c(115," + "),d(116,"kbd"),c(117,"Ctrl"),u(),c(118," + "),d(119,"kbd"),c(120,"E"),u()()()()(),d(121,"i"),c(122,"Note that the words Touch and Tap are synonymous with mouse Click."),u(),W(123,"br")(124,"br"),d(125,"h3"),c(126,"Login to Signal K"),u(),d(127,"p"),c(128," The first step is to configure Signal K server authentication ("),d(129,"i"),c(130,"a pre-existing Signal K server username and password is required"),u(),c(131,"). Go to KIP's Connectivity options, toggle "),d(132,"strong"),c(133,"Login to server"),u(),c(134,", enter your Signal K credentials and click "),d(135,"strong"),c(136,"Sign in"),u(),c(137,". Once completed, click the upper right X button to get back to this dashboard ("),d(138,"a",4),c(139,"Connectivity options"),u(),c(140,"). "),u(),d(141,"ul")(142,"li"),c(143," If you don\u2019t have a Signal K account, ask your captain or access the Signal K Admin Settings / Users page and create a user. "),u(),d(144,"li"),c(145," If you see an error, double-check your username and password, and make sure your device is on the same network as your Signal K server. "),u()(),d(146,"h3"),c(147,"Option 1: Load Demonstration Dashboards"),u(),d(148,"p"),c(149," Try the sample dashboards using data from your server: "),W(150,"br"),d(151,"button",5),U("click",function(){ee(e);let i=k();return te(i.loadDemoConfig())}),c(152,"Load Demo"),u()(),d(153,"h3"),c(154,"Option 2: Create Your Own Layout"),u(),d(155,"p"),c(156,' The text you are reading is actually a widget that fills half of the dashboard. The screen is split in halves at the middle. This mode is called Chartplotter mode. It can later be turned off in Settings / Options / Display. Dashboards are "Locked" by default to prevent accidental modifications. To edit a dashboard, swipe left and hit the bottom unlock menu button. Note that you can add and manage dashboards using the Settings button from the Actions menu. '),u(),d(157,"p")(158,"strong"),c(159,"Try editing the Dashboard now to receive further instructions!"),u()()}}function J1(n,o){n&1&&(d(0,"h2"),c(1,"Changing Layouts"),u(),c(2," Follow these simple steps to learn how to change your dashboard layout: "),d(3,"ol")(4,"li"),c(5,"Resize this Tutorial widget using the now visible dashed borders or corners arrows. Resize it so it does not take up all the screen. You need free space in your dashboard to add more widgets. You can delete this Tutorial widget later when you are done with the instructions."),u(),d(6,"li"),c(7,"Touch & Hold or Click & Hold in an empty area to open the Add Widget selection panel."),u(),d(8,"li"),c(9,"Choose a widget from the selection panel to add it to the dashboard."),u()(),d(10,"h3"),c(11,"Possible widget operations"),u(),d(12,"ul")(13,"li")(14,"strong"),c(15,"Touch and drag"),u(),c(16," to move widgets"),u(),d(17,"li")(18,"strong"),c(19,"Drag corners and sides"),u(),c(20," to resize widgets"),u(),d(21,"li")(22,"strong"),c(23,"Double Tap"),u(),c(24," on a widget to configure it"),u(),d(25,"li")(26,"strong"),c(27,"Press and Hold"),u(),c(28," on a widget to delete or duplicate widgets"),u()(),d(29,"h2"),c(30,"Exiting dashboard edit mode"),u(),d(31,"p"),c(32,"Use the Save or Cancel buttons in the lower right corner to either persist your changes or revert changes."),u(),d(33,"h2"),c(34,"Adding more dashboards"),u(),d(35,"p"),c(36,"Swipe left and hit the Dashboards button. From this page you can add, rename, order, delete, and duplicate entire dashboards."),u())}var Wm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={filterSelfPaths:!0};dashboard=y(yt);settings=y(Wt);loadDemoConfig(){this.settings.loadDemoConfig()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-tutorial"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[[1,"tutorial-container"],["routerLink","/help"],[1,"nav-table"],[2,"font-size","x-large"],["routerLink","/options"],["mat-flat-button","",2,"margin-left","15px",3,"click"]],template:function(t,i){t&1&&(d(0,"div",0),I(1,K1,160,0)(2,J1,37,0),u()),t&2&&(f(),N(i.dashboard.isDashboardStatic()?1:2))},dependencies:[wt,Zr],styles:[".tutorial-container[_ngcontent-%COMP%]{position:absolute;top:0;left:0;display:block;height:100%;width:100%;overflow-y:auto}.tutorial-container[_ngcontent-%COMP%]{padding:0 15px}.nav-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;margin-bottom:2em}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .nav-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #bbb;padding:.5em 1em;text-align:center}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#ddd;color:#222;font-weight:700}.nav-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background:#242424}.warning[_ngcontent-%COMP%]{color:#b71c1c}.button-group[_ngcontent-%COMP%]{margin-top:2em;display:flex;gap:20px}a[_ngcontent-%COMP%]:visited, a[_ngcontent-%COMP%]:link{color:var(--kip-blue-color)}"],changeDetection:0})}return n})();var eA=["canvas"],Qn=(()=>{class n{text=x.required();color=x.required();canvasRef=he.required("canvas");canvas=y(ht);canvasElement;canvasCtx;isReady=!1;cssWidth=0;cssHeight=0;constructor(){}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.drawTitle()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.isReady=!0,this.drawTitle()}ngOnChanges(e){(e.text||e.color)&&this.drawTitle()}drawTitle(){this.isReady&&this.canvas.drawTitle(this.canvasCtx,this.text(),this.color(),"normal",this.cssWidth,this.cssHeight)}ngOnDestroy(){try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}this.canvasCtx=null,this.canvasElement=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-title"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,eA,5),t&2&&ke()},inputs:{text:[1,"text"],color:[1,"color"]},features:[Qi],decls:3,vars:0,consts:[["canvas",""],[1,"title-wrapper"],[1,"title-canvas"]],template:function(t,i){t&1&&(E(0,"div",1),Q(1,"canvas",2,0),O())},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;z-index:10}.title-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.title-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}"]})}return n})();var Xt=(()=>{class n{resizeChange=new oi;kipResize=new oi;el=y(Ke);ro=null;constructor(){this.ro=new ResizeObserver(e=>{let t=e[e.length-1],{width:i,height:a}=t.contentRect;this.resizeChange.emit(t),this.kipResize.emit({width:i,height:a,entry:t})}),this.ro.observe(this.el.nativeElement)}ngOnDestroy(){this.ro?.disconnect(),this.ro=null}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["","kipResizeObserver",""]],outputs:{resizeChange:"resizeChange",kipResize:"kipResize"}})}return n})();var tA=["svgSlider"];function iA(n,o){n&1&&W(0,"div",10)}var Fm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"Slider Label",filterSelfPaths:!0,paths:{gaugePath:{description:"PUT Supported Numeric Path. IMPORTANT: Format must be set to (base)",path:null,source:null,pathType:"number",isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,showConvertUnitTo:!1,convertUnitTo:null,supportsPut:!0,sampleTime:500}},displayScale:{lower:0,upper:1,type:"linear"},enableTimeout:!1,dataTimeout:5,color:"contrast"};runtime=y(Se);streams=y(We);svgElement=he.required("svgSlider");dashboard=y(yt);signalkRequestsService=y(di);toast=y(nn);labelColor=w(void 0);barColor=w(void 0);lineStartPx;lineWidthPx;lineEndPx;resizeTimeout=null;handlePositionView=w(20);lineWidthView=X(()=>`${Math.max(0,this.handlePositionView()-this.LINE_START)}px`);pathValue=0;lineStart=20;isDragStarted=!1;VIEWBOX_WIDTH=200;LINE_START=20;LINE_WIDTH=160;colorMap=null;valueChange$=new zt;constructor(){L(()=>{let e=this.theme(),t=this.runtime.options();!t||!e||G(()=>{this.ensureColorMap(),this.getColors(t.color)})}),L(()=>{let e=this.runtime.options(),t=e?.paths?.gaugePath?.path;!e||!t||G(()=>{this.calculateLineBounds(),this.streams.observe("gaugePath",i=>{if(!i||!i.data){queueMicrotask(()=>this.updateHandlePosition(this.mapValueToPosition(e.displayScale.lower)));return}queueMicrotask(()=>this.updateHandlePosition(this.mapValueToPosition(i.data.value)))})})})}ngOnInit(){let e=this.runtime.options();e&&this.getColors(e.color),this.valueChange$.pipe(Kt(t=>{let i=this.runtime.options();return i?this.isWithinMargin(t,i.displayScale.lower,i)?i.displayScale.lower:this.isWithinMargin(t,i.displayScale.upper,i)?i.displayScale.upper:parseFloat(t.toFixed(2)):t}),In(200),wr()).subscribe(t=>{this.sendValue(t)})}mapValueToPosition(e){let t=this.runtime.options();if(!t)return e;let i=t.displayScale.upper-t.displayScale.lower,a=this.LINE_WIDTH;return(e-t.displayScale.lower)/i*a+this.LINE_START}mapPositionToValue(e){let t=this.runtime.options();if(!t)return e;let i=t.displayScale.upper-t.displayScale.lower,a=this.LINE_WIDTH;return(e-this.LINE_START)/a*i+t.displayScale.lower}isWithinMargin(e,t,i){let a=(i.displayScale.upper-i.displayScale.lower)*.01;return Math.abs(e-t)<=a}sendValue(e){let t=this.runtime.options()?.paths?.gaugePath?.path;this.signalkRequestsService.putRequest(t,e,this.id())}onResized(){this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{this.calculateLineBounds()},200)}calculateLineBounds(){if(!this.svgElement()?.nativeElement){console.warn("[Slider Widget] SVG element is not initialized yet.");return}let e=this.svgElement().nativeElement.getBoundingClientRect(),t=this.LINE_START/this.VIEWBOX_WIDTH*e.width,i=this.LINE_WIDTH/this.VIEWBOX_WIDTH*e.width;this.lineStartPx=t,this.lineWidthPx=i,this.lineEndPx=this.lineStartPx+this.lineWidthPx}updateHandlePosition(e){let t=Math.max(this.LINE_START,Math.min(this.LINE_START+this.LINE_WIDTH,e));this.handlePositionView.set(t)}getPointerX(e){return e.clientX-this.svgElement().nativeElement.getBoundingClientRect().left}onPointerDown(e){this.isDragStarted=!0,this.onPointerMove(e),e.stopPropagation(),e.preventDefault()}onPointerMove(e){if(this.isDragStarted){let t=this.getPointerX(e);if(t>=this.lineStartPx&&t<=this.lineEndPx){let i=(t-this.lineStartPx)/this.lineWidthPx*this.LINE_WIDTH+this.LINE_START;this.updateHandlePosition(i);let a=this.handlePositionView(),r=this.runtime.options();r&&a<=this.LINE_START?this.pathValue=r.displayScale.lower:r&&a>=this.LINE_START+this.LINE_WIDTH?this.pathValue=r.displayScale.upper:this.pathValue=this.mapPositionToValue(a),this.valueChange$.next(this.pathValue)}}}onPointerUp(){this.isDragStarted=!1,this.valueChange$.next(this.pathValue)}onPointerLeave(){this.isDragStarted&&(this.isDragStarted=!1,this.valueChange$.next(this.pathValue))}getColors(e){if(this.ensureColorMap(),!this.colorMap)return;let t=this.colorMap.get(e)||this.colorMap.get("contrast");this.labelColor.set(t.label),this.barColor.set(t.bar)}ensureColorMap(){let e=this.theme();e&&(this.colorMap=new Map([["contrast",{label:e.contrastDim,bar:e.contrast}],["blue",{label:e.blueDim,bar:e.blue}],["green",{label:e.greenDim,bar:e.green}],["pink",{label:e.pinkDim,bar:e.pink}],["orange",{label:e.orangeDim,bar:e.orange}],["purple",{label:e.purpleDim,bar:e.purple}],["grey",{label:e.greyDim,bar:e.grey}],["yellow",{label:e.yellowDim,bar:e.yellow}]]))}ngOnDestroy(){this.valueChange$.complete(),this.resizeTimeout&&clearTimeout(this.resizeTimeout)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-slider"]],viewQuery:function(t,i){t&1&&Me(i.svgElement,tA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:11,vars:7,consts:[["svgSlider",""],[3,"text","color"],["kipResizeObserver","",1,"widgets-container",3,"resizeChange"],["width","100%","height","100%","viewBox","0 40 200 40"],["width","160","height","8","rx","4.5","id","rect3","x","20","y","56",1,"slider-bg-bar",2,"display","inline","stroke-width","1.57144"],["height","8","rx","4.5","id","rect3","x","20","y","56",2,"display","inline","stroke-width","1.57144"],["id","g22"],["cy","60","fill","#ffffff","id","circle3","r","19.549999",2,"display","inline","fill","#4d4d4d","fill-opacity","1","stroke","#8c8c8c","stroke-width","0.9","stroke-dasharray","none","stroke-opacity","1"],["cy","60","fill","#ffffff","id","circle3-3","r","17.950001",2,"display","inline","fill","#ffffff","fill-opacity","1","stroke","#e6e6e6","stroke-width","1.8","stroke-dasharray","none","stroke-opacity","0.97"],["cursor","pointer","width","200","height","40","x","0","y","40",2,"display","inline","fill","rgba(0, 0, 0, 0)","stroke","none","stroke-width","0.3","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0",3,"pointerdown","pointerup","pointermove","pointerleave"],[1,"widgetOverlay"]],template:function(t,i){if(t&1&&(W(0,"widget-title",1),d(1,"div",2),U("resizeChange",function(){return i.onResized()}),ie(),d(2,"svg",3),W(3,"rect",4)(4,"rect",5),d(5,"g",6),W(6,"circle",7)(7,"circle",8),u(),d(8,"rect",9,0),U("pointerdown",function(r){return i.onPointerDown(r)})("pointerup",function(){return i.onPointerUp()})("pointermove",function(r){return i.onPointerMove(r)})("pointerleave",function(){return i.onPointerLeave()}),u()(),I(10,iA,1,0,"div",10),u()),t&2){let a;R("text",i.runtime==null||(a=i.runtime.options())==null?null:a.displayName)("color",i.labelColor()),f(4),J("width",i.lineWidthView())("fill",i.barColor()),f(2),J("cx",i.handlePositionView()),f(),J("cx",i.handlePositionView()),f(3),N(i.dashboard.isDashboardStatic()?-1:10)}},dependencies:[Xt,Qn],styles:[".widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20;padding:0 20px}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}.slider-bg-bar[_ngcontent-%COMP%]{fill:var(--mat-sys-inverse-on-surface)}"],changeDetection:0})}return n})();var nA=["gaugeBarAnimate"];function aA(n,o){if(n&1&&(ie(),Q(0,"rect",14)),n&2){let e=o.$implicit,t=k();J("fill",e.color)("x",5+(e.from-t.gaugeMinValue())*t.scaleSliceValue())("width",(e.to-e.from)*t.scaleSliceValue())}}var Gm=(()=>{class n{gaugeBarAnimate=he("gaugeBarAnimate");displayName=x.required();displayNameColor=x.required();dataValue=x.required();dataValueLabel=x.required();unitLabel=x.required();barColor=x.required();barColorGradient=x.required();barColorBackground=x.required();gaugeMinValue=x.required();gaugeMaxValue=x.required();highlights=x.required();scaleSliceValue=X(()=>{let e=this.gaugeMaxValue()-this.gaugeMinValue();return e!==0?195/e:0});newGaugeValue=w(null);oldGaugeValue=w(null);firstRenderApplied=!1;scheduleRafId=null;constructor(){L(()=>{let e=this.gaugeMinValue(),t=this.dataValue();t==null&&(t=e);let i=(t-e)*this.scaleSliceValue();G(()=>{let a=this.newGaugeValue();!this.firstRenderApplied||a===null?(this.oldGaugeValue.set(i),this.newGaugeValue.set(i),this.firstRenderApplied=!0):(this.oldGaugeValue.set(a),this.newGaugeValue.set(i)),this.gaugeBarAnimate()?.nativeElement&&(this.scheduleRafId!==null&&cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=requestAnimationFrame(()=>{let r=this.gaugeBarAnimate();r?.nativeElement&&r.nativeElement.beginElement(),this.scheduleRafId=null}))})})}ngOnDestroy(){this.scheduleRafId!==null&&(cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["svg-simple-linear-gauge"]],viewQuery:function(t,i){t&1&&Me(i.gaugeBarAnimate,nA,5),t&2&&ke()},inputs:{displayName:[1,"displayName"],displayNameColor:[1,"displayNameColor"],dataValue:[1,"dataValue"],dataValueLabel:[1,"dataValueLabel"],unitLabel:[1,"unitLabel"],barColor:[1,"barColor"],barColorGradient:[1,"barColorGradient"],barColorBackground:[1,"barColorBackground"],gaugeMinValue:[1,"gaugeMinValue"],gaugeMaxValue:[1,"gaugeMaxValue"],highlights:[1,"highlights"]},decls:26,vars:11,consts:[["gaugeBarAnimate",""],["viewBox","0 0 205 50","preserveAspectRatio","xMidYMid","version","1.1","id","svg8",1,"svg-simple-linear"],["id","defs2"],["id","gaugeBarGradient"],["id","stop849","offset","0",2,"stop-opacity","1"],["id","stop851","offset","0.40",2,"stop-opacity","0"],["id","linearGradient855","gradientTransform","translate(5,-30)","gradientUnits","userSpaceOnUse","y2","34.5","x2","-5","y1","34.5","x1","-6","href","#gaugeBarGradient"],["id","layer1",2,"display","inline"],["id","GaugeBackground","width","195","height","9","x","5","y","30","ry","0",2,"opacity","1","fill-opacity","1","stroke","none","stroke-width","0.265899","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["id","gaugeBar"],["id","gaugeValue","width","1","height","9","x","0","y","0","ry","0",2,"mix-blend-mode","normal","fill-opacity","1","stroke","none"],["id","gaugeValueGradient","transform","scale(-1,1)","width","1","height","9","x","-1","y","0","ry","0",2,"display","inline","opacity","1","mix-blend-mode","multiply","fill","url(#linearGradient855)","stroke","none"],[0,"xlink","href","#gaugeBar","transform","translate(5,30)"],["attributeName","transform","type","scale","begin","indefinite","dur","0.5s","additive","sum","fill","freeze"],["y","39.5","height","0.75","ry","0",2,"opacity","1","fill-opacity","1","stroke","none","stroke-width","0.265899","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["id","layer2",2,"display","inline"],[0,"xml","space","preserve","x","4.1731763","y","25.413595","id","displayNameText",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","12.7px","line-height","1.25","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","letter-spacing","0px","word-spacing","0px"],["id","tspan1945","x","4.1731763","y","25.413595",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","12.7px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["text-anchor","end","id","gaugeTexts","y","25.293016","x","200.37138",0,"xml","space","preserve",1,"simpleLinear-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","22.5778px","line-height","1.25","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","letter-spacing","0px","word-spacing","0px"],["y","25.293016","x","200.37138","id","valueText",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","22.5778px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["dy","-9","id","unitText",2,"text-transform","capitalize","font-size","9.87778px"]],template:function(t,i){t&1&&(ie(),E(0,"svg",1)(1,"defs",2)(2,"linearGradient",3),Q(3,"stop",4)(4,"stop",5),O(),Q(5,"linearGradient",6),O(),E(6,"g",7),Q(7,"rect",8),E(8,"defs")(9,"g",9),Q(10,"rect",10)(11,"rect",11),O()(),E(12,"use",12),Q(13,"animateTransform",13,0),O(),Ae(15,aA,1,3,":svg:rect",14,Ne),O(),E(17,"g",15)(18,"text",16)(19,"tspan",17),c(20),O()(),E(21,"text",18)(22,"tspan",19),c(23),O(),E(24,"tspan",20),c(25),O()()()()),t&2&&(f(3),J("stop-color",i.barColorGradient()),f(),J("stop-color",i.barColorGradient()),f(3),J("fill",i.barColorBackground()),f(5),xe("fill",i.barColor()),f(),J("from",i.oldGaugeValue()+" 1")("to",i.newGaugeValue()+" 1"),f(2),ye(i.highlights()),f(4),J("fill",i.displayNameColor()),f(),fe(" ",i.displayName()),f(3),K(i.dataValueLabel()),f(2),K(i.unitLabel()))},styles:["svg[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;left:0;top:0}.simpleLinear-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}"],changeDetection:0})}return n})();var mi=(()=>{class n{metaWidget=x();dataService=y(Ot);destroyRef=y(ze);_metaConfig=w(void 0);_meta=w(null);reset$=new zt;currentSub;pathSignature;zones=X(()=>this._meta()?.zones||[]);possibleValues=X(()=>this._meta()?.possibleValues||[]);supportsPut=X(()=>this._meta()?.supportsPut||!1);observe(e){let t=this._metaConfig();if(!t?.paths||Object.keys(t.paths).length===0)return;let i=e??Object.keys(t.paths)[0],a=t.paths[i]?.path;if(!a)return;let r=a;this.pathSignature!==r&&(this.pathSignature=r,this.subscribePathMeta(a))}subscribePathMeta(e){this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0);let t=this.dataService.getPathMetaObservable(e).pipe(Dr(this.reset$),Le(this.destroyRef)).subscribe(i=>{this._meta.set(i)});this.currentSub=t}setMetaConfig(e){this._metaConfig.set(e)}applyMetaConfigDiff(e){this._metaConfig.set(e),this.pathSignature&&this.observe()}reset(){this.reset$.next(),this.reset$.complete(),this.reset$=new zt,this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0),this.pathSignature=void 0,this._meta.set(null)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["","widget-metadata",""]],inputs:{metaWidget:[1,"metaWidget"]},exportAs:["widgetMetadata"]})}return n})();function go(n,o,e,t,i,a,r=!1){let s=[],l=[...n].sort((m,g)=>(m.lower??-1/0)-(g.lower??-1/0));for(let m of l){let g=null,v=null,A;switch(m.state){case ve.Emergency:A=o.zoneEmergency;break;case ve.Alarm:A=o.zoneAlarm;break;case ve.Warn:A=o.zoneWarn;break;case ve.Alert:A=o.zoneAlert;break;case ve.Nominal:A=o.zoneNominal;break;default:A="rgba(0,0,0,0)"}if(m.lower==null?g=i:g=t.convertToUnit(e,m.lower),m.upper==null?v=a:v=t.convertToUnit(e,m.upper),!(!Number.isFinite(g)||!Number.isFinite(v))&&!(v<i||g>a)){if(g=Math.max(g,i),v>a){v=a,s.push({from:g,to:v,color:A});break}s.push({from:g,to:v,color:A})}}return r&&(s=s.map(m=>({from:a-m.to,to:a-m.from,color:m.color}))),s}var Bm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:"V",convertUnitTo:"V",sampleTime:500}},displayScale:{lower:0,upper:15,type:"linear"},gauge:{type:"simpleLinear",unitLabelFormat:"full"},numInt:1,numDecimal:2,ignoreZones:!1,color:"contrast",enableTimeout:!1,dataTimeout:5};runtime=y(Se);streams=y(We);metadata=y(mi,{optional:!0});unitsService=y(it);unitsLabel=w("");dataLabelValue=w("0");dataValue=w(null);barColor=w("");barColorGradient=w("");barColorBackground=w("");highlights=X(()=>{let e=this.runtime.options(),t=this.theme();if(!e||!t)return[];if(e.ignoreZones||!this.metadata)return[];let i=this.metadata.zones();if(!i?.length)return[];let a=e.paths.gaugePath.convertUnitTo,r=e.displayScale.lower,s=e.displayScale.upper;return go(i,t,a,this.unitsService,r,s)});lastState=null;constructor(){L(()=>{let e=this.runtime.options(),t=e?.paths?.gaugePath?.path;!e||!t||G(()=>{this.streams.observe("gaugePath",a=>{let r=this.theme();if(!e||!r)return;let s=a?.data?.value;if(s==null)this.dataValue.set(e.displayScale.lower),this.dataLabelValue.set("--");else{let l=Math.min(Math.max(s,e.displayScale.lower),e.displayScale.upper);this.dataValue.set(l),this.dataLabelValue.set(l.toFixed(e.numDecimal))}if(!e.ignoreZones){let l=a?.state;if(l&&l!==this.lastState)switch(this.lastState=l,l){case ve.Alarm:this.barColor.set(r.zoneAlarm);break;case ve.Warn:this.barColor.set(r.zoneWarn);break;case ve.Alert:this.barColor.set(r.zoneAlert);break;case ve.Nominal:this.barColor.set(r.zoneNominal);break;default:this.barColor.set(Te(e.color,r).color);break}}});let i=e.paths.gaugePath.convertUnitTo;this.unitsLabel.set(e.gauge.unitLabelFormat==="abr"?i?.substring(0,1):i)})}),L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{this.barColorBackground.set(t.background);let i=Te(e.color,t);if(e.ignoreZones)this.barColor.set(i.color);else if(this.lastState)switch(this.lastState){case ve.Alarm:this.barColor.set(t.zoneAlarm);break;case ve.Warn:this.barColor.set(t.zoneWarn);break;case ve.Alert:this.barColor.set(t.zoneAlert);break;case ve.Nominal:this.barColor.set(t.zoneNominal);break;default:this.barColor.set(i.color);break}else this.barColor.set(i.color);this.barColorGradient.set(i.dimmer||i.dim||i.color)})}),L(()=>{let e=this.runtime.options();!e||e.ignoreZones||!this.metadata||G(()=>this.metadata.observe("gaugePath"))})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-simple-linear"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:11,consts:[[1,"simpleLinearGaugeContainer",3,"displayName","displayNameColor","unitLabel","dataValue","dataValueLabel","barColor","barColorGradient","barColorBackground","gaugeMaxValue","gaugeMinValue","highlights"]],template:function(t,i){if(t&1&&W(0,"svg-simple-linear-gauge",0),t&2){let a,r=i.runtime.options();R("displayName",r.displayName)("displayNameColor",(a=i.theme())==null?null:a.contrastDim)("unitLabel",i.unitsLabel())("dataValue",i.dataValue())("dataValueLabel",i.dataLabelValue())("barColor",i.barColor())("barColorGradient",i.barColorGradient())("barColorBackground",i.barColorBackground())("gaugeMaxValue",r.displayScale.upper)("gaugeMinValue",r.displayScale.lower)("highlights",i.highlights())}},dependencies:[Gm],styles:[".simpleLinearGaugeContainer[_ngcontent-%COMP%]{display:block;position:relative;height:100%;width:100%;padding:0}"],changeDetection:0})}return n})();var rA=["rotatingDial"],sA=["twaIndicator"],lA=["wptIndicator"],dA=["setIndicator"],cA=["tackIndicator"],zm=([n,o],[e,t],[i,a])=>(Math.atan2(a-t,i-e)-Math.atan2(o-t,n-e)+3*Math.PI)%(2*Math.PI)-Math.PI,Um=(()=>{class n{rotatingDial=he.required("rotatingDial");twaIndicator=he.required("twaIndicator");wptIndicator=he.required("wptIndicator");setIndicator=he.required("setIndicator");tackIndicator=he.required("tackIndicator");compassHeading=x.required();tackTrue=x.required();polarSpeedRatio=x.required();trueWindAngle=x.required();trueWindSpeed=x.required();targetAngle=x.required();optimalWindAngle=x.required();targetVMG=x.required();VMG=x.required();sailSetupEnabled=x.required();driftEnabled=x.required();driftSet=x(void 0);driftFlow=x(void 0);waypointEnabled=x.required();waypointAngle=x(void 0);vmgToWaypoint=x(void 0);trueWindMinHistoric=x(void 0);trueWindMidHistoric=x(void 0);trueWindMaxHistoric=x(void 0);gradianColor=x.required();compass={oldValue:0,newValue:0};twa={oldValue:0,newValue:0};wpt={oldValue:0,newValue:0};tack={oldValue:0,newValue:0};set={oldValue:0,newValue:0};compassInitialized=!1;twaInitialized=!1;wptInitialized=!1;tackInitialized=!1;setInitialized=!1;laylinesInitialized=!1;headingValue=w("--");windSectorsInitialized=!1;trueWindHeading=0;nextTargetDirection=X(()=>{let e=this.compassHeading(),t=this.tackTrue();return e==null||t==null?0:this.unsignedAngleDelta(e,t)});trueWindSpeedDisplay=X(()=>{let e=this.trueWindSpeed();return e==null?"--":e.toFixed(1)});windAnglePerformanceRatioColor=X(()=>{let e=this.optimalWindAngle(),t=this.targetAngle(),i=this.gradianColor().start,a=this.gradianColor().stop;if(e==null||t==null)return i;let r=1-Math.abs(e-t)/180;return this.interpolateColor(i,a,r)});targetVMGOffset=X(()=>{let e=this.VMG(),t=this.targetVMG();return e==null||t==null?"--":(e-t).toFixed(1)});targetVMGOffsetRatioColor=X(()=>{let e=this.VMG(),t=this.targetVMG(),i=this.gradianColor().start,a=this.gradianColor().stop;if(e==null||t==null)return i;let r=e/t;return this.interpolateColor(i,a,r)});waypointActive=w(!1);flow=X(()=>{let e=this.driftFlow();return e==null?"--":e.toFixed(1)});portLaylinePrev=0;stbdLaylinePrev=0;portLaylineAnimId=null;stbdLaylineAnimId=null;CENTER_X=600;CENTER_Y=620;RADIUS=540;ANIMATION_DURATION=1e3;laylinePortPath=w(`M ${this.CENTER_X},${this.CENTER_Y} ${this.CENTER_X},${this.CENTER_Y}`);laylineStbdPath=w(`M ${this.CENTER_X},${this.CENTER_Y} ${this.CENTER_X},${this.CENTER_Y}`);portSectorPrev={min:0,mid:0,max:0};stbdSectorPrev={min:0,mid:0,max:0};portSectorAnimId=null;stbdSectorAnimId=null;portWindSectorPath=w("");stbdWindSectorPath=w("");speedLineTipY=w(620);speedTipPoints=w("600,570 580,600 620,600");speedRatioColor=w("");speedLinePrevRatio=0;speedLinePrevTipY=600;speedLineAnimId=null;speedLineInitialized=!1;animationFrameIds=new WeakMap;ngZone=y(qe);setRotationImmediate(e,t){e.setAttribute("transform",`rotate(${t} 600 620)`)}constructor(){L(()=>{let e=this.waypointEnabled();G(()=>{this.waypointActive.set(e)})}),L(()=>{let e=this.compassHeading(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&G(()=>{this.compassInitialized?(this.compass.oldValue=this.compass.newValue,this.compass.newValue=t):(this.compass.oldValue=t,this.compass.newValue=t,this.compassInitialized=!0),this.headingValue.set(t.toString()),this.rotatingDial()?.nativeElement&&(this.compass.oldValue===this.compass.newValue?this.setRotationImmediate(this.rotatingDial().nativeElement,-this.compass.newValue):Zt(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateWindSectors())})}),L(()=>{let e=this.targetAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&G(()=>{this.tackInitialized?(this.tack.oldValue=this.tack.newValue,this.tack.newValue=t):(this.tack.oldValue=t,this.tack.newValue=t,this.tackInitialized=!0),this.tackIndicator()?.nativeElement&&(this.tack.oldValue===this.tack.newValue?this.setRotationImmediate(this.tackIndicator().nativeElement,this.tack.newValue):Zt(this.tackIndicator().nativeElement,this.tack.oldValue,this.tack.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620])),this.updateLaylines()})}),L(()=>{let e=this.waypointAngle();G(()=>{if(!e){this.waypointActive.set(!1);return}this.waypointEnabled()?this.waypointActive.set(!0):this.waypointActive.set(!1),this.wptInitialized?(this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=e):(this.wpt.oldValue=e,this.wpt.newValue=e,this.wptInitialized=!0),this.wptIndicator()?.nativeElement&&(this.wpt.oldValue===this.wpt.newValue?this.setRotationImmediate(this.wptIndicator().nativeElement,this.wpt.newValue):Zt(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620]))})}),L(()=>{let e=this.trueWindAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassHeading(),a=Number.isFinite(i)?Math.round(i):null;t==null||a==null||G(()=>{this.trueWindHeading=t;let r=this.addHeading(this.trueWindHeading,a*-1);this.twaInitialized?(this.twa.oldValue=this.twa.newValue,this.twa.newValue=r):(this.twa.oldValue=r,this.twa.newValue=r,this.twaInitialized=!0),this.twaIndicator()?.nativeElement&&(this.twa.oldValue===this.twa.newValue?this.setRotationImmediate(this.twaIndicator().nativeElement,this.twa.newValue):Zt(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateLaylines())})}),L(()=>{let e=this.polarSpeedRatio(),t=Math.max(0,Math.min(1,e)),i=620,r=i-166,s=i-r*t;if(!this.speedLineInitialized){this.speedLineInitialized=!0,this.speedLineTipY.set(s);let l=30,m=20,g=s-l;this.speedTipPoints.set(`600,${g} ${600-m},${s} ${600+m},${s}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,t)),this.speedLinePrevTipY=s,this.speedLinePrevRatio=t;return}this.animateSpeedLine(this.speedLinePrevTipY,s),this.speedLinePrevTipY=s,this.speedLinePrevRatio=t}),L(()=>{let e=this.driftSet(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&G(()=>{this.setInitialized?(this.set.oldValue=this.set.newValue,this.set.newValue=t):(this.set.oldValue=t,this.set.newValue=t,this.setInitialized=!0),this.setIndicator()?.nativeElement&&(this.set.oldValue===this.set.newValue?this.setRotationImmediate(this.setIndicator().nativeElement,this.set.newValue):Zt(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone))})})}updateLaylines(){if(!this.twaInitialized)return;let e=this.targetAngle(),t=Number.isFinite(e)?Math.round(e):null;if(t==null)return;t=t/2;let i=Number(this.twa.newValue),a=i-t,r=i+t;if(!this.laylinesInitialized){this.laylinesInitialized=!0,this.setLaylinePath(a,!0),this.setLaylinePath(r,!1),this.portLaylinePrev=a,this.stbdLaylinePrev=r;return}this.animateLayline(this.portLaylinePrev,a,!0),this.portLaylinePrev=a,this.animateLayline(this.stbdLaylinePrev,r,!1),this.stbdLaylinePrev=r}animateLayline(e,t,i){i&&this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),!i&&this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId);let a=()=>{i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null},r=Ss(e,t,this.ANIMATION_DURATION,s=>this.setLaylinePath(s,i),a,this.ngZone);i?this.portLaylineAnimId=r:this.stbdLaylineAnimId=r}updateWindSectors(){if(this.trueWindMinHistoric()==null||this.trueWindMidHistoric()==null||this.trueWindMaxHistoric()==null)return;let e={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()},t={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()};if(!this.windSectorsInitialized){this.portSectorPrev=e,this.stbdSectorPrev=t,this.windSectorsInitialized=!0,this.animateWindSector(e,e,!0),this.animateWindSector(t,t,!1);return}this.animateWindSector(this.portSectorPrev,e,!0),this.animateWindSector(this.stbdSectorPrev,t,!1),this.portSectorPrev=e,this.stbdSectorPrev=t}animateWindSector(e,t,i){i&&this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),!i&&this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId);let a=()=>{i?this.portSectorAnimId=null:this.stbdSectorAnimId=null},r=ws(e,t,this.ANIMATION_DURATION,s=>this.setWindSectorPath(s,i),a,this.ngZone);i?this.portSectorAnimId=r:this.stbdSectorAnimId=r}animateSpeedLine(e,t){this.speedLineAnimId&&(cancelAnimationFrame(this.speedLineAnimId),this.speedLineAnimId=null);let i=1e3,a=performance.now(),r=this.speedLinePrevRatio,s=(600-t)/454,l=g=>g<.5?4*g*g*g:1-Math.pow(-2*g+2,3)/2,m=g=>{let v=g-a,A=Math.min(v/i,1),C=l(A),_=(Y,j)=>Y+(j-Y)*C,M=_(e,t),B=_(r,s);this.speedLineTipY.set(M);let D=30,V=20,F=M-D;this.speedTipPoints.set(`600,${F} ${600-V},${M} ${600+V},${M}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,B)),A<1?this.speedLineAnimId=requestAnimationFrame(m):this.speedLineAnimId=null};requestAnimationFrame(m)}interpolateColor(e,t,i){i=Math.max(0,Math.min(1,i));function a(M){M=M.replace("#",""),M.length===3&&(M=M.split("").map(D=>D+D).join(""));let B=parseInt(M,16);return[B>>16&255,B>>8&255,B&255]}let[r,s,l]=a(e),[m,g,v]=a(t),A=Math.round(r+(m-r)*i),C=Math.round(s+(g-s)*i),_=Math.round(l+(v-l)*i);return`rgb(${A},${C},${_})`}addHeading(e=0,t=0){return((e+t)%360+360)%360}unsignedAngleDelta(e,t){let i=(e-t+540)%360-180;return Math.abs(i)}normalizeAngle(e){return(e%360+360)%360}setLaylinePath(e,t){let i=this.normalizeAngle(e)*Math.PI/180,a=Math.floor(this.RADIUS*Math.sin(i)+this.CENTER_X),r=Math.floor(this.RADIUS*Math.cos(i)*-1+this.CENTER_Y);t?this.laylinePortPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${r}`):this.laylineStbdPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${r}`)}setWindSectorPath(e,t){let i=this.addHeading(this.addHeading(e.min,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),a=this.addHeading(this.addHeading(e.mid,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),r=this.addHeading(this.addHeading(e.max,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),s=this.RADIUS*Math.sin(i*Math.PI/180)+this.CENTER_X,l=this.RADIUS*Math.cos(i*Math.PI/180)*-1+this.CENTER_Y,m=this.RADIUS*Math.sin(a*Math.PI/180)+this.CENTER_X,g=this.RADIUS*Math.cos(a*Math.PI/180)*-1+this.CENTER_Y,v=this.RADIUS*Math.sin(r*Math.PI/180)+this.CENTER_X,A=this.RADIUS*Math.cos(r*Math.PI/180)*-1+this.CENTER_Y,C=Math.abs(zm([s,l],[m,g],[v,A]))>Math.PI/2?0:1,_=zm([v,A],[s,l],[m,g])>0?0:1,M=`M ${this.CENTER_X},${this.CENTER_Y} L ${s},${l} A ${this.RADIUS},${this.RADIUS} 0 ${C} ${_} ${v},${A} z`;t?this.portWindSectorPath.set(M):this.stbdWindSectorPath.set(M)}ngOnDestroy(){this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId),this.portLaylineAnimId=null,this.stbdLaylineAnimId=null,this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId),this.portSectorAnimId=null,this.stbdSectorAnimId=null;let e=[this.rotatingDial(),this.twaIndicator(),this.wptIndicator(),this.setIndicator()];for(let t of e){let i=t?.nativeElement;if(!i)continue;let a=this.animationFrameIds.get(i);a&&cancelAnimationFrame(a),this.animationFrameIds.delete(i)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["svg-racesteer"]],viewQuery:function(t,i){t&1&&Me(i.rotatingDial,rA,5)(i.twaIndicator,sA,5)(i.wptIndicator,lA,5)(i.setIndicator,dA,5)(i.tackIndicator,cA,5),t&2&&ke(5)},inputs:{compassHeading:[1,"compassHeading"],tackTrue:[1,"tackTrue"],polarSpeedRatio:[1,"polarSpeedRatio"],trueWindAngle:[1,"trueWindAngle"],trueWindSpeed:[1,"trueWindSpeed"],targetAngle:[1,"targetAngle"],optimalWindAngle:[1,"optimalWindAngle"],targetVMG:[1,"targetVMG"],VMG:[1,"VMG"],sailSetupEnabled:[1,"sailSetupEnabled"],driftEnabled:[1,"driftEnabled"],driftSet:[1,"driftSet"],driftFlow:[1,"driftFlow"],waypointEnabled:[1,"waypointEnabled"],waypointAngle:[1,"waypointAngle"],vmgToWaypoint:[1,"vmgToWaypoint"],trueWindMinHistoric:[1,"trueWindMinHistoric"],trueWindMidHistoric:[1,"trueWindMidHistoric"],trueWindMaxHistoric:[1,"trueWindMaxHistoric"],gradianColor:[1,"gradianColor"]},decls:174,vars:39,consts:[["rotatingDial",""],["tackIndicator",""],["twaIndicator",""],["wptIndicator",""],["setIndicator",""],["viewBox","0 0 1200 1200"],["id","defs1"],["id","linearGradient18"],["offset","0",1,"boat",2,"stop-opacity","0.71372495"],["offset","1",1,"boat",2,"stop-opacity","0"],["id","linearGradient16"],["id","linearGradient13"],["offset","0.41176471",1,"drift-arrow",2,"stop-opacity","1"],["offset","1",1,"drift-arrow",2,"stop-opacity","0"],["id","swatch4"],["offset","0","id","stop4",2,"stop-color","#000000","stop-opacity","1"],["clipPathUnits","userSpaceOnUse","id","clipPath16"],["id","ellipse16","cx","311.24539","cy","-1516.3778","rx","194.27342","ry","181.83022",2,"display","inline","fill","#9a9300","fill-opacity","1","stroke","none","stroke-width","55","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],["id","linearGradient14",0,"xlink","href","#linearGradient13","x1","453.48047","y1","583.62891","x2","638.11328","y2","583.62891","gradientUnits","userSpaceOnUse","gradientTransform","matrix(0.00723393,1.2388183,-1.0538241,0.00615367,1211.2051,-79.73465)"],["id","linearGradient17",0,"xlink","href","#linearGradient16","x1","-502.04896","y1","439.35551","x2","-316","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],["id","linearGradient19",0,"xlink","href","#linearGradient18","x1","495.83999","y1","439.35551","x2","681.88895","y2","439.35551","gradientUnits","userSpaceOnUse","gradientTransform","translate(0,49.000266)"],["id","layerBackground","transform","translate(100,100)",2,"display","inline"],["id","boat",2,"display","inline"],["id","portSide","d","M 498.75049,208.89453 A 267.09439,554.67401 0 0 1 678.45974,767.81661",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient19)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","starboardSide","d","m -499.13846,208.89453 a 267.09439,554.67401 0 0 1 179.70925,558.92208","transform","scale(-1,1)",2,"fill","none","fill-opacity","1","stroke","url(#linearGradient17)","stroke-width","5.821","stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","layerCompass"],["id","fixedDial"],["id","dialBackground","cx","600","cy","620","r","516",1,"fixed-dial-background",2,"display","inline","stroke-width","46"],["id","barsAndText","transform","scale(1.1) translate(45,64)",1,"contrast-stroke",2,"display","inline"],["d","m 416.35095,19.837399 2.78142,15.77426","id","path199",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 334.23173,41.658798 5.47834,15.051615","id","path200",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 260.27336,81.806174 12.55151,21.739856","id","path37",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 187.44581,126.00035 10.29591,12.2702","id","path197",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 127.23918,185.95785 12.27019,10.29591","id","path198",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 83.252815,257.66724 21.739865,12.55151","id","path166",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 42.289518,332.39273 15.05162,5.47835","id","path195",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 20.127799,414.42077 15.774251,2.78142","id","path196",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 17.879075,498.47765 H 42.982096","id","path167",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 19.776759,583.71187 15.77426,-2.78142","id","path193",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 41.598167,665.8311 15.051615,-5.47834","id","path194",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 81.668963,739.71246 103.40883,727.16095","id","path168",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 125.93981,812.61701 12.2702,-10.29591","id","path191",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 185.89732,872.82365 10.29591,-12.27019","id","path192",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 257.53004,916.73298 12.55151,-21.73985","id","path169",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 332.33219,957.7732 5.47835,-15.05162","id","path189",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 414.36024,979.93493 2.78142,-15.77425","id","path190",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 498.34046,982.10672 V 957.0037","id","path170",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 583.65133,980.28596 580.86991,964.5117","id","path187",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 665.77057,958.46456 -5.47834,-15.05161","id","path188",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 739.57526,918.31683 727.02375,896.57698","id","path171",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 812.55647,874.12301 802.26056,861.85282","id","path185",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 872.76312,814.16551 860.49293,803.8696","id","path186",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 916.59579,742.45577 894.85593,729.90426","id","path172",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 957.71266,667.73063 -15.05161,-5.47834","id","path183",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 979.8744,585.70259 -15.77425,-2.78142","id","path184",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 981.96954,501.64535 -25.10304,10e-6","id","path173",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 980.22542,416.41149 -15.77425,2.78143","id","path181",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 958.40403,334.29226 -15.05161,5.47834","id","path182",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 918.17964,260.41055 -21.73986,12.55151","id","path174",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 874.06247,187.50636 -12.27018,10.29591","id","path180",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 817.34594,130.05494 -10.40259,12.17987","id","path179",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 742.31857,83.390025 729.76706,105.12988","id","path175",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 667.6701,42.350172 -5.47834,15.051615","id","path178",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 585.64206,20.188432 -2.78142,15.77425","id","path176",2,"fill","none","fill-opacity","0","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 501.50816,18.016286 V 43.119307","id","path177",2,"fill","none","fill-opacity","0","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],[0,"xml","space","preserve","x","181.91386","y","284.25186","id","text3","transform","rotate(-30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan3","x","181.91386","y","284.25186",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-183.53558","y","283.74811","id","text14","transform","rotate(-60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan14","x","-183.53558","y","283.74811",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-499.70761","y","100.95312","id","text15","transform","rotate(-90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan15","x","-499.70761","y","100.95312",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.66119","y","-216.36243","id","text16","transform","rotate(-120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["x","-681.66119","y","-216.36243","id","tspan25",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.06616","y","-581.71271","id","text17","transform","rotate(-150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan17","x","-681.06616","y","-581.71271",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-498.3313","y","-897.40875","id","text18","transform","scale(-1)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan18","x","-498.3313","y","-897.40875",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-184.41313","y","-1080.8452","id","text19","transform","rotate(150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan19","x","-184.41313","y","-1080.8452",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","181.57225","y","-1080.8853","id","text20","transform","rotate(120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan20","x","181.57225","y","-1080.8853",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","501.42661","y","-896.93701","id","text21","transform","rotate(90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan21","x","501.42661","y","-896.93701",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","682.35815","y","-579.63336","id","text22","transform","rotate(60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan22","x","682.35815","y","-579.63336",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","681.81525","y","-214.27321","id","text23","transform","rotate(30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan23","x","681.81525","y","-214.27321",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","500.15503","y","101.96342","id","text24",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan24","x","500.15503","y","101.96342",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],["id","LayerWindShift"],["id","portSectorShift",1,"wind-sector-port",2,"fill-opacity","0.4","stroke","none"],["id","StbdSectorShift",1,"wind-sector-stbd",2,"fill-opacity","0.4","stroke","none"],["id","LayerLayline"],["id","PortLayline",1,"portLayline"],["id","StbdLayline",1,"stbdLayline"],["id","layerCounter"],["id","tackCounter"],[0,"xml","space","preserve","x","1062","y","80",1,"tack-label"],["x","936","y","95","width","252","height","100","rx","20",1,"tack-box"],[0,"xml","space","preserve","x","1072","y","175","id","text42",1,"tack-value"],[2,"font-weight","normal"],["id","windVmgCounter"],[0,"xml","space","preserve","x","600","y","780",1,"tack-label"],[0,"xml","space","preserve","x","610","y","850",1,"wind-vmg-value"],[2,"font-weight","normal","font-size","30px"],[0,"xml","space","preserve","x","610","y","890",1,"wind-vmg-offset"],["id","waypointCounter"],[0,"xml","space","preserve","x","1062","y","1030",1,"tack-label"],["x","936","y","1045","width","252","height","140","rx","20",1,"waypoint-box"],[0,"xml","space","preserve","x","1060","y","1100",1,"waypoint-value"],[1,"tack-label"],[0,"xml","space","preserve","x","1060","y","1165",1,"waypoint-value"],["id","layerIndicators",2,"display","inline"],["d","m 606.20767,217.99458 a 6.3888631,8.8250643 0 0 1 -6.38888,8.82508 6.3888631,8.8250643 0 0 1 -6.38888,-8.82508 6.3888631,8.8250643 0 0 1 6.38888,-8.82509 6.3888631,8.8250643 0 0 1 6.38888,8.82509 z M 576.25472,75.811298 593.47058,58.265068 c 3.6173,-3.6867571 9.44162,-3.6867571 13.05892,0 l 17.21586,17.546106 c 3.6173,3.686743 3.6173,9.622786 0,13.309544 l -17.21595,17.54623 c -3.61721,3.686757 -9.44153,3.686757 -13.05893,0 L 576.25472,89.120841 c -3.6174,-3.686743 -3.6174,-9.622924 0,-13.309543 z m 17.20533,-16.510116 h 12.77766 V 218.26408 h -12.77766 z",1,"tack-angle"],["d","m 451.77021,5.469207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,230.15629 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,21.357036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.60410307,0,0,0.70555435,296.91787,121.152867)",1,"true-wind",2,"display","inline","stroke","none","stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","600","y","210","id","text10",1,"card-color",2,"font-weight","bold","font-size","60px","font-family","Roboto","text-align","center","text-anchor","middle","display","inline","stroke","none"],["cx","600","cy","225","rx","23","ry","23",1,"next-waypoint"],["id","layerDirectionSpeed"],["id","directionLine","x1","600","y1","620","x2","600","y2","110",1,"direction-line"],["id","speedLine","x1","600","y1","620","x2","600",1,"speed-line"],["id","speedTip",1,"speed-line"],["id","layerDrift","transform","translate(0, 20)"],["id","setArrow","d","m 663.93337,580.60403 -64.4901,-94.9673 -63.37665,95.71396 58.48691,-30.71299 0.77713,133.08346 c 0.0992,16.99331 2.52916,30.65913 5.44822,30.64209 2.91911,-0.0171 5.18926,-13.71032 5.09001,-30.70362 l -0.77782,-133.20444 z",1,"drift-arrow",2,"fill","url(#linearGradient14)"],["id","text11",0,"xml","space","preserve","x","599.78842","y","623.55145",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-stretch","normal","font-size","66.6667px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["id","layerHeading"],["id","rect1","width","310","height","117","x","445","y","10","rx","20",1,"heading-box",2,"stroke-width","5","stroke-opacity","0.5"],["x","600","y","110",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","120px","font-family","Roboto","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none","stroke-width","5","stroke-linejoin","bevel","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[2,"font-weight","normal","font-size","60px"]],template:function(t,i){t&1&&(ie(),E(0,"svg",5)(1,"defs",6)(2,"linearGradient",7),Q(3,"stop",8)(4,"stop",9),O(),E(5,"linearGradient",10),Q(6,"stop",8)(7,"stop",9),O(),E(8,"linearGradient",11),Q(9,"stop",12)(10,"stop",13),O(),E(11,"linearGradient",14),Q(12,"stop",15),O(),E(13,"clipPath",16),Q(14,"ellipse",17),O(),Q(15,"linearGradient",18)(16,"linearGradient",19)(17,"linearGradient",20),O(),E(18,"g",21)(19,"g",22),Q(20,"path",23)(21,"path",24),O()(),E(22,"g",25)(23,"g",26),Q(24,"circle",27),O(),E(25,"g",null,0)(27,"g",28),Q(28,"path",29)(29,"path",30)(30,"path",31)(31,"path",32)(32,"path",33)(33,"path",34)(34,"path",35)(35,"path",36)(36,"path",37)(37,"path",38)(38,"path",39)(39,"path",40)(40,"path",41)(41,"path",42)(42,"path",43)(43,"path",44)(44,"path",45)(45,"path",46)(46,"path",47)(47,"path",48)(48,"path",49)(49,"path",50)(50,"path",51)(51,"path",52)(52,"path",53)(53,"path",54)(54,"path",55)(55,"path",56)(56,"path",57)(57,"path",58)(58,"path",59)(59,"path",60)(60,"path",61)(61,"path",62)(62,"path",63)(63,"path",64),E(64,"text",65)(65,"tspan",66),c(66,"330"),O()(),E(67,"text",67)(68,"tspan",68),c(69,"300"),O()(),E(70,"text",69)(71,"tspan",70),c(72,"W"),O()(),E(73,"text",71)(74,"tspan",72),c(75,"240"),O()(),E(76,"text",73)(77,"tspan",74),c(78,"210"),O()(),E(79,"text",75)(80,"tspan",76),c(81,"S"),O()(),E(82,"text",77)(83,"tspan",78),c(84,"150"),O()(),E(85,"text",79)(86,"tspan",80),c(87,"120"),O()(),E(88,"text",81)(89,"tspan",82),c(90,"E"),O()(),E(91,"text",83)(92,"tspan",84),c(93,"60"),O()(),E(94,"text",85)(95,"tspan",86),c(96,"30"),O()(),E(97,"text",87)(98,"tspan",88),c(99,"N"),O()()()()(),E(100,"g",89),Q(101,"path",90)(102,"path",91),O(),E(103,"g",92),Q(104,"path",93)(105,"path",94),O(),E(106,"g",95)(107,"g",96)(108,"text",97),c(109,"Tack/Gybe"),O(),Q(110,"rect",98),E(111,"text",99),c(112),ct(113,"number"),E(114,"tspan",100),c(115,"\xB0"),O()()(),E(116,"g",101)(117,"text",102),c(118,"Wind VMG"),O(),E(119,"text",103),c(120),E(121,"tspan",104),c(122," kts"),O()(),E(123,"text",105),c(124),E(125,"tspan",104),c(126," kts"),O()()(),E(127,"g",106)(128,"text",107),c(129,"Waypoint"),O(),Q(130,"rect",108),E(131,"text",109)(132,"tspan",110),c(133,"VMG: "),O(),c(134),E(135,"tspan",104),c(136," kts"),O()(),E(137,"text",111)(138,"tspan",110),c(139,"HDG: "),O(),c(140),E(141,"tspan",100),c(142,"\xB0"),E(143,"tspan",104),c(144,"T"),O()()()()(),E(145,"g",112)(146,"g",null,1),Q(148,"path",113),O(),E(149,"g",null,2),Q(151,"path",114),E(152,"text",115),c(153,"T"),O()(),E(154,"g",null,3),Q(156,"ellipse",116),O()(),E(157,"g",117),Q(158,"line",118)(159,"line",119)(160,"polygon",120),O(),E(161,"g",121),Q(162,"path",122,4),E(164,"text",123),c(165),O()(),E(166,"g",124),Q(167,"rect",125),E(168,"text",126),c(169),E(170,"tspan",100),c(171,"\xB0"),E(172,"tspan",127),c(173,"T"),O()()()()()),t&2&&(f(101),xe("display",i.portWindSectorPath()!="none"?"inline":"none"),J("d",i.portWindSectorPath()),f(),xe("display",i.stbdWindSectorPath()!="none"?"inline":"none"),J("d",i.stbdWindSectorPath()),f(2),xe("display",i.trueWindAngle()!=null?"inline":"none"),J("d",i.laylinePortPath()),f(),xe("display",i.trueWindAngle()!=null?"inline":"none"),J("d",i.laylineStbdPath()),f(7),fe("",xn(113,36,i.nextTargetDirection(),"1.0-0")," "),f(7),xe("fill",i.targetVMGOffsetRatioColor()),f(),K(i.targetVMG()),f(3),xe("fill",i.targetVMGOffsetRatioColor()),f(),K(i.targetVMGOffset()),f(10),K(i.vmgToWaypoint()),f(6),K(i.waypointAngle()),f(11),xe("fill",i.windAnglePerformanceRatioColor()),f(3),J("display",i.waypointActive()?"inline":"none"),f(5),xe("stroke",i.speedRatioColor()),J("y2",i.speedLineTipY()),f(),xe("fill",i.speedRatioColor())("stroke",i.speedRatioColor()),J("points",i.speedTipPoints()),f(),xe("display",i.driftEnabled()?"inline":"none"),f(4),K(i.flow()),f(4),fe(" ",i.headingValue()))},dependencies:[Ha],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg[_ngcontent-%COMP%]{position:absolute;height:100%;width:100%;left:0;top:0}.fixed-dial-background[_ngcontent-%COMP%]{fill:none;stroke:var(--kip-grey-color)}.rotating-dial-Backplate[_ngcontent-%COMP%]{fill:var(--mat-sys-background)}.starboard[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color)}.port[_ngcontent-%COMP%]{stroke:var(--kip-port-color)}.heading-box[_ngcontent-%COMP%]{stroke:var(--kip-grey-color);fill:var(--kip-widget-card-background-color)}.boat[_ngcontent-%COMP%]{stop-color:var(--kip-grey-color)!important}.contrast-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.contrast-stroke[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color)}.card-color[_ngcontent-%COMP%]{fill:var(--kip-widget-card-background-color)}.tack-box[_ngcontent-%COMP%]{stroke:var(--kip-yellow-dim-color);fill:var(--kip-widget-card-background-color);stroke-width:5}.tack-value[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:80px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.tack-label[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color);font-family:Roboto;font-size:35px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.waypoint-box[_ngcontent-%COMP%]{stroke:var(--kip-orange-dim-color);fill:var(--kip-widget-card-background-color);stroke-width:5}.waypoint-value[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:50px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.wind-vmg-value[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:80px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.wind-vmg-offset[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);font-family:Roboto;font-size:35px;font-style:normal;font-weight:700;text-align:center;text-anchor:middle;stroke:none}.true-wind[_ngcontent-%COMP%]{fill:var(--kip-blue-color)}.app-wind-label[_ngcontent-%COMP%]{fill:var(--kip-orange-dim-color)}.tack-angle[_ngcontent-%COMP%]{fill:var(--kip-yellow-color);stroke-width:15;stroke-linecap:square}.next-waypoint[_ngcontent-%COMP%]{stroke:var(--kip-orange-color);stroke-width:20;fill:none}.next-waypoint-bar[_ngcontent-%COMP%]{stroke:var(--kip-grey-color)}.portLayline[_ngcontent-%COMP%]{stroke:var(--kip-port-color);stroke-width:5}.stbdLayline[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color);stroke-width:5}.direction-line[_ngcontent-%COMP%]{stroke:var(--kip-contrast-color);stroke-width:5}.speed-line[_ngcontent-%COMP%]{stroke:var(--kip-blue-color);stroke-width:10;fill:var(--kip-blue-color)}.wind-sector-port[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.wind-sector-stbd[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.drift-arrow[_ngcontent-%COMP%]{stop-color:var(--kip-blue-color);stroke:var(--kip-widget-card-background-color);stroke-width:3}"],changeDetection:0})}return n})();var Hm=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,filterSelfPaths:!0,paths:{headingPath:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},tackTrue:{description:"True Tack",path:"self.performance.tackTrue",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!0,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},polarSpeedRatio:{description:"Polar Speed Ratio",path:"self.performance.polarSpeedRatio",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"ratio",sampleTime:500},targetAngle:{description:"Target Angle",path:"self.performance.targetAngle",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"deg",sampleTime:500},optimalWindAngle:{description:"Optimal Wind Angle",path:"self.performance.optimumWindAngle",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"deg",sampleTime:500},targetVMG:{description:"Target Velocity Made Good",path:"self.performance.targetVelocityMadeGood",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"knots",sampleTime:500},VMG:{description:"Velocity Made Good",path:"self.performance.velocityMadeGood",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"knots",sampleTime:500},appWindAngle:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},appWindSpeed:{description:"Apparent Wind Speed",path:"self.environment.wind.speedApparent",source:"default",pathType:"number",isPathConfigurable:!0,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},trueWindAngle:{description:"True Wind Angle",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},trueWindSpeed:{description:"True Wind Speed",path:"self.environment.wind.speedTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},courseOverGround:{description:"True Course Over Ground",path:"self.navigation.courseOverGroundTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},nextWaypointBearing:{description:"Next Waypoint True Bearing",path:"self.navigation.course.calcValues.bearingTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},vmgToWaypoint:{description:"Velocity Made Good to Waypoint",path:"self.performance.velocityMadeGoodToWaypoint",source:"default",pathType:"number",isPathConfigurable:!1,pathRequired:!1,convertUnitTo:"knots",sampleTime:500},set:{description:"True Drift Set",path:"self.environment.current.setTrue",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},drift:{description:"Drift Speed Impact",path:"self.environment.current.drift",source:"default",pathType:"number",isPathConfigurable:!0,pathRequired:!1,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500}},windSectorEnable:!0,windSectorWindowSeconds:5,laylineEnable:!0,laylineAngle:40,waypointEnable:!0,courseOverGroundEnable:!0,driftEnable:!0,awsEnable:!0,twsEnable:!0,sailSetupEnable:!1,enableTimeout:!1,dataTimeout:5};runtime=y(Se);streams=y(We);currentHeading=w(0);courseOverGroundAngle=w(0);appWindAngle=w(0);appWindSpeed=w(0);appWindSpeedUnit=w("knots");trueWindAngle=w(0);trueWindSpeed=w(0);trueWindSpeedUnit=w("knots");driftFlow=w(0);driftSet=w(0);waypointAngle=w(0);vmgToWaypoint=w(null);tackTrue=w(0);polarSpeedRatio=w(0);targetAngle=w(0);optimalWindAngle=w(0);targetVMG=w(0);VMG=w(0);gradianColor=w({start:"#3298ff",stop:"#15af00"});trueWindMinHistoric=w(0);trueWindMidHistoric=w(0);trueWindMaxHistoric=w(0);windSectorSub=null;historicalWindDirection=[];constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.headingPath?.path||G(()=>this.streams.observe("headingPath",a=>{let r=a?.data?.value;this.currentHeading.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.courseOverGroundEnable||!e.paths?.courseOverGround?.path||G(()=>this.streams.observe("courseOverGround",a=>{let r=a?.data?.value;this.courseOverGroundAngle.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.driftEnable||!e.paths?.drift?.path||G(()=>this.streams.observe("drift",a=>{let r=a?.data?.value;this.driftFlow.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.driftEnable||!e.paths?.set?.path||G(()=>this.streams.observe("set",a=>{let r=a?.data?.value,s=r??0;this.driftSet.set(this.addHeading(-this.currentHeading(),s))}))}),L(()=>{let e=this.runtime.options();!e||!e.waypointEnable||!e.paths?.nextWaypointBearing?.path||G(()=>this.streams.observe("nextWaypointBearing",a=>{let r=a?.data?.value;if(r==null){this.waypointAngle.set(0);return}let s=r<0?360+r:r,l=this.addHeading(-this.currentHeading(),s);this.waypointAngle.set(Math.round(l))}))}),L(()=>{let e=this.runtime.options();!e||!e.awsEnable||!e.paths?.appWindAngle?.path||G(()=>this.streams.observe("appWindAngle",a=>{let r=a?.data?.value,s=r??0;if(s=s<0?360+s:s,this.appWindAngle.set(s),e.windSectorEnable){let l=this.currentHeading(),m=this.addHeading(l,r??0);this.addHistoricalWindDirection(m,e.windSectorWindowSeconds)}}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.tackTrue?.path||G(()=>this.streams.observe("tackTrue",a=>{let r=a?.data?.value;this.tackTrue.set(r==null?0:Math.round(r))}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.polarSpeedRatio?.path||G(()=>this.streams.observe("polarSpeedRatio",a=>{let r=a?.data?.value;this.polarSpeedRatio.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.targetAngle?.path||G(()=>this.streams.observe("targetAngle",a=>{let r=a?.data?.value;this.targetAngle.set(r)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.optimalWindAngle?.path||G(()=>this.streams.observe("optimalWindAngle",a=>{let r=a?.data?.value;this.optimalWindAngle.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.targetVMG?.path||G(()=>this.streams.observe("targetVMG",a=>{let r=a?.data?.value,s=r==null?0:Math.round(r*10)/10;this.targetVMG.set(s)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.VMG?.path||G(()=>this.streams.observe("VMG",a=>{let r=a?.data?.value,s=r==null?0:Math.round(r*10)/10;this.VMG.set(s)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.vmgToWaypoint?.path||G(()=>this.streams.observe("vmgToWaypoint",a=>{let r=a?.data?.value,s=r==null?null:Math.round(r*10)/10;this.vmgToWaypoint.set(s)}))}),L(()=>{let e=this.theme();if(!e)return;let t=e?.blue??"#3298ff",i=e?.green??"#15af00";G(()=>this.gradianColor.set({start:t,stop:i}))}),L(()=>{let e=this.runtime.options();!e||!e.awsEnable||!e.paths?.appWindSpeed?.path||G(()=>this.streams.observe("appWindSpeed",a=>{let r=a?.data?.value;this.appWindSpeed.set(r??0)}))}),L(()=>{let e=this.runtime.options();!e||!e.twsEnable||!e.paths?.trueWindSpeed?.path||G(()=>this.streams.observe("trueWindSpeed",a=>{let r=a?.data?.value;this.trueWindSpeed.set(r??0)}))}),L(()=>{let e=this.runtime.options();if(!e||!e.twsEnable)return;let i=e.paths?.trueWindAngle?.path;i&&G(()=>this.streams.observe("trueWindAngle",a=>{let r=a?.data?.value,s=r??0;if(i.includes("angleTrueWater")||i.includes("angleTrueGround")){let l=this.currentHeading();s=this.addHeading(l,s)}else s=s<0?360+s:s;this.trueWindAngle.set(s)}))}),L(()=>{let e=this.runtime.options();e&&(e.windSectorEnable?this.windSectorSub||G(()=>this.windSectorSub=Sr(500).subscribe(()=>this.historicalCleanup(e.windSectorWindowSeconds))):(this.windSectorSub?.unsubscribe(),this.windSectorSub=null))})}sectorArc=X(()=>{let e=this.trueWindMinHistoric(),t=this.trueWindMidHistoric(),i=this.trueWindMaxHistoric();return{min:e,mid:t,max:i}});addHistoricalWindDirection(e,t){this.historicalWindDirection.push({timestamp:Date.now(),windDirection:e});let i=this.arcForAngles(this.historicalWindDirection.map(a=>a.windDirection));this.trueWindMinHistoric.set(i.min),this.trueWindMaxHistoric.set(i.max),this.trueWindMidHistoric.set(i.mid),this.historicalCleanup(t)}arcForAngles(e){return!e||e.length===0?{min:0,max:0,mid:0}:e.slice(1).reduce((i,a)=>{let r=a;for(;r<i.min-180;)r+=360;for(;r>i.max+180;)r-=360;return i.min=Math.min(i.min,r),i.max=Math.max(i.max,r),i.mid=(i.max-i.min)/2+i.min,i},{min:e[0],max:e[0],mid:e[0]})}historicalCleanup(e){let t=Date.now()-e*1e3;this.historicalWindDirection=this.historicalWindDirection.filter(i=>i.timestamp>=t)}addHeading(e,t){let i=(e+t)%360;return i<0&&(i+=360),i}ngOnDestroy(){this.windSectorSub?.unsubscribe(),this.windSectorSub=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-racesteer"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:20,consts:[[3,"compassHeading","tackTrue","polarSpeedRatio","trueWindAngle","trueWindSpeed","targetAngle","optimalWindAngle","targetVMG","VMG","sailSetupEnabled","driftEnabled","driftFlow","driftSet","waypointEnabled","waypointAngle","vmgToWaypoint","trueWindMinHistoric","trueWindMidHistoric","trueWindMaxHistoric","gradianColor"]],template:function(t,i){if(t&1&&W(0,"svg-racesteer",0),t&2){let a,r,s;R("compassHeading",i.currentHeading())("tackTrue",i.tackTrue())("polarSpeedRatio",i.polarSpeedRatio())("trueWindAngle",i.trueWindAngle())("trueWindSpeed",i.trueWindSpeed())("targetAngle",i.targetAngle())("optimalWindAngle",i.optimalWindAngle())("targetVMG",i.targetVMG())("VMG",i.VMG())("sailSetupEnabled",(a=i.runtime.options())==null?null:a.sailSetupEnable)("driftEnabled",(r=i.runtime.options())==null?null:r.driftEnable)("driftFlow",i.driftFlow())("driftSet",i.driftSet())("waypointEnabled",(s=i.runtime.options())==null?null:s.waypointEnable)("waypointAngle",i.waypointAngle())("vmgToWaypoint",i.vmgToWaypoint()??0)("trueWindMinHistoric",i.trueWindMinHistoric())("trueWindMidHistoric",i.trueWindMidHistoric())("trueWindMaxHistoric",i.trueWindMaxHistoric())("gradianColor",i.gradianColor())}},dependencies:[Um],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg-racesteer[_ngcontent-%COMP%]{width:100%;height:100%}"],changeDetection:0})}return n})();var uA=["canvasMainRef"];function mA(n,o){if(n&1&&(d(0,"div",8),ie(),d(1,"svg",11)(2,"text",12),c(3),u()()()),n&2){let e=k();f(3),fe("@ ",e.startAtTime())}}function hA(n,o){if(n&1){let e=we();d(0,"button",13),U("click",function(){ee(e);let i=k();return te(i.sendStartTimerCommand("start"))}),d(1,"mat-icon",5),ie(),d(2,"svg",6)(3,"text",14),c(4,"Start"),u()()()(),Be(),d(5,"button",15),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(-60))}),d(6,"mat-icon",5),ie(),d(7,"svg",6)(8,"text",14),c(9,"-1m"),u()()()(),Be(),d(10,"button",16),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(60))}),d(11,"mat-icon",5),ie(),d(12,"svg",6)(13,"text",14),c(14,"+1m"),u()()()()}}function pA(n,o){if(n&1){let e=we();d(0,"button",17),U("click",function(){ee(e);let i=k();return te(i.sendStartTimerCommand("sync"))}),d(1,"mat-icon",5),ie(),d(2,"svg",18)(3,"text",19),c(4,"Sync"),u()()()(),Be(),d(5,"button",20),U("click",function(){ee(e);let i=k();return te(i.sendStartTimerCommand("reset"))}),d(6,"mat-icon",5),ie(),d(7,"svg",18)(8,"text",19),c(9,"Reset"),u()()()()}}function gA(n,o){if(n&1){let e=we();d(0,"button",21),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(-60))}),d(1,"mat-icon",5),ie(),d(2,"svg",22)(3,"text",23),c(4,"-1m"),u()()()(),Be(),d(5,"button",24),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(-1))}),d(6,"mat-icon",5),ie(),d(7,"svg",22)(8,"text",23),c(9,"-1s"),u()()()(),Be(),d(10,"button",25),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(1))}),d(11,"mat-icon",5),ie(),d(12,"svg",22)(13,"text",23),c(14,"+1s"),u()()()(),Be(),d(15,"button",26),U("click",function(){ee(e);let i=k();return te(i.adjustStartTime(60))}),d(16,"mat-icon",5),ie(),d(17,"svg",22)(18,"text",23),c(19,"+1m"),u()()()()}}function fA(n,o){if(n&1){let e=we();d(0,"input",27),bn("ngModelChange",function(i){ee(e);let a=k();return vn(a.startAtTimeEdit,i)||(a.startAtTimeEdit=i),te(i)}),U("change",function(){ee(e);let i=k();return te(i.setStartTime())}),u()}if(n&2){let e=k();fn("ngModel",e.startAtTimeEdit)}}function vA(n,o){n&1&&W(0,"div",10)}var $m=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"TTS",nextDashboard:0,playBeeps:!0,filterSelfPaths:!0,paths:{ttsPath:{description:"Time to the Start in seconds",path:"self.navigation.racing.timeToStart",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"s",showConvertUnitTo:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"s",sampleTime:500},startTimePath:{description:"Time of the start",path:"self.navigation.racing.startTime",source:"default",pathType:"Date",pathRequired:!1,isPathConfigurable:!1,sampleTime:500},dtsPath:{description:"Distance to Start Line path, used to determine OCS",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!1,pathSkUnitsFilter:"m",sampleTime:500}},color:"contrast",enableTimeout:!1,dataTimeout:5,ignoreZones:!0};runtime=y(Se);streams=y(We);signalk=y(di);dashboard=y(yt);canvas=y(ht);destroyRef=y(ze);canvasRef=he.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;labelColor=w("");mode=w(1);ttsValue=null;dtsValue=null;valueColor="";valueStateColor="";startAtTime=w("00:00:00");startAtTimeEdit=Br("");constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{let i=Te(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.valueStateColor=i.color,this.draw()})}),L(()=>{let e=this.runtime.options();!e||!e.paths?.ttsPath?.path||G(()=>this.streams.observe("ttsPath",a=>{let r=this.ttsValue;this.ttsValue=a?.data?.value??null,this.updateValueColor(),this.draw(),this.shouldBeep(r,this.ttsValue)&&this.beepForValue(this.ttsValue),e.nextDashboard>=0&&r===1&&this.ttsValue===0&&(!this.dtsValue||this.dtsValue>=0)}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.startTimePath?.path||G(()=>this.streams.observe("startTimePath",a=>{let r=a?.data?.value;if(!r)this.startAtTime.set("HH:MM:SS"),this.startAtTimeEdit.set("HH:MM:SS"),this.mode()===2&&this.mode.set(1);else{let s=new Date(r);this.startAtTimeEdit.set(s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})),this.startAtTime.set(this.startAtTimeEdit())}this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.dtsPath?.path||G(()=>this.streams.observe("dtsPath",a=>{this.dtsValue=a?.data?.value??null}))}),this.signalk.subscribeRequest().pipe(Le(this.destroyRef)).subscribe(e=>{e.widgetUUID===this.id()&&e.statusCode===200&&this.beep(600,20)})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw()}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}toggleMode(){this.mode.update(t=>(t+1)%5);let e=this.ttsValue;this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2),this.mode()===2&&e!==0&&!this.isStartTimerRunning()&&this.mode.set(3),this.draw()}sendStartTimerCommand(e){this.signalk.putRequest("navigation.racing.setStartTime",{command:e},this.id()),e==="start"&&this.mode.set(0),e==="reset"&&(this.startAtTime.set("HH:MM:SS"),this.mode.set(1))}adjustStartTime(e){this.signalk.putRequest("navigation.racing.setStartTime",{command:"adjust",delta:e},this.id())}setStartTime(){let e=new Date,t=this.startAtTimeEdit().split(":").map(Number),i=t[0],a=t[1],r=t.length>=3?t[2]:0,s=new Date(e);s.setHours(i,a,r,0),s<=e&&s.setDate(s.getDate()+1),this.mode.set(0),this.signalk.putRequest("navigation.racing.setStartTime",{command:"set",startTime:s.toISOString()},this.id())}isStartTimerRunning(){return(this.ttsValue??0)>0&&this.startAtTime()!==null&&this.startAtTime()!=="HH:MM:SS"}shouldBeep(e,t){return t==null||this.startAtTime()==="HH:MM:SS"||!this.runtime.options()?.playBeeps?!1:t===0&&e!==0||t<10&&t>=0||t<60&&t%10===0?!0:t%60===0}beepForValue(e){e===0?this.beep(500,1e3):e<10?this.beep(450,100):e<60&&e%10===0?this.beep(400,150):e%60===0&&this.beep(350,200)}updateValueColor(){let e=this.theme(),t=this.runtime.options();!e||!t||(t.ignoreZones?this.ttsValue?this.ttsValue===0?this.valueStateColor=this.valueColor:this.ttsValue<10?this.valueStateColor=(this.dtsValue??0)<0?e.zoneAlarm:e.zoneWarn:this.ttsValue<60?this.valueStateColor=e.zoneAlert:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor:this.valueStateColor=this.valueColor,this.ttsValue===0?(this.mode.set(2),(this.dtsValue??0)<0&&(this.valueStateColor=e.zoneAlarm)):this.mode()===1&&this.isStartTimerRunning()&&this.mode.set(2))}toHHMMSS(e){if(e==null||isNaN(e))return"-:--";let t=e<0;t&&(e=-e);let i=Math.floor(e/3600),a=Math.floor(e%3600/60),r=Math.floor(e%60),s=t?"-":"";return i===0?`${s}${a.toString().padStart(1,"0")}:${r.toString().padStart(2,"0")}`:`${s}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}getValueText(){return this.toHHMMSS(this.ttsValue)}draw(){if(!this.ctx||!this.canvasElement)return;let t=this.runtime.options()?.displayName||"TTS",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.getValueText(),Math.floor(this.cssWidth*.5),Math.floor(this.cssHeight*.55),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.9),"bold",this.valueStateColor,"center","middle")}beep(e=440,t=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,r=a.createOscillator(),s=a.createGain();r.connect(s),s.connect(a.destination),r.type="sine",r.frequency.value=e,s.gain.value=.1,r.start(),r.stop(a.currentTime+t/1e3)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-racer-timer"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,uA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],startAtTimeEdit:[1,"startAtTimeEdit"]},outputs:{startAtTimeEdit:"startAtTimeEditChange"},decls:15,vars:2,consts:[["canvasMainRef",""],[1,"filler"],[1,"timer-canvas"],[1,"buttons-container"],["mat-flat-button","","matTooltip","Select the control mode",1,"button","select-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 80 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","40","y","9"],[1,"start-at"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModel"],[1,"widgetOverlay"],["width","100%","height","100%","viewBox","0 0 80 12","preserveAspectRatio","xMidYMid meet",1,"svg-content","svg-start-at"],["x","40","y","10"],["mat-flat-button","","matTooltip","Start the race timer",1,"button","main-button",3,"click"],["x","40","y","11"],["mat-flat-button","","matTooltip","Remove 1 minute from the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Add 1 minute to the timer",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Sync the timer to nearest minute",1,"button","main-button",3,"click"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","50","y","11"],["mat-flat-button","","matTooltip","Stop and reset the timer",1,"button","other-button",3,"click"],["mat-flat-button","","matTooltip","Reduce the timer by 1 minute",1,"button","main-small-button",3,"click"],["width","100%","height","100%","viewBox","0 0 50 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","25","y","11"],["mat-flat-button","","matTooltip","Reduce the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 second",1,"button","other-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the timer by 1 minute",1,"button","main-small-button",3,"click"],["matInput","","type","time","step","1","matTooltip","Set an absolute start time",1,"set-start-at",3,"ngModelChange","change","ngModel"]],template:function(t,i){if(t&1&&(d(0,"div",1),W(1,"canvas",2,0),u(),d(3,"div",3)(4,"button",4),U("click",function(){return i.toggleMode()}),d(5,"mat-icon",5),ie(),d(6,"svg",6)(7,"text",7),c(8,"\u22EE"),u()()()(),I(9,mA,4,1,"div",8)(10,hA,15,0)(11,pA,10,0)(12,gA,20,0)(13,fA,1,1,"input",9),u(),I(14,vA,1,0,"div",10)),t&2){let a;f(9),N((a=i.mode())===0?9:a===1?10:a===2?11:a===3?12:a===4?13:-1),f(5),N(i.dashboard.isDashboardStatic()?-1:14)}},dependencies:[It,gt,rt,Fn,ot,wt,et,Xe,ro,oo,At],styles:["[_nghost-%COMP%]{overflow:clip;display:block;height:100%;width:100%}.timer-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.timer-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}.filler[_ngcontent-%COMP%]{width:100%;height:76%}.buttons-container[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;justify-content:space-between;column-gap:2%;position:relative;height:24%;width:100%;padding:0 10px 14px;z-index:20;pointer-events:auto;align-items:center}.button[_ngcontent-%COMP%]{min-width:0px;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.select-button[_ngcontent-%COMP%]{flex:none;width:18%;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.main-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.other-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.set-start-at[_ngcontent-%COMP%]{flex:1 1 auto;background-color:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%]{height:100%;width:100%;flex:1 1 auto}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.start-at[_ngcontent-%COMP%] svg[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:9px;font-weight:400;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.svg-start-at[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color)}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"],changeDetection:0})}return n})();var bA=["canvasMainRef"];function AA(n,o){if(n&1&&(d(0,"div",10),ie(),d(1,"svg",11)(2,"text",12),c(3),u()()(),Be(),d(4,"div",13),ie(),d(5,"svg",14)(6,"text",15)(7,"tspan",16),c(8,"\u2691"),u(),c(9),d(10,"tspan",17),c(11,"\u2691"),u()()()(),Be(),d(12,"div",18),ie(),d(13,"svg",19)(14,"text",12),c(15),u()()()),n&2){let e=k();f(3),K(e.portBiasValue()),f(6),fe(" ",e.lineLengthValue()," "),f(6),K(e.stbBiasValue())}}function yA(n,o){if(n&1){let e=we();d(0,"button",20),U("click",function(){ee(e);let i=k();return te(i.setLineEnd("port"))}),d(1,"mat-icon",6),ie(),d(2,"svg",21)(3,"text",22),c(4,"Port End"),u()()()(),Be(),d(5,"button",23),U("click",function(){ee(e);let i=k();return te(i.setLineEnd("stb"))}),d(6,"mat-icon",6),ie(),d(7,"svg",21)(8,"text",22),c(9,"Stbd End"),u()()()()}}function xA(n,o){if(n&1){let e=we();d(0,"button",24),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",5,0))}),d(1,"mat-icon",6),ie(),d(2,"svg",25)(3,"text",26),c(4,"+5m"),u()()()(),Be(),d(5,"button",27),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",-5,0))}),d(6,"mat-icon",6),ie(),d(7,"svg",25)(8,"text",26),c(9,"-5m"),u()()()(),Be(),d(10,"button",28),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",-5,0))}),d(11,"mat-icon",6),ie(),d(12,"svg",25)(13,"text",26),c(14,"-5m"),u()()()(),Be(),d(15,"button",29),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",5,0))}),d(16,"mat-icon",6),ie(),d(17,"svg",25)(18,"text",26),c(19,"+5m"),u()()()()}}function CA(n,o){if(n&1){let e=we();d(0,"button",30),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",0,i.toRadians(1)))}),d(1,"mat-icon",6),ie(),d(2,"svg",25)(3,"text",26),c(4,"\u21911\xB0"),u()()()(),Be(),d(5,"button",31),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("port",0,i.toRadians(-1)))}),d(6,"mat-icon",6),ie(),d(7,"svg",25)(8,"text",26),c(9,"\u21931\xB0"),u()()()(),Be(),d(10,"button",32),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",0,i.toRadians(1)))}),d(11,"mat-icon",6),ie(),d(12,"svg",25)(13,"text",26),c(14,"\u21931\xB0"),u()()()(),Be(),d(15,"button",33),U("click",function(){ee(e);let i=k();return te(i.adjustLineEnd("stb",0,i.toRadians(-1)))}),d(16,"mat-icon",6),ie(),d(17,"svg",25)(18,"text",26),c(19,"\u21911\xB0"),u()()()()}}function SA(n,o){if(n&1){let e=we();d(0,"button",34),U("click",function(){ee(e);let i=k();return te(i.nextDisplayLineName())}),d(1,"mat-icon",6),ie(),d(2,"svg",25)(3,"text",26),c(4,"Line"),u()()()(),Be(),d(5,"button",35),U("click",function(){ee(e);let i=k();return te(i.setStartLine(i.getDisplayLineName()))}),d(6,"mat-icon",6),ie(),d(7,"svg",36)(8,"text",37),c(9),u()()()()}if(n&2){let e=k();f(5),at(xl("button ",e.isDisplayLineCurrent()?"line-button-current":"line-button")),R("matTooltip",xl("Set the ",e.getDisplayLineName()," line as the current line")),f(4),K(e.getDisplayLineName())}}function wA(n,o){n&1&&W(0,"div",9)}var jm=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);canvas=y(ht);dashboard=y(yt);signalk=y(di);destroyRef=y(ze);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"DTS",filterSelfPaths:!0,playBeeps:!0,convertUnitTo:"m",convertUnitToGroup:"Length",numDecimal:0,ignoreZones:!0,color:"contrast",enableTimeout:!1,dataTimeout:5,paths:{dtsPath:{description:"Distance to Start Line",path:"self.navigation.racing.distanceStartline",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:"m",sampleTime:500},lineLengthPath:{description:"Length of the start line",path:"self.navigation.racing.startLineLength",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:"m",sampleTime:1e3},lineBiasPath:{description:"Bias of the start line to starboard end",path:"self.navigation.racing.stbLineBias",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:"m",sampleTime:1e3},startLineNamePath:{description:"The current named start line",path:"self.navigation.racing.lines.startLineName",source:"default",pathType:"string",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:null,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,sampleTime:1e3},linesPath:{description:"The known named lines",path:"self.navigation.racing.lines.lines",source:"default",pathType:null,pathRequired:!1,isPathConfigurable:!1,convertUnitTo:null,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,sampleTime:1e3},ttlPath:{description:"Time to sail to the start line in seconds",path:"self.navigation.racing.timeToLine",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"s",showConvertUnitTo:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"s",sampleTime:500},ttbPath:{description:"Time to delay before sailing to the start line in seconds",path:"self.navigation.racing.timeToBurn",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!1,convertUnitTo:"s",showConvertUnitTo:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"s",sampleTime:500}}};canvasRef=he.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;dtsValue=null;lengthValue=null;biasValue=null;ttlValue=null;ttbValue=null;labelColor=w("");valueColor="";dtsColor="";maxValueTextWidth=0;maxValueTextHeight=0;displayLineIndex=0;lines=[];startLineName=null;portBiasValue=w("");lineLengthValue=w("");stbBiasValue=w("");mode=w(0);constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{let i=Te(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw()})}),L(()=>{let e=this.runtime.options();!e||!e.paths?.dtsPath?.path||G(()=>this.streams.observe("dtsPath",i=>{this.dtsValue=i?.data?.value??null,this.updateDtsColor(),this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.lineLengthPath?.path||G(()=>this.streams.observe("lineLengthPath",i=>{this.lengthValue=i?.data?.value??null,this.setLenBias(),this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.lineBiasPath?.path||G(()=>this.streams.observe("lineBiasPath",i=>{this.biasValue=i?.data?.value??null,this.setLenBias()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.startLineNamePath?.path||G(()=>this.streams.observe("startLineNamePath",i=>{console.log("startLineName: "+JSON.stringify(i??"no data")),this.startLineName=i?.data?.value??null,this.displayLineIndex=0;for(let a=0;a<this.lines.length;a++)if(this.lines[a]===this.startLineName){this.displayLineIndex=a;break}this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.linesPath?.path||G(()=>this.streams.observe("linesPath",i=>{if(console.log("lines: "+JSON.stringify(i??"no data")),this.lines=["Default"],this.displayLineIndex=0,i?.data?.value&&Array.isArray(i.data.value))for(let a of i.data.value)a.startLineName&&(a.startLineName===this.startLineName&&(this.displayLineIndex=this.lines.length),this.lines.push(a.startLineName))}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.ttlPath?.path||G(()=>this.streams.observe("ttlPath",a=>{this.ttlValue=a?.data?.value??null,this.draw()}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.ttbPath?.path||G(()=>this.streams.observe("ttbPath",a=>{this.ttbValue=a?.data?.value??null,this.draw()}))}),this.signalk.subscribeRequest().pipe(Le(this.destroyRef)).subscribe(e=>{e.widgetUUID===this.id()&&e.statusCode===200&&this.beep(600,20)})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxValueTextWidth=Math.floor(this.cssWidth*.95),this.maxValueTextHeight=Math.floor(this.cssHeight*.95),this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.maxValueTextWidth=Math.floor(this.cssWidth*.95),this.maxValueTextHeight=Math.floor(this.cssHeight*.95),this.draw()}toggleMode(){this.mode.update(e=>(e+1)%5),this.draw()}setLineEnd(e){return this.signalk.putRequest("navigation.racing.setStartLine",{end:e,position:"bow"},this.id())}adjustLineEnd(e,t,i){return this.signalk.putRequest("navigation.racing.setStartLine",{end:e,delta:t,rotate:i||null},this.id())}nextDisplayLineName(){++this.displayLineIndex>=this.lines.length&&(this.displayLineIndex=0)}getDisplayLineName(){return this.lines[this.displayLineIndex]||"Default"}isDisplayLineCurrent(){return this.getDisplayLineName()===(this.startLineName||"Default")}setStartLine(e){let t=e==="Default"||!e?null:e;this.signalk.putRequest("navigation.racing.setStartLineName",{startLineName:t},this.id()),this.mode.set(0),this.draw()}toRadians(e){return e?e*(Math.PI/180):null}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options(),t=e?.displayName||"DTS",i=this.labelColor();(!this.titleBitmap||!e||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.getValueText(),Math.floor(this.cssWidth*.5),Math.floor(this.cssHeight*.325),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.55),"bold",this.dtsColor,"center","middle"),this.canvas.drawText(this.ctx,this.runtime.options()?.paths?.dtsPath?.convertUnitTo||"m",Math.floor(this.cssWidth*.975),Math.floor(this.cssHeight*.6),Math.floor(this.cssWidth*.95),Math.floor(this.cssHeight*.15),"normal",this.dtsColor,"right","bottom"),this.canvas.drawText(this.ctx,"TTL",Math.floor(this.cssWidth*.025),Math.floor(this.cssHeight*.7),Math.floor(this.cssWidth*.1),Math.floor(this.cssHeight*.15),"normal",this.dtsColor,"left","middle"),this.canvas.drawText(this.ctx,this.getTimeToLineText(),Math.floor(this.cssWidth*.15),Math.floor(this.cssHeight-.8),Math.floor(this.cssWidth*.35),Math.floor(this.cssHeight*.35),"bold",this.dtsColor,"left","bottom"),this.canvas.drawText(this.ctx,"TTB",Math.floor(this.cssWidth*.525),Math.floor(this.cssHeight*.7),Math.floor(this.cssWidth*.1),Math.floor(this.cssHeight*.15),"normal",this.dtsColor,"left","middle"),this.canvas.drawText(this.ctx,this.getTimeToBurnText(),Math.floor(this.cssWidth*.65),Math.floor(this.cssHeight-.8),Math.floor(this.cssWidth*.35),Math.floor(this.cssHeight*.35),"bold",this.dtsColor,"left","bottom"),this.setLenBias()}getValueText(){if(this.dtsValue===null)return"--";let e=this.runtime.options();return this.dtsValue.toFixed(e?.numDecimal??0)}toHHMMSS(e){if(e==null||isNaN(e))return"-:--";let t=e<0;t&&(e=-e);let i=Math.floor(e/3600),a=Math.floor(e%3600/60),r=Math.floor(e%60),s=t?"-":"";return i===0?`${s}${a.toString().padStart(1,"0")}:${r.toString().padStart(2,"0")}`:`${s}${i.toString().padStart(1,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}getTimeToLineText(){return this.toHHMMSS(this.ttlValue)}getTimeToBurnText(){return this.toHHMMSS(this.ttbValue)}setLenBias(){let e=this.runtime.options();if(e){if(e.paths.lineLengthPath.path&&this.lengthValue!=null){let t=e.paths.lineLengthPath.convertUnitTo;t==="feet"&&(t="\u2032"),this.lineLengthValue.set(`\u2015${this.applyDecorations(this.lengthValue.toFixed(e.numDecimal))}${t}\u2015`)}if(e.paths.lineBiasPath.path&&this.biasValue!=null){let t=e.paths.lineBiasPath.convertUnitTo;t==="feet"&&(t="\u2032"),this.biasValue<0?(this.portBiasValue.set("+"+(-this.biasValue).toFixed(e.numDecimal)+t),this.stbBiasValue.set(this.biasValue.toFixed(e.numDecimal)+t)):(this.portBiasValue.set(" "+(-this.biasValue).toFixed(e.numDecimal)+t),this.stbBiasValue.set(" +"+this.biasValue.toFixed(e.numDecimal)+t))}}}applyDecorations(e){switch(this.runtime.options()?.paths?.dtsPath?.convertUnitTo){case"percent":case"percentraw":return e+"%";default:return e}}updateDtsColor(){let e=this.theme(),t=this.runtime.options();!e||!t||(t.ignoreZones?this.dtsValue?this.dtsValue<0?this.dtsColor=e.zoneAlarm:this.dtsValue<10?this.dtsColor=e.zoneWarn:this.dtsValue<20?this.dtsColor=e.zoneAlert:this.dtsColor=this.valueColor:this.dtsColor=this.valueColor:this.dtsColor=this.valueColor)}beep(e=440,t=100){if(!this.runtime.options()?.playBeeps)return;let i=window.AudioContext||window.webkitAudioContext,a=new i,r=a.createOscillator(),s=a.createGain();r.connect(s),s.connect(a.destination),r.type="sine",r.frequency.value=e,s.gain.value=.1,r.start(),r.stop(a.currentTime+t/1e3)}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-racer-line"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,bA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:16,vars:2,consts:[["canvasMainRef",""],[1,"line-wrapper"],[1,"filler"],[1,"line-canvas"],[1,"buttons-container"],["mat-flat-button","","matTooltip","Select the control mode",1,"button","select-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 80 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","40","y","9"],[1,"widgetOverlay"],[1,"pin-container"],["width","100%","height","100%","viewBox","0 0 70 18","preserveAspectRatio","xMidYMid meet",1,"svg-content","pin"],["x","33","y","14"],[1,"len-bias-container"],["width","100%","height","100%","viewBox","0 0 90 12","preserveAspectRatio","xMidYMid meet",1,"svg-content","len-bias"],["x","45","y","9"],[1,"pin"],[1,"boat"],[1,"boat-container"],["width","100%","height","100%","viewBox","0 0 70 18","preserveAspectRatio","xMidYMid meet",1,"svg-content","boat"],["mat-flat-button","","matTooltip","Set the port(pin) end of the line to the current position",1,"button","port-button",3,"click"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","50","y","11"],["mat-flat-button","","matTooltip","Set the starboard(boat) end of the line to the current position",1,"button","starboard-button",3,"click"],["mat-flat-button","","matTooltip","Increase the line length by 5m at the port(pin) end",1,"button","port-small-button",3,"click"],["width","100%","height","100%","viewBox","0 0 50 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","25","y","11"],["mat-flat-button","","matTooltip","Decrease the line length by 5m at the port(pin) end",1,"button","port-small-button",3,"click"],["mat-flat-button","","matTooltip","Decrease the line length by 5m at the starboard(boat) end",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Increase the line length by 5m at the starboard(boat) end",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the port(pin) end 1\xB0 clockwise",1,"button","port-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the port(pin) end 1\xB0 counter-clockwise",1,"button","port-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the starboard(boat) end 1\xB0 counter-clockwise",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Rotate the line by moving the starboard(boat) end 1\xB0 clockwise",1,"button","starboard-small-button",3,"click"],["mat-flat-button","","matTooltip","Display the next named line",1,"button","select-button",3,"click"],["mat-flat-button","",3,"click","matTooltip"],["width","100%","height","100%","viewBox","0 0 150 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],["x","75","y","11"]],template:function(t,i){if(t&1&&(d(0,"div",1)(1,"div",2),W(2,"canvas",3,0),u(),d(4,"div",4)(5,"button",5),U("click",function(){return i.toggleMode()}),d(6,"mat-icon",6),ie(),d(7,"svg",7)(8,"text",8),c(9,"\u22EE"),u()()()(),I(10,AA,16,3)(11,yA,10,0)(12,xA,20,0)(13,CA,20,0)(14,SA,10,6),u(),I(15,wA,1,0,"div",9),u()),t&2){let a;f(10),N((a=i.mode())===0?10:a===1?11:a===2?12:a===3?13:a===4?14:-1),f(5),N(i.dashboard.isDashboardStatic()?-1:15)}},dependencies:[ot,wt,et,Xe,ro,oo],styles:["[_nghost-%COMP%]{overflow:clip;display:block;height:100%;width:100%}.line-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.line-canvas[_ngcontent-%COMP%]{position:absolute;width:100%!important;height:76%!important;display:block;top:0;left:0}.filler[_ngcontent-%COMP%]{width:100%;height:76%}.buttons-container[_ngcontent-%COMP%]{display:flex;flex-wrap:nowrap;justify-content:space-between;column-gap:2%;position:relative;height:24%;width:100%;padding:0 10px 14px;z-index:20;pointer-events:auto;align-items:center}.button[_ngcontent-%COMP%]{min-width:0px;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.select-button[_ngcontent-%COMP%]{flex:none;width:18%;--mat-button-filled-container-color: var(--kip-blue-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.line-button[_ngcontent-%COMP%]{flex:none;width:58%;--mat-button-filled-container-color: var(--kip-grey-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.line-button-current[_ngcontent-%COMP%]{flex:none;width:58%;--mat-button-filled-container-color: var(--kip-orange-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.port-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.starboard-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-starboard-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.port-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.starboard-small-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-starboard-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.pin-container[_ngcontent-%COMP%]{flex-basis:18%}.pin[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.pin[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:19px}.len-bias-container[_ngcontent-%COMP%]{flex-basis:35%}.len-bias[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.len-bias[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:12px}.boat-container[_ngcontent-%COMP%]{flex-basis:18%}.boat[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.boat[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:19px}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"],changeDetection:0})}return n})();var _A=["canvasMainRef"];function MA(n,o){if(n&1){let e=we();d(0,"button",14),U("click",function(){ee(e);let i=k();return te(i.startTimer())}),c(1," Start "),u()}}function kA(n,o){if(n&1){let e=we();d(0,"button",15),U("click",function(){ee(e);let i=k();return te(i.pauseTimer())}),c(1," Pause "),u()}}var Ym=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);timers=y(Fu);canvas=y(ht);static DEFAULT_CONFIG={timerLength:-300,color:"contrast",playBeeps:!0};canvasRef=he.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;dataValue=null;zoneState=null;currentValueLength=0;valueFontSize=1;flashOn=!1;flashInterval=null;timerRunning=w(!1);timeName="race";warnColor="";textColor="";constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{this.applyColors(e.color,t),this.draw()})}),L(()=>{let e=this.runtime.options();e&&this.ensureTimer(e.timerLength??-300)})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxTextWidth=Math.floor(this.cssWidth*.95),this.maxTextHeight=Math.floor(this.cssHeight),this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.maxTextWidth=Math.floor(this.cssWidth*.95),this.maxTextHeight=Math.floor(this.cssHeight),this.draw()}ensureTimer(e){this.timers.createTimer(this.timeName,e,1e3).subscribe(i=>{this.dataValue=i,this.timerRunning.set(this.timers.isRunning(this.timeName)),i>0?this.zoneState=ve.Normal:i===0?(this.zoneState=ve.Normal,this.beep(500,2e3)):i>-10?(this.zoneState=ve.Alarm,this.beep(450,100)):i>=-29?this.zoneState=ve.Warn:i===-30?(this.zoneState=ve.Warn,this.beep(400,200)):this.zoneState=ve.Normal,this.zoneState===ve.Alarm&&!this.flashInterval?this.flashInterval=setInterval(()=>{this.flashOn=!this.flashOn,this.draw()},500):this.zoneState!==ve.Alarm&&this.flashInterval&&(clearInterval(this.flashInterval),this.flashInterval=null,this.flashOn=!1),this.draw()})}startTimer(){this.timers.startTimer(this.timeName),this.timerRunning.set(!0)}resetTimer(){this.timers.deleteTimer(this.timeName),this.timerRunning.set(!1);let e=this.runtime.options();this.ensureTimer(e?.timerLength??-300),this.draw()}pauseTimer(){this.timers.stopTimer(this.timeName),this.timerRunning.set(!1)}roundToMin(){if(this.dataValue==null)return;let t=(this.dataValue<0?-this.dataValue:this.dataValue)%60;this.dataValue>0?this.timers.setTimer(this.timeName,this.dataValue+(t>30?60-t:-t)):this.timers.setTimer(this.timeName,this.dataValue+(t>30?-(60-t):t))}addTime(e){this.dataValue!=null&&this.timers.setTimer(this.timeName,this.dataValue+e)}removeTime(e){this.dataValue!=null&&this.timers.setTimer(this.timeName,this.dataValue-e)}applyColors(e,t){switch(e){case"contrast":this.textColor=t.contrast,this.warnColor=t.zoneAlarm;break;case"blue":this.textColor=t.blue,this.warnColor=t.zoneAlarm;break;case"green":this.textColor=t.green,this.warnColor=t.zoneAlarm;break;case"pink":this.textColor=t.pink,this.warnColor=t.zoneAlarm;break;case"orange":this.textColor=t.orange,this.warnColor=t.zoneAlarm;break;case"purple":this.textColor=t.purple,this.warnColor=t.zoneAlarm;break;case"grey":this.textColor=t.grey,this.warnColor=t.zoneAlarm;break;case"yellow":this.textColor=t.yellow,this.warnColor=t.zoneAlarm;break;default:this.textColor=t.contrast,this.warnColor=t.zoneAlarm;break}}beep(e=440,t=100){if(this.runtime.options()?.playBeeps){let i=new(window.AudioContext||window.webkitAudioContext),a=i.createOscillator(),r=i.createGain();a.connect(r),r.connect(i.destination),a.type="sine",a.frequency.value=e,r.gain.value=.1,a.start(),a.stop(i.currentTime+t/1e3)}}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}this.flashInterval&&(clearInterval(this.flashInterval),this.flashInterval=null)}draw(){if(!this.ctx)return;this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight);let e;if(this.dataValue!=null){let t=Math.abs(this.dataValue),i=Math.floor(t/60),a=Math.floor(t%60);e=`${i}:${("0"+a).slice(-2)}`,this.dataValue<0&&(e=`-${e}`)}else e="--";switch(this.currentValueLength!==e.length&&(this.currentValueLength=e.length,this.valueFontSize=this.canvas.calculateOptimalFontSize(this.ctx,e,this.maxTextWidth,this.maxTextHeight,"bold")),this.zoneState){case ve.Alarm:this.flashOn?this.ctx.fillStyle=this.textColor:(this.canvas.drawRectangle(this.ctx,0,0,this.cssWidth,this.cssHeight,this.warnColor),this.ctx.fillStyle=this.textColor);break;case ve.Warn:this.ctx.fillStyle=this.warnColor;break;default:this.ctx.fillStyle=this.textColor}this.canvas.drawText(this.ctx,e,this.cssWidth/2,this.cssHeight/2,this.maxTextWidth,this.maxTextHeight,"bold",this.ctx.fillStyle,"center","middle")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-racetimer"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,_A,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:35,vars:2,consts:[["canvasMainRef",""],[1,"racetimer-wrapper"],[1,"racetimer-canvas"],[1,"timerBarContainer"],[1,"timer-button-groups","timer-adjusters-group"],["mat-flat-button","",1,"button","other-small-button",3,"click"],[1,"buttons-svg-icon"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-content"],[0,"xml","space","preserve","x","50","y","11"],["mat-flat-button","",1,"button","main-button",3,"click"],[1,"timer-button-groups","timer-countdown-group"],["mat-flat-button","",1,"timer-start-button","button-color-red"],["mat-flat-button","",1,"timer-start-button"],["mat-flat-button","",1,"timer-synch-button","button-color-red",3,"click"],["mat-flat-button","",1,"timer-start-button","button-color-red",3,"click"],["mat-flat-button","",1,"timer-start-button",3,"click"]],template:function(t,i){t&1&&(d(0,"div",1),W(1,"canvas",2,0),d(3,"div",3)(4,"div",4)(5,"button",5),U("click",function(){return i.removeTime(5)}),d(6,"mat-icon",6),ie(),d(7,"svg",7)(8,"text",8),c(9,"-5s"),u()()()(),Be(),d(10,"button",5),U("click",function(){return i.removeTime(60)}),d(11,"mat-icon",6),ie(),d(12,"svg",7)(13,"text",8),c(14,"-60s"),u()()()(),Be(),d(15,"button",9),U("click",function(){return i.resetTimer()}),d(16,"mat-icon",6),ie(),d(17,"svg",7)(18,"text",8),c(19,"Reset"),u()()()(),Be(),d(20,"button",5),U("click",function(){return i.addTime(60)}),d(21,"mat-icon",6),ie(),d(22,"svg",7)(23,"text",8),c(24,"+60s"),u()()()(),Be(),d(25,"button",5),U("click",function(){return i.addTime(5)}),d(26,"mat-icon",6),ie(),d(27,"svg",7)(28,"text",8),c(29,"+5s"),u()()()()(),Be(),d(30,"div",10),I(31,MA,2,0,"button",11),I(32,kA,2,0,"button",12),d(33,"button",13),U("click",function(){return i.roundToMin()}),c(34," Synch "),u()()()()),t&2&&(f(31),N(i.timerRunning()?-1:31),f(),N(i.timerRunning()?32:-1))},dependencies:[ot,wt,et,Xe],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.racetimer-wrapper[_ngcontent-%COMP%]{width:100%;height:100%;min-height:1px}.racetimer-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block}.button-color-red[_ngcontent-%COMP%]{--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.timerBarContainer[_ngcontent-%COMP%]{position:absolute;left:0;bottom:0;height:23%;width:100%;padding:0 10px 10px;display:flex;flex-direction:column;flex-wrap:nowrap;justify-content:flex-end;align-items:stretch;gap:10px}.timer-button-groups[_ngcontent-%COMP%]{min-width:247px;max-width:100%;--mat-button-filled-container-shape: 5px}.timer-adjusters-group[_ngcontent-%COMP%]{flex:1 1 auto;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;gap:10px;height:100%}.timer-countdown-group[_ngcontent-%COMP%]{flex-grow:1;flex-shrink:1}.timer-synch-button[_ngcontent-%COMP%]{width:calc(50% - 5px);margin-left:5px}.timer-start-button[_ngcontent-%COMP%]{width:calc(50% - 5px);margin-right:5px}.buttons-svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.button[_ngcontent-%COMP%]{min-width:0px;height:100%;width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-height: 100%;--mat-button-filled-horizontal-padding: 0px;--mat-button-filled-icon-spacing: 0px}.main-button[_ngcontent-%COMP%]{flex:1 1 auto;--mat-button-filled-container-color: var(--kip-port-color);--mat-button-filled-label-text-color: var(--kip-contrast-color)}.svg-content[_ngcontent-%COMP%]{width:100%;height:100%;padding:0;margin:0}.svg-content[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:15px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}"],changeDetection:0})}return n})();var TA=["canvasMainRef"],Zm=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);canvas=y(ht);canvasRef=he.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;maxTextWidth=0;maxTextHeight=0;middle=0;center=0;fontSizeOffset=0;latPos="";longPos="";labelColor=w("");valueColor="";static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,displayName:"Position",filterSelfPaths:!0,paths:{longPath:{description:"Longitude",path:"self.navigation.position.longitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"longitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500},latPath:{description:"Latitude",path:"self.navigation.position.latitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"latitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},color:"contrast",enableTimeout:!1,dataTimeout:5};constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{let i=Te(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw()})}),L(()=>{let e=this.runtime.options();if(!e)return;let t=e.paths?.longPath;t?.path&&G(()=>this.streams.observe("longPath",i=>{let a=i?.data?.value;a==null?this.longPos="":t.convertUnitTo==="pdeg"?this.longPos=a.toFixed(6)+"\xB0":this.longPos=String(a),this.calculateFontSizeAndPositions(),this.draw()}))}),L(()=>{let e=this.runtime.options();if(!e)return;let t=e.paths?.latPath;t?.path&&G(()=>this.streams.observe("latPath",i=>{let a=i?.data?.value;a==null?this.latPos="":t.convertUnitTo==="pdeg"?this.latPos=a.toFixed(7)+"\xB0":this.latPos=String(a),this.calculateFontSizeAndPositions(),this.draw()}))})}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.calculateFontSizeAndPositions(),this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.calculateFontSizeAndPositions(),this.draw()}calculateFontSizeAndPositions(){if(!this.cssWidth||!this.cssHeight)return;this.maxTextHeight=Math.floor(this.cssHeight*.6/2),this.maxTextWidth=Math.floor(this.cssWidth*.85),this.center=this.cssWidth/2,this.middle=this.cssHeight*.57;let e=this.latPos.length>this.longPos.length?this.latPos:this.longPos;if(this.ctx){let t=this.canvas.calculateOptimalFontSize(this.ctx,e,this.maxTextWidth,this.maxTextHeight,"bold");this.fontSizeOffset=Math.floor(t*5e-4)}}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options();if(!e)return;let t=e.displayName||"Position",i=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==t||this.titleBitmapColor!==i)&&(this.titleBitmap=this.canvas.createTitleBitmap(t,i,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=t,this.titleBitmapColor=i),this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.ctx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight),this.canvas.drawText(this.ctx,this.latPos,this.center,this.middle-this.fontSizeOffset,this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor,"center","bottom"),this.canvas.drawText(this.ctx,this.longPos,this.center,this.middle+this.fontSizeOffset,this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor,"center","top")}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-position"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,TA,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"position-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.position-canvas[_ngcontent-%COMP%]{display:block;width:100%!important;height:100%!important;min-height:1px}"],changeDetection:0})}return n})();var DA={value:()=>{}};function Qm(){for(var n=0,o=arguments.length,e={},t;n<o;++n){if(!(t=arguments[n]+"")||t in e||/[\s.]/.test(t))throw new Error("illegal type: "+t);e[t]=[]}return new _s(e)}function _s(n){this._=n}function EA(n,o){return n.trim().split(/^|\s+/).map(function(e){var t="",i=e.indexOf(".");if(i>=0&&(t=e.slice(i+1),e=e.slice(0,i)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})}_s.prototype=Qm.prototype={constructor:_s,on:function(n,o){var e=this._,t=EA(n+"",e),i,a=-1,r=t.length;if(arguments.length<2){for(;++a<r;)if((i=(n=t[a]).type)&&(i=PA(e[i],n.name)))return i;return}if(o!=null&&typeof o!="function")throw new Error("invalid callback: "+o);for(;++a<r;)if(i=(n=t[a]).type)e[i]=Xm(e[i],n.name,o);else if(o==null)for(i in e)e[i]=Xm(e[i],n.name,null);return this},copy:function(){var n={},o=this._;for(var e in o)n[e]=o[e].slice();return new _s(n)},call:function(n,o){if((i=arguments.length-2)>0)for(var e=new Array(i),t=0,i,a;t<i;++t)e[t]=arguments[t+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(a=this._[n],t=0,i=a.length;t<i;++t)a[t].value.apply(o,e)},apply:function(n,o,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var t=this._[n],i=0,a=t.length;i<a;++i)t[i].value.apply(o,e)}};function PA(n,o){for(var e=0,t=n.length,i;e<t;++e)if((i=n[e]).name===o)return i.value}function Xm(n,o,e){for(var t=0,i=n.length;t<i;++t)if(n[t].name===o){n[t]=DA,n=n.slice(0,t).concat(n.slice(t+1));break}return e!=null&&n.push({name:o,value:e}),n}var ql=Qm;var Ms="http://www.w3.org/1999/xhtml",$l={svg:"http://www.w3.org/2000/svg",xhtml:Ms,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function wn(n){var o=n+="",e=o.indexOf(":");return e>=0&&(o=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),$l.hasOwnProperty(o)?{space:$l[o],local:n}:n}function IA(n){return function(){var o=this.ownerDocument,e=this.namespaceURI;return e===Ms&&o.documentElement.namespaceURI===Ms?o.createElement(n):o.createElementNS(e,n)}}function NA(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function ks(n){var o=wn(n);return(o.local?NA:IA)(o)}function OA(){}function wa(n){return n==null?OA:function(){return this.querySelector(n)}}function Km(n){typeof n!="function"&&(n=wa(n));for(var o=this._groups,e=o.length,t=new Array(e),i=0;i<e;++i)for(var a=o[i],r=a.length,s=t[i]=new Array(r),l,m,g=0;g<r;++g)(l=a[g])&&(m=n.call(l,l.__data__,g,a))&&("__data__"in l&&(m.__data__=l.__data__),s[g]=m);return new Tt(t,this._parents)}function jl(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function RA(){return[]}function Jo(n){return n==null?RA:function(){return this.querySelectorAll(n)}}function VA(n){return function(){return jl(n.apply(this,arguments))}}function Jm(n){typeof n=="function"?n=VA(n):n=Jo(n);for(var o=this._groups,e=o.length,t=[],i=[],a=0;a<e;++a)for(var r=o[a],s=r.length,l,m=0;m<s;++m)(l=r[m])&&(t.push(n.call(l,l.__data__,m,r)),i.push(l));return new Tt(t,i)}function er(n){return function(){return this.matches(n)}}function Ts(n){return function(o){return o.matches(n)}}var LA=Array.prototype.find;function WA(n){return function(){return LA.call(this.children,n)}}function FA(){return this.firstElementChild}function eh(n){return this.select(n==null?FA:WA(typeof n=="function"?n:Ts(n)))}var GA=Array.prototype.filter;function BA(){return Array.from(this.children)}function zA(n){return function(){return GA.call(this.children,n)}}function th(n){return this.selectAll(n==null?BA:zA(typeof n=="function"?n:Ts(n)))}function ih(n){typeof n!="function"&&(n=er(n));for(var o=this._groups,e=o.length,t=new Array(e),i=0;i<e;++i)for(var a=o[i],r=a.length,s=t[i]=[],l,m=0;m<r;++m)(l=a[m])&&n.call(l,l.__data__,m,a)&&s.push(l);return new Tt(t,this._parents)}function Ds(n){return new Array(n.length)}function nh(){return new Tt(this._enter||this._groups.map(Ds),this._parents)}function tr(n,o){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=o}tr.prototype={constructor:tr,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,o){return this._parent.insertBefore(n,o)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function ah(n){return function(){return n}}function UA(n,o,e,t,i,a){for(var r=0,s,l=o.length,m=a.length;r<m;++r)(s=o[r])?(s.__data__=a[r],t[r]=s):e[r]=new tr(n,a[r]);for(;r<l;++r)(s=o[r])&&(i[r]=s)}function HA(n,o,e,t,i,a,r){var s,l,m=new Map,g=o.length,v=a.length,A=new Array(g),C;for(s=0;s<g;++s)(l=o[s])&&(A[s]=C=r.call(l,l.__data__,s,o)+"",m.has(C)?i[s]=l:m.set(C,l));for(s=0;s<v;++s)C=r.call(n,a[s],s,a)+"",(l=m.get(C))?(t[s]=l,l.__data__=a[s],m.delete(C)):e[s]=new tr(n,a[s]);for(s=0;s<g;++s)(l=o[s])&&m.get(A[s])===l&&(i[s]=l)}function qA(n){return n.__data__}function oh(n,o){if(!arguments.length)return Array.from(this,qA);var e=o?HA:UA,t=this._parents,i=this._groups;typeof n!="function"&&(n=ah(n));for(var a=i.length,r=new Array(a),s=new Array(a),l=new Array(a),m=0;m<a;++m){var g=t[m],v=i[m],A=v.length,C=$A(n.call(g,g&&g.__data__,m,t)),_=C.length,M=s[m]=new Array(_),B=r[m]=new Array(_),D=l[m]=new Array(A);e(g,v,M,B,D,C,o);for(var V=0,F=0,Y,j;V<_;++V)if(Y=M[V]){for(V>=F&&(F=V+1);!(j=B[F])&&++F<_;);Y._next=j||null}}return r=new Tt(r,t),r._enter=s,r._exit=l,r}function $A(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function rh(){return new Tt(this._exit||this._groups.map(Ds),this._parents)}function sh(n,o,e){var t=this.enter(),i=this,a=this.exit();return typeof n=="function"?(t=n(t),t&&(t=t.selection())):t=t.append(n+""),o!=null&&(i=o(i),i&&(i=i.selection())),e==null?a.remove():e(a),t&&i?t.merge(i).order():i}function lh(n){for(var o=n.selection?n.selection():n,e=this._groups,t=o._groups,i=e.length,a=t.length,r=Math.min(i,a),s=new Array(i),l=0;l<r;++l)for(var m=e[l],g=t[l],v=m.length,A=s[l]=new Array(v),C,_=0;_<v;++_)(C=m[_]||g[_])&&(A[_]=C);for(;l<i;++l)s[l]=e[l];return new Tt(s,this._parents)}function dh(){for(var n=this._groups,o=-1,e=n.length;++o<e;)for(var t=n[o],i=t.length-1,a=t[i],r;--i>=0;)(r=t[i])&&(a&&r.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(r,a),a=r);return this}function ch(n){n||(n=jA);function o(v,A){return v&&A?n(v.__data__,A.__data__):!v-!A}for(var e=this._groups,t=e.length,i=new Array(t),a=0;a<t;++a){for(var r=e[a],s=r.length,l=i[a]=new Array(s),m,g=0;g<s;++g)(m=r[g])&&(l[g]=m);l.sort(o)}return new Tt(i,this._parents).order()}function jA(n,o){return n<o?-1:n>o?1:n>=o?0:NaN}function uh(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function mh(){return Array.from(this)}function hh(){for(var n=this._groups,o=0,e=n.length;o<e;++o)for(var t=n[o],i=0,a=t.length;i<a;++i){var r=t[i];if(r)return r}return null}function ph(){let n=0;for(let o of this)++n;return n}function gh(){return!this.node()}function fh(n){for(var o=this._groups,e=0,t=o.length;e<t;++e)for(var i=o[e],a=0,r=i.length,s;a<r;++a)(s=i[a])&&n.call(s,s.__data__,a,i);return this}function YA(n){return function(){this.removeAttribute(n)}}function ZA(n){return function(){this.removeAttributeNS(n.space,n.local)}}function XA(n,o){return function(){this.setAttribute(n,o)}}function QA(n,o){return function(){this.setAttributeNS(n.space,n.local,o)}}function KA(n,o){return function(){var e=o.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function JA(n,o){return function(){var e=o.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function vh(n,o){var e=wn(n);if(arguments.length<2){var t=this.node();return e.local?t.getAttributeNS(e.space,e.local):t.getAttribute(e)}return this.each((o==null?e.local?ZA:YA:typeof o=="function"?e.local?JA:KA:e.local?QA:XA)(e,o))}function Es(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function ey(n){return function(){this.style.removeProperty(n)}}function ty(n,o,e){return function(){this.style.setProperty(n,o,e)}}function iy(n,o,e){return function(){var t=o.apply(this,arguments);t==null?this.style.removeProperty(n):this.style.setProperty(n,t,e)}}function bh(n,o,e){return arguments.length>1?this.each((o==null?ey:typeof o=="function"?iy:ty)(n,o,e??"")):Kn(this.node(),n)}function Kn(n,o){return n.style.getPropertyValue(o)||Es(n).getComputedStyle(n,null).getPropertyValue(o)}function ny(n){return function(){delete this[n]}}function ay(n,o){return function(){this[n]=o}}function oy(n,o){return function(){var e=o.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function Ah(n,o){return arguments.length>1?this.each((o==null?ny:typeof o=="function"?oy:ay)(n,o)):this.node()[n]}function yh(n){return n.trim().split(/^|\s+/)}function Yl(n){return n.classList||new xh(n)}function xh(n){this._node=n,this._names=yh(n.getAttribute("class")||"")}xh.prototype={add:function(n){var o=this._names.indexOf(n);o<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var o=this._names.indexOf(n);o>=0&&(this._names.splice(o,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function Ch(n,o){for(var e=Yl(n),t=-1,i=o.length;++t<i;)e.add(o[t])}function Sh(n,o){for(var e=Yl(n),t=-1,i=o.length;++t<i;)e.remove(o[t])}function ry(n){return function(){Ch(this,n)}}function sy(n){return function(){Sh(this,n)}}function ly(n,o){return function(){(o.apply(this,arguments)?Ch:Sh)(this,n)}}function wh(n,o){var e=yh(n+"");if(arguments.length<2){for(var t=Yl(this.node()),i=-1,a=e.length;++i<a;)if(!t.contains(e[i]))return!1;return!0}return this.each((typeof o=="function"?ly:o?ry:sy)(e,o))}function dy(){this.textContent=""}function cy(n){return function(){this.textContent=n}}function uy(n){return function(){var o=n.apply(this,arguments);this.textContent=o??""}}function _h(n){return arguments.length?this.each(n==null?dy:(typeof n=="function"?uy:cy)(n)):this.node().textContent}function my(){this.innerHTML=""}function hy(n){return function(){this.innerHTML=n}}function py(n){return function(){var o=n.apply(this,arguments);this.innerHTML=o??""}}function Mh(n){return arguments.length?this.each(n==null?my:(typeof n=="function"?py:hy)(n)):this.node().innerHTML}function gy(){this.nextSibling&&this.parentNode.appendChild(this)}function kh(){return this.each(gy)}function fy(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Th(){return this.each(fy)}function Dh(n){var o=typeof n=="function"?n:ks(n);return this.select(function(){return this.appendChild(o.apply(this,arguments))})}function vy(){return null}function Eh(n,o){var e=typeof n=="function"?n:ks(n),t=o==null?vy:typeof o=="function"?o:wa(o);return this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})}function by(){var n=this.parentNode;n&&n.removeChild(this)}function Ph(){return this.each(by)}function Ay(){var n=this.cloneNode(!1),o=this.parentNode;return o?o.insertBefore(n,this.nextSibling):n}function yy(){var n=this.cloneNode(!0),o=this.parentNode;return o?o.insertBefore(n,this.nextSibling):n}function Ih(n){return this.select(n?yy:Ay)}function Nh(n){return arguments.length?this.property("__data__",n):this.node().__data__}function xy(n){return function(o){n.call(this,o,this.__data__)}}function Cy(n){return n.trim().split(/^|\s+/).map(function(o){var e="",t=o.indexOf(".");return t>=0&&(e=o.slice(t+1),o=o.slice(0,t)),{type:o,name:e}})}function Sy(n){return function(){var o=this.__on;if(o){for(var e=0,t=-1,i=o.length,a;e<i;++e)a=o[e],(!n.type||a.type===n.type)&&a.name===n.name?this.removeEventListener(a.type,a.listener,a.options):o[++t]=a;++t?o.length=t:delete this.__on}}}function wy(n,o,e){return function(){var t=this.__on,i,a=xy(o);if(t){for(var r=0,s=t.length;r<s;++r)if((i=t[r]).type===n.type&&i.name===n.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=e),i.value=o;return}}this.addEventListener(n.type,a,e),i={type:n.type,name:n.name,value:o,listener:a,options:e},t?t.push(i):this.__on=[i]}}function Oh(n,o,e){var t=Cy(n+""),i,a=t.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,m=s.length,g;l<m;++l)for(i=0,g=s[l];i<a;++i)if((r=t[i]).type===g.type&&r.name===g.name)return g.value}return}for(s=o?wy:Sy,i=0;i<a;++i)this.each(s(t[i],o,e));return this}function Rh(n,o,e){var t=Es(n),i=t.CustomEvent;typeof i=="function"?i=new i(o,e):(i=t.document.createEvent("Event"),e?(i.initEvent(o,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(o,!1,!1)),n.dispatchEvent(i)}function _y(n,o){return function(){return Rh(this,n,o)}}function My(n,o){return function(){return Rh(this,n,o.apply(this,arguments))}}function Vh(n,o){return this.each((typeof o=="function"?My:_y)(n,o))}function*Lh(){for(var n=this._groups,o=0,e=n.length;o<e;++o)for(var t=n[o],i=0,a=t.length,r;i<a;++i)(r=t[i])&&(yield r)}var Zl=[null];function Tt(n,o){this._groups=n,this._parents=o}function Wh(){return new Tt([[document.documentElement]],Zl)}function ky(){return this}Tt.prototype=Wh.prototype={constructor:Tt,select:Km,selectAll:Jm,selectChild:eh,selectChildren:th,filter:ih,data:oh,enter:nh,exit:rh,join:sh,merge:lh,selection:ky,order:dh,sort:ch,call:uh,nodes:mh,node:hh,size:ph,empty:gh,each:fh,attr:vh,style:bh,property:Ah,classed:wh,text:_h,html:Mh,raise:kh,lower:Th,append:Dh,insert:Eh,remove:Ph,clone:Ih,datum:Nh,on:Oh,dispatch:Vh,[Symbol.iterator]:Lh};var _n=Wh;function hn(n){return typeof n=="string"?new Tt([[document.querySelector(n)]],[document.documentElement]):new Tt([[n]],Zl)}function Ps(n,o,e){n.prototype=o.prototype=e,e.constructor=n}function Xl(n,o){var e=Object.create(n.prototype);for(var t in o)e[t]=o[t];return e}function ar(){}var ir=.7,Os=1/ir,fo="\\s*([+-]?\\d+)\\s*",nr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ty=/^#([0-9a-f]{3,8})$/,Dy=new RegExp(`^rgb\\(${fo},${fo},${fo}\\)$`),Ey=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),Py=new RegExp(`^rgba\\(${fo},${fo},${fo},${nr}\\)$`),Iy=new RegExp(`^rgba\\(${pn},${pn},${pn},${nr}\\)$`),Ny=new RegExp(`^hsl\\(${nr},${pn},${pn}\\)$`),Oy=new RegExp(`^hsla\\(${nr},${pn},${pn},${nr}\\)$`),Fh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ps(ar,Jn,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:Gh,formatHex:Gh,formatHex8:Ry,formatHsl:Vy,formatRgb:Bh,toString:Bh});function Gh(){return this.rgb().formatHex()}function Ry(){return this.rgb().formatHex8()}function Vy(){return jh(this).formatHsl()}function Bh(){return this.rgb().formatRgb()}function Jn(n){var o,e;return n=(n+"").trim().toLowerCase(),(o=Ty.exec(n))?(e=o[1].length,o=parseInt(o[1],16),e===6?zh(o):e===3?new hi(o>>8&15|o>>4&240,o>>4&15|o&240,(o&15)<<4|o&15,1):e===8?Is(o>>24&255,o>>16&255,o>>8&255,(o&255)/255):e===4?Is(o>>12&15|o>>8&240,o>>8&15|o>>4&240,o>>4&15|o&240,((o&15)<<4|o&15)/255):null):(o=Dy.exec(n))?new hi(o[1],o[2],o[3],1):(o=Ey.exec(n))?new hi(o[1]*255/100,o[2]*255/100,o[3]*255/100,1):(o=Py.exec(n))?Is(o[1],o[2],o[3],o[4]):(o=Iy.exec(n))?Is(o[1]*255/100,o[2]*255/100,o[3]*255/100,o[4]):(o=Ny.exec(n))?qh(o[1],o[2]/100,o[3]/100,1):(o=Oy.exec(n))?qh(o[1],o[2]/100,o[3]/100,o[4]):Fh.hasOwnProperty(n)?zh(Fh[n]):n==="transparent"?new hi(NaN,NaN,NaN,0):null}function zh(n){return new hi(n>>16&255,n>>8&255,n&255,1)}function Is(n,o,e,t){return t<=0&&(n=o=e=NaN),new hi(n,o,e,t)}function Ly(n){return n instanceof ar||(n=Jn(n)),n?(n=n.rgb(),new hi(n.r,n.g,n.b,n.opacity)):new hi}function vo(n,o,e,t){return arguments.length===1?Ly(n):new hi(n,o,e,t??1)}function hi(n,o,e,t){this.r=+n,this.g=+o,this.b=+e,this.opacity=+t}Ps(hi,vo,Xl(ar,{brighter(n){return n=n==null?Os:Math.pow(Os,n),new hi(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?ir:Math.pow(ir,n),new hi(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new hi(Ma(this.r),Ma(this.g),Ma(this.b),Rs(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Uh,formatHex:Uh,formatHex8:Wy,formatRgb:Hh,toString:Hh}));function Uh(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}`}function Wy(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}${_a((isNaN(this.opacity)?1:this.opacity)*255)}`}function Hh(){let n=Rs(this.opacity);return`${n===1?"rgb(":"rgba("}${Ma(this.r)}, ${Ma(this.g)}, ${Ma(this.b)}${n===1?")":`, ${n})`}`}function Rs(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function Ma(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function _a(n){return n=Ma(n),(n<16?"0":"")+n.toString(16)}function qh(n,o,e,t){return t<=0?n=o=e=NaN:e<=0||e>=1?n=o=NaN:o<=0&&(n=NaN),new qi(n,o,e,t)}function jh(n){if(n instanceof qi)return new qi(n.h,n.s,n.l,n.opacity);if(n instanceof ar||(n=Jn(n)),!n)return new qi;if(n instanceof qi)return n;n=n.rgb();var o=n.r/255,e=n.g/255,t=n.b/255,i=Math.min(o,e,t),a=Math.max(o,e,t),r=NaN,s=a-i,l=(a+i)/2;return s?(o===a?r=(e-t)/s+(e<t)*6:e===a?r=(t-o)/s+2:r=(o-e)/s+4,s/=l<.5?a+i:2-a-i,r*=60):s=l>0&&l<1?0:r,new qi(r,s,l,n.opacity)}function Yh(n,o,e,t){return arguments.length===1?jh(n):new qi(n,o,e,t??1)}function qi(n,o,e,t){this.h=+n,this.s=+o,this.l=+e,this.opacity=+t}Ps(qi,Yh,Xl(ar,{brighter(n){return n=n==null?Os:Math.pow(Os,n),new qi(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?ir:Math.pow(ir,n),new qi(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,o=isNaN(n)||isNaN(this.s)?0:this.s,e=this.l,t=e+(e<.5?e:1-e)*o,i=2*e-t;return new hi(Ql(n>=240?n-240:n+120,i,t),Ql(n,i,t),Ql(n<120?n+240:n-120,i,t),this.opacity)},clamp(){return new qi($h(this.h),Ns(this.s),Ns(this.l),Rs(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let n=Rs(this.opacity);return`${n===1?"hsl(":"hsla("}${$h(this.h)}, ${Ns(this.s)*100}%, ${Ns(this.l)*100}%${n===1?")":`, ${n})`}`}}));function $h(n){return n=(n||0)%360,n<0?n+360:n}function Ns(n){return Math.max(0,Math.min(1,n||0))}function Ql(n,o,e){return(n<60?o+(e-o)*n/60:n<180?e:n<240?o+(e-o)*(240-n)/60:o)*255}function Kl(n,o,e,t,i){var a=n*n,r=a*n;return((1-3*n+3*a-r)*o+(4-6*a+3*r)*e+(1+3*n+3*a-3*r)*t+r*i)/6}function Zh(n){var o=n.length-1;return function(e){var t=e<=0?e=0:e>=1?(e=1,o-1):Math.floor(e*o),i=n[t],a=n[t+1],r=t>0?n[t-1]:2*i-a,s=t<o-1?n[t+2]:2*a-i;return Kl((e-t/o)*o,r,i,a,s)}}function Xh(n){var o=n.length;return function(e){var t=Math.floor(((e%=1)<0?++e:e)*o),i=n[(t+o-1)%o],a=n[t%o],r=n[(t+1)%o],s=n[(t+2)%o];return Kl((e-t/o)*o,i,a,r,s)}}var Jl=n=>()=>n;function Fy(n,o){return function(e){return n+e*o}}function Gy(n,o,e){return n=Math.pow(n,e),o=Math.pow(o,e)-n,e=1/e,function(t){return Math.pow(n+t*o,e)}}function Qh(n){return(n=+n)==1?Vs:function(o,e){return e-o?Gy(o,e,n):Jl(isNaN(o)?e:o)}}function Vs(n,o){var e=o-n;return e?Fy(n,e):Jl(isNaN(n)?o:n)}var Ls=(function n(o){var e=Qh(o);function t(i,a){var r=e((i=vo(i)).r,(a=vo(a)).r),s=e(i.g,a.g),l=e(i.b,a.b),m=Vs(i.opacity,a.opacity);return function(g){return i.r=r(g),i.g=s(g),i.b=l(g),i.opacity=m(g),i+""}}return t.gamma=n,t})(1);function Kh(n){return function(o){var e=o.length,t=new Array(e),i=new Array(e),a=new Array(e),r,s;for(r=0;r<e;++r)s=vo(o[r]),t[r]=s.r||0,i[r]=s.g||0,a[r]=s.b||0;return t=n(t),i=n(i),a=n(a),s.opacity=1,function(l){return s.r=t(l),s.g=i(l),s.b=a(l),s+""}}}var By=Kh(Zh),zy=Kh(Xh);function Ni(n,o){return n=+n,o=+o,function(e){return n*(1-e)+o*e}}var td=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ed=new RegExp(td.source,"g");function Uy(n){return function(){return n}}function Hy(n){return function(o){return n(o)+""}}function id(n,o){var e=td.lastIndex=ed.lastIndex=0,t,i,a,r=-1,s=[],l=[];for(n=n+"",o=o+"";(t=td.exec(n))&&(i=ed.exec(o));)(a=i.index)>e&&(a=o.slice(e,a),s[r]?s[r]+=a:s[++r]=a),(t=t[0])===(i=i[0])?s[r]?s[r]+=i:s[++r]=i:(s[++r]=null,l.push({i:r,x:Ni(t,i)})),e=ed.lastIndex;return e<o.length&&(a=o.slice(e),s[r]?s[r]+=a:s[++r]=a),s.length<2?l[0]?Hy(l[0].x):Uy(o):(o=l.length,function(m){for(var g=0,v;g<o;++g)s[(v=l[g]).i]=v.x(m);return s.join("")})}var Jh=180/Math.PI,Ws={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function nd(n,o,e,t,i,a){var r,s,l;return(r=Math.sqrt(n*n+o*o))&&(n/=r,o/=r),(l=n*e+o*t)&&(e-=n*l,t-=o*l),(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s,l/=s),n*t<o*e&&(n=-n,o=-o,l=-l,r=-r),{translateX:i,translateY:a,rotate:Math.atan2(o,n)*Jh,skewX:Math.atan(l)*Jh,scaleX:r,scaleY:s}}var Fs;function ep(n){let o=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return o.isIdentity?Ws:nd(o.a,o.b,o.c,o.d,o.e,o.f)}function tp(n){return n==null?Ws:(Fs||(Fs=document.createElementNS("http://www.w3.org/2000/svg","g")),Fs.setAttribute("transform",n),(n=Fs.transform.baseVal.consolidate())?(n=n.matrix,nd(n.a,n.b,n.c,n.d,n.e,n.f)):Ws)}function ip(n,o,e,t){function i(m){return m.length?m.pop()+" ":""}function a(m,g,v,A,C,_){if(m!==v||g!==A){var M=C.push("translate(",null,o,null,e);_.push({i:M-4,x:Ni(m,v)},{i:M-2,x:Ni(g,A)})}else(v||A)&&C.push("translate("+v+o+A+e)}function r(m,g,v,A){m!==g?(m-g>180?g+=360:g-m>180&&(m+=360),A.push({i:v.push(i(v)+"rotate(",null,t)-2,x:Ni(m,g)})):g&&v.push(i(v)+"rotate("+g+t)}function s(m,g,v,A){m!==g?A.push({i:v.push(i(v)+"skewX(",null,t)-2,x:Ni(m,g)}):g&&v.push(i(v)+"skewX("+g+t)}function l(m,g,v,A,C,_){if(m!==v||g!==A){var M=C.push(i(C)+"scale(",null,",",null,")");_.push({i:M-4,x:Ni(m,v)},{i:M-2,x:Ni(g,A)})}else(v!==1||A!==1)&&C.push(i(C)+"scale("+v+","+A+")")}return function(m,g){var v=[],A=[];return m=n(m),g=n(g),a(m.translateX,m.translateY,g.translateX,g.translateY,v,A),r(m.rotate,g.rotate,v,A),s(m.skewX,g.skewX,v,A),l(m.scaleX,m.scaleY,g.scaleX,g.scaleY,v,A),m=g=null,function(C){for(var _=-1,M=A.length,B;++_<M;)v[(B=A[_]).i]=B.x(C);return v.join("")}}}var ad=ip(ep,"px, ","px)","deg)"),od=ip(tp,", ",")",")");var bo=0,rr=0,or=0,ap=1e3,Gs,sr,Bs=0,ka=0,zs=0,lr=typeof performance=="object"&&performance.now?performance:Date,op=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function cr(){return ka||(op(qy),ka=lr.now()+zs)}function qy(){ka=0}function dr(){this._call=this._time=this._next=null}dr.prototype=Us.prototype={constructor:dr,restart:function(n,o,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?cr():+e)+(o==null?0:+o),!this._next&&sr!==this&&(sr?sr._next=this:Gs=this,sr=this),this._call=n,this._time=e,rd()},stop:function(){this._call&&(this._call=null,this._time=1/0,rd())}};function Us(n,o,e){var t=new dr;return t.restart(n,o,e),t}function rp(){cr(),++bo;for(var n=Gs,o;n;)(o=ka-n._time)>=0&&n._call.call(void 0,o),n=n._next;--bo}function np(){ka=(Bs=lr.now())+zs,bo=rr=0;try{rp()}finally{bo=0,jy(),ka=0}}function $y(){var n=lr.now(),o=n-Bs;o>ap&&(zs-=o,Bs=n)}function jy(){for(var n,o=Gs,e,t=1/0;o;)o._call?(t>o._time&&(t=o._time),n=o,o=o._next):(e=o._next,o._next=null,o=n?n._next=e:Gs=e);sr=n,rd(t)}function rd(n){if(!bo){rr&&(rr=clearTimeout(rr));var o=n-ka;o>24?(n<1/0&&(rr=setTimeout(np,n-lr.now()-zs)),or&&(or=clearInterval(or))):(or||(Bs=lr.now(),or=setInterval($y,ap)),bo=1,op(np))}}function Hs(n,o,e){var t=new dr;return o=o==null?0:+o,t.restart(i=>{t.stop(),n(i+o)},o,e),t}var Yy=ql("start","end","cancel","interrupt"),Zy=[],dp=0,sp=1,$s=2,qs=3,lp=4,js=5,ur=6;function ea(n,o,e,t,i,a){var r=n.__transition;if(!r)n.__transition={};else if(e in r)return;Xy(n,e,{name:o,index:t,group:i,on:Yy,tween:Zy,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:dp})}function mr(n,o){var e=Vt(n,o);if(e.state>dp)throw new Error("too late; already scheduled");return e}function Gt(n,o){var e=Vt(n,o);if(e.state>qs)throw new Error("too late; already running");return e}function Vt(n,o){var e=n.__transition;if(!e||!(e=e[o]))throw new Error("transition not found");return e}function Xy(n,o,e){var t=n.__transition,i;t[o]=e,e.timer=Us(a,0,e.time);function a(m){e.state=sp,e.timer.restart(r,e.delay,e.time),e.delay<=m&&r(m-e.delay)}function r(m){var g,v,A,C;if(e.state!==sp)return l();for(g in t)if(C=t[g],C.name===e.name){if(C.state===qs)return Hs(r);C.state===lp?(C.state=ur,C.timer.stop(),C.on.call("interrupt",n,n.__data__,C.index,C.group),delete t[g]):+g<o&&(C.state=ur,C.timer.stop(),C.on.call("cancel",n,n.__data__,C.index,C.group),delete t[g])}if(Hs(function(){e.state===qs&&(e.state=lp,e.timer.restart(s,e.delay,e.time),s(m))}),e.state=$s,e.on.call("start",n,n.__data__,e.index,e.group),e.state===$s){for(e.state=qs,i=new Array(A=e.tween.length),g=0,v=-1;g<A;++g)(C=e.tween[g].value.call(n,n.__data__,e.index,e.group))&&(i[++v]=C);i.length=v+1}}function s(m){for(var g=m<e.duration?e.ease.call(null,m/e.duration):(e.timer.restart(l),e.state=js,1),v=-1,A=i.length;++v<A;)i[v].call(n,g);e.state===js&&(e.on.call("end",n,n.__data__,e.index,e.group),l())}function l(){e.state=ur,e.timer.stop(),delete t[o];for(var m in t)return;delete n.__transition}}function Ys(n,o){var e=n.__transition,t,i,a=!0,r;if(e){o=o==null?null:o+"";for(r in e){if((t=e[r]).name!==o){a=!1;continue}i=t.state>$s&&t.state<js,t.state=ur,t.timer.stop(),t.on.call(i?"interrupt":"cancel",n,n.__data__,t.index,t.group),delete e[r]}a&&delete n.__transition}}function cp(n){return this.each(function(){Ys(this,n)})}function Qy(n,o){var e,t;return function(){var i=Gt(this,n),a=i.tween;if(a!==e){t=e=a;for(var r=0,s=t.length;r<s;++r)if(t[r].name===o){t=t.slice(),t.splice(r,1);break}}i.tween=t}}function Ky(n,o,e){var t,i;if(typeof e!="function")throw new Error;return function(){var a=Gt(this,n),r=a.tween;if(r!==t){i=(t=r).slice();for(var s={name:o,value:e},l=0,m=i.length;l<m;++l)if(i[l].name===o){i[l]=s;break}l===m&&i.push(s)}a.tween=i}}function up(n,o){var e=this._id;if(n+="",arguments.length<2){for(var t=Vt(this.node(),e).tween,i=0,a=t.length,r;i<a;++i)if((r=t[i]).name===n)return r.value;return null}return this.each((o==null?Qy:Ky)(e,n,o))}function Ao(n,o,e){var t=n._id;return n.each(function(){var i=Gt(this,t);(i.value||(i.value={}))[o]=e.apply(this,arguments)}),function(i){return Vt(i,t).value[o]}}function Zs(n,o){var e;return(typeof o=="number"?Ni:o instanceof Jn?Ls:(e=Jn(o))?(o=e,Ls):id)(n,o)}function Jy(n){return function(){this.removeAttribute(n)}}function ex(n){return function(){this.removeAttributeNS(n.space,n.local)}}function tx(n,o,e){var t,i=e+"",a;return function(){var r=this.getAttribute(n);return r===i?null:r===t?a:a=o(t=r,e)}}function ix(n,o,e){var t,i=e+"",a;return function(){var r=this.getAttributeNS(n.space,n.local);return r===i?null:r===t?a:a=o(t=r,e)}}function nx(n,o,e){var t,i,a;return function(){var r,s=e(this),l;return s==null?void this.removeAttribute(n):(r=this.getAttribute(n),l=s+"",r===l?null:r===t&&l===i?a:(i=l,a=o(t=r,s)))}}function ax(n,o,e){var t,i,a;return function(){var r,s=e(this),l;return s==null?void this.removeAttributeNS(n.space,n.local):(r=this.getAttributeNS(n.space,n.local),l=s+"",r===l?null:r===t&&l===i?a:(i=l,a=o(t=r,s)))}}function mp(n,o){var e=wn(n),t=e==="transform"?od:Zs;return this.attrTween(n,typeof o=="function"?(e.local?ax:nx)(e,t,Ao(this,"attr."+n,o)):o==null?(e.local?ex:Jy)(e):(e.local?ix:tx)(e,t,o))}function ox(n,o){return function(e){this.setAttribute(n,o.call(this,e))}}function rx(n,o){return function(e){this.setAttributeNS(n.space,n.local,o.call(this,e))}}function sx(n,o){var e,t;function i(){var a=o.apply(this,arguments);return a!==t&&(e=(t=a)&&rx(n,a)),e}return i._value=o,i}function lx(n,o){var e,t;function i(){var a=o.apply(this,arguments);return a!==t&&(e=(t=a)&&ox(n,a)),e}return i._value=o,i}function hp(n,o){var e="attr."+n;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(o==null)return this.tween(e,null);if(typeof o!="function")throw new Error;var t=wn(n);return this.tween(e,(t.local?sx:lx)(t,o))}function dx(n,o){return function(){mr(this,n).delay=+o.apply(this,arguments)}}function cx(n,o){return o=+o,function(){mr(this,n).delay=o}}function pp(n){var o=this._id;return arguments.length?this.each((typeof n=="function"?dx:cx)(o,n)):Vt(this.node(),o).delay}function ux(n,o){return function(){Gt(this,n).duration=+o.apply(this,arguments)}}function mx(n,o){return o=+o,function(){Gt(this,n).duration=o}}function gp(n){var o=this._id;return arguments.length?this.each((typeof n=="function"?ux:mx)(o,n)):Vt(this.node(),o).duration}function hx(n,o){if(typeof o!="function")throw new Error;return function(){Gt(this,n).ease=o}}function fp(n){var o=this._id;return arguments.length?this.each(hx(o,n)):Vt(this.node(),o).ease}function px(n,o){return function(){var e=o.apply(this,arguments);if(typeof e!="function")throw new Error;Gt(this,n).ease=e}}function vp(n){if(typeof n!="function")throw new Error;return this.each(px(this._id,n))}function bp(n){typeof n!="function"&&(n=er(n));for(var o=this._groups,e=o.length,t=new Array(e),i=0;i<e;++i)for(var a=o[i],r=a.length,s=t[i]=[],l,m=0;m<r;++m)(l=a[m])&&n.call(l,l.__data__,m,a)&&s.push(l);return new ti(t,this._parents,this._name,this._id)}function Ap(n){if(n._id!==this._id)throw new Error;for(var o=this._groups,e=n._groups,t=o.length,i=e.length,a=Math.min(t,i),r=new Array(t),s=0;s<a;++s)for(var l=o[s],m=e[s],g=l.length,v=r[s]=new Array(g),A,C=0;C<g;++C)(A=l[C]||m[C])&&(v[C]=A);for(;s<t;++s)r[s]=o[s];return new ti(r,this._parents,this._name,this._id)}function gx(n){return(n+"").trim().split(/^|\s+/).every(function(o){var e=o.indexOf(".");return e>=0&&(o=o.slice(0,e)),!o||o==="start"})}function fx(n,o,e){var t,i,a=gx(o)?mr:Gt;return function(){var r=a(this,n),s=r.on;s!==t&&(i=(t=s).copy()).on(o,e),r.on=i}}function yp(n,o){var e=this._id;return arguments.length<2?Vt(this.node(),e).on.on(n):this.each(fx(e,n,o))}function vx(n){return function(){var o=this.parentNode;for(var e in this.__transition)if(+e!==n)return;o&&o.removeChild(this)}}function xp(){return this.on("end.remove",vx(this._id))}function Cp(n){var o=this._name,e=this._id;typeof n!="function"&&(n=wa(n));for(var t=this._groups,i=t.length,a=new Array(i),r=0;r<i;++r)for(var s=t[r],l=s.length,m=a[r]=new Array(l),g,v,A=0;A<l;++A)(g=s[A])&&(v=n.call(g,g.__data__,A,s))&&("__data__"in g&&(v.__data__=g.__data__),m[A]=v,ea(m[A],o,e,A,m,Vt(g,e)));return new ti(a,this._parents,o,e)}function Sp(n){var o=this._name,e=this._id;typeof n!="function"&&(n=Jo(n));for(var t=this._groups,i=t.length,a=[],r=[],s=0;s<i;++s)for(var l=t[s],m=l.length,g,v=0;v<m;++v)if(g=l[v]){for(var A=n.call(g,g.__data__,v,l),C,_=Vt(g,e),M=0,B=A.length;M<B;++M)(C=A[M])&&ea(C,o,e,M,A,_);a.push(A),r.push(g)}return new ti(a,r,o,e)}var bx=_n.prototype.constructor;function wp(){return new bx(this._groups,this._parents)}function Ax(n,o){var e,t,i;return function(){var a=Kn(this,n),r=(this.style.removeProperty(n),Kn(this,n));return a===r?null:a===e&&r===t?i:i=o(e=a,t=r)}}function _p(n){return function(){this.style.removeProperty(n)}}function yx(n,o,e){var t,i=e+"",a;return function(){var r=Kn(this,n);return r===i?null:r===t?a:a=o(t=r,e)}}function xx(n,o,e){var t,i,a;return function(){var r=Kn(this,n),s=e(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(n),Kn(this,n))),r===l?null:r===t&&l===i?a:(i=l,a=o(t=r,s))}}function Cx(n,o){var e,t,i,a="style."+o,r="end."+a,s;return function(){var l=Gt(this,n),m=l.on,g=l.value[a]==null?s||(s=_p(o)):void 0;(m!==e||i!==g)&&(t=(e=m).copy()).on(r,i=g),l.on=t}}function Mp(n,o,e){var t=(n+="")=="transform"?ad:Zs;return o==null?this.styleTween(n,Ax(n,t)).on("end.style."+n,_p(n)):typeof o=="function"?this.styleTween(n,xx(n,t,Ao(this,"style."+n,o))).each(Cx(this._id,n)):this.styleTween(n,yx(n,t,o),e).on("end.style."+n,null)}function Sx(n,o,e){return function(t){this.style.setProperty(n,o.call(this,t),e)}}function wx(n,o,e){var t,i;function a(){var r=o.apply(this,arguments);return r!==i&&(t=(i=r)&&Sx(n,r,e)),t}return a._value=o,a}function kp(n,o,e){var t="style."+(n+="");if(arguments.length<2)return(t=this.tween(t))&&t._value;if(o==null)return this.tween(t,null);if(typeof o!="function")throw new Error;return this.tween(t,wx(n,o,e??""))}function _x(n){return function(){this.textContent=n}}function Mx(n){return function(){var o=n(this);this.textContent=o??""}}function Tp(n){return this.tween("text",typeof n=="function"?Mx(Ao(this,"text",n)):_x(n==null?"":n+""))}function kx(n){return function(o){this.textContent=n.call(this,o)}}function Tx(n){var o,e;function t(){var i=n.apply(this,arguments);return i!==e&&(o=(e=i)&&kx(i)),o}return t._value=n,t}function Dp(n){var o="text";if(arguments.length<1)return(o=this.tween(o))&&o._value;if(n==null)return this.tween(o,null);if(typeof n!="function")throw new Error;return this.tween(o,Tx(n))}function Ep(){for(var n=this._name,o=this._id,e=Xs(),t=this._groups,i=t.length,a=0;a<i;++a)for(var r=t[a],s=r.length,l,m=0;m<s;++m)if(l=r[m]){var g=Vt(l,o);ea(l,n,e,m,r,{time:g.time+g.delay+g.duration,delay:0,duration:g.duration,ease:g.ease})}return new ti(t,this._parents,n,e)}function Pp(){var n,o,e=this,t=e._id,i=e.size();return new Promise(function(a,r){var s={value:r},l={value:function(){--i===0&&a()}};e.each(function(){var m=Gt(this,t),g=m.on;g!==n&&(o=(n=g).copy(),o._.cancel.push(s),o._.interrupt.push(s),o._.end.push(l)),m.on=o}),i===0&&a()})}var Dx=0;function ti(n,o,e,t){this._groups=n,this._parents=o,this._name=e,this._id=t}function Ip(n){return _n().transition(n)}function Xs(){return++Dx}var Mn=_n.prototype;ti.prototype=Ip.prototype={constructor:ti,select:Cp,selectAll:Sp,selectChild:Mn.selectChild,selectChildren:Mn.selectChildren,filter:bp,merge:Ap,selection:wp,transition:Ep,call:Mn.call,nodes:Mn.nodes,node:Mn.node,size:Mn.size,empty:Mn.empty,each:Mn.each,on:yp,attr:mp,attrTween:hp,style:Mp,styleTween:kp,text:Tp,textTween:Dp,remove:xp,tween:up,delay:pp,duration:gp,ease:fp,easeVarying:vp,end:Pp,[Symbol.iterator]:Mn[Symbol.iterator]};function Qs(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var Ex={time:null,delay:0,duration:250,ease:Qs};function Px(n,o){for(var e;!(e=n.__transition)||!(e=e[o]);)if(!(n=n.parentNode))throw new Error(`transition ${o} not found`);return e}function Np(n){var o,e;n instanceof ti?(o=n._id,n=n._name):(o=Xs(),(e=Ex).time=cr(),n=n==null?null:n+"");for(var t=this._groups,i=t.length,a=0;a<i;++a)for(var r=t[a],s=r.length,l,m=0;m<s;++m)(l=r[m])&&ea(l,n,o,m,r,e||Px(l,o));return new ti(t,this._parents,n,o)}_n.prototype.interrupt=cp;_n.prototype.transition=Np;var{abs:D8,max:E8,min:P8}=Math;function Op(n){return[+n[0],+n[1]]}function Ix(n){return[Op(n[0]),Op(n[1])]}var I8={name:"x",handles:["w","e"].map(sd),input:function(n,o){return n==null?null:[[+n[0],o[0][1]],[+n[1],o[1][1]]]},output:function(n){return n&&[n[0][0],n[1][0]]}},N8={name:"y",handles:["n","s"].map(sd),input:function(n,o){return n==null?null:[[o[0][0],+n[0]],[o[1][0],+n[1]]]},output:function(n){return n&&[n[0][1],n[1][1]]}},O8={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(sd),input:function(n){return n==null?null:Ix(n)},output:function(n){return n}};function sd(n){return{type:n}}var ld=Math.PI,dd=2*ld,Ta=1e-6,Nx=dd-Ta;function Rp(n){this._+=n[0];for(let o=1,e=n.length;o<e;++o)this._+=arguments[o]+n[o]}function Ox(n){let o=Math.floor(n);if(!(o>=0))throw new Error(`invalid digits: ${n}`);if(o>15)return Rp;let e=10**o;return function(t){this._+=t[0];for(let i=1,a=t.length;i<a;++i)this._+=Math.round(arguments[i]*e)/e+t[i]}}var Da=class{constructor(o){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=o==null?Rp:Ox(o)}moveTo(o,e){this._append`M${this._x0=this._x1=+o},${this._y0=this._y1=+e}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(o,e){this._append`L${this._x1=+o},${this._y1=+e}`}quadraticCurveTo(o,e,t,i){this._append`Q${+o},${+e},${this._x1=+t},${this._y1=+i}`}bezierCurveTo(o,e,t,i,a,r){this._append`C${+o},${+e},${+t},${+i},${this._x1=+a},${this._y1=+r}`}arcTo(o,e,t,i,a){if(o=+o,e=+e,t=+t,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let r=this._x1,s=this._y1,l=t-o,m=i-e,g=r-o,v=s-e,A=g*g+v*v;if(this._x1===null)this._append`M${this._x1=o},${this._y1=e}`;else if(A>Ta)if(!(Math.abs(v*l-m*g)>Ta)||!a)this._append`L${this._x1=o},${this._y1=e}`;else{let C=t-r,_=i-s,M=l*l+m*m,B=C*C+_*_,D=Math.sqrt(M),V=Math.sqrt(A),F=a*Math.tan((ld-Math.acos((M+A-B)/(2*D*V)))/2),Y=F/V,j=F/D;Math.abs(Y-1)>Ta&&this._append`L${o+Y*g},${e+Y*v}`,this._append`A${a},${a},0,0,${+(v*C>g*_)},${this._x1=o+j*l},${this._y1=e+j*m}`}}arc(o,e,t,i,a,r){if(o=+o,e=+e,t=+t,r=!!r,t<0)throw new Error(`negative radius: ${t}`);let s=t*Math.cos(i),l=t*Math.sin(i),m=o+s,g=e+l,v=1^r,A=r?i-a:a-i;this._x1===null?this._append`M${m},${g}`:(Math.abs(this._x1-m)>Ta||Math.abs(this._y1-g)>Ta)&&this._append`L${m},${g}`,t&&(A<0&&(A=A%dd+dd),A>Nx?this._append`A${t},${t},0,1,${v},${o-s},${e-l}A${t},${t},0,1,${v},${this._x1=m},${this._y1=g}`:A>Ta&&this._append`A${t},${t},0,${+(A>=ld)},${v},${this._x1=o+t*Math.cos(a)},${this._y1=e+t*Math.sin(a)}`)}rect(o,e,t,i){this._append`M${this._x0=this._x1=+o},${this._y0=this._y1=+e}h${t=+t}v${+i}h${-t}Z`}toString(){return this._}};function Vp(){return new Da}Vp.prototype=Da.prototype;function kn(n){return function(){return n}}var cd=Math.abs,Bt=Math.atan2,ta=Math.cos,Lp=Math.max,Ks=Math.min,$i=Math.sin,Ea=Math.sqrt,ii=1e-12,yo=Math.PI,hr=yo/2,Wp=2*yo;function Fp(n){return n>1?0:n<-1?yo:Math.acos(n)}function ud(n){return n>=1?hr:n<=-1?-hr:Math.asin(n)}function Gp(n){let o=3;return n.digits=function(e){if(!arguments.length)return o;if(e==null)o=null;else{let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);o=t}return n},()=>new Da(o)}function Rx(n){return n.innerRadius}function Vx(n){return n.outerRadius}function Lx(n){return n.startAngle}function Wx(n){return n.endAngle}function Fx(n){return n&&n.padAngle}function Gx(n,o,e,t,i,a,r,s){var l=e-n,m=t-o,g=r-i,v=s-a,A=v*l-g*m;if(!(A*A<ii))return A=(g*(o-a)-v*(n-i))/A,[n+A*l,o+A*m]}function Js(n,o,e,t,i,a,r){var s=n-e,l=o-t,m=(r?a:-a)/Ea(s*s+l*l),g=m*l,v=-m*s,A=n+g,C=o+v,_=e+g,M=t+v,B=(A+_)/2,D=(C+M)/2,V=_-A,F=M-C,Y=V*V+F*F,j=i-a,Ce=A*M-_*C,me=(F<0?-1:1)*Ea(Lp(0,j*j*Y-Ce*Ce)),ae=(Ce*F-V*me)/Y,se=(-Ce*V-F*me)/Y,ce=(Ce*F+V*me)/Y,oe=(-Ce*V+F*me)/Y,de=ae-B,le=se-D,be=ce-B,Ue=oe-D;return de*de+le*le>be*be+Ue*Ue&&(ae=ce,se=oe),{cx:ae,cy:se,x01:-g,y01:-v,x11:ae*(i/j-1),y11:se*(i/j-1)}}function md(){var n=Rx,o=Vx,e=kn(0),t=null,i=Lx,a=Wx,r=Fx,s=null,l=Gp(m);function m(){var g,v,A=+n.apply(this,arguments),C=+o.apply(this,arguments),_=i.apply(this,arguments)-hr,M=a.apply(this,arguments)-hr,B=cd(M-_),D=M>_;if(s||(s=g=l()),C<A&&(v=C,C=A,A=v),!(C>ii))s.moveTo(0,0);else if(B>Wp-ii)s.moveTo(C*ta(_),C*$i(_)),s.arc(0,0,C,_,M,!D),A>ii&&(s.moveTo(A*ta(M),A*$i(M)),s.arc(0,0,A,M,_,D));else{var V=_,F=M,Y=_,j=M,Ce=B,me=B,ae=r.apply(this,arguments)/2,se=ae>ii&&(t?+t.apply(this,arguments):Ea(A*A+C*C)),ce=Ks(cd(C-A)/2,+e.apply(this,arguments)),oe=ce,de=ce,le,be;if(se>ii){var Ue=ud(se/A*$i(ae)),st=ud(se/C*$i(ae));(Ce-=Ue*2)>ii?(Ue*=D?1:-1,Y+=Ue,j-=Ue):(Ce=0,Y=j=(_+M)/2),(me-=st*2)>ii?(st*=D?1:-1,V+=st,F-=st):(me=0,V=F=(_+M)/2)}var Dt=C*ta(V),Qt=C*$i(V),pi=A*ta(j),la=A*$i(j);if(ce>ii){var La=C*ta(F),da=C*$i(F),Wa=A*ta(Y),To=A*$i(Y),Ri;if(B<yo)if(Ri=Gx(Dt,Qt,Wa,To,La,da,pi,la)){var Do=Dt-Ri[0],Eo=Qt-Ri[1],Fa=La-Ri[0],Po=da-Ri[1],Io=1/$i(Fp((Do*Fa+Eo*Po)/(Ea(Do*Do+Eo*Eo)*Ea(Fa*Fa+Po*Po)))/2),br=Ea(Ri[0]*Ri[0]+Ri[1]*Ri[1]);oe=Ks(ce,(A-br)/(Io-1)),de=Ks(ce,(C-br)/(Io+1))}else oe=de=0}me>ii?de>ii?(le=Js(Wa,To,Dt,Qt,C,de,D),be=Js(La,da,pi,la,C,de,D),s.moveTo(le.cx+le.x01,le.cy+le.y01),de<ce?s.arc(le.cx,le.cy,de,Bt(le.y01,le.x01),Bt(be.y01,be.x01),!D):(s.arc(le.cx,le.cy,de,Bt(le.y01,le.x01),Bt(le.y11,le.x11),!D),s.arc(0,0,C,Bt(le.cy+le.y11,le.cx+le.x11),Bt(be.cy+be.y11,be.cx+be.x11),!D),s.arc(be.cx,be.cy,de,Bt(be.y11,be.x11),Bt(be.y01,be.x01),!D))):(s.moveTo(Dt,Qt),s.arc(0,0,C,V,F,!D)):s.moveTo(Dt,Qt),!(A>ii)||!(Ce>ii)?s.lineTo(pi,la):oe>ii?(le=Js(pi,la,La,da,A,-oe,D),be=Js(Dt,Qt,Wa,To,A,-oe,D),s.lineTo(le.cx+le.x01,le.cy+le.y01),oe<ce?s.arc(le.cx,le.cy,oe,Bt(le.y01,le.x01),Bt(be.y01,be.x01),!D):(s.arc(le.cx,le.cy,oe,Bt(le.y01,le.x01),Bt(le.y11,le.x11),!D),s.arc(0,0,A,Bt(le.cy+le.y11,le.cx+le.x11),Bt(be.cy+be.y11,be.cx+be.x11),D),s.arc(be.cx,be.cy,oe,Bt(be.y11,be.x11),Bt(be.y01,be.x01),!D))):s.arc(0,0,A,j,Y,D)}if(s.closePath(),g)return s=null,g+""||null}return m.centroid=function(){var g=(+n.apply(this,arguments)+ +o.apply(this,arguments))/2,v=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-yo/2;return[ta(v)*g,$i(v)*g]},m.innerRadius=function(g){return arguments.length?(n=typeof g=="function"?g:kn(+g),m):n},m.outerRadius=function(g){return arguments.length?(o=typeof g=="function"?g:kn(+g),m):o},m.cornerRadius=function(g){return arguments.length?(e=typeof g=="function"?g:kn(+g),m):e},m.padRadius=function(g){return arguments.length?(t=g==null?null:typeof g=="function"?g:kn(+g),m):t},m.startAngle=function(g){return arguments.length?(i=typeof g=="function"?g:kn(+g),m):i},m.endAngle=function(g){return arguments.length?(a=typeof g=="function"?g:kn(+g),m):a},m.padAngle=function(g){return arguments.length?(r=typeof g=="function"?g:kn(+g),m):r},m.context=function(g){return arguments.length?(s=g??null,m):s},m}function ia(n,o,e){this.k=n,this.x=o,this.y=e}ia.prototype={constructor:ia,scale:function(n){return n===1?this:new ia(this.k*n,this.x,this.y)},translate:function(n,o){return n===0&o===0?this:new ia(this.k,this.x+this.k*n,this.y+this.k*o)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var hd=new ia(1,0,0);pd.prototype=ia.prototype;function pd(n){for(;!n.__zoom;)if(!(n=n.parentNode))return hd;return n.__zoom}var pr=!1,Bx=250,zx=["atons.urn:mrn:imo:mmsi:*","shore.basestations.urn:mrn:imo:mmsi:*","vessels.urn:mrn:imo:mmsi:*","sar.urn:mrn:imo:mmsi:*"],Ux=[{prefix:"atons.urn:mrn:imo:mmsi:",type:"aton"},{prefix:"shore.basestations.urn:mrn:imo:mmsi:",type:"basestation"},{prefix:"vessels.urn:mrn:imo:mmsi:",type:"vessel"},{prefix:"sar.urn:mrn:imo:mmsi:",type:"sar"}],Hx="self.navigation.*",Bp=(()=>{class n{data=y(Ot);destroyRef=y(ze);tracks=new Map;contextIndex=new Map;mmsiIndex=new Map;targetsDirty$=new zt;_targets=w([]);_ownShip=w({});_hasCollisionRiskData=w(!1);targets=this._targets.asReadonly();ownShip=this._ownShip.asReadonly();hasCollisionRiskData=this._hasCollisionRiskData.asReadonly();getBearingTrue(e,t){if(typeof e.latitude!="number"||typeof e.longitude!="number"||typeof t.latitude!="number"||typeof t.longitude!="number")return null;let i=e.latitude*Math.PI/180,a=t.latitude*Math.PI/180,r=(t.longitude-e.longitude)*Math.PI/180,s=Math.sin(r)*Math.cos(a),l=Math.cos(i)*Math.sin(a)-Math.sin(i)*Math.cos(a)*Math.cos(r),m=Math.atan2(s,l)*180/Math.PI;return this.wrapDegrees(m)}constructor(){bi(...zx.map(t=>this.data.subscribePathTree(t))).pipe(Le(this.destroyRef)).subscribe(t=>this.handleAisTreeUpdate(t)),this.data.subscribePathTree(Hx).pipe(Le(this.destroyRef)).subscribe(t=>this.handleOwnShipTreeUpdate(t)),this.targetsDirty$.pipe(cc(Bx,void 0,{leading:!0,trailing:!0}),Le(this.destroyRef)).subscribe(()=>this.flushTargetsSignal())}handleAisTreeUpdate(e){let t=this.matchAisContext(e.path);t&&(pr&&console.debug("[AIS] update",{context:t.context,path:t.path,type:t.type,value:e.update.data.value}),this.applyAisUpdate({context:t.context,type:t.type,path:t.path,value:e.update.data.value,timestampMs:this.toTimestampMs(e.update.data.timestamp)}))}handleOwnShipTreeUpdate(e){if(!e.path.startsWith("self."))return;let t=e.path.slice(5);this.applyOwnShipUpdate(t,e.update.data.value)}matchAisContext(e){for(let t of Ux){if(!e.startsWith(t.prefix))continue;let i=e.indexOf(".",t.prefix.length);return i===-1?null:{context:e.slice(0,i),path:e.slice(i+1),type:t.type}}return null}applyOwnShipUpdate(e,t){let i=ne({},this._ownShip()),a=this.readPositionValue(t);switch(e){case"navigation.position":a&&(i.position=a);break;case"navigation.position.latitude":{let r=this.toNumberOrUndefined(t);if(r===void 0)return;i.position=ge(ne({},i.position??{}),{latitude:r})}break;case"navigation.position.longitude":{let r=this.toNumberOrUndefined(t);if(r===void 0)return;i.position=ge(ne({},i.position??{}),{longitude:r})}break;case"navigation.headingTrue":i.headingTrue=this.toNumberOrUndefined(t);break;case"navigation.courseOverGroundTrue":i.courseOverGroundTrue=this.toNumberOrUndefined(t);break;case"navigation.speedOverGround":i.speedOverGround=this.toNumberOrUndefined(t);break;default:return}this._ownShip.set(i)}applyAisUpdate(e){let t=this.resolveTrack(e);if(!t)return;t.lastUpdateAt=e.timestampMs,e.path.startsWith("navigation.closestApproach.")&&this.isVesselLike(t)&&!t.closestApproach&&(t.closestApproach={});let i=!1;({mmsi:()=>this.applyMmsi(t,e.value),name:()=>{t.name=this.toStringOrUndefined(e.value)},"communication.callsignVhf":()=>{this.isVesselLike(t)&&(t.callsign=this.toStringOrUndefined(e.value))},"navigation.destination":()=>{this.isVesselLike(t)&&(t.destination=this.toStringOrUndefined(e.value))},"navigation.destination.commonName":()=>{this.isVesselLike(t)&&(t.destination=this.toStringOrUndefined(e.value))},"navigation.destination.eta":()=>{this.isVesselLike(t)&&(t.eta=this.toStringOrUndefined(e.value))},"design.beam":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{beam:this.toNumberOrUndefined(e.value)}))},"design.length.overall":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{length:ge(ne({},t.design?.length??{}),{overall:this.toNumberOrUndefined(e.value)})}))},"design.length.hull":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{length:ge(ne({},t.design?.length??{}),{hull:this.toNumberOrUndefined(e.value)})}))},"design.length.waterline":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{length:ge(ne({},t.design?.length??{}),{waterline:this.toNumberOrUndefined(e.value)})}))},"design.draft.maximum":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{draft:ge(ne({},t.design?.draft??{}),{maximum:this.toNumberOrUndefined(e.value)})}))},"design.draft.minimum":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{draft:ge(ne({},t.design?.draft??{}),{minimum:this.toNumberOrUndefined(e.value)})}))},"design.draft.current":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{draft:ge(ne({},t.design?.draft??{}),{current:this.toNumberOrUndefined(e.value)})}))},"design.draft.canoe":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{draft:ge(ne({},t.design?.draft??{}),{canoe:this.toNumberOrUndefined(e.value)})}))},"registrations.imo":()=>{this.isVesselLike(t)&&(t.imo=this.toStringOrUndefined(e.value))},"navigation.courseOverGroundTrue":()=>{this.isVesselLike(t)&&(t.courseOverGroundTrue=this.toNumberOrUndefined(e.value))},"navigation.headingTrue":()=>{this.isVesselLike(t)&&(t.headingTrue=this.toNumberOrUndefined(e.value))},"navigation.rateOfTurn":()=>{this.isVesselLike(t)&&(t.rateOfTurn=this.toNumberOrUndefined(e.value))},"navigation.specialManeuver":()=>{this.isVesselLike(t)&&(t.specialManeuver=this.toStringOrUndefined(e.value))},"navigation.speedOverGround":()=>{this.isVesselLike(t)&&(t.speedOverGround=this.toNumberOrUndefined(e.value))},"navigation.state":()=>{this.isVesselLike(t)&&(t.navState=this.toStringOrUndefined(e.value))},"sensors.ais.class":()=>{t.ais.class=this.normalizeAisClass(e.value)},"sensors.ais.status":()=>{let r=this.normalizeAisStatus(e.value);if(r){if(r==="remove"){this.removeTrack(t),i=!0;return}t.ais.status=r}},"sensors.ais.fromBow":()=>{this.isVesselLike(t)&&(t.fromBow=this.toNumberOrUndefined(e.value))},"sensors.ais.fromCenter":()=>{this.isVesselLike(t)&&(t.fromCenter=this.toNumberOrUndefined(e.value))},"navigation.position.latitude":()=>{let r=this.toNumberOrUndefined(e.value);r!==void 0&&(t.position=ge(ne({},t.position??{}),{latitude:r}),t.lastPositionAt=e.timestampMs)},"navigation.position.longitude":()=>{let r=this.toNumberOrUndefined(e.value);r!==void 0&&(t.position=ge(ne({},t.position??{}),{longitude:r}),t.lastPositionAt=e.timestampMs)},"navigation.position.altitude":()=>{let r=this.toNumberOrUndefined(e.value);t.position&&(t.position=ge(ne({},t.position),{altitude:r}))},"navigation.position":()=>{let r=this.readPositionValue(e.value);r&&(t.position=r,t.lastPositionAt=e.timestampMs)},"atonType.id":()=>{this.isAton(t)&&(t.typeId=this.toNumberOrUndefined(e.value))},"atonType.name":()=>{this.isAton(t)&&(t.typeName=this.toStringOrUndefined(e.value))},virtual:()=>{this.isAton(t)&&(t.virtual=!!e.value)},offPosition:()=>{this.isAton(t)&&(t.offPosition=!!e.value)},"design.aisShipType.id":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{aisShipType:ge(ne({},t.design?.aisShipType??{}),{id:this.toNumberOrUndefined(e.value)})}))},"design.aisShipType.name":()=>{this.isVesselLike(t)&&(t.design=ge(ne({},t.design??{}),{aisShipType:ge(ne({},t.design?.aisShipType??{}),{name:this.toStringOrUndefined(e.value)})}))},"navigation.closestApproach.distance":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.distance=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.timeTo":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.timeTo=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.range":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.range=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.bearing":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.bearing=this.toNumberOrUndefined(e.value))},"navigation.closestApproach.collisionRiskRating":()=>{this.isVesselLike(t)&&t.closestApproach&&(t.closestApproach.collisionRiskRating=this.toNumberOrUndefined(e.value))}})[e.path]?.(),!i&&this.updateTargetsSignal()}resolveTrack(e){let t=this.contextIndex.get(e.context),i=e.timestampMs,a=t?this.tracks.get(t):null;if(a)return a;let r=this.createTrack(e.context,e.type,i,void 0);return this.contextIndex.set(e.context,r.id),r}createTrack(e,t,i,a){let r=this.buildTrackId(a??e),s=this.buildBaseTarget(e,t,i,a,r),l;switch(t){case"vessel":l=ge(ne({},s),{type:"vessel",closestApproach:{}});break;case"sar":l=ge(ne({},s),{type:"sar",closestApproach:{}});break;case"aton":l=ge(ne({},s),{type:"aton"});break;default:l=ge(ne({},s),{type:"basestation"});break}return this.tracks.set(l.id,l),a&&this.addMmsiIndex(a,l.id),this.updateTargetsSignal(),l}buildTrackId(e){if(!this.tracks.has(e))return e;let t=1;for(;this.tracks.has(`${e}-${t}`);)t+=1;return`${e}-${t}`}applyMmsi(e,t){let i=this.toStringOrUndefined(t);if(!i)return;let a=this.getTracksByMmsi(i).filter(r=>r.id!==e.id);a.length&&(this.markConflict(i),pr&&console.error("[AIS] MMSI conflict",{mmsi:i,contexts:[e.context,...a.map(r=>r.context)]})),e.mmsi&&e.mmsi!==i&&this.removeMmsiIndex(e.mmsi,e.id),e.mmsi=i,this.addMmsiIndex(i,e.id)}removeTrack(e){this.tracks.delete(e.id),e.mmsi&&this.removeMmsiIndex(e.mmsi,e.id);for(let[t,i]of this.contextIndex.entries())i===e.id&&this.contextIndex.delete(t);pr&&console.debug("[AIS] removed",{id:e.id,mmsi:e.mmsi,status:e.ais.status}),this.updateTargetsSignal()}updateTargetsSignal(){this.targetsDirty$.next()}flushTargetsSignal(){let e=Array.from(this.tracks.values()).filter(i=>!!i.mmsi||!!i.position),t=e.some(i=>{if(!this.isVesselLike(i))return!1;let a=i.closestApproach??{};return Object.prototype.hasOwnProperty.call(a,"collisionRiskRating")});this._targets.set(e),this._hasCollisionRiskData.set(t),pr&&console.debug("[AIS] flush",{count:this.tracks.size})}getTracksByMmsi(e){let t=this.mmsiIndex.get(e);return t?Array.from(t).map(i=>this.tracks.get(i)).filter(i=>!!i):[]}addMmsiIndex(e,t){this.mmsiIndex.has(e)||this.mmsiIndex.set(e,new Set),this.mmsiIndex.get(e).add(t)}removeMmsiIndex(e,t){let i=this.mmsiIndex.get(e);i&&(i.delete(t),i.size||this.mmsiIndex.delete(e))}markConflict(e){let t=this.getTracksByMmsi(e);for(let i of t)i.conflicted=!0}normalizeAisClass(e){let t=typeof e=="string"?e.toUpperCase():"";if(t==="A")return"A";if(t==="B")return"B"}normalizeAisStatus(e){if(e==null)return;let t=String(e).toLowerCase();if(t==="unconfirmed"||t==="confirmed"||t==="lost"||t==="remove")return t}toTimestampMs(e){if(!e)return Date.now();let t=e instanceof Date?e.getTime():Date.parse(e);return Number.isFinite(t)?t:Date.now()}toNumberOrUndefined(e){let t=Number(e);return Number.isFinite(t)?t:void 0}toStringOrUndefined(e){if(e==null)return;let t=String(e).trim();return t.length?t:void 0}wrapDegrees(e){let t=e%360;return t<0?t+360:t}buildBaseTarget(e,t,i,a,r){return{id:r,context:e,type:t,ais:{class:void 0,status:"unconfirmed"},conflicted:!1,mmsi:a,position:void 0,lastUpdateAt:i,lastPositionAt:void 0}}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}readPositionValue(e){if(!e||typeof e!="object")return;let t=this.toNumberOrUndefined(e.latitude),i=this.toNumberOrUndefined(e.longitude);if(t===void 0||i===void 0)return;let a=this.toNumberOrUndefined(e.altitude);return{latitude:t,longitude:i,altitude:a}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function qx(n,o){if(n&1&&(d(0,"div",3)(1,"span",13),c(2),u()()),n&2){k();let e=yn(0),t=yn(1);f(2),Ut("",t," ",e)}}function $x(n,o){if(n&1&&(d(0,"div",4)(1,"span",7),c(2,"State"),u(),d(3,"span",10),c(4),ct(5,"titlecase"),u()()),n&2){let e=k(4);f(4),Ut("",Et(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`)}}function jx(n,o){n&1&&(d(0,"div",5),W(1,"mat-divider"),u())}function Yx(n,o){if(n&1&&(d(0,"div",6)(1,"span",7),c(2,"Bearing"),u(),d(3,"span",8),c(4),u()(),d(5,"div",6)(6,"span",7),c(7,"Range"),u(),d(8,"span",8),c(9),u()(),d(10,"div",6)(11,"span",7),c(12,"CPA"),u(),d(13,"span",8),c(14),u()(),d(15,"div",6)(16,"span",7),c(17,"TCPA"),u(),d(18,"span",8),c(19),u()(),d(20,"div",3),W(21,"mat-divider"),u()),n&2){let e=k(4);f(4),K(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),f(5),K(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),f(5),K(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),f(5),K(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo))}}function Zx(n,o){if(n&1&&(d(0,"div",3)(1,"span",7),c(2,"ETA"),u(),d(3,"span",8),c(4),u()()),n&2){let e=k(4);f(4),K(e.formatText(e.target.eta))}}function Xx(n,o){if(n&1&&(ga(0)(1),I(2,qx,3,2,"div",3),I(3,$x,6,4,"div",4),I(4,jx,2,0,"div",5),I(5,Yx,22,4),d(6,"div",6)(7,"span",7),c(8,"COG"),u(),d(9,"span",8),c(10),d(11,"span",9),c(12,"T"),u()()(),d(13,"div",6)(14,"span",7),c(15,"SOG"),u(),d(16,"span",8),c(17),ct(18,"number"),u()(),d(19,"div",6)(20,"span",7),c(21,"HDG"),u(),d(22,"span",8),c(23),d(24,"span",9),c(25,"T"),u()()(),d(26,"div",6)(27,"span",7),c(28,"ROT"),u(),d(29,"span",8),c(30),u()(),d(31,"div",3),W(32,"mat-divider"),u(),d(33,"div",6)(34,"span",7),c(35,"IMO"),u(),d(36,"span",8),c(37),u()(),d(38,"div",6)(39,"span",7),c(40,"MMSI"),u(),d(41,"span",8),c(42),u()(),d(43,"div",6)(44,"span",7),c(45,"VHF Callsign"),u(),d(46,"span",8),c(47),u()(),d(48,"div",6)(49,"span",7),c(50,"AIS Class"),u(),d(51,"span",8),c(52),u()(),d(53,"div",4)(54,"span",7),c(55,"Destination"),u(),d(56,"span",10),c(57),u()(),I(58,Zx,5,1,"div",3),d(59,"div",3),W(60,"mat-divider"),u(),d(61,"div",6)(62,"span",7),c(63,"Latitude"),u(),d(64,"span",8),c(65),u()(),d(66,"div",6)(67,"span",7),c(68,"Longitude"),u(),d(69,"span",8),c(70),u()(),d(71,"div",11)(72,"span",12),c(73),u()()),n&2){let e=k(3),t=An(!(e.target.design==null||e.target.design.aisShipType==null)&&e.target.design.aisShipType.name?`${e.target.design.aisShipType.name}`:""),i=!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall?`${e.target.design.length.overall}m`:"?m",a=e.target.design!=null&&e.target.design.beam?`${e.target.design.beam}m`:"?m";f(),An(i&&a?`${i} x ${a}`:""),f(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t?2:-1),f(),N(e.target.navState||e.target.specialManeuver?3:-1),f(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t||e.target.navState||e.target.specialManeuver?4:-1),f(),N(e.hasClosestApproach(e.target.closestApproach)?5:-1),f(5),fe("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),f(7),fe("",xn(18,19,e.target.speedOverGround,"1.1-1")," kn"),f(6),fe("",e.formatDirection(e.target.headingTrue),"\xB0 "),f(7),K(e.formatRateOfTurn(e.target.rateOfTurn)),f(7),K(e.formatText(e.target.imo)),f(5),K(e.formatText(e.target.mmsi)),f(5),K(e.formatText(e.target.callsign)),f(5),K(e.formatText(e.target.ais.class)),f(5),K(e.formatText(e.target.destination)),f(),N(e.target.eta?58:-1),f(7),K(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),f(5),K(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),f(3),fe("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function Qx(n,o){if(n&1&&I(0,Xx,74,22),n&2){let e=k(2);N(e.isVesselLike(e.target)?0:-1)}}function Kx(n,o){if(n&1&&(d(0,"div",3)(1,"span",13),c(2),u()()),n&2){k();let e=yn(0),t=yn(1);f(2),Ut("",t," ",e)}}function Jx(n,o){if(n&1&&(d(0,"div",4)(1,"span",7),c(2,"State"),u(),d(3,"span",10),c(4),ct(5,"titlecase"),u()()),n&2){let e=k(4);f(4),Ut("",Et(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`)}}function eC(n,o){n&1&&(d(0,"div",5),W(1,"mat-divider"),u())}function tC(n,o){if(n&1&&(d(0,"div",6)(1,"span",7),c(2,"Bearing"),u(),d(3,"span",8),c(4),u()(),d(5,"div",6)(6,"span",7),c(7,"Range"),u(),d(8,"span",8),c(9),u()(),d(10,"div",6)(11,"span",7),c(12,"CPA"),u(),d(13,"span",8),c(14),u()(),d(15,"div",6)(16,"span",7),c(17,"TCPA"),u(),d(18,"span",8),c(19),u()(),d(20,"div",3),W(21,"mat-divider"),u()),n&2){let e=k(4);f(4),K(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),f(5),K(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),f(5),K(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),f(5),K(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo))}}function iC(n,o){if(n&1&&(d(0,"div",3)(1,"span",7),c(2,"ETA"),u(),d(3,"span",8),c(4),u()()),n&2){let e=k(4);f(4),K(e.formatText(e.target.eta))}}function nC(n,o){if(n&1&&(ga(0)(1),I(2,Kx,3,2,"div",3),I(3,Jx,6,4,"div",4),I(4,eC,2,0,"div",5),I(5,tC,22,4),d(6,"div",6)(7,"span",7),c(8,"COG"),u(),d(9,"span",8),c(10),d(11,"span",9),c(12,"T"),u()()(),d(13,"div",6)(14,"span",7),c(15,"SOG"),u(),d(16,"span",8),c(17),ct(18,"number"),u()(),d(19,"div",6)(20,"span",7),c(21,"HDG"),u(),d(22,"span",8),c(23),d(24,"span",9),c(25,"T"),u()()(),d(26,"div",6)(27,"span",7),c(28,"ROT"),u(),d(29,"span",8),c(30),u()(),d(31,"div",3),W(32,"mat-divider"),u(),d(33,"div",6)(34,"span",7),c(35,"IMO"),u(),d(36,"span",8),c(37),u()(),d(38,"div",6)(39,"span",7),c(40,"MMSI"),u(),d(41,"span",8),c(42),u()(),d(43,"div",6)(44,"span",7),c(45,"VHF Callsign"),u(),d(46,"span",8),c(47),u()(),d(48,"div",6)(49,"span",7),c(50,"AIS Class"),u(),d(51,"span",8),c(52),u()(),d(53,"div",4)(54,"span",7),c(55,"Destination"),u(),d(56,"span",10),c(57),u()(),I(58,iC,5,1,"div",3),d(59,"div",3),W(60,"mat-divider"),u(),d(61,"div",6)(62,"span",7),c(63,"Latitude"),u(),d(64,"span",8),c(65),u()(),d(66,"div",6)(67,"span",7),c(68,"Longitude"),u(),d(69,"span",8),c(70),u()(),d(71,"div",11)(72,"span",12),c(73),u()()),n&2){let e=k(3),t=An(!(e.target.design==null||e.target.design.aisShipType==null)&&e.target.design.aisShipType.name?`${e.target.design.aisShipType.name}`:""),i=!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall?`${e.target.design.length.overall}m`:"?m",a=e.target.design!=null&&e.target.design.beam?`${e.target.design.beam}m`:"?m";f(),An(i&&a?`${i} x ${a}`:""),f(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t?2:-1),f(),N(e.target.navState||e.target.specialManeuver?3:-1),f(),N(!(e.target.design==null||e.target.design.length==null)&&e.target.design.length.overall||e.target.design!=null&&e.target.design.beam||t||e.target.navState||e.target.specialManeuver?4:-1),f(),N(e.hasClosestApproach(e.target.closestApproach)?5:-1),f(5),fe("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),f(7),fe("",xn(18,19,e.target.speedOverGround,"1.1-1")," kn"),f(6),fe("",e.formatDirection(e.target.headingTrue),"\xB0 "),f(7),K(e.formatRateOfTurn(e.target.rateOfTurn)),f(7),K(e.formatText(e.target.imo)),f(5),K(e.formatText(e.target.mmsi)),f(5),K(e.formatText(e.target.callsign)),f(5),K(e.formatText(e.target.ais.class)),f(5),K(e.formatText(e.target.destination)),f(),N(e.target.eta?58:-1),f(7),K(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),f(5),K(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),f(3),fe("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function aC(n,o){if(n&1&&I(0,nC,74,22),n&2){let e=k(2);N(e.isVesselLike(e.target)?0:-1)}}function oC(n,o){if(n&1&&(d(0,"div",3)(1,"span",13),c(2),u()(),d(3,"div",4)(4,"span",7),c(5,"Off Position"),u(),d(6,"span",8),c(7),u()(),d(8,"div",6)(9,"span",7),c(10,"Type"),u(),d(11,"span",8),c(12,"Aid to Navigation"),u()(),d(13,"div",6)(14,"span",7),c(15,"Type ID"),u(),d(16,"span",8),c(17),u()(),d(18,"div",3),W(19,"mat-divider"),u(),d(20,"div",6)(21,"span",7),c(22,"MMSI"),u(),d(23,"span",8),c(24),u()(),d(25,"div",6)(26,"span",7),c(27,"Status"),u(),d(28,"span",8),c(29),ct(30,"titlecase"),u()(),d(31,"div",3),W(32,"mat-divider"),u(),d(33,"div",6)(34,"span",7),c(35,"Latitude"),u(),d(36,"span",8),c(37),u()(),d(38,"div",6)(39,"span",7),c(40,"Longitude"),u(),d(41,"span",8),c(42),u()(),d(43,"div",11)(44,"span",12),c(45),u()()),n&2){let e=k(3);f(2),K(e.formatText(e.target.name)),f(5),K(e.target.offPosition?"Yes":"No"),f(10),K(e.formatText(e.target.typeId==null?null:e.target.typeId.toString())),f(7),K(e.formatText(e.target.mmsi)),f(5),K(Et(30,8,e.target.ais.status)),f(8),K(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),f(5),K(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),f(3),fe("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function rC(n,o){if(n&1&&I(0,oC,46,10),n&2){let e=k(2);N(e.isAton(e.target)?0:-1)}}function sC(n,o){if(n&1&&(d(0,"div",6)(1,"span",7),c(2,"Name"),u(),d(3,"span",8),c(4),u()(),d(5,"div",6)(6,"span",7),c(7,"MMSI"),u(),d(8,"span",8),c(9),u()(),d(10,"div",6)(11,"span",7),c(12,"Status"),u(),d(13,"span",8),c(14),ct(15,"titlecase"),u()(),d(16,"div",6)(17,"span",7),c(18,"AIS Class"),u(),d(19,"span",8),c(20),u()(),d(21,"div",3),W(22,"mat-divider"),u(),d(23,"div",6)(24,"span",7),c(25,"Latitude"),u(),d(26,"span",8),c(27),u()(),d(28,"div",6)(29,"span",7),c(30,"Longitude"),u(),d(31,"span",8),c(32),u()(),d(33,"div",11)(34,"span",12),c(35),u()()),n&2){let e=k(3);f(4),K(e.formatText(e.target.name)),f(5),K(e.formatText(e.target.mmsi)),f(5),K(Et(15,7,e.target.ais.status)),f(6),K(e.formatText(e.target.ais.class)),f(7),K(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),f(5),K(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),f(3),fe("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function lC(n,o){if(n&1&&I(0,sC,36,9),n&2){let e=k(2);N(e.isBasestation(e.target)?0:-1)}}function dC(n,o){if(n&1&&(d(0,"div",0)(1,"div",2),I(2,Qx,1,1)(3,aC,1,1)(4,rC,1,1)(5,lC,1,1),u()()),n&2){let e,t=k();f(2),N((e=t.target.type)==="vessel"?2:e==="sar"?3:e==="aton"?4:e==="basestation"?5:-1)}}function cC(n,o){n&1&&(d(0,"div",1),c(1,"No AIS target selected."),u())}var el=(()=>{class n{static CLOCK_INTERVAL_MS=1e3;data=y(ri);units=y(it);ngZone=y(qe);now=w(Date.now());nowTimer=null;constructor(){this.startClock()}get payload(){return this.data?.payload??null}get target(){return this.payload?.target??null}formatDirection(e){return e==null||!Number.isFinite(e)?"--":this.units.convertToUnit("deg",e).toFixed(0)}formatNauticalMilesWithUnit(e){return e==null||!Number.isFinite(e)?"--":`${this.units.convertToUnit("nm",e).toFixed(1)} nm`}formatAngleWithUnit(e){return e==null||!Number.isFinite(e)?"--":`${e.toFixed(0)}\xB0`}formatRemainingTime(e){if(e==null||!Number.isFinite(e))return"--";let t=Math.max(0,Math.round(e)),i=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return i>0?`${i}:${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${a}:${String(r).padStart(2,"0")}`}formatSinceTimestamp(e){if(e==null||!Number.isFinite(e))return"--";let t=Math.max(0,Math.floor((this.now()-e)/1e3)),i=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return i>0?`${i}:${String(a).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${a}:${String(r).padStart(2,"0")}`}formatRateOfTurn(e){if(e==null||!Number.isFinite(e))return"--";let t=e>=0?"Stb":"Port",i=Math.abs(e)*(180/Math.PI)*60;return`${t} ${i.toFixed(0)}\xB0/min`}formatLatLon(e,t){return e==null||!Number.isFinite(e)?"--":this.units.convertToUnit(t,e).toString()}formatText(e){return e&&e.length?e:"--"}hasClosestApproach(e){return e?typeof e.bearing=="number"||typeof e.range=="number"||typeof e.distance=="number"||typeof e.timeTo=="number":!1}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}isBasestation(e){return e.type==="basestation"}startClock(){this.ngZone.runOutsideAngular(()=>{this.nowTimer=window.setInterval(()=>{this.ngZone.run(()=>{this.now.set(Date.now())})},n.CLOCK_INTERVAL_MS)})}ngOnDestroy(){this.nowTimer!==null&&(clearInterval(this.nowTimer),this.nowTimer=null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["dialog-ais-target"]],decls:2,vars:1,consts:[[1,"ais-dialog","mat-typography"],[1,"ais-dialog-empty"],[1,"ais-dialog-grid"],[1,"ais-dialog-item","ais-dialog-item-span"],[1,"ais-dialog-long-item","ais-dialog-item-span"],[1,"ais-dialog-item","ais-dialog-item-span","ais-divider"],[1,"ais-dialog-item"],[1,"ais-dialog-key","mat-subtitle-2"],[1,"ais-dialog-value","mat-body-2"],[2,"font-size","10px"],[1,"ais-dialog-long-value","mat-body-2"],[1,"ais-dialog-item",2,"grid-column","span 2"],[1,"ais-dialog-value","mat-body-4",2,"grid-column","span 2","text-align","center"],[1,"ais-vessel-description"]],template:function(t,i){t&1&&I(0,dC,6,1,"div",0)(1,cC,2,0,"div",1),t&2&&N(i.target?0:1)},dependencies:[Ht,ln,sn,On,Ha],styles:[".ais-dialog-panel .mat-mdc-dialog-container{--mat-dialog-content-padding: 0px 24px 20px 24px}.ais-dialog[_ngcontent-%COMP%]{display:grid;gap:8px;color:var(--kip-contrast-color)}.ais-dialog-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 14px}.ais-vessel-description[_ngcontent-%COMP%]{grid-column:span 2;font-size:var(--mat-sys-body-large-size)}.ais-dialog-long-item[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 1fr 1fr;align-items:baseline;gap:6px}.ais-dialog-long-value[_ngcontent-%COMP%]{grid-column:span 3;color:var(--kip-contrast-color)}.ais-dialog-item[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;align-items:baseline;gap:6px}.ais-divider[_ngcontent-%COMP%]{margin-top:6px}.ais-dialog-item[_ngcontent-%COMP%] mat-divider[_ngcontent-%COMP%]{grid-column:1/-1}.ais-dialog-item-span[_ngcontent-%COMP%]{grid-column:span 2}.ais-dialog-key[_ngcontent-%COMP%]{color:var(--kip-contrast-dim-color);letter-spacing:.04em}.ais-dialog-value[_ngcontent-%COMP%], .ais-dialog-empty[_ngcontent-%COMP%]{color:var(--kip-contrast-color)}"],changeDetection:0})}return n})();var uC=["radarSvg"],mC=["menuAnchor"],hC=["menuTrigger"],pC=(n,o)=>o.id;function gC(n,o){n&1&&(ie(),d(0,"svg",7),W(1,"path",17),d(2,"text",18),c(3,"N"),u()())}function fC(n,o){n&1&&(ie(),d(0,"svg",7),W(1,"path",19),u())}function vC(n,o){if(n&1){let e=we();d(0,"button",20),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("noCollisionRisk"))}),d(1,"mat-icon"),c(2,"security"),u()()}if(n&2){let e=k();dt("is-active",e.isFilterEnabled("noCollisionRisk"))}}function bC(n,o){if(n&1){let e=we();d(0,"button",22),U("click",function(){let i=ee(e).$implicit,a=k(2);return te(a.onMenuItemSelect(i))}),W(1,"img",23),d(2,"span",24),c(3),u()()}if(n&2){let e=o.$implicit;f(),xe("visibility",e.iconHref?"visible":"hidden"),J("src",e.iconHref??null,Nr),f(2),K(e.label)}}function AC(n,o){if(n&1&&Ae(0,bC,4,4,"button",21,pC),n&2){let e=k();ye(e.menuItems())}}function yC(n,o){if(n&1){let e=we();d(0,"button",25),c(1,"Filter Targets"),u(),d(2,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("anchoredMoored"))}),d(3,"mat-icon",27),c(4),u(),d(5,"span"),c(6,"Anchored/Moored"),u()(),d(7,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("allAton"))}),d(8,"mat-icon",27),c(9),u(),d(10,"span"),c(11,"All AtoN"),u()(),d(12,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("allButSar"))}),d(13,"mat-icon",27),c(14),u(),d(15,"span"),c(16,"All but SAR"),u()(),d(17,"button",26),U("click",function(){ee(e);let i=k();return te(i.toggleFilter("allVessels"))}),d(18,"mat-icon",27),c(19),u(),d(20,"span"),c(21,"All Vessels"),u()(),d(22,"button",28)(23,"span"),c(24,"Vessel Type"),u(),d(25,"mat-icon"),c(26,"chevron_right"),u()()}if(n&2){let e=k(),t=Rt(26);f(4),fe(" ",e.isFilterEnabled("anchoredMoored")?"check_box":"check_box_outline_blank"," "),f(5),fe(" ",e.isFilterEnabled("allAton")?"check_box":"check_box_outline_blank"," "),f(5),fe(" ",e.isFilterEnabled("allButSar")?"check_box":"check_box_outline_blank"," "),f(5),fe(" ",e.isFilterEnabled("allVessels")?"check_box":"check_box_outline_blank"," "),f(3),R("matMenuTriggerFor",t)}}function xC(n,o){if(n&1){let e=we();d(0,"button",26),U("click",function(){let i=ee(e).$implicit,a=k(2);return te(a.toggleVesselTypeFilter(i))}),d(1,"mat-icon",27),c(2),u(),d(3,"span"),c(4),u()()}if(n&2){let e=o.$implicit,t=k(2);f(2),fe(" ",t.isVesselTypeFilterEnabled(e)?"check_box":"check_box_outline_blank"," "),f(2),K(t.formatVesselTypeLabel(e))}}function CC(n,o){if(n&1&&Ae(0,xC,5,2,"button",29,Jt),n&2){let e=k();ye(e.vesselTypeFilters)}}function SC(n,o){n&1&&W(0,"div",16)}var zp=(()=>{class n{static TARGET_ICON_SIZE_PX=16;static OWN_SHIP_ICON_SIZE_PX=84;static HIT_RADIUS_PX=28;static ICON_RENDER_DEBOUNCE_MS=50;id=x.required();type=x.required();theme=x.required();runtime=y(Se);ais=y(Bp);dialog=y(Up);ngZone=y(qe);units=y(it);settings=y(Wt);toast=y(nn);dashboard=y(yt);static DEFAULT_CONFIG={filterSelfPaths:!1,enableTimeout:!1,dataTimeout:5,ais:{filters:{anchoredMoored:!1,noCollisionRisk:!1,allAton:!1,allButSar:!1,allVessels:!1,vesselTypes:[]},viewMode:"course-up",rangeRings:[1,3,6,12,24,48],rangeIndex:"3",showCogVectors:!0,cogVectorsMinutes:10,showLostTargets:!0,showUnconfirmedTargets:!0,showSelf:!0},color:"grey"};svgRef=he.required("radarSvg");menuAnchorRef=he.required("menuAnchor");menuTrigger=he.required("menuTrigger");hostSize=w(null);renderState=null;selectedId=w(null);localViewMode=w(null);localRangeIndex=w(null);effectiveViewMode=X(()=>this.localViewMode()??this.runtime.options()?.ais?.viewMode??"course-up");effectiveRangeIndex=X(()=>{let e=this.resolveRangeIndex(this.runtime.options()?.ais),t=this.runtime.options()?.ais?.rangeRings??[3,6,12,24,48],i=Math.max(0,t.length-1),a=this.localRangeIndex()??e;return Math.min(Math.max(a,0),i)});svg;root;ringsLayer;vectorsLayer;targetsLayer;selectedLayer;ownShipLayer;viewRotationSmoothed=null;lastRotationAt=null;renderFrame=null;iconRenderTimer=null;iconCache=new Map;targetCache=new Map;lastOriginKey=null;ringCache=null;ownShipIconHref=null;menuItems=w([]);menuPoint=null;lastRenderTargets=[];lastRenderScale=1;lastRenderSize=null;hitRadiusPx=n.HIT_RADIUS_PX;lastFiltersSignature=null;lastRenderSignature=null;filterState=w({anchoredMoored:!1,noCollisionRisk:!1,allAton:!1,allButSar:!1,allVessels:!1,vesselTypes:new Set});vesselTypeFilters=vs.filter(e=>e!=="vessel/self"&&e!=="vessel/unknown"&&e!=="vessel/spare");hasActiveFilters=X(()=>{let e=this.filterState();return e.anchoredMoored||e.allAton||e.allButSar||e.allVessels||e.vesselTypes.size>0});hasCollisionRiskData=this.ais.hasCollisionRiskData;constructor(){this.warnIfRemoteDataDisabled(),this.loadOwnShipIcon(),L(()=>{let e=this.hostSize(),t=this.runtime.options(),i=this.theme(),a=this.ais.targets(),r=this.ais.ownShip();!e||!t||!i||(G(()=>{this.renderState={size:e,cfg:t,theme:i,targets:a,ownShip:r},this.syncFiltersFromConfig(t)}),this.scheduleRender())}),L(()=>{this.localViewMode(),this.localRangeIndex(),this.selectedId(),this.filterState(),G(()=>{this.scheduleRender()})})}warnIfRemoteDataDisabled(){this.settings.signalKSubscribeAll||this.toast.show('AIS data is disabled in your connection. To see radar targets, go to Settings -> Options -> Connectivity, enable "Subscribe to remote sources messages", then reconnect.',0,!1,"warn")}loadOwnShipIcon(){this.ngZone.runOutsideAngular(()=>{gm().then(e=>{this.ownShipIconHref=e,this.scheduleRenderDebounced()})})}ngAfterViewInit(){this.initSvg(),this.scheduleRender()}onResized(e){this.hostSize.set({width:e.width,height:e.height})}initSvg(){this.svg=hn(this.svgRef().nativeElement),this.svg.attr("class","ais-radar"),this.root=this.svg.append("g").attr("class","radar-root"),this.ringsLayer=this.root.append("g").attr("class","radar-rings"),this.vectorsLayer=this.root.append("g").attr("class","radar-vectors"),this.targetsLayer=this.root.append("g").attr("class","radar-targets"),this.selectedLayer=this.root.append("g").attr("class","radar-selected"),this.ownShipLayer=this.root.append("g").attr("class","radar-ownship-layer"),this.svg.on("click",()=>{this.selectedId.set(null),this.closeTargetMenu()})}scheduleRender(){this.renderFrame===null&&this.ngZone.runOutsideAngular(()=>{this.renderFrame=requestAnimationFrame(()=>{this.renderFrame=null,this.render()})})}scheduleRenderDebounced(){this.iconRenderTimer===null&&this.ngZone.runOutsideAngular(()=>{this.iconRenderTimer=window.setTimeout(()=>{this.iconRenderTimer=null,this.scheduleRender()},n.ICON_RENDER_DEBOUNCE_MS)})}render(){if(!this.renderState||!this.svg||!this.root)return;let{size:e,cfg:t,theme:i,targets:a,ownShip:r}=this.renderState,s=Math.max(1,e.width),l=Math.max(1,e.height),m=Math.min(s,l)/2,g=(Math.min(s,l)-35)/Math.min(s,l),v=Math.hypot(s,l)/2/g,A=t.ais??{},C=A.rangeRings?.length?A.rangeRings:[3,6,12,24,48],_=this.effectiveRangeIndex(),M=C[_]??C[0],B=this.resolveRingCountForRange(M),D=this.localViewMode()??A.viewMode??"course-up",V=this.toDegreesIfRadians(r.courseOverGroundTrue),F=this.toDegreesIfRadians(r.headingTrue),Y=V!==null||F!==null,j=D==="course-up"?V??F??0:0,Ce=this.viewRotationSmoothed!==null&&Math.abs(this.shortestAngleDelta(this.viewRotationSmoothed,j))>.5,me=this.buildFilterStateSignature(this.filterState()),ae={sizeKey:`${s}x${l}`,viewMode:D,rangeIndex:_,rangesKey:C.join(","),showSelf:A.showSelf??!0,showCogVectors:A.showCogVectors??!0,showLostTargets:A.showLostTargets??!0,showUnconfirmedTargets:A.showUnconfirmedTargets??!0,filtersKey:me,selectedId:this.selectedId(),targetsRef:a,ownShipRef:r,themeRef:i,color:t.color},se=this.lastRenderSignature;if(!Ce&&se&&se.sizeKey===ae.sizeKey&&se.viewMode===ae.viewMode&&se.rangeIndex===ae.rangeIndex&&se.rangesKey===ae.rangesKey&&se.showSelf===ae.showSelf&&se.showCogVectors===ae.showCogVectors&&se.showLostTargets===ae.showLostTargets&&se.showUnconfirmedTargets===ae.showUnconfirmedTargets&&se.filtersKey===ae.filtersKey&&se.selectedId===ae.selectedId&&se.targetsRef===ae.targetsRef&&se.ownShipRef===ae.ownShipRef&&se.themeRef===ae.themeRef&&se.color===ae.color)return;this.lastRenderSignature=ae;let ce=D==="course-up"&&Y?this.smoothRotation(j):0,oe=D==="course-up"?Math.abs(this.shortestAngleDelta(ce,j)):0;this.svg.attr("viewBox",`${-s/2} ${-l/2} ${s} ${l}`),this.root.attr("transform",`scale(${g})`);let de=this.wrapDegrees((V??F??0)-ce),le=Te(t.color,i).dim;if(this.renderRings(B,M,m,v,ce,g,A.showSelf??!0,de,le),!r.position||!this.hasValidPosition(r.position))return;let be=v/m*M,Ue=this.buildTargets(a,r.position,M,be,m,ce,A);this.lastRenderTargets=Ue,this.lastRenderScale=g,this.lastRenderSize=e,this.renderVectors(Ue,M,m,ce,A,r),this.renderTargets(Ue,g),this.renderSelected(Ue,g),this.raiseOwnshipAndVector(),oe>.5&&this.scheduleRender()}renderRings(e,t,i,a,r,s,l,m,g){if(!this.ringsLayer)return;let v=`${t.toFixed(3)}|${i.toFixed(3)}|${a.toFixed(3)}|${e}`;if(!this.ringCache||this.ringCache.key!==v){let j=t/Math.max(1,e),Ce=a/i*t,me=[];for(let oe=j;oe<=Ce+1e-6;oe+=j)me.push(oe);let ae=me.map(oe=>({value:oe,radius:oe/t*i})).filter(oe=>oe.radius<=a+1e-6),se=20,ce=ae.flatMap(oe=>[{key:`${oe.value}-top`,value:oe.value,x:0,y:-oe.radius+se},{key:`${oe.value}-bottom`,value:oe.value,x:0,y:oe.radius-se}]);this.ringCache={key:v,rings:ae,labels:ce}}let A=this.ringCache;if(!A)return;let C=A.rings,_=this.ringsLayer.selectAll("circle.ring").data(C,j=>j.value.toString());_.enter().append("circle").attr("class","ring").merge(_).attr("r",j=>j.radius).attr("stroke",g),_.exit().remove();let M=A.labels,B=this.ringsLayer.selectAll("text.ring-label").data(M,j=>j.key);B.enter().append("text").attr("class","ring-label").merge(B).attr("x",j=>j.x).attr("y",j=>j.y).attr("text-anchor","middle").attr("dominant-baseline","middle").text(j=>`${j.value}`),B.exit().remove();let D=this.ringsLayer.selectAll("circle.radar-center").data(l?[]:[{r:Math.max(3,i*.01)}]);D.enter().append("circle").attr("class","radar-center").merge(D).attr("cx",0).attr("cy",0).attr("r",j=>j.r).attr("fill",g),D.exit().remove();let V=this.ownShipLayer.selectAll("g.radar-ownship").data(l?[{size:this.resolveOwnShipBaseSize(s)}]:[]),F=V.enter().append("g").attr("class","radar-ownship");F.append("image").attr("class","ownship-icon").attr("href",this.ownShipIconHref??null).attr("xlink:href",this.ownShipIconHref??null);let Y=F.merge(V);Y.attr("transform",`rotate(${m})`),Y.select("image.ownship-icon").attr("href",this.ownShipIconHref??null).attr("xlink:href",this.ownShipIconHref??null).attr("display",this.ownShipIconHref?null:"none").attr("width",j=>j.size).attr("height",j=>j.size).attr("x",j=>-j.size/2).attr("y",j=>-j.size/2),V.exit().remove()}toggleViewMode(){let e=this.localViewMode()??this.runtime.options()?.ais?.viewMode??"course-up";this.localViewMode.set(e==="course-up"?"north-up":"course-up")}incrementRange(){this.localRangeIndex.set(Math.max(this.effectiveRangeIndex()-1,0))}decrementRange(){let e=this.runtime.options()?.ais?.rangeRings??[3,6,12,24,48],t=Math.max(0,e.length-1);this.localRangeIndex.set(Math.min(this.effectiveRangeIndex()+1,t))}toggleFilter(e){this.filterState.update(t=>ge(ne({},t),{[e]:!t[e]}))}toggleVesselTypeFilter(e){this.filterState.update(t=>{let i=new Set(t.vesselTypes);return i.has(e)?i.delete(e):i.add(e),ge(ne({},t),{vesselTypes:i})})}isFilterEnabled(e){return this.filterState()[e]}isVesselTypeFilterEnabled(e){return this.filterState().vesselTypes.has(e)}formatVesselTypeLabel(e){let t=e.replace("vessel/","");switch(t){case"pleasurecraft":return"Pleasure Craft";case"highspeed":return"High Speed";case"sar":return"SAR";case"law":return"Law Enforcement";default:return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}}syncFiltersFromConfig(e){let t=e.ais?.filters;if(!t)return;let i=this.buildFilterSignature(t);i!==this.lastFiltersSignature&&(this.lastFiltersSignature=i,this.filterState.set({anchoredMoored:t.anchoredMoored??!1,noCollisionRisk:t.noCollisionRisk??!1,allAton:t.allAton??!1,allButSar:t.allButSar??!1,allVessels:t.allVessels??!1,vesselTypes:new Set(t.vesselTypes??[])}))}buildFilterSignature(e){let t=[...e?.vesselTypes??[]].sort();return JSON.stringify({anchoredMoored:e?.anchoredMoored??!1,noCollisionRisk:e?.noCollisionRisk??!1,allAton:e?.allAton??!1,allButSar:e?.allButSar??!1,allVessels:e?.allVessels??!1,vesselTypes:t})}buildFilterStateSignature(e){let t=[...e.vesselTypes].sort();return JSON.stringify({anchoredMoored:e.anchoredMoored,noCollisionRisk:e.noCollisionRisk,allAton:e.allAton,allButSar:e.allButSar,allVessels:e.allVessels,vesselTypes:t})}resolveRingCountForRange(e){return[3].find(i=>this.isNiceStep(e/i))??4}isNiceStep(e){return[.5,1,2,2.5,3,4,5,6,8,10,12,15,20,25].some(i=>Math.abs(e-i)<1e-6)}resolveRangeIndex(e){return e?Number(e.rangeIndex):0}buildTargets(e,t,i,a,r,s,l){let m=l.showLostTargets??!0,g=l.showUnconfirmedTargets??!0,v=`${t.latitude?.toFixed(6)}|${t.longitude?.toFixed(6)}`;this.lastOriginKey!==v&&(this.targetCache.clear(),this.lastOriginKey=v);let A=new Set;for(let M of e)A.add(M.id);for(let M of this.targetCache.keys())A.has(M)||this.targetCache.delete(M);for(let M of this.iconCache.keys())A.has(M)||this.iconCache.delete(M);let C=[];for(let M of e)M.ais.status==="remove"&&(this.targetCache.delete(M.id),this.iconCache.delete(M.id),this.selectedId()===M.id&&this.selectedId.set(null));let _=e.filter(M=>M.ais.status==="remove"||M.ais.status==="lost"&&!m||M.ais.status==="unconfirmed"&&!g||!M.position||!this.hasValidPosition(M.position)?!1:!this.shouldFilterTarget(M));for(let M of _){let B=this.buildTrackSignature(M),D=this.targetCache.get(M.id);if(!D||D.signature!==B){let se=this.distanceNm(t,M.position),ce=this.ais.getBearingTrue(t,M.position)??0,oe=this.toDegreesIfRadians(this.isVesselLike(M)?M.headingTrue:null),de=this.toDegreesIfRadians(this.isVesselLike(M)?M.courseOverGroundTrue:null);D={signature:B,distanceNm:se,bearing:ce,trackHeading:oe,trackCog:de},this.targetCache.set(M.id,D)}if(D.distanceNm>a)continue;let{href:V,scale:F}=this.resolveIconCached(M),Y=this.wrapDegrees(D.bearing-s),{x:j,y:Ce}=this.polarToCartesian(Y,D.distanceNm,i,r),me=M.type==="aton"||M.type==="basestation"?0:this.wrapDegrees((D.trackHeading??D.trackCog??0)-s),ae=this.buildClassName({id:M.id,status:M.ais.status,aisClass:M.ais.class,type:M.type,navState:this.isVesselLike(M)?M.navState:void 0});C.push({id:M.id,raw:M,x:j,y:Ce,heading:me,status:M.ais.status,aisClass:M.ais.class,type:M.type,iconHref:V,iconScale:F,navState:this.isVesselLike(M)?M.navState:void 0,sog:this.isVesselLike(M)?M.speedOverGround:void 0,cog:D.trackCog??null,className:ae})}return C}renderVectors(e,t,i,a,r,s){if(!this.vectorsLayer||!this.ownShipLayer)return;let l=r.showCogVectors??!0,m=Math.max(6,i*.04),g=(r.cogVectorsMinutes??5)*60,v=m*.8,A=[],C=[];for(let _ of e)if(this.isVesselLike(_.raw)&&!this.isStationaryNavState(_.raw.navState)&&l&&typeof _.sog=="number"&&typeof _.cog=="number"){let M=this.wrapDegrees(_.cog-a),B=this.offsetPoint(_.x,_.y,M,v),D=_.sog*g/1852,V=Math.max(0,D/t*i-v);if(V<=0)continue;let F=this.offsetPoint(B.x,B.y,M,V),Y=this.resolveTargetVectorStroke(_.raw);A.push({id:_.id,x1:B.x,y1:B.y,x2:F.x,y2:F.y,className:_.className,stroke:Y})}if(r.showSelf??!0){let _=this.toDegreesIfRadians(s.courseOverGroundTrue),M=s.speedOverGround;if(_!==null&&typeof M=="number"){let B=this.wrapDegrees(_-a),D=this.offsetPoint(0,0,B,v),V=M*g/1852,F=Math.max(0,V/t*i-v);if(F<=0)return;let Y=this.offsetPoint(D.x,D.y,B,F);C.push({id:"ownship",x1:D.x,y1:D.y,x2:Y.x,y2:Y.y,className:"ownship-vector",stroke:"var(--kip-orange-color)"})}}this.renderVectorLines(this.vectorsLayer,"motion-vector",A),this.renderVectorLines(this.ownShipLayer,"ownship-vector",C)}renderVectorLines(e,t,i){let a=e.selectAll(`line.${t}`).data(i,s=>s.id);a.enter().append("line").attr("class",s=>`${t} ${s.className}`).merge(a).attr("x1",s=>s.x1).attr("y1",s=>s.y1).attr("x2",s=>s.x2).attr("y2",s=>s.y2).style("stroke",s=>s.stroke??"#50505f").style("stroke-width",2).style("opacity",1).style("stroke-dasharray","15, 7"),a.exit().remove();let r=e.selectAll(`circle.${t}-tip`).data(i,s=>s.id);r.enter().append("circle").attr("class",s=>`${t}-tip ${s.className}`).merge(r).attr("cx",s=>s.x2).attr("cy",s=>s.y2).attr("r",2.5).style("fill",s=>s.stroke??"#50505f").style("stroke",s=>s.stroke??"#50505f").style("stroke-width",2).style("opacity",1).style("stroke-dasharray","15, 7"),r.exit().remove()}renderTargets(e,t){if(!this.targetsLayer)return;let i=this.resolveTargetBaseSize(t),a=this.targetsLayer.selectAll("g.target").data(e,l=>l.id),r=a.enter().append("g").on("click",(l,m)=>{l.stopPropagation(),this.handleTargetClick(l,m)});r.append("image").attr("class","target-icon"),r.append("title");let s=r.merge(a);s.attr("transform",l=>`translate(${l.x}, ${l.y}) rotate(${l.heading})`).attr("class",l=>`target ${l.className}`),s.select("image.target-icon").attr("href",l=>l.iconHref??null).attr("xlink:href",l=>l.iconHref??null).attr("display",l=>l.iconHref?null:"none").attr("width",l=>i*l.iconScale).attr("height",l=>i*l.iconScale).attr("x",l=>-(i*l.iconScale)/2).attr("y",l=>-(i*l.iconScale)/2),s.select("title").text(l=>`${l.raw.name??l.raw.mmsi??"AIS Target"}`),a.exit().remove()}renderSelected(e,t){if(!this.selectedLayer)return;let i=e.filter(g=>g.id===this.selectedId()),a=this.resolveTargetBaseSize(t),r=a*1.4,s=Math.min(r,Math.max(4,a*.6)),l=this.buildCornerBoxPath(r,s),m=this.selectedLayer.selectAll("path.selected-ring").data(i,g=>g.id);m.enter().append("path").attr("class","selected-ring").merge(m).attr("transform",g=>`translate(${g.x}, ${g.y})`).attr("d",l),m.exit().remove()}resolveTargetBaseSize(e){let t=Math.max(.2,e);return n.TARGET_ICON_SIZE_PX/t}resolveOwnShipBaseSize(e){let t=Math.max(.2,e);return n.OWN_SHIP_ICON_SIZE_PX/t}raiseOwnshipAndVector(){this.ownShipLayer?.raise()}onMenuItemSelect(e){this.openTargetDialog(e.target,e.iconHref),this.selectedId.set(null),this.closeTargetMenu()}handleTargetClick(e,t){let i=this.resolveMenuItems(e,t);if(i.length<=1){this.openTargetDialog(t.raw,t.iconHref);return}this.menuItems.set(i),this.menuPoint=this.resolveMenuPoint(e),this.positionMenuAnchor(),this.menuTrigger().openMenu()}openTargetDialog(e,t){this.selectedId.set(e.id),this.dialog.openAisDetailDialog({title:this.buildTargetTitle(e),iconHref:t??void 0,component:"ais-target",componentType:el,payload:{target:e}}).subscribe()}resolveMenuItems(e,t){return this.findTargetsNearEvent(e,t).map(a=>({id:a.id,label:this.buildTargetMenuLabel(a.raw),iconHref:a.iconHref,target:a.raw}))}findTargetsNearEvent(e,t){let i=this.lastRenderTargets.length?this.lastRenderTargets:[t],a=this.eventToRadarPoint(e);if(!a)return[t];let r=this.hitRadiusPx/this.lastRenderScale,s=i.map((l,m)=>{let g=l.x-a.x,v=l.y-a.y,A=Math.hypot(g,v);return{candidate:l,distance:A,index:m}}).filter(l=>l.distance<=r).sort((l,m)=>l.distance-m.distance||l.index-m.index).map(l=>l.candidate);return s.length?s:[t]}eventToRadarPoint(e){if(!this.lastRenderSize)return null;let a=this.svgRef().nativeElement.getBoundingClientRect(),r=e.clientX-a.left,s=e.clientY-a.top,l=(r-a.width/2)/this.lastRenderScale,m=(s-a.height/2)/this.lastRenderScale;return{x:l,y:m}}resolveMenuPoint(e){let t=this.svgRef().nativeElement.closest(".ais-radar-container");if(!t)return null;let i=t.getBoundingClientRect();return{x:e.clientX-i.left,y:e.clientY-i.top}}positionMenuAnchor(){let e=this.menuAnchorRef().nativeElement;this.menuPoint&&(e.style.left=`${this.menuPoint.x}px`,e.style.top=`${this.menuPoint.y}px`)}closeTargetMenu(){this.resetTargetMenuState(),this.menuTrigger().menuOpen&&this.menuTrigger().closeMenu()}resetTargetMenuState(){this.menuItems.set([]),this.menuPoint=null}buildTargetMenuLabel(e){return this.isAton(e)&&e.typeName?e.typeName:e.name??e.mmsi??"AIS Target"}buildTargetTitle(e){let t=this.isAton(e)&&e.typeName?e.typeName:e.name??e.type??"AIS Target",i=e.ais.status;return i==="unconfirmed"||i==="lost"||i==="remove"?`${t} - ${i}`:t}resolveIconCached(e){let t=this.buildIconSignature(e),i=this.iconCache.get(e.id);if(i&&i.signature===t)return i.icon;let a=this.resolveIconScale(e.type),r={href:i?.icon.href??null,scale:a};this.iconCache.set(e.id,{signature:t,icon:r});let s=e.ais.status==="remove"?void 0:e.ais.status;return this.ngZone.runOutsideAngular(()=>{pm({mmsi:e.mmsi??"",type:e.type,navState:this.isVesselLike(e)?e.navState:void 0,aisShipTypeId:this.isVesselLike(e)?e.design?.aisShipType?.id:void 0,atonVirtual:this.isAton(e)?e.virtual:void 0,atonTypeId:this.isAton(e)?e.typeId:void 0,status:s,collisionRiskRating:this.isVesselLike(e)?e.closestApproach?.collisionRiskRating:void 0}).then(l=>{let m=this.iconCache.get(e.id);!m||m.signature!==t||(m.icon={href:l,scale:a},this.scheduleRenderDebounced())})}),r}resolveIconScale(e){switch(e){case"aton":return 3.5;case"basestation":return 3;case"sar":return 2.4;case"vessel":return 3;default:return 2.4}}buildIconSignature(e){let t=e.ais.status==="lost"?"unconfirmed":e.ais.status;return[e.mmsi,e.type,this.isVesselLike(e)?e.navState:void 0,this.isVesselLike(e)?e.design?.aisShipType?.id:void 0,this.isAton(e)?e.virtual:void 0,this.isAton(e)?e.typeId:void 0,t,this.isVesselLike(e)?e.closestApproach?.collisionRiskRating:void 0].join("|")}buildClassName(e){let t=[`status-${e.status}`,`type-${e.type}`,e.aisClass?`class-${e.aisClass.toLowerCase()}`:"class-unknown"];if(e.navState){let i=e.navState.toLowerCase();i.includes("moored")&&t.push("state-moored"),i.includes("anchored")&&t.push("state-anchored")}return e.id===this.selectedId()&&t.push("is-selected"),t.join(" ")}resolveTargetVectorStroke(e){if(e.ais.status!=="confirmed")return"#50505f";let t=e.closestApproach?.collisionRiskRating,i=typeof t=="number"?t:Number(t);return Number.isFinite(i)?i<Vl?"red":i<fs?"yellow":"#50505f":"#50505f"}shouldFilterTarget(e){let t=this.filterState();if(!t.anchoredMoored&&!t.noCollisionRisk&&!t.allAton&&!t.allButSar&&!t.allVessels&&t.vesselTypes.size===0)return!1;if(t.anchoredMoored&&this.isVesselLike(e)&&this.isStationaryNavState(e.navState)||t.noCollisionRisk&&this.isVesselLike(e)&&(e.ais.status!=="confirmed"||this.isStationaryNavState(e.navState)||this.isNoCollisionRisk(e))||t.allAton&&e.type==="aton"||t.allButSar&&e.type!=="sar"||t.allVessels&&this.isVesselLike(e))return!0;if(t.vesselTypes.size>0&&this.isVesselLike(e)){let i=this.resolveVesselIconKey(e);if(i&&t.vesselTypes.has(i))return!0}return!1}isNoCollisionRisk(e){let t=e.closestApproach?.collisionRiskRating;if(!Object.prototype.hasOwnProperty.call(e.closestApproach??{},"collisionRiskRating"))return!1;if(t==null)return!0;let i=typeof t=="number"?t:Number(t);return Number.isFinite(i)?i>=fs:!0}resolveVesselIconKey(e){if(!this.isVesselLike(e))return null;let t=Gl({mmsi:e.mmsi??e.id??"",type:e.type,aisShipTypeId:e.design?.aisShipType?.id});return t.startsWith("vessel/")?t:null}polarToCartesian(e,t,i,a){let r=e*Math.PI/180,s=t/i*a;return{x:s*Math.sin(r),y:-s*Math.cos(r)}}hasValidPosition(e){return typeof e?.latitude=="number"&&Number.isFinite(e.latitude)&&typeof e?.longitude=="number"&&Number.isFinite(e.longitude)}offsetPoint(e,t,i,a){let r=i*Math.PI/180;return{x:e+a*Math.sin(r),y:t-a*Math.cos(r)}}wrapDegrees(e){let t=e%360;return t<0?t+360:t}isStationaryNavState(e){if(typeof e=="number"&&Number.isFinite(e))return e===1||e===5;if(typeof e!="string")return!1;let t=e.trim().toLowerCase().replace(/\s+/g," ");if(!t.length)return!1;let i=Number(t);return Number.isFinite(i)?i===1||i===5:t.includes("moored")||t.includes("anchored")||t.includes("at anchor")}shortestAngleDelta(e,t){return(t-e+540)%360-180}buildTrackSignature(e){let t=e.position??{};return[t.latitude,t.longitude,this.isVesselLike(e)?e.headingTrue:void 0,this.isVesselLike(e)?e.courseOverGroundTrue:void 0].join("|")}isVesselLike(e){return e.type==="vessel"||e.type==="sar"}isAton(e){return e.type==="aton"}buildCornerBoxPath(e,t){let i=e,a=Math.min(Math.max(t,0),i);return[`M ${-i} ${-i} h ${a}`,`M ${-i} ${-i} v ${a}`,`M ${i} ${-i} h ${-a}`,`M ${i} ${-i} v ${a}`,`M ${-i} ${i} h ${a}`,`M ${-i} ${i} v ${-a}`,`M ${i} ${i} h ${-a}`,`M ${i} ${i} v ${-a}`].join(" ")}smoothRotation(e){let t=performance.now();if(this.viewRotationSmoothed===null||this.lastRotationAt===null)return this.viewRotationSmoothed=this.wrapDegrees(e),this.lastRotationAt=t,this.viewRotationSmoothed;let i=Math.min(250,Math.max(0,t-this.lastRotationAt)),a=Math.min(1,i/200),r=this.shortestAngleDelta(this.viewRotationSmoothed,e);return this.viewRotationSmoothed=this.wrapDegrees(this.viewRotationSmoothed+r*a),this.lastRotationAt=t,this.viewRotationSmoothed}toDegreesIfRadians(e){return typeof e!="number"||!Number.isFinite(e)?null:this.units.convertToUnit("deg",e)}distanceNm(e,t){let a=e.latitude*Math.PI/180,r=t.latitude*Math.PI/180,s=(t.latitude-e.latitude)*Math.PI/180,l=(t.longitude-e.longitude)*Math.PI/180,m=Math.sin(s/2),g=Math.sin(l/2),v=m*m+Math.cos(a)*Math.cos(r)*g*g;return 6371e3*(2*Math.atan2(Math.sqrt(v),Math.sqrt(1-v)))/1852}ngOnDestroy(){this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.iconRenderTimer!==null&&(window.clearTimeout(this.iconRenderTimer),this.iconRenderTimer=null)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-ais-radar"]],viewQuery:function(t,i){t&1&&Me(i.svgRef,uC,5)(i.menuAnchorRef,mC,5)(i.menuTrigger,hC,5),t&2&&ke(3)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:29,vars:9,consts:[["radarSvg",""],["menuAnchor","","menuTrigger","matMenuTrigger"],["targetMenu","matMenu"],["filterMenu","matMenu"],["vesselTypeMenu","matMenu"],["kipResizeObserver","",1,"ais-radar-container",3,"kipResize"],["type","button","matMiniFab","",1,"ais-radar-mode-toggle-button",3,"click","matTooltip"],["viewBox","0 0 40 40","aria-hidden","true",1,"ais-mode-icon"],["type","button","matMiniFab","","matTooltip","Increase range","aria-label","Increase range",1,"ais-radar-range-button","ais-radar-range-plus",3,"click"],["type","button","matMiniFab","","matTooltip","Decrease range","aria-label","Decrease range",1,"ais-radar-range-button","ais-radar-range-minus",3,"click"],["type","button","matMiniFab","","matTooltip","Filter targets","aria-label","Filter targets",1,"ais-radar-range-button","ais-radar-filter-button",3,"matMenuTriggerFor"],["type","button","matMiniFab","","matTooltip","Show only collision risk targets","aria-label","No collision risk filter",1,"ais-radar-range-button","ais-radar-collision-button",3,"is-active"],["role","img","aria-label","AIS radar display",1,"ais-radar"],["type","button","aria-hidden","true","tabindex","-1",1,"ais-radar-menu-anchor",3,"matMenuTriggerFor"],[3,"closed"],["matMenuContent",""],[1,"widgetOverlay"],["stroke","currentColor","d","M10 8 L20 2 L30 8",1,"ais-mode-icon-chev"],["fill","currentColor","x","20","y","31",1,"ais-mode-icon-letter"],["fill","currentColor","d","M20 4 L34 36 L20 28 L6 36 Z",1,"ais-mode-icon-vessel"],["type","button","matMiniFab","","matTooltip","Show only collision risk targets","aria-label","No collision risk filter",1,"ais-radar-range-button","ais-radar-collision-button",3,"click"],["mat-menu-item","","type","button",1,"ais-radar-menu-item"],["mat-menu-item","","type","button",1,"ais-radar-menu-item",3,"click"],["alt","","aria-hidden","true",1,"target-menu-icon"],[1,"target-menu-label"],["mat-menu-item","","disabled","",1,"ais-filter-menu-header"],["mat-menu-item","","type","button",3,"click"],["aria-hidden","true",1,"ais-filter-check"],["mat-menu-item","",3,"matMenuTriggerFor"],["mat-menu-item","","type","button"]],template:function(t,i){if(t&1&&(d(0,"div",5),U("kipResize",function(r){return i.onResized(r)}),d(1,"button",6),U("click",function(){return i.toggleViewMode()}),I(2,gC,4,0,":svg:svg",7)(3,fC,2,0,":svg:svg",7),u(),d(4,"button",8),U("click",function(){return i.incrementRange()}),d(5,"mat-icon"),c(6,"add"),u()(),d(7,"button",9),U("click",function(){return i.decrementRange()}),d(8,"mat-icon"),c(9,"remove"),u()(),d(10,"button",10)(11,"mat-icon"),c(12,"filter_list"),u()(),I(13,vC,3,2,"button",11),ie(),W(14,"svg",12,0),Be(),W(16,"button",13,1),u(),d(19,"mat-menu",14,2),U("closed",function(){return i.resetTargetMenuState()}),yi(21,AC,2,0,"ng-template",15),u(),d(22,"mat-menu",null,3),yi(24,yC,27,5,"ng-template",15),u(),d(25,"mat-menu",null,4),yi(27,CC,2,0,"ng-template",15),u(),I(28,SC,1,0,"div",16)),t&2){let a=Rt(20),r=Rt(23);f(),R("matTooltip",i.effectiveViewMode()==="north-up"?"Change to North-Up mode":"Change to Course-Up mode"),J("aria-label",i.effectiveViewMode()==="north-up"?"North up mode":"Course up mode"),f(),N(i.effectiveViewMode()==="north-up"?2:3),f(8),dt("is-active",i.hasActiveFilters()),R("matMenuTriggerFor",r),f(3),N(i.hasCollisionRiskData()?13:-1),f(3),R("matMenuTriggerFor",a),f(12),N(i.dashboard.isDashboardStatic()?-1:28)}},dependencies:[Xt,ot,jr,et,Xe,Lu,Ru,Nu,Ou,Vu,ro,oo],encapsulation:2,changeDetection:0})}return n})();var wC=["canvasMainRef"],Hp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);canvas=y(ht);static DEFAULT_CONFIG={displayName:"Static Label",color:"green",bgColor:"grey",noColor:!1,noBgColor:!0};canvasRef=he.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;disposed=!1;fgColor=w("");bgColor=w("");constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{this.fgColor.set(this.mapColor(e.color,t)),this.bgColor.set(this.mapColor(e.bgColor??"grey",t)),this.draw()})}),L(()=>{let e=this.runtime.options()?.displayName;G(()=>{e!==void 0&&this.draw()})})}mapColor(e,t){switch(e){case"contrast":return t.contrast;case"blue":return t.blue;case"green":return t.green;case"pink":return t.pink;case"orange":return t.orange;case"purple":return t.purple;case"grey":return t.grey;case"yellow":return t.yellow;default:return t.contrast}}ngAfterViewInit(){this.canvasElement=this.canvasRef().nativeElement,this.ctx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.draw()}}),this.cssHeight=Math.round(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.round(this.canvasElement.getBoundingClientRect().width),this.draw()}draw(){if(!this.ctx||!this.canvasElement)return;let e=this.runtime.options();if(!e)return;this.canvas.clearCanvas(this.ctx,this.cssWidth,this.cssHeight),e.noBgColor||this.canvas.drawRectangle(this.ctx,0,0,this.canvasElement.width,this.canvasElement.height,this.bgColor());let t=e.displayName||"";this.canvas.drawText(this.ctx,t,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2+10),this.cssWidth-40,this.cssHeight-40,"bold",this.fgColor())}ngOnDestroy(){this.disposed=!0;try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-label"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,wC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"label-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.label-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;display:block;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}"],changeDetection:0})}return n})();var _C=["plainIframe"];function MC(n,o){if(n&1&&Q(0,"iframe",1,0),n&2){let e=k();Wi("src",e.widgetUrl(),ha)}}function kC(n,o){n&1&&(E(0,"div",2)(1,"h2"),c(2,"Empty or bad URL"),O(),E(3,"p"),c(4," IMPORTANT: cross-domain security rules (CORS) apply to this widget. "),O(),E(5,"p"),c(6,"Typically, you can load Grafana graphs, Signal K apps or other related tools. "),O()())}var qp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);_dashboard=y(yt);_sanitizer=y(ja);static DEFAULT_CONFIG={widgetUrl:null,allowInput:!1};iframe=he.required("plainIframe");widgetUrl=w(null);displayTransparentOverlay=w("block");constructor(){L(()=>{let e=this.runtime.options(),t=this._dashboard.isDashboardStatic();e&&G(()=>{t?this.displayTransparentOverlay.set(e.allowInput?"none":"block"):this.displayTransparentOverlay.set("block")})}),L(()=>{let e=this.runtime.options()?.widgetUrl;this.widgetUrl.set(this.resolveUrl(e))}),window.addEventListener("message",this.handleIframeGesture)}ngAfterViewInit(){if(this.iframe()){this.iframe().nativeElement.onload=()=>this.injectSwipeScript();try{let e=this.iframe().nativeElement.contentDocument;e&&(e.readyState==="complete"||e.readyState==="interactive")&&this.injectSwipeScript()}catch(e){}}}ngOnDestroy(){window.removeEventListener("message",this.handleIframeGesture),this.iframe()&&(this.iframe().nativeElement.onload=null);try{let e=this.iframe()?.nativeElement.contentDocument;if(e){let t=`kip-gesture-inject-${this.id()}`,i=e.getElementById(t);i&&i.parentNode&&i.parentNode.removeChild(i)}}catch(e){}}handleIframeGesture=e=>{if(!e.data)return;let t=e.data?.eventData?.instanceId||e.data?.keyEventData?.instanceId;if(!(!t||t!==this.id())){if(e.data.gesture)switch(e.data.gesture){case"swipeup":this._dashboard.navigateToPreviousDashboard();break;case"swipedown":this._dashboard.navigateToNextDashboard();break;case"swipeleft":{let i=new Event("openLeftSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}case"swiperight":{let i=new Event("openRightSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}default:break}if(e.data.type==="keydown"&&e.data.keyEventData){let{key:i,ctrlKey:a,shiftKey:r}=e.data.keyEventData,s=new KeyboardEvent("keydown",{key:i,ctrlKey:a,shiftKey:r,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}}};injectSwipeScript(){let e=this.iframe().nativeElement.contentWindow,t=this.iframe().nativeElement.contentDocument;if(!t||!e){console.error("[WidgetIframe] Iframe contentDocument or contentWindow is undefined. Possible cross-origin issue or iframe not fully loaded.");return}try{let i=`kip-gesture-inject-${this.id()}`;if(t.getElementById(i))return;let a=so({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=a,t.body.appendChild(r)}catch(i){console.warn("[WidgetIframe] Failed to inject swipe script into iframe:",i)}}isValidProtocol(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch(t){return console.warn(`[Embed Widget] Invalid Url: ${e}, Error: ${t}`),!1}}resolveUrl(e){if(!e)return null;try{let t=new URL(e,window.location.origin);return this.isValidProtocol(t.href)?this._sanitizer.bypassSecurityTrustResourceUrl(t.href):null}catch(t){return console.warn(`[Embed Widget] Can't resolve Url: ${e}, Error: ${t}`),null}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-iframe"]],viewQuery:function(t,i){t&1&&Me(i.iframe,_C,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:3,consts:[["plainIframe",""],["width","100%","height","100%","frameborder","0",1,"widgetIframe",3,"src"],[2,"padding","15px"],[1,"widgetOverlay"]],template:function(t,i){t&1&&(I(0,MC,2,1,"iframe",1)(1,kC,7,0,"div",2),Q(2,"div",3)),t&2&&(N(i.widgetUrl()?0:1),f(2),xe("display",i.displayTransparentOverlay()))},styles:["[_nghost-%COMP%]{overflow:hidden}.widgetIframe[_ngcontent-%COMP%]{background-color:#fff;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"],changeDetection:0})}return n})();var TC=["hWrapper"];function DC(n){return{Red:n.ColorDef.RED,Green:n.ColorDef.GREEN,Blue:n.ColorDef.BLUE,Orange:n.ColorDef.ORANGE,Yellow:n.ColorDef.YELLOW,Cyan:n.ColorDef.CYAN,Magenta:n.ColorDef.MAGENTA,White:n.ColorDef.WHITE,Gray:n.ColorDef.GRAY,Black:n.ColorDef.BLACK,Raith:n.ColorDef.RAITH,"Green LCD":n.ColorDef.GREEN_LCD,"JUG Green":n.ColorDef.JUG_GREEN}}function EC(n){return{blackMetal:n.FrameDesign.BLACK_METAL,metal:n.FrameDesign.METAL,shinyMetal:n.FrameDesign.SHINY_METAL,brass:n.FrameDesign.BRASS,steel:n.FrameDesign.STEEL,chrome:n.FrameDesign.CHROME,gold:n.FrameDesign.GOLD,anthracite:n.FrameDesign.ANTHRACITE,tiltedGray:n.FrameDesign.TILTED_GRAY,tiltedBlack:n.FrameDesign.TILTED_BLACK,glossyMetal:n.FrameDesign.GLOSSY_METAL}}var $p=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Horizon",filterSelfPaths:!0,paths:{gaugePitchPath:{description:"Attitude Pitch Data",path:"self.navigation.attitude.pitch",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:1e3},gaugeRollPath:{description:"Attitude Roll Data",path:"self.navigation.attitude.roll",source:"default",pathType:"number",pathRequired:!1,isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:1e3}},gauge:{type:"horizon",noFrameVisible:!1,faceColor:"anthracite",invertPitch:!1,invertRoll:!1},enableTimeout:!1,dataTimeout:5};wrapperRef=he("hWrapper");resizeObserver=null;currentSize=0;structuralKey="";pendingSize=null;sizeCommitTimer=null;SIZE_STABLE_MS=180;ngZone=y(qe);gaugeOptions={};frameVisibleView=X(()=>!(this.runtime.options()?.gauge?.noFrameVisible??!1));gauge=null;latestPitch=0;latestRoll=0;constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.gaugePitchPath?.path||G(()=>this.streams.observe("gaugePitchPath",i=>{let a=i?.data?.value??0;if(this.latestPitch=a,this.gauge){let r=e.gauge?.invertPitch?-a:a;try{this.gauge.setPitchAnimated(r)}catch(s){}}}))}),L(()=>{let e=this.runtime.options();!e||!e.paths?.gaugeRollPath?.path||G(()=>this.streams.observe("gaugeRollPath",i=>{let a=i?.data?.value??0;if(this.latestRoll=a,this.gauge){let r=e.gauge?.invertRoll?-a:a;try{this.gauge.setRollAnimated(r)}catch(s){}}}))}),L(()=>{let e=this.runtime.options();if(!e)return;let t=`${e.gauge?.noFrameVisible??!1}|${e.gauge?.faceColor??"anthracite"}`;if(t===this.structuralKey){this.applyInversions(e);return}this.structuralKey=t,this.currentSize>=50&&(this.buildOptions(e,this.currentSize),this.rebuildGauge())})}ngAfterViewInit(){let e=this.wrapperRef()?.nativeElement;if(!e)return;let t=()=>{if(this.pendingSize==null||this.pendingSize===this.currentSize||this.pendingSize<50)return;let r=this.pendingSize,s=this.runtime.options();if(!s)return;this.currentSize=r;let l=document.getElementById(this.id()+"-canvas");l&&((l.width!==r||l.height!==r)&&(l.width=r,l.height=r),l.style.width=r+"px",l.style.height=r+"px"),this.buildOptions(s,r),this.rebuildGauge(),this.pendingSize=null},i=()=>{this.sizeCommitTimer&&clearTimeout(this.sizeCommitTimer),this.sizeCommitTimer=window.setTimeout(()=>{t(),this.sizeCommitTimer=null},this.SIZE_STABLE_MS)},a=()=>{let r=e.getBoundingClientRect(),s=Math.round(Math.min(r.width,r.height)),l=this.pendingSize??this.currentSize;if(!s||s<50||l&&Math.abs(l-s)<4)return;if(this.currentSize===0&&this.pendingSize===null){this.pendingSize=s,t();return}this.pendingSize=s;let m=document.getElementById(this.id()+"-canvas");m&&(m.style.width=s+"px",m.style.height=s+"px"),i()};this.ngZone.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(()=>a()),this.resizeObserver.observe(e),a()})}buildOptions(e,t){if(typeof steelseries>"u")return;let i=EC(steelseries),a=DC(steelseries);this.gaugeOptions={pointerColor:a.Red,frameVisible:!(e.gauge?.noFrameVisible??!1),frameDesign:i[e.gauge?.faceColor??"anthracite"],foregroundVisible:!1,size:t}}rebuildGauge(){let e=this.id()+"-canvas";if(this.gauge)try{this.gauge=null}catch(i){}let t=document.getElementById(e);if(t){this.currentSize&&(t.width!==this.currentSize||t.height!==this.currentSize)&&(t.width=this.currentSize,t.height=this.currentSize);let i=t.getContext("2d");i&&i.clearRect(0,0,t.width,t.height)}try{this.gauge=new steelseries.Horizon(e,this.gaugeOptions);let i=this.runtime.options();i&&this.gauge&&this.applyInversions(i)}catch(i){}}applyInversions(e){if(this.gauge){try{this.gauge.setPitchAnimated(e.gauge?.invertPitch?-this.latestPitch:this.latestPitch)}catch(t){}try{this.gauge.setRollAnimated(e.gauge?.invertRoll?-this.latestRoll:this.latestRoll)}catch(t){}}}ngOnDestroy(){if(this.resizeObserver){try{this.resizeObserver.disconnect()}catch(t){}this.resizeObserver=null}this.sizeCommitTimer&&(clearTimeout(this.sizeCommitTimer),this.sizeCommitTimer=null);let e=document.getElementById(this.id()+"-canvas");if(e)try{let t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height),e.width=0,e.height=0}catch(t){}this.gauge=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-horizon"]],viewQuery:function(t,i){t&1&&Me(i.wrapperRef,TC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:4,vars:3,consts:[["hWrapper",""],[1,"canvas-wrap"],[2,"z-index","inherit",3,"id"]],template:function(t,i){t&1&&(E(0,"div",1,0)(2,"canvas",2),c(3," Browser does not support canvas element. "),O()()),t&2&&(xe("padding",i.frameVisibleView()?"10px":"0px"),f(2),Wi("id",i.id()+"-canvas"))},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.canvas-wrap[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:0}.canvas-wrap[_ngcontent-%COMP%] > canvas[_ngcontent-%COMP%]{display:block;position:static;transform:none}"],changeDetection:0})}return n})();var PC=["finePath"],IC=["coarsePath"];function NC(n,o){if(n&1&&(ie(),Q(0,"line")),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.5:1)}}function OC(n,o){if(n&1&&(ie(),Q(0,"line",20)),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.2:.8)}}function RC(n,o){if(n&1&&(ie(),E(0,"text"),c(1),O()),n&2){let e=o.$implicit;J("x",e.x)("y",e.y),f(),fe("",e.text,"\xB0")}}function VC(n,o){if(n&1&&(ie(),Q(0,"line")),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.5:1)}}function LC(n,o){if(n&1&&(ie(),Q(0,"line",20)),n&2){let e=o.$implicit;J("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.2:.8)}}function WC(n,o){if(n&1&&(ie(),E(0,"text"),c(1),O()),n&2){let e=o.$implicit;J("x",e.x)("y",e.y),f(),fe("",e.text,"\xB0")}}var jp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);ngZone=y(qe);finePathRef=he("finePath");coarsePathRef=he("coarsePath");angleDeg=w(0);absAngle=X(()=>{let e=this.angleDeg();return e==null?null:Math.abs(e)});angleSide=X(()=>{let e=this.angleDeg();if(e==null)return"";let t=e>0?"Stbd":e<0?"Port":"Level";return this.runtime.options()?.gauge?.sideLabel?t:""});displayValue=X(()=>{let e=this.absAngle();if(e==null)return"--";let t=this.runtime.options()?.numDecimal??1;return e.toFixed(t)});themeColorValue=w("contrast");ready=w(!1);pointerTransition=X(()=>{let e=this.runtime.options()?.paths?.angle?.sampleTime??1e3;return`transform ${Math.max(100,e*.95)}ms ease-in-out`});fineTicks=w([]);fineInnerTicks=w([]);fineLabels=w([]);coarseTicks=w([]);coarseInnerTicks=w([]);coarseLabels=w([]);finePointerTransform=this.makePointerTransform("fine");coarsePointerTransform=this.makePointerTransform("coarse");displayName=X(()=>this.runtime.options()?.displayName||"Heel");static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Heel",filterSelfPaths:!0,paths:{angle:{description:"Heel / Roll / Other Angle",path:"self.navigation.attitude.roll",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"deg",sampleTime:1e3,pathRequired:!0}},gauge:{type:"angle",invertAngle:!1,sideLabel:!0},numInt:2,numDecimal:0,color:"contrast",enableTimeout:!1,dataTimeout:5};constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.angle?.path||G(()=>this.streams.observe("angle",i=>{let a=i?.data?.value;if(a==null){this.angleDeg.set(null);return}let r=e.gauge?.invertAngle?-a:a;this.angleDeg.set(r)}))}),L(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||this.themeColorValue.set(Te(t.color||"contrast",e).color)})}ngAfterViewInit(){this.ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>{let e=this.finePathRef()?.nativeElement,t=this.coarsePathRef()?.nativeElement;if(e){let i=this.buildScale(e,-5,5,1,.5);this.fineTicks.set(i.ticks),this.fineInnerTicks.set(i.innerTicks),this.fineLabels.set(i.labels)}if(t){let i=this.buildScale(t,-40,40,10,5);this.coarseTicks.set(i.ticks),this.coarseInnerTicks.set(i.innerTicks),this.coarseLabels.set(i.labels)}this.angleDeg()==null&&this.angleDeg.set(0),this.ready.set(!0)})})}makePointerTransform(e){return X(()=>this.computePointerTransform(this.angleDeg(),e))}setColors(e){let t=this.runtime.options();!e||!t||this.themeColorValue.set(Te(t.color||"contrast",e).color)}computePointerTransform(e,t){let i=e??0,a=t==="fine"?this.finePathRef()?.nativeElement:this.coarsePathRef()?.nativeElement;if(!a)return t==="fine"?"translate(200px, 20px) rotate(0deg)":"translate(200px, 10px) rotate(0deg)";let r=t==="fine"?{min:-5,max:5}:{min:-40,max:40},s=Math.max(r.min,Math.min(r.max,i)),l=a.getTotalLength(),g=(s-r.min)/(r.max-r.min)*l,v=a.getPointAtLength(g),A=g<10||g>l-10?5:1,C=a.getPointAtLength(Math.max(0,g-A)),_=a.getPointAtLength(Math.min(l,g+A)),M=_.x-C.x,B=_.y-C.y,D=Math.atan2(B,M)*180/Math.PI,V=Math.hypot(M,B)||1,F=-B/V,Y=M/V,j=-10,Ce=v.x+F*j,me=v.y+Y*j;return`translate(${Ce}px, ${me}px) rotate(${D}deg)`}buildScale(e,t,i,a,r){let s=e.getTotalLength(),l=[],m=[],g=[],v=i-t,A=Math.round(v/r),C=Math.round(a/r);for(let _=0;_<=A;_++){let M=t+_*r,B=_/A,D=_===A?s:B*s,V=e.getPointAtLength(D),F=e.getPointAtLength(Math.max(0,D-1)),Y=e.getPointAtLength(Math.min(s,D+1)),j=Math.atan2(Y.y-F.y,Y.x-F.x)*180/Math.PI,Ce=_%C===0||Math.abs(M)<1e-9,me=Ce?8:4,ae=Ce?6:3,se=this.pointFromAngle(V,j+90,0),ce=this.pointFromAngle(V,j+90,me);l.push({x1:se.x,y1:se.y,x2:ce.x,y2:ce.y,major:Ce});let oe=this.pointFromAngle(V,j-90,0),de=this.pointFromAngle(V,j-90,ae);if(m.push({x1:oe.x,y1:oe.y,x2:de.x,y2:de.y,major:Ce}),Ce){let le=this.pointFromAngle(V,j+90,me+8);g.push({x:le.x,y:le.y,text:`${Math.abs(M)}`,value:M})}}return{ticks:l,innerTicks:m,labels:g}}pointFromAngle(e,t,i){let a=t*Math.PI/180;return{x:e.x+Math.cos(a)*i,y:e.y+Math.sin(a)*i}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-heel-gauge"]],viewQuery:function(t,i){t&1&&Me(i.finePathRef,PC,5)(i.coarsePathRef,IC,5),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:54,vars:18,consts:[["finePath",""],["coarsePath",""],[1,"container"],["viewBox","0 0 400 105","preserveAspectRatio","xMidYMid meet",1,"flex-element","scale","fine"],["id","fineTubeGradient","x1","0%","y1","0%","x2","0%","y2","100%"],["offset","0%",1,"tube-highlight-color","opacity1"],["offset","45%",1,"tube-highlight-color","opacity2"],["offset","100%",1,"tube-highlight-color","opacity3"],["id","tubeEffect"],["in","SourceAlpha","stdDeviation","1.5","result","blur"],["in","blur","surfaceScale","4","specularConstant",".6","specularExponent","30","lighting-color","currentColor","result","specular"],["x","200","y","-50","z","150"],["x","200","y","150","z","80"],["in","specular","in2","SourceAlpha","operator","in","result","specular"],["in","SourceGraphic","in2","specular","operator","arithmetic","k1","0","k2","1","k3","0.7","k4","0"],["d","M 60,10 A 2400,2400 0 0,0 340,10 A 10,10 0 0,1 340,30 A 2400,2400 0 0,1 60,30 A 10,10 0 0,1 60,10 Z",1,"tube-background"],["d","M 60,11 A 2400,2400 0 0,0 340,11 A 8,8 0 0,1 340,17 A 2400,2400 0 0,1 60,17 A 8,8 0 0,1 60,11 Z",1,"tube-highlight"],["d","M 60,23 A 2400,2400 0 0,0 340,23 A 8,8 0 0,1 340,26 A 2400,2400 0 0,1 60,26 A 8,8 0 0,1 60,23 Z",1,"tube-highlight-secondary"],["d","M 60,30 A 2400,2400 0 0,0 340,30",1,"scale-line"],[1,"tick-marks"],["opacity","0.6"],[1,"scale-values"],["transform","translate(200 20) rotate(0)",1,"pointer"],["rx","6","ry","9"],["x","200","y","93","text-anchor","middle",1,"brand"],["viewBox","0 0 400 115","preserveAspectRatio","xMidYMid meet",1,"flex-element","scale"],["transform","translate(0,15)"],["x","200","y","22","text-anchor","middle",1,"angle"],["dx","-16",1,"side"],["d","M 40,0 A 400,400 0 0,0 360,0 A 10,10 0 0,1 360,20 A 400,400 0 0,1 40,20 A 10,10 0 0,1 40,0 Z",1,"tube-background"],["d","M 40,1 A 400,400 0 0,0 360,1 A 8,8 0 0,1 360,7 A 400,400 0 0,1 40,7 A 8,8 0 0,1 40,1 Z",1,"tube-highlight"],["d","M 40,13 A 400,400 0 0,0 360,13 A 8,8 0 0,1 360,16 A 400,400 0 0,1 40,16 A 8,8 0 0,1 40,13 Z",1,"tube-highlight-secondary"],["d","M 40,20 A 400,400 0 0,0 360,20",1,"scale-line"],["transform","translate(200 10) rotate(0)",1,"pointer"]],template:function(t,i){t&1&&(E(0,"div",2),ie(),E(1,"svg",3)(2,"defs")(3,"linearGradient",4),Q(4,"stop",5)(5,"stop",6)(6,"stop",7),O(),E(7,"filter",8),Q(8,"feGaussianBlur",9),E(9,"feSpecularLighting",10),Q(10,"fePointLight",11)(11,"fePointLight",12),O(),Q(12,"feComposite",13)(13,"feComposite",14),O()(),Q(14,"path",15)(15,"path",16)(16,"path",17)(17,"path",18,0),E(19,"g",19),Ae(20,NC,1,5,":svg:line",null,Ne),O(),E(22,"g",19),Ae(23,OC,1,5,":svg:line",20,Ne),O(),E(25,"g",21),Ae(26,RC,2,3,":svg:text",null,Ne),O(),E(28,"g",22),Q(29,"ellipse",23),O(),E(30,"text",24),c(31),O()(),E(32,"svg",25)(33,"g",26)(34,"text",27),c(35),E(36,"tspan",28),c(37),O()(),Q(38,"path",29)(39,"path",30)(40,"path",31)(41,"path",32,1),E(43,"g",19),Ae(44,VC,1,5,":svg:line",null,Ne),O(),E(46,"g",19),Ae(47,LC,1,5,":svg:line",20,Ne),O(),E(49,"g",21),Ae(50,WC,2,3,":svg:text",null,Ne),O(),E(52,"g",33),Q(53,"ellipse",23),O()()()()),t&2&&(f(20),ye(i.fineTicks()),f(3),ye(i.fineInnerTicks()),f(3),ye(i.fineLabels()),f(2),xe("transition",i.ready()?i.pointerTransition():"none")("transform",i.finePointerTransform()),dt("ready",i.ready()),f(),J("fill",i.themeColorValue()),f(2),K(i.displayName()),f(3),J("fill",i.themeColorValue()),f(),fe(" ",i.displayValue(),"\xB0 "),f(2),K(i.angleSide()),f(7),ye(i.coarseTicks()),f(3),ye(i.coarseInnerTicks()),f(3),ye(i.coarseLabels()),f(2),xe("transition",i.ready()?i.pointerTransition():"none")("transform",i.coarsePointerTransform()),dt("ready",i.ready()),f(),J("fill",i.themeColorValue()))},styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;font-family:Roboto}.container[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;justify-content:center;height:100%;width:100%;box-sizing:border-box;gap:0px}.brand[_ngcontent-%COMP%]{font-size:25px;font-weight:700;fill:var(--kip-contrast-dim-color)}.angle[_ngcontent-%COMP%]{font-size:50px;font-weight:700}.side[_ngcontent-%COMP%]{font-size:16px}svg.scale[_ngcontent-%COMP%]{width:100%;height:auto}svg.scale[_ngcontent-%COMP%] .tube-background[_ngcontent-%COMP%]{fill:var(--mat-sys-surface-container);filter:url(#tubeEffect)}svg.scale[_ngcontent-%COMP%] .tube-highlight[_ngcontent-%COMP%]{fill:url(#fineTubeGradient);opacity:.15;mix-blend-mode:soft-light;transition:fill .3s ease,opacity .3s ease}svg.scale[_ngcontent-%COMP%] .tube-highlight-secondary[_ngcontent-%COMP%]{fill:url(#fineTubeGradient);opacity:.2;mix-blend-mode:overlay;transition:fill .3s ease,opacity .3s ease}.tube-highlight-color[_ngcontent-%COMP%]{stop-color:var(--kip-contrast-color)}.opacity1[_ngcontent-%COMP%]{stop-opacity:.12}.opacity2[_ngcontent-%COMP%]{stop-opacity:.05}.opacity3[_ngcontent-%COMP%]{stop-opacity:0}svg.scale[_ngcontent-%COMP%] .scale-line[_ngcontent-%COMP%]{stroke:none;fill:none}.tick-marks[_ngcontent-%COMP%]{stroke:var(--kip-contrast-dim-color)}.scale-values[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);text-anchor:middle;dominant-baseline:hanging;font-size:12;font-weight:700}.pointer[_ngcontent-%COMP%] ellipse[_ngcontent-%COMP%]{stroke:#ffffff59;stroke-width:.7;paint-order:stroke fill;filter:drop-shadow(0 0 1px rgba(0,0,0,.55)) drop-shadow(0 1px 1.5px rgba(0,0,0,.55)) drop-shadow(0 -1px 1px rgba(255,255,255,.25));transition:filter .25s,stroke .25s}"],changeDetection:0})}return n})();var FC=["gaugeCanvas"];typeof steelseries>"u"&&(globalThis.steelseries={BackgroundColor:{DARK_GRAY:"darkGray",SATIN_GRAY:"satinGray",LIGHT_GRAY:"lightGray",WHITE:"white",BLACK:"black",BEIGE:"beige",BROWN:"brown",RED:"red",GREEN:"green",BLUE:"blue",ANTHRACITE:"anthracite",MUD:"mud",PUNCHED_SHEET:"punchedSheet",CARBON:"carbon",STAINLESS:"stainless",BRUSHED_METAL:"brushedMetal",BRUSHED_STAINLESS:"brushedStainless",TURNED:"turned"},FrameDesign:{BLACK_METAL:"blackMetal",METAL:"metal",SHINY_METAL:"shinyMetal",BRASS:"brass",STEEL:"steel",CHROME:"chrome",GOLD:"gold",ANTHRACITE:"anthracite",TILTED_GRAY:"tiltedGray",TILTED_BLACK:"tiltedBlack",GLOSSY_METAL:"glossyMetal"}});var fd={darkGray:steelseries.BackgroundColor.DARK_GRAY,satinGray:steelseries.BackgroundColor.SATIN_GRAY,lightGray:steelseries.BackgroundColor.LIGHT_GRAY,white:steelseries.BackgroundColor.WHITE,black:steelseries.BackgroundColor.BLACK,beige:steelseries.BackgroundColor.BEIGE,brown:steelseries.BackgroundColor.BROWN,red:steelseries.BackgroundColor.RED,green:steelseries.BackgroundColor.GREEN,blue:steelseries.BackgroundColor.BLUE,anthracite:steelseries.BackgroundColor.ANTHRACITE,mud:steelseries.BackgroundColor.MUD,punchedSheet:steelseries.BackgroundColor.PUNCHED_SHEET,carbon:steelseries.BackgroundColor.CARBON,stainless:steelseries.BackgroundColor.STAINLESS,brushedMetal:steelseries.BackgroundColor.BRUSHED_METAL,brushedStainless:steelseries.BackgroundColor.BRUSHED_STAINLESS,turned:steelseries.BackgroundColor.TURNED},vd={blackMetal:steelseries.FrameDesign.BLACK_METAL,metal:steelseries.FrameDesign.METAL,shinyMetal:steelseries.FrameDesign.SHINY_METAL,brass:steelseries.FrameDesign.BRASS,steel:steelseries.FrameDesign.STEEL,chrome:steelseries.FrameDesign.CHROME,gold:steelseries.FrameDesign.GOLD,anthracite:steelseries.FrameDesign.ANTHRACITE,tiltedGray:steelseries.FrameDesign.TILTED_GRAY,tiltedBlack:steelseries.FrameDesign.TILTED_BLACK,glossyMetal:steelseries.FrameDesign.GLOSSY_METAL},Yp=(()=>{class n{unitsService=y(it);canvasService=y(ht);canvasRef=he("gaugeCanvas");widgetUUID=x(void 0);subType=x(void 0);barGauge=x(void 0);radialSize=x(void 0);backgroundColor=x(void 0);frameColor=x(void 0);minValue=x(void 0);maxValue=x(void 0);decimals=x(void 0);zones=x(void 0);title=x(void 0);units=x(void 0);value=x(void 0);theme=x(void 0,{alias:"themeColors"});gaugeStarted=!1;gauge;gaugeOptions={};paddingTop=0;lastSizeSignature="";resizeTimer=null;pendingStructuralRebuild=!1;ngOnInit(){this.buildOptions()}buildOptions(){this.gaugeOptions.minValue=this.minValue(),this.gaugeOptions.maxValue=this.maxValue();let e=this.decimals();this.gaugeOptions.lcdDecimals=e??2,this.gaugeOptions.titleString=this.title(),this.gaugeOptions.unitString=this.units(),this.subType()=="radial"&&(this.gaugeOptions.gaugeType=this.setGaugeType(this.radialSize()));let t=this.zones();if(t){let i=[],a=[],r=[...t].sort((s,l)=>s.lower-l.lower);for(let s of r){let l=null,m=null,g;switch(s.state){case ve.Emergency:g=this.theme().zoneEmergency;break;case ve.Alarm:g=this.theme().zoneAlarm;break;case ve.Warn:g=this.theme().zoneWarn;break;case ve.Alert:g=this.theme().zoneAlert;break;case ve.Nominal:g=this.theme().zoneNominal;break;default:g="rgba(0,0,0,0)"}let v=this.units();if(v=="ratio"?(l=s.lower,m=s.upper):(l=this.unitsService.convertToUnit(v,s.lower),m=this.unitsService.convertToUnit(v,s.upper)),!(m<this.minValue()||l>this.maxValue())){if(l=l!==null?l:this.minValue(),m=m!==null?m:this.maxValue(),l=Math.max(l,this.minValue()),m>this.maxValue()){m=this.maxValue(),i.push(steelseries.Section(l,m,g));break}i.push(steelseries.Section(l,m,g))}}this.gaugeOptions.section=i,this.gaugeOptions.area=a,this.gaugeOptions.useSectionColors=!0}fd[this.backgroundColor()]&&(this.gaugeOptions.backgroundColor=fd[this.backgroundColor()]),vd[this.frameColor()]&&(this.gaugeOptions.frameDesign=vd[this.frameColor()]),this.barGauge()&&(this.gaugeOptions.valueColor=steelseries.ColorDef.GREEN),this.gaugeOptions.lcdVisible=!0,this.gaugeOptions.thresholdVisible=!1,this.gaugeOptions.threshold=this.maxValue(),this.gaugeOptions.ledVisible=!1}setGaugeType(e){switch(e){case"quarter":return steelseries.GaugeType.TYPE1;case"half":return steelseries.GaugeType.TYPE2;case"three-quarter":return steelseries.GaugeType.TYPE3;default:return steelseries.GaugeType.TYPE4}}startGauge(e=!1){this.buildOptions();let t=this.widgetUUID();if(!t)return;let i=e||this.pendingStructuralRebuild;if(this.gauge&&!i){this.gauge.setValueAnimated&&this.value()!=null,this.gaugeStarted=!0;return}this.pendingStructuralRebuild=!1,this.gaugeStarted=!0;let a=this.subType();a==="radial"?this.gauge=new steelseries.Radial(t,this.gaugeOptions):a==="linear"&&(this.barGauge()?this.gauge=new steelseries.LinearBargraph(t,this.gaugeOptions):this.gauge=new steelseries.Linear(t,this.gaugeOptions))}onResized(e){if(e.contentRect.height<50||e.contentRect.width<50)return;let t;if(this.subType()==="radial"){let i=Math.floor(Math.min(e.contentRect.height,e.contentRect.width));this.gaugeOptions.size=i,t="radial:"+i}else{let i=Math.floor(e.contentRect.width),a=Math.floor(e.contentRect.height);this.gaugeOptions.width=i,this.gaugeOptions.height=a,t=`linear:${i}x${a}`}t!==this.lastSizeSignature&&(this.lastSizeSignature=t,this.resizeTimer&&window.clearTimeout(this.resizeTimer),this.resizeTimer=window.setTimeout(()=>{this.startGauge(!0),this.resizeTimer=null},120))}ngOnChanges(e){this.gaugeStarted&&(e.value&&!e.value.firstChange&&this.gauge.setValueAnimated(e.value.currentValue),e.zones&&(this.pendingStructuralRebuild=!0,this.startGauge(!0)),e.title&&this.gauge.setTitleString(e.title.currentValue),e.backgroundColor&&this.gauge.setBackgroundColor(fd[e.backgroundColor.currentValue]),e.frameColor&&this.gauge.setFrameDesign(vd[e.frameColor.currentValue]),e.radialSize&&(this.pendingStructuralRebuild=!0,this.startGauge(!0)),e.minValue&&this.gauge.setMinValue(e.minValue.currentValue),e.maxValue&&this.gauge.setMaxValue(e.maxValue.currentValue))}ngOnDestroy(){if(this.gauge&&this.gauge.setValue){let t=this.gauge.getValue?this.gauge.getValue():this.value();this.gauge.setValue(t)}let e=this.widgetUUID();if(e){let t=document.getElementById(e);this.canvasService.releaseCanvas(t,{clear:!0,removeFromDom:!0})}this.gauge=null}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["gauge-steel"]],viewQuery:function(t,i){t&1&&Me(i.canvasRef,FC,5),t&2&&ke()},inputs:{widgetUUID:[1,"widgetUUID"],subType:[1,"subType"],barGauge:[1,"barGauge"],radialSize:[1,"radialSize"],backgroundColor:[1,"backgroundColor"],frameColor:[1,"frameColor"],minValue:[1,"minValue"],maxValue:[1,"maxValue"],decimals:[1,"decimals"],zones:[1,"zones"],title:[1,"title"],units:[1,"units"],value:[1,"value"],theme:[1,"themeColors","theme"]},features:[Qi],decls:4,vars:2,consts:[["gaugeCanvas",""],["kipResizeObserver","",1,"wrapper",3,"resizeChange"],[2,"z-index","inherit",3,"id"]],template:function(t,i){t&1&&(d(0,"div",1),U("resizeChange",function(r){return i.onResized(r)}),d(1,"canvas",2,0),c(3," Browser does not support canvas element. "),u()()),t&2&&(f(),R("id",Fi(i.widgetUUID())))},dependencies:[Xt],styles:[".sgWrapper[_ngcontent-%COMP%]{height:100%;width:100%;text-align:center}"],changeDetection:0})}return n})();var Zp=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);metadata=y(mi);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{type:"linear",lower:0,upper:100},gauge:{type:"steel",subType:"radial",backgroundColor:"carbon",faceColor:"anthracite",radialSize:"full",rotateFace:!1,digitalMeter:!1},numDecimal:2,enableTimeout:!1,dataTimeout:5,ignoreZones:!1};dataValue=w(0);zones=w([]);displayName=X(()=>this.runtime.options()?.displayName||"Gauge Label");constructor(){L(()=>{let e=this.runtime.options();!e||!e.paths?.gaugePath?.path||G(()=>this.streams.observe("gaugePath",i=>{let a=i?.data?.value,r=e.displayScale?.lower??0,s=e.displayScale?.upper??r+100;if(a==null)this.dataValue.set(r);else{let l=Math.min(Math.max(a,r),s);this.dataValue.set(l)}}))}),L(()=>{let e=this.runtime.options();if(!e)return;if(e.ignoreZones){this.zones.set([]);return}if(!e.paths?.gaugePath?.path){this.zones.set([]);return}G(()=>this.metadata.observe("gaugePath")),this.zones.set(this.metadata.zones())})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-gauge-steel"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:14,consts:[[1,"wrapper"],[3,"widgetUUID","subType","barGauge","radialSize","backgroundColor","frameColor","minValue","maxValue","decimals","zones","title","units","value","themeColors"]],template:function(t,i){if(t&1&&(d(0,"div",0),W(1,"gauge-steel",1),u()),t&2){let a,r,s,l,m,g,v,A,C;f(),R("widgetUUID",i.id())("subType",(a=i.runtime.options())==null||a.gauge==null?null:a.gauge.subType)("barGauge",(r=i.runtime.options())==null||r.gauge==null?null:r.gauge.digitalMeter)("radialSize",(s=i.runtime.options())==null||s.gauge==null?null:s.gauge.radialSize)("backgroundColor",(l=i.runtime.options())==null||l.gauge==null?null:l.gauge.backgroundColor)("frameColor",(m=i.runtime.options())==null||m.gauge==null?null:m.gauge.faceColor)("minValue",(g=i.runtime.options())==null||g.displayScale==null?null:g.displayScale.lower)("maxValue",(v=i.runtime.options())==null||v.displayScale==null?null:v.displayScale.upper)("decimals",(A=i.runtime.options())==null?null:A.numDecimal)("zones",i.zones())("title",i.displayName())("units",(C=i.runtime.options())==null||C.paths==null||C.paths.gaugePath==null?null:C.paths.gaugePath.convertUnitTo)("value",i.dataValue())("themeColors",i.theme())}},dependencies:[Yp],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}gauge-steel[_ngcontent-%COMP%]{display:block;position:relative;width:100%;height:100%} .wrapper{display:block;position:relative;width:100%;height:100%;padding:10px} .wrapper>canvas{display:block;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}"],changeDetection:0})}return n})();var na=Xd(bd(),1),Jp=Xd(bd(),1);var GC=["gauge"],BC=n=>n.replace(/(\-\w)/g,o=>o[1].toUpperCase()),zC=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xp=n=>BC(n),Qp=(()=>{class n{el;zone;canvas;gauge;isInited=!1;preInitValue;preInitOptions;domListener;constructor(e,t){this.el=e,this.zone=t}get options(){let e={};e.renderTo=this.canvas.nativeElement;for(let t of this.el.nativeElement.attributes){let i=Xp(t.name);e[i]=na.DomObserver.parse(t.value)}for(let t in this.preInitOptions)e[t]=this.preInitOptions[t];return this.isInited&&(this.preInitOptions=null),e}set options(e){if(!this.isInited){this.preInitOptions=e;return}this.update(e)}set value(e){if(!this.isInited){this.preInitValue=e;return}this.zone.runOutsideAngular(()=>{this.gauge.value=e})}update(e){if(e)for(let t in e){let i=e[t].toString();if(t==="value")this.value=na.DomObserver.parse(i);else{let a=zC(t);this.el.nativeElement.setAttribute(a,i)}}}ngOnDestroy(){this.destroy(),this.cleanup()}cleanup(){}destroy(){this.stopListeningForDOMEvents(),this.gauge.destroy()}ngAfterViewInit(){this.initGauge(),this.listenForDOMEvents(),this.isInited=!0,this.preInitValue&&(this.value=this.preInitValue)}listenForDOMEvents(){this.domListener=new MutationObserver(e=>{let t={};e.forEach(i=>{i.type==="attributes"&&(t[Xp(i.attributeName)]=na.DomObserver.parse(this.el.nativeElement.getAttribute(i.attributeName)))}),this.basicUpdate(t)}),this.domListener.observe(this.el.nativeElement,{attributes:!0})}stopListeningForDOMEvents(){this.domListener&&(this.domListener.disconnect(),this.domListener=null)}initGauge(){let e=this.options;(!e.hasOwnProperty("renderTo")||!e.renderTo)&&(e.renderTo=this.canvas.nativeElement),this.basicUpdate(e)}basicUpdate(e){typeof e.value=="number"&&(this.value=e.value,delete e.value),Object.keys(e).length&&this.gauge.update(e)}static \u0275fac=function(t){return new(t||n)(pa(Ke),pa(qe))};static \u0275dir=Lt({type:n,viewQuery:function(t,i){if(t&1&&Nn(GC,7),t&2){let a;xi(a=Ci())&&(i.canvas=a.first)}},inputs:{options:"options",value:"value"}})}return n})();var Kp=(()=>{class n extends Qp{constructor(e,t){super(e,t)}ngOnInit(){this.gauge=new na.LinearGauge(this.options).draw()}static \u0275fac=function(t){return new(t||n)(pa(Ke),pa(qe))};static \u0275cmp=H({type:n,selectors:[["linear-gauge"]],features:[Wo],decls:2,vars:0,consts:[["gauge",""]],template:function(t,i){t&1&&W(0,"canvas",null,0)},encapsulation:2})}return n})();var il=(()=>{class n extends Qp{constructor(e,t){super(e,t)}ngOnInit(){this.gauge=new na.RadialGauge(this.options).draw()}static \u0275fac=function(t){return new(t||n)(pa(Ke),pa(qe))};static \u0275cmp=H({type:n,selectors:[["radial-gauge"]],features:[Wo],decls:2,vars:0,consts:[["gauge",""]],template:function(t,i){t&1&&W(0,"canvas",null,0)},encapsulation:2})}return n})(),xo=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ki({type:n});static \u0275inj=Xi({})}return n})();function nl(n,o,e=!1){let t=[],i=o-n,a=0,r=10;i=eg(o-n,!1),a=eg(i/(r-1),!0);let s=Math.floor(n/a)*a,l=Math.ceil(o/a)*a;t.push(s);let m=i/a;for(let g=0;g<m;g++)if(t[g]<l){let v=(Number(t[g].toFixed(2))*100+Number(a.toFixed(2))*100)/100;t.push(v)}if(t[t.length-1]!==l&&t.push(l),e){let g=[...t].reverse();return{min:s,max:l,majorTicks:g}}return{min:s,max:l,majorTicks:t}}function eg(n,o){let e=Math.floor(Math.log10(n)),t=n/Math.pow(10,e),i=null;return o?1.5>t?i=1:3>t?i=2:7>t?i=5:i=10:1>=t?i=1:2>=t?i=2:5>=t?i=5:i=10,i*Math.pow(10,e)}var tg=["radialGauge"];function UC(n,o){if(n&1){let e=we();d(0,"radial-gauge",2,0),U("resizeChange",function(i){ee(e);let a=k();return te(a.onResized(i))}),u()}if(n&2){let e=k();R("options",e.gaugeOptions)("value",e.value()),J("value-text",e.textValue())}}var ig=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);metadata=y(mi);unitsService=y(it);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{lower:0,upper:100,type:"linear"},gauge:{type:"ngRadial",subType:"measuring",highlightsWidth:5,scaleStart:180,barStartPosition:"left",enableTicks:!0,enableProgressbar:!0,enableNeedle:!0},numInt:1,numDecimal:0,enableTimeout:!1,color:"contrast",dataTimeout:5,ignoreZones:!1};LINE="line";ANIMATION_TARGET_NEEDLE="needle";ngGauge=he("radialGauge");gauge=he("radialGauge",{read:Ke});value=w(void 0);shouldRenderGauge=X(()=>this.value()!==void 0);textValue=w("--");colorStrokeTicks=w("");gaugeBootstrapped=w(!1);animationEnabled=X(()=>this.gaugeBootstrapped());adjustedScale=X(()=>{let e=this.runtime.options();return e?e.gauge?.subType==="capacity"?{min:e.displayScale?.lower??0,max:e.displayScale?.upper??100,majorTicks:[]}:nl(e.displayScale?.lower??0,e.displayScale?.upper??100,e.gauge?.barStartPosition==="right"):{min:0,max:100,majorTicks:[]}});highlights=X(()=>{let e=this.metadata.zones(),t=this.runtime.options(),i=this.theme();if(!e?.length)return[];if(!t||!i)return[];if(t.ignoreZones)return[];if(t.gauge?.subType!=="measuring")return[];let a=t.paths?.gaugePath,r=this.adjustedScale(),s=t.gauge?.barStartPosition==="right";return go(e,i,a.convertUnitTo,this.unitsService,r.min,r.max,s)});displayName=X(()=>this.runtime.options()?.displayName);pathDataState=w(null);viewReady=w(!1);gaugeOptions={};constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||e.paths?.gaugePath.path&&G(()=>this.streams.observe("gaugePath",i=>{i.state!==this.pathDataState()&&this.pathDataState.set(i.state||null);let a=i?.data?.value??null;if(a==null)this.value.set(e.displayScale?.lower??0),this.textValue.set("--");else{let r=e.displayScale?.lower??0,s=e.displayScale?.upper??100,l=Math.min(Math.max(a,r),s);this.value.set(l),this.textValue()==="--"&&this.textValue.set("")}}))}),L(()=>{let e=this.runtime.options();!e||e.ignoreZones||G(()=>this.metadata.observe("gaugePath"))}),L(()=>{let e=this.highlights();this.viewReady()&&G(()=>{try{if(!e.length)this.ngGauge()?.update({highlights:[]});else{let t=JSON.stringify(e);this.ngGauge()?.update({highlights:t,highlightsWidth:this.runtime.options().gauge?.highlightsWidth})}}catch(t){}})}),L(()=>{let e=this.theme(),t=this.adjustedScale();G(()=>{if(this.buildGaugeOptions(this.runtime.options(),e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions)}catch(i){}})}),L(()=>{let e=this.ngGauge();!e||this.gaugeBootstrapped()||G(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{e.update({animation:!0,animatedValue:!0})}catch(t){}})}catch(t){}})}),L(()=>{let e=this.pathDataState();this.viewReady()&&G(()=>{let t=this.runtime.options(),i=this.theme();if(t.ignoreZones)return;let a={};switch(e){case ve.Alarm:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=i.zoneAlarm,a.colorValueText=i.zoneAlarm;break;case ve.Warn:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=i.zoneWarn,a.colorValueText=i.zoneWarn;break;case ve.Alert:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=i.zoneAlert,a.colorValueText=i.zoneAlert;break;default:a.colorBorderMiddle=i.cardColor,a.colorBarProgress=t.gauge?.subType==="measuring"?Te(t.color,i).color:Te(t.color,i).dim,a.colorValueText=Te(t.color,i).color}try{this.ngGauge()?.update(a)}catch(r){}})})}ngAfterViewInit(){this.viewReady.set(!0),this.setCanvasSize();try{this.ngGauge()?.update(this.gaugeOptions)}catch(e){}}onResized(e){let t={height:e.contentRect.height,width:e.contentRect.width};try{this.ngGauge()?.update(t)}catch(i){}}setCanvasSize(){let e=this.gauge()?.nativeElement;if(!e)return;let t=e.getBoundingClientRect(),i={height:t.height,width:t.width};try{this.ngGauge()?.update(i)}catch(a){}}buildGaugeOptions(e,t,i){let a={};a.title=this.displayName(),a.minValue=i.min,a.maxValue=i.max,a.units=e.paths?.gaugePath?.convertUnitTo,a.highlights=[];let r=this.highlights();r.length&&(a.highlights=JSON.stringify(r),a.highlightsWidth=e.gauge?.highlightsWidth),a.fontTitle="Roboto",a.fontTitleWeight="bold",a.fontUnits="Roboto",a.fontUnitsSize=25,a.fontUnitsWeight="normal",a.barStrokeWidth=0,a.barShadow=0,a.colorBarStroke="",a.fontValue="Roboto",a.fontValueWeight="bold",a.valueTextShadow=!1,a.colorValueBoxShadow="",a.fontNumbers="Roboto",a.fontNumbersWeight="bold",a.valueInt=e.numInt??1,a.valueDec=e.numDecimal??2,a.majorTicksInt=a.valueInt,a.majorTicksDec=a.valueDec,a.highlightsWidth=e.gauge?.highlightsWidth,a.animation=this.animationEnabled(),a.animateOnInit=!1,a.animatedValue=this.animationEnabled(),a.animationRule="linear";let s=e.paths?.gaugePath?.sampleTime??500;a.animationDuration=s-25,a.colorBorderShadow=!1,a.colorBorderOuter=t.cardColor,a.colorBorderOuterEnd="",a.colorBorderMiddle=t.cardColor,a.colorBorderMiddleEnd="",a.colorPlate=a.colorPlateEnd=t.cardColor,a.colorBar=t.background,a.barProgress=e.gauge?.enableProgressbar,a.colorBarProgress=Te(e.color,t).color,a.colorNeedle=Te(e.color,t).color,a.colorNeedleEnd=Te(e.color,t).color,a.needleShadow=!0,a.colorNeedleShadowUp="black",a.colorNeedleShadowDown="black",a.colorNeedleCircleInner=a.colorPlate,a.colorNeedleCircleInnerEnd=a.colorPlate,a.colorNeedleCircleOuter=a.colorPlate,a.colorNeedleCircleOuterEnd=a.colorPlate,a.colorTitle=t.contrastDim,a.colorUnits=t.contrastDim,a.colorValueText=Te(e.color,t).color,this.colorStrokeTicks.set(t.contrastDim),a.colorMinorTicks=t.contrastDim,a.animationTarget=this.ANIMATION_TARGET_NEEDLE,a.useMinPath=!1,e.gauge?.subType==="capacity"?(a.fontTitleSize=40,a.valueBox=!0,a.fontValueSize=60,a.valueBoxWidth=10,a.valueBoxBorderRadius=5,a.valueBoxStroke=0,a.colorValueBoxBackground="",a.colorMajorTicks=a.colorPlate,a.colorNumbers=a.colorMinorTicks="",a.barWidth=20,a.colorBarProgress=Te(e.color,t).dim,a.needle=e.gauge.enableNeedle,a.needleType=this.LINE,a.needleWidth=2,a.needleStart=75,a.needleEnd=95,a.needleCircleSize=1,a.needleCircleInner=!1,a.needleCircleOuter=!1,a.ticksAngle=360,a.startAngle=e.gauge?.scaleStart||180,a.majorTicks=0,a.exactTicks=!0,a.strokeTicks=!1,a.minorTicks=0,a.numbersMargin=0,a.fontNumbersSize=0,a.borders=!0,a.borderOuterWidth=2,a.borderMiddleWidth=1,a.borderInnerWidth=0,a.borderShadowWidth=0):(a.fontTitleSize=24,a.barWidth=15,a.valueBox=!0,a.fontValueSize=60,a.valueBoxWidth=100,a.valueBoxBorderRadius=0,a.valueBoxStroke=0,a.colorValueBoxBackground="",a.needle=e.gauge.enableNeedle,a.needleType=this.LINE,a.needleWidth=2,a.needleStart=0,a.needleEnd=95,a.needleCircleSize=10,a.needleCircleInner=!1,a.needleCircleOuter=!1,a.ticksAngle=270,a.startAngle=45,a.barStartPosition=e.gauge?.barStartPosition||"left",e.gauge.enableTicks?(a.strokeTicks=!0,a.majorTicks=i.majorTicks,a.minorTicks=2,a.exactTicks=!1,a.numbersMargin=3,a.fontNumbersSize=15,a.colorMajorTicks=t.contrastDim,a.colorNumbers=t.contrastDim):(a.strokeTicks=!1,a.majorTicks=0,a.minorTicks=0,a.exactTicks=!0,a.numbersMargin=0,a.fontNumbersSize=0,a.colorMajorTicks=a.colorPlate,a.colorNumbers=a.colorMinorTicks=""),a.borders=!0,a.borderOuterWidth=2,a.borderMiddleWidth=1,a.borderInnerWidth=0,a.borderShadowWidth=0,a.animationTarget=this.ANIMATION_TARGET_NEEDLE,a.useMinPath=!1),this.gaugeOptions=a}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-gauge-ng-radial"]],viewQuery:function(t,i){t&1&&Me(i.ngGauge,tg,5)(i.gauge,tg,5,Ke),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:1,consts:[["radialGauge",""],["kipResizeObserver","",3,"options","value"],["kipResizeObserver","",3,"resizeChange","options","value"]],template:function(t,i){t&1&&I(0,UC,2,3,"radial-gauge",1),t&2&&N(i.shouldRenderGauge()?0:-1)},dependencies:[Xt,xo,il],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%} radial-gauge{display:block;position:relative;width:100%;min-width:8px;height:100%;overflow:clip} radial-gauge>canvas{display:block;position:absolute;height:100%;width:100%;left:50%;top:50%;transform:translate(-50%,-50%);padding:0}"],changeDetection:0})}return n})();var ng=["linearGauge"];function HC(n,o){if(n&1){let e=we();d(0,"linear-gauge",2,0),U("resizeChange",function(i){ee(e);let a=k();return te(a.onResized(i))}),u()}if(n&2){let e=k();R("options",e.gaugeOptions)("value",e.value()),J("value-text",e.textValue())}}var ag=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);metadata=y(mi);unitsService=y(it);static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,convertUnitTo:"unitless",sampleTime:500}},displayScale:{lower:0,upper:100,type:"linear"},gauge:{type:"ngLinear",subType:"vertical",highlightsWidth:5,enableTicks:!0,enableNeedle:!1},numInt:1,numDecimal:0,color:"contrast",enableTimeout:!1,dataTimeout:5,ignoreZones:!1};ngGauge=he("linearGauge");gauge=he("linearGauge",{read:Ke});textValue=w("--");value=w(void 0);shouldRenderGauge=X(()=>this.value()!==void 0);gaugeOptions={};viewReady=w(!1);gaugeBootstrapped=w(!1);animationEnabled=X(()=>this.gaugeBootstrapped());currentState=w(ve.Normal);adjustedScale=X(()=>{let e=this.runtime.options();return e?e.gauge?.enableTicks?nl(e.displayScale.lower,e.displayScale.upper):{min:e.displayScale.lower,max:e.displayScale.upper,majorTicks:[]}:{min:0,max:100,majorTicks:[]}});highlights=X(()=>{let e=this.metadata.zones(),t=this.runtime.options(),i=this.theme();return e?.length?!t||!i?[]:t.ignoreZones?[]:t.paths?.gaugePath?go(e,i,t.paths.gaugePath.convertUnitTo,this.unitsService,this.adjustedScale().min,this.adjustedScale().max):[]:[]});displayName=X(()=>this.runtime.options()?.displayName||"Gauge Label");constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||e.paths?.gaugePath.path&&G(()=>this.streams.observe("gaugePath",i=>{let a=i?.data?.value??null;if(a==null)this.value.set(e.displayScale.lower),this.textValue.set("--");else{let r=Math.min(Math.max(a,e.displayScale.lower),e.displayScale.upper);this.value.set(r),this.textValue()==="--"&&this.textValue.set("")}i.state!==this.currentState()&&this.currentState.set(i.state)}))}),L(()=>{let e=this.runtime.options();!e||e.ignoreZones||G(()=>this.metadata.observe("gaugePath"))}),L(()=>{let e=this.highlights();this.viewReady()&&G(()=>{try{if(!e.length)this.ngGauge()?.update({highlights:[]});else{let t=JSON.stringify(e);this.ngGauge()?.update({highlights:t,highlightsWidth:this.runtime.options().gauge?.highlightsWidth})}}catch(t){}})}),L(()=>{let e=this.theme(),t=this.adjustedScale();G(()=>{if(this.buildGaugeOptions(this.runtime.options(),e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions),this.applyInitialSize()}catch(i){}})}),L(()=>{let e=this.ngGauge();!e||this.gaugeBootstrapped()||G(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{e.update({animation:!0,animatedValue:!0})}catch(t){}})}catch(t){}})}),L(()=>{let e=this.currentState();this.viewReady()&&G(()=>{let t=this.runtime.options(),i=this.theme();if(t.ignoreZones)return;let a={},r=t.gauge?.enableNeedle,s=Te(t.color,i);switch(e){case ve.Alarm:r?(a.colorNeedle=i.zoneAlarm,a.colorValueText=i.zoneAlarm):(a.colorBarProgress=i.zoneAlarm,a.colorValueText=i.zoneAlarm);break;case ve.Warn:r?(a.colorNeedle=i.zoneWarn,a.colorValueText=i.zoneWarn):(a.colorBarProgress=i.zoneWarn,a.colorValueText=i.zoneWarn);break;case ve.Alert:r?(a.colorNeedle=i.zoneAlert,a.colorValueText=i.zoneAlert):(a.colorBarProgress=i.zoneAlert,a.colorValueText=i.zoneAlert);break;default:r?(a.colorNeedle=s.color,a.colorValueText=s.color):(a.colorBarProgress=s.color,a.colorValueText=s.color)}try{this.ngGauge()?.update(a)}catch(l){}})})}buildGaugeOptions(e,t,i){let a=this.gaugeOptions={},r=e.gauge?.subType==="vertical",s=e.gauge?.enableNeedle,l=e.gauge?.enableTicks;a.minValue=i.min,a.maxValue=i.max,a.valueInt=e.numInt??1,a.valueDec=e.numDecimal??2,a.title=this.displayName(),a.fontTitleSize=40,a.fontTitle="Roboto",a.fontTitleWeight="bold",a.barLength=r?80:90,a.barWidth=l?s?0:30:60,a.barProgress=!0,a.barBeginCircle=0,a.barStrokeWidth=0,a.barShadow=0,a.needle=!!s,a.needleType=s?"arrow":"line",a.needleStart=s?r?200:155:-45,a.needleEnd=s?r?175:180:55,a.needleShadow=!0,a.needleSide="both",a.units=e.paths?.gaugePath?.convertUnitTo,a.fontUnits="Roboto",a.fontUnitsWeight="normal",a.borders=!1,a.borderOuterWidth=0,a.borderMiddleWidth=0,a.borderInnerWidth=0,a.borderShadowWidth=0,a.borderRadius=0,a.valueBox=!0,a.valueBoxWidth=35,a.valueBoxStroke=0,a.valueBoxBorderRadius=10,a.colorValueBoxRect="",a.colorValueBoxRectEnd="",a.colorValueBoxShadow="",a.fontValueSize=50,a.fontValue="Roboto",a.fontValueWeight="bold",a.valueTextShadow=!1,a.fontNumbers="Roboto",a.fontNumbersWeight="normal",a.fontUnitsSize=r?40:35,a.colorTitle=Te("contrast",t).dim,a.colorUnits=Te("contrast",t).dim,a.colorValueBoxBackground=t.background;let m=Te(e.color,t);a.colorValueText=m.color,s?(a.colorNeedle=m.color,a.colorNeedleEnd=m.color,a.needleWidth=45,a.colorNeedleShadowUp=m.color,a.colorNeedleShadowDown=m.color):(a.colorBarProgress=m.color,a.colorBarProgressEnd="",a.needleWidth=0),a.colorPlate=t.cardColor,a.colorBar=t.background,a.colorBarEnd="",a.colorBarStroke="0",a.colorMajorTicks=Te("contrast",t).dim,a.colorMinorTicks=Te("contrast",t).dim,a.colorNumbers=Te("contrast",t).dim,a.majorTicks=l?i.majorTicks:[],a.majorTicksInt=e.numInt??1,a.majorTicksDec=e.numDecimal??2,a.strokeTicks=!!l,a.minorTicks=l?2:0,a.ticksWidthMinor=l?6:0,a.numberSide=s?"right":"left",a.fontNumbersSize=l?r?22:30:0,a.numbersMargin=r?s?-7:-3:s?-33:-5,a.ticksWidth=l?s&&r?15:10:0,a.ticksPadding=l?r?s?0:5:s?9:8:0,a.tickSide="left",a.animation=this.animationEnabled(),a.animationRule="linear",a.animatedValue=this.animationEnabled(),a.animateOnInit=!1,a.animationDuration=(e.paths?.gaugePath?.sampleTime??500)-25,a.highlights=[],a.highlightsWidth=e.gauge?.highlightsWidth;let g=this.highlights();g.length&&(a.highlights=JSON.stringify(g))}ngAfterViewInit(){this.viewReady.set(!0),this.applyInitialSize();try{this.ngGauge()?.update(this.gaugeOptions)}catch(e){}}applyInitialSize(){let e=this.gauge()?.nativeElement;if(!e)return;let t=e.getBoundingClientRect(),i=.3,a,r;this.runtime.options()?.gauge?.subType==="vertical"?(a=t.height,r=t.height*i):(r=t.width,a=t.width*i);let m={height:a,width:r};try{this.ngGauge()?.update(m)}catch(g){}}onResized(e){let t=this.runtime.options();if(!t)return;let i=.3,a=t.gauge?.subType==="vertical",r={};a?(r.height=e.contentRect.height,r.width=r.height*i,r.width>e.contentRect.width&&(r.width=e.contentRect.width,r.height=r.width/i)):(r.width=e.contentRect.width,r.height=r.width*i,r.height>e.contentRect.height&&(r.height=e.contentRect.height,r.width=r.height/i)),r.height=(r.height??0)-10;try{this.ngGauge()?.update(r)}catch(s){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-gauge-ng-linear"]],viewQuery:function(t,i){t&1&&Me(i.ngGauge,ng,5)(i.gauge,ng,5,Ke),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:1,consts:[["linearGauge",""],["kipResizeObserver","",1,"linearGauge",3,"options","value"],["kipResizeObserver","",1,"linearGauge",3,"resizeChange","options","value"]],template:function(t,i){t&1&&I(0,HC,2,3,"linear-gauge",1),t&2&&N(i.shouldRenderGauge()?0:-1)},dependencies:[Xt,xo,Kp],styles:["[_nghost-%COMP%]{width:100%;height:100%;display:block} linear-gauge{display:block;position:relative;width:100%;min-width:8px;height:100%;overflow:clip} linear-gauge>canvas{display:block;position:absolute;height:100%;width:100%;left:50%;top:50%;transform:translate(-50%,-50%);margin-top:5px}"],changeDetection:0})}return n})();var og=["compassGauge"];function qC(n,o){if(n&1){let e=we();d(0,"radial-gauge",2,0),U("resizeChange",function(i){ee(e);let a=k();return te(a.onResized(i))}),u()}if(n&2){let e=k();R("options",e.gaugeOptions)("value",e.value()),J("value-text",e.textValue())("color-stroke-ticks",e.colorStrokeTicks)}}function rg(n){let o=n.match(/(\d+(\.\d+)?|\.\d+)/g);if(!o||o.length<3)throw new Error("Invalid RGBA format");let[e,t,i,a=1]=o.map(Number),r=a===1?"":Math.round(a*255).toString(16).padStart(2,"0").toUpperCase();return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1).toUpperCase()+r}function $C(n){return n<0&&(n=360+n),n}var sg=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);static DEFAULT_CONFIG={displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",suppressBootstrapNull:!0,isPathConfigurable:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,convertUnitTo:"deg",sampleTime:500}},supportAutomaticHistoricalSeries:!0,gauge:{type:"ngRadial",subType:"baseplateCompass",enableTicks:!0,compassUseNumbers:!1,showValueBox:!1},enableTimeout:!1,color:"contrast",dataTimeout:5};LINE="line";NEEDLE_START=40;NEEDLE_END=100;NEEDLE_CIRCLE_SIZE=15;BORDER_MIDDLE_WIDTH=2;BORDER_INNER_WIDTH=2;ANIMATION_TARGET_PLATE="plate";ANIMATION_TARGET_NEEDLE="needle";textValue=w("--");value=w(void 0);shouldRenderGauge=X(()=>this.value()!==void 0);gaugeBootstrapped=w(!1);animationEnabled=X(()=>this.gaugeBootstrapped());ngGauge=he("compassGauge");gauge=he("compassGauge",{read:Ke});viewReady=w(!1);gaugeOptions={};colorStrokeTicks="";currentState=w(ve.Normal);lastAppliedState=null;negToPortPaths=["self.environment.wind.angleApparent","self.environment.wind.angleTrueGround","self.environment.wind.angleTrueWater","self.environment.wind.angleTrueWaterDamped","self.performance.beatAngle","self.performance.gybeAngle","self.performance.targetAngle","self.performance.optimumWindAngle"];displayName=X(()=>this.runtime.options()?.displayName);constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();if(!e||!t)return;let i=e.paths?.gaugePath;i?.path&&G(()=>this.streams.observe("gaugePath",a=>{let r=a?.data?.value??null;if(r==null)this.value.set(0),this.textValue.set("--");else{this.negToPortPaths.includes(i.path)&&(r=$C(r));let l=Math.min(Math.max(r,0),360);this.value.set(l),this.textValue.set(l.toFixed(0))}let s=a?.state??ve.Normal;s!==this.currentState()&&this.currentState.set(s)}))}),L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{if(this.buildGaugeOptions(e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions)}catch(i){}})}),L(()=>{let e=this.ngGauge();!e||this.gaugeBootstrapped()||G(()=>{try{requestAnimationFrame(()=>{this.gaugeBootstrapped.set(!0);try{e.update({animation:!0,animatedValue:!0})}catch(t){}})}catch(t){}})}),L(()=>{let e=this.runtime.options(),t=this.theme(),i=this.currentState();!e||!t||this.viewReady()&&i!==this.lastAppliedState&&G(()=>{let a={};switch(i){case ve.Emergency:a.colorValueText=t.zoneEmergency;break;case ve.Alarm:a.colorValueText=t.zoneAlarm;break;case ve.Warn:a.colorValueText=t.zoneWarn;break;case ve.Alert:a.colorValueText=t.zoneAlert;break;default:a.colorValueText=t.contrast;break}try{this.ngGauge()?.update(a)}catch(r){}this.lastAppliedState=i})})}buildGaugeOptions(e,t){let i=this.gaugeOptions={};i.title=this.displayName(),i.minValue=0,i.maxValue=360,i.units=e.paths?.gaugePath?.convertUnitTo||"",i.valueDec=e.numDecimal??0,i.valueInt=e.numInt??1,i.barProgress=!1,i.barWidth=0,i.valueBox=!!e.gauge?.showValueBox,i.fontValueSize=60,i.valueBoxWidth=30,i.valueBoxBorderRadius=10,i.valueBoxStroke=0,i.ticksAngle=360,i.startAngle=180,i.exactTicks=!1,i.strokeTicks="",i.majorTicks=e.gauge?.compassUseNumbers?["N","30","60","E","120","150","S","210","240","W","300","330","N"]:["N","NE","E","SE","S","SW","W","NW","N"],i.majorTicksDec=0,i.majorTicksInt=1,i.numbersMargin=5,i.fontNumbersSize=25,i.minorTicks=e.gauge?.compassUseNumbers?3:2,i.needle=!0,i.needleType=this.LINE,i.needleStart=this.NEEDLE_START,i.needleEnd=this.NEEDLE_END,i.needleCircleSize=this.NEEDLE_CIRCLE_SIZE,i.needleWidth=4,i.needleShadow=!1,i.needleCircleInner=!1,i.needleCircleOuter=!1,i.borders=!0,i.borderOuterWidth=0,i.borderMiddleWidth=this.BORDER_MIDDLE_WIDTH,i.borderInnerWidth=this.BORDER_INNER_WIDTH,i.borderShadowWidth=0,i.highlights=[],i.highlightsWidth=0,i.fontTitle="Roboto",i.fontTitleWeight="normal",i.fontTitleSize=25,i.fontUnits="Roboto",i.fontUnitsSize=25,i.fontUnitsWeight="normal",i.barStrokeWidth=0,i.barShadow=0,i.fontValue="Roboto",i.fontValueWeight="bold",i.valueTextShadow=!1,i.colorValueBoxShadow="",i.fontNumbers="Roboto",i.fontNumbersWeight="bold",e.gauge?.subType==="marineCompass"?(i.animationTarget=this.ANIMATION_TARGET_PLATE,i.useMinPath=!0):(i.animationTarget=this.ANIMATION_TARGET_NEEDLE,i.useMinPath=!0),i.animateOnInit=!1,i.animation=this.animationEnabled(),i.animatedValue=this.animationEnabled(),i.animationRule="linear",i.animationDuration=(e.paths?.gaugePath?.sampleTime??500)-50;let a=Te(e.color,t),r=rg(a.dim),s=rg(Te("contrast",t).dim);i.colorBarProgress=a.color,i.colorBorderMiddle=r,i.colorBorderMiddleEnd=r,i.colorNeedle=a.color,i.colorNeedleEnd=a.color,i.colorTitle=s,i.colorUnits=s,i.colorValueText=a.color,i.colorMinorTicks=s,i.colorNumbers=e.gauge?.compassUseNumbers?[t.port,s,s,r,s,s,r,s,s,r,s,s,t.port]:[t.port,r,r,r,r,r,r,r,t.port],i.colorMajorTicks=e.gauge?.compassUseNumbers?[t.port,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.port]:[t.port,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.contrast,t.port],i.colorPlate=i.colorPlateEnd=i.colorBorderInner=i.colorBorderInnerEnd=t.cardColor,i.colorBar=t.background,i.colorBarStroke="",i.colorValueBoxBackground=t.background,i.colorNeedleShadowUp="",i.colorNeedleShadowDown="",i.colorNeedleCircleInner=i.colorPlate,i.colorNeedleCircleInnerEnd=i.colorPlate,i.colorNeedleCircleOuter=i.colorPlate,i.colorNeedleCircleOuterEnd=i.colorPlate}setCanvasSize(){let e=this.gauge()?.nativeElement;if(!e)return;let t=e.getBoundingClientRect(),i={height:t.height,width:t.width};try{this.ngGauge()?.update(i)}catch(a){}}ngAfterViewInit(){this.viewReady.set(!0),this.setCanvasSize();try{this.ngGauge()?.update(this.gaugeOptions)}catch(e){}}onResized(e){let t={height:e.contentRect.height,width:e.contentRect.width};try{this.ngGauge()?.update(t)}catch(i){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-gauge-ng-compass"]],viewQuery:function(t,i){t&1&&Me(i.ngGauge,og,5)(i.gauge,og,5,Ke),t&2&&ke(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:1,vars:1,consts:[["compassGauge",""],["kipResizeObserver","",3,"options","value"],["kipResizeObserver","",3,"resizeChange","options","value"]],template:function(t,i){t&1&&I(0,qC,2,4,"radial-gauge",1),t&2&&N(i.shouldRenderGauge()?0:-1)},dependencies:[Xt,xo,il],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%} radial-gauge{display:block;position:relative;width:100%;min-width:8px;height:100%;overflow:clip} radial-gauge>canvas{display:block;position:absolute;height:100%;width:100%;left:50%;top:50%;transform:translate(-50%,-50%);padding:10px}"],changeDetection:0})}return n})();var jC=["plainIframe"],lg=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);_dashboard=y(yt);_sanitizer=y(ja);settings=y(Wt);static DEFAULT_CONFIG={};iframe=he.required("plainIframe");widgetUrl=null;displayTransparentOverlay=w("block");constructor(){let e=new URL("/signalk-anchoralarm-plugin/",window.location.origin);this.widgetUrl=this.toSafeResourceUrl(e),L(()=>{let t=this.runtime.options(),i=this._dashboard.isDashboardStatic();t&&G(()=>{i?this.displayTransparentOverlay.set("none"):this.displayTransparentOverlay.set("block")})}),window.addEventListener("message",this.handleIframeGesture)}toSafeResourceUrl(e){return e.origin!==window.location.origin||!e.pathname.startsWith("/signalk-anchoralarm-plugin/")?null:this._sanitizer.bypassSecurityTrustResourceUrl(e.toString())}ngAfterViewInit(){if(this.iframe()){this.iframe().nativeElement.onload=()=>this.injectSwipeScript();try{let e=this.iframe().nativeElement.contentDocument;e&&(e.readyState==="complete"||e.readyState==="interactive")&&this.injectSwipeScript()}catch(e){}}}handleIframeGesture=e=>{if(!e.data)return;let t=e.data?.eventData?.instanceId||e.data?.keyEventData?.instanceId;if(!(!t||t!==this.id())){if(e.data.gesture)switch(e.data.gesture){case"swipeup":this._dashboard.navigateToPreviousDashboard();break;case"swipedown":this._dashboard.navigateToNextDashboard();break;case"swipeleft":{let i=new Event("openLeftSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}case"swiperight":{let i=new Event("openRightSidenav",{bubbles:!0,cancelable:!0});window.document.dispatchEvent(i);break}default:break}if(e.data.type==="keydown"&&e.data.keyEventData){let{key:i,ctrlKey:a,shiftKey:r}=e.data.keyEventData,s=new KeyboardEvent("keydown",{key:i,ctrlKey:a,shiftKey:r,bubbles:!0,cancelable:!0});document.dispatchEvent(s)}}};injectSwipeScript(){let e=this.iframe().nativeElement.contentWindow,t=this.iframe().nativeElement.contentDocument;if(!t||!e){console.error("[WidgetIframe] Iframe contentDocument or contentWindow is undefined. Possible cross-origin issue or iframe not fully loaded.");return}try{let i=`kip-gesture-inject-${this.id()}`;if(t.getElementById(i))return;let a=so({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=a,t.body.appendChild(r)}catch(i){console.warn("[WidgetIframe] Failed to inject swipe script into iframe:",i)}}ngOnDestroy(){window.removeEventListener("message",this.handleIframeGesture),this.iframe()&&(this.iframe().nativeElement.onload=null);try{let e=this.iframe()?.nativeElement.contentDocument;if(e){let t=`kip-gesture-inject-${this.id()}`,i=e.getElementById(t);i&&i.parentNode&&i.parentNode.removeChild(i)}}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-anchor-alarm"]],viewQuery:function(t,i){t&1&&Me(i.iframe,jC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:3,consts:[["plainIframe",""],["width","100%","height","100%","frameborder","0",1,"widgetIframe",3,"src"],[1,"widgetOverlay"]],template:function(t,i){t&1&&Q(0,"iframe",1,0)(2,"div",2),t&2&&(Wi("src",i.widgetUrl,ha),f(2),xe("display",i.displayTransparentOverlay()))},styles:["[_nghost-%COMP%]{overflow:hidden}.widgetIframe[_ngcontent-%COMP%]{background-color:#fff;border-radius:var(--mat-card-elevated-container-shape, var(--mat-sys-corner-medium))}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"],changeDetection:0})}return n})();var YC=["canvasMainRef"],dg=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);streams=y(We);static DEFAULT_CONFIG={displayName:"Time Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Date / Time",path:null,source:null,pathType:"Date",isPathConfigurable:!0,sampleTime:1e3}},dateFormat:"dd/MM/yyyy HH:mm:ss",dateTimezone:"Atlantic/Azores",color:"contrast",enableTimeout:!1,dataTimeout:5};canvasMainRef=he.required("canvasMainRef");canvasElement;canvasCtx;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;canvas=y(ht);cssWidth=0;cssHeight=0;dataValue=w(null);_timeZoneGTM="";isDestroyed=!1;labelColor=w(void 0);valueColor=void 0;maxTextWidth=0;maxTextHeight=0;displayName=X(()=>this.runtime.options()?.displayName);dateFormat=X(()=>this.runtime.options()?.dateFormat);dateTimezone=X(()=>this.runtime.options()?.dateTimezone);constructor(){L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{this.applyColors(),e.paths?.gaugePath?.path&&(this._timeZoneGTM=this.getGMTOffset(this.dateTimezone()),this.streams.observe("gaugePath",a=>{this.dataValue.set(a?.data?.value??null),this.drawWidget()}))})}),L(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||G(()=>{this.applyColors(),this.drawWidget()})})}ngAfterViewInit(){this.canvasElement=this.canvasMainRef().nativeElement,this.canvasCtx=this.canvasElement.getContext("2d"),this.canvas.registerCanvas(this.canvasElement,{autoRelease:!0,onResize:(e,t)=>{this.cssWidth=e,this.cssHeight=t,this.maxTextWidth=Math.floor(this.cssWidth*.85),this.maxTextHeight=Math.floor(this.cssHeight*.7),this.drawWidget()}}),!this.isDestroyed&&(this.cssHeight=Math.floor(this.canvasElement.getBoundingClientRect().height),this.cssWidth=Math.floor(this.canvasElement.getBoundingClientRect().width),this.maxTextWidth=Math.floor(this.canvasElement.width*.85),this.maxTextHeight=Math.floor(this.canvasElement.height*.7),this.applyColors(),this.drawWidget())}getGMTOffset(e){try{if(e==="System Timezone -")return"";let a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"}).formatToParts(new Date).find(r=>r.type==="timeZoneName");return a?a.value:"GMT"}catch(t){return console.error(`Error getting GMT offset for timezone "${e}":`,t),"GMT"}}applyColors(){let e=this.runtime.options(),t=this.theme();!e||!t||(this.labelColor.set(Te(e.color,t).dim),this.valueColor=Te(e.color,t).color)}ngOnDestroy(){this.isDestroyed=!0;try{this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}drawWidget(){if(!this.canvasCtx)return;let e=this.labelColor();(!this.titleBitmap||this.titleBitmap.width!==this.canvasElement.width||this.titleBitmap.height!==this.canvasElement.height||this.titleBitmapText!==`${this.displayName()}-${this.runtime.options().color}`||this.titleBitmapColor!==e)&&(this.titleBitmap=this.canvas.createTitleBitmap(this.displayName(),e,"normal",this.cssWidth,this.cssHeight),this.titleBitmapText=`${this.displayName()}-${this.runtime.options().color}`,this.titleBitmapColor=e),this.canvas.clearCanvas(this.canvasCtx,this.cssWidth,this.cssHeight),this.titleBitmap&&this.titleBitmap.width>0&&this.titleBitmap.height>0&&this.canvasCtx.drawImage(this.titleBitmap,0,0,this.cssWidth,this.cssHeight);let t,i=this.dataValue();if(!i||isNaN(Date.parse(i)))t="--";else try{t=yc(i,this.dateFormat(),"en-US",this._timeZoneGTM)}catch(a){t=a,console.log("[Date Time Widget]: "+a)}this.canvas.drawText(this.canvasCtx,t,Math.floor(this.cssWidth/2),Math.floor(this.cssHeight/2*1.15),this.maxTextWidth,this.maxTextHeight,"bold",this.valueColor)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-datetime"]],viewQuery:function(t,i){t&1&&Me(i.canvasMainRef,YC,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:0,consts:[["canvasMainRef",""],[1,"date-canvas"]],template:function(t,i){t&1&&Q(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%;overflow:hidden}.date-canvas[_ngcontent-%COMP%]{width:100%!important;height:100%!important;min-height:1px;display:block}"],changeDetection:0})}return n})();var cg={modes:{point(n,o){return al(n,o,{intersect:!0})},nearest(n,o,e){return QC(n,o,e)},x(n,o,e){return al(n,o,{intersect:e.intersect,axis:"x"})},y(n,o,e){return al(n,o,{intersect:e.intersect,axis:"y"})}}};function Td(n,o,e){return(cg.modes[e.mode]||cg.modes.nearest)(n,o,e)}function ZC(n,o,e){return e!=="x"&&e!=="y"?n.inRange(o.x,o.y,"x",!0)||n.inRange(o.x,o.y,"y",!0):n.inRange(o.x,o.y,e,!0)}function XC(n,o,e){return e==="x"?{x:n.x,y:o.y}:e==="y"?{x:o.x,y:n.y}:o}function al(n,o,e){return n.filter(t=>e.intersect?t.inRange(o.x,o.y):ZC(t,o,e.axis))}function QC(n,o,e){let t=Number.POSITIVE_INFINITY;return al(n,o,e).reduce((i,a)=>{let r=a.getCenterPoint(),s=XC(o,r,e.axis),l=Uo(o,s);return l<t?(i=[a],t=l):l===t&&i.push(a),i},[]).sort((i,a)=>i._index-a._index).slice(0,1)}function Ra(n,o,e){let t=Math.cos(e),i=Math.sin(e),a=o.x,r=o.y;return{x:a+t*(n.x-a)-i*(n.y-r),y:r+i*(n.x-a)+t*(n.y-r)}}var KC=(n,o)=>o>n||n.length>o.length&&n.slice(0,o.length)===o,Pa=.001,rl=(n,o,e)=>Math.min(e,Math.max(o,n)),Eg=(n,o)=>n.value>=n.start-o&&n.value<=n.end+o;function JC(n,o,e){for(let t of Object.keys(n))n[t]=rl(n[t],o,e);return n}function eS(n,o,e,t){return!n||!o||e<=0?!1:Math.pow(n.x-o.x,2)+Math.pow(n.y-o.y,2)<=Math.pow(e+t,2)}function Pg(n,{x:o,y:e,x2:t,y2:i},a,{borderWidth:r,hitTolerance:s}){let l=(r+s)/2,m=n.x>=o-l-Pa&&n.x<=t+l+Pa,g=n.y>=e-l-Pa&&n.y<=i+l+Pa;return a==="x"?m:(a==="y"||m)&&g}function Ig(n,{rect:o,center:e},t,{rotation:i,borderWidth:a,hitTolerance:r}){let s=Ra(n,e,Ui(-i));return Pg(s,o,t,{borderWidth:a,hitTolerance:r})}function Va(n,o){let{centerX:e,centerY:t}=n.getProps(["centerX","centerY"],o);return{x:e,y:t}}function tS(n,o,e,t=!0){let i=e.split("."),a=0;for(let r of o.split(".")){let s=i[a++];if(parseInt(r,10)<parseInt(s,10))break;if(KC(s,r)){if(t)throw new Error(`${n} v${e} is not supported. v${o} or newer is required.`);return!1}}return!0}var Ng=n=>typeof n=="string"&&n.endsWith("%"),Og=n=>parseFloat(n)/100,Rg=n=>rl(Og(n),0,1),gr=(n,o)=>({x:n,y:o,x2:n,y2:o,width:0,height:0}),iS={box:n=>gr(n.centerX,n.centerY),doughnutLabel:n=>gr(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>gr(n.centerX,n.centerY),line:n=>gr(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>gr(n.centerX,n.centerY)};function Dd(n,o){return o==="start"?0:o==="end"?n:Ng(o)?Rg(o)*n:n/2}function ra(n,o,e=!0){return typeof o=="number"?o:Ng(o)?(e?Rg(o):Og(o))*n:n}function nS(n,o){let{x:e,width:t}=n,i=o.textAlign;return i==="center"?e+t/2:i==="end"||i==="right"?e+t:e}function Vg(n,o,{borderWidth:e,position:t,xAdjust:i,yAdjust:a},r){let s=Un(r),l=o.width+(s?r.width:0)+e,m=o.height+(s?r.height:0)+e,g=Ed(t),v=ug(n.x,l,i,g.x),A=ug(n.y,m,a,g.y);return{x:v,y:A,x2:v+l,y2:A+m,width:l,height:m,centerX:v+l/2,centerY:A+m/2}}function Ed(n,o="center"){return Un(n)?{x:Cn(n.x,o),y:Cn(n.y,o)}:(n=Cn(n,o),{x:n,y:n})}var Lg=(n,o)=>n&&n.autoFit&&o<1;function Wg(n,o){let e=n.font,t=Bi(e)?e:[e];return Lg(n,o)?t.map(function(i){let a=$o(i);return a.size=Math.floor(i.size*o),a.lineHeight=i.lineHeight,$o(a)}):t.map(i=>$o(i))}function Fg(n){return n&&(zi(n.xValue)||zi(n.yValue))}function ug(n,o,e=0,t){return n-Dd(o,t)+e}function Mo(n,o,e){let t=e.init;if(t){if(t===!0)return Bg(o,e)}else return;return aS(n,o,e)}function Gg(n,o,e){let t=!1;return o.forEach(i=>{Hn(n[i])?(t=!0,e[i]=n[i]):zi(e[i])&&delete e[i]}),t}function Bg(n,o){let e=o.type||"line";return iS[e](n)}function aS(n,o,e){let t=dn(e.init,[{chart:n,properties:o,options:e}]);if(t===!0)return Bg(o,e);if(Un(t))return t}var yd=new Map,oS=n=>isNaN(n)||n<=0,rS=n=>n.reduce(function(o,e){return o+=e.string,o},"");function sl(n){if(n&&typeof n=="object"){let o=n.toString();return o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"}}function ll(n,{x:o,y:e},t){t&&(n.translate(o,e),n.rotate(Ui(t)),n.translate(-o,-e))}function Tn(n,o){if(o&&o.borderWidth)return n.lineCap=o.borderCapStyle||"butt",n.setLineDash(o.borderDash),n.lineDashOffset=o.borderDashOffset,n.lineJoin=o.borderJoinStyle||"miter",n.lineWidth=o.borderWidth,n.strokeStyle=o.borderColor,!0}function ko(n,o){n.shadowColor=o.backgroundShadowColor,n.shadowBlur=o.shadowBlur,n.shadowOffsetX=o.shadowOffsetX,n.shadowOffsetY=o.shadowOffsetY}function dl(n,o){let e=o.content;if(sl(e))return{width:ra(e.width,o.width),height:ra(e.height,o.height)};let t=Wg(o),i=o.textStrokeWidth,a=Bi(e)?e:[e],r=a.join()+rS(t)+i+(n._measureText?"-spriting":"");return yd.has(r)||yd.set(r,cS(n,a,t,i)),yd.get(r)}function zg(n,o,e){let{x:t,y:i,width:a,height:r}=o;n.save(),ko(n,e);let s=Tn(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),kl(n,{x:t,y:i,w:a,h:r,radius:JC(Tl(e.borderRadius),0,Math.min(a,r)/2)}),n.closePath(),n.fill(),s&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function Ug(n,o,e,t){let i=e.content;if(sl(i)){n.save(),n.globalAlpha=hS(e.opacity,i.style.opacity),n.drawImage(i,o.x,o.y,o.width,o.height),n.restore();return}let a=Bi(i)?i:[i],r=Wg(e,t),s=e.color,l=Bi(s)?s:[s],m=nS(o,e),g=o.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,sS(n,e)&&uS(n,{x:m,y:g},a,r),mS(n,{x:m,y:g},a,{fonts:r,colors:l}),n.restore()}function sS(n,o){if(o.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=o.textStrokeWidth,n.strokeStyle=o.textStrokeColor,!0}function lS(n,o,e,t){let{radius:i,options:a}=o,r=a.pointStyle,s=a.rotation,l=(s||0)*is;if(sl(r)){n.save(),n.translate(e,t),n.rotate(l),n.drawImage(r,-r.width/2,-r.height/2,r.width,r.height),n.restore();return}oS(i)||dS(n,{x:e,y:t,radius:i,rotation:s,style:r,rad:l})}function dS(n,{x:o,y:e,radius:t,rotation:i,style:a,rad:r}){let s,l,m,g;switch(n.beginPath(),a){default:n.arc(o,e,t,0,ts),n.closePath();break;case"triangle":n.moveTo(o+Math.sin(r)*t,e-Math.cos(r)*t),r+=ns,n.lineTo(o+Math.sin(r)*t,e-Math.cos(r)*t),r+=ns,n.lineTo(o+Math.sin(r)*t,e-Math.cos(r)*t),n.closePath();break;case"rectRounded":g=t*.516,m=t-g,s=Math.cos(r+Aa)*m,l=Math.sin(r+Aa)*m,n.arc(o-s,e-l,g,r-gi,r-Ka),n.arc(o+l,e-s,g,r-Ka,r),n.arc(o+s,e+l,g,r,r+Ka),n.arc(o-l,e+s,g,r+Ka,r+gi),n.closePath();break;case"rect":if(!i){m=Math.SQRT1_2*t,n.rect(o-m,e-m,2*m,2*m);break}r+=Aa;case"rectRot":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+l,e-s),n.lineTo(o+s,e+l),n.lineTo(o-l,e+s),n.closePath();break;case"crossRot":r+=Aa;case"cross":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l),n.moveTo(o+l,e-s),n.lineTo(o-l,e+s);break;case"star":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l),n.moveTo(o+l,e-s),n.lineTo(o-l,e+s),r+=Aa,s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l),n.moveTo(o+l,e-s),n.lineTo(o-l,e+s);break;case"line":s=Math.cos(r)*t,l=Math.sin(r)*t,n.moveTo(o-s,e-l),n.lineTo(o+s,e+l);break;case"dash":n.moveTo(o,e),n.lineTo(o+Math.cos(r)*t,e+Math.sin(r)*t);break}n.fill()}function cS(n,o,e,t){n.save();let i=o.length,a=0,r=t;for(let s=0;s<i;s++){let l=e[Math.min(s,e.length-1)];n.font=l.string;let m=o[s];a=Math.max(a,n.measureText(m).width+t),r+=l.lineHeight}return n.restore(),{width:a,height:r}}function uS(n,{x:o,y:e},t,i){n.beginPath();let a=0;t.forEach(function(r,s){let l=i[Math.min(s,i.length-1)],m=l.lineHeight;n.font=l.string,n.strokeText(r,o,e+m/2+a),a+=m}),n.stroke()}function mS(n,{x:o,y:e},t,{fonts:i,colors:a}){let r=0;t.forEach(function(s,l){let m=a[Math.min(l,a.length-1)],g=i[Math.min(l,i.length-1)],v=g.lineHeight;n.beginPath(),n.font=g.string,n.fillStyle=m,n.fillText(s,o,e+v/2+r),r+=v,n.fill()})}function hS(n,o){let e=Ja(n)?n:o;return Ja(e)?rl(e,0,1):1}var Hg=["left","bottom","top","right"];function pS(n,o){let{pointX:e,pointY:t,options:i}=o,a=i.callout,r=a&&a.display&&AS(o,a);if(!r||xS(o,a,r))return;if(n.save(),n.beginPath(),!Tn(n,a))return n.restore();let{separatorStart:l,separatorEnd:m}=gS(o,r),{sideStart:g,sideEnd:v}=vS(o,r,l);(a.margin>0||i.borderWidth===0)&&(n.moveTo(l.x,l.y),n.lineTo(m.x,m.y)),n.moveTo(g.x,g.y),n.lineTo(v.x,v.y);let A=Ra({x:e,y:t},o.getCenterPoint(),Ui(-o.rotation));n.lineTo(A.x,A.y),n.stroke(),n.restore()}function gS(n,o){let{x:e,y:t,x2:i,y2:a}=n,r=fS(n,o),s,l;return o==="left"||o==="right"?(s={x:e+r,y:t},l={x:s.x,y:a}):(s={x:e,y:t+r},l={x:i,y:s.y}),{separatorStart:s,separatorEnd:l}}function fS(n,o){let{width:e,height:t,options:i}=n,a=i.callout.margin+i.borderWidth/2;return o==="right"?e+a:o==="bottom"?t+a:-a}function vS(n,o,e){let{y:t,width:i,height:a,options:r}=n,s=r.callout.start,l=bS(o,r.callout),m,g;return o==="left"||o==="right"?(m={x:e.x,y:t+ra(a,s)},g={x:m.x+l,y:m.y}):(m={x:e.x+ra(i,s),y:e.y},g={x:m.x,y:m.y+l}),{sideStart:m,sideEnd:g}}function bS(n,o){let e=o.side;return n==="left"||n==="top"?-e:e}function AS(n,o){let e=o.position;return Hg.includes(e)?e:yS(n,o)}function yS(n,o){let{x:e,y:t,x2:i,y2:a,width:r,height:s,pointX:l,pointY:m,centerX:g,centerY:v,rotation:A}=n,C={x:g,y:v},_=o.start,M=ra(r,_),B=ra(s,_),D=[e,e+M,e+M,i],V=[t+B,a,t,a],F=[];for(let Y=0;Y<4;Y++){let j=Ra({x:D[Y],y:V[Y]},C,Ui(A));F.push({position:Hg[Y],distance:Uo(j,{x:l,y:m})})}return F.sort((Y,j)=>Y.distance-j.distance)[0].position}function xS(n,o,e){let{pointX:t,pointY:i}=n,a=o.margin,r=t,s=i;return e==="left"?r+=a:e==="right"?r-=a:e==="top"?s+=a:e==="bottom"&&(s-=a),n.inRange(r,s)}var mg={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function Co(n,o,e){return o=typeof o=="number"?o:n.parse(o),ba(o)?n.getPixelForValue(o):e}function Ia(n,o,e){let t=o[e];if(t||e==="scaleID")return t;let i=e.charAt(0),a=Object.values(n).filter(r=>r.axis&&r.axis===i);return a.length?a[0].id:i}function qg(n,o){if(n){let e=n.options.reverse,t=Co(n,o.min,e?o.end:o.start),i=Co(n,o.max,e?o.start:o.end);return{start:t,end:i}}}function $g(n,o){let{chartArea:e,scales:t}=n,i=t[Ia(t,o,"xScaleID")],a=t[Ia(t,o,"yScaleID")],r=e.width/2,s=e.height/2;return i&&(r=Co(i,o.xValue,i.left+i.width/2)),a&&(s=Co(a,o.yValue,a.top+a.height/2)),{x:r,y:s}}function Pd(n,o){let e=n.scales,t=e[Ia(e,o,"xScaleID")],i=e[Ia(e,o,"yScaleID")];if(!t&&!i)return{};let{left:a,right:r}=t||n.chartArea,{top:s,bottom:l}=i||n.chartArea,m=hg(t,{min:o.xMin,max:o.xMax,start:a,end:r});a=m.start,r=m.end;let g=hg(i,{min:o.yMin,max:o.yMax,start:l,end:s});return s=g.start,l=g.end,{x:a,y:s,x2:r,y2:l,width:r-a,height:l-s,centerX:a+(r-a)/2,centerY:s+(l-s)/2}}function jg(n,o){if(!Fg(o)){let e=Pd(n,o),t=o.radius;(!t||isNaN(t))&&(t=Math.min(e.width,e.height)/2,o.radius=t);let i=t*2,a=e.centerX+o.xAdjust,r=e.centerY+o.yAdjust;return{x:a-t,y:r-t,x2:a+t,y2:r+t,centerX:a,centerY:r,width:i,height:i,radius:t}}return SS(n,o)}function CS(n,o){let{scales:e,chartArea:t}=n,i=e[o.scaleID],a={x:t.left,y:t.top,x2:t.right,y2:t.bottom};return i?wS(i,a,o):_S(e,a,o),a}function Yg(n,o){let e=Pd(n,o);return e.initProperties=Mo(n,e,o),e.elements=[{type:"label",optionScope:"label",properties:TS(n,e,o),initProperties:e.initProperties}],e}function SS(n,o){let e=$g(n,o),t=o.radius*2;return{x:e.x-o.radius+o.xAdjust,y:e.y-o.radius+o.yAdjust,x2:e.x+o.radius+o.xAdjust,y2:e.y+o.radius+o.yAdjust,centerX:e.x+o.xAdjust,centerY:e.y+o.yAdjust,radius:o.radius,width:t,height:t}}function hg(n,o){let e=qg(n,o)||o;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function wS(n,o,e){let t=Co(n,e.value,NaN),i=Co(n,e.endValue,t);n.isHorizontal()?(o.x=t,o.x2=i):(o.y=t,o.y2=i)}function _S(n,o,e){for(let t of Object.keys(mg)){let i=n[Ia(n,e,t)];if(i){let{min:a,max:r,start:s,end:l,startProp:m,endProp:g}=mg[t],v=qg(i,{min:e[a],max:e[r],start:i[s],end:i[l]});o[m]=v.start,o[g]=v.end}}}function MS({properties:n,options:o},e,t,i){let{x:a,x2:r,width:s}=n;return Zg({start:a,end:r,size:s,borderWidth:o.borderWidth},{position:t.x,padding:{start:i.left,end:i.right},adjust:o.label.xAdjust,size:e.width})}function kS({properties:n,options:o},e,t,i){let{y:a,y2:r,height:s}=n;return Zg({start:a,end:r,size:s,borderWidth:o.borderWidth},{position:t.y,padding:{start:i.top,end:i.bottom},adjust:o.label.yAdjust,size:e.height})}function Zg(n,o){let{start:e,end:t,borderWidth:i}=n,{position:a,padding:{start:r,end:s},adjust:l}=o,m=t-i-e-r-s-o.size;return e+i/2+l+Dd(m,a)}function TS(n,o,e){let t=e.label;t.backgroundColor="transparent",t.callout.display=!1;let i=Ed(t.position),a=io(t.padding),r=dl(n.ctx,t),s=MS({properties:o,options:e},r,i,a),l=kS({properties:o,options:e},r,i,a),m=r.width+a.width,g=r.height+a.height;return{x:s,y:l,x2:s+m,y2:l+g,width:m,height:g,centerX:s+m/2,centerY:l+g/2,rotation:t.rotation}}var xd=["enter","leave"],Id=xd.concat("click");function DS(n,o,e){o.listened=Gg(e,Id,o.listeners),o.moveListened=!1,xd.forEach(t=>{Hn(e[t])&&(o.moveListened=!0)}),(!o.listened||!o.moveListened)&&o.annotations.forEach(t=>{!o.listened&&Hn(t.click)&&(o.listened=!0),o.moveListened||xd.forEach(i=>{Hn(t[i])&&(o.listened=!0,o.moveListened=!0)})})}function ES(n,o,e){if(n.listened)switch(o.type){case"mousemove":case"mouseout":return PS(n,o,e);case"click":return IS(n,o,e)}}function PS(n,o,e){if(!n.moveListened)return;let t;o.type==="mousemove"?t=Td(n.visibleElements,o,e.interaction):t=[];let i=n.hovered;n.hovered=t;let a={state:n,event:o},r=pg(a,"leave",i,t);return pg(a,"enter",t,i)||r}function pg({state:n,event:o},e,t,i){let a;for(let r of t)i.indexOf(r)<0&&(a=Xg(r.options[e]||n.listeners[e],r,o)||a);return a}function IS(n,o,e){let t=n.listeners,i=Td(n.visibleElements,o,e.interaction),a;for(let r of i)a=Xg(r.options.click||t.click,r,o)||a;return a}function Xg(n,o,e){return dn(n,[o.$context,e])===!0}var ol=["afterDraw","beforeDraw"];function NS(n,o,e){let t=o.visibleElements;o.hooked=Gg(e,ol,o.hooks),o.hooked||t.forEach(i=>{o.hooked||ol.forEach(a=>{Hn(i.options[a])&&(o.hooked=!0)})})}function gg(n,o,e){if(n.hooked){let t=o.options[e]||n.hooks[e];return dn(t,[o.$context])}}function OS(n,o,e){let t=FS(n.scales,o,e),i=fg(o,t,"min","suggestedMin");i=fg(o,t,"max","suggestedMax")||i,i&&Hn(o.handleTickRangeOptions)&&o.handleTickRangeOptions()}function RS(n,o){for(let e of n)LS(e,o)}function fg(n,o,e,t){if(ba(o[e])&&!VS(n.options,e,t)){let i=n[e]!==o[e];return n[e]=o[e],i}}function VS(n,o,e){return zi(n[o])||zi(n[e])}function LS(n,o){for(let e of["scaleID","xScaleID","yScaleID"]){let t=Ia(o,n,e);t&&!o[t]&&WS(n,e)&&console.warn(`No scale found with id '${t}' for annotation '${n.id}'`)}}function WS(n,o){if(o==="scaleID")return!0;let e=o.charAt(0);for(let t of["Min","Max","Value"])if(zi(n[e+t]))return!0;return!1}function FS(n,o,e){let t=o.axis,i=o.id,a=t+"ScaleID",r={min:Cn(o.min,Number.NEGATIVE_INFINITY),max:Cn(o.max,Number.POSITIVE_INFINITY)};for(let s of e)s.scaleID===i?vg(s,o,["value","endValue"],r):Ia(n,s,a)===i&&vg(s,o,[t+"Min",t+"Max",t+"Value"],r);return r}function vg(n,o,e,t){for(let i of e){let a=n[i];if(zi(a)){let r=o.parse(a);t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}}}var sa=class extends $n{inRange(o,e,t,i){let{x:a,y:r}=Ra({x:o,y:e},this.getCenterPoint(i),Ui(-this.options.rotation));return Pg({x:a,y:r},this.getProps(["x","y","x2","y2"],i),t,this.options)}getCenterPoint(o){return Va(this,o)}draw(o){o.save(),ll(o,this.getCenterPoint(),this.options.rotation),zg(o,this,this.options),o.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(o,e){return Yg(o,e)}};sa.id="boxAnnotation";sa.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,hitTolerance:0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};sa.defaultRoutes={borderColor:"color",backgroundColor:"color"};sa.descriptors={label:{_fallback:!0}};var So=class extends $n{inRange(o,e,t,i){return Ig({x:o,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},t,{rotation:this.rotation,borderWidth:0,hitTolerance:this.options.hitTolerance})}getCenterPoint(o){return Va(this,o)}draw(o){let e=this.options;!e.display||!e.content||(qS(o,this),o.save(),ll(o,this.getCenterPoint(),this.rotation),Ug(o,this,e,this._fitRatio),o.restore())}resolveElementProperties(o,e){let t=GS(o,e);if(!t)return{};let{controllerMeta:i,point:a,radius:r}=zS(o,e,t),s=dl(o.ctx,e),l=US(s,r);Lg(e,l)&&(s={width:s.width*l,height:s.height*l});let{position:m,xAdjust:g,yAdjust:v}=e,A=Vg(a,s,{borderWidth:0,position:m,xAdjust:g,yAdjust:v});return ge(ne(ne({initProperties:Mo(o,A,e)},A),i),{rotation:e.rotation,_fitRatio:l})}};So.id="doughnutLabelAnnotation";So.defaults={autoFit:!0,autoHide:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderColor:"transparent",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:0,color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,spacing:1,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0};So.defaultRoutes={};function GS(n,o){return n.getSortedVisibleDatasetMetas().reduce(function(e,t){let i=t.controller;return i instanceof Du&&BS(n,o,t.data)&&(!e||i.innerRadius<e.controller.innerRadius)&&i.options.circumference>=90?t:e},void 0)}function BS(n,o,e){if(!o.autoHide)return!0;for(let t=0;t<e.length;t++)if(!e[t].hidden&&n.getDataVisibility(t))return!0}function zS({chartArea:n},o,e){let{left:t,top:i,right:a,bottom:r}=n,{innerRadius:s,offsetX:l,offsetY:m}=e.controller,g=(t+a)/2+l,v=(i+r)/2+m,A={left:Math.max(g-s,t),right:Math.min(g+s,a),top:Math.max(v-s,i),bottom:Math.min(v+s,r)},C={x:(A.left+A.right)/2,y:(A.top+A.bottom)/2},_=o.spacing+o.borderWidth/2,M=s-_,B=C.y>v,D=B?i+_:r-_,V=HS(D,g,v,M);return{controllerMeta:ne({_centerX:g,_centerY:v,_radius:M,_counterclockwise:B},V),point:C,radius:Math.min(s,Math.min(A.right-A.left,A.bottom-A.top)/2)}}function US({width:n,height:o},e){let t=Math.sqrt(Math.pow(n,2)+Math.pow(o,2));return e*2/t}function HS(n,o,e,t){let i=Math.pow(e-n,2),a=Math.pow(t,2),r=o*-2,s=Math.pow(o,2)+i-a,l=Math.pow(r,2)-4*s;if(l<=0)return{_startAngle:0,_endAngle:ts};let m=(-r-Math.sqrt(l))/2,g=(-r+Math.sqrt(l))/2;return{_startAngle:as({x:o,y:e},{x:m,y:n}).angle,_endAngle:as({x:o,y:e},{x:g,y:n}).angle}}function qS(n,o){let{_centerX:e,_centerY:t,_radius:i,_startAngle:a,_endAngle:r,_counterclockwise:s,options:l}=o;n.save();let m=Tn(n,l);n.fillStyle=l.backgroundColor,n.beginPath(),n.arc(e,t,i,a,r,s),n.closePath(),n.fill(),m&&n.stroke(),n.restore()}var Na=class extends $n{inRange(o,e,t,i){return Ig({x:o,y:e},{rect:this.getProps(["x","y","x2","y2"],i),center:this.getCenterPoint(i)},t,{rotation:this.rotation,borderWidth:this.options.borderWidth,hitTolerance:this.options.hitTolerance})}getCenterPoint(o){return Va(this,o)}draw(o){let e=this.options,t=!zi(this._visible)||this._visible;!e.display||!e.content||!t||(o.save(),ll(o,this.getCenterPoint(),this.rotation),pS(o,this),zg(o,this,e),Ug(o,$S(this),e),o.restore())}resolveElementProperties(o,e){let t;if(Fg(e))t=$g(o,e);else{let{centerX:s,centerY:l}=Pd(o,e);t={x:s,y:l}}let i=io(e.padding),a=dl(o.ctx,e),r=Vg(t,a,e,i);return ge(ne({initProperties:Mo(o,r,e),pointX:t.x,pointY:t.y},r),{rotation:e.rotation})}};Na.id="labelAnnotation";Na.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,hitTolerance:0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};Na.defaultRoutes={borderColor:"color"};function $S({x:n,y:o,width:e,height:t,options:i}){let a=i.borderWidth/2,r=io(i.padding);return{x:n+r.left+a,y:o+r.top+a,width:e-r.left-r.right-i.borderWidth,height:t-r.top-r.bottom-i.borderWidth}}var Nd=(n,o,e)=>({x:n.x+e*(o.x-n.x),y:n.y+e*(o.y-n.y)}),Cd=(n,o,e)=>Nd(o,e,Math.abs((n-o.y)/(e.y-o.y))).x,bg=(n,o,e)=>Nd(o,e,Math.abs((n-o.x)/(e.x-o.x))).y,vr=n=>n*n,jS=(n,o,{x:e,y:t,x2:i,y2:a},r)=>r==="y"?{start:Math.min(t,a),end:Math.max(t,a),value:o}:{start:Math.min(e,i),end:Math.max(e,i),value:n},Ag=(n,o,e,t)=>(1-t)*(1-t)*n+2*(1-t)*t*o+t*t*e,Sd=(n,o,e,t)=>({x:Ag(n.x,o.x,e.x,t),y:Ag(n.y,o.y,e.y,t)}),yg=(n,o,e,t)=>2*(1-t)*(o-n)+2*t*(e-o),xg=(n,o,e,t)=>-Math.atan2(yg(n.x,o.x,e.x,t),yg(n.y,o.y,e.y,t))+.5*gi,cl=(()=>{class n extends $n{inRange(e,t,i,a){let r=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){let s={mouseX:e,mouseY:t},{path:l,ctx:m}=this;if(l){Tn(m,this.options),m.lineWidth+=this.options.hitTolerance;let{chart:v}=this.$context,A=e*v.currentDevicePixelRatio,C=t*v.currentDevicePixelRatio,_=m.isPointInStroke(l,A,C)||wd(this,s,a);return m.restore(),_}let g=vr(r);return QS(this,s,g,a)||wd(this,s,a)}return YS(this,{mouseX:e,mouseY:t},i,{hitSize:r,useFinalPosition:a})}getCenterPoint(e){return Va(this,e)}draw(e){let{x:t,y:i,x2:a,y2:r,cp:s,options:l}=this;if(e.save(),!Tn(e,l))return e.restore();ko(e,l);let m=Math.sqrt(Math.pow(a-t,2)+Math.pow(r-i,2));if(l.curve&&s)return ow(e,this,s,m),e.restore();let{startOpts:g,endOpts:v,startAdjust:A,endAdjust:C}=Qg(this),_=Math.atan2(r-i,a-t);e.translate(t,i),e.rotate(_),e.beginPath(),e.moveTo(0+A,0),e.lineTo(m-C,0),e.shadowColor=l.borderShadowColor,e.stroke(),_d(e,0,A,g),_d(e,m,-C,v),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,t){let i=CS(e,t),{x:a,y:r,x2:s,y2:l}=i,m=ZS(i,e.chartArea),g=m?XS({x:a,y:r},{x:s,y:l},e.chartArea):{x:a,y:r,x2:s,y2:l,width:Math.abs(s-a),height:Math.abs(l-r)};if(g.centerX=(s+a)/2,g.centerY=(l+r)/2,g.initProperties=Mo(e,g,t),t.curve){let A={x:g.x,y:g.y},C={x:g.x2,y:g.y2};g.cp=aw(g,t,Uo(A,C))}let v=KS(e,g,t.label);return v._visible=m,g.elements=[{type:"label",optionScope:"label",properties:v,initProperties:g.initProperties}],g}}return n.id="lineAnnotation",n})(),Cg={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};cl.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Cg),fill:!1,length:12,start:Object.assign({},Cg),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,hitTolerance:0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},Na.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,hitTolerance:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};cl.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};cl.defaultRoutes={borderColor:"color"};function YS(n,{mouseX:o,mouseY:e},t,{hitSize:i,useFinalPosition:a}){let r=jS(o,e,n.getProps(["x","y","x2","y2"],a),t);return Eg(r,i)||wd(n,{mouseX:o,mouseY:e},a,t)}function ZS({x:n,y:o,x2:e,y2:t},{top:i,right:a,bottom:r,left:s}){return!(n<s&&e<s||n>a&&e>a||o<i&&t<i||o>r&&t>r)}function Sg({x:n,y:o},e,{top:t,right:i,bottom:a,left:r}){return n<r&&(o=bg(r,{x:n,y:o},e),n=r),n>i&&(o=bg(i,{x:n,y:o},e),n=i),o<t&&(n=Cd(t,{x:n,y:o},e),o=t),o>a&&(n=Cd(a,{x:n,y:o},e),o=a),{x:n,y:o}}function XS(n,o,e){let{x:t,y:i}=Sg(n,o,e),{x:a,y:r}=Sg(o,n,e);return{x:t,y:i,x2:a,y2:r,width:Math.abs(a-t),height:Math.abs(r-i)}}function QS(n,{mouseX:o,mouseY:e},t=Pa,i){let{x:a,y:r,x2:s,y2:l}=n.getProps(["x","y","x2","y2"],i),m=s-a,g=l-r,v=vr(m)+vr(g),A=v===0?-1:((o-a)*m+(e-r)*g)/v,C,_;return A<0?(C=a,_=r):A>1?(C=s,_=l):(C=a+A*m,_=r+A*g),vr(o-C)+vr(e-_)<=t}function wd(n,{mouseX:o,mouseY:e},t,i){let a=n.label;return a.options.display&&a.inRange(o,e,i,t)}function KS(n,o,e){let t=e.borderWidth,i=io(e.padding),a=dl(n.ctx,e),r=a.width+i.width+t,s=a.height+i.height+t;return ew(o,e,{width:r,height:s,padding:i},n.chartArea)}function JS(n){let{x:o,y:e,x2:t,y2:i}=n,a=Math.atan2(i-e,t-o);return a>gi/2?a-gi:a<gi/-2?a+gi:a}function ew(n,o,e,t){let{width:i,height:a,padding:r}=e,{xAdjust:s,yAdjust:l}=o,m={x:n.x,y:n.y},g={x:n.x2,y:n.y2},v=o.rotation==="auto"?JS(n):Ui(o.rotation),A=tw(i,a,v),C=iw(n,o,{labelSize:A,padding:r},t),_=n.cp?Sd(m,n.cp,g,C):Nd(m,g,C),M={size:A.w,min:t.left,max:t.right,padding:r.left},B={size:A.h,min:t.top,max:t.bottom,padding:r.top},D=_g(_.x,M)+s,V=_g(_.y,B)+l;return{x:D-i/2,y:V-a/2,x2:D+i/2,y2:V+a/2,centerX:D,centerY:V,pointX:_.x,pointY:_.y,width:i,height:a,rotation:_l(v)}}function tw(n,o,e){let t=Math.cos(e),i=Math.sin(e);return{w:Math.abs(n*t)+Math.abs(o*i),h:Math.abs(n*i)+Math.abs(o*t)}}function iw(n,o,e,t){let i,a=nw(n,t);return o.position==="start"?i=wg({w:n.x2-n.x,h:n.y2-n.y},e,o,a):o.position==="end"?i=1-wg({w:n.x-n.x2,h:n.y-n.y2},e,o,a):i=Dd(1,o.position),i}function wg(n,o,e,t){let{labelSize:i,padding:a}=o,r=n.w*t.dx,s=n.h*t.dy,l=r>0&&(i.w/2+a.left-t.x)/r,m=s>0&&(i.h/2+a.top-t.y)/s;return rl(Math.max(l,m),0,.25)}function nw(n,o){let{x:e,x2:t,y:i,y2:a}=n,r=Math.min(i,a)-o.top,s=Math.min(e,t)-o.left,l=o.bottom-Math.max(i,a),m=o.right-Math.max(e,t);return{x:Math.min(s,m),y:Math.min(r,l),dx:s<=m?1:-1,dy:r<=l?1:-1}}function _g(n,o){let{size:e,min:t,max:i,padding:a}=o,r=e/2;return e>i-t?(i+t)/2:(t>=n-a-r&&(n=t+a+r),i<=n+a+r&&(n=i-a-r),n)}function Qg(n){let o=n.options,e=o.arrowHeads&&o.arrowHeads.start,t=o.arrowHeads&&o.arrowHeads.end;return{startOpts:e,endOpts:t,startAdjust:Mg(n,e),endAdjust:Mg(n,t)}}function Mg(n,o){if(!o||!o.display)return 0;let{length:e,width:t}=o,i=n.options.borderWidth/2,a={x:e,y:t+i};return Math.abs(Cd(0,a,{x:0,y:i}))}function _d(n,o,e,t){if(!t||!t.display)return;let{length:i,width:a,fill:r,backgroundColor:s,borderColor:l}=t,m=Math.abs(o-i)+e;n.beginPath(),ko(n,t),Tn(n,t),n.moveTo(m,-a),n.lineTo(o+e,0),n.lineTo(m,a),r===!0?(n.fillStyle=s||l,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=t.borderShadowColor,n.stroke()}function aw(n,o,e){let{x:t,y:i,x2:a,y2:r,centerX:s,centerY:l}=n,m=Math.atan2(r-i,a-t),g=Ed(o.controlPoint,0),v={x:s+ra(e,g.x,!1),y:l+ra(e,g.y,!1)};return Ra(v,{x:s,y:l},m)}function kg(n,{x:o,y:e},{angle:t,adjust:i},a){!a||!a.display||(n.save(),n.translate(o,e),n.rotate(t),_d(n,0,-i,a),n.restore())}function ow(n,o,e,t){let{x:i,y:a,x2:r,y2:s,options:l}=o,{startOpts:m,endOpts:g,startAdjust:v,endAdjust:A}=Qg(o),C={x:i,y:a},_={x:r,y:s},M=xg(C,e,_,0),B=xg(C,e,_,1)-gi,D=Sd(C,e,_,v/t),V=Sd(C,e,_,1-A/t),F=new Path2D;n.beginPath(),F.moveTo(D.x,D.y),F.quadraticCurveTo(e.x,e.y,V.x,V.y),n.shadowColor=l.borderShadowColor,n.stroke(F),o.path=F,o.ctx=n,kg(n,D,{angle:M,adjust:v},m),kg(n,V,{angle:B,adjust:A},g)}var Oa=class extends $n{inRange(o,e,t,i){let a=this.options.rotation,r=(this.options.borderWidth+this.options.hitTolerance)/2;if(t!=="x"&&t!=="y")return rw({x:o,y:e},this.getProps(["width","height","centerX","centerY"],i),a,r);let{x:s,y:l,x2:m,y2:g}=this.getProps(["x","y","x2","y2"],i),v=t==="y"?{start:l,end:g}:{start:s,end:m},A=Ra({x:o,y:e},this.getCenterPoint(i),Ui(-a));return A[t]>=v.start-r-Pa&&A[t]<=v.end+r+Pa}getCenterPoint(o){return Va(this,o)}draw(o){let{width:e,height:t,centerX:i,centerY:a,options:r}=this;o.save(),ll(o,this.getCenterPoint(),r.rotation),ko(o,this.options),o.beginPath(),o.fillStyle=r.backgroundColor;let s=Tn(o,r);o.ellipse(i,a,t/2,e/2,gi/2,0,2*gi),o.fill(),s&&(o.shadowColor=r.borderShadowColor,o.stroke()),o.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(o,e){return Yg(o,e)}};Oa.id="ellipseAnnotation";Oa.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},sa.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};Oa.defaultRoutes={borderColor:"color",backgroundColor:"color"};Oa.descriptors={label:{_fallback:!0}};function rw(n,o,e,t){let{width:i,height:a,centerX:r,centerY:s}=o,l=i/2,m=a/2;if(l<=0||m<=0)return!1;let g=Ui(e||0),v=Math.cos(g),A=Math.sin(g),C=Math.pow(v*(n.x-r)+A*(n.y-s),2),_=Math.pow(A*(n.x-r)-v*(n.y-s),2);return C/Math.pow(l+t,2)+_/Math.pow(m+t,2)<=1.0001}var wo=class extends $n{inRange(o,e,t,i){let{x:a,y:r,x2:s,y2:l,width:m}=this.getProps(["x","y","x2","y2","width"],i),g=(this.options.borderWidth+this.options.hitTolerance)/2;return t!=="x"&&t!=="y"?eS({x:o,y:e},this.getCenterPoint(i),m/2,g):Eg(t==="y"?{start:r,end:l,value:e}:{start:a,end:s,value:o},g)}getCenterPoint(o){return Va(this,o)}draw(o){let e=this.options,t=e.borderWidth;if(e.radius<.1)return;o.save(),o.fillStyle=e.backgroundColor,ko(o,e);let i=Tn(o,e);lS(o,this,this.centerX,this.centerY),i&&!sl(e.pointStyle)&&(o.shadowColor=e.borderShadowColor,o.stroke()),o.restore(),e.borderWidth=t}resolveElementProperties(o,e){let t=jg(o,e);return t.initProperties=Mo(o,t,e),t}};wo.id="pointAnnotation";wo.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};wo.defaultRoutes={borderColor:"color",backgroundColor:"color"};var _o=class extends $n{inRange(o,e,t,i){if(t!=="x"&&t!=="y")return this.options.radius>=.1&&this.elements.length>1&&lw(this.elements,o,e,i);let a=Ra({x:o,y:e},this.getCenterPoint(i),Ui(-this.options.rotation)),r=this.elements.map(m=>t==="y"?m.bY:m.bX),s=Math.min(...r),l=Math.max(...r);return a[t]>=s&&a[t]<=l}getCenterPoint(o){return Va(this,o)}draw(o){let{elements:e,options:t}=this;o.save(),o.beginPath(),o.fillStyle=t.backgroundColor,ko(o,t);let i=Tn(o,t),a=!0;for(let r of e)a?(o.moveTo(r.x,r.y),a=!1):o.lineTo(r.x,r.y);o.closePath(),o.fill(),i&&(o.shadowColor=t.borderShadowColor,o.stroke()),o.restore()}resolveElementProperties(o,e){let t=jg(o,e),{sides:i,rotation:a}=e,r=[],s=2*gi/i,l=a*is;for(let m=0;m<i;m++,l+=s){let g=sw(t,e,l);g.initProperties=Mo(o,t,e),r.push(g)}return t.elements=r,t}};_o.id="polygonAnnotation";_o.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};_o.defaultRoutes={borderColor:"color",backgroundColor:"color"};function sw({centerX:n,centerY:o},{radius:e,borderWidth:t,hitTolerance:i},a){let r=(t+i)/2,s=Math.sin(a),l=Math.cos(a),m={x:n+s*e,y:o-l*e};return{type:"point",optionScope:"point",properties:{x:m.x,y:m.y,centerX:m.x,centerY:m.y,bX:n+s*(e+r),bY:o-l*(e+r)}}}function lw(n,o,e,t){let i=!1,a=n[n.length-1].getProps(["bX","bY"],t);for(let r of n){let s=r.getProps(["bX","bY"],t);s.bY>e!=a.bY>e&&o<(a.bX-s.bX)*(e-s.bY)/(a.bY-s.bY)+s.bX&&(i=!i),a=s}return i}var oa={box:sa,doughnutLabel:So,ellipse:Oa,label:Na,line:cl,point:wo,polygon:_o};Object.keys(oa).forEach(n=>{qo.describe(`elements.${oa[n].id}`,{_fallback:"plugins.annotation.common"})});var dw={update:Object.assign},cw=Id.concat(ol),Tg=(n,o)=>Un(o)?kd(n,o):n,Md=n=>n==="color"||n==="font";function Od(n="line"){return oa[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function uw(n,o,e,t){let i=hw(n,e.animations,t),a=o.annotations,r=fw(o.elements,a);for(let s=0;s<a.length;s++){let l=a[s],m=Kg(r,s,l.type),g=l.setContext(gw(n,m,r,l)),v=m.resolveElementProperties(n,g);v.skip=mw(v),"elements"in v&&(pw(m,v.elements,g,i),delete v.elements),zi(m.x)||Object.assign(m,v),Object.assign(m,v.initProperties),v.options=Jg(g),i.update(m,v)}}function mw(n){return isNaN(n.x)||isNaN(n.y)}function hw(n,o,e){return e==="reset"||e==="none"||e==="resize"?dw:new ku(n,o)}function pw(n,o,e,t){let i=n.elements||(n.elements=[]);i.length=o.length;for(let a=0;a<o.length;a++){let r=o[a],s=r.properties,l=Kg(i,a,r.type,r.initProperties),m=e[r.optionScope].override(r);s.options=Jg(m),t.update(l,s)}}function Kg(n,o,e,t){let i=oa[Od(e)],a=n[o];return(!a||!(a instanceof i))&&(a=n[o]=new i,Object.assign(a,t)),a}function Jg(n){let o=oa[Od(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,kd(n,o.defaults),kd(n,o.defaultRoutes));for(let t of cw)e[t]=n[t];return e}function kd(n,o){let e={};for(let t of Object.keys(o)){let i=o[t],a=n[t];Md(t)&&Bi(a)?e[t]=a.map(r=>Tg(r,i)):e[t]=Tg(a,i)}return e}function gw(n,o,e,t){return o.$context||(o.$context=Object.assign(Object.create(n.getContext()),{element:o,get elements(){return e.filter(i=>i&&i.options)},id:t.id,type:"annotation"}))}function fw(n,o){let e=o.length,t=n.length;if(t<e){let i=e-t;n.splice(t,0,...new Array(i))}else t>e&&n.splice(e,t-e);return n}var vw="3.1.0",aa=new Map,Dg=n=>n.type!=="doughnutLabel",bw=Id.concat(ol),ef={id:"annotation",version:vw,beforeRegister(){tS("chart.js","4.0",Ct.version)},afterRegister(){Ct.register(oa)},afterUnregister(){Ct.unregister(oa)},beforeInit(n){aa.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,o,e){let t=aa.get(n),i=t.annotations=[],a=e.annotations;Un(a)?Object.keys(a).forEach(r=>{let s=a[r];Un(s)&&(s.id=r,i.push(s))}):Bi(a)&&i.push(...a),RS(i.filter(Dg),n.scales)},afterDataLimits(n,o){let e=aa.get(n);OS(n,o.scale,e.annotations.filter(Dg).filter(t=>t.display&&t.adjustScaleRange))},afterUpdate(n,o,e){let t=aa.get(n);DS(n,t,e),uw(n,t,e,o.mode),t.visibleElements=t.elements.filter(i=>!i.skip&&i.options.display),NS(n,t,e)},beforeDatasetsDraw(n,o,e){fr(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,o,e){fr(n,"afterDatasetsDraw",e.clip)},beforeDatasetDraw(n,o,e){fr(n,o.index,e.clip)},beforeDraw(n,o,e){fr(n,"beforeDraw",e.clip)},afterDraw(n,o,e){fr(n,"afterDraw",e.clip)},beforeEvent(n,o,e){let t=aa.get(n);ES(t,o.event,e)&&(o.changed=!0)},afterDestroy(n){aa.delete(n)},getAnnotations(n){let o=aa.get(n);return o?o.elements:[]},_getAnnotationElementsAtEventForMode(n,o,e){return Td(n,o,e)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"},colors:{properties:["backgroundColor","borderColor"],type:"color"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:n=>!bw.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,o)=>`elements.${oa[Od(o.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:Md,_fallback:!0},_indexable:Md}},additionalOptionScopes:[""]};function fr(n,o,e){let{ctx:t,chartArea:i}=n,a=aa.get(n);e&&eo(t,i);let r=Aw(a.visibleElements,o).sort((s,l)=>s.element.options.z-l.element.options.z);for(let s of r)yw(t,i,a,s);e&&to(t)}function Aw(n,o){let e=[];for(let t of n)if(t.options.drawTime===o&&e.push({element:t,main:!0}),t.elements&&t.elements.length)for(let i of t.elements)i.options.display&&i.options.drawTime===o&&e.push({element:i});return e}function yw(n,o,e,t){let i=t.element;t.main?(gg(e,i,"beforeDraw"),i.draw(n,o),gg(e,i,"afterDraw")):i.draw(n,o)}var xw=["widgetDataChart"];function Cw(n,o){n&1&&Q(0,"canvas",1,0)}function Sw(n,o){n&1&&(E(0,"div",2)(1,"p"),c(2,"Ready to configure"),O(),E(3,"p",3),c(4,"Double-tap to begin"),O()())}Ct.register(ef,Sa,ao,os,rs,un,Zn,qn,Yn,jn);var tf=(()=>{class n{id=x.required();type=x.required();theme=x.required();runtime=y(Se);dsService=y(mn);ngZone=y(qe);canvasService=y(ht);unitsService=y(it);datasetLifecycle=y(lo);widgetDataChart=he("widgetDataChart",{read:Ke});static DEFAULT_CONFIG={displayName:"Chart Label",color:"contrast",filterSelfPaths:!0,datachartPath:null,datachartSource:null,convertUnitTo:null,timeScale:"minute",period:10,numDecimal:1,inverseYAxis:!1,datasetAverageArray:"sma",showDataPoints:!1,showAverageData:!0,trackAgainstAverage:!1,showDatasetMinimumValueLine:!1,showDatasetMaximumValueLine:!1,showDatasetAverageValueLine:!0,showDatasetAngleAverageValueLine:!1,showLabel:!0,showTimeScale:!1,startScaleAtZero:!1,verticalChart:!1,showYScale:!1,yScaleSuggestedMin:null,yScaleSuggestedMax:null,enableMinMaxScaleLimit:!1,yScaleMin:null,yScaleMax:null};lineChartData={datasets:[]};lineChartOptions={parsing:!1,datasets:{line:{pointRadius:0,pointHoverRadius:0,tension:.4}},animations:{tension:{easing:"easeInOutCubic"}}};lineChartType="line";chart;dsServiceSub=null;datasetConfig=null;dataSourceInfo=null;lastVerticalChart=null;hasPath=X(()=>!!this.runtime.options()?.datachartPath);pathSignature=X(()=>{let e=this.runtime.options();if(e.datachartPath)return[e.datachartPath,e.convertUnitTo,e.datachartSource,e.timeScale,e.period].join("|")});previousPathSignature=void 0;constructor(){L(()=>{let e=this.pathSignature();G(()=>{e!==this.previousPathSignature&&G(()=>{this.previousPathSignature=e,this.rebuildForDataset(this.runtime.options())})})}),L(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||G(()=>{this.lastVerticalChart!==null&&this.lastVerticalChart!==e.verticalChart?(this.lastVerticalChart=e.verticalChart,this.rebuildForDataset(e)):this.chart&&(this.ensureAverageDatasetPresence(),this.updateAnnotationVisibility(),this.applyDynamicTrackAverageStyling(),this.setChartOptions(e),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")))})}),L(()=>{let e=this.runtime.options(),t=this.widgetDataChart(),i=this.hasPath();!e||!i||!t||this.chart||G(()=>this.rebuildForDataset(e))})}rebuildForDataset(e){e.datachartPath&&this.widgetDataChart()&&(this.dsServiceSub?.unsubscribe(),this.lineChartData.datasets=[],this.datasetLifecycle.syncDataChartDataset(this.id(),e,this.pathSignature()),this.datasetConfig=this.dsService.getDatasetConfig(this.id()),this.dataSourceInfo=this.dsService.getDataSourceInfo(this.id()),this.datasetConfig&&(this.createDatasets(e),this.setChartOptions(e),this.chart?.destroy(),this.chart=new Ct(this.widgetDataChart().nativeElement.getContext("2d"),{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.startStreaming(),this.ngZone.runOutsideAngular(()=>this.chart?.update())))}setChartOptions(e){this.lineChartOptions.maintainAspectRatio=!1,this.lineChartOptions.animation=!1,this.lineChartOptions.indexAxis=e.verticalChart?"y":"x",e.verticalChart?this.lineChartOptions.scales={y:{type:"realtime",display:e.showTimeScale,position:e.verticalChart?"right":"left",suggestedMin:"",suggestedMax:"",title:{display:!0,text:`Last ${this.datasetConfig.period} ${this.datasetConfig.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!0,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}},x:{type:"linear",display:e.showYScale,position:e.verticalChart?"top":"bottom",suggestedMin:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMin,suggestedMax:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMax,min:e.enableMinMaxScaleLimit?e.yScaleMin:null,max:e.enableMinMaxScaleLimit?e.yScaleMax:null,beginAtZero:e.startScaleAtZero,reverse:e.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:e.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}}}:this.lineChartOptions.scales={x:{type:"realtime",display:e.showTimeScale,title:{display:!0,text:`Last ${this.datasetConfig.period} ${this.datasetConfig.timeScaleFormat}`,align:"center",color:this.getThemeColors().averageChartLine},time:{unit:this.datasetConfig.timeScaleFormat,minUnit:"second",round:"second",displayFormats:{hour:"k:mm''",minute:"mm''",second:'ss"',millisecond:"SSS"}},ticks:{autoSkip:!0,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}},y:{display:e.showYScale,position:"right",suggestedMin:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMin,suggestedMax:e.enableMinMaxScaleLimit?null:e.yScaleSuggestedMax,min:e.enableMinMaxScaleLimit?e.yScaleMin:null,max:e.enableMinMaxScaleLimit?e.yScaleMax:null,beginAtZero:e.startScaleAtZero,reverse:e.inverseYAxis,title:{display:!1,text:"Value Axis",align:"center",color:this.getThemeColors().averageChartLine},ticks:{maxTicksLimit:8,precision:e.numDecimal,color:this.getThemeColors().averageChartLine,major:{enabled:!0}},grid:{display:!0,color:this.theme().contrastDimmer}}},this.lineChartOptions.plugins={title:{display:!0,align:"end",padding:{top:3,bottom:0},text:"",font:{size:32},color:this.getThemeColors().chartValue},subtitle:{display:e.showLabel,align:"start",padding:{top:-35,bottom:20},text:` ${e.displayName}`,font:{size:22},color:this.getThemeColors().chartLabel},annotation:{annotations:{minimumLine:{type:"line",scaleID:e.verticalChart?"x":"y",display:e.showDatasetMinimumValueLine,value:null,drawTime:"afterDatasetsDraw",label:{display:!0,position:"start",yAdjust:12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},maximumLine:{type:"line",scaleID:e.verticalChart?"x":"y",display:e.showDatasetMaximumValueLine,value:null,drawTime:"afterDatasetsDraw",label:{display:!0,position:"start",yAdjust:-12,padding:4,color:this.getThemeColors().averageChartLine,backgroundColor:"rgba(63,63,63,0.0)"}},averageLine:{type:"line",scaleID:e.verticalChart?"x":"y",display:e.showDatasetAverageValueLine,value:null,borderDash:[6,6],borderColor:this.getThemeColors().averageChartLine,drawTime:"afterDatasetsDraw",label:{display:!0,position:"start",padding:4,color:this.getThemeColors().chartValue,backgroundColor:"rgba(63,63,63,0.7)"}}}},legend:{display:!1},streaming:{duration:this.dataSourceInfo.maxDataPoints*this.dataSourceInfo.sampleTime,delay:this.dataSourceInfo.sampleTime,frameRate:this.datasetConfig.timeScaleFormat==="day"?5:this.datasetConfig.timeScaleFormat==="hour"?8:this.datasetConfig.timeScaleFormat==="minute"?15:30}}}createDatasets(e){let t,i;e.inverseYAxis&&e.trackAgainstAverage?(t="start",i=!1):e.inverseYAxis&&!e.trackAgainstAverage?(t=!1,i="start"):!e.inverseYAxis&&e.trackAgainstAverage?(t=!0,i=!1):(t=!1,i=!0),this.lineChartData.datasets=[],this.lineChartData.datasets.push({label:"Value",data:[],order:e.trackAgainstAverage?1:0,parsing:!1,tension:0,pointRadius:e.showDataPoints?e.trackAgainstAverage?0:1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:e.trackAgainstAverage||e.showDataPoints?0:3,fill:t}),e.showAverageData&&this.lineChartData.datasets.push({label:"Average",data:[],order:e.trackAgainstAverage?0:1,parsing:!1,tension:.4,pointRadius:e.showDataPoints&&e.trackAgainstAverage?1.5:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:e.trackAgainstAverage?e.showDataPoints?0:3:0,fill:i}),this.setDatasetsColors()}setDatasetsColors(){this.lineChartData.datasets.forEach(e=>{e.label==="Value"?(e.borderColor=this.getThemeColors().valueLine,e.backgroundColor=this.getThemeColors().valueFill):e.label==="Average"&&(e.borderColor=this.getThemeColors().averageLine,e.backgroundColor=this.getThemeColors().averageFill)})}ensureAverageDatasetPresence(){let e=this.runtime.options();if(!e||!this.chart)return;let t=this.lineChartData.datasets.some(i=>i.label==="Average");if(e.showAverageData&&!t){if(this.lineChartData.datasets.findIndex(a=>a.label==="Value")>=0){let a=e.inverseYAxis?e.trackAgainstAverage?!1:"start":!e.trackAgainstAverage;this.lineChartData.datasets.push({label:"Average",data:[],order:e.trackAgainstAverage?0:1,parsing:!1,tension:.4,pointRadius:0,pointHoverRadius:0,pointHitRadius:0,borderWidth:e.trackAgainstAverage?3:0,fill:a})}}else!e.showAverageData&&t&&(this.lineChartData.datasets=this.lineChartData.datasets.filter(i=>i.label!=="Average"))}applyDynamicTrackAverageStyling(){let e=this.runtime.options();if(!e)return;let t=this.lineChartData.datasets.find(s=>s.label==="Value"),i=this.lineChartData.datasets.find(s=>s.label==="Average"),a,r;e.inverseYAxis&&e.trackAgainstAverage?(a="start",r=!1):e.inverseYAxis&&!e.trackAgainstAverage?(a=!1,r="start"):!e.inverseYAxis&&e.trackAgainstAverage?(a=!0,r=!1):(a=!1,r=!0),t&&(t.order=e.trackAgainstAverage?1:0,t.borderWidth=e.trackAgainstAverage?0:3,t.fill=a),i&&(i.order=e.trackAgainstAverage?0:1,i.borderWidth=e.trackAgainstAverage?3:0,i.fill=r)}updateAnnotationVisibility(){let e=this.runtime.options();if(!e||!this.chart)return;let t=this.chart.options.plugins.annotation?.annotations;t&&(t.minimumLine&&(t.minimumLine.display=e.showDatasetMinimumValueLine),t.maximumLine&&(t.maximumLine.display=e.showDatasetMaximumValueLine),t.averageLine&&(t.averageLine.display=e.showDatasetAverageValueLine))}getThemeColors(){let e=this.runtime.options()?.color,t={valueLine:null,valueFill:null,averageLine:null,averageFill:null,averageChartLine:null,chartLabel:null,chartValue:null};switch(e){case"contrast":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().contrastDimmer,t.valueFill=this.theme().contrastDimmer,t.averageLine=this.theme().contrast,t.averageFill=this.theme().contrast,t.chartValue=t.averageLine):(t.valueLine=this.theme().contrast,t.valueFill=this.theme().contrast,t.averageLine=this.theme().contrastDimmer,t.averageFill=this.theme().contrastDimmer,t.chartValue=this.theme().contrast),t.averageChartLine=this.theme().contrastDim,t.chartLabel=this.theme().contrastDim;break;case"blue":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().blueDimmer,t.valueFill=this.theme().blueDimmer,t.averageLine=this.theme().blue,t.averageFill=this.theme().blue,t.chartValue=t.averageLine):(t.valueLine=this.theme().blue,t.valueFill=this.theme().blue,t.averageLine=this.theme().blueDimmer,t.averageFill=this.theme().blueDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().blueDim,t.chartLabel=this.theme().contrastDim;break;case"green":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().greenDimmer,t.valueFill=this.theme().greenDimmer,t.averageLine=this.theme().green,t.averageFill=this.theme().green,t.chartValue=t.averageLine):(t.valueLine=this.theme().green,t.valueFill=this.theme().green,t.averageLine=this.theme().greenDimmer,t.averageFill=this.theme().greenDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greenDim,t.chartLabel=this.theme().contrastDim;break;case"pink":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().pinkDimmer,t.valueFill=this.theme().pinkDimmer,t.averageLine=this.theme().pink,t.averageFill=this.theme().pink,t.chartValue=t.averageLine):(t.valueLine=this.theme().pink,t.valueFill=this.theme().pink,t.averageLine=this.theme().pinkDimmer,t.averageFill=this.theme().pinkDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().pinkDim,t.chartLabel=this.theme().contrastDim;break;case"orange":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().orangeDimmer,t.valueFill=this.theme().orangeDimmer,t.averageLine=this.theme().orange,t.averageFill=this.theme().orange,t.chartValue=t.averageLine):(t.valueLine=this.theme().orange,t.valueFill=this.theme().orange,t.averageLine=this.theme().orangeDimmer,t.averageFill=this.theme().orangeDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().orangeDim,t.chartLabel=this.theme().contrastDim;break;case"purple":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().purpleDimmer,t.valueFill=this.theme().purpleDimmer,t.averageLine=this.theme().purple,t.averageFill=this.theme().purple,t.chartValue=t.averageLine):(t.valueLine=this.theme().purple,t.valueFill=this.theme().purple,t.averageLine=this.theme().purpleDimmer,t.averageFill=this.theme().purpleDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().purpleDim,t.chartLabel=this.theme().contrastDim;break;case"grey":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().greyDimmer,t.valueFill=this.theme().greyDimmer,t.averageLine=this.theme().grey,t.averageFill=this.theme().grey,t.chartValue=t.averageLine):(t.valueLine=this.theme().grey,t.valueFill=this.theme().grey,t.averageLine=this.theme().greyDimmer,t.averageFill=this.theme().greyDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().greyDim,t.chartLabel=this.theme().contrastDim;break;case"yellow":this.runtime.options()?.trackAgainstAverage?(t.valueLine=this.theme().yellowDimmer,t.valueFill=this.theme().yellowDimmer,t.averageLine=this.theme().yellow,t.averageFill=this.theme().yellow,t.chartValue=t.averageLine):(t.valueLine=this.theme().yellow,t.valueFill=this.theme().yellow,t.averageLine=this.theme().yellowDimmer,t.averageFill=this.theme().yellowDimmer,t.chartValue=t.valueFill),t.averageChartLine=this.theme().yellowDim,t.chartLabel=this.theme().contrastDim;break}return t}getUnitsLabel(){let e=null,t=this.runtime.options()?.convertUnitTo;switch(t){case"percent":case"percentraw":e="%";break;case"latitudeMin":e="latitude in minutes";break;case"latitudeSec":e="latitude in secondes";break;case"longitudeMin":e="longitude in minutes";break;case"longitudeSec":e="longitude in secondes";break;default:e=t;break}return e}startStreaming(){let e=this.runtime.options();if(!e?.datachartPath)return;this.dsServiceSub?.unsubscribe();let t=this.dsService.getDatasetBatchThenLiveObservable(this.id());this.dsServiceSub=t?.subscribe(i=>{if(this.chart){if(Array.isArray(i)){let a=this.transformDatasetRows(i,0);if(this.chart.data.datasets[0].data.push(...a),e.showAverageData&&this.lineChartData.datasets[1]){let s=this.transformDatasetRows(i,e.datasetAverageArray);this.chart.data.datasets[1].data.push(...s)}let r=i[i.length-1];r&&this.applyTitleAndAnnotationValues(r,e)}else{let a=this.transformDatasetRows([i],0)[0];if(this.chart.data.datasets[0].data.push(a),e.showAverageData&&this.lineChartData.datasets[1]){let r=this.transformDatasetRows([i],e.datasetAverageArray)[0];this.chart.data.datasets[1].data.push(r)}this.applyTitleAndAnnotationValues(i,e)}this.ngZone.runOutsideAngular(()=>this.chart?.update("none"))}})}applyTitleAndAnnotationValues(e,t){let i=t.trackAgainstAverage?e.data.sma??e.data.value:e.data.value,a=this.unitsService.convertToUnit(t.convertUnitTo,i);Number.isFinite(a)&&(this.chart.options.plugins.title.text=`${a.toFixed(t.numDecimal)} ${this.getUnitsLabel()} `);let r=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastAverage),s=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastMinimum),l=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastMaximum),g=this.chart.options.plugins.annotation?.annotations;g&&(Number.isFinite(r)&&g.averageLine?.value!==r&&(g.averageLine.value=r,g.averageLine.label.content=`${r.toFixed(t.numDecimal)}`),Number.isFinite(s)&&g.minimumLine?.value!==s&&(g.minimumLine.value=s,g.minimumLine.label.content=`${s.toFixed(t.numDecimal)}`),Number.isFinite(l)&&g.maximumLine?.value!==l&&(g.maximumLine.value=l,g.maximumLine.label.content=`${l.toFixed(t.numDecimal)}`))}transformDatasetRows(e,t){let i=this.runtime.options(),a=l=>this.unitsService.convertToUnit(i.convertUnitTo,l),r=i.verticalChart,s=i.datasetAverageArray;return e.map(l=>{if(r){if(t===0)return{x:a(l.data.value),y:l.timestamp};{let m={sma:l.data.sma,ema:l.data.ema,dema:l.data.doubleEma,avg:l.data.lastAverage};return{x:a(m[s]),y:l.timestamp}}}else{if(t===0)return{x:l.timestamp,y:a(l.data.value)};{let m={sma:l.data.sma,ema:l.data.ema,dema:l.data.doubleEma,avg:l.data.lastAverage};return{x:l.timestamp,y:a(m[s])}}}})}ngOnDestroy(){this.dsServiceSub?.unsubscribe(),this.chart?.destroy();let e=this.widgetDataChart?.()?.nativeElement;this.canvasService.releaseCanvas(e,{clear:!0,removeFromDom:!0})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-data-chart"]],viewQuery:function(t,i){t&1&&Me(i.widgetDataChart,xw,5,Ke),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:1,consts:[["widgetDataChart",""],[2,"z-index","inherit"],[1,"empty-state"],[1,"hint"]],template:function(t,i){t&1&&I(0,Cw,2,0,"canvas",1)(1,Sw,5,0,"div",2),t&2&&N(i.hasPath()?0:1)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.empty-state[_ngcontent-%COMP%]{display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;width:100%;text-align:center;color:var(--mat-sys-on-surface-variant)}.empty-state[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{margin:4px 0;padding:0 16px}.empty-state[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{font-size:.85em;opacity:.7}"],changeDetection:0})}return n})();var nf=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=mt();toggleOff="0 35 180 35";toggleOn="0 0 180 35";ctrlState=null;ctrlColor="";oldTheme=null;viewBox=this.toggleOff;labelColor=null;valueColor=null;constructor(){}ngDoCheck(){let e=this.data();e.value!=this.ctrlState&&(this.ctrlState=e.value,this.viewBox=e.value?this.toggleOn:this.toggleOff),e.color!=this.ctrlColor&&(this.ctrlColor=e.color,this.getColors(e.color));let t=this.theme();this.oldTheme!=t&&(this.oldTheme=t,this.getColors(e.color))}toggle(e){let t=this.data();t.value=e,this.toggleClick.emit(t)}getColors(e){switch(e){case"contrast":this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break;case"blue":this.labelColor=this.theme().blueDim,this.valueColor=this.theme().blue;break;case"green":this.labelColor=this.theme().greenDim,this.valueColor=this.theme().green;break;case"pink":this.labelColor=this.theme().pinkDim,this.valueColor=this.theme().pink;break;case"orange":this.labelColor=this.theme().orangeDim,this.valueColor=this.theme().orange;break;case"purple":this.labelColor=this.theme().purpleDim,this.valueColor=this.theme().purple;break;case"grey":this.labelColor=this.theme().greyDim,this.valueColor=this.theme().grey;break;case"yellow":this.labelColor=this.theme().yellowDim,this.valueColor=this.theme().yellow;break;default:this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["app-svg-boolean-light"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:26,vars:9,consts:[["version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs1"],["id","linearGradient32"],["offset","0","id","stop32",2,"stop-color","#000000","stop-opacity","0.88486844"],["offset","1","id","stop33",2,"stop-color","#f7f7f7","stop-opacity","0.17763157"],[0,"xlink","href","#linearGradient32","id","linearGradient33","x1","7.0431595","y1","17.869596","x2","39.043159","y2","17.869596","gradientUnits","userSpaceOnUse"],["id","disabled","transform","translate(0,35)"],["width","180","height","35","id","rect1-5","x","0","y","0",2,"display","inline","opacity","1","fill","black","fill-opacity","0","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","1"],["x","0","y","0","width","175","height","35","viewBox","0 0 175 35"],["id","text1-5","x","47.083984","y","22.636719",2,"text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","disabledToogleControl"],["cx","18","cy","16","id","circle3-7","r","13.5",2,"stroke-width","5","stroke","url(#linearGradient33)","stroke-opacity","0.2","stroke-dasharray","none"],["id","enabled"],["width","180","height","35","id","rect1","x","0","y","0",2,"display","inline","opacity","1","fill","black","fill-opacity","0","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","1"],["id","glow","x","-50%","y","-50%","width","200%","height","200%"],["stdDeviation","2.5","result","coloredBlur"],["in","coloredBlur"],["in","SourceGraphic"],["filter","url(#glow)","id","text1","x","47.083984","y","22.636719",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","enabledToogleControl"],["filter","url(#glow)","cx","18","cy","16","id","circle3","r","13.5",2,"stroke","url(#linearGradient33)","stroke-width","5","stroke-opacity","0.2","stroke-dasharray","none"]],template:function(t,i){t&1&&(ie(),E(0,"svg",0)(1,"defs",1)(2,"linearGradient",2),Q(3,"stop",3)(4,"stop",4),O(),Q(5,"linearGradient",5),O(),E(6,"g",6),Q(7,"rect",7),E(8,"svg",8)(9,"text",9),c(10),O()(),E(11,"g",10),Q(12,"circle",11),O()(),E(13,"g",12),Q(14,"rect",13),E(15,"svg",8)(16,"defs")(17,"filter",14),Q(18,"feGaussianBlur",15),E(19,"feMerge"),Q(20,"feMergeNode",16)(21,"feMergeNode",17),O()()(),E(22,"text",18),c(23),O()(),E(24,"g",19),Q(25,"circle",20),O()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),f(9),J("fill",i.labelColor),f(),fe(" ",i.data().ctrlLabel," "),f(2),J("fill",i.labelColor),f(10),J("fill",i.valueColor),f(),fe("",i.data().ctrlLabel," "),f(2),J("fill",i.valueColor))},encapsulation:2,changeDetection:0})}return n})();var af=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=mt();toggleOff="0 35 180 35";toggleOn="0 0 180 35";oldTheme=null;holdTimeoutId=null;emitIntervalId=null;pressed=!1;isSwiping=!1;pointerStartX=0;pointerStartY=0;viewBox=this.toggleOff;labelColorEnabled=null;labelColorDisabled=null;valueColor=null;ctrlColor="";ngDoCheck(){this.viewBox=this.pressed?this.toggleOn:this.toggleOff;let e=this.data();e.color!=this.ctrlColor&&(this.ctrlColor=e.color,this.getColors(e.color));let t=this.theme();this.oldTheme!=t&&(this.oldTheme=t,this.getColors(this.data().color))}handleClickDown(e){this.isSwiping=!1,this.pointerStartX=e.clientX,this.pointerStartY=e.clientY,this.clearTimers(),this.holdTimeoutId=setTimeout(()=>{if(!this.isSwiping){this.pressed=!0;let t=Ft(this.data());t.value=this.pressed,this.toggleClick.emit(t),this.emitIntervalId=setInterval(()=>{this.toggleClick.emit(t)},100)}},200)}handlePointerMove(e){let t=Math.abs(e.clientX-this.pointerStartX),i=Math.abs(e.clientY-this.pointerStartY);(t>30||i>30)&&(this.isSwiping=!0,this.holdTimeoutId&&(clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null))}handleClickUp(){if(this.isSwiping){this.isSwiping=!1;return}this.pressed=!1,this.emitIntervalId&&(clearInterval(this.emitIntervalId),this.emitIntervalId=null),this.holdTimeoutId&&(clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null)}getColors(e){switch(e){case"contrast":this.labelColorEnabled="black",this.labelColorDisabled=this.theme().contrastDim,this.valueColor=this.theme().contrast;break;case"blue":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().blueDim,this.valueColor=this.theme().blue;break;case"green":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().greenDim,this.valueColor=this.theme().green;break;case"pink":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().pinkDim,this.valueColor=this.theme().pink;break;case"orange":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().orangeDim,this.valueColor=this.theme().orange;break;case"purple":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().purpleDim,this.valueColor=this.theme().purple;break;case"grey":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().greyDim,this.valueColor=this.theme().grey;break;case"yellow":this.labelColorEnabled=this.theme().contrast,this.labelColorDisabled=this.theme().yellowDim,this.valueColor=this.theme().yellow;break;default:this.labelColorEnabled="black",this.labelColorDisabled=this.theme().contrastDim,this.valueColor=this.theme().contrast;break}}clearTimers(){this.holdTimeoutId&&(clearTimeout(this.holdTimeoutId),this.holdTimeoutId=null),this.emitIntervalId&&(clearInterval(this.emitIntervalId),this.emitIntervalId=null)}ngOnDestroy(){this.clearTimers()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["app-svg-boolean-button"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:15,vars:9,consts:[["version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs9"],[3,"pointerup","pointerleave","pointerdown","pointermove"],["id","disabled","transform","translate(0,35)"],["id","clickRecDisabled","width","180","height","35","x","0","y","0","pointer-events","all",2,"display","inline","opacity","1","fill","transparent","fill-opacity","1","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["id","buttonDisabled","width","165.02518","height","25.025183","rx","3.6672263","x","7.4874101","y","4.9874086",2,"display","inline","mix-blend-mode","normal","fill-opacity","1","stroke","#ffffff","stroke-width","1.5","stroke-dasharray","none","stroke-opacity","0.2"],["x","12","y","0","width","156","height","35","viewBox","0 0 156 35"],["id","textDisabled","x","77.968102","y","22",2,"text-anchor","middle","text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["id","enabled"],["width","180","height","35","id","rect1","x","0","y","0","pointer-events","all",2,"display","inline","opacity","1","fill","transparent","fill-opacity","1","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["id","buttonEnabled","width","165.02518","height","25.025183","rx","3.6672263","x","5.9874086","y","4.9874086","transform","translate(1.5)",2,"display","inline","opacity","1","mix-blend-mode","normal","stroke","#000000","stroke-width","1.5","stroke-dasharray","none","stroke-opacity","0.2"],["id","textEnabled","x","77.968102","y","22",2,"text-anchor","middle","text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"]],template:function(t,i){t&1&&(ie(),E(0,"svg",0),Q(1,"defs",1),E(2,"g",2),Fo("pointerup",function(){return i.handleClickUp()})("pointerleave",function(){return i.handleClickUp()})("pointerdown",function(r){return i.handleClickDown(r)})("pointermove",function(r){return i.handlePointerMove(r)}),E(3,"g",3),Q(4,"rect",4)(5,"rect",5),E(6,"svg",6)(7,"text",7),c(8),O()()(),E(9,"g",8),Q(10,"rect",9)(11,"rect",10),E(12,"svg",6)(13,"text",11),c(14),O()()()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),f(5),J("fill",i.labelColorDisabled),f(2),J("fill",i.labelColorDisabled),f(),fe(" ",i.data().ctrlLabel," "),f(3),J("fill",i.valueColor),f(2),J("fill",i.labelColorEnabled),f(),fe(" ",i.data().ctrlLabel," "))},encapsulation:2,changeDetection:0})}return n})();function ul(n={}){let o=n.threshold??30,e=!1,t=0,i=0,a=null,r=null,s=()=>{e=!1,t=0,i=0,a=null,r=null};return{onPointerDown(l){e=!1,t=l.clientX,i=l.clientY;let m=l.currentTarget;if(m&&typeof m.setPointerCapture=="function")try{m.setPointerCapture(l.pointerId),a=m,r=l.pointerId}catch(g){}},onPointerMove(l){let m=Math.abs(l.clientX-t),g=Math.abs(l.clientY-i);(m>o||g>o)&&(e=!0)},onPointerUp(l){if(a&&r!==null){let g=a;if(typeof g.releasePointerCapture=="function")try{(!l||g.hasPointerCapture?.(r))&&g.releasePointerCapture(r)}catch(v){}}let m=!e;return s(),m},onPointerCancel(l){if(a&&r!==null){let m=a;if(typeof m.releasePointerCapture=="function")try{(!l||m.hasPointerCapture?.(r))&&m.releasePointerCapture(r)}catch(g){}}s()},reset:s}}var of=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=mt();toggleOff="0 35 180 35";toggleOn="0 0 180 35";ctrlState=null;oldTheme=null;swipeGuard=ul();viewBox=this.toggleOff;labelColor=null;valueColor=null;ctrlColor="";constructor(){}ngDoCheck(){let e=this.data();e.value!=this.ctrlState&&(this.ctrlState=e.value,this.viewBox=e.value?this.toggleOn:this.toggleOff),e.color!=this.ctrlColor&&(this.ctrlColor=e.color,this.getColors(e.color));let t=this.theme();this.oldTheme!=t&&(this.oldTheme=t,this.getColors(e.color))}onPointerDown(e){this.swipeGuard.onPointerDown(e)}onPointerMove(e){this.swipeGuard.onPointerMove(e)}onPointerUp(e,t){this.swipeGuard.onPointerUp(e)&&this.toggle(t)}onPointerCancel(e){this.swipeGuard.onPointerCancel(e)}toggle(e){let t=this.data();t.value=e,this.toggleClick.emit(t)}getColors(e){switch(e){case"contrast":this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break;case"blue":this.labelColor=this.theme().blueDim,this.valueColor=this.theme().blue;break;case"green":this.labelColor=this.theme().greenDim,this.valueColor=this.theme().green;break;case"pink":this.labelColor=this.theme().pinkDim,this.valueColor=this.theme().pink;break;case"orange":this.labelColor=this.theme().orangeDim,this.valueColor=this.theme().orange;break;case"purple":this.labelColor=this.theme().purpleDim,this.valueColor=this.theme().purple;break;case"grey":this.labelColor=this.theme().greyDim,this.valueColor=this.theme().grey;break;case"yellow":this.labelColor=this.theme().yellowDim,this.valueColor=this.theme().yellow;break;default:this.labelColor=this.theme().contrastDim,this.valueColor=this.theme().contrast;break}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["app-svg-boolean-switch"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:24,vars:10,consts:[["version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs9"],["id","disabled","transform","translate(0,35)",3,"pointerdown","pointermove","pointerup","pointercancel"],["width","180","height","35","id","rect1-5","x","0","y","0","pointer-events","all",2,"display","inline","opacity","0.001","fill","black","fill-opacity","0.001","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["x","0","y","0","width","175","height","35","viewBox","0 0 175 35"],["id","text1-5","x","47.083984","y","22.636719",2,"text-align","center","font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","disabledToogleControl"],["width","37.714306","height","22","rx","10.999999","id","rect3-4","x","0","y","5",2,"stroke-width","1.57144","fill","var(--mat-sys-outline)","fill-opacity","1"],["cx","11.5","cy","16","id","circle3-7","r","10",2,"stroke-width","1.5","stroke","black","stroke-opacity","0.2","stroke-dasharray","none"],["id","enabled",3,"pointerdown","pointermove","pointerup","pointercancel"],["width","180","height","35","id","rect1","x","0","y","0","pointer-events","all",2,"display","inline","opacity","0.001","fill","black","fill-opacity","0.001","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["id","glow","x","-50%","y","-50%","width","200%","height","200%"],["stdDeviation","2.5","result","coloredBlur"],["in","coloredBlur"],["in","SourceGraphic"],["filter","url(#glow)","id","text1","x","47.083984","y","22.636719",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","14px","font-family","arial","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],["transform","translate(6,2)","id","enabledToogleControl"],["filter","url(#glow)","width","37.714306","height","22","rx","10.999999","id","rect3","x","0","y","5",2,"stroke-width","1.57144"],["cx","26.5","cy","16","id","circle3","r","10",2,"stroke-width","1.5","stroke","black","stroke-opacity","0.2","stroke-dasharray","none"]],template:function(t,i){t&1&&(ie(),E(0,"svg",0),Q(1,"defs",1),E(2,"g",2),Fo("pointerdown",function(r){return i.onPointerDown(r)})("pointermove",function(r){return i.onPointerMove(r)})("pointerup",function(r){return i.onPointerUp(r,!0)})("pointercancel",function(r){return i.onPointerCancel(r)}),Q(3,"rect",3),E(4,"svg",4)(5,"text",5),c(6),O()(),E(7,"g",6),Q(8,"rect",7)(9,"circle",8),O()(),E(10,"g",9),Fo("pointerdown",function(r){return i.onPointerDown(r)})("pointermove",function(r){return i.onPointerMove(r)})("pointerup",function(r){return i.onPointerUp(r,!1)})("pointercancel",function(r){return i.onPointerCancel(r)}),Q(11,"rect",10),E(12,"svg",4)(13,"defs")(14,"filter",11),Q(15,"feGaussianBlur",12),E(16,"feMerge"),Q(17,"feMergeNode",13)(18,"feMergeNode",14),O()()(),E(19,"text",15),c(20),O()(),E(21,"g",16),Q(22,"rect",17)(23,"circle",18),O()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),f(5),J("fill",i.labelColor),f(),fe(" ",i.data().ctrlLabel," "),f(3),J("fill",i.labelColor),f(10),J("fill",i.valueColor),f(),fe("",i.data().ctrlLabel," "),f(2),J("fill",i.labelColor),f(),J("fill",i.valueColor))},encapsulation:2,changeDetection:0})}return n})();function ww(n,o){if(n&1&&W(0,"widget-title",1),n&2){let e=k(),t=yn(0);R("text",t==null?null:t.displayName)("color",e.labelColor())}}function _w(n,o){if(n&1){let e=we();d(0,"app-svg-boolean-switch",5),U("toggleClick",function(i){ee(e);let a=k(2);return te(a.toggle(i))}),u()}if(n&2){let e=k().$implicit,t=k();R("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function Mw(n,o){if(n&1){let e=we();d(0,"app-svg-boolean-button",5),U("toggleClick",function(i){ee(e);let a=k(2);return te(a.toggle(i))}),u()}if(n&2){let e=k().$implicit,t=k();R("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function kw(n,o){if(n&1){let e=we();d(0,"app-svg-boolean-light",5),U("toggleClick",function(i){ee(e);let a=k(2);return te(a.toggle(i))}),u()}if(n&2){let e=k().$implicit,t=k();R("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function Tw(n,o){if(n&1&&(Ji(0),I(1,_w,1,3,"app-svg-boolean-switch",4)(2,Mw,1,3,"app-svg-boolean-button",4)(3,kw,1,3,"app-svg-boolean-light",4),en()),n&2){let e,t=o.$implicit;f(),N((e=t.type)==="1"?1:e==="2"?2:e==="3"?3:-1)}}function Dw(n,o){n&1&&W(0,"div",3)}var rf=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Switch Panel Label",showLabel:!0,filterSelfPaths:!0,paths:[],enableTimeout:!1,dataTimeout:5,color:"contrast",zonesOnlyPaths:!1,putEnable:!0,putMomentary:!1,multiChildCtrls:[]};cdr=y(Si);ngZone=y(qe);runtime=y(Se,{optional:!0});streams=y(We,{optional:!0});dashboard=y(yt);signalkRequestsService=y(di);toast=y(nn);switchControls=w([]);labelColor=w(void 0);noTitleClass=X(()=>this.runtime?.options()?.showLabel===!1?"widgets-container-no-title":"widgets-container");nbCtrl=null;ctrlDimensions={width:0,height:0};skRequestSub=new Ba;constructor(){L(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||G(()=>{this.labelColor.set(Te(t.color,e).dim)})}),L(()=>{let e=this.runtime?.options();if(!e)return;let t=(e.multiChildCtrls||[]).map(i=>ge(ne({},i),{isNumeric:i.isNumeric??!1}));this.nbCtrl=t.length,G(()=>{this.switchControls.set(t),this.streams&&t.forEach(i=>{let a=e.paths;if(!a?.length)return;let r=a.findIndex(l=>l.pathID===i.pathID);r<0||!a[r]?.path||this.streams.observe(String(r),l=>{let m=l?.data?.value,g=i.isNumeric?[0,1,null].includes(m)?!!m:i.value:m;this.ngZone.run(()=>{this.switchControls.update(v=>{let A=v.findIndex(_=>_.pathID===i.pathID);if(A===-1)return v;let C=ge(ne({},v[A]),{value:g});return[...v.slice(0,A),C,...v.slice(A+1)]}),this.cdr.markForCheck()})})})})})}onResized(e){let t=this.nbCtrl||1,i=e.contentRect.height/t,a=35*e.contentRect.width/180,r=a<i?a:i;this.ctrlDimensions={width:e.contentRect.width,height:r}}toggle(e){let t=this.runtime?.options();if(!t?.putEnable)return;let i=t.paths;if(!i)return;let a=i.findIndex(s=>s.pathID===e.pathID);if(a<0)return;let r=i[a].path;r&&(e.isNumeric?this.signalkRequestsService.putRequest(r,e.value?1:0,this.id()):this.signalkRequestsService.putRequest(r,e.value,this.id()))}ngOnDestroy(){this.skRequestSub?.unsubscribe()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-boolean-switch"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:7,vars:5,consts:[["widgetContainer",""],[3,"text","color"],["kipResizeObserver","",3,"resizeChange"],[1,"widgetOverlay"],[1,"svg-widget",3,"controlData","theme","dimensions"],[1,"svg-widget",3,"toggleClick","controlData","theme","dimensions"]],template:function(t,i){if(t&1&&(ga(0),I(1,ww,1,2,"widget-title",1),d(2,"div",2,0),U("resizeChange",function(r){return i.onResized(r)}),Ae(4,Tw,4,1,"ng-container",null,Ne),u(),I(6,Dw,1,0,"div",3)),t&2){let a=An(i.runtime==null?null:i.runtime.options());f(),N(a!=null&&a.showLabel?1:-1),f(),at(i.noTitleClass()),f(2),ye(i.switchControls()),f(2),N(i.dashboard.isDashboardStatic()?-1:6)}},dependencies:[Xt,of,af,nf,Qn],styles:[".widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20}.widgets-container-no-title[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;padding:3px 0 0;height:100%;width:100%;overflow:hidden;z-index:20}.svg-widget[_ngcontent-%COMP%]{display:flex}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"],changeDetection:0})}return n})();var sf=(n,o)=>o.raw.value;function Ew(n,o){if(n&1&&W(0,"widget-title",0),n&2){let e=k();R("text",e.displayName())("color",e.accentColor())}}function Pw(n,o){if(n&1&&(ie(),W(0,"path")),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.fullRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Iw(n,o){if(n&1&&(ie(),W(0,"path")),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.topRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Nw(n,o){if(n&1&&(ie(),W(0,"path")),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.bottomRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Ow(n,o){if(n&1&&(ie(),W(0,"rect",18)),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("width",t.menuWidth)("height",t.itemHeight)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Rw(n,o){if(n&1){let e=we();ie(),d(0,"g",15),U("pointerdown",function(i){ee(e);let a=k();return te(a.onPointerDown(i))})("pointermove",function(i){ee(e);let a=k();return te(a.onPointerMove(i))})("pointerup",function(i){let a=ee(e).$implicit,r=k();return te(r.onPointerUp(i,a))})("pointercancel",function(i){ee(e);let a=k();return te(a.onPointerCancel(i))})("keyup.enter",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))})("keyup.space",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))}),I(1,Pw,1,4,":svg:path",16)(2,Iw,1,4,":svg:path",16)(3,Nw,1,4,":svg:path",16)(4,Ow,1,5,":svg:rect",17),d(5,"text"),c(6),u()()}if(n&2){let e=o.$implicit,t=k();xe("cursor",t.canPut()?"pointer":"not-allowed"),dt("is-selected",t.isSelected(e.raw))("is-off",e.raw.isOn===!1),J("transform","translate(0 "+e.index*(t.itemHeight+t.itemGap)+")")("tabindex",t.canPut()?0:-1)("aria-label",e.label)("aria-pressed",t.isSelected(e.raw))("aria-disabled",!t.canPut()),f(),N(e.index===0&&e.index===t.optionsCount()-1?1:e.index===0?2:e.index===t.optionsCount()-1?3:4),f(4),at(t.isSelected(e.raw)?"svg-menu-item-current-text":e.raw.isOn===!1?"svg-menu-item-off-text":"svg-menu-item-text"),J("x",t.menuWidth/2)("y",t.itemHeight/2)("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",(t.isSelected(e.raw)||e.raw.isOn===!1,t.textColor())),f(),Ut(" ",t.isSelected(e.raw)?"\u2713 ":"","",e.label," ")}}function Vw(n,o){if(n&1&&(ie(),W(0,"path")),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.fullRoundedItemPathD())("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Lw(n,o){if(n&1&&(ie(),W(0,"path")),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.topRoundedItemPathD())("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Ww(n,o){if(n&1&&(ie(),W(0,"path")),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("d",t.bottomRoundedItemPathD())("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Fw(n,o){if(n&1&&(ie(),W(0,"rect",18)),n&2){let e=k().$implicit,t=k();at(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),J("width",t.menuWidth)("height",t.itemHeight)("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function Gw(n,o){if(n&1){let e=we();ie(),d(0,"g",15),U("pointerdown",function(i){ee(e);let a=k();return te(a.onPointerDown(i))})("pointermove",function(i){ee(e);let a=k();return te(a.onPointerMove(i))})("pointerup",function(i){let a=ee(e).$implicit,r=k();return te(r.onPointerUp(i,a))})("pointercancel",function(i){ee(e);let a=k();return te(a.onPointerCancel(i))})("keyup.enter",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))})("keyup.space",function(){let i=ee(e).$implicit,a=k();return te(a.canPut()&&a.selectUi(i))}),I(1,Vw,1,5,":svg:path",16)(2,Lw,1,5,":svg:path",16)(3,Ww,1,5,":svg:path",16)(4,Fw,1,6,":svg:rect",17),d(5,"text"),c(6),u()()}if(n&2){let e=o.$implicit,t=k();xe("cursor",t.canPut()?"pointer":"not-allowed"),dt("is-selected",t.isSelected(e.raw))("is-off",e.raw.isOn===!1),J("transform","translate(0 "+e.index*(t.itemHeight+t.itemGap)+")")("tabindex",t.canPut()?0:-1)("aria-label",e.label)("aria-pressed",t.isSelected(e.raw))("aria-disabled",!t.canPut()),f(),N(e.index===0&&e.index===t.optionsCount()-1?1:e.index===0?2:e.index===t.optionsCount()-1?3:4),f(4),at(t.isSelected(e.raw)?"svg-menu-item-current-text":e.raw.isOn===!1?"svg-menu-item-off-text":"svg-menu-item-text"),J("x",t.menuWidth/2)("y",t.itemHeight/2)("filter",t.isSelected(e.raw)?"url(#glow)":null)("fill",(t.isSelected(e.raw)||e.raw.isOn===!1,t.textColor())),f(),Ut(" ",t.isSelected(e.raw)?"\u2713 ":"","",e.label," ")}}function Bw(n,o){n&1&&W(0,"div",14)}var lf=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Switch Label",showLabel:!0,filterSelfPaths:!0,paths:{controlPath:{description:"Multi-state control path",path:null,source:null,pathType:"multiple",supportsPut:!0,isPathConfigurable:!0,pathRequired:!0,showPathSkUnitsFilter:!1,pathSkUnitsFilter:null,showConvertUnitTo:!1,convertUnitTo:null,sampleTime:500}},enableTimeout:!1,dataTimeout:5,color:"contrast"};runtime=y(Se);streams=y(We);meta=y(mi);signalkRequestsService=y(di);dashboard=y(yt);toast=y(nn);skRequest=Mi(this.signalkRequestsService.subscribeRequest(),{initialValue:null});cfg=X(()=>this.runtime.options());displayName=X(()=>this.cfg()?.displayName);showLabel=X(()=>this.cfg()?.showLabel);controlPath=X(()=>this.getControlPath(this.cfg()));accentColor=w(void 0);accentDim=w(void 0);accentDimmer=w(void 0);textColor=w(void 0);textDim=w(void 0);textDimmer=w(void 0);currentValue=w(null);sortedOptions=X(()=>{let e=this.meta.possibleValues();if(!e.length)return[];let t=e.map(i=>({raw:i,label:i.title||i.abbrev||String(i.value),comparable:this.toComparable(i.value)}));return t.sort((i,a)=>{let r=i.comparable,s=a.comparable;return r.kind==="num"&&s.kind==="num"?r.value-s.value:r.kind==="str"&&s.kind==="str"?r.value.localeCompare(s.value):r.kind==="num"?-1:1}),t.map((i,a)=>ge(ne({},i),{index:a}))});menuWidth=220;itemHeight=50;itemGap=1;svgPadding=Math.max(1,Math.round(this.itemHeight*.2));optionsCount=X(()=>this.sortedOptions().length);menuHeight=X(()=>{let e=this.sortedOptions().length;return e<=0?0:e*this.itemHeight+(e-1)*this.itemGap});hasOptions=X(()=>this.meta.possibleValues().length>0);selectedValue=X(()=>this.currentValue());canPut=X(()=>this.meta.supportsPut());swipeGuard=ul();unselectedOptions=X(()=>this.sortedOptions().filter(e=>!this.isSelected(e.raw)));selectedOptions=X(()=>this.sortedOptions().filter(e=>this.isSelected(e.raw)));fullRoundedItemPathD=X(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!0,!0));topRoundedItemPathD=X(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!0,!1));bottomRoundedItemPathD=X(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!1,!0));cornerRadius=7;constructor(){L(()=>{let e=this.theme(),t=this.cfg().color;!e||!t||G(()=>{this.accentColor.set(Te(t,e).color),this.accentDim.set(Te(t,e).dim),this.accentDimmer.set(Te(t,e).dimmer),t==="contrast"?(this.textColor.set(e.background),this.textDim.set(e.contrastDim),this.textDimmer.set(e.contrastDimmer)):(this.textColor.set(e.contrast),this.textDim.set(Te(t,e).dim),this.textDimmer.set(Te(t,e).dimmer))})}),L(()=>{if(!this.controlPath()){this.currentValue.set(null);return}G(()=>{this.streams.observe("controlPath",t=>{this.currentValue.set(t?.data?.value??null)}),this.meta.observe("controlPath")})})}select(e){let t=this.getControlPath(this.cfg());t&&this.signalkRequestsService.putRequest(t,e.value,this.id())}selectUi(e){this.select(e.raw)}onPointerDown(e){this.canPut()&&this.swipeGuard.onPointerDown(e)}onPointerMove(e){this.canPut()&&this.swipeGuard.onPointerMove(e)}onPointerUp(e,t){this.canPut()&&this.swipeGuard.onPointerUp(e)&&this.selectUi(t)}onPointerCancel(e){this.swipeGuard.onPointerCancel(e)}getControlPath(e){let t=e?.paths;return!t||Array.isArray(t)?null:t.controlPath?.path??null}isSelected(e){let t=this.selectedValue();return typeof e.value=="number"&&typeof t=="string"?e.value===Number(t):typeof e.value=="string"&&typeof t=="number"?Number(e.value)===t||e.value===String(t):Object.is(e.value,t)}toComparable(e){if(typeof e=="number"&&Number.isFinite(e))return{kind:"num",value:e};if(typeof e=="boolean")return{kind:"num",value:e?1:0};if(typeof e=="string"){let t=e.trim();if(/^-?\d+(\.\d+)?$/.test(t)){let i=Number(t);if(Number.isFinite(i))return{kind:"num",value:i}}return{kind:"str",value:t}}return{kind:"str",value:String(e)}}buildRoundedRectPath(e,t,i,a,r){let s=Math.max(0,e),l=Math.max(0,t),m=Math.max(0,Math.min(i,s/2,l/2));return s===0||l===0?"":m===0?`M0 0H${s}V${l}H0Z`:a&&r?[`M${m} 0`,`H${s-m}`,`A${m} ${m} 0 0 1 ${s} ${m}`,`V${l-m}`,`A${m} ${m} 0 0 1 ${s-m} ${l}`,`H${m}`,`A${m} ${m} 0 0 1 0 ${l-m}`,`V${m}`,`A${m} ${m} 0 0 1 ${m} 0`,"Z"].join(""):a?[`M0 ${m}`,`A${m} ${m} 0 0 1 ${m} 0`,`H${s-m}`,`A${m} ${m} 0 0 1 ${s} ${m}`,`V${l}`,"H0","Z"].join(""):r?["M0 0",`H${s}`,`V${l-m}`,`A${m} ${m} 0 0 1 ${s-m} ${l}`,`H${m}`,`A${m} ${m} 0 0 1 0 ${l-m}`,"V0","Z"].join(""):`M0 0H${s}V${l}H0Z`}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-multi-state-switch"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:23,vars:6,consts:[[3,"text","color"],["role","group",1,"widgets-container"],["preserveAspectRatio","xMidYMid meet","role","presentation",1,"svg-menu"],["id","glow","x","-50%","y","-50%","width","200%","height","200%"],["stdDeviation","5","result","coloredBlur"],["in","coloredBlur"],["in","SourceGraphic"],["id","focus-inner-ring","x","0","y","0","width","100%","height","100%","color-interpolation-filters","sRGB"],["in","SourceAlpha","operator","erode","radius","2","result","eroded"],["in","SourceAlpha","in2","eroded","operator","out","result","border"],["flood-color","#ffffff","flood-opacity","0.9","result","ringColor"],["in","ringColor","in2","border","operator","in","result","ring"],["in","ring"],["role","button",1,"svg-menu-item-group",3,"is-selected","is-off","cursor"],[1,"widgetOverlay"],["role","button",1,"svg-menu-item-group",3,"pointerdown","pointermove","pointerup","pointercancel","keyup.enter","keyup.space"],[3,"class"],["x","0","y","0",3,"class"],["x","0","y","0"]],template:function(t,i){t&1&&(I(0,Ew,1,2,"widget-title",0),d(1,"div",1),ie(),d(2,"svg",2)(3,"defs")(4,"filter",3),W(5,"feGaussianBlur",4),d(6,"feMerge"),W(7,"feMergeNode",5)(8,"feMergeNode",6),u()(),d(9,"filter",7),W(10,"feMorphology",8)(11,"feComposite",9)(12,"feFlood",10)(13,"feComposite",11),d(14,"feMerge"),W(15,"feMergeNode",6)(16,"feMergeNode",12),u()()(),d(17,"g"),Ae(18,Rw,7,20,":svg:g",13,sf),Ae(20,Gw,7,20,":svg:g",13,sf),u()()(),I(22,Bw,1,0,"div",14)),t&2&&(N(i.showLabel()?0:-1),f(),J("aria-label",i.displayName()),f(),J("viewBox","0 0 "+(i.menuWidth+i.svgPadding*2)+" "+((i.menuHeight()||i.itemHeight)+i.svgPadding*2))("aria-label",i.displayName()),f(15),J("transform","translate("+i.svgPadding+" "+i.svgPadding+")"),f(),ye(i.unselectedOptions()),f(2),ye(i.selectedOptions()),f(2),N(i.dashboard.isDashboardStatic()?-1:22))},dependencies:[Qn],styles:["[_nghost-%COMP%]{display:block;height:100%}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}.widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;padding:2px}.svg-menu[_ngcontent-%COMP%]{width:100%;height:100%;display:block;background:transparent;border-radius:12px;z-index:20;font-family:Roboto;font-size:1.3rem;font-weight:700;text-anchor:middle;text-align:center;alignment-baseline:middle}.svg-menu-item-current[_ngcontent-%COMP%]{stroke:var(--mat-sys-on-background);stroke-width:3px;stroke-dasharray:none;stroke-opacity:1}.svg-menu-item[_ngcontent-%COMP%]{fill:var(--mat-sys-outline);stroke:#000;stroke-width:2px;stroke-dasharray:none;stroke-opacity:.2}.svg-menu-item-off[_ngcontent-%COMP%]{stroke:#000;stroke-width:2;stroke-dasharray:none;stroke-opacity:.2}.svg-menu-item-current-text[_ngcontent-%COMP%]{font-size:1.5rem;font-weight:700;text-anchor:middle;dominant-baseline:middle;alignment-baseline:middle}.svg-menu-item-text[_ngcontent-%COMP%], .svg-menu-item-off-text[_ngcontent-%COMP%]{font-weight:600;text-anchor:middle;dominant-baseline:middle;alignment-baseline:middle}.svg-menu-item-group[_ngcontent-%COMP%]:focus{outline:none}.svg-menu-item-group[_ngcontent-%COMP%]:focus-visible :is(rect[_ngcontent-%COMP%], path[_ngcontent-%COMP%]){filter:url(#focus-inner-ring)}"],changeDetection:0})}return n})();var df=(()=>{class n{data=x(null,{alias:"controlData"});theme=x(null);dimensions=x.required();toggleClick=mt();ctrlLabelColor=w(null);ctrlStateColor=w(null);messageTxtColor=w(null);shouldEmergencyBlink=X(()=>(this.data()?.notificationState??"").toLowerCase()==="emergency");shouldAlarmBlink=X(()=>(this.data()?.notificationState??"").toLowerCase()==="alarm");constructor(){L(()=>{let e=this.data(),t=this.theme();G(()=>{switch(e.notificationState){case ve.Emergency:this.ctrlStateColor.set(t.zoneEmergency),this.messageTxtColor.set(t.background);break;case ve.Alarm:this.ctrlStateColor.set(t.zoneAlarm),this.messageTxtColor.set(t.background);break;case ve.Warn:this.ctrlStateColor.set(t.zoneWarn),this.messageTxtColor.set(t.background);break;case ve.Alert:this.ctrlStateColor.set(t.zoneAlert),this.messageTxtColor.set(t.background);break;default:this.ctrlStateColor.set(t.background),this.messageTxtColor.set(Te(e.color,t).dim);break}this.ctrlLabelColor.set(Te(e.color,t).color)})})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["app-svg-zone-states"]],inputs:{data:[1,"controlData","data"],theme:[1,"theme"],dimensions:[1,"dimensions"]},outputs:{toggleClick:"toggleClick"},decls:12,vars:14,consts:[["viewBox","0 0 180 75","version","1.1","id","svg9","xmlns","http://www.w3.org/2000/svg",0,"xmlns","svg","http://www.w3.org/2000/svg"],["id","defs9"],["id","zoneStateCtrl"],["id","touchRect","width","180","height","75","x","0","y","0","pointer-events","all",2,"display","inline","opacity","1","fill","transparent","fill-opacity","1","stroke","none","stroke-width","0","stroke-dasharray","none","stroke-opacity","0"],["x","0","y","0","width","180","height","20"],["xmlns","http://www.w3.org/1999/xhtml",2,"width","180px","height","20px","display","flex","align-items","center","justify-content","center","font-weight","bold","font-size","14px","line-height","1.1","text-align","center","overflow","hidden","word-break","break-word","white-space","normal"],["id","outlineRect","x","6","y","22","width","168","height","43","rx","3.5","fill","none",2,"display","inline","opacity","1","mix-blend-mode","normals","stroke-width","1","stroke-dasharray","none","stroke-opacity","0.65"],["id","innerRect","x","7","y","23","width","166","height","41","rx","3.5",2,"display","inline","opacity","1","mix-blend-mode","normal","stroke","none","stroke-width","0"],["x","7","y","23","width","166","height","41"],["xmlns","http://www.w3.org/1999/xhtml",2,"width","166px","height","41px","display","flex","align-items","center","justify-content","center","font-weight","regular","font-size","12px","line-height","1.1","text-align","center","overflow","hidden","word-break","break-word","white-space","normal","padding","2px"]],template:function(t,i){t&1&&(ie(),E(0,"svg",0),Q(1,"defs",1),E(2,"g",2),Q(3,"rect",3),E(4,"foreignObject",4),Be(),E(5,"div",5),c(6),O()(),ie(),Q(7,"rect",6)(8,"rect",7),E(9,"foreignObject",8),Be(),E(10,"div",9),c(11),O()()()()),t&2&&(J("height",i.dimensions().height)("width",i.dimensions().width),f(5),xe("color",i.ctrlLabelColor()),f(),fe(" ",i.data().ctrlLabel," "),f(),J("stroke",i.ctrlLabelColor()),f(),dt("emergency-blink-fill",i.shouldEmergencyBlink())("alarm-blink-fill",i.shouldAlarmBlink()),J("fill",i.ctrlStateColor()),f(2),xe("color",i.messageTxtColor()),f(),fe(" ",i.data().notificationMessage," "))},styles:["@keyframes _ngcontent-%COMP%_AlarmBlinkFill{0%,49%{opacity:1}50%,to{opacity:.6}}.alarm-blink-fill[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_AlarmBlinkFill 1s step-end infinite}@keyframes _ngcontent-%COMP%_EmergencyBlinkFill{0%,49%{opacity:1}50%,to{opacity:.1}}.emergency-blink-fill[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_EmergencyBlinkFill .3s step-end infinite}"],changeDetection:0})}return n})();function zw(n,o){if(n&1&&W(0,"widget-title",1),n&2){let e=k(),t=yn(0);R("text",t==null?null:t.displayName)("color",e.labelColor())}}function Uw(n,o){if(n&1&&W(0,"app-svg-zone-states",4),n&2){let e=k().$implicit,t=k();R("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions())}}function Hw(n,o){if(n&1&&(Ji(0),I(1,Uw,1,3,"app-svg-zone-states",4),en()),n&2){let e,t=o.$implicit;f(),N((e=t.type)==="4"?1:-1)}}function qw(n,o){n&1&&W(0,"div",3)}var cf=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={displayName:"Zones State Panel Label",showLabel:!0,filterSelfPaths:!0,paths:[],enableTimeout:!1,dataTimeout:5,color:"contrast",putEnable:!1,zonesOnlyPaths:!0,putMomentary:!1,multiChildCtrls:[]};cdr=y(Si);ngZone=y(qe);runtime=y(Se,{optional:!0});notificationsService=y(zu);dashboard=y(yt);notifications=Mi(this.notificationsService.observeNotifications());zonesControls=w([]);labelColor=w(void 0);noTitleClass=X(()=>this.runtime?.options()?.showLabel===!1?"widgets-container-no-title":"widgets-container");pathIdToNotificationPath=new Map;hostSize=w(null);ctrlDimensions=X(()=>{let e=this.hostSize();if(!e)return{width:0,height:0};let t=Math.max(1,this.zonesControls().length),i=e.height/t,a=75*e.width/180,r=Math.min(a,i);return{width:e.width,height:r}});constructor(){L(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||(G(()=>{this.labelColor.set(Te(t.color,e).dim)}),this.cdr.markForCheck())}),L(()=>{let e=this.runtime?.options();e&&(G(()=>{let t=(e.multiChildCtrls||[]).map(a=>ge(ne({},a),{isNumeric:a.isNumeric??!1}));this.zonesControls.set(t);let i=e.paths;if(i?.length){this.pathIdToNotificationPath.clear();for(let a of i){if(!a?.pathID||!a?.path)continue;let r=a.path.replace(/^self(\.|$)/,"notifications$1");this.pathIdToNotificationPath.set(a.pathID,r)}this.applyNotificationsSnapshot(this.notifications())}}),this.cdr.markForCheck())}),L(()=>{let e=this.notifications();G(()=>this.applyNotificationsSnapshot(e))})}applyNotificationsSnapshot(e){if(!this.pathIdToNotificationPath.size||!e?.length)return;let t=new Map;for(let i of e)i?.path&&t.set(i.path,i);this.ngZone.run(()=>{let i=!1;this.zonesControls.update(a=>{let r=null;for(let s=0;s<a.length;s++){let l=a[s],m=this.pathIdToNotificationPath.get(l.pathID),g=m?t.get(m):void 0;if(!g)continue;let v=g.value?.state,A=g.value?.message;l.notificationState===v&&l.notificationMessage===A||(r||(r=[...a]),r[s]=ge(ne({},l),{notificationState:v,notificationMessage:A}),i=!0)}return r??a}),i&&this.cdr.markForCheck()})}onResized(e){this.hostSize.set({width:e.contentRect.width,height:e.contentRect.height}),this.cdr.markForCheck()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-zones-state-panel"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:7,vars:5,consts:[["widgetContainer",""],[3,"text","color"],["kipResizeObserver","",3,"resizeChange"],[1,"widgetOverlay"],[1,"svg-widget",3,"controlData","theme","dimensions"]],template:function(t,i){if(t&1&&(ga(0),I(1,zw,1,2,"widget-title",1),d(2,"div",2,0),U("resizeChange",function(r){return i.onResized(r)}),Ae(4,Hw,2,1,"ng-container",null,Ne),u(),I(6,qw,1,0,"div",3)),t&2){let a=An(i.runtime==null?null:i.runtime.options());f(),N(a!=null&&a.showLabel?1:-1),f(),at(i.noTitleClass()),f(2),ye(i.zonesControls()),f(2),N(i.dashboard.isDashboardStatic()?-1:6)}},dependencies:[Xt,df,Qn],styles:[".widgets-container[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20}.widgets-container-no-title[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;padding:6px 0 0;height:100%;width:100%;overflow:hidden;z-index:20}.svg-widget[_ngcontent-%COMP%]{display:flex}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}"],changeDetection:0})}return n})();var uf="mat-badge-content",$w=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["ng-component"]],decls:0,vars:0,template:function(t,i){},styles:[`.mat-badge{position:relative}.mat-badge.mat-badge{overflow:visible}.mat-badge-content{position:absolute;text-align:center;display:inline-block;transition:transform 200ms ease-in-out;transform:scale(0.6);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;box-sizing:border-box;pointer-events:none;background-color:var(--mat-badge-background-color, var(--mat-sys-error));color:var(--mat-badge-text-color, var(--mat-sys-on-error));font-family:var(--mat-badge-text-font, var(--mat-sys-label-small-font));font-weight:var(--mat-badge-text-weight, var(--mat-sys-label-small-weight));border-radius:var(--mat-badge-container-shape, var(--mat-sys-corner-full))}.mat-badge-above .mat-badge-content{bottom:100%}.mat-badge-below .mat-badge-content{top:100%}.mat-badge-before .mat-badge-content{right:100%}[dir=rtl] .mat-badge-before .mat-badge-content{right:auto;left:100%}.mat-badge-after .mat-badge-content{left:100%}[dir=rtl] .mat-badge-after .mat-badge-content{left:auto;right:100%}@media(forced-colors: active){.mat-badge-content{outline:solid 1px;border-radius:0}}.mat-badge-disabled .mat-badge-content{background-color:var(--mat-badge-disabled-state-background-color, color-mix(in srgb, var(--mat-sys-error) 38%, transparent));color:var(--mat-badge-disabled-state-text-color, var(--mat-sys-on-error))}.mat-badge-hidden .mat-badge-content{display:none}.ng-animate-disabled .mat-badge-content,.mat-badge-content._mat-animation-noopable{transition:none}.mat-badge-content.mat-badge-active{transform:none}.mat-badge-small .mat-badge-content{width:var(--mat-badge-legacy-small-size-container-size, unset);height:var(--mat-badge-legacy-small-size-container-size, unset);min-width:var(--mat-badge-small-size-container-size, 6px);min-height:var(--mat-badge-small-size-container-size, 6px);line-height:var(--mat-badge-small-size-line-height, 6px);padding:var(--mat-badge-small-size-container-padding, 0);font-size:var(--mat-badge-small-size-text-size, 0);margin:var(--mat-badge-small-size-container-offset, -6px 0)}.mat-badge-small.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-small-size-container-overlap-offset, -6px)}.mat-badge-medium .mat-badge-content{width:var(--mat-badge-legacy-container-size, unset);height:var(--mat-badge-legacy-container-size, unset);min-width:var(--mat-badge-container-size, 16px);min-height:var(--mat-badge-container-size, 16px);line-height:var(--mat-badge-line-height, 16px);padding:var(--mat-badge-container-padding, 0 4px);font-size:var(--mat-badge-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-container-offset, -12px 0)}.mat-badge-medium.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-container-overlap-offset, -12px)}.mat-badge-large .mat-badge-content{width:var(--mat-badge-legacy-large-size-container-size, unset);height:var(--mat-badge-legacy-large-size-container-size, unset);min-width:var(--mat-badge-large-size-container-size, 16px);min-height:var(--mat-badge-large-size-container-size, 16px);line-height:var(--mat-badge-large-size-line-height, 16px);padding:var(--mat-badge-large-size-container-padding, 0 4px);font-size:var(--mat-badge-large-size-text-size, var(--mat-sys-label-small-size));margin:var(--mat-badge-large-size-container-offset, -12px 0)}.mat-badge-large.mat-badge-overlap .mat-badge-content{margin:var(--mat-badge-large-size-container-overlap-offset, -12px)}
45
- `],encapsulation:2,changeDetection:0})}return n})(),rF=(()=>{class n{_ngZone=y(qe);_elementRef=y(Ke);_ariaDescriber=y(Oc);_renderer=y(Or);_animationsDisabled=tn();_idGenerator=y(fa);get color(){return this._color}set color(e){this._setColor(e),this._color=e}_color="primary";overlap=!0;disabled=!1;position="above after";get content(){return this._content}set content(e){this._updateRenderedContent(e)}_content;get description(){return this._description}set description(e){this._updateDescription(e)}_description;size="medium";hidden=!1;_badgeElement;_inlineBadgeDescription;_isInitialized=!1;_interactivityChecker=y(Pc);_document=y(hc);constructor(){let e=y(Ur);e.load($w),e.load(Dc)}isAbove(){return this.position.indexOf("below")===-1}isAfter(){return this.position.indexOf("before")===-1}getBadgeElement(){return this._badgeElement}ngOnInit(){this._clearExistingBadges(),this.content&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement(),this._updateRenderedContent(this.content)),this._isInitialized=!0}ngAfterViewInit(){}ngOnDestroy(){this._renderer.destroyNode&&(this._renderer.destroyNode(this._badgeElement),this._inlineBadgeDescription?.remove()),this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description)}_isHostInteractive(){return this._interactivityChecker.isFocusable(this._elementRef.nativeElement,{ignoreVisibility:!0})}_createBadgeElement(){let e=this._renderer.createElement("span"),t="mat-badge-active";return e.setAttribute("id",this._idGenerator.getId("mat-badge-content-")),e.setAttribute("aria-hidden","true"),e.classList.add(uf),this._animationsDisabled&&e.classList.add("_mat-animation-noopable"),this._elementRef.nativeElement.appendChild(e),typeof requestAnimationFrame=="function"&&!this._animationsDisabled?this._ngZone.runOutsideAngular(()=>{requestAnimationFrame(()=>{e.classList.add(t)})}):e.classList.add(t),e}_updateRenderedContent(e){let t=`${e??""}`.trim();this._isInitialized&&t&&!this._badgeElement&&(this._badgeElement=this._createBadgeElement()),this._badgeElement&&(this._badgeElement.textContent=t),this._content=t}_updateDescription(e){this._ariaDescriber.removeDescription(this._elementRef.nativeElement,this.description),(!e||this._isHostInteractive())&&this._removeInlineDescription(),this._description=e,this._isHostInteractive()?this._ariaDescriber.describe(this._elementRef.nativeElement,e):this._updateInlineDescription()}_updateInlineDescription(){this._inlineBadgeDescription||(this._inlineBadgeDescription=this._document.createElement("span"),this._inlineBadgeDescription.classList.add("cdk-visually-hidden")),this._inlineBadgeDescription.textContent=this.description,this._badgeElement?.appendChild(this._inlineBadgeDescription)}_removeInlineDescription(){this._inlineBadgeDescription?.remove(),this._inlineBadgeDescription=void 0}_setColor(e){let t=this._elementRef.nativeElement.classList;t.remove(`mat-badge-${this._color}`),e&&t.add(`mat-badge-${e}`)}_clearExistingBadges(){let e=this._elementRef.nativeElement.querySelectorAll(`:scope > .${uf}`);for(let t of Array.from(e))t!==this._badgeElement&&t.remove()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Lt({type:n,selectors:[["","matBadge",""]],hostAttrs:[1,"mat-badge"],hostVars:20,hostBindings:function(t,i){t&2&&dt("mat-badge-overlap",i.overlap)("mat-badge-above",i.isAbove())("mat-badge-below",!i.isAbove())("mat-badge-before",!i.isAfter())("mat-badge-after",i.isAfter())("mat-badge-small",i.size==="small")("mat-badge-medium",i.size==="medium")("mat-badge-large",i.size==="large")("mat-badge-hidden",i.hidden||!i.content)("mat-badge-disabled",i.disabled)},inputs:{color:[0,"matBadgeColor","color"],overlap:[2,"matBadgeOverlap","overlap",St],disabled:[2,"matBadgeDisabled","disabled",St],position:[0,"matBadgePosition","position"],content:[0,"matBadge","content"],description:[0,"matBadgeDescription","description"],size:[0,"matBadgeSize","size"],hidden:[2,"matBadgeHidden","hidden",St]}})}return n})(),mf=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ki({type:n});static \u0275inj=Xi({imports:[Ic,Vn]})}return n})();var jw=["rotatingDial"],Yw=["awaIndicator"],Zw=["rudderStarboardRect"],Xw=["rudderPortRect"],hf=(()=>{class n{rotatingDial=he.required("rotatingDial");awaIndicator=he.required("awaIndicator");rudderStarboardRect=he.required("rudderStarboardRect");rudderPortRect=he.required("rudderPortRect");apMode=x("off-line");targetPilotHeadingTrue=x.required();autopilotTarget=x.required();courseXte=x.required();compassHeading=x.required();headingDirectionTrue=x.required();appWindAngle=x.required();rudderAngle=x.required();compassAngle=w(0);awaAngle=w(0);prevCompassAngle=0;prevAwaAngle=0;compassInitialized=!1;awaInitialized=!1;rudderInitialized=!1;lastRudderSigned=Number.NaN;oldRudderPrtAngle=0;newRudderPrtAngle=0;oldRudderStbAngle=0;newRudderStbAngle=0;apModeValue=w("");apModeValueAnnotation=w("");apModeValueDirection=w("");lockedMode=X(()=>{let e=this.apMode();return e==="auto"||e==="compass"?"Heading Hold":e==="gps"?"GPS Hold":e==="route"||e==="nav"?"Track":e==="wind"?"Wind Hold":e==="true wind"?"Wind True Hold":e==="standby"?"Standby":"Off-line"});lockedHdg=X(()=>{let e=this.autopilotTarget();return Number.isFinite(e)?this.roundDeg(e):null});lockedHdgAnnotation=X(()=>{let e=this.apMode();if(["route","auto","gps","nav"].includes(e))return this.targetPilotHeadingTrue()?"True":"Mag";if(["wind","true wind"].includes(e)){let t=this.lockedHdg()??null;return t===null?"":t>0?"Stbd":"Port"}return""});hdgDirectionTrue=X(()=>this.headingDirectionTrue()?"T":"M");animationFrames=new WeakMap;ANIMATION_DURATION=1e3;DEG_TO_PX=16.66666667;ROT_CENTER=[500,560.061];ngZone=y(qe);roundDeg(e){return Math.round(e)}setRotationImmediate(e,t){e.setAttribute("transform",`rotate(${t} ${this.ROT_CENTER[0]} ${this.ROT_CENTER[1]})`)}setRudderWidthImmediate(e,t){e.setAttribute("width",`${Math.max(0,t)}`)}constructor(){L(()=>{let e=this.compassHeading();if(!Number.isFinite(e))return;let t=this.roundDeg(e);G(()=>{let i=this.prevCompassAngle,a=!this.compassInitialized;if(!this.compassInitialized)this.prevCompassAngle=t,this.compassInitialized=!0;else{if(i===t)return;this.prevCompassAngle=t}this.compassAngle.set(t);let r=this.rotatingDial()?.nativeElement;r&&(a||i===t?this.setRotationImmediate(r,-t):Zt(r,-i,-t,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ROT_CENTER,this.ngZone))})}),L(()=>{let e=this.appWindAngle();if(!Number.isFinite(e))return;let i=(this.roundDeg(e)+360)%360;G(()=>{let a=this.prevAwaAngle,r=!this.awaInitialized;if(!this.awaInitialized)this.prevAwaAngle=i,this.awaInitialized=!0;else{if(a===i)return;this.prevAwaAngle=i}this.awaAngle.set(i);let s=this.awaIndicator()?.nativeElement;s&&(r||a===i?this.setRotationImmediate(s,i):Zt(s,a,i,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ROT_CENTER,this.ngZone))})}),L(()=>{let e=this.rudderAngle();Number.isFinite(e)&&G(()=>{this.updateRudderAngle(-e)})}),L(()=>{let e=this.apMode(),t=this.appWindAngle(),i=Number.isFinite(t)?this.roundDeg(t):0,a=this.courseXte();G(()=>{switch(e){case"auto":case"route":{let r,s,l;a<0?l=" Port":a>0?l=" Stbd":l="",a=Math.abs(a),a>185?(r=(a/1852).toFixed(1),s=" nm"):(r=a.toFixed(0),s=" m"),this.apModeValueAnnotation.set(s),this.apModeValue.set(r),this.apModeValueDirection.set(l);break}case"standby":this.apModeValueAnnotation.set(""),this.apModeValue.set(""),this.apModeValueDirection.set("");break;case"wind":this.apModeValueAnnotation.set(i?i>0?"S":"P":""),this.apModeValue.set(Math.abs(i)+"\xB0"),this.apModeValueDirection.set("");break;default:this.apModeValueAnnotation.set(""),this.apModeValue.set(""),this.apModeValueDirection.set("");break}})})}updateRudderAngle(e){if(!Number.isFinite(e))return;let t=this.roundDeg(e);if(this.lastRudderSigned===t)return;this.lastRudderSigned=t;let a=Math.min(Math.abs(t),30)*this.DEG_TO_PX,r=this.rudderStarboardRect().nativeElement,s=this.rudderPortRect().nativeElement;if(!this.rudderInitialized){this.rudderInitialized=!0,t<=0?(this.setRudderWidthImmediate(r,a),this.setRudderWidthImmediate(s,0),this.oldRudderStbAngle=a,this.oldRudderPrtAngle=0):(this.setRudderWidthImmediate(s,a),this.setRudderWidthImmediate(r,0),this.oldRudderPrtAngle=a,this.oldRudderStbAngle=0);return}t<=0?(Ko(r,this.oldRudderStbAngle,a,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),Ko(s,this.oldRudderPrtAngle,0,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),this.oldRudderStbAngle=a,this.oldRudderPrtAngle=0):(Ko(s,this.oldRudderPrtAngle,a,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),Ko(r,this.oldRudderStbAngle,0,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),this.oldRudderPrtAngle=a,this.oldRudderStbAngle=0)}ngOnDestroy(){let e=[this.rotatingDial(),this.awaIndicator(),this.rudderPortRect(),this.rudderStarboardRect()];for(let t of e){let i=t?.nativeElement;if(!i)continue;let a=this.animationFrames.get(i);a&&cancelAnimationFrame(a),this.animationFrames.delete(i)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["app-svg-autopilot"]],viewQuery:function(t,i){t&1&&Me(i.rotatingDial,jw,5)(i.awaIndicator,Yw,5)(i.rudderStarboardRect,Zw,5)(i.rudderPortRect,Xw,5),t&2&&ke(4)},inputs:{apMode:[1,"apMode"],targetPilotHeadingTrue:[1,"targetPilotHeadingTrue"],autopilotTarget:[1,"autopilotTarget"],courseXte:[1,"courseXte"],compassHeading:[1,"compassHeading"],headingDirectionTrue:[1,"headingDirectionTrue"],appWindAngle:[1,"appWindAngle"],rudderAngle:[1,"rudderAngle"]},decls:123,vars:17,consts:[["rotatingDial",""],["awaIndicator",""],["rudderStarboardRect",""],["rudderPortRect",""],["viewBox","0 0 1000 500","preserveAspectRatio","xMidYMid meet"],["id","compassDial"],["id","fixedDial"],["d","M 499.99997,70.521 A 489.47916,489.47916 0 0 0 10.520805,560.00017 489.47916,489.47916 0 0 0 499.99997,1049.4793 489.47916,489.47916 0 0 0 989.47913,560.00017 489.47916,489.47916 0 0 0 499.99997,70.521 Z m 0,132.29166 a 357.1875,357.1875 0 0 1 357.18749,357.1875 357.1875,357.1875 0 0 1 -357.18749,357.18749 357.1875,357.1875 0 0 1 -357.1875,-357.18749 357.1875,357.1875 0 0 1 357.1875,-357.1875 z",1,"fixed-dial-background",2,"display","inline","stroke","none"],["d","M 93.283801,325.18249 A 469.63541,469.63541 0 0 1 339.37522,118.68726",1,"port",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],["d","M 660.62476,118.68725 A 469.63541,469.63541 0 0 1 906.71619,325.18247",1,"starboard",2,"display","inline","fill","none","stroke-width","39.6875","stroke-linecap","butt","stroke-linejoin","round","stroke-miterlimit","0"],[2,"display","inline"],["transform","translate(0,59.999714)"],["d","m 416.35095,19.837399 2.78142,15.77426","id","path199",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 334.23173,41.658798 5.47834,15.051615","id","path200",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 260.27336,81.806174 12.55151,21.739856","id","path37",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 187.44581,126.00035 10.29591,12.2702","id","path197",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 127.23918,185.95785 12.27019,10.29591","id","path198",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 83.252815,257.66724 21.739865,12.55151","id","path166",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 42.289518,332.39273 15.05162,5.47835","id","path195",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 20.127799,414.42077 15.774251,2.78142","id","path196",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 17.879075,498.47765 H 42.982096","id","path167",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 19.776759,583.71187 15.77426,-2.78142","id","path193",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 41.598167,665.8311 15.051615,-5.47834","id","path194",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 81.668963,739.71246 103.40883,727.16095","id","path168",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 125.93981,812.61701 12.2702,-10.29591","id","path191",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 185.89732,872.82365 10.29591,-12.27019","id","path192",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 257.53004,916.73298 12.55151,-21.73985","id","path169",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 332.33219,957.7732 5.47835,-15.05162","id","path189",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 414.36024,979.93493 2.78142,-15.77425","id","path190",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 498.34046,982.10672 V 957.0037","id","path170",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 583.65133,980.28596 580.86991,964.5117","id","path187",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 665.77057,958.46456 -5.47834,-15.05161","id","path188",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 739.57526,918.31683 727.02375,896.57698","id","path171",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 812.55647,874.12301 802.26056,861.85282","id","path185",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 872.76312,814.16551 860.49293,803.8696","id","path186",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 916.59579,742.45577 894.85593,729.90426","id","path172",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 957.71266,667.73063 -15.05161,-5.47834","id","path183",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 979.8744,585.70259 -15.77425,-2.78142","id","path184",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 981.96954,501.64535 -25.10304,10e-6","id","path173",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 980.22542,416.41149 -15.77425,2.78143","id","path181",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 958.40403,334.29226 -15.05161,5.47834","id","path182",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 918.17964,260.41055 -21.73986,12.55151","id","path174",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 874.06247,187.50636 -12.27018,10.29591","id","path180",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 817.34594,130.05494 -10.40259,12.17987","id","path179",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 742.31857,83.390025 729.76706,105.12988","id","path175",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 667.6701,42.350172 -5.47834,15.051615","id","path178",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","m 585.64206,20.188432 -2.78142,15.77425","id","path176",1,"contrast-text",2,"display","inline","fill","none","stroke-width","4.18042","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["d","M 501.50816,18.016286 V 43.119307","id","path177",1,"contrast-text",2,"display","inline","fill","none","stroke-width","15","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["id","lightGray","d","M 499.99997,50.208304 A 449.79166,449.79166 0 0 0 50.208304,499.99997 449.79166,449.79166 0 0 0 499.99997,949.79163 449.79166,449.79166 0 0 0 949.79163,499.99997 449.79166,449.79166 0 0 0 499.99997,50.208304 Z m 0,92.604166 a 357.1875,357.1875 0 0 1 357.18749,357.1875 357.1875,357.1875 0 0 1 -357.18749,357.18749 357.1875,357.1875 0 0 1 -357.1875,-357.18749 357.1875,357.1875 0 0 1 357.1875,-357.1875 z",1,"rotating-dial-Backplate",2,"display","inline","fill-opacity","1","stroke","none"],[0,"xml","space","preserve","x","181.91386","y","284.25186","id","text3","transform","rotate(-30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan3","x","181.91386","y","284.25186",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-183.53558","y","283.74811","id","text14","transform","rotate(-60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan14","x","-183.53558","y","283.74811",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-499.70761","y","100.95312","id","text15","transform","rotate(-90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan15","x","-499.70761","y","100.95312",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.66119","y","-216.36243","id","text16","transform","rotate(-120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["x","-681.66119","y","-216.36243","id","tspan25",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-681.06616","y","-581.71271","id","text17","transform","rotate(-150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan17","x","-681.06616","y","-581.71271",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-498.3313","y","-897.40875","id","text18","transform","scale(-1)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan18","x","-498.3313","y","-897.40875",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","-184.41313","y","-1080.8452","id","text19","transform","rotate(150)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan19","x","-184.41313","y","-1080.8452",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","181.57225","y","-1080.8853","id","text20","transform","rotate(120)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan20","x","181.57225","y","-1080.8853",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","501.42661","y","-896.93701","id","text21","transform","rotate(90)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan21","x","501.42661","y","-896.93701",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","682.35815","y","-579.63336","id","text22","transform","rotate(60)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan22","x","682.35815","y","-579.63336",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","681.81525","y","-214.27321","id","text23","transform","rotate(30)",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan23","x","681.81525","y","-214.27321",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","44.0972px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],[0,"xml","space","preserve","x","500.15503","y","101.96342","id","text24",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none","stroke-width","0.47625","stroke-linecap","square","stroke-linejoin","round","stroke-miterlimit","0"],["id","tspan24","x","500.15503","y","101.96342",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","52.9167px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke-width","0.47625"],["id","triangle","d","M 499.5601,155 450,197 h 100 z",1,"fixed-dial-background",2,"display","inline","stroke","none"],["id","counterAWA",2,"display","inline"],[0,"xml","space","preserve","x","910.14893","y","90.67927",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","34.6667px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[0,"xml","space","preserve","x","907.84814","y","160.33212",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","73.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","33.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal"],[0,"xml","space","preserve","x","910.14893","y","200",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","34.6667px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[0,"xml","space","preserve","x","97","y","90.47614",1,"contrast-text-dim",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","33.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],[0,"xml","space","preserve","x","109.25","y","160.33212",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","73.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["id","displayArea",2,"display","inline"],[0,"xml","space","preserve","x","523.93127","y","480",1,"contrast-text",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","240px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","stroke","none"],["dy","-38",2,"font-weight","normal","font-size","180px"],[0,"xml","space","preserve","x","730","y","484",1,"contrast-text-dim",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","33.3333px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","fill-opacity","1","stroke","none"],[0,"xml","space","preserve","x","500","y","280",1,"contrast-text-dim",2,"font-style","normal","font-variant","normal","font-weight","normal","font-stretch","normal","font-size","45px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","text-align","center","text-anchor","middle","display","inline","stroke","none"],["id","IndicatorsLayer",2,"display","inline"],["transform","matrix(0.78967872,0,0,0.78967872,95.846484,6.0520865)"],["d","m 451.77021,55.078207 42.08541,-33.202814 a 12.555638,12.555638 0.26446337 0 1 15.64423,0.07221 l 42.20046,33.930296 a 15.557694,15.557694 71.53185 0 1 5.32954,15.957795 L 504.17034,279.76529 a 2.5373267,2.5373267 0.02614114 0 1 -4.91879,-0.002 L 446.37431,70.966036 a 15.416336,15.416336 108.75875 0 1 5.3959,-15.887829 z","transform","matrix(0.7935953,0,0,0.92686935,113.64335,37.878309)",1,"awa-text",2,"stroke-width","5.8876","stroke-miterlimit","0"],[0,"xml","space","preserve","x","486.45618","y","136.29939",1,"card-color",2,"font-weight","bold","font-size","52.9167px","stroke","none"],["id","tspan8","x","486.45618","y","136.29939",2,"font-style","normal","font-variant","normal","font-weight","bold","font-stretch","normal","font-size","70.5556px","font-variant-ligatures","normal","font-variant-caps","normal","font-variant-numeric","normal","font-variant-east-asian","normal","fill","#001000","fill-opacity","1","stroke","none","stroke-width","14.5521"],["id","rudder",2,"display","inline"],["width","0","height","35","x","500","y","0",1,"rudderStarboard",2,"display","inline","opacity","1","fill-opacity","1","stroke","none"],["width","0","height","35","x","-500","y","0","transform","scale(-1,1)",1,"rudderPort",2,"display","inline","opacity","1","fill-opacity","1","stroke","none"],["width","331.54941","height","33.216152","x","167.55841","y","0.89179999",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["width","331.54941","height","33.216152","x","500.89182","y","0.89179999",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["width","331.54941","height","33.216152","x","334.22531","y","0.89179999",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"],["id","rect12","width","998.26178","height","33.261108","x","0.86909997","y","0.86909997",1,"boxes",2,"display","inline","opacity","1","fill","none","stroke-width","2","stroke-miterlimit","4","stroke-dasharray","none","stroke-opacity","1"]],template:function(t,i){t&1&&(ie(),E(0,"svg",4)(1,"g",5)(2,"g",6),Q(3,"path",7)(4,"path",8)(5,"path",9),O(),E(6,"g",10,0)(8,"g",11),Q(9,"path",12)(10,"path",13)(11,"path",14)(12,"path",15)(13,"path",16)(14,"path",17)(15,"path",18)(16,"path",19)(17,"path",20)(18,"path",21)(19,"path",22)(20,"path",23)(21,"path",24)(22,"path",25)(23,"path",26)(24,"path",27)(25,"path",28)(26,"path",29)(27,"path",30)(28,"path",31)(29,"path",32)(30,"path",33)(31,"path",34)(32,"path",35)(33,"path",36)(34,"path",37)(35,"path",38)(36,"path",39)(37,"path",40)(38,"path",41)(39,"path",42)(40,"path",43)(41,"path",44)(42,"path",45)(43,"path",46)(44,"path",47)(45,"path",48),E(46,"text",49)(47,"tspan",50),c(48,"330"),O()(),E(49,"text",51)(50,"tspan",52),c(51,"300"),O()(),E(52,"text",53)(53,"tspan",54),c(54,"W"),O()(),E(55,"text",55)(56,"tspan",56),c(57,"240"),O()(),E(58,"text",57)(59,"tspan",58),c(60,"210"),O()(),E(61,"text",59)(62,"tspan",60),c(63,"S"),O()(),E(64,"text",61)(65,"tspan",62),c(66,"150"),O()(),E(67,"text",63)(68,"tspan",64),c(69,"120"),O()(),E(70,"text",65)(71,"tspan",66),c(72,"E"),O()(),E(73,"text",67)(74,"tspan",68),c(75,"60"),O()(),E(76,"text",69)(77,"tspan",70),c(78,"30"),O()(),E(79,"text",71)(80,"tspan",72),c(81,"N"),O()()()(),Q(82,"path",73),O(),E(83,"g",74)(84,"text",75),c(85),O(),E(86,"text",76),c(87),E(88,"tspan",77),c(89),O()(),E(90,"text",78),c(91),O(),E(92,"text",79),c(93,"HDG"),O(),E(94,"text",80),c(95),E(96,"tspan",77),c(97),O()()(),E(98,"g",81)(99,"text",82),c(100),E(101,"tspan",83),c(102,"\xB0"),O()(),E(103,"text",84),c(104),O(),E(105,"text",85),c(106),O()(),E(107,"g",86)(108,"g",87,1),Q(110,"path",88),E(111,"text",89)(112,"tspan",90),c(113,"A"),O()()()(),E(114,"g",91),Q(115,"rect",92,2)(117,"rect",93,3)(119,"rect",94)(120,"rect",95)(121,"rect",96)(122,"rect",97),O()()),t&2&&(f(84),at(i.apMode()=="wind"?"awa-text-dim":"contrast-text-dim"),J("display",i.apMode()=="wind"||i.apMode()=="route"?"inline":"none"),f(),fe(" ",i.apMode()==="route"?"XTE":"AWA"),f(),at(i.apMode()=="wind"?"awa-text":"contrast-text"),J("display",i.apMode()=="wind"||i.apMode()=="route"?"inline":"none"),f(),K(i.apModeValue()??"--"),f(2),K(i.apModeValueAnnotation()),f(),J("display",i.apMode()=="route"?"inline":"none"),f(),K(i.apModeValueDirection()),f(4),fe("",i.compassAngle()??"--","\xB0"),f(2),K(i.hdgDirectionTrue()),f(3),K(i.lockedHdg()??"--"),f(4),K(i.lockedHdgAnnotation()),f(2),K(i.lockedMode()),f(2),J("display",i.apMode()=="wind"?"inline":"none"))},styles:["[_nghost-%COMP%]{display:block;width:100%;font-family:Roboto;overflow:hidden;aspect-ratio:2/1;max-width:100%;max-height:100%}svg[_ngcontent-%COMP%]{width:100%;height:100%;display:block;overflow:hidden}.starboard[_ngcontent-%COMP%]{stroke:var(--kip-starboard-color)}.port[_ngcontent-%COMP%]{stroke:var(--kip-port-color)}.contrast-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:var(--kip-contrast-color)}.contrast-text-dim[_ngcontent-%COMP%]{fill:var(--kip-contrast-dim-color);stroke:var(--kip-contrast-dim-color)}.awa-text[_ngcontent-%COMP%]{fill:var(--kip-orange-color);stroke:var(--kip-orange-color)}.awa-text-dim[_ngcontent-%COMP%]{fill:var(--kip-orange-dim-color);stroke:var(--kip-orange-dim-color)}.card-color[_ngcontent-%COMP%]{fill:var(--kip-widget-card-background-color)}.fixed-dial-background[_ngcontent-%COMP%]{fill:var(--kip-grey-color)}.rotating-dial-Backplate[_ngcontent-%COMP%]{fill:var(--mat-sys-background)}.rudderPort[_ngcontent-%COMP%]{fill:var(--kip-port-color)}.rudderStarboard[_ngcontent-%COMP%]{fill:var(--kip-starboard-color)}.boxes[_ngcontent-%COMP%]{stroke:var(--kip-grey-color);fill:var(--kip-grey-color)}"],changeDetection:0})}return n})();var Qw=["childOutlet"],pf=(()=>{class n{widgetProperties;outlet;_streams=y(We,{optional:!0});_meta=y(mi,{optional:!0});_runtime=y(Se,{optional:!0});_widgetService=y(ml);_app=y(Ii);theme=Mi(this._app.cssThemeColorRoles$,{requireSync:!0});childRef;compType;constructor(){L(()=>{let e=this.theme();this.childRef&&this.childRef.setInput("theme",e)})}ngOnInit(){let e=this.widgetProperties.type;if(!e)return;this.compType=this._widgetService.getComponentType(e),this._runtime?.initialize?.(void 0,this.widgetProperties.config);let t=this._runtime?.options();t&&(this.widgetProperties.config=t),this._streams?.applyStreamsConfigDiff?.(t),this._meta?.applyMetaConfigDiff?.(t),this.outlet&&this.compType&&(this.childRef=this.outlet.createComponent(this.compType),this.childRef.setInput("id",this.widgetProperties.uuid),this.childRef.setInput("type",this.widgetProperties.type),this.childRef.setInput("theme",this.theme()))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-embedded"]],viewQuery:function(t,i){if(t&1&&Nn(Qw,7,Rr),t&2){let a;xi(a=Ci())&&(i.outlet=a.first)}},inputs:{widgetProperties:"widgetProperties"},features:[fc([We,mi,Se])],decls:3,vars:0,consts:[["childOutlet",""],["appearance","raised",1,"widget-container","kip-widget-card-colors",2,"border","1px dashed transparent"]],template:function(t,i){t&1&&(d(0,"mat-card",1),Lr(1,null,0),u())},dependencies:[Jr,Au],styles:["[_nghost-%COMP%]{width:100%;height:100%;display:block}.widget-container[_ngcontent-%COMP%]{display:block;width:100%;height:100%;margin:0;padding:0}.kip-widget-card-colors[_ngcontent-%COMP%]{background-color:var(--kip-widget-card-background-color)}"]})}return n})();function Kw(n,o){if(n&1){let e=we();d(0,"button",17),U("click",function(){ee(e);let i=k();return te(i.toggleDodge())}),d(1,"mat-icon",18),ie(),d(2,"svg",34)(3,"text",40),c(4,"Dodge"),u(),W(5,"path",41)(6,"path",42),d(7,"text",43),c(8,"!"),u()()()()}if(n&2){let e=k();dt("ap-btn-active",e.dodgeModeActive()),R("disabled",e.apBtnDisabled()),f(5),xe("fill",e.dodgeModeActive()?"currentColor":"none")("stroke","currentColor"),f(),xe("fill",e.dodgeModeActive()?"currentColor":"none")("stroke","currentColor")}}function Jw(n,o){if(n&1){let e=we();ie(),d(0,"g",48),U("click",function(){let i=ee(e).$implicit,a=k(2);return te(!i.disabled&&a.onMenuItemClick(i.action))})("keyup.enter",function(){let i=ee(e).$implicit,a=k(2);return te(!i.disabled&&a.onMenuItemClick(i.action))})("keyup.space",function(){let i=ee(e).$implicit,a=k(2);return te(!i.disabled&&a.onMenuItemClick(i.action))}),W(1,"rect",49),d(2,"text",50),c(3),u()()}if(n&2){let e=o.$implicit,t=o.$index,i=k(2);J("aria-label",e.label),f(),at(e.isCancel?"svg-menu-item-cancel":e.current?"svg-menu-item-current":e.disabled?"svg-menu-item-disabled":"svg-menu-item"),J("y",t*i.itemHeight)("height",i.itemHeight),f(),at(e.isCancel?"svg-menu-item-cancel-text":e.current?"svg-menu-item-current-text":e.disabled?"svg-menu-item-disabled-text":"svg-menu-item-text"),J("y",(t+.65)*i.itemHeight),f(),Ut(" ",e.current?"\u2713 ":"","",e.label," ")}}function e_(n,o){if(n&1){let e=we();d(0,"div",44),U("click",function(){ee(e);let i=k();return te(i.toggleMenu())})("keyup.enter",function(){ee(e);let i=k();return te(i.toggleMenu())})("keyup.space",function(){ee(e);let i=k();return te(i.toggleMenu())}),ie(),d(1,"svg",45),U("click",function(i){return i.stopPropagation()})("keyup.enter",function(i){return i.stopPropagation()})("keyup.space",function(i){return i.stopPropagation()}),W(2,"rect",46),Ji(3),Ae(4,Jw,4,10,":svg:g",47,Ne),en(),u()()}if(n&2){let e=k();f(),J("viewBox","0 0 240 "+e.menuItems().length*e.itemHeight),f(),J("height",e.menuItems().length*e.itemHeight),f(2),ye(e.menuItems())}}function t_(n,o){n&1&&W(0,"div",39)}var Oi={V1_MODE_PATH:"self.steering.autopilot.state",V2_BASE:"/signalk/v2/api",V2_AUTOPILOTS:"/signalk/v2/api/vessels/self/autopilots",V2_COURSE:"/signalk/v2/api/vessels/self/navigation/course"},Dn={BASE:n=>`${Oi.V2_AUTOPILOTS}/${n}`,ENGAGE:n=>`${Oi.V2_AUTOPILOTS}/${n}/engage`,DISENGAGE:n=>`${Oi.V2_AUTOPILOTS}/${n}/disengage`,STATE:n=>`${Oi.V2_AUTOPILOTS}/${n}/state`,MODE:n=>`${Oi.V2_AUTOPILOTS}/${n}/mode`,TARGET_HEADING:n=>`${Oi.V2_AUTOPILOTS}/${n}/target`,TACK:n=>`${Oi.V2_AUTOPILOTS}/${n}/tack`,GYBE:n=>`${Oi.V2_AUTOPILOTS}/${n}/gybe`,DODGE:n=>`${Oi.V2_AUTOPILOTS}/${n}/dodge`,ADJUST_HEADING:n=>`${Oi.V2_AUTOPILOTS}/${n}/target/adjust`},Rd={auto:{path:"self.steering.autopilot.state",value:"auto"},wind:{path:"self.steering.autopilot.state",value:"wind"},route:{path:"self.steering.autopilot.state",value:"route"},standby:{path:"self.steering.autopilot.state",value:"standby"},"+1":{path:"self.steering.autopilot.actions.adjustHeading",value:1},"+10":{path:"self.steering.autopilot.actions.adjustHeading",value:10},"-1":{path:"self.steering.autopilot.actions.adjustHeading",value:-1},"-10":{path:"self.steering.autopilot.actions.adjustHeading",value:-10},tackToPort:{path:"self.steering.autopilot.actions.tack",value:"port"},tackToStarboard:{path:"self.steering.autopilot.actions.tack",value:"starboard"},advanceWaypoint:{path:"self.steering.autopilot.actions.advanceWaypoint",value:"1"},compass:{path:"v2 only command",value:"v2 only command"},gps:{path:"v2 only command",value:"v2 only command"},"true wind":{path:"v2 only command",value:"v2 only command"},nav:{path:"v2 only command",value:"v2 only command"}},Vd={COUNTDOWN_SECONDS:5,ERROR_DISPLAY_DURATION:6e3,MESSAGE_DISPLAY_DURATION:5e3},gf=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!1,filterSelfPaths:!0,paths:{autopilotState:{description:"Autopilot State",path:"self.steering.autopilot.state",source:"default",pathType:"string",isPathConfigurable:!1,showPathSkUnitsFilter:!1,convertUnitTo:"",sampleTime:500},autopilotMode:{description:"Autopilot Mode",path:"self.steering.autopilot.mode",source:"default",pathType:"string",isPathConfigurable:!1,showPathSkUnitsFilter:!1,convertUnitTo:"",sampleTime:500},autopilotEngaged:{description:"Autopilot Engaged",path:"self.steering.autopilot.engaged",source:"default",pathType:"boolean",isPathConfigurable:!1,showPathSkUnitsFilter:!1,convertUnitTo:"",sampleTime:500},autopilotV2Target:{description:"Autopilot API v2 Target",path:"self.steering.autopilot.target",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},autopilotTargetHeading:{description:"Autopilot Target Magnetic Heading",path:"self.steering.autopilot.target.headingMagnetic",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},autopilotTargetWindHeading:{description:"Autopilot Target Apparent Wind Angle",path:"self.steering.autopilot.target.windAngleApparent",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},rudderAngle:{description:"Rudder Angle",path:"self.steering.rudderAngle",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",sampleTime:500},courseXte:{description:"Cross Track Error",path:"self.navigation.course.calcValues.crossTrackError",source:"default",pathType:"number",isPathConfigurable:!1,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathRequired:!1,pathSkUnitsFilter:"m",sampleTime:500},headingMag:{description:"Magnetic Heading",path:"self.navigation.headingMagnetic",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500},headingTrue:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500},windAngleApparent:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500},windAngleTrueWater:{description:"Wind Angle True Water",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",convertUnitTo:"deg",isPathConfigurable:!0,pathRequired:!1,showPathSkUnitsFilter:!1,pathSkUnitsFilter:"rad",showConvertUnitTo:!1,sampleTime:500}},autopilot:{invertRudder:!0,headingDirectionTrue:!1,courseDirectionTrue:!1,apiVersion:null,instanceId:null,pluginId:null,modes:null},enableTimeout:!1,dataTimeout:5};runtime=y(Se);streams=y(We,{optional:!0});_requests=y(di);http=y($a);dashboard=y(yt);_destroyRef=y(ze);apiEndpoints;apState=w(null);apEngaged=w(null);apMode=w(null);dodgeModeActive=w(!1);autopilotTargetHeading=w(null);autopilotTargetWindHeading=w(null);heading=w(null);crossTrackError=w(null);windAngleApparent=w(null);rudder=w(null);autopilotTarget=bc(()=>{let e=this.autopilotTargetHeading(),t=this.autopilotTargetWindHeading();return this.apMode()==="wind"?t??null:e??null});currentRequests=new Set;apGrid=X(()=>this.apMode()?"grid":"none");apEngageBtnDisabled=X(()=>{let e=this.apState(),t=this.apEngaged(),i=this.runtime.options().autopilot.apiVersion;return i?i==="v1"?!!["standby","off-line"].includes(e):i!=="v2":!0});apBtnDisabled=X(()=>{let e=this.apEngaged();return this.runtime.options().autopilot.apiVersion==="v1"?this.apMode()==="standby":!e});adjustHdgBtnVisibility=X(()=>{let e=this.apMode();return!!["auto","compass","gps","wind","true wind","standby"].includes(e)});tackBtnVisibility=X(()=>{let e=this.apMode();return!!["auto","compass","gps","wind","true wind","standby"].includes(e)});routeBtnVisibility=X(()=>{let e=this.apMode();return e==="route"||e==="nav"});countdownOverlayVisibility=w("hidden");countdownOverlayText=w("");msgOverlayVisibility=w("hidden");msgOverlayText=w("");errorOverlayVisibility=w("hidden");errorOverlayText=w("");handleCountDownCounterTimeout=null;handleConfirmActionTimeout=null;handleDisplayErrorTimeout=null;handleMessageTimeout=null;isPersistentError=!1;countDownValue=-1;actionToBeConfirmed="";menuItems=X(()=>{let e=this.apMode(),t=this.runtime.options().autopilot.apiVersion,i=this.runtime.options().autopilot.pluginId,a=[];return G(()=>{if(t==="v2"){if(i=="pypilot-autopilot-provider"){let r=[{label:"Compass",action:"compass"},{label:"GPS",action:"gps"},{label:"Wind",action:"wind"},{label:"True Wind",action:"true wind"},{label:"Navigation",action:"nav"},{label:"Close",action:"cancel",isCancel:!0}];a=this.parseMenuItems(r,e)}}else if(t==="v1"){let r=[{label:"Auto",action:"auto"},{label:"Wind",action:"wind"},{label:"Route",action:"route"},{label:"Close",action:"cancel",isCancel:!0}];a=this.parseMenuItems(r,e)}}),a});menuOpen=w(!1);itemHeight=60;padding=20;embedWidgetColor="contrast";nextWptProperties=w({type:"widget-position",uuid:"db473695-42b1-4435-9d3d-ac2f27bf9665",config:{displayName:"Next WPT",filterSelfPaths:!0,paths:{longPath:{description:"Longitude",path:"self.navigation.courseGreatCircle.nextPoint.position.longitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"longitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500},latPath:{description:"Latitude",path:"self.navigation.courseGreatCircle.nextPoint.position.latitude",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"latitudeMin",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5}},{equal:_i});ttwProperties=w({type:"widget-numeric",uuid:"ee022f2f-ee23-41a7-b0b1-0928dc28864d",config:{displayName:"TTWpt",filterSelfPaths:!0,paths:{numericPath:{description:"Time To Waypoint",path:"self.navigation.course.calcValues.timeToGo",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"D HH:MM:SS",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,numInt:1,showMiniChart:!1,color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5,ignoreZones:!1}},{equal:_i});etaProperties=w({type:"widget-datetime",uuid:"544ca35d-18bf-4a90-9aa8-b12312e3fc60",config:{displayName:"ETA",filterSelfPaths:!0,paths:{gaugePath:{description:"Estimated Time Of Arrival Date",path:"self.navigation.course.calcValues.estimatedTimeOfArrival",source:"default",pathType:"Date",isPathConfigurable:!0,sampleTime:500}},dateFormat:"EEE HH:mm",dateTimezone:"System Timezone -",color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5}},{equal:_i});dtwProperties=w({type:"widget-numeric",uuid:"ee02ef2f-ee23-41a7-b0b1-0928dc28864d",config:{displayName:"DTWpt",filterSelfPaths:!0,paths:{numericPath:{description:"Distance To Waypoint",path:"self.navigation.course.calcValues.distance",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"nm",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,numInt:1,showMiniChart:!1,color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5,ignoreZones:!1}},{equal:_i});xteProperties=w({type:"widget-numeric",uuid:"9234856b-7573-4154-a44f-3baf7c6f119c",config:{displayName:"XTE",filterSelfPaths:!0,paths:{numericPath:{description:"Cross Track Error",path:"self.navigation.course.calcValues.crossTrackError",source:"default",pathType:"number",isPathConfigurable:!0,convertUnitTo:"m",showPathSkUnitsFilter:!0,pathSkUnitsFilter:null,sampleTime:500}},showMax:!1,showMin:!1,numDecimal:1,numInt:1,showMiniChart:!1,color:this.embedWidgetColor,enableTimeout:!1,dataTimeout:5,ignoreZones:!1}},{equal:_i});constructor(){L(()=>{this.runtime?.options()&&G(()=>{this.cancelAllHttpRequests(),this.isPersistentError=!1,this.errorOverlayVisibility.set("hidden"),this.errorOverlayText.set(""),this.apEngaged.set(null),this.startWidget()})})}ngOnInit(){this.startWidget()}startWidget(){let e={statusCode:500,statusCodeDescription:"Autopilot widget not configured",requestId:"",state:""},t=this.runtime.options().autopilot.apiVersion,i=this.runtime.options().autopilot.instanceId,a=this.runtime.options().autopilot.pluginId,r=s=>{console.error(`[Autopilot Widget] ${s}`),this.displayApError(e),this.isPersistentError=!0,this.apMode.set("off-line"),this.apState.set("off-line"),this.apEngaged.set(!1)};if(!t){r("Not configured with autopilot API version, skipping initialization");return}if(t==="v2"){if(!i){r("No autopilot instance ID configured for V2 API, skipping initialization");return}if(!a){r("No autopilot plugin ID configured for V2 API, skipping initialization");return}this.apiEndpoints=this.setV2Endpoint(i),this.startV2Subscriptions();return}if(t==="v1"){this.startV1Subscriptions();return}r(`Unknown autopilot API version: ${t}`)}setV2Endpoint(e){return{engage:Dn.ENGAGE(e),disengage:Dn.DISENGAGE(e),mode:Dn.MODE(e),state:Dn.STATE(e),target:Dn.TARGET_HEADING(e),tack:Dn.TACK(e),gybe:Dn.GYBE(e),dodge:Dn.DODGE(e),adjustHeading:Dn.ADJUST_HEADING(e)}}isV2CommandSupported(e){return this.runtime.options().autopilot.modes.includes(e)}startV2Subscriptions(){this.streams.observe("autopilotState",e=>{e.data?.value?this.apState.set(e.data.value):(this.apState.set("off-line"),console.warn("[Autopilot Widget] Autopilot state is null or not available"))}),this.streams.observe("autopilotMode",e=>{e.data?.value?this.apMode.set(e.data.value):(this.apMode.set("off-line"),console.warn("[Autopilot Widget] Autopilot mode is null or not available"))}),this.streams.observe("autopilotEngaged",e=>{e.data?.value!=null?this.apEngaged.set(e.data.value):(this.apEngaged.set(!1),console.warn("[Autopilot Widget] Autopilot engaged is null or not available"))}),this.streams.observe("autopilotV2Target",e=>{e.data?.value?this.autopilotTarget.set(e.data.value):(this.autopilotTarget.set(null),console.warn("[Autopilot Widget] Autopilot V2 target is null or not available"))}),this.startDataSubscription()}startV1Subscriptions(){this.runtime.options().paths.autopilotMode.path=Oi.V1_MODE_PATH,this.streams.observe("autopilotMode",e=>{e.data?.value?this.apMode.set(e.data.value):(this.apMode.set("off-line"),console.warn("[Autopilot Widget] Autopilot V1 mode state is null or not available"))}),this.streams.observe("autopilotTargetHeading",e=>this.autopilotTargetHeading.set(e.data.value!=null?e.data.value:0)),this.streams.observe("autopilotTargetWindHeading",e=>this.autopilotTargetWindHeading.set(e.data.value!=null?e.data.value:0)),this.startDataSubscription(),this.subscribePutResponse(),this.apState.set(null)}startDataSubscription(){this.streams.observe("courseXte",e=>this.crossTrackError.set(e.data.value!=null?e.data.value:0)),this.streams.observe("rudderAngle",e=>{e.data.value===null?this.rudder.set(null):this.rudder.set(this.runtime.options().autopilot.invertRudder?-e.data.value:e.data.value)}),this.runtime.options().autopilot.headingDirectionTrue?this.streams.observe("headingTrue",e=>this.heading.set(e.data.value!=null?e.data.value:0)):this.streams.observe("headingMag",e=>this.heading.set(e.data.value!=null?e.data.value:0)),this.streams.observe("windAngleApparent",e=>this.windAngleApparent.set(e.data.value!=null?e.data.value:0))}subscribePutResponse(){this._requests.subscribeRequest().pipe(Le(this._destroyRef)).subscribe(e=>{e.widgetUUID==this.id()&&this.commandReceived(e)})}makeHttpRequest(e){let t=e.pipe(Le(this._destroyRef));return this.currentRequests.add(t),t.pipe(_r(()=>this.currentRequests.delete(t)))}cancelAllHttpRequests(){this.currentRequests.clear()}buildAndSendCommand(e){let t=Rd[e];if(typeof t>"u"){alert("Unknown Autopilot command: "+e);return}if(this.actionToBeConfirmed!==""&&this.actionToBeConfirmed!==e&&this.clearConfirmCmd(),(e==="tackToPort"||e==="tackToStarboard")&&this.actionToBeConfirmed===""){this.confirmTack(e);return}if((e==="route"&&this.apMode()==="route"||e==="route"&&this.apMode()==="nav")&&this.actionToBeConfirmed===""){this.confirmAdvanceWaypoint(e);return}if(this.actionToBeConfirmed===e){if(this.clearConfirmCmd(),e==="tackToPort"||e==="tackToStarboard"){let i=e==="tackToPort"?"port":"starboard";this.performTackOrGybe("tack",i)}(e==="route"&&this.apMode()==="route"||e==="route"&&this.apMode()==="nav")&&this.routeCommand(e,Rd.advanceWaypoint);return}this.routeCommand(e,t)}routeCommand(e,t){let i=this.runtime.options().autopilot.apiVersion;i==="v2"?(e==="route"&&this.apMode()==="nav"&&(e="advanceWaypoint"),this.sendV2Command(e)):i==="v1"&&!t.path.startsWith("v2:")?this.sendV1Command(t):(console.error("[Autopilot Widget] Unsupported basic command:",t.path),this.displayApError({statusCode:400,statusCodeDescription:"Unsupported Command",message:`Command path '${t.path}' is not supported in the current API version`,widgetUUID:this.id()}))}sendV1Command(e){this._requests.putRequest(e.path,e.value,this.id()),console.log(`AP Action:
46
- `+JSON.stringify(e))}sendV2Command(e,t){return Re(this,null,function*(){let i=this.apiEndpoints;if(!i){console.error("V2 endpoints not available");return}let a=this.dodgeModeActive(),r;switch(e){case"+1":r={path:a?i.dodge:i.adjustHeading,value:{value:1,units:"deg"}},this.executeRestRequest("PUT",r);break;case"+10":r={path:a?i.dodge:i.adjustHeading,value:{value:10,units:"deg"}},this.executeRestRequest("PUT",r);break;case"-1":r={path:a?i.dodge:i.adjustHeading,value:{value:-1,units:"deg"}},this.executeRestRequest("PUT",r);break;case"-10":r={path:a?i.dodge:i.adjustHeading,value:{value:-10,units:"deg"}},this.executeRestRequest("PUT",r);break;case"advanceWaypoint":r={path:`${Oi.V2_COURSE}/activeRoute/nextPoint`},this.executeRestRequest("PUT",r);break;case"tack":r={path:`${i.tack}/${t.value}`},this.executeRestRequest("POST",r);break;case"gybe":r={path:`${i.gybe}/${t}`},this.executeRestRequest("POST",r);break;case"dodge":r={path:i.dodge},this.dodgeModeActive()?this.executeRestRequest("DELETE",r).then(s=>{s.statusCode!==200&&this.dodgeModeActive.set(!1)}):this.executeRestRequest("POST",r).then(s=>{s.statusCode!==200&&this.dodgeModeActive.set(!0)});break;case"target_heading":r={path:i.target,value:t},this.executeRestRequest("PUT",r);break;case"standby":{let s={path:`${this.apEngaged()?i.disengage:i.engage}`};this.executeRestRequest("POST",s)}break;case"auto":case"compass":case"gps":case"wind":case"true wind":case"route":case"nav":yield this.setModeAndEnable(e,i);break;default:console.error("Unknown V2 command:",e),this.displayApError({statusCode:400,statusCodeDescription:"Unknown Command",message:`V2 command '${e}' is not supported`,widgetUUID:this.id()})}})}executeRestRequest(e,t){return Re(this,null,function*(){try{let i;switch(e){case"POST":i=yield Cr(this.makeHttpRequest(this.http.post(t.path,void 0)));break;case"PUT":i=yield Cr(this.makeHttpRequest(this.http.put(t.path,t.value==null?void 0:t.value)));break;case"DELETE":i=yield Cr(this.makeHttpRequest(this.http.delete(t.path)));break;default:console.error("[Autopilot Widget] Unsupported REST method:",e)}return i&&i.statusCode===200?i:(console.warn("[Autopilot Widget] V2 Command completed with non-success status:",JSON.stringify(i)),i||{statusCode:0,message:"Unavailable",state:"not provided"})}catch(i){return console.error("[Autopilot Widget] REST operation failed:",i),this.displayApError({statusCode:500,statusCodeDescription:"V2 Command Failed",message:`Failed to execute ${e} ${t.path}`,widgetUUID:this.id()}),{statusCode:0,message:i instanceof Error?i.message:"REST operation failed",state:null}}})}setModeAndEnable(e,t){return Re(this,null,function*(){try{let i=yield this.executeRestRequest("PUT",{path:t.mode,value:{value:e}});if(i.statusCode!==200){console.error(`[Autopilot Widget] Failed to set mode '${e}':`,i);return}let a=yield this.executeRestRequest("PUT",{path:t.state,value:{value:"enabled"}});a.statusCode!==200&&console.error(`[Autopilot Widget] Failed to engage after mode '${e}':`,a)}catch(i){console.error("[Autopilot Widget] setModeAndEngage unexpected error:",i)}})}performTackOrGybe(e,t){if(this.runtime.options().autopilot.apiVersion==="v2")this.sendV2Command(e,{value:t});else{if(e!=="tack")return;let i=Rd[t==="port"?"tackToPort":"tackToStarboard"];this._requests.putRequest(i.path,i.value,this.id())}}setAbsoluteTarget(e){this.runtime.options().autopilot.apiVersion==="v2"?this.sendV2Command("target_heading",{value:e,units:"deg"}):console.error("[Autopilot Widget] Absolute target only available in V2 API")}toggleDodge(){this.runtime.options().autopilot.apiVersion==="v2"?this.sendV2Command("dodge"):(console.warn("[Autopilot Widget] Dodge mode only available in V2 API"),this.displayApError({statusCode:400,statusCodeDescription:"V2 API Required",message:"Dodge mode only available in V2 API",widgetUUID:this.id()}))}commandReceived(e){e.statusCode!=200&&this.displayApError(e)}confirmAdvanceWaypoint(e){this.startConfirmCmd(e,"Repeat key [Adv Wpt] to confirm")}confirmTack(e){let t="";if(e==="tackToPort")t="Port",this.actionToBeConfirmed=e;else if(e==="tackToStarboard")t="Starboard",this.actionToBeConfirmed=e;else{this.actionToBeConfirmed="";return}let i=`Repeat [Tack ${t}] key to confirm`;this.startConfirmCmd(e,i)}startConfirmCmd(e,t){this.countDownValue=Vd.COUNTDOWN_SECONDS,this.actionToBeConfirmed=e,this.countdownOverlayText.set(t),this.countdownOverlayVisibility.set("visible"),this.updateCountDownCounter(t),clearTimeout(this.handleConfirmActionTimeout),this.handleConfirmActionTimeout=setTimeout(()=>{this.countdownOverlayVisibility.set("hidden"),this.countdownOverlayText.set(""),this.actionToBeConfirmed=""},Vd.MESSAGE_DISPLAY_DURATION)}clearConfirmCmd(){clearTimeout(this.handleConfirmActionTimeout),clearTimeout(this.handleCountDownCounterTimeout),this.countDownValue=-1,this.countdownOverlayVisibility.set("hidden"),this.countdownOverlayText.set(""),this.actionToBeConfirmed=""}updateCountDownCounter(e){this.countDownValue>0?(clearTimeout(this.handleCountDownCounterTimeout),this.countdownOverlayText.set(e),this.countDownValue-=1,this.handleCountDownCounterTimeout=setTimeout(()=>{this.updateCountDownCounter(e)},1e3)):(this.countDownValue=-1,clearTimeout(this.handleCountDownCounterTimeout))}displayApError(e){if(this.isPersistentError){console.warn("[Autopilot Widget] Skipping temporary error display - persistent error active:",e.statusCodeDescription);return}let t=e.statusCode+" - "+e.statusCodeDescription+".";e.message&&(t=t+"Server Message: "+e.message+"."),this.errorOverlayText.set(t),this.errorOverlayVisibility.set("visible"),clearTimeout(this.handleDisplayErrorTimeout),this.handleDisplayErrorTimeout=setTimeout(()=>{this.isPersistentError||(this.errorOverlayVisibility.set("hidden"),this.errorOverlayText.set(""))},Vd.ERROR_DISPLAY_DURATION)}toggleMenu(){this.menuOpen.set(!this.menuOpen())}onMenuItemClick(e){if(e==="cancel"){this.toggleMenu();return}this.buildAndSendCommand(e),this.menuOpen.set(!1)}parseMenuItems(e,t){let i=this.runtime.options().autopilot.apiVersion;return e.map(r=>{if(r.isCancel)return ge(ne({},r),{current:!1,disabled:!1});let s=!1;if(i==="v1")switch(t){case"standby":s=r.action==="auto"||r.action==="wind";break;case"auto":s=r.action==="wind"||r.action==="route";break;case"wind":s=r.action==="auto";break;case"route":s=r.action==="auto";break;default:s=!1}else i==="v2"&&(s=this.runtime.options().autopilot.modes.includes(r.action));return ge(ne({},r),{current:r.action===t,disabled:!s})})}ngOnDestroy(){this.cancelAllHttpRequests(),clearTimeout(this.handleCountDownCounterTimeout),clearTimeout(this.handleConfirmActionTimeout),clearTimeout(this.handleDisplayErrorTimeout),clearTimeout(this.handleMessageTimeout)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-autopilot"]],inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:93,vars:64,consts:[[1,"autopilot-grid-container"],[1,"ap-modes"],["mat-flat-button","",1,"ap-btn","ap-btn-ctrlbar",3,"click","disabled"],[1,"svg-icon-ctrlbar"],["width","100%","height","100%","viewBox","0 0 100 14","preserveAspectRatio","xMidYMid meet",1,"svg-element","svg-modes"],[0,"xml","space","preserve","x","50","y","10.7"],["mat-flat-button","",3,"click","disabled"],[0,"xml","space","preserve","x","50.090435","y","10.743966"],[1,"ap-screen"],[3,"apMode","targetPilotHeadingTrue","autopilotTarget","courseXte","compassHeading","headingDirectionTrue","appWindAngle","rudderAngle"],[1,"ap-screen-overlay"],["viewBox","0 0 100 100","width","100%","height","100%","preserveAspectRatio","xMidYMid meet"],["x","50%","y","25",1,"svg-element-msg",3,"innerHTML"],["x","50%","dy","75",1,"svg-element-msg",2,"font-size","3em",3,"innerHTML"],[1,"ap-screen-overlay","ap-error-text"],[1,"material-icons","ap-error-icon"],["x","50%","y","25",1,"svg-element-msg","svg-element-error-txt",3,"innerHTML"],["mat-flat-button","",1,"ap-btn",3,"click","disabled"],[1,"svg-icon"],["width","100%","height","100%","viewBox","0 0 100 100","preserveAspectRatio","xMidYMid meet",1,"svg-element"],["fill","currentColor","stroke","currentColor",0,"xml","space","preserve","x","49.894032","y","98.734871"],["fill","currentColor","stroke","currentColor","d","M 31.033486,35.785143 68.966514,66.630677 M 31.033486,35.640825 68.966514,4.79529"],["fill","currentColor","stroke","currentColor",0,"xml","space","preserve","x","50.052986","y","98.734871"],["fill","currentColor","stroke","currentColor","d","M 68.966514,35.785143 31.033486,66.630677 M 68.966514,35.640825 31.033486,4.79529"],["fill","currentColor","stroke","currentColor","d","M 15.778367,35.785143 53.711395,66.630677 M 15.778367,35.640825 53.711395,4.79529"],["fill","currentColor","stroke","currentColor","d","M 46.288608,35.785143 84.221633,66.630677 M 46.288608,35.640825 84.221633,4.79529"],["fill","currentColor","stroke","currentColor","d","M 84.221633,35.785143 46.288605,66.630677 M 84.221633,35.640825 46.288605,4.79529"],["fill","currentColor","stroke","currentColor","d","M 53.711392,35.785143 15.778367,66.630677 M 53.711392,35.640825 15.778367,4.79529"],["transform","scale(-1,1) translate(-100,0)"],["fill","currentColor","d","M 90.5,22.5 67.5,45 96,53 Z",2,"stroke-width","8","stroke-linecap","round","stroke-linejoin","round","stroke-miterlimit","0","stroke-dasharray","none"],["fill","none","stroke","currentColor","d",`M 76,31
47
- A 36 38 0 0 0 24,33`,2,"stroke-width","8.45947","stroke-linecap","square","stroke-linejoin","miter","stroke-miterlimit","0"],["fill","currentColor","cx","14.5","cy","45.25","r","12"],[1,"embed-widget",3,"widgetProperties"],["mat-flat-button","",1,"ap-btn",3,"disabled","ap-btn-active"],["viewBox","0 0 100 100","preserveAspectRatio","xMidYMid meet",1,"svg-element","svg-route"],["fill","currentColor","stroke","currentColor",0,"xml","space","preserve","x","49.961578","y","86.799866"],["fill","currentColor","d","M 12.090795,4 V 63.58544 L 71.676235,33.792718 Z",2,"stroke","none"],["fill","currentColor","stroke","currentColor","d","M 75.95674,4 V 63.58544",2,"fill","none","stroke-width","9.90493","stroke-linecap","butt","stroke-linejoin","miter","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],["tabindex","0","role","button","aria-label","Close menu",1,"svg-menu-overlay"],[1,"widgetOverlay"],[0,"xml","space","preserve","x","49.961578","y","86.799866"],["d","M 4.6584699,36.552789 29.229283,58.159051 M 4.6584699,36.451699 29.229283,14.845436",2,"stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],["d","M 95.34153,36.552789 70.770717,58.159051 M 95.34153,36.451699 70.770717,14.845436",2,"stroke-linecap","round","stroke-miterlimit","0","stroke-dasharray","none","stroke-opacity","1"],[0,"xml","space","preserve","x","50.167503","y","61.058273",2,"font-size","68.6095px"],["tabindex","0","role","button","aria-label","Close menu",1,"svg-menu-overlay",3,"click","keyup.enter","keyup.space"],["tabindex","0","role","presentation","aria-label","Menu",1,"svg-menu",3,"click","keyup.enter","keyup.space"],["x","0","y","0","width","240",1,"svg-menu-box"],["tabindex","0","role","button",2,"cursor","pointer"],["tabindex","0","role","button",2,"cursor","pointer",3,"click","keyup.enter","keyup.space"],["x","0","width","240"],["x","120"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1)(2,"button",2),U("click",function(){return i.toggleMenu()}),d(3,"mat-icon",3),ie(),d(4,"svg",4)(5,"text",5),c(6),ct(7,"titlecase"),u()()()(),Be(),d(8,"button",6),U("click",function(){return i.buildAndSendCommand("standby")}),d(9,"mat-icon",3),ie(),d(10,"svg",4)(11,"text",7),c(12,"Disengage"),u()()()()(),Be(),d(13,"div",8),W(14,"app-svg-autopilot",9),d(15,"div",10),ie(),d(16,"svg",11),W(17,"text",12)(18,"text",13),u()(),Be(),d(19,"div",14)(20,"span",15),c(21,"warning"),u(),ie(),d(22,"svg",11),W(23,"text",16),u()()(),Be(),d(24,"div")(25,"button",17),U("click",function(){return i.buildAndSendCommand("-1")}),d(26,"mat-icon",18),ie(),d(27,"svg",19)(28,"text",20),c(29,"-1\xB0"),u(),W(30,"path",21),u()()()(),Be(),d(31,"div")(32,"button",17),U("click",function(){return i.buildAndSendCommand("+1")}),d(33,"mat-icon",18),ie(),d(34,"svg",19)(35,"text",22),c(36,"+1\xB0"),u(),W(37,"path",23),u()()()(),Be(),d(38,"div")(39,"button",17),U("click",function(){return i.buildAndSendCommand("-10")}),d(40,"mat-icon",18),ie(),d(41,"svg",19)(42,"text",20),c(43,"-10\xB0"),u(),W(44,"path",24)(45,"path",25),u()()()(),Be(),d(46,"div")(47,"button",17),U("click",function(){return i.buildAndSendCommand("+10")}),d(48,"mat-icon",18),ie(),d(49,"svg",19)(50,"text",22),c(51,"+10\xB0"),u(),W(52,"path",26)(53,"path",27),u()()()(),Be(),d(54,"div")(55,"button",17),U("click",function(){return i.buildAndSendCommand("tackToPort")}),d(56,"mat-icon",18),ie(),d(57,"svg",19)(58,"text",20),c(59,"Tack"),u(),d(60,"g",28),W(61,"path",29)(62,"path",30)(63,"circle",31),u()()()()(),Be(),d(64,"div")(65,"button",17),U("click",function(){return i.buildAndSendCommand("tackToStarboard")}),d(66,"mat-icon",18),ie(),d(67,"svg",19)(68,"text",20),c(69,"Tack"),u(),W(70,"path",29)(71,"path",30)(72,"circle",31),u()()()(),Be(),d(73,"div"),W(74,"widget-embedded",32),u(),d(75,"div"),W(76,"widget-embedded",32),u(),d(77,"div"),W(78,"widget-embedded",32),u(),d(79,"div"),W(80,"widget-embedded",32),u(),d(81,"div"),I(82,Kw,9,11,"button",33),u(),d(83,"div")(84,"button",17),U("click",function(){return i.buildAndSendCommand("route")}),d(85,"mat-icon",18),ie(),d(86,"svg",34)(87,"text",35),c(88,"Adv Wpt"),u(),W(89,"path",36)(90,"path",37),u()()()()(),I(91,e_,6,2,"div",38),I(92,t_,1,0,"div",39)),t&2&&(xe("display",i.apGrid()),f(2),R("disabled",i.apState()==="off-line"||i.apMode()==="off-line"),f(4),fe("Mode ",Et(7,62,i.apMode())," \xA0\u22EE"),f(2),at(i.apEngaged()?"ap-btn ap-btn-ctrlbar ap-btn-engage":"ap-btn ap-btn-ctrlbar ap-btn-disengage"),R("disabled",i.apEngageBtnDisabled()),f(6),R("apMode",i.apMode())("targetPilotHeadingTrue",i.runtime.options().autopilot.courseDirectionTrue)("autopilotTarget",i.autopilotTarget())("courseXte",i.crossTrackError())("compassHeading",i.heading())("headingDirectionTrue",i.runtime.options().autopilot.headingDirectionTrue)("appWindAngle",i.windAngleApparent())("rudderAngle",i.rudder()),f(),xe("visibility",i.countdownOverlayVisibility()),f(2),R("innerHTML",i.countdownOverlayText(),Ir),f(),xe("visibility",i.countDownValue>=0?"visible":"hidden"),R("innerHTML",i.countDownValue+1,Ir),f(),xe("visibility",i.errorOverlayVisibility()),f(4),R("innerHTML",i.errorOverlayText(),Ir),f(),xe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),f(),R("disabled",i.apBtnDisabled()),f(6),xe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),f(),R("disabled",i.apBtnDisabled()),f(6),xe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),f(),R("disabled",i.apBtnDisabled()),f(7),xe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),f(),R("disabled",i.apBtnDisabled()),f(7),xe("display",i.tackBtnVisibility()?"block":"none"),f(),R("disabled",i.apBtnDisabled()),f(9),xe("display",i.tackBtnVisibility()?"block":"none"),f(),R("disabled",i.apBtnDisabled()),f(8),xe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),f(),R("widgetProperties",i.nextWptProperties()),f(),xe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),f(),R("widgetProperties",i.etaProperties()),f(),xe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),f(),R("widgetProperties",i.dtwProperties()),f(),xe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),f(),R("widgetProperties",i.xteProperties()),f(),xe("display",i.routeBtnVisibility()?"block":"none"),f(),N(i.runtime.options().autopilot.apiVersion==="v2"?82:-1),f(),xe("display",i.routeBtnVisibility()?"block":"none"),f(),R("disabled",i.apBtnDisabled()||i.dodgeModeActive()),f(7),N(i.menuOpen()?91:-1),f(),N(i.dashboard.isDashboardStatic()?-1:92))},dependencies:[hf,ot,wt,et,Xe,mf,pf,On],styles:['[_nghost-%COMP%]{display:block;height:100%;width:100%}.widget-host[_ngcontent-%COMP%]{display:block;height:100%;width:100%}.autopilot-grid-container[_ngcontent-%COMP%]{box-sizing:border-box;width:100%;height:100%;display:grid;gap:.5rem .5rem;padding:10px;grid-template:"modes modes" minmax(50px,1fr) "screen screen" minmax(50px,auto)/1fr 1fr;grid-template-rows:.15fr 1fr;grid-auto-rows:minmax(50px,2fr)}.ap-modes[_ngcontent-%COMP%]{grid-area:modes;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:minmax(50px,1fr);gap:.5rem .5rem}.ap-screen[_ngcontent-%COMP%]{position:relative;grid-area:screen;width:100%;height:100%;max-height:200px;align-content:center}.ap-screen-overlay[_ngcontent-%COMP%]{position:absolute;top:0;left:0;width:100%;height:100%;z-index:50;vertical-align:middle;text-align:center;background-color:var(--mat-sys-background)}.ap-error-icon[_ngcontent-%COMP%]{padding-top:15px}.ap-error-text[_ngcontent-%COMP%]{color:var(--mat-sys-error-container)}.ap-btn[_ngcontent-%COMP%]{width:100%;border-radius:12px;align-items:center;justify-content:center;cursor:pointer;--mat-button-filled-container-color: var(--kip-blue-dim-color);--mat-button-filled-label-text-color: var(--kip-contrast-color);--mat-button-filled-container-height: 100%}.ap-btn-ctrlbar[_ngcontent-%COMP%]{padding:4px}.ap-btn-modes[_ngcontent-%COMP%]{--mat-button-filled-horizontal-padding: 0rem}.ap-btn-notifications[_ngcontent-%COMP%]{--mat-button-filled-container-color: var(--kip-yellow-dim-color)}.ap-btn-engage[_ngcontent-%COMP%]{--mat-button-filled-horizontal-padding: 0rem;--mat-button-filled-container-color: var(--kip-port-color)}.ap-btn-disengage[_ngcontent-%COMP%]{--mat-button-filled-horizontal-padding: 0rem;--mat-button-filled-container-color: var(--kip-starboard-color)}.svg-icon-ctrlbar[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:0}.svg-icon[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;padding:.5rem}.svg-element[_ngcontent-%COMP%]{width:100%;height:100%;padding:0}.svg-element[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-family:Roboto;font-size:25px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke:none}.svg-element[_ngcontent-%COMP%] path[_ngcontent-%COMP%]{stroke-width:7.59058;stroke-linecap:round;stroke-miterlimit:0;stroke-dasharray:none}.svg-element-msg[_ngcontent-%COMP%]{font-family:Roboto;font-size:12px;font-weight:700;text-align:center;text-anchor:middle;font-style:normal;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:var(--kip-contrast-color);fill-opacity:1;stroke:none}.svg-element-note[_ngcontent-%COMP%]{font-family:Roboto;font-size:.5em;font-weight:400;text-align:center;text-anchor:middle;font-style:italic;font-variant:normal;font-stretch:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:var(--kip-contrast-dim-color);fill-opacity:1;stroke:none}.svg-element-error-txt[_ngcontent-%COMP%]{fill:var(--mat-sys-error-container)}.svg-element-notifications[_ngcontent-%COMP%]{fill:var(--kip-contrast-color)}.svg-element-clear-notifications[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);fill-opacity:1;stroke:none}.svg-modes[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:12px}.svg-route[_ngcontent-%COMP%] text[_ngcontent-%COMP%]{font-size:25px}.embed-widget[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-surface-container-highest);border-radius:12px}@media(max-width:600px){.autopilot-grid-container[_ngcontent-%COMP%]{padding:.5rem;gap:.25rem}.autopilot-btn[_ngcontent-%COMP%]{font-size:.95rem;padding:.4em .5em}}.widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent;z-index:21}.svg-menu-overlay[_ngcontent-%COMP%]{position:absolute;inset:0;background:#000c;z-index:19;display:flex;align-items:center;justify-content:center}.svg-menu-box[_ngcontent-%COMP%]{fill:var(--mat-sys-surface);stroke:none;border-radius:12px}.svg-menu[_ngcontent-%COMP%]{max-width:80%;background:transparent;border-radius:12px;box-shadow:0 4px 24px #00000026;z-index:20;display:block;font-family:Roboto;font-size:1.1rem;font-weight:700;text-anchor:middle;text-align:center;alignment-baseline:middle}g[_ngcontent-%COMP%]:hover rect[_ngcontent-%COMP%]{fill-opacity:.7}g[_ngcontent-%COMP%]:hover text[_ngcontent-%COMP%]{fill-opacity:.7}g[_ngcontent-%COMP%]:active rect[_ngcontent-%COMP%]{fill-opacity:.4}g[_ngcontent-%COMP%]:active text[_ngcontent-%COMP%]{fill-opacity:.4}.svg-menu-item[_ngcontent-%COMP%]{fill:var(--kip-blue-color);stroke:var(--mat-sys-outline-variant)}.svg-menu-item-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:none}.svg-menu-item-current[_ngcontent-%COMP%]{fill:var(--kip-blue-color);pointer-events:none;stroke:var(--mat-sys-outline-variant)}.svg-menu-item-current-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:none;pointer-events:none}.svg-menu-item-disabled[_ngcontent-%COMP%]{fill:var(--kip-blue-color);pointer-events:none;stroke:var(--mat-sys-outline-variant)}.svg-menu-item-disabled-text[_ngcontent-%COMP%]{fill:var(--mat-sys-surface-tint);stroke:none;pointer-events:none}.svg-menu-item-cancel[_ngcontent-%COMP%]{fill:var(--mat-sys-outline);stroke:var(--mat-sys-outline-variant)}.svg-menu-item-cancel-text[_ngcontent-%COMP%]{fill:var(--kip-contrast-color);stroke:none}.counterText[_ngcontent-%COMP%]{font-weight:700;font-size:7em;margin-top:0;margin-bottom:0}'],changeDetection:0})}return n})();var i_=["bmsSvg"];function n_(n,o){n&1&&(E(0,"div",2)(1,"div",3),c(2,"No batteries detected"),O(),E(3,"div",4),c(4,"Check Signal K battery paths or select batteries in widget settings."),O()())}var ff=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={color:"contrast",ignoreZones:!1,bms:{trackedBatteryIds:[],banks:[]}};static VIEWBOX_WIDTH=200;static MIN_VIEWBOX_HEIGHT=1;static BANK_CARD_WIDTH=200;static BATTERY_CARD_HEIGHT=50;static BATTERY_CARD_WIDTH=195;static CARD_GAP=8;static BANK_HEADER_HEIGHT=60;static BANK_MIN_HEIGHT=75;static IN_BANK_COLUMNS=2;static IN_BANK_COLUMN_GAP=5;static IN_BANK_PADDING_X=5;static BANK_GAUGE_RADIUS=38;static BANK_GAUGE_BG_STROKE=8;static BANK_GAUGE_VALUE_STROKE=8;static PATH_BATCH_WINDOW_MS=500;runtime=y(Se);data=y(Ot);units=y(it);iconRegistry=y(iu);destroyRef=y(ze);ngZone=y(qe);svgRef=he.required("bmsSvg");svg;root;bankLayer;batteryLayer;bankGaugeBackgroundPath=this.buildSemiGaugeArcPath(n.BANK_GAUGE_RADIUS,1);renderFrameId=null;pendingRenderSnapshot=null;pathBatchTimerId=null;initialPathPaintDone=!1;pendingPathUpdates=new Map;powerAvailableIconTemplate=null;powerRenewalIconTemplate=null;discoveredBatteryIds=w([]);trackedBatteryIds=w([]);banks=w([]);batteries=w({});visibleBatteryIds=X(()=>{let e=this.trackedBatteryIds();return e.length?e:this.discoveredBatteryIds()});visibleBatteries=X(()=>{let e=this.visibleBatteryIds(),t=this.batteries();return e.map(i=>t[i]).filter(i=>!!i)});bankSummaries=X(()=>{let e=this.banks(),t=this.batteries();return e.map(i=>this.buildBankSummary(i,t))});colorRole=X(()=>this.runtime.options()?.color);ignoreZones=X(()=>this.runtime.options()?.ignoreZones);widgetColors=X(()=>{let e=this.theme();return e?Te(this.colorRole(),e):null});batteryDisplayModels=X(()=>{let e=this.visibleBatteries(),t=this.theme(),i=this.widgetColors(),a=this.ignoreZones(),r={};for(let s of e){let l=n.resolveZoneAwareColor(s.stateOfChargeState,i?.dimmer??"var(--kip-contrast-dimmer-color)",t,a),m=n.resolveZoneAwareColor(s.stateOfChargeState,i?.dim??"var(--kip-contrast-dim-color)",t,a),g=n.resolveZoneAwareColor(s.currentState,"var(--kip-contrast-dim-color)",t,a),v=n.resolveZoneAwareColor(s.currentState,"var(--kip-contrast-color)",t,a);r[s.id]={id:s.id,titleText:s.name||`Battery ${s.id}`,chargeWidth:(n.BATTERY_CARD_WIDTH-3)*(s.stateOfCharge??0),chargeBarColorCompact:l,chargeBarColorRegular:m,currentTextColorCompact:g,currentTextColorRegular:v,currentStrokeWidth:s.currentState!==ve.Normal?.5:0,currentText:`${this.formatCurrent(s.current)}`.trim(),detailLineCompact:`${this.formatVoltage(s.voltage)}\xA0\xA0\xA0\xA0${this.formatTemperature(s.temperature)}`,detailLineRegular:`${this.formatVoltage(s.voltage)}\xA0\xA0\xA0\xA0${this.formatPower(s.power)}\xA0\xA0\xA0\xA0${this.formatTemperature(s.temperature)}`.trim(),socText:this.formatSoc(s.stateOfCharge),actualCapacityText:s.capacityActual?`${s.capacityActual} kWh`:"",remainingText:`${this.formatDuration(s.timeRemaining)}`.trim(),iconKey:s.current!=null&&s.current>0?"power_renewal":"power_available"}}return r});bankDisplayModels=X(()=>{let e=this.bankSummaries(),t=this.widgetColors(),i={};for(let a of e)i[a.id]={id:a.id,titleText:a.name||"Bank",currentText:this.formatCurrent(a.totalCurrent),powerText:this.formatPower(a.totalPower),socText:this.formatSoc(a.avgSoc),remainingText:`${this.formatDuration(a.timeRemaining)}`.trim(),remainingCapacityText:a.remainingCapacity?`${a.remainingCapacity} kWh`:"",gaugeValuePath:this.buildSemiGaugeArcPath(n.BANK_GAUGE_RADIUS,a.avgSoc),gaugeValueColor:t?.color??"var(--kip-contrast-color)",zoneState:null,zoneColor:null};return i});hasBatteries=X(()=>this.visibleBatteries().length>0);constructor(){L(()=>{let t=this.runtime.options();t&&G(()=>this.applyConfig(t))}),L(()=>{let t=this.bankSummaries(),i=this.visibleBatteries(),a=this.widgetColors(),r=this.batteryDisplayModels(),s=this.bankDisplayModels();!this.svg||!a||this.requestRender({banks:t,batteries:i,batteryDisplayModels:r,bankDisplayModels:s,widgetColors:a})});let e=this.data.subscribePathTreeWithInitial("self.electrical.batteries.*");if(e.initial.length){for(let t of e.initial)this.enqueuePathUpdate(t,!0);this.flushPendingPathUpdates(),this.initialPathPaintDone=!0}e.live$.pipe(Le(this.destroyRef)).subscribe(t=>{this.enqueuePathUpdate(t)})}ngAfterViewInit(){this.initializeSvg(),this.loadPowerIcons(),this.requestRender()}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null}initializeSvg(){this.svg=hn(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${n.VIEWBOX_WIDTH} ${n.MIN_VIEWBOX_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Battery Management System View"),this.root=this.svg.append("g").attr("class","bms-root"),this.bankLayer=this.root.append("g").attr("class","bms-banks"),this.batteryLayer=this.root.append("g").attr("class","bms-batteries")}loadPowerIcons(){this.loadNamedIcon("power_available",e=>{this.powerAvailableIconTemplate=e}),this.loadNamedIcon("power_renewal",e=>{this.powerRenewalIconTemplate=e})}loadNamedIcon(e,t){this.iconRegistry.getNamedSvgIcon(e).pipe(ai(1)).subscribe({next:i=>{t(i),this.requestRender()},error:()=>{}})}applyConfig(e){let t=this.resolveBmsConfig(e);this.trackedBatteryIds.set(t.trackedBatteryIds),this.banks.set(t.banks)}resolveBmsConfig(e){let t=e.bms;return{trackedBatteryIds:Array.isArray(t?.trackedBatteryIds)?t.trackedBatteryIds:[],banks:(Array.isArray(t?.banks)?t.banks:[]).map(i=>ge(ne({},i),{connectionMode:this.normalizeConnectionMode(i.connectionMode)}))}}normalizeConnectionMode(e){return e==="series"?"series":"parallel"}enqueuePathUpdate(e,t=!1){let i=this.parseBatteryPath(e.path);if(!i)return;let{id:a,key:r}=i,s=e.update?.data?.value??null,l=e.update?.state??null,m=`${a}::${r}`;if(this.pendingPathUpdates.set(m,{id:a,key:r,value:s,state:l}),!t){if(!this.initialPathPaintDone){this.initialPathPaintDone=!0,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates()},n.PATH_BATCH_WINDOW_MS))}}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredBattery(i)),this.batteries.update(i=>{let a=i,r=!1;for(let s of e){let l=a[s.id]??{id:s.id},m=ne({},l),g=this.applyBatteryValue(m,s.key,s.value,s.state),v=!1;if(m.voltage!=null&&m.current!=null){let A=Number.isFinite(m.voltage)&&Number.isFinite(m.current)?m.voltage*m.current:null;Object.is(m.power,A)||(m.power=A,v=!0)}!g&&!v||(r||(a=ne({},a),r=!0),a[s.id]=m)}return r?a:i})}parseBatteryPath(e){let t=e.match(/self\.electrical\.batteries\.([^.]+)\.(.+)$/);return t?{id:t[1],key:t[2]}:null}trackDiscoveredBattery(e){let t=this.discoveredBatteryIds();if(t.includes(e))return;let i=[...t,e].sort();this.discoveredBatteryIds.set(i)}applyBatteryValue(e,t,i,a){switch(t){case"name":{let r=i;return e.name===r?!1:(e.name=r,!0)}case"location":{let r=i;return e.location===r?!1:(e.location=r,!0)}case"chemistry":{let r=i;return e.chemistry===r?!1:(e.chemistry=r,!0)}case"voltage":{let r=this.toNumber(i,"V");return Object.is(e.voltage,r)?!1:(e.voltage=r,!0)}case"current":{let r=this.toNumber(i,"A"),s=!Object.is(e.currentState??null,a??null);return Object.is(e.current,r)&&!s?!1:(e.current=r,e.currentState=a,!0)}case"temperature":{let r=this.toNumber(i,this.units.getDefaults().Temperature);return Object.is(e.temperature,r)?!1:(e.temperature=r,!0)}case"capacity.nominal":{let r=this.toNumber(i,"kWh");return Object.is(e.capacityNominal,r)?!1:(e.capacityNominal=r,!0)}case"capacity.actual":{let r=this.toNumber(i,"kWh");return Object.is(e.capacityActual,r)?!1:(e.capacityActual=r,!0)}case"capacity.remaining":{let r=this.toNumber(i,"kWh");return Object.is(e.capacityRemaining,r)?!1:(e.capacityRemaining=r,!0)}case"capacity.stateOfCharge":{let r=this.toNumber(i,"ratio"),s=!Object.is(e.stateOfChargeState??null,a??null);return Object.is(e.stateOfCharge,r)&&!s?!1:(e.stateOfCharge=r,e.stateOfChargeState=a,!0)}case"capacity.timeRemaining":{let r=this.toNumber(i,"s");return Object.is(e.timeRemaining,r)?!1:(e.timeRemaining=r,!0)}default:return!1}}buildBankSummary(e,t){let i=e.batteryIds.map(v=>t[v]).filter(v=>!!v),a=this.normalizeConnectionMode(e.connectionMode),r=this.calculateBankCurrent(i,a),s=this.sumNumbers(i.map(v=>v.power)),l=this.sumNumbers(i.map(v=>v.capacityRemaining)),m=this.calculateBankSoc(i),g=this.calculateBankTimeRemaining(i,a);return{id:e.id,name:e.name,batteryIds:e.batteryIds,totalCurrent:r,totalPower:s,remainingCapacity:l,avgSoc:m,timeRemaining:g}}calculateBankSoc(e){let t=this.sumNumbers(e.map(r=>r.capacityRemaining)),i=this.sumNumbers(e.map(r=>r.capacityActual));if(t!=null&&i!=null&&i>0)return Math.max(0,Math.min(1,t/i));let a=this.sumNumbers(e.map(r=>r.capacityNominal));return t!=null&&a!=null&&a>0?Math.max(0,Math.min(1,t/a)):this.averageNumbers(e.map(r=>r.stateOfCharge))}calculateBankCurrent(e,t){let i=e.map(a=>a.current);return t==="series"?this.averageNumbers(i):this.sumNumbers(i)}calculateBankTimeRemaining(e,t){let i=e.map(a=>a.timeRemaining);return t==="series"?this.minNumber(i):this.averageNumbers(i)}requestRender(e){this.svg&&(this.pendingRenderSnapshot=e??this.buildRenderSnapshot(),this.pendingRenderSnapshot&&this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.ngZone.runOutsideAngular(()=>this.render(t))})))}buildRenderSnapshot(){let e=this.widgetColors();return e?{banks:this.bankSummaries(),batteries:this.visibleBatteries(),batteryDisplayModels:this.batteryDisplayModels(),bankDisplayModels:this.bankDisplayModels(),widgetColors:e}:null}render(e){if(!this.bankLayer||!this.batteryLayer)return;let{banks:t,batteries:i,bankDisplayModels:a,batteryDisplayModels:r,widgetColors:s}=e,l=this.buildRenderLayout(t,i,a,r),m=Math.max(n.MIN_VIEWBOX_HEIGHT,l.contentHeight);this.svg?.attr("viewBox",`0 0 ${n.VIEWBOX_WIDTH} ${m}`),this.root?.attr("transform",null);let g=this.bankLayer.selectAll("g.bank-card").data(l.banks,D=>D.id),v=g.enter().append("g").attr("class","bank-card");v.append("rect").attr("class","bank-card").attr("rx",4).attr("ry",4),v.append("text").attr("class","bank-card-power"),v.append("text").attr("class","bank-card-current");let A=v.append("g").attr("class","bank-gauge");A.append("path").attr("class","bank-gauge-bg"),A.append("path").attr("class","bank-gauge-value"),A.append("text").attr("class","bank-gauge-soc"),v.append("text").attr("class","bank-actualCapacity"),v.append("text").attr("class","bank-remaining"),v.append("g").attr("class","bank-bms-batteries"),v.append("text").attr("class","bank-title");let C=v.merge(g);C.attr("transform",D=>`translate(${D.x+.5},${D.y+.5})`),C.select("rect").attr("width",D=>D.width-1).attr("height",D=>D.height-1).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5),C.select("text.bank-title").attr("x",5).attr("y",16).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",15.5).attr("opacity",.8).text(D=>D.displayModel.titleText),C.select("text.bank-card-current").attr("x",10).attr("y",37).attr("fill","var(--kip-contrast-color)").attr("font-size",16).text(D=>D.displayModel.currentText),C.select("text.bank-card-power").attr("x",10).attr("y",49).attr("fill","var(--kip-contrast-color)").attr("font-size",10).attr("opacity",.8).text(D=>D.displayModel.powerText),C.select("g.bank-gauge").attr("transform","translate(150, 46)"),C.select("path.bank-gauge-bg").attr("d",this.bankGaugeBackgroundPath).attr("fill","none").attr("stroke","var(--kip-contrast-dimmer-color)").attr("stroke-width",n.BANK_GAUGE_BG_STROKE).attr("stroke-linecap","round"),C.select("path.bank-gauge-value").attr("d",D=>D.displayModel.gaugeValuePath).attr("fill","none").attr("stroke",D=>D.displayModel.gaugeValueColor).attr("stroke-width",n.BANK_GAUGE_VALUE_STROKE).attr("stroke-linecap","round"),C.select("text.bank-gauge-soc").attr("x",0).attr("y",-2).attr("text-anchor","middle").attr("fill","var(--kip-contrast-color)").attr("font-size",25).attr("font-weight",700).text(D=>D.displayModel.socText),C.select("text.bank-remaining").attr("x",150).attr("y",22).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",6).text(D=>D.displayModel.remainingText),C.select("text.bank-actualCapacity").attr("x",150).attr("y",53).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8).text(D=>D.displayModel.remainingCapacityText),C.select("g.bank-bms-batteries").each((D,V,F)=>{let j=hn(F[V]).selectAll("g.battery-card").data(D.batteries,ae=>ae.key),Ce=j.enter().append("g").attr("class","battery-card battery-card--in-bank");this.appendBatteryCardSkeleton(Ce);let me=Ce.merge(j);this.renderBatteryCards(me,s),j.exit().remove()}),g.exit().remove();let _=this.batteryLayer.selectAll("g.battery-card").data(l.unassignedBatteries,D=>D.key),M=_.enter().append("g").attr("class","battery-card battery-card--unassigned");this.appendBatteryCardSkeleton(M);let B=M.merge(_);this.renderBatteryCards(B,s),_.exit().remove(),this.root?.attr("data-theme","ready")}buildRenderLayout(e,t,i,a){let r=new Map(t.map(F=>[F.id,F])),s=new Set,l=this.computeInBankBatteryScale(),m=n.BATTERY_CARD_HEIGHT*l,g=this.computeInBankBatterySlotWidth(),v=0,A=e.map(F=>{let Y=new Set,j=F.batteryIds.map(oe=>r.get(oe)).filter(oe=>!oe||Y.has(oe.id)?!1:(Y.add(oe.id),!0));j.forEach(oe=>s.add(oe.id));let Ce=Math.ceil(j.length/n.IN_BANK_COLUMNS),me=Ce>0?Ce*m+(Ce-1)*n.CARD_GAP:0,ae=Math.max(n.BANK_MIN_HEIGHT,n.BANK_HEADER_HEIGHT+me+n.CARD_GAP),se=j.map((oe,de)=>{let le=de%n.IN_BANK_COLUMNS,be=Math.floor(de/n.IN_BANK_COLUMNS),Ue=n.IN_BANK_PADDING_X+le*(g+n.IN_BANK_COLUMN_GAP),st=n.BANK_HEADER_HEIGHT+be*(m+n.CARD_GAP);return{id:oe.id,displayModel:a[oe.id],key:`${F.id}::${oe.id}`,x:Ue,y:st,scale:l,compact:!0}}),ce={id:F.id,name:F.name,batteryIds:F.batteryIds,totalCurrent:F.totalCurrent,totalPower:F.totalPower,avgSoc:F.avgSoc,remainingCapacity:F.remainingCapacity,timeRemaining:F.timeRemaining,displayModel:i[F.id],x:0,y:v,width:n.BANK_CARD_WIDTH,height:ae,batteries:se};return v+=ae+n.CARD_GAP,ce}),C=A.length>0?v:0,_=t.filter(F=>!s.has(F.id)).sort((F,Y)=>F.id.localeCompare(Y.id)).map((F,Y)=>({id:F.id,displayModel:a[F.id],key:F.id,x:0,y:C+Y*(n.BATTERY_CARD_HEIGHT+n.CARD_GAP),scale:1,compact:!1})),M=A[A.length-1],B=M?M.y+M.height:0,D=_[_.length-1],V=D?D.y+n.BATTERY_CARD_HEIGHT:0;return{banks:A,unassignedBatteries:_,contentHeight:Math.max(B,V)}}computeInBankBatterySlotWidth(){return(n.BANK_CARD_WIDTH-n.IN_BANK_PADDING_X*2-n.IN_BANK_COLUMN_GAP)/n.IN_BANK_COLUMNS}computeInBankBatteryScale(){let e=this.computeInBankBatterySlotWidth();return Math.max(.35,Math.min(1,e/n.BATTERY_CARD_WIDTH))}appendBatteryCardSkeleton(e){e.append("rect").attr("class","bms-battery").attr("rx",4).attr("ry",4),e.append("rect").attr("class","bms-battery-tip").attr("rx",1).attr("ry",1),e.append("rect").attr("class","bms-charge-fill").attr("rx",3).attr("ry",3),e.append("g").attr("class","bms-state-icon"),e.append("text").attr("class","bms-ampere"),e.append("text").attr("class","bms-volt-power"),e.append("text").attr("class","bms-soc"),e.append("text").attr("class","bms-actualCapacity"),e.append("text").attr("class","bms-remaining"),e.append("text").attr("class","bms-title")}renderBatteryCards(e,t){e.attr("transform",i=>`translate(${i.x},${i.y}) scale(${i.scale})`),e.select("rect.bms-battery").attr("width",n.BATTERY_CARD_WIDTH).attr("height",n.BATTERY_CARD_HEIGHT).attr("fill",i=>i.compact?"var(--mat-sys-background)":"var(--kip-contrast-dimmer-color)").attr("stroke","var(--kip-contrast-dimmer-color)").attr("stroke-width",0),e.select("rect.bms-battery-tip").attr("x",n.BATTERY_CARD_WIDTH+1).attr("y",n.BATTERY_CARD_HEIGHT/2-10).attr("width",4).attr("height",20).attr("fill",i=>i.compact?"var(--mat-sys-background)":"var(--kip-contrast-dimmer-color)").attr("stroke",t.color).attr("stroke-width",0),e.select("rect.bms-charge-fill").attr("x",1.5).attr("y",1.5).attr("width",i=>i.displayModel.chargeWidth).attr("height",n.BATTERY_CARD_HEIGHT-3).attr("fill",i=>i.compact?i.displayModel.chargeBarColorCompact:i.displayModel.chargeBarColorRegular),e.select("text.bms-title").attr("x",5).attr("y",i=>i.compact?11:14).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",i=>i.compact?8:12).text(i=>i.displayModel.titleText),e.select("text.bms-ampere").attr("x",10).attr("y",33).attr("fill",i=>i.compact?i.displayModel.currentTextColorCompact:i.displayModel.currentTextColorRegular).attr("stroke","var(--kip-widget-card-background-color)").attr("stroke-width",i=>i.displayModel.currentStrokeWidth).attr("font-size",16).text(i=>i.displayModel.currentText),e.select("text.bms-volt-power").attr("x",10).attr("y",45).attr("fill","var(--kip-contrast-dim-color)").attr("font-size",8).attr("opacity",.8).text(i=>i.compact?i.displayModel.detailLineCompact:i.displayModel.detailLineRegular),e.select("text.bms-soc").attr("x",n.BATTERY_CARD_WIDTH-33).attr("y",34).attr("fill",i=>i.compact?"var(--kip-contrast-dim-color)":"var(--kip-contrast-color)").attr("text-anchor","middle").attr("font-size",25).attr("font-weight",700).text(i=>i.displayModel.socText),e.select("text.bms-actualCapacity").attr("x",n.BATTERY_CARD_WIDTH-33).attr("y",45).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",8).text(i=>i.compact?"":i.displayModel.actualCapacityText),e.select("text.bms-remaining").attr("x",n.BATTERY_CARD_WIDTH-33).attr("y",12).attr("fill","var(--kip-contrast-dim-color)").attr("text-anchor","middle").attr("font-size",6).text(i=>i.compact?"":i.displayModel.remainingText),e.select("g.bms-state-icon").attr("transform",`translate(${n.BATTERY_CARD_WIDTH/2-18}, ${n.BATTERY_CARD_HEIGHT/2-18})`).attr("display",i=>i.compact&&i.scale<.45?"none":null).attr("color",i=>i.compact?t.dim:t.color).each((i,a,r)=>{let s=hn(r[a]),l=i.displayModel.iconKey,m=l==="power_renewal"?this.powerRenewalIconTemplate:this.powerAvailableIconTemplate;if(!m){s.selectAll("*").remove(),s.attr("data-icon-key",null);return}let g=s.node();if(!g||s.attr("data-icon-key")===l&&g.firstElementChild)return;s.selectAll("*").remove();let A=m.cloneNode(!0);A.removeAttribute("id"),A.setAttribute("width","36"),A.setAttribute("height","36"),A.getAttribute("viewBox")||A.setAttribute("viewBox","0 0 24 24"),g.appendChild(A),s.attr("data-icon-key",l)})}formatVoltage(e){return e==null?"-- V":`${e.toFixed(1)}V`}formatCurrent(e){return e==null?"-- A":`${e.toFixed(1)}A`}formatPower(e){return e==null?"":`${e.toFixed(0)}W`}formatSoc(e){return e==null?"--%":`${Math.round(e*100)}%`}formatDuration(e){return e==null?"":this.units.convertToUnit("D HH:MM:SS",e).toString()}sumNumbers(e){let t=e.filter(i=>typeof i=="number");return t.length?t.reduce((i,a)=>i+a,0):null}averageNumbers(e){let t=e.filter(i=>typeof i=="number");return t.length?t.reduce((i,a)=>i+a,0)/t.length:null}minNumber(e){let t=e.filter(i=>typeof i=="number");return t.length?Math.min(...t):null}toNumber(e,t){return e==null||typeof e!="number"?null:this.units.convertToUnit(t,e)??e}formatTemperature(e){return e==null||typeof e!="number"?"":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}static resolveZoneAwareColor(e,t,i,a){if(a||!e||!i)return t;switch(e){case ve.Nominal:return i.zoneNominal;case ve.Alarm:return i.zoneAlarm;case ve.Warn:return i.zoneWarn;case ve.Alert:return i.zoneAlert;default:return t}}buildSemiGaugeArcPath(e,t){let i=Math.max(0,Math.min(1,t??0)),a=-Math.PI*.55,r=Math.PI*1.1,s=a+r*i;if(i<=0){let l=e*Math.cos(a),m=e*Math.sin(a);return`M ${l} ${m}`}return md()({innerRadius:e,outerRadius:e,startAngle:a,endAngle:s})??""}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-bms"]],viewQuery:function(t,i){t&1&&Me(i.svgRef,i_,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[["bmsSvg",""],["aria-hidden","false",1,"bms-svg"],[1,"bms-empty"],[1,"bms-empty-title"],[1,"bms-empty-sub"]],template:function(t,i){t&1&&(ie(),Q(0,"svg",1,0),I(2,n_,5,0,"div",2)),t&2&&(f(2),N(i.hasBatteries()?-1:2))},dependencies:[et],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.bms-svg[_ngcontent-%COMP%]{height:100%;width:100%;padding:12px}.bms-card-metric[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:30px;font-weight:700}.bms-card-sub[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:18px;opacity:.9}.bms-card-meta[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:15px;opacity:.75}.bms-card-footer[_ngcontent-%COMP%]{fill:var(--mat-sys-on-surface);font-size:16px;opacity:.8}.bms-flow-line[_ngcontent-%COMP%]{stroke:var(--kip-zone-nominal-color);stroke-width:3px;stroke-dasharray:6 6;animation:_ngcontent-%COMP%_flow-dash 2s linear infinite}.bms-flow-line--out[_ngcontent-%COMP%]{stroke:var(--kip-zone-warn-color)}.bms-flow-line--in[_ngcontent-%COMP%]{stroke:var(--kip-zone-nominal-color)}.bms-flow-line--neutral[_ngcontent-%COMP%]{stroke:var(--kip-widget-card-border-color);animation:none}.bms-empty[_ngcontent-%COMP%]{position:absolute;inset:0;margin:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.bms-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.bms-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}@keyframes _ngcontent-%COMP%_flow-dash{to{stroke-dashoffset:-12}}"],changeDetection:0})}return n})();var a_=["solarSvg"];function o_(n,o){n&1&&(E(0,"div",2)(1,"div",3),c(2,"No solar chargers detected"),O(),E(3,"div",4),c(4,"Check Signal K solar paths or select chargers in widget settings."),O()())}var vf=(()=>{class n{id=x.required();type=x.required();theme=x.required();static DEFAULT_CONFIG={color:"contrast",ignoreZones:!1,solarCharger:{trackedSolarIds:[],solarOptionsById:{}}};static VIEWBOX_WIDTH=200;static CARD_HEIGHT=92;static CARD_GAP=8;static SOLAR_PANEL_X=135;static SOLAR_PANEL_Y=0;static PATH_BATCH_WINDOW_MS=500;runtime=y(Se);data=y(Ot);units=y(it);destroyRef=y(ze);ngZone=y(qe);svgRef=he.required("solarSvg");svg;layer;renderFrameId=null;pendingRenderSnapshot=null;pathBatchTimerId=null;initialPathPaintDone=!1;pendingPathUpdates=new Map;discoveredSolarIds=w([]);trackedSolarIds=w([]);solarOptionsById=w({});chargers=w({});visibleSolarIds=X(()=>{let e=this.trackedSolarIds();return e.length?e:this.discoveredSolarIds()});visibleSolarUnits=X(()=>{let e=this.visibleSolarIds(),t=this.chargers();return e.map(i=>t[i]).filter(i=>!!i)});colorRole=X(()=>this.runtime.options()?.color);ignoreZones=X(()=>this.runtime.options()?.ignoreZones);widgetColors=X(()=>{let e=this.theme();return e?Te(this.colorRole(),e):null});displayModels=X(()=>{let e=this.visibleSolarUnits(),t=this.solarOptionsById(),i=this.theme(),a=this.widgetColors(),r=this.ignoreZones(),s={};for(let l of e){let m=t[l.id]?.arrayRatedPowerW??null,g=l.panelPower??null,v=this.formatPowerAuto(g),A=m&&m>0&&g!=null?Math.max(0,Math.min(1,g/m)):0,C=l.panelPowerState??l.panelCurrentState??null,_=l.currentState??null,M=n.resolveZoneAwareColor(C,a?.dim??"var(--kip-contrast-dim-color)",i,r),B=n.resolveZoneAwareColor(_,"var(--kip-contrast-color)",i,r),D=this.valueOrDash(l.controllerMode),V=this.isRelayActive(l.load),F=V?`${this.formatRelayState(l.load)}\xA0\xA0\xA0\xA0${this.formatCurrent(l.loadCurrent)}`.trim():"";s[l.id]={id:l.id,titleText:l.name||`Controller ${l.id}`,panelPowerText:v.value,panelPowerUnitText:v.unit,panelPowerColor:M,chargerCurrentTextColor:B,gaugeProgress:A,gaugeSectionText:`${this.formatVoltage(l.panelVoltage)}`+(l.panelCurrent!=null?`, ${this.formatCurrent(l.panelCurrent)}`:"")+(l.panelTemperature!=null?`, ${this.formatTemperature(l.panelTemperature)}`:""),chargerSectionCurrent:`${this.formatCurrent(l.current)}`,chargerMode:`${D.charAt(0).toUpperCase()+D.slice(1)} mode`,chargerSectionMetadata:`${l.voltage!=null?this.formatVoltage(l.voltage):""}\xA0\xA0\xA0\xA0${l.temperature!=null?this.formatTemperature(l.temperature):""}`.trim(),relaySectionVisible:V,relaySectionText:F}}return s});hasChargers=X(()=>this.visibleSolarUnits().length>0);constructor(){L(()=>{let t=this.runtime.options();t&&G(()=>this.applyConfig(t))}),L(()=>{let t=this.displayModels(),i=this.visibleSolarUnits(),a=this.widgetColors();!this.svg||!a||this.requestRender({solarUnits:i,displayModels:t,widgetColors:a})});let e=this.data.subscribePathTreeWithInitial("self.electrical.solar.*");if(e.initial.length){for(let t of e.initial)this.enqueuePathUpdate(t,!0);this.flushPendingPathUpdates(),this.initialPathPaintDone=!0}e.live$.pipe(Le(this.destroyRef)).subscribe(t=>{this.enqueuePathUpdate(t)})}ngAfterViewInit(){this.initializeSvg(),this.requestRender()}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null}initializeSvg(){this.svg=hn(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${n.VIEWBOX_WIDTH} ${n.CARD_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Solar Charger View"),this.layer=this.svg.append("g").attr("class","solar-layer")}applyConfig(e){let t=this.resolveSolarConfig(e);this.trackedSolarIds.set(t.trackedSolarIds),this.solarOptionsById.set(t.solarOptionsById)}resolveSolarConfig(e){let t=e.solarCharger,i=t?.solarOptionsById??{};return{trackedSolarIds:Array.isArray(t?.trackedSolarIds)?t.trackedSolarIds:[],solarOptionsById:i}}enqueuePathUpdate(e,t=!1){let i=this.parseSolarPath(e.path);if(!i)return;let{id:a,key:r}=i,s=e.update?.data?.value??null,l=e.update?.state??null,m=`${a}::${r}`;if(this.pendingPathUpdates.set(m,{id:a,key:r,value:s,state:l}),!t){if(!this.initialPathPaintDone){this.initialPathPaintDone=!0,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates()},n.PATH_BATCH_WINDOW_MS))}}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredSolar(i)),this.chargers.update(i=>{let a=i,r=!1;for(let s of e){let l=a[s.id]??{id:s.id},m=ne({},l),g=this.applyChargerValue(m,s.key,s.value,s.state),v=!1,A=this.resolvePowerValue(m.rawBatteryPower,m.voltage,m.current);Object.is(m.power,A)||(m.power=A,v=!0);let C=this.resolvePowerValue(m.rawPanelPower,m.panelVoltage,m.panelCurrent);Object.is(m.panelPower,C)||(m.panelPower=C,v=!0),!(!g&&!v)&&(r||(a=ne({},a),r=!0),a[s.id]=m)}return r?a:i})}parseSolarPath(e){let t=e.match(/self\.electrical\.solar\.([^.]+)\.(.+)$/);return t?{id:t[1],key:t[2]}:null}trackDiscoveredSolar(e){let t=this.discoveredSolarIds();t.includes(e)||this.discoveredSolarIds.set([...t,e].sort())}applyChargerValue(e,t,i,a){switch(t){case"name":return this.setValue(e,"name",this.toStringValue(i));case"location":return this.setValue(e,"location",this.toStringValue(i));case"associatedBus":return this.setValue(e,"associatedBus",this.toStringValue(i));case"voltage":return this.setValue(e,"voltage",this.toNumber(i,"V"));case"current":{let r=this.toNumber(i,"A"),s=!Object.is(e.currentState??null,a??null);return Object.is(e.current,r)&&!s?!1:(e.current=r,e.currentState=a,!0)}case"power":return this.setPowerPathValue(e,"rawBatteryPower",i);case"temperature":return this.setValue(e,"temperature",this.toNumber(i,this.units.getDefaults().Temperature));case"chargingAlgorithm":return this.setValue(e,"chargingAlgorithm",this.toStringValue(i));case"chargerRole":return this.setValue(e,"chargerRole",this.toStringValue(i));case"chargingMode":return this.setValue(e,"chargingMode",this.toStringValue(i));case"setpointVoltage":return this.setValue(e,"setpointVoltage",this.toNumber(i,"V"));case"setpointCurrent":return this.setValue(e,"setpointCurrent",this.toNumber(i,"A"));case"controllerMode":return this.setValue(e,"controllerMode",this.toStringValue(i));case"panelVoltage":return this.setValue(e,"panelVoltage",this.toNumber(i,"V"));case"panelCurrent":{let r=this.toNumber(i,"A"),s=!Object.is(e.panelCurrentState??null,a??null);return Object.is(e.panelCurrent,r)&&!s?!1:(e.panelCurrent=r,e.panelCurrentState=a,!0)}case"panelPower":{let r=this.toNumber(i,"W"),s=!Object.is(e.panelPowerState??null,a??null);return Object.is(e.rawPanelPower,r)&&!s?!1:(e.rawPanelPower=r,e.panelPowerState=a,!0)}case"panelTemperature":return this.setValue(e,"panelTemperature",this.toNumber(i,this.units.getDefaults().Temperature));case"load":case"loadState":case"load.state":return this.setValue(e,"load",i);case"loadCurrent":return this.setValue(e,"loadCurrent",this.toNumber(i,"A"));default:return!1}}setPowerPathValue(e,t,i){let a=this.toNumber(i,"W");return this.setValue(e,t,a)}setValue(e,t,i){return Object.is(e[t],i)?!1:(e[t]=i,!0)}resolvePowerValue(e,t,i){if(e!=null)return e;if(t!=null&&i!=null)return t*i}requestRender(e){this.svg&&(this.pendingRenderSnapshot=e??this.buildRenderSnapshot(),this.pendingRenderSnapshot&&this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.ngZone.runOutsideAngular(()=>this.render(t))})))}buildRenderSnapshot(){let e=this.widgetColors();return e?{solarUnits:this.visibleSolarUnits(),displayModels:this.displayModels(),widgetColors:e}:null}render(e){if(!this.layer||!this.svg)return;let t=e.solarUnits.map((v,A)=>({id:v.id,model:e.displayModels[v.id],y:A*(n.CARD_HEIGHT+n.CARD_GAP)})),i=t.length?t[t.length-1].y+n.CARD_HEIGHT:n.CARD_HEIGHT;this.svg.attr("viewBox",`0 0 ${n.VIEWBOX_WIDTH} ${i}`);let a=this.layer.selectAll("g.solar-card").data(t,v=>v.id),r=a.enter().append("g").attr("class","solar-card");r.append("rect").attr("class","solar-card-bg"),r.append("text").attr("class","solar-title"),r.append("text").attr("class","solar-charger"),r.append("text").attr("class","solar-charger-current"),r.append("text").attr("class","solar-charger-meta"),r.append("text").attr("class","solar-relay-label"),r.append("text").attr("class","solar-relay-values");let s=r.append("g").attr("class","solar-panel-icon");s.append("use").attr("class","solar-panel-bg").attr("href","assets/svg/symbols.svg#solar-panel-cells").attr("x",n.SOLAR_PANEL_X).attr("y",n.SOLAR_PANEL_Y);let l=s.append("g").attr("class","solar-panel-progress");l.append("defs").append("clipPath").attr("clipPathUnits","objectBoundingBox").attr("id",v=>`solar-panel-clip-${this.id()}-${v.id}`).append("rect").attr("x",0).attr("y",0).attr("height",1).attr("width",0),l.append("use").attr("class","solar-panel-colored").attr("href","assets/svg/symbols.svg#solar-panel-cells").attr("x",n.SOLAR_PANEL_X).attr("y",n.SOLAR_PANEL_Y).attr("clip-path",v=>`url(#solar-panel-clip-${this.id()}-${v.id})`);let m=l.append("text").attr("class","solar-panel-power");m.append("tspan").attr("class","solar-panel-power-value"),m.append("tspan").attr("class","solar-panel-power-unit"),l.append("text").attr("class","solar-panel-values");let g=r.merge(a);g.attr("transform",v=>`translate(0, ${v.y})`),g.select("rect.solar-card-bg").attr("x",.5).attr("y",.5).attr("rx",4).attr("ry",4).attr("width",n.VIEWBOX_WIDTH-1).attr("height",n.CARD_HEIGHT-1).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5).attr("fill","none"),g.select("text.solar-title").attr("x",5).attr("y",16).attr("font-size",15.5).attr("fill","var(--kip-contrast-dim-color)").text(v=>v.model.titleText),g.select("text.solar-charger-current").attr("x",10).attr("y",37).attr("font-size",16).attr("fill",v=>v.model.chargerCurrentTextColor).text(v=>v.model.chargerSectionCurrent),g.select("text.solar-charger").attr("x",10).attr("y",47).attr("fill","var(--kip-contrast-color)").attr("font-size",6).attr("opacity",.8).text(v=>v.model.chargerMode),g.select("text.solar-charger-meta").attr("x",10).attr("y",53).attr("font-size",6).attr("opacity",.8).attr("fill","var(--kip-contrast-color)").text(v=>v.model.chargerSectionMetadata),g.select("text.solar-relay-label").attr("x",10).attr("y",74).attr("font-size",8).attr("fill",v=>v.model.panelPowerColor).text(v=>v.model.relaySectionVisible?"Load Output":""),g.select("text.solar-relay-values").attr("x",15).attr("y",83).attr("font-size",6).attr("fill","var(--kip-contrast-color)").attr("opacity",v=>v.model.relaySectionVisible?.8:0).text(v=>v.model.relaySectionText),g.select("g.solar-panel-icon").attr("transform","translate(-3, 25) scale(0.63)"),g.select("use.solar-panel-bg").attr("color","var(--kip-contrast-dimmer-color)"),g.select("g.solar-panel-progress").each((v,A,C)=>{hn(C[A]).select("rect").attr("width",v.model.gaugeProgress)}),g.select("use.solar-panel-colored").attr("color",v=>v.model.panelPowerColor),g.select("text.solar-panel-power").attr("x",235).attr("y",58).attr("text-anchor","middle").attr("font-size",40).attr("font-weight",700).attr("fill","var(--kip-contrast-color)"),g.select("tspan.solar-panel-power-value").text(v=>v.model.panelPowerText),g.select("tspan.solar-panel-power-unit").attr("dx",v=>v.model.panelPowerUnitText?1:0).attr("font-size",22).attr("font-weight",500).attr("fill","var(--kip-contrast-color)").attr("opacity",v=>v.model.panelPowerUnitText?1:0).text(v=>v.model.panelPowerUnitText),g.select("text.solar-panel-values").attr("x",235).attr("y",76).attr("text-anchor","middle").attr("font-size",12).attr("font-weight",500).attr("opacity",.8).attr("fill","var(--kip-contrast-color)").text(v=>v.model.gaugeSectionText),a.exit().remove()}toNumber(e,t){return e==null||typeof e!="number"?null:this.units.convertToUnit(t,e)??e}isRelayActive(e){if(e==null)return!1;if(typeof e=="boolean")return e;if(typeof e=="number")return e>0;let t=e.trim().toLowerCase();return!(!t||t==="off"||t==="false"||t==="0")}toStringValue(e){return typeof e=="string"?e:e==null?null:`${e}`}valueOrDash(e){return e===null?"--":e===void 0?"":e}formatVoltage(e){return e===null?"--":e===void 0?"":`${e.toFixed(1)}V`}formatCurrent(e){return e===null?"--":e===void 0?"":`${e.toFixed(1)}A`}formatTemperature(e){return e===null?"--":e===void 0?"":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}formatRelayState(e){return e===null?"--":e===void 0?"":typeof e=="boolean"?e?"On":"Off":typeof e=="number"?e>0?"On":"Off":e}formatPowerAuto(e){return e===null?{value:"--",unit:""}:e===void 0?{value:"",unit:""}:Math.abs(e)>=1e3?{value:(e/1e3).toFixed(2),unit:"kW"}:{value:e.toFixed(0),unit:"W"}}static resolveZoneAwareColor(e,t,i,a){if(a||!e||!i)return t;switch(e){case ve.Nominal:return i.zoneNominal;case ve.Alarm:return i.zoneAlarm;case ve.Warn:return i.zoneWarn;case ve.Alert:return i.zoneAlert;default:return t}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-solar-charger"]],viewQuery:function(t,i){t&1&&Me(i.svgRef,a_,5),t&2&&ke()},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:3,vars:1,consts:[["solarSvg",""],["aria-hidden","false",1,"solar-svg"],[1,"solar-empty"],[1,"solar-empty-title"],[1,"solar-empty-sub"]],template:function(t,i){t&1&&(ie(),Q(0,"svg",1,0),I(2,o_,5,0,"div",2)),t&2&&(f(2),N(i.hasChargers()?-1:2))},styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.solar-svg[_ngcontent-%COMP%]{height:100%;width:100%;padding:12px}.solar-empty[_ngcontent-%COMP%]{position:absolute;inset:0;margin:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.solar-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.solar-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}"],changeDetection:0})}return n})();var r_=["Core","Gauge","Component","Racing"];var ml=(()=>{class n{_pluginConfig=y(es);_widgetCategories=[...r_];_componentTypeCache=new Map;_componentTypeMap={WidgetNumericComponent:Pm,WidgetTextComponent:Im,WidgetWindTrendsChartComponent:Nm,WidgetWindComponent:Lm,WidgetTutorialComponent:Wm,WidgetSliderComponent:Fm,WidgetSimpleLinearComponent:Bm,WidgetRacesteerComponent:Hm,WidgetRacerTimerComponent:$m,WidgetRacerLineComponent:jm,WidgetRaceTimerComponent:Ym,WidgetPositionComponent:Zm,WidgetAisRadarComponent:zp,WidgetLabelComponent:Hp,WidgetIframeComponent:qp,WidgetHorizonComponent:$p,WidgetHeelGaugeComponent:jp,WidgetSteelGaugeComponent:Zp,WidgetGaugeNgRadialComponent:ig,WidgetGaugeNgLinearComponent:ag,WidgetGaugeNgCompassComponent:sg,WidgetFreeboardskComponent:Bu,WidgetAnchorAlarmComponent:lg,WidgetDatetimeComponent:dg,WidgetDataChartComponent:tf,WidgetBooleanSwitchComponent:rf,WidgetMultiStateSwitchComponent:lf,WidgetZonesStatePanelComponent:cf,WidgetAutopilotComponent:gf,WidgetBmsComponent:ff,WidgetSolarChargerComponent:vf};_widgetDefinition=[{name:"Numeric",description:"Displays numeric data in a clear and concise format, with options to show minimum and/or maximum recorded values. Includes an optional background minichart for quick visual trend insights.",icon:"numericWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-numeric",componentClassName:"WidgetNumericComponent"},{name:"Text",description:"Displays text data with a customizable color formatting option.",icon:"textWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-text",componentClassName:"WidgetTextComponent"},{name:"Date & Time",description:"Displays date and time data with fully custom formatting options and timezone correction.",icon:"datetimeWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-datetime",componentClassName:"WidgetDatetimeComponent"},{name:"Position",description:"Displays latitude and longitude for location tracking and navigation.",icon:"positionWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-position",componentClassName:"WidgetPositionComponent"},{name:"Static Label",description:"A static text widget that allows you to add customizable labels to your dashboard, helping to organize and clarify your layout effectively.",icon:"labelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-label",componentClassName:"WidgetLabelComponent"},{name:"Switch Panel",description:"A Digital Switching panel group with multiple controls including toggle switches, indicator lights, and press buttons to send Signal K paths values and other operations.",icon:"switchpanelWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-boolean-switch",componentClassName:"WidgetBooleanSwitchComponent"},{name:"Multi-State Switch",description:"Lists all available device/path operating modes/states (e.g., On, Off, Charge Only, Invert Only), highlights the current state, and lets you select a new state to send to the device and see the result.",icon:"multiStateSwitchWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-multi-state-switch",componentClassName:"WidgetMultiStateSwitchComponent"},{name:"Zones State Panel",description:"Displays the data state (severity and message) of the path's Zones (based on Signal K path metadata configuration).",icon:"zonesStatePanel",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Core",requiredPlugins:[],selector:"widget-zones-state-panel",componentClassName:"WidgetZonesStatePanelComponent"},{name:"Slider",description:"A Digital Switching range slider that allows users to adjust values, such as controlling lighting intensity or audio volume from 0% to 100%.",icon:"sliderWidget",minWidth:2,minHeight:2,defaultWidth:4,defaultHeight:4,category:"Core",requiredPlugins:[],selector:"widget-slider",componentClassName:"WidgetSliderComponent"},{name:"Compact Linear",description:"A simple horizontal linear gauge with a large value label offering a clean, compact modern look.",icon:"simpleLinearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-simple-linear",componentClassName:"WidgetSimpleLinearComponent"},{name:"Linear",description:"A horizontal or vertical linear gauge that supports zone highlighting.",icon:"linearGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-linear",componentClassName:"WidgetGaugeNgLinearComponent"},{name:"Radial",description:"A radial gauge with configurable capacity and measurement dials plus zone highlighting.",icon:"radialGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-radial",componentClassName:"WidgetGaugeNgRadialComponent"},{name:"Compass",description:"A faceplate or card-style rotating compass gauge with multiple cardinal point indicator options.",icon:"compassGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-ng-compass",componentClassName:"WidgetGaugeNgCompassComponent"},{name:"Level Gauge",description:"Dual-scale heel angle indicator combining a high\u2011precision \xB15\xB0 fine level with a wide \xB140\xB0 coarse arc for fast trim tuning and broader heel / sea\u2011state monitoring.",icon:"level",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-heel-gauge",componentClassName:"WidgetHeelGaugeComponent"},{name:"Pitch & Roll",description:"Horizon-style attitude indicator showing live pitch and roll degrees with smooth animation\u2014ideal for monitoring trim, heel, and sea-state response.",icon:"pitchRollGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-horizon",componentClassName:"WidgetHorizonComponent"},{name:"Battery Monitor",description:"Displays battery banks and individual batteries with aggregated bank totals plus per-battery detail cards. See key BMS values such as state of charge, current, voltage, power, temperature, capacity, and time remaining for a clearer view of overall bank health and individual battery status.",icon:"battery_charging",minWidth:2,minHeight:2,defaultWidth:8,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-bms",componentClassName:"WidgetBmsComponent"},{name:"Solar Charger",description:"Track solar generation and charging performance at a glance with live panel output, battery-side metrics, and clear charger and relay status indicators.",icon:"solar_charger",minWidth:2,minHeight:2,defaultWidth:8,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-solar-charger",componentClassName:"WidgetSolarChargerComponent"},{name:"Classic Steel",description:"A traditional steel looking linear & radial gauges replica that supports range sizes and zones highlights.",icon:"steelGauge",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Gauge",requiredPlugins:[],selector:"widget-gauge-steel",componentClassName:"WidgetSteelGaugeComponent"},{name:"Windsteer",description:"A wind steering display that combines wind, wind sectors, heading, course over ground and next waypoint information.",icon:"windsteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-wind-steer",componentClassName:"WidgetWindComponent"},{name:"Freeboard-SK",description:"Adds the Freeboard-SK chart plotter as a widget with automatic sign-in to your dashboard.",icon:"freeboardWidget",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["freeboard-sk","tracks","resources-provider","course-provider"],selector:"widget-freeboardsk",componentClassName:"WidgetFreeboardskComponent"},{name:"Autopilot Head",description:"Provides typical autopilot controls for Signal K v1 & v2 Autopilot API devices. Requires a compatible hardware-specific Autopilot plugin for full functionality.",icon:"autopilotWidget",minWidth:3,minHeight:9,defaultWidth:4,defaultHeight:10,category:"Component",requiredPlugins:[],anyOfPlugins:["autopilot","pypilot-autopilot-provider"],selector:"widget-autopilot",componentClassName:"WidgetAutopilotComponent"},{name:"Realtime Data Chart",description:"Visualizes data on a real-time chart with multiple preconfigured series including actuals, SMA and period overall averages and Min/Max. Requires the KIP Dataset to be configured.",icon:"datachartWidget",minWidth:2,minHeight:3,defaultWidth:6,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-data-chart",componentClassName:"WidgetDataChartComponent"},{name:"Anchor Watch",description:"Monitors your anchor position and triggers an alarm if you drift outside a configured radius (anchor drag). Set the anchor point, watch radius, and alarm behavior (sound/notification) in the widget config. Requires internet connectivity to view map.",icon:"anchorWatch",minWidth:6,minHeight:8,defaultWidth:6,defaultHeight:14,category:"Component",requiredPlugins:["anchoralarm"],selector:"widget-anchor-alarm",componentClassName:"WidgetAnchorAlarmComponent"},{name:"AIS Radar",description:"Displays AIS targets with range rings, interactive target details, and quick zoom and filtering controls.",icon:"aisradar",minWidth:4,minHeight:4,defaultWidth:5,defaultHeight:8,category:"Component",requiredPlugins:[],selector:"widget-ais-radar",componentClassName:"WidgetAisRadarComponent"},{name:"Embed Webpage Viewer",description:"Embeds external web-based applications\u2014such as Grafana graphs or other Signal K apps\u2014into your dashboard for seamless integration. Interaction is disabled by default but can be enabled.",icon:"embedWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-iframe",componentClassName:"WidgetIframeComponent"},{name:"Tutorial",description:"An instructional widget that guides new users through basic navigation, gestures, and dashboard editing steps.",icon:"helpWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:6,category:"Component",requiredPlugins:[],selector:"widget-tutorial",componentClassName:"WidgetTutorialComponent"},{name:"Racesteer (BETA)",description:"A dynamic race steering display that fuses polar performance data with live conditions to guide optimal steering, tacking, and gybing angles for maximum speed. Instantly compare performance against competition polars for smarter tactical decisions.",icon:"racesteeringWidget",minWidth:1,minHeight:2,defaultWidth:4,defaultHeight:6,category:"Racing",requiredPlugins:["signalk-polar-performance-plugin"],selector:"widget-racesteer",componentClassName:"WidgetRacesteerComponent"},{name:"Racer - Start Line Insight",description:"Gain a tactical advantage for racing starts: set and adjust the port and starboard ends of the start line, see your distance to the line, the favored end, and how much the line is favored or unfavored. Includes visual integration with Freeboard SK for interactive line adjustment and display.",icon:"racerlineWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-line",componentClassName:"WidgetRacerLineComponent"},{name:"Racer - Start Timer",description:"An advanced racing countdown timer that indicates OCS (On Course Side) status. Set the start line, choose or adjust the duration, or specify the exact start time. Automatically switches to the target dashboard at the start unless over early.",icon:"racertimerWidget",minWidth:4,minHeight:4,defaultWidth:4,defaultHeight:4,requiredPlugins:["signalk-racer"],category:"Racing",selector:"widget-racer-timer",componentClassName:"WidgetRacerTimerComponent"},{name:"Countdown Timer",description:"A simple race start countdown timer that can be started, paused, synced, reset, and configured for duration.",icon:"racetimerWidget",minWidth:4,minHeight:4,defaultWidth:6,defaultHeight:7,category:"Racing",requiredPlugins:[],selector:"widget-racetimer",componentClassName:"WidgetRaceTimerComponent"},{name:"Wind Trends",description:"A real-time wind trends graph with dual axes for direction and speed. Displays live values and simple moving averages over the current period\u2019s average.",icon:"windtrendsWidget",minWidth:8,minHeight:6,defaultWidth:10,defaultHeight:8,category:"Racing",requiredPlugins:[],selector:"widget-windtrends-chart",componentClassName:"WidgetWindTrendsChartComponent"}];get kipWidgets(){return this._widgetDefinition}get categories(){return this._widgetCategories}getComponentType(e){let t=this._componentTypeCache.get(e);if(t)return t;let i=this._widgetDefinition.find(r=>r.selector===e);if(!i)return;let a=this._componentTypeMap[i.componentClassName];if(a)return this._componentTypeCache.set(e,a),a}getKipWidgetsWithStatus(){return Re(this,null,function*(){let e={},t=Array.from(new Set(this._widgetDefinition.flatMap(i=>[...i.requiredPlugins||[],...i.anyOfPlugins||[]])));return yield Promise.all(t.map(i=>Re(this,null,function*(){let a=yield this._pluginConfig.getPlugin(i);e[i]=a.ok}))),this._widgetDefinition.map(i=>{let a=i.requiredPlugins||[],r=i.anyOfPlugins||[],s=a.map(v=>({name:v,enabled:e[v],required:!0})),l=r.map(v=>({name:v,enabled:e[v],required:!1})),m=[...s,...l],g=s.every(v=>v.enabled);return g&&r.length>0&&(g=l.some(v=>v.enabled)),ge(ne({},i),{isDependencyValid:g,pluginsStatus:m})})})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function s_(n,o){n&1&&(d(0,"span"),c(1,", "),u())}function l_(n,o){if(n&1&&(d(0,"span",8),c(1),d(2,"span",9),c(3),u()(),I(4,s_,2,0,"span")),n&2){let e=o.$implicit,t=o.$index,i=o.$count,a=k(2);R("ngClass",a.pluginDependencyValid()?e.required?"dependency-required-ok":e.enabled?"dependency-optional-ok":"dependency-optional-missing-met":e.enabled?e.required?"dependency-required-ok":"dependency-optional-ok":e.required?"dependency-required-error":"dependency-optional-error"),J("title",e.required?"Required":"Optional"),f(),Ut(" ",e.enabled?"\u2714":"\u2716"," ",e.name," "),f(2),K(e.required?"":"(optional)"),f(),N(t!==i-1?4:-1)}}function d_(n,o){if(n&1&&(d(0,"div",7)(1,"span"),c(2,"Plugins:"),u(),Ae(3,l_,5,6,null,null,Ne),u()),n&2){let e=k();Ua(e.pluginsStatus().length>0?"margin-bottom: 8px;margin-top: 4px;":""),f(),at(e.pluginDependencyValid()?"":"dependency-error"),f(2),ye(e.pluginsStatus())}}var bf=(()=>{class n{svgIcon=x.required();iconSize=x.required();name=x.required();description=x.required();pluginsStatus=x.required();pluginDependencyValid=x.required();onKeydown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.target.click())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-list-card"]],hostBindings:function(t,i){t&1&&U("keydown",function(r){return i.onKeydown(r)})},inputs:{svgIcon:[1,"svgIcon"],iconSize:[1,"iconSize"],name:[1,"name"],description:[1,"description"],pluginsStatus:[1,"pluginsStatus"],pluginDependencyValid:[1,"pluginDependencyValid"]},decls:9,vars:11,consts:[["role","button","tabindex","0",1,"item-container"],[1,"item-icon"],["aria-hidden","false",3,"svgIcon"],[1,"item-label"],[1,"title","no-text-select"],[1,"dependency","no-text-select",3,"style"],[1,"description","no-text-select"],[1,"dependency","no-text-select"],[3,"ngClass"],[1,"plugin-type-label"]],template:function(t,i){t&1&&(d(0,"div",0)(1,"div",1),W(2,"mat-icon",2),u(),d(3,"div",3)(4,"p",4),c(5),u(),I(6,d_,5,4,"div",5),d(7,"span",6),c(8),u()()()),t&2&&(J("aria-disabled",i.pluginDependencyValid()?null:"true"),f(2),xe("width",i.iconSize(),"px")("height",i.iconSize(),"px"),R("svgIcon",i.svgIcon()),f(2),Ua(i.pluginsStatus().length>0?"margin-bottom:0px; margin-top: 4px":""),f(),K(i.name()),f(),N(i.pluginsStatus().length>0?6:-1),f(2),K(i.description()))},dependencies:[Sc,xc,et,Xe],styles:["[_nghost-%COMP%]{display:block;text-align:center;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer;padding:0}.item-container[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;width:100%;height:100%;margin:0;padding:15px;border:solid 1px var(--mat-sys-outline);cursor:pointer}.item-container[_ngcontent-%COMP%]:hover{background-color:var(--mat-sys-inverse-on-surface)}.item-container[_ngcontent-%COMP%]:focus-visible{background-color:var(--mat-sys-surface-bright);outline:-webkit-focus-ring-color auto 0px}.item-icon[_ngcontent-%COMP%]{width:48px}.item-label[_ngcontent-%COMP%]{width:calc(100% - 48px);text-align:left;padding-left:15px}.title[_ngcontent-%COMP%]{font-size:var(--mat-sys-label-medium-line-height)}.description[_ngcontent-%COMP%]{color:var(--mat-sys-outline)}.dependency[_ngcontent-%COMP%]{color:var(--mat-sys-outline);text-align:start;font-style:italic;font-size:var(--mat-sys-label-large-size)}.dependency-error[_ngcontent-%COMP%]{color:var(--kip-port-color);font-weight:700}.dependency-required-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color);font-weight:700}.dependency-required-error[_ngcontent-%COMP%]{color:var(--kip-port-color);font-weight:700;text-decoration:underline}.dependency-optional-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color)}.dependency-optional-error[_ngcontent-%COMP%]{color:var(--kip-port-color)}.dependency-optional-missing-met[_ngcontent-%COMP%]{color:var(--mat-sys-outline);text-decoration:line-through}.dependency-optional-present-met[_ngcontent-%COMP%]{color:var(--mat-sys-outline)}.plugin-type-label[_ngcontent-%COMP%]{font-size:.8em;margin-left:2px;opacity:.7}.dependency-ok[_ngcontent-%COMP%]{color:var(--kip-starboard-color)}.no-text-select[_ngcontent-%COMP%]{-webkit-user-select:none;user-select:none}"]})}return n})();var c_=(n,o)=>o.selector;function u_(n,o){if(n&1&&(d(0,"mat-button-toggle",1),c(1),u()),n&2){let e=o.$implicit;R("value",e),f(),fe(" ",e," ")}}function m_(n,o){if(n&1){let e=we();d(0,"widget-list-card",3),U("click",function(){let i=ee(e).$implicit,a=k();return te(a.onSelectWidget(i))}),u()}if(n&2){let e=o.$implicit;dt("dependency-missing",!e.isDependencyValid),R("svgIcon",e.icon)("iconSize",48)("name",e.name)("description",e.description)("pluginDependencyValid",e.isDependencyValid)("pluginsStatus",e.pluginsStatus)}}var Af=(()=>{class n{_dialogRef=y(an);_widgets=y(ml);_widgetsList=[];filteredWidgetsList=w([]);_widgetCategory=w("Core");isDependencyValid=w(!0);ngOnInit(){this.loadWidgets()}loadWidgets(){return Re(this,null,function*(){this._widgetsList=yield this._widgets.getKipWidgetsWithStatus(),this.filteredWidgetsList.set(this._widgetsList.filter(e=>e.category===this._widgetCategory()))})}onCategoryChange(e){this.filteredWidgetsList.set(this._widgetsList.filter(t=>t.category===e.value)),this._widgetCategory.set(e.value)}onSelectWidget(e){if(!e.isDependencyValid)return;let{name:t,description:i,icon:a,minWidth:r,minHeight:s,defaultWidth:l,defaultHeight:m,category:g,requiredPlugins:v,anyOfPlugins:A,selector:C,componentClassName:_}=e,M=ge(ne({name:t,description:i,icon:a,minWidth:r,minHeight:s,defaultWidth:l,defaultHeight:m,category:g,requiredPlugins:v},A?{anyOfPlugins:A}:{}),{selector:C,componentClassName:_});this._dialogRef.close(M)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widgets-list"]],decls:7,vars:1,consts:[["name","widgetCategories","aria-label","Widget categories",1,"list-filter",3,"change","value"],[3,"value"],[3,"dependency-missing","svgIcon","iconSize","name","description","pluginDependencyValid","pluginsStatus"],[3,"click","svgIcon","iconSize","name","description","pluginDependencyValid","pluginsStatus"]],template:function(t,i){t&1&&(d(0,"div")(1,"mat-button-toggle-group",0),U("change",function(r){return i.onCategoryChange(r)}),Ae(2,u_,2,2,"mat-button-toggle",1,Ne),u(),d(4,"div"),Ae(5,m_,1,8,"widget-list-card",2,c_),u()()),t&2&&(f(),R("value",i._widgetCategory()),f(),ye(i._widgets.categories),f(3),ye(i.filteredWidgetsList()))},dependencies:[As,Xo,po,bf],styles:[".list-filter[_ngcontent-%COMP%]{margin-bottom:20px}.dependency-missing[_ngcontent-%COMP%]{pointer-events:none;opacity:.8;background-color:var(--mat-sys-neutral10)}"]})}return n})();var yf=(()=>{class n{dialogRef=y(an);upgradeSvc=y(Uu);upgrade(){this.upgradeSvc.runUpgrade(void 0)}startFresh(){this.upgradeSvc.startFresh(),this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["upgrade-config"]],decls:193,vars:0,consts:[[1,"warning"],[1,"nav-table"],[2,"font-size","x-large"],["href","https://discord.gg/AMDYT2DQga","target","_blank"],[1,"button-group"],["mat-flat-button","",3,"click"],["mat-flat-button","",2,"margin-left","20px",3,"click"]],template:function(t,i){t&1&&(d(0,"h2"),c(1,"All New Touch, Mouse, and Keyboard Navigation"),u(),d(2,"p",0)(3,"strong"),c(4,"Heads up:"),u(),c(5," The new version introduces a completely redesigned fullscreen interface with no navigation bar. Please review the input modes table below to get an understanding of the new ways to operate KIP before upgrading. After the upgrade, give yourself time to get comfortable with the changes."),u(),d(6,"table",1)(7,"thead")(8,"tr")(9,"th"),c(10,"Actions"),u(),d(11,"th"),c(12,"Touch"),u(),d(13,"th"),c(14,"Mouse"),u(),d(15,"th"),c(16,"Keyboard Shortcuts"),u()()(),d(17,"tbody")(18,"tr")(19,"td"),c(20,"Open Actions menu"),u(),d(21,"td"),c(22,"Swipe left"),u(),d(23,"td"),c(24,"Click, drag left, and release"),u(),d(25,"td")(26,"kbd"),c(27,"Shift"),u(),c(28," + "),d(29,"kbd"),c(30,"Ctrl"),u(),c(31," + "),d(32,"kbd",2),c(33,"\u2190"),u(),c(34," (Left Arrow)"),u()(),d(35,"tr")(36,"td"),c(37,"Open Notification menu"),u(),d(38,"td"),c(39,"Swipe right"),u(),d(40,"td"),c(41,"Click, drag right, and release"),u(),d(42,"td")(43,"kbd"),c(44,"Shift"),u(),c(45," + "),d(46,"kbd"),c(47,"Ctrl"),u(),c(48," + "),d(49,"kbd",2),c(50,"\u2192"),u(),c(51," (Right Arrow)"),u()(),d(52,"tr")(53,"td"),c(54,"Cycle through dashboards"),u(),d(55,"td"),c(56,"Swipe up/down"),u(),d(57,"td"),c(58,"Click, drag up/down, and release"),u(),d(59,"td")(60,"kbd"),c(61,"Shift"),u(),c(62," + "),d(63,"kbd"),c(64,"Ctrl"),u(),c(65," + "),d(66,"kbd",2),c(67,"\u2191"),u(),c(68,"/"),d(69,"kbd",2),c(70,"\u2193"),u(),c(71," (Up/Down Arrow)"),u()(),d(72,"tr")(73,"td"),c(74,"Toggle Fullscreen"),u(),d(75,"td"),c(76,"N/A"),u(),d(77,"td"),c(78,"N/A"),u(),d(79,"td")(80,"kbd"),c(81,"Shift"),u(),c(82," + "),d(83,"kbd"),c(84,"Ctrl"),u(),c(85," + "),d(86,"kbd"),c(87,"F"),u()()(),d(88,"tr")(89,"td"),c(90,"Toggle Night mode"),u(),d(91,"td"),c(92,"N/A"),u(),d(93,"td"),c(94,"N/A"),u(),d(95,"td")(96,"kbd"),c(97,"Shift"),u(),c(98," + "),d(99,"kbd"),c(100,"Ctrl"),u(),c(101," + "),d(102,"kbd"),c(103,"N"),u()()(),d(104,"tr")(105,"td"),c(106,"Toggle dashboard edit mode"),u(),d(107,"td"),c(108,"N/A"),u(),d(109,"td"),c(110,"N/A"),u(),d(111,"td")(112,"kbd"),c(113,"Shift"),u(),c(114," + "),d(115,"kbd"),c(116,"Ctrl"),u(),c(117," + "),d(118,"kbd"),c(119,"E"),u()()()()(),d(120,"i"),c(121,"Note that the words Touch and Tap are synonymous with mouse click."),u(),W(122,"br")(123,"br"),d(124,"h2"),c(125,"Migration Limitations"),u(),d(126,"p")(127,"span",0),c(128,"Important:"),u(),c(129," The new widget layout engine is "),d(130,"strong"),c(131,"completely different"),u(),c(132," from the previous version. When you upgrade, your configuration will be migrated, but "),d(133,"strong"),c(134,"the way dashboards and widgets are arranged will change significantly"),u(),c(135,`.
48
- `),u(),d(136,"ul")(137,"li"),c(138,"All KIP configuration settings will be migrated."),u(),d(139,"li"),c(140,"Each v2 Page layout will become a v3 Dashboard."),u(),d(141,"li"),c(142,"All widgets and their settings will appear in their new dashboards."),u(),d(143,"li")(144,"span",0)(145,"strong"),c(146,"Note:"),u(),c(147," Widget positions, order, and sizes "),d(148,"strong"),c(149,"WILL BE LOST"),u(),c(150,". After upgrading, dashboards will contain small widgets that you must reposition and resize manually."),u()()(),d(151,"p"),c(152,"To upgrade your configuration, follow these steps:"),u(),d(153,"ol")(154,"li"),c(155," As a safety measure, if you are using Signal K authentication, manually back up your configuration. Make a copy of the "),d(156,"code"),c(157,"9.0.0.json"),u(),c(158," files found on the Signal K server in the following folders: "),d(159,"ul")(160,"li")(161,"code"),c(162,"~/.signalk/applicationData/users/(username)/kip/"),u()(),d(163,"li")(164,"code"),c(165,"~/.signalk/applicationData/global/kip/"),u()()()(),d(166,"li"),c(167,"Click the "),d(168,"strong"),c(169,"Upgrade"),u(),c(170," button below."),u(),d(171,"li"),c(172,"Once the upgrade is complete, KIP will restart and display the migrated dashboards."),u(),d(173,"li"),c(174,"Reposition and resize your widgets as needed."),u(),d(175,"li"),c(176,"Once satisfied, delete the "),d(177,"code"),c(178,"9.0.0.json"),u(),c(179," configuration files located in the previously mentioned folders. They are not needed any more."),u()(),d(180,"p"),c(181," For tips and guidance, consult KIP\u2019s in-app "),d(182,"strong"),c(183,"Help"),u(),c(184," section. Most common questions are answered there. If you need support, join the "),d(185,"a",3),c(186,"Signal K #kip Discord channel"),u(),c(187,`.
49
- `),u(),d(188,"div",4)(189,"button",5),U("click",function(){return i.upgrade()}),c(190,"Upgrade"),u(),d(191,"button",6),U("click",function(){return i.startFresh()}),c(192,"Start Fresh"),u()())},dependencies:[Ht,ot,wt],styles:[".button-group[_ngcontent-%COMP%]{display:flex;justify-content:center}.nav-table[_ngcontent-%COMP%]{width:100%;border-collapse:collapse;margin-bottom:2em}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .nav-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border:1px solid #bbb;padding:.5em 1em;text-align:center}.nav-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background:#ddd;color:#222;font-weight:700}.nav-table[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(2n){background:#242424}.warning[_ngcontent-%COMP%]{color:#b71c1c}.button-group[_ngcontent-%COMP%]{margin-top:2em;display:flex;gap:20px}"]})}return n})();var h_=(n,o)=>o.id;function p_(n,o){if(n&1){let e=we();d(0,"div",2),U("click",function(){let i=ee(e).$implicit,a=k();return te(a.selectIcon(i.id))})("keydown.enter",function(){let i=ee(e).$implicit,a=k();return te(a.selectIcon(i.id))})("keydown.space",function(i){let a=ee(e).$implicit;return k().selectIcon(a.id),te(i.preventDefault())}),d(1,"div",3),W(2,"mat-icon",4),u()()}if(n&2){let e=o.$implicit,t=k();dt("selected",t.selected()===e.id),J("aria-label","Select "+e.id+" icon"),f(2),xe("width",64,"px")("height",64,"px"),R("svgIcon",e.id)}}var xf=(()=>{class n{iconFile=x("assets/svg/icons.svg");currentIcon=x(void 0);selectedIcon=mt();icons=w([]);selected=w("");constructor(){this.loadIcons(),L(()=>{let e=this.currentIcon();G(()=>{e&&this.selected()!==e&&this.selected.set(e)})})}loadIcons(){return Re(this,null,function*(){try{let t=yield(yield fetch(this.iconFile())).text(),r=new DOMParser().parseFromString(t,"image/svg+xml").querySelector("defs");if(!r)return;let s=r.querySelectorAll("svg"),l=[];s.forEach(g=>{let v=g.getAttribute("id");v&&v.startsWith("dashboard-")&&l.push({id:v})}),this.icons.set(l);let m=this.currentIcon();m&&this.selected.set(m)}catch(e){console.error("Error loading icons:",e)}})}selectIcon(e){this.selected.set(e),this.selectedIcon.emit(e)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["select-icon"]],inputs:{iconFile:[1,"iconFile"],currentIcon:[1,"currentIcon"]},outputs:{selectedIcon:"selectedIcon"},decls:3,vars:0,consts:[[1,"icon-grid"],["tabindex","0",1,"icon-item",3,"selected"],["tabindex","0",1,"icon-item",3,"click","keydown.enter","keydown.space"],[1,"icon-container"],["aria-hidden","false",3,"svgIcon"]],template:function(t,i){t&1&&(d(0,"div",0),Ae(1,p_,3,8,"div",1,h_),u()),t&2&&(f(),ye(i.icons()))},dependencies:[et,Xe],styles:[".icon-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(80px,1fr));gap:16px;padding:16px;max-height:400px;overflow-y:auto}.icon-item[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;padding:8px;border:2px solid transparent;border-radius:8px;cursor:pointer;transition:border-color .2s ease;background-color:var(--mat-sys-surface-container-low)}.icon-item[_ngcontent-%COMP%]:hover{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-item.selected[_ngcontent-%COMP%]{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px;background-color:var(--mat-sys-primary-container)}.icon-item[_ngcontent-%COMP%]:focus{outline:2px solid var(--mat-sys-on-primary-container);outline-offset:2px}.icon-container[_ngcontent-%COMP%]{width:64px;height:64px;display:flex;align-items:center;justify-content:center;overflow:hidden}.icon-container[_ngcontent-%COMP%] mat-icon[_ngcontent-%COMP%]{width:100%;height:100%;fill:currentColor}"]})}return n})();function g_(n,o){if(n&1&&(d(0,"button",15),c(1),u()),n&2){let e=k(),t=Rt(1);R("disabled",!t.valid),f(),K(e.data.confirmBtnText)}}var Cf=(()=>{class n{dialogRef=y(an);data=y(ri);_settings=y(Wt);isSplitShellEnabled=w(!0);constructor(){this.data.icon||(this.data.icon="dashboard-dashboard"),this.isSplitShellEnabled.set(this._settings.getSplitShellEnabled())}save(){this.dialogRef.close(this.data)}onIconSelected(e){this.data.icon=e}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["dialog-dashboard-page-editor"]],decls:27,vars:10,consts:[["name","ngForm"],["name","name",3,"ngSubmit"],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"field-wrapper","field-margin"],[1,"field-flex"],["matInput","","type","text","id","name","placeholder","Name","name","name","required","","cdkFocusInitial","",3,"ngModelChange","ngModel"],["placeholder","collapseSplitShell","name","collapseSplitShell",1,"field-flex",3,"ngModelChange","ngModel","disabled"],[1,"field-margin","icon-section"],[2,"font-size","1.2em"],[1,"icon-selector"],[3,"selectedIcon","iconFile","currentIcon"],["align","end"],["mat-flat-button","",3,"mat-dialog-close"],["mat-flat-button","","type","submit",3,"disabled"]],template:function(t,i){if(t&1){let a=we();d(0,"form",1,0),U("ngSubmit",function(){return i.save()}),d(2,"div",2)(3,"h5",3),c(4),u(),d(5,"button",4)(6,"mat-icon"),c(7,"close"),u()()(),d(8,"mat-dialog-content")(9,"div",5)(10,"mat-form-field",6)(11,"mat-label"),c(12,"Display Name"),u(),d(13,"input",7),bn("ngModelChange",function(s){return ee(a),vn(i.data.name,s)||(i.data.name=s),te(s)}),u(),d(14,"mat-error"),c(15," A name is required "),u()(),d(16,"mat-checkbox",8),bn("ngModelChange",function(s){return ee(a),vn(i.data.collapseSplitShell,s)||(i.data.collapseSplitShell=s),te(s)}),c(17," Auto-collapse Freeboard-SK panel when displaying this dashboard. "),u()(),d(18,"div",9)(19,"span",10),c(20,"Icon Gallery"),u(),d(21,"div",11)(22,"select-icon",12),U("selectedIcon",function(s){return i.onIconSelected(s)}),u()()()(),d(23,"mat-dialog-actions",13)(24,"button",14),c(25),u(),I(26,g_,2,2,"button",15),u()()}t&2&&(f(4),K(i.data.title),f(),R("mat-dialog-close",!1),f(8),fn("ngModel",i.data.name),f(3),fn("ngModel",i.data.collapseSplitShell),R("disabled",!i.isSplitShellEnabled()),f(6),R("iconFile","assets/svg/icons.svg")("currentIcon",i.data.icon),f(2),R("mat-dialog-close",!1),f(),K(i.data.cancelBtnText),f(),N(i.data.confirmBtnText?26:-1))},dependencies:[Ht,ki,Ti,Ln,Di,et,Xe,qt,bt,vt,Bn,$t,At,ot,wt,Pt,It,Ya,gt,rt,Mt,kt,Fn,Qr,xf,li,Yt],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.field-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;align-content:center}.field-margin[_ngcontent-%COMP%]{margin-left:15px;margin-bottom:15px}.field-flex[_ngcontent-%COMP%]{flex:auto}.icon-selector[_ngcontent-%COMP%]{border:1px solid var(--mat-sys-outline);border-radius:4px}.icon-section[_ngcontent-%COMP%] .mat-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:var(--mat-sys-on-surface);font-size:14px;font-weight:400}"]})}return n})();function Ld(n){return n.expansionMode==="bms-battery-tree"||n.expansionMode==="solar-tree"}function OB(n){return n.enabled}var f_=["historyCanvas"];function v_(n,o){n&1&&(d(0,"p",12),c(1,"Loading historical data\u2026"),u())}function b_(n,o){if(n&1&&(d(0,"p",13),c(1),u()),n&2){let e=k();f(),fe("503: ",e.error())}}function A_(n,o){n&1&&(d(0,"p",12),c(1,"No historical data is available for this widget. If you are not using the built-in KIP History API provider, validate your plugin configuration supports the widget's path and try again."),u())}function y_(n,o){n&1&&(d(0,"div",14),W(1,"canvas",null,0),u())}Ct.register(qn,jn,Zn,Yn,un,Pu,Eu);var Sf=(()=>{class n{historyApiClient=y(ss);historyMapper=y(ls);app=y(Ii);destroyRef=y(ze);units=y(it);data=y(ri);chartCanvas=he("historyCanvas");theme=Mi(this.app.cssThemeColorRoles$,{requireSync:!0});loading=w(!0);error=w(null);datasetCount=w(0);selectedPeriod=Br("PT1H");hasNoData=X(()=>!this.loading()&&!this.error()&&this.datasetCount()===0);chart=null;viewReady=!1;pendingDatasets=[];constructor(){L(()=>{let e=this.chartCanvas(),t=this.loading(),i=this.datasetCount();!e||t||i<=0||G(()=>{this.tryRenderChart()})})}loadHistoryDatasets(){return Re(this,null,function*(){this.loading.set(!0),this.error.set(null);try{let e=yield this.resolveQueryableSeriesDefinitions(),t=yield Promise.all(e.map((i,a)=>this.buildDatasetForSeries(i,a)));this.pendingDatasets=t.filter(i=>!!i),this.datasetCount.set(this.pendingDatasets.length),this.tryRenderChart()}catch(e){console.error("[WidgetHistoryChartDialogComponent] Failed to load widget history datasets:",e),this.error.set("Unable to load historical data for this widget."),this.pendingDatasets=[],this.datasetCount.set(0)}finally{this.loading.set(!1),queueMicrotask(()=>{this.tryRenderChart()})}})}ngOnInit(){this.loadHistoryDatasets(),this.destroyRef.onDestroy(()=>{this.chart?.destroy(),this.chart=null})}ngAfterViewInit(){this.onCanvasReady()}ngOnDestroy(){this.chart?.destroy(),this.chart=null}onCanvasReady(){this.viewReady=!0,this.tryRenderChart()}buildDatasetForSeries(e,t){return Re(this,null,function*(){let i=e.path;if(!i)return null;let a=this.resolveDuration(e),r=this.resolveResolutionSeconds(a),s=this.buildHistoryRequestCandidates(i,e.context),l=this.describeDualAxisSeries(i),m=[],g=this.normalizeHistoryPath(i),v=this.resolveConvertUnitTo(i);for(let _ of s){let M=yield this.historyApiClient.getValues({paths:_.paths,context:_.context,duration:a,resolution:r});if(!M?.data?.length)continue;if(m=this.historyMapper.mapValuesToChartDatapoints(M,{unit:"number",domain:"scalar"}).map(D=>{let V=D.data.value;return typeof V=="number"&&Number.isFinite(V)&&(l?.metric==="soc"?V*=100:l?.metric==="panelPower"?V/=1e3:!l&&v&&(V=this.units.convertToUnit(v,V))),{x:D.timestamp,y:V}}),m.length){g=_.labelPath;break}}if(!m.length)return null;let A=this.resolveSeriesColor(t,l),C=e.source?` (${e.source})`:"";return{label:`${g}${C}`,data:m,borderColor:A,backgroundColor:A,pointRadius:0,borderWidth:2,tension:.25,yAxisID:l?.axisId??"y",borderDash:this.isDualAxisDashedSeries(l)?[6,4]:void 0,fill:!1}})}describeDualAxisSeries(e){let t=this.normalizeHistoryPath(e??""),i=/^electrical\.batteries\.([^.]+)\.(?:capacity\.)?stateOfCharge$/i.exec(t);if(i)return{widgetType:"widget-bms",entityId:i[1],metric:"soc",axisId:"ySoc"};let a=/^electrical\.batteries\.([^.]+)\.current$/i.exec(t);if(a)return{widgetType:"widget-bms",entityId:a[1],metric:"current",axisId:"yCurrent"};let r=/^electrical\.solar\.([^.]+)\.current$/i.exec(t);if(r)return{widgetType:"widget-solar-charger",entityId:r[1],metric:"current",axisId:"yCurrent"};let s=/^electrical\.solar\.([^.]+)\.panelPower$/i.exec(t);return s?{widgetType:"widget-solar-charger",entityId:s[1],metric:"panelPower",axisId:"yPower"}:null}resolveSeriesColor(e,t){let i=this.getSeriesPalette();return t?this.getDualAxisMetricColor(t.widgetType,t.metric):i[e%i.length]}getSeriesPalette(){let e=this.data.widget?.config?.color||"blue",t=this.resolveThemeColor(e),i=[this.theme().green,this.theme().orange,this.theme().pink,this.theme().purple,this.theme().yellow,this.theme().grey,this.theme().blue,this.theme().contrast],a=i.findIndex(r=>r?.toLowerCase()===t.toLowerCase());return a!==-1?i=[i[a],...i.slice(0,a),...i.slice(a+1)]:i=[t,...i],i}resolveThemeColor(e){let t=this.theme()[e];return typeof t=="string"&&t.length>0?t:e}dualAxisMetricOrder={"widget-bms":["soc","current"],"widget-solar-charger":["panelPower","current"]};isDualAxisDashedSeries(e){return e?this.getDualAxisEntityOrderIndex(e.entityId,e.widgetType)%2===1:!1}getDualAxisEntityOrderIndex(e,t){let i=[];this.data.seriesDefinitions.forEach(r=>{let s=this.describeDualAxisSeries(r.path);!s||s.widgetType!==t||i.includes(s.entityId)||i.push(s.entityId)});let a=i.indexOf(e);return a>=0?a:0}getDualAxisMetricColor(e,t){let i=this.getSeriesPalette(),a=this.dualAxisMetricOrder[e].indexOf(t),r=a>=0?a:0;return i[r%i.length]}buildHistoryRequestCandidates(e,t){let i=this.normalizeHistoryPath(e),a=this.resolveHistoryContext(e,t),r=[i].filter(l=>l.length>0),s=[];return r.forEach(l=>{s.push({paths:`${l}:avg`,context:a,labelPath:this.normalizeHistoryPath(l)})}),s}resolveQueryableSeriesDefinitions(){return Re(this,null,function*(){let e=[];for(let t of this.data.seriesDefinitions){let i=yield this.expandTemplateSeries(t);e.push(...i)}return this.sortExpandedSeries(e)})}sortExpandedSeries(e){return e.some(i=>this.describeDualAxisSeries(i.path)!==null)?[...e].sort((i,a)=>{let r=this.describeDualAxisSeries(i.path),s=this.describeDualAxisSeries(a.path);if(!r&&!s)return 0;if(!r)return 1;if(!s)return-1;if(r.entityId!==s.entityId)return r.entityId.localeCompare(s.entityId);let l=this.dualAxisMetricOrder[r.widgetType]?.indexOf(r.metric)??0,m=this.dualAxisMetricOrder[s.widgetType]?.indexOf(s.metric)??0;return l-m}):e}expandTemplateSeries(e){return Re(this,null,function*(){let t=this.normalizeHistoryPath(e.path??""),i=t.endsWith(".*");if(!Ld(e)&&!i)return[e];let a=t.replace(/\.\*$/,"");if(!a.length)return[e];let r=this.resolveDuration(e),s=yield this.historyApiClient.getPaths({duration:r});if(!s?.length)return[e];let l=this.findConcreteTemplatePaths(e,a,s);return l.length===0?[e]:l.map((m,g)=>ge(ne({},e),{seriesId:`${e.seriesId}:resolved:${g}`,datasetUuid:`${e.datasetUuid}:resolved:${g}`,path:m,expansionMode:null,allowedBatteryIds:null,allowedSolarIds:null}))})}findConcreteTemplatePaths(e,t,i){let a=Array.from(new Set(i.map(s=>this.normalizeHistoryPath(s)).filter(s=>s.startsWith(`${t}.`))));return a.length===0?[]:Ld(e)?a.filter(s=>this.matchesTemplateMetric(s,t,e)).filter(s=>this.matchesTemplateAllowedIds(s,t,e)):a}matchesTemplateMetric(e,t,i){let a=e.slice(t.length+1);return i.expansionMode==="solar-tree"?a.endsWith(".current")||a.endsWith(".panelPower"):a.endsWith(".current")||a.endsWith(".capacity.stateOfCharge")||a.endsWith(".stateOfCharge")}matchesTemplateAllowedIds(e,t,i){if(i.expansionMode==="solar-tree"){let s=Array.isArray(i.allowedSolarIds)?i.allowedSolarIds.map(m=>String(m).trim()).filter(m=>m.length>0):[];if(s.length===0)return!0;let l=this.extractEntityId(e,t);return!!l&&s.includes(l)}let a=Array.isArray(i.allowedBatteryIds)?i.allowedBatteryIds.map(s=>String(s).trim()).filter(s=>s.length>0):[];if(a.length===0)return!0;let r=this.extractEntityId(e,t);return!!r&&a.includes(r)}extractEntityId(e,t){let i=e.slice(t.length+1);if(!i.length)return null;let a=i.split(".");if(a.length<2)return null;let[r]=a;return r==="current"||r==="panelCurrent"||r==="panelPower"||r==="capacity"||r==="stateOfCharge"?null:r}normalizeHistoryPath(e){let t=e.trim();return t.length?t.replace(/^(vessels\.)?self\./,""):""}resolveHistoryContext(e,t){let i=this.normalizeContext(t);if(i)return i;if(/^(vessels\.)?self\./.test(e))return"vessels.self"}tryRenderChart(){if(!this.viewReady)return;if(!this.pendingDatasets.length){this.chart?.destroy(),this.chart=null;return}let e=this.chartCanvas();if(!e)return;this.chart?.destroy();let t=this.getPrimaryAxisUnitLabel(),i={type:"line",data:{datasets:this.pendingDatasets},options:{responsive:!0,maintainAspectRatio:!1,parsing:!1,interaction:{mode:"nearest",intersect:!1,axis:"x"},scales:ne({x:{type:"time",time:{tooltipFormat:"PPpp",displayFormats:{second:"HH:mm:ss",minute:"HH:mm",hour:"HH:mm",day:"MMM d",week:"MMM d",month:"MMM yyyy"},unit:"minute",minUnit:"second"},ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer}}},this.buildYScales(t)),plugins:{legend:{labels:{color:this.theme().contrastDim,generateLabels:a=>this.buildLegendLabels(a)}},tooltip:{boxWidth:15,boxHeight:15,bodyFont:{size:14},multiKeyBackground:"rgba(0, 0, 0, 0)",callbacks:{labelColor:a=>{let r=this.getLegendItemForDataset(a.chart,a.datasetIndex),s=Array.isArray(r?.lineDash)&&r.lineDash.length>=2?[r.lineDash[0],r.lineDash[1]]:void 0;return{borderColor:r?.strokeStyle??this.theme().contrast,backgroundColor:"rgba(0, 0, 0, 0)",borderWidth:2,borderRadius:0,borderDash:s}}}}}}};this.chart=new Ct(e.nativeElement.getContext("2d"),i)}getPrimaryAxisUnitLabel(){let e=this.resolveConvertUnitTo();return this.getUnitsLabel(e)}resolveConvertUnitTo(e){let t=this.data.widget?.config;if(!t)return null;if(t.paths&&typeof t.paths=="object"){if(e)for(let a of Object.keys(t.paths)){let r=t.paths[a];if(r?.path===e&&r.convertUnitTo)return r.convertUnitTo}let i=Object.keys(t.paths)[0];if(i&&t.paths[i]?.convertUnitTo)return t.paths[i].convertUnitTo}return t.convertUnitTo??null}buildYScales(e){let t=this.resolveDualAxisWidgetType();if(t==="widget-bms"){let i=this.getDualAxisMetricColor("widget-bms","soc"),a=this.getDualAxisMetricColor("widget-bms","current");return{ySoc:{type:"linear",position:"left",min:0,max:100,ticks:{color:this.theme().contrastDim,callback:r=>`${r}%`},grid:{color:this.theme().contrastDimmer},title:{display:!0,text:"SoC (%)",color:i}},yCurrent:{type:"linear",position:"right",ticks:{color:this.theme().contrastDim,callback:r=>`${r} A`},grid:{drawOnChartArea:!1,color:this.theme().contrastDimmer},title:{display:!0,text:"Current (A)",color:a}}}}if(t==="widget-solar-charger"){let i=this.getDualAxisMetricColor("widget-solar-charger","panelPower"),a=this.getDualAxisMetricColor("widget-solar-charger","current");return{yPower:{type:"linear",position:"left",ticks:{color:this.theme().contrastDim,callback:r=>`${r} kW`},grid:{color:this.theme().contrastDimmer},title:{display:!0,text:"Power (kW)",color:i}},yCurrent:{type:"linear",position:"right",ticks:{color:this.theme().contrastDim,callback:r=>`${r} A`},grid:{drawOnChartArea:!1,color:this.theme().contrastDimmer},title:{display:!0,text:"Current (A)",color:a}}}}return{y:{ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer},title:{display:!!e,text:e?`${e}`:"",color:this.theme().contrastDim}}}}buildLegendLabels(e){return Ct.defaults.plugins.legend.labels.generateLabels(e).map(t=>{let i=t.datasetIndex!=null?e.data.datasets[t.datasetIndex]:null,a=Array.isArray(i?.borderDash)?i.borderDash:[];return ge(ne({},t),{fillStyle:"transparent",lineDash:a})})}getLegendItemForDataset(e,t){return this.buildLegendLabels(e).find(i=>i.datasetIndex===t)??null}resolveDualAxisWidgetType(){let e=this.data.widget?.type;return e==="widget-bms"&&this.pendingDatasets.some(t=>t.yAxisID==="ySoc"||t.yAxisID==="yCurrent")?"widget-bms":e==="widget-solar-charger"&&this.pendingDatasets.some(t=>t.yAxisID==="yPower"||t.yAxisID==="yCurrent")?"widget-solar-charger":null}setPeriod(e){this.selectedPeriod.set(e),this.loadHistoryDatasets()}resolveDuration(e){return e.timeScale&&e.period&&Number.isFinite(e.period)?this.durationFromScaleAndPeriod(e.timeScale,e.period):this.selectedPeriod()}durationFromScaleAndPeriod(e,t){let i=Math.max(1,Math.round(t)),a=e.trim().toLowerCase(),r=a.match(/^last\s+(\d+)\s+([a-z]+)/i);if(r){let s=Number(r[1]),l=r[2];if(Number.isFinite(s)&&s>0)return this.durationFromToken(l,s)}return this.durationFromToken(a,i)}durationFromToken(e,t){let i=e.toLowerCase();return i.startsWith("second")?`PT${t}S`:i.startsWith("minute")?`PT${t}M`:i.startsWith("hour")?`PT${t}H`:i.startsWith("day")?`P${t}D`:i.startsWith("week")?`P${t*7}D`:i.startsWith("month")?`P${t}M`:"PT24H"}resolveResolutionSeconds(e){let t=this.parseDurationToSeconds(e);return!Number.isFinite(t)||t<=0?1:Math.max(1,Math.round(t/120))}parseDurationToSeconds(e){let i=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(e.trim());if(!i)return NaN;let a=Number(i[1]??0),r=Number(i[2]??0),s=Number(i[3]??0),l=Number(i[4]??0);return a*86400+r*3600+s*60+l}normalizeContext(e){let t=typeof e=="string"?e.trim():"";return t.length?t:void 0}getUnitsLabel(e){if(!e)return"";switch(e){case"percent":case"percentraw":return"%";case"latitudeMin":return"latitude in minutes";case"latitudeSec":return"latitude in secondes";case"longitudeMin":return"longitude in minutes";case"longitudeSec":return"longitude in secondes";default:return e}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["widget-history-chart-dialog"]],viewQuery:function(t,i){t&1&&Me(i.chartCanvas,f_,5),t&2&&ke()},inputs:{selectedPeriod:[1,"selectedPeriod"]},outputs:{selectedPeriod:"selectedPeriodChange"},decls:22,vars:4,consts:[["historyCanvas",""],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"history-dialog-content"],[1,"time-select"],["hideSingleSelectionIndicator","true","aria-label","Chart Time Span Selection",3,"ngModelChange","ngModel"],["value","PT15M",3,"click"],["value","PT1H",3,"click"],["value","PT8H",3,"click"],["value","PT24H",3,"click"],[1,"chart-area"],[1,"history-message"],[1,"history-message","error"],[1,"chart-wrapper"]],template:function(t,i){t&1&&(d(0,"div",1)(1,"h5",2),c(2),u(),d(3,"button",3)(4,"mat-icon"),c(5,"close"),u()()(),d(6,"mat-dialog-content",4)(7,"div",5)(8,"mat-button-toggle-group",6),bn("ngModelChange",function(r){return vn(i.selectedPeriod,r)||(i.selectedPeriod=r),r}),d(9,"mat-button-toggle",7),U("click",function(){return i.setPeriod("PT15M")}),c(10,"15 Minutes"),u(),d(11,"mat-button-toggle",8),U("click",function(){return i.setPeriod("PT1H")}),c(12,"1 Hour"),u(),d(13,"mat-button-toggle",9),U("click",function(){return i.setPeriod("PT8H")}),c(14,"8 Hours"),u(),d(15,"mat-button-toggle",10),U("click",function(){return i.setPeriod("PT24H")}),c(16,"24 Hours"),u()()(),d(17,"div",11),I(18,v_,2,0,"p",12)(19,b_,2,1,"p",13)(20,A_,2,0,"p",12)(21,y_,3,0,"div",14),u()()),t&2&&(f(2),K(i.data.title),f(),R("mat-dialog-close",!1),f(5),fn("ngModel",i.selectedPeriod),f(10),N(i.loading()?18:i.error()?19:i.hasNoData()?20:21))},dependencies:[Ht,ki,Ti,Di,As,Xo,po,ot,Pt,et,Xe,It,rt,Fn],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}mat-dialog-content.history-dialog-content[_ngcontent-%COMP%]{padding:0 24px 20px;display:flex;flex-direction:column;width:100%;height:100%;min-width:70vw;min-height:55vh;justify-content:flex-start;align-items:stretch}.time-select[_ngcontent-%COMP%]{flex-grow:0;text-align:center;width:100%}.chart-area[_ngcontent-%COMP%], .chart-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 0;min-height:0;width:100%}.chart-wrapper[_ngcontent-%COMP%] canvas[_ngcontent-%COMP%]{flex:1 1 0;min-height:0}.history-message[_ngcontent-%COMP%]{margin:0;padding:1rem 0}.error[_ngcontent-%COMP%]{color:var(--mat-sys-error)}"],changeDetection:0})}return n})();var Up=(()=>{class n{dialog=y(ru);openFrameDialog(e,t){switch(e.component){case"select-widget":e.componentType=Af;break;case"upgrade-config":e.componentType=yf;break;case"ais-target":e.componentType=el;break}return this.dialog.open(El,{data:e,height:t?"calc(100% - 30px)":"",width:t?"calc(100% - 30px)":"",maxWidth:t?"100%":"",maxHeight:t?"100%":""}).afterClosed()}openAisDetailDialog(e){return this.dialog.open(El,{panelClass:"ais-dialog-panel",data:e,height:"",width:"",maxWidth:"",maxHeight:""}).afterClosed()}openConfirmationDialog(e){return this.dialog.open(Hu,{data:e,minWidth:"35vw",minHeight:"25vh"}).afterClosed()}openNameDialog(e){return this.dialog.open(qu,{data:e,minWidth:"20vw",minHeight:"20vh",disableClose:!1})}openDashboardPageEditorDialog(e){return this.dialog.open(Cf,{data:e,minWidth:"60vw",maxWidth:"90vw",maxHeight:"95vh",disableClose:!1})}openWidgetOptions(e){return this.dialog.open(xm,{data:e.config,minWidth:"50vw",maxWidth:"90vw",closeOnNavigation:!0})}openWidgetHistoryDialog(e){return this.dialog.open(Sf,{data:e,minWidth:"70vw",maxWidth:"95vw",maxHeight:"95vh",disableClose:!1})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function x_(n,o){}var wf="_mat-bottom-sheet-enter",_f="_mat-bottom-sheet-exit",C_=(()=>{class n extends nu{_breakpointSubscription;_animationsDisabled=tn();_animationState="void";_animationStateChanged=new oi;_destroyed=!1;constructor(){super();let e=y(qa);this._breakpointSubscription=e.observe([Gi.Medium,Gi.Large,Gi.XLarge]).subscribe(()=>{let t=this._elementRef.nativeElement.classList;t.toggle("mat-bottom-sheet-container-medium",e.isMatched(Gi.Medium)),t.toggle("mat-bottom-sheet-container-large",e.isMatched(Gi.Large)),t.toggle("mat-bottom-sheet-container-xlarge",e.isMatched(Gi.XLarge))})}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._animationsDisabled&&this._simulateAnimation(wf))}exit(){this._destroyed||(this._elementRef.nativeElement.setAttribute("mat-exit",""),this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._animationsDisabled&&this._simulateAnimation(_f))}ngOnDestroy(){super.ngOnDestroy(),this._breakpointSubscription.unsubscribe(),this._destroyed=!0}_simulateAnimation(e){this._ngZone.run(()=>{this._handleAnimationEvent(!0,e),setTimeout(()=>this._handleAnimationEvent(!1,e))})}_trapFocus(){super._trapFocus({preventScroll:!0})}_handleAnimationEvent(e,t){let i=t===wf;(i||t===_f)&&this._animationStateChanged.emit({toState:i?"visible":"hidden",phase:e?"start":"done"})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=H({type:n,selectors:[["mat-bottom-sheet-container"]],hostAttrs:["tabindex","-1",1,"mat-bottom-sheet-container"],hostVars:9,hostBindings:function(t,i){t&1&&U("animationstart",function(r){return i._handleAnimationEvent(!0,r.animationName)})("animationend",function(r){return i._handleAnimationEvent(!1,r.animationName)})("animationcancel",function(r){return i._handleAnimationEvent(!1,r.animationName)}),t&2&&(J("role",i._config.role)("aria-modal",i._config.ariaModal)("aria-label",i._config.ariaLabel),dt("mat-bottom-sheet-container-animations-enabled",!i._animationsDisabled)("mat-bottom-sheet-container-enter",i._animationState==="visible")("mat-bottom-sheet-container-exit",i._animationState==="hidden"))},features:[Wo],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(t,i){t&1&&yi(0,x_,0,0,"ng-template",0)},dependencies:[Fc],styles:[`@keyframes _mat-bottom-sheet-enter{from{transform:translateY(100%)}to{transform:none}}@keyframes _mat-bottom-sheet-exit{from{transform:none}to{transform:translateY(100%)}}.mat-bottom-sheet-container{box-shadow:0px 8px 10px -5px rgba(0, 0, 0, 0.2), 0px 16px 24px 2px rgba(0, 0, 0, 0.14), 0px 6px 30px 5px rgba(0, 0, 0, 0.12);padding:8px 16px;min-width:100vw;box-sizing:border-box;display:block;outline:0;max-height:80vh;overflow:auto;position:relative;background:var(--mat-bottom-sheet-container-background-color, var(--mat-sys-surface-container-low));color:var(--mat-bottom-sheet-container-text-color, var(--mat-sys-on-surface));font-family:var(--mat-bottom-sheet-container-text-font, var(--mat-sys-body-large-font));font-size:var(--mat-bottom-sheet-container-text-size, var(--mat-sys-body-large-size));line-height:var(--mat-bottom-sheet-container-text-line-height, var(--mat-sys-body-large-line-height));font-weight:var(--mat-bottom-sheet-container-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-bottom-sheet-container-text-tracking, var(--mat-sys-body-large-tracking))}@media(forced-colors: active){.mat-bottom-sheet-container{outline:1px solid}}.mat-bottom-sheet-container-animations-enabled{transform:translateY(100%)}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-enter{animation:_mat-bottom-sheet-enter 195ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-bottom-sheet-container-animations-enabled.mat-bottom-sheet-container-exit{animation:_mat-bottom-sheet-exit 375ms cubic-bezier(0.4, 0, 1, 1) backwards}.mat-bottom-sheet-container-xlarge,.mat-bottom-sheet-container-large,.mat-bottom-sheet-container-medium{border-top-left-radius:var(--mat-bottom-sheet-container-shape, 28px);border-top-right-radius:var(--mat-bottom-sheet-container-shape, 28px)}.mat-bottom-sheet-container-medium{min-width:384px;max-width:calc(100vw - 128px)}.mat-bottom-sheet-container-large{min-width:512px;max-width:calc(100vw - 256px)}.mat-bottom-sheet-container-xlarge{min-width:576px;max-width:calc(100vw - 384px)}
50
- `],encapsulation:2})}return n})(),S_=new gn("MatBottomSheetData"),Wd=class{viewContainerRef;injector;panelClass;direction;data=null;hasBackdrop=!0;backdropClass;disableClose=!1;ariaLabel=null;ariaModal=!1;closeOnNavigation=!0;autoFocus="first-tabbable";restoreFocus=!0;scrollStrategy;height="";minHeight;maxHeight},hl=class{_ref;get instance(){return this._ref.componentInstance}get componentRef(){return this._ref.componentRef}containerInstance;disableClose;_afterOpened=new zt;_result;_closeFallbackTimeout;constructor(o,e,t){this._ref=o,this.containerInstance=t,this.disableClose=e.disableClose,t._animationStateChanged.pipe(Ai(i=>i.phase==="done"&&i.toState==="visible"),ai(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),t._animationStateChanged.pipe(Ai(i=>i.phase==="done"&&i.toState==="hidden"),ai(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._ref.close(this._result)}),o.overlayRef.detachments().subscribe(()=>{this._ref.close(this._result)}),bi(this.backdropClick(),this.keydownEvents().pipe(Ai(i=>i.keyCode===27))).subscribe(i=>{!this.disableClose&&(i.type!=="keydown"||!Rn(i))&&(i.preventDefault(),this.dismiss())})}dismiss(o){this.containerInstance&&(this.containerInstance._animationStateChanged.pipe(Ai(e=>e.phase==="start"),ai(1)).subscribe(()=>{this._closeFallbackTimeout=setTimeout(()=>this._ref.close(this._result),500),this._ref.overlayRef.detachBackdrop()}),this._result=o,this.containerInstance.exit(),this.containerInstance=null)}afterDismissed(){return this._ref.closed}afterOpened(){return this._afterOpened}backdropClick(){return this._ref.backdropClick}keydownEvents(){return this._ref.keydownEvents}},w_=new gn("mat-bottom-sheet-default-options"),__=(()=>{class n{_injector=y(Lo);_parentBottomSheet=y(n,{optional:!0,skipSelf:!0});_animationsDisabled=tn();_defaultOptions=y(w_,{optional:!0});_bottomSheetRefAtThisLevel=null;_dialog=y(au);get _openedBottomSheetRef(){let e=this._parentBottomSheet;return e?e._openedBottomSheetRef:this._bottomSheetRefAtThisLevel}set _openedBottomSheetRef(e){this._parentBottomSheet?this._parentBottomSheet._openedBottomSheetRef=e:this._bottomSheetRefAtThisLevel=e}constructor(){}open(e,t){let i=ne(ne({},this._defaultOptions||new Wd),t),a;return this._dialog.open(e,ge(ne({},i),{disableClose:!0,closeOnOverlayDetachments:!1,maxWidth:"100%",container:C_,scrollStrategy:i.scrollStrategy||Uc(this._injector),positionStrategy:jc(this._injector).centerHorizontally().bottom("0"),disableAnimations:this._animationsDisabled,templateContext:()=>({bottomSheetRef:a}),providers:(r,s,l)=>(a=new hl(r,i,l),[{provide:hl,useValue:a},{provide:S_,useValue:i.data}])})),a.afterDismissed().subscribe(()=>{this._openedBottomSheetRef===a&&(this._openedBottomSheetRef=null)}),this._openedBottomSheetRef?(this._openedBottomSheetRef.afterDismissed().subscribe(()=>a.containerInstance?.enter()),this._openedBottomSheetRef.dismiss()):a.containerInstance.enter(),this._openedBottomSheetRef=a,a}dismiss(e){this._openedBottomSheetRef&&this._openedBottomSheetRef.dismiss(e)}ngOnDestroy(){this._bottomSheetRefAtThisLevel&&this._bottomSheetRefAtThisLevel.dismiss()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),Ez=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ki({type:n});static \u0275inj=Xi({providers:[__],imports:[ou,Gc,Vn]})}return n})();var Mf=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],En=(()=>{if(typeof document>"u")return!1;let n=Mf[0],o={};for(let e of Mf)if(e?.[1]in document){for(let[i,a]of e.entries())o[n[i]]=a;return o}return!1})(),kf={change:En.fullscreenchange,error:En.fullscreenerror},fi={request(n=document.documentElement,o){return new Promise((e,t)=>{let i=()=>{fi.off("change",i),e()};fi.on("change",i);let a=n[En.requestFullscreen](o);a instanceof Promise&&a.then(i).catch(t)})},exit(){return new Promise((n,o)=>{if(!fi.isFullscreen){n();return}let e=()=>{fi.off("change",e),n()};fi.on("change",e);let t=document[En.exitFullscreen]();t instanceof Promise&&t.then(e).catch(o)})},toggle(n,o){return fi.isFullscreen?fi.exit():fi.request(n,o)},onchange(n){fi.on("change",n)},onerror(n){fi.on("error",n)},on(n,o){let e=kf[n];e&&document.addEventListener(e,o,!1)},off(n,o){let e=kf[n];e&&document.removeEventListener(e,o,!1)},raw:En};Object.defineProperties(fi,{isFullscreen:{get:()=>!!document[En.fullscreenElement]},element:{enumerable:!0,get:()=>document[En.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>!!document[En.fullscreenEnabled]}});En||(fi={isEnabled:!1});var ji=fi;var M_="data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",k_="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",Fd=class{constructor(){this.enabled=!1}enable(){throw new Error("NoSleep using SSR/no-op mode; do not call enable.")}disable(){throw new Error("NoSleep using SSR/no-op mode; do not call disable.")}},Gd=class{constructor(){this.enabled=!1;let o=()=>this.wakeLock&&document.visibilityState==="visible"&&this.enable();document.addEventListener("visibilitychange",o),document.addEventListener("fullscreenchange",o)}enable(){return Re(this,null,function*(){try{this.wakeLock=yield navigator.wakeLock.request("screen"),this.enabled=!0,console.debug("Wake Lock active."),this.wakeLock.addEventListener("release",()=>{console.debug("Wake Lock released.")})}catch(o){this.enabled=!1,o instanceof Error&&console.error(`${o.name}, ${o.message}`)}})}disable(){this.wakeLock?.release(),this.wakeLock=void 0,this.enabled=!1}},Bd=class{constructor(){this.enabled=!1,this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",M_),this._addSourceToVideo(this.noSleepVideo,"mp4",k_),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body")?.append(this.noSleepVideo),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{this.noSleepVideo.currentTime>.5&&(this.noSleepVideo.currentTime=Math.random())})})}_addSourceToVideo(o,e,t){let i=document.createElement("source");i.src=t,i.type=`video/${e}`,o.appendChild(i)}enable(){return Re(this,null,function*(){let o=this.noSleepVideo.play();try{let e=yield o;return this.enabled=!0,e}catch(e){this.enabled=!1,e instanceof Error&&console.error(`${e.name}, ${e.message}`)}})}disable(){this.noSleepVideo.pause(),this.enabled=!1}};function T_(){if(!/iPod|iPhone|iPad/.test(navigator.userAgent))return null;let n=navigator.userAgent.match(/OS (\d+)_(\d+)/);return n&&[Number(n[1]),Number(n[2])]}function D_(n,o){return n[0]>o[0]||n[0]===o[0]&&n[1]>=o[1]}function E_(){if(!("wakeLock"in navigator))return!1;let n=T_();return n?!navigator.standalone||D_(n,[18,4]):!0}var Tf=typeof navigator>"u"?Fd:E_()?Gd:Bd;var Gz=(()=>{class n{isDragging=w(!1);fullscreenStatus=w(!1);fullscreenSupported=w(!0);noSleepStatus=w(!1);noSleepSupported=w(!0);noSleep=null;initialTouchX=null;initialTouchY=null;hotkeyListeners=new Map;boundPreventGestures=null;fullscreenChangeHandler=()=>{if(this.fullscreenStatus.set(ji.isFullscreen),!ji.isFullscreen&&this.noSleep&&this.noSleepStatus()){try{this.noSleep.disable()}catch(e){}this.noSleepStatus.set(!1)}};constructor(){window.__KIP_TEST__?(this.fullscreenSupported.set(!1),this.noSleepSupported.set(!1)):(ji.isEnabled?ji.on("change",this.fullscreenChangeHandler):(this.fullscreenSupported.set(!1),console.log("[UI Event Service] Fullscreen mode is not supported by device/browser.")),this.checkNoSleepSupport(),this.checkPwaMode()&&this.noSleepSupported()&&!this.noSleepStatus()&&this.toggleNoSleep())}checkNoSleepSupport(){try{if(this.noSleep||(this.noSleep=new Tf),!this.noSleep||typeof this.noSleep.enable!="function"||typeof this.noSleep.disable!="function")throw new Error("[UI Event Service] NoSleep methods not available")}catch(e){this.noSleepSupported.set(!1),console.warn(`[UI Event Service] NoSleep is not supported by this device/browser. Error: ${e}`),this.noSleep=null}}checkPwaMode(){let e=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone!==void 0;return console.log("[UI Event Service] PWA mode:",e),e}toggleNoSleep(){if(this.noSleepSupported()){if(this.noSleepStatus())try{this.noSleep?.disable()}catch(e){}else{this.noSleep||this.checkNoSleepSupport();try{this.noSleep?.enable()}catch(e){console.warn("[UI Event Service] Failed to enable NoSleep:",e)}}this.noSleepStatus.set(!this.noSleepStatus()),console.log("[UI Event Service] NoSleep active:",this.noSleepStatus())}}toggleFullScreen(){if(ji.isEnabled){if(this.fullscreenStatus()){if(ji.isFullscreen&&ji.exit(),this.noSleepStatus()){try{this.noSleep?.disable()}catch(e){}this.noSleepStatus.set(!1)}}else if(ji.request(),!this.noSleepStatus()){this.noSleep||this.checkNoSleepSupport();try{this.noSleep?.enable(),this.noSleepStatus.set(!0)}catch(e){}}this.fullscreenStatus.set(!this.fullscreenStatus())}else this.fullscreenSupported.set(!1),console.log("[UI Event Service] Fullscreen mode is not supported by this browser.")}addGestureListeners(e,t){this.boundPreventGestures||(this.boundPreventGestures=this.preventBrowserHistorySwipeGestures.bind(this)),document.addEventListener("openLeftSidenav",e),document.addEventListener("openRightSidenav",t),document.addEventListener("touchstart",this.boundPreventGestures,{passive:!1}),document.addEventListener("touchmove",this.boundPreventGestures,{passive:!1}),document.addEventListener("touchend",this.boundPreventGestures),document.addEventListener("touchcancel",this.boundPreventGestures)}removeGestureListeners(e,t){document.removeEventListener("openLeftSidenav",e),document.removeEventListener("openRightSidenav",t),this.boundPreventGestures&&(document.removeEventListener("touchstart",this.boundPreventGestures),document.removeEventListener("touchmove",this.boundPreventGestures),document.removeEventListener("touchend",this.boundPreventGestures),document.removeEventListener("touchcancel",this.boundPreventGestures))}preventBrowserHistorySwipeGestures(e){if(e instanceof TouchEvent&&e.touches.length===1){let t=e.touches[0],i=30;if(e.type==="touchstart")this.initialTouchX=t.clientX,this.initialTouchY=t.clientY;else if(e.type==="touchmove"&&this.initialTouchX!==null&&this.initialTouchY!==null){let a=Math.abs(t.clientX-this.initialTouchX),r=Math.abs(t.clientY-this.initialTouchY);a>10&&a>r&&(this.initialTouchX<i||this.initialTouchX>window.innerWidth-i)&&e.preventDefault(),r>10&&this.initialTouchY<50&&e.preventDefault()}else(e.type==="touchend"||e.type==="touchcancel")&&(this.initialTouchX=null,this.initialTouchY=null)}}addHotkeyListener(e,t){let i=a=>{if(a instanceof KeyboardEvent){let r=a.key.toLowerCase();if(t&&(t.keys&&!t.keys.includes(r)||t.ctrlKey!==void 0&&a.ctrlKey!==t.ctrlKey||t.shiftKey!==void 0&&a.shiftKey!==t.shiftKey))return;e(r,a)}else console.warn("[uiEvent Service] Non-keyboard event detected in addHotkeyListener:",a)};this.hotkeyListeners.set(e,i),document.addEventListener("keydown",i)}removeHotkeyListener(e){let t=this.hotkeyListeners.get(e);t&&(document.removeEventListener("keydown",t),this.hotkeyListeners.delete(e))}ngOnDestroy(){if(ji.isEnabled)try{ji.off("change",this.fullscreenChangeHandler)}catch(e){}if(this.noSleep&&this.noSleepStatus())try{this.noSleep.disable()}catch(e){}this.noSleep=null,this.boundPreventGestures&&(document.removeEventListener("touchstart",this.boundPreventGestures),document.removeEventListener("touchmove",this.boundPreventGestures),document.removeEventListener("touchend",this.boundPreventGestures),document.removeEventListener("touchcancel",this.boundPreventGestures),this.boundPreventGestures=null);for(let[,e]of this.hotkeyListeners.entries())document.removeEventListener("keydown",e);this.hotkeyListeners.clear()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=lt({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();export{ds as a,yt as b,mn as c,Se as d,We as e,lo as f,Qn as g,mi as h,Fu as i,Bu as j,zu as k,rF as l,mf as m,ml as n,Uu as o,Ld as p,OB as q,Up as r,S_ as s,hl as t,__ as u,Ez as v,Gz as w};