@mxtommy/kip 4.8.2 → 4.8.4

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 (66) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +27 -4
  3. package/public/{chunk-BIYHVfJl.js → chunk-07zHjmg-.js} +1 -1
  4. package/public/{chunk-NnB8OYZt.js → chunk-0z3nIRXw.js} +1 -1
  5. package/public/{chunk-CCiqU2uY.js → chunk-B09jfNia.js} +1 -1
  6. package/public/{chunk-Bq-eHuZV.js → chunk-B0D54iJs.js} +1 -1
  7. package/public/{chunk-DfGLo6Tb.js → chunk-B0eE4udE.js} +1 -1
  8. package/public/{chunk-CkfPr-c5.js → chunk-B9nVBlGj.js} +1 -1
  9. package/public/{chunk-B8zRhoG8.js → chunk-BFpzxIIT.js} +1 -1
  10. package/public/{chunk-D_wrJJxl.js → chunk-BIb-xYiS.js} +1 -1
  11. package/public/{chunk-CSpA60X7.js → chunk-BJ-wyixK.js} +1 -1
  12. package/public/{chunk-Bb1mO304.js → chunk-BLEZOsfR.js} +1 -1
  13. package/public/{chunk-7lulvsGI.js → chunk-BN7A4g6c.js} +1 -1
  14. package/public/{chunk-h2q_pbbF.js → chunk-BTOTKeBo.js} +1 -1
  15. package/public/{chunk-DjavLLpP.js → chunk-BUguZ7cK.js} +1 -1
  16. package/public/{chunk-B8gfh4xf.js → chunk-BZx964-p.js} +1 -1
  17. package/public/{chunk-CcvYOops.js → chunk-BeM64etA.js} +1 -1
  18. package/public/{chunk-DSvdWjO4.js → chunk-BfiyH3nV.js} +1 -1
  19. package/public/{chunk-B_PiPxb4.js → chunk-BjINKQ03.js} +1 -1
  20. package/public/{chunk-BdBWqZzL.js → chunk-BpcNrtxJ.js} +1 -1
  21. package/public/{chunk-C4FGoLDg.js → chunk-BuvyF0y5.js} +1 -1
  22. package/public/{chunk-DGOvRnAo.js → chunk-C6b8CVno.js} +1 -1
  23. package/public/{chunk-BgyxBAyq.js → chunk-CCfhzpE8.js} +1 -1
  24. package/public/{chunk-CoEM_FqS.js → chunk-CHAFm_nM.js} +1 -1
  25. package/public/{chunk-D0MyVrEL.js → chunk-CIGP2YJm.js} +1 -1
  26. package/public/{chunk-Bhah8DNM.js → chunk-CLTHuhlN.js} +1 -1
  27. package/public/{chunk-B6XxnPxk.js → chunk-CLs_NL1y.js} +1 -1
  28. package/public/{chunk-Cr34s2uQ.js → chunk-COI6IBXH.js} +1 -1
  29. package/public/{chunk-BxV0O2fU.js → chunk-CQMVIDcp.js} +1 -1
  30. package/public/{chunk-CHKQxw6E.js → chunk-CXvWM_vF.js} +1 -1
  31. package/public/{chunk-Di5pPpU7.js → chunk-CYYBxjrc.js} +1 -1
  32. package/public/{chunk-BW4m3O2L.js → chunk-C_OZJltF.js} +1 -1
  33. package/public/{chunk-CjsnWLUr.js → chunk-Co2wVrD6.js} +1 -1
  34. package/public/{chunk-DMhuBqKs.js → chunk-CoCQ3DW2.js} +1 -1
  35. package/public/{chunk-DMoEBcor.js → chunk-CxPx4NZv.js} +1 -1
  36. package/public/{chunk-CdSWuWKr.js → chunk-CyVRpGoJ.js} +1 -1
  37. package/public/{chunk-Dv77RFHm.js → chunk-D-_-GUVr.js} +1 -1
  38. package/public/{chunk-CU8RPnsi.js → chunk-D1HYfaL_.js} +1 -1
  39. package/public/{chunk-DBA0eRqb.js → chunk-D2953Rfp.js} +1 -1
  40. package/public/{chunk-Cu9FE8cB.js → chunk-DIl1k00y.js} +1 -1
  41. package/public/{chunk-CyURmwWh.js → chunk-DPnbM-aB.js} +1 -1
  42. package/public/{chunk-8hkXyEzG.js → chunk-DTN-sa1K.js} +1 -1
  43. package/public/{chunk-C3CwUYvD.js → chunk-DUEKoZhd.js} +1 -1
  44. package/public/{chunk-COMZv7NY.js → chunk-DmkAKXR1.js} +1 -1
  45. package/public/{chunk-zg7II0hz.js → chunk-Do8wqING.js} +1 -1
  46. package/public/{chunk-oPq9Nexl.js → chunk-JhFkJS7i.js} +1 -1
  47. package/public/{chunk-CJIxuzvd.js → chunk-OeQDZKFO.js} +1 -1
  48. package/public/{chunk-Bz9bswDl.js → chunk-_zRMMvCu.js} +1 -1
  49. package/public/{chunk-D-xDPCf7.js → chunk-eQ1pa34Q.js} +1 -1
  50. package/public/{chunk-DVB9tiW3.js → chunk-ibauGmSP.js} +1 -1
  51. package/public/{chunk-oZiyAw_P.js → chunk-otzyItXL.js} +1 -1
  52. package/public/{chunk-B6AwCAvV.js → chunk-q9NoPvcx.js} +1 -1
  53. package/public/{chunk-B15lj2T8.js → chunk-szQs8fiq.js} +1 -1
  54. package/public/{chunk-o977r5_s.js → chunk-x7L6DXVK.js} +1 -1
  55. package/public/index.html +1 -1
  56. package/public/{main-BNR44HGB.js → main-YKDNK5VZ.js} +4 -4
  57. package/plugin/history-series.service.js +0 -637
  58. package/plugin/index.js +0 -1322
  59. package/plugin/kip-series-contract.js +0 -31
  60. package/plugin/openApi.json +0 -855
  61. package/plugin/sqlite-history-storage.service.js +0 -1124
  62. package/plugin/src/history-series.service.js +0 -634
  63. package/plugin/src/index.js +0 -1322
  64. package/plugin/src/kip-series-contract.js +0 -31
  65. package/plugin/src/openApi.json +0 -855
  66. package/plugin/src/sqlite-history-storage.service.js +0 -1122
