@mxtommy/kip 4.5.1 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +13 -13
  3. package/plugin/duckdb-parquet-storage.service.js +179 -60
  4. package/plugin/index.js +82 -74
  5. package/public/{chunk-D7VDX7ZF.js → chunk-67V4XHCY.js} +1 -1
  6. package/public/chunk-BTFZS2TW.js +16 -0
  7. package/public/{chunk-JGGMFMY5.js → chunk-CD5TQSCS.js} +1 -1
  8. package/public/chunk-FZFDGAQO.js +1 -0
  9. package/public/{chunk-IYRLINL7.js → chunk-I4SJ5UNN.js} +1 -1
  10. package/public/{chunk-VCY32MWT.js → chunk-IH4CEW4C.js} +7 -7
  11. package/public/chunk-ISF5E3CX.js +50 -0
  12. package/public/{chunk-EQ2N7KDA.js → chunk-KQEEYPK3.js} +2 -2
  13. package/public/chunk-NFJ4RQSE.js +4 -0
  14. package/public/{chunk-DEM56G4S.js → chunk-OPTBDYBL.js} +1 -1
  15. package/public/{chunk-YCEXTKGG.js → chunk-P4CRTB7N.js} +1 -1
  16. package/public/{chunk-IHURI4IH.js → chunk-P7JKENHI.js} +3 -3
  17. package/public/chunk-Q2ANAJAD.js +1 -0
  18. package/public/{chunk-B75MT7ND.js → chunk-R36UY4Q4.js} +1 -1
  19. package/public/{chunk-CHGXAEKT.js → chunk-RCYOZLZB.js} +1 -1
  20. package/public/{chunk-KPHICV76.js → chunk-SJFJEOSG.js} +1 -1
  21. package/public/{chunk-MGPPVLZ7.js → chunk-TBNKOU7M.js} +1 -1
  22. package/public/chunk-TVNXBPFF.js +6 -0
  23. package/public/{chunk-S72JTJPN.js → chunk-VPF5756E.js} +1 -1
  24. package/public/chunk-VXCYPAWR.js +1 -0
  25. package/public/{chunk-RONXIZ2U.js → chunk-VXTTEFRP.js} +3 -3
  26. package/public/{chunk-R7RQHWKJ.js → chunk-WH5CIUSB.js} +1 -1
  27. package/public/{chunk-LQDSU4WS.js → chunk-WQSJFJLW.js} +1 -1
  28. package/public/{chunk-KZ5DUKAX.js → chunk-XBSU7OGT.js} +1 -1
  29. package/public/{chunk-CEB42O2C.js → chunk-YI3MZWRZ.js} +1 -1
  30. package/public/index.html +1 -1
  31. package/public/main-B6TXB3EB.js +1 -0
  32. package/public/chunk-A6DQJFP4.js +0 -16
  33. package/public/chunk-DEGYRCMI.js +0 -1
  34. package/public/chunk-DYTBBUMI.js +0 -4
  35. package/public/chunk-FNF7M3AE.js +0 -1
  36. package/public/chunk-JB4YVVNW.js +0 -1
  37. package/public/chunk-YKJKIWXO.js +0 -6
  38. package/public/chunk-ZV7IYYEQ.js +0 -50
  39. package/public/main-FQESQQV6.js +0 -1
@@ -0,0 +1,50 @@
1
+ import{$ as Pr,A as Er,B as Ra,C as Ni,D as Ys,E as Dr,F as vo,G as Zs,H as bo,I as Ao,J as La,K as Va,L as Qs,M as Xs,N as Wa,O as yo,P as Ks,Q as Yc,R as Zc,S as Qc,T as Rn,U as Ln,V as Fa,W as gt,X as Vn,Y as Wn,Z as Ga,_ as Xc,a as Bt,aa as Ir,b as Xt,ba as Kc,c as wi,ca as Jc,d as Bc,da as Fn,e as Uc,ea as en,f as zc,g as Mr,h as Hc,i as qc,j as jc,k as $c,l as ct,m as aa,n as Ii,o as On,p as oa,q as un,r as Ki,s as Ji,t as Oi,u as Nn,v as ii,w as kr,x as Tr,y as Na,z as ra}from"./chunk-VXTTEFRP.js";import{a as Gc,b as _r,c as Jt}from"./chunk-VPF5756E.js";import{a as eu,b as tu,c as iu,d as nu,e as au}from"./chunk-RCYOZLZB.js";import{a as Si,b as In,c as ot,e as Ba,f as Ua}from"./chunk-NFJ4RQSE.js";import{a as Oc,b as Nc,c as Rc,d as Oa,e as Lc,f as Gt,g as Vc,h as Wc,k as Fc,m as fo,o as ve,p as $s,r as Kt}from"./chunk-SJFJEOSG.js";import{b as yc,e as xc,f as Cr}from"./chunk-FZFDGAQO.js";import{a as Pa,b as Ia}from"./chunk-YI3MZWRZ.js";import{a as Cc,b as Sc,c as wc,d as Yi,e as Qt,g as _c,h as bi,i as Ai,j as yi,k as Mn,l as Wt,n as _t,o as Dn,p as Pc,q as Pn,s as Ic,u as Mt,v as xi,w as kt,x as Ci}from"./chunk-67V4XHCY.js";import{A as kn,B as Ea,C as Zi,D as Qi,E as Ec,F as Dc,G as Xi,H as xt,I as Da,J as Tn,K as Ct,M as En,N as St,O as wt,a as gi,b as Hd,d as Rt,e as fi,f as fc,i as xr,j as vc,k as bc,l as Ac,m as Ot,n as $i,o as Sr,p as yt,r as Ft,t as dt,u as Nt,v as Mc,w as kc,x as wr,y as Tc,z as bt}from"./chunk-P7JKENHI.js";import{$ as Jo,$a as ta,$b as pe,$c as wa,Aa as tt,Ab as Ae,Ac as ie,Bb as ye,Bc as Wd,Bd as ka,Be as dc,Ca as Zt,Cb as I,Cc as Fd,Ce as cc,D as Sd,Da as Be,Db as l,Dc as rt,De as uc,E as wd,Eb as u,Ec as y,Fa as w,Fb as L,Fc as ce,Ga as V,Gb as E,Gd as Ta,Ge as mc,H as Jn,Ha as Bi,Hb as P,Hc as pr,He as hc,I as Qo,Ib as Z,J as li,Jb as Hi,Jc as pi,Jd as Xd,Je as pc,K as di,Ka as Ye,Kb as qi,Lb as cr,Lc as pt,Mb as xe,Md as Kd,Nb as Ei,Nd as na,Ne as gc,O as _d,Ob as z,Od as wn,Oe as Je,P as Cn,Pa as or,Pb as ho,Pd as Jd,Pe as vi,Q as ci,Qa as rr,Qb as T,Ra as ea,Rb as ur,Rd as js,Re as Qe,S as Md,Sb as mr,Sd as br,Se as at,T as kd,Tb as hr,Td as ec,U as Xo,Ub as Sn,V as Ko,Va as g,Vb as mi,Vc as Gd,Vd as Pi,Wb as hi,Wc as Bd,Xa as Nd,Xc as Ud,Xd as ji,Ya as Rd,Yb as Ce,Z as Td,Zb as Se,_ as Ed,_a as sr,_b as Tt,_c as gr,a as ne,aa as er,ac as it,ae as tc,b as ue,ba as Ca,bc as Sa,bd as _a,be as ic,ca as tr,cb as lr,cc as Ke,ce as It,d as df,da as ir,dc as d,dd as zd,de as Ar,e as bd,ea as nr,ec as X,ee as _n,f as Oe,fa as Dd,fb as q,fc as he,fe as nc,g as xa,ga as Pd,gb as Ui,gc as Vt,ge as At,hb as Dt,ib as dr,ie as yr,j as zs,ja as ar,jb as Ld,jc as on,jd as qd,je as nt,k as Yt,ka as st,kb as mo,kc as rn,kd as jd,la as Gi,lb as ui,lc as sn,ld as $d,le as ac,m as Fi,mb as Vd,mc as ia,n as Ad,na as an,nc as ln,oc as dn,pa as A,pc as Di,pd as Yd,pe as oc,qc as qs,qe as rc,r as yd,rc as po,rd as fr,s as Hs,sa as Id,sc as go,sd as Zd,t as xd,td as Qd,ua as J,ub as Q,uc as lt,va as ee,vc as Pt,vd as Ma,w as Zo,wa as te,wb as O,wc as cn,x as xn,xa as Fe,xb as N,xe as sc,y as Cd,ya as uo,yb as Le,yd as vr,z as Ht,za as Od,zb as zi,zc as W,ze as lc}from"./chunk-BTFZS2TW.js";var Ll=df((p7,_s)=>{(function(n){"use strict";function a(h){if(Array.isArray(h)){for(var m=0,v=Array(h.length);m<h.length;m++)v[m]=h[m];return v}return Array.from(h)}function e(h,m){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!m||typeof m!="object"&&typeof m!="function"?h:m}function t(h,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof m);h.prototype=Object.create(m&&m.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}}),m&&(Object.setPrototypeOf?Object.setPrototypeOf(h,m):h.__proto__=m)}function i(h,m){if(!(h instanceof m))throw new TypeError("Cannot call a class as a function")}function o(h,m){if(m||(m=typeof window>"u"?global:window),m[h]!==void 0)return m[h];if(Yo===null){var v=window.getComputedStyle(document.documentElement,"");Yo=(Array.prototype.slice.call(v).join("").match(/-(moz|webkit|ms)-/)||v.OLink===""&&["","o"]||["",""])[1]}if(Yo==="")return null;var C=h.charAt(0).toUpperCase()+h.substr(1),M=m[Yo+C];return M!==void 0?M:null}function r(h,m,v,C,M,D,F){if(typeof C!="function")throw new TypeError("Invalid animation rule:",C);var H=h-v,U=H/M,$=0;U>1&&(U=1),U!==1&&($=C(U),isFinite($)&&!isNaN($)&&(U=$)),m&&m(U),H<M?F.frame=hd(function(re){return r(re,m,v,C,M,D,F)}):(D&&D(),F.inProgress=!1)}function s(){Array.prototype.constructor.apply(this,arguments)}function c(h){if(!(h instanceof DOMException&&h.result===2152923147))throw h}function p(h,m){return m.replace(rf,function(v,C){var M=h[C];return M!==void 0?M:v})}function f(h){return h.majorTicks instanceof Array||(h.majorTicks=h.majorTicks?[h.majorTicks]:[]),h.majorTicks.length||(h.majorTicks.push(fe.formatMajorTickNumber(h.minValue,h)),h.majorTicks.push(fe.formatMajorTickNumber(h.maxValue,h))),[h.tickSide!=="right",h.tickSide!=="left"]}function b(h,m,v,C,M,D){h.beginPath(),h.moveTo(m+D,v),h.lineTo(m+C-D,v),h.quadraticCurveTo(m+C,v,m+C,v+D),h.lineTo(m+C,v+M-D),h.quadraticCurveTo(m+C,v+M,m+C-D,v+M),h.lineTo(m+D,v+M),h.quadraticCurveTo(m,v+M,m,v+M-D),h.lineTo(m,v+D),h.quadraticCurveTo(m,v,m+D,v),h.closePath()}function x(h,m){var v=m.valueDec,C=m.valueInt,M=0,D=void 0,F=void 0,H=void 0;if(h=parseFloat(h),H=h<0,h=Math.abs(h),v>0){for(F=h.toFixed(v).toString().split("."),D=C-F[0].length;M<D;++M)F[0]="0"+F[0];F=(H?"-":"")+F[0]+"."+F[1]}else{for(F=Math.round(h).toString(),D=C-F.length;M<D;++M)F="0"+F;F=(H?"-":"")+F}return F}function S(h,m){var v=void 0,C=!1;return v=m.majorTicksDec===0?Math.round(h).toString():h.toFixed(m.majorTicksDec),m.majorTicksInt>1?(C=~v.indexOf("."),~v.indexOf("-")?"-"+[m.majorTicksInt+m.majorTicksDec+2+(C?1:0)-v.length].join("0")+v.replace("-",""):[m.majorTicksInt+m.majorTicksDec+1+(C?1:0)-v.length].join("0")+v):v}function _(h){return h*Math.PI/180}function k(h,m){return{x:-h*Math.sin(m),y:h*Math.cos(m)}}function B(h,m,v,C){var M=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],D=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,F=h.createLinearGradient(M?0:D,M?D:0,M?0:C,M?C:0);return F.addColorStop(0,m),F.addColorStop(1,v),F}function R(h,m){m.needleShadow&&(h.shadowOffsetX=2,h.shadowOffsetY=2,h.shadowBlur=10,h.shadowColor=m.colorNeedleShadowDown)}function G(h,m,v){return h["font"+m+"Style"]+" "+h["font"+m+"Weight"]+" "+h["font"+m+"Size"]*v+"px "+h["font"+m]}function j(h){h.shadowOffsetX=null,h.shadowOffsetY=null,h.shadowBlur=null,h.shadowColor="",h.strokeStyle=null,h.lineWidth=0,h.save()}function K(h,m,v,C){m.valueTextShadow&&(h.shadowOffsetX=v,h.shadowOffsetY=v,h.shadowBlur=C,h.shadowColor=m.colorValueTextShadow)}function Y(h,m,v,C,M,D){if(m.valueBox){j(h);var F=m.valueDec?1+m.valueDec:0,H="9".repeat(Math.max.apply(null,[String(parseInt(v)).length+F].concat(m.majorTicks.map(function(He){return String(parseInt(He,10)).length+F})))),U=m.valueText||x(v,m),$=D/200,re=D/100,se=.4*re,_e=1.2*re;h.font=G(m,"Value",$),K(h,m,se,_e);var ke=h.measureText(m.valueText?U:"-"+x(Number(H),m)).width;j(h);var Pe=parseFloat(m.fontValueSize)*$+se+_e,$e=re*parseFloat(m.valueBoxStroke),De=2*D-2*$e,qe=ke+10*re,je=1.1*Pe+se+_e,Ze=re*m.valueBoxBorderRadius,Ge=(parseFloat(m.valueBoxWidth)||0)/100*De;Ge>qe&&(qe=Ge),qe>De&&(qe=De);var ze=C-qe/2,We=M-je/2,Ee=M-5.75*re;if(h.beginPath(),Ze?b(h,ze,We,qe,je,Ze):h.rect(ze,We,qe,je),$e){var Ie=h.createRadialGradient(C,Ee,10*re,C,Ee,20*re);Ie.addColorStop(0,m.colorValueBoxRect),Ie.addColorStop(1,m.colorValueBoxRectEnd),h.strokeStyle=Ie,h.lineWidth=$e,h.stroke()}m.colorValueBoxShadow&&(h.shadowBlur=1.2*re,h.shadowColor=m.colorValueBoxShadow),m.colorValueBoxBackground&&(h.fillStyle=m.colorValueBoxBackground,h.fill()),h.closePath(),h.restore(),K(h,m,se,_e),h.fillStyle=m.colorValueText,h.textAlign="center",h.textBaseline="alphabetic",h.fillText(U,ze+qe/2,M+je/2-Pe/3),h.restore()}}function Te(h){var m=h.value,v=h.minValue,C=h.maxValue,M=.01*(C-v);return{normal:m<v?v:m>C?C:m,indented:m<v?v-M:m>C?C+M:m}}function ge(h,m,v,C,M){v.beginPath(),v.arc(0,0,Ti(h),0,2*lo,!0),v.lineWidth=m,v.strokeStyle=M?fe.linearGradient(v,C,M,h):C,v.stroke(),v.closePath()}function oe(h,m){var v=ki.pixelRatio;return h.maxRadius||(h.maxRadius=h.max-m.borderShadowWidth-m.borderOuterWidth*v-m.borderMiddleWidth*v-m.borderInnerWidth*v+(m.borderOuterWidth?.5:0)+(m.borderMiddleWidth?.5:0)+(m.borderInnerWidth?.5:0)),h.maxRadius}function le(h,m){function v(se,_e,ke,Pe,$e,De){return _e&&(!De&&m.borderShadowWidth&&(ke.save(),ke.shadowBlur=m.borderShadowWidth,ke.shadowColor=m.colorBorderShadow),ge(se,_e*C,ke,Pe,$e),!De&&m.borderShadowWidth&&(De=!0,ke.restore())),De}var C=ki.pixelRatio,M=m.borderShadowWidth*C,D=h.max-M-m.borderOuterWidth*C/2,F=D-m.borderOuterWidth*C/2-m.borderMiddleWidth*C/2+.5,H=F-m.borderMiddleWidth*C/2-m.borderInnerWidth*C/2+.5,U=oe(h,m),$=void 0,re=!1;h.save(),re=v(D,m.borderOuterWidth,h,m.colorBorderOuter,m.colorBorderOuterEnd,re),re=v(F,m.borderMiddleWidth,h,m.colorBorderMiddle,m.colorBorderMiddleEnd,re),re=v(H,m.borderInnerWidth,h,m.colorBorderInner,m.colorBorderInnerEnd,re),!re&&m.borderShadowWidth&&(h.shadowBlur=m.borderShadowWidth,h.shadowColor=m.colorBorderShadow),h.beginPath(),h.arc(0,0,Ti(U),0,2*lo,!0),m.colorPlateEnd?($=h.createRadialGradient(0,0,U/2,0,0,U),$.addColorStop(0,m.colorPlate),$.addColorStop(1,m.colorPlateEnd)):$=m.colorPlate,h.fillStyle=$,h.fill(),h.closePath(),h.restore()}function me(h,m){if(m.highlights!=="false"&&m.highlights.length&&m.highlightsWidth!==0){var v=h.max*(parseFloat(m.highlightsWidth)||0)/100,C=Ti(Me(h,m)-v/2),M=m.highlights.length,D=(m.maxValue-m.minValue)/m.ticksAngle;h.save();for(var F=0;F<M;F++){var H=m.highlights[F];h.lineWidth=v,h.lineCap=m.highlightsLineCap,h.strokeStyle=H.color,h.beginPath(),h.rotate(Us),h.arc(0,0,C,fe.radians(m.startAngle+(H.from-m.minValue)/D),fe.radians(m.startAngle+(H.to-m.minValue)/D),!1),h.stroke(),h.closePath(),h.restore(),h.save()}h.restore()}}function de(h,m){var v=Me(h,m),C=void 0,M=void 0,D=void 0,F=0,H=Math.abs(m.minorTicks)||0,U=m.ticksAngle/(m.maxValue-m.minValue);m.exactTicks?(M=m.maxValue-m.minValue,C=H?M/H:0,F=(Wi.mod(m.majorTicks[0],H)||0)*U):C=H*(m.majorTicks.length-1),h.lineWidth=ki.pixelRatio,h.strokeStyle=m.colorMinorTicks||m.colorStrokeTicks,h.save();for(var $=0;$<C;++$)(D=m.startAngle+F+$*(m.ticksAngle/C))<=m.ticksAngle+m.startAngle&&(h.rotate(fe.radians(D)),h.beginPath(),h.moveTo(0,v),h.lineTo(0,v-.075*h.max),et(h));h.restore()}function Me(h,m){var v=h.max/100;return oe(h,m)-5*v-(m.barWidth?2*(parseFloat(m.barStrokeWidth)||0)+((parseFloat(m.barWidth)||0)+5)*v:0)}function Ve(h,m){fe.prepareTicks(m);var v=Ti(Me(h,m)),C=void 0,M=m.majorTicks.length,D=ki.pixelRatio;h.lineWidth=2*D,C=m.colorMajorTicks instanceof Array?m.colorMajorTicks:new Array(M).fill(m.colorStrokeTicks||m.colorMajorTicks);for(var F=0;F<M;++F)h.save(),h.strokeStyle=C[F],h.rotate(fe.radians(Ue(m,m.exactTicks?m.majorTicks[F]:F,M))),h.beginPath(),h.moveTo(0,v),h.lineTo(0,v-.15*h.max),h.stroke(),h.closePath(),h.restore();m.strokeTicks&&(h.save(),h.strokeStyle=m.colorStrokeTicks||C[0],h.rotate(Us),h.beginPath(),h.arc(0,0,v,fe.radians(m.startAngle),fe.radians(m.startAngle+m.ticksAngle),!1),h.stroke(),h.closePath(),h.restore())}function Ue(h,m,v){if(h.exactTicks){var C=h.ticksAngle/(h.maxValue-h.minValue);return h.startAngle+C*(m-h.minValue)}return h.startAngle+m*(h.ticksAngle/(v-1))}function et(h){h.stroke(),h.restore(),h.closePath(),h.save()}function vt(h,m){var v=Me(h,m)-.15*h.max,C={},M=0,D=m.majorTicks.length,F=m.animationTarget!=="needle",H=m.colorNumbers instanceof Array?m.colorNumbers:new Array(D).fill(m.colorNumbers),U=F?-(m.value-m.minValue)/(m.maxValue-m.minValue)*m.ticksAngle:0;for(F&&(h.save(),h.rotate(-fe.radians(U))),h.font=fe.font(m,"Numbers",h.max/200),h.lineWidth=0,h.textAlign="center",h.textBaseline="middle";M<D;++M){var $=U+Ue(m,m.exactTicks?m.majorTicks[M]:M,D),re=h.measureText(m.majorTicks[M]).width,se=m.fontNumbersSize,_e=Math.sqrt(re*re+se*se)/2,ke=fe.radialPoint(v-_e-m.numbersMargin/100*h.max,fe.radians($));$===360&&($=0),C[$]||(C[$]=!0,h.fillStyle=H[M],h.fillText(m.majorTicks[M],ke.x,ke.y))}F&&h.restore()}function jt(h,m){m.title&&(h.save(),h.font=fe.font(m,"Title",h.max/200),h.fillStyle=m.colorTitle,h.textAlign="center",h.fillText(m.title,0,-h.max/4.25,.8*h.max),h.restore())}function An(h,m){m.units&&(h.save(),h.font=fe.font(m,"Units",h.max/200),h.fillStyle=m.colorUnits,h.textAlign="center",h.fillText(fe.formatContext(m,m.units),0,h.max/3.25,.8*h.max),h.restore())}function yn(h,m){if(m.needle){var v=m.animationTarget!=="needle",C=m.ticksAngle<360?fe.normalizedValue(m).indented:m.value,M=v?m.startAngle:m.startAngle+(C-m.minValue)/(m.maxValue-m.minValue)*m.ticksAngle;m.barStartPosition==="right"&&(M=m.startAngle+m.ticksAngle-(C-m.minValue)/(m.maxValue-m.minValue)*m.ticksAngle);var D=oe(h,m),F=Ti(D/100*m.needleCircleSize),H=Ti(D/100*m.needleCircleSize*.75),U=Ti(D/100*m.needleEnd),$=Ti(m.needleStart?D/100*m.needleStart:0),re=D/100*m.needleWidth,se=D/100*m.needleWidth/2,_e=ki.pixelRatio;h.save(),fe.drawNeedleShadow(h,m),h.rotate(fe.radians(M)),h.fillStyle=fe.linearGradient(h,m.colorNeedle,m.colorNeedleEnd,U-$),m.needleType==="arrow"?(h.beginPath(),h.moveTo(-se,-$),h.lineTo(-re,0),h.lineTo(-1*_e,U),h.lineTo(_e,U),h.lineTo(re,0),h.lineTo(se,-$),h.closePath(),h.fill(),h.beginPath(),h.lineTo(-.5*_e,U),h.lineTo(-1*_e,U),h.lineTo(-re,0),h.lineTo(-se,-$),h.lineTo(se/2*_e-2*_e,-$),h.closePath(),h.fillStyle=m.colorNeedleShadowUp,h.fill()):(h.beginPath(),h.moveTo(-se,U),h.lineTo(-se,$),h.lineTo(se,$),h.lineTo(se,U),h.closePath(),h.fill()),h.restore(),m.needleCircleSize&&(h.save(),fe.drawNeedleShadow(h,m),m.needleCircleOuter&&(h.beginPath(),h.arc(0,0,F,0,2*lo,!0),h.fillStyle=fe.linearGradient(h,m.colorNeedleCircleOuter,m.colorNeedleCircleOuterEnd,F),h.fill(),h.closePath()),m.needleCircleInner&&(h.beginPath(),h.arc(0,0,H,0,2*lo,!0),h.fillStyle=fe.linearGradient(h,m.colorNeedleCircleInner,m.colorNeedleCircleInnerEnd,H),h.fill(),h.closePath()),h.restore())}}function od(h,m,v){fe.drawValueBox(h,m,v,0,h.max-.33*h.max,h.max)}function Gg(h){var m=h.startAngle,v=h.startAngle+h.ticksAngle,C=m,M=m+(fe.normalizedValue(h).normal-h.minValue)/(h.maxValue-h.minValue)*h.ticksAngle;if(h.barStartPosition==="middle"){var D=.5*(h.minValue+h.maxValue);h.value<D?(C=180-(D-fe.normalizedValue(h).normal)/(h.maxValue-h.minValue)*h.ticksAngle,M=180):(C=180,M=180+(fe.normalizedValue(h).normal-D)/(h.maxValue-h.minValue)*h.ticksAngle)}else h.barStartPosition==="right"&&(C=v-M+m,M=v);return{startAngle:C,endAngle:M}}function rd(h,m){var v=h.max/100,C=oe(h,m)-5*v,M=parseFloat(m.barStrokeWidth+"")||0,D=(parseFloat(m.barWidth+"")||0)*v,F=C-2*M-D,H=(C-F)/2,U=F+H,$=M/U,re=m.startAngle,se=m.startAngle+m.ticksAngle;if(h.save(),h.rotate(Us),M&&(h.beginPath(),h.arc(0,0,U,fe.radians(re)-$,fe.radians(se)+$,!1),h.strokeStyle=m.colorBarStroke,h.lineWidth=2*H,h.stroke(),h.closePath()),D&&(h.beginPath(),h.arc(0,0,U,fe.radians(re),fe.radians(se),!1),h.strokeStyle=m.colorBar,h.lineWidth=D,h.stroke(),h.closePath(),m.barShadow&&(h.save(),h.beginPath(),h.arc(0,0,C,fe.radians(re),fe.radians(se),!1),h.clip(),h.beginPath(),h.strokeStyle=m.colorBar,h.lineWidth=1,h.shadowBlur=m.barShadow,h.shadowColor=m.colorBarShadow,h.shadowOffsetX=0,h.shadowOffsetY=0,h.arc(0,0,C,fe.radians(m.startAngle),fe.radians(m.startAngle+m.ticksAngle),!1),h.stroke(),h.closePath(),h.restore()),m.barProgress)){var _e=Gg(m),ke=_e.startAngle,Pe=_e.endAngle;h.beginPath(),h.arc(0,0,U,fe.radians(ke),fe.radians(Pe),!1),h.strokeStyle=m.colorBarProgress,h.lineWidth=D,h.stroke(),h.closePath()}h.restore()}function sd(h){return h.options.animatedValue?h.options.value:h.value}function Bg(h,m,v,C,M,D,F,H){h.beginPath(),h.fillStyle=H?fe.linearGradient(h,F,H,M>D?M:D,D>M,M>D?v:C):F,m>0?fe.roundRect(h,v,C,M,D,m):h.rect(v,C,M,D),h.fill(),h.closePath()}function Ug(h,m,v,C,M,D,F,H,U){h.beginPath(),h.lineWidth=m,h.strokeStyle=U?fe.linearGradient(h,H,U,F,!0,M):H,v>0?fe.roundRect(h,C,M,D,F,v):h.rect(C,M,D,F),h.stroke(),h.closePath()}function zg(h,m,v,C,M,D){function F(He,Xe,ut,$t){return He&&(!$t&&m.borderShadowWidth&&(h.save(),h.shadowBlur=m.borderShadowWidth,h.shadowColor=m.colorBorderShadow),Ug(h,He*H,U,v+He*H/2-Ee,C+He*H/2-Ee,$,ke,Xe,ut),Ee+=.5*H,!$t&&m.borderShadowWidth&&($t=!0,h.restore())),$t}var H=ki.pixelRatio,U=m.borderRadius*H,$=M-m.borderShadowWidth-m.borderOuterWidth*H,re=$-m.borderOuterWidth*H-m.borderMiddleWidth*H,se=re-m.borderMiddleWidth*H-m.borderInnerWidth*H,_e=se-m.borderInnerWidth*H,ke=D-m.borderShadowWidth-m.borderOuterWidth*H,Pe=ke-m.borderOuterWidth*H-m.borderMiddleWidth*H,$e=Pe-m.borderMiddleWidth*H-m.borderInnerWidth*H,De=$e-m.borderInnerWidth*H,qe=v-(re-$)/2,je=qe-(se-re)/2,Ze=je-(_e-se)/2,Ge=C-(Pe-ke)/2,ze=Ge-($e-Pe)/2,We=ze-(De-$e)/2,Ee=0,Ie=!1;return h.save(),Ie=F(m.borderOuterWidth,m.colorBorderOuter,m.colorBorderOuterEnd,Ie),Ie=F(m.borderMiddleWidth,m.colorBorderMiddle,m.colorBorderMiddleEnd,Ie),Ie=F(m.borderInnerWidth,m.colorBorderInner,m.colorBorderInnerEnd,Ie),!Ie&&m.borderShadowWidth&&(h.shadowBlur=m.borderShadowWidth,h.shadowColor=m.colorBorderShadow),Bg(h,U,Ze,We,_e+2*Ee,De+2*Ee,m.colorPlate,m.colorPlateEnd),h.restore(),[Ze,We,_e,De]}function Hg(h,m,v,C,M,D){var F=ki.pixelRatio,H=D>=M,U=H?.85*M:D,$=H?D:M;v=H?Re(v+(M-U)/2):v;var re=!!m.title,se=!!m.units,_e=!!m.valueBox,ke=void 0,Pe=void 0,$e=void 0;H?(Pe=Re(.05*$),ke=Re(.075*$),$e=Re(.11*$),re&&($-=ke,C+=ke),se&&($-=Pe),_e&&($-=$e)):(Pe=ke=Re(.15*U),re&&(U-=ke,C+=ke),se&&(U-=Pe));var De=2*m.barStrokeWidth,qe=m.barBeginCircle?Re(U*m.barBeginCircle/200-De/2):0,je=Re(U*m.barWidth/100-De),Ze=Re($*m.barLength/100-De),Ge=Re(($-Ze)/2),ze=Re(v+(H?U/2:Ge+qe)),We=Re(C+(H?$-Ge-qe+De/2:U/2)),Ee=!H||m.hasLeft&&m.hasRight?0:(m.hasRight?-1:1)*m.ticksWidth/100*U,Ie=H||m.hasLeft&&m.hasRight?0:(m.hasRight?-1:1)*m.ticksWidth/100*U;return h.barDimensions={isVertical:H,width:U,length:$,barWidth:je,barLength:Ze,strokeWidth:De,barMargin:Ge,radius:qe,pixelRatio:F,barOffset:null,titleMargin:re?ke:0,unitsMargin:se?Pe:0,get ticksLength(){return this.barLength-this.barOffset-this.strokeWidth},X:v+Ee,Y:C+Ie,x0:ze+Ee,y0:We+Ie,baseX:v,baseY:C,ticksPadding:m.ticksPadding/100},h.barDimensions}function ld(h,m,v,C,M,D,F){var H=Hg(h,m,C,M,D,F),U=H.isVertical,$=H.width,re=H.barWidth,se=H.barLength,_e=H.strokeWidth,ke=H.barMargin,Pe=H.radius,$e=H.x0,De=H.y0,qe=H.X,je=H.Y,Ze=se;h.save(),h.beginPath();var Ge=null;if(m.barBeginCircle){var ze=fe.radians(U?270:0),We=Math.asin(re/2/Pe),Ee=Math.cos(We),Ie=Math.sin(We),He=$e+(U?Pe*Ie:Pe*Ee-_e/2),Xe=U?De-Pe*Ee:De+Pe*Ie,ut=Ti(U?Xe-De:He-$e);Ge=Re(ut+Pe);var $t=U?Re($e-Pe*Ie):He,si=U?Xe:Re(De-Pe*Ie);v==="progress"&&(se=Ge+(se-Ge)*(fe.normalizedValue(m).normal-m.minValue)/(m.maxValue-m.minValue));var co=Re(He+se-Ge+_e/2),Kn=Re(Xe-se+Ge-_e/2);h.arc($e,De,Pe,ze+We,ze-We),U?(h.moveTo(He,si),h.lineTo(He,Kn),h.lineTo($t,Kn),h.lineTo($t,si)):(h.moveTo(He,si),h.lineTo(co,si),h.lineTo(co,Xe),h.lineTo(He,Xe))}else{var fd=Re(U?qe+($-re)/2:qe+ke),vd=Re(U?je+se+ke:je+($-re)/2);v==="progress"&&(se*=(m.value-m.minValue)/(m.maxValue-m.minValue)),U?h.rect(fd,vd,re,-se):h.rect(fd,vd,se,re)}v!=="progress"&&m.barStrokeWidth&&(h.lineWidth=_e,h.strokeStyle=m.colorBarStroke,h.stroke()),v!=="progress"&&m.colorBar?(h.fillStyle=m.colorBarEnd?fe.linearGradient(h,m.colorBar,m.colorBarEnd,se,U,U?je:qe):m.colorBar,h.fill()):v==="progress"&&m.colorBarProgress&&(h.fillStyle=m.colorBarProgressEnd?fe.linearGradient(h,m.colorBarProgress,m.colorBarProgressEnd,Ze,U,U?je:qe):m.colorBarProgress,h.fill()),h.closePath(),h.restore(),m.barBeginCircle&&(h.barDimensions.radius+=_e),h.barDimensions.barOffset=Ge,h.barDimensions.barWidth+=_e,h.barDimensions.barLength+=_e}function qg(h,m,v,C,M,D){ld(h,m,"",v,C,M,D)}function dd(h,m){return m.needleSide!==h||m.tickSide!==h||m.numberSide!==h}function jg(h,m,v,C,M,D){m.barProgress&&ld(h,m,"progress",v,C,M,D)}function $g(h,m){var v=h.barDimensions,C=v.isVertical,M=v.width,D=v.length,F=v.barWidth,H=v.barOffset,U=v.barMargin,$=v.X,re=v.Y,se=v.ticksLength,_e=v.ticksPadding,ke=M*(parseFloat(m.highlightsWidth)||0)/100;if(m.highlights&&ke){var Pe=m.tickSide!=="right",$e=m.tickSide!=="left",De=0,qe=m.highlights.length,je=(M-F)/2,Ze=m.maxValue-m.minValue,Ge=Re(C?$+je:$+U+H),ze=ke,We=C?re+D-U-H:re+je,Ee=Re((m.ticksWidth/100+_e)*M)+(ke-m.ticksWidth/100*M),Ie=Re(F+_e*M);for(h.save();De<qe;De++){var He=m.highlights[De],Xe=se*Ti(m.minValue-He.from)/Ze,ut=se*Ti((He.to-He.from)/Ze);h.beginPath(),h.fillStyle=He.color,C?(Pe&&h.rect(Ge-Ee,We-Xe,ze,-ut),$e&&h.rect(Ge+Ie,We-Xe,ze,-ut)):(Pe&&h.rect(Ge+Xe,We-Ee,ut,ze),$e&&h.rect(Ge+Xe,We+Ie,ut,ze)),h.fill(),h.closePath()}h.restore()}}function jo(h,m,v,C,M){h.beginPath(),h.moveTo(m,v),h.lineTo(C,M),h.stroke(),h.closePath()}function cd(h,m,v,C,M,D,F,H,U){var $=h.barDimensions,re=$.isVertical,se=$.length,_e=$.barWidth,ke=$.barOffset,Pe=$.barMargin,$e=$.pixelRatio,De=$.width,qe=$.X,je=$.Y,Ze=$.ticksLength,Ge=$.ticksPadding,ze=(De-_e)/2,We=void 0,Ee=void 0,Ie=0,He=v.length,Xe=void 0,ut=U*De,$t=ze-Ge*De,si=ze+_e+ut+Ge*De,co=m instanceof Array?m:new Array(v.length).fill(m);h.save(),h.lineWidth=H*$e;for(var Kn=Ze/(M-C);Ie<He;Ie++)Xe=v[Ie],h.strokeStyle=co[Ie],re?(Ee=je+se-Pe-ke+(C-Xe)*Kn,D&&(We=qe+$t,jo(h,We,Ee,Re(We-ut),Ee)),F&&(We=qe+si,jo(h,We,Ee,Re(We-ut),Ee))):(We=qe+Pe+ke-(C-Xe)*Kn,D&&(Ee=je+$t,jo(h,We,Ee,We,Re(Ee-ut))),F&&(Ee=je+si,jo(h,We,Re(Ee),We,Ee-ut)));h.restore()}function Yg(h,m){var v=fe.prepareTicks(m),C=md(v,2),M=C[0],D=C[1],F=2,H=(m.maxValue-m.minValue)/(m.majorTicks.length-1),U=m.colorMajorTicks instanceof Array?m.colorMajorTicks:new Array(m.majorTicks.length).fill(m.colorStrokeTicks||m.colorMajorTicks);if(cd(h,U,m.exactTicks?m.majorTicks:m.majorTicks.map(function(ut,$t){return m.minValue+H*$t}),m.minValue,m.maxValue,M,D,F,m.ticksWidth/100),m.strokeTicks){var $=h.barDimensions,re=$.isVertical,se=$.length,_e=$.width,ke=$.barWidth,Pe=$.barMargin,$e=$.barOffset,De=$.X,qe=$.Y,je=$.ticksLength,Ze=$.pixelRatio,Ge=$.ticksPadding,ze=(_e-ke)/2+ke+Ge*_e,We=(_e-ke)/2-Ge*_e,Ee=void 0,Ie=void 0,He=void 0,Xe=void 0;h.strokeStyle=m.colorStrokeTicks||U[0],F*=Ze,re?(Ie=qe+se-Pe-$e+F/2,Xe=Ie-je-F,M&&(He=Ee=Re(De+We),$o(h,Ee,Ie,He,Xe)),D&&(He=Ee=Re(De+ze),$o(h,Ee,Ie,He,Xe))):(Ee=De+Pe+$e-F/2,He=Ee+je+F,M&&(Xe=Ie=Re(qe+We),$o(h,Ee,Ie,He,Xe)),D&&(Xe=Ie=Re(qe+ze),$o(h,Ee,Ie,He,Xe)))}}function $o(h,m,v,C,M){h.beginPath(),h.moveTo(m,v),h.lineTo(C,M),h.stroke(),h.closePath()}function Zg(h,m){var v=fe.prepareTicks(m),C=md(v,2),M=C[0],D=C[1],F=[],H=m.minValue,U=Math.abs(m.minorTicks)||0,$=U?(m.maxValue-m.minValue)/(U*(m.majorTicks.length-1)):0;if(U)if(m.exactTicks)for(var re=Wi.mod(m.majorTicks[0],U)||0;H<m.maxValue;H+=U)re+H<m.maxValue&&F.push(re+H);else for(;H<m.maxValue;H+=$)F.push(H);cd(h,m.colorMinorTicks||m.colorStrokeTicks,F,m.minValue,m.maxValue,M,D,1,m.ticksWidthMinor/100)}function Qg(h,m){var v=h.barDimensions,C=v.isVertical,M=v.length,D=v.width,F=v.barWidth,H=v.barMargin,U=v.barOffset,$=v.X,re=v.Y,se=v.ticksLength,_e=v.ticksPadding,ke=m.maxValue-m.minValue,Pe=ke/(m.majorTicks.length-1),$e=m.exactTicks?m.majorTicks:m.majorTicks.map(function(co,Kn){return m.minValue+Pe*Kn}),De=$e.length,qe=m.numberSide!=="right",je=m.numberSide!=="left",Ze=m.fontNumbersSize*D/200,Ge=0,ze=(m.ticksWidth/100+2*_e)*D,We=(D-F)/2-ze,Ee=(D-F)/2+F+ze,Ie=void 0,He=void 0,Xe=void 0,ut=void 0,$t=m.colorNumbers instanceof Array?m.colorNumbers:new Array(De).fill(m.colorNumbers),si=m.numbersMargin/100*D;for(h.font=fe.font(m,"Numbers",D/200),h.lineWidth=0,h.textAlign="center";Ge<De;Ge++)h.fillStyle=$t[Ge],ut=m.majorTicks[Ge],Xe=m.exactTicks?se*(($e[Ge]-m.minValue)/ke):Ge*se/(De-1),C?(He=re+M-H-U-Xe+Ze/3,qe&&(h.textAlign="right",h.fillText(ut,$+We-si,He)),je&&(h.textAlign="left",h.fillText(ut,$+Ee+si,He))):(h.measureText(ut).width,Ie=$+H+U+Xe,qe&&h.fillText(ut,Ie,re+We-si),je&&h.fillText(ut,Ie,re+Ee+Ze+si))}function Xg(h,m){if(m.title){var v=h.barDimensions,C=v.isVertical,M=v.width,D=v.length,F=v.baseX,H=v.baseY,U=v.titleMargin,$=m.fontTitleSize*M/200,re=Re(F+(C?M:D)/2),se=Re(H+U/2-(C?$:$/2)-.025*(C?D:M));h.save(),h.textAlign="center",h.fillStyle=m.colorTitle,h.font=fe.font(m,"Title",M/200),h.lineWidth=0,h.fillText(m.title,re,se,C?M:D),h.restore()}}function Kg(h,m){if(m.units){var v=h.barDimensions,C=v.isVertical,M=v.width,D=v.length,F=v.baseX,H=v.baseY,U=v.unitsMargin,$=m.fontUnitsSize*M/200,re=Re(F+(C?M:D)/2),se=Re(H+(C?D:M)+U/2-$/2);h.save(),h.textAlign="center",h.fillStyle=m.colorUnits,h.font=fe.font(m,"Units",M/200),h.lineWidth=0,h.fillText(fe.formatContext(m,m.units),re,se,C?M:D),h.restore()}}function Jg(h,m){if(m.needle){var v=h.barDimensions,C=v.isVertical,M=v.width,D=v.length,F=v.barWidth,H=v.barOffset,U=v.barMargin,$=v.ticksLength,re=v.X,se=v.Y,_e=v.ticksPadding,ke=m.needleSide!=="right",Pe=m.needleSide!=="left",$e=$*(fe.normalizedValue(m).indented-m.minValue)/(m.maxValue-m.minValue),De=(m.ticksWidth/100+_e)*M,qe=F/2+De,je=qe*(m.needleEnd/100),Ze=void 0,Ge=void 0,ze=void 0,We=void 0,Ee=m.needleType.toLowerCase()==="arrow"?tf:ef,Ie=(M-F)/2,He=qe*(m.needleStart/100),Xe=Ie-De-He,ut=Ie+F+De+He;h.save(),fe.drawNeedleShadow(h,m),C?(ze=Re(se+D-U-H-$e),ke&&(Ze=Re(re+Xe),Ge=Ze+je,Ee(h,m,Ze,ze,Ge,ze,je)),Pe&&(Ze=Re(re+ut),Ge=Ze-je,Ee(h,m,Ze,ze,Ge,ze,je,!0))):(Ze=Re(re+U+H+$e),ke&&(ze=Re(se+Xe),We=ze+je,Ee(h,m,Ze,ze,Ze,We,je)),Pe&&(ze=Re(se+ut),We=ze-je,Ee(h,m,Ze,ze,Ze,We,je,!0))),h.restore()}}function ud(h,m,v,C){return m.colorNeedleEnd?fe.linearGradient(h,C?m.colorNeedleEnd:m.colorNeedle,C?m.colorNeedle:m.colorNeedleEnd,v,!h.barDimensions.isVertical):m.colorNeedle}function ef(h,m,v,C,M,D,F,H){h.lineWidth=m.needleWidth,h.strokeStyle=ud(h,m,F,H),h.beginPath(),h.moveTo(v,C),h.lineTo(M,D),h.stroke(),h.closePath()}function tf(h,m,v,C,M,D,F,H){var U=Re(.4*F),$=F-U,re=v===M,se=m.needleWidth/2;h.fillStyle=ud(h,m,F,H),h.beginPath(),re?(C>D&&($*=-1),h.moveTo(v-se,C),h.lineTo(v+se,C),h.lineTo(v+se,C+$),h.lineTo(v,D),h.lineTo(v-se,C+$),h.lineTo(v-se,C)):(v>M&&($*=-1),h.moveTo(v,C-se),h.lineTo(v,C+se),h.lineTo(v+$,C+se),h.lineTo(M,C),h.lineTo(v+$,C-se),h.lineTo(v,C-se)),h.fill(),h.closePath()}function nf(h,m,v,C,M,D,F){var H=(parseFloat(m.fontValueSize)||0)*D/200,U=(.11*F-H)/2;h.barDimensions.isVertical&&fe.drawValueBox(h,m,v,C+D/2,M+F-H-U,D)}var md=(function(){function h(m,v){var C=[],M=!0,D=!1,F=void 0;try{for(var H,U=m[Symbol.iterator]();!(M=(H=U.next()).done)&&(C.push(H.value),!v||C.length!==v);M=!0);}catch($){D=!0,F=$}finally{try{!M&&U.return&&U.return()}finally{if(D)throw F}}return C}return function(m,v){if(Array.isArray(m))return m;if(Symbol.iterator in Object(m))return h(m,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),Ws=function h(m,v,C){m===null&&(m=Function.prototype);var M=Object.getOwnPropertyDescriptor(m,v);if(M===void 0){var D=Object.getPrototypeOf(m);return D===null?void 0:h(D,v,C)}if("value"in M)return M.value;var F=M.get;if(F!==void 0)return F.call(C)},af=function h(m,v,C,M){var D=Object.getOwnPropertyDescriptor(m,v);if(D===void 0){var F=Object.getPrototypeOf(m);F!==null&&h(F,v,C,M)}else if("value"in D&&D.writable)D.value=C;else{var H=D.set;H!==void 0&&H.call(M,C)}return C},Xn=(function(){function h(m,v){for(var C=0;C<v.length;C++){var M=v[C];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(m,M.key,M)}}return function(m,v,C){return v&&h(m.prototype,v),C&&h(m,C),m}})(),Yo=null,of=(function(){function h(){i(this,h),this._events={},this.addListener=this.on,this.removeListener=this.off}return Xn(h,[{key:"emit",value:function(m){if(this._events[m]){for(var v=0,C=this._events[m].length,M=arguments.length,D=Array(M>1?M-1:0),F=1;F<M;F++)D[F-1]=arguments[F];for(;v<C;v++)this._events[m][v]&&this._events[m][v].apply(this,D)}}},{key:"once",value:function(m){for(var v=arguments.length,C=Array(v>1?v-1:0),M=1;M<v;M++)C[M-1]=arguments[M];for(var D=0,F=C.length,H=this;D<F;D++)(function(){var U=C[D],$=function re(){H.off(m,re),U.apply(H,arguments)};C[D]=$})();this.on.apply(this,[m].concat(C))}},{key:"on",value:function(m){this._events[m]||(this._events[m]=[]);for(var v=0,C=arguments.length<=1?0:arguments.length-1;v<C;v++)this._events[m].push(arguments.length<=v+1?void 0:arguments[v+1])}},{key:"off",value:function(m){if(this._events[m])for(var v=0,C=arguments.length<=1?0:arguments.length-1;v<C;v++)for(var M=arguments.length<=v+1?void 0:arguments[v+1],D=void 0;~(D=this._events[m].indexOf(M));)this._events[m].splice(D,1)}},{key:"removeAllListeners",value:function(m){delete this._events[m]}},{key:"listeners",get:function(){return this._events}}]),h})(),hd=o("requestAnimationFrame")||function(h){return setTimeout(function(){return h(new Date().getTime())},1e3/60)},ro={linear:function(h){return h},quad:function(h){return Math.pow(h,2)},dequad:function(h){return 1-ro.quad(1-h)},quint:function(h){return Math.pow(h,5)},dequint:function(h){return 1-Math.pow(1-h,5)},cycle:function(h){return 1-Math.sin(Math.acos(h))},decycle:function(h){return Math.sin(Math.acos(1-h))},bounce:function(h){return 1-ro.debounce(1-h)},debounce:function(h){for(var m=0,v=1;;m+=v,v/=2)if(h>=(7-4*m)/11)return-Math.pow((11-6*m-11*h)/4,2)+Math.pow(v,2)},elastic:function(h){return 1-ro.delastic(1-h)},delastic:function(h){return Math.pow(2,10*(h-1))*Math.cos(20*Math.PI*1.5/3*h)}},Fs=(function(){function h(){var m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"linear",v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:250,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},M=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){};if(i(this,h),this.duration=v,this.rule=m,this.draw=C,this.end=M,typeof this.draw!="function")throw new TypeError("Invalid animation draw callback:",C);if(typeof this.end!="function")throw new TypeError("Invalid animation end callback:",M)}return Xn(h,[{key:"animate",value:function(m,v){var C=this;this.frame&&this.cancel();var M=window.performance&&window.performance.now?window.performance.now():o("animationStartTime")||Date.now();m=m||this.draw,v=v||this.end,this.draw=m,this.end=v,this.frame=hd(function(D){return r(D,m,M,ro[C.rule]||C.rule,C.duration,v,C)})}},{key:"cancel",value:function(){this.frame&&((o("cancelAnimationFrame")||function(m){})(this.frame),this.frame=null)}},{key:"destroy",value:function(){this.cancel(),this.draw=null,this.end=null}}]),h})();Fs.rules=ro;var ya=(function(){function h(m,v,C){i(this,h),this.options=m,this.element=v.toLowerCase(),this.type=h.toDashed(C),this.Type=n[C],this.mutationsObserved=!1,this.isObservable=!!window.MutationObserver,window.GAUGES_NO_AUTO_INIT||h.domReady(this.traverse.bind(this))}return Xn(h,[{key:"isValidNode",value:function(m){return!(!m.tagName||m.tagName.toLowerCase()!==this.element||m.getAttribute("data-type")!==this.type)}},{key:"traverse",value:function(){for(var m=document.getElementsByTagName(this.element),v=0,C=m.length;v<C;v++)this.process(m[v]);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(m){for(var v=0,C=m.length;v<C;v++){var M=m[v];if(M.type==="attributes"&&M.attributeName==="data-type"&&this.isValidNode(M.target)&&M.oldValue!==this.type)setTimeout(this.process.bind(this,M.target));else if(M.addedNodes&&M.addedNodes.length)for(var D=0,F=M.addedNodes.length;D<F;D++)setTimeout(this.process.bind(this,M.addedNodes[D]))}}},{key:"process",value:function(m){var v=this;if(!this.isValidNode(m))return null;var C=void 0,M=JSON.parse(JSON.stringify(this.options)),D=null;for(C in M)if(M.hasOwnProperty(C)){var F=h.toAttributeName(C),H=h.parse(m.getAttribute(F));H!=null&&(M[C]=H)}return M.renderTo=m,D=new this.Type(M),D.draw&&D.draw(),this.isObservable&&(D.observer=new MutationObserver(function(U){U.forEach(function($){if($.type==="attributes"){var re=$.attributeName.toLowerCase(),se=m.getAttribute(re).toLowerCase();if(re==="data-type"&&se&&se!==v.type)D.observer.disconnect(),delete D.observer,D.destroy&&D.destroy();else if(re.substr(0,5)==="data-"){var _e=re.substr(5).split("-").map(function(Pe,$e){return $e?Pe.charAt(0).toUpperCase()+Pe.substr(1):Pe}).join(""),ke={};ke[_e]=h.parse(m.getAttribute($.attributeName)),_e==="value"?D&&(D.value=ke[_e]):D.update&&D.update(ke)}}})}),D.observer.observe(m,{attributes:!0})),D}}],[{key:"parse",value:function(m){if(m==="true")return!0;if(m==="false")return!1;if(m!=="undefined"){if(m==="null")return null;if(/^[-+#.\w\d\s]+(?:,[-+#.\w\d\s]*)+$/.test(m))return m.split(",");try{return JSON.parse(m)}catch(v){}return m}}},{key:"toDashed",value:function(m){for(var v=m.split(/(?=[A-Z])/),C=1,M=v.length,D=v[0].toLowerCase();C<M;C++)D+="-"+v[C].toLowerCase();return D}},{key:"toCamelCase",value:function(m){for(var v=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],C=m.split(/-/),M=0,D=C.length,F="";M<D;M++)F+=M||v?C[M][0].toUpperCase()+C[M].substr(1).toLowerCase():C[M].toLowerCase();return F}},{key:"toAttributeName",value:function(m){return"data-"+h.toDashed(m)}},{key:"domReady",value:function(m){if(/comp|inter|loaded/.test((window.document||{}).readyState+""))return m();window.addEventListener?window.addEventListener("DOMContentLoaded",m,!1):window.attachEvent&&window.attachEvent("onload",m)}}]),h})(),ki=(function(){function h(m,v,C){i(this,h),h.collection.push(this),this.width=v||0,this.height=C||0,this.element=m,this.init()}return Xn(h,[{key:"init",value:function(){var m=h.pixelRatio;this.element.width=this.width*m,this.element.height=this.height*m,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 m=h.collection.indexOf(this);~m&&h.collection.splice(m,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 m=h.pixelRatio;return m!==1&&this.contextClone.scale(m,m),this}},{key:"redraw",value:function(){return this.init(),this.onRedraw&&this.onRedraw(),this}}],[{key:"redraw",value:function(){for(var m=0,v=h.collection.length;m<v;m++)h.collection[m].redraw()}},{key:"pixelRatio",get:function(){return window.devicePixelRatio||1}}]),h})();ki.collection=[],window.matchMedia&&window.matchMedia("screen and (min-resolution: 2dppx)").addListener(ki.redraw);var Gs={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(h){if(typeof h=="string")for(var m=0,v=this.length;m<v;m++){var C=this[m].options.renderTo.tagName?this[m].options.renderTo:document.getElementById(this[m].options.renderTo||"");if(C.getAttribute("id")===h)return this[m]}else if(typeof h=="number")return this[h];return null};var Bs="2.2.1",Re=Math.round,Ti=Math.abs,so=new s;so.version=Bs;var Wi=(function(h){function m(v){i(this,m);var C=e(this,(m.__proto__||Object.getPrototypeOf(m)).call(this)),M=C.constructor.name;if(M==="BaseGauge")throw new TypeError("Attempt to instantiate abstract class!");if(so.push(C),v.listeners&&Object.keys(v.listeners).forEach(function(F){(v.listeners[F]instanceof Array?v.listeners[F]:[v.listeners[F]]).forEach(function(H){C.on(F,H)})}),C.version=Bs,C.type=n[M]||m,C.initialized=!1,v.minValue=parseFloat(v.minValue),v.maxValue=parseFloat(v.maxValue),v.value=parseFloat(v.value)||0,v.borders||(v.borderInnerWidth=v.borderMiddleWidth=v.borderOuterWidth=0),!v.renderTo)throw TypeError("Canvas element was not specified when creating the Gauge object!");var D=v.renderTo.tagName?v.renderTo:document.getElementById(v.renderTo);if(!(D instanceof HTMLCanvasElement))throw TypeError("Given gauge canvas element is invalid!");return v.width=parseFloat(v.width)||0,v.height=parseFloat(v.height)||0,v.width&&v.height||(v.width||(v.width=D.parentNode?D.parentNode.offsetWidth:D.offsetWidth),v.height||(v.height=D.parentNode?D.parentNode.offsetHeight:D.offsetHeight)),C.options=v||{},C.options.animateOnInit&&(C._value=C.options.value,C.options.value=C.options.minValue),C.canvas=new ki(D,v.width,v.height),C.canvas.onRedraw=C.draw.bind(C),C.animation=new Fs(v.animationRule,v.animationDuration),C}return t(m,h),Xn(m,[{key:"update",value:function(v){return Object.assign(this.options,this.type.configure(v||{})),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 v=so.indexOf(this);~v&&so.splice(v,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(v){var C=this;v=m.ensureValue(v,this.options.minValue);var M=this.options.value;if(v!==M)if(this.options.animation){if(this.animation.frame&&(this.options.value=this._value,this._value===v))return this.animation.cancel(),void delete this._value;this._value===void 0&&(this._value=v),this.emit("animationStart"),this.animation.animate(function(D){var F=M+(v-M)*D;C.options.animatedValue&&C.emit("value",F,C.value),C.options.value=F,C.draw(),C.emit("animate",D,C.options.value)},function(){C._value!==void 0&&(C.emit("value",C._value,C.value),C.options.value=C._value,delete C._value),C.draw(),C.emit("animationEnd"),C.animation.frame=null})}else this.emit("value",v,this.value),this.options.value=v,this.draw()},get:function(){return this._value===void 0?this.options.value:this._value}}],[{key:"configure",value:function(v){return v}},{key:"initialize",value:function(v,C){return new ya(C,"canvas",v)}},{key:"fromElement",value:function(v){var C=ya.toCamelCase(v.getAttribute("data-type")),M=v.attributes,D=0,F=M.length,H={};if(C){for(/Gauge$/.test(C)||(C+="Gauge");D<F;D++)H[ya.toCamelCase(M[D].name.replace(/^data-/,""),!1)]=ya.parse(M[D].value);new ya(H,v.tagName,C).process(v)}}},{key:"ensureValue",value:function(v){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return v=parseFloat(v),!isNaN(v)&&isFinite(v)||(v=parseFloat(C)||0),v}},{key:"mod",value:function(v,C){return(v%C+C)%C}},{key:"version",get:function(){return Bs}}]),m})(of);n!==void 0&&(n.BaseGauge=Wi,n.gauges=(window.document||{}).gauges=so);var rf=/{([_a-zA-Z]+[_a-zA-Z0-9]*)}/g,fe={roundRect:b,padValue:x,formatMajorTickNumber:S,radians:_,radialPoint:k,linearGradient:B,drawNeedleShadow:R,drawValueBox:Y,verifyError:c,prepareTicks:f,font:G,normalizedValue:Te,formatContext:p},lo=Math.PI,Us=lo/2,pd=Object.assign({},Gs,{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"}),sf=(function(h){function m(v){return i(this,m),v=Object.assign({},pd,v||{}),e(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,m.configure(v)))}return t(m,h),Xn(m,[{key:"draw",value:function(){try{var v=this.canvas,C=[-v.drawX,-v.drawY,v.drawWidth,v.drawHeight],M=C[0],D=C[1],F=C[2],H=C[3],U=this.options;if(U.animationTarget==="needle"){if(!v.elementClone.initialized){var $=v.contextClone;$.clearRect(M,D,F,H),this.emit("beforePlate"),le($,U),this.emit("beforeHighlights"),me($,U),this.emit("beforeMinorTicks"),de($,U),this.emit("beforeMajorTicks"),Ve($,U),this.emit("beforeNumbers"),vt($,U),this.emit("beforeTitle"),jt($,U),this.emit("beforeUnits"),An($,U),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(M,D,F,H),v.context.drawImage(v.elementClone,M,D,F,H),this.emit("beforeProgressBar"),rd(v.context,U),this.emit("beforeValueBox"),od(v.context,U,sd(this)),this.emit("beforeNeedle"),yn(v.context,U)}else{var re=-fe.radians((U.value-U.minValue)/(U.maxValue-U.minValue)*U.ticksAngle);if(v.context.clearRect(M,D,F,H),this.emit("beforePlate"),le(v.context,U),v.context.rotate(re),this.emit("beforeHighlights"),me(v.context,U),this.emit("beforeMinorTicks"),de(v.context,U),this.emit("beforeMajorTicks"),Ve(v.context,U),this.emit("beforeNumbers"),vt(v.context,U),this.emit("beforeProgressBar"),rd(v.context,U),v.context.rotate(-re),!v.elementClone.initialized){var se=v.contextClone;se.clearRect(M,D,F,H),this.emit("beforeTitle"),jt(se,U),this.emit("beforeUnits"),An(se,U),this.emit("beforeNeedle"),yn(se,U),v.elementClone.initialized=!0}v.context.drawImage(v.elementClone,M,D,F,H)}this.emit("beforeValueBox"),od(v.context,U,sd(this)),Ws(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"draw",this).call(this)}catch(_e){fe.verifyError(_e)}return this}},{key:"value",set:function(v){v=Wi.ensureValue(v,this.options.minValue),this.options.animation&&this.options.ticksAngle===360&&this.options.useMinPath&&(this._value=v,v=this.options.value+((v-this.options.value)%360+540)%360-180),af(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"value",v,this)},get:function(){return Ws(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"value",this)}}],[{key:"configure",value:function(v){return v.barWidth>50&&(v.barWidth=50),isNaN(v.startAngle)&&(v.startAngle=45),isNaN(v.ticksAngle)&&(v.ticksAngle=270),v.ticksAngle>360&&(v.ticksAngle=360),v.ticksAngle<0&&(v.ticksAngle=0),v.startAngle<0&&(v.startAngle=0),v.startAngle>360&&(v.startAngle=360),v}}]),m})(Wi);n!==void 0&&(n.RadialGauge=sf),Wi.initialize("RadialGauge",pd);var gd=Object.assign({},Gs,{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}),lf=(function(h){function m(v){return i(this,m),v=Object.assign({},gd,v||{}),e(this,(m.__proto__||Object.getPrototypeOf(m)).call(this,m.configure(v)))}return t(m,h),Xn(m,[{key:"draw",value:function(){try{var v=this.canvas,C=[-v.drawX,-v.drawY,v.drawWidth,v.drawHeight],M=C[0],D=C[1],F=C[2],H=C[3],U=this.options;if(!v.elementClone.initialized){var $=v.contextClone;$.clearRect(M,D,F,H),this.emit("beforePlate"),this.drawBox=zg($,U,M,D,F,H),this.emit("beforeBar"),qg.apply(void 0,[$,U].concat(a(this.drawBox))),v.contextClone.barDimensions=$.barDimensions,this.emit("beforeHighlights"),$g($,U),this.emit("beforeMinorTicks"),Zg($,U),this.emit("beforeMajorTicks"),Yg($,U),this.emit("beforeNumbers"),Qg($,U),this.emit("beforeTitle"),Xg($,U),this.emit("beforeUnits"),Kg($,U),v.elementClone.initialized=!0}this.canvas.commit(),v.context.clearRect(M,D,F,H),v.context.drawImage(v.elementClone,M,D,F,H),this.emit("beforeProgressBar"),jg.apply(void 0,[v.context,U].concat(a(this.drawBox))),this.emit("beforeNeedle"),Jg(v.context,U),this.emit("beforeValueBox"),nf.apply(void 0,[v.context,U,U.animatedValue?this.options.value:this.value].concat(a(this.drawBox))),Ws(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"draw",this).call(this)}catch(re){fe.verifyError(re)}return this}}],[{key:"configure",value:function(v){return v.barStrokeWidth>=v.barWidth&&(v.barStrokeWidth=Re(v.barWidth/2)),v.hasLeft=dd("right",v),v.hasRight=dd("left",v),v.value>v.maxValue&&(v.value=v.maxValue),v.value<v.minValue&&(v.value=v.minValue),Wi.configure(v)}}]),m})(Wi);n!==void 0&&(n.LinearGauge=lf),Wi.initialize("LinearGauge",gd),typeof _s<"u"&&Object.assign(n,{Collection:s,GenericOptions:Gs,Animation:Fs,BaseGauge:Wi,drawings:fe,SmartCanvas:ki,DomObserver:ya,vendorize:o})})(typeof _s<"u"?_s.exports:window)});var ou=[{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 mt=(()=>{class n{_settings=A(Ot);_router=A(xc);_destroyRef=A(tt);dashboards=w([],{equal:fi});activeDashboard=w(null);_widgetAction=new Fi(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=ou.map(o=>ue(ne({},o),{id:gi.create()}));this.dashboards.set([...i])}else this.dashboards.set(e);this.applyDashboardParam(this.getRouteParam("id"),!1);let t=this._router.events.pipe(di(i=>i instanceof yc),Jo({bufferSize:1,refCount:!0}),Je(this._destroyRef));t.pipe(ci(1),Ht(()=>this.getRouteParam("id"))).subscribe(i=>this.applyDashboardParam(i,!0)),t.pipe(er(1),Ht(()=>this.getRouteParam("id")),Xo()).subscribe(i=>this.applyDashboardParam(i,!1)),V(()=>{let i=this.dashboards();W(()=>{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,o){let r=0;return this.dashboards.update(s=>{let c=[...s,{id:gi.create(),name:e,icon:i??"dashboard-dashboard",configuration:t,collapseSplitShell:o??!1}];return r=c.length-1,c}),r}update(e,t,i,o){this.dashboards.update(r=>r.map((s,c)=>c===e?ue(ne({},s),{name:t,icon:i??"dashboard-dashboard",collapseSplitShell:o??!1}):s))}delete(e){this.dashboards.update(t=>t.filter((i,o)=>o!==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,o){if(e<0||e>=this.dashboards().length)return console.error(`[Dashboard Service] Invalid itemIndex: ${e}`),-1;let r=this.dashboards()[e],s=Rt(r);s.id=gi.create(),s.name=t,s.icon=i||"dashboard-dashboard",s.collapseSplitShell=o??!1,Array.isArray(s.configuration)?s.configuration.forEach(p=>{p&&p.input?.widgetProperties?(p.id=gi.create(),p.input.widgetProperties.uuid=p.id):console.error("Dashboard Service] Widget configuration is missing required properties:",p)}):(console.error("Dashboard Service] Dashboard configuration is not an array:",s.configuration),s.configuration=[]);let c=-1;return this.dashboards.update(p=>{let f=[...p,s];return c=f.length-1,f}),c}updateConfiguration(e,t){let i=Rt(t??[]);this.dashboards.update(o=>o.map((r,s)=>s===e?fi(r.configuration,i)?r:ue(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:Rt(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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Or=(()=>{class n{http=A(ka);connection=A(xr);destroyRef=A(tt);historyServiceUrl=null;constructor(){this.connection.serverServiceEndpoint$.pipe(Je(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 Oe(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 vr;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 o=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${o}`);let r=yield xn(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 Oe(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 vr;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 o=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${o}`);let r=yield xn(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 Oe(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 vr;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 o=`${t}?${i.toString()}`;console.log(`[HistoryApiClientService] GET ${o}`);let r=yield xn(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 Oe(this,null,function*(){let e=`${this.historyServiceUrl}history/_providers`;return yield xn(this.http.get(e)),["kip"]})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Nr=(()=>{class n{mapValuesToChartDatapoints(e,t){let i=e?.data;if(!i||i.length===0)return[];let o=-1,r=-1;if(e.values&&Array.isArray(e.values)){for(let R=0;R<e.values.length;R++){let G=e.values[R]?.method,j=typeof G=="string"?G.toLowerCase():G;if(!j)continue;let K=R+1;j==="sma"?o=K:(j==="avg"||j==="average")&&(r=K)}r<0&&e.values.length===1&&(r=1)}else i[0]?.length>1&&(r=1);let s=t.unit==="rad",c=s?t.domain==="signed"?this.normalizeToSigned.bind(this):this.normalizeToDirection.bind(this):null,p=[],f=0,b=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,S=0,_=0,k=0,B=[];for(let R of i){if(!Array.isArray(R)||R.length===0)continue;let G=Date.parse(R[0]),j=o>=0?R[o]:null,K=r>=0?R[r]:null;if(s?(j=Number.isFinite(j)?c(j):null,K=Number.isFinite(K)?c(K):null):(j=Number.isFinite(j)?j:null,K=Number.isFinite(K)?K:null),Number.isFinite(K)){let Y=K;s?(B.push(Y),_+=Math.sin(Y),k+=Math.cos(Y)):(S++,f+=Y,Y<b&&(b=Y),Y>x&&(x=Y))}p.push({timestamp:G,data:{value:K,sma:j,ema:null,doubleEma:null,lastAverage:null,lastMinimum:null,lastMaximum:null}})}if(p.length>0){let R=null,G=null,j=null;if(s&&B.length>0){R=Math.atan2(_/B.length,k/B.length);let{min:K,max:Y}=this.circularMinMaxRad(B);t.domain==="signed"?(R=this.normalizeToSigned(R),G=this.normalizeToSigned(K),j=this.normalizeToSigned(Y)):(R=this.normalizeToDirection(R),G=this.normalizeToDirection(K),j=this.normalizeToDirection(Y))}else!s&&S>0&&(R=f/S,G=b,j=x);if(R!==null&&G!==null&&j!==null){let K=p[p.length-1];K.data.lastAverage=R,K.data.lastMinimum=G,K.data.lastMaximum=j}}return p}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,o=0;for(let r=0;r<t.length;r++){let s=(r+1)%t.length,c=(t[s]-t[r]+360)%360;c>i&&(i=c,o=s)}return{min:t[o]*Math.PI/180,max:t[(o-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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var tn=(()=>{class n{appSettings=A(Ot);data=A(Kt);history=A(Or);historyChartAdapter=A(Nr);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(c=>{c.configuration?.length&&c.configuration?.forEach(p=>{p?.id&&i.add(p.id)})});function o(c){let p=c.match(/^(windtrends|speedtrends)-(.+)$/);return p?p[2]:null}let r=[],s=[];for(let c of this._svcDatasetConfigs){let p=c.label||"",f=!1;if(p.startsWith("windtrends-")||p.startsWith("speedtrends-")){let b=o(p);f=!!(b&&i.has(b))}else(p.startsWith("simple-chart-")||(p.match(/\|/g)||[]).length===4)&&(f=i.has(c.uuid));f?s.push(c):r.push(c)}r.length&&(r.forEach(c=>{console.warn(`[DatasetStreamService] Cleaned dataset: uuid=${c.uuid}, label="${c.label}"`)}),this._svcDatasetConfigs=s,this.appSettings.saveDataSets(this._svcDatasetConfigs))}setupServiceSubjectRegistry(e,t){let i=this._svcSubjectObserverRegistry.findIndex(o=>o.datasetUuid==e);i>=0&&(this._svcSubjectObserverRegistry[i].rxjsSubject.complete(),this._svcSubjectObserverRegistry.splice(i,1)),this._svcSubjectObserverRegistry.push({datasetUuid:e,rxjsSubject:new Ad(t)})}createDataSourceConfiguration(e){let r={uuid:e.uuid,pathObserverSubscription:null,sampleTime:null,maxDataPoints:null,smoothingPeriod:null,historicalData:[]},s=p(e.timeScaleFormat,e.period),c=s>0?Math.max(100,Math.round(s/120)):1e3;return r.sampleTime=c,r.maxDataPoints=Math.max(1,Math.ceil(s/c)),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 p(f,b){switch(f){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,b)*24*60*6e4;case"hour":return Math.max(0,b)*60*6e4;case"minute":return Math.max(0,b)*6e4;case"second":return Math.max(0,b)*1e3;default:return 0}}}waitUntilReady(){return Oe(this,null,function*(){return this._startAllPromise})}startAll(){return Oe(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 Oe(this,null,function*(){let t=this._svcDatasetConfigs.find(b=>b.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 o=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(o,t,s,r));let c=this.data.subscribePath(t.path,t.pathSource).pipe(di(b=>b?.data?.value!==null),Jo({bufferSize:1,refCount:!0})),p=c.pipe(ci(1)),f=Jn(i.sampleTime,i.sampleTime).pipe(Pd(c,(b,x)=>x));o.pathObserverSubscription=li(p,f).subscribe(b=>{o.maxDataPoints>0&&o.historicalData.length>=o.maxDataPoints&&o.historicalData.shift(),o.historicalData.push(b.data.value);let x=this.updateDataset(o,t.baseUnit,r);this._svcSubjectObserverRegistry.find(S=>S.datasetUuid===o.uuid).rxjsSubject.next(x)})})}seedHistoryData(e,t,i,o){return Oe(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}})(),c=new Date,p={paths:r,from:new Date(c.getTime()-s).toISOString(),resolution:i},f=yield this.history.getValues(p);if(!f||!f.data||f.data.length===0){console.log(`[DatasetStreamService] No history data available for ${t.path}`);return}let b=this.convertHistoryToDatapoints(f,t.baseUnit,o),x=this._svcSubjectObserverRegistry.find(S=>S.datasetUuid===e.uuid)?.rxjsSubject;if(x&&b.length>0){let S=[];e.historicalData=[],b.forEach(_=>{let k=_.data.value;if(!Number.isFinite(k))return;e.maxDataPoints>0&&e.historicalData.length>=e.maxDataPoints&&e.historicalData.shift(),e.historicalData.push(k);let B=this.updateDataset(e,t.baseUnit,o);B.timestamp=_.timestamp,S.push(B)}),S.forEach(_=>x.next(_)),console.log(`[DatasetStreamService] Seeded ${S.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 Rt(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,o,r,s=!0,c=!0,p){if(!e||!t||!i||!o||!r)return null;let f=p||gi.create(),b={uuid:f,path:e,pathSource:t,baseUnit:this.data.getPathUnitType(e),timeScaleFormat:i,period:o,label:r,editable:c};return console.log(`[DatasetStreamService] Creating ${s?"":"non-"}persistent ${c?"":"hidden "}dataset: ${b.uuid}, Path: ${b.path}, Source: ${b.pathSource} Scale: ${b.timeScaleFormat}, Period: ${b.period}`),this._svcDatasetConfigs.push(b),this.start(f),s===!0&&this.appSettings.saveDataSets(this._svcDatasetConfigs),f}edit(e,t=!0){let i=this._svcDatasetConfigs.find(o=>o.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(o=>o.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(c=>c.datasetUuid==e);if(!t)return null;let i=t.rxjsSubject,o=i._buffer?i._buffer.slice():[],r=yd([o]),s=i.pipe(er(o.length));return Sd(r,s)}updateDataset(e,t,i="scalar"){let o=null,r=null,s=null,c=null;if(t==="rad"){o=this.circularMeanRad(e.historicalData);let x=e.historicalData.slice(-e.smoothingPeriod);r=this.circularMeanRad(x);let{min:S,max:_}=this.circularMinMaxRad(e.historicalData);i==="direction"?(o=this.normalizeToDirection(o),r=this.normalizeToDirection(r),s=this.normalizeToDirection(S),c=this.normalizeToDirection(_)):i==="signed"?(o=this.normalizeToSigned(o),r=this.normalizeToSigned(r),s=this.normalizeToSigned(S),c=this.normalizeToSigned(_)):(s=S,c=_)}else o=f(e.historicalData),r=b(e.historicalData,e.smoothingPeriod),s=Math.min(...e.historicalData),c=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:o,lastMinimum:s,lastMaximum:c}};function f(x){return x.length===0?null:x.reduce((_,k)=>_+k,0)/x.length}function b(x,S){x.length<S&&(S=x.length);let _=0;for(let k=x.length-S;k<x.length;k++)_+=x[k];return _/S}}circularMeanRad(e){if(e.length===0)return 0;let t=e.reduce((o,r)=>o+Math.sin(r),0),i=e.reduce((o,r)=>o+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(c=>(c*180/Math.PI+360)%360).sort((c,p)=>c-p),i=0,o=0;for(let c=0;c<t.length;c++){let p=(c+1)%t.length,f=(t[p]-t[c]+360)%360;f>i&&(i=f,o=p)}let r=t[o]*Math.PI/180,s=t[(o-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 o of this.signedAnglePaths)if(i===this.normalizePathKey(o))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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var ru=(()=>{class n{kipTimers={};constructor(){}createTimer(e,t,i){return e in this.kipTimers?this.kipTimers[e].currentValue.asObservable():(this.kipTimers[e]={currentValue:new Fi(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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var su=(()=>{class n{sanitizer=A(Ta);transform(e){return this.sanitizer.bypassSecurityTrustResourceUrl(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=dr({name:"safe",type:n,pure:!0})}return n})();var cf={minDist:230,maxDur:550,minVelocity:1.5,axisDominance:1.8,deadzoneMs:160,purityRatio:.8,lockThreshold:28,directionLockAngle:25,reversalPrimaryThreshold:34};function za(n){let a=ne(ne({},cf),n);return`(() => {
2
+ if (window.__kipSwipeInit) return; window.__kipSwipeInit = true;
3
+ const instanceId='${a.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=${a.minDist};
7
+ const maxDur=${a.maxDur};
8
+ const minVelocity=${a.minVelocity};
9
+ const axisDominance=${a.axisDominance};
10
+ const deadzoneMs=${a.deadzoneMs};
11
+ const purityRatio=${a.purityRatio};
12
+ const lockThreshold=${a.lockThreshold};
13
+ const directionLockAngle=${a.directionLockAngle};
14
+ const reversalPrimaryThreshold=${a.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 be=(()=>{class n{config=y();defaultConfig=w(void 0);runtimeConfig=rt();_runtimeConfig=w(void 0);lastBaseRef;lastUserRef;lastMergedRef;options=ie(()=>{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=fc(Rt(e),Rt(t)):e&&!t?i=Rt(e):!e&&t?i=Rt(t):i=void 0,this.lastBaseRef=e,this.lastUserRef=t,this.lastMergedRef=i,this.runtimeConfig.emit(i),i});firstPathKey=ie(()=>{let e=this.options();if(!e?.paths)return;let t=Object.keys(e.paths);return t.length?t[0]:void 0});constructor(){V(()=>{let e=this.config();W(()=>{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=Dt({type:n,selectors:[["","widget-runtime",""]],inputs:{config:[1,"config"]},outputs:{runtimeConfig:"runtimeConfig"},exportAs:["widgetRuntime"]})}return n})();var mf=["freeboardSkIframe"];function hf(n,a){if(n&1&&(Z(0,"iframe",1,0),lt(2,"safe")),n&2){let e=T();Ei("src",Pt(2,1,e.widgetUrl),ea)}}function pf(n,a){n&1&&Z(0,"div",4)}function gf(n,a){if(n&1&&(E(0,"div",2),Z(1,"iframe",3,0),lt(3,"safe"),O(4,pf,1,0,"div",4),P()),n&2){let e=T();g(),Ei("src",Pt(3,2,e.widgetUrl),ea),g(3),N(e.dashboard.isDashboardStatic()?-1:4)}}var lu=(()=>{class n{id=y();type=y();theme=y();disableWidgetShell=y(!1);swipeDisabled=y(!1);runtime=A(be,{optional:!0});appSettings=A(Ot);app=A(wi);auth=A(bc);dashboard=A(mt);iframe=ce.required("freeboardSkIframe");authToken=vi(this.auth.authToken$,{initialValue:null});viewReady=!1;iframeLoaded=!1;widgetUrl=null;static DEFAULT_CONFIG={};constructor(){window.addEventListener("message",this.handleIframeGesture),V(()=>{let e=this.authToken();W(()=>{let t=e?.token;this.widgetUrl=t?`${this.appSettings.signalkUrl.url}/@signalk/freeboard-sk/?token=${t}`:`${this.appSettings.signalkUrl.url}/@signalk/freeboard-sk/`})}),V(()=>{let e=this.app.isNightMode();W(()=>{!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 o=za({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=o,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 o=this.id();if(e.data.gesture&&e.data.eventData?.instanceId===o)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===o){let{key:r,ctrlKey:s,shiftKey:c}=e.data.keyEventData,p=new KeyboardEvent("keydown",{key:r,ctrlKey:s,shiftKey:c,bubbles:!0,cancelable:!0});document.dispatchEvent(p)}};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=q({type:n,selectors:[["widget-freeboardsk"]],viewQuery:function(t,i){t&1&&Ce(i.iframe,mf,5),t&2&&Se()},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&&O(0,hf,3,3,"iframe",1)(1,gf,5,4,"div",2),t&2&&N(i.disableWidgetShell()?0:1)},dependencies:[su],styles:[".widgetOverlay[_ngcontent-%COMP%]{position:absolute;width:100%;height:100%;right:0;bottom:0;color:transparent}"]})}return n})();var ff={1e3:"notification",1001:"alert",1002:"warn",1003:"alarm",1004:"emergency"},du=(()=>{class n{settings=A(Ot);toastService=A($i);audioBlockedNotificationShown=!1;data=A(Kt);requests=A(Jt);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 Fi(Hd);_notifications=[];_notifications$=new Fi([]);_alarmsInfo$=new Fi({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]=ue(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]=ue(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:c}=this.getNotificationSeverity(r);e=Math.max(e,s),t=Math.max(t,c)}this._notificationConfig.sound.disableSound||this.playAlarm(1e3+e);let o={audioSev:e,visualSev:t,alarmCount:i,isMuted:this._isMuted};fi(o,this._lastEmittedValue)||(this._alarmsInfo$.next(o),this._lastEmittedValue=o)}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||!fi(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]=ue(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 o=i.sound,r=i.visual;return(!e.value.method.includes($s.Sound)||this._notificationConfig.sound[`mute${t.charAt(0).toUpperCase()+t.slice(1)}`]||this._isMuted)&&(o=0),e.value.method.includes($s.Visual)||(r=0),{aSev:o,vSev:r}}setSkMethod(e,t){this.requests.putRequest(`${e}.method`,t,gi.create())}setSkState(e,t){this.requests.putRequest(`${e}.state`,t,gi.create())}observerNotificationsInfo(){return this._alarmsInfo$.pipe(Ht(e=>{let t=!1,i=!1;switch(e.visualSev){case 1:t=!0;break;case 2:i=!0;break}return ue(ne({},e),{isWarn:t,isAlarmEmergency:i})}))}getPlayer(e){let t=this._players.get(e);if(t)return t;let i=ff[e];if(!i)return console.warn("[Notification Service] Unknown track id",e),this.getPlayer(1e3);let o=new Audio(`assets/${i}.mp3`);return o.preload="auto",o.loop=!0,o.muted=this._isMuted,this._players.set(e,o),o}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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var Rr=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=y(30);swipeMaxDuration=y(600);longPressMs=y(500);doubleTapInterval=y(300);tapSlop=y(20);pressMoveSlop=y(10);mode=y("all");disableGestures=y(!1);enablePress=y(!0);enableDoubleTap=y(!0);bridgeUiEvents=y(!1);_swipeMinDistance=30;_swipeMaxDuration=600;_longPressMs=500;_doubleTapInterval=300;_tapSlop=20;_pressMoveSlop=10;swipeleft=rt();swiperight=rt();swipeup=rt();swipedown=rt();press=rt();doubletap=rt();zone=A(Be);destroyRef=A(tt);host=A(Ye);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=a=>{a.preventDefault()};lockedAxis=null;axisLockThreshold=6;captureEl=null;static MOVES_BUFFER_SIZE=120;moveSamples=[];constructor(){this.isChromeOnMac=(()=>{let a=navigator.userAgent,e=navigator.platform;return/Chrome\//.test(a)&&/Mac/.test(e)&&!/Edg\//.test(a)&&!/OPR\//.test(a)})(),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(a){}this.zone.runOutsideAngular(()=>{let a=this.host.nativeElement;a.style.touchAction||(a.style.touchAction="none","webkitTouchCallout"in a.style&&(a.style.webkitTouchCallout="none"),a.style.userSelect||(a.style.userSelect="none"),a.style.webkitUserSelect===""&&(a.style.webkitUserSelect="none"),a.style.webkitTapHighlightColor="transparent"),a.addEventListener("pointerdown",this.onPointerDown,{passive:!1,capture:!0}),a.addEventListener("pointermove",this.onPointerMove,{passive:!0,capture:!0}),a.addEventListener("pointerrawupdate",this.onPointerRawUpdate,{passive:!0,capture:!0}),a.addEventListener("pointerup",this.onPointerUp,{passive:!0}),a.addEventListener("pointercancel",this.onPointerCancel,{passive:!0,capture:!0}),a.addEventListener("lostpointercapture",this.onLostPointerCapture,{passive:!0,capture:!0}),a.addEventListener("dblclick",this.onNativeDblClick,{passive:!0});let e=i=>{let o=i;if(o.detail?.__gid===this._instanceId||this.disableGestures())return;let s=o.target,c=!!(s&&s!==this.host.nativeElement&&this.host.nativeElement.contains(s)),p=this.modeAllowsHorizontal(),f=this.modeAllowsVertical(),b=this.modeAllowsPress(),x=this.modeAllowsDoubleTap();if(c&&(o.type==="press"||o.type==="doubletap")&&(b=b||o.type==="press",x=x||o.type==="doubletap"),o.type==="press"||o.type==="doubletap"){let S=this.host.nativeElement,_=s&&typeof s.closest=="function"?s.closest(".widget-container"):null;_&&_!==S&&(b=!1,x=!1);let k=S.classList?.contains("grid-stack")||S.tagName?.toLowerCase()==="gridstack",B=s&&typeof s.closest=="function"?s.closest(".grid-stack-item"):null;k&&B&&(b=!1,x=!1,this.debug("suppress grid-root rebroadcast for press/doubletap inside grid-stack-item",{host:this.elDesc(S),target:this.elDesc(s??void 0),inGridItem:this.elDesc(B)}))}this.debug("rebroadcast gate",{type:o.type,allowH:p,allowV:f,allowP:b,allowDT:x,fromChild:c,target:this.elDesc(s??void 0),host:this.elDesc(this.host.nativeElement),mode:this.mode()}),this.zone.run(()=>{switch(o.type){case"press":b&&(this.debug("rebroadcast emit: press"),this.press.emit(o));break;case"doubletap":x&&(this.debug("rebroadcast emit: doubletap"),this.doubletap.emit(o));break;case"swipeleft":p&&(this.debug("rebroadcast emit: swipeleft"),this.swipeleft.emit(o));break;case"swiperight":p&&(this.debug("rebroadcast emit: swiperight"),this.swiperight.emit(o));break;case"swipeup":f&&(this.debug("rebroadcast emit: swipeup"),this.swipeup.emit(o));break;case"swipedown":f&&(this.debug("rebroadcast emit: swipedown"),this.swipedown.emit(o));break}})},t={passive:!0};a.addEventListener("press",e,t),a.addEventListener("doubletap",e,t),a.addEventListener("swipeleft",e,t),a.addEventListener("swiperight",e,t),a.addEventListener("swipeup",e,t),a.addEventListener("swipedown",e,t),a.addEventListener("contextmenu",this.onContextMenu,{passive:!1}),this.destroyRef.onDestroy(()=>{a.removeEventListener("pointerdown",this.onPointerDown,{capture:!0}),a.removeEventListener("pointermove",this.onPointerMove,{capture:!0}),a.removeEventListener("pointerrawupdate",this.onPointerRawUpdate,{capture:!0}),a.removeEventListener("pointerup",this.onPointerUp),a.removeEventListener("pointercancel",this.onPointerCancel,{capture:!0}),a.removeEventListener("lostpointercapture",this.onLostPointerCapture,{capture:!0}),a.removeEventListener("dblclick",this.onNativeDblClick),a.removeEventListener("press",e,t),a.removeEventListener("doubletap",e,t),a.removeEventListener("swipeleft",e,t),a.removeEventListener("swiperight",e,t),a.removeEventListener("swipeup",e,t),a.removeEventListener("swipedown",e,t),a.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,o=i.get(this.pointerId);o&&(this.debug("onDestroy: releasing lane ownership",{pointerId:this.pointerId,ownersBefore:o,ownedByThis:this.ownedLanes,instanceId:this._instanceId}),this.ownedLanes.h&&o.h===this._instanceId&&delete o.h,this.ownedLanes.v&&o.v===this._instanceId&&delete o.v,this.ownedLanes.p&&o.p===this._instanceId&&delete o.p,!o.h&&!o.v&&!o.p?i.delete(this.pointerId):i.set(this.pointerId,o),this.debug("onDestroy: lane owners after release",{pointerId:this.pointerId,owners:o}));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=a=>{if(this.disableGestures()||!this.modeAllowsDoubleTap())return;let e=new CustomEvent("doubletap",{detail:{x:a.clientX,y:a.clientY,dt:0}});this.zone.run(()=>this.doubletap.emit(e)),this.lastTapTime=0};onPointerDown=a=>{let e=this.constructor._activePointers,t=e.has(a.pointerId);t||e.add(a.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:a.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 o=performance.now(),r=this.constructor._suppressAllGesturesUntil;if(o<r){this.debug("pointerdown suppressed by global window after longpress",{now:Math.round(o),suppressUntil:Math.round(r),remainingMs:Math.round(r-o)});return}if(this.disableGestures()||(this.debug("pointerdown",{x:a.clientX,y:a.clientY,pointerId:a.pointerId,pointerType:a.pointerType,sourceElement:a.target instanceof Element?a.target.outerHTML:String(a.target)}),this.pointerId!==null))return;let s=this.modeAllowsHorizontal(),c=this.modeAllowsVertical(),p=this.modeAllowsPress(),f=this.modeAllowsDoubleTap();{let R=a.target,G=this.host.nativeElement,j=R&&typeof R.closest=="function"?R.closest(".widget-container"):null;j&&j!==G&&(p=!1,f=!1);let K=G.classList?.contains("grid-stack")||G.tagName?.toLowerCase()==="gridstack",Y=R&&typeof R.closest=="function"?R.closest(".grid-stack-item"):null;K&&Y&&(p=!1,f=!1,this.debug("suppress grid-root press/doubletap for event inside grid-stack-item",{host:this.elDesc(G),target:this.elDesc(R??void 0),inGridItem:this.elDesc(Y)}))}if(!s&&!c&&!p&&!f){this.debug("ignoring pointerdown: no gestures enabled for current mode");return}let b=p||f,x=this.constructor._laneOwners;!t&&x.has(a.pointerId)&&(this.debug("new pointer sequence; clearing stale lane owners",{pointerId:a.pointerId,prevOwners:x.get(a.pointerId)}),x.delete(a.pointerId));let S=x.get(a.pointerId)??{};if(S.p!==void 0){let R=S.p,G=this.constructor._instanceToEl.get(R),j=this.host.nativeElement,K=a.target??null,Y=this.ownerRelationshipSummary(G??null,j,K);this.debug("pre-acquire owners (press lane already owned)",{owners:S,ownerId:R,ownerEl:this.elDesc(G),hostEl:this.elDesc(j),targetEl:this.elDesc(K),rel:Y})}else this.debug("pre-acquire owners",{owners:S});if(this.ownedLanes={h:!1,v:!1,p:!1},s&&S.h===void 0&&(S.h=this._instanceId,this.ownedLanes.h=!0,this.debug("lane acquired",{lane:"horizontal",pointerId:a.pointerId,instanceId:this._instanceId,owners:S})),c&&S.v===void 0&&(S.v=this._instanceId,this.ownedLanes.v=!0,this.debug("lane acquired",{lane:"vertical",pointerId:a.pointerId,instanceId:this._instanceId,owners:S})),b&&S.p===void 0&&(S.p=this._instanceId,this.ownedLanes.p=!0,this.debug("lane acquired",{lane:"press",pointerId:a.pointerId,instanceId:this._instanceId,owners:S})),this.debug("lane acquisition",{allowH:s,allowV:c,allowPress:p,allowDT:f,wantP:b,acquired:this.ownedLanes,existingOwners:S}),!this.ownedLanes.h&&!this.ownedLanes.v&&!this.ownedLanes.p){if(b&&S.p!==void 0){let R=S.p,G=this.constructor._instanceToEl.get(R),j=this.host.nativeElement,K=a.target??null,Y=this.ownerRelationshipSummary(G??null,j,K);this.debug("ignoring pointerdown: press lane not owned",{owners:S,ownerId:R,ownerEl:this.elDesc(G),hostEl:this.elDesc(j),targetEl:this.elDesc(K),rel:Y})}else this.debug("ignoring pointerdown: other instance owns relevant lanes",{owners:S});return}switch(this.pointerId=a.pointerId,x.set(a.pointerId,S),this.tracking=!0,this.pressFired=!1,this.currentPointerType=a.pointerType||null,this.lockedAxis=null,this.captureEl=null,this.isDebugEnabled()&&(this.moveSamples=[{t:performance.now(),x:a.clientX,y:a.clientY,source:"move"}]),a.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:a.pointerType,swipeMinDistance:this._swipeMinDistance,swipeMaxDuration:this._swipeMaxDuration,longPressMs:this._longPressMs,doubleTapInterval:this._doubleTapInterval,tapSlop:this._tapSlop,pressMoveSlop:this._pressMoveSlop,axisLockThreshold:this.axisLockThreshold});let k=performance.now()-this.lastTapUpTime,B=Math.hypot(a.clientX-this.lastTapUpX,a.clientY-this.lastTapUpY);if(this.potentialDoubleTap=f&&k<=this._doubleTapInterval&&B<=this._tapSlop,this.startX=a.clientX,this.startY=a.clientY,this.startTime=performance.now(),a.pointerType!=="mouse"){let G=a.target??null??this.host.nativeElement;try{"setPointerCapture"in G?(G.setPointerCapture(a.pointerId),this.captureEl=G,this.debug("setPointerCapture success",{pointerId:a.pointerId,pointerType:a.pointerType,captureElement:this.elDesc(G)})):(this.captureEl=null,this.debug("setPointerCapture unavailable on element"))}catch(j){this.captureEl=null,this.debug("setPointerCapture failed",{pointerId:a.pointerId,pointerType:a.pointerType})}}if(this.longPressTimer&&(this.debug("longpress timer cleared on pointerdown"),window.clearTimeout(this.longPressTimer)),!this.potentialDoubleTap&&p&&this.ownedLanes.p){if(this.currentPointerType!=="mouse")try{a.preventDefault()}catch(R){}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 R=a.clientX-this.startX,G=a.clientY-this.startY;if(Math.abs(R)<=this._pressMoveSlop&&Math.abs(G)<=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 j={x:this.startX,y:this.startY,center:{x:this.startX,y:this.startY}};this.zone.run(()=>this.emitPressEvent(j)),this.reset()}this.longPressTimer=null,this.removeLongpressCancelListeners()},this._longPressMs)}else this.debug("longpress not scheduled",{potentialDoubleTap:this.potentialDoubleTap,allowPress:p,ownedPressLane:this.ownedLanes.p,reason:this.potentialDoubleTap?"awaiting doubletap":p?this.ownedLanes.p?"unknown":"press lane not owned":"press disabled by mode/flag",ownersForPointer:S})};onLostPointerCapture=a=>{if(a.pointerId===this.pointerId){if(this.currentPointerType!=="mouse"&&this.longPressTimer){this.debug("ignore lostpointercapture during active touch/pen long-press");return}this.onPointerCancel(a)}};suppressNextClick(a=500){this.debug("suppressNextClick (Firefox)",{timeoutMs:a});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 c=s;typeof c.stopImmediatePropagation=="function"&&c.stopImmediatePropagation()},o=()=>{t.forEach(s=>document.removeEventListener(s,i,e)),window.clearTimeout(r)};t.forEach(s=>document.addEventListener(s,i,e));let r=window.setTimeout(o,a)}onPointerMove=a=>this.handlePointerMotion(a,"move");onPointerRawUpdate=a=>this.handlePointerMotion(a,"raw");handlePointerMotion(a,e){if(!(!this.tracking||a.pointerId!==this.pointerId)){if(this.constructor._multiPointerActive){this.debug("multi-pointer block active; cancelling motion",{pointerId:a.pointerId,source:e}),this.reset(!0);return}if(!this.pressFired){if(this.recordMove(a,e),this.longPressTimer){let t=Math.abs(a.clientX-this.startX),i=Math.abs(a.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=a.clientX-this.startX,i=a.clientY-this.startY,o=Math.abs(t),r=Math.abs(i);(o>=this.axisLockThreshold||r>=this.axisLockThreshold)&&(this.lockedAxis=o>=r?"x":"y",this.debug(`axis locked${e==="raw"?" (raw)":""}`,{axis:this.lockedAxis,dx:t,dy:i}))}}}}onPointerUp=a=>{if(this.debug("pointerup",{x:a.clientX,y:a.clientY,pointerId:a.pointerId}),!this.tracking||a.pointerId!==this.pointerId){this.cleanupActivePointer(a.pointerId);return}this.finishGesture(a,!1)};onPointerCancel=a=>{let e=this.host.nativeElement;if(this.debug("pointercancel",{pointerId:a.pointerId,pointerType:a.pointerType,event:a,documentActiveElement:document.activeElement,elementIsConnected:e.isConnected,elementVisibility:e.offsetParent!==null,hasPointerCapture:typeof e.hasPointerCapture=="function"?e.hasPointerCapture(a.pointerId):void 0,documentHidden:document.hidden}),!this.tracking||a.pointerId!==this.pointerId){this.cleanupActivePointer(a.pointerId);return}this.finishGesture(a,!0)};finishGesture(a,e){if(this.debug("finishGesture begin",{cancelled:e,hasTimer:!!this.longPressTimer,pressFired:this.pressFired,ownedLanes:this.ownedLanes}),this.cleanupActivePointer(a.pointerId),this.constructor._multiPointerActive){this.debug("multi-pointer block active; ignoring finishGesture",{pointerId:a.pointerId}),this.reset(!0);return}let t=performance.now(),i=t-this.startTime,o=a.clientX-this.startX,r=a.clientY-this.startY,s=Math.abs(o),c=Math.abs(r);if(this.longPressTimer&&(this.debug(`longpress cancelled by ${e?"pointercancel":"pointerup"}`,{durationMs:Math.round(i),absDx:s,absDy:c,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 f=this.modeAllowsHorizontal(),b=this.modeAllowsVertical(),x=f&&this.ownedLanes.h&&(this.lockedAxis==="x"&&s>=this._swipeMinDistance||!this.lockedAxis&&s>=this._swipeMinDistance&&s>=c),S=b&&this.ownedLanes.v&&(this.lockedAxis==="y"&&c>=this._swipeMinDistance||!this.lockedAxis&&c>=this._swipeMinDistance&&c>s);if(this.debug("swipe gating",{allowH:f,allowV:b,owned:this.ownedLanes,lockedAxis:this.lockedAxis,horizontalOk:x,verticalOk:S}),x){this.debugSwipeDecision({phase:"recognized",axis:"x",dx:o,dy:r,absDx:s,absDy:c,duration:i,reason:e?"horizontal swipe (on cancel)":"horizontal swipe"}),this.debug("swipe detected",{direction:o>0?"right":"left",dx:o,dy:r,duration:i}),this.zone.run(()=>{o>0?this.emitSwipeEvent("swiperight",{dx:o,dy:r,duration:i}):this.emitSwipeEvent("swipeleft",{dx:o,dy:r,duration:i})}),this.reset();return}else if(S){this.debugSwipeDecision({phase:"recognized",axis:"y",dx:o,dy:r,absDx:s,absDy:c,duration:i,reason:e?"vertical swipe (on cancel)":"vertical swipe"}),this.debug("swipe detected",{direction:r>0?"down":"up",dx:o,dy:r,duration:i}),this.zone.run(()=>{r>0?this.emitSwipeEvent("swipedown",{dx:o,dy:r,duration:i}):this.emitSwipeEvent("swipeup",{dx:o,dy:r,duration:i})}),this.reset();return}if(!e){let _=this.lockedAxis??(s>=c?"x":"y"),k=_==="x"?s:c,B=[];k<this._swipeMinDistance&&B.push(`distance ${Math.round(k)}px < min ${this._swipeMinDistance}px`),!this.lockedAxis&&(_==="x"&&c>s||_==="y"&&s>c)&&B.push("orthogonal movement dominated"),this.debugSwipeDecision({phase:"rejected",axis:_,dx:o,dy:r,absDx:s,absDy:c,duration:i,reason:B.join("; ")||"fell through conditions"})}}else e||this.debugSwipeDecision({phase:"rejected",axis:this.lockedAxis??(s>=c?"x":"y"),dx:o,dy:r,absDx:s,absDy:c,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&&c<=this._tapSlop&&i<this._longPressMs){let f=t,b=f-this.lastTapTime,x=Math.hypot(a.clientX-this.lastTapX,a.clientY-this.lastTapY);b<=this._doubleTapInterval&&x<=this._tapSlop?(this.zone.run(()=>this.emitDoubleTapEvent({x:a.clientX,y:a.clientY,dt:b})),this.lastTapTime=0,this.potentialDoubleTap=!1):(this.lastTapTime=f,this.lastTapX=a.clientX,this.lastTapY=a.clientY)}!e&&!this.pressFired&&s<=this._tapSlop&&c<=this._tapSlop&&i<this._longPressMs?(this.lastTapUpTime=t,this.lastTapUpX=a.clientX,this.lastTapUpY=a.clientY):this.potentialDoubleTap=!1,this.reset()}addLongpressCancelListeners(){this.debug("addLongpressCancelListeners");let a=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},o=[{type:"pointercancel",handler:a,opts:i,targets:["el","doc"]}];this.currentPointerType!=="mouse"&&o.push({type:"blur",handler:a,opts:i,targets:["window"]}),this.cancelLongpressHandlers=o;for(let r of this.cancelLongpressHandlers){let{type:s,handler:c,opts:p,targets:f}=r;f&&f.includes("el")&&e.addEventListener(s,c,p),f&&f.includes("doc")&&t.addEventListener(s,c,p),f&&f.includes("window")&&window.addEventListener(s,c,p)}}removeLongpressCancelListeners(){this.debug("removeLongpressCancelListeners");let a=this.host.nativeElement,e=document;for(let t of this.cancelLongpressHandlers){let{type:i,handler:o,opts:r,targets:s}=t;s&&s.includes("el")&&a.removeEventListener(i,o,r),s&&s.includes("doc")&&e.removeEventListener(i,o,r),s&&s.includes("window")&&window.removeEventListener(i,o,r)}this.cancelLongpressHandlers=[]}reset(a=!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&&!a&&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(a){return this.constructor.DEBUG}}recordMove(a,e){this.isDebugEnabled()&&(this.moveSamples.push({t:performance.now(),x:a.clientX,y:a.clientY,source:e}),this.moveSamples.length>this.constructor.MOVES_BUFFER_SIZE&&this.moveSamples.shift())}debugSwipeDecision(a){if(!this.isDebugEnabled())return;let e=this.moveSamples,t=e[e.length-1],i;if(e.length>=2){let o=t?.t??performance.now(),r=100,s=e.length-2;for(;s>=0&&o-e[s].t<r;)s--;s=Math.max(0,s);let c=e[s],p=Math.max(1,(t?.t??o)-c.t),f=(t?.x??0)-c.x,b=(t?.y??0)-c.y;i=(a.axis==="x"?Math.abs(f):Math.abs(b))/p}this.debug("swipe decision",{phase:a.phase,axis:a.axis,dx:a.dx,dy:a.dy,absDx:a.absDx,absDy:a.absDy,durationMs:Math.round(a.duration),velocityAvgPxPerMs:a.velocity??(a.axis==="x"?a.absDx:a.absDy)/Math.max(1,a.duration),recentVelocity100msPxPerMs:i,minDistance:this._swipeMinDistance,maxDuration:this._swipeMaxDuration,lockedAxis:this.lockedAxis,reason:a.reason,samplesCount:e.length,firstSample:e[0],lastSample:e[e.length-1]})}debug(...a){this.isDebugEnabled()&&console.debug(`[GestureDirective][#${this._instanceId}]`,...a)}cleanupActivePointer(a){try{let e=this.constructor._activePointers;e.delete(a)&&this.debug("activePointers delete",{pointerId:a,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(a,e){e.__gid=this._instanceId;let t=new CustomEvent(a,{detail:e,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(t)}catch(i){}if(this.debug("emitSwipeEvent",{name:a,detail:e}),this.bridgeUiEvents()&&(a==="swipeleft"||a==="swiperight"))try{let i=a==="swipeleft"?"openLeftSidenav":"openRightSidenav";document.dispatchEvent(new CustomEvent(i,{detail:e}))}catch(i){}switch(a){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(a){let e=performance.now();if(e-this._lastPressEmitTs<80){this.debug("press emit suppressed by cooldown");return}this._lastPressEmitTs=e,a.__gid=this._instanceId;let t=new CustomEvent("press",{detail:a,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(t)}catch(i){}this.debug("emitPressEvent",{detail:a}),this.press.emit(t)}emitDoubleTapEvent(a){a.__gid=this._instanceId;let e=new CustomEvent("doubletap",{detail:a,bubbles:!0,composed:!0});try{this.host.nativeElement.dispatchEvent(e)}catch(t){}this.doubletap.emit(e)}modeAllowsHorizontal(){let a=this.mode();return this.disableGestures()?!1:a==="all"||a==="horizontal"}modeAllowsVertical(){let a=this.mode();return this.disableGestures()?!1:a==="all"||a==="dashboard"}modeAllowsPress(){let a=this.mode();return this.disableGestures()?!1:(a==="all"||a==="dashboard"||a==="press"||a==="editor")&&this.enablePress()}modeAllowsDoubleTap(){let a=this.mode();return this.disableGestures()?!1:(a==="all"||a==="dashboard"||a==="press"||a==="editor")&&this.enableDoubleTap()}elDesc(a){if(!a)return null;try{let e=a,t=a.tagName?.toLowerCase?.()??"node",i=e.id?`#${e.id}`:"",o=e.className&&typeof e.className=="string"?e.className:"",r=o?"."+o.split(/\s+/).filter(Boolean).slice(0,4).join("."):"";return`${t}${i}${r}`}catch(e){return"node"}}ownerRelationshipSummary(a,e,t){try{return{owner:this.elDesc(a),host:this.elDesc(e),target:this.elDesc(t),ownerIsConnected:a?a.isConnected:null,hostIsConnected:e.isConnected,targetIsConnected:t?t.isConnected:null,targetInOwner:a&&t?a.contains(t):null,targetInHost:t?e.contains(t):null,ownerInHost:a?e.contains(a):null,hostInOwner:a?a.contains(e):null}}catch(i){return{}}}static \u0275fac=function(e){return new(e||n)};static \u0275dir=Dt({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"&&(Rr.DEBUG=!0);let a=window;a.kipGesturesDebug=e=>{let t=Rr;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 Ha=(()=>{class n{dataset=A(tn);syncDataChartDataset(e,t,i){let o=typeof t?.datachartPath=="string"?t.datachartPath.trim():"";if(!o)return;let r=typeof t?.datachartSource=="string"&&t.datachartSource.trim().length>0?t.datachartSource.trim():"default",s=t?.timeScale,c=Number(t?.period??0),p=i??"";this.upsertDataset({uuid:e,path:o,source:r,timeScale:s,period:c,label:p,serialize:!0,editable:!1})}syncNumericMiniChartDataset(e,t,i){let o=typeof t=="string"?t.trim():"";if(!o)return;let r=typeof i=="string"&&i.trim().length>0?i.trim():"default";this.upsertDataset({uuid:e,path:o,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 o=ue(ne({},t),{path:e.path,pathSource:e.source,timeScaleFormat:e.timeScale,period:e.period,label:e.label,editable:e.editable});this.dataset.edit(o,e.serialize)}static \u0275fac=function(t){return new(t||n)};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();var cu=(()=>{class n{_storage=A(Ac);_settings=A(Ot);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 Oe(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 o=yield this.transformConfig(i);if(o)try{yield this._storage.setConfig(o.scope,o.name,o.newConfiguration),yield this._storage.setConfig(o.scope,o.name,o.oldConfiguration,this.legacyFileVersion),this.pushMsg(`[Upgrade] Configuration ${o.scope}/${o.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 o=yield this._storage.getConfig(i.scope,i.name,11),r=Rt(o);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(o);if(!s)continue;this.pushMsg("[Upgrade] Saving upgraded configurations..."),yield this._storage.setConfig(i.scope,i.name,s)}catch(o){this.pushError(`[Upgrade] Error upgrading ${i.scope}/${i.name}: ${o.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),o=this.extractAppDatasets(i),r=this.transformTheme(t.theme),s=t.layout?.rootSplits||[],c=t.layout?.splitSets||[],p=t.widget?.widgets||[],f=s.map((b,x)=>{let S=this.extractWidgetsFromSplitSets(c,p,b);return{id:b,name:`Dashboard ${x+1}`,configuration:S}});this.migrateDatasetsToDataCharts(o,f),this.migrateUseNeedleToEnableNeedle(f),localStorage.setItem("appConfig",JSON.stringify(i)),localStorage.setItem("dashboardsConfig",JSON.stringify(f)),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=>Oe(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(o){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(o){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 Oe(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),o=this.extractAppDatasets(i),r=this.transformTheme(t.theme),s=t.layout?.rootSplits||[],c=t.layout?.splitSets||[],p=t.widget?.widgets||[],f=s.map((x,S)=>{let _=this.extractWidgetsFromSplitSets(c,p,x);return{id:x,name:`Dashboard ${S+1}`,configuration:_}});this.migrateDatasetsToDataCharts(o,f),this.migrateUseNeedleToEnableNeedle(f);let b=Rt(t);return b.app.configVersion=0,{scope:e.scope,name:e.name,newConfiguration:{app:i,theme:r,dashboards:f},oldConfiguration:b}})}extractAppDatasets(e){if(!e||!Array.isArray(e.dataSets))return[];let t=0,i=[],o=[];e.dataSets.forEach((r,s)=>{(r.editable===!0||r.editable===void 0)&&(o.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).`),o}migrateDatasetsToDataCharts(e,t){!Array.isArray(e)||e.length===0||Array.isArray(t)&&t.forEach(i=>{let o=0;i&&Array.isArray(i.configuration)&&(i.configuration.forEach(r=>{if(r&&typeof r=="object"&&r.input?.widgetProperties?.config){let s=e.find(c=>c.datasetUUID===r.input?.widgetProperties?.config.datasetUUID);s&&(Object.entries(s).forEach(([c,p])=>{c!=="datasetUUID"&&(r.input.widgetProperties.config[c]=p)}),delete r.input.widgetProperties.config?.datasetUUID,delete r.input.widgetProperties.config?.timeScaleFormat,o++)}}),o&&this.pushMsg(`[Upgrade] Migrated ${o} 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=Rt(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,o=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 c=p=>{let f=s[p],b=typeof f=="string"?Number(f):f;Number.isFinite(b)&&b!==0&&(s[p]=b*2,o++)};if(c("w"),c("h"),c("x"),c("y"),s.w===void 0||s.w===null){let p=s.minW,f=p||2;s.w=f,o++}if(s.h===void 0||s.h===null){let p=s.minH,f=p||2;s.h=f,o++}}}}return i&&this.pushMsg(`[Upgrade] Updated ${i} widget selector(s) to 'widget-host2'.`),o&&this.pushMsg(`[Upgrade] Doubled widget grid metrics for ${o} 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 o of i.configuration){let c=o.input?.widgetProperties?.config?.gauge;!c||typeof c!="object"||Object.prototype.hasOwnProperty.call(c,"useNeedle")&&(c.enableNeedle===void 0?c.enableNeedle=!!c.useNeedle:c.enableNeedle=!!c.enableNeedle,delete c.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 o of e)if(!(!o||!Array.isArray(o.configuration)))for(let r of o.configuration){if(!r||typeof r!="object")continue;r.selector!=="widget-host2"&&(r.selector="widget-host2",t++);let s=c=>{let p=r[c],f=typeof p=="string"?Number(p):p;Number.isFinite(f)&&f!==0&&(r[c]=f*2,i++)};if(s("w"),s("h"),s("x"),s("y"),r.w===void 0||r.w===null){let c=r.minW,p=typeof c=="string"?Number(c):c,f=Number.isFinite(p)&&p>0?p:2;r.w=f*2,i++}if(r.h===void 0||r.h===null){let c=r.minH,p=typeof c=="string"?Number(c):c,f=Number.isFinite(p)&&p>0?p:2;r.h=f*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 o=new Map(t.map(k=>[k.uuid,k])),r=[],s=[],c=0,p=0,f=24,b=24,x=3,S=3,_=k=>{let B=e.find(R=>R.uuid===k);if(!B){s.push(`Missing splitSet with UUID: ${k}`);return}B.splitAreas.forEach(R=>{if(R.type==="widget"){let G=o.get(R.uuid);if(G){if(G.type==="WidgetBlank")return;if(p+S>b){s.push(`No space left for widget: ${G.uuid}`);return}let j=n.widgetTypeToSelectorMap[G.type]||"widget-unknown",K=this.transformWidget(G.config,G.type);r.push({id:G.uuid,selector:"widget-host2",input:{widgetProperties:{type:j,uuid:G.uuid,config:K}},x:c,y:p,w:x,h:S}),c+=x,c>=f&&(c=0,p+=S)}else s.push(`Missing widget with UUID: ${R.uuid}`)}else R.type==="splitSet"&&_(R.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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function vf(n,a){if(n&1&&L(0,"img",3),n&2){let e=T();Q("src",e.data.iconHref,rr)}}function bf(n,a){n&1&&cr(0)}var Js=(()=>{class n{data=A(Qt);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"div",0)(1,"div",1)(2,"h5",2),O(3,vf,1,1,"img",3),d(4),u()(),l(5,"button",4)(6,"mat-icon"),d(7,"close"),u()()(),l(8,"mat-dialog-content",5),ui(9,bf,1,0,"ng-container",6),u()),t&2&&(g(3),N(i.data.iconHref?3:-1),g(),he(" ",i.data.title),g(),I("mat-dialog-close",!1),g(4),I("ngComponentOutlet",i.data.componentType))},dependencies:[Qe,Wt,bi,Ai,yi,nt,It,Ud],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 Af(n,a){if(n&1&&(l(0,"button",4),d(1),u()),n&2){let e=T();I("mat-dialog-close",!0),g(),X(e.data.confirmBtnText)}}var uu=(()=>{class n{data=A(Qt);static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"div",0)(1,"h5",1),d(2),u(),l(3,"button",2)(4,"mat-icon"),d(5,"close"),u()()(),l(6,"mat-dialog-content"),d(7),u(),l(8,"mat-dialog-actions",3)(9,"button",4),d(10),u(),O(11,Af,2,2,"button",4),u()),t&2&&(g(2),X(i.data.title),g(),I("mat-dialog-close",!1),g(4),he(" ",i.data.message,`
41
+ `),g(2),I("mat-dialog-close",!1),g(),X(i.data.cancelBtnText),g(),N(i.data.confirmBtnText?11:-1))},dependencies:[Qe,Wt,bi,Ai,Mn,yi,nt,At,It],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 yf(n,a){if(n&1&&(l(0,"button",9),d(1),u()),n&2){let e=T(),t=Tt(1);I("disabled",!t.valid),g(),X(e.data.confirmBtnText)}}var mu=(()=>{class n{dialogRef=A(Yi);data=A(Qt);saveName(){this.dialogRef.close(this.data)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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 o=xe();l(0,"form",1,0),z("ngSubmit",function(){return i.saveName()}),l(2,"div",2)(3,"h5",3),d(4),u(),l(5,"button",4)(6,"mat-icon"),d(7,"close"),u()()(),l(8,"mat-dialog-content")(9,"mat-form-field",5)(10,"mat-label"),d(11,"Name"),u(),l(12,"input",6),sn("ngModelChange",function(s){return J(o),rn(i.data.name,s)||(i.data.name=s),ee(s)}),u(),l(13,"mat-error"),d(14," A name is required "),u()()(),l(15,"mat-dialog-actions",7)(16,"button",8),d(17),u(),O(18,yf,2,2,"button",9),u()()}t&2&&(g(4),X(i.data.title),g(),I("mat-dialog-close",!1),g(7),on("ngModel",i.data.name),g(4),I("mat-dialog-close",!1),g(),X(i.data.cancelBtnText),g(),N(i.data.confirmBtnText?18:-1))},dependencies:[Wt,bi,Ai,Mn,yi,at,Qe,xi,Mt,_t,Dn,Ci,kt,nt,At,It,St,Ea,yt,dt,Nt,Ct,kn,wr],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 xf(n,a){n&1&&(l(0,"mat-option",19),d(1,"Toggle"),u(),l(2,"mat-option",20),d(3,"Push"),u(),l(4,"mat-option",21),d(5,"Indicator"),u())}function Cf(n,a){n&1&&(l(0,"mat-option",8),d(1,"Zone State"),u())}function Sf(n,a){if(n&1&&(l(0,"mat-option",10),d(1),u()),n&2){let e=a.$implicit;I("value",Di(e.value)),g(),X(e.label)}}function wf(n,a){n&1&&(l(0,"mat-checkbox",12),d(1," Use numeric path "),u())}function _f(n,a){if(n&1){let e=xe();l(0,"button",22),z("click",function(){J(e);let i=T();return ee(i.moveCtrlUp())}),l(1,"mat-icon"),d(2,"arrow_drop_up"),u()()}}function Mf(n,a){if(n&1){let e=xe();l(0,"button",23),z("click",function(){J(e);let i=T();return ee(i.moveCtrlDown())}),l(1,"mat-icon"),d(2,"arrow_drop_down"),u()()}}var hu=(()=>{class n{app=A(wi);ctrlFormGroup=y.required();controlIndex=y(void 0);arrayLength=y(void 0);deleteCtrl=rt();moveUp=rt();moveDown=rt();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=q({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&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"mat-form-field",3)(4,"mat-label"),d(5,"Label"),u(),L(6,"input",4),u()(),l(7,"div",5)(8,"mat-form-field",6)(9,"mat-label"),d(10,"Type"),u(),l(11,"mat-select",7),O(12,xf,6,0)(13,Cf,2,0,"mat-option",8),u()()(),l(14,"div",5)(15,"mat-form-field",6)(16,"mat-label"),d(17,"Color"),u(),l(18,"mat-select",9),Ae(19,Sf,2,3,"mat-option",10,Le),u()()(),l(21,"div",11),O(22,wf,2,0,"mat-checkbox",12),u()(),l(23,"div",13)(24,"div",14)(25,"div",15),O(26,_f,3,0,"button",16),O(27,Mf,3,0,"button",17),l(28,"button",18),z("click",function(){return i.deleteControl()}),l(29,"mat-icon"),d(30,"delete"),u()()()()()()),t&2&&(I("formGroup",i.ctrlFormGroup()),g(12),N(i.ctrlFormGroup().value.type!=="4"?12:13),g(7),ye(i.colors),g(3),N(i.ctrlFormGroup().value.type!=="4"?22:-1),g(4),N(i.controlIndex()!==0?26:-1),g(),N(i.controlIndex()!==i.arrayLength()-1?27:-1))},dependencies:[St,yt,dt,Nt,Ct,wt,xt,Xi,Mt,_t,kt,Si,Gt,It,Xt,Bt,at,Qe],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 kf(n,a){if(n&1){let e=xe();l(0,"boolean-control-config",4),z("moveUp",function(i){J(e);let o=T();return ee(o.moveUp(i))})("moveDown",function(i){J(e);let o=T();return ee(o.moveDown(i))})("deleteCtrl",function(i){J(e);let o=T();return ee(o.deletePath(i))}),u()}if(n&2){let e=a.$implicit,t=a.$index,i=T();I("ctrlFormGroup",i.getFormGroup(e))("controlIndex",t)("arrayLength",i.arrayLength)}}var pu=(()=>{class n{fb=A(En);multiCtrlArray=y.required();zonesOnlyPaths=y.required();addPath=rt();updatePath=rt();delPath=rt();multiFormGroup=null;arrayLength=0;multiCtrlArraySubscription=null;ngOnInit(){this.arrayLength=this.multiCtrlArray().length,this.multiFormGroup=new Mc({multiCtrlArray:this.multiCtrlArray()}),this.multiCtrlArraySubscription=this.multiCtrlArray().valueChanges.pipe(Cn(350)).subscribe(e=>{this.updatePath.emit(e)})}addCtrlGroup(){let e=gi.create();this.multiCtrlArray().push(this.fb.group({ctrlLabel:[null,Ft.required],type:[this.zonesOnlyPaths()?"4":"1",Ft.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=q({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&&(l(0,"div",0)(1,"div",1),Ae(2,kf,1,3,"boolean-control-config",2,zi),l(4,"button",3),z("click",function(){return i.addCtrlGroup()}),l(5,"mat-icon"),d(6,"add"),u()()()()),t&2&&(I("formGroup",i.multiFormGroup),g(2),ye(i.multiCtrlArray().controls))},dependencies:[St,Nt,wt,xt,Dc,hu,nt,yr,at,Qe],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 Tf(n,a){if(n&1&&(l(0,"mat-option",8),d(1),u()),n&2){let e=a.$implicit;I("value",Di(e.value)),g(),X(e.label)}}var gu=(()=>{class n{app=A(wi);displayName=y.required();showLabel=y.required();convertUnitTo=y.required();datasetUUID=y.required();datasetAverageArray=y.required();showAverageData=y.required();showDataPoints=y.required();trackAgainstAverage=y.required();showDatasetMinimumValueLine=y.required();showDatasetMaximumValueLine=y.required();showDatasetAverageValueLine=y.required();showDatasetAngleAverageValueLine=y.required();verticalChart=y.required();inverseYAxis=y.required();showTimeScale=y.required();showYScale=y.required();startScaleAtZero=y.required();yScaleSuggestedMin=y.required();yScaleSuggestedMax=y.required();enableMinMaxScaleLimit=y.required();yScaleMin=y.required();yScaleMax=y.required();numDecimal=y.required();color=y.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=q({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&&(l(0,"div",1)(1,"div",2)(2,"div",3)(3,"mat-form-field",4)(4,"mat-label"),d(5,"Widget Label"),u(),L(6,"input",5),u()(),l(7,"div",3)(8,"mat-checkbox",6),d(9," Show Label "),u()()(),l(10,"div",2)(11,"mat-form-field",4)(12,"mat-label"),d(13,"Color"),u(),l(14,"mat-select",7),Ae(15,Tf,2,3,"mat-option",8,Le),u()()(),l(17,"div",2)(18,"div",9)(19,"p"),d(20,"Series"),u(),l(21,"mat-form-field",10)(22,"mat-label"),d(23,"Value Decimal Places"),u(),L(24,"input",11),u(),l(25,"mat-checkbox",12),d(26," Display Data Points "),u(),l(27,"mat-checkbox",13),z("change",function(r){return i.enableTrackAgainstMovingAverage(r)}),d(28," Display Moving Average "),u(),l(29,"mat-checkbox",14),d(30," Track Against Moving Average "),u(),l(31,"mat-checkbox",15),d(32," Vertical Data Graph "),u()(),l(33,"div",9)(34,"div")(35,"p",16),d(36,"Data Scale"),u(),l(37,"span",17),d(38,"(Default node is automatic scale)"),u(),l(39,"mat-radio-group",18)(40,"mat-radio-button",19),z("change",function(r){return i.setScaleControls(r)}),d(41,"Auto Scale"),u(),l(42,"div",20)(43,"mat-form-field",21)(44,"mat-label"),d(45,"Suggested Min"),u(),L(46,"input",22),u(),l(47,"mat-form-field",21)(48,"mat-label"),d(49,"Suggested Max"),u(),L(50,"input",23),u()(),l(51,"mat-radio-button",19),z("change",function(r){return i.setScaleControls(r)}),d(52," Fixed Scale "),u(),l(53,"div",20)(54,"div",24)(55,"mat-form-field",21)(56,"mat-label"),d(57,"Min"),u(),L(58,"input",25),u()(),l(59,"div",24)(60,"mat-form-field",21)(61,"mat-label"),d(62,"Max"),u(),L(63,"input",26),u()()()(),l(64,"mat-checkbox",27),d(65," Show Scale Ticks "),u(),l(66,"mat-checkbox",28),d(67," Inverse Scale "),u()()(),l(68,"div",9)(69,"div")(70,"p",16),d(71,"Time Scale"),u(),l(72,"mat-checkbox",29),d(73," Show Scale Ticks "),u()()(),l(74,"div",9)(75,"div")(76,"p",16),d(77,"Dataset"),u(),l(78,"mat-checkbox",30),d(79," Show Maximum Line "),u(),l(80,"mat-checkbox",31),d(81," Show Average Line "),u(),l(82,"mat-checkbox",32,0),d(84," Show Minimum Line "),u()()()()()),t&2&&(g(6),I("formControl",i.displayName()),g(2),I("formControl",i.showLabel()),g(6),I("formControl",i.color()),g(),ye(i.colors),g(9),I("formControl",i.numDecimal()),g(),I("formControl",i.showDataPoints()),g(2),I("formControl",i.showAverageData()),g(2),I("formControl",i.trackAgainstAverage()),g(2),I("formControl",i.verticalChart()),g(8),I("formControl",i.enableMinMaxScaleLimit()),g(),I("value",!1),g(6),I("formControl",i.yScaleSuggestedMin()),g(4),I("formControl",i.yScaleSuggestedMax()),g(),I("value",!0),g(7),I("formControl",i.yScaleMin()),g(5),I("formControl",i.yScaleMax()),g(),I("formControl",i.showYScale()),g(2),I("formControl",i.inverseYAxis()),g(6),I("formControl",i.showTimeScale()),g(6),I("formControl",i.showDatasetMaximumValueLine()),g(2),I("formControl",i.showDatasetAverageValueLine()),g(2),I("formControl",i.showDatasetMinimumValueLine()))},dependencies:[_r,xi,Mt,_t,Xt,Bt,In,Si,Gt,fo,Ci,kt,zc,Bc,Uc,wt,yt,Zi,dt,Ct,Tn,Da,Qi],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 Df=["panel"],Pf=["*"];function If(n,a){if(n&1&&(E(0,"div",1,0),mr(2),P()),n&2){let e=a.id,t=T();Ke(t._classList),it("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"),Ei("id",t.id),Q("aria-label",t.ariaLabel||null)("aria-labelledby",t._getPanelAriaLabelledby(e))}}var el=class{source;option;constructor(a,e){this.source=a,this.option=e}},fu=new an("mat-autocomplete-default-options",{providedIn:"root",factory:()=>({autoActiveFirstOption:!1,autoSelectActiveOption:!1,hideSingleSelectionIndicator:!1,requireSelection:!1,hasBackdrop:!1})}),ja=(()=>{class n{_changeDetectorRef=A(pi);_elementRef=A(Ye);_defaults=A(fu);_animationsDisabled=ji();_activeOptionChanges=xa.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 Zt;opened=new Zt;closed=new Zt;optionActivated=new Zt;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=A(na).getId("mat-autocomplete-");inertGroups;constructor(){let e=A($d);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 Jd(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 el(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=q({type:n,selectors:[["mat-autocomplete"]],contentQueries:function(t,i,o){if(t&1&&hr(o,Gt,5)(o,Rc,5),t&2){let r;mi(r=hi())&&(i.options=r),mi(r=hi())&&(i.optionGroups=r)}},viewQuery:function(t,i){if(t&1&&Sn(Rd,7)(Df,5),t&2){let o;mi(o=hi())&&(i.template=o.first),mi(o=hi())&&(i.panel=o.first)}},hostAttrs:[1,"mat-mdc-autocomplete"],inputs:{ariaLabel:[0,"aria-label","ariaLabel"],ariaLabelledby:[0,"aria-labelledby","ariaLabelledby"],displayWith:"displayWith",autoActiveFirstOption:[2,"autoActiveFirstOption","autoActiveFirstOption",pt],autoSelectActiveOption:[2,"autoSelectActiveOption","autoSelectActiveOption",pt],requireSelection:[2,"requireSelection","requireSelection",pt],panelWidth:"panelWidth",disableRipple:[2,"disableRipple","disableRipple",pt],classList:[0,"class","classList"],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",pt]},outputs:{optionSelected:"optionSelected",opened:"opened",closed:"closed",optionActivated:"optionActivated"},exportAs:["matAutocomplete"],features:[po([{provide:Nc,useExisting:n}])],ngContentSelectors:Pf,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&&(ur(),Vd(0,If,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 Of={provide:Sr,useExisting:ar(()=>sa),multi:!0};var Nf=new an("mat-autocomplete-scroll-strategy",{providedIn:"root",factory:()=>{let n=A(uo);return()=>cc(n)}}),sa=(()=>{class n{_environmentInjector=A(Id);_element=A(Ye);_injector=A(uo);_viewContainerRef=A(lr);_zone=A(Be);_changeDetectorRef=A(pi);_dir=A(Ar,{optional:!0});_formField=A(Ic,{optional:!0,host:!0});_viewportRuler=A(sc);_scrollStrategy=A(Nf);_renderer=A(sr);_animationsDisabled=ji();_defaults=A(fu,{optional:!0});_overlayRef=null;_portal;_componentDestroyed=!1;_initialized=new Yt;_keydownSubscription;_outsideClickSubscription;_cleanupWindowBlur;_previousValue=null;_valueOnAttach=null;_valueOnLastKeydown=null;_positionStrategy;_manuallyFloatingLabel=!1;_closingActionsSubscription;_viewportSubscription=xa.EMPTY;_breakpointObserver=A(Ma);_handsetLandscapeSubscription=xa.EMPTY;_canOpenOnNextFocus=!0;_valueBeforeAutoSelection;_pendingAutoselectedOption=null;_closeKeyEventStream=new Yt;_overlayPanelClass=Qd(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&&br(this._trackedModal,"aria-owns",this.autocomplete.id))}updatePosition(){this._overlayAttached&&this._overlayRef.updatePosition()}get panelClosingActions(){return li(this.optionSelections,this.autocomplete._keyManager.tabOut.pipe(di(()=>this._overlayAttached)),this._closeKeyEventStream,this._getOutsideClickStream(),this._overlayRef?this._overlayRef.detachments().pipe(di(()=>this._overlayAttached)):Hs()).pipe(Ht(e=>e instanceof Lc?e:null))}optionSelections=wd(()=>{let e=this.autocomplete?this.autocomplete.options:null;return e?e.changes.pipe(Ca(e),tr(()=>li(...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 zs(e=>{let t=o=>{let r=jd(o),s=this._formField?this._formField.getConnectedOverlayOrigin().nativeElement:null,c=this.connectedTo?this.connectedTo.elementRef.nativeElement:null;this._overlayAttached&&r!==this._element.nativeElement&&!this._hasFocus()&&(!s||!s.contains(r))&&(!c||!c.contains(r))&&this._overlayRef&&!this._overlayRef.overlayElement.contains(r)&&e.next(o)},i=[this._renderer.listen("document","click",t),this._renderer.listen("document","auxclick",t),this._renderer.listen("document","touchend",t)];return()=>{i.forEach(o=>o())}})}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,o=wn(t);if(i===27&&!o&&t.preventDefault(),this._valueOnLastKeydown=this._element.nativeElement.value,this.activeOption&&i===13&&this.panelOpen&&!o)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&&!o&&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 o=this.autocomplete.options?.find(r=>r.selected);if(o){let r=this._getDisplayValue(o.value);i!==r&&o.deselect(!1)}}if(this._canOpen()&&this._hasFocus()){let o=this._valueOnLastKeydown??this._element.nativeElement.value;this._valueOnLastKeydown=null,this._openPanelInternal(o)}}}_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 qd()===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 zs(i=>{Nd(()=>{i.next()},{injector:this._environmentInjector})}),t=this.autocomplete.options?.changes.pipe(nr(()=>this._positionStrategy.reapplyLastPosition()),kd(0))??Hs();return li(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})),ci(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;js(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 ac(this.autocomplete.template,this._viewContainerRef,{id:this._formField?.getLabelId()}),t=pc(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(Pi.HandsetLandscape).subscribe(o=>{o.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&&!wn(e)||e.keyCode===38&&wn(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 uc({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=mc(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,o=[{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=o:this.position==="below"?r=t:r=[...t,...o],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=Vc(e,t.options,t.optionGroups);if(e===0&&i===1)t._setScrollTop(0);else if(t.panel){let o=t.options.toArray()[e];if(o){let r=o._getHostElement(),s=Wc(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&&br(this._trackedModal,"aria-owns",t),js(e,"aria-owns",t),this._trackedModal=e}_clearFromModal(){if(this._trackedModal){let e=this.autocomplete.id;br(this._trackedModal,"aria-owns",e),this._trackedModal=null}}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Dt({type:n,selectors:[["input","matAutocomplete",""],["textarea","matAutocomplete",""]],hostAttrs:[1,"mat-mdc-autocomplete-trigger"],hostVars:7,hostBindings:function(t,i){t&1&&z("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&&Q("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",pt]},exportAs:["matAutocompleteTrigger"],features:[po([Of]),Bi]})}return n})(),Gr=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ui({type:n});static \u0275inj=Gi({imports:[gc,fo,lc,fo,_n]})}return n})();var Rf=(n,a)=>a.path;function Lf(n,a){if(n&1){let e=xe();l(0,"button",24),z("click",function(){J(e);let i=T();return ee(i.clearPathInputField())}),l(1,"mat-icon"),d(2,"close"),u()()}}function Vf(n,a){n&1&&(l(0,"mat-error"),d(1," Path is required. Please enter a valid Signal K path. "),u())}function Wf(n,a){n&1&&(l(0,"mat-error"),d(1," Path not recognized. Please enter a path from the server's published list. "),u())}function Ff(n,a){if(n&1&&(l(0,"span"),d(1),u(),L(2,"br"),l(3,"small",25),d(4),u()),n&2){let e=T().$implicit;g(),X(e.path),g(3),X(e.meta.description)}}function Gf(n,a){if(n&1&&d(0),n&2){let e=T().$implicit;he(" ",e.path," ")}}function Bf(n,a){if(n&1&&(l(0,"mat-option",8),O(1,Ff,5,2)(2,Gf,1,1),u()),n&2){let e=a.$implicit;I("value",e.path),g(),N(e.meta!==void 0?1:2)}}function Uf(n,a){if(n&1&&(l(0,"mat-option",12),d(1),u()),n&2){let e=a.$implicit;I("value",e),g(),he(" ",e," ")}}function zf(n,a){if(n&1&&(l(0,"mat-option",12),d(1),u()),n&2){let e=a.$implicit;I("value",e.measure),g(),he(" ",e.description," ")}}function Hf(n,a){if(n&1&&(l(0,"mat-optgroup",14),Ae(1,zf,2,2,"mat-option",12,Le),u()),n&2){let e=a.$implicit;I("label",e.group),g(),ye(e.units)}}function qf(n){return a=>{let e=a.parent?.value?.pathRequired!==!1,t=a.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 bu=(()=>{class n{convertUnitTo=y.required();filterSelfPaths=y.required();datachartPath=y.required();datachartSource=y.required();timeScale=y.required();period=y.required();data=A(Kt);units=A(ot);_destroyRef=A(tt);numericPaths=w([]);filteredNumericPaths=w([]);unitList=w({});pathSources=w([]);maxDuration=ie(()=>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(Cn(300),Je(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([qf(()=>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=q({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&&(l(0,"div",2)(1,"div",3)(2,"mat-form-field",4)(3,"mat-label"),d(4," Signal K Path "),u(),L(5,"input",5,0),O(7,Lf,3,0,"button",6),O(8,Vf,2,0,"mat-error")(9,Wf,2,0,"mat-error"),l(10,"mat-autocomplete",7,1),z("optionSelected",function(r){return i.changePath(r)}),Ae(12,Bf,3,2,"mat-option",8,Rf),u()()(),l(14,"div",3)(15,"mat-checkbox",9),d(16," Restrict to own vessel "),u()(),l(17,"div",3)(18,"div",10)(19,"mat-form-field",4)(20,"mat-label"),d(21,"Source"),u(),l(22,"mat-select",11),Ae(23,Uf,2,2,"mat-option",12,zi),u()()(),l(25,"div",10)(26,"mat-form-field",4)(27,"mat-label"),d(28,"Display Format"),u(),l(29,"mat-select",13),Ae(30,Hf,3,1,"mat-optgroup",14,Le),u()()()(),L(32,"br"),l(33,"p",15),d(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(),l(35,"div",3)(36,"div",10)(37,"mat-form-field",4)(38,"mat-label"),d(39,"Time Scale"),u(),l(40,"mat-select",16)(41,"mat-option",17),d(42,"Days"),u(),l(43,"mat-option",18),d(44,"Hours"),u(),l(45,"mat-option",19),d(46,"Minutes"),u(),l(47,"mat-option",20),d(48,"Seconds"),u()()()(),l(49,"div",10)(50,"mat-form-field",4)(51,"mat-label"),d(52,"Duration"),u(),L(53,"input",21),u()(),l(54,"div",22)(55,"strong"),d(56,"History API:"),u(),d(57," When the time scale is minutes or longer, the Data Chart can be pre-filled with historical data. "),l(58,"a",23),d(59,"Learn more"),u()()()()),t&2){let o=Tt(6),r=Tt(11);g(5),I("formControl",i.datachartPath())("matAutocomplete",r),g(2),N(o.value?7:-1),g(),N(o.validity.valueMissing?8:i.datachartPath().errors?9:-1),g(4),ye(i.filteredNumericPaths()),g(3),I("formControl",i.filterSelfPaths()),g(7),I("formControl",i.datachartSource()),g(),ye(i.pathSources()),g(6),I("formControl",i.convertUnitTo()),g(),ye(i.unitList().conversions),g(10),I("formControl",i.timeScale()),g(13),I("max",i.maxDuration())("formControl",i.period())}},dependencies:[at,Qe,Gr,ja,Gt,Oa,sa,Xt,Bt,xi,Mt,_t,Dn,Pn,In,Si,Ci,kt,nt,It,wt,yt,Zi,dt,Ct,Tn,Da,Qi,Cr],styles:[".display-content[_ngcontent-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:10px}"]})}return n})();var Au=(()=>{class n{transform(e){return Object.keys(e)}static \u0275fac=function(t){return new(t||n)};static \u0275pipe=dr({name:"objectKeys",type:n,pure:!0})}return n})();var jf=(n,a)=>a.path;function $f(n,a){n&1&&L(0,"i",18)}function Yf(n,a){n&1&&L(0,"i",19)}function Zf(n,a){if(n&1&&(l(0,"mat-option",16),d(1),u()),n&2){let e=a.$implicit;I("value",e),g(),Vt("",e.properties.quantity,": ",e.properties.display)}}function Qf(n,a){if(n&1){let e=xe();l(0,"div",5)(1,"mat-form-field",17)(2,"mat-label"),O(3,$f,1,0,"i",18)(4,Yf,1,0,"i",19),d(5," Filter"),u(),l(6,"mat-select",20,2),z("selectionChange",function(){J(e),T();let i=Tt(11),o=T();return ee(o.pathFormGroup().controls.path.setValue(i.value))}),l(8,"mat-option"),d(9,"All"),u(),Ae(10,Zf,2,3,"mat-option",16,Le),u()()()}if(n&2){let e=Tt(7),t=T(2);g(3),N(e.value?4:3),g(3),I("formControl",t.pathSkUnitsFilterControl),g(4),ye(t.pathSkUnitsFiltersList)}}function Xf(n,a){n&1&&(l(0,"span",8),d(1,"(optional)"),u())}function Kf(n,a){n&1&&(l(0,"mat-hint"),d(1,"Leave blank to disable this path."),u())}function Jf(n,a){if(n&1){let e=xe();l(0,"button",21),z("click",function(){J(e);let i=T(2);return ee(i.pathFormGroup().controls.path.setValue(""))}),l(1,"mat-icon"),d(2,"close"),u()()}}function e0(n,a){n&1&&(l(0,"mat-error"),d(1," Path is required. Please enter a valid Signal K path. "),u())}function t0(n,a){n&1&&(l(0,"mat-error"),d(1," Path not recognized. Please enter a path from the server's published list. "),u())}function i0(n,a){if(n&1&&(l(0,"span"),d(1),u(),L(2,"br"),l(3,"small",22),d(4),u()),n&2){let e=T().$implicit;g(),X(e.path),g(3),X(e.meta.description)}}function n0(n,a){if(n&1&&d(0),n&2){let e=T().$implicit;he(" ",e.path," ")}}function a0(n,a){if(n&1&&(l(0,"mat-option",11),O(1,i0,5,2)(2,n0,1,1),u()),n&2){let e=a.$implicit;I("value",e.path),g(),N(e.meta!==void 0?1:2)}}function o0(n,a){if(n&1&&(l(0,"mat-option",16),d(1),u()),n&2){let e=a.$implicit;I("value",e),g(),he(" ",e," ")}}function r0(n,a){if(n&1&&(l(0,"mat-option",16),d(1),u()),n&2){let e=a.$implicit;I("value",e.measure),g(),he(" ",e.description," ")}}function s0(n,a){if(n&1&&(l(0,"mat-optgroup",28),Ae(1,r0,2,2,"mat-option",16,Le),u()),n&2){let e=a.$implicit;I("label",e.group),g(),ye(e.units)}}function l0(n,a){if(n&1&&(l(0,"mat-form-field",26)(1,"mat-label"),d(2,"Display Format"),u(),l(3,"mat-select",27),Ae(4,s0,3,1,"mat-optgroup",28,Le),u()()),n&2){let e=T(3);g(4),ye(e.unitList.conversions)}}function d0(n,a){if(n&1&&(l(0,"div",23)(1,"mat-form-field",14)(2,"mat-label"),d(3,"Sample Time"),u(),L(4,"input",24),u()(),l(5,"div",25),O(6,l0,6,0,"mat-form-field",26),u()),n&2){let e=T(2);g(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 c0(n,a){if(n&1&&(l(0,"div",3)(1,"div",4)(2,"span"),d(3),u()(),O(4,Qf,12,2,"div",5),l(5,"div",6)(6,"mat-form-field",7)(7,"mat-label"),d(8," Signal K Path "),O(9,Xf,2,0,"span",8),u(),L(10,"input",9,0),O(12,Kf,2,0,"mat-hint"),O(13,Jf,3,0,"button",10),O(14,e0,2,0,"mat-error")(15,t0,2,0,"mat-error"),l(16,"mat-autocomplete",null,1),Ae(18,a0,3,2,"mat-option",11,jf),lt(20,"async"),u()()(),l(21,"div",12)(22,"div",13)(23,"mat-form-field",14)(24,"mat-label"),d(25,"Data Source"),u(),l(26,"mat-select",15),Ae(27,o0,2,2,"mat-option",16,Le),u()()(),O(29,d0,7,1),u()()),n&2){let e,t=Tt(17),i=T();I("formGroup",i.pathFormGroup()),g(2),pe("color",i.pathFormGroup().enabled?"":"rgba(255,255,255,0.5)"),g(),X(i.pathFormGroup().value.description),g(),N(i.pathFormGroup().value.pathType==="number"&&i.showPathSkUnitsFilter?4:-1),g(5),N(i.pathFormGroup().value.pathRequired===!1?9:-1),g(),I("matAutocomplete",t),g(2),N(i.pathFormGroup().value.pathRequired===!1?12:-1),g(),N(i.pathFormGroup().value.path?13:-1),g(),N((e=i.pathFormGroup().controls.path.errors)!=null&&e.required?14:(e=i.pathFormGroup().controls.path.errors)!=null&&e.requireMatch?15:-1),g(4),ye(Pt(20,11,i.filteredPaths)),g(9),ye(i.availableSources),g(2),N(i.pathFormGroup().value.zonesOnlyPaths?-1:29)}}function u0(n){return a=>{let e=a.parent?.value?.pathRequired!==!1,t=a.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 yu=(()=>{class n{_data=A(Kt);_units=A(ot);_connection=A(xr);_destroyRef=A(tt);pathFormGroup=y.required();multiCTRLArray=y.required();filterSelfPaths=y.required();availablePaths;filteredPaths=new Fi(null);availableSources;unitList={base:"",conversions:[]};showPathSkUnitsFilter=!1;pathSkUnitsFilterControl=new Tc(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([u0(()=>this.getPaths())]),e.controls.path.updateValueAndValidity({onlySelf:!0,emitEvent:!1}),e.controls.pathRequired&&e.controls.pathRequired.valueChanges.pipe(Je(this._destroyRef)).subscribe(()=>{this.pathFormGroup().controls.path.updateValueAndValidity()}),e.controls.path.valid?this.enableFormFields(!1):this.disablePathFields(),e.controls.sampleTime||(e.addControl("sampleTime",new bt("500",Ft.required)),e.controls.sampleTime.updateValueAndValidity({onlySelf:!0,emitEvent:!1})),e.controls.path.valueChanges.pipe(_d(t=>t===""?Jn(0):Jn(350)),Ca(""),Ht(t=>this.filterPaths(t||""))).pipe(Je(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(Je(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,o=this.pathFormGroup();if(o.value.supportsPut){let s=!1;this.multiCTRLArray().length>0&&(s=this.multiCTRLArray().some(c=>c.pathID===this.pathFormGroup().value.pathID&&c.type==="3")),s?i=!1:i=vc(this._connection.skServerVersion,"2.12.0",">=")?o.value.supportsPut:!1}let r=o.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 o=this.pathSkUnitsFilterControl.value.unit;i=i.filter(r=>{let s=!!r.meta&&!!r.meta.units,c=o==="unitless";return s&&r.meta.units===o||!s&&c})}i=i.filter(o=>o.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 o=t.parent.parent.get("displayScale"),r=t.controls.convertUnitTo.value;i.displayScale.lower!==null&&i.displayScale.lower!==void 0&&o.controls.lower.setValue(this._units.convertToUnit(r,i.displayScale.lower)),i.displayScale.upper!==null&&i.displayScale.upper!==void 0&&o.controls.upper.setValue(this._units.convertToUnit(r,i.displayScale.upper)),i.displayScale.type!==null&&i.displayScale.type!==void 0&&o.controls.type.setValue(i.displayScale.type),i.displayScale.power!==null&&i.displayScale.power!==void 0&&o.controls.power.setValue(i.displayScale.power)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["path-control-config"]],inputs:{pathFormGroup:[1,"pathFormGroup"],multiCTRLArray:[1,"multiCTRLArray"],filterSelfPaths:[1,"filterSelfPaths"]},features:[Bi],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&&O(0,c0,30,13,"div",3),t&2&&N(i.pathFormGroup().value.isPathConfigurable?0:-1)},dependencies:[St,yt,Zi,dt,Nt,Ct,wt,Qi,xt,Xi,Mt,_t,kt,Gr,ja,Gt,Oa,sa,It,Pn,Dn,Si,at,Qe,Pc,gr],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 m0(n,a){if(n&1&&L(0,"path-control-config",6),n&2){let e=a.$implicit,t=T(2);I("pathFormGroup",e)("filterSelfPaths",t.filterSelfPaths().value)("multiCTRLArray",t.multiCTRLArray)}}function h0(n,a){if(n&1&&Ae(0,m0,1,3,"path-control-config",6,Le),n&2){let e=T();ye(e.pathsFormGroup.controls)}}function p0(n,a){if(n&1&&L(0,"path-control-config",6),n&2){let e=a.$implicit,t=T(2);I("pathFormGroup",t.pathsFormGroup.get(e))("filterSelfPaths",t.filterSelfPaths().value)("multiCTRLArray",t.multiCTRLArray)}}function g0(n,a){if(n&1&&(Ae(0,p0,1,3,"path-control-config",6,Le),lt(2,"objectKeys")),n&2){let e=T();ye(Pt(2,0,e.pathsFormGroup.controls))}}var xu=(()=>{class n{rootFormGroup=A(xt);fb=A(En);formGroupName=y.required();isArray=y.required();enableTimeout=y.required();dataTimeout=y.required();filterSelfPaths=y.required();addPathEvent=y(void 0);delPathEvent=y(void 0);updatePathEvent=y(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,Ft.required],pathID:[e.path.pathID],source:[e.path.source,Ft.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=q({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:[Bi],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&&(l(0,"div",0)(1,"mat-checkbox",1),d(2," Enable Widget Data TTL "),u(),l(3,"mat-form-field")(4,"mat-label"),d(5,"TTL Timeout For Paths"),u(),L(6,"input",2),l(7,"span",3),d(8,"Seconds"),u()()(),Hi(9,4),O(10,h0,2,0)(11,g0,3,2),qi(),l(12,"mat-checkbox",5),d(13,` Restrict to own vessel
43
+ `),u()),t&2&&(g(),I("formControl",i.enableTimeout()),g(5),I("formControl",i.dataTimeout()),g(3),I("formGroup",i.pathsFormGroup),g(),N(i.isArray()?10:11),g(2),I("formControl",i.filterSelfPaths()))},dependencies:[Bt,St,yt,Zi,dt,Nt,Ct,Tn,wt,Qi,xt,Mt,_t,kt,Pn,yu,Au],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;padding-top:15px;padding-bottom:5px}"]})}return n})();function f0(n,a){if(n&1){let e=xe();l(0,"button",7),z("click",function(){J(e);let i=T();return ee(i.dateTimezone().setValue(""))}),L(1,"span",8),u()}}function v0(n,a){if(n&1&&(l(0,"mat-option",6),d(1),u()),n&2){let e=a.$implicit;I("value",e.label),g(),Vt(" ",e.offset," - ",e.label," ")}}function b0(n){return a=>n.some(t=>t.label===a.value)?null:{requireMatch:!0}}var A0=()=>{let n=Intl.supportedValuesOf("timeZone"),a=new Date;return n.map(e=>({offset:new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"}).formatToParts(a).find(r=>r.type==="timeZoneName")?.value||"",label:e}))},Cu=(()=>{class n{_destroyRef=A(tt);dateFormat=y(void 0);dateTimezone=y(void 0);tz=[];filteredTZ;filteredTZSubscription=null;constructor(){}ngOnInit(){typeof Intl.supportedValuesOf<"u"?this.tz=A0().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([Ft.required,b0(this.tz)]),this.filteredTZ=this.dateTimezone().valueChanges.pipe(Cn(500),Ca(""),Ht(e=>this.filterTZ(e||""))),this.filteredTZSubscription=this.filteredTZ.pipe(Je(this._destroyRef)).subscribe()}filterTZ(e){let t=e.toLowerCase();return this.tz.filter(i=>i.label.toLowerCase().includes(t))}compareOffsets(e,t){let i=o=>{let r=o.match(/([+-]?)(\d+)(?::(\d+))?/);if(!r)return 0;let s=r[1]==="-"?-1:1,c=parseInt(r[2],10),p=r[3]?parseInt(r[3],10):0;return s*(c*60+p)};return i(e)-i(t)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"div",1)(1,"mat-form-field",2)(2,"mat-label"),d(3,"Date & Time Format"),u(),L(4,"input",3),u(),l(5,"mat-form-field",2)(6,"mat-label"),d(7,"Adjust Value to Time Zone"),u(),L(8,"input",4),O(9,f0,2,0,"button",5),l(10,"mat-autocomplete",null,0),Ae(12,v0,2,3,"mat-option",6,zi),lt(14,"async"),u()()()),t&2){let o=Tt(11);g(4),I("formControl",i.dateFormat()),g(4),I("formControl",i.dateTimezone())("matAutocomplete",o),g(),N(i.dateTimezone().value?9:-1),g(3),ye(Pt(14,4,i.filteredTZ))}},dependencies:[Mt,_t,kt,St,yt,dt,Ct,wt,Qi,sa,It,Pn,ja,Gt,gr],encapsulation:2})}return n})();function y0(n,a){if(n&1&&(l(0,"mat-option",6),d(1),lt(2,"titlecase"),u()),n&2){let e=a.$implicit;I("value",Di(e)),g(),X(Pt(2,3,e))}}var nl={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"},Su={options:{modes:[],states:[]},state:null,mode:"off-line",target:null,engaged:!1},wu=(()=>{class n{formGroupName=y.required();_pluginConfig=A(Mr);_destroyRef=A(tt);http=A(ka);rootFormGroup=A(xt);autopilotFormGroup;apiVersion=w(null);availableAutopilots=w({});autopilotPlugin=w(null);discoveryInProgress=w(!1);apiDetectionError=w(null);apInstances=ie(()=>{let e=this.availableAutopilots();return e?Object.keys(e):[]});modes=w(null);pluginId=w(null);currentRequests=new Set;constructor(){V(()=>{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 Oe(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(nl.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 Oe(this,null,function*(){try{let e=yield xn(this.makeHttpRequest(this.http.get(nl.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 Oe(this,null,function*(){let t;try{try{this.discoveryInProgress.set(!0),t=yield xn(this.makeHttpRequest(this.http.get(`${nl.V2_AUTOPILOTS}/${e}`))),console.log("[Autopilot Options] V2 Autopilot Options response:",JSON.stringify(t))}catch(i){t=Su,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}'`),Su}})}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 o=i.options.modes||[];this.modes.set(o.join(", ")),this.autopilotFormGroup.get("modes")?.setValue(o,{emitEvent:!1}),console.log("[Autopilot Options] Autopilot plugin supported modes :",o.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(Je(this._destroyRef));return this.currentRequests.add(t),t.pipe(Ko(()=>this.currentRequests.delete(t)))}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),d(4,"Signal K Service Discovery"),u(),l(5,"ul")(6,"li")(7,"b"),d(8,"API Version:"),u(),d(9),u(),l(10,"li")(11,"b"),d(12,"Plugin:"),u(),d(13),u()()(),l(14,"mat-form-field")(15,"mat-label"),d(16,"Target Autopilot"),u(),l(17,"mat-select",4),z("selectionChange",function(r){return i.onAutopilotInstanceIdChange(r)}),l(18,"mat-option",5),d(19,"No autopilot"),u(),Ae(20,y0,3,5,"mat-option",6,Le),u()(),l(22,"div",7)(23,"b"),d(24,"Supported modes:"),u(),d(25),u(),l(26,"mat-checkbox",8),d(27," Display True Heading "),u(),l(28,"mat-checkbox",9),d(29," Invert Rudder Angle Indicator "),u()()()),t&2&&(g(),I("formGroup",i.autopilotFormGroup),g(8),he(" ",i.apiVersion()),g(4),he(" ",i.pluginId()),g(7),ye(i.apInstances()),g(5),he(" ",i.modes()," "))},dependencies:[wt,dt,Nt,Ct,xt,Xi,xi,Mt,_t,Xt,Bt,In,Si,Gt,Ci,wa],styles:[".autopilot-options[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px}"]})}return n})();var _u={fill:"#b1b1b1",stroke:"#50505f"},x0=24,C0=1.6,S0="#e6e6e6",w0=.15,_0=1,M0=1,ol=15e3,Ur=25e3,k0=.9,T0=1.25;function Mu(n){let a=n.baseSizePx??x0,e=n.unconfirmedFill??S0,t=n.unconfirmedOpacity??w0,i=n.targetState==="confirmed",o=i?E0(n.collisionRiskRating):"none",r=a,s,c,p,f,b,x,S;return i||(s=e,p=t,f=t),i&&n.isStationary&&(p=0),n.targetKind==="moving"&&o!=="none"?(x=o==="high"?"red":"yellow",S=k0,{fill:s,stroke:c,auraColor:x,auraOpacity:S,fillOpacity:p,strokeOpacity:f,strokeWidth:b,sizePx:Math.round(a*T0)}):{fill:s,stroke:c,auraColor:x,auraOpacity:S,fillOpacity:p,strokeOpacity:f,strokeWidth:b,sizePx:r}}function ku(n,a){let e=P0(n,a),t=D0(n,a.sizePx),i=a.auraColor?R0(t):t;return V0(i,N0(e))}function rl(n){return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(n).replace(/%0A/g,"").replace(/%0D/g,"")}`}function E0(n){return typeof n!="number"||!Number.isFinite(n)?"none":n<ol?"high":n<Ur?"low":"none"}function D0(n,a){let e=`${a}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 P0(n,a){let e=I0(n);return{fill:Gn(a.fill,e.fill,_u.fill),stroke:Gn(a.stroke,e.stroke,_u.stroke),strokeDasharray:Gn(a.strokeStyle,e.strokeStyle,"solid"),auraColor:Gn(a.auraColor,e.auraColor,"transparent"),auraOpacity:Gn(a.auraOpacity,e.auraOpacity,0),strokeWidth:Gn(a.strokeWidth,e.strokeWidth,C0),fillOpacity:Gn(a.fillOpacity,e.fillOpacity,_0),strokeOpacity:Gn(a.strokeOpacity,e.strokeOpacity,M0)}}function I0(n){return{fill:So(n,"--icon-fill"),stroke:So(n,"--icon-stroke"),strokeStyle:So(n,"--icon-stroke-dasharray"),auraColor:So(n,"--icon-aura-color"),auraOpacity:Br(n,"--icon-aura-opacity"),strokeWidth:Br(n,"--icon-stroke-width"),fillOpacity:Br(n,"--icon-fill-opacity"),strokeOpacity:Br(n,"--icon-stroke-opacity")}}function So(n,a){let e=n.match(new RegExp(`${O0(a)}:\\s*([^;]+);`,"i"));return e?e[1].trim():void 0}function Br(n,a){let e=So(n,a);if(!e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function O0(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gn(n,a,e){return n!==void 0?n:a!==void 0?a:e}function N0(n){return[":root {",`--icon-fill: ${n.fill};`,`--icon-fill-opacity: ${al(n.fillOpacity)};`,`--icon-stroke: ${n.stroke};`,`--icon-stroke-dasharray: ${n.strokeDasharray};`,`--icon-aura-color: ${n.auraColor};`,`--icon-aura-opacity: ${al(n.auraOpacity)};`,`--icon-stroke-width: ${n.strokeWidth};`,`--icon-stroke-opacity: ${al(n.strokeOpacity)};`,"}"].join("")}function R0(n){if(n.includes('id="icon-aura"')||n.includes("id='icon-aura'"))return n;let a=L0(n)??{minX:0,minY:0,width:24,height:24},e=a.minX+a.width/2,t=a.minY+a.height/2,i=Math.min(a.width,a.height)/2,o=["<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}${o}${r}`)}function L0(n){let a=n.match(/viewBox="([^"]+)"/i);if(!a)return null;let e=a[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 V0(n,a){let e=n.match(/(<style[^>]*>)([\s\S]*?)(<\/style>)/i);if(e){let[,t,,i]=e;return n.replace(e[0],`${t}${a}${i}`)}return n.replace(/<svg[^>]*>/i,t=>`${t}<style>${a}</style>`)}function al(n){return Number.isFinite(n)?Math.min(1,Math.max(0,n)):1}var Tu=new Map,sl=new Map,Eu=new Map,Du=new Map,Pu=new Map,Iu='<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>',W0={"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"},Ou={"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"},zr=Object.keys(Ou),F0={"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"},G0=ne(ne(ne({},W0),Ou),F0),B0=[{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"}],U0=[{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 Nu(n){return Oe(this,null,function*(){let a=Mu(X0(n));return q0(dl(n),a)})}function Ru(){return Oe(this,null,function*(){return z0("vessel/self")})}function Lu(n){return Oe(this,null,function*(){let a=Tu.get(n);if(a)return a;let e=sl.get(n);if(e)return e;let t=G0[n],i=fetch(t).then(o=>o.ok?o.text():Iu).catch(o=>(console.warn("[ais-icon-registry] Icon fetch error, using fallback.",{key:n,url:t,error:o}),Iu)).then(o=>(Tu.set(n,o),sl.delete(n),o));return sl.set(n,i),i})}function z0(n){return Oe(this,null,function*(){let a=Eu.get(n);if(a)return a;let e=yield Lu(n),t=rl(e);return Eu.set(n,t),t})}function H0(n,a){return Oe(this,null,function*(){let e=Vu(n,a),t=Du.get(e);if(t)return t;let i=yield Lu(n),o=ku(i,a);return Du.set(e,o),o})}function q0(n,a){return Oe(this,null,function*(){let e=Vu(n,a),t=Pu.get(e);if(t)return t;let i=yield H0(n,a),o=rl(i);return Pu.set(e,o),o})}function Vu(n,a){return`${n}|${j0(a)}`}function j0(n){return[ll(n.fill),ll(n.stroke),ll(n.auraColor),wo(n.fillOpacity),wo(n.strokeOpacity),wo(n.auraOpacity),wo(n.strokeWidth),wo(n.sizePx)].join("|")}function ll(n){return n??""}function wo(n){return n===void 0||!Number.isFinite(n)?"":n.toFixed(4)}function dl(n){let a=Y0($0(n.mmsi));if(a)return a;switch(n.type){case"aton":return Z0(n.atonTypeId??null);case"basestation":return"aton/basestation";case"sar":return"vessel/sar";case"vessel":return Q0(n.aisShipTypeId??null);default:return"vessel/unknown"}}function $0(n){if(n==null)return null;let a=typeof n=="number"?String(n):n;return a.length?a:null}function Y0(n){return n?n.startsWith("970")?"beacon/sart":n.startsWith("972")?"beacon/mob":n.startsWith("974")?"beacon/epirb":null:null}function Z0(n){let a=typeof n=="number"&&Number.isFinite(n)?n:null,t=(a===null?void 0:B0.find(i=>i.code===a))?.key??"aton/unknown";return t}function Q0(n){if(n!==null){for(let a of U0)if(n>=a.min&&n<=a.max)return a.key}return"vessel/other"}function X0(n){let a=J0(n.navState),e=n.targetKind??(a?"fixed":K0(n.type)),t=n.status==="unconfirmed"||n.status==="lost"?"unconfirmed":"confirmed";return ne({targetKind:e,targetState:t,isStationary:a,collisionRiskRating:n.collisionRiskRating},n.themeOverrides)}function K0(n){switch(n){case"aton":case"basestation":return"fixed";default:return"moving"}}function J0(n){let a=ev(n);if(a!==void 0)return a===1||a===5;let e=tv(n);return e?e.includes("moored")||e.includes("anchored")||e.includes("at anchor"):!1}function ev(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let a=n.trim();if(!a.length)return;let e=Number(a);return Number.isFinite(e)?e:void 0}}function tv(n){if(typeof n!="string")return;let a=n.trim().toLowerCase();return a.length?a.replace(/\s+/g," "):void 0}function iv(n,a){if(n&1){let e=xe();l(0,"mat-checkbox",8),z("change",function(){let i=J(e).$implicit,o=T(2);return ee(o.toggleVesselType(i))}),d(1),u()}if(n&2){let e=a.$implicit,t=T(2);I("checked",t.isVesselTypeSelected(e)),g(),he(" ",t.formatVesselTypeLabel(e)," ")}}function nv(n,a){if(n&1&&(l(0,"div",0)(1,"p",1),d(2,"Categories"),u(),l(3,"mat-checkbox",2),d(4,"Anchored/Moored"),u(),l(5,"mat-checkbox",3),d(6,"All AtoN"),u(),l(7,"mat-checkbox",4),d(8,"All but SAR"),u(),l(9,"mat-checkbox",5),d(10,"All Vessels"),u(),L(11,"mat-divider",6),l(12,"p",1),d(13,"Types of vessels"),u(),Ae(14,iv,2,2,"mat-checkbox",7,zi),u()),n&2){let e=T();I("formGroup",e.filtersGroup),g(14),ye(e.vesselTypeFilters)}}var Fu=(()=>{class n{formGroupName=y.required();rootFormGroup=A(xt);fb=A(En);aisFormGroup=null;filtersGroup=null;vesselTypeFilters=zr.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:[],o=new Set(i);o.has(e)?o.delete(e):o.add(e),t.setValue(Array.from(o))}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 bt(!1),noCollisionRisk:new bt(!1),allAton:new bt(!1),allButSar:new bt(!1),allVessels:new bt(!1),vesselTypes:new bt([])})}ensureControl(e,t,i){let o=e.get(t);return o||(o=new bt(i),e.addControl(t,o)),o}vesselTypesControl(){return this.filtersGroup?.get("vesselTypes")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&O(0,nv,16,1,"div",0),t&2&&N(i.filtersGroup?0:-1)},dependencies:[wt,dt,Nt,xt,Xi,Xt,Bt,Ia,Pa],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})();var Gu=()=>["measuring","capacity"],av=()=>["marineCompass","baseplateCompass"],ov=()=>["measuring"];function rv(n,a){if(n&1&&L(0,"config-display-chart-options",5),n&2){let e=T();I("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 sv(n,a){n&1&&L(0,"select-autopilot",6)}function lv(n,a){n&1&&(l(0,"mat-form-field",17)(1,"mat-label"),d(2,"URL"),u(),L(3,"input",42),u())}function dv(n,a){n&1&&(l(0,"mat-checkbox",18),d(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 cv(n,a){n&1&&(l(0,"div",43)(1,"div",44)(2,"mat-form-field",45)(3,"mat-label"),d(4,"Widget Label"),u(),L(5,"input",46),u()(),l(6,"div",44)(7,"mat-checkbox",47),d(8," Show Label "),u()()())}function uv(n,a){n&1&&(l(0,"mat-form-field",17)(1,"mat-label"),d(2,"Widget Label"),u(),L(3,"input",46),u())}function mv(n,a){if(n&1&&O(0,cv,9,0,"div",43)(1,uv,4,0,"mat-form-field",17),n&2){let e=T(2);N((e.widgetConfig==null?null:e.widgetConfig.showLabel)!==void 0?0:1)}}function hv(n,a){n&1&&(l(0,"mat-form-field",48)(1,"mat-label"),d(2,"Scale Start"),u(),L(3,"input",49),u(),l(4,"mat-form-field",48)(5,"mat-label"),d(6,"Scale End"),u(),L(7,"input",50),u())}function pv(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Integer Places"),u(),L(3,"input",51),u())}function gv(n,a){if(n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Decimal Places"),u(),L(3,"input",52),u()),n&2){let e=T(2);Ke(e.widgetConfig.showMiniChart!==void 0?"options-grid-span2":"")}}function fv(n,a){n&1&&(l(0,"mat-checkbox",20),d(1," Show Min recorded value "),u())}function vv(n,a){n&1&&(l(0,"mat-checkbox",21),d(1," Show Max recorded value "),u())}function bv(n,a){if(n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Next Dashboard after start"),u(),L(3,"input",53),u()),n&2){let e=T(2);it("options-grid-span2",!e.widgetConfig.numInt)}}function Av(n,a){if(n&1&&(l(0,"mat-option",56),d(1),u()),n&2){let e=a.$implicit;I("value",e.measure),g(),he(" ",e.description," ")}}function yv(n,a){if(n&1&&(l(0,"mat-optgroup",55),Ae(1,Av,2,2,"mat-option",56,Le),u()),n&2){let e=T().$implicit;I("label",e.group),g(),ye(e.units)}}function xv(n,a){if(n&1&&O(0,yv,3,1,"mat-optgroup",55),n&2){let e=a.$implicit,t=T(3);N(!t.widgetConfig.convertUnitToGroup||t.widgetConfig.convertUnitToGroup===""||t.widgetConfig.convertUnitToGroup===e.group?0:-1)}}function Cv(n,a){if(n&1&&(l(0,"mat-form-field",23)(1,"mat-label"),d(2,"Display Units"),u(),l(3,"mat-select",54),Ae(4,xv,1,1,null,null,Le),u()()),n&2){let e=T(2);g(4),ye(e.unitList.conversions)}}function Sv(n,a){n&1&&(l(0,"mat-checkbox",24),d(1," Enable beeps on count down "),u())}function wv(n,a){if(n&1&&L(0,"display-datetime-options",25),n&2){let e=T(2);I("dateFormat",e.dateFormatToControl)("dateTimezone",e.dateTimezoneToControl)}}function _v(n,a){n&1&&(l(0,"mat-checkbox",26),d(1," Enable Advanced Compass Mode "),u())}function Mv(n,a){n&1&&(l(0,"mat-checkbox",27),d(1," Close-hauled Lines "),u())}function kv(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Optimal Close-hauled Angle"),u(),L(3,"input",57),u())}function Tv(n,a){n&1&&(l(0,"mat-checkbox",28),d(1," Wind Sectors "),u())}function Ev(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Sector Duration (sec)"),u(),L(3,"input",58),u())}function Dv(n,a){n&1&&(l(0,"mat-checkbox",29),d(1," Apparent Wind Speed Value "),u())}function Pv(n,a){n&1&&(l(0,"mat-checkbox",30),d(1," True Wind Speed Value "),u())}function Iv(n,a){n&1&&(l(0,"mat-checkbox",31),d(1," Course Over Ground "),u())}function Ov(n,a){n&1&&(l(0,"mat-checkbox",32),d(1," True Wind Angle Indicator "),u())}function Nv(n,a){n&1&&(l(0,"mat-checkbox",33),d(1," Next Waypoint "),u())}function Rv(n,a){n&1&&(l(0,"mat-checkbox",34),d(1," Drift "),u())}function Lv(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Minimum Value"),u(),L(3,"input",59),u())}function Vv(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Maximum Value"),u(),L(3,"input",60),u())}function Wv(n,a){n&1&&(l(0,"mat-checkbox",35),d(1," Ignore Zones configuration "),u())}function Fv(n,a){n&1&&(l(0,"div",61)(1,"mat-checkbox",62),d(2," Show Heeling Side Label "),u()(),l(3,"div",61)(4,"mat-checkbox",63),d(5," Reverse Angle "),u()())}function Gv(n,a){n&1&&(l(0,"div",61)(1,"mat-checkbox",66),d(2," Show Progress Bar "),u()(),l(3,"div",36)(4,"mat-checkbox",67),d(5," Show Ticks "),u()())}function Bv(n,a){n&1&&(l(0,"div",61)(1,"mat-checkbox",67),d(2," Show Ticks "),u()())}function Uv(n,a){if(n&1&&(l(0,"mat-form-field",61)(1,"mat-label"),d(2,"Highlights Width"),u(),L(3,"input",64),u(),l(4,"div",61)(5,"mat-checkbox",65),d(6," Show Needle Indicator "),u()(),O(7,Gv,6,0)(8,Bv,3,0,"div",61)),n&2){let e=T(2);g(7),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"?7:8)}}function zv(n,a){n&1&&(l(0,"mat-form-field",36)(1,"mat-label"),d(2,"Rotation Element"),u(),l(3,"mat-select",68)(4,"mat-option",69),d(5,"Dial (Marine Compass)"),u(),l(6,"mat-option",70),d(7,"Needle (Base plate compass)"),u()()(),l(8,"div",61)(9,"mat-checkbox",71),d(10," Show value box "),u()(),l(11,"div",61)(12,"mat-checkbox",72),d(13," Show cardinal degrees "),u()())}function Hv(n,a){n&1&&(l(0,"mat-form-field",61)(1,"mat-label"),d(2,"Progress Bar Start Position"),u(),l(3,"mat-select",75)(4,"mat-option",76),d(5,"Left"),u(),l(6,"mat-option",77),d(7,"Middle"),u(),l(8,"mat-option",78),d(9,"Right"),u()()())}function qv(n,a){n&1&&(l(0,"mat-form-field",61)(1,"mat-label"),d(2,"Progress Bar Start Angle"),u(),L(3,"input",79),u())}function jv(n,a){if(n&1&&(l(0,"mat-form-field",61)(1,"mat-label"),d(2,"Gauge Type"),u(),l(3,"mat-select",68)(4,"mat-option",73),d(5,"Measuring"),u(),l(6,"mat-option",74),d(7,"Capacity"),u()()(),O(8,Hv,10,0,"mat-form-field",61),O(9,qv,4,0,"mat-form-field",61)),n&2){let e=T(3);g(8),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"&&go(2,ov).includes(e.formMaster.value.gauge.subType)?8:-1),g(),N(e.formMaster.value.gauge.subType==="capacity"?9:-1)}}function $v(n,a){if(n&1&&O(0,zv,14,0)(1,jv,10,3),n&2){let e=T(2);N(go(1,av).indexOf(e.formMaster.value.gauge.subType)>-1?0:go(2,Gu).indexOf(e.formMaster.value.gauge.subType)>-1?1:-1)}}function Yv(n,a){n&1&&(l(0,"mat-form-field",36)(1,"mat-label"),d(2,"Orientation"),u(),l(3,"mat-select",80)(4,"mat-option",81),d(5,"Vertical"),u(),l(6,"mat-option",82),d(7,"Horizontal"),u()()())}function Zv(n,a){n&1&&(l(0,"mat-form-field",36)(1,"mat-label"),d(2,"Unit Label"),u(),l(3,"mat-select",83)(4,"mat-option",84),d(5,"Full Label"),u(),l(6,"mat-option",85),d(7,"First Letter Only"),u()()())}function Qv(n,a){if(n&1&&(l(0,"mat-option",56),d(1),u()),n&2){let e=a.$implicit;I("value",Di(e.value)),g(),X(e.label)}}function Xv(n,a){if(n&1&&(l(0,"mat-form-field",17)(1,"mat-label"),d(2,"Color"),u(),l(3,"mat-select",86),Ae(4,Qv,2,3,"mat-option",56,Le),u()()),n&2){let e=T(2);g(4),ye(e.colors)}}function Kv(n,a){n&1&&(l(0,"mat-form-field",17)(1,"mat-label"),d(2,"Scale Span"),u(),l(3,"mat-select",87)(4,"mat-option",88),d(5,"1 Minute"),u(),l(6,"mat-option",89),d(7,"5 Minutes"),u(),l(8,"mat-option",90),d(9,"30 Minutes"),u()()(),l(10,"div",91)(11,"strong"),d(12,"History API:"),u(),d(13," Wind Trends can be pre-filled with historical data from the Signal K History API. "),l(14,"a",92),d(15,"Learn more"),u()())}function Jv(n,a){n&1&&(l(0,"mat-checkbox",37),d(1," Show Background Graph "),l(2,"i"),d(3,"(Too many graphs may affect performance)"),u()())}function eb(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Suggested Scale Start"),u(),L(3,"input",93),u())}function tb(n,a){n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Suggested Scale End"),u(),L(3,"input",94),u())}function ib(n,a){n&1&&(l(0,"mat-checkbox",38),d(1," Inverse Scale Axis "),u())}function nb(n,a){n&1&&(l(0,"mat-checkbox",39),d(1," Vertical Data Graph "),u())}function ab(n,a){n&1&&(l(0,"mat-checkbox",40),d(1," Disable background color "),u())}function ob(n,a){if(n&1&&(l(0,"mat-option",56),d(1),u()),n&2){let e=a.$implicit;I("value",Di(e.value)),g(),X(e.label)}}function rb(n,a){if(n&1&&(l(0,"mat-form-field")(1,"mat-label"),d(2,"Background Color"),u(),l(3,"mat-select",95),Ae(4,ob,2,3,"mat-option",56,Le),u()()),n&2){let e=T(2);g(4),ye(e.colors)}}function sb(n,a){n&1&&(Hi(0,41),l(1,"mat-form-field")(2,"mat-label"),d(3,"View Mode"),u(),l(4,"mat-select",96)(5,"mat-option",97),d(6,"North Up"),u(),l(7,"mat-option",98),d(8,"Course Up"),u()()(),l(9,"mat-form-field")(10,"mat-label"),d(11,"Fully Visible Rings Range"),u(),l(12,"mat-select",99)(13,"mat-option",100),d(14,"1 miles"),u(),l(15,"mat-option",101),d(16,"3 miles"),u(),l(17,"mat-option",102),d(18,"6 miles"),u(),l(19,"mat-option",103),d(20,"12 miles"),u(),l(21,"mat-option",104),d(22,"24 miles"),u(),l(23,"mat-option",105),d(24,"48 miles"),u()()(),l(25,"mat-checkbox",106),d(26," Plot target COG vector "),u(),l(27,"mat-form-field")(28,"mat-label"),d(29,"COG plot length (minutes)"),u(),L(30,"input",107),u(),l(31,"mat-checkbox",108),d(32," Show unconfirmed targets "),u(),l(33,"mat-checkbox",109),d(34," Show lost targets "),u(),l(35,"mat-checkbox",110),d(36," Show own ship icon "),u(),qi())}function lb(n,a){n&1&&(l(0,"mat-form-field",61)(1,"mat-label"),d(2,"Background Style"),u(),l(3,"mat-select",123)(4,"mat-option",124),d(5,"Dark Gray"),u(),l(6,"mat-option",125),d(7,"Satin Gray"),u(),l(8,"mat-option",126),d(9,"Light Gray"),u(),l(10,"mat-option",127),d(11,"White"),u(),l(12,"mat-option",128),d(13,"Black"),u(),l(14,"mat-option",129),d(15,"Beige"),u(),l(16,"mat-option",130),d(17,"Brown"),u(),l(18,"mat-option",131),d(19,"Red"),u(),l(20,"mat-option",132),d(21,"Green"),u(),l(22,"mat-option",133),d(23,"Blue"),u(),l(24,"mat-option",119),d(25,"Anthracite"),u(),l(26,"mat-option",134),d(27,"Mud"),u(),l(28,"mat-option",135),d(29,"Punched Sheet"),u(),l(30,"mat-option",136),d(31,"Carbon"),u(),l(32,"mat-option",137),d(33,"Stainless"),u(),l(34,"mat-option",138),d(35,"Brushed Metal"),u(),l(36,"mat-option",139),d(37,"Brushed Stainless"),u(),l(38,"mat-option",140),d(39,"Turned"),u()()())}function db(n,a){n&1&&(l(0,"div",61)(1,"mat-checkbox",141),d(2," Reverse Pitch Axis "),u()(),l(3,"div",61)(4,"mat-checkbox",142),d(5," Reverse Roll Axis "),u()(),l(6,"div",61)(7,"mat-checkbox",143),d(8," Show Frame "),u()())}function cb(n,a){if(n&1&&(O(0,lb,40,0,"mat-form-field",61),O(1,db,9,0),l(2,"mat-form-field",61)(3,"mat-label"),d(4,"Frame Style"),u(),l(5,"mat-select",111)(6,"mat-option",112),d(7,"Black Metal"),u(),l(8,"mat-option",113),d(9,"Metal"),u(),l(10,"mat-option",114),d(11,"Shiny Metal"),u(),l(12,"mat-option",115),d(13,"Brass"),u(),l(14,"mat-option",116),d(15,"Steel"),u(),l(16,"mat-option",117),d(17,"Chrome"),u(),l(18,"mat-option",118),d(19,"Gold"),u(),l(20,"mat-option",119),d(21,"Anthracite"),u(),l(22,"mat-option",120),d(23,"Tilted Gray"),u(),l(24,"mat-option",121),d(25,"Tilted Black"),u(),l(26,"mat-option",122),d(27,"Glossy Metal"),u()()()),n&2){let e=T(2);N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)!=="horizon"?0:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="horizon"?1:-1)}}function ub(n,a){if(n&1&&(l(0,"div",7)(1,"div",16),O(2,lv,4,0,"mat-form-field",17),O(3,dv,2,0,"mat-checkbox",18),O(4,mv,2,1),O(5,hv,8,0),O(6,pv,4,0,"mat-form-field"),O(7,gv,4,2,"mat-form-field",19),O(8,fv,2,0,"mat-checkbox",20),O(9,vv,2,0,"mat-checkbox",21),O(10,bv,4,2,"mat-form-field",22),O(11,Cv,6,0,"mat-form-field",23),O(12,Sv,2,0,"mat-checkbox",24),O(13,wv,1,2,"display-datetime-options",25),O(14,_v,2,0,"mat-checkbox",26),O(15,Mv,2,0,"mat-checkbox",27),O(16,kv,4,0,"mat-form-field"),O(17,Tv,2,0,"mat-checkbox",28),O(18,Ev,4,0,"mat-form-field"),O(19,Dv,2,0,"mat-checkbox",29),O(20,Pv,2,0,"mat-checkbox",30),O(21,Iv,2,0,"mat-checkbox",31),O(22,Ov,2,0,"mat-checkbox",32),O(23,Nv,2,0,"mat-checkbox",33),O(24,Rv,2,0,"mat-checkbox",34),O(25,Lv,4,0,"mat-form-field"),O(26,Vv,4,0,"mat-form-field"),O(27,Wv,2,0,"mat-checkbox",35),O(28,Fv,6,0),O(29,Uv,9,1),O(30,$v,2,3),O(31,Yv,8,0,"mat-form-field",36),O(32,Zv,8,0,"mat-form-field",36),O(33,Xv,6,0,"mat-form-field",17),O(34,Kv,16,0),O(35,Jv,4,0,"mat-checkbox",37),O(36,eb,4,0,"mat-form-field"),O(37,tb,4,0,"mat-form-field"),O(38,ib,2,0,"mat-checkbox",38),O(39,nb,2,0,"mat-checkbox",39),O(40,ab,2,0,"mat-checkbox",40),O(41,rb,6,0,"mat-form-field"),O(42,sb,37,0,"ng-container",41),O(43,cb,28,2),u()()),n&2){let e=T();g(2),N((e.widgetConfig==null?null:e.widgetConfig.widgetUrl)!==void 0?2:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.allowInput)!==void 0?3:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.displayName)!==void 0?4:-1),g(),N(e.formMaster.get("displayScale")?5:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.numInt)!==void 0?6:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.numDecimal)!==void 0?7:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.showMin)!==void 0?8:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.showMax)!==void 0?9:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.nextDashboard)!==void 0?10:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.convertUnitTo)!==void 0?11:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.playBeeps)!==void 0?12:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.dateFormat)!==void 0?13:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.compassModeEnabled)!==void 0?14:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?15:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.laylineEnable)!==void 0?16:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?17:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.windSectorEnable)!==void 0?18:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.awsEnable)!==void 0?19:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.twsEnable)!==void 0?20:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.courseOverGroundEnable)!==void 0?21:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.twaEnable)!==void 0?22:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.waypointEnable)!==void 0?23:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.driftEnable)!==void 0?24:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.minValue)!==void 0&&!e.formMaster.get("displayScale")?25:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.maxValue)!==void 0&&!e.formMaster.get("displayScale")?26:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.ignoreZones)!==void 0?27:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="angle"?28:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"&&go(42,Gu).includes(e.formMaster.value.gauge.subType)||(e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngLinear"?29:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngRadial"?30:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="ngLinear"?31:-1),g(),N((e.widgetConfig==null||e.widgetConfig.gauge==null?null:e.widgetConfig.gauge.type)==="simpleLinear"?32:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.color)!==void 0?33:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.timeScale)!==void 0?34:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.showMiniChart)!==void 0?35:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.yScaleMin)!==void 0?36:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.yScaleMax)!==void 0?37:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.inverseYAxis)!==void 0?38:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.verticalChart)!==void 0?39:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.noBgColor)!==void 0?40:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.bgColor)!==void 0?41:-1),g(),N((e.widgetConfig==null?null:e.widgetConfig.ais)!==void 0?42:-1),g(),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 mb(n,a){n&1&&(l(0,"mat-tab",8),L(1,"ais-target-options",41),u())}function hb(n,a){if(n&1&&(L(0,"span",147),d(1,"\xA0Controls ")),n&2){let e=T(2);Sa(e.formMaster.controls.multiChildCtrls.valid?"display: none":"display: block")}}function pb(n,a){if(n&1){let e=xe();l(0,"mat-tab",9)(1,"div",144)(2,"div"),ui(3,hb,2,2,"ng-template",145),u(),l(4,"boolean-multicontrol-options",146),z("addPath",function(i){J(e);let o=T();return ee(o.addPathGroup(i))})("updatePath",function(i){J(e);let o=T();return ee(o.updatePath(i))})("delPath",function(i){J(e);let o=T();return ee(o.deletePath(i))}),u()()()}if(n&2){let e=T();g(4),I("multiCtrlArray",e.multiChildCtrlsToControl)("zonesOnlyPaths",(e.widgetConfig==null?null:e.widgetConfig.zonesOnlyPaths)??!1)}}function gb(n,a){if(n&1&&(l(0,"span",149),d(1," error "),u(),d(2," \xA0Paths ")),n&2){let e=T(2);Sa(e.formMaster.controls.paths.valid||e.formMaster.controls.paths.disabled?"display: none":"display: block")}}function fb(n,a){if(n&1&&(l(0,"mat-tab",10)(1,"div",144)(2,"div"),ui(3,gb,3,2,"ng-template",145),u(),L(4,"paths-options",148),u()()),n&2){let e=T();g(4),I("isArray",e.isPathArray)("enableTimeout",e.enableTimeoutToControl)("dataTimeout",e.dataTimeoutToControl)("filterSelfPaths",e.filterSelfPathsToControl)("addPathEvent",e.addPathEvent)("delPathEvent",e.delPathEvent)("updatePathEvent",e.updatePathEvent)}}function vb(n,a){n&1&&(l(0,"p")(1,"mat-checkbox",152),d(2," Digital display "),u()())}function bb(n,a){n&1&&(l(0,"mat-form-field",17)(1,"mat-label"),d(2,"Dial Size"),u(),l(3,"mat-select",153)(4,"mat-option",154),d(5,"1/4"),u(),l(6,"mat-option",155),d(7,"1/2"),u(),l(8,"mat-option",156),d(9,"3/4"),u(),l(10,"mat-option",84),d(11,"Full"),u()()())}function Ab(n,a){if(n&1&&(l(0,"mat-tab",11)(1,"div",7)(2,"mat-form-field",17)(3,"mat-label"),d(4,"Gauge Type"),u(),l(5,"mat-select",80)(6,"mat-option",150),d(7,"Linear"),u(),l(8,"mat-option",151),d(9,"Radial"),u()()(),O(10,vb,3,0,"p"),O(11,bb,12,0,"mat-form-field",17),u()()),n&2){let e=T();g(10),N(e.formMaster.value.gauge.subType==="linear"?10:-1),g(),N(e.formMaster.value.gauge.subType==="radial"?11:-1)}}function yb(n,a){n&1&&(l(0,"p")(1,"mat-checkbox",159),d(2," Value to send on button push (checked = on, unchecked = off) "),u()())}function xb(n,a){if(n&1&&(l(0,"mat-tab",12)(1,"div",144)(2,"p")(3,"mat-checkbox",157),d(4," Enable Put Requests "),u()(),l(5,"p")(6,"mat-checkbox",158),d(7," Momentary mode (instead of switching between on/off) "),u()(),O(8,yb,3,0,"p"),u()()),n&2){let e=T();g(8),N(e.formMaster.controls.putMomentary.value?8:-1)}}function Cb(n,a){n&1&&L(0,"span",147)}function Sb(n,a){if(n&1&&(O(0,Cb,1,0,"span",147),d(1," Dataset ")),n&2){let e=T(2);N(e.formMaster.controls.datachartPath.valid?-1:0)}}function wb(n,a){if(n&1&&(l(0,"mat-tab",13),ui(1,Sb,2,1,"ng-template",145),L(2,"config-dataset-chart-options",160),u()),n&2){let e=T();g(2),I("filterSelfPaths",e.filterSelfPathsToControl)("datachartPath",e.datachartPathControl)("datachartSource",e.datachartSourceControl)("convertUnitTo",e.convertUnitToControl)("timeScale",e.timeScaleControl)("period",e.periodControl)}}var Bu=(()=>{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=A(Yi);fb=A(En);DatasetStreamService=A(tn);units=A(ot);app=A(wi);widgetConfig=A(Qt);titleDialog="Widget Options";formMaster;availableDataSets;unitList={};isPathArray=!1;addPathEvent;delPathEvent;updatePathEvent;colors=[];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||"",o=t.label||"";return i.localeCompare(o,void 0,{sensitivity:"base"})}),this.unitList=this.units.getConversionsForPath(""),this.formMaster=this.generateFormGroups(this.widgetConfig),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(o=>{let r=e[o];if(r!==null&&(Array.isArray(r)||this.isPlainObject(r))){if(o===n.KEY_MULTI_CHILD_CTRLS){i.addControl(o,this.fb.array([]));let s=i.get(o);r.forEach(c=>{s.push(this.generateCtrlArray(c))})}else if(o===n.KEY_DISPLAY_SCALE)i.addControl(o,this.generateFormGroups(r,o));else if(o===n.KEY_GAUGE)i.addControl(o,this.generateFormGroups(r,o));else if(o===n.KEY_AUTOPILOT)i.addControl(o,this.generateFormGroups(r,o));else if(o===n.KEY_AIS)i.addControl(o,this.generateFormGroups(r,o));else if(o===n.KEY_PATHS){let s=r;if(this.widgetConfig.multiChildCtrls!==void 0){this.isPathArray=!0,i.addControl(o,this.fb.array([]));let c=i.get(o);Object.keys(s).forEach(p=>{let f=s[p];if(f){let b=this.generatePathArray(p,f);f.isPathConfigurable===!1&&b.disable(),c.push(b)}})}else{let c=this.fb.group({});Object.keys(s).forEach(p=>{let f=s[p];if(f){let b=this.generateFormGroups(f,p);f.isPathConfigurable===!1&&b.disable(),c.addControl(p,b)}}),i.addControl(o,c)}}else Array.isArray(r)?i.addControl(o,new bt(r)):i.addControl(o,this.generateFormGroups(r,o));t===n.KEY_PATHS&&i.addControl(o,this.generateFormGroups(r,o))}else if(t===n.KEY_CONVERT_UNIT_TO){let s=e[o];(s&&s.pathType=="number"||"datasetUUID"in this.widgetConfig)&&i.addControl(o,new bt(r))}else switch(o){case"path":i.addControl(o,new bt(r));break;case"datasetUUID":i.addControl(o,new bt(r,Ft.required));break;case"dataTimeout":i.addControl(o,new bt(r,Ft.required));break;default:i.addControl(o,new bt(r));break}}),i}generatePathArray(e,t){let i=new kc({});return Object.keys(t).forEach(o=>{i.addControl(o,this.generatePathFields(o,t[o]))}),i}generatePathFields(e,t){let i=null;switch(e){case"path":i=new bt(t);break;case"source":i=new bt(t,Ft.required);break;case"sampleTime":i=new bt(t,Ft.required);break;default:i=new bt(t);break}return i}generateCtrlArray(e){let t=this.fb.group(e);return t.get("ctrlLabel").addValidators(Ft.required),t}addPathGroup(e){this.addPathEvent=e}updatePath(e){e.forEach(t=>{this.formMaster.get("paths").controls.forEach(o=>{o.get("pathID").value==t.pathID&&(o.controls.description.setValue(t.ctrlLabel),o.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=q({type:n,selectors:[["modal-widget-config"]],decls:21,vars:10,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"],["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"]],template:function(t,i){t&1&&(l(0,"form",0),z("ngSubmit",function(){return i.submitConfig()}),l(1,"h6",1),d(2),u(),l(3,"mat-dialog-content",2)(4,"mat-tab-group",3)(5,"mat-tab",4),O(6,rv,1,24,"config-display-chart-options",5)(7,sv,1,0,"select-autopilot",6)(8,ub,44,43,"div",7),u(),O(9,mb,2,0,"mat-tab",8),O(10,pb,5,2,"mat-tab",9),O(11,fb,5,7,"mat-tab",10),O(12,Ab,12,2,"mat-tab",11),O(13,xb,9,1,"mat-tab",12),O(14,wb,3,6,"mat-tab",13),u()(),L(15,"mat-divider"),l(16,"mat-dialog-actions")(17,"button",14),d(18,"Cancel"),u(),l(19,"button",15),d(20," Save "),u()()()),t&2&&(I("formGroup",i.formMaster),g(2),X(i.titleDialog),g(4),N((i.widgetConfig==null?null:i.widgetConfig.datachartPath)!==void 0?6:i.widgetConfig!=null&&i.widgetConfig.autopilot?7:8),g(3),N((i.widgetConfig==null?null:i.widgetConfig.ais)!==void 0?9:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.multiChildCtrls)!==void 0?10:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.paths)!==void 0?11:-1),g(),N((i.widgetConfig==null||i.widgetConfig.gauge==null?null:i.widgetConfig.gauge.type)==="steel"?12:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.putEnable)!==void 0&&(i.widgetConfig==null?null:i.widgetConfig.multiChildCtrls)===void 0?13:-1),g(),N((i.widgetConfig==null?null:i.widgetConfig.datachartPath)!==void 0?14:-1),g(5),I("disabled",!i.formMaster.valid))},dependencies:[St,Ea,yt,Zi,dt,Nt,Ct,Tn,Da,wt,xt,Xi,Ec,Wt,bi,Ai,Mn,yi,xi,Mt,_t,Ci,kt,$c,Hc,qc,jc,Xt,Bt,In,Si,Gt,Oa,Ia,Pa,nt,At,Cu,gu,bu,pu,xu,wu,Fu],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 Tb=["button"],Eb=["*"];function Db(n,a){if(n&1&&(l(0,"div",2),L(1,"mat-pseudo-checkbox",6),u()),n&2){let e=T();g(),I("disabled",e.disabled)}}var Uu=new an("MAT_BUTTON_TOGGLE_DEFAULT_OPTIONS",{providedIn:"root",factory:()=>({hideSingleSelectionIndicator:!1,hideMultipleSelectionIndicator:!1,disabledInteractive:!1})}),zu=new an("MatButtonToggleGroup"),Pb={provide:Sr,useExisting:ar(()=>_o),multi:!0},Hr=class{source;value;constructor(a,e){this.source=a,this.value=e}},_o=(()=>{class n{_changeDetector=A(pi);_dir=A(Ar,{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=A(na).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 Zt;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 Zt;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=A(Uu,{optional:!0});this.appearance=e&&e.appearance?e.appearance:"standard",this._hideSingleSelectionIndicator=e?.hideSingleSelectionIndicator??!1,this._hideMultipleSelectionIndicator=e?.hideMultipleSelectionIndicator??!1}ngOnInit(){this._selectionModel=new Fc(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||wn(e))return;let i=e.target.id,o=this._buttonToggles.toArray().findIndex(s=>s.buttonId===i),r=null;switch(e.keyCode){case 32:case 13:r=this._buttonToggles.get(o)||null;break;case 38:r=this._getNextButton(o,-1);break;case 37:r=this._getNextButton(o,this.dir==="ltr"?-1:1);break;case 40:r=this._getNextButton(o,1);break;case 39:r=this._getNextButton(o,this.dir==="ltr"?1:-1);break;default:return}r&&(e.preventDefault(),r._onButtonClick(),r.focus())}_emitChangeEvent(e){let t=new Hr(e,this.value);this._rawValue=t.value,this._controlValueAccessorChangeFn(t.value),this.change.emit(t)}_syncButtonToggle(e,t,i=!1,o=!1){!this.multiple&&this.selected&&!e.checked&&(this.selected.checked=!1),this._selectionModel?t?this._selectionModel.select(e):this._selectionModel.deselect(e):o=!0,o?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 o=1;o<=i.length;o++){let r=(e+t*o+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=Dt({type:n,selectors:[["mat-button-toggle-group"]],contentQueries:function(t,i,o){if(t&1&&hr(o,$a,5),t&2){let r;mi(r=hi())&&(i._buttonToggles=r)}},hostAttrs:[1,"mat-button-toggle-group"],hostVars:6,hostBindings:function(t,i){t&1&&z("keydown",function(r){return i._keydown(r)}),t&2&&(Q("role",i.multiple?"group":"radiogroup")("aria-disabled",i.disabled),it("mat-button-toggle-vertical",i.vertical)("mat-button-toggle-group-appearance-standard",i.appearance==="standard"))},inputs:{appearance:"appearance",name:"name",vertical:[2,"vertical","vertical",pt],value:"value",multiple:[2,"multiple","multiple",pt],disabled:[2,"disabled","disabled",pt],disabledInteractive:[2,"disabledInteractive","disabledInteractive",pt],hideSingleSelectionIndicator:[2,"hideSingleSelectionIndicator","hideSingleSelectionIndicator",pt],hideMultipleSelectionIndicator:[2,"hideMultipleSelectionIndicator","hideMultipleSelectionIndicator",pt]},outputs:{valueChange:"valueChange",change:"change"},exportAs:["matButtonToggleGroup"],features:[po([Pb,{provide:zu,useExisting:n}])]})}return n})(),$a=(()=>{class n{_changeDetectorRef=A(pi);_elementRef=A(Ye);_focusMonitor=A(Yd);_idGenerator=A(na);_animationDisabled=ji();_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 Zt;constructor(){A(fr).load(ic);let e=A(zu,{optional:!0}),t=A(new Fd("tabindex"),{optional:!0})||"",i=A(Uu,{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 Hr(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=q({type:n,selectors:[["mat-button-toggle"]],viewQuery:function(t,i){if(t&1&&Sn(Tb,5),t&2){let o;mi(o=hi())&&(i._buttonElement=o.first)}},hostAttrs:["role","presentation",1,"mat-button-toggle"],hostVars:14,hostBindings:function(t,i){t&1&&z("focus",function(){return i.focus()}),t&2&&(Q("aria-label",null)("aria-labelledby",null)("id",i.id)("name",null),it("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",pt],appearance:"appearance",checked:[2,"checked","checked",pt],disabled:[2,"disabled","disabled",pt],disabledInteractive:[2,"disabledInteractive","disabledInteractive",pt]},outputs:{change:"change"},exportAs:["matButtonToggle"],ngContentSelectors:Eb,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){let o=xe();ur(),l(0,"button",1,0),z("click",function(){return J(o),ee(i._onButtonClick())}),O(2,Db,2,1,"div",2),l(3,"span",3),mr(4),u()(),L(5,"span",4)(6,"span",5)}if(t&2){let o=Tt(1);I("id",i.buttonId)("disabled",i.disabled&&!i.disabledInteractive||null),Q("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),g(2),N(i.buttonToggleGroup&&(!i.buttonToggleGroup.multiple&&!i.buttonToggleGroup.hideSingleSelectionIndicator||i.buttonToggleGroup.multiple&&!i.buttonToggleGroup.hideMultipleSelectionIndicator)?2:-1),g(4),I("matRippleTrigger",o)("matRippleDisabled",i.disableRipple||i.disabled)}},dependencies:[tc,Oc],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})(),qr=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ui({type:n});static \u0275inj=Gi({imports:[nc,$a,_n]})}return n})();var Ib="3.5.1";function cl(n,a,e){return Math.min(Math.max(n,a),e)}function ht(n,a){let e=n.options.realtime,t=n.chart.options.plugins?.streaming;return un(e?.[a],t?.[a])}function ul(n,{x:a,y:e},{xAxisID:t,yAxisID:i}){let o={};for(let r=0,s=a.length;r<s;++r)o[a[r]]={axisId:t};for(let r=0,s=e.length;r<s;++r)o[e[r]]={axisId:i};return o}var Ob=typeof window>"u"?aa:window.cancelAnimationFrame;function qu(n){let a=n.frameRequestID;a&&(Ob.call(window,a),delete n.frameRequestID)}function Zu(n){let a=n.refreshTimerID;a&&(clearInterval(a),delete n.refreshTimerID,delete n.refreshInterval)}function Qu(n,a,e){n.refreshTimerID||(n.refreshTimerID=setInterval(()=>{if(typeof document<"u"&&document.hidden)return;let t=Ki(a,[],n);n.refreshInterval===t||isNaN(t)||(Zu(n),Qu(n,a,t))},e||0),n.refreshInterval=e||0)}function Ri(n,a,e){return a=typeof a=="number"?a:n.parse(a),oa(a)?{value:n.getPixelForValue(a),transitionable:!0}:{value:e,transitionable:!1}}function Nb(){let n=Fa.getElement("boxAnnotation"),a=Fa.getElement("lineAnnotation"),e=Fa.getElement("pointAnnotation");if(!n||!a||!e)return;let t=n.prototype.resolveElementProperties,i=a.prototype.resolveElementProperties,o=e.prototype.resolveElementProperties;n.prototype.resolveElementProperties=function(r,s){return(function(c,p,f){let{scales:b,chartArea:x}=p,{xScaleID:S,yScaleID:_,xMin:k,xMax:B,yMin:R,yMax:G}=f,j=b[S],K=b[_],{top:Y,left:Te,bottom:ge,right:oe}=x,le=c.$streaming={};if(j){let me=Ri(j,k,Te),de=Ri(j,B,oe),Me=me.value>de.value;me.transitionable&&(le[Me?"x2":"x"]={axisId:S}),de.transitionable&&(le[Me?"x":"x2"]={axisId:S}),me.transitionable!==de.transitionable&&(le.width={axisId:S,reverse:me.transitionable})}if(K){let me=Ri(K,R,Y),de=Ri(K,G,ge),Me=me.value>de.value;me.transitionable&&(le[Me?"y2":"y"]={axisId:_}),de.transitionable&&(le[Me?"y":"y2"]={axisId:_}),me.transitionable!==de.transitionable&&(le.height={axisId:_,reverse:me.transitionable})}})(this,r,s),t.call(this,r,s)},a.prototype.resolveElementProperties=function(r,s){let c=r.chartArea;r.chartArea=(function(f,b,x){let{scales:S,chartArea:_}=b,{scaleID:k,value:B}=x,R=S[k],{top:G,left:j,bottom:K,right:Y}=_,Te=f.$streaming={};if(R){let vt=R.isHorizontal();return Ri(R,B,0).transitionable&&(Te[vt?"x":"y"]={axisId:k},Te[vt?"x2":"y2"]={axisId:k}),vt?{top:G,bottom:K}:{left:j,right:Y}}let{xScaleID:ge,yScaleID:oe,xMin:le,xMax:me,yMin:de,yMax:Me}=x,Ve=S[ge],Ue=S[oe],et={};if(Ve){let vt=Ri(Ve,le,j),jt=Ri(Ve,me,Y);vt.transitionable?Te.x={axisId:ge}:et.left=j,jt.transitionable?Te.x2={axisId:ge}:et.right=Y}if(Ue){let vt=Ri(Ue,de,G),jt=Ri(Ue,Me,K);vt.transitionable?Te.y={axisId:oe}:et.top=G,jt.transitionable?Te.y2={axisId:oe}:et.bottom=K}return et})(this,r,s);let p=i.call(this,r,s);return r.chartArea=c,p},e.prototype.resolveElementProperties=function(r,s){return(function(c,p,f){let b=p.scales,{xScaleID:x,yScaleID:S,xValue:_,yValue:k}=f,B=b[x],R=b[S],G=c.$streaming={};B&&Ri(B,_,0).transitionable&&(G.x={axisId:x}),R&&Ri(R,k,0).transitionable&&(G.y={axisId:S})})(this,r,s),o.call(this,r,s)}}var Rb={x:["x","caretX"],y:["y","caretY"]};function Lb(...n){let a=this,e=a.getActiveElements()[0];if(e){let t=a.chart.getDatasetMeta(e.datasetIndex);a.$streaming=ul(0,Rb,t)}else a.$streaming={};a.constructor.prototype.update.call(a,...n)}var ml=new WeakMap;function hl(n){let{originalScaleOptions:a}=(function(t){let i=ml.get(t);return i||(i={originalScaleOptions:{}},ml.set(t,i)),i})(n),e=n.scales;return Ji(e,t=>{let i=t.id;a[i]||(a[i]={duration:ht(t,"duration"),delay:ht(t,"delay")})}),Ji(a,(t,i)=>{e&&e[i]||delete a[i]}),a}function Vb(n,a,e,t){let{chart:i}=n,o=n.id,{minDuration:r=0,maxDuration:s=1/0,minDelay:c=-1/0,maxDelay:p=1/0}=t?.[o]||{},f=n.options.realtime,b=ht(n,"duration"),x=ht(n,"delay"),S=cl(b*(2-a),r,s),_,k;return hl(i),_=n.isHorizontal()?(n.right-e.x)/(n.right-n.left):(n.bottom-e.y)/(n.bottom-n.top),k=x+_*(b-S),f.duration=S,f.delay=cl(k,c,p),S!==n.max-n.min}function Wb(n,a,e){let{chart:t}=n,i=n.id,{minDelay:o=-1/0,maxDelay:r=1/0}=e?.[i]||{},s=ht(n,"delay")+((n.getValueForPixel(a)||0)-(n.getValueForPixel(0)||0));return hl(t),n.options.realtime.delay=cl(s,o,r),!0}function Fb(n,a){let e=a.$streaming;if(e.zoomPlugin!==n){let t=e.resetZoom=a.resetZoom;(function(i){i.zoomFunctions.realtime=Vb,i.panFunctions.realtime=Wb})(n),a.resetZoom=i=>{(function(o){let r=hl(o);Ji(o.scales,s=>{let c=s.options.realtime;if(c){let p=r[s.id];p?(c.duration=p.duration,c.delay=p.delay):(delete c.duration,delete c.delay)}})})(a),t(i)},e.zoomPlugin=n}}function Gb(n){let a=n.$streaming;a.zoomPlugin&&(n.resetZoom=a.resetZoom,(function(e){ml.delete(e)})(n),delete a.resetZoom,delete a.zoomPlugin)}var Mo={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}},la=Object.keys(Mo);function ju(n,a,e){if(e){if(e.length){let{lo:t,hi:i}=Zs(e,a);n[e[t]>=a?e[t]:e[i]]=!0}}else n[a]=!0}var $u=["pointBackgroundColor","pointBorderColor","pointBorderWidth","pointRadius","pointRotation","pointStyle","pointHitRadius","pointHoverBackgroundColor","pointHoverBorderColor","pointHoverBorderWidth","pointHoverRadius","backgroundColor","borderColor","borderSkipped","borderWidth","hoverBackgroundColor","hoverBorderColor","hoverBorderWidth","hoverRadius","hitRadius","radius","rotation"];function jr(n,a,e){let t=n.$streaming;if(!t)return;let i=n.$animations||{},o=e;for(let r in t){let s=t[r];if(s.axisId===a){let c=s.reverse?-o:o,p=i[r];oa(n[r])&&(n[r]-=c),p&&(p._from-=c,p._to-=c)}}}var mn=class extends en{constructor(a){super(a),this.$realtime={}}init(a,e){let t=this;super.init.call(t,a),(function(i){if(typeof console<"u"&&console.warn){let o=ht(i,"duration"),r=ht(i,"delay"),s=ht(i,"frameRate"),c=ht(i,"refresh");(typeof o!="number"||o<=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 c!="number"||c<=0)&&console.warn("Chart streaming: refresh should be a positive number")}})(t),Qu(t.$realtime,()=>{let i=t.chart;try{let o=ht(t,"onRefresh");return typeof o=="function"&&Ki(o,[i],t),(function(r){let{chart:s,id:c,max:p}=r,f=ht(r,"duration"),b=ht(r,"delay"),x=ht(r,"ttl"),S=ht(r,"pause"),_=Date.now()-(isNaN(x)?f+b:x),k,B,R,G;Ji(s.data.datasets,(j,K)=>{let Y=s.getDatasetMeta(K),Te=c===Y.xAxisID?"x":c===Y.yAxisID&&"y";if(Te){let ge=Y.controller,oe=j.data,le=oe.length;if(S){for(k=0;k<le;++k){let me=ge.getParsed&&typeof ge.getParsed=="function"?ge.getParsed(k):Array.isArray(oe[k])?{x:oe[k][0],y:oe[k][1]}:oe[k];if(me&&!(me[Te]<p))break}B=k+2}else B=0;for(k=B;k<le;++k){let me=ge.getParsed&&typeof ge.getParsed=="function"?ge.getParsed(k):Array.isArray(oe[k])?{x:oe[k][0],y:oe[k][1]}:oe[k];if(!(me&&me[Te]<=_))break}if(R=k-B,isNaN(x)&&(R=Math.max(R-2,0)),R>0){oe.splice(B,R);for(let Me=0,Ve=$u.length;Me<Ve;++Me){let Ue=$u[Me];Ii(j[Ue])&&j[Ue].splice(B,R)}let me=j.datalabels;if(me)for(let Me in me)Ii(me[Me])&&me[Me].splice(B,R);typeof oe[0]!="object"&&(G={start:B,count:R});let de=s._active;if(de&&de.length>0)for(let Me=de.length-1;Me>=0;Me--){let Ve=de[Me];Ve.datasetIndex===K&&(Ve.index>=B+R?Ve.index-=R:Ve.index>=B&&de.splice(Me,1))}}}}),G&&s.data.labels?.splice(G.start,G.count)})(t),i.update("quiet"),ht(t,"refresh")}catch(o){return typeof console<"u"&&console.error&&console.error("Error in streaming refresh:",o),1e3}})}update(a,e,t){let i=this,{$realtime:o,options:r}=i,{bounds:s,offset:c,ticks:p}=r,{autoSkip:f,source:b,major:x}=p,S=x.enabled;ht(i,"pause")?qu(o):(o.frameRequestID||(o.head=Date.now()),(function(_,k){if(!_.frameRequestID){let B=()=>{if(typeof document<"u"&&document.hidden)return void(_.frameRequestID=bo.call(window,B));let R=_.nextRefresh||0,G=Date.now();if(R<=G){let j=Ki(k,[],_),K=1e3/(Math.max(j,0)||30),Y=(_.nextRefresh||0)+K||0;_.nextRefresh=Y>G?Y:G+K}_.frameRequestID=bo.call(window,B)};_.frameRequestID=bo.call(window,B)}})(o,()=>{let _=i.chart,k=_.$streaming;return(function(B){let{chart:R,id:G,$realtime:j}=B,K=ht(B,"duration"),Y=ht(B,"delay"),Te=B.isHorizontal(),ge=Te?B.width:B.height,oe=Date.now(),le=R.tooltip,me=(function(Ue){let et=Ue.$streaming?.annotationPlugin;return et?et.getAnnotations(Ue):[]})(R),de=ge*(oe-j.head)/K;Te===!!B.options.reverse&&(de=-de);let Me=R.data.datasets.length;for(let Ue=0;Ue<Me;++Ue){let et=R.getDatasetMeta(Ue),{data:vt=[],dataset:jt}=et,An=vt.length;for(let yn=0;yn<An;++yn)jr(vt[yn],G,de);jt&&(jr(jt,G,de),delete jt._path)}let Ve=me.length;for(let Ue=0;Ue<Ve;++Ue)jr(me[Ue],G,de);le&&jr(le,G,de),B.max=oe-Y,B.min=B.max-K,j.head=oe})(i),k&&Ki(k.render,[_]),ht(i,"frameRate")})),r.bounds=void 0,r.offset=!1,p.autoSkip=!1,p.source=b==="auto"?"":b,x.enabled=!0,super.update.call(i,a,e,t),r.bounds=s,r.offset=c,p.autoSkip=f,p.source=b,x.enabled=S}buildTicks(){let a=this,e=ht(a,"duration"),t=ht(a,"delay"),i=a.$realtime.head-t,o=i-e,r=[1e15,i],s=[-1e15,o];Object.defineProperty(a,"min",{get:()=>s.shift(),set:aa,configurable:!0}),Object.defineProperty(a,"max",{get:()=>r.shift(),set:aa,configurable:!0});let c=super.buildTicks.call(a);return delete a.min,delete a.max,a.min=o,a.max=i,c}calculateLabelRotation(){let a=this.options.ticks,e=a.maxRotation;a.maxRotation=a.minRotation||0,super.calculateLabelRotation.call(this),a.maxRotation=e}fit(){let a=this,e=a.options;super.fit.call(a),e.ticks.display&&e.display&&a.isHorizontal()&&(a.paddingLeft=3,a.paddingRight=3,a._handleMargins())}draw(a){let e=this,{chart:t,ctx:i}=e,o=e.isHorizontal()?{left:a.left,top:0,right:a.right,bottom:t.height}:{left:0,top:a.top,right:t.width,bottom:a.bottom};e._gridLineItems=null,e._labelItems=null,La(i,o),super.draw.call(e,a),Va(i)}destroy(){let a=this.$realtime;qu(a),Zu(a)}_generate(){let a=this,e=a._adapter,t=ht(a,"duration"),i=ht(a,"delay"),o=ht(a,"refresh"),r=a.$realtime.head-i,s=r-t,c=a._getLabelCapacity(s),{time:p,ticks:f}=a.options,b=p.unit||(function(ge,oe,le,me){let de=le-oe,Me=la.length;for(let Ve=la.indexOf(ge);Ve<Me-1;++Ve){let Ue=la[Ve],et=Mo[Ue];if(!et)continue;let{common:vt,size:jt,steps:An}=et,yn=An?An[An.length-1]:Number.MAX_SAFE_INTEGER;if(vt&&Math.ceil(de/(yn*jt))<=me)return Ue}return la[Me-1]})(p.minUnit,s,r,c),x=(function(ge){for(let oe=la.indexOf(ge)+1,le=la.length;oe<le;++oe){let me=la[oe];if(Mo[me]?.common)return me}})(b),S=p.stepSize||(function(ge,oe,le,me){let de=oe-ge,Me=Mo[le];if(!Me)return 1;let{size:Ve,steps:Ue}=Me,et=1;if(!Ue)return Math.ceil(de/(me*Ve));for(let vt=0,jt=Ue.length;vt<jt&&(et=Ue[vt],!(Math.ceil(de/(Ve*et))<=me));++vt);return et||1})(s,r,b,c),_=b==="week"&&p.isoWeekday,k=f.major.enabled,B=Ra(_)||_===!0,R=Mo[b],G={},j,K,Y=s;if(B&&(Y=+e.startOf(Y,"isoWeek",_)),Y=+e.startOf(Y,B?"day":b),e.diff(r,s,b)>1e5*S)throw new Error(s+" and "+r+" are too far apart with stepSize of "+S+" "+b);j=Y,k&&x&&!B&&!p.round&&(j=+e.startOf(j,x),j=+e.add(j,~~((Y-j)/(R.size*S))*S,b));let Te=f.source==="data"&&a.getDataTimestamps();for(K=0;j<r+o;j=+e.add(j,S,b),K++)ju(G,j,Te);return j!==r+o&&K!==1||ju(G,j,Te),Object.keys(G).sort((ge,oe)=>+ge-+oe).map(ge=>+ge)}};mn.id="realtime",mn.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}}},Ao.describe("scale.realtime",{_scriptable:n=>n!=="onRefresh"});var Bb=Ib;Ao.set("transitions",{quiet:{animation:{duration:0}}});var Yu={x:["x","cp1x","cp2x"],y:["y","cp1y","cp2y"]};function Ub(n){let a=this;n==="quiet"&&Ji(a.data.datasets,(e,t)=>{let i=a.getDatasetMeta(t).controller;i&&(i._setStyle=function(o,r,s,c){Zc.prototype._setStyle.call(this,o,r,"quiet",c)})}),gt.prototype.update.call(a,n),n==="quiet"&&Ji(a.data.datasets,(e,t)=>{let i=a.getDatasetMeta(t).controller;i&&delete i._setStyle})}function zb(n){let a=n.$streaming;n.render(),a.lastMouseEvent&&setTimeout(()=>{let e=a.lastMouseEvent;e&&n._eventHandler(e)},0)}var Hb={id:"streaming",version:Bb,beforeInit(n){let a=n.$streaming=n.$streaming||{render:zb},e=a.canvas=n.canvas,t=a.mouseEventListener=i=>{let o=Ks(i,n);a.lastMouseEvent={type:"mousemove",chart:n,native:i,x:o.x,y:o.y}};if(e.addEventListener("mousedown",t),e.addEventListener("mouseup",t),typeof document<"u"&&document.addEventListener){let i=()=>{if(!document.hidden){let o=n.scales;o&&Object.keys(o).forEach(r=>{let s=o[r];s&&s instanceof mn&&s.$realtime&&(s.$realtime.head=Date.now())})}};document.addEventListener("visibilitychange",i),a.visibilityChangeListener=i}},afterInit(n){n.update=Ub},beforeUpdate(n){let{scales:a,elements:e}=n.options,t=n.tooltip;a&&Ji(a,i=>{i?.type==="realtime"&&e&&(e.line.capBezierPoints=!1)}),t&&(t.update=Lb);try{let i=Fa.getPlugin("annotation");i&&(function(o,r){let s=r.$streaming;if(s.annotationPlugin!==o){let c=o.afterUpdate;Nb(),s.annotationPlugin=o,o.afterUpdate=function(p,f,b){let x=f.mode,S=b.animation;x==="quiet"&&(b.animation=!1),c.call(this,p,f,b),x==="quiet"&&(b.animation=S)}}})(i,n)}catch(i){(function(o){delete o.$streaming.annotationPlugin})(n)}try{let i=Fa.getPlugin("zoom");i&&Fb(i,n)}catch(i){Gb(n)}},beforeDatasetUpdate(n,a){let{meta:e,mode:t}=a;if(t==="quiet"){let{controller:i,$animations:o}=e;o&&o.visible&&o.visible._active&&(i.updateElement=aa,i.updateSharedOptions=aa)}},afterDatasetUpdate(n,a){let{meta:e,mode:t}=a,{data:i=[],dataset:o,controller:r}=e;for(let s=0,c=i.length;s<c;++s)i[s].$streaming=ul(i[s],Yu,e);o&&(o.$streaming=ul(0,Yu,e)),t==="quiet"&&(delete r.updateElement,delete r.updateSharedOptions)},beforeDatasetDraw(n,a){let{ctx:e,chartArea:t,width:i,height:o}=n,{xAxisID:r,yAxisID:s,controller:c}=a.meta,p={left:0,top:0,right:i,bottom:o};r&&c.getScaleForId(r)instanceof mn&&(p.left=t.left,p.right=t.right),s&&c.getScaleForId(s)instanceof mn&&(p.top=t.top,p.bottom=t.bottom),La(e,p)},afterDatasetDraw(n){Va(n.ctx)},beforeEvent(n,a){let e=n.$streaming,t=a.event;t?.type==="mousemove"?e.lastMouseEvent=t:t?.type==="mouseout"&&delete e.lastMouseEvent},afterDestroy(n){let{scales:a,tooltip:e}=n,t=n.$streaming,{canvas:i,mouseEventListener:o,visibilityChangeListener:r}=t;delete n.update,e&&delete e.update,i.removeEventListener("mousedown",o),i.removeEventListener("mouseup",o),r&&typeof document<"u"&&document.removeEventListener&&document.removeEventListener("visibilitychange",r),Ji(a,s=>{s instanceof mn&&s.destroy()})},defaults:{duration:1e4,delay:0,frameRate:30,refresh:1e3,onRefresh:null,pause:!1,ttl:void 0},descriptors:{_scriptable:n=>n!=="onRefresh"}},da=[Hb,mn];gt.register(da);var qb=["widgetDataChart"];gt.register(da,en,Fn,Rn,Wn,Vn,Ga,Jc);var $r=(()=>{class n{theme=y.required();color=null;dataPath=null;dataSource=null;convertUnitTo=null;numDecimal=null;yScaleMin=null;yScaleMax=null;inverseYAxis=!1;verticalChart=null;datasetUUID=null;unitsService=A(ot);dsService=A(tn);ngZone=A(Be);canvasService=A(ct);widgetDataChart=ce("widgetDataChart",{read:Ye});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;config={datasetAverageArray:"sma",showAverageData:!1,trackAgainstAverage:!1,startScaleAtZero:!1,yScaleSuggestedMin:null,yScaleSuggestedMax:null,enableMinMaxScaleLimit:!1};constructor(){V(()=>{this.theme()&&W(()=>{this.datasetConfig&&(this.setChartOptions(),this.setDatasetsColors())})})}startChart(){this.datasetUUID&&(this.datasetConfig=this.dsService.getDatasetConfig(this.datasetUUID),this.dataSourceInfo=this.dsService.getDataSourceInfo(this.datasetUUID),this.datasetConfig&&(this.setChartOptions(),this.createDatasets(),this.chart?this.chart.update():this.chart=new gt(this.widgetDataChart().nativeElement.getContext("2d"),{type:this.lineChartType,data:this.lineChartData,options:this.lineChartOptions}),this.startStreaming()))}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(Array.isArray(t)){let i=this.transformDatasetRows(t,0);if(this.chart.data.datasets[0].data.push(...i),this.config.showAverageData){let o=this.transformDatasetRows(t,this.config.datasetAverageArray);this.chart.data.datasets[1].data.push(...o)}}else{let i=this.transformDatasetRows([t],0)[0];if(this.chart.data.datasets[0].data.push(i),this.config.showAverageData){let o=this.transformDatasetRows([t],this.config.datasetAverageArray)[0];this.chart.data.datasets[1].data.push(o)}}this.ngZone.runOutsideAngular(()=>{this.chart?.update("none")})})}transformDatasetRows(e,t){let i=s=>this.unitsService.convertToUnit(this.convertUnitTo,s),o=this.verticalChart,r=this.config.datasetAverageArray;return e.map(s=>{if(o){if(t===0)return{x:i(s.data.value),y:s.timestamp};{let c={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return{x:i(c[r]),y:s.timestamp}}}else{if(t===0)return{x:s.timestamp,y:i(s.data.value)};{let c={sma:s.data.sma,ema:s.data.ema,dema:s.data.doubleEma,avg:s.data.lastAverage};return{x:s.timestamp,y:i(c[r])}}}})}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=q({type:n,selectors:[["minichart"]],viewQuery:function(t,i){t&1&&Ce(i.widgetDataChart,qb,5,Ye),t&2&&Se()},inputs:{theme:[1,"theme"]},decls:2,vars:0,consts:[["widgetDataChart",""],[2,"z-index","inherit"]],template:function(t,i){t&1&&Z(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:calc(90% - 10px);position:absolute;bottom:0;border-radius:12px;overflow:hidden}"]})}return n})();var Ne=(()=>{class n{_streamsConfig=w(void 0);dataService=A(Kt);unitsService=A(ot);destroyRef=A(tt);streams;registrations=[];subscriptions=new Map;baseSignatures=new Map;reset$=new Yt;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].join("|")}computeBaseKey(e,t){let i=this.normalizePath(e)??"",o=t?.trim()||"default";return`${i}|${o}`}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,o){let r=this.normalizePath(o.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,o.source),c=this.baseSignatures.get(e);(!this.streams.has(e)||c!==s)&&(this.streams.set(e,this.dataService.subscribePath(r,o.source?.trim()||"default")),this.baseSignatures.set(e,s));let p=this.streams.get(e),f=!!i.enableTimeout,b=(i.dataTimeout??5)*1e3,x=5e3,S=`[Widget] ${i.displayName} - ${b/1e3} second data update timeout reached for `,_=`[Widget] ${i.displayName} - Retrying in ${x/1e3} seconds`,k=o.pathType,B=o.convertUnitTo,R=Number(o.sampleTime);(!Number.isFinite(R)||R<=0)&&(R=1e3);let G=de=>B?this.unitsService.convertToUnit(B,de):de,j=p;k==="number"&&(j=j.pipe(Ht(de=>({data:{value:G(de.data.value),timestamp:de.data.timestamp},state:de.state}))));let K=j.pipe(ci(1)),Y=j.pipe(Ed(R));j=li(K,Y),f&&(j=j.pipe(Cd({each:b,with:()=>xd(()=>{console.log(S+r),this.dataService.timeoutPathObservable(r,k)})}),Td(de=>de.pipe(nr(()=>console.log(_)),Md(()=>Jn(x))))));let Te=this.buildObserver(e,t),ge=j.pipe(ir(this.reset$),Je(this.destroyRef)).subscribe(Te),oe=ue(ne({},o),{path:r}),le=this.computePathSignature(oe),me=this.subscriptions.get(e);me&&me.sub.unsubscribe(),this.subscriptions.set(e,{sub:ge,signature:le})}setStreamsConfig(e){this._streamsConfig.set(e),this.rootSignature=this.computeRootSignature(e)}applyStreamsConfigDiff(e){let t=this._streamsConfig(),i=this.rootSignature,o=this.computeRootSignature(e);if(this._streamsConfig.set(e),this.rootSignature=o,!t||!t.paths||!Object.keys(t.paths).length)return;if(!e||!e.paths){this.subscriptions.forEach(f=>f.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),c=r.filter(f=>!s.includes(f));for(let f of c){let b=this.subscriptions.get(f);b&&b.sub.unsubscribe(),this.subscriptions.delete(f),this.streams?.delete(f),this.baseSignatures.delete(f),this.registrations=this.registrations.filter(x=>x.pathName!==f)}let p=i!==o;for(let f of s){let b=e.paths[f],x=this.normalizePath(b?.path);if(!x){let B=this.subscriptions.get(f);B&&B.sub.unsubscribe(),this.subscriptions.delete(f),this.streams?.delete(f),this.baseSignatures.delete(f);continue}let S=ue(ne({},b),{path:x}),_=this.computePathSignature(S),k=this.subscriptions.get(f);if(!k||k.signature!==_||p){k&&(k.sub.unsubscribe(),this.subscriptions.delete(f));let B=this.registrations.find(R=>R.pathName===f);B&&this.buildAndSubscribe(f,B.next,e,S)}}}observe(e,t){let i=this.registrations.find(b=>b.pathName===e)?.next;this.registrations=this.registrations.filter(b=>b.pathName!==e),this.registrations.push({pathName:e,next:t});let o=this._streamsConfig();if(!o||!o.paths?.[e]){let b=this.subscriptions.get(e);b&&(b.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e));return}let r=o.paths[e],s=this.normalizePath(r?.path);if(!s){let b=this.subscriptions.get(e);b&&(b.sub.unsubscribe(),this.subscriptions.delete(e),this.streams?.delete(e),this.baseSignatures.delete(e)),this.registrations=this.registrations.filter(x=>x.pathName!==e);return}let c=ue(ne({},r),{path:s}),p=this.computePathSignature(c),f=this.subscriptions.get(e);f&&f.signature===p&&i===t||this.buildAndSubscribe(e,t,o,c)}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Dt({type:n,selectors:[["","widget-streams",""]],exportAs:["widgetStreams"]})}return n})();function we(n,a){return{contrast:{color:a.contrast,dim:a.contrastDim,dimmer:a.contrastDimmer},blue:{color:a.blue,dim:a.blueDim,dimmer:a.blueDimmer},green:{color:a.green,dim:a.greenDim,dimmer:a.greenDimmer},pink:{color:a.pink,dim:a.pinkDim,dimmer:a.pinkDimmer},orange:{color:a.orange,dim:a.orangeDim,dimmer:a.orangeDimmer},purple:{color:a.purple,dim:a.purpleDim,dimmer:a.purpleDimmer},yellow:{color:a.yellow,dim:a.yellowDim,dimmer:a.yellowDimmer},grey:{color:a.grey,dim:a.greyDim,dimmer:a.greyDimmer}}[n]}var $b=["canvasMainRef"];function Yb(n,a){if(n&1&&L(0,"minichart",1),n&2){let e=T();I("theme",e.theme())}}var Xu=(()=>{class n{id=y.required();type=y.required();theme=y.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:!0,displayName:"Gauge Label",filterSelfPaths:!0,paths:{numericPath:{description:"Numeric Data",path:null,source:null,pathType:"number",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=A(be);stream=A(Ne);canvas=A(ct);datasetLifecycle=A(Ha);miniChart=ce($r);canvasMainRef=ce.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;lastDrawnValue=void 0;lastDrawnMin=void 0;lastDrawnMax=void 0;valueColor=void 0;valueStateColor=void 0;maxValueTextWidth=0;maxValueTextHeight=0;maxMinMaxTextWidth=0;maxMinMaxTextHeight=0;streamRegistered=!1;pathDataState=null;isDestroyed=!1;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),V(()=>{let e=this.theme();W(()=>{e&&(this.setColors(),this.drawWidget())})}),V(()=>{this.runtime?.options()&&W(()=>{this.isDestroyed||!this.canvasCtx||(this.manageDatasetAndChart(),this.setColors(),this.startWidget(),this.pathDataState=null,this.drawWidget())})}),V(()=>{let e=this.showMiniChart(),t=this.miniChart();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.startWidget(),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)}startWidget(){this.minValue=null,this.maxValue=null,this.dataValue=null,this.streamRegistered||(this.runtime?.options()?.paths?.numericPath?.path?(this.stream?.observe("numericPath",this.onNumericValue),this.streamRegistered=!0):this.drawValue())}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 o=t.source??"default";this.datasetLifecycle.syncNumericMiniChartDataset(this.id(),t.path,o)}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(we(e.color,this.theme()).dim),this.valueStateColor=this.valueColor=we(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,o=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-o,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(),this.lastDrawnMin=this.minValue,this.lastDrawnMax=this.maxValue)}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),this.lastDrawnValue=this.dataValue}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,o=5*this.canvas.scaleFactor;this.canvas.drawText(this.canvasCtx,t,i,Math.floor(this.cssHeight-o),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=q({type:n,selectors:[["widget-numeric"]],viewQuery:function(t,i){t&1&&Ce(i.miniChart,$r,5)(i.canvasMainRef,$b,5),t&2&&Se(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&&(O(0,Yb,1,1,"minichart",1),L(1,"canvas",2,0)),t&2&&N(i.showMiniChart()?0:-1)},dependencies:[$r],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}"]})}return n})();var Zb=["canvasMainRef"],Ku=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);stream=A(Ne);canvas=A(ct);canvasMainRef=ce.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(){V(()=>{let e=this.theme();W(()=>{this.runtime?.options()&&e&&(this.setColors(),this.drawWidget())})}),V(()=>{this.runtime?.options()&&(this.isDestroyed||!this.canvasCtx||W(()=>{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(we(e.color,this.theme()).dim),this.valueColor=we(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 o=this.dataValue===null?"--":this.dataValue,r=this.canvas.EDGE_BUFFER||10,s=Math.max(0,this.cssHeight-e-2*r),c=Math.max(0,Math.floor(this.cssWidth-2*r)),p=Math.max(0,Math.floor(s)),f=Math.floor(this.cssWidth/2),b=Math.floor(e+r+s/2);this.canvas.drawText(this.canvasCtx,o,f,b,c,p,"bold",this.valueColor,"center","middle")}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-text"]],viewQuery:function(t,i){t&1&&Ce(i.canvasMainRef,Zb,5),t&2&&Se()},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&&Z(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}"]})}return n})();var Qb=["widgetDataChart"];gt.register(da,en,Fn,Rn,Wn,Vn,Ga,Pr,Ir);var Ju=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be,{optional:!0});static DEFAULT_CONFIG={filterSelfPaths:!0,color:"contrast",timeScale:"Last 30 Minutes"};ngZone=A(Be);_dataset=A(tn);datasetLifecycle=A(Ha);canvasService=A(ct);unitsService=A(ot);responsive=A(Ma);isPhonePortrait;widgetDataChart=ce("widgetDataChart",{read:Ye});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,o=this.theme();i.save(),i.globalCompositeOperation="destination-over",i.fillStyle=o.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,o=this.theme(),r=this.getThemeColors(),s=gt.defaults.font,c=e.scales,p=e.options?.scales,f=e.data?.datasets?.[0]?.data,b=e.data?.datasets?.[5]?.data,x=(f?.length??0)>=2&&(b?.length??0)>=2,S=(ge,oe)=>{let le=c?.[ge],me=p;if(!le)return;let de=le,Me=me?.[ge]?.min??de.min,Ve=me?.[ge]?.max??de.max;if(typeof Me!="number"||typeof Ve!="number"||!isFinite(Me)||!isFinite(Ve))return;let Ue=(Me+Ve)/2,et=le.getPixelForValue(Ue);t.save(),t.strokeStyle=o.contrastDim,t.lineWidth=this.CENTER_LINE_WIDTH,t.beginPath(),t.moveTo(et,i.top),t.lineTo(et,i.bottom),t.stroke(),t.restore(),t.save(),t.fillStyle=o.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 vt=this.axisTopLabelY(le);t.fillText(oe(Ue),et,vt),t.restore()};S("x",ge=>`${((ge%360+360)%360).toFixed(0)}\xB0`),S("xSpeed",ge=>`${ge.toFixed(1)}`);let _=c?.xSpeed;if(_){let ge=p,oe=_,le=ge?.xSpeed?.max??oe.max;if(typeof le=="number"&&isFinite(le)){let me=_.getPixelForValue(le);t.save(),t.fillStyle=this.resolveTickColor(e,_,le),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 de=this.axisTopLabelY(_),Me=this.xStepSpeed??1,Ve=Math.max(0,Math.min(3,Math.ceil(-Math.log10(Me))));t.fillText(`${le.toFixed(Ve)}`,me-this.EDGE_SPEED_LABEL_OFFSET,de),t.restore(),t.save(),t.strokeStyle=o.contrastDim,t.lineWidth=this.GRID_LINE_WIDTH,t.beginPath();let Ue=Math.round(me)+.5;t.moveTo(Ue,i.bottom),t.lineTo(Ue,i.top-this.EDGE_EXTEND_UP_PX),t.stroke(),t.restore()}}let k=c?.x;if(k){let ge=p,oe=k,le=ge?.x?.min??oe.min;if(typeof le=="number"&&isFinite(le)){let me=k.getPixelForValue(le);t.save(),t.fillStyle=this.resolveTickColor(e,k,le),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 de=this.axisTopLabelY(k),Me=this.normalizeAngle(le);t.fillText(`${Me.toFixed(0)}\xB0`,me+this.EDGE_DIR_LABEL_OFFSET,de),t.restore()}}let B=e.data?.datasets,R=B?.[5]?.data,G=R?.length?R.length-1:-1,j=G>=0?R[G]?.x:void 0;if(typeof j=="number"&&isFinite(j)){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 ge=`${j.toFixed(1)}`,oe=i.left+i.width/4,le=i.top-(this.isPhonePortrait().matches?this.TOP_VALUE_PHONE_PORTRAIT_Y_OFFSET:this.TOP_VALUE_Y_OFFSET);t.fillText(ge,oe,le);let me=t.measureText(ge),de=oe+me.width/2+(this.isPhonePortrait().matches?this.UNIT_PHONE_PORTRAIT_PADDING:this.UNIT_PADDING),Me=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",de,Me),t.restore()}let K=B?.[0]?.data,Y=K?.length?K.length-1:-1,Te=Y>=0?K[Y]?.x:void 0;if(typeof Te=="number"&&isFinite(Te)){let ge=this.normalizeAngle(Te);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(`${ge.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(!x){let ge=Math.min(i.width*.7,420),oe=90,le=i.left+(i.width-ge)/2,me=i.top+(i.height-oe)/2;t.save(),t.globalAlpha=.82,t.fillStyle=o.background,t.fillRect(le,me,ge,oe),t.restore(),t.save(),t.strokeStyle=o.contrastDim,t.lineWidth=2,t.strokeRect(le,me,ge,oe),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...",le+ge/2,me+oe/2),t.restore()}}};constructor(){this.isPhonePortrait=vi(this.responsive.observe(Pi.HandsetPortrait)),V(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||W(()=>{this.datasetConfig&&this.chart&&(this.setChartOptions(),this.setDatasetsColors(),this.ngZone.runOutsideAngular(()=>this.chart?.update("none")))})}),V(()=>{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 gt(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,o=0,r=20,s=(r-o)/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:c=>{let p=Number(c),f=this.datasetConfig?.timeScaleFormat,b=this.getWindowMs(f);return f==="Last 5 Minutes"?`${Math.round(p/6e4)}'`:b>=10*6e4?`${Math.round(p/6e4)}'`:`${Math.round(p/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:c=>{let p=this.xCenter??Number.NaN;if(this.nearlyEqual(c,p))return"";let b=this.chart?.options?.scales?.x?.min;return typeof b=="number"&&this.nearlyEqual(c,b)?"":`${((c%360+360)%360).toFixed(0)}\xB0`},font:c=>{let p=c.tick?.value??Number.NaN,f=this.xCenter??Number.NaN,b=this.nearlyEqual(p,f);return this.isPhonePortrait().matches?{size:11,weight:b?"bold":"normal"}:{size:20,weight:b?"bold":"normal"}},color:c=>{let p=c.tick?.value??Number.NaN,f=this.xCenter??Number.NaN;return this.nearlyEqual(p,f)?this.theme().contrast:void 0}},grid:{display:!0,color:c=>{let p=c.tick?.value??Number.NaN,f=c.scale,b=this.chart?.options?.scales,x=f,S=b?.x?.min??x.min;return this.nearlyEqual(p,S)?"rgba(0,0,0,0)":this.theme().contrastDimmer},lineWidth:1}},xSpeed:{type:"linear",position:"top",stack:"trends",beginAtZero:!1,bounds:"ticks",min:o,max:r,title:{display:!1},ticks:{count:5,align:"inner",autoSkip:!1,includeBounds:!0,stepSize:s,minRotation:0,maxRotation:0,callback:c=>{let p=this.xCenterSpeed??Number.NaN;if(this.nearlyEqual(c,p))return"";let b=this.chart?.options?.scales?.xSpeed?.max;if(typeof b=="number"&&this.nearlyEqual(c,b))return"";let x=this.xStepSpeed??Number.NaN,S=Number.isFinite(x)?x:1,_=Math.max(0,Math.min(3,Math.ceil(-Math.log10(S))));return`${c.toFixed(_)}`},font:c=>{let p=c.tick?.value??Number.NaN,f=this.xCenterSpeed??Number.NaN,b=this.nearlyEqual(p,f);return this.isPhonePortrait().matches?{size:11,weight:b?"bold":"normal"}:{size:20,weight:b?"bold":"normal"}},color:c=>{let p=c.tick?.value??Number.NaN,f=this.xCenterSpeed??Number.NaN;return this.nearlyEqual(p,f)?this.theme().contrast:void 0}},grid:{display:!0,color:c=>{let p=c.tick?.value??Number.NaN,f=c.scale,b=this.chart?.options?.scales,x=f,S=b?.xSpeed?.max??x.max;return this.nearlyEqual(p,S)?"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=(o+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 o=0;o<=4;o++)this.chart.data.datasets[o].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 o=5;o<=9;o++)this.chart.data.datasets[o].data.shift();this.updateChartAfterDataChange(),this.ngZone.runOutsideAngular(()=>{this.chart?.update("none")})})}unwrapAngles(e){if(e.length===0)return[];let t=[],i=null;for(let o of e){if(o==null){t.push(null);continue}if(i==null){t.push(o),i=o;continue}let r=o-i;r>180&&(r-=360),r<-180&&(r+=360),t.push(t[t.length-1]+r),i=o}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,o){let r=e.map(c=>{let p=this.getRowValue(c,t);return p==null?null:this.unitsService.convertToUnit(i,p)}),s=o?this.unwrapAngles(r):r;return e.map((c,p)=>({x:s[p],y:c.timestamp,ts:c.timestamp}))}pushRowsGeneric(e,t,i,o){["value","sma","avg","min","max"].forEach((s,c)=>{this.chart.data.datasets[t+c].data.push(...this.transformRows(e,s,i,o))})}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)),o=e/Math.pow(10,i);return(t.find(s=>o<=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,o=!!e?.length,r=!!t?.length,s=!!i?.length,c=o?e[e.length-1].x:r?t[t.length-1].x:s?i[i.length-1].x:void 0;if(typeof c=="number"&&isFinite(c)){let x=this.chart.data.datasets[3]?.data,S=this.chart.data.datasets[4]?.data,_=x?.length?x[x.length-1].x:void 0,k=S?.length?S[S.length-1].x:void 0,B=typeof _=="number"&&isFinite(_)?this.angularDiff(c,_):Number.NaN,R=typeof k=="number"&&isFinite(k)?this.angularDiff(c,k):Number.NaN,G=Number.isFinite(B)||Number.isFinite(R)?Math.max(Number.isFinite(B)?B:0,Number.isFinite(R)?R:0):Number.NaN;if(!Number.isFinite(G)){let le=o?e:r?t:i,me=Math.min(30,le?.length??0);if(me>1){let Me=le.slice(le.length-me).map(Ve=>Ve.x).filter(Ve=>typeof Ve=="number"&&isFinite(Ve));Me.length&&(G=Me.reduce((Ve,Ue)=>Math.max(Ve,this.angularDiff(c,Ue)),0))}}G=Math.max(G||0,15);let K=2*G/4,Y=this.niceStepFromMantissas(K,[1,1.5,2,2.5,5,7.5,10]),Te=c-2*Y,ge=c+2*Y;this.chart.options.scales.x.min=Te,this.chart.options.scales.x.max=ge;let oe=this.chart.options.scales;oe.x.ticks=ue(ne({},oe.x.ticks??{}),{stepSize:Y}),this.xCenter=c,this.xStep=Y}let p=this.chart.data.datasets[7]?.data;if(p&&p.length){let x=p.length-1,S=p[x]?.x??0,_=this.chart.data.datasets[8].data[x]?.x??S,k=this.chart.data.datasets[9].data[x]?.x??S,B=Math.abs(S-_),R=Math.abs(k-S),G=Math.max(B,R);G=Math.max(G,.5);let K=2*G/4,Y=this.niceStepFromMantissas(K,[1,2,2.5,5,10]),Te=S-2*Y,ge=S+2*Y,oe=this.chart.options.scales;oe.xSpeed.min=Te,oe.xSpeed.max=ge,oe.xSpeed.ticks=ue(ne({},oe.xSpeed.ticks??{}),{stepSize:Y}),this.xCenterSpeed=S,this.xStepSpeed=Y}let f=this.getWindowMs(this.datasetConfig?.timeScaleFormat);if(this.chart.data.datasets[0].data.length>0){let x=Date.now();this.chart.data.datasets.forEach(R=>{R.data.forEach(G=>{let j=G.ts??G.y;G.y=Math.max(0,Math.min(f,x-j))})}),this.chart.options.scales.y.min=0,this.chart.options.scales.y.max=f;let S;switch(this.datasetConfig?.timeScaleFormat){case"Last Minute":S=15e3;break;case"Last 5 Minutes":S=6e4;break;case"Last 30 Minutes":S=5*6e4;break;default:S=f/5;break}let k=this.chart.options.scales,B=ne({},k.y.ticks??{});delete B.count,B.stepSize=S,k.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 o=t.chartArea;if(!o)return null;let r=t.scales?.[i];if(!r)return null;let s=t.options?.scales,c=r,p=s?.[i]?.min??c.min,f=s?.[i]?.max??c.max;if(typeof p!="number"||typeof f!="number"||!isFinite(p)||!isFinite(f))return null;let b=(p+f)/2,x=r.getPixelForValue(b),S=Math.max(0,Math.min(1,(x-o.left)/o.width)),_=e.createLinearGradient(o.left,0,o.right,0);return _.addColorStop(0,this.theme().port),_.addColorStop(S,this.theme().port),_.addColorStop(S,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 o=Math.max(1,Math.max(Math.abs(e),Math.abs(t)));return Math.abs(e-t)<=i*o}resolveTickColor(e,t,i){let r=t.options.ticks?.color;return typeof r=="function"?r({chart:e,scale:t,tick:{value:i}})??gt.defaults.color:typeof r=="string"?r:gt.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=q({type:n,selectors:[["widget-windtrends-chart"]],viewQuery:function(t,i){t&1&&Ce(i.widgetDataChart,Qb,5,Ye),t&2&&Se()},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&&Z(0,"canvas",1,0)},styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}"]})}return n})();function Ut(n,a,e,t=1e3,i,o,r=[500,500],s){if(o){let _=o.get(n);_&&cancelAnimationFrame(_)}a=(()=>{let _=n.getAttribute("transform");if(_){let k=/rotate\((-?\d+(\.\d+)?)/.exec(_);if(k)return parseFloat(k[1])}return a})();let p=_=>(_+360)%360;a=p(a),e=p(e);let f=e-a;f>180&&(f-=360),f<-180&&(f+=360);let b=_=>_<.5?4*_*_*_:1-Math.pow(-2*_+2,3)/2,x=_=>s?s.runOutsideAngular(_):_(),S=_=>s?s.run(_):_();x(()=>{let _=performance.now(),k=R=>{let G=R-_,j=Math.min(G/t,1),K=b(j),Y=a+f*K;if(n.setAttribute("transform",`rotate(${Y} ${r[0]} ${r[1]})`),j<1){let Te=requestAnimationFrame(k);o&&o.set(n,Te)}else n.setAttribute("transform",`rotate(${e} ${r[0]} ${r[1]})`),i&&S(i),o&&o.delete(n)},B=requestAnimationFrame(k);o&&o.set(n,B)})}function ko(n,a,e,t=500,i,o,r){if(o){let p=o.get(n);p&&cancelAnimationFrame(p)}let s=p=>r?r.runOutsideAngular(p):p(),c=p=>r?r.run(p):p();s(()=>{let p=performance.now(),f=e-a,b=_=>_<.5?4*_*_*_:1-Math.pow(-2*_+2,3)/2,x=_=>{let k=_-p,B=Math.min(k/t,1),R=b(B),G=a+f*R;if(n.setAttribute("width",G.toString()),B<1){let j=requestAnimationFrame(x);o&&o.set(n,j)}else n.setAttribute("width",e.toString()),i&&c(i),o&&o.delete(n)},S=requestAnimationFrame(x);o&&o.set(n,S)})}var em=n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,Yr=n=>(n%360+360)%360,Xb=(n,a)=>{let e=Yr(a)-Yr(n);return e>180&&(e-=360),e<=-180&&(e+=360),e};function Zr(n,a,e,t,i,o){let r=p=>o?o.runOutsideAngular(p):p(),s=p=>o?o.run(p):p(),c=0;return r(()=>{let p=performance.now(),f=Xb(n,a),b=Yr(n),x=S=>{let _=Math.min((S-p)/e,1),k=em(_),B=b+f*k;t(Yr(B)),_<1?c=requestAnimationFrame(x):i&&s(i)};c=requestAnimationFrame(x)}),c}var Kb=(n,a,e)=>({min:n.min+(a.min-n.min)*e,mid:n.mid+(a.mid-n.mid)*e,max:n.max+(a.max-n.max)*e});function Qr(n,a,e,t,i,o){let r=p=>o?o.runOutsideAngular(p):p(),s=p=>o?o.run(p):p(),c=0;return r(()=>{let p=performance.now(),f=b=>{let x=Math.min((b-p)/e,1),S=em(x);t(Kb(n,a,S)),x<1?c=requestAnimationFrame(f):i&&s(i)};c=requestAnimationFrame(f)}),c}var Jb=["rotatingDial"],e1=["awaIndicator"],t1=["twaIndicator"],i1=["wptIndicator"],n1=["setIndicator"],a1=["cogIndicator"];function o1(n,a){n&1&&(te(),E(0,"g",69)(1,"text",100)(2,"tspan",101),d(3,"330"),P()(),E(4,"text",102)(5,"tspan",103),d(6,"300"),P()(),E(7,"text",104)(8,"tspan",105),d(9,"W"),P()(),E(10,"text",106)(11,"tspan",107),d(12,"240"),P()(),E(13,"text",108)(14,"tspan",109),d(15,"210"),P()(),E(16,"text",110)(17,"tspan",111),d(18,"S"),P()(),E(19,"text",112)(20,"tspan",113),d(21,"150"),P()(),E(22,"text",114)(23,"tspan",115),d(24,"120"),P()(),E(25,"text",116)(26,"tspan",117),d(27,"E"),P()(),E(28,"text",118)(29,"tspan",119),d(30,"60"),P()(),E(31,"text",120)(32,"tspan",121),d(33,"30"),P()(),E(34,"text",122)(35,"tspan",123),d(36,"N"),P()()())}function r1(n,a){n&1&&(te(),E(0,"g",70)(1,"text",100)(2,"tspan",101),d(3,"30"),P()(),E(4,"text",102)(5,"tspan",103),d(6,"60"),P()(),E(7,"text",104)(8,"tspan",105),d(9,"90"),P()(),E(10,"text",106)(11,"tspan",107),d(12,"120"),P()(),E(13,"text",108)(14,"tspan",109),d(15,"150"),P()(),E(16,"text",110)(17,"tspan",111),d(18,"180"),P()(),E(19,"text",112)(20,"tspan",113),d(21,"150"),P()(),E(22,"text",114)(23,"tspan",115),d(24,"120"),P()(),E(25,"text",116)(26,"tspan",117),d(27,"90"),P()(),E(28,"text",118)(29,"tspan",119),d(30,"60"),P()(),E(31,"text",120)(32,"tspan",121),d(33,"30"),P()(),E(34,"text",122)(35,"tspan",123),d(36,"0"),P()()())}var tm=([n,a],[e,t],[i,o])=>(Math.atan2(o-t,i-e)-Math.atan2(a-t,n-e)+3*Math.PI)%(2*Math.PI)-Math.PI,im=(()=>{class n{rotatingDial=ce.required("rotatingDial");awaIndicator=ce.required("awaIndicator");twaIndicator=ce.required("twaIndicator");wptIndicator=ce.required("wptIndicator");setIndicator=ce.required("setIndicator");cogIndicator=ce.required("cogIndicator");compassHeading=y.required();compassModeEnabled=y.required();courseOverGroundAngle=y(void 0);courseOverGroundEnabled=y.required();trueWindAngle=y.required();twsEnabled=y.required();twaEnabled=y.required();trueWindSpeed=y.required();trueWindSpeedUnit=y.required();appWindAngle=y.required();awsEnabled=y.required();appWindSpeed=y.required();appWindSpeedUnit=y.required();laylineAngle=y(void 0);closeHauledLineEnabled=y.required();sailSetupEnabled=y.required();windSectorEnabled=y.required();driftEnabled=y.required();driftSet=y(void 0);driftFlow=y(void 0);waypointAngle=y(void 0);waypointEnabled=y.required();trueWindMinHistoric=y(void 0);trueWindMidHistoric=y(void 0);trueWindMaxHistoric=y(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};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=A(Be);constructor(){V(()=>{let e=this.waypointEnabled();W(()=>{this.waypointActive.set(e)})}),V(()=>{let e=this.compassModeEnabled(),t=this.compassHeading(),i=Number.isFinite(t)?Math.round(t):null;i!=null&&W(()=>{let o=e?i:0;this.compass.oldValue=this.compass.newValue,this.compass.newValue=o,this.headingValue.set(i.toString()),this.rotatingDial()?.nativeElement&&(Ut(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))})}),V(()=>{let e=this.courseOverGroundAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassModeEnabled();t!=null&&W(()=>{let o=i?this.compass.newValue:0;this.cog.oldValue=this.cog.newValue,this.cog.newValue=t-o,this.cogIndicator()?.nativeElement&&Ut(this.cogIndicator().nativeElement,this.cog.oldValue,this.cog.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone)})}),V(()=>{let e=this.waypointAngle();W(()=>{if(!e){this.waypointActive.set(!1);return}this.waypointEnabled()?this.waypointActive.set(!0):this.waypointActive.set(!1),this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=e,this.wptIndicator()?.nativeElement&&Ut(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone)})}),V(()=>{let e=this.appWindAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&W(()=>{this.awa.oldValue=this.awa.newValue,this.awa.newValue=t,this.awaIndicator()?.nativeElement&&Ut(this.awaIndicator().nativeElement,this.awa.oldValue,this.awa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone),this.updateCloseHauledLines()})}),V(()=>{let e=this.trueWindAngle(),t=Number.isFinite(e)?Math.round(e):null,i=this.compassModeEnabled();t!=null&&W(()=>{this.twa.oldValue=this.twa.newValue,this.trueWindHeading=t;let o=i?this.compass.newValue*-1:0;this.twa.newValue=this.addHeading(this.trueWindHeading,o),this.twaIndicator()?.nativeElement&&Ut(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone)})}),V(()=>{this.laylineAngle(),this.closeHauledLineEnabled()&&W(()=>this.updateCloseHauledLines())}),V(()=>{let e=this.driftSet(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&W(()=>{this.set.oldValue=this.set.newValue,this.set.newValue=t,this.setIndicator()?.nativeElement&&Ut(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,void 0,this.ngZone)})}),V(()=>{let e=this.windSectorEnabled();this.trueWindMinHistoric(),this.trueWindMidHistoric(),this.trueWindMaxHistoric(),this.laylineAngle(),W(()=>{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,o=t&&Number(this.awa.newValue)||0,r=Number(this.laylineAngle())||0,s=t?this.addHeading(i,this.addHeading(o,r*-1)):this.addHeading(o,r*-1);this.animateLayline(this.portLaylinePrev,s,!0,e),this.portLaylinePrev=s;let c=t?this.addHeading(i,this.addHeading(o,r)):this.addHeading(o,r);this.animateLayline(this.stbdLaylinePrev,c,!1,e),this.stbdLaylinePrev=c}animateLayline(e,t,i,o=!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(!o){this.drawLayline(t,i),i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;return}let r=Zr(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,o=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 ${o},${r}`):this.closeHauledLineStbdPath.set(`M ${this.CENTER},${this.CENTER} L ${o},${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=Qr(e,t,this.ANIMATION_DURATION,s=>{let c=this.computeSectorPath(s,i);i?this.portWindSectorPath.set(c):this.stbdWindSectorPath.set(c)},()=>{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 o=this.animationFrameIds.get(i);o&&cancelAnimationFrame(o),this.animationFrameIds.delete(i)}}angleDelta(e,t){let i=(t-e+540)%360-180;return Math.abs(i)}computeSectorPath(e,t){let o=(Number(this.laylineAngle())||0)*(t?-1:1),r=this.compassModeEnabled(),s=r&&Number(this.compass.newValue)||0,c=Number(this.awa.newValue)||0,p=r?this.addHeading(s,this.addHeading(e.min,o)):this.addHeading(o,this.addHeading(e.min,c*-1)),f=r?this.addHeading(s,this.addHeading(e.mid,o)):this.addHeading(o,this.addHeading(e.mid,c*-1)),b=r?this.addHeading(s,this.addHeading(e.max,o)):this.addHeading(o,this.addHeading(e.max,c*-1)),x=this.RADIUS*Math.sin(p*Math.PI/180)+this.CENTER,S=this.RADIUS*Math.cos(p*Math.PI/180)*-1+this.CENTER,_=this.RADIUS*Math.sin(f*Math.PI/180)+this.CENTER,k=this.RADIUS*Math.cos(f*Math.PI/180)*-1+this.CENTER,B=this.RADIUS*Math.sin(b*Math.PI/180)+this.CENTER,R=this.RADIUS*Math.cos(b*Math.PI/180)*-1+this.CENTER,G=Math.abs(tm([x,S],[_,k],[B,R]))>Math.PI/2?0:1,j=tm([B,R],[x,S],[_,k])>0?0:1;return`M ${this.CENTER},${this.CENTER} L ${x},${S} A ${this.RADIUS},${this.RADIUS} 0 ${G} ${j} ${B},${R} z`}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["svg-windsteer"]],viewQuery:function(t,i){t&1&&Ce(i.rotatingDial,Jb,5)(i.awaIndicator,e1,5)(i.twaIndicator,t1,5)(i.wptIndicator,i1,5)(i.setIndicator,n1,5)(i.cogIndicator,a1,5),t&2&&Se(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&&(te(),E(0,"svg",6)(1,"defs",7)(2,"linearGradient",8),Z(3,"stop",9)(4,"stop",10),P(),E(5,"linearGradient",11),Z(6,"stop",9)(7,"stop",10),P(),E(8,"linearGradient",12),Z(9,"stop",13)(10,"stop",14),P(),E(11,"linearGradient",15),Z(12,"stop",16),P(),E(13,"clipPath",17),Z(14,"ellipse",18),P(),Z(15,"linearGradient",19)(16,"linearGradient",20)(17,"linearGradient",21),P(),E(18,"g",22)(19,"g",23),Z(20,"path",24)(21,"path",25),P()(),E(22,"g",26)(23,"g",27),Z(24,"path",28)(25,"path",29)(26,"path",30),P(),E(27,"g",null,0)(29,"g",31),Z(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),O(67,o1,37,0,":svg:g",69)(68,r1,37,0,":svg:g",70),P(),E(69,"g",71),Z(70,"path",72)(71,"path",73),P(),E(72,"g",74),Z(73,"path",75)(74,"path",76),P(),E(75,"g",null,1),Z(77,"path",77)(78,"ellipse",78),P(),E(79,"g",null,2),Z(81,"path",79),P()()(),E(82,"g",80)(83,"g",81)(84,"text",82),d(85),P(),E(86,"text",83),d(87),lt(88,"number"),P(),E(89,"text",84),d(90,"TWS"),P()(),E(91,"g",85)(92,"text",86),d(93),P(),E(94,"text",87),d(95),lt(96,"number"),P(),E(97,"text",88),d(98,"AWS"),P()()(),E(99,"g",89)(100,"text",90),d(101),lt(102,"number"),P()(),E(103,"g",91)(104,"g",null,3),Z(106,"path",92),P(),E(107,"g",null,4),Z(109,"path",93),E(110,"text",94),d(111,"A"),P()(),E(112,"g",null,5),Z(114,"path",95),E(115,"text",96),d(116,"T"),P()()(),E(117,"g",97),Z(118,"rect",98),E(119,"text",99)(120,"tspan"),d(121),E(122,"tspan"),d(123,"\xB0"),P()()()()()),t&2&&(g(67),N(i.compassModeEnabled()?67:68),g(2),pe("display",i.closeHauledLineEnabled()?"inline":"none"),g(),pe("display",i.appWindAngle()!=null?"inline":"none"),Q("d",i.closeHauledLineStbdPath()),g(),pe("display",i.appWindAngle()!=null?"inline":"none"),Q("d",i.closeHauledLinePortPath()),g(),pe("display",i.windSectorEnabled()?"inline":"none"),g(),pe("display",i.portWindSectorPath()?"inline":"none"),Q("d",i.portWindSectorPath()||null),g(),pe("display",i.stbdWindSectorPath()?"inline":"none"),Q("d",i.stbdWindSectorPath()||null),g(),Q("display",i.waypointActive()?"inline":"none"),g(4),pe("display",i.driftEnabled()?"inline":"none"),g(4),pe("display",i.twsEnabled()?"inline":"none"),g(2),X(i.trueWindSpeedUnit()),g(2),X(cn(88,35,i.trueWindSpeed(),"1.1-1")??"--"),g(4),pe("display",i.awsEnabled()?"inline":"none"),g(2),X(i.appWindSpeedUnit()),g(2),X(cn(96,38,i.appWindSpeed(),"1.1-1")??"--"),g(4),pe("display",i.driftEnabled()?"inline":"none"),g(2),X(cn(102,41,i.driftFlow(),"1.1-1")??"--"),g(3),Q("display",i.courseOverGroundEnabled()?"inline":"none"),g(8),pe("display",i.twaEnabled()?"inline":"none"),g(9),X(i.headingValue()))},dependencies:[_a],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 nm=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);stream=A(Ne);zones=A(Be);cdr=A(pi);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(){V(()=>{let e=this.runtime.options();e&&W(()=>{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||"",o=i.includes("angleTrueWater")||i.includes("angleTrueGround")?this.addHeading(this.currentHeading(),e.data.value):e.data.value,r=this.normalizeAngle(o);(!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=Qo(1e3).subscribe(()=>{this.historicalCleanup()})})}addHistoricalWindDirection(e){let t=Date.now(),i=this.unwrapAngle(e),o=this.windSampleIndex++;for(this.windSamples.push({t,u:i,i:o});this.windMinDeque.length&&this.windMinDeque[this.windMinDeque.length-1].u>=i;)this.windMinDeque.pop();for(this.windMinDeque.push({i:o,u:i});this.windMaxDeque.length&&this.windMaxDeque[this.windMaxDeque.length-1].u<=i;)this.windMaxDeque.pop();this.windMaxDeque.push({i:o,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 f=this.windSamples.shift();if(!f)break;this.windMinDeque.length&&this.windMinDeque[0].i===f.i&&this.windMinDeque.shift(),this.windMaxDeque.length&&this.windMaxDeque[0].i===f.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,o=(t+i)/2,r=this.normalizeAngle(t),s=this.normalizeAngle(o),c=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,c)>=this.DEG_EPSILON)&&(this.trueWindMinHistoric.set(r),this.trueWindMidHistoric.set(s),this.trueWindMaxHistoric.set(c),this.lastSector={min:r,mid:s,max:c},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,o=(e-i+540)%360-180,r=t+o;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=q({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&&L(0,"svg-windsteer",0),t&2){let o,r,s,c,p,f,b,x,S,_,k;I("compassHeading",i.currentHeading())("compassModeEnabled",(o=i.runtime.options())==null?null:o.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",(c=i.runtime.options())==null?null:c.twaEnable)("trueWindSpeed",i.trueWindSpeed())("trueWindSpeedUnit",i.trueWindSpeedUnit())("appWindAngle",i.appWindAngle())("awsEnabled",(p=i.runtime.options())==null?null:p.awsEnable)("appWindSpeed",i.appWindSpeed())("appWindSpeedUnit",i.appWindSpeedUnit())("laylineAngle",(f=i.runtime.options())==null?null:f.laylineAngle)("closeHauledLineEnabled",(b=i.runtime.options())==null?null:b.laylineEnable)("windSectorEnabled",(x=i.runtime.options())==null?null:x.windSectorEnable)("driftEnabled",(S=i.runtime.options())==null?null:S.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",((k=i.runtime.options())==null?null:k.sailSetupEnable)??!1)}},dependencies:[im],encapsulation:2,changeDetection:0})}return n})();function s1(n,a){if(n&1){let e=xe();l(0,"h3"),d(1,"Getting Started"),u(),l(2,"p"),d(3,"Welcome to KIP! Here are some basic gestures to help you navigate the application. Access the "),l(4,"a",1),d(5,"KIP Help"),u(),d(6," to learn more."),u(),l(7,"table",2)(8,"thead")(9,"tr")(10,"th"),d(11,"Actions"),u(),l(12,"th"),d(13,"Touch"),u(),l(14,"th"),d(15,"Mouse"),u(),l(16,"th"),d(17,"Keyboard Shortcuts"),u()()(),l(18,"tbody")(19,"tr")(20,"td"),d(21,"Open Actions menu"),u(),l(22,"td"),d(23,"Swipe left"),u(),l(24,"td"),d(25,"Click, drag left, and release"),u(),l(26,"td")(27,"kbd"),d(28,"Shift"),u(),d(29," + "),l(30,"kbd"),d(31,"Ctrl"),u(),d(32," + "),l(33,"kbd",3),d(34,"\u2190"),u(),d(35," (Left Arrow)"),u()(),l(36,"tr")(37,"td"),d(38,"Open Notification menu"),u(),l(39,"td"),d(40,"Swipe right"),u(),l(41,"td"),d(42,"Click, drag right, and release"),u(),l(43,"td")(44,"kbd"),d(45,"Shift"),u(),d(46," + "),l(47,"kbd"),d(48,"Ctrl"),u(),d(49," + "),l(50,"kbd",3),d(51,"\u2192"),u(),d(52," (Right Arrow)"),u()(),l(53,"tr")(54,"td"),d(55,"Cycle through dashboards"),u(),l(56,"td"),d(57,"Swipe up/down"),u(),l(58,"td"),d(59,"Click, drag up/down, and release"),u(),l(60,"td")(61,"kbd"),d(62,"Shift"),u(),d(63," + "),l(64,"kbd"),d(65,"Ctrl"),u(),d(66," + "),l(67,"kbd",3),d(68,"\u2191"),u(),d(69,"/"),l(70,"kbd",3),d(71,"\u2193"),u(),d(72," (Up/Down Arrow)"),u()(),l(73,"tr")(74,"td"),d(75,"Toggle Fullscreen"),u(),l(76,"td"),d(77,"N/A"),u(),l(78,"td"),d(79,"N/A"),u(),l(80,"td")(81,"kbd"),d(82,"Shift"),u(),d(83," + "),l(84,"kbd"),d(85,"Ctrl"),u(),d(86," + "),l(87,"kbd"),d(88,"F"),u()()(),l(89,"tr")(90,"td"),d(91,"Toggle Night mode"),u(),l(92,"td"),d(93,"N/A"),u(),l(94,"td"),d(95,"N/A"),u(),l(96,"td")(97,"kbd"),d(98,"Shift"),u(),d(99," + "),l(100,"kbd"),d(101,"Ctrl"),u(),d(102," + "),l(103,"kbd"),d(104,"N"),u()()(),l(105,"tr")(106,"td"),d(107,"Toggle dashboard edit mode"),u(),l(108,"td"),d(109,"N/A"),u(),l(110,"td"),d(111,"N/A"),u(),l(112,"td")(113,"kbd"),d(114,"Shift"),u(),d(115," + "),l(116,"kbd"),d(117,"Ctrl"),u(),d(118," + "),l(119,"kbd"),d(120,"E"),u()()()()(),l(121,"i"),d(122,"Note that the words Touch and Tap are synonymous with mouse Click."),u(),L(123,"br")(124,"br"),l(125,"h3"),d(126,"Login to Signal K"),u(),l(127,"p"),d(128," The first step is to configure Signal K server authentication ("),l(129,"i"),d(130,"a pre-existing Signal K server username and password is required"),u(),d(131,"). Use the table above to find the gesture, mouse or keyboard shortcut to open the Actions menu, then select the top right "),l(132,"strong"),d(133,"Settings button"),u(),d(134,", then the top left "),l(135,"strong"),d(136,"Options button"),u(),d(137,". Toggle "),l(138,"strong"),d(139,"Login to server"),u(),d(140," and enter your Signal K credentials. "),u(),l(141,"ul")(142,"li")(143,"strong"),d(144,"Why login?"),u(),d(145," Logging in allows KIP to do two things: 1) to send commands to Signal K and 2) to save its configuration on the server so it can be shared between multiple devices. It is the recommended method to use KIP. "),u(),l(146,"li"),d(147," If you don\u2019t have a Signal K account, ask your Signal K administrator, access the Signal K Admin Settings / Users page and create a user or check your server\u2019s documentation for setup instructions. "),u(),l(148,"li"),d(149," After entering your credentials, select "),l(150,"strong"),d(151,"Login"),u(),d(152," or "),l(153,"strong"),d(154,"Connect"),u(),d(155,". If successful, your connection status will update and live data will appear in KIP. "),u(),l(156,"li"),d(157," 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()(),l(158,"h3"),d(159,"Option 1: Load Demonstration Dashboards"),u(),l(160,"p"),d(161," Try the sample dashboards using data from your server: "),L(162,"br"),l(163,"button",4),z("click",function(){J(e);let i=T();return ee(i.loadDemoConfig())}),d(164,"Load Demo"),u()(),l(165,"h3"),d(166,"Option 2: Create Your Own Layout"),u(),l(167,"p"),d(168,' The text you are reading is actually a widget that fills 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(),l(169,"p")(170,"strong"),d(171,"Try editing the Dashboard now to receive further instructions!"),u()()}}function l1(n,a){n&1&&(l(0,"h2"),d(1,"Changing Layouts"),u(),d(2," Follow these simple steps to learn how to change your dashboard layout: "),l(3,"ol")(4,"li"),d(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(),l(6,"li"),d(7,"Touch & Hold or Click & Hold in an empty area to open the Add Widget selection panel."),u(),l(8,"li"),d(9,"Choose a widget from the selection panel to add it to the dashboard."),u()(),l(10,"h3"),d(11,"Possible widget operations"),u(),l(12,"ul")(13,"li")(14,"strong"),d(15,"Touch and drag"),u(),d(16," to move widgets"),u(),l(17,"li")(18,"strong"),d(19,"Drag corners and sides"),u(),d(20," to resize widgets"),u(),l(21,"li")(22,"strong"),d(23,"Double Tap"),u(),d(24," on a widget to configure it"),u(),l(25,"li")(26,"strong"),d(27,"Press and Hold"),u(),d(28," on a widget to delete or duplicate widgets"),u()(),l(29,"h2"),d(30,"Exiting dashboard edit mode"),u(),l(31,"p"),d(32,"Use the Save or Cancel buttons in the lower right corner to either persist your changes or revert changes."),u(),l(33,"h2"),d(34,"Adding more dashboards"),u(),l(35,"p"),d(36,"Swipe left and hit the Dashboards button. From this page you can add, rename, order, delete, and duplicate entire dashboards."),u())}var am=(()=>{class n{id=y.required();type=y.required();theme=y.required();static DEFAULT_CONFIG={filterSelfPaths:!0};dashboard=A(mt);settings=A(Ot);loadDemoConfig(){this.settings.loadDemoConfig()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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"],["mat-raised-button","",2,"margin-left","15px",3,"click"]],template:function(t,i){t&1&&(l(0,"div",0),O(1,s1,172,0)(2,l1,37,0),u()),t&2&&(g(),N(i.dashboard.isDashboardStatic()?1:2))},dependencies:[At,Cr],styles:[".tutorial-container[_ngcontent-%COMP%]{position:absolute;top:0;left:0;display:block;height:100%;width:100%;overflow:none}.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}"],changeDetection:0})}return n})();var d1=["canvas"],Bn=(()=>{class n{text=y.required();color=y.required();canvasRef=ce.required("canvas");canvas=A(ct);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=q({type:n,selectors:[["widget-title"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,d1,5),t&2&&Se()},inputs:{text:[1,"text"],color:[1,"color"]},features:[Bi],decls:3,vars:0,consts:[["canvas",""],[1,"title-wrapper"],[1,"title-canvas"]],template:function(t,i){t&1&&(E(0,"div",1),Z(1,"canvas",2,0),P())},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 zt=(()=>{class n{resizeChange=new Zt;kipResize=new Zt;el=A(Ye);zone=A(Be);ro=null;constructor(){this.zone.runOutsideAngular(()=>{this.ro=new ResizeObserver(e=>{let t=e[e.length-1],{width:i,height:o}=t.contentRect;this.zone.run(()=>{this.resizeChange.emit(t),this.kipResize.emit({width:i,height:o,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=Dt({type:n,selectors:[["","kipResizeObserver",""]],outputs:{resizeChange:"resizeChange",kipResize:"kipResize"}})}return n})();var c1=["svgSlider"];function u1(n,a){n&1&&L(0,"div",10)}var om=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);streams=A(Ne);svgElement=ce.required("svgSlider");dashboard=A(mt);signalkRequestsService=A(Jt);toast=A($i);labelColor=w(void 0);barColor=w(void 0);lineStartPx;lineWidthPx;lineEndPx;resizeTimeout=null;handlePosition=20;pathValue=0;lineStart=this.handlePosition;isDragStarted=!1;lineWidth="0px";VIEWBOX_WIDTH=200;LINE_START=20;LINE_WIDTH=160;colorMap=null;valueChange$=new Yt;constructor(){V(()=>{let e=this.theme(),t=this.runtime.options();!t||!e||W(()=>{this.ensureColorMap(),this.getColors(t.color)})}),V(()=>{let e=this.runtime.options(),t=e?.paths?.gaugePath?.path;!e||!t||W(()=>{this.calculateLineBounds(),this.streams.observe("gaugePath",i=>{if(!i||!i.data){this.handlePosition=this.mapValueToPosition(e.displayScale.lower);return}this.updateHandlePosition(this.mapValueToPosition(i.data.value))})})})}ngOnInit(){let e=this.runtime.options();e&&this.getColors(e.color),this.valueChange$.pipe(Ht(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}),Cn(200),Xo()).subscribe(t=>{this.sendValue(t)})}mapValueToPosition(e){let t=this.runtime.options();if(!t)return e;let i=t.displayScale.upper-t.displayScale.lower,o=this.LINE_WIDTH;return(e-t.displayScale.lower)/i*o+this.LINE_START}mapPositionToValue(e){let t=this.runtime.options();if(!t)return e;let i=t.displayScale.upper-t.displayScale.lower,o=this.LINE_WIDTH;return(e-this.LINE_START)/o*i+t.displayScale.lower}isWithinMargin(e,t,i){let o=(i.displayScale.upper-i.displayScale.lower)*.01;return Math.abs(e-t)<=o}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){this.handlePosition=e,this.lineWidth=`${e-this.lineStart}px`}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 o=this.runtime.options();o&&this.handlePosition<=this.LINE_START?this.pathValue=o.displayScale.lower:o&&this.handlePosition>=this.LINE_START+this.LINE_WIDTH?this.pathValue=o.displayScale.upper:this.pathValue=this.mapPositionToValue(this.handlePosition),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=q({type:n,selectors:[["widget-slider"]],viewQuery:function(t,i){t&1&&Ce(i.svgElement,c1,5),t&2&&Se()},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&&(L(0,"widget-title",1),l(1,"div",2),z("resizeChange",function(){return i.onResized()}),te(),l(2,"svg",3),L(3,"rect",4)(4,"rect",5),l(5,"g",6),L(6,"circle",7)(7,"circle",8),u(),l(8,"rect",9,0),z("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()(),O(10,u1,1,0,"div",10),u()),t&2){let o;I("text",i.runtime==null||(o=i.runtime.options())==null?null:o.displayName)("color",i.labelColor()),g(4),Q("width",i.lineWidth)("fill",i.barColor()),g(2),Q("cx",i.handlePosition),g(),Q("cx",i.handlePosition),g(3),N(i.dashboard.isDashboardStatic()?-1:10)}},dependencies:[zt,Bn],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)}"]})}return n})();var m1=["gaugeBarAnimate"];function h1(n,a){if(n&1&&(te(),Z(0,"rect",14)),n&2){let e=a.$implicit,t=T();Q("fill",e.color)("x",5+(e.from-t.gaugeMinValue())*t.scaleSliceValue())("width",(e.to-e.from)*t.scaleSliceValue())}}var rm=(()=>{class n{gaugeBarAnimate=ce("gaugeBarAnimate");displayName=y.required();displayNameColor=y.required();dataValue=y.required();dataValueLabel=y.required();unitLabel=y.required();barColor=y.required();barColorGradient=y.required();barColorBackground=y.required();gaugeMinValue=y.required();gaugeMaxValue=y.required();highlights=y.required();scaleSliceValue=ie(()=>{let e=this.gaugeMaxValue()-this.gaugeMinValue();return e!==0?195/e:0});newGaugeValue=w(null);oldGaugeValue=w(null);scheduleRafId=null;constructor(){V(()=>{let e=this.gaugeMinValue(),t=this.dataValue();t===null&&(t=e),W(()=>{this.oldGaugeValue.set(this.newGaugeValue()!==null?this.newGaugeValue():e),this.newGaugeValue.set(this.dataValue()!==null?(t-e)*this.scaleSliceValue():e),this.gaugeBarAnimate()?.nativeElement&&(this.scheduleRafId!==null&&cancelAnimationFrame(this.scheduleRafId),this.scheduleRafId=requestAnimationFrame(()=>{let i=this.gaugeBarAnimate();i?.nativeElement&&i.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=q({type:n,selectors:[["svg-simple-linear-gauge"]],viewQuery:function(t,i){t&1&&Ce(i.gaugeBarAnimate,m1,5),t&2&&Se()},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&&(te(),E(0,"svg",1)(1,"defs",2)(2,"linearGradient",3),Z(3,"stop",4)(4,"stop",5),P(),Z(5,"linearGradient",6),P(),E(6,"g",7),Z(7,"rect",8),E(8,"defs")(9,"g",9),Z(10,"rect",10)(11,"rect",11),P()(),E(12,"use",12),Z(13,"animateTransform",13,0),P(),Ae(15,h1,1,3,":svg:rect",14,Le),P(),E(17,"g",15)(18,"text",16)(19,"tspan",17),d(20),P()(),E(21,"text",18)(22,"tspan",19),d(23),P(),E(24,"tspan",20),d(25),P()()()()),t&2&&(g(3),Q("stop-color",i.barColorGradient()),g(),Q("stop-color",i.barColorGradient()),g(3),Q("fill",i.barColorBackground()),g(5),pe("fill",i.barColor()),g(),Q("from",i.oldGaugeValue()+" 1")("to",i.newGaugeValue()+" 1"),g(2),ye(i.highlights()),g(4),Q("fill",i.displayNameColor()),g(),he(" ",i.displayName()),g(3),X(i.dataValueLabel()),g(2),X(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)}"]})}return n})();var ei=(()=>{class n{metaWidget=y();dataService=A(Kt);destroyRef=A(tt);_metaConfig=w(void 0);_meta=w(null);reset$=new Yt;currentSub;pathSignature;zones=ie(()=>this._meta()?.zones||[]);possibleValues=ie(()=>this._meta()?.possibleValues||[]);supportsPut=ie(()=>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],o=t.paths[i]?.path;if(!o)return;let r=o;this.pathSignature!==r&&(this.pathSignature=r,this.subscribePathMeta(o))}subscribePathMeta(e){this.currentSub&&(this.currentSub.unsubscribe(),this.currentSub=void 0);let t=this.dataService.getPathMetaObservable(e).pipe(ir(this.reset$),Je(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 Yt,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=Dt({type:n,selectors:[["","widget-metadata",""]],inputs:{metaWidget:[1,"metaWidget"]},exportAs:["widgetMetadata"]})}return n})();function Ya(n,a,e,t,i,o,r=!1){let s=[],c=[...n].sort((p,f)=>(p.lower??-1/0)-(f.lower??-1/0));for(let p of c){let f=null,b=null,x;switch(p.state){case ve.Emergency:x=a.zoneEmergency;break;case ve.Alarm:x=a.zoneAlarm;break;case ve.Warn:x=a.zoneWarn;break;case ve.Alert:x=a.zoneAlert;break;case ve.Nominal:x=a.zoneNominal;break;default:x="rgba(0,0,0,0)"}if(p.lower==null?f=i:f=t.convertToUnit(e,p.lower),p.upper==null?b=o:b=t.convertToUnit(e,p.upper),!(!Number.isFinite(f)||!Number.isFinite(b))&&!(b<i||f>o)){if(f=Math.max(f,i),b>o){b=o,s.push({from:f,to:b,color:x});break}s.push({from:f,to:b,color:x})}}return r&&(s=s.map(p=>({from:o-p.to,to:o-p.from,color:p.color}))),s}var sm=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);streams=A(Ne);metadata=A(ei,{optional:!0});unitsService=A(ot);unitsLabel=w("");dataLabelValue=w("0");dataValue=w(null);barColor=w("");barColorGradient=w("");barColorBackground=w("");highlights=ie(()=>{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 o=e.paths.gaugePath.convertUnitTo,r=e.displayScale.lower,s=e.displayScale.upper;return Ya(i,t,o,this.unitsService,r,s)});lastState=null;constructor(){V(()=>{let e=this.runtime.options(),t=e?.paths?.gaugePath?.path;!e||!t||W(()=>{this.streams.observe("gaugePath",o=>{let r=this.theme();if(!e||!r)return;let s=o?.data?.value;if(s==null)this.dataValue.set(e.displayScale.lower),this.dataLabelValue.set("--");else{let c=Math.min(Math.max(s,e.displayScale.lower),e.displayScale.upper);this.dataValue.set(c),this.dataLabelValue.set(c.toFixed(e.numDecimal))}if(!e.ignoreZones){let c=o?.state;if(c&&c!==this.lastState)switch(this.lastState=c,c){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(we(e.color,r).color);break}}});let i=e.paths.gaugePath.convertUnitTo;this.unitsLabel.set(e.gauge.unitLabelFormat==="abr"?i?.substring(0,1):i)})}),V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{this.barColorBackground.set(t.background);let i=we(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)})}),V(()=>{let e=this.runtime.options();!e||e.ignoreZones||!this.metadata||W(()=>this.metadata.observe("gaugePath"))})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&L(0,"svg-simple-linear-gauge",0),t&2){let o,r=i.runtime.options();I("displayName",r.displayName)("displayNameColor",(o=i.theme())==null?null:o.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:[rm],styles:[".simpleLinearGaugeContainer[_ngcontent-%COMP%]{display:block;position:relative;height:100%;width:100%;padding:0}"]})}return n})();var g1=["rotatingDial"],f1=["twaIndicator"],v1=["wptIndicator"],b1=["setIndicator"],A1=["tackIndicator"],lm=([n,a],[e,t],[i,o])=>(Math.atan2(o-t,i-e)-Math.atan2(a-t,n-e)+3*Math.PI)%(2*Math.PI)-Math.PI,dm=(()=>{class n{rotatingDial=ce.required("rotatingDial");twaIndicator=ce.required("twaIndicator");wptIndicator=ce.required("wptIndicator");setIndicator=ce.required("setIndicator");tackIndicator=ce.required("tackIndicator");compassHeading=y.required();tackTrue=y.required();polarSpeedRatio=y.required();trueWindAngle=y.required();trueWindSpeed=y.required();targetAngle=y.required();optimalWindAngle=y.required();targetVMG=y.required();VMG=y.required();sailSetupEnabled=y.required();driftEnabled=y.required();driftSet=y(void 0);driftFlow=y(void 0);waypointEnabled=y.required();waypointAngle=y(void 0);vmgToWaypoint=y(void 0);trueWindMinHistoric=y(void 0);trueWindMidHistoric=y(void 0);trueWindMaxHistoric=y(void 0);gradianColor=y.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};headingValue=w("--");windSectorsInitialized=!1;trueWindHeading=0;nextTargetDirection=ie(()=>{let e=this.compassHeading(),t=this.tackTrue();return e==null||t==null?0:this.unsignedAngleDelta(e,t)});trueWindSpeedDisplay=ie(()=>{let e=this.trueWindSpeed();return e==null?"--":e.toFixed(1)});windAnglePerformanceRatioColor=ie(()=>{let e=this.optimalWindAngle(),t=this.targetAngle(),i=this.gradianColor().start,o=this.gradianColor().stop;if(e==null||t==null)return i;let r=1-Math.abs(e-t)/180;return this.interpolateColor(i,o,r)});targetVMGOffset=ie(()=>{let e=this.VMG(),t=this.targetVMG();return e==null||t==null?"--":(e-t).toFixed(1)});targetVMGOffsetRatioColor=ie(()=>{let e=this.VMG(),t=this.targetVMG(),i=this.gradianColor().start,o=this.gradianColor().stop;if(e==null||t==null)return i;let r=e/t;return this.interpolateColor(i,o,r)});waypointActive=w(!1);flow=ie(()=>{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;animationFrameIds=new WeakMap;ngZone=A(Be);constructor(){V(()=>{let e=this.waypointEnabled();W(()=>{this.waypointActive.set(e)})}),V(()=>{let e=this.compassHeading(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&W(()=>{this.compass.oldValue=this.compass.newValue,this.compass.newValue=t,this.headingValue.set(t.toString()),this.rotatingDial()?.nativeElement&&(Ut(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateWindSectors())})}),V(()=>{let e=this.targetAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&W(()=>{this.tack.oldValue=this.tack.newValue,this.tack.newValue=t,this.tackIndicator()?.nativeElement&&Ut(this.tackIndicator().nativeElement,this.tack.oldValue,this.tack.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620]),this.updateLaylines()})}),V(()=>{let e=this.waypointAngle();W(()=>{if(!e){this.waypointActive.set(!1);return}this.waypointEnabled()?this.waypointActive.set(!0):this.waypointActive.set(!1),this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=e,this.wptIndicator()?.nativeElement&&Ut(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620])})}),V(()=>{let e=this.trueWindAngle(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&W(()=>{this.twa.oldValue=this.twa.newValue,this.trueWindHeading=t,this.twa.newValue=this.addHeading(this.trueWindHeading,this.compass.newValue*-1),this.twaIndicator()?.nativeElement&&(Ut(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateLaylines())})}),V(()=>{let e=this.polarSpeedRatio(),t=Math.max(0,Math.min(1,e)),i=620,r=i-166,s=i-r*t;this.animateSpeedLine(this.speedLinePrevTipY,s),this.speedLinePrevTipY=s,this.speedLinePrevRatio=t}),V(()=>{let e=this.driftSet(),t=Number.isFinite(e)?Math.round(e):null;t!=null&&W(()=>{this.set.oldValue=this.set.newValue,this.set.newValue=t,this.setIndicator()?.nativeElement&&Ut(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone)})})}updateLaylines(){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),o=i-t;this.animateLayline(this.portLaylinePrev,o,!0),this.portLaylinePrev=o;let r=i+t;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 o=()=>{i?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null},r=Zr(e,t,this.ANIMATION_DURATION,s=>this.setLaylinePath(s,i),o,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 o=()=>{i?this.portSectorAnimId=null:this.stbdSectorAnimId=null},r=Qr(e,t,this.ANIMATION_DURATION,s=>this.setWindSectorPath(s,i),o,this.ngZone);i?this.portSectorAnimId=r:this.stbdSectorAnimId=r}animateSpeedLine(e,t){this.speedLineAnimId&&(cancelAnimationFrame(this.speedLineAnimId),this.speedLineAnimId=null);let i=1e3,o=performance.now(),r=this.speedLinePrevRatio,s=(600-t)/454,c=f=>f<.5?4*f*f*f:1-Math.pow(-2*f+2,3)/2,p=f=>{let b=f-o,x=Math.min(b/i,1),S=c(x),_=(K,Y)=>K+(Y-K)*S,k=_(e,t),B=_(r,s);this.speedLineTipY.set(k);let R=30,G=20,j=k-R;this.speedTipPoints.set(`600,${j} ${600-G},${k} ${600+G},${k}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,B)),x<1?this.speedLineAnimId=requestAnimationFrame(p):this.speedLineAnimId=null};requestAnimationFrame(p)}interpolateColor(e,t,i){i=Math.max(0,Math.min(1,i));function o(k){k=k.replace("#",""),k.length===3&&(k=k.split("").map(R=>R+R).join(""));let B=parseInt(k,16);return[B>>16&255,B>>8&255,B&255]}let[r,s,c]=o(e),[p,f,b]=o(t),x=Math.round(r+(p-r)*i),S=Math.round(s+(f-s)*i),_=Math.round(c+(b-c)*i);return`rgb(${x},${S},${_})`}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,o=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 ${o},${r}`):this.laylineStbdPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${o},${r}`)}setWindSectorPath(e,t){let i=this.addHeading(this.addHeading(e.min,Number(this.compass.newValue)*-1),this.targetAngle()/2*(t?-1:1)),o=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,c=this.RADIUS*Math.cos(i*Math.PI/180)*-1+this.CENTER_Y,p=this.RADIUS*Math.sin(o*Math.PI/180)+this.CENTER_X,f=this.RADIUS*Math.cos(o*Math.PI/180)*-1+this.CENTER_Y,b=this.RADIUS*Math.sin(r*Math.PI/180)+this.CENTER_X,x=this.RADIUS*Math.cos(r*Math.PI/180)*-1+this.CENTER_Y,S=Math.abs(lm([s,c],[p,f],[b,x]))>Math.PI/2?0:1,_=lm([b,x],[s,c],[p,f])>0?0:1,k=`M ${this.CENTER_X},${this.CENTER_Y} L ${s},${c} A ${this.RADIUS},${this.RADIUS} 0 ${S} ${_} ${b},${x} z`;t?this.portWindSectorPath.set(k):this.stbdWindSectorPath.set(k)}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 o=this.animationFrameIds.get(i);o&&cancelAnimationFrame(o),this.animationFrameIds.delete(i)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["svg-racesteer"]],viewQuery:function(t,i){t&1&&Ce(i.rotatingDial,g1,5)(i.twaIndicator,f1,5)(i.wptIndicator,v1,5)(i.setIndicator,b1,5)(i.tackIndicator,A1,5),t&2&&Se(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&&(te(),E(0,"svg",5)(1,"defs",6)(2,"linearGradient",7),Z(3,"stop",8)(4,"stop",9),P(),E(5,"linearGradient",10),Z(6,"stop",8)(7,"stop",9),P(),E(8,"linearGradient",11),Z(9,"stop",12)(10,"stop",13),P(),E(11,"linearGradient",14),Z(12,"stop",15),P(),E(13,"clipPath",16),Z(14,"ellipse",17),P(),Z(15,"linearGradient",18)(16,"linearGradient",19)(17,"linearGradient",20),P(),E(18,"g",21)(19,"g",22),Z(20,"path",23)(21,"path",24),P()(),E(22,"g",25)(23,"g",26),Z(24,"circle",27),P(),E(25,"g",null,0)(27,"g",28),Z(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),d(66,"330"),P()(),E(67,"text",67)(68,"tspan",68),d(69,"300"),P()(),E(70,"text",69)(71,"tspan",70),d(72,"W"),P()(),E(73,"text",71)(74,"tspan",72),d(75,"240"),P()(),E(76,"text",73)(77,"tspan",74),d(78,"210"),P()(),E(79,"text",75)(80,"tspan",76),d(81,"S"),P()(),E(82,"text",77)(83,"tspan",78),d(84,"150"),P()(),E(85,"text",79)(86,"tspan",80),d(87,"120"),P()(),E(88,"text",81)(89,"tspan",82),d(90,"E"),P()(),E(91,"text",83)(92,"tspan",84),d(93,"60"),P()(),E(94,"text",85)(95,"tspan",86),d(96,"30"),P()(),E(97,"text",87)(98,"tspan",88),d(99,"N"),P()()()()(),E(100,"g",89),Z(101,"path",90)(102,"path",91),P(),E(103,"g",92),Z(104,"path",93)(105,"path",94),P(),E(106,"g",95)(107,"g",96)(108,"text",97),d(109,"Tack/Gybe"),P(),Z(110,"rect",98),E(111,"text",99),d(112),lt(113,"number"),E(114,"tspan",100),d(115,"\xB0"),P()()(),E(116,"g",101)(117,"text",102),d(118,"Wind VMG"),P(),E(119,"text",103),d(120),E(121,"tspan",104),d(122," kts"),P()(),E(123,"text",105),d(124),E(125,"tspan",104),d(126," kts"),P()()(),E(127,"g",106)(128,"text",107),d(129,"Waypoint"),P(),Z(130,"rect",108),E(131,"text",109)(132,"tspan",110),d(133,"VMG: "),P(),d(134),E(135,"tspan",104),d(136," kts"),P()(),E(137,"text",111)(138,"tspan",110),d(139,"HDG: "),P(),d(140),E(141,"tspan",100),d(142,"\xB0"),E(143,"tspan",104),d(144,"T"),P()()()()(),E(145,"g",112)(146,"g",null,1),Z(148,"path",113),P(),E(149,"g",null,2),Z(151,"path",114),E(152,"text",115),d(153,"T"),P()(),E(154,"g",null,3),Z(156,"ellipse",116),P()(),E(157,"g",117),Z(158,"line",118)(159,"line",119)(160,"polygon",120),P(),E(161,"g",121),Z(162,"path",122,4),E(164,"text",123),d(165),P()(),E(166,"g",124),Z(167,"rect",125),E(168,"text",126),d(169),E(170,"tspan",100),d(171,"\xB0"),E(172,"tspan",127),d(173,"T"),P()()()()()),t&2&&(g(101),pe("display",i.portWindSectorPath()!="none"?"inline":"none"),Q("d",i.portWindSectorPath()),g(),pe("display",i.stbdWindSectorPath()!="none"?"inline":"none"),Q("d",i.stbdWindSectorPath()),g(2),pe("display",i.trueWindAngle()!=null?"inline":"none"),Q("d",i.laylinePortPath()),g(),pe("display",i.trueWindAngle()!=null?"inline":"none"),Q("d",i.laylineStbdPath()),g(7),he("",cn(113,36,i.nextTargetDirection(),"1.0-0")," "),g(7),pe("fill",i.targetVMGOffsetRatioColor()),g(),X(i.targetVMG()),g(3),pe("fill",i.targetVMGOffsetRatioColor()),g(),X(i.targetVMGOffset()),g(10),X(i.vmgToWaypoint()),g(6),X(i.waypointAngle()),g(11),pe("fill",i.windAnglePerformanceRatioColor()),g(3),Q("display",i.waypointActive()?"inline":"none"),g(5),pe("stroke",i.speedRatioColor()),Q("y2",i.speedLineTipY()),g(),pe("fill",i.speedRatioColor())("stroke",i.speedRatioColor()),Q("points",i.speedTipPoints()),g(),pe("display",i.driftEnabled()?"inline":"none"),g(4),X(i.flow()),g(4),he(" ",i.headingValue()))},dependencies:[_a],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 cm=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);streams=A(Ne);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(){V(()=>{let e=this.runtime.options();!e||!e.paths?.headingPath?.path||W(()=>this.streams.observe("headingPath",o=>{let r=o?.data?.value;this.currentHeading.set(r??0)}))}),V(()=>{let e=this.runtime.options();!e||!e.courseOverGroundEnable||!e.paths?.courseOverGround?.path||W(()=>this.streams.observe("courseOverGround",o=>{let r=o?.data?.value;this.courseOverGroundAngle.set(r??0)}))}),V(()=>{let e=this.runtime.options();!e||!e.driftEnable||!e.paths?.drift?.path||W(()=>this.streams.observe("drift",o=>{let r=o?.data?.value;this.driftFlow.set(r??0)}))}),V(()=>{let e=this.runtime.options();!e||!e.driftEnable||!e.paths?.set?.path||W(()=>this.streams.observe("set",o=>{let r=o?.data?.value,s=r??0;this.driftSet.set(this.addHeading(-this.currentHeading(),s))}))}),V(()=>{let e=this.runtime.options();!e||!e.waypointEnable||!e.paths?.nextWaypointBearing?.path||W(()=>this.streams.observe("nextWaypointBearing",o=>{let r=o?.data?.value;if(r==null){this.waypointAngle.set(0);return}let s=r<0?360+r:r,c=this.addHeading(-this.currentHeading(),s);this.waypointAngle.set(Math.round(c))}))}),V(()=>{let e=this.runtime.options();!e||!e.awsEnable||!e.paths?.appWindAngle?.path||W(()=>this.streams.observe("appWindAngle",o=>{let r=o?.data?.value,s=r??0;if(s=s<0?360+s:s,this.appWindAngle.set(s),e.windSectorEnable){let c=this.currentHeading(),p=this.addHeading(c,r??0);this.addHistoricalWindDirection(p,e.windSectorWindowSeconds)}}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.tackTrue?.path||W(()=>this.streams.observe("tackTrue",o=>{let r=o?.data?.value;this.tackTrue.set(r==null?0:Math.round(r))}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.polarSpeedRatio?.path||W(()=>this.streams.observe("polarSpeedRatio",o=>{let r=o?.data?.value;this.polarSpeedRatio.set(r??0)}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.targetAngle?.path||W(()=>this.streams.observe("targetAngle",o=>{let r=o?.data?.value;this.targetAngle.set(r)}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.optimalWindAngle?.path||W(()=>this.streams.observe("optimalWindAngle",o=>{let r=o?.data?.value;this.optimalWindAngle.set(r??0)}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.targetVMG?.path||W(()=>this.streams.observe("targetVMG",o=>{let r=o?.data?.value,s=r==null?0:Math.round(r*10)/10;this.targetVMG.set(s)}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.VMG?.path||W(()=>this.streams.observe("VMG",o=>{let r=o?.data?.value,s=r==null?0:Math.round(r*10)/10;this.VMG.set(s)}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.vmgToWaypoint?.path||W(()=>this.streams.observe("vmgToWaypoint",o=>{let r=o?.data?.value,s=r==null?null:Math.round(r*10)/10;this.vmgToWaypoint.set(s)}))}),V(()=>{let e=this.theme();if(!e)return;let t=e?.blue??"#3298ff",i=e?.green??"#15af00";W(()=>this.gradianColor.set({start:t,stop:i}))}),V(()=>{let e=this.runtime.options();!e||!e.awsEnable||!e.paths?.appWindSpeed?.path||W(()=>this.streams.observe("appWindSpeed",o=>{let r=o?.data?.value;this.appWindSpeed.set(r??0)}))}),V(()=>{let e=this.runtime.options();!e||!e.twsEnable||!e.paths?.trueWindSpeed?.path||W(()=>this.streams.observe("trueWindSpeed",o=>{let r=o?.data?.value;this.trueWindSpeed.set(r??0)}))}),V(()=>{let e=this.runtime.options();if(!e||!e.twsEnable)return;let i=e.paths?.trueWindAngle?.path;i&&W(()=>this.streams.observe("trueWindAngle",o=>{let r=o?.data?.value,s=r??0;if(i.includes("angleTrueWater")||i.includes("angleTrueGround")){let c=this.currentHeading();s=this.addHeading(c,s)}else s=s<0?360+s:s;this.trueWindAngle.set(s)}))}),V(()=>{let e=this.runtime.options();e&&(e.windSectorEnable?this.windSectorSub||W(()=>this.windSectorSub=Qo(500).subscribe(()=>this.historicalCleanup(e.windSectorWindowSeconds))):(this.windSectorSub?.unsubscribe(),this.windSectorSub=null))})}sectorArc=ie(()=>{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(o=>o.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,o)=>{let r=o;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=q({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&&L(0,"svg-racesteer",0),t&2){let o,r,s;I("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",(o=i.runtime.options())==null?null:o.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:[dm],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg-racesteer[_ngcontent-%COMP%]{width:100%;height:100%}"]})}return n})();var y1=["canvasMainRef"];function x1(n,a){if(n&1&&(l(0,"div",8),te(),l(1,"svg",11)(2,"text",12),d(3),u()()()),n&2){let e=T();g(3),he("@ ",e.startAtTime())}}function C1(n,a){if(n&1){let e=xe();l(0,"button",13),z("click",function(){J(e);let i=T();return ee(i.sendStartTimerCommand("start"))}),l(1,"mat-icon",5),te(),l(2,"svg",6)(3,"text",14),d(4,"Start"),u()()()(),Fe(),l(5,"button",15),z("click",function(){J(e);let i=T();return ee(i.adjustStartTime(-60))}),l(6,"mat-icon",5),te(),l(7,"svg",6)(8,"text",14),d(9,"-1m"),u()()()(),Fe(),l(10,"button",16),z("click",function(){J(e);let i=T();return ee(i.adjustStartTime(60))}),l(11,"mat-icon",5),te(),l(12,"svg",6)(13,"text",14),d(14,"+1m"),u()()()()}}function S1(n,a){if(n&1){let e=xe();l(0,"button",17),z("click",function(){J(e);let i=T();return ee(i.sendStartTimerCommand("sync"))}),l(1,"mat-icon",5),te(),l(2,"svg",18)(3,"text",19),d(4,"Sync"),u()()()(),Fe(),l(5,"button",20),z("click",function(){J(e);let i=T();return ee(i.sendStartTimerCommand("reset"))}),l(6,"mat-icon",5),te(),l(7,"svg",18)(8,"text",19),d(9,"Reset"),u()()()()}}function w1(n,a){if(n&1){let e=xe();l(0,"button",21),z("click",function(){J(e);let i=T();return ee(i.adjustStartTime(-60))}),l(1,"mat-icon",5),te(),l(2,"svg",22)(3,"text",23),d(4,"-1m"),u()()()(),Fe(),l(5,"button",24),z("click",function(){J(e);let i=T();return ee(i.adjustStartTime(-1))}),l(6,"mat-icon",5),te(),l(7,"svg",22)(8,"text",23),d(9,"-1s"),u()()()(),Fe(),l(10,"button",25),z("click",function(){J(e);let i=T();return ee(i.adjustStartTime(1))}),l(11,"mat-icon",5),te(),l(12,"svg",22)(13,"text",23),d(14,"+1s"),u()()()(),Fe(),l(15,"button",26),z("click",function(){J(e);let i=T();return ee(i.adjustStartTime(60))}),l(16,"mat-icon",5),te(),l(17,"svg",22)(18,"text",23),d(19,"+1m"),u()()()()}}function _1(n,a){if(n&1){let e=xe();l(0,"input",27),sn("ngModelChange",function(i){J(e);let o=T();return rn(o.startAtTimeEdit,i)||(o.startAtTimeEdit=i),ee(i)}),z("change",function(){J(e);let i=T();return ee(i.setStartTime())}),u()}if(n&2){let e=T();on("ngModel",e.startAtTimeEdit)}}function M1(n,a){n&1&&L(0,"div",10)}var mm=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);streams=A(Ne);signalk=A(Jt);dashboard=A(mt);canvas=A(ct);destroyRef=A(tt);canvasRef=ce.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=pr("");constructor(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{let i=we(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.valueStateColor=i.color,this.draw()})}),V(()=>{let e=this.runtime.options();!e||!e.paths?.ttsPath?.path||W(()=>this.streams.observe("ttsPath",o=>{let r=this.ttsValue;this.ttsValue=o?.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)}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.startTimePath?.path||W(()=>this.streams.observe("startTimePath",o=>{let r=o?.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()}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.dtsPath?.path||W(()=>this.streams.observe("dtsPath",o=>{this.dtsValue=o?.data?.value??null}))}),this.signalk.subscribeRequest().pipe(Je(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],o=t[1],r=t.length>=3?t[2]:0,s=new Date(e);s.setHours(i,o,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),o=Math.floor(e%3600/60),r=Math.floor(e%60),s=t?"-":"";return i===0?`${s}${o.toString().padStart(1,"0")}:${r.toString().padStart(2,"0")}`:`${s}${i.toString().padStart(1,"0")}:${o.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,o=new i,r=o.createOscillator(),s=o.createGain();r.connect(s),s.connect(o.destination),r.type="sine",r.frequency.value=e,s.gain.value=.1,r.start(),r.stop(o.currentTime+t/1e3)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-racer-timer"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,y1,5),t&2&&Se()},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&&(l(0,"div",1),L(1,"canvas",2,0),u(),l(3,"div",3)(4,"button",4),z("click",function(){return i.toggleMode()}),l(5,"mat-icon",5),te(),l(6,"svg",6)(7,"text",7),d(8,"\u22EE"),u()()()(),O(9,x1,4,1,"div",8)(10,C1,15,0)(11,S1,10,0)(12,w1,20,0)(13,_1,1,1,"input",9),u(),O(14,M1,1,0,"div",10)),t&2){let o;g(9),N((o=i.mode())===0?9:o===1?10:o===2?11:o===3?12:o===4?13:-1),g(5),N(i.dashboard.isDashboardStatic()?-1:14)}},dependencies:[St,yt,dt,kn,nt,At,at,Qe,Ua,Ba,kt],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}"]})}return n})();var k1=["canvasMainRef"];function T1(n,a){if(n&1&&(l(0,"div",10),te(),l(1,"svg",11)(2,"text",12),d(3),u()()(),Fe(),l(4,"div",13),te(),l(5,"svg",14)(6,"text",15)(7,"tspan",16),d(8,"\u2691"),u(),d(9),l(10,"tspan",17),d(11,"\u2691"),u()()()(),Fe(),l(12,"div",18),te(),l(13,"svg",19)(14,"text",12),d(15),u()()()),n&2){let e=T();g(3),X(e.portBiasValue()),g(6),he(" ",e.lineLengthValue()," "),g(6),X(e.stbBiasValue())}}function E1(n,a){if(n&1){let e=xe();l(0,"button",20),z("click",function(){J(e);let i=T();return ee(i.setLineEnd("port"))}),l(1,"mat-icon",6),te(),l(2,"svg",21)(3,"text",22),d(4,"Port End"),u()()()(),Fe(),l(5,"button",23),z("click",function(){J(e);let i=T();return ee(i.setLineEnd("stb"))}),l(6,"mat-icon",6),te(),l(7,"svg",21)(8,"text",22),d(9,"Stbd End"),u()()()()}}function D1(n,a){if(n&1){let e=xe();l(0,"button",24),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("port",5,0))}),l(1,"mat-icon",6),te(),l(2,"svg",25)(3,"text",26),d(4,"+5m"),u()()()(),Fe(),l(5,"button",27),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("port",-5,0))}),l(6,"mat-icon",6),te(),l(7,"svg",25)(8,"text",26),d(9,"-5m"),u()()()(),Fe(),l(10,"button",28),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("stb",-5,0))}),l(11,"mat-icon",6),te(),l(12,"svg",25)(13,"text",26),d(14,"-5m"),u()()()(),Fe(),l(15,"button",29),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("stb",5,0))}),l(16,"mat-icon",6),te(),l(17,"svg",25)(18,"text",26),d(19,"+5m"),u()()()()}}function P1(n,a){if(n&1){let e=xe();l(0,"button",30),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("port",0,i.toRadians(1)))}),l(1,"mat-icon",6),te(),l(2,"svg",25)(3,"text",26),d(4,"\u21911\xB0"),u()()()(),Fe(),l(5,"button",31),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("port",0,i.toRadians(-1)))}),l(6,"mat-icon",6),te(),l(7,"svg",25)(8,"text",26),d(9,"\u21931\xB0"),u()()()(),Fe(),l(10,"button",32),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("stb",0,i.toRadians(1)))}),l(11,"mat-icon",6),te(),l(12,"svg",25)(13,"text",26),d(14,"\u21931\xB0"),u()()()(),Fe(),l(15,"button",33),z("click",function(){J(e);let i=T();return ee(i.adjustLineEnd("stb",0,i.toRadians(-1)))}),l(16,"mat-icon",6),te(),l(17,"svg",25)(18,"text",26),d(19,"\u21911\xB0"),u()()()()}}function I1(n,a){if(n&1){let e=xe();l(0,"button",34),z("click",function(){J(e);let i=T();return ee(i.nextDisplayLineName())}),l(1,"mat-icon",6),te(),l(2,"svg",25)(3,"text",26),d(4,"Line"),u()()()(),Fe(),l(5,"button",35),z("click",function(){J(e);let i=T();return ee(i.setStartLine(i.getDisplayLineName()))}),l(6,"mat-icon",6),te(),l(7,"svg",36)(8,"text",37),d(9),u()()()()}if(n&2){let e=T();g(5),Ke(qs("button ",e.isDisplayLineCurrent()?"line-button-current":"line-button")),I("matTooltip",qs("Set the ",e.getDisplayLineName()," line as the current line")),g(4),X(e.getDisplayLineName())}}function O1(n,a){n&1&&L(0,"div",9)}var hm=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);canvas=A(ct);dashboard=A(mt);signalk=A(Jt);destroyRef=A(tt);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=ce.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(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{let i=we(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw()})}),V(()=>{let e=this.runtime.options();!e||!e.paths?.dtsPath?.path||W(()=>this.streams.observe("dtsPath",i=>{this.dtsValue=i?.data?.value??null,this.updateDtsColor(),this.draw()}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.lineLengthPath?.path||W(()=>this.streams.observe("lineLengthPath",i=>{this.lengthValue=i?.data?.value??null,this.setLenBias(),this.draw()}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.lineBiasPath?.path||W(()=>this.streams.observe("lineBiasPath",i=>{this.biasValue=i?.data?.value??null,this.setLenBias()}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.startLineNamePath?.path||W(()=>this.streams.observe("startLineNamePath",i=>{console.log("startLineName: "+JSON.stringify(i??"no data")),this.startLineName=i?.data?.value??null,this.displayLineIndex=0;for(let o=0;o<this.lines.length;o++)if(this.lines[o]===this.startLineName){this.displayLineIndex=o;break}this.draw()}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.linesPath?.path||W(()=>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 o of i.data.value)o.startLineName&&(o.startLineName===this.startLineName&&(this.displayLineIndex=this.lines.length),this.lines.push(o.startLineName))}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.ttlPath?.path||W(()=>this.streams.observe("ttlPath",o=>{this.ttlValue=o?.data?.value??null,this.draw()}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.ttbPath?.path||W(()=>this.streams.observe("ttbPath",o=>{this.ttbValue=o?.data?.value??null,this.draw()}))}),this.signalk.subscribeRequest().pipe(Je(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),o=Math.floor(e%3600/60),r=Math.floor(e%60),s=t?"-":"";return i===0?`${s}${o.toString().padStart(1,"0")}:${r.toString().padStart(2,"0")}`:`${s}${i.toString().padStart(1,"0")}:${o.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,o=new i,r=o.createOscillator(),s=o.createGain();r.connect(s),s.connect(o.destination),r.type="sine",r.frequency.value=e,s.gain.value=.1,r.start(),r.stop(o.currentTime+t/1e3)}ngOnDestroy(){try{this.canvasElement&&this.canvas.unregisterCanvas(this.canvasElement)}catch(e){}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-racer-line"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,k1,5),t&2&&Se()},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&&(l(0,"div",1)(1,"div",2),L(2,"canvas",3,0),u(),l(4,"div",4)(5,"button",5),z("click",function(){return i.toggleMode()}),l(6,"mat-icon",6),te(),l(7,"svg",7)(8,"text",8),d(9,"\u22EE"),u()()()(),O(10,T1,16,3)(11,E1,10,0)(12,D1,20,0)(13,P1,20,0)(14,I1,10,6),u(),O(15,O1,1,0,"div",9),u()),t&2){let o;g(10),N((o=i.mode())===0?10:o===1?11:o===2?12:o===3?13:o===4?14:-1),g(5),N(i.dashboard.isDashboardStatic()?-1:15)}},dependencies:[nt,At,at,Qe,Ua,Ba],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}"]})}return n})();var N1=["canvasMainRef"];function R1(n,a){if(n&1){let e=xe();l(0,"button",14),z("click",function(){J(e);let i=T();return ee(i.startTimer())}),d(1," Start "),u()}}function L1(n,a){if(n&1){let e=xe();l(0,"button",15),z("click",function(){J(e);let i=T();return ee(i.pauseTimer())}),d(1," Pause "),u()}}var pm=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);timers=A(ru);canvas=A(ct);static DEFAULT_CONFIG={timerLength:-300,color:"contrast",playBeeps:!0,displayName:"Race",filterSelfPaths:!0,paths:{},enableTimeout:!1,dataTimeout:5,ignoreZones:!0};canvasRef=ce.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(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{this.applyColors(e.color,t),this.draw()})}),V(()=>{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),o=i.createOscillator(),r=i.createGain();o.connect(r),r.connect(i.destination),o.type="sine",o.frequency.value=e,r.gain.value=.1,o.start(),o.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),o=Math.floor(t%60);e=`${i}:${("0"+o).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=q({type:n,selectors:[["widget-racetimer"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,N1,5),t&2&&Se()},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&&(l(0,"div",1),L(1,"canvas",2,0),l(3,"div",3)(4,"div",4)(5,"button",5),z("click",function(){return i.removeTime(5)}),l(6,"mat-icon",6),te(),l(7,"svg",7)(8,"text",8),d(9,"-5s"),u()()()(),Fe(),l(10,"button",5),z("click",function(){return i.removeTime(60)}),l(11,"mat-icon",6),te(),l(12,"svg",7)(13,"text",8),d(14,"-60s"),u()()()(),Fe(),l(15,"button",9),z("click",function(){return i.resetTimer()}),l(16,"mat-icon",6),te(),l(17,"svg",7)(18,"text",8),d(19,"Reset"),u()()()(),Fe(),l(20,"button",5),z("click",function(){return i.addTime(60)}),l(21,"mat-icon",6),te(),l(22,"svg",7)(23,"text",8),d(24,"+60s"),u()()()(),Fe(),l(25,"button",5),z("click",function(){return i.addTime(5)}),l(26,"mat-icon",6),te(),l(27,"svg",7)(28,"text",8),d(29,"+5s"),u()()()()(),Fe(),l(30,"div",10),O(31,R1,2,0,"button",11),O(32,L1,2,0,"button",12),l(33,"button",13),z("click",function(){return i.roundToMin()}),d(34," Synch "),u()()()()),t&2&&(g(31),N(i.timerRunning()?-1:31),g(),N(i.timerRunning()?32:-1))},dependencies:[nt,At,at,Qe],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}"]})}return n})();var V1=["canvasMainRef"],gm=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);canvas=A(ct);canvasRef=ce.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(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{let i=we(e.color,t);this.labelColor.set(i.dim),this.valueColor=i.color,this.draw()})}),V(()=>{let e=this.runtime.options();if(!e)return;let t=e.paths?.longPath;t?.path&&W(()=>this.streams.observe("longPath",i=>{let o=i?.data?.value;o==null?this.longPos="":t.convertUnitTo==="pdeg"?this.longPos=o.toFixed(6)+"\xB0":this.longPos=String(o),this.calculateFontSizeAndPositions(),this.draw()}))}),V(()=>{let e=this.runtime.options();if(!e)return;let t=e.paths?.latPath;t?.path&&W(()=>this.streams.observe("latPath",i=>{let o=i?.data?.value;o==null?this.latPos="":t.convertUnitTo==="pdeg"?this.latPos=o.toFixed(7)+"\xB0":this.latPos=String(o),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=q({type:n,selectors:[["widget-position"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,V1,5),t&2&&Se()},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&&Z(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}"]})}return n})();var W1={value:()=>{}};function vm(){for(var n=0,a=arguments.length,e={},t;n<a;++n){if(!(t=arguments[n]+"")||t in e||/[\s.]/.test(t))throw new Error("illegal type: "+t);e[t]=[]}return new Xr(e)}function Xr(n){this._=n}function F1(n,a){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&&!a.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})}Xr.prototype=vm.prototype={constructor:Xr,on:function(n,a){var e=this._,t=F1(n+"",e),i,o=-1,r=t.length;if(arguments.length<2){for(;++o<r;)if((i=(n=t[o]).type)&&(i=G1(e[i],n.name)))return i;return}if(a!=null&&typeof a!="function")throw new Error("invalid callback: "+a);for(;++o<r;)if(i=(n=t[o]).type)e[i]=fm(e[i],n.name,a);else if(a==null)for(i in e)e[i]=fm(e[i],n.name,null);return this},copy:function(){var n={},a=this._;for(var e in a)n[e]=a[e].slice();return new Xr(n)},call:function(n,a){if((i=arguments.length-2)>0)for(var e=new Array(i),t=0,i,o;t<i;++t)e[t]=arguments[t+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(o=this._[n],t=0,i=o.length;t<i;++t)o[t].value.apply(a,e)},apply:function(n,a,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var t=this._[n],i=0,o=t.length;i<o;++i)t[i].value.apply(a,e)}};function G1(n,a){for(var e=0,t=n.length,i;e<t;++e)if((i=n[e]).name===a)return i.value}function fm(n,a,e){for(var t=0,i=n.length;t<i;++t)if(n[t].name===a){n[t]=W1,n=n.slice(0,t).concat(n.slice(t+1));break}return e!=null&&n.push({name:a,value:e}),n}var pl=vm;var Kr="http://www.w3.org/1999/xhtml",gl={svg:"http://www.w3.org/2000/svg",xhtml:Kr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hn(n){var a=n+="",e=a.indexOf(":");return e>=0&&(a=n.slice(0,e))!=="xmlns"&&(n=n.slice(e+1)),gl.hasOwnProperty(a)?{space:gl[a],local:n}:n}function B1(n){return function(){var a=this.ownerDocument,e=this.namespaceURI;return e===Kr&&a.documentElement.namespaceURI===Kr?a.createElement(n):a.createElementNS(e,n)}}function U1(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function Jr(n){var a=hn(n);return(a.local?U1:B1)(a)}function z1(){}function ca(n){return n==null?z1:function(){return this.querySelector(n)}}function bm(n){typeof n!="function"&&(n=ca(n));for(var a=this._groups,e=a.length,t=new Array(e),i=0;i<e;++i)for(var o=a[i],r=o.length,s=t[i]=new Array(r),c,p,f=0;f<r;++f)(c=o[f])&&(p=n.call(c,c.__data__,f,o))&&("__data__"in c&&(p.__data__=c.__data__),s[f]=p);return new ft(t,this._parents)}function fl(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function H1(){return[]}function To(n){return n==null?H1:function(){return this.querySelectorAll(n)}}function q1(n){return function(){return fl(n.apply(this,arguments))}}function Am(n){typeof n=="function"?n=q1(n):n=To(n);for(var a=this._groups,e=a.length,t=[],i=[],o=0;o<e;++o)for(var r=a[o],s=r.length,c,p=0;p<s;++p)(c=r[p])&&(t.push(n.call(c,c.__data__,p,r)),i.push(c));return new ft(t,i)}function Eo(n){return function(){return this.matches(n)}}function es(n){return function(a){return a.matches(n)}}var j1=Array.prototype.find;function $1(n){return function(){return j1.call(this.children,n)}}function Y1(){return this.firstElementChild}function ym(n){return this.select(n==null?Y1:$1(typeof n=="function"?n:es(n)))}var Z1=Array.prototype.filter;function Q1(){return Array.from(this.children)}function X1(n){return function(){return Z1.call(this.children,n)}}function xm(n){return this.selectAll(n==null?Q1:X1(typeof n=="function"?n:es(n)))}function Cm(n){typeof n!="function"&&(n=Eo(n));for(var a=this._groups,e=a.length,t=new Array(e),i=0;i<e;++i)for(var o=a[i],r=o.length,s=t[i]=[],c,p=0;p<r;++p)(c=o[p])&&n.call(c,c.__data__,p,o)&&s.push(c);return new ft(t,this._parents)}function ts(n){return new Array(n.length)}function Sm(){return new ft(this._enter||this._groups.map(ts),this._parents)}function Do(n,a){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=a}Do.prototype={constructor:Do,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,a){return this._parent.insertBefore(n,a)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function wm(n){return function(){return n}}function K1(n,a,e,t,i,o){for(var r=0,s,c=a.length,p=o.length;r<p;++r)(s=a[r])?(s.__data__=o[r],t[r]=s):e[r]=new Do(n,o[r]);for(;r<c;++r)(s=a[r])&&(i[r]=s)}function J1(n,a,e,t,i,o,r){var s,c,p=new Map,f=a.length,b=o.length,x=new Array(f),S;for(s=0;s<f;++s)(c=a[s])&&(x[s]=S=r.call(c,c.__data__,s,a)+"",p.has(S)?i[s]=c:p.set(S,c));for(s=0;s<b;++s)S=r.call(n,o[s],s,o)+"",(c=p.get(S))?(t[s]=c,c.__data__=o[s],p.delete(S)):e[s]=new Do(n,o[s]);for(s=0;s<f;++s)(c=a[s])&&p.get(x[s])===c&&(i[s]=c)}function eA(n){return n.__data__}function _m(n,a){if(!arguments.length)return Array.from(this,eA);var e=a?J1:K1,t=this._parents,i=this._groups;typeof n!="function"&&(n=wm(n));for(var o=i.length,r=new Array(o),s=new Array(o),c=new Array(o),p=0;p<o;++p){var f=t[p],b=i[p],x=b.length,S=tA(n.call(f,f&&f.__data__,p,t)),_=S.length,k=s[p]=new Array(_),B=r[p]=new Array(_),R=c[p]=new Array(x);e(f,b,k,B,R,S,a);for(var G=0,j=0,K,Y;G<_;++G)if(K=k[G]){for(G>=j&&(j=G+1);!(Y=B[j])&&++j<_;);K._next=Y||null}}return r=new ft(r,t),r._enter=s,r._exit=c,r}function tA(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function Mm(){return new ft(this._exit||this._groups.map(ts),this._parents)}function km(n,a,e){var t=this.enter(),i=this,o=this.exit();return typeof n=="function"?(t=n(t),t&&(t=t.selection())):t=t.append(n+""),a!=null&&(i=a(i),i&&(i=i.selection())),e==null?o.remove():e(o),t&&i?t.merge(i).order():i}function Tm(n){for(var a=n.selection?n.selection():n,e=this._groups,t=a._groups,i=e.length,o=t.length,r=Math.min(i,o),s=new Array(i),c=0;c<r;++c)for(var p=e[c],f=t[c],b=p.length,x=s[c]=new Array(b),S,_=0;_<b;++_)(S=p[_]||f[_])&&(x[_]=S);for(;c<i;++c)s[c]=e[c];return new ft(s,this._parents)}function Em(){for(var n=this._groups,a=-1,e=n.length;++a<e;)for(var t=n[a],i=t.length-1,o=t[i],r;--i>=0;)(r=t[i])&&(o&&r.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(r,o),o=r);return this}function Dm(n){n||(n=iA);function a(b,x){return b&&x?n(b.__data__,x.__data__):!b-!x}for(var e=this._groups,t=e.length,i=new Array(t),o=0;o<t;++o){for(var r=e[o],s=r.length,c=i[o]=new Array(s),p,f=0;f<s;++f)(p=r[f])&&(c[f]=p);c.sort(a)}return new ft(i,this._parents).order()}function iA(n,a){return n<a?-1:n>a?1:n>=a?0:NaN}function Pm(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function Im(){return Array.from(this)}function Om(){for(var n=this._groups,a=0,e=n.length;a<e;++a)for(var t=n[a],i=0,o=t.length;i<o;++i){var r=t[i];if(r)return r}return null}function Nm(){let n=0;for(let a of this)++n;return n}function Rm(){return!this.node()}function Lm(n){for(var a=this._groups,e=0,t=a.length;e<t;++e)for(var i=a[e],o=0,r=i.length,s;o<r;++o)(s=i[o])&&n.call(s,s.__data__,o,i);return this}function nA(n){return function(){this.removeAttribute(n)}}function aA(n){return function(){this.removeAttributeNS(n.space,n.local)}}function oA(n,a){return function(){this.setAttribute(n,a)}}function rA(n,a){return function(){this.setAttributeNS(n.space,n.local,a)}}function sA(n,a){return function(){var e=a.apply(this,arguments);e==null?this.removeAttribute(n):this.setAttribute(n,e)}}function lA(n,a){return function(){var e=a.apply(this,arguments);e==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}}function Vm(n,a){var e=hn(n);if(arguments.length<2){var t=this.node();return e.local?t.getAttributeNS(e.space,e.local):t.getAttribute(e)}return this.each((a==null?e.local?aA:nA:typeof a=="function"?e.local?lA:sA:e.local?rA:oA)(e,a))}function is(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function dA(n){return function(){this.style.removeProperty(n)}}function cA(n,a,e){return function(){this.style.setProperty(n,a,e)}}function uA(n,a,e){return function(){var t=a.apply(this,arguments);t==null?this.style.removeProperty(n):this.style.setProperty(n,t,e)}}function Wm(n,a,e){return arguments.length>1?this.each((a==null?dA:typeof a=="function"?uA:cA)(n,a,e??"")):Un(this.node(),n)}function Un(n,a){return n.style.getPropertyValue(a)||is(n).getComputedStyle(n,null).getPropertyValue(a)}function mA(n){return function(){delete this[n]}}function hA(n,a){return function(){this[n]=a}}function pA(n,a){return function(){var e=a.apply(this,arguments);e==null?delete this[n]:this[n]=e}}function Fm(n,a){return arguments.length>1?this.each((a==null?mA:typeof a=="function"?pA:hA)(n,a)):this.node()[n]}function Gm(n){return n.trim().split(/^|\s+/)}function vl(n){return n.classList||new Bm(n)}function Bm(n){this._node=n,this._names=Gm(n.getAttribute("class")||"")}Bm.prototype={add:function(n){var a=this._names.indexOf(n);a<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var a=this._names.indexOf(n);a>=0&&(this._names.splice(a,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function Um(n,a){for(var e=vl(n),t=-1,i=a.length;++t<i;)e.add(a[t])}function zm(n,a){for(var e=vl(n),t=-1,i=a.length;++t<i;)e.remove(a[t])}function gA(n){return function(){Um(this,n)}}function fA(n){return function(){zm(this,n)}}function vA(n,a){return function(){(a.apply(this,arguments)?Um:zm)(this,n)}}function Hm(n,a){var e=Gm(n+"");if(arguments.length<2){for(var t=vl(this.node()),i=-1,o=e.length;++i<o;)if(!t.contains(e[i]))return!1;return!0}return this.each((typeof a=="function"?vA:a?gA:fA)(e,a))}function bA(){this.textContent=""}function AA(n){return function(){this.textContent=n}}function yA(n){return function(){var a=n.apply(this,arguments);this.textContent=a??""}}function qm(n){return arguments.length?this.each(n==null?bA:(typeof n=="function"?yA:AA)(n)):this.node().textContent}function xA(){this.innerHTML=""}function CA(n){return function(){this.innerHTML=n}}function SA(n){return function(){var a=n.apply(this,arguments);this.innerHTML=a??""}}function jm(n){return arguments.length?this.each(n==null?xA:(typeof n=="function"?SA:CA)(n)):this.node().innerHTML}function wA(){this.nextSibling&&this.parentNode.appendChild(this)}function $m(){return this.each(wA)}function _A(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ym(){return this.each(_A)}function Zm(n){var a=typeof n=="function"?n:Jr(n);return this.select(function(){return this.appendChild(a.apply(this,arguments))})}function MA(){return null}function Qm(n,a){var e=typeof n=="function"?n:Jr(n),t=a==null?MA:typeof a=="function"?a:ca(a);return this.select(function(){return this.insertBefore(e.apply(this,arguments),t.apply(this,arguments)||null)})}function kA(){var n=this.parentNode;n&&n.removeChild(this)}function Xm(){return this.each(kA)}function TA(){var n=this.cloneNode(!1),a=this.parentNode;return a?a.insertBefore(n,this.nextSibling):n}function EA(){var n=this.cloneNode(!0),a=this.parentNode;return a?a.insertBefore(n,this.nextSibling):n}function Km(n){return this.select(n?EA:TA)}function Jm(n){return arguments.length?this.property("__data__",n):this.node().__data__}function DA(n){return function(a){n.call(this,a,this.__data__)}}function PA(n){return n.trim().split(/^|\s+/).map(function(a){var e="",t=a.indexOf(".");return t>=0&&(e=a.slice(t+1),a=a.slice(0,t)),{type:a,name:e}})}function IA(n){return function(){var a=this.__on;if(a){for(var e=0,t=-1,i=a.length,o;e<i;++e)o=a[e],(!n.type||o.type===n.type)&&o.name===n.name?this.removeEventListener(o.type,o.listener,o.options):a[++t]=o;++t?a.length=t:delete this.__on}}}function OA(n,a,e){return function(){var t=this.__on,i,o=DA(a);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=o,i.options=e),i.value=a;return}}this.addEventListener(n.type,o,e),i={type:n.type,name:n.name,value:a,listener:o,options:e},t?t.push(i):this.__on=[i]}}function eh(n,a,e){var t=PA(n+""),i,o=t.length,r;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,p=s.length,f;c<p;++c)for(i=0,f=s[c];i<o;++i)if((r=t[i]).type===f.type&&r.name===f.name)return f.value}return}for(s=a?OA:IA,i=0;i<o;++i)this.each(s(t[i],a,e));return this}function th(n,a,e){var t=is(n),i=t.CustomEvent;typeof i=="function"?i=new i(a,e):(i=t.document.createEvent("Event"),e?(i.initEvent(a,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(a,!1,!1)),n.dispatchEvent(i)}function NA(n,a){return function(){return th(this,n,a)}}function RA(n,a){return function(){return th(this,n,a.apply(this,arguments))}}function ih(n,a){return this.each((typeof a=="function"?RA:NA)(n,a))}function*nh(){for(var n=this._groups,a=0,e=n.length;a<e;++a)for(var t=n[a],i=0,o=t.length,r;i<o;++i)(r=t[i])&&(yield r)}var bl=[null];function ft(n,a){this._groups=n,this._parents=a}function ah(){return new ft([[document.documentElement]],bl)}function LA(){return this}ft.prototype=ah.prototype={constructor:ft,select:bm,selectAll:Am,selectChild:ym,selectChildren:xm,filter:Cm,data:_m,enter:Sm,exit:Mm,join:km,merge:Tm,selection:LA,order:Em,sort:Dm,call:Pm,nodes:Im,node:Om,size:Nm,empty:Rm,each:Lm,attr:Vm,style:Wm,property:Fm,classed:Hm,text:qm,html:jm,raise:$m,lower:Ym,append:Zm,insert:Qm,remove:Xm,clone:Km,datum:Jm,on:eh,dispatch:ih,[Symbol.iterator]:nh};var pn=ah;function Al(n){return typeof n=="string"?new ft([[document.querySelector(n)]],[document.documentElement]):new ft([[n]],bl)}function ns(n,a,e){n.prototype=a.prototype=e,e.constructor=n}function yl(n,a){var e=Object.create(n.prototype);for(var t in a)e[t]=a[t];return e}function Oo(){}var Po=.7,rs=1/Po,Za="\\s*([+-]?\\d+)\\s*",Io="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",nn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",VA=/^#([0-9a-f]{3,8})$/,WA=new RegExp(`^rgb\\(${Za},${Za},${Za}\\)$`),FA=new RegExp(`^rgb\\(${nn},${nn},${nn}\\)$`),GA=new RegExp(`^rgba\\(${Za},${Za},${Za},${Io}\\)$`),BA=new RegExp(`^rgba\\(${nn},${nn},${nn},${Io}\\)$`),UA=new RegExp(`^hsl\\(${Io},${nn},${nn}\\)$`),zA=new RegExp(`^hsla\\(${Io},${nn},${nn},${Io}\\)$`),oh={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};ns(Oo,zn,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:rh,formatHex:rh,formatHex8:HA,formatHsl:qA,formatRgb:sh,toString:sh});function rh(){return this.rgb().formatHex()}function HA(){return this.rgb().formatHex8()}function qA(){return hh(this).formatHsl()}function sh(){return this.rgb().formatRgb()}function zn(n){var a,e;return n=(n+"").trim().toLowerCase(),(a=VA.exec(n))?(e=a[1].length,a=parseInt(a[1],16),e===6?lh(a):e===3?new ti(a>>8&15|a>>4&240,a>>4&15|a&240,(a&15)<<4|a&15,1):e===8?as(a>>24&255,a>>16&255,a>>8&255,(a&255)/255):e===4?as(a>>12&15|a>>8&240,a>>8&15|a>>4&240,a>>4&15|a&240,((a&15)<<4|a&15)/255):null):(a=WA.exec(n))?new ti(a[1],a[2],a[3],1):(a=FA.exec(n))?new ti(a[1]*255/100,a[2]*255/100,a[3]*255/100,1):(a=GA.exec(n))?as(a[1],a[2],a[3],a[4]):(a=BA.exec(n))?as(a[1]*255/100,a[2]*255/100,a[3]*255/100,a[4]):(a=UA.exec(n))?uh(a[1],a[2]/100,a[3]/100,1):(a=zA.exec(n))?uh(a[1],a[2]/100,a[3]/100,a[4]):oh.hasOwnProperty(n)?lh(oh[n]):n==="transparent"?new ti(NaN,NaN,NaN,0):null}function lh(n){return new ti(n>>16&255,n>>8&255,n&255,1)}function as(n,a,e,t){return t<=0&&(n=a=e=NaN),new ti(n,a,e,t)}function jA(n){return n instanceof Oo||(n=zn(n)),n?(n=n.rgb(),new ti(n.r,n.g,n.b,n.opacity)):new ti}function Qa(n,a,e,t){return arguments.length===1?jA(n):new ti(n,a,e,t??1)}function ti(n,a,e,t){this.r=+n,this.g=+a,this.b=+e,this.opacity=+t}ns(ti,Qa,yl(Oo,{brighter(n){return n=n==null?rs:Math.pow(rs,n),new ti(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Po:Math.pow(Po,n),new ti(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new ti(ma(this.r),ma(this.g),ma(this.b),ss(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:dh,formatHex:dh,formatHex8:$A,formatRgb:ch,toString:ch}));function dh(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}`}function $A(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}${ua((isNaN(this.opacity)?1:this.opacity)*255)}`}function ch(){let n=ss(this.opacity);return`${n===1?"rgb(":"rgba("}${ma(this.r)}, ${ma(this.g)}, ${ma(this.b)}${n===1?")":`, ${n})`}`}function ss(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 ua(n){return n=ma(n),(n<16?"0":"")+n.toString(16)}function uh(n,a,e,t){return t<=0?n=a=e=NaN:e<=0||e>=1?n=a=NaN:a<=0&&(n=NaN),new Li(n,a,e,t)}function hh(n){if(n instanceof Li)return new Li(n.h,n.s,n.l,n.opacity);if(n instanceof Oo||(n=zn(n)),!n)return new Li;if(n instanceof Li)return n;n=n.rgb();var a=n.r/255,e=n.g/255,t=n.b/255,i=Math.min(a,e,t),o=Math.max(a,e,t),r=NaN,s=o-i,c=(o+i)/2;return s?(a===o?r=(e-t)/s+(e<t)*6:e===o?r=(t-a)/s+2:r=(a-e)/s+4,s/=c<.5?o+i:2-o-i,r*=60):s=c>0&&c<1?0:r,new Li(r,s,c,n.opacity)}function ph(n,a,e,t){return arguments.length===1?hh(n):new Li(n,a,e,t??1)}function Li(n,a,e,t){this.h=+n,this.s=+a,this.l=+e,this.opacity=+t}ns(Li,ph,yl(Oo,{brighter(n){return n=n==null?rs:Math.pow(rs,n),new Li(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Po:Math.pow(Po,n),new Li(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,a=isNaN(n)||isNaN(this.s)?0:this.s,e=this.l,t=e+(e<.5?e:1-e)*a,i=2*e-t;return new ti(xl(n>=240?n-240:n+120,i,t),xl(n,i,t),xl(n<120?n+240:n-120,i,t),this.opacity)},clamp(){return new Li(mh(this.h),os(this.s),os(this.l),ss(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=ss(this.opacity);return`${n===1?"hsl(":"hsla("}${mh(this.h)}, ${os(this.s)*100}%, ${os(this.l)*100}%${n===1?")":`, ${n})`}`}}));function mh(n){return n=(n||0)%360,n<0?n+360:n}function os(n){return Math.max(0,Math.min(1,n||0))}function xl(n,a,e){return(n<60?a+(e-a)*n/60:n<180?e:n<240?a+(e-a)*(240-n)/60:a)*255}function Cl(n,a,e,t,i){var o=n*n,r=o*n;return((1-3*n+3*o-r)*a+(4-6*o+3*r)*e+(1+3*n+3*o-3*r)*t+r*i)/6}function gh(n){var a=n.length-1;return function(e){var t=e<=0?e=0:e>=1?(e=1,a-1):Math.floor(e*a),i=n[t],o=n[t+1],r=t>0?n[t-1]:2*i-o,s=t<a-1?n[t+2]:2*o-i;return Cl((e-t/a)*a,r,i,o,s)}}function fh(n){var a=n.length;return function(e){var t=Math.floor(((e%=1)<0?++e:e)*a),i=n[(t+a-1)%a],o=n[t%a],r=n[(t+1)%a],s=n[(t+2)%a];return Cl((e-t/a)*a,i,o,r,s)}}var Sl=n=>()=>n;function YA(n,a){return function(e){return n+e*a}}function ZA(n,a,e){return n=Math.pow(n,e),a=Math.pow(a,e)-n,e=1/e,function(t){return Math.pow(n+t*a,e)}}function vh(n){return(n=+n)==1?ls:function(a,e){return e-a?ZA(a,e,n):Sl(isNaN(a)?e:a)}}function ls(n,a){var e=a-n;return e?YA(n,e):Sl(isNaN(n)?a:n)}var ds=(function n(a){var e=vh(a);function t(i,o){var r=e((i=Qa(i)).r,(o=Qa(o)).r),s=e(i.g,o.g),c=e(i.b,o.b),p=ls(i.opacity,o.opacity);return function(f){return i.r=r(f),i.g=s(f),i.b=c(f),i.opacity=p(f),i+""}}return t.gamma=n,t})(1);function bh(n){return function(a){var e=a.length,t=new Array(e),i=new Array(e),o=new Array(e),r,s;for(r=0;r<e;++r)s=Qa(a[r]),t[r]=s.r||0,i[r]=s.g||0,o[r]=s.b||0;return t=n(t),i=n(i),o=n(o),s.opacity=1,function(c){return s.r=t(c),s.g=i(c),s.b=o(c),s+""}}}var QA=bh(gh),XA=bh(fh);function _i(n,a){return n=+n,a=+a,function(e){return n*(1-e)+a*e}}var _l=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wl=new RegExp(_l.source,"g");function KA(n){return function(){return n}}function JA(n){return function(a){return n(a)+""}}function Ml(n,a){var e=_l.lastIndex=wl.lastIndex=0,t,i,o,r=-1,s=[],c=[];for(n=n+"",a=a+"";(t=_l.exec(n))&&(i=wl.exec(a));)(o=i.index)>e&&(o=a.slice(e,o),s[r]?s[r]+=o:s[++r]=o),(t=t[0])===(i=i[0])?s[r]?s[r]+=i:s[++r]=i:(s[++r]=null,c.push({i:r,x:_i(t,i)})),e=wl.lastIndex;return e<a.length&&(o=a.slice(e),s[r]?s[r]+=o:s[++r]=o),s.length<2?c[0]?JA(c[0].x):KA(a):(a=c.length,function(p){for(var f=0,b;f<a;++f)s[(b=c[f]).i]=b.x(p);return s.join("")})}var Ah=180/Math.PI,cs={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kl(n,a,e,t,i,o){var r,s,c;return(r=Math.sqrt(n*n+a*a))&&(n/=r,a/=r),(c=n*e+a*t)&&(e-=n*c,t-=a*c),(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s,c/=s),n*t<a*e&&(n=-n,a=-a,c=-c,r=-r),{translateX:i,translateY:o,rotate:Math.atan2(a,n)*Ah,skewX:Math.atan(c)*Ah,scaleX:r,scaleY:s}}var us;function yh(n){let a=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return a.isIdentity?cs:kl(a.a,a.b,a.c,a.d,a.e,a.f)}function xh(n){return n==null?cs:(us||(us=document.createElementNS("http://www.w3.org/2000/svg","g")),us.setAttribute("transform",n),(n=us.transform.baseVal.consolidate())?(n=n.matrix,kl(n.a,n.b,n.c,n.d,n.e,n.f)):cs)}function Ch(n,a,e,t){function i(p){return p.length?p.pop()+" ":""}function o(p,f,b,x,S,_){if(p!==b||f!==x){var k=S.push("translate(",null,a,null,e);_.push({i:k-4,x:_i(p,b)},{i:k-2,x:_i(f,x)})}else(b||x)&&S.push("translate("+b+a+x+e)}function r(p,f,b,x){p!==f?(p-f>180?f+=360:f-p>180&&(p+=360),x.push({i:b.push(i(b)+"rotate(",null,t)-2,x:_i(p,f)})):f&&b.push(i(b)+"rotate("+f+t)}function s(p,f,b,x){p!==f?x.push({i:b.push(i(b)+"skewX(",null,t)-2,x:_i(p,f)}):f&&b.push(i(b)+"skewX("+f+t)}function c(p,f,b,x,S,_){if(p!==b||f!==x){var k=S.push(i(S)+"scale(",null,",",null,")");_.push({i:k-4,x:_i(p,b)},{i:k-2,x:_i(f,x)})}else(b!==1||x!==1)&&S.push(i(S)+"scale("+b+","+x+")")}return function(p,f){var b=[],x=[];return p=n(p),f=n(f),o(p.translateX,p.translateY,f.translateX,f.translateY,b,x),r(p.rotate,f.rotate,b,x),s(p.skewX,f.skewX,b,x),c(p.scaleX,p.scaleY,f.scaleX,f.scaleY,b,x),p=f=null,function(S){for(var _=-1,k=x.length,B;++_<k;)b[(B=x[_]).i]=B.x(S);return b.join("")}}}var Tl=Ch(yh,"px, ","px)","deg)"),El=Ch(xh,", ",")",")");var Xa=0,Ro=0,No=0,wh=1e3,ms,Lo,hs=0,ha=0,ps=0,Vo=typeof performance=="object"&&performance.now?performance:Date,_h=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Fo(){return ha||(_h(ey),ha=Vo.now()+ps)}function ey(){ha=0}function Wo(){this._call=this._time=this._next=null}Wo.prototype=gs.prototype={constructor:Wo,restart:function(n,a,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?Fo():+e)+(a==null?0:+a),!this._next&&Lo!==this&&(Lo?Lo._next=this:ms=this,Lo=this),this._call=n,this._time=e,Dl()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dl())}};function gs(n,a,e){var t=new Wo;return t.restart(n,a,e),t}function Mh(){Fo(),++Xa;for(var n=ms,a;n;)(a=ha-n._time)>=0&&n._call.call(void 0,a),n=n._next;--Xa}function Sh(){ha=(hs=Vo.now())+ps,Xa=Ro=0;try{Mh()}finally{Xa=0,iy(),ha=0}}function ty(){var n=Vo.now(),a=n-hs;a>wh&&(ps-=a,hs=n)}function iy(){for(var n,a=ms,e,t=1/0;a;)a._call?(t>a._time&&(t=a._time),n=a,a=a._next):(e=a._next,a._next=null,a=n?n._next=e:ms=e);Lo=n,Dl(t)}function Dl(n){if(!Xa){Ro&&(Ro=clearTimeout(Ro));var a=n-ha;a>24?(n<1/0&&(Ro=setTimeout(Sh,n-Vo.now()-ps)),No&&(No=clearInterval(No))):(No||(hs=Vo.now(),No=setInterval(ty,wh)),Xa=1,_h(Sh))}}function fs(n,a,e){var t=new Wo;return a=a==null?0:+a,t.restart(i=>{t.stop(),n(i+a)},a,e),t}var ny=pl("start","end","cancel","interrupt"),ay=[],Eh=0,kh=1,bs=2,vs=3,Th=4,As=5,Go=6;function Hn(n,a,e,t,i,o){var r=n.__transition;if(!r)n.__transition={};else if(e in r)return;oy(n,e,{name:a,index:t,group:i,on:ny,tween:ay,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Eh})}function Bo(n,a){var e=Et(n,a);if(e.state>Eh)throw new Error("too late; already scheduled");return e}function Lt(n,a){var e=Et(n,a);if(e.state>vs)throw new Error("too late; already running");return e}function Et(n,a){var e=n.__transition;if(!e||!(e=e[a]))throw new Error("transition not found");return e}function oy(n,a,e){var t=n.__transition,i;t[a]=e,e.timer=gs(o,0,e.time);function o(p){e.state=kh,e.timer.restart(r,e.delay,e.time),e.delay<=p&&r(p-e.delay)}function r(p){var f,b,x,S;if(e.state!==kh)return c();for(f in t)if(S=t[f],S.name===e.name){if(S.state===vs)return fs(r);S.state===Th?(S.state=Go,S.timer.stop(),S.on.call("interrupt",n,n.__data__,S.index,S.group),delete t[f]):+f<a&&(S.state=Go,S.timer.stop(),S.on.call("cancel",n,n.__data__,S.index,S.group),delete t[f])}if(fs(function(){e.state===vs&&(e.state=Th,e.timer.restart(s,e.delay,e.time),s(p))}),e.state=bs,e.on.call("start",n,n.__data__,e.index,e.group),e.state===bs){for(e.state=vs,i=new Array(x=e.tween.length),f=0,b=-1;f<x;++f)(S=e.tween[f].value.call(n,n.__data__,e.index,e.group))&&(i[++b]=S);i.length=b+1}}function s(p){for(var f=p<e.duration?e.ease.call(null,p/e.duration):(e.timer.restart(c),e.state=As,1),b=-1,x=i.length;++b<x;)i[b].call(n,f);e.state===As&&(e.on.call("end",n,n.__data__,e.index,e.group),c())}function c(){e.state=Go,e.timer.stop(),delete t[a];for(var p in t)return;delete n.__transition}}function ys(n,a){var e=n.__transition,t,i,o=!0,r;if(e){a=a==null?null:a+"";for(r in e){if((t=e[r]).name!==a){o=!1;continue}i=t.state>bs&&t.state<As,t.state=Go,t.timer.stop(),t.on.call(i?"interrupt":"cancel",n,n.__data__,t.index,t.group),delete e[r]}o&&delete n.__transition}}function Dh(n){return this.each(function(){ys(this,n)})}function ry(n,a){var e,t;return function(){var i=Lt(this,n),o=i.tween;if(o!==e){t=e=o;for(var r=0,s=t.length;r<s;++r)if(t[r].name===a){t=t.slice(),t.splice(r,1);break}}i.tween=t}}function sy(n,a,e){var t,i;if(typeof e!="function")throw new Error;return function(){var o=Lt(this,n),r=o.tween;if(r!==t){i=(t=r).slice();for(var s={name:a,value:e},c=0,p=i.length;c<p;++c)if(i[c].name===a){i[c]=s;break}c===p&&i.push(s)}o.tween=i}}function Ph(n,a){var e=this._id;if(n+="",arguments.length<2){for(var t=Et(this.node(),e).tween,i=0,o=t.length,r;i<o;++i)if((r=t[i]).name===n)return r.value;return null}return this.each((a==null?ry:sy)(e,n,a))}function Ka(n,a,e){var t=n._id;return n.each(function(){var i=Lt(this,t);(i.value||(i.value={}))[a]=e.apply(this,arguments)}),function(i){return Et(i,t).value[a]}}function xs(n,a){var e;return(typeof a=="number"?_i:a instanceof zn?ds:(e=zn(a))?(a=e,ds):Ml)(n,a)}function ly(n){return function(){this.removeAttribute(n)}}function dy(n){return function(){this.removeAttributeNS(n.space,n.local)}}function cy(n,a,e){var t,i=e+"",o;return function(){var r=this.getAttribute(n);return r===i?null:r===t?o:o=a(t=r,e)}}function uy(n,a,e){var t,i=e+"",o;return function(){var r=this.getAttributeNS(n.space,n.local);return r===i?null:r===t?o:o=a(t=r,e)}}function my(n,a,e){var t,i,o;return function(){var r,s=e(this),c;return s==null?void this.removeAttribute(n):(r=this.getAttribute(n),c=s+"",r===c?null:r===t&&c===i?o:(i=c,o=a(t=r,s)))}}function hy(n,a,e){var t,i,o;return function(){var r,s=e(this),c;return s==null?void this.removeAttributeNS(n.space,n.local):(r=this.getAttributeNS(n.space,n.local),c=s+"",r===c?null:r===t&&c===i?o:(i=c,o=a(t=r,s)))}}function Ih(n,a){var e=hn(n),t=e==="transform"?El:xs;return this.attrTween(n,typeof a=="function"?(e.local?hy:my)(e,t,Ka(this,"attr."+n,a)):a==null?(e.local?dy:ly)(e):(e.local?uy:cy)(e,t,a))}function py(n,a){return function(e){this.setAttribute(n,a.call(this,e))}}function gy(n,a){return function(e){this.setAttributeNS(n.space,n.local,a.call(this,e))}}function fy(n,a){var e,t;function i(){var o=a.apply(this,arguments);return o!==t&&(e=(t=o)&&gy(n,o)),e}return i._value=a,i}function vy(n,a){var e,t;function i(){var o=a.apply(this,arguments);return o!==t&&(e=(t=o)&&py(n,o)),e}return i._value=a,i}function Oh(n,a){var e="attr."+n;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(a==null)return this.tween(e,null);if(typeof a!="function")throw new Error;var t=hn(n);return this.tween(e,(t.local?fy:vy)(t,a))}function by(n,a){return function(){Bo(this,n).delay=+a.apply(this,arguments)}}function Ay(n,a){return a=+a,function(){Bo(this,n).delay=a}}function Nh(n){var a=this._id;return arguments.length?this.each((typeof n=="function"?by:Ay)(a,n)):Et(this.node(),a).delay}function yy(n,a){return function(){Lt(this,n).duration=+a.apply(this,arguments)}}function xy(n,a){return a=+a,function(){Lt(this,n).duration=a}}function Rh(n){var a=this._id;return arguments.length?this.each((typeof n=="function"?yy:xy)(a,n)):Et(this.node(),a).duration}function Cy(n,a){if(typeof a!="function")throw new Error;return function(){Lt(this,n).ease=a}}function Lh(n){var a=this._id;return arguments.length?this.each(Cy(a,n)):Et(this.node(),a).ease}function Sy(n,a){return function(){var e=a.apply(this,arguments);if(typeof e!="function")throw new Error;Lt(this,n).ease=e}}function Vh(n){if(typeof n!="function")throw new Error;return this.each(Sy(this._id,n))}function Wh(n){typeof n!="function"&&(n=Eo(n));for(var a=this._groups,e=a.length,t=new Array(e),i=0;i<e;++i)for(var o=a[i],r=o.length,s=t[i]=[],c,p=0;p<r;++p)(c=o[p])&&n.call(c,c.__data__,p,o)&&s.push(c);return new qt(t,this._parents,this._name,this._id)}function Fh(n){if(n._id!==this._id)throw new Error;for(var a=this._groups,e=n._groups,t=a.length,i=e.length,o=Math.min(t,i),r=new Array(t),s=0;s<o;++s)for(var c=a[s],p=e[s],f=c.length,b=r[s]=new Array(f),x,S=0;S<f;++S)(x=c[S]||p[S])&&(b[S]=x);for(;s<t;++s)r[s]=a[s];return new qt(r,this._parents,this._name,this._id)}function wy(n){return(n+"").trim().split(/^|\s+/).every(function(a){var e=a.indexOf(".");return e>=0&&(a=a.slice(0,e)),!a||a==="start"})}function _y(n,a,e){var t,i,o=wy(a)?Bo:Lt;return function(){var r=o(this,n),s=r.on;s!==t&&(i=(t=s).copy()).on(a,e),r.on=i}}function Gh(n,a){var e=this._id;return arguments.length<2?Et(this.node(),e).on.on(n):this.each(_y(e,n,a))}function My(n){return function(){var a=this.parentNode;for(var e in this.__transition)if(+e!==n)return;a&&a.removeChild(this)}}function Bh(){return this.on("end.remove",My(this._id))}function Uh(n){var a=this._name,e=this._id;typeof n!="function"&&(n=ca(n));for(var t=this._groups,i=t.length,o=new Array(i),r=0;r<i;++r)for(var s=t[r],c=s.length,p=o[r]=new Array(c),f,b,x=0;x<c;++x)(f=s[x])&&(b=n.call(f,f.__data__,x,s))&&("__data__"in f&&(b.__data__=f.__data__),p[x]=b,Hn(p[x],a,e,x,p,Et(f,e)));return new qt(o,this._parents,a,e)}function zh(n){var a=this._name,e=this._id;typeof n!="function"&&(n=To(n));for(var t=this._groups,i=t.length,o=[],r=[],s=0;s<i;++s)for(var c=t[s],p=c.length,f,b=0;b<p;++b)if(f=c[b]){for(var x=n.call(f,f.__data__,b,c),S,_=Et(f,e),k=0,B=x.length;k<B;++k)(S=x[k])&&Hn(S,a,e,k,x,_);o.push(x),r.push(f)}return new qt(o,r,a,e)}var ky=pn.prototype.constructor;function Hh(){return new ky(this._groups,this._parents)}function Ty(n,a){var e,t,i;return function(){var o=Un(this,n),r=(this.style.removeProperty(n),Un(this,n));return o===r?null:o===e&&r===t?i:i=a(e=o,t=r)}}function qh(n){return function(){this.style.removeProperty(n)}}function Ey(n,a,e){var t,i=e+"",o;return function(){var r=Un(this,n);return r===i?null:r===t?o:o=a(t=r,e)}}function Dy(n,a,e){var t,i,o;return function(){var r=Un(this,n),s=e(this),c=s+"";return s==null&&(c=s=(this.style.removeProperty(n),Un(this,n))),r===c?null:r===t&&c===i?o:(i=c,o=a(t=r,s))}}function Py(n,a){var e,t,i,o="style."+a,r="end."+o,s;return function(){var c=Lt(this,n),p=c.on,f=c.value[o]==null?s||(s=qh(a)):void 0;(p!==e||i!==f)&&(t=(e=p).copy()).on(r,i=f),c.on=t}}function jh(n,a,e){var t=(n+="")=="transform"?Tl:xs;return a==null?this.styleTween(n,Ty(n,t)).on("end.style."+n,qh(n)):typeof a=="function"?this.styleTween(n,Dy(n,t,Ka(this,"style."+n,a))).each(Py(this._id,n)):this.styleTween(n,Ey(n,t,a),e).on("end.style."+n,null)}function Iy(n,a,e){return function(t){this.style.setProperty(n,a.call(this,t),e)}}function Oy(n,a,e){var t,i;function o(){var r=a.apply(this,arguments);return r!==i&&(t=(i=r)&&Iy(n,r,e)),t}return o._value=a,o}function $h(n,a,e){var t="style."+(n+="");if(arguments.length<2)return(t=this.tween(t))&&t._value;if(a==null)return this.tween(t,null);if(typeof a!="function")throw new Error;return this.tween(t,Oy(n,a,e??""))}function Ny(n){return function(){this.textContent=n}}function Ry(n){return function(){var a=n(this);this.textContent=a??""}}function Yh(n){return this.tween("text",typeof n=="function"?Ry(Ka(this,"text",n)):Ny(n==null?"":n+""))}function Ly(n){return function(a){this.textContent=n.call(this,a)}}function Vy(n){var a,e;function t(){var i=n.apply(this,arguments);return i!==e&&(a=(e=i)&&Ly(i)),a}return t._value=n,t}function Zh(n){var a="text";if(arguments.length<1)return(a=this.tween(a))&&a._value;if(n==null)return this.tween(a,null);if(typeof n!="function")throw new Error;return this.tween(a,Vy(n))}function Qh(){for(var n=this._name,a=this._id,e=Cs(),t=this._groups,i=t.length,o=0;o<i;++o)for(var r=t[o],s=r.length,c,p=0;p<s;++p)if(c=r[p]){var f=Et(c,a);Hn(c,n,e,p,r,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new qt(t,this._parents,n,e)}function Xh(){var n,a,e=this,t=e._id,i=e.size();return new Promise(function(o,r){var s={value:r},c={value:function(){--i===0&&o()}};e.each(function(){var p=Lt(this,t),f=p.on;f!==n&&(a=(n=f).copy(),a._.cancel.push(s),a._.interrupt.push(s),a._.end.push(c)),p.on=a}),i===0&&o()})}var Wy=0;function qt(n,a,e,t){this._groups=n,this._parents=a,this._name=e,this._id=t}function Kh(n){return pn().transition(n)}function Cs(){return++Wy}var gn=pn.prototype;qt.prototype=Kh.prototype={constructor:qt,select:Uh,selectAll:zh,selectChild:gn.selectChild,selectChildren:gn.selectChildren,filter:Wh,merge:Fh,selection:Hh,transition:Qh,call:gn.call,nodes:gn.nodes,node:gn.node,size:gn.size,empty:gn.empty,each:gn.each,on:Gh,attr:Ih,attrTween:Oh,style:jh,styleTween:$h,text:Yh,textTween:Zh,remove:Bh,tween:Ph,delay:Nh,duration:Rh,ease:Lh,easeVarying:Vh,end:Xh,[Symbol.iterator]:gn[Symbol.iterator]};function Ss(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var Fy={time:null,delay:0,duration:250,ease:Ss};function Gy(n,a){for(var e;!(e=n.__transition)||!(e=e[a]);)if(!(n=n.parentNode))throw new Error(`transition ${a} not found`);return e}function Jh(n){var a,e;n instanceof qt?(a=n._id,n=n._name):(a=Cs(),(e=Fy).time=Fo(),n=n==null?null:n+"");for(var t=this._groups,i=t.length,o=0;o<i;++o)for(var r=t[o],s=r.length,c,p=0;p<s;++p)(c=r[p])&&Hn(c,n,a,p,r,e||Gy(c,a));return new qt(t,this._parents,n,a)}pn.prototype.interrupt=Dh;pn.prototype.transition=Jh;var{abs:GN,max:BN,min:UN}=Math;function ep(n){return[+n[0],+n[1]]}function By(n){return[ep(n[0]),ep(n[1])]}var zN={name:"x",handles:["w","e"].map(Pl),input:function(n,a){return n==null?null:[[+n[0],a[0][1]],[+n[1],a[1][1]]]},output:function(n){return n&&[n[0][0],n[1][0]]}},HN={name:"y",handles:["n","s"].map(Pl),input:function(n,a){return n==null?null:[[a[0][0],+n[0]],[a[1][0],+n[1]]]},output:function(n){return n&&[n[0][1],n[1][1]]}},qN={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Pl),input:function(n){return n==null?null:By(n)},output:function(n){return n}};function Pl(n){return{type:n}}function qn(n,a,e){this.k=n,this.x=a,this.y=e}qn.prototype={constructor:qn,scale:function(n){return n===1?this:new qn(this.k*n,this.x,this.y)},translate:function(n,a){return n===0&a===0?this:new qn(this.k,this.x+this.k*n,this.y+this.k*a)},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 Il=new qn(1,0,0);Ol.prototype=qn.prototype;function Ol(n){for(;!n.__zoom;)if(!(n=n.parentNode))return Il;return n.__zoom}var Uo=!1,zy=250,Hy=["atons.urn:mrn:imo:mmsi:*","shore.basestations.urn:mrn:imo:mmsi:*","vessels.urn:mrn:imo:mmsi:*","sar.urn:mrn:imo:mmsi:*"],qy=[{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"}],jy="self.navigation.*",tp=(()=>{class n{data=A(Kt);destroyRef=A(tt);tracks=new Map;contextIndex=new Map;mmsiIndex=new Map;targetsDirty$=new Yt;_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,o=t.latitude*Math.PI/180,r=(t.longitude-e.longitude)*Math.PI/180,s=Math.sin(r)*Math.cos(o),c=Math.cos(i)*Math.sin(o)-Math.sin(i)*Math.cos(o)*Math.cos(r),p=Math.atan2(s,c)*180/Math.PI;return this.wrapDegrees(p)}constructor(){li(...Hy.map(t=>this.data.subscribePathTree(t))).pipe(Je(this.destroyRef)).subscribe(t=>this.handleAisTreeUpdate(t)),this.data.subscribePathTree(jy).pipe(Je(this.destroyRef)).subscribe(t=>this.handleOwnShipTreeUpdate(t)),this.targetsDirty$.pipe(Dd(zy,void 0,{leading:!0,trailing:!0}),Je(this.destroyRef)).subscribe(()=>this.flushTargetsSignal())}handleAisTreeUpdate(e){let t=this.matchAisContext(e.path);t&&(Uo&&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 qy){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()),o=this.readPositionValue(t);switch(e){case"navigation.position":o&&(i.position=o);break;case"navigation.position.latitude":{let r=this.toNumberOrUndefined(t);if(r===void 0)return;i.position=ue(ne({},i.position??{}),{latitude:r})}break;case"navigation.position.longitude":{let r=this.toNumberOrUndefined(t);if(r===void 0)return;i.position=ue(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=ue(ne({},t.design??{}),{beam:this.toNumberOrUndefined(e.value)}))},"design.length.overall":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{length:ue(ne({},t.design?.length??{}),{overall:this.toNumberOrUndefined(e.value)})}))},"design.length.hull":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{length:ue(ne({},t.design?.length??{}),{hull:this.toNumberOrUndefined(e.value)})}))},"design.length.waterline":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{length:ue(ne({},t.design?.length??{}),{waterline:this.toNumberOrUndefined(e.value)})}))},"design.draft.maximum":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{draft:ue(ne({},t.design?.draft??{}),{maximum:this.toNumberOrUndefined(e.value)})}))},"design.draft.minimum":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{draft:ue(ne({},t.design?.draft??{}),{minimum:this.toNumberOrUndefined(e.value)})}))},"design.draft.current":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{draft:ue(ne({},t.design?.draft??{}),{current:this.toNumberOrUndefined(e.value)})}))},"design.draft.canoe":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{draft:ue(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=ue(ne({},t.position??{}),{latitude:r}),t.lastPositionAt=e.timestampMs)},"navigation.position.longitude":()=>{let r=this.toNumberOrUndefined(e.value);r!==void 0&&(t.position=ue(ne({},t.position??{}),{longitude:r}),t.lastPositionAt=e.timestampMs)},"navigation.position.altitude":()=>{let r=this.toNumberOrUndefined(e.value);t.position&&(t.position=ue(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=ue(ne({},t.design??{}),{aisShipType:ue(ne({},t.design?.aisShipType??{}),{id:this.toNumberOrUndefined(e.value)})}))},"design.aisShipType.name":()=>{this.isVesselLike(t)&&(t.design=ue(ne({},t.design??{}),{aisShipType:ue(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,o=t?this.tracks.get(t):null;if(o)return o;let r=this.createTrack(e.context,e.type,i,void 0);return this.contextIndex.set(e.context,r.id),r}createTrack(e,t,i,o){let r=this.buildTrackId(o??e),s=this.buildBaseTarget(e,t,i,o,r),c;switch(t){case"vessel":c=ue(ne({},s),{type:"vessel",closestApproach:{}});break;case"sar":c=ue(ne({},s),{type:"sar",closestApproach:{}});break;case"aton":c=ue(ne({},s),{type:"aton"});break;default:c=ue(ne({},s),{type:"basestation"});break}return this.tracks.set(c.id,c),o&&this.addMmsiIndex(o,c.id),this.updateTargetsSignal(),c}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 o=this.getTracksByMmsi(i).filter(r=>r.id!==e.id);o.length&&(this.markConflict(i),Uo&&console.error("[AIS] MMSI conflict",{mmsi:i,contexts:[e.context,...o.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);Uo&&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 o=i.closestApproach??{};return Object.prototype.hasOwnProperty.call(o,"collisionRiskRating")});this._targets.set(e),this._hasCollisionRiskData.set(t),Uo&&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,o,r){return{id:r,context:e,type:t,ais:{class:void 0,status:"unconfirmed"},conflicted:!1,mmsi:o,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 o=this.toNumberOrUndefined(e.altitude);return{latitude:t,longitude:i,altitude:o}}static \u0275fac=function(t){return new(t||n)};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function $y(n,a){if(n&1&&(l(0,"div",3)(1,"span",13),d(2),u()()),n&2){T();let e=dn(0),t=dn(1);g(2),Vt("",t," ",e)}}function Yy(n,a){if(n&1&&(l(0,"div",4)(1,"span",7),d(2,"State"),u(),l(3,"span",10),d(4),lt(5,"titlecase"),u()()),n&2){let e=T(4);g(4),Vt("",Pt(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`)}}function Zy(n,a){n&1&&(l(0,"div",5),L(1,"mat-divider"),u())}function Qy(n,a){if(n&1&&(l(0,"div",6)(1,"span",7),d(2,"Bearing"),u(),l(3,"span",8),d(4),u()(),l(5,"div",6)(6,"span",7),d(7,"Range"),u(),l(8,"span",8),d(9),u()(),l(10,"div",6)(11,"span",7),d(12,"CPA"),u(),l(13,"span",8),d(14),u()(),l(15,"div",6)(16,"span",7),d(17,"TCPA"),u(),l(18,"span",8),d(19),u()(),l(20,"div",3),L(21,"mat-divider"),u()),n&2){let e=T(4);g(4),X(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),g(5),X(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo))}}function Xy(n,a){if(n&1&&(l(0,"div",3)(1,"span",7),d(2,"ETA"),u(),l(3,"span",8),d(4),u()()),n&2){let e=T(4);g(4),X(e.formatText(e.target.eta))}}function Ky(n,a){if(n&1&&(ia(0)(1),O(2,$y,3,2,"div",3),O(3,Yy,6,4,"div",4),O(4,Zy,2,0,"div",5),O(5,Qy,22,4),l(6,"div",6)(7,"span",7),d(8,"COG"),u(),l(9,"span",8),d(10),l(11,"span",9),d(12,"T"),u()()(),l(13,"div",6)(14,"span",7),d(15,"SOG"),u(),l(16,"span",8),d(17),lt(18,"number"),u()(),l(19,"div",6)(20,"span",7),d(21,"HDG"),u(),l(22,"span",8),d(23),l(24,"span",9),d(25,"T"),u()()(),l(26,"div",6)(27,"span",7),d(28,"ROT"),u(),l(29,"span",8),d(30),u()(),l(31,"div",3),L(32,"mat-divider"),u(),l(33,"div",6)(34,"span",7),d(35,"IMO"),u(),l(36,"span",8),d(37),u()(),l(38,"div",6)(39,"span",7),d(40,"MMSI"),u(),l(41,"span",8),d(42),u()(),l(43,"div",6)(44,"span",7),d(45,"VHF Callsign"),u(),l(46,"span",8),d(47),u()(),l(48,"div",6)(49,"span",7),d(50,"AIS Class"),u(),l(51,"span",8),d(52),u()(),l(53,"div",4)(54,"span",7),d(55,"Destination"),u(),l(56,"span",10),d(57),u()(),O(58,Xy,5,1,"div",3),l(59,"div",3),L(60,"mat-divider"),u(),l(61,"div",6)(62,"span",7),d(63,"Latitude"),u(),l(64,"span",8),d(65),u()(),l(66,"div",6)(67,"span",7),d(68,"Longitude"),u(),l(69,"span",8),d(70),u()(),l(71,"div",11)(72,"span",12),d(73),u()()),n&2){let e=T(3),t=ln(!(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",o=e.target.design!=null&&e.target.design.beam?`${e.target.design.beam}m`:"?m";g(),ln(i&&o?`${i} x ${o}`:""),g(),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),g(),N(e.target.navState||e.target.specialManeuver?3:-1),g(),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),g(),N(e.hasClosestApproach(e.target.closestApproach)?5:-1),g(5),he("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),g(7),he("",cn(18,19,e.target.speedOverGround,"1.1-1")," kn"),g(6),he("",e.formatDirection(e.target.headingTrue),"\xB0 "),g(7),X(e.formatRateOfTurn(e.target.rateOfTurn)),g(7),X(e.formatText(e.target.imo)),g(5),X(e.formatText(e.target.mmsi)),g(5),X(e.formatText(e.target.callsign)),g(5),X(e.formatText(e.target.ais.class)),g(5),X(e.formatText(e.target.destination)),g(),N(e.target.eta?58:-1),g(7),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),he("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function Jy(n,a){if(n&1&&O(0,Ky,74,22),n&2){let e=T(2);N(e.isVesselLike(e.target)?0:-1)}}function ex(n,a){if(n&1&&(l(0,"div",3)(1,"span",13),d(2),u()()),n&2){T();let e=dn(0),t=dn(1);g(2),Vt("",t," ",e)}}function tx(n,a){if(n&1&&(l(0,"div",4)(1,"span",7),d(2,"State"),u(),l(3,"span",10),d(4),lt(5,"titlecase"),u()()),n&2){let e=T(4);g(4),Vt("",Pt(5,2,e.target.navState?`${e.target.navState}`:""),"",e.target.specialManeuver==="not available"?"":`, ${e.target.specialManeuver}`)}}function ix(n,a){n&1&&(l(0,"div",5),L(1,"mat-divider"),u())}function nx(n,a){if(n&1&&(l(0,"div",6)(1,"span",7),d(2,"Bearing"),u(),l(3,"span",8),d(4),u()(),l(5,"div",6)(6,"span",7),d(7,"Range"),u(),l(8,"span",8),d(9),u()(),l(10,"div",6)(11,"span",7),d(12,"CPA"),u(),l(13,"span",8),d(14),u()(),l(15,"div",6)(16,"span",7),d(17,"TCPA"),u(),l(18,"span",8),d(19),u()(),l(20,"div",3),L(21,"mat-divider"),u()),n&2){let e=T(4);g(4),X(e.formatAngleWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.bearing)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.range)),g(5),X(e.formatNauticalMilesWithUnit(e.target.closestApproach==null?null:e.target.closestApproach.distance)),g(5),X(e.formatRemainingTime(e.target.closestApproach==null?null:e.target.closestApproach.timeTo))}}function ax(n,a){if(n&1&&(l(0,"div",3)(1,"span",7),d(2,"ETA"),u(),l(3,"span",8),d(4),u()()),n&2){let e=T(4);g(4),X(e.formatText(e.target.eta))}}function ox(n,a){if(n&1&&(ia(0)(1),O(2,ex,3,2,"div",3),O(3,tx,6,4,"div",4),O(4,ix,2,0,"div",5),O(5,nx,22,4),l(6,"div",6)(7,"span",7),d(8,"COG"),u(),l(9,"span",8),d(10),l(11,"span",9),d(12,"T"),u()()(),l(13,"div",6)(14,"span",7),d(15,"SOG"),u(),l(16,"span",8),d(17),lt(18,"number"),u()(),l(19,"div",6)(20,"span",7),d(21,"HDG"),u(),l(22,"span",8),d(23),l(24,"span",9),d(25,"T"),u()()(),l(26,"div",6)(27,"span",7),d(28,"ROT"),u(),l(29,"span",8),d(30),u()(),l(31,"div",3),L(32,"mat-divider"),u(),l(33,"div",6)(34,"span",7),d(35,"IMO"),u(),l(36,"span",8),d(37),u()(),l(38,"div",6)(39,"span",7),d(40,"MMSI"),u(),l(41,"span",8),d(42),u()(),l(43,"div",6)(44,"span",7),d(45,"VHF Callsign"),u(),l(46,"span",8),d(47),u()(),l(48,"div",6)(49,"span",7),d(50,"AIS Class"),u(),l(51,"span",8),d(52),u()(),l(53,"div",4)(54,"span",7),d(55,"Destination"),u(),l(56,"span",10),d(57),u()(),O(58,ax,5,1,"div",3),l(59,"div",3),L(60,"mat-divider"),u(),l(61,"div",6)(62,"span",7),d(63,"Latitude"),u(),l(64,"span",8),d(65),u()(),l(66,"div",6)(67,"span",7),d(68,"Longitude"),u(),l(69,"span",8),d(70),u()(),l(71,"div",11)(72,"span",12),d(73),u()()),n&2){let e=T(3),t=ln(!(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",o=e.target.design!=null&&e.target.design.beam?`${e.target.design.beam}m`:"?m";g(),ln(i&&o?`${i} x ${o}`:""),g(),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),g(),N(e.target.navState||e.target.specialManeuver?3:-1),g(),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),g(),N(e.hasClosestApproach(e.target.closestApproach)?5:-1),g(5),he("",e.formatDirection(e.target.courseOverGroundTrue),"\xB0 "),g(7),he("",cn(18,19,e.target.speedOverGround,"1.1-1")," kn"),g(6),he("",e.formatDirection(e.target.headingTrue),"\xB0 "),g(7),X(e.formatRateOfTurn(e.target.rateOfTurn)),g(7),X(e.formatText(e.target.imo)),g(5),X(e.formatText(e.target.mmsi)),g(5),X(e.formatText(e.target.callsign)),g(5),X(e.formatText(e.target.ais.class)),g(5),X(e.formatText(e.target.destination)),g(),N(e.target.eta?58:-1),g(7),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),he("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function rx(n,a){if(n&1&&O(0,ox,74,22),n&2){let e=T(2);N(e.isVesselLike(e.target)?0:-1)}}function sx(n,a){if(n&1&&(l(0,"div",3)(1,"span",13),d(2),u()(),l(3,"div",4)(4,"span",7),d(5,"Off Position"),u(),l(6,"span",8),d(7),u()(),l(8,"div",6)(9,"span",7),d(10,"Type"),u(),l(11,"span",8),d(12,"Aid to Navigation"),u()(),l(13,"div",6)(14,"span",7),d(15,"Type ID"),u(),l(16,"span",8),d(17),u()(),l(18,"div",3),L(19,"mat-divider"),u(),l(20,"div",6)(21,"span",7),d(22,"MMSI"),u(),l(23,"span",8),d(24),u()(),l(25,"div",6)(26,"span",7),d(27,"Status"),u(),l(28,"span",8),d(29),lt(30,"titlecase"),u()(),l(31,"div",3),L(32,"mat-divider"),u(),l(33,"div",6)(34,"span",7),d(35,"Latitude"),u(),l(36,"span",8),d(37),u()(),l(38,"div",6)(39,"span",7),d(40,"Longitude"),u(),l(41,"span",8),d(42),u()(),l(43,"div",11)(44,"span",12),d(45),u()()),n&2){let e=T(3);g(2),X(e.formatText(e.target.name)),g(5),X(e.target.offPosition?"Yes":"No"),g(10),X(e.formatText(e.target.typeId==null?null:e.target.typeId.toString())),g(7),X(e.formatText(e.target.mmsi)),g(5),X(Pt(30,8,e.target.ais.status)),g(8),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),he("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function lx(n,a){if(n&1&&O(0,sx,46,10),n&2){let e=T(2);N(e.isAton(e.target)?0:-1)}}function dx(n,a){if(n&1&&(l(0,"div",6)(1,"span",7),d(2,"Name"),u(),l(3,"span",8),d(4),u()(),l(5,"div",6)(6,"span",7),d(7,"MMSI"),u(),l(8,"span",8),d(9),u()(),l(10,"div",6)(11,"span",7),d(12,"Status"),u(),l(13,"span",8),d(14),lt(15,"titlecase"),u()(),l(16,"div",6)(17,"span",7),d(18,"AIS Class"),u(),l(19,"span",8),d(20),u()(),l(21,"div",3),L(22,"mat-divider"),u(),l(23,"div",6)(24,"span",7),d(25,"Latitude"),u(),l(26,"span",8),d(27),u()(),l(28,"div",6)(29,"span",7),d(30,"Longitude"),u(),l(31,"span",8),d(32),u()(),l(33,"div",11)(34,"span",12),d(35),u()()),n&2){let e=T(3);g(4),X(e.formatText(e.target.name)),g(5),X(e.formatText(e.target.mmsi)),g(5),X(Pt(15,7,e.target.ais.status)),g(6),X(e.formatText(e.target.ais.class)),g(7),X(e.formatLatLon(e.target.position==null?null:e.target.position.latitude,"latitudeMin")),g(5),X(e.formatLatLon(e.target.position==null?null:e.target.position.longitude,"longitudeMin")),g(3),he("Received ",e.formatSinceTimestamp(e.target.lastPositionAt)," ago")}}function cx(n,a){if(n&1&&O(0,dx,36,9),n&2){let e=T(2);N(e.isBasestation(e.target)?0:-1)}}function ux(n,a){if(n&1&&(l(0,"div",0)(1,"div",2),O(2,Jy,1,1)(3,rx,1,1)(4,lx,1,1)(5,cx,1,1),u()()),n&2){let e,t=T();g(2),N((e=t.target.type)==="vessel"?2:e==="sar"?3:e==="aton"?4:e==="basestation"?5:-1)}}function mx(n,a){n&1&&(l(0,"div",1),d(1,"No AIS target selected."),u())}var ws=(()=>{class n{static CLOCK_INTERVAL_MS=1e3;data=A(Qt);units=A(ot);ngZone=A(Be);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),o=Math.floor(t%3600/60),r=t%60;return i>0?`${i}:${String(o).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${o}:${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),o=Math.floor(t%3600/60),r=t%60;return i>0?`${i}:${String(o).padStart(2,"0")}:${String(r).padStart(2,"0")}`:`${o}:${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=q({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&&O(0,ux,6,1,"div",0)(1,mx,2,0,"div",1),t&2&&N(i.target?0:1)},dependencies:[Wt,Ia,Pa,wa,_a],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 hx=["radarSvg"],px=["menuAnchor"],gx=["menuTrigger"],fx=(n,a)=>a.id;function vx(n,a){n&1&&(te(),l(0,"svg",7),L(1,"path",17),l(2,"text",18),d(3,"N"),u()())}function bx(n,a){n&1&&(te(),l(0,"svg",7),L(1,"path",19),u())}function Ax(n,a){if(n&1){let e=xe();l(0,"button",20),z("click",function(){J(e);let i=T();return ee(i.toggleFilter("noCollisionRisk"))}),l(1,"mat-icon"),d(2,"security"),u()()}if(n&2){let e=T();it("is-active",e.isFilterEnabled("noCollisionRisk"))}}function yx(n,a){if(n&1){let e=xe();l(0,"button",22),z("click",function(){let i=J(e).$implicit,o=T(2);return ee(o.onMenuItemSelect(i))}),L(1,"img",23),l(2,"span",24),d(3),u()()}if(n&2){let e=a.$implicit;g(),pe("visibility",e.iconHref?"visible":"hidden"),Q("src",e.iconHref??null,rr),g(2),X(e.label)}}function xx(n,a){if(n&1&&Ae(0,yx,4,4,"button",21,fx),n&2){let e=T();ye(e.menuItems())}}function Cx(n,a){if(n&1){let e=xe();l(0,"button",25),d(1,"Filter Targets"),u(),l(2,"button",26),z("click",function(){J(e);let i=T();return ee(i.toggleFilter("anchoredMoored"))}),l(3,"mat-icon",27),d(4),u(),l(5,"span"),d(6,"Anchored/Moored"),u()(),l(7,"button",26),z("click",function(){J(e);let i=T();return ee(i.toggleFilter("allAton"))}),l(8,"mat-icon",27),d(9),u(),l(10,"span"),d(11,"All AtoN"),u()(),l(12,"button",26),z("click",function(){J(e);let i=T();return ee(i.toggleFilter("allButSar"))}),l(13,"mat-icon",27),d(14),u(),l(15,"span"),d(16,"All but SAR"),u()(),l(17,"button",26),z("click",function(){J(e);let i=T();return ee(i.toggleFilter("allVessels"))}),l(18,"mat-icon",27),d(19),u(),l(20,"span"),d(21,"All Vessels"),u()(),l(22,"button",28)(23,"span"),d(24,"Vessel Type"),u(),l(25,"mat-icon"),d(26,"chevron_right"),u()()}if(n&2){let e=T(),t=Tt(26);g(4),he(" ",e.isFilterEnabled("anchoredMoored")?"check_box":"check_box_outline_blank"," "),g(5),he(" ",e.isFilterEnabled("allAton")?"check_box":"check_box_outline_blank"," "),g(5),he(" ",e.isFilterEnabled("allButSar")?"check_box":"check_box_outline_blank"," "),g(5),he(" ",e.isFilterEnabled("allVessels")?"check_box":"check_box_outline_blank"," "),g(3),I("matMenuTriggerFor",t)}}function Sx(n,a){if(n&1){let e=xe();l(0,"button",26),z("click",function(){let i=J(e).$implicit,o=T(2);return ee(o.toggleVesselTypeFilter(i))}),l(1,"mat-icon",27),d(2),u(),l(3,"span"),d(4),u()()}if(n&2){let e=a.$implicit,t=T(2);g(2),he(" ",t.isVesselTypeFilterEnabled(e)?"check_box":"check_box_outline_blank"," "),g(2),X(t.formatVesselTypeLabel(e))}}function wx(n,a){if(n&1&&Ae(0,Sx,5,2,"button",29,zi),n&2){let e=T();ye(e.vesselTypeFilters)}}function _x(n,a){n&1&&L(0,"div",16)}var ip=(()=>{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=y.required();type=y.required();theme=y.required();runtime=A(be);ais=A(tp);dialog=A(np);ngZone=A(Be);units=A(ot);settings=A(Ot);toast=A($i);dashboard=A(mt);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=ce.required("radarSvg");menuAnchorRef=ce.required("menuAnchor");menuTrigger=ce.required("menuTrigger");hostSize=w(null);renderState=null;selectedId=w(null);localViewMode=w(null);localRangeIndex=w(null);effectiveViewMode=ie(()=>this.localViewMode()??this.runtime.options()?.ais?.viewMode??"course-up");effectiveRangeIndex=ie(()=>{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),o=this.localRangeIndex()??e;return Math.min(Math.max(o,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=zr.filter(e=>e!=="vessel/self"&&e!=="vessel/unknown"&&e!=="vessel/spare");hasActiveFilters=ie(()=>{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(),V(()=>{let e=this.hostSize(),t=this.runtime.options(),i=this.theme(),o=this.ais.targets(),r=this.ais.ownShip();!e||!t||!i||(W(()=>{this.renderState={size:e,cfg:t,theme:i,targets:o,ownShip:r},this.syncFiltersFromConfig(t)}),this.scheduleRender())}),V(()=>{this.localViewMode(),this.localRangeIndex(),this.selectedId(),this.filterState(),W(()=>{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(()=>{Ru().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=Al(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:o,ownShip:r}=this.renderState,s=Math.max(1,e.width),c=Math.max(1,e.height),p=Math.min(s,c)/2,f=(Math.min(s,c)-35)/Math.min(s,c),b=Math.hypot(s,c)/2/f,x=t.ais??{},S=x.rangeRings?.length?x.rangeRings:[3,6,12,24,48],_=this.effectiveRangeIndex(),k=S[_]??S[0],B=this.resolveRingCountForRange(k),R=this.localViewMode()??x.viewMode??"course-up",G=this.toDegreesIfRadians(r.courseOverGroundTrue),j=this.toDegreesIfRadians(r.headingTrue),K=G!==null||j!==null,Y=R==="course-up"?G??j??0:0,Te=this.viewRotationSmoothed!==null&&Math.abs(this.shortestAngleDelta(this.viewRotationSmoothed,Y))>.5,ge=this.buildFilterStateSignature(this.filterState()),oe={sizeKey:`${s}x${c}`,viewMode:R,rangeIndex:_,rangesKey:S.join(","),showSelf:x.showSelf??!0,showCogVectors:x.showCogVectors??!0,showLostTargets:x.showLostTargets??!0,showUnconfirmedTargets:x.showUnconfirmedTargets??!0,filtersKey:ge,selectedId:this.selectedId(),targetsRef:o,ownShipRef:r,themeRef:i,color:t.color},le=this.lastRenderSignature;if(!Te&&le&&le.sizeKey===oe.sizeKey&&le.viewMode===oe.viewMode&&le.rangeIndex===oe.rangeIndex&&le.rangesKey===oe.rangesKey&&le.showSelf===oe.showSelf&&le.showCogVectors===oe.showCogVectors&&le.showLostTargets===oe.showLostTargets&&le.showUnconfirmedTargets===oe.showUnconfirmedTargets&&le.filtersKey===oe.filtersKey&&le.selectedId===oe.selectedId&&le.targetsRef===oe.targetsRef&&le.ownShipRef===oe.ownShipRef&&le.themeRef===oe.themeRef&&le.color===oe.color)return;this.lastRenderSignature=oe;let me=R==="course-up"&&K?this.smoothRotation(Y):0,de=R==="course-up"?Math.abs(this.shortestAngleDelta(me,Y)):0;this.svg.attr("viewBox",`${-s/2} ${-c/2} ${s} ${c}`),this.root.attr("transform",`scale(${f})`);let Me=this.wrapDegrees((G??j??0)-me),Ve=we(t.color,i).dim;if(this.renderRings(B,k,p,b,me,f,x.showSelf??!0,Me,Ve),!r.position||!this.hasValidPosition(r.position))return;let Ue=b/p*k,et=this.buildTargets(o,r.position,k,Ue,p,me,x);this.lastRenderTargets=et,this.lastRenderScale=f,this.lastRenderSize=e,this.renderVectors(et,k,p,me,x,r),this.renderTargets(et,f),this.renderSelected(et,f),this.raiseOwnshipAndVector(),de>.5&&this.scheduleRender()}renderRings(e,t,i,o,r,s,c,p,f){if(!this.ringsLayer)return;let b=`${t.toFixed(3)}|${i.toFixed(3)}|${o.toFixed(3)}|${e}`;if(!this.ringCache||this.ringCache.key!==b){let Y=t/Math.max(1,e),Te=o/i*t,ge=[];for(let de=Y;de<=Te+1e-6;de+=Y)ge.push(de);let oe=ge.map(de=>({value:de,radius:de/t*i})).filter(de=>de.radius<=o+1e-6),le=20,me=oe.flatMap(de=>[{key:`${de.value}-top`,value:de.value,x:0,y:-de.radius+le},{key:`${de.value}-bottom`,value:de.value,x:0,y:de.radius-le}]);this.ringCache={key:b,rings:oe,labels:me}}let x=this.ringCache;if(!x)return;let S=x.rings,_=this.ringsLayer.selectAll("circle.ring").data(S,Y=>Y.value.toString());_.enter().append("circle").attr("class","ring").merge(_).attr("r",Y=>Y.radius).attr("stroke",f),_.exit().remove();let k=x.labels,B=this.ringsLayer.selectAll("text.ring-label").data(k,Y=>Y.key);B.enter().append("text").attr("class","ring-label").merge(B).attr("x",Y=>Y.x).attr("y",Y=>Y.y).attr("text-anchor","middle").attr("dominant-baseline","middle").text(Y=>`${Y.value}`),B.exit().remove();let R=this.ringsLayer.selectAll("circle.radar-center").data(c?[]:[{r:Math.max(3,i*.01)}]);R.enter().append("circle").attr("class","radar-center").merge(R).attr("cx",0).attr("cy",0).attr("r",Y=>Y.r).attr("fill",f),R.exit().remove();let G=this.ownShipLayer.selectAll("g.radar-ownship").data(c?[{size:this.resolveOwnShipBaseSize(s)}]:[]),j=G.enter().append("g").attr("class","radar-ownship");j.append("image").attr("class","ownship-icon").attr("href",this.ownShipIconHref??null).attr("xlink:href",this.ownShipIconHref??null);let K=j.merge(G);K.attr("transform",`rotate(${p})`),K.select("image.ownship-icon").attr("href",this.ownShipIconHref??null).attr("xlink:href",this.ownShipIconHref??null).attr("display",this.ownShipIconHref?null:"none").attr("width",Y=>Y.size).attr("height",Y=>Y.size).attr("x",Y=>-Y.size/2).attr("y",Y=>-Y.size/2),G.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=>ue(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),ue(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,o,r,s,c){let p=c.showLostTargets??!0,f=c.showUnconfirmedTargets??!0,b=`${t.latitude?.toFixed(6)}|${t.longitude?.toFixed(6)}`;this.lastOriginKey!==b&&(this.targetCache.clear(),this.lastOriginKey=b);let x=new Set;for(let k of e)x.add(k.id);for(let k of this.targetCache.keys())x.has(k)||this.targetCache.delete(k);for(let k of this.iconCache.keys())x.has(k)||this.iconCache.delete(k);let S=[];for(let k of e)k.ais.status==="remove"&&(this.targetCache.delete(k.id),this.iconCache.delete(k.id),this.selectedId()===k.id&&this.selectedId.set(null));let _=e.filter(k=>k.ais.status==="remove"||k.ais.status==="lost"&&!p||k.ais.status==="unconfirmed"&&!f||!k.position||!this.hasValidPosition(k.position)?!1:!this.shouldFilterTarget(k));for(let k of _){let B=this.buildTrackSignature(k),R=this.targetCache.get(k.id);if(!R||R.signature!==B){let le=this.distanceNm(t,k.position),me=this.ais.getBearingTrue(t,k.position)??0,de=this.toDegreesIfRadians(this.isVesselLike(k)?k.headingTrue:null),Me=this.toDegreesIfRadians(this.isVesselLike(k)?k.courseOverGroundTrue:null);R={signature:B,distanceNm:le,bearing:me,trackHeading:de,trackCog:Me},this.targetCache.set(k.id,R)}if(R.distanceNm>o)continue;let{href:G,scale:j}=this.resolveIconCached(k),K=this.wrapDegrees(R.bearing-s),{x:Y,y:Te}=this.polarToCartesian(K,R.distanceNm,i,r),ge=k.type==="aton"||k.type==="basestation"?0:this.wrapDegrees((R.trackHeading??R.trackCog??0)-s),oe=this.buildClassName({id:k.id,status:k.ais.status,aisClass:k.ais.class,type:k.type,navState:this.isVesselLike(k)?k.navState:void 0});S.push({id:k.id,raw:k,x:Y,y:Te,heading:ge,status:k.ais.status,aisClass:k.ais.class,type:k.type,iconHref:G,iconScale:j,navState:this.isVesselLike(k)?k.navState:void 0,sog:this.isVesselLike(k)?k.speedOverGround:void 0,cog:R.trackCog??null,className:oe})}return S}renderVectors(e,t,i,o,r,s){if(!this.vectorsLayer||!this.ownShipLayer)return;let c=r.showCogVectors??!0,p=Math.max(6,i*.04),f=(r.cogVectorsMinutes??5)*60,b=p*.8,x=[],S=[];for(let _ of e)if(this.isVesselLike(_.raw)&&!this.isStationaryNavState(_.raw.navState)&&c&&typeof _.sog=="number"&&typeof _.cog=="number"){let k=this.wrapDegrees(_.cog-o),B=this.offsetPoint(_.x,_.y,k,b),R=_.sog*f/1852,G=Math.max(0,R/t*i-b);if(G<=0)continue;let j=this.offsetPoint(B.x,B.y,k,G),K=this.resolveTargetVectorStroke(_.raw);x.push({id:_.id,x1:B.x,y1:B.y,x2:j.x,y2:j.y,className:_.className,stroke:K})}if(r.showSelf??!0){let _=this.toDegreesIfRadians(s.courseOverGroundTrue),k=s.speedOverGround;if(_!==null&&typeof k=="number"){let B=this.wrapDegrees(_-o),R=this.offsetPoint(0,0,B,b),G=k*f/1852,j=Math.max(0,G/t*i-b);if(j<=0)return;let K=this.offsetPoint(R.x,R.y,B,j);S.push({id:"ownship",x1:R.x,y1:R.y,x2:K.x,y2:K.y,className:"ownship-vector",stroke:"var(--kip-orange-color)"})}}this.renderVectorLines(this.vectorsLayer,"motion-vector",x),this.renderVectorLines(this.ownShipLayer,"ownship-vector",S)}renderVectorLines(e,t,i){let o=e.selectAll(`line.${t}`).data(i,s=>s.id);o.enter().append("line").attr("class",s=>`${t} ${s.className}`).merge(o).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"),o.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),o=this.targetsLayer.selectAll("g.target").data(e,c=>c.id),r=o.enter().append("g").on("click",(c,p)=>{c.stopPropagation(),this.handleTargetClick(c,p)});r.append("image").attr("class","target-icon"),r.append("title");let s=r.merge(o);s.attr("transform",c=>`translate(${c.x}, ${c.y}) rotate(${c.heading})`).attr("class",c=>`target ${c.className}`),s.select("image.target-icon").attr("href",c=>c.iconHref??null).attr("xlink:href",c=>c.iconHref??null).attr("display",c=>c.iconHref?null:"none").attr("width",c=>i*c.iconScale).attr("height",c=>i*c.iconScale).attr("x",c=>-(i*c.iconScale)/2).attr("y",c=>-(i*c.iconScale)/2),s.select("title").text(c=>`${c.raw.name??c.raw.mmsi??"AIS Target"}`),o.exit().remove()}renderSelected(e,t){if(!this.selectedLayer)return;let i=e.filter(f=>f.id===this.selectedId()),o=this.resolveTargetBaseSize(t),r=o*1.4,s=Math.min(r,Math.max(4,o*.6)),c=this.buildCornerBoxPath(r,s),p=this.selectedLayer.selectAll("path.selected-ring").data(i,f=>f.id);p.enter().append("path").attr("class","selected-ring").merge(p).attr("transform",f=>`translate(${f.x}, ${f.y})`).attr("d",c),p.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:ws,payload:{target:e}}).subscribe()}resolveMenuItems(e,t){return this.findTargetsNearEvent(e,t).map(o=>({id:o.id,label:this.buildTargetMenuLabel(o.raw),iconHref:o.iconHref,target:o.raw}))}findTargetsNearEvent(e,t){let i=this.lastRenderTargets.length?this.lastRenderTargets:[t],o=this.eventToRadarPoint(e);if(!o)return[t];let r=this.hitRadiusPx/this.lastRenderScale,s=i.map((c,p)=>{let f=c.x-o.x,b=c.y-o.y,x=Math.hypot(f,b);return{candidate:c,distance:x,index:p}}).filter(c=>c.distance<=r).sort((c,p)=>c.distance-p.distance||c.index-p.index).map(c=>c.candidate);return s.length?s:[t]}eventToRadarPoint(e){if(!this.lastRenderSize)return null;let o=this.svgRef().nativeElement.getBoundingClientRect(),r=e.clientX-o.left,s=e.clientY-o.top,c=(r-o.width/2)/this.lastRenderScale,p=(s-o.height/2)/this.lastRenderScale;return{x:c,y:p}}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 o=this.resolveIconScale(e.type),r={href:i?.icon.href??null,scale:o};this.iconCache.set(e.id,{signature:t,icon:r});let s=e.ais.status==="remove"?void 0:e.ais.status;return this.ngZone.runOutsideAngular(()=>{Nu({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(c=>{let p=this.iconCache.get(e.id);!p||p.signature!==t||(p.icon={href:c,scale:o},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<ol?"red":i<Ur?"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>=Ur:!0}resolveVesselIconKey(e){if(!this.isVesselLike(e))return null;let t=dl({mmsi:e.mmsi??e.id??"",type:e.type,aisShipTypeId:e.design?.aisShipType?.id});return t.startsWith("vessel/")?t:null}polarToCartesian(e,t,i,o){let r=e*Math.PI/180,s=t/i*o;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,o){let r=i*Math.PI/180;return{x:e+o*Math.sin(r),y:t-o*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,o=Math.min(Math.max(t,0),i);return[`M ${-i} ${-i} h ${o}`,`M ${-i} ${-i} v ${o}`,`M ${i} ${-i} h ${-o}`,`M ${i} ${-i} v ${o}`,`M ${-i} ${i} h ${o}`,`M ${-i} ${i} v ${-o}`,`M ${i} ${i} h ${-o}`,`M ${i} ${i} v ${-o}`].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)),o=Math.min(1,i/200),r=this.shortestAngleDelta(this.viewRotationSmoothed,e);return this.viewRotationSmoothed=this.wrapDegrees(this.viewRotationSmoothed+r*o),this.lastRotationAt=t,this.viewRotationSmoothed}toDegreesIfRadians(e){return typeof e!="number"||!Number.isFinite(e)?null:this.units.convertToUnit("deg",e)}distanceNm(e,t){let o=e.latitude*Math.PI/180,r=t.latitude*Math.PI/180,s=(t.latitude-e.latitude)*Math.PI/180,c=(t.longitude-e.longitude)*Math.PI/180,p=Math.sin(s/2),f=Math.sin(c/2),b=p*p+Math.cos(o)*Math.cos(r)*f*f;return 6371e3*(2*Math.atan2(Math.sqrt(b),Math.sqrt(1-b)))/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=q({type:n,selectors:[["widget-ais-radar"]],viewQuery:function(t,i){t&1&&Ce(i.svgRef,hx,5)(i.menuAnchorRef,px,5)(i.menuTrigger,gx,5),t&2&&Se(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&&(l(0,"div",5),z("kipResize",function(r){return i.onResized(r)}),l(1,"button",6),z("click",function(){return i.toggleViewMode()}),O(2,vx,4,0,":svg:svg",7)(3,bx,2,0,":svg:svg",7),u(),l(4,"button",8),z("click",function(){return i.incrementRange()}),l(5,"mat-icon"),d(6,"add"),u()(),l(7,"button",9),z("click",function(){return i.decrementRange()}),l(8,"mat-icon"),d(9,"remove"),u()(),l(10,"button",10)(11,"mat-icon"),d(12,"filter_list"),u()(),O(13,Ax,3,2,"button",11),te(),L(14,"svg",12,0),Fe(),L(16,"button",13,1),u(),l(19,"mat-menu",14,2),z("closed",function(){return i.resetTargetMenuState()}),ui(21,xx,2,0,"ng-template",15),u(),l(22,"mat-menu",null,3),ui(24,Cx,27,5,"ng-template",15),u(),l(25,"mat-menu",null,4),ui(27,wx,2,0,"ng-template",15),u(),O(28,_x,1,0,"div",16)),t&2){let o=Tt(20),r=Tt(23);g(),I("matTooltip",i.effectiveViewMode()==="north-up"?"Change to North-Up mode":"Change to Course-Up mode"),Q("aria-label",i.effectiveViewMode()==="north-up"?"North up mode":"Course up mode"),g(),N(i.effectiveViewMode()==="north-up"?2:3),g(8),it("is-active",i.hasActiveFilters()),I("matMenuTriggerFor",r),g(3),N(i.hasCollisionRiskData()?13:-1),g(3),I("matMenuTriggerFor",o),g(12),N(i.dashboard.isDashboardStatic()?-1:28)}},dependencies:[zt,nt,yr,at,Qe,au,iu,eu,tu,nu,Ua,Ba],encapsulation:2,changeDetection:0})}return n})();var Mx=["canvasMainRef"],ap=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);canvas=A(ct);static DEFAULT_CONFIG={displayName:"Static Label",color:"green",bgColor:"grey",noColor:!1,noBgColor:!0};canvasRef=ce.required("canvasMainRef");canvasElement=null;ctx=null;cssWidth=0;cssHeight=0;maxTextWidth=0;maxTextHeight=0;disposed=!1;fgColor=w("");bgColor=w("");constructor(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{this.fgColor.set(this.mapColor(e.color,t)),this.bgColor.set(this.mapColor(e.bgColor??"grey",t)),this.draw()})}),V(()=>{let e=this.runtime.options()?.displayName;W(()=>{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=q({type:n,selectors:[["widget-label"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,Mx,5),t&2&&Se()},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&&Z(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))}"]})}return n})();var kx=["plainIframe"];function Tx(n,a){if(n&1&&Z(0,"iframe",1,0),n&2){let e=T();Ei("src",e.widgetUrl(),ea)}}function Ex(n,a){n&1&&(E(0,"div",2)(1,"h2"),d(2,"Empty or bad URL"),P(),E(3,"p"),d(4," IMPORTANT: cross-domain security rules (CORS) apply to this widget. "),P(),E(5,"p"),d(6,"Typically, you can load Grafana graphs, Signal K apps or other related tools. "),P()())}var op=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);_dashboard=A(mt);_sanitizer=A(Ta);static DEFAULT_CONFIG={widgetUrl:null,allowInput:!1};iframe=ce.required("plainIframe");widgetUrl=w(null);displayTransparentOverlay=w("block");constructor(){V(()=>{let e=this.runtime.options(),t=this._dashboard.isDashboardStatic();e&&W(()=>{t?this.displayTransparentOverlay.set(e.allowInput?"none":"block"):this.displayTransparentOverlay.set("block")})}),V(()=>{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:o,shiftKey:r}=e.data.keyEventData,s=new KeyboardEvent("keydown",{key:i,ctrlKey:o,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 o=za({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=o,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=q({type:n,selectors:[["widget-iframe"]],viewQuery:function(t,i){t&1&&Ce(i.iframe,kx,5),t&2&&Se()},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&&(O(0,Tx,2,1,"iframe",1)(1,Ex,7,0,"div",2),Z(2,"div",3)),t&2&&(N(i.widgetUrl()?0:1),g(2),pe("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}"]})}return n})();var Dx=["hWrapper"];function Px(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 Ix(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 rp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);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=ce("hWrapper");resizeObserver=null;currentSize=0;structuralKey="";pendingSize=null;sizeCommitTimer=null;SIZE_STABLE_MS=180;ngZone=A(Be);gaugeOptions={};gauge=null;latestPitch=0;latestRoll=0;constructor(){V(()=>{let e=this.runtime.options();!e||!e.paths?.gaugePitchPath?.path||W(()=>this.streams.observe("gaugePitchPath",i=>{let o=i?.data?.value??0;if(this.latestPitch=o,this.gauge){let r=e.gauge?.invertPitch?-o:o;try{this.gauge.setPitchAnimated(r)}catch(s){}}}))}),V(()=>{let e=this.runtime.options();!e||!e.paths?.gaugeRollPath?.path||W(()=>this.streams.observe("gaugeRollPath",i=>{let o=i?.data?.value??0;if(this.latestRoll=o,this.gauge){let r=e.gauge?.invertRoll?-o:o;try{this.gauge.setRollAnimated(r)}catch(s){}}}))}),V(()=>{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 c=document.getElementById(this.id()+"-canvas");c&&((c.width!==r||c.height!==r)&&(c.width=r,c.height=r),c.style.width=r+"px",c.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)},o=()=>{let r=e.getBoundingClientRect(),s=Math.round(Math.min(r.width,r.height)),c=this.pendingSize??this.currentSize;if(!s||s<50||c&&Math.abs(c-s)<4)return;if(this.currentSize===0&&this.pendingSize===null){this.pendingSize=s,t();return}this.pendingSize=s;let p=document.getElementById(this.id()+"-canvas");p&&(p.style.width=s+"px",p.style.height=s+"px"),i()};this.ngZone.runOutsideAngular(()=>{this.resizeObserver=new ResizeObserver(()=>o()),this.resizeObserver.observe(e),o()})}buildOptions(e,t){if(typeof steelseries>"u")return;let i=Ix(steelseries),o=Px(steelseries);this.gaugeOptions={pointerColor:o.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=q({type:n,selectors:[["widget-horizon"]],viewQuery:function(t,i){t&1&&Ce(i.wrapperRef,Dx,5),t&2&&Se()},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),d(3," Browser does not support canvas element. "),P()()),t&2&&(pe("padding",i.gaugeOptions.frameVisible?"10px":"0px"),g(2),Ei("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}"]})}return n})();var Ox=["finePath"],Nx=["coarsePath"];function Rx(n,a){if(n&1&&(te(),Z(0,"line")),n&2){let e=a.$implicit;Q("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.5:1)}}function Lx(n,a){if(n&1&&(te(),Z(0,"line",20)),n&2){let e=a.$implicit;Q("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.2:.8)}}function Vx(n,a){if(n&1&&(te(),E(0,"text"),d(1),P()),n&2){let e=a.$implicit;Q("x",e.x)("y",e.y),g(),he("",e.text,"\xB0")}}function Wx(n,a){if(n&1&&(te(),Z(0,"line")),n&2){let e=a.$implicit;Q("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.5:1)}}function Fx(n,a){if(n&1&&(te(),Z(0,"line",20)),n&2){let e=a.$implicit;Q("x1",e.x1)("y1",e.y1)("x2",e.x2)("y2",e.y2)("stroke-width",e.major?1.2:.8)}}function Gx(n,a){if(n&1&&(te(),E(0,"text"),d(1),P()),n&2){let e=a.$implicit;Q("x",e.x)("y",e.y),g(),he("",e.text,"\xB0")}}var sp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);ngZone=A(Be);finePathRef=ce("finePath");coarsePathRef=ce("coarsePath");angleDeg=w(0);absAngle=ie(()=>{let e=this.angleDeg();return e==null?null:Math.abs(e)});angleSide=ie(()=>{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=ie(()=>{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=ie(()=>{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=ie(()=>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(){V(()=>{let e=this.runtime.options();!e||!e.paths?.angle?.path||W(()=>this.streams.observe("angle",i=>{let o=i?.data?.value;if(o==null){this.angleDeg.set(null);return}let r=e.gauge?.invertAngle?-o:o;this.angleDeg.set(r)}))}),V(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||this.themeColorValue.set(we(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 ie(()=>this.computePointerTransform(this.angleDeg(),e))}setColors(e){let t=this.runtime.options();!e||!t||this.themeColorValue.set(we(t.color||"contrast",e).color)}computePointerTransform(e,t){let i=e??0,o=t==="fine"?this.finePathRef()?.nativeElement:this.coarsePathRef()?.nativeElement;if(!o)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)),c=o.getTotalLength(),f=(s-r.min)/(r.max-r.min)*c,b=o.getPointAtLength(f),x=f<10||f>c-10?5:1,S=o.getPointAtLength(Math.max(0,f-x)),_=o.getPointAtLength(Math.min(c,f+x)),k=_.x-S.x,B=_.y-S.y,R=Math.atan2(B,k)*180/Math.PI,G=Math.hypot(k,B)||1,j=-B/G,K=k/G,Y=-10,Te=b.x+j*Y,ge=b.y+K*Y;return`translate(${Te}px, ${ge}px) rotate(${R}deg)`}buildScale(e,t,i,o,r){let s=e.getTotalLength(),c=[],p=[],f=[],b=i-t,x=Math.round(b/r),S=Math.round(o/r);for(let _=0;_<=x;_++){let k=t+_*r,B=_/x,R=_===x?s:B*s,G=e.getPointAtLength(R),j=e.getPointAtLength(Math.max(0,R-1)),K=e.getPointAtLength(Math.min(s,R+1)),Y=Math.atan2(K.y-j.y,K.x-j.x)*180/Math.PI,Te=_%S===0||Math.abs(k)<1e-9,ge=Te?8:4,oe=Te?6:3,le=this.pointFromAngle(G,Y+90,0),me=this.pointFromAngle(G,Y+90,ge);c.push({x1:le.x,y1:le.y,x2:me.x,y2:me.y,major:Te});let de=this.pointFromAngle(G,Y-90,0),Me=this.pointFromAngle(G,Y-90,oe);if(p.push({x1:de.x,y1:de.y,x2:Me.x,y2:Me.y,major:Te}),Te){let Ve=this.pointFromAngle(G,Y+90,ge+8);f.push({x:Ve.x,y:Ve.y,text:`${Math.abs(k)}`,value:k})}}return{ticks:c,innerTicks:p,labels:f}}pointFromAngle(e,t,i){let o=t*Math.PI/180;return{x:e.x+Math.cos(o)*i,y:e.y+Math.sin(o)*i}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-heel-gauge"]],viewQuery:function(t,i){t&1&&Ce(i.finePathRef,Ox,5)(i.coarsePathRef,Nx,5),t&2&&Se(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),te(),E(1,"svg",3)(2,"defs")(3,"linearGradient",4),Z(4,"stop",5)(5,"stop",6)(6,"stop",7),P(),E(7,"filter",8),Z(8,"feGaussianBlur",9),E(9,"feSpecularLighting",10),Z(10,"fePointLight",11)(11,"fePointLight",12),P(),Z(12,"feComposite",13)(13,"feComposite",14),P()(),Z(14,"path",15)(15,"path",16)(16,"path",17)(17,"path",18,0),E(19,"g",19),Ae(20,Rx,1,5,":svg:line",null,Le),P(),E(22,"g",19),Ae(23,Lx,1,5,":svg:line",20,Le),P(),E(25,"g",21),Ae(26,Vx,2,3,":svg:text",null,Le),P(),E(28,"g",22),Z(29,"ellipse",23),P(),E(30,"text",24),d(31),P()(),E(32,"svg",25)(33,"g",26)(34,"text",27),d(35),E(36,"tspan",28),d(37),P()(),Z(38,"path",29)(39,"path",30)(40,"path",31)(41,"path",32,1),E(43,"g",19),Ae(44,Wx,1,5,":svg:line",null,Le),P(),E(46,"g",19),Ae(47,Fx,1,5,":svg:line",20,Le),P(),E(49,"g",21),Ae(50,Gx,2,3,":svg:text",null,Le),P(),E(52,"g",33),Z(53,"ellipse",23),P()()()()),t&2&&(g(20),ye(i.fineTicks()),g(3),ye(i.fineInnerTicks()),g(3),ye(i.fineLabels()),g(2),pe("transition",i.ready()?i.pointerTransition():"none")("transform",i.finePointerTransform()),it("ready",i.ready()),g(),Q("fill",i.themeColorValue()),g(2),X(i.displayName()),g(3),Q("fill",i.themeColorValue()),g(),he(" ",i.displayValue(),"\xB0 "),g(2),X(i.angleSide()),g(7),ye(i.coarseTicks()),g(3),ye(i.coarseInnerTicks()),g(3),ye(i.coarseLabels()),g(2),pe("transition",i.ready()?i.pointerTransition():"none")("transform",i.coarsePointerTransform()),it("ready",i.ready()),g(),Q("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}"]})}return n})();var Bx=["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 Nl={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},Rl={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},lp=(()=>{class n{unitsService=A(ot);canvasService=A(ct);canvasRef=ce("gaugeCanvas");widgetUUID=y(void 0);subType=y(void 0);barGauge=y(void 0);radialSize=y(void 0);backgroundColor=y(void 0);frameColor=y(void 0);minValue=y(void 0);maxValue=y(void 0);decimals=y(void 0);zones=y(void 0);title=y(void 0);units=y(void 0);value=y(void 0);theme=y(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=[],o=[],r=[...t].sort((s,c)=>s.lower-c.lower);for(let s of r){let c=null,p=null,f;switch(s.state){case ve.Emergency:f=this.theme().zoneEmergency;break;case ve.Alarm:f=this.theme().zoneAlarm;break;case ve.Warn:f=this.theme().zoneWarn;break;case ve.Alert:f=this.theme().zoneAlert;break;case ve.Nominal:f=this.theme().zoneNominal;break;default:f="rgba(0,0,0,0)"}let b=this.units();if(b=="ratio"?(c=s.lower,p=s.upper):(c=this.unitsService.convertToUnit(b,s.lower),p=this.unitsService.convertToUnit(b,s.upper)),!(p<this.minValue()||c>this.maxValue())){if(c=c!==null?c:this.minValue(),p=p!==null?p:this.maxValue(),c=Math.max(c,this.minValue()),p>this.maxValue()){p=this.maxValue(),i.push(steelseries.Section(c,p,f));break}i.push(steelseries.Section(c,p,f))}}this.gaugeOptions.section=i,this.gaugeOptions.area=o,this.gaugeOptions.useSectionColors=!0}Nl[this.backgroundColor()]&&(this.gaugeOptions.backgroundColor=Nl[this.backgroundColor()]),Rl[this.frameColor()]&&(this.gaugeOptions.frameDesign=Rl[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 o=this.subType();o==="radial"?this.gauge=new steelseries.Radial(t,this.gaugeOptions):o==="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),o=Math.floor(e.contentRect.height);this.gaugeOptions.width=i,this.gaugeOptions.height=o,t=`linear:${i}x${o}`}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(Nl[e.backgroundColor.currentValue]),e.frameColor&&this.gauge.setFrameDesign(Rl[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=q({type:n,selectors:[["gauge-steel"]],viewQuery:function(t,i){t&1&&Ce(i.canvasRef,Bx,5),t&2&&Se()},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:[Bi],decls:4,vars:2,consts:[["gaugeCanvas",""],["kipResizeObserver","",1,"wrapper",3,"resizeChange"],[2,"z-index","inherit",3,"id"]],template:function(t,i){t&1&&(l(0,"div",1),z("resizeChange",function(r){return i.onResized(r)}),l(1,"canvas",2,0),d(3," Browser does not support canvas element. "),u()()),t&2&&(g(),I("id",Di(i.widgetUUID())))},dependencies:[zt],styles:[".sgWrapper[_ngcontent-%COMP%]{height:100%;width:100%;text-align:center}"]})}return n})();var dp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);metadata=A(ei);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=ie(()=>this.runtime.options()?.displayName||"Gauge Label");constructor(){V(()=>{let e=this.runtime.options();!e||!e.paths?.gaugePath?.path||W(()=>this.streams.observe("gaugePath",i=>{let o=i?.data?.value,r=e.displayScale?.lower??0,s=e.displayScale?.upper??r+100;if(o==null)this.dataValue.set(r);else{let c=Math.min(Math.max(o,r),s);this.dataValue.set(c)}}))}),V(()=>{let e=this.runtime.options();if(!e)return;if(e.ignoreZones){this.zones.set([]);return}if(!e.paths?.gaugePath?.path){this.zones.set([]);return}W(()=>this.metadata.observe("gaugePath")),this.zones.set(this.metadata.zones())})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"div",0),L(1,"gauge-steel",1),u()),t&2){let o,r,s,c,p,f,b,x,S;g(),I("widgetUUID",i.id())("subType",(o=i.runtime.options())==null||o.gauge==null?null:o.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",(c=i.runtime.options())==null||c.gauge==null?null:c.gauge.backgroundColor)("frameColor",(p=i.runtime.options())==null||p.gauge==null?null:p.gauge.faceColor)("minValue",(f=i.runtime.options())==null||f.displayScale==null?null:f.displayScale.lower)("maxValue",(b=i.runtime.options())==null||b.displayScale==null?null:b.displayScale.upper)("decimals",(x=i.runtime.options())==null?null:x.numDecimal)("zones",i.zones())("title",i.displayName())("units",(S=i.runtime.options())==null||S.paths==null||S.paths.gaugePath==null?null:S.paths.gaugePath.convertUnitTo)("value",i.dataValue())("themeColors",i.theme())}},dependencies:[lp],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%)}"]})}return n})();var jn=bd(Ll(),1),hp=bd(Ll(),1);var Ux=["gauge"],zx=n=>n.replace(/(\-\w)/g,a=>a[1].toUpperCase()),Hx=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cp=n=>zx(n),up=(()=>{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=cp(t.name);e[i]=jn.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=jn.DomObserver.parse(i);else{let o=Hx(t);this.el.nativeElement.setAttribute(o,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[cp(i.attributeName)]=jn.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)(ta(Ye),ta(Be))};static \u0275dir=Dt({type:n,viewQuery:function(t,i){if(t&1&&Sn(Ux,7),t&2){let o;mi(o=hi())&&(i.canvas=o.first)}},inputs:{options:"options",value:"value"}})}return n})();var mp=(()=>{class n extends up{constructor(e,t){super(e,t)}ngOnInit(){this.gauge=new jn.LinearGauge(this.options).draw()}static \u0275fac=function(t){return new(t||n)(ta(Ye),ta(Be))};static \u0275cmp=q({type:n,selectors:[["linear-gauge"]],features:[mo],decls:2,vars:0,consts:[["gauge",""]],template:function(t,i){t&1&&L(0,"canvas",null,0)},encapsulation:2})}return n})();var Ms=(()=>{class n extends up{constructor(e,t){super(e,t)}ngOnInit(){this.gauge=new jn.RadialGauge(this.options).draw()}static \u0275fac=function(t){return new(t||n)(ta(Ye),ta(Be))};static \u0275cmp=q({type:n,selectors:[["radial-gauge"]],features:[mo],decls:2,vars:0,consts:[["gauge",""]],template:function(t,i){t&1&&L(0,"canvas",null,0)},encapsulation:2})}return n})(),Ja=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ui({type:n});static \u0275inj=Gi({})}return n})();function ks(n,a,e=!1){let t=[],i=a-n,o=0,r=10;i=pp(a-n,!1),o=pp(i/(r-1),!0);let s=Math.floor(n/o)*o,c=Math.ceil(a/o)*o;t.push(s);let p=i/o;for(let f=0;f<p;f++)if(t[f]<c){let b=(Number(t[f].toFixed(2))*100+Number(o.toFixed(2))*100)/100;t.push(b)}if(t[t.length-1]!==c&&t.push(c),e){let f=[...t].reverse();return{min:s,max:c,majorTicks:f}}return{min:s,max:c,majorTicks:t}}function pp(n,a){let e=Math.floor(Math.log10(n)),t=n/Math.pow(10,e),i=null;return a?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 gp=["radialGauge"],fp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);metadata=A(ei);unitsService=A(ot);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:{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=ce.required("radialGauge");gauge=ce("radialGauge",{read:Ye});value=w(0);textValue=w("");colorStrokeTicks=w("");adjustedScale=ie(()=>{let e=this.runtime.options();return e?e.gauge?.subType==="capacity"?{min:e.displayScale?.lower??0,max:e.displayScale?.upper??100,majorTicks:[]}:ks(e.displayScale?.lower??0,e.displayScale?.upper??100,e.gauge?.barStartPosition==="right"):{min:0,max:100,majorTicks:[]}});highlights=ie(()=>{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 o=t.paths?.gaugePath,r=this.adjustedScale(),s=t.gauge?.barStartPosition==="right";return Ya(e,i,o.convertUnitTo,this.unitsService,r.min,r.max,s)});displayName=ie(()=>this.runtime.options()?.displayName);pathDataState=w(null);viewReady=w(!1);gaugeOptions={};constructor(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||e.paths?.gaugePath.path&&W(()=>this.streams.observe("gaugePath",i=>{i.state!==this.pathDataState()&&this.pathDataState.set(i.state||null);let o=i?.data?.value??null;if(o==null)this.value.set(e.displayScale?.lower??0),this.textValue.set("--");else{let r=e.displayScale?.lower??0,s=e.displayScale?.upper??100,c=Math.min(Math.max(o,r),s);this.value.set(c),this.textValue()==="--"&&this.textValue.set("")}}))}),V(()=>{let e=this.runtime.options();!e||e.ignoreZones||W(()=>this.metadata.observe("gaugePath"))}),V(()=>{let e=this.highlights();this.viewReady()&&W(()=>{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){}})}),V(()=>{let e=this.theme(),t=this.adjustedScale();W(()=>{if(this.buildGaugeOptions(this.runtime.options(),e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions)}catch(i){}})}),V(()=>{let e=this.pathDataState();this.viewReady()&&W(()=>{let t=this.runtime.options(),i=this.theme();if(t.ignoreZones)return;let o={};switch(e){case ve.Alarm:o.colorBorderMiddle=i.cardColor,o.colorBarProgress=i.zoneAlarm,o.colorValueText=i.zoneAlarm;break;case ve.Warn:o.colorBorderMiddle=i.cardColor,o.colorBarProgress=i.zoneWarn,o.colorValueText=i.zoneWarn;break;case ve.Alert:o.colorBorderMiddle=i.cardColor,o.colorBarProgress=i.zoneAlert,o.colorValueText=i.zoneAlert;break;default:o.colorBorderMiddle=i.cardColor,o.colorBarProgress=t.gauge?.subType==="measuring"?we(t.color,i).color:we(t.color,i).dim,o.colorValueText=we(t.color,i).color}try{this.ngGauge()?.update(o)}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(o){}}buildGaugeOptions(e,t,i){let o={};o.title=this.displayName(),o.minValue=i.min,o.maxValue=i.max,o.units=e.paths?.gaugePath?.convertUnitTo,o.highlights=[];let r=this.highlights();r.length&&(o.highlights=JSON.stringify(r),o.highlightsWidth=e.gauge?.highlightsWidth),o.fontTitle="Roboto",o.fontTitleWeight="bold",o.fontUnits="Roboto",o.fontUnitsSize=25,o.fontUnitsWeight="normal",o.barStrokeWidth=0,o.barShadow=0,o.colorBarStroke="",o.fontValue="Roboto",o.fontValueWeight="bold",o.valueTextShadow=!1,o.colorValueBoxShadow="",o.fontNumbers="Roboto",o.fontNumbersWeight="bold",o.valueInt=e.numInt??1,o.valueDec=e.numDecimal??2,o.majorTicksInt=o.valueInt,o.majorTicksDec=o.valueDec,o.highlightsWidth=e.gauge?.highlightsWidth,o.animation=!0,o.animateOnInit=!1,o.animatedValue=!1,o.animationRule="linear";let s=e.paths?.gaugePath?.sampleTime??500;o.animationDuration=s-25,o.colorBorderShadow=!1,o.colorBorderOuter=t.cardColor,o.colorBorderOuterEnd="",o.colorBorderMiddle=t.cardColor,o.colorBorderMiddleEnd="",o.colorPlate=o.colorPlateEnd=t.cardColor,o.colorBar=t.background,o.barProgress=e.gauge?.enableProgressbar,o.colorBarProgress=we(e.color,t).color,o.colorNeedle=we(e.color,t).color,o.colorNeedleEnd=we(e.color,t).color,o.needleShadow=!0,o.colorNeedleShadowUp="black",o.colorNeedleShadowDown="black",o.colorNeedleCircleInner=o.colorPlate,o.colorNeedleCircleInnerEnd=o.colorPlate,o.colorNeedleCircleOuter=o.colorPlate,o.colorNeedleCircleOuterEnd=o.colorPlate,o.colorTitle=t.contrastDim,o.colorUnits=t.contrastDim,o.colorValueText=we(e.color,t).color,this.colorStrokeTicks.set(t.contrastDim),o.colorMinorTicks=t.contrastDim,o.animationTarget=this.ANIMATION_TARGET_NEEDLE,o.useMinPath=!1,e.gauge?.subType==="capacity"?(o.fontTitleSize=40,o.valueBox=!0,o.fontValueSize=60,o.valueBoxWidth=10,o.valueBoxBorderRadius=5,o.valueBoxStroke=0,o.colorValueBoxBackground="",o.colorMajorTicks=o.colorPlate,o.colorNumbers=o.colorMinorTicks="",o.barWidth=20,o.colorBarProgress=we(e.color,t).dim,o.needle=e.gauge.enableNeedle,o.needleType=this.LINE,o.needleWidth=2,o.needleStart=75,o.needleEnd=95,o.needleCircleSize=1,o.needleCircleInner=!1,o.needleCircleOuter=!1,o.ticksAngle=360,o.startAngle=e.gauge?.scaleStart||180,o.majorTicks=0,o.exactTicks=!0,o.strokeTicks=!1,o.minorTicks=0,o.numbersMargin=0,o.fontNumbersSize=0,o.borders=!0,o.borderOuterWidth=2,o.borderMiddleWidth=1,o.borderInnerWidth=0,o.borderShadowWidth=0):(o.fontTitleSize=24,o.barWidth=15,o.valueBox=!0,o.fontValueSize=60,o.valueBoxWidth=100,o.valueBoxBorderRadius=0,o.valueBoxStroke=0,o.colorValueBoxBackground="",o.needle=e.gauge.enableNeedle,o.needleType=this.LINE,o.needleWidth=2,o.needleStart=0,o.needleEnd=95,o.needleCircleSize=10,o.needleCircleInner=!1,o.needleCircleOuter=!1,o.ticksAngle=270,o.startAngle=45,o.barStartPosition=e.gauge?.barStartPosition||"left",e.gauge.enableTicks?(o.strokeTicks=!0,o.majorTicks=i.majorTicks,o.minorTicks=2,o.exactTicks=!1,o.numbersMargin=3,o.fontNumbersSize=15,o.colorMajorTicks=t.contrastDim,o.colorNumbers=t.contrastDim):(o.strokeTicks=!1,o.majorTicks=0,o.minorTicks=0,o.exactTicks=!0,o.numbersMargin=0,o.fontNumbersSize=0,o.colorMajorTicks=o.colorPlate,o.colorNumbers=o.colorMinorTicks=""),o.borders=!0,o.borderOuterWidth=2,o.borderMiddleWidth=1,o.borderInnerWidth=0,o.borderShadowWidth=0,o.animationTarget=this.ANIMATION_TARGET_NEEDLE,o.useMinPath=!1),this.gaugeOptions=o}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-gauge-ng-radial"]],viewQuery:function(t,i){t&1&&Ce(i.ngGauge,gp,5)(i.gauge,gp,5,Ye),t&2&&Se(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:3,consts:[["radialGauge",""],["kipResizeObserver","",3,"resizeChange","options","value"]],template:function(t,i){t&1&&(l(0,"radial-gauge",1,0),z("resizeChange",function(r){return i.onResized(r)}),u()),t&2&&(I("options",i.gaugeOptions)("value",i.value()),Q("value-text",i.textValue()))},dependencies:[zt,Ja,Ms],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}"]})}return n})();var vp=["linearGauge"],bp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);metadata=A(ei);unitsService=A(ot);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:{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=ce("linearGauge");gauge=ce("linearGauge",{read:Ye});textValue=w("--");value=w(0);gaugeOptions={};viewReady=w(!1);currentState=w(ve.Normal);adjustedScale=ie(()=>{let e=this.runtime.options();return e?e.gauge?.enableTicks?ks(e.displayScale.lower,e.displayScale.upper):{min:e.displayScale.lower,max:e.displayScale.upper,majorTicks:[]}:{min:0,max:100,majorTicks:[]}});highlights=ie(()=>{let e=this.metadata.zones(),t=this.runtime.options(),i=this.theme();return e?.length?!t||!i?[]:t.ignoreZones?[]:t.paths?.gaugePath?Ya(e,i,t.paths.gaugePath.convertUnitTo,this.unitsService,this.adjustedScale().min,this.adjustedScale().max):[]:[]});displayName=ie(()=>this.runtime.options()?.displayName||"Gauge Label");constructor(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||e.paths?.gaugePath.path&&W(()=>this.streams.observe("gaugePath",i=>{let o=i?.data?.value??null;if(o==null)this.value.set(e.displayScale.lower),this.textValue.set("--");else{let r=Math.min(Math.max(o,e.displayScale.lower),e.displayScale.upper);this.value.set(r),this.textValue()==="--"&&this.textValue.set("")}i.state!==this.currentState()&&this.currentState.set(i.state)}))}),V(()=>{let e=this.runtime.options();!e||e.ignoreZones||W(()=>this.metadata.observe("gaugePath"))}),V(()=>{let e=this.highlights();this.viewReady()&&W(()=>{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){}})}),V(()=>{let e=this.theme(),t=this.adjustedScale();W(()=>{if(this.buildGaugeOptions(this.runtime.options(),e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions),this.applyInitialSize()}catch(i){}})}),V(()=>{let e=this.currentState();this.viewReady()&&W(()=>{let t=this.runtime.options(),i=this.theme();if(t.ignoreZones)return;let o={},r=t.gauge?.enableNeedle,s=we(t.color,i);switch(e){case ve.Alarm:r?(o.colorNeedle=i.zoneAlarm,o.colorValueText=i.zoneAlarm):(o.colorBarProgress=i.zoneAlarm,o.colorValueText=i.zoneAlarm);break;case ve.Warn:r?(o.colorNeedle=i.zoneWarn,o.colorValueText=i.zoneWarn):(o.colorBarProgress=i.zoneWarn,o.colorValueText=i.zoneWarn);break;case ve.Alert:r?(o.colorNeedle=i.zoneAlert,o.colorValueText=i.zoneAlert):(o.colorBarProgress=i.zoneAlert,o.colorValueText=i.zoneAlert);break;default:r?(o.colorNeedle=s.color,o.colorValueText=s.color):(o.colorBarProgress=s.color,o.colorValueText=s.color)}try{this.ngGauge()?.update(o)}catch(c){}})})}buildGaugeOptions(e,t,i){let o=this.gaugeOptions={},r=e.gauge?.subType==="vertical",s=e.gauge?.enableNeedle,c=e.gauge?.enableTicks;o.minValue=i.min,o.maxValue=i.max,o.valueInt=e.numInt??1,o.valueDec=e.numDecimal??2,o.title=this.displayName(),o.fontTitleSize=40,o.fontTitle="Roboto",o.fontTitleWeight="bold",o.barLength=r?80:90,o.barWidth=c?s?0:30:60,o.barProgress=!0,o.barBeginCircle=0,o.barStrokeWidth=0,o.barShadow=0,o.needle=!!s,o.needleType=s?"arrow":"line",o.needleStart=s?r?200:155:-45,o.needleEnd=s?r?175:180:55,o.needleShadow=!0,o.needleSide="both",o.units=e.paths?.gaugePath?.convertUnitTo,o.fontUnits="Roboto",o.fontUnitsWeight="normal",o.borders=!1,o.borderOuterWidth=0,o.borderMiddleWidth=0,o.borderInnerWidth=0,o.borderShadowWidth=0,o.borderRadius=0,o.valueBox=!0,o.valueBoxWidth=35,o.valueBoxStroke=0,o.valueBoxBorderRadius=10,o.colorValueBoxRect="",o.colorValueBoxRectEnd="",o.colorValueBoxShadow="",o.fontValueSize=50,o.fontValue="Roboto",o.fontValueWeight="bold",o.valueTextShadow=!1,o.fontNumbers="Roboto",o.fontNumbersWeight="normal",o.fontUnitsSize=r?40:35,o.colorTitle=we("contrast",t).dim,o.colorUnits=we("contrast",t).dim,o.colorValueBoxBackground=t.background;let p=we(e.color,t);o.colorValueText=p.color,s?(o.colorNeedle=p.color,o.colorNeedleEnd=p.color,o.needleWidth=45,o.colorNeedleShadowUp=p.color,o.colorNeedleShadowDown=p.color):(o.colorBarProgress=p.color,o.colorBarProgressEnd="",o.needleWidth=0),o.colorPlate=t.cardColor,o.colorBar=t.background,o.colorBarEnd="",o.colorBarStroke="0",o.colorMajorTicks=we("contrast",t).dim,o.colorMinorTicks=we("contrast",t).dim,o.colorNumbers=we("contrast",t).dim,o.majorTicks=c?i.majorTicks:[],o.majorTicksInt=e.numInt??1,o.majorTicksDec=e.numDecimal??2,o.strokeTicks=!!c,o.minorTicks=c?2:0,o.ticksWidthMinor=c?6:0,o.numberSide=s?"right":"left",o.fontNumbersSize=c?r?22:30:0,o.numbersMargin=r?s?-7:-3:s?-33:-5,o.ticksWidth=c?s&&r?15:10:0,o.ticksPadding=c?r?s?0:5:s?9:8:0,o.tickSide="left",o.animation=!0,o.animationRule="linear",o.animatedValue=!1,o.animateOnInit=!1,o.animationDuration=(e.paths?.gaugePath?.sampleTime??500)-25,o.highlights=[],o.highlightsWidth=e.gauge?.highlightsWidth;let f=this.highlights();f.length&&(o.highlights=JSON.stringify(f))}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,o,r;this.runtime.options()?.gauge?.subType==="vertical"?(o=t.height,r=t.height*i):(r=t.width,o=t.width*i);let p={height:o,width:r};try{this.ngGauge()?.update(p)}catch(f){}}onResized(e){let t=this.runtime.options();if(!t)return;let i=.3,o=t.gauge?.subType==="vertical",r={};o?(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=q({type:n,selectors:[["widget-gauge-ng-linear"]],viewQuery:function(t,i){t&1&&Ce(i.ngGauge,vp,5)(i.gauge,vp,5,Ye),t&2&&Se(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:3,consts:[["linearGauge",""],["kipResizeObserver","",1,"linearGauge",3,"resizeChange","options","value"]],template:function(t,i){t&1&&(l(0,"linear-gauge",1,0),z("resizeChange",function(r){return i.onResized(r)}),u()),t&2&&(I("options",i.gaugeOptions)("value",i.value()),Q("value-text",i.textValue()))},dependencies:[zt,Ja,mp],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}"]})}return n})();var Ap=["compassGauge"];function yp(n){let a=n.match(/(\d+(\.\d+)?|\.\d+)/g);if(!a||a.length<3)throw new Error("Invalid RGBA format");let[e,t,i,o=1]=a.map(Number),r=o===1?"":Math.round(o*255).toString(16).padStart(2,"0").toUpperCase();return"#"+((1<<24)+(e<<16)+(t<<8)+i).toString(16).slice(1).toUpperCase()+r}function qx(n){return n<0&&(n=360+n),n}var xp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);static DEFAULT_CONFIG={displayName:"Gauge Label",filterSelfPaths:!0,paths:{gaugePath:{description:"Numeric Data",path:null,source:null,pathType:"number",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(0);ngGauge=ce("compassGauge");gauge=ce("compassGauge",{read:Ye});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=ie(()=>this.runtime.options()?.displayName);constructor(){V(()=>{let e=this.runtime.options(),t=this.theme();if(!e||!t)return;let i=e.paths?.gaugePath;i?.path&&W(()=>this.streams.observe("gaugePath",o=>{let r=o?.data?.value??null;if(r==null)this.value.set(0),this.textValue.set("--");else{this.negToPortPaths.includes(i.path)&&(r=qx(r));let c=Math.min(Math.max(r,0),360);this.value.set(c),this.textValue.set(c.toFixed(0))}let s=o?.state??ve.Normal;s!==this.currentState()&&this.currentState.set(s)}))}),V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{if(this.buildGaugeOptions(e,t),this.viewReady())try{this.ngGauge()?.update(this.gaugeOptions)}catch(i){}})}),V(()=>{let e=this.runtime.options(),t=this.theme(),i=this.currentState();!e||!t||this.viewReady()&&i!==this.lastAppliedState&&W(()=>{let o={};switch(i){case ve.Emergency:o.colorValueText=t.zoneEmergency;break;case ve.Alarm:o.colorValueText=t.zoneAlarm;break;case ve.Warn:o.colorValueText=t.zoneWarn;break;case ve.Alert:o.colorValueText=t.zoneAlert;break;default:o.colorValueText=t.contrast;break}try{this.ngGauge()?.update(o)}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.animation=!0,i.animateOnInit=!0,i.animatedValue=!0,i.animationRule="linear",i.animationDuration=(e.paths?.gaugePath?.sampleTime??500)-50;let o=we(e.color,t),r=yp(o.dim),s=yp(we("contrast",t).dim);i.colorBarProgress=o.color,i.colorBorderMiddle=r,i.colorBorderMiddleEnd=r,i.colorNeedle=o.color,i.colorNeedleEnd=o.color,i.colorTitle=s,i.colorUnits=s,i.colorValueText=o.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(o){}}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=q({type:n,selectors:[["widget-gauge-ng-compass"]],viewQuery:function(t,i){t&1&&Ce(i.ngGauge,Ap,5)(i.gauge,Ap,5,Ye),t&2&&Se(2)},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"]},decls:2,vars:4,consts:[["compassGauge",""],["kipResizeObserver","",3,"resizeChange","options","value"]],template:function(t,i){t&1&&(l(0,"radial-gauge",1,0),z("resizeChange",function(r){return i.onResized(r)}),u()),t&2&&(I("options",i.gaugeOptions)("value",i.value()),Q("value-text",i.textValue())("color-stroke-ticks",i.colorStrokeTicks))},dependencies:[zt,Ja,Ms],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}"]})}return n})();var jx=["plainIframe"],Cp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);_dashboard=A(mt);_sanitizer=A(Ta);settings=A(Ot);static DEFAULT_CONFIG={};iframe=ce.required("plainIframe");widgetUrl=null;displayTransparentOverlay=w("block");constructor(){let e=new URL("/signalk-anchoralarm-plugin/",window.location.origin);this.widgetUrl=this.toSafeResourceUrl(e),V(()=>{let t=this.runtime.options(),i=this._dashboard.isDashboardStatic();t&&W(()=>{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:o,shiftKey:r}=e.data.keyEventData,s=new KeyboardEvent("keydown",{key:i,ctrlKey:o,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 o=za({instanceId:this.id()}),r=t.createElement("script");r.id=i,r.textContent=o,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=q({type:n,selectors:[["widget-anchor-alarm"]],viewQuery:function(t,i){t&1&&Ce(i.iframe,jx,5),t&2&&Se()},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&&Z(0,"iframe",1,0)(2,"div",2),t&2&&(Ei("src",i.widgetUrl,ea),g(2),pe("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}"]})}return n})();var $x=["canvasMainRef"],Sp=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);streams=A(Ne);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=ce.required("canvasMainRef");canvasElement;canvasCtx;titleBitmap=null;titleBitmapText=null;titleBitmapColor=null;canvas=A(ct);cssWidth=0;cssHeight=0;dataValue=w(null);_timeZoneGTM="";isDestroyed=!1;labelColor=w(void 0);valueColor=void 0;maxTextWidth=0;maxTextHeight=0;displayName=ie(()=>this.runtime.options()?.displayName);dateFormat=ie(()=>this.runtime.options()?.dateFormat);dateTimezone=ie(()=>this.runtime.options()?.dateTimezone);constructor(){V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{this.applyColors(),e.paths?.gaugePath?.path&&(this._timeZoneGTM=this.getGMTOffset(this.dateTimezone()),this.streams.observe("gaugePath",o=>{this.dataValue.set(o?.data?.value??null),this.drawWidget()}))})}),V(()=>{let e=this.theme(),t=this.runtime.options();!e||!t||W(()=>{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 o=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"}).formatToParts(new Date).find(r=>r.type==="timeZoneName");return o?o.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(we(e.color,t).dim),this.valueColor=we(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=Gd(i,this.dateFormat(),"en-US",this._timeZoneGTM)}catch(o){t=o,console.log("[Date Time Widget]: "+o)}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=q({type:n,selectors:[["widget-datetime"]],viewQuery:function(t,i){t&1&&Ce(i.canvasMainRef,$x,5),t&2&&Se()},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&&Z(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}"]})}return n})();var wp={modes:{point(n,a){return Ts(n,a,{intersect:!0})},nearest(n,a,e){return Qx(n,a,e)},x(n,a,e){return Ts(n,a,{intersect:e.intersect,axis:"x"})},y(n,a,e){return Ts(n,a,{intersect:e.intersect,axis:"y"})}}};function jl(n,a,e){return(wp.modes[e.mode]||wp.modes.nearest)(n,a,e)}function Yx(n,a,e){return e!=="x"&&e!=="y"?n.inRange(a.x,a.y,"x",!0)||n.inRange(a.x,a.y,"y",!0):n.inRange(a.x,a.y,e,!0)}function Zx(n,a,e){return e==="x"?{x:n.x,y:a.y}:e==="y"?{x:a.x,y:n.y}:a}function Ts(n,a,e){return n.filter(t=>e.intersect?t.inRange(a.x,a.y):Yx(t,a,e.axis))}function Qx(n,a,e){let t=Number.POSITIVE_INFINITY;return Ts(n,a,e).reduce((i,o)=>{let r=o.getCenterPoint(),s=Zx(a,r,e.axis),c=vo(a,s);return c<t?(i=[o],t=c):c===t&&i.push(o),i},[]).sort((i,o)=>i._index-o._index).slice(0,1)}function ba(n,a,e){let t=Math.cos(e),i=Math.sin(e),o=a.x,r=a.y;return{x:o+t*(n.x-o)-i*(n.y-r),y:r+i*(n.x-o)+t*(n.y-r)}}var Xx=(n,a)=>a>n||n.length>a.length&&n.slice(0,a.length)===a,pa=.001,Ds=(n,a,e)=>Math.min(e,Math.max(a,n)),Hp=(n,a)=>n.value>=n.start-a&&n.value<=n.end+a;function Kx(n,a,e){for(let t of Object.keys(n))n[t]=Ds(n[t],a,e);return n}function Jx(n,a,e,t){return!n||!a||e<=0?!1:Math.pow(n.x-a.x,2)+Math.pow(n.y-a.y,2)<=Math.pow(e+t,2)}function qp(n,{x:a,y:e,x2:t,y2:i},o,{borderWidth:r,hitTolerance:s}){let c=(r+s)/2,p=n.x>=a-c-pa&&n.x<=t+c+pa,f=n.y>=e-c-pa&&n.y<=i+c+pa;return o==="x"?p:(o==="y"||p)&&f}function jp(n,{rect:a,center:e},t,{rotation:i,borderWidth:o,hitTolerance:r}){let s=ba(n,e,Ni(-i));return qp(s,a,t,{borderWidth:o,hitTolerance:r})}function Aa(n,a){let{centerX:e,centerY:t}=n.getProps(["centerX","centerY"],a);return{x:e,y:t}}function eC(n,a,e,t=!0){let i=e.split("."),o=0;for(let r of a.split(".")){let s=i[o++];if(parseInt(r,10)<parseInt(s,10))break;if(Xx(s,r)){if(t)throw new Error(`${n} v${e} is not supported. v${a} or newer is required.`);return!1}}return!0}var $p=n=>typeof n=="string"&&n.endsWith("%"),Yp=n=>parseFloat(n)/100,Zp=n=>Ds(Yp(n),0,1),zo=(n,a)=>({x:n,y:a,x2:n,y2:a,width:0,height:0}),tC={box:n=>zo(n.centerX,n.centerY),doughnutLabel:n=>zo(n.centerX,n.centerY),ellipse:n=>({centerX:n.centerX,centerY:n.centerX,radius:0,width:0,height:0}),label:n=>zo(n.centerX,n.centerY),line:n=>zo(n.x,n.y),point:n=>({centerX:n.centerX,centerY:n.centerY,radius:0,width:0,height:0}),polygon:n=>zo(n.centerX,n.centerY)};function $l(n,a){return a==="start"?0:a==="end"?n:$p(a)?Zp(a)*n:n/2}function Zn(n,a,e=!0){return typeof a=="number"?a:$p(a)?(e?Zp(a):Yp(a))*n:n}function iC(n,a){let{x:e,width:t}=n,i=a.textAlign;return i==="center"?e+t/2:i==="end"||i==="right"?e+t:e}function Qp(n,a,{borderWidth:e,position:t,xAdjust:i,yAdjust:o},r){let s=On(r),c=a.width+(s?r.width:0)+e,p=a.height+(s?r.height:0)+e,f=Yl(t),b=_p(n.x,c,i,f.x),x=_p(n.y,p,o,f.y);return{x:b,y:x,x2:b+c,y2:x+p,width:c,height:p,centerX:b+c/2,centerY:x+p/2}}function Yl(n,a="center"){return On(n)?{x:un(n.x,a),y:un(n.y,a)}:(n=un(n,a),{x:n,y:n})}var Xp=(n,a)=>n&&n.autoFit&&a<1;function Kp(n,a){let e=n.font,t=Ii(e)?e:[e];return Xp(n,a)?t.map(function(i){let o=yo(i);return o.size=Math.floor(i.size*a),o.lineHeight=i.lineHeight,yo(o)}):t.map(i=>yo(i))}function Jp(n){return n&&(Oi(n.xValue)||Oi(n.yValue))}function _p(n,a,e=0,t){return n-$l(a,t)+e}function ao(n,a,e){let t=e.init;if(t){if(t===!0)return tg(a,e)}else return;return nC(n,a,e)}function eg(n,a,e){let t=!1;return a.forEach(i=>{Nn(n[i])?(t=!0,e[i]=n[i]):Oi(e[i])&&delete e[i]}),t}function tg(n,a){let e=a.type||"line";return tC[e](n)}function nC(n,a,e){let t=Ki(e.init,[{chart:n,properties:a,options:e}]);if(t===!0)return tg(a,e);if(On(t))return t}var Wl=new Map,aC=n=>isNaN(n)||n<=0,oC=n=>n.reduce(function(a,e){return a+=e.string,a},"");function Ps(n){if(n&&typeof n=="object"){let a=n.toString();return a==="[object HTMLImageElement]"||a==="[object HTMLCanvasElement]"}}function Is(n,{x:a,y:e},t){t&&(n.translate(a,e),n.rotate(Ni(t)),n.translate(-a,-e))}function fn(n,a){if(a&&a.borderWidth)return n.lineCap=a.borderCapStyle||"butt",n.setLineDash(a.borderDash),n.lineDashOffset=a.borderDashOffset,n.lineJoin=a.borderJoinStyle||"miter",n.lineWidth=a.borderWidth,n.strokeStyle=a.borderColor,!0}function oo(n,a){n.shadowColor=a.backgroundShadowColor,n.shadowBlur=a.shadowBlur,n.shadowOffsetX=a.shadowOffsetX,n.shadowOffsetY=a.shadowOffsetY}function Os(n,a){let e=a.content;if(Ps(e))return{width:Zn(e.width,a.width),height:Zn(e.height,a.height)};let t=Kp(a),i=a.textStrokeWidth,o=Ii(e)?e:[e],r=o.join()+oC(t)+i+(n._measureText?"-spriting":"");return Wl.has(r)||Wl.set(r,dC(n,o,t,i)),Wl.get(r)}function ig(n,a,e){let{x:t,y:i,width:o,height:r}=a;n.save(),oo(n,e);let s=fn(n,e);n.fillStyle=e.backgroundColor,n.beginPath(),Qs(n,{x:t,y:i,w:o,h:r,radius:Kx(Xs(e.borderRadius),0,Math.min(o,r)/2)}),n.closePath(),n.fill(),s&&(n.shadowColor=e.borderShadowColor,n.stroke()),n.restore()}function ng(n,a,e,t){let i=e.content;if(Ps(i)){n.save(),n.globalAlpha=mC(e.opacity,i.style.opacity),n.drawImage(i,a.x,a.y,a.width,a.height),n.restore();return}let o=Ii(i)?i:[i],r=Kp(e,t),s=e.color,c=Ii(s)?s:[s],p=iC(a,e),f=a.y+e.textStrokeWidth/2;n.save(),n.textBaseline="middle",n.textAlign=e.textAlign,rC(n,e)&&cC(n,{x:p,y:f},o,r),uC(n,{x:p,y:f},o,{fonts:r,colors:c}),n.restore()}function rC(n,a){if(a.textStrokeWidth>0)return n.lineJoin="round",n.miterLimit=2,n.lineWidth=a.textStrokeWidth,n.strokeStyle=a.textStrokeColor,!0}function sC(n,a,e,t){let{radius:i,options:o}=a,r=o.pointStyle,s=o.rotation,c=(s||0)*Tr;if(Ps(r)){n.save(),n.translate(e,t),n.rotate(c),n.drawImage(r,-r.width/2,-r.height/2,r.width,r.height),n.restore();return}aC(i)||lC(n,{x:e,y:t,radius:i,rotation:s,style:r,rad:c})}function lC(n,{x:a,y:e,radius:t,rotation:i,style:o,rad:r}){let s,c,p,f;switch(n.beginPath(),o){default:n.arc(a,e,t,0,kr),n.closePath();break;case"triangle":n.moveTo(a+Math.sin(r)*t,e-Math.cos(r)*t),r+=Er,n.lineTo(a+Math.sin(r)*t,e-Math.cos(r)*t),r+=Er,n.lineTo(a+Math.sin(r)*t,e-Math.cos(r)*t),n.closePath();break;case"rectRounded":f=t*.516,p=t-f,s=Math.cos(r+ra)*p,c=Math.sin(r+ra)*p,n.arc(a-s,e-c,f,r-ii,r-Na),n.arc(a+c,e-s,f,r-Na,r),n.arc(a+s,e+c,f,r,r+Na),n.arc(a-c,e+s,f,r+Na,r+ii),n.closePath();break;case"rect":if(!i){p=Math.SQRT1_2*t,n.rect(a-p,e-p,2*p,2*p);break}r+=ra;case"rectRot":s=Math.cos(r)*t,c=Math.sin(r)*t,n.moveTo(a-s,e-c),n.lineTo(a+c,e-s),n.lineTo(a+s,e+c),n.lineTo(a-c,e+s),n.closePath();break;case"crossRot":r+=ra;case"cross":s=Math.cos(r)*t,c=Math.sin(r)*t,n.moveTo(a-s,e-c),n.lineTo(a+s,e+c),n.moveTo(a+c,e-s),n.lineTo(a-c,e+s);break;case"star":s=Math.cos(r)*t,c=Math.sin(r)*t,n.moveTo(a-s,e-c),n.lineTo(a+s,e+c),n.moveTo(a+c,e-s),n.lineTo(a-c,e+s),r+=ra,s=Math.cos(r)*t,c=Math.sin(r)*t,n.moveTo(a-s,e-c),n.lineTo(a+s,e+c),n.moveTo(a+c,e-s),n.lineTo(a-c,e+s);break;case"line":s=Math.cos(r)*t,c=Math.sin(r)*t,n.moveTo(a-s,e-c),n.lineTo(a+s,e+c);break;case"dash":n.moveTo(a,e),n.lineTo(a+Math.cos(r)*t,e+Math.sin(r)*t);break}n.fill()}function dC(n,a,e,t){n.save();let i=a.length,o=0,r=t;for(let s=0;s<i;s++){let c=e[Math.min(s,e.length-1)];n.font=c.string;let p=a[s];o=Math.max(o,n.measureText(p).width+t),r+=c.lineHeight}return n.restore(),{width:o,height:r}}function cC(n,{x:a,y:e},t,i){n.beginPath();let o=0;t.forEach(function(r,s){let c=i[Math.min(s,i.length-1)],p=c.lineHeight;n.font=c.string,n.strokeText(r,a,e+p/2+o),o+=p}),n.stroke()}function uC(n,{x:a,y:e},t,{fonts:i,colors:o}){let r=0;t.forEach(function(s,c){let p=o[Math.min(c,o.length-1)],f=i[Math.min(c,i.length-1)],b=f.lineHeight;n.beginPath(),n.font=f.string,n.fillStyle=p,n.fillText(s,a,e+b/2+r),r+=b,n.fill()})}function mC(n,a){let e=Ra(n)?n:a;return Ra(e)?Ds(e,0,1):1}var ag=["left","bottom","top","right"];function hC(n,a){let{pointX:e,pointY:t,options:i}=a,o=i.callout,r=o&&o.display&&bC(a,o);if(!r||yC(a,o,r))return;if(n.save(),n.beginPath(),!fn(n,o))return n.restore();let{separatorStart:c,separatorEnd:p}=pC(a,r),{sideStart:f,sideEnd:b}=fC(a,r,c);(o.margin>0||i.borderWidth===0)&&(n.moveTo(c.x,c.y),n.lineTo(p.x,p.y)),n.moveTo(f.x,f.y),n.lineTo(b.x,b.y);let x=ba({x:e,y:t},a.getCenterPoint(),Ni(-a.rotation));n.lineTo(x.x,x.y),n.stroke(),n.restore()}function pC(n,a){let{x:e,y:t,x2:i,y2:o}=n,r=gC(n,a),s,c;return a==="left"||a==="right"?(s={x:e+r,y:t},c={x:s.x,y:o}):(s={x:e,y:t+r},c={x:i,y:s.y}),{separatorStart:s,separatorEnd:c}}function gC(n,a){let{width:e,height:t,options:i}=n,o=i.callout.margin+i.borderWidth/2;return a==="right"?e+o:a==="bottom"?t+o:-o}function fC(n,a,e){let{y:t,width:i,height:o,options:r}=n,s=r.callout.start,c=vC(a,r.callout),p,f;return a==="left"||a==="right"?(p={x:e.x,y:t+Zn(o,s)},f={x:p.x+c,y:p.y}):(p={x:e.x+Zn(i,s),y:e.y},f={x:p.x,y:p.y+c}),{sideStart:p,sideEnd:f}}function vC(n,a){let e=a.side;return n==="left"||n==="top"?-e:e}function bC(n,a){let e=a.position;return ag.includes(e)?e:AC(n,a)}function AC(n,a){let{x:e,y:t,x2:i,y2:o,width:r,height:s,pointX:c,pointY:p,centerX:f,centerY:b,rotation:x}=n,S={x:f,y:b},_=a.start,k=Zn(r,_),B=Zn(s,_),R=[e,e+k,e+k,i],G=[t+B,o,t,o],j=[];for(let K=0;K<4;K++){let Y=ba({x:R[K],y:G[K]},S,Ni(x));j.push({position:ag[K],distance:vo(Y,{x:c,y:p})})}return j.sort((K,Y)=>K.distance-Y.distance)[0].position}function yC(n,a,e){let{pointX:t,pointY:i}=n,o=a.margin,r=t,s=i;return e==="left"?r+=o:e==="right"?r-=o:e==="top"?s+=o:e==="bottom"&&(s-=o),n.inRange(r,s)}var Mp={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 eo(n,a,e){return a=typeof a=="number"?a:n.parse(a),oa(a)?n.getPixelForValue(a):e}function ga(n,a,e){let t=a[e];if(t||e==="scaleID")return t;let i=e.charAt(0),o=Object.values(n).filter(r=>r.axis&&r.axis===i);return o.length?o[0].id:i}function og(n,a){if(n){let e=n.options.reverse,t=eo(n,a.min,e?a.end:a.start),i=eo(n,a.max,e?a.start:a.end);return{start:t,end:i}}}function rg(n,a){let{chartArea:e,scales:t}=n,i=t[ga(t,a,"xScaleID")],o=t[ga(t,a,"yScaleID")],r=e.width/2,s=e.height/2;return i&&(r=eo(i,a.xValue,i.left+i.width/2)),o&&(s=eo(o,a.yValue,o.top+o.height/2)),{x:r,y:s}}function Zl(n,a){let e=n.scales,t=e[ga(e,a,"xScaleID")],i=e[ga(e,a,"yScaleID")];if(!t&&!i)return{};let{left:o,right:r}=t||n.chartArea,{top:s,bottom:c}=i||n.chartArea,p=kp(t,{min:a.xMin,max:a.xMax,start:o,end:r});o=p.start,r=p.end;let f=kp(i,{min:a.yMin,max:a.yMax,start:c,end:s});return s=f.start,c=f.end,{x:o,y:s,x2:r,y2:c,width:r-o,height:c-s,centerX:o+(r-o)/2,centerY:s+(c-s)/2}}function sg(n,a){if(!Jp(a)){let e=Zl(n,a),t=a.radius;(!t||isNaN(t))&&(t=Math.min(e.width,e.height)/2,a.radius=t);let i=t*2,o=e.centerX+a.xAdjust,r=e.centerY+a.yAdjust;return{x:o-t,y:r-t,x2:o+t,y2:r+t,centerX:o,centerY:r,width:i,height:i,radius:t}}return CC(n,a)}function xC(n,a){let{scales:e,chartArea:t}=n,i=e[a.scaleID],o={x:t.left,y:t.top,x2:t.right,y2:t.bottom};return i?SC(i,o,a):wC(e,o,a),o}function lg(n,a){let e=Zl(n,a);return e.initProperties=ao(n,e,a),e.elements=[{type:"label",optionScope:"label",properties:kC(n,e,a),initProperties:e.initProperties}],e}function CC(n,a){let e=rg(n,a),t=a.radius*2;return{x:e.x-a.radius+a.xAdjust,y:e.y-a.radius+a.yAdjust,x2:e.x+a.radius+a.xAdjust,y2:e.y+a.radius+a.yAdjust,centerX:e.x+a.xAdjust,centerY:e.y+a.yAdjust,radius:a.radius,width:t,height:t}}function kp(n,a){let e=og(n,a)||a;return{start:Math.min(e.start,e.end),end:Math.max(e.start,e.end)}}function SC(n,a,e){let t=eo(n,e.value,NaN),i=eo(n,e.endValue,t);n.isHorizontal()?(a.x=t,a.x2=i):(a.y=t,a.y2=i)}function wC(n,a,e){for(let t of Object.keys(Mp)){let i=n[ga(n,e,t)];if(i){let{min:o,max:r,start:s,end:c,startProp:p,endProp:f}=Mp[t],b=og(i,{min:e[o],max:e[r],start:i[s],end:i[c]});a[p]=b.start,a[f]=b.end}}}function _C({properties:n,options:a},e,t,i){let{x:o,x2:r,width:s}=n;return dg({start:o,end:r,size:s,borderWidth:a.borderWidth},{position:t.x,padding:{start:i.left,end:i.right},adjust:a.label.xAdjust,size:e.width})}function MC({properties:n,options:a},e,t,i){let{y:o,y2:r,height:s}=n;return dg({start:o,end:r,size:s,borderWidth:a.borderWidth},{position:t.y,padding:{start:i.top,end:i.bottom},adjust:a.label.yAdjust,size:e.height})}function dg(n,a){let{start:e,end:t,borderWidth:i}=n,{position:o,padding:{start:r,end:s},adjust:c}=a,p=t-i-e-r-s-a.size;return e+i/2+c+$l(p,o)}function kC(n,a,e){let t=e.label;t.backgroundColor="transparent",t.callout.display=!1;let i=Yl(t.position),o=Wa(t.padding),r=Os(n.ctx,t),s=_C({properties:a,options:e},r,i,o),c=MC({properties:a,options:e},r,i,o),p=r.width+o.width,f=r.height+o.height;return{x:s,y:c,x2:s+p,y2:c+f,width:p,height:f,centerX:s+p/2,centerY:c+f/2,rotation:t.rotation}}var Fl=["enter","leave"],Ql=Fl.concat("click");function TC(n,a,e){a.listened=eg(e,Ql,a.listeners),a.moveListened=!1,Fl.forEach(t=>{Nn(e[t])&&(a.moveListened=!0)}),(!a.listened||!a.moveListened)&&a.annotations.forEach(t=>{!a.listened&&Nn(t.click)&&(a.listened=!0),a.moveListened||Fl.forEach(i=>{Nn(t[i])&&(a.listened=!0,a.moveListened=!0)})})}function EC(n,a,e){if(n.listened)switch(a.type){case"mousemove":case"mouseout":return DC(n,a,e);case"click":return PC(n,a,e)}}function DC(n,a,e){if(!n.moveListened)return;let t;a.type==="mousemove"?t=jl(n.visibleElements,a,e.interaction):t=[];let i=n.hovered;n.hovered=t;let o={state:n,event:a},r=Tp(o,"leave",i,t);return Tp(o,"enter",t,i)||r}function Tp({state:n,event:a},e,t,i){let o;for(let r of t)i.indexOf(r)<0&&(o=cg(r.options[e]||n.listeners[e],r,a)||o);return o}function PC(n,a,e){let t=n.listeners,i=jl(n.visibleElements,a,e.interaction),o;for(let r of i)o=cg(r.options.click||t.click,r,a)||o;return o}function cg(n,a,e){return Ki(n,[a.$context,e])===!0}var Es=["afterDraw","beforeDraw"];function IC(n,a,e){let t=a.visibleElements;a.hooked=eg(e,Es,a.hooks),a.hooked||t.forEach(i=>{a.hooked||Es.forEach(o=>{Nn(i.options[o])&&(a.hooked=!0)})})}function Ep(n,a,e){if(n.hooked){let t=a.options[e]||n.hooks[e];return Ki(t,[a.$context])}}function OC(n,a,e){let t=WC(n.scales,a,e),i=Dp(a,t,"min","suggestedMin");i=Dp(a,t,"max","suggestedMax")||i,i&&Nn(a.handleTickRangeOptions)&&a.handleTickRangeOptions()}function NC(n,a){for(let e of n)LC(e,a)}function Dp(n,a,e,t){if(oa(a[e])&&!RC(n.options,e,t)){let i=n[e]!==a[e];return n[e]=a[e],i}}function RC(n,a,e){return Oi(n[a])||Oi(n[e])}function LC(n,a){for(let e of["scaleID","xScaleID","yScaleID"]){let t=ga(a,n,e);t&&!a[t]&&VC(n,e)&&console.warn(`No scale found with id '${t}' for annotation '${n.id}'`)}}function VC(n,a){if(a==="scaleID")return!0;let e=a.charAt(0);for(let t of["Min","Max","Value"])if(Oi(n[e+t]))return!0;return!1}function WC(n,a,e){let t=a.axis,i=a.id,o=t+"ScaleID",r={min:un(a.min,Number.NEGATIVE_INFINITY),max:un(a.max,Number.POSITIVE_INFINITY)};for(let s of e)s.scaleID===i?Pp(s,a,["value","endValue"],r):ga(n,s,o)===i&&Pp(s,a,[t+"Min",t+"Max",t+"Value"],r);return r}function Pp(n,a,e,t){for(let i of e){let o=n[i];if(Oi(o)){let r=a.parse(o);t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}}}var Qn=class extends Ln{inRange(a,e,t,i){let{x:o,y:r}=ba({x:a,y:e},this.getCenterPoint(i),Ni(-this.options.rotation));return qp({x:o,y:r},this.getProps(["x","y","x2","y2"],i),t,this.options)}getCenterPoint(a){return Aa(this,a)}draw(a){a.save(),Is(a,this.getCenterPoint(),this.options.rotation),ig(a,this,this.options),a.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(a,e){return lg(a,e)}};Qn.id="boxAnnotation";Qn.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};Qn.defaultRoutes={borderColor:"color",backgroundColor:"color"};Qn.descriptors={label:{_fallback:!0}};var to=class extends Ln{inRange(a,e,t,i){return jp({x:a,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(a){return Aa(this,a)}draw(a){let e=this.options;!e.display||!e.content||(HC(a,this),a.save(),Is(a,this.getCenterPoint(),this.rotation),ng(a,this,e,this._fitRatio),a.restore())}resolveElementProperties(a,e){let t=FC(a,e);if(!t)return{};let{controllerMeta:i,point:o,radius:r}=BC(a,e,t),s=Os(a.ctx,e),c=UC(s,r);Xp(e,c)&&(s={width:s.width*c,height:s.height*c});let{position:p,xAdjust:f,yAdjust:b}=e,x=Qp(o,s,{borderWidth:0,position:p,xAdjust:f,yAdjust:b});return ue(ne(ne({initProperties:ao(a,x,e)},x),i),{rotation:e.rotation,_fitRatio:c})}};to.id="doughnutLabelAnnotation";to.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};to.defaultRoutes={};function FC(n,a){return n.getSortedVisibleDatasetMetas().reduce(function(e,t){let i=t.controller;return i instanceof Qc&&GC(n,a,t.data)&&(!e||i.innerRadius<e.controller.innerRadius)&&i.options.circumference>=90?t:e},void 0)}function GC(n,a,e){if(!a.autoHide)return!0;for(let t=0;t<e.length;t++)if(!e[t].hidden&&n.getDataVisibility(t))return!0}function BC({chartArea:n},a,e){let{left:t,top:i,right:o,bottom:r}=n,{innerRadius:s,offsetX:c,offsetY:p}=e.controller,f=(t+o)/2+c,b=(i+r)/2+p,x={left:Math.max(f-s,t),right:Math.min(f+s,o),top:Math.max(b-s,i),bottom:Math.min(b+s,r)},S={x:(x.left+x.right)/2,y:(x.top+x.bottom)/2},_=a.spacing+a.borderWidth/2,k=s-_,B=S.y>b,R=B?i+_:r-_,G=zC(R,f,b,k);return{controllerMeta:ne({_centerX:f,_centerY:b,_radius:k,_counterclockwise:B},G),point:S,radius:Math.min(s,Math.min(x.right-x.left,x.bottom-x.top)/2)}}function UC({width:n,height:a},e){let t=Math.sqrt(Math.pow(n,2)+Math.pow(a,2));return e*2/t}function zC(n,a,e,t){let i=Math.pow(e-n,2),o=Math.pow(t,2),r=a*-2,s=Math.pow(a,2)+i-o,c=Math.pow(r,2)-4*s;if(c<=0)return{_startAngle:0,_endAngle:kr};let p=(-r-Math.sqrt(c))/2,f=(-r+Math.sqrt(c))/2;return{_startAngle:Dr({x:a,y:e},{x:p,y:n}).angle,_endAngle:Dr({x:a,y:e},{x:f,y:n}).angle}}function HC(n,a){let{_centerX:e,_centerY:t,_radius:i,_startAngle:o,_endAngle:r,_counterclockwise:s,options:c}=a;n.save();let p=fn(n,c);n.fillStyle=c.backgroundColor,n.beginPath(),n.arc(e,t,i,o,r,s),n.closePath(),n.fill(),p&&n.stroke(),n.restore()}var fa=class extends Ln{inRange(a,e,t,i){return jp({x:a,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(a){return Aa(this,a)}draw(a){let e=this.options,t=!Oi(this._visible)||this._visible;!e.display||!e.content||!t||(a.save(),Is(a,this.getCenterPoint(),this.rotation),hC(a,this),ig(a,this,e),ng(a,qC(this),e),a.restore())}resolveElementProperties(a,e){let t;if(Jp(e))t=rg(a,e);else{let{centerX:s,centerY:c}=Zl(a,e);t={x:s,y:c}}let i=Wa(e.padding),o=Os(a.ctx,e),r=Qp(t,o,e,i);return ue(ne({initProperties:ao(a,r,e),pointX:t.x,pointY:t.y},r),{rotation:e.rotation})}};fa.id="labelAnnotation";fa.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};fa.defaultRoutes={borderColor:"color"};function qC({x:n,y:a,width:e,height:t,options:i}){let o=i.borderWidth/2,r=Wa(i.padding);return{x:n+r.left+o,y:a+r.top+o,width:e-r.left-r.right-i.borderWidth,height:t-r.top-r.bottom-i.borderWidth}}var Xl=(n,a,e)=>({x:n.x+e*(a.x-n.x),y:n.y+e*(a.y-n.y)}),Gl=(n,a,e)=>Xl(a,e,Math.abs((n-a.y)/(e.y-a.y))).x,Ip=(n,a,e)=>Xl(a,e,Math.abs((n-a.x)/(e.x-a.x))).y,qo=n=>n*n,jC=(n,a,{x:e,y:t,x2:i,y2:o},r)=>r==="y"?{start:Math.min(t,o),end:Math.max(t,o),value:a}:{start:Math.min(e,i),end:Math.max(e,i),value:n},Op=(n,a,e,t)=>(1-t)*(1-t)*n+2*(1-t)*t*a+t*t*e,Bl=(n,a,e,t)=>({x:Op(n.x,a.x,e.x,t),y:Op(n.y,a.y,e.y,t)}),Np=(n,a,e,t)=>2*(1-t)*(a-n)+2*t*(e-a),Rp=(n,a,e,t)=>-Math.atan2(Np(n.x,a.x,e.x,t),Np(n.y,a.y,e.y,t))+.5*ii,Ns=(()=>{class n extends Ln{inRange(e,t,i,o){let r=(this.options.borderWidth+this.options.hitTolerance)/2;if(i!=="x"&&i!=="y"){let s={mouseX:e,mouseY:t},{path:c,ctx:p}=this;if(c){fn(p,this.options),p.lineWidth+=this.options.hitTolerance;let{chart:b}=this.$context,x=e*b.currentDevicePixelRatio,S=t*b.currentDevicePixelRatio,_=p.isPointInStroke(c,x,S)||Ul(this,s,o);return p.restore(),_}let f=qo(r);return QC(this,s,f,o)||Ul(this,s,o)}return $C(this,{mouseX:e,mouseY:t},i,{hitSize:r,useFinalPosition:o})}getCenterPoint(e){return Aa(this,e)}draw(e){let{x:t,y:i,x2:o,y2:r,cp:s,options:c}=this;if(e.save(),!fn(e,c))return e.restore();oo(e,c);let p=Math.sqrt(Math.pow(o-t,2)+Math.pow(r-i,2));if(c.curve&&s)return aS(e,this,s,p),e.restore();let{startOpts:f,endOpts:b,startAdjust:x,endAdjust:S}=ug(this),_=Math.atan2(r-i,o-t);e.translate(t,i),e.rotate(_),e.beginPath(),e.moveTo(0+x,0),e.lineTo(p-S,0),e.shadowColor=c.borderShadowColor,e.stroke(),zl(e,0,x,f),zl(e,p,-S,b),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,t){let i=xC(e,t),{x:o,y:r,x2:s,y2:c}=i,p=YC(i,e.chartArea),f=p?ZC({x:o,y:r},{x:s,y:c},e.chartArea):{x:o,y:r,x2:s,y2:c,width:Math.abs(s-o),height:Math.abs(c-r)};if(f.centerX=(s+o)/2,f.centerY=(c+r)/2,f.initProperties=ao(e,f,t),t.curve){let x={x:f.x,y:f.y},S={x:f.x2,y:f.y2};f.cp=nS(f,t,vo(x,S))}let b=XC(e,f,t.label);return b._visible=p,f.elements=[{type:"label",optionScope:"label",properties:b,initProperties:f.initProperties}],f}}return n.id="lineAnnotation",n})(),Lp={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};Ns.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Lp),fill:!1,length:12,start:Object.assign({},Lp),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({},fa.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};Ns.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};Ns.defaultRoutes={borderColor:"color"};function $C(n,{mouseX:a,mouseY:e},t,{hitSize:i,useFinalPosition:o}){let r=jC(a,e,n.getProps(["x","y","x2","y2"],o),t);return Hp(r,i)||Ul(n,{mouseX:a,mouseY:e},o,t)}function YC({x:n,y:a,x2:e,y2:t},{top:i,right:o,bottom:r,left:s}){return!(n<s&&e<s||n>o&&e>o||a<i&&t<i||a>r&&t>r)}function Vp({x:n,y:a},e,{top:t,right:i,bottom:o,left:r}){return n<r&&(a=Ip(r,{x:n,y:a},e),n=r),n>i&&(a=Ip(i,{x:n,y:a},e),n=i),a<t&&(n=Gl(t,{x:n,y:a},e),a=t),a>o&&(n=Gl(o,{x:n,y:a},e),a=o),{x:n,y:a}}function ZC(n,a,e){let{x:t,y:i}=Vp(n,a,e),{x:o,y:r}=Vp(a,n,e);return{x:t,y:i,x2:o,y2:r,width:Math.abs(o-t),height:Math.abs(r-i)}}function QC(n,{mouseX:a,mouseY:e},t=pa,i){let{x:o,y:r,x2:s,y2:c}=n.getProps(["x","y","x2","y2"],i),p=s-o,f=c-r,b=qo(p)+qo(f),x=b===0?-1:((a-o)*p+(e-r)*f)/b,S,_;return x<0?(S=o,_=r):x>1?(S=s,_=c):(S=o+x*p,_=r+x*f),qo(a-S)+qo(e-_)<=t}function Ul(n,{mouseX:a,mouseY:e},t,i){let o=n.label;return o.options.display&&o.inRange(a,e,i,t)}function XC(n,a,e){let t=e.borderWidth,i=Wa(e.padding),o=Os(n.ctx,e),r=o.width+i.width+t,s=o.height+i.height+t;return JC(a,e,{width:r,height:s,padding:i},n.chartArea)}function KC(n){let{x:a,y:e,x2:t,y2:i}=n,o=Math.atan2(i-e,t-a);return o>ii/2?o-ii:o<ii/-2?o+ii:o}function JC(n,a,e,t){let{width:i,height:o,padding:r}=e,{xAdjust:s,yAdjust:c}=a,p={x:n.x,y:n.y},f={x:n.x2,y:n.y2},b=a.rotation==="auto"?KC(n):Ni(a.rotation),x=eS(i,o,b),S=tS(n,a,{labelSize:x,padding:r},t),_=n.cp?Bl(p,n.cp,f,S):Xl(p,f,S),k={size:x.w,min:t.left,max:t.right,padding:r.left},B={size:x.h,min:t.top,max:t.bottom,padding:r.top},R=Fp(_.x,k)+s,G=Fp(_.y,B)+c;return{x:R-i/2,y:G-o/2,x2:R+i/2,y2:G+o/2,centerX:R,centerY:G,pointX:_.x,pointY:_.y,width:i,height:o,rotation:Ys(b)}}function eS(n,a,e){let t=Math.cos(e),i=Math.sin(e);return{w:Math.abs(n*t)+Math.abs(a*i),h:Math.abs(n*i)+Math.abs(a*t)}}function tS(n,a,e,t){let i,o=iS(n,t);return a.position==="start"?i=Wp({w:n.x2-n.x,h:n.y2-n.y},e,a,o):a.position==="end"?i=1-Wp({w:n.x-n.x2,h:n.y-n.y2},e,a,o):i=$l(1,a.position),i}function Wp(n,a,e,t){let{labelSize:i,padding:o}=a,r=n.w*t.dx,s=n.h*t.dy,c=r>0&&(i.w/2+o.left-t.x)/r,p=s>0&&(i.h/2+o.top-t.y)/s;return Ds(Math.max(c,p),0,.25)}function iS(n,a){let{x:e,x2:t,y:i,y2:o}=n,r=Math.min(i,o)-a.top,s=Math.min(e,t)-a.left,c=a.bottom-Math.max(i,o),p=a.right-Math.max(e,t);return{x:Math.min(s,p),y:Math.min(r,c),dx:s<=p?1:-1,dy:r<=c?1:-1}}function Fp(n,a){let{size:e,min:t,max:i,padding:o}=a,r=e/2;return e>i-t?(i+t)/2:(t>=n-o-r&&(n=t+o+r),i<=n+o+r&&(n=i-o-r),n)}function ug(n){let a=n.options,e=a.arrowHeads&&a.arrowHeads.start,t=a.arrowHeads&&a.arrowHeads.end;return{startOpts:e,endOpts:t,startAdjust:Gp(n,e),endAdjust:Gp(n,t)}}function Gp(n,a){if(!a||!a.display)return 0;let{length:e,width:t}=a,i=n.options.borderWidth/2,o={x:e,y:t+i};return Math.abs(Gl(0,o,{x:0,y:i}))}function zl(n,a,e,t){if(!t||!t.display)return;let{length:i,width:o,fill:r,backgroundColor:s,borderColor:c}=t,p=Math.abs(a-i)+e;n.beginPath(),oo(n,t),fn(n,t),n.moveTo(p,-o),n.lineTo(a+e,0),n.lineTo(p,o),r===!0?(n.fillStyle=s||c,n.closePath(),n.fill(),n.shadowColor="transparent"):n.shadowColor=t.borderShadowColor,n.stroke()}function nS(n,a,e){let{x:t,y:i,x2:o,y2:r,centerX:s,centerY:c}=n,p=Math.atan2(r-i,o-t),f=Yl(a.controlPoint,0),b={x:s+Zn(e,f.x,!1),y:c+Zn(e,f.y,!1)};return ba(b,{x:s,y:c},p)}function Bp(n,{x:a,y:e},{angle:t,adjust:i},o){!o||!o.display||(n.save(),n.translate(a,e),n.rotate(t),zl(n,0,-i,o),n.restore())}function aS(n,a,e,t){let{x:i,y:o,x2:r,y2:s,options:c}=a,{startOpts:p,endOpts:f,startAdjust:b,endAdjust:x}=ug(a),S={x:i,y:o},_={x:r,y:s},k=Rp(S,e,_,0),B=Rp(S,e,_,1)-ii,R=Bl(S,e,_,b/t),G=Bl(S,e,_,1-x/t),j=new Path2D;n.beginPath(),j.moveTo(R.x,R.y),j.quadraticCurveTo(e.x,e.y,G.x,G.y),n.shadowColor=c.borderShadowColor,n.stroke(j),a.path=j,a.ctx=n,Bp(n,R,{angle:k,adjust:b},p),Bp(n,G,{angle:B,adjust:x},f)}var va=class extends Ln{inRange(a,e,t,i){let o=this.options.rotation,r=(this.options.borderWidth+this.options.hitTolerance)/2;if(t!=="x"&&t!=="y")return oS({x:a,y:e},this.getProps(["width","height","centerX","centerY"],i),o,r);let{x:s,y:c,x2:p,y2:f}=this.getProps(["x","y","x2","y2"],i),b=t==="y"?{start:c,end:f}:{start:s,end:p},x=ba({x:a,y:e},this.getCenterPoint(i),Ni(-o));return x[t]>=b.start-r-pa&&x[t]<=b.end+r+pa}getCenterPoint(a){return Aa(this,a)}draw(a){let{width:e,height:t,centerX:i,centerY:o,options:r}=this;a.save(),Is(a,this.getCenterPoint(),r.rotation),oo(a,this.options),a.beginPath(),a.fillStyle=r.backgroundColor;let s=fn(a,r);a.ellipse(i,o,t/2,e/2,ii/2,0,2*ii),a.fill(),s&&(a.shadowColor=r.borderShadowColor,a.stroke()),a.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(a,e){return lg(a,e)}};va.id="ellipseAnnotation";va.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,hitTolerance:0,init:void 0,label:Object.assign({},Qn.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};va.defaultRoutes={borderColor:"color",backgroundColor:"color"};va.descriptors={label:{_fallback:!0}};function oS(n,a,e,t){let{width:i,height:o,centerX:r,centerY:s}=a,c=i/2,p=o/2;if(c<=0||p<=0)return!1;let f=Ni(e||0),b=Math.cos(f),x=Math.sin(f),S=Math.pow(b*(n.x-r)+x*(n.y-s),2),_=Math.pow(x*(n.x-r)-b*(n.y-s),2);return S/Math.pow(c+t,2)+_/Math.pow(p+t,2)<=1.0001}var io=class extends Ln{inRange(a,e,t,i){let{x:o,y:r,x2:s,y2:c,width:p}=this.getProps(["x","y","x2","y2","width"],i),f=(this.options.borderWidth+this.options.hitTolerance)/2;return t!=="x"&&t!=="y"?Jx({x:a,y:e},this.getCenterPoint(i),p/2,f):Hp(t==="y"?{start:r,end:c,value:e}:{start:o,end:s,value:a},f)}getCenterPoint(a){return Aa(this,a)}draw(a){let e=this.options,t=e.borderWidth;if(e.radius<.1)return;a.save(),a.fillStyle=e.backgroundColor,oo(a,e);let i=fn(a,e);sC(a,this,this.centerX,this.centerY),i&&!Ps(e.pointStyle)&&(a.shadowColor=e.borderShadowColor,a.stroke()),a.restore(),e.borderWidth=t}resolveElementProperties(a,e){let t=sg(a,e);return t.initProperties=ao(a,t,e),t}};io.id="pointAnnotation";io.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};io.defaultRoutes={borderColor:"color",backgroundColor:"color"};var no=class extends Ln{inRange(a,e,t,i){if(t!=="x"&&t!=="y")return this.options.radius>=.1&&this.elements.length>1&&sS(this.elements,a,e,i);let o=ba({x:a,y:e},this.getCenterPoint(i),Ni(-this.options.rotation)),r=this.elements.map(p=>t==="y"?p.bY:p.bX),s=Math.min(...r),c=Math.max(...r);return o[t]>=s&&o[t]<=c}getCenterPoint(a){return Aa(this,a)}draw(a){let{elements:e,options:t}=this;a.save(),a.beginPath(),a.fillStyle=t.backgroundColor,oo(a,t);let i=fn(a,t),o=!0;for(let r of e)o?(a.moveTo(r.x,r.y),o=!1):a.lineTo(r.x,r.y);a.closePath(),a.fill(),i&&(a.shadowColor=t.borderShadowColor,a.stroke()),a.restore()}resolveElementProperties(a,e){let t=sg(a,e),{sides:i,rotation:o}=e,r=[],s=2*ii/i,c=o*Tr;for(let p=0;p<i;p++,c+=s){let f=rS(t,e,c);f.initProperties=ao(a,t,e),r.push(f)}return t.elements=r,t}};no.id="polygonAnnotation";no.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};no.defaultRoutes={borderColor:"color",backgroundColor:"color"};function rS({centerX:n,centerY:a},{radius:e,borderWidth:t,hitTolerance:i},o){let r=(t+i)/2,s=Math.sin(o),c=Math.cos(o),p={x:n+s*e,y:a-c*e};return{type:"point",optionScope:"point",properties:{x:p.x,y:p.y,centerX:p.x,centerY:p.y,bX:n+s*(e+r),bY:a-c*(e+r)}}}function sS(n,a,e,t){let i=!1,o=n[n.length-1].getProps(["bX","bY"],t);for(let r of n){let s=r.getProps(["bX","bY"],t);s.bY>e!=o.bY>e&&a<(o.bX-s.bX)*(e-s.bY)/(o.bY-s.bY)+s.bX&&(i=!i),o=s}return i}var Yn={box:Qn,doughnutLabel:to,ellipse:va,label:fa,line:Ns,point:io,polygon:no};Object.keys(Yn).forEach(n=>{Ao.describe(`elements.${Yn[n].id}`,{_fallback:"plugins.annotation.common"})});var lS={update:Object.assign},dS=Ql.concat(Es),Up=(n,a)=>On(a)?ql(n,a):n,Hl=n=>n==="color"||n==="font";function Kl(n="line"){return Yn[n]?n:(console.warn(`Unknown annotation type: '${n}', defaulting to 'line'`),"line")}function cS(n,a,e,t){let i=mS(n,e.animations,t),o=a.annotations,r=gS(a.elements,o);for(let s=0;s<o.length;s++){let c=o[s],p=mg(r,s,c.type),f=c.setContext(pS(n,p,r,c)),b=p.resolveElementProperties(n,f);b.skip=uS(b),"elements"in b&&(hS(p,b.elements,f,i),delete b.elements),Oi(p.x)||Object.assign(p,b),Object.assign(p,b.initProperties),b.options=hg(f),i.update(p,b)}}function uS(n){return isNaN(n.x)||isNaN(n.y)}function mS(n,a,e){return e==="reset"||e==="none"||e==="resize"?lS:new Yc(n,a)}function hS(n,a,e,t){let i=n.elements||(n.elements=[]);i.length=a.length;for(let o=0;o<a.length;o++){let r=a[o],s=r.properties,c=mg(i,o,r.type,r.initProperties),p=e[r.optionScope].override(r);s.options=hg(p),t.update(c,s)}}function mg(n,a,e,t){let i=Yn[Kl(e)],o=n[a];return(!o||!(o instanceof i))&&(o=n[a]=new i,Object.assign(o,t)),o}function hg(n){let a=Yn[Kl(n.type)],e={};e.id=n.id,e.type=n.type,e.drawTime=n.drawTime,Object.assign(e,ql(n,a.defaults),ql(n,a.defaultRoutes));for(let t of dS)e[t]=n[t];return e}function ql(n,a){let e={};for(let t of Object.keys(a)){let i=a[t],o=n[t];Hl(t)&&Ii(o)?e[t]=o.map(r=>Up(r,i)):e[t]=Up(o,i)}return e}function pS(n,a,e,t){return a.$context||(a.$context=Object.assign(Object.create(n.getContext()),{element:a,get elements(){return e.filter(i=>i&&i.options)},id:t.id,type:"annotation"}))}function gS(n,a){let e=a.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 fS="3.1.0",$n=new Map,zp=n=>n.type!=="doughnutLabel",vS=Ql.concat(Es),pg={id:"annotation",version:fS,beforeRegister(){eC("chart.js","4.0",gt.version)},afterRegister(){gt.register(Yn)},afterUnregister(){gt.unregister(Yn)},beforeInit(n){$n.set(n,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(n,a,e){let t=$n.get(n),i=t.annotations=[],o=e.annotations;On(o)?Object.keys(o).forEach(r=>{let s=o[r];On(s)&&(s.id=r,i.push(s))}):Ii(o)&&i.push(...o),NC(i.filter(zp),n.scales)},afterDataLimits(n,a){let e=$n.get(n);OC(n,a.scale,e.annotations.filter(zp).filter(t=>t.display&&t.adjustScaleRange))},afterUpdate(n,a,e){let t=$n.get(n);TC(n,t,e),cS(n,t,e,a.mode),t.visibleElements=t.elements.filter(i=>!i.skip&&i.options.display),IC(n,t,e)},beforeDatasetsDraw(n,a,e){Ho(n,"beforeDatasetsDraw",e.clip)},afterDatasetsDraw(n,a,e){Ho(n,"afterDatasetsDraw",e.clip)},beforeDatasetDraw(n,a,e){Ho(n,a.index,e.clip)},beforeDraw(n,a,e){Ho(n,"beforeDraw",e.clip)},afterDraw(n,a,e){Ho(n,"afterDraw",e.clip)},beforeEvent(n,a,e){let t=$n.get(n);EC(t,a.event,e)&&(a.changed=!0)},afterDestroy(n){$n.delete(n)},getAnnotations(n){let a=$n.get(n);return a?a.elements:[]},_getAnnotationElementsAtEventForMode(n,a,e){return jl(n,a,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=>!vS.includes(n)&&n!=="init",annotations:{_allKeys:!1,_fallback:(n,a)=>`elements.${Yn[Kl(a.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:Hl,_fallback:!0},_indexable:Hl}},additionalOptionScopes:[""]};function Ho(n,a,e){let{ctx:t,chartArea:i}=n,o=$n.get(n);e&&La(t,i);let r=bS(o.visibleElements,a).sort((s,c)=>s.element.options.z-c.element.options.z);for(let s of r)AS(t,i,o,s);e&&Va(t)}function bS(n,a){let e=[];for(let t of n)if(t.options.drawTime===a&&e.push({element:t,main:!0}),t.elements&&t.elements.length)for(let i of t.elements)i.options.display&&i.options.drawTime===a&&e.push({element:i});return e}function AS(n,a,e,t){let i=t.element;t.main?(Ep(e,i,"beforeDraw"),i.draw(n,a),Ep(e,i,"afterDraw")):i.draw(n,a)}var yS=["widgetDataChart"];function xS(n,a){n&1&&Z(0,"canvas",1,0)}function CS(n,a){n&1&&(E(0,"div",2)(1,"p"),d(2,"Ready to configure"),P(),E(3,"p",3),d(4,"Double-tap to begin"),P()())}gt.register(pg,da,Ga,Pr,Ir,en,Fn,Rn,Wn,Vn);var gg=(()=>{class n{id=y.required();type=y.required();theme=y.required();runtime=A(be);dsService=A(tn);ngZone=A(Be);canvasService=A(ct);unitsService=A(ot);datasetLifecycle=A(Ha);widgetDataChart=ce("widgetDataChart",{read:Ye});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=ie(()=>!!this.runtime.options()?.datachartPath);pathSignature=ie(()=>{let e=this.runtime.options();if(e.datachartPath)return[e.datachartPath,e.convertUnitTo,e.datachartSource,e.timeScale,e.period].join("|")});previousPathSignature=void 0;constructor(){V(()=>{let e=this.pathSignature();W(()=>{e!==this.previousPathSignature&&W(()=>{this.previousPathSignature=e,this.rebuildForDataset(this.runtime.options())})})}),V(()=>{let e=this.runtime.options(),t=this.theme();!e||!t||W(()=>{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")))})}),V(()=>{let e=this.runtime.options(),t=this.widgetDataChart(),i=this.hasPath();!e||!i||!t||this.chart||W(()=>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 gt(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(o=>o.label==="Value")>=0){let o=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:o})}}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"),o,r;e.inverseYAxis&&e.trackAgainstAverage?(o="start",r=!1):e.inverseYAxis&&!e.trackAgainstAverage?(o=!1,r="start"):!e.inverseYAxis&&e.trackAgainstAverage?(o=!0,r=!1):(o=!1,r=!0),t&&(t.order=e.trackAgainstAverage?1:0,t.borderWidth=e.trackAgainstAverage?0:3,t.fill=o),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 o=this.transformDatasetRows(i,0);if(this.chart.data.datasets[0].data.push(...o),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 o=this.transformDatasetRows([i],0)[0];if(this.chart.data.datasets[0].data.push(o),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,o=this.unitsService.convertToUnit(t.convertUnitTo,i);Number.isFinite(o)&&(this.chart.options.plugins.title.text=`${o.toFixed(t.numDecimal)} ${this.getUnitsLabel()} `);let r=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastAverage),s=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastMinimum),c=this.unitsService.convertToUnit(t.convertUnitTo,e.data.lastMaximum),f=this.chart.options.plugins.annotation?.annotations;f&&(Number.isFinite(r)&&f.averageLine?.value!==r&&(f.averageLine.value=r,f.averageLine.label.content=`${r.toFixed(t.numDecimal)}`),Number.isFinite(s)&&f.minimumLine?.value!==s&&(f.minimumLine.value=s,f.minimumLine.label.content=`${s.toFixed(t.numDecimal)}`),Number.isFinite(c)&&f.maximumLine?.value!==c&&(f.maximumLine.value=c,f.maximumLine.label.content=`${c.toFixed(t.numDecimal)}`))}transformDatasetRows(e,t){let i=this.runtime.options(),o=c=>this.unitsService.convertToUnit(i.convertUnitTo,c),r=i.verticalChart,s=i.datasetAverageArray;return e.map(c=>{if(r){if(t===0)return{x:o(c.data.value),y:c.timestamp};{let p={sma:c.data.sma,ema:c.data.ema,dema:c.data.doubleEma,avg:c.data.lastAverage};return{x:o(p[s]),y:c.timestamp}}}else{if(t===0)return{x:c.timestamp,y:o(c.data.value)};{let p={sma:c.data.sma,ema:c.data.ema,dema:c.data.doubleEma,avg:c.data.lastAverage};return{x:c.timestamp,y:o(p[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=q({type:n,selectors:[["widget-data-chart"]],viewQuery:function(t,i){t&1&&Ce(i.widgetDataChart,yS,5,Ye),t&2&&Se()},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&&O(0,xS,2,0,"canvas",1)(1,CS,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}"]})}return n})();var fg=(()=>{class n{data=y(null,{alias:"controlData"});theme=y(null);dimensions=y.required();toggleClick=rt();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=q({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&&(te(),E(0,"svg",0)(1,"defs",1)(2,"linearGradient",2),Z(3,"stop",3)(4,"stop",4),P(),Z(5,"linearGradient",5),P(),E(6,"g",6),Z(7,"rect",7),E(8,"svg",8)(9,"text",9),d(10),P()(),E(11,"g",10),Z(12,"circle",11),P()(),E(13,"g",12),Z(14,"rect",13),E(15,"svg",8)(16,"defs")(17,"filter",14),Z(18,"feGaussianBlur",15),E(19,"feMerge"),Z(20,"feMergeNode",16)(21,"feMergeNode",17),P()()(),E(22,"text",18),d(23),P()(),E(24,"g",19),Z(25,"circle",20),P()()()),t&2&&(Q("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),g(9),Q("fill",i.labelColor),g(),he(" ",i.data().ctrlLabel," "),g(2),Q("fill",i.labelColor),g(10),Q("fill",i.valueColor),g(),he("",i.data().ctrlLabel," "),g(2),Q("fill",i.valueColor))},encapsulation:2})}return n})();var vg=(()=>{class n{data=y(null,{alias:"controlData"});theme=y(null);dimensions=y.required();toggleClick=rt();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=Rt(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=q({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&&(te(),E(0,"svg",0),Z(1,"defs",1),E(2,"g",2),ho("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),Z(4,"rect",4)(5,"rect",5),E(6,"svg",6)(7,"text",7),d(8),P()()(),E(9,"g",8),Z(10,"rect",9)(11,"rect",10),E(12,"svg",6)(13,"text",11),d(14),P()()()()()),t&2&&(Q("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),g(5),Q("fill",i.labelColorDisabled),g(2),Q("fill",i.labelColorDisabled),g(),he(" ",i.data().ctrlLabel," "),g(3),Q("fill",i.valueColor),g(2),Q("fill",i.labelColorEnabled),g(),he(" ",i.data().ctrlLabel," "))},encapsulation:2})}return n})();function Rs(n={}){let a=n.threshold??30,e=!1,t=0,i=0,o=null,r=null,s=()=>{e=!1,t=0,i=0,o=null,r=null};return{onPointerDown(c){e=!1,t=c.clientX,i=c.clientY;let p=c.currentTarget;if(p&&typeof p.setPointerCapture=="function")try{p.setPointerCapture(c.pointerId),o=p,r=c.pointerId}catch(f){}},onPointerMove(c){let p=Math.abs(c.clientX-t),f=Math.abs(c.clientY-i);(p>a||f>a)&&(e=!0)},onPointerUp(c){if(o&&r!==null){let f=o;if(typeof f.releasePointerCapture=="function")try{(!c||f.hasPointerCapture?.(r))&&f.releasePointerCapture(r)}catch(b){}}let p=!e;return s(),p},onPointerCancel(c){if(o&&r!==null){let p=o;if(typeof p.releasePointerCapture=="function")try{(!c||p.hasPointerCapture?.(r))&&p.releasePointerCapture(r)}catch(f){}}s()},reset:s}}var bg=(()=>{class n{data=y(null,{alias:"controlData"});theme=y(null);dimensions=y.required();toggleClick=rt();toggleOff="0 35 180 35";toggleOn="0 0 180 35";ctrlState=null;oldTheme=null;swipeGuard=Rs();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=q({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&&(te(),E(0,"svg",0),Z(1,"defs",1),E(2,"g",2),ho("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)}),Z(3,"rect",3),E(4,"svg",4)(5,"text",5),d(6),P()(),E(7,"g",6),Z(8,"rect",7)(9,"circle",8),P()(),E(10,"g",9),ho("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)}),Z(11,"rect",10),E(12,"svg",4)(13,"defs")(14,"filter",11),Z(15,"feGaussianBlur",12),E(16,"feMerge"),Z(17,"feMergeNode",13)(18,"feMergeNode",14),P()()(),E(19,"text",15),d(20),P()(),E(21,"g",16),Z(22,"rect",17)(23,"circle",18),P()()()),t&2&&(Q("height",i.dimensions().height)("width",i.dimensions().width)("viewBox",i.viewBox),g(5),Q("fill",i.labelColor),g(),he(" ",i.data().ctrlLabel," "),g(3),Q("fill",i.labelColor),g(10),Q("fill",i.valueColor),g(),he("",i.data().ctrlLabel," "),g(2),Q("fill",i.labelColor),g(),Q("fill",i.valueColor))},encapsulation:2})}return n})();function SS(n,a){if(n&1&&L(0,"widget-title",1),n&2){let e=T(),t=dn(0);I("text",t==null?null:t.displayName)("color",e.labelColor())}}function wS(n,a){if(n&1){let e=xe();l(0,"app-svg-boolean-switch",5),z("toggleClick",function(i){J(e);let o=T(2);return ee(o.toggle(i))}),u()}if(n&2){let e=T().$implicit,t=T();I("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function _S(n,a){if(n&1){let e=xe();l(0,"app-svg-boolean-button",5),z("toggleClick",function(i){J(e);let o=T(2);return ee(o.toggle(i))}),u()}if(n&2){let e=T().$implicit,t=T();I("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function MS(n,a){if(n&1){let e=xe();l(0,"app-svg-boolean-light",5),z("toggleClick",function(i){J(e);let o=T(2);return ee(o.toggle(i))}),u()}if(n&2){let e=T().$implicit,t=T();I("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions)}}function kS(n,a){if(n&1&&(Hi(0),O(1,wS,1,3,"app-svg-boolean-switch",4)(2,_S,1,3,"app-svg-boolean-button",4)(3,MS,1,3,"app-svg-boolean-light",4),qi()),n&2){let e,t=a.$implicit;g(),N((e=t.type)==="1"?1:e==="2"?2:e==="3"?3:-1)}}function TS(n,a){n&1&&L(0,"div",3)}var Ag=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(pi);ngZone=A(Be);runtime=A(be,{optional:!0});streams=A(Ne,{optional:!0});dashboard=A(mt);signalkRequestsService=A(Jt);toast=A($i);switchControls=w([]);labelColor=w(void 0);noTitleClass=ie(()=>this.runtime?.options()?.showLabel===!1?"widgets-container-no-title":"widgets-container");nbCtrl=null;ctrlDimensions={width:0,height:0};skRequestSub=new xa;constructor(){V(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||W(()=>{this.labelColor.set(we(t.color,e).dim)})}),V(()=>{let e=this.runtime?.options();if(!e)return;let t=(e.multiChildCtrls||[]).map(i=>ue(ne({},i),{isNumeric:i.isNumeric??!1}));this.nbCtrl=t.length,W(()=>{this.switchControls.set(t),this.streams&&t.forEach(i=>{let o=e.paths;if(!o?.length)return;let r=o.findIndex(c=>c.pathID===i.pathID);r<0||!o[r]?.path||this.streams.observe(String(r),c=>{let p=c?.data?.value,f=i.isNumeric?[0,1,null].includes(p)?!!p:i.value:p;this.ngZone.run(()=>{this.switchControls.update(b=>{let x=b.findIndex(_=>_.pathID===i.pathID);if(x===-1)return b;let S=ue(ne({},b[x]),{value:f});return[...b.slice(0,x),S,...b.slice(x+1)]}),this.cdr.markForCheck()})})})})})}onResized(e){let t=this.nbCtrl||1,i=e.contentRect.height/t,o=35*e.contentRect.width/180,r=o<i?o: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 o=i.findIndex(s=>s.pathID===e.pathID);if(o<0)return;let r=i[o].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=q({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&&(ia(0),O(1,SS,1,2,"widget-title",1),l(2,"div",2,0),z("resizeChange",function(r){return i.onResized(r)}),Ae(4,kS,4,1,"ng-container",null,Le),u(),O(6,TS,1,0,"div",3)),t&2){let o=ln(i.runtime==null?null:i.runtime.options());g(),N(o!=null&&o.showLabel?1:-1),g(),Ke(i.noTitleClass()),g(2),ye(i.switchControls()),g(2),N(i.dashboard.isDashboardStatic()?-1:6)}},dependencies:[zt,bg,vg,fg,Bn],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}"]})}return n})();var yg=(n,a)=>a.raw.value;function ES(n,a){if(n&1&&L(0,"widget-title",0),n&2){let e=T();I("text",e.displayName())("color",e.accentColor())}}function DS(n,a){if(n&1&&(te(),L(0,"path")),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("d",t.fullRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function PS(n,a){if(n&1&&(te(),L(0,"path")),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("d",t.topRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function IS(n,a){if(n&1&&(te(),L(0,"path")),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("d",t.bottomRoundedItemPathD())("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function OS(n,a){if(n&1&&(te(),L(0,"rect",18)),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("width",t.menuWidth)("height",t.itemHeight)("fill",t.isSelected(e.raw)?t.accentColor():(e.raw.isOn===!1,t.accentDim()))}}function NS(n,a){if(n&1){let e=xe();te(),l(0,"g",15),z("pointerdown",function(i){J(e);let o=T();return ee(o.onPointerDown(i))})("pointermove",function(i){J(e);let o=T();return ee(o.onPointerMove(i))})("pointerup",function(i){let o=J(e).$implicit,r=T();return ee(r.onPointerUp(i,o))})("pointercancel",function(i){J(e);let o=T();return ee(o.onPointerCancel(i))})("keyup.enter",function(){let i=J(e).$implicit,o=T();return ee(o.canPut()&&o.selectUi(i))})("keyup.space",function(){let i=J(e).$implicit,o=T();return ee(o.canPut()&&o.selectUi(i))}),O(1,DS,1,4,":svg:path",16)(2,PS,1,4,":svg:path",16)(3,IS,1,4,":svg:path",16)(4,OS,1,5,":svg:rect",17),l(5,"text"),d(6),u()()}if(n&2){let e=a.$implicit,t=T();pe("cursor",t.canPut()?"pointer":"not-allowed"),it("is-selected",t.isSelected(e.raw))("is-off",e.raw.isOn===!1),Q("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()),g(),N(e.index===0&&e.index===t.optionsCount()-1?1:e.index===0?2:e.index===t.optionsCount()-1?3:4),g(4),Ke(t.isSelected(e.raw)?"svg-menu-item-current-text":e.raw.isOn===!1?"svg-menu-item-off-text":"svg-menu-item-text"),Q("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())),g(),Vt(" ",t.isSelected(e.raw)?"\u2713 ":"","",e.label," ")}}function RS(n,a){if(n&1&&(te(),L(0,"path")),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("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 LS(n,a){if(n&1&&(te(),L(0,"path")),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("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 VS(n,a){if(n&1&&(te(),L(0,"path")),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("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 WS(n,a){if(n&1&&(te(),L(0,"rect",18)),n&2){let e=T().$implicit,t=T();Ke(t.isSelected(e.raw)?"svg-menu-item-current":e.raw.isOn===!1?"svg-menu-item-off":"svg-menu-item"),Q("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 FS(n,a){if(n&1){let e=xe();te(),l(0,"g",15),z("pointerdown",function(i){J(e);let o=T();return ee(o.onPointerDown(i))})("pointermove",function(i){J(e);let o=T();return ee(o.onPointerMove(i))})("pointerup",function(i){let o=J(e).$implicit,r=T();return ee(r.onPointerUp(i,o))})("pointercancel",function(i){J(e);let o=T();return ee(o.onPointerCancel(i))})("keyup.enter",function(){let i=J(e).$implicit,o=T();return ee(o.canPut()&&o.selectUi(i))})("keyup.space",function(){let i=J(e).$implicit,o=T();return ee(o.canPut()&&o.selectUi(i))}),O(1,RS,1,5,":svg:path",16)(2,LS,1,5,":svg:path",16)(3,VS,1,5,":svg:path",16)(4,WS,1,6,":svg:rect",17),l(5,"text"),d(6),u()()}if(n&2){let e=a.$implicit,t=T();pe("cursor",t.canPut()?"pointer":"not-allowed"),it("is-selected",t.isSelected(e.raw))("is-off",e.raw.isOn===!1),Q("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()),g(),N(e.index===0&&e.index===t.optionsCount()-1?1:e.index===0?2:e.index===t.optionsCount()-1?3:4),g(4),Ke(t.isSelected(e.raw)?"svg-menu-item-current-text":e.raw.isOn===!1?"svg-menu-item-off-text":"svg-menu-item-text"),Q("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())),g(),Vt(" ",t.isSelected(e.raw)?"\u2713 ":"","",e.label," ")}}function GS(n,a){n&1&&L(0,"div",14)}var xg=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);streams=A(Ne);meta=A(ei);signalkRequestsService=A(Jt);dashboard=A(mt);toast=A($i);skRequest=vi(this.signalkRequestsService.subscribeRequest(),{initialValue:null});cfg=ie(()=>this.runtime.options());displayName=ie(()=>this.cfg()?.displayName);showLabel=ie(()=>this.cfg()?.showLabel);controlPath=ie(()=>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=ie(()=>{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,o)=>{let r=i.comparable,s=o.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,o)=>ue(ne({},i),{index:o}))});menuWidth=220;itemHeight=50;itemGap=1;svgPadding=Math.max(1,Math.round(this.itemHeight*.2));optionsCount=ie(()=>this.sortedOptions().length);menuHeight=ie(()=>{let e=this.sortedOptions().length;return e<=0?0:e*this.itemHeight+(e-1)*this.itemGap});hasOptions=ie(()=>this.meta.possibleValues().length>0);selectedValue=ie(()=>this.currentValue());canPut=ie(()=>this.meta.supportsPut());swipeGuard=Rs();unselectedOptions=ie(()=>this.sortedOptions().filter(e=>!this.isSelected(e.raw)));selectedOptions=ie(()=>this.sortedOptions().filter(e=>this.isSelected(e.raw)));fullRoundedItemPathD=ie(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!0,!0));topRoundedItemPathD=ie(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!0,!1));bottomRoundedItemPathD=ie(()=>this.buildRoundedRectPath(this.menuWidth,this.itemHeight,this.cornerRadius,!1,!0));cornerRadius=7;constructor(){V(()=>{let e=this.theme(),t=this.cfg().color;!e||!t||W(()=>{this.accentColor.set(we(t,e).color),this.accentDim.set(we(t,e).dim),this.accentDimmer.set(we(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(we(t,e).dim),this.textDimmer.set(we(t,e).dimmer))})}),V(()=>{if(!this.controlPath()){this.currentValue.set(null);return}W(()=>{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,o,r){let s=Math.max(0,e),c=Math.max(0,t),p=Math.max(0,Math.min(i,s/2,c/2));return s===0||c===0?"":p===0?`M0 0H${s}V${c}H0Z`:o&&r?[`M${p} 0`,`H${s-p}`,`A${p} ${p} 0 0 1 ${s} ${p}`,`V${c-p}`,`A${p} ${p} 0 0 1 ${s-p} ${c}`,`H${p}`,`A${p} ${p} 0 0 1 0 ${c-p}`,`V${p}`,`A${p} ${p} 0 0 1 ${p} 0`,"Z"].join(""):o?[`M0 ${p}`,`A${p} ${p} 0 0 1 ${p} 0`,`H${s-p}`,`A${p} ${p} 0 0 1 ${s} ${p}`,`V${c}`,"H0","Z"].join(""):r?["M0 0",`H${s}`,`V${c-p}`,`A${p} ${p} 0 0 1 ${s-p} ${c}`,`H${p}`,`A${p} ${p} 0 0 1 0 ${c-p}`,"V0","Z"].join(""):`M0 0H${s}V${c}H0Z`}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(O(0,ES,1,2,"widget-title",0),l(1,"div",1),te(),l(2,"svg",2)(3,"defs")(4,"filter",3),L(5,"feGaussianBlur",4),l(6,"feMerge"),L(7,"feMergeNode",5)(8,"feMergeNode",6),u()(),l(9,"filter",7),L(10,"feMorphology",8)(11,"feComposite",9)(12,"feFlood",10)(13,"feComposite",11),l(14,"feMerge"),L(15,"feMergeNode",6)(16,"feMergeNode",12),u()()(),l(17,"g"),Ae(18,NS,7,20,":svg:g",13,yg),Ae(20,FS,7,20,":svg:g",13,yg),u()()(),O(22,GS,1,0,"div",14)),t&2&&(N(i.showLabel()?0:-1),g(),Q("aria-label",i.displayName()),g(),Q("viewBox","0 0 "+(i.menuWidth+i.svgPadding*2)+" "+((i.menuHeight()||i.itemHeight)+i.svgPadding*2))("aria-label",i.displayName()),g(15),Q("transform","translate("+i.svgPadding+" "+i.svgPadding+")"),g(),ye(i.unselectedOptions()),g(2),ye(i.selectedOptions()),g(2),N(i.dashboard.isDashboardStatic()?-1:22))},dependencies:[Bn],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 Cg=(()=>{class n{data=y(null,{alias:"controlData"});theme=y(null);dimensions=y.required();toggleClick=rt();ctrlLabelColor=w(null);ctrlStateColor=w(null);messageTxtColor=w(null);shouldEmergencyBlink=ie(()=>(this.data()?.notificationState??"").toLowerCase()==="emergency");shouldAlarmBlink=ie(()=>(this.data()?.notificationState??"").toLowerCase()==="alarm");constructor(){V(()=>{let e=this.data(),t=this.theme();W(()=>{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(we(e.color,t).dim);break}this.ctrlLabelColor.set(we(e.color,t).color)})})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(te(),E(0,"svg",0),Z(1,"defs",1),E(2,"g",2),Z(3,"rect",3),E(4,"foreignObject",4),Fe(),E(5,"div",5),d(6),P()(),te(),Z(7,"rect",6)(8,"rect",7),E(9,"foreignObject",8),Fe(),E(10,"div",9),d(11),P()()()()),t&2&&(Q("height",i.dimensions().height)("width",i.dimensions().width),g(5),pe("color",i.ctrlLabelColor()),g(),he(" ",i.data().ctrlLabel," "),g(),Q("stroke",i.ctrlLabelColor()),g(),it("emergency-blink-fill",i.shouldEmergencyBlink())("alarm-blink-fill",i.shouldAlarmBlink()),Q("fill",i.ctrlStateColor()),g(2),pe("color",i.messageTxtColor()),g(),he(" ",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}"]})}return n})();function BS(n,a){if(n&1&&L(0,"widget-title",1),n&2){let e=T(),t=dn(0);I("text",t==null?null:t.displayName)("color",e.labelColor())}}function US(n,a){if(n&1&&L(0,"app-svg-zone-states",4),n&2){let e=T().$implicit,t=T();I("controlData",e)("theme",t.theme())("dimensions",t.ctrlDimensions())}}function zS(n,a){if(n&1&&(Hi(0),O(1,US,1,3,"app-svg-zone-states",4),qi()),n&2){let e,t=a.$implicit;g(),N((e=t.type)==="4"?1:-1)}}function HS(n,a){n&1&&L(0,"div",3)}var Sg=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(pi);ngZone=A(Be);runtime=A(be,{optional:!0});notificationsService=A(du);dashboard=A(mt);notifications=vi(this.notificationsService.observeNotifications());zonesControls=w([]);labelColor=w(void 0);noTitleClass=ie(()=>this.runtime?.options()?.showLabel===!1?"widgets-container-no-title":"widgets-container");pathIdToNotificationPath=new Map;hostSize=w(null);ctrlDimensions=ie(()=>{let e=this.hostSize();if(!e)return{width:0,height:0};let t=Math.max(1,this.zonesControls().length),i=e.height/t,o=75*e.width/180,r=Math.min(o,i);return{width:e.width,height:r}});constructor(){V(()=>{let e=this.theme(),t=this.runtime?.options();!e||!t||(W(()=>{this.labelColor.set(we(t.color,e).dim)}),this.cdr.markForCheck())}),V(()=>{let e=this.runtime?.options();e&&(W(()=>{let t=(e.multiChildCtrls||[]).map(o=>ue(ne({},o),{isNumeric:o.isNumeric??!1}));this.zonesControls.set(t);let i=e.paths;if(i?.length){this.pathIdToNotificationPath.clear();for(let o of i){if(!o?.pathID||!o?.path)continue;let r=o.path.replace(/^self(\.|$)/,"notifications$1");this.pathIdToNotificationPath.set(o.pathID,r)}this.applyNotificationsSnapshot(this.notifications())}}),this.cdr.markForCheck())}),V(()=>{let e=this.notifications();W(()=>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(o=>{let r=null;for(let s=0;s<o.length;s++){let c=o[s],p=this.pathIdToNotificationPath.get(c.pathID),f=p?t.get(p):void 0;if(!f)continue;let b=f.value?.state,x=f.value?.message;c.notificationState===b&&c.notificationMessage===x||(r||(r=[...o]),r[s]=ue(ne({},c),{notificationState:b,notificationMessage:x}),i=!0)}return r??o}),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=q({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&&(ia(0),O(1,BS,1,2,"widget-title",1),l(2,"div",2,0),z("resizeChange",function(r){return i.onResized(r)}),Ae(4,zS,2,1,"ng-container",null,Le),u(),O(6,HS,1,0,"div",3)),t&2){let o=ln(i.runtime==null?null:i.runtime.options());g(),N(o!=null&&o.showLabel?1:-1),g(),Ke(i.noTitleClass()),g(2),ye(i.zonesControls()),g(2),N(i.dashboard.isDashboardStatic()?-1:6)}},dependencies:[zt,Cg,Bn],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}"]})}return n})();var wg="mat-badge-content",qS=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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})(),$V=(()=>{class n{_ngZone=A(Be);_elementRef=A(Ye);_ariaDescriber=A(ec);_renderer=A(sr);_animationsDisabled=ji();_idGenerator=A(na);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=A(Xd);_document=A(Od);constructor(){let e=A(fr);e.load(qS),e.load(Zd)}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(wg),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 > .${wg}`);for(let t of Array.from(e))t!==this._badgeElement&&t.remove()}static \u0275fac=function(t){return new(t||n)};static \u0275dir=Dt({type:n,selectors:[["","matBadge",""]],hostAttrs:[1,"mat-badge"],hostVars:20,hostBindings:function(t,i){t&2&&it("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",pt],disabled:[2,"matBadgeDisabled","disabled",pt],position:[0,"matBadgePosition","position"],content:[0,"matBadge","content"],description:[0,"matBadgeDescription","description"],size:[0,"matBadgeSize","size"],hidden:[2,"matBadgeHidden","hidden",pt]}})}return n})(),_g=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ui({type:n});static \u0275inj=Gi({imports:[Kd,_n]})}return n})();var jS=["rotatingDial"],$S=["awaIndicator"],YS=["rudderStarboardRect"],ZS=["rudderPortRect"],Mg=(()=>{class n{rotatingDial=ce.required("rotatingDial");awaIndicator=ce.required("awaIndicator");rudderStarboardRect=ce.required("rudderStarboardRect");rudderPortRect=ce.required("rudderPortRect");apMode=y("off-line");targetPilotHeadingTrue=y.required();autopilotTarget=y.required();courseXte=y.required();compassHeading=y.required();headingDirectionTrue=y.required();appWindAngle=y.required();rudderAngle=y.required();compassAngle=w(0);awaAngle=w(0);prevCompassAngle=0;prevAwaAngle=0;lastRudderSigned=Number.NaN;oldRudderPrtAngle=0;newRudderPrtAngle=0;oldRudderStbAngle=0;newRudderStbAngle=0;apModeValue=w("");apModeValueAnnotation=w("");apModeValueDirection=w("");lockedMode=ie(()=>{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=ie(()=>{let e=this.autopilotTarget();return Number.isFinite(e)?this.roundDeg(e):null});lockedHdgAnnotation=ie(()=>{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=ie(()=>this.headingDirectionTrue()?"T":"M");animationFrames=new WeakMap;ANIMATION_DURATION=1e3;DEG_TO_PX=16.66666667;ROT_CENTER=[500,560.061];ngZone=A(Be);roundDeg(e){return Math.round(e)}constructor(){V(()=>{let e=this.compassHeading();if(!Number.isFinite(e))return;let t=this.roundDeg(e);W(()=>{let i=this.prevCompassAngle;if(i===t)return;this.prevCompassAngle=t,this.compassAngle.set(t);let o=this.rotatingDial()?.nativeElement;o&&Ut(o,-i,-t,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ROT_CENTER,this.ngZone)})}),V(()=>{let e=this.appWindAngle();if(!Number.isFinite(e))return;let i=(this.roundDeg(e)+360)%360;W(()=>{let o=this.prevAwaAngle;if(o===i)return;this.prevAwaAngle=i,this.awaAngle.set(i);let r=this.awaIndicator()?.nativeElement;r&&Ut(r,o,i,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ROT_CENTER,this.ngZone)})}),V(()=>{let e=this.rudderAngle();Number.isFinite(e)&&W(()=>{this.updateRudderAngle(-e)})}),V(()=>{let e=this.apMode(),t=this.appWindAngle(),i=Number.isFinite(t)?this.roundDeg(t):0,o=this.courseXte();W(()=>{switch(e){case"auto":case"route":{let r,s,c;o<0?c=" Port":o>0?c=" Stbd":c="",o=Math.abs(o),o>185?(r=(o/1852).toFixed(1),s=" nm"):(r=o.toFixed(0),s=" m"),this.apModeValueAnnotation.set(s),this.apModeValue.set(r),this.apModeValueDirection.set(c);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 o=Math.min(Math.abs(t),30)*this.DEG_TO_PX;t<=0?(ko(this.rudderStarboardRect().nativeElement,this.oldRudderStbAngle,o,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),ko(this.rudderPortRect().nativeElement,this.oldRudderPrtAngle,0,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),this.oldRudderStbAngle=o,this.oldRudderPrtAngle=0):(ko(this.rudderPortRect().nativeElement,this.oldRudderPrtAngle,o,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),ko(this.rudderStarboardRect().nativeElement,this.oldRudderStbAngle,0,this.ANIMATION_DURATION,void 0,this.animationFrames,this.ngZone),this.oldRudderPrtAngle=o,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 o=this.animationFrames.get(i);o&&cancelAnimationFrame(o),this.animationFrames.delete(i)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["app-svg-autopilot"]],viewQuery:function(t,i){t&1&&Ce(i.rotatingDial,jS,5)(i.awaIndicator,$S,5)(i.rudderStarboardRect,YS,5)(i.rudderPortRect,ZS,5),t&2&&Se(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&&(te(),E(0,"svg",4)(1,"g",5)(2,"g",6),Z(3,"path",7)(4,"path",8)(5,"path",9),P(),E(6,"g",10,0)(8,"g",11),Z(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),d(48,"330"),P()(),E(49,"text",51)(50,"tspan",52),d(51,"300"),P()(),E(52,"text",53)(53,"tspan",54),d(54,"W"),P()(),E(55,"text",55)(56,"tspan",56),d(57,"240"),P()(),E(58,"text",57)(59,"tspan",58),d(60,"210"),P()(),E(61,"text",59)(62,"tspan",60),d(63,"S"),P()(),E(64,"text",61)(65,"tspan",62),d(66,"150"),P()(),E(67,"text",63)(68,"tspan",64),d(69,"120"),P()(),E(70,"text",65)(71,"tspan",66),d(72,"E"),P()(),E(73,"text",67)(74,"tspan",68),d(75,"60"),P()(),E(76,"text",69)(77,"tspan",70),d(78,"30"),P()(),E(79,"text",71)(80,"tspan",72),d(81,"N"),P()()()(),Z(82,"path",73),P(),E(83,"g",74)(84,"text",75),d(85),P(),E(86,"text",76),d(87),E(88,"tspan",77),d(89),P()(),E(90,"text",78),d(91),P(),E(92,"text",79),d(93,"HDG"),P(),E(94,"text",80),d(95),E(96,"tspan",77),d(97),P()()(),E(98,"g",81)(99,"text",82),d(100),E(101,"tspan",83),d(102,"\xB0"),P()(),E(103,"text",84),d(104),P(),E(105,"text",85),d(106),P()(),E(107,"g",86)(108,"g",87,1),Z(110,"path",88),E(111,"text",89)(112,"tspan",90),d(113,"A"),P()()()(),E(114,"g",91),Z(115,"rect",92,2)(117,"rect",93,3)(119,"rect",94)(120,"rect",95)(121,"rect",96)(122,"rect",97),P()()),t&2&&(g(84),Ke(i.apMode()=="wind"?"awa-text-dim":"contrast-text-dim"),Q("display",i.apMode()=="wind"||i.apMode()=="route"?"inline":"none"),g(),he(" ",i.apMode()==="route"?"XTE":"AWA"),g(),Ke(i.apMode()=="wind"?"awa-text":"contrast-text"),Q("display",i.apMode()=="wind"||i.apMode()=="route"?"inline":"none"),g(),X(i.apModeValue()??"--"),g(2),X(i.apModeValueAnnotation()),g(),Q("display",i.apMode()=="route"?"inline":"none"),g(),X(i.apModeValueDirection()),g(4),he("",i.compassAngle()??"--","\xB0"),g(2),X(i.hdgDirectionTrue()),g(3),X(i.lockedHdg()??"--"),g(4),X(i.lockedHdgAnnotation()),g(2),X(i.lockedMode()),g(2),Q("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 QS=["childOutlet"],kg=(()=>{class n{widgetProperties;outlet;_streams=A(Ne,{optional:!0});_meta=A(ei,{optional:!0});_runtime=A(be,{optional:!0});_widgetService=A(Ls);_app=A(wi);theme=vi(this._app.cssThemeColorRoles$,{requireSync:!0});childRef;compType;constructor(){V(()=>{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=q({type:n,selectors:[["widget-embedded"]],viewQuery:function(t,i){if(t&1&&Sn(QS,7,lr),t&2){let o;mi(o=hi())&&(i.outlet=o.first)}},inputs:{widgetProperties:"widgetProperties"},features:[Ld([Ne,ei,be])],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&&(l(0,"mat-card",1),cr(1,null,0),u())},dependencies:[_r,Gc],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 XS(n,a){if(n&1){let e=xe();l(0,"button",17),z("click",function(){J(e);let i=T();return ee(i.toggleDodge())}),l(1,"mat-icon",18),te(),l(2,"svg",34)(3,"text",40),d(4,"Dodge"),u(),L(5,"path",41)(6,"path",42),l(7,"text",43),d(8,"!"),u()()()()}if(n&2){let e=T();it("ap-btn-active",e.dodgeModeActive()),I("disabled",e.apBtnDisabled()),g(5),pe("fill",e.dodgeModeActive()?"currentColor":"none")("stroke","currentColor"),g(),pe("fill",e.dodgeModeActive()?"currentColor":"none")("stroke","currentColor")}}function KS(n,a){if(n&1){let e=xe();te(),l(0,"g",48),z("click",function(){let i=J(e).$implicit,o=T(2);return ee(!i.disabled&&o.onMenuItemClick(i.action))})("keyup.enter",function(){let i=J(e).$implicit,o=T(2);return ee(!i.disabled&&o.onMenuItemClick(i.action))})("keyup.space",function(){let i=J(e).$implicit,o=T(2);return ee(!i.disabled&&o.onMenuItemClick(i.action))}),L(1,"rect",49),l(2,"text",50),d(3),u()()}if(n&2){let e=a.$implicit,t=a.$index,i=T(2);Q("aria-label",e.label),g(),Ke(e.isCancel?"svg-menu-item-cancel":e.current?"svg-menu-item-current":e.disabled?"svg-menu-item-disabled":"svg-menu-item"),Q("y",t*i.itemHeight)("height",i.itemHeight),g(),Ke(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"),Q("y",(t+.65)*i.itemHeight),g(),Vt(" ",e.current?"\u2713 ":"","",e.label," ")}}function JS(n,a){if(n&1){let e=xe();l(0,"div",44),z("click",function(){J(e);let i=T();return ee(i.toggleMenu())})("keyup.enter",function(){J(e);let i=T();return ee(i.toggleMenu())})("keyup.space",function(){J(e);let i=T();return ee(i.toggleMenu())}),te(),l(1,"svg",45),z("click",function(i){return i.stopPropagation()})("keyup.enter",function(i){return i.stopPropagation()})("keyup.space",function(i){return i.stopPropagation()}),L(2,"rect",46),Hi(3),Ae(4,KS,4,10,":svg:g",47,Le),qi(),u()()}if(n&2){let e=T();g(),Q("viewBox","0 0 240 "+e.menuItems().length*e.itemHeight),g(),Q("height",e.menuItems().length*e.itemHeight),g(2),ye(e.menuItems())}}function ew(n,a){n&1&&L(0,"div",39)}var Mi={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"},vn={BASE:n=>`${Mi.V2_AUTOPILOTS}/${n}`,ENGAGE:n=>`${Mi.V2_AUTOPILOTS}/${n}/engage`,DISENGAGE:n=>`${Mi.V2_AUTOPILOTS}/${n}/disengage`,STATE:n=>`${Mi.V2_AUTOPILOTS}/${n}/state`,MODE:n=>`${Mi.V2_AUTOPILOTS}/${n}/mode`,TARGET_HEADING:n=>`${Mi.V2_AUTOPILOTS}/${n}/target`,TACK:n=>`${Mi.V2_AUTOPILOTS}/${n}/tack`,GYBE:n=>`${Mi.V2_AUTOPILOTS}/${n}/gybe`,DODGE:n=>`${Mi.V2_AUTOPILOTS}/${n}/dodge`,ADJUST_HEADING:n=>`${Mi.V2_AUTOPILOTS}/${n}/target/adjust`},Jl={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"}},ed={COUNTDOWN_SECONDS:5,ERROR_DISPLAY_DURATION:6e3,MESSAGE_DISPLAY_DURATION:5e3},Tg=(()=>{class n{id=y.required();type=y.required();theme=y.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=A(be);streams=A(Ne,{optional:!0});_requests=A(Jt);http=A(ka);dashboard=A(mt);_destroyRef=A(tt);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=Wd(()=>{let e=this.autopilotTargetHeading(),t=this.autopilotTargetWindHeading();return this.apMode()==="wind"?t??null:e??null});currentRequests=new Set;apGrid=ie(()=>this.apMode()?"grid":"none");apEngageBtnDisabled=ie(()=>{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=ie(()=>{let e=this.apEngaged();return this.runtime.options().autopilot.apiVersion==="v1"?this.apMode()==="standby":!e});adjustHdgBtnVisibility=ie(()=>{let e=this.apMode();return!!["auto","compass","gps","wind","true wind","standby"].includes(e)});tackBtnVisibility=ie(()=>{let e=this.apMode();return!!["auto","compass","gps","wind","true wind","standby"].includes(e)});routeBtnVisibility=ie(()=>{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=ie(()=>{let e=this.apMode(),t=this.runtime.options().autopilot.apiVersion,i=this.runtime.options().autopilot.pluginId,o=[];return W(()=>{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}];o=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}];o=this.parseMenuItems(r,e)}}),o});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:fi});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:fi});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:fi});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:fi});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:fi});constructor(){V(()=>{this.runtime?.options()&&W(()=>{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,o=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(!o){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:vn.ENGAGE(e),disengage:vn.DISENGAGE(e),mode:vn.MODE(e),state:vn.STATE(e),target:vn.TARGET_HEADING(e),tack:vn.TACK(e),gybe:vn.GYBE(e),dodge:vn.DODGE(e),adjustHeading:vn.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=Mi.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(Je(this._destroyRef)).subscribe(e=>{e.widgetUUID==this.id()&&this.commandReceived(e)})}makeHttpRequest(e){let t=e.pipe(Je(this._destroyRef));return this.currentRequests.add(t),t.pipe(Ko(()=>this.currentRequests.delete(t)))}cancelAllHttpRequests(){this.currentRequests.clear()}buildAndSendCommand(e){let t=Jl[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,Jl.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 Oe(this,null,function*(){let i=this.apiEndpoints;if(!i){console.error("V2 endpoints not available");return}let o=this.dodgeModeActive(),r;switch(e){case"+1":r={path:o?i.dodge:i.adjustHeading,value:{value:1,units:"deg"}},this.executeRestRequest("PUT",r);break;case"+10":r={path:o?i.dodge:i.adjustHeading,value:{value:10,units:"deg"}},this.executeRestRequest("PUT",r);break;case"-1":r={path:o?i.dodge:i.adjustHeading,value:{value:-1,units:"deg"}},this.executeRestRequest("PUT",r);break;case"-10":r={path:o?i.dodge:i.adjustHeading,value:{value:-10,units:"deg"}},this.executeRestRequest("PUT",r);break;case"advanceWaypoint":r={path:`${Mi.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 Oe(this,null,function*(){try{let i;switch(e){case"POST":i=yield Zo(this.makeHttpRequest(this.http.post(t.path,void 0)));break;case"PUT":i=yield Zo(this.makeHttpRequest(this.http.put(t.path,t.value==null?void 0:t.value)));break;case"DELETE":i=yield Zo(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 Oe(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 o=yield this.executeRestRequest("PUT",{path:t.state,value:{value:"enabled"}});o.statusCode!==200&&console.error(`[Autopilot Widget] Failed to engage after mode '${e}':`,o)}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=Jl[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=ed.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=""},ed.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(""))},ed.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 ue(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 ue(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=q({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&&(l(0,"div",0)(1,"div",1)(2,"button",2),z("click",function(){return i.toggleMenu()}),l(3,"mat-icon",3),te(),l(4,"svg",4)(5,"text",5),d(6),lt(7,"titlecase"),u()()()(),Fe(),l(8,"button",6),z("click",function(){return i.buildAndSendCommand("standby")}),l(9,"mat-icon",3),te(),l(10,"svg",4)(11,"text",7),d(12,"Disengage"),u()()()()(),Fe(),l(13,"div",8),L(14,"app-svg-autopilot",9),l(15,"div",10),te(),l(16,"svg",11),L(17,"text",12)(18,"text",13),u()(),Fe(),l(19,"div",14)(20,"span",15),d(21,"warning"),u(),te(),l(22,"svg",11),L(23,"text",16),u()()(),Fe(),l(24,"div")(25,"button",17),z("click",function(){return i.buildAndSendCommand("-1")}),l(26,"mat-icon",18),te(),l(27,"svg",19)(28,"text",20),d(29,"-1\xB0"),u(),L(30,"path",21),u()()()(),Fe(),l(31,"div")(32,"button",17),z("click",function(){return i.buildAndSendCommand("+1")}),l(33,"mat-icon",18),te(),l(34,"svg",19)(35,"text",22),d(36,"+1\xB0"),u(),L(37,"path",23),u()()()(),Fe(),l(38,"div")(39,"button",17),z("click",function(){return i.buildAndSendCommand("-10")}),l(40,"mat-icon",18),te(),l(41,"svg",19)(42,"text",20),d(43,"-10\xB0"),u(),L(44,"path",24)(45,"path",25),u()()()(),Fe(),l(46,"div")(47,"button",17),z("click",function(){return i.buildAndSendCommand("+10")}),l(48,"mat-icon",18),te(),l(49,"svg",19)(50,"text",22),d(51,"+10\xB0"),u(),L(52,"path",26)(53,"path",27),u()()()(),Fe(),l(54,"div")(55,"button",17),z("click",function(){return i.buildAndSendCommand("tackToPort")}),l(56,"mat-icon",18),te(),l(57,"svg",19)(58,"text",20),d(59,"Tack"),u(),l(60,"g",28),L(61,"path",29)(62,"path",30)(63,"circle",31),u()()()()(),Fe(),l(64,"div")(65,"button",17),z("click",function(){return i.buildAndSendCommand("tackToStarboard")}),l(66,"mat-icon",18),te(),l(67,"svg",19)(68,"text",20),d(69,"Tack"),u(),L(70,"path",29)(71,"path",30)(72,"circle",31),u()()()(),Fe(),l(73,"div"),L(74,"widget-embedded",32),u(),l(75,"div"),L(76,"widget-embedded",32),u(),l(77,"div"),L(78,"widget-embedded",32),u(),l(79,"div"),L(80,"widget-embedded",32),u(),l(81,"div"),O(82,XS,9,11,"button",33),u(),l(83,"div")(84,"button",17),z("click",function(){return i.buildAndSendCommand("route")}),l(85,"mat-icon",18),te(),l(86,"svg",34)(87,"text",35),d(88,"Adv Wpt"),u(),L(89,"path",36)(90,"path",37),u()()()()(),O(91,JS,6,2,"div",38),O(92,ew,1,0,"div",39)),t&2&&(pe("display",i.apGrid()),g(2),I("disabled",i.apState()==="off-line"||i.apMode()==="off-line"),g(4),he("Mode ",Pt(7,62,i.apMode())," \xA0\u22EE"),g(2),Ke(i.apEngaged()?"ap-btn ap-btn-ctrlbar ap-btn-engage":"ap-btn ap-btn-ctrlbar ap-btn-disengage"),I("disabled",i.apEngageBtnDisabled()),g(6),I("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()),g(),pe("visibility",i.countdownOverlayVisibility()),g(2),I("innerHTML",i.countdownOverlayText(),or),g(),pe("visibility",i.countDownValue>=0?"visible":"hidden"),I("innerHTML",i.countDownValue+1,or),g(),pe("visibility",i.errorOverlayVisibility()),g(4),I("innerHTML",i.errorOverlayText(),or),g(),pe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),I("disabled",i.apBtnDisabled()),g(6),pe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),I("disabled",i.apBtnDisabled()),g(6),pe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),I("disabled",i.apBtnDisabled()),g(7),pe("display",i.adjustHdgBtnVisibility()||i.apMode()==="nav"&&i.dodgeModeActive()?"block":"none"),g(),I("disabled",i.apBtnDisabled()),g(7),pe("display",i.tackBtnVisibility()?"block":"none"),g(),I("disabled",i.apBtnDisabled()),g(9),pe("display",i.tackBtnVisibility()?"block":"none"),g(),I("disabled",i.apBtnDisabled()),g(8),pe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),I("widgetProperties",i.nextWptProperties()),g(),pe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),I("widgetProperties",i.etaProperties()),g(),pe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),I("widgetProperties",i.dtwProperties()),g(),pe("display",i.routeBtnVisibility()&&!i.dodgeModeActive()?"block":"none"),g(),I("widgetProperties",i.xteProperties()),g(),pe("display",i.routeBtnVisibility()?"block":"none"),g(),N(i.runtime.options().autopilot.apiVersion==="v2"?82:-1),g(),pe("display",i.routeBtnVisibility()?"block":"none"),g(),I("disabled",i.apBtnDisabled()||i.dodgeModeActive()),g(7),N(i.menuOpen()?91:-1),g(),N(i.dashboard.isDashboardStatic()?-1:92))},dependencies:[Mg,nt,At,at,Qe,_g,kg,wa],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}']})}return n})();var tw=["Core","Gauge","Component","Racing"];var Ls=(()=>{class n{_pluginConfig=A(Mr);_widgetCategories=[...tw];_componentTypeCache=new Map;_componentTypeMap={WidgetNumericComponent:Xu,WidgetTextComponent:Ku,WidgetWindTrendsChartComponent:Ju,WidgetWindComponent:nm,WidgetTutorialComponent:am,WidgetSliderComponent:om,WidgetSimpleLinearComponent:sm,WidgetRacesteerComponent:cm,WidgetRacerTimerComponent:mm,WidgetRacerLineComponent:hm,WidgetRaceTimerComponent:pm,WidgetPositionComponent:gm,WidgetAisRadarComponent:ip,WidgetLabelComponent:ap,WidgetIframeComponent:op,WidgetHorizonComponent:rp,WidgetHeelGaugeComponent:sp,WidgetSteelGaugeComponent:dp,WidgetGaugeNgRadialComponent:fp,WidgetGaugeNgLinearComponent:bp,WidgetGaugeNgCompassComponent:xp,WidgetFreeboardskComponent:lu,WidgetAnchorAlarmComponent:Cp,WidgetDatetimeComponent:Sp,WidgetDataChartComponent:gg,WidgetBooleanSwitchComponent:Ag,WidgetMultiStateSwitchComponent:xg,WidgetZonesStatePanelComponent:Sg,WidgetAutopilotComponent:Tg};_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:"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:"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 o=this._componentTypeMap[i.componentClassName];if(o)return this._componentTypeCache.set(e,o),o}getKipWidgetsWithStatus(){return Oe(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=>Oe(this,null,function*(){let o=yield this._pluginConfig.getPlugin(i);e[i]=o.ok}))),this._widgetDefinition.map(i=>{let o=i.requiredPlugins||[],r=i.anyOfPlugins||[],s=o.map(b=>({name:b,enabled:e[b],required:!0})),c=r.map(b=>({name:b,enabled:e[b],required:!1})),p=[...s,...c],f=s.every(b=>b.enabled);return f&&r.length>0&&(f=c.some(b=>b.enabled)),ue(ne({},i),{isDependencyValid:f,pluginsStatus:p})})})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function iw(n,a){n&1&&(l(0,"span"),d(1,", "),u())}function nw(n,a){if(n&1&&(l(0,"span",8),d(1),l(2,"span",9),d(3),u()(),O(4,iw,2,0,"span")),n&2){let e=a.$implicit,t=a.$index,i=a.$count,o=T(2);I("ngClass",o.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"),Q("title",e.required?"Required":"Optional"),g(),Vt(" ",e.enabled?"\u2714":"\u2716"," ",e.name," "),g(2),X(e.required?"":"(optional)"),g(),N(t!==i-1?4:-1)}}function aw(n,a){if(n&1&&(l(0,"div",7)(1,"span"),d(2,"Plugins:"),u(),Ae(3,nw,5,6,null,null,Le),u()),n&2){let e=T();Sa(e.pluginsStatus().length>0?"margin-bottom: 8px;margin-top: 4px;":""),g(),Ke(e.pluginDependencyValid()?"":"dependency-error"),g(2),ye(e.pluginsStatus())}}var Eg=(()=>{class n{svgIcon=y.required();iconSize=y.required();name=y.required();description=y.required();pluginsStatus=y.required();pluginDependencyValid=y.required();onKeydown(e){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.target.click())}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["widget-list-card"]],hostBindings:function(t,i){t&1&&z("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&&(l(0,"div",0)(1,"div",1),L(2,"mat-icon",2),u(),l(3,"div",3)(4,"p",4),d(5),u(),O(6,aw,5,4,"div",5),l(7,"span",6),d(8),u()()()),t&2&&(Q("aria-disabled",i.pluginDependencyValid()?null:"true"),g(2),pe("width",i.iconSize(),"px")("height",i.iconSize(),"px"),I("svgIcon",i.svgIcon()),g(2),Sa(i.pluginsStatus().length>0?"margin-bottom:0px; margin-top: 4px":""),g(),X(i.name()),g(),N(i.pluginsStatus().length>0?6:-1),g(2),X(i.description()))},dependencies:[zd,Bd,at,Qe],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 ow=(n,a)=>a.selector;function rw(n,a){if(n&1&&(l(0,"mat-button-toggle",1),d(1),u()),n&2){let e=a.$implicit;I("value",e),g(),he(" ",e," ")}}function sw(n,a){if(n&1){let e=xe();l(0,"widget-list-card",3),z("click",function(){let i=J(e).$implicit,o=T();return ee(o.onSelectWidget(i))}),u()}if(n&2){let e=a.$implicit;it("dependency-missing",!e.isDependencyValid),I("svgIcon",e.icon)("iconSize",48)("name",e.name)("description",e.description)("pluginDependencyValid",e.isDependencyValid)("pluginsStatus",e.pluginsStatus)}}var Dg=(()=>{class n{_dialogRef=A(Yi);_widgets=A(Ls);_widgetsList=[];filteredWidgetsList=w([]);_widgetCategory=w("Core");isDependencyValid=w(!0);ngOnInit(){this.loadWidgets()}loadWidgets(){return Oe(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:o,minWidth:r,minHeight:s,defaultWidth:c,defaultHeight:p,category:f,requiredPlugins:b,anyOfPlugins:x,selector:S,componentClassName:_}=e,k=ue(ne({name:t,description:i,icon:o,minWidth:r,minHeight:s,defaultWidth:c,defaultHeight:p,category:f,requiredPlugins:b},x?{anyOfPlugins:x}:{}),{selector:S,componentClassName:_});this._dialogRef.close(k)}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"div")(1,"mat-button-toggle-group",0),z("change",function(r){return i.onCategoryChange(r)}),Ae(2,rw,2,2,"mat-button-toggle",1,Le),u(),l(4,"div"),Ae(5,sw,1,8,"widget-list-card",2,ow),u()()),t&2&&(g(),I("value",i._widgetCategory()),g(),ye(i._widgets.categories),g(3),ye(i.filteredWidgetsList()))},dependencies:[qr,_o,$a,Eg],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 Pg=(()=>{class n{dialogRef=A(Yi);upgradeSvc=A(cu);upgrade(){this.upgradeSvc.runUpgrade(void 0)}startFresh(){this.upgradeSvc.startFresh(),this.dialogRef.close()}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({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&&(l(0,"h2"),d(1,"All New Touch, Mouse, and Keyboard Navigation"),u(),l(2,"p",0)(3,"strong"),d(4,"Heads up:"),u(),d(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(),l(6,"table",1)(7,"thead")(8,"tr")(9,"th"),d(10,"Actions"),u(),l(11,"th"),d(12,"Touch"),u(),l(13,"th"),d(14,"Mouse"),u(),l(15,"th"),d(16,"Keyboard Shortcuts"),u()()(),l(17,"tbody")(18,"tr")(19,"td"),d(20,"Open Actions menu"),u(),l(21,"td"),d(22,"Swipe left"),u(),l(23,"td"),d(24,"Click, drag left, and release"),u(),l(25,"td")(26,"kbd"),d(27,"Shift"),u(),d(28," + "),l(29,"kbd"),d(30,"Ctrl"),u(),d(31," + "),l(32,"kbd",2),d(33,"\u2190"),u(),d(34," (Left Arrow)"),u()(),l(35,"tr")(36,"td"),d(37,"Open Notification menu"),u(),l(38,"td"),d(39,"Swipe right"),u(),l(40,"td"),d(41,"Click, drag right, and release"),u(),l(42,"td")(43,"kbd"),d(44,"Shift"),u(),d(45," + "),l(46,"kbd"),d(47,"Ctrl"),u(),d(48," + "),l(49,"kbd",2),d(50,"\u2192"),u(),d(51," (Right Arrow)"),u()(),l(52,"tr")(53,"td"),d(54,"Cycle through dashboards"),u(),l(55,"td"),d(56,"Swipe up/down"),u(),l(57,"td"),d(58,"Click, drag up/down, and release"),u(),l(59,"td")(60,"kbd"),d(61,"Shift"),u(),d(62," + "),l(63,"kbd"),d(64,"Ctrl"),u(),d(65," + "),l(66,"kbd",2),d(67,"\u2191"),u(),d(68,"/"),l(69,"kbd",2),d(70,"\u2193"),u(),d(71," (Up/Down Arrow)"),u()(),l(72,"tr")(73,"td"),d(74,"Toggle Fullscreen"),u(),l(75,"td"),d(76,"N/A"),u(),l(77,"td"),d(78,"N/A"),u(),l(79,"td")(80,"kbd"),d(81,"Shift"),u(),d(82," + "),l(83,"kbd"),d(84,"Ctrl"),u(),d(85," + "),l(86,"kbd"),d(87,"F"),u()()(),l(88,"tr")(89,"td"),d(90,"Toggle Night mode"),u(),l(91,"td"),d(92,"N/A"),u(),l(93,"td"),d(94,"N/A"),u(),l(95,"td")(96,"kbd"),d(97,"Shift"),u(),d(98," + "),l(99,"kbd"),d(100,"Ctrl"),u(),d(101," + "),l(102,"kbd"),d(103,"N"),u()()(),l(104,"tr")(105,"td"),d(106,"Toggle dashboard edit mode"),u(),l(107,"td"),d(108,"N/A"),u(),l(109,"td"),d(110,"N/A"),u(),l(111,"td")(112,"kbd"),d(113,"Shift"),u(),d(114," + "),l(115,"kbd"),d(116,"Ctrl"),u(),d(117," + "),l(118,"kbd"),d(119,"E"),u()()()()(),l(120,"i"),d(121,"Note that the words Touch and Tap are synonymous with mouse click."),u(),L(122,"br")(123,"br"),l(124,"h2"),d(125,"Migration Limitations"),u(),l(126,"p")(127,"span",0),d(128,"Important:"),u(),d(129," The new widget layout engine is "),l(130,"strong"),d(131,"completely different"),u(),d(132," from the previous version. When you upgrade, your configuration will be migrated, but "),l(133,"strong"),d(134,"the way dashboards and widgets are arranged will change significantly"),u(),d(135,`.
48
+ `),u(),l(136,"ul")(137,"li"),d(138,"All KIP configuration settings will be migrated."),u(),l(139,"li"),d(140,"Each v2 Page layout will become a v3 Dashboard."),u(),l(141,"li"),d(142,"All widgets and their settings will appear in their new dashboards."),u(),l(143,"li")(144,"span",0)(145,"strong"),d(146,"Note:"),u(),d(147," Widget positions, order, and sizes "),l(148,"strong"),d(149,"WILL BE LOST"),u(),d(150,". After upgrading, dashboards will contain small widgets that you must reposition and resize manually."),u()()(),l(151,"p"),d(152,"To upgrade your configuration, follow these steps:"),u(),l(153,"ol")(154,"li"),d(155," As a safety measure, if you are using Signal K authentication, manually back up your configuration. Make a copy of the "),l(156,"code"),d(157,"9.0.0.json"),u(),d(158," files found on the Signal K server in the following folders: "),l(159,"ul")(160,"li")(161,"code"),d(162,"~/.signalk/applicationData/users/(username)/kip/"),u()(),l(163,"li")(164,"code"),d(165,"~/.signalk/applicationData/global/kip/"),u()()()(),l(166,"li"),d(167,"Click the "),l(168,"strong"),d(169,"Upgrade"),u(),d(170," button below."),u(),l(171,"li"),d(172,"Once the upgrade is complete, KIP will restart and display the migrated dashboards."),u(),l(173,"li"),d(174,"Reposition and resize your widgets as needed."),u(),l(175,"li"),d(176,"Once satisfied, delete the "),l(177,"code"),d(178,"9.0.0.json"),u(),d(179," configuration files located in the previously mentioned folders. They are not needed any more."),u()(),l(180,"p"),d(181," For tips and guidance, consult KIP\u2019s in-app "),l(182,"strong"),d(183,"Help"),u(),d(184," section. Most common questions are answered there. If you need support, join the "),l(185,"a",3),d(186,"Signal K #kip Discord channel"),u(),d(187,`.
49
+ `),u(),l(188,"div",4)(189,"button",5),z("click",function(){return i.upgrade()}),d(190,"Upgrade"),u(),l(191,"button",6),z("click",function(){return i.startFresh()}),d(192,"Start Fresh"),u()())},dependencies:[Wt,nt,At],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 lw=(n,a)=>a.id;function dw(n,a){if(n&1){let e=xe();l(0,"div",2),z("click",function(){let i=J(e).$implicit,o=T();return ee(o.selectIcon(i.id))})("keydown.enter",function(){let i=J(e).$implicit,o=T();return ee(o.selectIcon(i.id))})("keydown.space",function(i){let o=J(e).$implicit;return T().selectIcon(o.id),ee(i.preventDefault())}),l(1,"div",3),L(2,"mat-icon",4),u()()}if(n&2){let e=a.$implicit,t=T();it("selected",t.selected()===e.id),Q("aria-label","Select "+e.id+" icon"),g(2),pe("width",64,"px")("height",64,"px"),I("svgIcon",e.id)}}var Ig=(()=>{class n{iconFile=y("assets/svg/icons.svg");currentIcon=y(void 0);selectedIcon=rt();icons=w([]);selected=w("");constructor(){this.loadIcons(),V(()=>{let e=this.currentIcon();W(()=>{e&&this.selected()!==e&&this.selected.set(e)})})}loadIcons(){return Oe(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"),c=[];s.forEach(f=>{let b=f.getAttribute("id");b&&b.startsWith("dashboard-")&&c.push({id:b})}),this.icons.set(c);let p=this.currentIcon();p&&this.selected.set(p)}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=q({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&&(l(0,"div",0),Ae(1,dw,3,8,"div",1,lw),u()),t&2&&(g(),ye(i.icons()))},dependencies:[at,Qe],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 cw(n,a){if(n&1&&(l(0,"button",15),d(1),u()),n&2){let e=T(),t=Tt(1);I("disabled",!t.valid),g(),X(e.data.confirmBtnText)}}var Og=(()=>{class n{dialogRef=A(Yi);data=A(Qt);_settings=A(Ot);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=q({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 o=xe();l(0,"form",1,0),z("ngSubmit",function(){return i.save()}),l(2,"div",2)(3,"h5",3),d(4),u(),l(5,"button",4)(6,"mat-icon"),d(7,"close"),u()()(),l(8,"mat-dialog-content")(9,"div",5)(10,"mat-form-field",6)(11,"mat-label"),d(12,"Display Name"),u(),l(13,"input",7),sn("ngModelChange",function(s){return J(o),rn(i.data.name,s)||(i.data.name=s),ee(s)}),u(),l(14,"mat-error"),d(15," A name is required "),u()(),l(16,"mat-checkbox",8),sn("ngModelChange",function(s){return J(o),rn(i.data.collapseSplitShell,s)||(i.data.collapseSplitShell=s),ee(s)}),d(17," Auto-collapse Freeboard-SK panel when displaying this dashboard. "),u()(),l(18,"div",9)(19,"span",10),d(20,"Icon Gallery"),u(),l(21,"div",11)(22,"select-icon",12),z("selectedIcon",function(s){return i.onIconSelected(s)}),u()()()(),l(23,"mat-dialog-actions",13)(24,"button",14),d(25),u(),O(26,cw,2,2,"button",15),u()()}t&2&&(g(4),X(i.data.title),g(),I("mat-dialog-close",!1),g(8),on("ngModel",i.data.name),g(3),on("ngModel",i.data.collapseSplitShell),I("disabled",!i.isSplitShellEnabled()),g(6),I("iconFile","assets/svg/icons.svg")("currentIcon",i.data.icon),g(2),I("mat-dialog-close",!1),g(),X(i.data.cancelBtnText),g(),N(i.data.confirmBtnText?26:-1))},dependencies:[Wt,bi,Ai,Mn,yi,at,Qe,xi,Mt,_t,Dn,Ci,kt,nt,At,It,St,Ea,yt,dt,Nt,Ct,kn,wr,Ig,Xt,Bt],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})();var uw=["historyCanvas"];function mw(n,a){n&1&&(l(0,"p",11),d(1,"Loading historical data\u2026"),u())}function hw(n,a){if(n&1&&(l(0,"p",12),d(1),u()),n&2){let e=T();g(),X(e.error())}}function pw(n,a){n&1&&(l(0,"p",11),d(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 gw(n,a){n&1&&(l(0,"div",13),L(1,"canvas",null,0),u())}gt.register(Rn,Vn,Fn,Wn,en,Kc,Xc);var Ng=(()=>{class n{historyApiClient=A(Or);historyMapper=A(Nr);app=A(wi);destroyRef=A(tt);units=A(ot);data=A(Qt);chartCanvas=ce("historyCanvas");theme=vi(this.app.cssThemeColorRoles$,{requireSync:!0});loading=w(!0);error=w(null);datasetCount=w(0);selectedPeriod=pr("PT1H");hasNoData=ie(()=>!this.loading()&&!this.error()&&this.datasetCount()===0);chart=null;viewReady=!1;pendingDatasets=[];constructor(){V(()=>{let e=this.chartCanvas(),t=this.loading(),i=this.datasetCount();!e||t||i<=0||W(()=>{this.tryRenderChart()})})}loadHistoryDatasets(){return Oe(this,null,function*(){this.loading.set(!0),this.error.set(null);try{let e=yield Promise.all(this.data.seriesDefinitions.map((t,i)=>this.buildDatasetForSeries(t,i)));this.pendingDatasets=e.filter(t=>!!t),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 Oe(this,null,function*(){let i=e.path;if(!i)return null;let o=this.resolveDuration(e),r=this.resolveResolutionSeconds(o),s=this.buildHistoryRequestCandidates(i,e.context),c=[],p=this.normalizeHistoryPath(i),f=this.data.widget?.config,b=null;if(f){if(f.paths&&typeof f.paths=="object")for(let R of Object.keys(f.paths)){let G=f.paths[R];if(G?.path===i&&G.convertUnitTo){b=G.convertUnitTo;break}}!b&&f.convertUnitTo&&(b=f.convertUnitTo)}for(let R of s){let G=yield this.historyApiClient.getValues({paths:R.paths,context:R.context,duration:o,resolution:r});if(!G?.data?.length)continue;if(c=this.historyMapper.mapValuesToChartDatapoints(G,{unit:"number",domain:"scalar"}).map(K=>{let Y=K.data.value;return b&&typeof Y=="number"&&Number.isFinite(Y)&&(Y=this.units.convertToUnit(b,Y)),{x:K.timestamp,y:Y}}),c.length){p=R.labelPath;break}}if(!c.length)return null;let x=this.data.widget?.config?.color||"blue",S=[this.theme().green,this.theme().orange,this.theme().pink,this.theme().purple,this.theme().yellow,this.theme().grey,this.theme().blue,this.theme().contrast],_=S.findIndex(R=>R?.toLowerCase()===this.theme()[x].toLowerCase());_!==-1?S=[S[_],...S.slice(0,_),...S.slice(_+1)]:S=[x,...S];let k=S[t%S.length],B=e.source?` (${e.source})`:"";return{label:`${p}${B}`,data:c,borderColor:k,backgroundColor:k,pointRadius:0,borderWidth:2,tension:.25,fill:!1}})}buildHistoryRequestCandidates(e,t){let i=this.normalizeHistoryPath(e),o=this.resolveHistoryContext(e,t),r=[...new Set([i].filter(c=>c.length>0))],s=[];return r.forEach(c=>{s.push({paths:`${c}:avg`,context:o,labelPath:this.normalizeHistoryPath(c)})}),s}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="",i=this.data.widget?.config,o=null;if(i){if(i.paths&&typeof i.paths=="object"){let s=Object.keys(i.paths)[0];s&&i.paths[s]?.convertUnitTo&&(o=i.paths[s].convertUnitTo)}!o&&i.convertUnitTo&&(o=i.convertUnitTo)}t=this.getUnitsLabel(o);let r={type:"line",data:{datasets:this.pendingDatasets},options:{responsive:!0,maintainAspectRatio:!1,parsing:!1,interaction:{mode:"nearest",intersect:!1,axis:"x"},scales:{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}},y:{ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer},title:{display:!!t,text:t?`${t}`:"",color:this.theme().contrastDim}}},plugins:{legend:{labels:{color:this.theme().contrastDim}}}}};this.chart=new gt(e.nativeElement.getContext("2d"),r)}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)),o=e.trim().toLowerCase(),r=o.match(/^last\s+(\d+)\s+([a-z]+)/i);if(r){let s=Number(r[1]),c=r[2];if(Number.isFinite(s)&&s>0)return this.durationFromToken(c,s)}return this.durationFromToken(o,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 o=Number(i[1]??0),r=Number(i[2]??0),s=Number(i[3]??0),c=Number(i[4]??0);return o*86400+r*3600+s*60+c}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=q({type:n,selectors:[["widget-history-chart-dialog"]],viewQuery:function(t,i){t&1&&Ce(i.chartCanvas,uw,5),t&2&&Se()},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,"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,"history-dialog-content"],[1,"history-message"],[1,"history-message","error"],[1,"chart-wrapper"]],template:function(t,i){t&1&&(l(0,"div",1)(1,"h5",2),d(2),u(),l(3,"button",3)(4,"mat-icon"),d(5,"close"),u()()(),l(6,"mat-dialog-content")(7,"div",4)(8,"mat-button-toggle-group",5),sn("ngModelChange",function(r){return rn(i.selectedPeriod,r)||(i.selectedPeriod=r),r}),l(9,"mat-button-toggle",6),z("click",function(){return i.setPeriod("PT15M")}),d(10,"15 Minutes"),u(),l(11,"mat-button-toggle",7),z("click",function(){return i.setPeriod("PT1H")}),d(12,"1 Hour"),u(),l(13,"mat-button-toggle",8),z("click",function(){return i.setPeriod("PT8H")}),d(14,"8 Hours"),u(),l(15,"mat-button-toggle",9),z("click",function(){return i.setPeriod("PT24H")}),d(16,"24 Hours"),u()()(),l(17,"div",10),O(18,mw,2,0,"p",11)(19,hw,2,1,"p",12)(20,pw,2,0,"p",11)(21,gw,3,0,"div",13),u()()),t&2&&(g(2),X(i.data.title),g(),I("mat-dialog-close",!1),g(5),on("ngModel",i.selectedPeriod),g(10),N(i.loading()?18:i.error()?19:i.hasNoData()?20:21))},dependencies:[Wt,bi,Ai,yi,qr,_o,$a,nt,It,at,Qe,St,dt,kn],styles:[".dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}.history-dialog-content[_ngcontent-%COMP%]{display:flex;min-width:70vw;min-height:55vh;padding-top:0;justify-content:center;align-items:center}.chart-wrapper[_ngcontent-%COMP%]{position:relative;width:100%;height:55vh}.history-message[_ngcontent-%COMP%]{margin:0;padding:1rem 0}.error[_ngcontent-%COMP%]{color:var(--mat-sys-error)}.time-select[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0})}return n})();var np=(()=>{class n{dialog=A(_c);openFrameDialog(e,t){switch(e.component){case"select-widget":e.componentType=Dg;break;case"upgrade-config":e.componentType=Pg;break;case"ais-target":e.componentType=ws;break}return this.dialog.open(Js,{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(Js,{panelClass:"ais-dialog-panel",data:e,height:"",width:"",maxWidth:"",maxHeight:""}).afterClosed()}openConfirmationDialog(e){return this.dialog.open(uu,{data:e,minWidth:"35vw",minHeight:"25vh"}).afterClosed()}openNameDialog(e){return this.dialog.open(mu,{data:e,minWidth:"20vw",minHeight:"20vh",disableClose:!1})}openDashboardPageEditorDialog(e){return this.dialog.open(Og,{data:e,minWidth:"60vw",maxWidth:"90vw",maxHeight:"95vh",disableClose:!1})}openWidgetOptions(e){return this.dialog.open(Bu,{data:e.config,minWidth:"50vw",maxWidth:"90vw",closeOnNavigation:!0})}openWidgetHistoryDialog(e){return this.dialog.open(Ng,{data:e,minWidth:"70vw",maxWidth:"95vw",maxHeight:"95vh",disableClose:!1})}static \u0275fac=function(t){return new(t||n)};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();function fw(n,a){}var Rg="_mat-bottom-sheet-enter",Lg="_mat-bottom-sheet-exit",vw=(()=>{class n extends Cc{_breakpointSubscription;_animationsDisabled=ji();_animationState="void";_animationStateChanged=new Zt;_destroyed=!1;constructor(){super();let e=A(Ma);this._breakpointSubscription=e.observe([Pi.Medium,Pi.Large,Pi.XLarge]).subscribe(()=>{let t=this._elementRef.nativeElement.classList;t.toggle("mat-bottom-sheet-container-medium",e.isMatched(Pi.Medium)),t.toggle("mat-bottom-sheet-container-large",e.isMatched(Pi.Large)),t.toggle("mat-bottom-sheet-container-xlarge",e.isMatched(Pi.XLarge))})}enter(){this._destroyed||(this._animationState="visible",this._changeDetectorRef.markForCheck(),this._changeDetectorRef.detectChanges(),this._animationsDisabled&&this._simulateAnimation(Rg))}exit(){this._destroyed||(this._elementRef.nativeElement.setAttribute("mat-exit",""),this._animationState="hidden",this._changeDetectorRef.markForCheck(),this._animationsDisabled&&this._simulateAnimation(Lg))}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===Rg;(i||t===Lg)&&this._animationStateChanged.emit({toState:i?"visible":"hidden",phase:e?"start":"done"})}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=q({type:n,selectors:[["mat-bottom-sheet-container"]],hostAttrs:["tabindex","-1",1,"mat-bottom-sheet-container"],hostVars:9,hostBindings:function(t,i){t&1&&z("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&&(Q("role",i._config.role)("aria-modal",i._config.ariaModal)("aria-label",i._config.ariaLabel),it("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:[mo],decls:1,vars:0,consts:[["cdkPortalOutlet",""]],template:function(t,i){t&1&&ui(0,fw,0,0,"ng-template",0)},dependencies:[oc],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})(),bw=new an("MatBottomSheetData"),td=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},Vs=class{_ref;get instance(){return this._ref.componentInstance}get componentRef(){return this._ref.componentRef}containerInstance;disableClose;_afterOpened=new Yt;_result;_closeFallbackTimeout;constructor(a,e,t){this._ref=a,this.containerInstance=t,this.disableClose=e.disableClose,t._animationStateChanged.pipe(di(i=>i.phase==="done"&&i.toState==="visible"),ci(1)).subscribe(()=>{this._afterOpened.next(),this._afterOpened.complete()}),t._animationStateChanged.pipe(di(i=>i.phase==="done"&&i.toState==="hidden"),ci(1)).subscribe(()=>{clearTimeout(this._closeFallbackTimeout),this._ref.close(this._result)}),a.overlayRef.detachments().subscribe(()=>{this._ref.close(this._result)}),li(this.backdropClick(),this.keydownEvents().pipe(di(i=>i.keyCode===27))).subscribe(i=>{!this.disableClose&&(i.type!=="keydown"||!wn(i))&&(i.preventDefault(),this.dismiss())})}dismiss(a){this.containerInstance&&(this.containerInstance._animationStateChanged.pipe(di(e=>e.phase==="start"),ci(1)).subscribe(()=>{this._closeFallbackTimeout=setTimeout(()=>this._ref.close(this._result),500),this._ref.overlayRef.detachBackdrop()}),this._result=a,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}},Aw=new an("mat-bottom-sheet-default-options"),yw=(()=>{class n{_injector=A(uo);_parentBottomSheet=A(n,{optional:!0,skipSelf:!0});_animationsDisabled=ji();_defaultOptions=A(Aw,{optional:!0});_bottomSheetRefAtThisLevel=null;_dialog=A(Sc);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 td),t),o;return this._dialog.open(e,ue(ne({},i),{disableClose:!0,closeOnOverlayDetachments:!1,maxWidth:"100%",container:vw,scrollStrategy:i.scrollStrategy||dc(this._injector),positionStrategy:hc(this._injector).centerHorizontally().bottom("0"),disableAnimations:this._animationsDisabled,templateContext:()=>({bottomSheetRef:o}),providers:(r,s,c)=>(o=new Vs(r,i,c),[{provide:Vs,useValue:o},{provide:bw,useValue:i.data}])})),o.afterDismissed().subscribe(()=>{this._openedBottomSheetRef===o&&(this._openedBottomSheetRef=null)}),this._openedBottomSheetRef?(this._openedBottomSheetRef.afterDismissed().subscribe(()=>o.containerInstance?.enter()),this._openedBottomSheetRef.dismiss()):o.containerInstance.enter(),this._openedBottomSheetRef=o,o}dismiss(e){this._openedBottomSheetRef&&this._openedBottomSheetRef.dismiss(e)}ngOnDestroy(){this._bottomSheetRefAtThisLevel&&this._bottomSheetRefAtThisLevel.dismiss()}static \u0275fac=function(t){return new(t||n)};static \u0275prov=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})(),FF=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=Ui({type:n});static \u0275inj=Gi({providers:[yw],imports:[wc,rc,_n]})}return n})();var Vg=[["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"]],bn=(()=>{if(typeof document>"u")return!1;let n=Vg[0],a={};for(let e of Vg)if(e?.[1]in document){for(let[i,o]of e.entries())a[n[i]]=o;return a}return!1})(),Wg={change:bn.fullscreenchange,error:bn.fullscreenerror},ri={request(n=document.documentElement,a){return new Promise((e,t)=>{let i=()=>{ri.off("change",i),e()};ri.on("change",i);let o=n[bn.requestFullscreen](a);o instanceof Promise&&o.then(i).catch(t)})},exit(){return new Promise((n,a)=>{if(!ri.isFullscreen){n();return}let e=()=>{ri.off("change",e),n()};ri.on("change",e);let t=document[bn.exitFullscreen]();t instanceof Promise&&t.then(e).catch(a)})},toggle(n,a){return ri.isFullscreen?ri.exit():ri.request(n,a)},onchange(n){ri.on("change",n)},onerror(n){ri.on("error",n)},on(n,a){let e=Wg[n];e&&document.addEventListener(e,a,!1)},off(n,a){let e=Wg[n];e&&document.removeEventListener(e,a,!1)},raw:bn};Object.defineProperties(ri,{isFullscreen:{get:()=>!!document[bn.fullscreenElement]},element:{enumerable:!0,get:()=>document[bn.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>!!document[bn.fullscreenEnabled]}});bn||(ri={isEnabled:!1});var Vi=ri;var xw="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",Cw="data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw",id=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.")}},nd=class{constructor(){this.enabled=!1;let a=()=>this.wakeLock&&document.visibilityState==="visible"&&this.enable();document.addEventListener("visibilitychange",a),document.addEventListener("fullscreenchange",a)}enable(){return Oe(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(a){this.enabled=!1,a instanceof Error&&console.error(`${a.name}, ${a.message}`)}})}disable(){this.wakeLock?.release(),this.wakeLock=void 0,this.enabled=!1}},ad=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",xw),this._addSourceToVideo(this.noSleepVideo,"mp4",Cw),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(a,e,t){let i=document.createElement("source");i.src=t,i.type=`video/${e}`,a.appendChild(i)}enable(){return Oe(this,null,function*(){let a=this.noSleepVideo.play();try{let e=yield a;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 Sw(){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 ww(n,a){return n[0]>a[0]||n[0]===a[0]&&n[1]>=a[1]}function _w(){if(!("wakeLock"in navigator))return!1;let n=Sw();return n?!navigator.standalone||ww(n,[18,4]):!0}var Fg=typeof navigator>"u"?id:_w()?nd:ad;var ZF=(()=>{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(Vi.isFullscreen),!Vi.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)):(Vi.isEnabled?Vi.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 Fg),!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(Vi.isEnabled){if(this.fullscreenStatus()){if(Vi.isFullscreen&&Vi.exit(),this.noSleepStatus()){try{this.noSleep?.disable()}catch(e){}this.noSleepStatus.set(!1)}}else if(Vi.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 o=Math.abs(t.clientX-this.initialTouchX),r=Math.abs(t.clientY-this.initialTouchY);o>10&&o>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=o=>{if(o instanceof KeyboardEvent){let r=o.key.toLowerCase();if(t&&(t.keys&&!t.keys.includes(r)||t.ctrlKey!==void 0&&o.ctrlKey!==t.ctrlKey||t.shiftKey!==void 0&&o.shiftKey!==t.shiftKey))return;e(r,o)}else console.warn("[uiEvent Service] Non-keyboard event detected in addHotkeyListener:",o)};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(Vi.isEnabled)try{Vi.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=st({token:n,factory:n.\u0275fac,providedIn:"root"})}return n})();export{Rr as a,mt as b,tn as c,be as d,Ne as e,Ha as f,Bn as g,ei as h,ru as i,lu as j,du as k,$V as l,_g as m,Ls as n,cu as o,np as p,bw as q,Vs as r,yw as s,FF as t,ZF as u};