@@ -1 +1 @@
1
- import {v,R,S}from'./chunk-CQNVyz8q.js';import {d1 as Hj,w,du as p,dv as rt$1,v as vt,D as Dt,F as Fa,dn as ge,J as JD,c as $h,B as Bh,$ as $j,ao as ue,dz as es,cn as wd,ci as dl,cp as Uh,cj as fl,T as TT,bD as HT,e as EE,d as ig,an as Hh,bp as gl,dA as UT,aA as gg,f as eg,K as Kw,aI as ms}from'./main-BNR44HGB.js';var it=["rotatingDial"],at=["twaIndicator"],ot=["wptIndicator"],rt=["setIndicator"],st=["tackIndicator"],Q=([y,K],[t,n],[e,a])=>(Math.atan2(a-n,e-t)-Math.atan2(K-n,y-t)+3*Math.PI)%(2*Math.PI)-Math.PI,J=(()=>{class y{rotatingDial=$j.required("rotatingDial");twaIndicator=$j.required("twaIndicator");wptIndicator=$j.required("wptIndicator");setIndicator=$j.required("setIndicator");tackIndicator=$j.required("tackIndicator");compassHeading=Hj.required();tackTrue=Hj.required();polarSpeedRatio=Hj.required();trueWindAngle=Hj.required();trueWindSpeed=Hj.required();targetAngle=Hj.required();optimalWindAngle=Hj.required();targetVMG=Hj.required();VMG=Hj.required();sailSetupEnabled=Hj.required();driftEnabled=Hj.required();driftSet=Hj();driftFlow=Hj();waypointEnabled=Hj.required();waypointAngle=Hj();vmgToWaypoint=Hj();trueWindMinHistoric=Hj();trueWindMidHistoric=Hj();trueWindMaxHistoric=Hj();gradianColor=Hj.required();compass={oldValue:0,newValue:0};twa={oldValue:0,newValue:0};wpt={oldValue:0,newValue:0};tack={oldValue:0,newValue:0};set={oldValue:0,newValue:0};compassInitialized=false;twaInitialized=false;wptInitialized=false;tackInitialized=false;setInitialized=false;laylinesInitialized=false;headingValue=vt("--");windSectorsInitialized=false;trueWindHeading=0;nextTargetDirection=Dt(()=>{let t=this.compassHeading(),n=this.tackTrue();return t==null||n==null?0:this.unsignedAngleDelta(t,n)});trueWindSpeedDisplay=Dt(()=>{let t=this.trueWindSpeed();return t==null?"--":t.toFixed(1)});windAnglePerformanceRatioColor=Dt(()=>{let t=this.optimalWindAngle(),n=this.targetAngle(),e=this.gradianColor().start,a=this.gradianColor().stop;if(t==null||n==null)return e;let i=1-Math.abs(t-n)/180;return this.interpolateColor(e,a,i)});targetVMGOffset=Dt(()=>{let t=this.VMG(),n=this.targetVMG();return t==null||n==null?"--":(t-n).toFixed(1)});targetVMGOffsetRatioColor=Dt(()=>{let t=this.VMG(),n=this.targetVMG(),e=this.gradianColor().start,a=this.gradianColor().stop;if(t==null||n==null)return e;let i=t/n;return this.interpolateColor(e,a,i)});waypointActive=vt(false);flow=Dt(()=>{let t=this.driftFlow();return t==null?"--":t.toFixed(1)});portLaylinePrev=0;stbdLaylinePrev=0;portLaylineAnimId=null;stbdLaylineAnimId=null;CENTER_X=600;CENTER_Y=620;RADIUS=540;ANIMATION_DURATION=1e3;laylinePortPath=vt(`M ${this.CENTER_X},${this.CENTER_Y} ${this.CENTER_X},${this.CENTER_Y}`);laylineStbdPath=vt(`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=vt("");stbdWindSectorPath=vt("");speedLineTipY=vt(620);speedTipPoints=vt("600,570 580,600 620,600");speedRatioColor=vt("");speedLinePrevRatio=0;speedLinePrevTipY=600;speedLineAnimId=null;speedLineInitialized=false;animationFrameIds=new WeakMap;ngZone=w(ue);setRotationImmediate(t,n){t.setAttribute("transform",`rotate(${n} 600 620)`);}constructor(){Fa(()=>{let t=this.waypointEnabled();ge(()=>{this.waypointActive.set(t);});}),Fa(()=>{let t=this.compassHeading(),n=Number.isFinite(t)?Math.round(t):null;n!=null&&ge(()=>{this.compassInitialized?(this.compass.oldValue=this.compass.newValue,this.compass.newValue=n):(this.compass.oldValue=n,this.compass.newValue=n,this.compassInitialized=true),this.headingValue.set(n.toString()),this.rotatingDial()?.nativeElement&&(this.compass.oldValue===this.compass.newValue?this.setRotationImmediate(this.rotatingDial().nativeElement,-this.compass.newValue):S(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateWindSectors());});}),Fa(()=>{let t=this.targetAngle(),n=Number.isFinite(t)?Math.round(t):null;n!=null&&ge(()=>{this.tackInitialized?(this.tack.oldValue=this.tack.newValue,this.tack.newValue=n):(this.tack.oldValue=n,this.tack.newValue=n,this.tackInitialized=true),this.tackIndicator()?.nativeElement&&(this.tack.oldValue===this.tack.newValue?this.setRotationImmediate(this.tackIndicator().nativeElement,this.tack.newValue):S(this.tackIndicator().nativeElement,this.tack.oldValue,this.tack.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620])),this.updateLaylines();});}),Fa(()=>{let t=this.waypointAngle();ge(()=>{if(!t){this.waypointActive.set(false);return}this.waypointEnabled()?this.waypointActive.set(true):this.waypointActive.set(false),this.wptInitialized?(this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=t):(this.wpt.oldValue=t,this.wpt.newValue=t,this.wptInitialized=true),this.wptIndicator()?.nativeElement&&(this.wpt.oldValue===this.wpt.newValue?this.setRotationImmediate(this.wptIndicator().nativeElement,this.wpt.newValue):S(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620]));});}),Fa(()=>{let t=this.trueWindAngle(),n=Number.isFinite(t)?Math.round(t):null,e=this.compassHeading(),a=Number.isFinite(e)?Math.round(e):null;n==null||a==null||ge(()=>{this.trueWindHeading=n;let i=this.addHeading(this.trueWindHeading,a*-1);this.twaInitialized?(this.twa.oldValue=this.twa.newValue,this.twa.newValue=i):(this.twa.oldValue=i,this.twa.newValue=i,this.twaInitialized=true),this.twaIndicator()?.nativeElement&&(this.twa.oldValue===this.twa.newValue?this.setRotationImmediate(this.twaIndicator().nativeElement,this.twa.newValue):S(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateLaylines());});}),Fa(()=>{let t=this.polarSpeedRatio(),n=Math.max(0,Math.min(1,t)),e=620,i=e-166,r=e-i*n;if(!this.speedLineInitialized){this.speedLineInitialized=true,this.speedLineTipY.set(r);let f=30,w=20,g=r-f;this.speedTipPoints.set(`600,${g} ${600-w},${r} ${600+w},${r}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,n)),this.speedLinePrevTipY=r,this.speedLinePrevRatio=n;return}this.animateSpeedLine(this.speedLinePrevTipY,r),this.speedLinePrevTipY=r,this.speedLinePrevRatio=n;}),Fa(()=>{let t=this.driftSet(),n=Number.isFinite(t)?Math.round(t):null;n!=null&&ge(()=>{this.setInitialized?(this.set.oldValue=this.set.newValue,this.set.newValue=n):(this.set.oldValue=n,this.set.newValue=n,this.setInitialized=true),this.setIndicator()?.nativeElement&&(this.set.oldValue===this.set.newValue?this.setRotationImmediate(this.setIndicator().nativeElement,this.set.newValue):S(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone));});});}updateLaylines(){if(!this.twaInitialized)return;let t=this.targetAngle(),n=Number.isFinite(t)?Math.round(t):null;if(n==null)return;n=n/2;let e=Number(this.twa.newValue),a=e-n,i=e+n;if(!this.laylinesInitialized){this.laylinesInitialized=true,this.setLaylinePath(a,true),this.setLaylinePath(i,false),this.portLaylinePrev=a,this.stbdLaylinePrev=i;return}this.animateLayline(this.portLaylinePrev,a,true),this.portLaylinePrev=a,this.animateLayline(this.stbdLaylinePrev,i,false),this.stbdLaylinePrev=i;}animateLayline(t,n,e){e&&this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),!e&&this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId);let a=()=>{e?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;},i=v(t,n,this.ANIMATION_DURATION,r=>this.setLaylinePath(r,e),a,this.ngZone);e?this.portLaylineAnimId=i:this.stbdLaylineAnimId=i;}updateWindSectors(){if(this.trueWindMinHistoric()==null||this.trueWindMidHistoric()==null||this.trueWindMaxHistoric()==null)return;let t={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()},n={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()};if(!this.windSectorsInitialized){this.portSectorPrev=t,this.stbdSectorPrev=n,this.windSectorsInitialized=true,this.animateWindSector(t,t,true),this.animateWindSector(n,n,false);return}this.animateWindSector(this.portSectorPrev,t,true),this.animateWindSector(this.stbdSectorPrev,n,false),this.portSectorPrev=t,this.stbdSectorPrev=n;}animateWindSector(t,n,e){e&&this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),!e&&this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId);let a=()=>{e?this.portSectorAnimId=null:this.stbdSectorAnimId=null;},i=R(t,n,this.ANIMATION_DURATION,r=>this.setWindSectorPath(r,e),a,this.ngZone);e?this.portSectorAnimId=i:this.stbdSectorAnimId=i;}animateSpeedLine(t,n){this.speedLineAnimId&&(cancelAnimationFrame(this.speedLineAnimId),this.speedLineAnimId=null);let e=1e3,a=performance.now(),i=this.speedLinePrevRatio,r=(600-n)/454,f=g=>g<.5?4*g*g*g:1-Math.pow(-2*g+2,3)/2,w=g=>{let E=g-a,x=Math.min(E/e,1),I=f(x),S=(H,et)=>H+(et-H)*I,v=S(t,n),R=S(i,r);this.speedLineTipY.set(v);let D=30,P=20,tt=v-D;this.speedTipPoints.set(`600,${tt} ${600-P},${v} ${600+P},${v}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,R)),x<1?this.speedLineAnimId=requestAnimationFrame(w):this.speedLineAnimId=null;};requestAnimationFrame(w);}interpolateColor(t,n,e){e=Math.max(0,Math.min(1,e));function a(v){v=v.replace("#",""),v.length===3&&(v=v.split("").map(D=>D+D).join(""));let R=parseInt(v,16);return [R>>16&255,R>>8&255,R&255]}let[i,r,f]=a(t),[w,g,E]=a(n),x=Math.round(i+(w-i)*e),I=Math.round(r+(g-r)*e),S=Math.round(f+(E-f)*e);return `rgb(${x},${I},${S})`}addHeading(t=0,n=0){return ((t+n)%360+360)%360}unsignedAngleDelta(t,n){let e=(t-n+540)%360-180;return Math.abs(e)}normalizeAngle(t){return (t%360+360)%360}setLaylinePath(t,n){let e=this.normalizeAngle(t)*Math.PI/180,a=Math.floor(this.RADIUS*Math.sin(e)+this.CENTER_X),i=Math.floor(this.RADIUS*Math.cos(e)*-1+this.CENTER_Y);n?this.laylinePortPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${i}`):this.laylineStbdPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${i}`);}setWindSectorPath(t,n){let e=this.addHeading(this.addHeading(t.min,Number(this.compass.newValue)*-1),this.targetAngle()/2*(n?-1:1)),a=this.addHeading(this.addHeading(t.mid,Number(this.compass.newValue)*-1),this.targetAngle()/2*(n?-1:1)),i=this.addHeading(this.addHeading(t.max,Number(this.compass.newValue)*-1),this.targetAngle()/2*(n?-1:1)),r=this.RADIUS*Math.sin(e*Math.PI/180)+this.CENTER_X,f=this.RADIUS*Math.cos(e*Math.PI/180)*-1+this.CENTER_Y,w=this.RADIUS*Math.sin(a*Math.PI/180)+this.CENTER_X,g=this.RADIUS*Math.cos(a*Math.PI/180)*-1+this.CENTER_Y,E=this.RADIUS*Math.sin(i*Math.PI/180)+this.CENTER_X,x=this.RADIUS*Math.cos(i*Math.PI/180)*-1+this.CENTER_Y,I=Math.abs(Q([r,f],[w,g],[E,x]))>Math.PI/2?0:1,S=Q([E,x],[r,f],[w,g])>0?0:1,v=`M ${this.CENTER_X},${this.CENTER_Y} L ${r},${f} A ${this.RADIUS},${this.RADIUS} 0 ${I} ${S} ${E},${x} z`;n?this.portWindSectorPath.set(v):this.stbdWindSectorPath.set(v);}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 t=[this.rotatingDial(),this.twaIndicator(),this.wptIndicator(),this.setIndicator()];for(let n of t){let e=n?.nativeElement;if(!e)continue;let a=this.animationFrameIds.get(e);a&&cancelAnimationFrame(a),this.animationFrameIds.delete(e);}}static \u0275fac=function(n){return new(n||y)};static \u0275cmp=JD({type:y,selectors:[["svg-racesteer"]],viewQuery:function(n,e){n&1&&eg(e.rotatingDial,it,5)(e.twaIndicator,at,5)(e.wptIndicator,ot,5)(e.setIndicator,rt,5)(e.tackIndicator,st,5),n&2&&Kw(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(n,e){n&1&&(wd(),dl(0,"svg",5)(1,"defs",6)(2,"linearGradient",7),Uh(3,"stop",8)(4,"stop",9),fl(),dl(5,"linearGradient",10),Uh(6,"stop",8)(7,"stop",9),fl(),dl(8,"linearGradient",11),Uh(9,"stop",12)(10,"stop",13),fl(),dl(11,"linearGradient",14),Uh(12,"stop",15),fl(),dl(13,"clipPath",16),Uh(14,"ellipse",17),fl(),Uh(15,"linearGradient",18)(16,"linearGradient",19)(17,"linearGradient",20),fl(),dl(18,"g",21)(19,"g",22),Uh(20,"path",23)(21,"path",24),fl()(),dl(22,"g",25)(23,"g",26),Uh(24,"circle",27),fl(),dl(25,"g",null,0)(27,"g",28),Uh(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),dl(64,"text",65)(65,"tspan",66),TT(66,"330"),fl()(),dl(67,"text",67)(68,"tspan",68),TT(69,"300"),fl()(),dl(70,"text",69)(71,"tspan",70),TT(72,"W"),fl()(),dl(73,"text",71)(74,"tspan",72),TT(75,"240"),fl()(),dl(76,"text",73)(77,"tspan",74),TT(78,"210"),fl()(),dl(79,"text",75)(80,"tspan",76),TT(81,"S"),fl()(),dl(82,"text",77)(83,"tspan",78),TT(84,"150"),fl()(),dl(85,"text",79)(86,"tspan",80),TT(87,"120"),fl()(),dl(88,"text",81)(89,"tspan",82),TT(90,"E"),fl()(),dl(91,"text",83)(92,"tspan",84),TT(93,"60"),fl()(),dl(94,"text",85)(95,"tspan",86),TT(96,"30"),fl()(),dl(97,"text",87)(98,"tspan",88),TT(99,"N"),fl()()()()(),dl(100,"g",89),Uh(101,"path",90)(102,"path",91),fl(),dl(103,"g",92),Uh(104,"path",93)(105,"path",94),fl(),dl(106,"g",95)(107,"g",96)(108,"text",97),TT(109,"Tack/Gybe"),fl(),Uh(110,"rect",98),dl(111,"text",99),TT(112),HT(113,"number"),dl(114,"tspan",100),TT(115,"\xB0"),fl()()(),dl(116,"g",101)(117,"text",102),TT(118,"Wind VMG"),fl(),dl(119,"text",103),TT(120),dl(121,"tspan",104),TT(122," kts"),fl()(),dl(123,"text",105),TT(124),dl(125,"tspan",104),TT(126," kts"),fl()()(),dl(127,"g",106)(128,"text",107),TT(129,"Waypoint"),fl(),Uh(130,"rect",108),dl(131,"text",109)(132,"tspan",110),TT(133,"VMG: "),fl(),TT(134),dl(135,"tspan",104),TT(136," kts"),fl()(),dl(137,"text",111)(138,"tspan",110),TT(139,"HDG: "),fl(),TT(140),dl(141,"tspan",100),TT(142,"\xB0"),dl(143,"tspan",104),TT(144,"T"),fl()()()()(),dl(145,"g",112)(146,"g",null,1),Uh(148,"path",113),fl(),dl(149,"g",null,2),Uh(151,"path",114),dl(152,"text",115),TT(153,"T"),fl()(),dl(154,"g",null,3),Uh(156,"ellipse",116),fl()(),dl(157,"g",117),Uh(158,"line",118)(159,"line",119)(160,"polygon",120),fl(),dl(161,"g",121),Uh(162,"path",122,4),dl(164,"text",123),TT(165),fl()(),dl(166,"g",124),Uh(167,"rect",125),dl(168,"text",126),TT(169),dl(170,"tspan",100),TT(171,"\xB0"),dl(172,"tspan",127),TT(173,"T"),fl()()()()()),n&2&&(EE(101),ig("display",e.portWindSectorPath()!="none"?"inline":"none"),Hh("d",e.portWindSectorPath()),EE(),ig("display",e.stbdWindSectorPath()!="none"?"inline":"none"),Hh("d",e.stbdWindSectorPath()),EE(2),ig("display",e.trueWindAngle()!=null?"inline":"none"),Hh("d",e.laylinePortPath()),EE(),ig("display",e.trueWindAngle()!=null?"inline":"none"),Hh("d",e.laylineStbdPath()),EE(7),gl("",UT(113,36,e.nextTargetDirection(),"1.0-0")," "),EE(7),ig("fill",e.targetVMGOffsetRatioColor()),EE(),gg(e.targetVMG()),EE(3),ig("fill",e.targetVMGOffsetRatioColor()),EE(),gg(e.targetVMGOffset()),EE(10),gg(e.vmgToWaypoint()),EE(6),gg(e.waypointAngle()),EE(11),ig("fill",e.windAnglePerformanceRatioColor()),EE(3),Hh("display",e.waypointActive()?"inline":"none"),EE(5),ig("stroke",e.speedRatioColor()),Hh("y2",e.speedLineTipY()),EE(),ig("fill",e.speedRatioColor())("stroke",e.speedRatioColor()),Hh("points",e.speedTipPoints()),EE(),ig("display",e.driftEnabled()?"inline":"none"),EE(4),gg(e.flow()),EE(4),gl(" ",e.headingValue()));},dependencies:[es],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}"]})}return y})();var yt=(()=>{class y{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,filterSelfPaths:true,paths:{headingPath:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",isPathConfigurable:true,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},tackTrue:{description:"True Tack",path:"self.performance.tackTrue",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:true,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},polarSpeedRatio:{description:"Polar Speed Ratio",path:"self.performance.polarSpeedRatio",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"ratio",sampleTime:500},targetAngle:{description:"Target Angle",path:"self.performance.targetAngle",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"deg",sampleTime:500},optimalWindAngle:{description:"Optimal Wind Angle",path:"self.performance.optimumWindAngle",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"deg",sampleTime:500},targetVMG:{description:"Target Velocity Made Good",path:"self.performance.targetVelocityMadeGood",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"knots",sampleTime:500},VMG:{description:"Velocity Made Good",path:"self.performance.velocityMadeGood",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"knots",sampleTime:500},appWindAngle:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",isPathConfigurable:true,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},appWindSpeed:{description:"Apparent Wind Speed",path:"self.environment.wind.speedApparent",source:"default",pathType:"number",isPathConfigurable:true,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},trueWindAngle:{description:"True Wind Angle",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},trueWindSpeed:{description:"True Wind Speed",path:"self.environment.wind.speedTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},courseOverGround:{description:"True Course Over Ground",path:"self.navigation.courseOverGroundTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},nextWaypointBearing:{description:"Next Waypoint True Bearing",path:"self.navigation.course.calcValues.bearingTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},vmgToWaypoint:{description:"Velocity Made Good to Waypoint",path:"self.performance.velocityMadeGoodToWaypoint",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"knots",sampleTime:500},set:{description:"True Drift Set",path:"self.environment.current.setTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},drift:{description:"Drift Speed Impact",path:"self.environment.current.drift",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500}},windSectorEnable:true,windSectorWindowSeconds:5,laylineEnable:true,laylineAngle:40,waypointEnable:true,courseOverGroundEnable:true,driftEnable:true,awsEnable:true,twsEnable:true,sailSetupEnable:false,enableTimeout:false,dataTimeout:5};runtime=w(p);streams=w(rt$1);currentHeading=vt(0);courseOverGroundAngle=vt(0);appWindAngle=vt(0);appWindSpeed=vt(0);appWindSpeedUnit=vt("knots");trueWindAngle=vt(0);trueWindSpeed=vt(0);trueWindSpeedUnit=vt("knots");driftFlow=vt(0);driftSet=vt(0);waypointAngle=vt(0);vmgToWaypoint=vt(null);tackTrue=vt(0);polarSpeedRatio=vt(0);targetAngle=vt(0);optimalWindAngle=vt(0);targetVMG=vt(0);VMG=vt(0);gradianColor=vt({start:"#3298ff",stop:"#15af00"});trueWindMinHistoric=vt(0);trueWindMidHistoric=vt(0);trueWindMaxHistoric=vt(0);normalizedConfig=Dt(()=>this.runtime.options()??y.DEFAULT_CONFIG);sailSetupEnabledValue=Dt(()=>this.normalizedConfig().sailSetupEnable??false);driftEnabledValue=Dt(()=>this.normalizedConfig().driftEnable??false);waypointEnabledValue=Dt(()=>this.normalizedConfig().waypointEnable??false);windSectorSub=null;historicalWindDirection=[];constructor(){Fa(()=>{let t=this.normalizedConfig();!t||!t.paths?.headingPath?.path||ge(()=>this.streams.observe("headingPath",a=>{let i=a?.data?.value;this.currentHeading.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.courseOverGroundEnable||!t.paths?.courseOverGround?.path||ge(()=>this.streams.observe("courseOverGround",a=>{let i=a?.data?.value;this.courseOverGroundAngle.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.driftEnable||!t.paths?.drift?.path||ge(()=>this.streams.observe("drift",a=>{let i=a?.data?.value;this.driftFlow.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.driftEnable||!t.paths?.set?.path||ge(()=>this.streams.observe("set",a=>{let i=a?.data?.value,r=i??0;this.driftSet.set(this.addHeading(-this.currentHeading(),r));}));}),Fa(()=>{let t=this.runtime.options();!t||!t.waypointEnable||!t.paths?.nextWaypointBearing?.path||ge(()=>this.streams.observe("nextWaypointBearing",a=>{let i=a?.data?.value;if(i==null){this.waypointAngle.set(0);return}let r=i<0?360+i:i,f=this.addHeading(-this.currentHeading(),r);this.waypointAngle.set(Math.round(f));}));}),Fa(()=>{let t=this.runtime.options();!t||!t.awsEnable||!t.paths?.appWindAngle?.path||ge(()=>this.streams.observe("appWindAngle",a=>{let i=a?.data?.value,r=i??0;if(r=r<0?360+r:r,this.appWindAngle.set(r),t.windSectorEnable){let f=this.currentHeading(),w=this.addHeading(f,i??0);this.addHistoricalWindDirection(w,t.windSectorWindowSeconds??5);}}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.tackTrue?.path||ge(()=>this.streams.observe("tackTrue",a=>{let i=a?.data?.value;this.tackTrue.set(i==null?0:Math.round(i));}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.polarSpeedRatio?.path||ge(()=>this.streams.observe("polarSpeedRatio",a=>{let i=a?.data?.value;this.polarSpeedRatio.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.targetAngle?.path||ge(()=>this.streams.observe("targetAngle",a=>{let i=a?.data?.value;this.targetAngle.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.optimalWindAngle?.path||ge(()=>this.streams.observe("optimalWindAngle",a=>{let i=a?.data?.value;this.optimalWindAngle.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.targetVMG?.path||ge(()=>this.streams.observe("targetVMG",a=>{let i=a?.data?.value,r=i==null?0:Math.round(i*10)/10;this.targetVMG.set(r);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.VMG?.path||ge(()=>this.streams.observe("VMG",a=>{let i=a?.data?.value,r=i==null?0:Math.round(i*10)/10;this.VMG.set(r);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.vmgToWaypoint?.path||ge(()=>this.streams.observe("vmgToWaypoint",a=>{let i=a?.data?.value,r=i==null?null:Math.round(i*10)/10;this.vmgToWaypoint.set(r);}));}),Fa(()=>{let t=this.theme();if(!t)return;let n=t?.blue??"#3298ff",e=t?.green??"#15af00";ge(()=>this.gradianColor.set({start:n,stop:e}));}),Fa(()=>{let t=this.runtime.options();!t||!t.awsEnable||!t.paths?.appWindSpeed?.path||ge(()=>this.streams.observe("appWindSpeed",a=>{let i=a?.data?.value;this.appWindSpeed.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.twsEnable||!t.paths?.trueWindSpeed?.path||ge(()=>this.streams.observe("trueWindSpeed",a=>{let i=a?.data?.value;this.trueWindSpeed.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();if(!t||!t.twsEnable)return;let e=t.paths?.trueWindAngle?.path;e&&ge(()=>this.streams.observe("trueWindAngle",a=>{let i=a?.data?.value,r=i??0;if(e.includes("angleTrueWater")||e.includes("angleTrueGround")){let f=this.currentHeading();r=this.addHeading(f,r);}else r=r<0?360+r:r;this.trueWindAngle.set(r);}));}),Fa(()=>{let t=this.normalizedConfig();t&&(t.windSectorEnable?this.windSectorSub||ge(()=>this.windSectorSub=ms(500).subscribe(()=>this.historicalCleanup(t.windSectorWindowSeconds??5))):(this.windSectorSub?.unsubscribe(),this.windSectorSub=null));});}sectorArc=Dt(()=>{let t=this.trueWindMinHistoric(),n=this.trueWindMidHistoric(),e=this.trueWindMaxHistoric();return {min:t,mid:n,max:e}});addHistoricalWindDirection(t,n){this.historicalWindDirection.push({timestamp:Date.now(),windDirection:t});let e=this.arcForAngles(this.historicalWindDirection.map(a=>a.windDirection));this.trueWindMinHistoric.set(e.min),this.trueWindMaxHistoric.set(e.max),this.trueWindMidHistoric.set(e.mid),this.historicalCleanup(n);}arcForAngles(t){return !t||t.length===0?{min:0,max:0,mid:0}:t.slice(1).reduce((e,a)=>{let i=a;for(;i<e.min-180;)i+=360;for(;i>e.max+180;)i-=360;return e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.mid=(e.max-e.min)/2+e.min,e},{min:t[0],max:t[0],mid:t[0]})}historicalCleanup(t){let n=Date.now()-t*1e3;this.historicalWindDirection=this.historicalWindDirection.filter(e=>e.timestamp>=n);}addHeading(t,n){let e=(t+n)%360;return e<0&&(e+=360),e}ngOnDestroy(){this.windSectorSub?.unsubscribe(),this.windSectorSub=null;}static \u0275fac=function(n){return new(n||y)};static \u0275cmp=JD({type:y,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(n,e){n&1&&$h(0,"svg-racesteer",0),n&2&&Bh("compassHeading",e.currentHeading())("tackTrue",e.tackTrue())("polarSpeedRatio",e.polarSpeedRatio())("trueWindAngle",e.trueWindAngle())("trueWindSpeed",e.trueWindSpeed())("targetAngle",e.targetAngle())("optimalWindAngle",e.optimalWindAngle())("targetVMG",e.targetVMG())("VMG",e.VMG())("sailSetupEnabled",e.sailSetupEnabledValue())("driftEnabled",e.driftEnabledValue())("driftFlow",e.driftFlow())("driftSet",e.driftSet())("waypointEnabled",e.waypointEnabledValue())("waypointAngle",e.waypointAngle())("vmgToWaypoint",e.vmgToWaypoint()??0)("trueWindMinHistoric",e.trueWindMinHistoric())("trueWindMidHistoric",e.trueWindMidHistoric())("trueWindMaxHistoric",e.trueWindMaxHistoric())("gradianColor",e.gradianColor());},dependencies:[J],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg-racesteer[_ngcontent-%COMP%]{width:100%;height:100%}"]})}return y})();export{yt as WidgetRacesteerComponent};
1
+ import {v,R,S}from'./chunk-CQNVyz8q.js';import {d1 as Hj,w,du as p,dv as rt$1,v as vt,D as Dt,F as Fa,dn as ge,J as JD,c as $h,B as Bh,$ as $j,ao as ue,dz as es,cn as wd,ci as dl,cp as Uh,cj as fl,T as TT,bD as HT,e as EE,d as ig,an as Hh,bp as gl,dA as UT,aA as gg,f as eg,K as Kw,aI as ms}from'./main-YKDNK5VZ.js';var it=["rotatingDial"],at=["twaIndicator"],ot=["wptIndicator"],rt=["setIndicator"],st=["tackIndicator"],Q=([y,K],[t,n],[e,a])=>(Math.atan2(a-n,e-t)-Math.atan2(K-n,y-t)+3*Math.PI)%(2*Math.PI)-Math.PI,J=(()=>{class y{rotatingDial=$j.required("rotatingDial");twaIndicator=$j.required("twaIndicator");wptIndicator=$j.required("wptIndicator");setIndicator=$j.required("setIndicator");tackIndicator=$j.required("tackIndicator");compassHeading=Hj.required();tackTrue=Hj.required();polarSpeedRatio=Hj.required();trueWindAngle=Hj.required();trueWindSpeed=Hj.required();targetAngle=Hj.required();optimalWindAngle=Hj.required();targetVMG=Hj.required();VMG=Hj.required();sailSetupEnabled=Hj.required();driftEnabled=Hj.required();driftSet=Hj();driftFlow=Hj();waypointEnabled=Hj.required();waypointAngle=Hj();vmgToWaypoint=Hj();trueWindMinHistoric=Hj();trueWindMidHistoric=Hj();trueWindMaxHistoric=Hj();gradianColor=Hj.required();compass={oldValue:0,newValue:0};twa={oldValue:0,newValue:0};wpt={oldValue:0,newValue:0};tack={oldValue:0,newValue:0};set={oldValue:0,newValue:0};compassInitialized=false;twaInitialized=false;wptInitialized=false;tackInitialized=false;setInitialized=false;laylinesInitialized=false;headingValue=vt("--");windSectorsInitialized=false;trueWindHeading=0;nextTargetDirection=Dt(()=>{let t=this.compassHeading(),n=this.tackTrue();return t==null||n==null?0:this.unsignedAngleDelta(t,n)});trueWindSpeedDisplay=Dt(()=>{let t=this.trueWindSpeed();return t==null?"--":t.toFixed(1)});windAnglePerformanceRatioColor=Dt(()=>{let t=this.optimalWindAngle(),n=this.targetAngle(),e=this.gradianColor().start,a=this.gradianColor().stop;if(t==null||n==null)return e;let i=1-Math.abs(t-n)/180;return this.interpolateColor(e,a,i)});targetVMGOffset=Dt(()=>{let t=this.VMG(),n=this.targetVMG();return t==null||n==null?"--":(t-n).toFixed(1)});targetVMGOffsetRatioColor=Dt(()=>{let t=this.VMG(),n=this.targetVMG(),e=this.gradianColor().start,a=this.gradianColor().stop;if(t==null||n==null)return e;let i=t/n;return this.interpolateColor(e,a,i)});waypointActive=vt(false);flow=Dt(()=>{let t=this.driftFlow();return t==null?"--":t.toFixed(1)});portLaylinePrev=0;stbdLaylinePrev=0;portLaylineAnimId=null;stbdLaylineAnimId=null;CENTER_X=600;CENTER_Y=620;RADIUS=540;ANIMATION_DURATION=1e3;laylinePortPath=vt(`M ${this.CENTER_X},${this.CENTER_Y} ${this.CENTER_X},${this.CENTER_Y}`);laylineStbdPath=vt(`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=vt("");stbdWindSectorPath=vt("");speedLineTipY=vt(620);speedTipPoints=vt("600,570 580,600 620,600");speedRatioColor=vt("");speedLinePrevRatio=0;speedLinePrevTipY=600;speedLineAnimId=null;speedLineInitialized=false;animationFrameIds=new WeakMap;ngZone=w(ue);setRotationImmediate(t,n){t.setAttribute("transform",`rotate(${n} 600 620)`);}constructor(){Fa(()=>{let t=this.waypointEnabled();ge(()=>{this.waypointActive.set(t);});}),Fa(()=>{let t=this.compassHeading(),n=Number.isFinite(t)?Math.round(t):null;n!=null&&ge(()=>{this.compassInitialized?(this.compass.oldValue=this.compass.newValue,this.compass.newValue=n):(this.compass.oldValue=n,this.compass.newValue=n,this.compassInitialized=true),this.headingValue.set(n.toString()),this.rotatingDial()?.nativeElement&&(this.compass.oldValue===this.compass.newValue?this.setRotationImmediate(this.rotatingDial().nativeElement,-this.compass.newValue):S(this.rotatingDial().nativeElement,-this.compass.oldValue,-this.compass.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateWindSectors());});}),Fa(()=>{let t=this.targetAngle(),n=Number.isFinite(t)?Math.round(t):null;n!=null&&ge(()=>{this.tackInitialized?(this.tack.oldValue=this.tack.newValue,this.tack.newValue=n):(this.tack.oldValue=n,this.tack.newValue=n,this.tackInitialized=true),this.tackIndicator()?.nativeElement&&(this.tack.oldValue===this.tack.newValue?this.setRotationImmediate(this.tackIndicator().nativeElement,this.tack.newValue):S(this.tackIndicator().nativeElement,this.tack.oldValue,this.tack.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620])),this.updateLaylines();});}),Fa(()=>{let t=this.waypointAngle();ge(()=>{if(!t){this.waypointActive.set(false);return}this.waypointEnabled()?this.waypointActive.set(true):this.waypointActive.set(false),this.wptInitialized?(this.wpt.oldValue=this.wpt.newValue,this.wpt.newValue=t):(this.wpt.oldValue=t,this.wpt.newValue=t,this.wptInitialized=true),this.wptIndicator()?.nativeElement&&(this.wpt.oldValue===this.wpt.newValue?this.setRotationImmediate(this.wptIndicator().nativeElement,this.wpt.newValue):S(this.wptIndicator().nativeElement,this.wpt.oldValue,this.wpt.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620]));});}),Fa(()=>{let t=this.trueWindAngle(),n=Number.isFinite(t)?Math.round(t):null,e=this.compassHeading(),a=Number.isFinite(e)?Math.round(e):null;n==null||a==null||ge(()=>{this.trueWindHeading=n;let i=this.addHeading(this.trueWindHeading,a*-1);this.twaInitialized?(this.twa.oldValue=this.twa.newValue,this.twa.newValue=i):(this.twa.oldValue=i,this.twa.newValue=i,this.twaInitialized=true),this.twaIndicator()?.nativeElement&&(this.twa.oldValue===this.twa.newValue?this.setRotationImmediate(this.twaIndicator().nativeElement,this.twa.newValue):S(this.twaIndicator().nativeElement,this.twa.oldValue,this.twa.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone),this.updateLaylines());});}),Fa(()=>{let t=this.polarSpeedRatio(),n=Math.max(0,Math.min(1,t)),e=620,i=e-166,r=e-i*n;if(!this.speedLineInitialized){this.speedLineInitialized=true,this.speedLineTipY.set(r);let f=30,w=20,g=r-f;this.speedTipPoints.set(`600,${g} ${600-w},${r} ${600+w},${r}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,n)),this.speedLinePrevTipY=r,this.speedLinePrevRatio=n;return}this.animateSpeedLine(this.speedLinePrevTipY,r),this.speedLinePrevTipY=r,this.speedLinePrevRatio=n;}),Fa(()=>{let t=this.driftSet(),n=Number.isFinite(t)?Math.round(t):null;n!=null&&ge(()=>{this.setInitialized?(this.set.oldValue=this.set.newValue,this.set.newValue=n):(this.set.oldValue=n,this.set.newValue=n,this.setInitialized=true),this.setIndicator()?.nativeElement&&(this.set.oldValue===this.set.newValue?this.setRotationImmediate(this.setIndicator().nativeElement,this.set.newValue):S(this.setIndicator().nativeElement,this.set.oldValue,this.set.newValue,this.ANIMATION_DURATION,void 0,this.animationFrameIds,[600,620],this.ngZone));});});}updateLaylines(){if(!this.twaInitialized)return;let t=this.targetAngle(),n=Number.isFinite(t)?Math.round(t):null;if(n==null)return;n=n/2;let e=Number(this.twa.newValue),a=e-n,i=e+n;if(!this.laylinesInitialized){this.laylinesInitialized=true,this.setLaylinePath(a,true),this.setLaylinePath(i,false),this.portLaylinePrev=a,this.stbdLaylinePrev=i;return}this.animateLayline(this.portLaylinePrev,a,true),this.portLaylinePrev=a,this.animateLayline(this.stbdLaylinePrev,i,false),this.stbdLaylinePrev=i;}animateLayline(t,n,e){e&&this.portLaylineAnimId&&cancelAnimationFrame(this.portLaylineAnimId),!e&&this.stbdLaylineAnimId&&cancelAnimationFrame(this.stbdLaylineAnimId);let a=()=>{e?this.portLaylineAnimId=null:this.stbdLaylineAnimId=null;},i=v(t,n,this.ANIMATION_DURATION,r=>this.setLaylinePath(r,e),a,this.ngZone);e?this.portLaylineAnimId=i:this.stbdLaylineAnimId=i;}updateWindSectors(){if(this.trueWindMinHistoric()==null||this.trueWindMidHistoric()==null||this.trueWindMaxHistoric()==null)return;let t={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()},n={min:this.trueWindMinHistoric(),mid:this.trueWindMidHistoric(),max:this.trueWindMaxHistoric()};if(!this.windSectorsInitialized){this.portSectorPrev=t,this.stbdSectorPrev=n,this.windSectorsInitialized=true,this.animateWindSector(t,t,true),this.animateWindSector(n,n,false);return}this.animateWindSector(this.portSectorPrev,t,true),this.animateWindSector(this.stbdSectorPrev,n,false),this.portSectorPrev=t,this.stbdSectorPrev=n;}animateWindSector(t,n,e){e&&this.portSectorAnimId&&cancelAnimationFrame(this.portSectorAnimId),!e&&this.stbdSectorAnimId&&cancelAnimationFrame(this.stbdSectorAnimId);let a=()=>{e?this.portSectorAnimId=null:this.stbdSectorAnimId=null;},i=R(t,n,this.ANIMATION_DURATION,r=>this.setWindSectorPath(r,e),a,this.ngZone);e?this.portSectorAnimId=i:this.stbdSectorAnimId=i;}animateSpeedLine(t,n){this.speedLineAnimId&&(cancelAnimationFrame(this.speedLineAnimId),this.speedLineAnimId=null);let e=1e3,a=performance.now(),i=this.speedLinePrevRatio,r=(600-n)/454,f=g=>g<.5?4*g*g*g:1-Math.pow(-2*g+2,3)/2,w=g=>{let E=g-a,x=Math.min(E/e,1),I=f(x),S=(H,et)=>H+(et-H)*I,v=S(t,n),R=S(i,r);this.speedLineTipY.set(v);let D=30,P=20,tt=v-D;this.speedTipPoints.set(`600,${tt} ${600-P},${v} ${600+P},${v}`),this.speedRatioColor.set(this.interpolateColor(this.gradianColor().start,this.gradianColor().stop,R)),x<1?this.speedLineAnimId=requestAnimationFrame(w):this.speedLineAnimId=null;};requestAnimationFrame(w);}interpolateColor(t,n,e){e=Math.max(0,Math.min(1,e));function a(v){v=v.replace("#",""),v.length===3&&(v=v.split("").map(D=>D+D).join(""));let R=parseInt(v,16);return [R>>16&255,R>>8&255,R&255]}let[i,r,f]=a(t),[w,g,E]=a(n),x=Math.round(i+(w-i)*e),I=Math.round(r+(g-r)*e),S=Math.round(f+(E-f)*e);return `rgb(${x},${I},${S})`}addHeading(t=0,n=0){return ((t+n)%360+360)%360}unsignedAngleDelta(t,n){let e=(t-n+540)%360-180;return Math.abs(e)}normalizeAngle(t){return (t%360+360)%360}setLaylinePath(t,n){let e=this.normalizeAngle(t)*Math.PI/180,a=Math.floor(this.RADIUS*Math.sin(e)+this.CENTER_X),i=Math.floor(this.RADIUS*Math.cos(e)*-1+this.CENTER_Y);n?this.laylinePortPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${i}`):this.laylineStbdPath.set(`M ${this.CENTER_X},${this.CENTER_Y} L ${a},${i}`);}setWindSectorPath(t,n){let e=this.addHeading(this.addHeading(t.min,Number(this.compass.newValue)*-1),this.targetAngle()/2*(n?-1:1)),a=this.addHeading(this.addHeading(t.mid,Number(this.compass.newValue)*-1),this.targetAngle()/2*(n?-1:1)),i=this.addHeading(this.addHeading(t.max,Number(this.compass.newValue)*-1),this.targetAngle()/2*(n?-1:1)),r=this.RADIUS*Math.sin(e*Math.PI/180)+this.CENTER_X,f=this.RADIUS*Math.cos(e*Math.PI/180)*-1+this.CENTER_Y,w=this.RADIUS*Math.sin(a*Math.PI/180)+this.CENTER_X,g=this.RADIUS*Math.cos(a*Math.PI/180)*-1+this.CENTER_Y,E=this.RADIUS*Math.sin(i*Math.PI/180)+this.CENTER_X,x=this.RADIUS*Math.cos(i*Math.PI/180)*-1+this.CENTER_Y,I=Math.abs(Q([r,f],[w,g],[E,x]))>Math.PI/2?0:1,S=Q([E,x],[r,f],[w,g])>0?0:1,v=`M ${this.CENTER_X},${this.CENTER_Y} L ${r},${f} A ${this.RADIUS},${this.RADIUS} 0 ${I} ${S} ${E},${x} z`;n?this.portWindSectorPath.set(v):this.stbdWindSectorPath.set(v);}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 t=[this.rotatingDial(),this.twaIndicator(),this.wptIndicator(),this.setIndicator()];for(let n of t){let e=n?.nativeElement;if(!e)continue;let a=this.animationFrameIds.get(e);a&&cancelAnimationFrame(a),this.animationFrameIds.delete(e);}}static \u0275fac=function(n){return new(n||y)};static \u0275cmp=JD({type:y,selectors:[["svg-racesteer"]],viewQuery:function(n,e){n&1&&eg(e.rotatingDial,it,5)(e.twaIndicator,at,5)(e.wptIndicator,ot,5)(e.setIndicator,rt,5)(e.tackIndicator,st,5),n&2&&Kw(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(n,e){n&1&&(wd(),dl(0,"svg",5)(1,"defs",6)(2,"linearGradient",7),Uh(3,"stop",8)(4,"stop",9),fl(),dl(5,"linearGradient",10),Uh(6,"stop",8)(7,"stop",9),fl(),dl(8,"linearGradient",11),Uh(9,"stop",12)(10,"stop",13),fl(),dl(11,"linearGradient",14),Uh(12,"stop",15),fl(),dl(13,"clipPath",16),Uh(14,"ellipse",17),fl(),Uh(15,"linearGradient",18)(16,"linearGradient",19)(17,"linearGradient",20),fl(),dl(18,"g",21)(19,"g",22),Uh(20,"path",23)(21,"path",24),fl()(),dl(22,"g",25)(23,"g",26),Uh(24,"circle",27),fl(),dl(25,"g",null,0)(27,"g",28),Uh(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),dl(64,"text",65)(65,"tspan",66),TT(66,"330"),fl()(),dl(67,"text",67)(68,"tspan",68),TT(69,"300"),fl()(),dl(70,"text",69)(71,"tspan",70),TT(72,"W"),fl()(),dl(73,"text",71)(74,"tspan",72),TT(75,"240"),fl()(),dl(76,"text",73)(77,"tspan",74),TT(78,"210"),fl()(),dl(79,"text",75)(80,"tspan",76),TT(81,"S"),fl()(),dl(82,"text",77)(83,"tspan",78),TT(84,"150"),fl()(),dl(85,"text",79)(86,"tspan",80),TT(87,"120"),fl()(),dl(88,"text",81)(89,"tspan",82),TT(90,"E"),fl()(),dl(91,"text",83)(92,"tspan",84),TT(93,"60"),fl()(),dl(94,"text",85)(95,"tspan",86),TT(96,"30"),fl()(),dl(97,"text",87)(98,"tspan",88),TT(99,"N"),fl()()()()(),dl(100,"g",89),Uh(101,"path",90)(102,"path",91),fl(),dl(103,"g",92),Uh(104,"path",93)(105,"path",94),fl(),dl(106,"g",95)(107,"g",96)(108,"text",97),TT(109,"Tack/Gybe"),fl(),Uh(110,"rect",98),dl(111,"text",99),TT(112),HT(113,"number"),dl(114,"tspan",100),TT(115,"\xB0"),fl()()(),dl(116,"g",101)(117,"text",102),TT(118,"Wind VMG"),fl(),dl(119,"text",103),TT(120),dl(121,"tspan",104),TT(122," kts"),fl()(),dl(123,"text",105),TT(124),dl(125,"tspan",104),TT(126," kts"),fl()()(),dl(127,"g",106)(128,"text",107),TT(129,"Waypoint"),fl(),Uh(130,"rect",108),dl(131,"text",109)(132,"tspan",110),TT(133,"VMG: "),fl(),TT(134),dl(135,"tspan",104),TT(136," kts"),fl()(),dl(137,"text",111)(138,"tspan",110),TT(139,"HDG: "),fl(),TT(140),dl(141,"tspan",100),TT(142,"\xB0"),dl(143,"tspan",104),TT(144,"T"),fl()()()()(),dl(145,"g",112)(146,"g",null,1),Uh(148,"path",113),fl(),dl(149,"g",null,2),Uh(151,"path",114),dl(152,"text",115),TT(153,"T"),fl()(),dl(154,"g",null,3),Uh(156,"ellipse",116),fl()(),dl(157,"g",117),Uh(158,"line",118)(159,"line",119)(160,"polygon",120),fl(),dl(161,"g",121),Uh(162,"path",122,4),dl(164,"text",123),TT(165),fl()(),dl(166,"g",124),Uh(167,"rect",125),dl(168,"text",126),TT(169),dl(170,"tspan",100),TT(171,"\xB0"),dl(172,"tspan",127),TT(173,"T"),fl()()()()()),n&2&&(EE(101),ig("display",e.portWindSectorPath()!="none"?"inline":"none"),Hh("d",e.portWindSectorPath()),EE(),ig("display",e.stbdWindSectorPath()!="none"?"inline":"none"),Hh("d",e.stbdWindSectorPath()),EE(2),ig("display",e.trueWindAngle()!=null?"inline":"none"),Hh("d",e.laylinePortPath()),EE(),ig("display",e.trueWindAngle()!=null?"inline":"none"),Hh("d",e.laylineStbdPath()),EE(7),gl("",UT(113,36,e.nextTargetDirection(),"1.0-0")," "),EE(7),ig("fill",e.targetVMGOffsetRatioColor()),EE(),gg(e.targetVMG()),EE(3),ig("fill",e.targetVMGOffsetRatioColor()),EE(),gg(e.targetVMGOffset()),EE(10),gg(e.vmgToWaypoint()),EE(6),gg(e.waypointAngle()),EE(11),ig("fill",e.windAnglePerformanceRatioColor()),EE(3),Hh("display",e.waypointActive()?"inline":"none"),EE(5),ig("stroke",e.speedRatioColor()),Hh("y2",e.speedLineTipY()),EE(),ig("fill",e.speedRatioColor())("stroke",e.speedRatioColor()),Hh("points",e.speedTipPoints()),EE(),ig("display",e.driftEnabled()?"inline":"none"),EE(4),gg(e.flow()),EE(4),gl(" ",e.headingValue()));},dependencies:[es],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}"]})}return y})();var yt=(()=>{class y{id=Hj.required();type=Hj.required();theme=Hj.required();static DEFAULT_CONFIG={supportAutomaticHistoricalSeries:false,filterSelfPaths:true,paths:{headingPath:{description:"True Heading",path:"self.navigation.headingTrue",source:"default",pathType:"number",isPathConfigurable:true,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},tackTrue:{description:"True Tack",path:"self.performance.tackTrue",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:true,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},polarSpeedRatio:{description:"Polar Speed Ratio",path:"self.performance.polarSpeedRatio",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"ratio",sampleTime:500},targetAngle:{description:"Target Angle",path:"self.performance.targetAngle",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"deg",sampleTime:500},optimalWindAngle:{description:"Optimal Wind Angle",path:"self.performance.optimumWindAngle",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"deg",sampleTime:500},targetVMG:{description:"Target Velocity Made Good",path:"self.performance.targetVelocityMadeGood",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"knots",sampleTime:500},VMG:{description:"Velocity Made Good",path:"self.performance.velocityMadeGood",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"knots",sampleTime:500},appWindAngle:{description:"Apparent Wind Angle",path:"self.environment.wind.angleApparent",source:"default",pathType:"number",isPathConfigurable:true,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},appWindSpeed:{description:"Apparent Wind Speed",path:"self.environment.wind.speedApparent",source:"default",pathType:"number",isPathConfigurable:true,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},trueWindAngle:{description:"True Wind Angle",path:"self.environment.wind.angleTrueWater",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},trueWindSpeed:{description:"True Wind Speed",path:"self.environment.wind.speedTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500},courseOverGround:{description:"True Course Over Ground",path:"self.navigation.courseOverGroundTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},nextWaypointBearing:{description:"Next Waypoint True Bearing",path:"self.navigation.course.calcValues.bearingTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},vmgToWaypoint:{description:"Velocity Made Good to Waypoint",path:"self.performance.velocityMadeGoodToWaypoint",source:"default",pathType:"number",isPathConfigurable:false,pathRequired:false,convertUnitTo:"knots",sampleTime:500},set:{description:"True Drift Set",path:"self.environment.current.setTrue",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"rad",convertUnitTo:"deg",sampleTime:500},drift:{description:"Drift Speed Impact",path:"self.environment.current.drift",source:"default",pathType:"number",isPathConfigurable:true,pathRequired:false,pathSkUnitsFilter:"m/s",convertUnitTo:"knots",sampleTime:500}},windSectorEnable:true,windSectorWindowSeconds:5,laylineEnable:true,laylineAngle:40,waypointEnable:true,courseOverGroundEnable:true,driftEnable:true,awsEnable:true,twsEnable:true,sailSetupEnable:false,enableTimeout:false,dataTimeout:5};runtime=w(p);streams=w(rt$1);currentHeading=vt(0);courseOverGroundAngle=vt(0);appWindAngle=vt(0);appWindSpeed=vt(0);appWindSpeedUnit=vt("knots");trueWindAngle=vt(0);trueWindSpeed=vt(0);trueWindSpeedUnit=vt("knots");driftFlow=vt(0);driftSet=vt(0);waypointAngle=vt(0);vmgToWaypoint=vt(null);tackTrue=vt(0);polarSpeedRatio=vt(0);targetAngle=vt(0);optimalWindAngle=vt(0);targetVMG=vt(0);VMG=vt(0);gradianColor=vt({start:"#3298ff",stop:"#15af00"});trueWindMinHistoric=vt(0);trueWindMidHistoric=vt(0);trueWindMaxHistoric=vt(0);normalizedConfig=Dt(()=>this.runtime.options()??y.DEFAULT_CONFIG);sailSetupEnabledValue=Dt(()=>this.normalizedConfig().sailSetupEnable??false);driftEnabledValue=Dt(()=>this.normalizedConfig().driftEnable??false);waypointEnabledValue=Dt(()=>this.normalizedConfig().waypointEnable??false);windSectorSub=null;historicalWindDirection=[];constructor(){Fa(()=>{let t=this.normalizedConfig();!t||!t.paths?.headingPath?.path||ge(()=>this.streams.observe("headingPath",a=>{let i=a?.data?.value;this.currentHeading.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.courseOverGroundEnable||!t.paths?.courseOverGround?.path||ge(()=>this.streams.observe("courseOverGround",a=>{let i=a?.data?.value;this.courseOverGroundAngle.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.driftEnable||!t.paths?.drift?.path||ge(()=>this.streams.observe("drift",a=>{let i=a?.data?.value;this.driftFlow.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.driftEnable||!t.paths?.set?.path||ge(()=>this.streams.observe("set",a=>{let i=a?.data?.value,r=i??0;this.driftSet.set(this.addHeading(-this.currentHeading(),r));}));}),Fa(()=>{let t=this.runtime.options();!t||!t.waypointEnable||!t.paths?.nextWaypointBearing?.path||ge(()=>this.streams.observe("nextWaypointBearing",a=>{let i=a?.data?.value;if(i==null){this.waypointAngle.set(0);return}let r=i<0?360+i:i,f=this.addHeading(-this.currentHeading(),r);this.waypointAngle.set(Math.round(f));}));}),Fa(()=>{let t=this.runtime.options();!t||!t.awsEnable||!t.paths?.appWindAngle?.path||ge(()=>this.streams.observe("appWindAngle",a=>{let i=a?.data?.value,r=i??0;if(r=r<0?360+r:r,this.appWindAngle.set(r),t.windSectorEnable){let f=this.currentHeading(),w=this.addHeading(f,i??0);this.addHistoricalWindDirection(w,t.windSectorWindowSeconds??5);}}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.tackTrue?.path||ge(()=>this.streams.observe("tackTrue",a=>{let i=a?.data?.value;this.tackTrue.set(i==null?0:Math.round(i));}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.polarSpeedRatio?.path||ge(()=>this.streams.observe("polarSpeedRatio",a=>{let i=a?.data?.value;this.polarSpeedRatio.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.targetAngle?.path||ge(()=>this.streams.observe("targetAngle",a=>{let i=a?.data?.value;this.targetAngle.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.optimalWindAngle?.path||ge(()=>this.streams.observe("optimalWindAngle",a=>{let i=a?.data?.value;this.optimalWindAngle.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.targetVMG?.path||ge(()=>this.streams.observe("targetVMG",a=>{let i=a?.data?.value,r=i==null?0:Math.round(i*10)/10;this.targetVMG.set(r);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.VMG?.path||ge(()=>this.streams.observe("VMG",a=>{let i=a?.data?.value,r=i==null?0:Math.round(i*10)/10;this.VMG.set(r);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.paths?.vmgToWaypoint?.path||ge(()=>this.streams.observe("vmgToWaypoint",a=>{let i=a?.data?.value,r=i==null?null:Math.round(i*10)/10;this.vmgToWaypoint.set(r);}));}),Fa(()=>{let t=this.theme();if(!t)return;let n=t?.blue??"#3298ff",e=t?.green??"#15af00";ge(()=>this.gradianColor.set({start:n,stop:e}));}),Fa(()=>{let t=this.runtime.options();!t||!t.awsEnable||!t.paths?.appWindSpeed?.path||ge(()=>this.streams.observe("appWindSpeed",a=>{let i=a?.data?.value;this.appWindSpeed.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();!t||!t.twsEnable||!t.paths?.trueWindSpeed?.path||ge(()=>this.streams.observe("trueWindSpeed",a=>{let i=a?.data?.value;this.trueWindSpeed.set(i??0);}));}),Fa(()=>{let t=this.runtime.options();if(!t||!t.twsEnable)return;let e=t.paths?.trueWindAngle?.path;e&&ge(()=>this.streams.observe("trueWindAngle",a=>{let i=a?.data?.value,r=i??0;if(e.includes("angleTrueWater")||e.includes("angleTrueGround")){let f=this.currentHeading();r=this.addHeading(f,r);}else r=r<0?360+r:r;this.trueWindAngle.set(r);}));}),Fa(()=>{let t=this.normalizedConfig();t&&(t.windSectorEnable?this.windSectorSub||ge(()=>this.windSectorSub=ms(500).subscribe(()=>this.historicalCleanup(t.windSectorWindowSeconds??5))):(this.windSectorSub?.unsubscribe(),this.windSectorSub=null));});}sectorArc=Dt(()=>{let t=this.trueWindMinHistoric(),n=this.trueWindMidHistoric(),e=this.trueWindMaxHistoric();return {min:t,mid:n,max:e}});addHistoricalWindDirection(t,n){this.historicalWindDirection.push({timestamp:Date.now(),windDirection:t});let e=this.arcForAngles(this.historicalWindDirection.map(a=>a.windDirection));this.trueWindMinHistoric.set(e.min),this.trueWindMaxHistoric.set(e.max),this.trueWindMidHistoric.set(e.mid),this.historicalCleanup(n);}arcForAngles(t){return !t||t.length===0?{min:0,max:0,mid:0}:t.slice(1).reduce((e,a)=>{let i=a;for(;i<e.min-180;)i+=360;for(;i>e.max+180;)i-=360;return e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.mid=(e.max-e.min)/2+e.min,e},{min:t[0],max:t[0],mid:t[0]})}historicalCleanup(t){let n=Date.now()-t*1e3;this.historicalWindDirection=this.historicalWindDirection.filter(e=>e.timestamp>=n);}addHeading(t,n){let e=(t+n)%360;return e<0&&(e+=360),e}ngOnDestroy(){this.windSectorSub?.unsubscribe(),this.windSectorSub=null;}static \u0275fac=function(n){return new(n||y)};static \u0275cmp=JD({type:y,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(n,e){n&1&&$h(0,"svg-racesteer",0),n&2&&Bh("compassHeading",e.currentHeading())("tackTrue",e.tackTrue())("polarSpeedRatio",e.polarSpeedRatio())("trueWindAngle",e.trueWindAngle())("trueWindSpeed",e.trueWindSpeed())("targetAngle",e.targetAngle())("optimalWindAngle",e.optimalWindAngle())("targetVMG",e.targetVMG())("VMG",e.VMG())("sailSetupEnabled",e.sailSetupEnabledValue())("driftEnabled",e.driftEnabledValue())("driftFlow",e.driftFlow())("driftSet",e.driftSet())("waypointEnabled",e.waypointEnabledValue())("waypointAngle",e.waypointAngle())("vmgToWaypoint",e.vmgToWaypoint()??0)("trueWindMinHistoric",e.trueWindMinHistoric())("trueWindMidHistoric",e.trueWindMidHistoric())("trueWindMaxHistoric",e.trueWindMaxHistoric())("gradianColor",e.gradianColor());},dependencies:[J],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}svg-racesteer[_ngcontent-%COMP%]{width:100%;height:100%}"]})}return y})();export{yt as WidgetRacesteerComponent};
@@ -1 +1 @@
1
- import {w as w$1,dl as E,dm as G,N,aY as xe,bu as ut,dd as $e,$ as $j,W as Wp,v as vt,bG as Bj,D as Dt,F as Fa,dn as ge,a$ as Zr,dp as n,cw as z,cv as G$1,b0 as Wl,J as JD,dq as Ht,di as jt,de as Nt,df as Vt,dr as Ot,ds as bt,dt as nt,O as Op,o as eu,y as yt,b as wt,b2 as Ln,b5 as Pn,b9 as rn,P as Pi,T as TT,u as ul,bi as Eg,k as Qh,bk as cD,_ as _w,e as EE,aA as gg,B as Bh,bm as Ig,bo as lD,M as Mw,f as eg,K as Kw,g as qw,bp as gl,c as $h,bj as ST}from'./main-BNR44HGB.js';import'./chunk-h2q_pbbF.js';var y={"widget-bms":{expansionMode:"bms-battery-tree",metricOrder:["soc","current"],metrics:{soc:{metric:"soc",axisId:"ySoc",pathSuffixes:[".capacity.stateOfCharge",".stateOfCharge"],transform:a=>a*100},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{ySoc:{axisId:"ySoc",position:"left",title:"SoC (%)",tickSuffix:"%",min:0,max:100},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"soc",axisId:"ySoc",regex:/^electrical\.batteries\.([^.]+)\.(?:capacity\.)?stateOfCharge$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.batteries\.([^.]+)\.current$/i}]},"widget-solar-charger":{expansionMode:"solar-tree",metricOrder:["panelPower","current"],metrics:{panelPower:{metric:"panelPower",axisId:"yPower",pathSuffixes:[".panelPower"],transform:a=>a/1e3},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yPower:{axisId:"yPower",position:"left",title:"Power (kW)",tickSuffix:"kW"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"current",axisId:"yCurrent",regex:/^electrical\.solar\.([^.]+)\.current$/i},{metric:"panelPower",axisId:"yPower",regex:/^electrical\.solar\.([^.]+)\.panelPower$/i}]},"widget-charger":{expansionMode:"charger-tree",metricOrder:["voltage","current"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.chargers\.([^.]+)\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.chargers\.([^.]+)\.current$/i}]},"widget-inverter":{expansionMode:"inverter-tree",metricOrder:["voltage","current"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.inverters\.([^.]+)\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.inverters\.([^.]+)\.current$/i}]},"widget-alternator":{expansionMode:"alternator-tree",metricOrder:["voltage","current"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.alternators\.([^.]+)\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.alternators\.([^.]+)\.current$/i}]},"widget-ac":{expansionMode:"ac-tree",metricOrder:["voltage","current","frequency"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".line1.voltage",".line2.voltage",".line3.voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".line1.current",".line2.current",".line3.current"],transform:a=>a},frequency:{metric:"frequency",axisId:"yFrequency",pathSuffixes:[".line1.frequency",".line2.frequency",".line3.frequency"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false},yFrequency:{axisId:"yFrequency",position:"left",title:"Frequency (Hz)",tickSuffix:"Hz",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.ac\.([^.]+)\.line[123]\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.ac\.([^.]+)\.line[123]\.current$/i},{metric:"frequency",axisId:"yFrequency",regex:/^electrical\.ac\.([^.]+)\.line[123]\.frequency$/i}]}},Ie={"bms-battery-tree":"widget-bms","solar-tree":"widget-solar-charger","charger-tree":"widget-charger","inverter-tree":"widget-inverter","alternator-tree":"widget-alternator","ac-tree":"widget-ac"};function Me(a){return !!a&&a in y}function D(a){return y[a]}function w(a){let l=Ie[a],e=y[l],t=[];return e.metricOrder.forEach(r=>{let i=e.metrics[r];i&&i.pathSuffixes.forEach(n=>{t.includes(n)||t.push(n);});}),t}function ve(a,l){let e=y[a.widgetType].metrics[a.metric];return e?e.transform(l):l}function P(a){let l=y[a],e=[];return l.metricOrder.forEach(t=>{let r=l.metrics[t]?.axisId;!r||e.includes(r)||e.push(r);}),e.map(t=>l.axes[t]).filter(t=>!!t)}function De(a,l){if(!Me(a))return null;let e=P(a),t=new Set(e.map(i=>i.axisId));return t.size===0?null:l.some(i=>!!i&&t.has(i))?a:null}function Se(a){for(let[l,e]of Object.entries(y))for(let t of e.pathRules){let r=t.regex.exec(a);if(r)return {widgetType:l,entityId:r[1],metric:t.metric,axisId:t.axisId}}return null}var Ae=["historyCanvas"];function we(a,l){a&1&&(Pi(0,"p",12),TT(1,"Loading historical data\u2026"),ul());}function Pe(a,l){if(a&1&&(Pi(0,"p",13),TT(1),ul()),a&2){let e=qw();EE(),gl("503: ",e.error());}}function Te(a,l){a&1&&(Pi(0,"p",12),TT(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."),ul());}function _e(a,l){a&1&&(Pi(0,"div",14),$h(1,"canvas",null,0),ul());}var rt=(()=>{class a{historyApiClient=w$1(E);historyMapper=w$1(G);app=w$1(N);destroyRef=w$1(xe);units=w$1(ut);data=w$1($e);chartCanvas=$j("historyCanvas");theme=Wp(this.app.cssThemeColorRoles$,{requireSync:true});loading=vt(true);error=vt(null);datasetCount=vt(0);selectedPeriod=Bj("PT1H");hasNoData=Dt(()=>!this.loading()&&!this.error()&&this.datasetCount()===0);chart=null;viewReady=false;pendingDatasets=[];dualAxisDescriptorCache=new Map;constructor(){Fa(()=>{let e=this.chartCanvas(),t=this.loading(),r=this.datasetCount();!e||t||r<=0||ge(()=>{this.tryRenderChart();});});}loadHistoryDatasets(){return Zr(this,null,function*(){this.loading.set(true),this.error.set(null),this.dualAxisDescriptorCache.clear();try{let e=yield this.resolveQueryableSeriesDefinitions(),t=yield Promise.all(e.map((r,i)=>this.buildDatasetForSeries(r,i)));this.pendingDatasets=t.filter(r=>!!r),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(false),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=true,this.tryRenderChart();}buildDatasetForSeries(e,t){return Zr(this,null,function*(){let r=e.path;if(!r)return null;let i=this.resolveDuration(e),n=this.resolveResolutionSeconds(i),o=this.buildHistoryRequestCandidates(r,e.context),s=this.describeDualAxisSeries(r),u=[],x=this.normalizeHistoryPath(r),T=this.resolveConvertUnitTo(r);for(let I of o){let k=yield this.historyApiClient.getValues({paths:I.paths,context:I.context,duration:i,resolution:n});if(!k?.data?.length)continue;if(u=this.historyMapper.mapValuesToChartDatapoints(k,{unit:"number",domain:"scalar"}).map(O=>{let m=O.data.value;return typeof m=="number"&&Number.isFinite(m)&&(s?m=ve(s,m):T&&(m=this.units.convertToUnit(T,m)??m)),{x:O.timestamp,y:m}}),u.length){x=I.labelPath;break}}if(!u.length)return null;let _=this.resolveSeriesColor(t,s),be=e.source?` (${e.source})`:"";return {label:`${x}${be}`,data:u,borderColor:_,backgroundColor:_,pointRadius:0,borderWidth:2,tension:.25,yAxisID:s?.axisId??"y",borderDash:this.isDualAxisDashedSeries(s)?[6,4]:void 0,fill:false}})}describeDualAxisSeries(e){let t=this.normalizeHistoryPath(e??"");if(!t.length)return null;if(this.dualAxisDescriptorCache.has(t))return this.dualAxisDescriptorCache.get(t)??null;let r=Se(t);return this.dualAxisDescriptorCache.set(t,r),r}resolveSeriesColor(e,t){let r=this.getSeriesPalette();return t?this.getDualAxisMetricColor(t.widgetType,t.metric):r[e%r.length]}getSeriesPalette(){let e=this.data.widget?.config?.color||"blue",t=this.resolveThemeColor(e),r=[this.theme().green,this.theme().orange,this.theme().pink,this.theme().purple,this.theme().yellow,this.theme().grey,this.theme().blue,this.theme().contrast],i=r.findIndex(n=>n?.toLowerCase()===t.toLowerCase());return i!==-1?r=[r[i],...r.slice(0,i),...r.slice(i+1)]:r=[t,...r],r}resolveThemeColor(e){let t=this.theme()[e];return typeof t=="string"&&t.length>0?t:e}isDualAxisDashedSeries(e){return e?this.getDualAxisEntityOrderIndex(e.entityId,e.widgetType)%2===1:false}getDualAxisEntityOrderIndex(e,t){let r=[];this.data.seriesDefinitions.forEach(n=>{let o=this.describeDualAxisSeries(n.path);!o||o.widgetType!==t||r.includes(o.entityId)||r.push(o.entityId);});let i=r.indexOf(e);return i>=0?i:0}getDualAxisMetricColor(e,t){let r=this.getSeriesPalette(),n=D(e).metricOrder.indexOf(t),o=n>=0?n:0;return r[o%r.length]}buildHistoryRequestCandidates(e,t){let r=this.normalizeHistoryPath(e),i=this.resolveHistoryContext(e,t),n=[r].filter(s=>s.length>0),o=[];return n.forEach(s=>{o.push({paths:`${s}:avg`,context:i,labelPath:this.normalizeHistoryPath(s)});}),o}resolveQueryableSeriesDefinitions(){return Zr(this,null,function*(){let e=[];for(let t of this.data.seriesDefinitions){let r=yield this.expandTemplateSeries(t);e.push(...r);}return this.sortExpandedSeries(e)})}sortExpandedSeries(e){return e.some(r=>this.describeDualAxisSeries(r.path)!==null)?[...e].sort((r,i)=>{let n=this.describeDualAxisSeries(r.path),o=this.describeDualAxisSeries(i.path);if(!n&&!o)return 0;if(!n)return 1;if(!o)return -1;if(n.entityId!==o.entityId)return n.entityId.localeCompare(o.entityId);let s=D(n.widgetType).metricOrder.indexOf(n.metric),u=D(o.widgetType).metricOrder.indexOf(o.metric);return s-u}):e}expandTemplateSeries(e){return Zr(this,null,function*(){let t=this.normalizeHistoryPath(e.path??""),r=t.endsWith(".*");if(!n(e)&&!r)return [e];let i=t.replace(/\.\*$/,"");if(!i.length)return [e];let n$1=this.resolveDuration(e),o=yield this.historyApiClient.getPaths({duration:n$1});if(!o?.length)return [e];let s=this.findConcreteTemplatePaths(e,i,o);return s.length===0?[e]:s.map((u,x)=>z(G$1({},e),{seriesId:`${e.seriesId}:resolved:${x}`,datasetUuid:`${e.datasetUuid}:resolved:${x}`,path:u,expansionMode:null,familyKey:null,allowedIds:null,trackedDevices:void 0}))})}findConcreteTemplatePaths(e,t,r){let i=Array.from(new Set(r.map(o=>this.normalizeHistoryPath(o)).filter(o=>o.startsWith(`${t}.`))));return i.length===0?[]:n(e)?i.filter(o=>this.matchesTemplateMetric(o,t,e)).filter(o=>this.matchesTemplateAllowedIds(o,t,e)):i}matchesTemplateMetric(e,t,r){let i=e.slice(t.length+1);return w(r.expansionMode).some(o=>i.endsWith(o))}matchesTemplateAllowedIds(e,t,r){let i=Array.isArray(r.allowedIds)?r.allowedIds.map(o=>String(o).trim()).filter(o=>o.length>0):[];if(i.length===0)return true;let n=this.extractEntityId(e,t,r);return !!n&&i.includes(n)}extractEntityId(e,t,r){let i=e.slice(t.length+1);if(!i.length)return null;let o=w(r.expansionMode).find(u=>i.endsWith(u));if(!o)return null;let s=i.slice(0,-o.length).replace(/\.$/,"").trim();return s.length?s:null}normalizeHistoryPath(e){let t=e.trim();return t.length?t.replace(/^(vessels\.)?self\./,""):""}resolveHistoryContext(e,t){let r=this.normalizeContext(t);if(r)return r;if(/^(vessels\.)?self\./.test(e))return "vessels.self"}tryRenderChart(){if(!this.viewReady)return;if(!this.pendingDatasets.length){this.chart?.destroy(),this.chart=null;return}let e=this.chartCanvas();if(!e)return;this.chart?.destroy();let t=this.getPrimaryAxisUnitLabel(),r={type:"line",data:{datasets:this.pendingDatasets},options:{responsive:true,maintainAspectRatio:false,parsing:false,interaction:{mode:"nearest",intersect:false,axis:"x"},scales:G$1({x:{type:"time",time:{tooltipFormat:"PPpp",displayFormats:{second:"HH:mm:ss",minute:"HH:mm",hour:"HH:mm",day:"MMM d",week:"MMM d",month:"MMM yyyy"},unit:"minute",minUnit:"second"},ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer}}},this.buildYScales(t)),plugins:{legend:{labels:{color:this.theme().contrastDim,generateLabels:i=>this.buildLegendLabels(i)}},tooltip:{boxWidth:15,boxHeight:15,bodyFont:{size:14},multiKeyBackground:"rgba(0, 0, 0, 0)",callbacks:{labelColor:i=>{let n=this.getLegendItemForDataset(i.chart,i.datasetIndex),o=Array.isArray(n?.lineDash)&&n.lineDash.length>=2?[n.lineDash[0],n.lineDash[1]]:void 0;return {borderColor:n?.strokeStyle??this.theme().contrast,backgroundColor:"rgba(0, 0, 0, 0)",borderWidth:2,borderRadius:0,borderDash:o}}}}}}};this.chart=new Wl(e.nativeElement.getContext("2d"),r);}getPrimaryAxisUnitLabel(){let e=this.resolveConvertUnitTo();return this.getUnitsLabel(e)}getWidgetPathConfig(e,t){let r=e?.config?.paths;if(!(!r||Array.isArray(r)))return r[t]}resolveConvertUnitTo(e){let t=this.data.widget?.config;if(!t)return null;if(t.paths&&!Array.isArray(t.paths)){if(e)for(let n of Object.keys(t.paths)){let o=this.getWidgetPathConfig(this.data.widget,n);if(o?.path===e&&o.convertUnitTo)return o.convertUnitTo}let r=Object.keys(t.paths)[0],i=r?this.getWidgetPathConfig(this.data.widget,r):void 0;if(i?.convertUnitTo)return i.convertUnitTo}return t.convertUnitTo??null}buildYScales(e){let t=this.resolveDualAxisWidgetType();if(!t)return {y:{ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer},title:{display:!!e,text:e?`${e}`:"",color:this.theme().contrastDim}}};let r=P(t),i={};return r.forEach(n=>{let o=this.resolvePrimaryMetricForAxis(t,n.axisId),s=o?this.getDualAxisMetricColor(t,o):this.theme().contrastDim;i[n.axisId]=z(G$1(G$1({type:"linear",position:n.position},n.min!=null?{min:n.min}:{}),n.max!=null?{max:n.max}:{}),{ticks:{color:this.theme().contrastDim,callback:u=>this.formatAxisTick(u,n.tickSuffix)},grid:G$1({color:this.theme().contrastDimmer},n.drawOnChartArea===false?{drawOnChartArea:false}:{}),title:{display:true,text:n.title,color:s}});}),i}resolvePrimaryMetricForAxis(e,t){let r=D(e);return r.metricOrder.find(n=>r.metrics[n]?.axisId===t)??null}formatAxisTick(e,t){return t==="%"?`${e}%`:`${e} ${t}`}buildLegendLabels(e){return Wl.defaults.plugins.legend.labels.generateLabels(e).map(t=>{let r=t.datasetIndex!=null?e.data.datasets[t.datasetIndex]:null,i=Array.isArray(r?.borderDash)?r.borderDash.filter(n=>typeof n=="number"):[];return z(G$1({},t),{fillStyle:"transparent",lineDash:i})})}getLegendItemForDataset(e,t){return this.buildLegendLabels(e).find(r=>r.datasetIndex===t)??null}resolveDualAxisWidgetType(){return De(this.data.widget?.type,this.pendingDatasets.map(e=>typeof e.yAxisID=="string"?e.yAxisID:null))}setPeriod(e){this.selectedPeriod.set(e),this.loadHistoryDatasets();}resolveDuration(e){return e.timeScale&&e.period&&Number.isFinite(e.period)?this.durationFromScaleAndPeriod(e.timeScale,e.period):this.selectedPeriod()}durationFromScaleAndPeriod(e,t){let r=Math.max(1,Math.round(t)),i=e.trim().toLowerCase(),n=i.match(/^last\s+(\d+)\s+([a-z]+)/i);if(n){let o=Number(n[1]),s=n[2];if(Number.isFinite(o)&&o>0)return this.durationFromToken(s,o)}return this.durationFromToken(i,r)}durationFromToken(e,t){let r=e.toLowerCase();return r.startsWith("second")?`PT${t}S`:r.startsWith("minute")?`PT${t}M`:r.startsWith("hour")?`PT${t}H`:r.startsWith("day")?`P${t}D`:r.startsWith("week")?`P${t*7}D`:r.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 r=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(e.trim());if(!r)return NaN;let i=Number(r[1]??0),n=Number(r[2]??0),o=Number(r[3]??0),s=Number(r[4]??0);return i*86400+n*3600+o*60+s}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||a)};static \u0275cmp=JD({type:a,selectors:[["widget-history-chart-dialog"]],viewQuery:function(t,r){t&1&&eg(r.chartCanvas,Ae,5),t&2&&Kw();},inputs:{selectedPeriod:[1,"selectedPeriod"]},outputs:{selectedPeriod:"selectedPeriodChange"},decls:22,vars:4,consts:[["historyCanvas",""],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"history-dialog-content"],[1,"time-select"],["hideSingleSelectionIndicator","true","aria-label","Chart Time Span Selection",3,"ngModelChange","ngModel"],["value","PT15M",3,"click"],["value","PT1H",3,"click"],["value","PT8H",3,"click"],["value","PT24H",3,"click"],[1,"chart-area"],[1,"history-message"],[1,"history-message","error"],[1,"chart-wrapper"]],template:function(t,r){t&1&&(Pi(0,"div",1)(1,"h5",2),TT(2),ul(),Pi(3,"button",3)(4,"mat-icon"),TT(5,"close"),ul()()(),Pi(6,"mat-dialog-content",4)(7,"div",5)(8,"mat-button-toggle-group",6),Eg("ngModelChange",function(n){return ST(r.selectedPeriod,n)||(r.selectedPeriod=n),n}),Pi(9,"mat-button-toggle",7),Qh("click",function(){return r.setPeriod("PT15M")}),TT(10,"15 Minutes"),ul(),Pi(11,"mat-button-toggle",8),Qh("click",function(){return r.setPeriod("PT1H")}),TT(12,"1 Hour"),ul(),Pi(13,"mat-button-toggle",9),Qh("click",function(){return r.setPeriod("PT8H")}),TT(14,"8 Hours"),ul(),Pi(15,"mat-button-toggle",10),Qh("click",function(){return r.setPeriod("PT24H")}),TT(16,"24 Hours"),ul()(),cD(),ul(),Pi(17,"div",11),_w(18,we,2,0,"p",12)(19,Pe,2,1,"p",13)(20,Te,2,0,"p",12)(21,_e,3,0,"div",14),ul()()),t&2&&(EE(2),gg(r.data.title),EE(),Bh("mat-dialog-close",false),EE(5),Ig("ngModel",r.selectedPeriod),lD(),EE(10),Mw(r.loading()?18:r.error()?19:r.hasNoData()?20:21));},dependencies:[Ht,jt,Nt,Vt,Ot,bt,nt,Op,eu,yt,wt,Ln,Pn,rn],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}mat-dialog-content.history-dialog-content[_ngcontent-%COMP%]{padding:0 24px 20px;display:flex;flex-direction:column;width:100%;height:100%;min-width:70vw;min-height:55vh;justify-content:flex-start;align-items:stretch}.time-select[_ngcontent-%COMP%]{flex-grow:0;text-align:center;width:100%}.chart-area[_ngcontent-%COMP%], .chart-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 0;min-height:0;width:100%}.chart-wrapper[_ngcontent-%COMP%] canvas[_ngcontent-%COMP%]{flex:1 1 0;min-height:0}.history-message[_ngcontent-%COMP%]{margin:0;padding:1rem 0}.error[_ngcontent-%COMP%]{color:var(--mat-sys-error)}"]})}return a})();export{rt as WidgetHistoryChartDialogComponent};
1
+ import {w as w$1,dl as E,dm as G,N,aY as xe,bu as ut,dd as $e,$ as $j,W as Wp,v as vt,bG as Bj,D as Dt,F as Fa,dn as ge,a$ as Zr,dp as n,cw as z,cv as G$1,b0 as Wl,J as JD,dq as Ht,di as jt,de as Nt,df as Vt,dr as Ot,ds as bt,dt as nt,O as Op,o as eu,y as yt,b as wt,b2 as Ln,b5 as Pn,b9 as rn,P as Pi,T as TT,u as ul,bi as Eg,k as Qh,bk as cD,_ as _w,e as EE,aA as gg,B as Bh,bm as Ig,bo as lD,M as Mw,f as eg,K as Kw,g as qw,bp as gl,c as $h,bj as ST}from'./main-YKDNK5VZ.js';import'./chunk-BTOTKeBo.js';var y={"widget-bms":{expansionMode:"bms-battery-tree",metricOrder:["soc","current"],metrics:{soc:{metric:"soc",axisId:"ySoc",pathSuffixes:[".capacity.stateOfCharge",".stateOfCharge"],transform:a=>a*100},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{ySoc:{axisId:"ySoc",position:"left",title:"SoC (%)",tickSuffix:"%",min:0,max:100},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"soc",axisId:"ySoc",regex:/^electrical\.batteries\.([^.]+)\.(?:capacity\.)?stateOfCharge$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.batteries\.([^.]+)\.current$/i}]},"widget-solar-charger":{expansionMode:"solar-tree",metricOrder:["panelPower","current"],metrics:{panelPower:{metric:"panelPower",axisId:"yPower",pathSuffixes:[".panelPower"],transform:a=>a/1e3},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yPower:{axisId:"yPower",position:"left",title:"Power (kW)",tickSuffix:"kW"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"current",axisId:"yCurrent",regex:/^electrical\.solar\.([^.]+)\.current$/i},{metric:"panelPower",axisId:"yPower",regex:/^electrical\.solar\.([^.]+)\.panelPower$/i}]},"widget-charger":{expansionMode:"charger-tree",metricOrder:["voltage","current"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.chargers\.([^.]+)\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.chargers\.([^.]+)\.current$/i}]},"widget-inverter":{expansionMode:"inverter-tree",metricOrder:["voltage","current"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.inverters\.([^.]+)\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.inverters\.([^.]+)\.current$/i}]},"widget-alternator":{expansionMode:"alternator-tree",metricOrder:["voltage","current"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".current"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.alternators\.([^.]+)\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.alternators\.([^.]+)\.current$/i}]},"widget-ac":{expansionMode:"ac-tree",metricOrder:["voltage","current","frequency"],metrics:{voltage:{metric:"voltage",axisId:"yVoltage",pathSuffixes:[".line1.voltage",".line2.voltage",".line3.voltage"],transform:a=>a},current:{metric:"current",axisId:"yCurrent",pathSuffixes:[".line1.current",".line2.current",".line3.current"],transform:a=>a},frequency:{metric:"frequency",axisId:"yFrequency",pathSuffixes:[".line1.frequency",".line2.frequency",".line3.frequency"],transform:a=>a}},axes:{yVoltage:{axisId:"yVoltage",position:"left",title:"Voltage (V)",tickSuffix:"V"},yCurrent:{axisId:"yCurrent",position:"right",title:"Current (A)",tickSuffix:"A",drawOnChartArea:false},yFrequency:{axisId:"yFrequency",position:"left",title:"Frequency (Hz)",tickSuffix:"Hz",drawOnChartArea:false}},pathRules:[{metric:"voltage",axisId:"yVoltage",regex:/^electrical\.ac\.([^.]+)\.line[123]\.voltage$/i},{metric:"current",axisId:"yCurrent",regex:/^electrical\.ac\.([^.]+)\.line[123]\.current$/i},{metric:"frequency",axisId:"yFrequency",regex:/^electrical\.ac\.([^.]+)\.line[123]\.frequency$/i}]}},Ie={"bms-battery-tree":"widget-bms","solar-tree":"widget-solar-charger","charger-tree":"widget-charger","inverter-tree":"widget-inverter","alternator-tree":"widget-alternator","ac-tree":"widget-ac"};function Me(a){return !!a&&a in y}function D(a){return y[a]}function w(a){let l=Ie[a],e=y[l],t=[];return e.metricOrder.forEach(r=>{let i=e.metrics[r];i&&i.pathSuffixes.forEach(n=>{t.includes(n)||t.push(n);});}),t}function ve(a,l){let e=y[a.widgetType].metrics[a.metric];return e?e.transform(l):l}function P(a){let l=y[a],e=[];return l.metricOrder.forEach(t=>{let r=l.metrics[t]?.axisId;!r||e.includes(r)||e.push(r);}),e.map(t=>l.axes[t]).filter(t=>!!t)}function De(a,l){if(!Me(a))return null;let e=P(a),t=new Set(e.map(i=>i.axisId));return t.size===0?null:l.some(i=>!!i&&t.has(i))?a:null}function Se(a){for(let[l,e]of Object.entries(y))for(let t of e.pathRules){let r=t.regex.exec(a);if(r)return {widgetType:l,entityId:r[1],metric:t.metric,axisId:t.axisId}}return null}var Ae=["historyCanvas"];function we(a,l){a&1&&(Pi(0,"p",12),TT(1,"Loading historical data\u2026"),ul());}function Pe(a,l){if(a&1&&(Pi(0,"p",13),TT(1),ul()),a&2){let e=qw();EE(),gl("503: ",e.error());}}function Te(a,l){a&1&&(Pi(0,"p",12),TT(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."),ul());}function _e(a,l){a&1&&(Pi(0,"div",14),$h(1,"canvas",null,0),ul());}var rt=(()=>{class a{historyApiClient=w$1(E);historyMapper=w$1(G);app=w$1(N);destroyRef=w$1(xe);units=w$1(ut);data=w$1($e);chartCanvas=$j("historyCanvas");theme=Wp(this.app.cssThemeColorRoles$,{requireSync:true});loading=vt(true);error=vt(null);datasetCount=vt(0);selectedPeriod=Bj("PT1H");hasNoData=Dt(()=>!this.loading()&&!this.error()&&this.datasetCount()===0);chart=null;viewReady=false;pendingDatasets=[];dualAxisDescriptorCache=new Map;constructor(){Fa(()=>{let e=this.chartCanvas(),t=this.loading(),r=this.datasetCount();!e||t||r<=0||ge(()=>{this.tryRenderChart();});});}loadHistoryDatasets(){return Zr(this,null,function*(){this.loading.set(true),this.error.set(null),this.dualAxisDescriptorCache.clear();try{let e=yield this.resolveQueryableSeriesDefinitions(),t=yield Promise.all(e.map((r,i)=>this.buildDatasetForSeries(r,i)));this.pendingDatasets=t.filter(r=>!!r),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(false),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=true,this.tryRenderChart();}buildDatasetForSeries(e,t){return Zr(this,null,function*(){let r=e.path;if(!r)return null;let i=this.resolveDuration(e),n=this.resolveResolutionSeconds(i),o=this.buildHistoryRequestCandidates(r,e.context),s=this.describeDualAxisSeries(r),u=[],x=this.normalizeHistoryPath(r),T=this.resolveConvertUnitTo(r);for(let I of o){let k=yield this.historyApiClient.getValues({paths:I.paths,context:I.context,duration:i,resolution:n});if(!k?.data?.length)continue;if(u=this.historyMapper.mapValuesToChartDatapoints(k,{unit:"number",domain:"scalar"}).map(O=>{let m=O.data.value;return typeof m=="number"&&Number.isFinite(m)&&(s?m=ve(s,m):T&&(m=this.units.convertToUnit(T,m)??m)),{x:O.timestamp,y:m}}),u.length){x=I.labelPath;break}}if(!u.length)return null;let _=this.resolveSeriesColor(t,s),be=e.source?` (${e.source})`:"";return {label:`${x}${be}`,data:u,borderColor:_,backgroundColor:_,pointRadius:0,borderWidth:2,tension:.25,yAxisID:s?.axisId??"y",borderDash:this.isDualAxisDashedSeries(s)?[6,4]:void 0,fill:false}})}describeDualAxisSeries(e){let t=this.normalizeHistoryPath(e??"");if(!t.length)return null;if(this.dualAxisDescriptorCache.has(t))return this.dualAxisDescriptorCache.get(t)??null;let r=Se(t);return this.dualAxisDescriptorCache.set(t,r),r}resolveSeriesColor(e,t){let r=this.getSeriesPalette();return t?this.getDualAxisMetricColor(t.widgetType,t.metric):r[e%r.length]}getSeriesPalette(){let e=this.data.widget?.config?.color||"blue",t=this.resolveThemeColor(e),r=[this.theme().green,this.theme().orange,this.theme().pink,this.theme().purple,this.theme().yellow,this.theme().grey,this.theme().blue,this.theme().contrast],i=r.findIndex(n=>n?.toLowerCase()===t.toLowerCase());return i!==-1?r=[r[i],...r.slice(0,i),...r.slice(i+1)]:r=[t,...r],r}resolveThemeColor(e){let t=this.theme()[e];return typeof t=="string"&&t.length>0?t:e}isDualAxisDashedSeries(e){return e?this.getDualAxisEntityOrderIndex(e.entityId,e.widgetType)%2===1:false}getDualAxisEntityOrderIndex(e,t){let r=[];this.data.seriesDefinitions.forEach(n=>{let o=this.describeDualAxisSeries(n.path);!o||o.widgetType!==t||r.includes(o.entityId)||r.push(o.entityId);});let i=r.indexOf(e);return i>=0?i:0}getDualAxisMetricColor(e,t){let r=this.getSeriesPalette(),n=D(e).metricOrder.indexOf(t),o=n>=0?n:0;return r[o%r.length]}buildHistoryRequestCandidates(e,t){let r=this.normalizeHistoryPath(e),i=this.resolveHistoryContext(e,t),n=[r].filter(s=>s.length>0),o=[];return n.forEach(s=>{o.push({paths:`${s}:avg`,context:i,labelPath:this.normalizeHistoryPath(s)});}),o}resolveQueryableSeriesDefinitions(){return Zr(this,null,function*(){let e=[];for(let t of this.data.seriesDefinitions){let r=yield this.expandTemplateSeries(t);e.push(...r);}return this.sortExpandedSeries(e)})}sortExpandedSeries(e){return e.some(r=>this.describeDualAxisSeries(r.path)!==null)?[...e].sort((r,i)=>{let n=this.describeDualAxisSeries(r.path),o=this.describeDualAxisSeries(i.path);if(!n&&!o)return 0;if(!n)return 1;if(!o)return -1;if(n.entityId!==o.entityId)return n.entityId.localeCompare(o.entityId);let s=D(n.widgetType).metricOrder.indexOf(n.metric),u=D(o.widgetType).metricOrder.indexOf(o.metric);return s-u}):e}expandTemplateSeries(e){return Zr(this,null,function*(){let t=this.normalizeHistoryPath(e.path??""),r=t.endsWith(".*");if(!n(e)&&!r)return [e];let i=t.replace(/\.\*$/,"");if(!i.length)return [e];let n$1=this.resolveDuration(e),o=yield this.historyApiClient.getPaths({duration:n$1});if(!o?.length)return [e];let s=this.findConcreteTemplatePaths(e,i,o);return s.length===0?[e]:s.map((u,x)=>z(G$1({},e),{seriesId:`${e.seriesId}:resolved:${x}`,datasetUuid:`${e.datasetUuid}:resolved:${x}`,path:u,expansionMode:null,familyKey:null,allowedIds:null,trackedDevices:void 0}))})}findConcreteTemplatePaths(e,t,r){let i=Array.from(new Set(r.map(o=>this.normalizeHistoryPath(o)).filter(o=>o.startsWith(`${t}.`))));return i.length===0?[]:n(e)?i.filter(o=>this.matchesTemplateMetric(o,t,e)).filter(o=>this.matchesTemplateAllowedIds(o,t,e)):i}matchesTemplateMetric(e,t,r){let i=e.slice(t.length+1);return w(r.expansionMode).some(o=>i.endsWith(o))}matchesTemplateAllowedIds(e,t,r){let i=Array.isArray(r.allowedIds)?r.allowedIds.map(o=>String(o).trim()).filter(o=>o.length>0):[];if(i.length===0)return true;let n=this.extractEntityId(e,t,r);return !!n&&i.includes(n)}extractEntityId(e,t,r){let i=e.slice(t.length+1);if(!i.length)return null;let o=w(r.expansionMode).find(u=>i.endsWith(u));if(!o)return null;let s=i.slice(0,-o.length).replace(/\.$/,"").trim();return s.length?s:null}normalizeHistoryPath(e){let t=e.trim();return t.length?t.replace(/^(vessels\.)?self\./,""):""}resolveHistoryContext(e,t){let r=this.normalizeContext(t);if(r)return r;if(/^(vessels\.)?self\./.test(e))return "vessels.self"}tryRenderChart(){if(!this.viewReady)return;if(!this.pendingDatasets.length){this.chart?.destroy(),this.chart=null;return}let e=this.chartCanvas();if(!e)return;this.chart?.destroy();let t=this.getPrimaryAxisUnitLabel(),r={type:"line",data:{datasets:this.pendingDatasets},options:{responsive:true,maintainAspectRatio:false,parsing:false,interaction:{mode:"nearest",intersect:false,axis:"x"},scales:G$1({x:{type:"time",time:{tooltipFormat:"PPpp",displayFormats:{second:"HH:mm:ss",minute:"HH:mm",hour:"HH:mm",day:"MMM d",week:"MMM d",month:"MMM yyyy"},unit:"minute",minUnit:"second"},ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer}}},this.buildYScales(t)),plugins:{legend:{labels:{color:this.theme().contrastDim,generateLabels:i=>this.buildLegendLabels(i)}},tooltip:{boxWidth:15,boxHeight:15,bodyFont:{size:14},multiKeyBackground:"rgba(0, 0, 0, 0)",callbacks:{labelColor:i=>{let n=this.getLegendItemForDataset(i.chart,i.datasetIndex),o=Array.isArray(n?.lineDash)&&n.lineDash.length>=2?[n.lineDash[0],n.lineDash[1]]:void 0;return {borderColor:n?.strokeStyle??this.theme().contrast,backgroundColor:"rgba(0, 0, 0, 0)",borderWidth:2,borderRadius:0,borderDash:o}}}}}}};this.chart=new Wl(e.nativeElement.getContext("2d"),r);}getPrimaryAxisUnitLabel(){let e=this.resolveConvertUnitTo();return this.getUnitsLabel(e)}getWidgetPathConfig(e,t){let r=e?.config?.paths;if(!(!r||Array.isArray(r)))return r[t]}resolveConvertUnitTo(e){let t=this.data.widget?.config;if(!t)return null;if(t.paths&&!Array.isArray(t.paths)){if(e)for(let n of Object.keys(t.paths)){let o=this.getWidgetPathConfig(this.data.widget,n);if(o?.path===e&&o.convertUnitTo)return o.convertUnitTo}let r=Object.keys(t.paths)[0],i=r?this.getWidgetPathConfig(this.data.widget,r):void 0;if(i?.convertUnitTo)return i.convertUnitTo}return t.convertUnitTo??null}buildYScales(e){let t=this.resolveDualAxisWidgetType();if(!t)return {y:{ticks:{color:this.theme().contrastDim},grid:{color:this.theme().contrastDimmer},title:{display:!!e,text:e?`${e}`:"",color:this.theme().contrastDim}}};let r=P(t),i={};return r.forEach(n=>{let o=this.resolvePrimaryMetricForAxis(t,n.axisId),s=o?this.getDualAxisMetricColor(t,o):this.theme().contrastDim;i[n.axisId]=z(G$1(G$1({type:"linear",position:n.position},n.min!=null?{min:n.min}:{}),n.max!=null?{max:n.max}:{}),{ticks:{color:this.theme().contrastDim,callback:u=>this.formatAxisTick(u,n.tickSuffix)},grid:G$1({color:this.theme().contrastDimmer},n.drawOnChartArea===false?{drawOnChartArea:false}:{}),title:{display:true,text:n.title,color:s}});}),i}resolvePrimaryMetricForAxis(e,t){let r=D(e);return r.metricOrder.find(n=>r.metrics[n]?.axisId===t)??null}formatAxisTick(e,t){return t==="%"?`${e}%`:`${e} ${t}`}buildLegendLabels(e){return Wl.defaults.plugins.legend.labels.generateLabels(e).map(t=>{let r=t.datasetIndex!=null?e.data.datasets[t.datasetIndex]:null,i=Array.isArray(r?.borderDash)?r.borderDash.filter(n=>typeof n=="number"):[];return z(G$1({},t),{fillStyle:"transparent",lineDash:i})})}getLegendItemForDataset(e,t){return this.buildLegendLabels(e).find(r=>r.datasetIndex===t)??null}resolveDualAxisWidgetType(){return De(this.data.widget?.type,this.pendingDatasets.map(e=>typeof e.yAxisID=="string"?e.yAxisID:null))}setPeriod(e){this.selectedPeriod.set(e),this.loadHistoryDatasets();}resolveDuration(e){return e.timeScale&&e.period&&Number.isFinite(e.period)?this.durationFromScaleAndPeriod(e.timeScale,e.period):this.selectedPeriod()}durationFromScaleAndPeriod(e,t){let r=Math.max(1,Math.round(t)),i=e.trim().toLowerCase(),n=i.match(/^last\s+(\d+)\s+([a-z]+)/i);if(n){let o=Number(n[1]),s=n[2];if(Number.isFinite(o)&&o>0)return this.durationFromToken(s,o)}return this.durationFromToken(i,r)}durationFromToken(e,t){let r=e.toLowerCase();return r.startsWith("second")?`PT${t}S`:r.startsWith("minute")?`PT${t}M`:r.startsWith("hour")?`PT${t}H`:r.startsWith("day")?`P${t}D`:r.startsWith("week")?`P${t*7}D`:r.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 r=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/i.exec(e.trim());if(!r)return NaN;let i=Number(r[1]??0),n=Number(r[2]??0),o=Number(r[3]??0),s=Number(r[4]??0);return i*86400+n*3600+o*60+s}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||a)};static \u0275cmp=JD({type:a,selectors:[["widget-history-chart-dialog"]],viewQuery:function(t,r){t&1&&eg(r.chartCanvas,Ae,5),t&2&&Kw();},inputs:{selectedPeriod:[1,"selectedPeriod"]},outputs:{selectedPeriod:"selectedPeriodChange"},decls:22,vars:4,consts:[["historyCanvas",""],[1,"dialogue-header"],["mat-dialog-title",""],["mat-icon-button","",1,"dialog-close-icon",3,"mat-dialog-close"],[1,"history-dialog-content"],[1,"time-select"],["hideSingleSelectionIndicator","true","aria-label","Chart Time Span Selection",3,"ngModelChange","ngModel"],["value","PT15M",3,"click"],["value","PT1H",3,"click"],["value","PT8H",3,"click"],["value","PT24H",3,"click"],[1,"chart-area"],[1,"history-message"],[1,"history-message","error"],[1,"chart-wrapper"]],template:function(t,r){t&1&&(Pi(0,"div",1)(1,"h5",2),TT(2),ul(),Pi(3,"button",3)(4,"mat-icon"),TT(5,"close"),ul()()(),Pi(6,"mat-dialog-content",4)(7,"div",5)(8,"mat-button-toggle-group",6),Eg("ngModelChange",function(n){return ST(r.selectedPeriod,n)||(r.selectedPeriod=n),n}),Pi(9,"mat-button-toggle",7),Qh("click",function(){return r.setPeriod("PT15M")}),TT(10,"15 Minutes"),ul(),Pi(11,"mat-button-toggle",8),Qh("click",function(){return r.setPeriod("PT1H")}),TT(12,"1 Hour"),ul(),Pi(13,"mat-button-toggle",9),Qh("click",function(){return r.setPeriod("PT8H")}),TT(14,"8 Hours"),ul(),Pi(15,"mat-button-toggle",10),Qh("click",function(){return r.setPeriod("PT24H")}),TT(16,"24 Hours"),ul()(),cD(),ul(),Pi(17,"div",11),_w(18,we,2,0,"p",12)(19,Pe,2,1,"p",13)(20,Te,2,0,"p",12)(21,_e,3,0,"div",14),ul()()),t&2&&(EE(2),gg(r.data.title),EE(),Bh("mat-dialog-close",false),EE(5),Ig("ngModel",r.selectedPeriod),lD(),EE(10),Mw(r.loading()?18:r.error()?19:r.hasNoData()?20:21));},dependencies:[Ht,jt,Nt,Vt,Ot,bt,nt,Op,eu,yt,wt,Ln,Pn,rn],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%}.dialogue-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.dialog-close-icon[_ngcontent-%COMP%]{margin-right:15px}mat-dialog-content.history-dialog-content[_ngcontent-%COMP%]{padding:0 24px 20px;display:flex;flex-direction:column;width:100%;height:100%;min-width:70vw;min-height:55vh;justify-content:flex-start;align-items:stretch}.time-select[_ngcontent-%COMP%]{flex-grow:0;text-align:center;width:100%}.chart-area[_ngcontent-%COMP%], .chart-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex:1 1 0;min-height:0;width:100%}.chart-wrapper[_ngcontent-%COMP%] canvas[_ngcontent-%COMP%]{flex:1 1 0;min-height:0}.history-message[_ngcontent-%COMP%]{margin:0;padding:1rem 0}.error[_ngcontent-%COMP%]{color:var(--mat-sys-error)}"]})}return a})();export{rt as WidgetHistoryChartDialogComponent};
@@ -1 +1 @@
1
- import {C,e as e$1}from'./chunk-CyURmwWh.js';import {g as ge$1}from'./chunk-TakPRI3t.js';import {e9 as a,d1 as Hj,w,du as p,aS as De,bu as ut,aY as xe,$ as $j,v as vt,D as Dt,F as Fa,dn as ge,a_ as Gp,cv as G,cw as z,dx as n$1,J as JD,dC as x,c as $h,cn as wd,_ as _w,B as Bh,e as EE,M as Mw,f as eg,K as Kw,P as Pi,T as TT,u as ul}from'./main-BNR44HGB.js';import {c,e}from'./chunk-D_wrJJxl.js';var ie=["alternatorSvg"];function oe(d,e){d&1&&(Pi(0,"div",3)(1,"div",4),TT(2,"No alternators detected"),ul(),Pi(3,"div",5),TT(4,"Check Signal K alternator paths or select alternators in widget settings."),ul()());}function ne(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Z=class d{static ALTERNATOR_DESCRIPTOR=a("widget-alternator");static SELF_ROOT_PATH=(()=>{let e=d.ALTERNATOR_DESCRIPTOR?.selfRootPath;if(!e)throw new Error("[WidgetAlternatorComponent] Descriptor missing or selfRootPath not set; check widget registration.");return e})();static ROOT_PATTERN=`${d.SELF_ROOT_PATH}.*`;static PATH_REGEX=new RegExp(`^${ne(d.SELF_ROOT_PATH)}\\.([^.]+)\\.(.+)$`);static VIEWBOX_WIDTH=200;static CARD_HEIGHT=100;static COMPACT_CARD_HEIGHT=100;static CARD_GAP=8;static PATH_BATCH_WINDOW_MS=500;static DEFAULT_CONFIG={color:"contrast",ignoreZones:false,alternator:{trackedDevices:[],optionsById:{}}};id=Hj.required();type=Hj.required();theme=Hj.required();renderMode=Hj(null);runtime=w(p);data=w(De);units=w(ut);destroyRef=w(xe);svgRef=$j.required("alternatorSvg");svg;layer;pendingPathUpdates=new Map;pathBatchTimerId=null;initialPathPaintDone=false;renderFrameId=null;pendingRenderSnapshot=null;discoveredAlternatorIds=vt([]);trackedDevices=vt([]);optionsById=vt({});cardMode=vt({displayMode:"full",metrics:["voltage","current","power","revolutions"]});alternatorsByKey=vt({});visibleAlternatorKeys=Dt(()=>{let e=this.trackedDevices();if(e.length)return e.map(i=>i.key);let r=this.alternatorsByKey(),t=new Set(this.discoveredAlternatorIds());return Object.keys(r).filter(i=>{let a=r[i];return !!a&&t.has(a.id)}).sort((i,a)=>i.localeCompare(a))});visibleAlternators=Dt(()=>{let e=this.visibleAlternatorKeys(),r=this.alternatorsByKey();return e.map(t=>r[t]).filter(t=>!!t)});hasAlternators=Dt(()=>this.visibleAlternators().length>0);activeDisplayMode=Dt(()=>this.renderMode()??this.cardMode().displayMode??"full");isCompactCardMode=Dt(()=>this.activeDisplayMode()==="compact");colorRole=Dt(()=>this.runtime.options()?.color??"contrast");ignoreZones=Dt(()=>this.runtime.options()?.ignoreZones??false);displayLabel=Dt(()=>{let e=this.visibleAlternators();return e.length!==1?"Alternators":this.resolveTitleText(e[0])});labelColor=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e).dim:"var(--kip-contrast-dim-color)"});widgetColors=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e):null});displayModels=Dt(()=>{let e$1=this.visibleAlternators(),r=this.theme(),t=this.widgetColors(),i=this.ignoreZones(),a=new Map;e$1.forEach(o=>a.set(o.id,(a.get(o.id)??0)+1));let l=new Set([...a.entries()].filter(([,o])=>o>1).map(([o])=>o)),s={};for(let o of e$1){let c=o.deviceKey??o.id,n=!!o.source&&l.has(o.id),p=this.resolveMostSevereState(o.powerState??null,o.currentState??null,o.voltageState??null,o.temperatureState??null,o.chargingModeState??null,o.revolutionsState??null,o.fieldDriveState??null,o.regulatorTemperatureState??null),T=this.resolveMostSevereState(o.voltageState??null,o.currentState??null),C=this.resolveMostSevereState(o.powerState??null,o.revolutionsState??null,o.temperatureState??null,o.regulatorTemperatureState??null),[u,I]=this.buildMetricRows(o);s[c]={id:o.id,titleText:this.resolveTitleText(o),modeText:this.isCompactCardMode()?"":this.resolveModeText(o),busText:this.isCompactCardMode()?"":n?o.source??"-":o.associatedBus||o.location||"-",metricsLineOne:u,metricsLineTwo:I,stateBarColor:e(p,t?.dim??"var(--kip-contrast-color)",r,i),titleTextColor:e(p,"var(--kip-contrast-color)",r,i),metaTextColor:e(this.resolveMostSevereState(o.chargingModeState??null,o.fieldDriveState??null),"var(--kip-contrast-dim-color)",r,i),primaryMetricsTextColor:e(T,"var(--kip-contrast-color)",r,i),secondaryMetricsTextColor:e(C,"var(--kip-contrast-color)",r,i)};}return s});constructor(){Fa(()=>{let t=this.runtime.options();t&&ge(()=>this.applyConfig(t));}),Fa(()=>{let t=this.displayModels(),i=this.visibleAlternators(),a=this.widgetColors();!this.svg||!a||this.requestRender({alternators:i,displayModels:t,widgetColors:a});});let e=[this.data.subscribePathTreeWithInitial(d.ROOT_PATTERN)],r=false;for(let t of e)if(t.initial.length){r=true;for(let i of t.initial)this.enqueuePathUpdate(i,true);}r&&(this.flushPendingPathUpdates(),this.initialPathPaintDone=true);for(let t of e)t.live$.pipe(Gp(this.destroyRef)).subscribe(i=>{this.enqueuePathUpdate(i);});}ngAfterViewInit(){this.initializeSvg(),this.requestRender();}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null;}initializeSvg(){this.svg=ge$1(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${d.VIEWBOX_WIDTH} ${d.CARD_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Alternator View"),this.layer=this.svg.append("g").attr("class","alternator-layer");}applyConfig(e){let r=this.resolveAlternatorConfig(e);this.trackedDevices.set(r.trackedDevices??[]),this.reprojectSnapshotsToDeviceKeys(r.trackedDevices??[]),this.optionsById.set(r.optionsById),this.cardMode.set(this.normalizeCardMode(r.cardMode));}reprojectSnapshotsToDeviceKeys(e){if(!e.length)return;let r=new Map;e.forEach(t=>{let i=r.get(t.id)??[];i.push(t.key),r.set(t.id,i);}),this.alternatorsByKey.update(t=>{let i=t,a=false;return r.forEach((l,s)=>{let o=t[s];if(o){for(let c of l){if(t[c])continue;let n=e.find(p=>p.key===c);a||(i=G({},t),a=true),i[c]=z(G({},o),{source:n?.source??null,deviceKey:c});}a&&i[s]?.deviceKey===void 0&&delete i[s];}}),a?i:t});}resolveAlternatorConfig(e){let r=e.alternator,t=this.normalizeOptionsById(r?.optionsById??r?.alternatorOptionsById);return {trackedDevices:this.normalizeTrackedDevices(r?.trackedDevices),optionsById:t,cardMode:this.normalizeCardMode(r?.cardMode)}}normalizeTrackedDevices(e){if(!Array.isArray(e))return [];let r=new Map;return e.forEach(t=>{if(!t||typeof t!="object")return;let i=t,a=this.normalizeOptionalString(i.id),l=this.normalizeOptionalString(i.source);if(!a||!l)return;let s=this.normalizeOptionalString(i.key)??`${a}||${l}`;r.set(s,{id:a,source:l,key:s});}),[...r.values()].sort((t,i)=>t.key.localeCompare(i.key))}buildIdToDeviceKeysMap(){let e=new Map;return this.trackedDevices().forEach(r=>{let t=e.get(r.id)??[];t.push(r.key),e.set(r.id,t);}),e}normalizeCardMode(e){let r=e&&typeof e=="object"?e:null;if(!r)return {displayMode:"full",metrics:["voltage","current","power","revolutions"]};let t=this.normalizeStringList(r?.metrics);return {displayMode:r?.displayMode==="compact"?"compact":"full",metrics:t.length?t:["voltage","current","power","revolutions"]}}normalizeStringList(e){if(!Array.isArray(e))return [];let r=new Set;return e.forEach(t=>{if(typeof t!="string")return;let i=t.trim();i.length>0&&r.add(i);}),[...r].sort((t,i)=>t.localeCompare(i))}normalizeOptionsById(e){if(!e||typeof e!="object")return {};let r={};return Object.entries(e).forEach(([t])=>{let i=this.normalizeOptionalString(t);i&&(r[i]={});}),r}normalizeOptionalString(e){if(typeof e!="string")return null;let r=e.trim();return r.length>0?r:null}enqueuePathUpdate(e,r=false){let t=this.parsePath(e.path);if(!t)return;let i=e.update?.data?.value??null,a=e.update?.state??null,l=`${t.id}::${t.key}`;if(this.pendingPathUpdates.set(l,{id:t.id,key:t.key,value:i,state:a}),!r){if(!this.initialPathPaintDone){this.initialPathPaintDone=true,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates();},d.PATH_BATCH_WINDOW_MS));}}parsePath(e){let r=e.match(d.PATH_REGEX);return r?{id:r[1],key:r[2]}:null}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredAlternator(i));let t=this.buildIdToDeviceKeysMap();this.alternatorsByKey.update(i=>{let a=i,l=false;for(let s of e){let o=t.get(s.id),c=o?.length?o:[s.id];for(let n of c){let p=!!o?.length,T=p?this.trackedDevices().find(Q=>Q.key===n):null,C=a[n]??{id:s.id,source:T?.source??null,deviceKey:p?n:void 0},u=G({},C);if(!this.applyValue(u,s.key,s.value,s.state))continue;let D=u.rawPower!=null?u.rawPower:u.voltage!=null&&u.current!=null?u.voltage*u.current:null;D!=null?u.power=Number.isFinite(D)?D:null:u.power=null,u.rawPower==null&&(u.powerState=this.resolveMostSevereState(u.voltageState??null,u.currentState??null)),l||(a=G({},a),l=true),a[n]=u;}}return l?a:i});}trackDiscoveredAlternator(e){let r=this.discoveredAlternatorIds();r.includes(e)||this.discoveredAlternatorIds.set([...r,e].sort((t,i)=>t.localeCompare(i)));}applyValue(e,r,t,i){switch(r){case "name":return this.setValue(e,"name",this.toStringValue(t));case "location":return this.setValue(e,"location",this.toStringValue(t));case "associatedBus":return this.setValue(e,"associatedBus",this.toStringValue(t));case "chargingMode":return this.setMetricValue(e,"chargingMode","chargingModeState",this.toStringValue(t),i);case "voltage":return this.setMetricValue(e,"voltage","voltageState",this.toNumber(t,"V"),i);case "current":return this.setMetricValue(e,"current","currentState",this.toNumber(t,"A"),i);case "power":case "realPower":return this.setMetricValue(e,"rawPower","powerState",this.toNumber(t,"W"),i);case "temperature":return this.setMetricValue(e,"temperature","temperatureState",this.toNumber(t,this.units.getDefaults().Temperature),i);case "revolutions":return this.setMetricValue(e,"revolutions","revolutionsState",this.toNumber(t,"Hz"),i);case "fieldDrive":return this.setMetricValue(e,"fieldDrive","fieldDriveState",this.toNumber(t,"%"),i);case "regulatorTemperature":return this.setMetricValue(e,"regulatorTemperature","regulatorTemperatureState",this.toNumber(t,this.units.getDefaults().Temperature),i);case "setpointVoltage":return this.setMetricValue(e,"setpointVoltage","setpointVoltageState",this.toNumber(t,"V"),i);case "setpointCurrent":return this.setMetricValue(e,"setpointCurrent","setpointCurrentState",this.toNumber(t,"A"),i);default:return false}}setValue(e,r,t){return Object.is(e[r],t)?false:(e[r]=t,true)}setMetricValue(e,r,t,i,a){let l=!Object.is(e[r],i),s=!Object.is(e[t],a);return !l&&!s?false:(e[r]=i,e[t]=a,true)}requestRender(e){let r=this.widgetColors();!this.svg||!r||(this.pendingRenderSnapshot=e??{alternators:this.visibleAlternators(),displayModels:this.displayModels(),widgetColors:r},this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.render(t);})));}render(e){if(!this.layer||!this.svg)return;let r=this.isCompactCardMode(),t=r?C:e$1,i=r?d.COMPACT_CARD_HEIGHT:d.CARD_HEIGHT,a=e.alternators.map((n,p)=>({key:n.deviceKey??n.id,alternator:n,y:p*(i+d.CARD_GAP)})),l=a.length?a[a.length-1].y+i:i;this.svg.attr("viewBox",`0 0 ${d.VIEWBOX_WIDTH} ${l}`);let s=this.layer.selectAll("g.alternator-card").data(a,n=>n.key),o=s.enter().append("g").attr("class","alternator-card");o.append("rect").attr("class","alternator-card-bg"),o.append("rect").attr("class","alternator-state-bar"),o.append("text").attr("class","alternator-title"),o.append("text").attr("class","alternator-id"),o.append("text").attr("class","alternator-mode"),o.append("text").attr("class","alternator-bus"),o.append("text").attr("class","alternator-metrics-1"),o.append("text").attr("class","alternator-metrics-2");let c=o.merge(s);c.attr("transform",n=>`translate(0, ${n.y})`),c.select("rect.alternator-card-bg").attr("x",.5).attr("y",.5).attr("rx",t.cardCornerRadius).attr("ry",t.cardCornerRadius).attr("width",d.VIEWBOX_WIDTH-1).attr("height",i-1).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5).attr("fill","none"),c.select("rect.alternator-state-bar").attr("x",1.5).attr("y",1.5).attr("rx",t.stateBarCornerRadius).attr("ry",t.stateBarCornerRadius).attr("width",3).attr("height",i-3).attr("fill",n=>e.displayModels[n.key]?.stateBarColor??e.widgetColors.dim),e.alternators.length>1?c.select("text.alternator-title").attr("x",t.titleX).attr("y",t.titleY).attr("font-size",t.titleFontSize).attr("fill",n=>e.displayModels[n.key]?.titleTextColor??"var(--kip-contrast-color)").text(n=>e.displayModels[n.key]?.titleText??this.resolveTitleText(n.alternator)):c.select("text.alternator-title").text(""),c.select("text.alternator-id").attr("x",t.idX).attr("y",t.idY).attr("text-anchor","end").attr("font-size",t.idFontSize).attr("fill","var(--kip-contrast-dim-color)").text(n=>n.alternator.id),c.select("text.alternator-mode").attr("x",t.metaLeftX).attr("y",t.metaY).attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",n=>e.displayModels[n.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(n=>e.displayModels[n.key]?.modeText??""),c.select("text.alternator-bus").attr("x",t.metaRightX).attr("y",t.metaY).attr("text-anchor","end").attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",n=>e.displayModels[n.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(n=>e.displayModels[n.key]?.busText??""),c.select("text.alternator-metrics-1").attr("x",t.lineOneX).attr("y",t.lineOneY).attr("font-size",t.lineOneFontSize).attr("fill",n=>e.displayModels[n.key]?.primaryMetricsTextColor??"var(--kip-contrast-color)").text(n=>e.displayModels[n.key]?.metricsLineOne??""),c.select("text.alternator-metrics-2").attr("x",t.lineTwoX).attr("y",t.lineTwoY).attr("font-size",t.lineTwoFontSize).attr("opacity",.85).attr("fill",n=>e.displayModels[n.key]?.secondaryMetricsTextColor??"var(--kip-contrast-color)").text(n=>e.displayModels[n.key]?.metricsLineTwo??""),s.exit().remove();}displayName(e){return e.name?.trim()||e.id}resolveTitleText(e){return e.name||`Alternator ${e.id}`}resolveModeText(e){return e.chargingMode?`Mode ${e.chargingMode}`:e.fieldDrive!=null?`Field ${e.fieldDrive.toFixed(0)} %`:"Mode -"}buildMetricRows(e){let r=this.cardMode();if(this.activeDisplayMode()==="full")return [`V ${this.formatValue(e.voltage,"V")} A ${this.formatValue(e.current,"A")}`,`P ${this.formatValue(e.power,"W")} RPM ${this.formatRevolutions(e.revolutions)}`];let t=r.metrics.map(l=>this.toMetricLabel(l,e)).filter(l=>!!l);if(!t.length)return ["V - A -","P - RPM -"];let i=t.slice(0,2).join(" "),a=t.slice(2,4).join(" ");return [i||" ",a||" "]}toMetricLabel(e,r){switch(e){case "voltage":return `V ${this.formatValue(r.voltage,"V")}`;case "current":return `A ${this.formatValue(r.current,"A")}`;case "power":return `P ${this.formatValue(r.power,"W")}`;case "temperature":return `T ${this.formatTemperature(r.temperature)}`;case "revolutions":return `RPM ${this.formatRevolutions(r.revolutions)}`;case "fieldDrive":return `FD ${this.formatPercent(r.fieldDrive)}`;case "regulatorTemperature":return `RT ${this.formatTemperature(r.regulatorTemperature)}`;default:return null}}formatValue(e,r){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${r}`}formatTemperature(e){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}formatRevolutions(e){return e==null||Number.isNaN(e)?"-":Math.round(e*60).toString()}formatPercent(e){return e==null||Number.isNaN(e)?"-":`${e.toFixed(0)} %`}toStringValue(e){return typeof e=="string"?e:null}resolveMostSevereState(...e){return e.some(r=>r===n$1.Alert)?n$1.Alert:e.some(r=>r===n$1.Alarm)?n$1.Alarm:e.some(r=>r===n$1.Warn)?n$1.Warn:e.some(r=>r===n$1.Normal)?n$1.Normal:null}toNumber(e,r){if(e==null||typeof e=="boolean")return null;let t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return null;let i=this.units.convertToUnit(r,t);return Number.isFinite(i)?i:t}static \u0275fac=function(r){return new(r||d)};static \u0275cmp=JD({type:d,selectors:[["widget-alternator"]],viewQuery:function(r,t){r&1&&eg(t.svgRef,ie,5),r&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],renderMode:[1,"renderMode"]},decls:4,vars:3,consts:[["alternatorSvg",""],[3,"text","color"],["aria-hidden","false",1,"alternator-svg"],[1,"alternator-empty"],[1,"alternator-empty-title"],[1,"alternator-empty-sub"]],template:function(r,t){r&1&&($h(0,"widget-title",1),wd(),$h(1,"svg",2,0),_w(3,oe,5,0,"div",3)),r&2&&(Bh("text",t.displayLabel())("color",t.labelColor()),EE(3),Mw(t.hasAlternators()?-1:3));},dependencies:[x],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.alternator-svg[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20;padding:0 10px 10px}.alternator-empty[_ngcontent-%COMP%]{position:absolute;inset:0;margin:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.alternator-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.alternator-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}"]})};export{Z as WidgetAlternatorComponent};
1
+ import {C,e as e$1}from'./chunk-DPnbM-aB.js';import {g as ge$1}from'./chunk-TakPRI3t.js';import {e9 as a,d1 as Hj,w,du as p,aS as De,bu as ut,aY as xe,$ as $j,v as vt,D as Dt,F as Fa,dn as ge,a_ as Gp,cv as G,cw as z,dx as n$1,J as JD,dC as x,c as $h,cn as wd,_ as _w,B as Bh,e as EE,M as Mw,f as eg,K as Kw,P as Pi,T as TT,u as ul}from'./main-YKDNK5VZ.js';import {c,e}from'./chunk-BIb-xYiS.js';var ie=["alternatorSvg"];function oe(d,e){d&1&&(Pi(0,"div",3)(1,"div",4),TT(2,"No alternators detected"),ul(),Pi(3,"div",5),TT(4,"Check Signal K alternator paths or select alternators in widget settings."),ul()());}function ne(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Z=class d{static ALTERNATOR_DESCRIPTOR=a("widget-alternator");static SELF_ROOT_PATH=(()=>{let e=d.ALTERNATOR_DESCRIPTOR?.selfRootPath;if(!e)throw new Error("[WidgetAlternatorComponent] Descriptor missing or selfRootPath not set; check widget registration.");return e})();static ROOT_PATTERN=`${d.SELF_ROOT_PATH}.*`;static PATH_REGEX=new RegExp(`^${ne(d.SELF_ROOT_PATH)}\\.([^.]+)\\.(.+)$`);static VIEWBOX_WIDTH=200;static CARD_HEIGHT=100;static COMPACT_CARD_HEIGHT=100;static CARD_GAP=8;static PATH_BATCH_WINDOW_MS=500;static DEFAULT_CONFIG={color:"contrast",ignoreZones:false,alternator:{trackedDevices:[],optionsById:{}}};id=Hj.required();type=Hj.required();theme=Hj.required();renderMode=Hj(null);runtime=w(p);data=w(De);units=w(ut);destroyRef=w(xe);svgRef=$j.required("alternatorSvg");svg;layer;pendingPathUpdates=new Map;pathBatchTimerId=null;initialPathPaintDone=false;renderFrameId=null;pendingRenderSnapshot=null;discoveredAlternatorIds=vt([]);trackedDevices=vt([]);optionsById=vt({});cardMode=vt({displayMode:"full",metrics:["voltage","current","power","revolutions"]});alternatorsByKey=vt({});visibleAlternatorKeys=Dt(()=>{let e=this.trackedDevices();if(e.length)return e.map(i=>i.key);let r=this.alternatorsByKey(),t=new Set(this.discoveredAlternatorIds());return Object.keys(r).filter(i=>{let a=r[i];return !!a&&t.has(a.id)}).sort((i,a)=>i.localeCompare(a))});visibleAlternators=Dt(()=>{let e=this.visibleAlternatorKeys(),r=this.alternatorsByKey();return e.map(t=>r[t]).filter(t=>!!t)});hasAlternators=Dt(()=>this.visibleAlternators().length>0);activeDisplayMode=Dt(()=>this.renderMode()??this.cardMode().displayMode??"full");isCompactCardMode=Dt(()=>this.activeDisplayMode()==="compact");colorRole=Dt(()=>this.runtime.options()?.color??"contrast");ignoreZones=Dt(()=>this.runtime.options()?.ignoreZones??false);displayLabel=Dt(()=>{let e=this.visibleAlternators();return e.length!==1?"Alternators":this.resolveTitleText(e[0])});labelColor=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e).dim:"var(--kip-contrast-dim-color)"});widgetColors=Dt(()=>{let e=this.theme();return e?c(this.colorRole(),e):null});displayModels=Dt(()=>{let e$1=this.visibleAlternators(),r=this.theme(),t=this.widgetColors(),i=this.ignoreZones(),a=new Map;e$1.forEach(o=>a.set(o.id,(a.get(o.id)??0)+1));let l=new Set([...a.entries()].filter(([,o])=>o>1).map(([o])=>o)),s={};for(let o of e$1){let c=o.deviceKey??o.id,n=!!o.source&&l.has(o.id),p=this.resolveMostSevereState(o.powerState??null,o.currentState??null,o.voltageState??null,o.temperatureState??null,o.chargingModeState??null,o.revolutionsState??null,o.fieldDriveState??null,o.regulatorTemperatureState??null),T=this.resolveMostSevereState(o.voltageState??null,o.currentState??null),C=this.resolveMostSevereState(o.powerState??null,o.revolutionsState??null,o.temperatureState??null,o.regulatorTemperatureState??null),[u,I]=this.buildMetricRows(o);s[c]={id:o.id,titleText:this.resolveTitleText(o),modeText:this.isCompactCardMode()?"":this.resolveModeText(o),busText:this.isCompactCardMode()?"":n?o.source??"-":o.associatedBus||o.location||"-",metricsLineOne:u,metricsLineTwo:I,stateBarColor:e(p,t?.dim??"var(--kip-contrast-color)",r,i),titleTextColor:e(p,"var(--kip-contrast-color)",r,i),metaTextColor:e(this.resolveMostSevereState(o.chargingModeState??null,o.fieldDriveState??null),"var(--kip-contrast-dim-color)",r,i),primaryMetricsTextColor:e(T,"var(--kip-contrast-color)",r,i),secondaryMetricsTextColor:e(C,"var(--kip-contrast-color)",r,i)};}return s});constructor(){Fa(()=>{let t=this.runtime.options();t&&ge(()=>this.applyConfig(t));}),Fa(()=>{let t=this.displayModels(),i=this.visibleAlternators(),a=this.widgetColors();!this.svg||!a||this.requestRender({alternators:i,displayModels:t,widgetColors:a});});let e=[this.data.subscribePathTreeWithInitial(d.ROOT_PATTERN)],r=false;for(let t of e)if(t.initial.length){r=true;for(let i of t.initial)this.enqueuePathUpdate(i,true);}r&&(this.flushPendingPathUpdates(),this.initialPathPaintDone=true);for(let t of e)t.live$.pipe(Gp(this.destroyRef)).subscribe(i=>{this.enqueuePathUpdate(i);});}ngAfterViewInit(){this.initializeSvg(),this.requestRender();}ngOnDestroy(){this.pathBatchTimerId!==null&&(clearTimeout(this.pathBatchTimerId),this.pathBatchTimerId=null),this.renderFrameId!==null&&(cancelAnimationFrame(this.renderFrameId),this.renderFrameId=null),this.pendingRenderSnapshot=null;}initializeSvg(){this.svg=ge$1(this.svgRef().nativeElement),this.svg.attr("viewBox",`0 0 ${d.VIEWBOX_WIDTH} ${d.CARD_HEIGHT}`).attr("preserveAspectRatio","xMidYMid meet").attr("role","img").attr("aria-label","Alternator View"),this.layer=this.svg.append("g").attr("class","alternator-layer");}applyConfig(e){let r=this.resolveAlternatorConfig(e);this.trackedDevices.set(r.trackedDevices??[]),this.reprojectSnapshotsToDeviceKeys(r.trackedDevices??[]),this.optionsById.set(r.optionsById),this.cardMode.set(this.normalizeCardMode(r.cardMode));}reprojectSnapshotsToDeviceKeys(e){if(!e.length)return;let r=new Map;e.forEach(t=>{let i=r.get(t.id)??[];i.push(t.key),r.set(t.id,i);}),this.alternatorsByKey.update(t=>{let i=t,a=false;return r.forEach((l,s)=>{let o=t[s];if(o){for(let c of l){if(t[c])continue;let n=e.find(p=>p.key===c);a||(i=G({},t),a=true),i[c]=z(G({},o),{source:n?.source??null,deviceKey:c});}a&&i[s]?.deviceKey===void 0&&delete i[s];}}),a?i:t});}resolveAlternatorConfig(e){let r=e.alternator,t=this.normalizeOptionsById(r?.optionsById??r?.alternatorOptionsById);return {trackedDevices:this.normalizeTrackedDevices(r?.trackedDevices),optionsById:t,cardMode:this.normalizeCardMode(r?.cardMode)}}normalizeTrackedDevices(e){if(!Array.isArray(e))return [];let r=new Map;return e.forEach(t=>{if(!t||typeof t!="object")return;let i=t,a=this.normalizeOptionalString(i.id),l=this.normalizeOptionalString(i.source);if(!a||!l)return;let s=this.normalizeOptionalString(i.key)??`${a}||${l}`;r.set(s,{id:a,source:l,key:s});}),[...r.values()].sort((t,i)=>t.key.localeCompare(i.key))}buildIdToDeviceKeysMap(){let e=new Map;return this.trackedDevices().forEach(r=>{let t=e.get(r.id)??[];t.push(r.key),e.set(r.id,t);}),e}normalizeCardMode(e){let r=e&&typeof e=="object"?e:null;if(!r)return {displayMode:"full",metrics:["voltage","current","power","revolutions"]};let t=this.normalizeStringList(r?.metrics);return {displayMode:r?.displayMode==="compact"?"compact":"full",metrics:t.length?t:["voltage","current","power","revolutions"]}}normalizeStringList(e){if(!Array.isArray(e))return [];let r=new Set;return e.forEach(t=>{if(typeof t!="string")return;let i=t.trim();i.length>0&&r.add(i);}),[...r].sort((t,i)=>t.localeCompare(i))}normalizeOptionsById(e){if(!e||typeof e!="object")return {};let r={};return Object.entries(e).forEach(([t])=>{let i=this.normalizeOptionalString(t);i&&(r[i]={});}),r}normalizeOptionalString(e){if(typeof e!="string")return null;let r=e.trim();return r.length>0?r:null}enqueuePathUpdate(e,r=false){let t=this.parsePath(e.path);if(!t)return;let i=e.update?.data?.value??null,a=e.update?.state??null,l=`${t.id}::${t.key}`;if(this.pendingPathUpdates.set(l,{id:t.id,key:t.key,value:i,state:a}),!r){if(!this.initialPathPaintDone){this.initialPathPaintDone=true,this.flushPendingPathUpdates();return}this.pathBatchTimerId===null&&(this.pathBatchTimerId=window.setTimeout(()=>{this.pathBatchTimerId=null,this.flushPendingPathUpdates();},d.PATH_BATCH_WINDOW_MS));}}parsePath(e){let r=e.match(d.PATH_REGEX);return r?{id:r[1],key:r[2]}:null}flushPendingPathUpdates(){if(!this.pendingPathUpdates.size)return;let e=Array.from(this.pendingPathUpdates.values());this.pendingPathUpdates.clear(),new Set(e.map(i=>i.id)).forEach(i=>this.trackDiscoveredAlternator(i));let t=this.buildIdToDeviceKeysMap();this.alternatorsByKey.update(i=>{let a=i,l=false;for(let s of e){let o=t.get(s.id),c=o?.length?o:[s.id];for(let n of c){let p=!!o?.length,T=p?this.trackedDevices().find(Q=>Q.key===n):null,C=a[n]??{id:s.id,source:T?.source??null,deviceKey:p?n:void 0},u=G({},C);if(!this.applyValue(u,s.key,s.value,s.state))continue;let D=u.rawPower!=null?u.rawPower:u.voltage!=null&&u.current!=null?u.voltage*u.current:null;D!=null?u.power=Number.isFinite(D)?D:null:u.power=null,u.rawPower==null&&(u.powerState=this.resolveMostSevereState(u.voltageState??null,u.currentState??null)),l||(a=G({},a),l=true),a[n]=u;}}return l?a:i});}trackDiscoveredAlternator(e){let r=this.discoveredAlternatorIds();r.includes(e)||this.discoveredAlternatorIds.set([...r,e].sort((t,i)=>t.localeCompare(i)));}applyValue(e,r,t,i){switch(r){case "name":return this.setValue(e,"name",this.toStringValue(t));case "location":return this.setValue(e,"location",this.toStringValue(t));case "associatedBus":return this.setValue(e,"associatedBus",this.toStringValue(t));case "chargingMode":return this.setMetricValue(e,"chargingMode","chargingModeState",this.toStringValue(t),i);case "voltage":return this.setMetricValue(e,"voltage","voltageState",this.toNumber(t,"V"),i);case "current":return this.setMetricValue(e,"current","currentState",this.toNumber(t,"A"),i);case "power":case "realPower":return this.setMetricValue(e,"rawPower","powerState",this.toNumber(t,"W"),i);case "temperature":return this.setMetricValue(e,"temperature","temperatureState",this.toNumber(t,this.units.getDefaults().Temperature),i);case "revolutions":return this.setMetricValue(e,"revolutions","revolutionsState",this.toNumber(t,"Hz"),i);case "fieldDrive":return this.setMetricValue(e,"fieldDrive","fieldDriveState",this.toNumber(t,"%"),i);case "regulatorTemperature":return this.setMetricValue(e,"regulatorTemperature","regulatorTemperatureState",this.toNumber(t,this.units.getDefaults().Temperature),i);case "setpointVoltage":return this.setMetricValue(e,"setpointVoltage","setpointVoltageState",this.toNumber(t,"V"),i);case "setpointCurrent":return this.setMetricValue(e,"setpointCurrent","setpointCurrentState",this.toNumber(t,"A"),i);default:return false}}setValue(e,r,t){return Object.is(e[r],t)?false:(e[r]=t,true)}setMetricValue(e,r,t,i,a){let l=!Object.is(e[r],i),s=!Object.is(e[t],a);return !l&&!s?false:(e[r]=i,e[t]=a,true)}requestRender(e){let r=this.widgetColors();!this.svg||!r||(this.pendingRenderSnapshot=e??{alternators:this.visibleAlternators(),displayModels:this.displayModels(),widgetColors:r},this.renderFrameId===null&&(this.renderFrameId=requestAnimationFrame(()=>{this.renderFrameId=null;let t=this.pendingRenderSnapshot;this.pendingRenderSnapshot=null,t&&this.render(t);})));}render(e){if(!this.layer||!this.svg)return;let r=this.isCompactCardMode(),t=r?C:e$1,i=r?d.COMPACT_CARD_HEIGHT:d.CARD_HEIGHT,a=e.alternators.map((n,p)=>({key:n.deviceKey??n.id,alternator:n,y:p*(i+d.CARD_GAP)})),l=a.length?a[a.length-1].y+i:i;this.svg.attr("viewBox",`0 0 ${d.VIEWBOX_WIDTH} ${l}`);let s=this.layer.selectAll("g.alternator-card").data(a,n=>n.key),o=s.enter().append("g").attr("class","alternator-card");o.append("rect").attr("class","alternator-card-bg"),o.append("rect").attr("class","alternator-state-bar"),o.append("text").attr("class","alternator-title"),o.append("text").attr("class","alternator-id"),o.append("text").attr("class","alternator-mode"),o.append("text").attr("class","alternator-bus"),o.append("text").attr("class","alternator-metrics-1"),o.append("text").attr("class","alternator-metrics-2");let c=o.merge(s);c.attr("transform",n=>`translate(0, ${n.y})`),c.select("rect.alternator-card-bg").attr("x",.5).attr("y",.5).attr("rx",t.cardCornerRadius).attr("ry",t.cardCornerRadius).attr("width",d.VIEWBOX_WIDTH-1).attr("height",i-1).attr("stroke","var(--mat-sys-outline-variant)").attr("stroke-width",.5).attr("fill","none"),c.select("rect.alternator-state-bar").attr("x",1.5).attr("y",1.5).attr("rx",t.stateBarCornerRadius).attr("ry",t.stateBarCornerRadius).attr("width",3).attr("height",i-3).attr("fill",n=>e.displayModels[n.key]?.stateBarColor??e.widgetColors.dim),e.alternators.length>1?c.select("text.alternator-title").attr("x",t.titleX).attr("y",t.titleY).attr("font-size",t.titleFontSize).attr("fill",n=>e.displayModels[n.key]?.titleTextColor??"var(--kip-contrast-color)").text(n=>e.displayModels[n.key]?.titleText??this.resolveTitleText(n.alternator)):c.select("text.alternator-title").text(""),c.select("text.alternator-id").attr("x",t.idX).attr("y",t.idY).attr("text-anchor","end").attr("font-size",t.idFontSize).attr("fill","var(--kip-contrast-dim-color)").text(n=>n.alternator.id),c.select("text.alternator-mode").attr("x",t.metaLeftX).attr("y",t.metaY).attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",n=>e.displayModels[n.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(n=>e.displayModels[n.key]?.modeText??""),c.select("text.alternator-bus").attr("x",t.metaRightX).attr("y",t.metaY).attr("text-anchor","end").attr("font-size",t.metaFontSize).attr("opacity",.8).attr("fill",n=>e.displayModels[n.key]?.metaTextColor??"var(--kip-contrast-dim-color)").text(n=>e.displayModels[n.key]?.busText??""),c.select("text.alternator-metrics-1").attr("x",t.lineOneX).attr("y",t.lineOneY).attr("font-size",t.lineOneFontSize).attr("fill",n=>e.displayModels[n.key]?.primaryMetricsTextColor??"var(--kip-contrast-color)").text(n=>e.displayModels[n.key]?.metricsLineOne??""),c.select("text.alternator-metrics-2").attr("x",t.lineTwoX).attr("y",t.lineTwoY).attr("font-size",t.lineTwoFontSize).attr("opacity",.85).attr("fill",n=>e.displayModels[n.key]?.secondaryMetricsTextColor??"var(--kip-contrast-color)").text(n=>e.displayModels[n.key]?.metricsLineTwo??""),s.exit().remove();}displayName(e){return e.name?.trim()||e.id}resolveTitleText(e){return e.name||`Alternator ${e.id}`}resolveModeText(e){return e.chargingMode?`Mode ${e.chargingMode}`:e.fieldDrive!=null?`Field ${e.fieldDrive.toFixed(0)} %`:"Mode -"}buildMetricRows(e){let r=this.cardMode();if(this.activeDisplayMode()==="full")return [`V ${this.formatValue(e.voltage,"V")} A ${this.formatValue(e.current,"A")}`,`P ${this.formatValue(e.power,"W")} RPM ${this.formatRevolutions(e.revolutions)}`];let t=r.metrics.map(l=>this.toMetricLabel(l,e)).filter(l=>!!l);if(!t.length)return ["V - A -","P - RPM -"];let i=t.slice(0,2).join(" "),a=t.slice(2,4).join(" ");return [i||" ",a||" "]}toMetricLabel(e,r){switch(e){case "voltage":return `V ${this.formatValue(r.voltage,"V")}`;case "current":return `A ${this.formatValue(r.current,"A")}`;case "power":return `P ${this.formatValue(r.power,"W")}`;case "temperature":return `T ${this.formatTemperature(r.temperature)}`;case "revolutions":return `RPM ${this.formatRevolutions(r.revolutions)}`;case "fieldDrive":return `FD ${this.formatPercent(r.fieldDrive)}`;case "regulatorTemperature":return `RT ${this.formatTemperature(r.regulatorTemperature)}`;default:return null}}formatValue(e,r){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${r}`}formatTemperature(e){return e==null||Number.isNaN(e)?"-":`${e.toFixed(1)} ${this.units.getDefaults().Temperature==="celsius"?"\xB0C":"\xB0F"}`}formatRevolutions(e){return e==null||Number.isNaN(e)?"-":Math.round(e*60).toString()}formatPercent(e){return e==null||Number.isNaN(e)?"-":`${e.toFixed(0)} %`}toStringValue(e){return typeof e=="string"?e:null}resolveMostSevereState(...e){return e.some(r=>r===n$1.Alert)?n$1.Alert:e.some(r=>r===n$1.Alarm)?n$1.Alarm:e.some(r=>r===n$1.Warn)?n$1.Warn:e.some(r=>r===n$1.Normal)?n$1.Normal:null}toNumber(e,r){if(e==null||typeof e=="boolean")return null;let t=typeof e=="number"?e:Number(e);if(!Number.isFinite(t))return null;let i=this.units.convertToUnit(r,t);return Number.isFinite(i)?i:t}static \u0275fac=function(r){return new(r||d)};static \u0275cmp=JD({type:d,selectors:[["widget-alternator"]],viewQuery:function(r,t){r&1&&eg(t.svgRef,ie,5),r&2&&Kw();},inputs:{id:[1,"id"],type:[1,"type"],theme:[1,"theme"],renderMode:[1,"renderMode"]},decls:4,vars:3,consts:[["alternatorSvg",""],[3,"text","color"],["aria-hidden","false",1,"alternator-svg"],[1,"alternator-empty"],[1,"alternator-empty-title"],[1,"alternator-empty-sub"]],template:function(r,t){r&1&&($h(0,"widget-title",1),wd(),$h(1,"svg",2,0),_w(3,oe,5,0,"div",3)),r&2&&(Bh("text",t.displayLabel())("color",t.labelColor()),EE(3),Mw(t.hasAlternators()?-1:3));},dependencies:[x],styles:["[_nghost-%COMP%]{display:block;height:100%;width:100%;position:relative;overflow:hidden}.alternator-svg[_ngcontent-%COMP%]{display:block;position:absolute;left:0;right:0;top:15%;height:85%;width:100%;overflow:hidden;z-index:20;padding:0 10px 10px}.alternator-empty[_ngcontent-%COMP%]{position:absolute;inset:0;margin:10px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;color:var(--mat-sys-on-surface);background:color-mix(in srgb,var(--kip-widget-card-background-color) 92%,transparent)}.alternator-empty-title[_ngcontent-%COMP%]{font-size:18px;font-weight:600}.alternator-empty-sub[_ngcontent-%COMP%]{font-size:14px;opacity:.8}"]})};export{Z as WidgetAlternatorComponent};