ocearo-ui 2.1.1 → 2.1.3

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 (103) hide show
  1. package/404.html +1 -1
  2. package/README.fr.md +9 -7
  3. package/README.md +9 -7
  4. package/__next.__PAGE__.txt +3 -3
  5. package/__next._full.txt +3 -3
  6. package/__next._tree.txt +2 -2
  7. package/_next/static/chunks/0ath9h2eo-m4-.js +1 -0
  8. package/_next/static/chunks/0bxzs0khjn1uj.js +1 -0
  9. package/_next/static/chunks/0ejjon45nq_-h.js +9 -0
  10. package/_next/static/chunks/{0zvzu5fnwh4_a.js → 0glm63vhzbxk5.js} +2 -2
  11. package/_next/static/chunks/0n5v9mjln3x9c.js +121 -0
  12. package/_next/static/chunks/{1l-jew0-1-3eq.js → 0ngl63fz0a-bo.js} +2 -2
  13. package/_next/static/chunks/0nq1o9-m7bhjg.js +1 -0
  14. package/_next/static/chunks/0vhk5q54me91_.js +1 -0
  15. package/_next/static/chunks/0wi5jop1ihbm6.js +2 -0
  16. package/_next/static/chunks/1442uc2w4y1ve.js +503 -0
  17. package/_next/static/chunks/18vlmqe7txbmt.js +1 -0
  18. package/_next/static/chunks/{2gr1d26f-ymoh.js → 192c42s2wc7qe.js} +1 -1
  19. package/_next/static/chunks/1_twx50ejqan5.js +1 -0
  20. package/_next/static/chunks/1na56snuhu-pc.js +346 -0
  21. package/_next/static/chunks/{3qik_nv7zlj4e.js → 1quvj-861o57h.js} +1 -1
  22. package/_next/static/chunks/1vchkqgn-xw-o.js +1 -0
  23. package/_next/static/chunks/{0j11dppxb9l0b.js → 1zuex-na8y-w4.js} +1 -1
  24. package/_next/static/chunks/21408p9d6c0sg.js +1 -0
  25. package/_next/static/chunks/2393lwi8kee3m.js +48 -0
  26. package/_next/static/chunks/25v2cwta2fy-7.js +393 -0
  27. package/_next/static/chunks/28wfa6j-9g_qc.js +1 -0
  28. package/_next/static/chunks/2cecf_xnd_9em.js +1 -0
  29. package/_next/static/chunks/2die6btm3_mhq.js +1 -0
  30. package/_next/static/chunks/{18_i6mf6hb_c7.js → 2gsiwp60towtx.js} +1 -1
  31. package/_next/static/chunks/2ijx7rln4jshb.css +3 -0
  32. package/_next/static/chunks/2qch0at4eelx8.js +1 -0
  33. package/_next/static/chunks/2qylgmdj-32um.js +503 -0
  34. package/_next/static/chunks/2xntuu6mzh41s.js +1 -0
  35. package/_next/static/chunks/30p1dpgmonstj.js +1 -0
  36. package/_next/static/chunks/31p7nz0hfuym7.js +1 -0
  37. package/_next/static/chunks/{1e-w_-usen7fy.js → 34nhy77liurum.js} +2 -2
  38. package/_next/static/chunks/3h_m2s30sr9mt.js +430 -0
  39. package/_next/static/chunks/3j453-2u58qbv.js +1 -0
  40. package/_next/static/chunks/3k-r-4veivdjr.js +1 -0
  41. package/_next/static/chunks/3l25j666ze4c1.js +1 -0
  42. package/_next/static/chunks/3nv6p6vvu2zlg.js +1 -0
  43. package/_next/static/chunks/3yz0mxxv4vrfg.js +1 -0
  44. package/_next/static/chunks/3z29h80ysf4f1.js +739 -0
  45. package/_next/static/chunks/40b8ooaw6x7my.js +180 -0
  46. package/_next/static/chunks/44f5hh9caupby.js +1 -0
  47. package/_not-found/__next._full.txt +2 -2
  48. package/_not-found/__next._not-found.__PAGE__.txt +2 -2
  49. package/_not-found/__next._tree.txt +2 -2
  50. package/_not-found.html +1 -1
  51. package/_not-found.txt +2 -2
  52. package/boats/boats.json +11 -19
  53. package/boats/windsurf/assets/license.txt +6 -8
  54. package/boats/windsurf/assets/rider.glb +0 -0
  55. package/boats/wingfoil/assets/license.txt +9 -0
  56. package/boats/wingfoil/assets/rider.glb +0 -0
  57. package/guide/bathymetry.jpg +0 -0
  58. package/guide/weather.jpg +0 -0
  59. package/index.html +1 -1
  60. package/index.txt +3 -3
  61. package/package.json +2 -2
  62. package/settings/__next._full.txt +3 -3
  63. package/settings/__next._tree.txt +2 -2
  64. package/settings/__next.settings.__PAGE__.txt +3 -3
  65. package/settings.html +1 -1
  66. package/settings.txt +3 -3
  67. package/_next/static/chunks/0-jqvc-r0kh0c.js +0 -1
  68. package/_next/static/chunks/05do10p9ldt1p.js +0 -409
  69. package/_next/static/chunks/096zaxs1gf_3q.js +0 -2
  70. package/_next/static/chunks/0b3cus8izqkmg.js +0 -119
  71. package/_next/static/chunks/0jucaltuccn03.js +0 -1
  72. package/_next/static/chunks/0m7wbuocx-b4_.js +0 -9
  73. package/_next/static/chunks/1_g85m2d7jjpo.css +0 -3
  74. package/_next/static/chunks/1arvue9o-atui.js +0 -739
  75. package/_next/static/chunks/1bo0ke8gjc1c2.js +0 -1
  76. package/_next/static/chunks/1cp1kkarm5gxz.js +0 -1
  77. package/_next/static/chunks/1hz_mzl8l35j8.js +0 -1
  78. package/_next/static/chunks/1k72cpd0x8veh.js +0 -1
  79. package/_next/static/chunks/2aivnrnff0avu.js +0 -446
  80. package/_next/static/chunks/2fthh9f57zzm2.js +0 -1
  81. package/_next/static/chunks/2mzecccvvbjr1.js +0 -1
  82. package/_next/static/chunks/2r98jty3a4wel.js +0 -564
  83. package/_next/static/chunks/2v6ebsavxlgyw.js +0 -1
  84. package/_next/static/chunks/2w71oj1brox5z.js +0 -1
  85. package/_next/static/chunks/2wayx8t5r5fi9.js +0 -1
  86. package/_next/static/chunks/33u782y6vhw-f.js +0 -346
  87. package/_next/static/chunks/3qzb9nvvw-b-k.js +0 -1
  88. package/_next/static/chunks/3r8nellt-dsed.js +0 -1
  89. package/_next/static/chunks/3td9mnhvcj9cq.js +0 -1
  90. package/_next/static/chunks/3wwn1rti8oc_r.js +0 -1
  91. package/_next/static/chunks/41odv061mfm6t.js +0 -1
  92. package/_next/static/chunks/432vtxrssprta.js +0 -1
  93. package/boats/optimist/Scene.jsx +0 -28
  94. package/boats/optimist/assets/license.txt +0 -11
  95. package/boats/optimist/assets/scene-transformed.glb +0 -0
  96. package/boats/sailboat/Scene.jsx +0 -21
  97. package/boats/sailboat/assets/license.txt +0 -10
  98. package/boats/sailboat/assets/scene-transformed.glb +0 -0
  99. package/boats/windsurf/Scene.jsx +0 -22
  100. package/boats/windsurf/assets/scene-transformed.glb +0 -0
  101. /package/_next/static/{QMD1VkISjzTIQCzLSHPpB → RbyYYNpJGkiHnU7YTHoaU}/_buildManifest.js +0 -0
  102. /package/_next/static/{QMD1VkISjzTIQCzLSHPpB → RbyYYNpJGkiHnU7YTHoaU}/_clientMiddlewareManifest.js +0 -0
  103. /package/_next/static/{QMD1VkISjzTIQCzLSHPpB → RbyYYNpJGkiHnU7YTHoaU}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54784,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(46932),n=e.i(49721),i=e.i(68757);e.i(85269);var l=e.i(62588),r=e.i(77291),o=e.i(83646),c=e.i(85709),d=e.i(83402);let u=({title:e,icon:s,iconClass:i="text-oBlue",action:l,className:r="",children:o,...c})=>(0,t.jsxs)("div",{className:`tesla-card flex flex-col min-w-0 ${r}`,...c,children:[(e||s||l)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3 shrink-0",children:[s&&(a.default.isValidElement(s)?(0,t.jsx)("span",{className:`${i} flex items-center`,children:s}):(0,t.jsx)(n.FontAwesomeIcon,{icon:s,className:`${i} text-sm opacity-80`})),e&&(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-secondary truncate",children:e}),l&&(0,t.jsx)("div",{className:"ml-auto flex items-center gap-2",children:l})]}),o]}),m=({title:e,icon:a,iconColorClass:s="text-oBlue",hasData:n=!0,noDataMessage:i="No data available",children:l,className:r=""})=>{let o="function"==typeof a?a():a;return n?(0,t.jsx)(u,{title:e,icon:o,iconClass:s,className:`h-full overflow-hidden ${r}`,children:(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center min-h-0 overflow-hidden",children:l})}):(0,t.jsx)(u,{title:e,icon:o,iconClass:s,className:`h-full overflow-hidden ${r}`,children:(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center min-h-0",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-hero font-medium text-hud-dim mb-2",children:"N/A"}),(0,t.jsx)("div",{className:"text-caption font-semibold uppercase text-hud-muted",children:i})]})})})};var x=e.i(22831),h=e.i(20705);let p=[1,2,5,10,20],g={cardinal:"#f2c200",isolated_danger:"#e0483a",safe_water:"#f0f0f0",special_purpose:"#f2c200",station:"#8a9097"},f=a.default.memo(()=>{let e,{t:s}=(0,x.useTranslation)(),{targets:u,atons:f}=(0,l.useAIS)(),{statuses:v}=(0,r.default)({always:!0}),{scene:y,id:w}=(0,o.default)(),[b,N]=(0,a.useState)(5),j=d.default.get("debugMode"),k=(0,a.useCallback)(e=>{e.preventDefault(),N(t=>{let a=p.indexOf(t);return -1===a?t:e.deltaY<0&&a>0?p[a-1]:e.deltaY>0&&a<p.length-1?p[a+1]:t})},[]),C=(0,c.useSignalKPath)("navigation.position"),M=(0,c.useSignalKPath)("navigation.headingTrue"),S=(0,c.useSignalKPath)("navigation.headingMagnetic"),W=(0,c.useSignalKPath)("navigation.courseOverGroundTrue"),$=M??S??W??0,F=(0,a.useMemo)(()=>u.length&&C?u.filter(e=>e.distanceMeters&&e.distanceMeters<=1852*b).map(e=>{let t=e.distanceMeters/1852,a=((180*Math.atan2(e.sceneX,-e.sceneZ)/Math.PI+360)%360-180*$/Math.PI+360)%360,s=null===e.cpaMeters?null:e.cpaMeters/1852;return{id:e.mmsi,name:e.name||`MMSI ${e.mmsi}`,distance:Math.round(10*t)/10,bearing:Math.round(a),type:e.shipType||"unknown",cpa:null===s?null:Math.round(10*s)/10}}).sort((e,t)=>e.distance-t.distance).slice(0,10):[],[u,b,C,$]),T=(0,a.useMemo)(()=>f.length&&C?f.filter(e=>null!==e.distanceMeters&&e.distanceMeters<=1852*b).slice(0,40).map(e=>{let t=(180*Math.atan2(e.east,e.north)/Math.PI+360)%360;return{id:e.id,name:e.name||`MMSI ${e.mmsi||""}`,distance:e.distanceMeters/1852,bearing:(t-180*$/Math.PI+360)%360,colour:"night"===w?y.compass:(e=>{let{kind:t,category:a=""}=(0,h.atonKind)(e);return"lateral"===t?a.endsWith("starboard")?"#1fae5b":"#e0483a":g[t]||g.station})(e.atonType),virtual:e.virtual}}):[],[f,b,C,$,w,y.compass]),I={giveWay:y.vesselDanger,yields:y.vesselYields,close:y.vesselClose},D=e=>I[v[e.id]]||"var(--hud-text-secondary, #8a9097)",P=e=>"giveWay"===v[e.id]||"yields"===v[e.id],A=j||F.length>0||T.length>0;return(0,t.jsxs)(m,{title:s("widgets.aisTacticalRadar"),icon:i.faTowerBroadcast,hasData:A,noDataMessage:s("widgets.signalLossAIS"),children:[(0,t.jsx)("div",{className:"absolute top-4 right-4 z-10",children:(0,t.jsxs)("select",{value:b,onChange:e=>N(Number(e.target.value)),className:"bg-hud-elevated text-hud-secondary text-caption font-semibold uppercase tracking-widest rounded-sm px-3 py-1 border border-hud shadow-soft focus:outline-none focus:ring-1 focus:ring-oBlue/50 hover:bg-hud-bg hover:text-hud-main transition-all duration-500",children:[(0,t.jsx)("option",{value:1,children:"1 NM"}),(0,t.jsx)("option",{value:2,children:"2 NM"}),(0,t.jsx)("option",{value:5,children:"5 NM"}),(0,t.jsx)("option",{value:10,children:"10 NM"}),(0,t.jsx)("option",{value:20,children:"20 NM"})]})}),(0,t.jsxs)("div",{className:"flex-1 relative min-h-0 bg-hud-bg rounded-sm overflow-hidden border border-hud shadow-inner group mt-2",onWheel:k,children:[(0,t.jsxs)("svg",{className:"w-full h-full p-2 transition-transform duration-700 group-hover:scale-[1.02]",viewBox:"0 0 200 200",children:[[1,2,3,4].map(e=>(0,t.jsx)("circle",{cx:"100",cy:"100",r:20*e,fill:"none",stroke:"var(--color-oBlue)",strokeOpacity:"0.28",strokeWidth:"0.5"},e)),(0,t.jsx)("line",{x1:"100",y1:"20",x2:"100",y2:"180",stroke:"var(--color-oBlue)",strokeOpacity:"0.16",strokeWidth:"0.5"}),(0,t.jsx)("line",{x1:"20",y1:"100",x2:"180",y2:"100",stroke:"var(--color-oBlue)",strokeOpacity:"0.16",strokeWidth:"0.5"}),(0,t.jsxs)("g",{children:[(0,t.jsx)("line",{x1:"100",y1:"100",x2:"100",y2:"20",stroke:"var(--color-oGreen)",strokeWidth:"1",strokeOpacity:"0.4"}),(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 100 100",to:"360 100 100",dur:"3s",repeatCount:"indefinite"})]}),T.map(e=>{let a=e.distance/b*80,s=100+a*Math.cos((e.bearing-90)*Math.PI/180),n=100+a*Math.sin((e.bearing-90)*Math.PI/180);return(0,t.jsx)("polygon",{points:`${s},${n-2.6} ${s+2},${n} ${s},${n+2.6} ${s-2},${n}`,fill:e.virtual?"none":e.colour,stroke:e.colour,strokeWidth:e.virtual?.7:.4,strokeDasharray:e.virtual?"1 0.6":void 0,opacity:"0.9",children:(0,t.jsx)("title",{children:e.virtual?`${e.name} (V-AIS)`:e.name})},e.id)}),(e=[],F.map(t=>{let a=t.distance/b*80,s=100+a*Math.cos((t.bearing-90)*Math.PI/180),n=100+a*Math.sin((t.bearing-90)*Math.PI/180),i=n-5;for(;e.some(e=>26>Math.abs(e.x-s)&&6>Math.abs(e.y-i));)i+=6;return e.push({x:s,y:i}),{target:t,x:s,y:n,ly:i}})).map(({target:e,x:a,y:s,ly:n})=>{let i=P(e);return(0,t.jsxs)("g",{className:i?"animate-soft-pulse":"",children:[(0,t.jsx)("circle",{cx:a,cy:s,r:i?"3":"2",fill:D(e),className:"transition-all duration-1000"}),(0,t.jsx)("text",{x:a+5,y:n,fill:"currentColor",fontSize:"5",className:"font-black pointer-events-none uppercase tracking-tighter opacity-60 text-hud-main",children:e.name.substring(0,8)})]},e.id)}),(0,t.jsx)("polygon",{points:"100,95 105,105 100,102 95,105",fill:"var(--color-oBlue)",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.8",className:"text-hud-main"})]}),(0,t.jsxs)("div",{className:"absolute top-2 left-2 text-caption text-hud-muted font-semibold pointer-events-none uppercase tracking-widest space-y-1",children:[(0,t.jsxs)("div",{className:"bg-hud-bg/40 px-1.5 py-0.5 rounded-sm",children:[s("widgets.range")," ",b," NM"]}),(0,t.jsxs)("div",{className:"bg-hud-bg/40 px-1.5 py-0.5 rounded-sm",children:[s("widgets.targets")," ",F.length]})]})]}),F.length>0&&(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)("div",{className:"text-caption text-hud-muted font-semibold uppercase tracking-[0.2em] px-1",children:s("widgets.tacticalAnalysis")}),F.slice(0,2).map(e=>{let a;return(0,t.jsxs)("div",{className:"flex items-center justify-between text-caption tesla-card px-3 py-2 tesla-hover",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3 min-w-0",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:30===(a=Number(e.type))||a>=70&&a<=89?i.faShip:i.faLocationDot,style:{color:D(e)},className:`text-xs opacity-80 ${P(e)?"animate-soft-pulse":""}`}),(0,t.jsx)("span",{className:"text-hud-main truncate font-black uppercase tracking-tight",children:e.name})]}),(0,t.jsxs)("div",{className:"flex space-x-4 text-hud-secondary font-black tracking-tighter",children:[(0,t.jsxs)("span",{className:"gliding-value",children:[e.distance.toFixed(1)," NM"]}),(0,t.jsxs)("span",{className:"gliding-value",style:{color:D(e)},children:["CPA: ",null===e.cpa?"--":e.cpa.toFixed(1)]})]})]},e.id)})]})]})});function v(){let{t:e}=(0,x.useTranslation)(),s=(0,c.useSignalKPaths)(["tanks.fuel.0.currentLevel","tanks.fuel.0.capacity","tanks.fuel.0.name","tanks.fuel.0.type","tanks.fuel.0.temperature","tanks.freshWater.0.currentLevel","tanks.freshWater.0.capacity","tanks.freshWater.0.name","tanks.freshWater.0.type","tanks.freshWater.0.temperature","tanks.wasteWater.0.currentLevel","tanks.wasteWater.0.capacity","tanks.wasteWater.0.name","tanks.wasteWater.0.type","tanks.wasteWater.0.temperature","tanks.blackWater.0.currentLevel","tanks.blackWater.0.capacity","tanks.blackWater.0.name","tanks.blackWater.0.type","tanks.blackWater.0.temperature","tanks.oil.0.currentLevel","tanks.oil.0.capacity","tanks.oil.0.name","tanks.oil.0.type","tanks.oil.0.temperature"]),l=(0,a.useMemo)(()=>{let t=(e,t,a,n,i)=>({level:s[`tanks.${e}.0.currentLevel`]??null,capacity:s[`tanks.${e}.0.capacity`]??null,tankName:s[`tanks.${e}.0.name`],tankType:s[`tanks.${e}.0.type`],temperature:s[`tanks.${e}.0.temperature`],icon:a,color:n,bgColor:i,displayName:t}),a={fuel:t("fuel",e("widgets.tankFuel"),i.faGasPump,"text-oYellow","bg-oYellow"),freshWater:t("freshWater",e("widgets.tankFreshWater"),i.faTint,"text-oBlue","bg-oBlue"),wasteWater:t("wasteWater",e("widgets.tankWasteWater"),i.faToilet,"text-hud-secondary","bg-hud-elevated"),blackWater:t("blackWater",e("widgets.tankBlackWater"),i.faToilet,"text-hud-secondary","bg-hud-elevated"),oil:t("oil",e("widgets.tankEngineOil"),i.faOilCan,"text-oYellow","bg-oYellow")};return{hasData:Object.values(a).some(e=>null!==e.level),...a}},[s,e]);return(0,t.jsx)(m,{title:e("widgets.storageSystems"),icon:i.faGasPump,hasData:l.hasData,noDataMessage:e("widgets.signalLossLevelSensors"),children:(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center min-h-0 space-y-4",children:Object.entries(l).filter(([e])=>"hasData"!==e).map(([e,a])=>{if(null===a.level)return null;let s=Math.round(100*a.level),i=Number.isFinite(a.capacity)?Math.round(1e3*a.capacity):null,l=null!==i?Math.round(a.level*i):null,r="wasteWater"===e||"blackWater"===e,o=r?a.level>.8:a.level<.1;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 bg-hud-elevated rounded-full",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:a.icon,className:`${a.color} text-xs opacity-80`})}),(0,t.jsx)("span",{className:"text-hud-main text-caption font-semibold uppercase tracking-widest whitespace-nowrap",children:a.displayName})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[null!==i&&(0,t.jsxs)("span",{className:"text-hud-secondary text-caption font-semibold opacity-60 tabular-nums whitespace-nowrap",children:[l,"/",i," L"]}),(0,t.jsxs)("span",{className:`text-label font-semibold ${((e,t=!1)=>t?e>.8?"text-oRed":e>.6?"text-oYellow":"text-oGreen":e<.1?"text-oRed":e<.25?"text-oYellow":"text-oGreen")(a.level,r)} ${o?"animate-soft-pulse":""}`,children:[s,"%"]})]})]}),(0,t.jsx)("div",{className:"bg-hud-elevated rounded-full h-1.5 overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:`h-full transition-all duration-1000 ${r?a.level>.8?"bg-oRed":a.level>.6?"bg-oYellow":"bg-oGreen":a.level<.1?"bg-oRed":a.level<.25?"bg-oYellow":"bg-oGreen"}`,style:{width:`${s}%`}})})]},e)})})})}f.displayName="AISRadarWidget";var y=e.i(46991),w=e.i(83934),b=e.i(95430);function N(){let{t:e}=(0,x.useTranslation)(),s=d.default.get("debugMode"),{forecasts:l,isLoading:r,weatherApiAvailable:o,fetchWeatherForecast:c,getCurrentWeather:u}=(0,w.useWeather)(),h=(0,a.useMemo)(()=>{let e=u(),t=(0,y.convertTemperatureUnit)(e.temperature),a=null!==(0,y.finite)(e.humidity)?Math.round(100*e.humidity):null,n=null!==(0,y.convertPressure)(e.pressure)?Math.round(e.pressure/100):null,i=(0,y.convertSpeedUnit)(e.windSpeed),r=(0,y.toDegrees)(e.windDirection),o=e.description,c=e.source,d=null!==t||null!==a||null!==n||null!==i;if(!d&&!s)return{hasData:!1,dataSource:null};let m=t,x=a,h=n,p=i,g=r;!d&&s&&(m=15,x=65,h=1013,p=5.2,g=120,c="debug");let f="sunny";if(o){let e=o.toLowerCase();e.includes("rain")||e.includes("shower")?f="rainy":e.includes("snow")?f="snow":e.includes("partly")||e.includes("few clouds")||e.includes("scattered")?f="partly-cloudy":e.includes("cloud")||e.includes("overcast")?f="cloudy":(e.includes("clear")||e.includes("sun"))&&(f="sunny")}else h&&(f=h<1e3?x&&x>80?"rainy":"cloudy":h>1020?"sunny":"partly-cloudy");return{hasData:!0,dataSource:c,description:o,temperature:m,humidity:x,pressure:h,windSpeed:p,windDirection:g,condition:f,forecast:l}},[u,l,s]),p=e=>{switch(e){case"sunny":return i.faSun;case"partly-cloudy":default:return i.faCloudSun;case"cloudy":return i.faCloud;case"rainy":return i.faCloudRain;case"heavy-rain":return i.faCloudShowersHeavy;case"snow":return i.faSnowflake}},g=e=>{switch(e){case"sunny":return"text-oYellow";case"partly-cloudy":case"rainy":case"heavy-rain":default:return"text-oBlue";case"cloudy":return"text-hud-muted";case"snow":return"text-hud-main"}},f=e=>null===(0,y.finite)(e)?"":["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][(Math.round(e/22.5)%16+16)%16];return(0,t.jsxs)(m,{title:e("widgets.meteorologicalData"),icon:p(h.condition),hasData:h.hasData,noDataMessage:r?e("widgets.acquiringSatellite"):e("widgets.signalLossWeather"),children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex items-center space-x-3",children:[h.dataSource&&(0,t.jsx)("span",{className:`text-caption px-2 py-0.5 rounded-sm uppercase font-semibold tracking-widest text-hud-main shadow-soft ${"sensors"===h.dataSource?"bg-oGreen/40 border border-oGreen/30":"forecast"===h.dataSource?"bg-oBlue/40 border border-oBlue/30":"bg-hud-elevated border border-hud"}`,children:(()=>{switch(h.dataSource){case"sensors":return e("widgets.dataSourceLive");case"forecast":return e("widgets.dataSourceForecast");case"debug":return e("widgets.dataSourceDemo");default:return""}})()}),!1!==o&&(0,t.jsx)("button",{onClick:c,disabled:r,className:"w-7 h-7 rounded-full bg-hud-elevated flex items-center justify-center text-hud-secondary hover:text-hud-main transition-all duration-500 tesla-hover",title:e("widgets.updateForecast"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faSync,className:`text-xs ${r?"animate-spin":""}`})})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center",children:(0,t.jsxs)("div",{className:"text-center mb-6 group",children:[(0,t.jsx)("div",{className:`text-hero mb-4 transition-transform duration-700 group-hover:scale-110 ${g(h.condition)}`,children:(0,t.jsx)(n.FontAwesomeIcon,{icon:p(h.condition),className:"sunny"!==h.condition?"animate-soft-pulse":""})}),(0,t.jsx)("div",{className:"text-hero font-medium text-hud-main leading-none gliding-value tracking-tight",children:null!==h.temperature?`${h.temperature}${(0,y.getTemperatureUnitLabel)()}`:e("common.na")}),(0,t.jsx)("div",{className:"text-caption font-semibold text-hud-secondary uppercase tracking-[0.3em] mt-3 opacity-60",children:h.description||(t=>{switch(t){case"sunny":return e("widgets.clearSkies");case"partly-cloudy":return e("widgets.partlyCloudy");case"cloudy":return e("widgets.overcast");case"rainy":return e("widgets.lightRain");case"heavy-rain":return e("widgets.heavyRain");case"snow":return e("widgets.snow");default:return e("widgets.variable")}})(h.condition)})]})}),h.forecast&&h.forecast.length>1&&(0,t.jsx)("div",{className:"space-y-2 shrink-0",children:h.forecast.slice(1,4).map((e,a)=>{let s=new Date(e.date?e.date:(0,b.vesselNow)().getTime()+(a+1)*864e5),l=isNaN(s.getTime())?e.time||`+${a+1}d`:s.toLocaleDateString("en-GB",{weekday:"short"}),r=e.description?e.description.toLowerCase().includes("rain")?"rainy":e.description.toLowerCase().includes("cloud")?"cloudy":e.description.toLowerCase().includes("snow")?"snow":"sunny":"partly-cloudy",o=null!==(0,y.finite)(e.wind?.speed)?Math.round(10*e.wind.speed)/10:null,c=f(e.wind?.direction)||null;return(0,t.jsxs)("div",{className:"flex items-center justify-between py-1.5 border-b border-hud/30 last:border-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)("span",{className:"text-hud-muted text-caption font-semibold uppercase tracking-widest w-8",children:l}),(0,t.jsx)(n.FontAwesomeIcon,{icon:p(r),className:`text-sm w-5 ${g(r)}`}),(0,t.jsx)("span",{className:"text-hud-main text-label font-semibold gliding-value w-8",children:null!==e.temperature?`${Math.round(e.temperature)}\xb0`:"--"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faWind,className:"text-oBlue text-xs opacity-50"}),(0,t.jsx)("span",{className:"text-hud-main text-caption font-semibold gliding-value",children:null!==o?`${o} ${(0,y.getSpeedUnitLabel)()}`:"--"}),c&&(0,t.jsx)("span",{className:"text-hud-muted text-caption font-semibold tracking-widest opacity-60",children:c})]})]},a)})}),(0,t.jsxs)("div",{className:"flex items-center justify-between shrink-0 mt-2",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faWind,className:"text-oBlue text-sm opacity-50"}),(0,t.jsx)("span",{className:"text-hud-secondary text-caption uppercase font-semibold tracking-widest",children:e("widgets.now")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("span",{className:"text-hud-main text-label font-semibold gliding-value tracking-tight",children:null!==h.windSpeed?`${h.windSpeed} ${(0,y.getSpeedUnitLabel)()}`:e("common.na")}),(0,t.jsx)("span",{className:"text-hud-muted text-caption uppercase font-semibold tracking-widest ml-2 opacity-60",children:null!==h.windDirection?f(h.windDirection):""})]})]})]})]})}var j=e.i(66799);let k=(0,a.createContext)(),C=({children:e})=>{let[s,n]=(0,a.useState)({}),[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)({}),[c,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),[x,h]=(0,a.useState)(null),[p,g]=(0,a.useState)(null),[f,v]=(0,a.useState)(!1),[y,w]=(0,a.useState)(null),b=(0,a.useRef)(null),N=(0,a.useRef)(null),C=(0,a.useCallback)(async()=>{d(!0),m(null);try{let[e,t,a]=await Promise.all([j.default.getRoutes().catch(e=>("NetworkError"!==e.name&&console.error("NavigationContext: Failed to fetch routes:",e),{})),j.default.getWaypoints().catch(e=>("NetworkError"!==e.name&&console.error("NavigationContext: Failed to fetch waypoints:",e),{})),j.default.getCharts().catch(e=>("NetworkError"!==e.name&&console.error("NavigationContext: Failed to fetch charts:",e),{}))]);n(e||{}),l(t||{}),o(a||{})}catch(e){"NetworkError"!==e.name&&(console.error("NavigationContext: Failed to fetch resources:",e),m(e.message))}finally{d(!1)}},[]),M=(0,a.useCallback)(async()=>{try{let e=await j.default.getRoutes();return n(e||{}),e}catch(e){throw console.error("NavigationContext: Failed to fetch routes:",e),e}},[]),S=(0,a.useCallback)(async()=>{try{let e=await j.default.getWaypoints();return l(e||{}),e}catch(e){throw console.error("NavigationContext: Failed to fetch waypoints:",e),e}},[]),W=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([j.default.getCourse().catch(()=>null),j.default.getCourseCalculations().catch(()=>null)]);h(e),g(t)}catch(e){console.error("NavigationContext: Failed to fetch course:",e),w(e.message)}},[]),$=(0,a.useCallback)(async e=>{v(!0),w(null);try{await j.default.setDestinationWaypoint(e),await W()}catch(e){throw console.error("NavigationContext: Failed to set waypoint destination:",e),w(e.message),e}finally{v(!1)}},[W]),F=(0,a.useCallback)(async(e,t)=>{v(!0),w(null);try{await j.default.setDestinationPosition(e,t),await W()}catch(e){throw console.error("NavigationContext: Failed to set position destination:",e),w(e.message),e}finally{v(!1)}},[W]),T=(0,a.useCallback)(async(e,t=0,a=!1)=>{v(!0),w(null);try{await j.default.activateRoute(e,t,a),await W()}catch(e){throw console.error("NavigationContext: Failed to activate route:",e),w(e.message),e}finally{v(!1)}},[W]),I=(0,a.useCallback)(async()=>{v(!0),w(null);try{await j.default.clearCourse(),h(null),g(null)}catch(e){throw console.error("NavigationContext: Failed to clear course:",e),w(e.message),e}finally{v(!1)}},[]),D=(0,a.useCallback)(async()=>{try{await j.default.nextWaypoint(),await W()}catch(e){throw console.error("NavigationContext: Failed to go to next waypoint:",e),e}},[W]),P=(0,a.useCallback)(async()=>{try{await j.default.previousWaypoint(),await W()}catch(e){throw console.error("NavigationContext: Failed to go to previous waypoint:",e),e}},[W]),A=(0,a.useCallback)(async(e,t,a,s="")=>{try{let n=j.default.generateUUID(),i=j.default.createWaypointFeature(t,e,a,s);return await j.default.saveWaypoint(n,i),await S(),n}catch(e){throw console.error("NavigationContext: Failed to create waypoint:",e),e}},[S]),R=(0,a.useCallback)(async e=>{try{await j.default.deleteWaypoint(e),await S()}catch(e){throw console.error("NavigationContext: Failed to delete waypoint:",e),e}},[S]),G=(0,a.useCallback)(async(e,t,a="")=>{try{let s=j.default.generateUUID(),n=e.map(e=>[e.longitude,e.latitude]),i=j.default.createRouteFeature(n,t,a);return await j.default.saveRoute(s,i),await M(),s}catch(e){throw console.error("NavigationContext: Failed to create route:",e),e}},[M]),L=(0,a.useCallback)(async e=>{try{await j.default.deleteRoute(e),await M()}catch(e){throw console.error("NavigationContext: Failed to delete route:",e),e}},[M]),E=(0,a.useCallback)(e=>{let t=s[e];return t?j.default.parseRouteCoordinates(t):[]},[s]),B=(0,a.useCallback)(e=>{let t=i[e];return t?j.default.parseWaypointPosition(t):null},[i]),O=(0,a.useCallback)(()=>Object.entries(s).map(([e,t])=>({id:e,name:t.name||"Unnamed Route",description:t.description||"",pointCount:t.feature?.geometry?.coordinates?.length||0})),[s]),Y=(0,a.useCallback)(()=>Object.entries(i).map(([e,t])=>{let a=j.default.parseWaypointPosition(t);return{id:e,name:t.name||"Unnamed Waypoint",description:t.description||"",latitude:a?.latitude,longitude:a?.longitude}}),[i]),U=(0,a.useCallback)(()=>x?.nextPoint?.position!=null||x?.activeRoute?.href!=null,[x]),K=(0,a.useCallback)(()=>x?{position:x.nextPoint?.position,waypointHref:x.nextPoint?.href,routeHref:x.activeRoute?.href,pointIndex:x.activeRoute?.pointIndex,isRoute:!!x.activeRoute?.href,arrivalCircle:x.arrivalCircle}:null,[x]);(0,a.useEffect)(()=>(C(),W(),b.current=setInterval(()=>{W()},5e3),N.current=setInterval(()=>{C()},3e5),()=>{b.current&&clearInterval(b.current),N.current&&clearInterval(N.current)}),[C,W]);let z=(0,a.useMemo)(()=>({routes:s,waypoints:i,charts:r,isLoadingResources:c,resourcesError:u,activeCourse:x,courseCalculations:p,isLoadingCourse:f,courseError:y,fetchResources:C,fetchRoutes:M,fetchWaypoints:S,fetchCourse:W,navigateToWaypoint:$,navigateToPosition:F,activateRoute:T,clearCourse:I,goToNextWaypoint:D,goToPreviousWaypoint:P,createWaypoint:A,deleteWaypoint:R,createRoute:G,deleteRoute:L,getRouteCoordinates:E,getWaypointPosition:B,getRoutesList:O,getWaypointsList:Y,hasActiveDestination:U,getDestinationInfo:K}),[s,i,r,c,u,x,p,f,y,C,M,S,W,$,F,T,I,D,P,A,R,G,L,E,B,O,Y,U,K]);return(0,t.jsx)(k.Provider,{value:z,children:e})};function M(){var e,s;let{t:l}=(0,x.useTranslation)(),{activeCourse:r,courseCalculations:o,waypoints:u,routes:h,isLoadingCourse:p,navigateToWaypoint:g,activateRoute:f,clearCourse:v,goToNextWaypoint:w,goToPreviousWaypoint:b,getWaypointsList:N,getRoutesList:j,hasActiveDestination:C}=(()=>{let e=(0,a.useContext)(k);if(!e)throw Error("useNavigation must be used within a NavigationContextProvider");return e})(),M=d.default.get("debugMode"),S=(0,c.useSignalKPath)("navigation.courseGreatCircle.nextPoint.distance"),W=(0,c.useSignalKPath)("navigation.courseGreatCircle.nextPoint.bearingTrue"),$=(0,c.useSignalKPath)("navigation.courseGreatCircle.crossTrackError"),F=(0,c.useSignalKPath)("navigation.courseGreatCircle.velocityMadeGood"),T=(0,c.useSignalKPath)("steering.autopilot.state"),I=(0,c.useSignalKPath)("steering.autopilot.mode"),D=(0,c.useSignalKPath)("steering.autopilot.target.headingTrue"),[P,A]=(0,a.useState)(!1),[R,G]=(0,a.useState)(!1),L=a.default.useMemo(()=>{let e=o||{},t=S??e.distance??null,a=W??e.bearingTrue??null;return null!==t||null!==a||M?{hasData:!0,distance:t??(M?5e3:null),bearingTrue:a??(M?.52:null),bearingMagnetic:e.bearingMagnetic??null,crossTrackError:$??e.crossTrackError??(M?50:null),velocityMadeGood:F??e.velocityMadeGood??(M?5.5:null),timeToGo:e.timeToGo??null,estimatedTimeOfArrival:e.estimatedTimeOfArrival??null,calcMethod:e.calcMethod}:{hasData:!1}},[o,S,W,$,F,M]),E=async e=>{try{await g(e),A(!1)}catch(e){console.error("Failed to navigate to waypoint:",e)}},B=async e=>{try{await f(e),G(!1)}catch(e){console.error("Failed to activate route:",e)}},O=N(),Y=j(),U=C();return(0,t.jsxs)(m,{title:l("widgets.course"),icon:i.faRoute,iconColorClass:"text-oGreen",hasData:L.hasData||U||O.length>0||Y.length>0,noDataMessage:l("widgets.noCourseData"),children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{A(!P),G(!1)},className:`w-8 h-8 rounded-full flex items-center justify-center transition-all duration-500 shadow-soft ${P?"bg-oGreen text-hud-main":"bg-hud-elevated text-hud-secondary tesla-hover"}`,title:l("widgets.waypoints"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faLocationDot,className:"text-xs"})}),(0,t.jsx)("button",{onClick:()=>{G(!R),A(!1)},className:`w-8 h-8 rounded-full flex items-center justify-center transition-all duration-500 shadow-soft ${R?"bg-oGreen text-hud-main":"bg-hud-elevated text-hud-secondary tesla-hover"}`,title:l("widgets.routes"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faList,className:"text-xs"})})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[P&&(0,t.jsxs)("div",{className:"mb-4 max-h-40 overflow-y-auto tesla-card space-y-1",children:[(0,t.jsx)("div",{className:"text-caption text-hud-muted mb-2 uppercase font-semibold tracking-[0.2em] px-2 pt-1",children:l("widgets.storedWaypoints")}),0===O.length?(0,t.jsx)("div",{className:"text-caption text-hud-secondary italic px-2 py-4 text-center font-semibold uppercase",children:l("widgets.noActiveNodes")}):O.map(e=>(0,t.jsxs)("button",{onClick:()=>E(e.id),className:"w-full text-left p-2 tesla-hover rounded-sm text-caption text-hud-main flex items-center group font-semibold uppercase tracking-tight",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faLocationDot,className:"text-oYellow mr-3 text-xs opacity-50 group-hover:opacity-100"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))]}),R&&(0,t.jsxs)("div",{className:"mb-4 max-h-40 overflow-y-auto tesla-card space-y-1",children:[(0,t.jsx)("div",{className:"text-caption text-hud-muted mb-2 uppercase font-semibold tracking-[0.2em] px-2 pt-1",children:l("widgets.missionRoutes")}),0===Y.length?(0,t.jsx)("div",{className:"text-caption text-hud-secondary italic px-2 py-4 text-center font-semibold uppercase",children:l("widgets.noRoutesLoaded")}):Y.map(e=>(0,t.jsxs)("button",{onClick:()=>B(e.id),className:"w-full text-left p-2 tesla-hover rounded-sm text-caption text-hud-main flex items-center justify-between group font-semibold uppercase tracking-tight",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faRoute,className:"text-oGreen mr-3 text-xs opacity-50 group-hover:opacity-100"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted font-semibold",children:[e.pointCount," pts"]})]},e.id))]}),U&&(0,t.jsxs)("div",{className:"tesla-card bg-oYellow/5 mb-6 border-l-2 border-oYellow/30 animate-soft-pulse",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faCrosshairs,className:"text-oYellow text-sm"}),(0,t.jsx)("span",{className:"text-hud-main text-caption font-semibold uppercase tracking-widest truncate",children:(()=>{if(!r)return l("widgets.noDestination");if(r.activeRoute?.href){let e=h[r.activeRoute.href.split("/").pop()],t=r.activeRoute.pointIndex||0;return e?.name?`${e.name} (${t+1})`:l("widgets.activeRoute")}if(r.nextPoint?.href){let e=u[r.nextPoint.href.split("/").pop()];return e?.name||l("widgets.waypoint")}if(r.nextPoint?.position){let e=r.nextPoint.position;return`${e.latitude?.toFixed(4)}\xb0, ${e.longitude?.toFixed(4)}\xb0`}return l("widgets.noDestination")})()})]}),(0,t.jsx)("button",{onClick:v,className:"text-hud-secondary hover:text-oRed transition-colors p-1",title:l("widgets.abortNavigation"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faTimes,className:"text-sm"})})]}),r?.activeRoute?.href&&(0,t.jsxs)("div",{className:"flex justify-center space-x-3 mt-4",children:[(0,t.jsxs)("button",{onClick:b,className:"bg-hud-elevated hover:bg-hud-bg text-hud-main px-4 py-1.5 rounded text-caption font-semibold uppercase tracking-widest transition-all shadow-soft",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faArrowLeft,className:"mr-2"}),l("widgets.previous")]}),(0,t.jsxs)("button",{onClick:w,className:"bg-oBlue hover:bg-oBlue/80 text-hud-main px-4 py-1.5 rounded text-caption font-semibold uppercase tracking-widest transition-all shadow-lg shadow-oBlue/20",children:[l("widgets.proceed"),(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faArrowRight,className:"ml-2"})]})]})]}),T&&(0,t.jsxs)("div",{className:`tesla-card px-3 py-2 mb-3 flex items-center justify-between ${"enabled"===T?"border-l-2 border-oGreen/30":""}`,children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faRobot,className:`text-xs ${"enabled"===T?"text-oGreen":"text-hud-muted"}`}),(0,t.jsx)("span",{className:`text-caption font-semibold uppercase capitalize gliding-value ${"enabled"===T?"text-oGreen":"text-hud-secondary"}`,children:T})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4 text-caption font-semibold uppercase",children:[(0,t.jsx)("span",{className:"text-hud-main capitalize gliding-value",children:I||"—"}),(0,t.jsx)("span",{className:"text-oYellow gliding-value",children:null!==D?`${Math.round((0,y.toDegrees)(D))}\xb0`:"—"})]})]}),L.hasData&&(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faRuler,className:"text-oGreen text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:null==(e=L.distance)?l("common.na"):e<1e3?`${Math.round(e)} m`:`${(0,y.convertDistanceUnit)(e)} ${(0,y.getDistanceUnitLabel)()}`}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:l("widgets.distance")})]}),(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faCompass,className:"text-oBlue text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:null!==L.bearingTrue?`${Math.round((0,y.toDegrees)(L.bearingTrue))}\xb0`:l("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:l("widgets.bearing")})]}),(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faArrowRight,className:`${L.crossTrackError>50||L.crossTrackError<-50?"text-oRed animate-soft-pulse":"text-oGreen opacity-50"} text-xs mb-2`}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:null!==L.crossTrackError?`${Math.abs(Math.round(L.crossTrackError))}m`:l("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"XTE"})]}),(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faPlay,className:"text-oGreen text-xs mb-2 opacity-50"}),(0,t.jsxs)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:[null!==L.velocityMadeGood?`${(0,y.convertSpeedUnit)(L.velocityMadeGood)}`:l("common.na"),(0,t.jsx)("span",{className:"text-caption text-hud-secondary ml-1",children:(0,y.getSpeedUnitLabel)()})]}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"VMG"})]}),null!==L.timeToGo&&(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faClock,className:"text-oGreen text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:(e=>{if(null==e)return l("common.na");let t=Math.floor(e/3600),a=Math.floor(e%3600/60);return t>0?`${t}h ${a}m`:`${a}m`})(L.timeToGo)}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"TTG"})]}),L.estimatedTimeOfArrival&&(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faClock,className:"text-oYellow text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:(s=L.estimatedTimeOfArrival)?new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):l("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"ETA"})]})]})]})]})}e.i(67561);let S=a.default.memo(({children:e,widgetName:a,className:l="",fullscreenWidget:r,toggleFullscreen:o})=>(0,t.jsxs)(s.motion.div,{layout:!0,variants:{hidden:{opacity:0,y:20},show:{opacity:1,y:0}},transition:{duration:.5,ease:[.4,0,.2,1]},className:`relative group ${l}`,children:[e,(0,t.jsx)("button",{onClick:()=>o(a),className:"absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-all duration-500 bg-hud-bg backdrop-blur-md hover:bg-hud-elevated rounded-full w-8 h-8 flex items-center justify-center text-hud-muted hover:text-hud-main z-10 shadow-soft",title:r===a?"Exit fullscreen":"Fullscreen",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:r===a?i.faCompress:i.faExpand,className:"text-xs"})})]}));S.displayName="WidgetWrapper";let W={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}};e.s(["default",0,function(){let[e,n]=(0,a.useState)(null),i=a.default.useCallback(e=>{n(t=>t===e?null:e)},[]),l=(a,s,n="")=>(0,t.jsx)(S,{widgetName:a,fullscreenWidget:e,toggleFullscreen:i,className:e&&e!==a?"hidden":e===a?"w-full h-full":n,children:s});return(0,t.jsx)("div",{className:"flex flex-col h-full bg-rightPaneBg overflow-hidden",children:(0,t.jsx)("div",{className:"flex-1 p-4 min-h-0 overflow-auto scrollbar-hide",children:(0,t.jsxs)(s.motion.div,{variants:W,initial:"hidden",animate:"show",className:e?"flex h-full":"card-grid",children:[l("aisradar",(0,t.jsx)(f,{}),"sm:col-span-2 sm:row-span-2"),l("weather",(0,t.jsx)(N,{})),l("course",(0,t.jsx)(C,{children:(0,t.jsx)(M,{})})),l("tanks",(0,t.jsx)(v,{}))]})})})}],54784)},25294,function(e){e.n(e.i(54784))}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54784,e=>{"use strict";var t=e.i(43476),a=e.i(71645),s=e.i(46932),n=e.i(49721),i=e.i(68757);e.i(85269);var l=e.i(62588),r=e.i(77291),o=e.i(83646),c=e.i(85709),d=e.i(83402);let u=({title:e,icon:s,iconClass:i="text-oBlue",action:l,className:r="",children:o,...c})=>(0,t.jsxs)("div",{className:`tesla-card flex flex-col min-w-0 ${r}`,...c,children:[(e||s||l)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-3 shrink-0",children:[s&&(a.default.isValidElement(s)?(0,t.jsx)("span",{className:`${i} flex items-center`,children:s}):(0,t.jsx)(n.FontAwesomeIcon,{icon:s,className:`${i} text-sm opacity-80`})),e&&(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-secondary truncate",children:e}),l&&(0,t.jsx)("div",{className:"ml-auto flex items-center gap-2",children:l})]}),o]}),m=({title:e,icon:a,iconColorClass:s="text-oBlue",hasData:n=!0,noDataMessage:i="No data available",children:l,className:r=""})=>{let o="function"==typeof a?a():a;return n?(0,t.jsx)(u,{title:e,icon:o,iconClass:s,className:`h-full overflow-hidden ${r}`,children:(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center min-h-0 overflow-hidden",children:l})}):(0,t.jsx)(u,{title:e,icon:o,iconClass:s,className:`h-full overflow-hidden ${r}`,children:(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center min-h-0",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-hero font-medium text-hud-dim mb-2",children:"N/A"}),(0,t.jsx)("div",{className:"text-caption font-semibold uppercase text-hud-muted",children:i})]})})})};var x=e.i(22831),h=e.i(20705);let p=[1,2,5,10,20],g={cardinal:"#f2c200",isolated_danger:"#e0483a",safe_water:"#f0f0f0",special_purpose:"#f2c200",station:"#8a9097"},f=a.default.memo(()=>{let e,{t:s}=(0,x.useTranslation)(),{targets:u,atons:f}=(0,l.useAIS)(),{statuses:v}=(0,r.default)({always:!0}),{scene:y,id:w}=(0,o.default)(),[b,N]=(0,a.useState)(5),j=d.default.get("debugMode"),k=(0,a.useCallback)(e=>{e.preventDefault(),N(t=>{let a=p.indexOf(t);return -1===a?t:e.deltaY<0&&a>0?p[a-1]:e.deltaY>0&&a<p.length-1?p[a+1]:t})},[]),C=(0,c.useSignalKPath)("navigation.position"),M=(0,c.useSignalKPath)("navigation.headingTrue"),S=(0,c.useSignalKPath)("navigation.headingMagnetic"),W=(0,c.useSignalKPath)("navigation.courseOverGroundTrue"),$=M??S??W??0,F=(0,a.useMemo)(()=>u.length&&C?u.filter(e=>e.distanceMeters&&e.distanceMeters<=1852*b).map(e=>{let t=e.distanceMeters/1852,a=((180*Math.atan2(e.sceneX,-e.sceneZ)/Math.PI+360)%360-180*$/Math.PI+360)%360,s=null===e.cpaMeters?null:e.cpaMeters/1852;return{id:e.mmsi,name:e.name||`MMSI ${e.mmsi}`,distance:Math.round(10*t)/10,bearing:Math.round(a),type:e.shipType||"unknown",cpa:null===s?null:Math.round(10*s)/10}}).sort((e,t)=>e.distance-t.distance).slice(0,10):[],[u,b,C,$]),T=(0,a.useMemo)(()=>f.length&&C?f.filter(e=>null!==e.distanceMeters&&e.distanceMeters<=1852*b).slice(0,40).map(e=>{let t=(180*Math.atan2(e.east,e.north)/Math.PI+360)%360;return{id:e.id,name:e.name||`MMSI ${e.mmsi||""}`,distance:e.distanceMeters/1852,bearing:(t-180*$/Math.PI+360)%360,colour:"night"===w?y.compass:(e=>{let{kind:t,category:a=""}=(0,h.atonKind)(e);return"lateral"===t?a.endsWith("starboard")?"#1fae5b":"#e0483a":g[t]||g.station})(e.atonType),virtual:e.virtual}}):[],[f,b,C,$,w,y.compass]),I={giveWay:y.vesselDanger,yields:y.vesselYields,close:y.vesselClose},D=e=>I[v[e.id]]||"var(--hud-text-secondary, #8a9097)",A=e=>"giveWay"===v[e.id]||"yields"===v[e.id],R=j||F.length>0||T.length>0;return(0,t.jsxs)(m,{title:s("widgets.aisTacticalRadar"),icon:i.faTowerBroadcast,hasData:R,noDataMessage:s("widgets.signalLossAIS"),children:[(0,t.jsx)("div",{className:"absolute top-4 right-4 z-10",children:(0,t.jsxs)("select",{value:b,onChange:e=>N(Number(e.target.value)),className:"bg-hud-elevated text-hud-secondary text-caption font-semibold uppercase tracking-widest rounded-sm px-3 py-1 border border-hud shadow-soft focus:outline-none focus:ring-1 focus:ring-oBlue/50 hover:bg-hud-bg hover:text-hud-main transition-all duration-500",children:[(0,t.jsx)("option",{value:1,children:"1 NM"}),(0,t.jsx)("option",{value:2,children:"2 NM"}),(0,t.jsx)("option",{value:5,children:"5 NM"}),(0,t.jsx)("option",{value:10,children:"10 NM"}),(0,t.jsx)("option",{value:20,children:"20 NM"})]})}),(0,t.jsxs)("div",{className:"flex-1 relative min-h-0 bg-hud-bg rounded-sm overflow-hidden border border-hud shadow-inner group mt-2",onWheel:k,children:[(0,t.jsxs)("svg",{className:"w-full h-full p-2 transition-transform duration-700 group-hover:scale-[1.02]",viewBox:"0 0 200 200",children:[[1,2,3,4].map(e=>(0,t.jsx)("circle",{cx:"100",cy:"100",r:20*e,fill:"none",stroke:"var(--color-oBlue)",strokeOpacity:"0.28",strokeWidth:"0.5"},e)),(0,t.jsx)("line",{x1:"100",y1:"20",x2:"100",y2:"180",stroke:"var(--color-oBlue)",strokeOpacity:"0.16",strokeWidth:"0.5"}),(0,t.jsx)("line",{x1:"20",y1:"100",x2:"180",y2:"100",stroke:"var(--color-oBlue)",strokeOpacity:"0.16",strokeWidth:"0.5"}),(0,t.jsxs)("g",{children:[(0,t.jsx)("line",{x1:"100",y1:"100",x2:"100",y2:"20",stroke:"var(--color-oGreen)",strokeWidth:"1",strokeOpacity:"0.4"}),(0,t.jsx)("animateTransform",{attributeName:"transform",type:"rotate",from:"0 100 100",to:"360 100 100",dur:"3s",repeatCount:"indefinite"})]}),T.map(e=>{let a=e.distance/b*80,s=100+a*Math.cos((e.bearing-90)*Math.PI/180),n=100+a*Math.sin((e.bearing-90)*Math.PI/180);return(0,t.jsx)("polygon",{points:`${s},${n-2.6} ${s+2},${n} ${s},${n+2.6} ${s-2},${n}`,fill:e.virtual?"none":e.colour,stroke:e.colour,strokeWidth:e.virtual?.7:.4,strokeDasharray:e.virtual?"1 0.6":void 0,opacity:"0.9",children:(0,t.jsx)("title",{children:e.virtual?`${e.name} (V-AIS)`:e.name})},e.id)}),(e=[],F.map(t=>{let a=t.distance/b*80,s=100+a*Math.cos((t.bearing-90)*Math.PI/180),n=100+a*Math.sin((t.bearing-90)*Math.PI/180),i=n-5;for(;e.some(e=>26>Math.abs(e.x-s)&&6>Math.abs(e.y-i));)i+=6;return e.push({x:s,y:i}),{target:t,x:s,y:n,ly:i}})).map(({target:e,x:a,y:s,ly:n})=>{let i=A(e);return(0,t.jsxs)("g",{className:i?"animate-soft-pulse":"",children:[(0,t.jsx)("circle",{cx:a,cy:s,r:i?"3":"2",fill:D(e),className:"transition-all duration-1000"}),(0,t.jsx)("text",{x:a+5,y:n,fill:"currentColor",fontSize:"5",className:"font-black pointer-events-none uppercase tracking-tighter opacity-60 text-hud-main",children:e.name.substring(0,8)})]},e.id)}),(0,t.jsx)("polygon",{points:"100,95 105,105 100,102 95,105",fill:"var(--color-oBlue)",stroke:"currentColor",strokeWidth:"0.5",opacity:"0.8",className:"text-hud-main"})]}),(0,t.jsxs)("div",{className:"absolute top-2 left-2 text-caption text-hud-muted font-semibold pointer-events-none uppercase tracking-widest space-y-1",children:[(0,t.jsxs)("div",{className:"bg-hud-bg/40 px-1.5 py-0.5 rounded-sm",children:[s("widgets.range")," ",b," NM"]}),(0,t.jsxs)("div",{className:"bg-hud-bg/40 px-1.5 py-0.5 rounded-sm",children:[s("widgets.targets")," ",F.length]})]})]}),F.length>0&&(0,t.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,t.jsx)("div",{className:"text-caption text-hud-muted font-semibold uppercase tracking-[0.2em] px-1",children:s("widgets.tacticalAnalysis")}),F.slice(0,2).map(e=>{let a;return(0,t.jsxs)("div",{className:"flex items-center justify-between text-caption tesla-card px-3 py-2 tesla-hover",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3 min-w-0",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:30===(a=Number(e.type))||a>=70&&a<=89?i.faShip:i.faLocationDot,style:{color:D(e)},className:`text-xs opacity-80 ${A(e)?"animate-soft-pulse":""}`}),(0,t.jsx)("span",{className:"text-hud-main truncate font-black uppercase tracking-tight",children:e.name})]}),(0,t.jsxs)("div",{className:"flex space-x-4 text-hud-secondary font-black tracking-tighter",children:[(0,t.jsxs)("span",{className:"gliding-value",children:[e.distance.toFixed(1)," NM"]}),(0,t.jsxs)("span",{className:"gliding-value",style:{color:D(e)},children:["CPA: ",null===e.cpa?"--":e.cpa.toFixed(1)]})]})]},e.id)})]})]})});function v(){let{t:e}=(0,x.useTranslation)(),s=(0,c.useSignalKPaths)(["tanks.fuel.0.currentLevel","tanks.fuel.0.capacity","tanks.fuel.0.name","tanks.fuel.0.type","tanks.fuel.0.temperature","tanks.freshWater.0.currentLevel","tanks.freshWater.0.capacity","tanks.freshWater.0.name","tanks.freshWater.0.type","tanks.freshWater.0.temperature","tanks.wasteWater.0.currentLevel","tanks.wasteWater.0.capacity","tanks.wasteWater.0.name","tanks.wasteWater.0.type","tanks.wasteWater.0.temperature","tanks.blackWater.0.currentLevel","tanks.blackWater.0.capacity","tanks.blackWater.0.name","tanks.blackWater.0.type","tanks.blackWater.0.temperature","tanks.oil.0.currentLevel","tanks.oil.0.capacity","tanks.oil.0.name","tanks.oil.0.type","tanks.oil.0.temperature"]),l=(0,a.useMemo)(()=>{let t=(e,t,a,n,i)=>({level:s[`tanks.${e}.0.currentLevel`]??null,capacity:s[`tanks.${e}.0.capacity`]??null,tankName:s[`tanks.${e}.0.name`],tankType:s[`tanks.${e}.0.type`],temperature:s[`tanks.${e}.0.temperature`],icon:a,color:n,bgColor:i,displayName:t}),a={fuel:t("fuel",e("widgets.tankFuel"),i.faGasPump,"text-oYellow","bg-oYellow"),freshWater:t("freshWater",e("widgets.tankFreshWater"),i.faTint,"text-oBlue","bg-oBlue"),wasteWater:t("wasteWater",e("widgets.tankWasteWater"),i.faToilet,"text-hud-secondary","bg-hud-elevated"),blackWater:t("blackWater",e("widgets.tankBlackWater"),i.faToilet,"text-hud-secondary","bg-hud-elevated"),oil:t("oil",e("widgets.tankEngineOil"),i.faOilCan,"text-oYellow","bg-oYellow")};return{hasData:Object.values(a).some(e=>null!==e.level),...a}},[s,e]);return(0,t.jsx)(m,{title:e("widgets.storageSystems"),icon:i.faGasPump,hasData:l.hasData,noDataMessage:e("widgets.signalLossLevelSensors"),children:(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center min-h-0 space-y-4",children:Object.entries(l).filter(([e])=>"hasData"!==e).map(([e,a])=>{if(null===a.level)return null;let s=Math.round(100*a.level),i=Number.isFinite(a.capacity)?Math.round(1e3*a.capacity):null,l=null!==i?Math.round(a.level*i):null,r="wasteWater"===e||"blackWater"===e,o=r?a.level>.8:a.level<.1;return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)("div",{className:"flex items-center justify-center w-6 h-6 bg-hud-elevated rounded-full",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:a.icon,className:`${a.color} text-xs opacity-80`})}),(0,t.jsx)("span",{className:"text-hud-main text-caption font-semibold uppercase tracking-widest whitespace-nowrap",children:a.displayName})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[null!==i&&(0,t.jsxs)("span",{className:"text-hud-secondary text-caption font-semibold opacity-60 tabular-nums whitespace-nowrap",children:[l,"/",i," L"]}),(0,t.jsxs)("span",{className:`text-label font-semibold ${((e,t=!1)=>t?e>.8?"text-oRed":e>.6?"text-oYellow":"text-oGreen":e<.1?"text-oRed":e<.25?"text-oYellow":"text-oGreen")(a.level,r)} ${o?"animate-soft-pulse":""}`,children:[s,"%"]})]})]}),(0,t.jsx)("div",{className:"bg-hud-elevated rounded-full h-1.5 overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:`h-full transition-all duration-1000 ${r?a.level>.8?"bg-oRed":a.level>.6?"bg-oYellow":"bg-oGreen":a.level<.1?"bg-oRed":a.level<.25?"bg-oYellow":"bg-oGreen"}`,style:{width:`${s}%`}})})]},e)})})})}f.displayName="AISRadarWidget";var y=e.i(46991),w=e.i(83934),b=e.i(95430);function N(){let{t:e}=(0,x.useTranslation)(),s=d.default.get("debugMode"),{forecasts:l,isLoading:r,weatherApiAvailable:o,fetchWeatherForecast:c,getCurrentWeather:u}=(0,w.useWeather)(),h=(0,a.useMemo)(()=>{let e=u(),t=(0,y.convertTemperatureUnit)(e.temperature),a=null!==(0,y.finite)(e.humidity)?Math.round(100*e.humidity):null,n=null!==(0,y.convertPressure)(e.pressure)?Math.round(e.pressure/100):null,i=(0,y.convertSpeedUnit)(e.windSpeed),r=(0,y.toDegrees)(e.windDirection),o=e.description,c=e.source,d=null!==t||null!==a||null!==n||null!==i;if(!d&&!s)return{hasData:!1,dataSource:null};let m=t,x=a,h=n,p=i,g=r;!d&&s&&(m=15,x=65,h=1013,p=5.2,g=120,c="debug");let f="sunny";if(o){let e=o.toLowerCase();e.includes("rain")||e.includes("shower")?f="rainy":e.includes("snow")?f="snow":e.includes("partly")||e.includes("few clouds")||e.includes("scattered")?f="partly-cloudy":e.includes("cloud")||e.includes("overcast")?f="cloudy":(e.includes("clear")||e.includes("sun"))&&(f="sunny")}else h&&(f=h<1e3?x&&x>80?"rainy":"cloudy":h>1020?"sunny":"partly-cloudy");return{hasData:!0,dataSource:c,description:o,temperature:m,humidity:x,pressure:h,windSpeed:p,windDirection:g,condition:f,forecast:l}},[u,l,s]),p=e=>{switch(e){case"sunny":return i.faSun;case"partly-cloudy":default:return i.faCloudSun;case"cloudy":return i.faCloud;case"rainy":return i.faCloudRain;case"heavy-rain":return i.faCloudShowersHeavy;case"snow":return i.faSnowflake}},g=e=>{switch(e){case"sunny":return"text-oYellow";case"partly-cloudy":case"rainy":case"heavy-rain":default:return"text-oBlue";case"cloudy":return"text-hud-muted";case"snow":return"text-hud-main"}},f=e=>null===(0,y.finite)(e)?"":["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][(Math.round(e/22.5)%16+16)%16];return(0,t.jsxs)(m,{title:e("widgets.meteorologicalData"),icon:p(h.condition),hasData:h.hasData,noDataMessage:r?e("widgets.acquiringSatellite"):e("widgets.signalLossWeather"),children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex items-center space-x-3",children:[h.dataSource&&(0,t.jsx)("span",{className:`text-caption px-2 py-0.5 rounded-sm uppercase font-semibold tracking-widest text-hud-main shadow-soft ${"sensors"===h.dataSource?"bg-oGreen/40 border border-oGreen/30":"forecast"===h.dataSource?"bg-oBlue/40 border border-oBlue/30":"bg-hud-elevated border border-hud"}`,children:(()=>{switch(h.dataSource){case"sensors":return e("widgets.dataSourceLive");case"forecast":return e("widgets.dataSourceForecast");case"debug":return e("widgets.dataSourceDemo");default:return""}})()}),!1!==o&&(0,t.jsx)("button",{onClick:c,disabled:r,className:"w-7 h-7 rounded-full bg-hud-elevated flex items-center justify-center text-hud-secondary hover:text-hud-main transition-all duration-500 tesla-hover",title:e("widgets.updateForecast"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faSync,className:`text-xs ${r?"animate-spin":""}`})})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center",children:(0,t.jsxs)("div",{className:"text-center mb-6 group",children:[(0,t.jsx)("div",{className:`text-hero mb-4 transition-transform duration-700 group-hover:scale-110 ${g(h.condition)}`,children:(0,t.jsx)(n.FontAwesomeIcon,{icon:p(h.condition),className:"sunny"!==h.condition?"animate-soft-pulse":""})}),(0,t.jsx)("div",{className:"text-hero font-medium text-hud-main leading-none gliding-value tracking-tight",children:null!==h.temperature?`${h.temperature}${(0,y.getTemperatureUnitLabel)()}`:e("common.na")}),(0,t.jsx)("div",{className:"text-caption font-semibold text-hud-secondary uppercase tracking-[0.3em] mt-3 opacity-60",children:h.description||(t=>{switch(t){case"sunny":return e("widgets.clearSkies");case"partly-cloudy":return e("widgets.partlyCloudy");case"cloudy":return e("widgets.overcast");case"rainy":return e("widgets.lightRain");case"heavy-rain":return e("widgets.heavyRain");case"snow":return e("widgets.snow");default:return e("widgets.variable")}})(h.condition)})]})}),h.forecast&&h.forecast.length>1&&(0,t.jsx)("div",{className:"space-y-2 shrink-0",children:h.forecast.slice(1,4).map((e,a)=>{let s=new Date(e.date?e.date:(0,b.vesselNow)().getTime()+(a+1)*864e5),l=isNaN(s.getTime())?e.time||`+${a+1}d`:s.toLocaleDateString("en-GB",{weekday:"short"}),r=e.description?e.description.toLowerCase().includes("rain")?"rainy":e.description.toLowerCase().includes("cloud")?"cloudy":e.description.toLowerCase().includes("snow")?"snow":"sunny":"partly-cloudy",o=null!==(0,y.finite)(e.wind?.speed)?Math.round(10*e.wind.speed)/10:null,c=f(e.wind?.direction)||null;return(0,t.jsxs)("div",{className:"flex items-center justify-between py-1.5 border-b border-hud/30 last:border-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)("span",{className:"text-hud-muted text-caption font-semibold uppercase tracking-widest w-8",children:l}),(0,t.jsx)(n.FontAwesomeIcon,{icon:p(r),className:`text-sm w-5 ${g(r)}`}),(0,t.jsx)("span",{className:"text-hud-main text-label font-semibold gliding-value w-8",children:null!==e.temperature?`${Math.round(e.temperature)}\xb0`:"--"})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faWind,className:"text-oBlue text-xs opacity-50"}),(0,t.jsx)("span",{className:"text-hud-main text-caption font-semibold gliding-value",children:null!==o?`${o} ${(0,y.getSpeedUnitLabel)()}`:"--"}),c&&(0,t.jsx)("span",{className:"text-hud-muted text-caption font-semibold tracking-widest opacity-60",children:c})]})]},a)})}),(0,t.jsxs)("div",{className:"flex items-center justify-between shrink-0 mt-2",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faWind,className:"text-oBlue text-sm opacity-50"}),(0,t.jsx)("span",{className:"text-hud-secondary text-caption uppercase font-semibold tracking-widest",children:e("widgets.now")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("span",{className:"text-hud-main text-label font-semibold gliding-value tracking-tight",children:null!==h.windSpeed?`${h.windSpeed} ${(0,y.getSpeedUnitLabel)()}`:e("common.na")}),(0,t.jsx)("span",{className:"text-hud-muted text-caption uppercase font-semibold tracking-widest ml-2 opacity-60",children:null!==h.windDirection?f(h.windDirection):""})]})]})]})]})}var j=e.i(66799);let k=(0,a.createContext)(),C=({children:e})=>{let[s,n]=(0,a.useState)({}),[i,l]=(0,a.useState)({}),[r,o]=(0,a.useState)({}),[c,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),[x,h]=(0,a.useState)(null),[p,g]=(0,a.useState)(null),[f,v]=(0,a.useState)(!1),[y,w]=(0,a.useState)(null),b=(0,a.useRef)(null),N=(0,a.useRef)(null),C=(0,a.useCallback)(async()=>{d(!0),m(null);try{let[e,t,a]=await Promise.all([j.default.getRoutes().catch(e=>("NetworkError"!==e.name&&console.error("NavigationContext: Failed to fetch routes:",e),{})),j.default.getWaypoints().catch(e=>("NetworkError"!==e.name&&console.error("NavigationContext: Failed to fetch waypoints:",e),{})),j.default.getCharts().catch(e=>("NetworkError"!==e.name&&console.error("NavigationContext: Failed to fetch charts:",e),{}))]);n(e||{}),l(t||{}),o(a||{})}catch(e){"NetworkError"!==e.name&&(console.error("NavigationContext: Failed to fetch resources:",e),m(e.message))}finally{d(!1)}},[]),M=(0,a.useCallback)(async()=>{try{let e=await j.default.getRoutes();return n(e||{}),e}catch(e){throw console.error("NavigationContext: Failed to fetch routes:",e),e}},[]),S=(0,a.useCallback)(async()=>{try{let e=await j.default.getWaypoints();return l(e||{}),e}catch(e){throw console.error("NavigationContext: Failed to fetch waypoints:",e),e}},[]),W=(0,a.useCallback)(async()=>{try{let[e,t]=await Promise.all([j.default.getCourse().catch(()=>null),j.default.getCourseCalculations().catch(()=>null)]);h(e),g(t)}catch(e){console.error("NavigationContext: Failed to fetch course:",e),w(e.message)}},[]),$=(0,a.useCallback)(async e=>{v(!0),w(null);try{await j.default.setDestinationWaypoint(e),await W()}catch(e){throw console.error("NavigationContext: Failed to set waypoint destination:",e),w(e.message),e}finally{v(!1)}},[W]),F=(0,a.useCallback)(async(e,t)=>{v(!0),w(null);try{await j.default.setDestinationPosition(e,t),await W()}catch(e){throw console.error("NavigationContext: Failed to set position destination:",e),w(e.message),e}finally{v(!1)}},[W]),T=(0,a.useCallback)(async(e,t=0,a=!1)=>{v(!0),w(null);try{await j.default.activateRoute(e,t,a),await W()}catch(e){throw console.error("NavigationContext: Failed to activate route:",e),w(e.message),e}finally{v(!1)}},[W]),I=(0,a.useCallback)(async()=>{v(!0),w(null);try{await j.default.clearCourse(),h(null),g(null)}catch(e){throw console.error("NavigationContext: Failed to clear course:",e),w(e.message),e}finally{v(!1)}},[]),D=(0,a.useCallback)(async()=>{try{await j.default.nextWaypoint(),await W()}catch(e){throw console.error("NavigationContext: Failed to go to next waypoint:",e),e}},[W]),A=(0,a.useCallback)(async()=>{try{await j.default.previousWaypoint(),await W()}catch(e){throw console.error("NavigationContext: Failed to go to previous waypoint:",e),e}},[W]),R=(0,a.useCallback)(async(e,t,a,s="")=>{try{let n=j.default.generateUUID(),i=j.default.createWaypointFeature(t,e,a,s);return await j.default.saveWaypoint(n,i),await S(),n}catch(e){throw console.error("NavigationContext: Failed to create waypoint:",e),e}},[S]),P=(0,a.useCallback)(async e=>{try{await j.default.deleteWaypoint(e),await S()}catch(e){throw console.error("NavigationContext: Failed to delete waypoint:",e),e}},[S]),G=(0,a.useCallback)(async(e,t,a="")=>{try{let s=j.default.generateUUID(),n=e.map(e=>[e.longitude,e.latitude]),i=j.default.createRouteFeature(n,t,a);return await j.default.saveRoute(s,i),await M(),s}catch(e){throw console.error("NavigationContext: Failed to create route:",e),e}},[M]),L=(0,a.useCallback)(async e=>{try{await j.default.deleteRoute(e),await M()}catch(e){throw console.error("NavigationContext: Failed to delete route:",e),e}},[M]),E=(0,a.useCallback)(e=>{let t=s[e];return t?j.default.parseRouteCoordinates(t):[]},[s]),B=(0,a.useCallback)(e=>{let t=i[e];return t?j.default.parseWaypointPosition(t):null},[i]),O=(0,a.useCallback)(()=>Object.entries(s).map(([e,t])=>({id:e,name:t.name||"Unnamed Route",description:t.description||"",pointCount:t.feature?.geometry?.coordinates?.length||0})),[s]),Y=(0,a.useCallback)(()=>Object.entries(i).map(([e,t])=>{let a=j.default.parseWaypointPosition(t);return{id:e,name:t.name||"Unnamed Waypoint",description:t.description||"",latitude:a?.latitude,longitude:a?.longitude}}),[i]),U=(0,a.useCallback)(()=>x?.nextPoint?.position!=null||x?.activeRoute?.href!=null,[x]),K=(0,a.useCallback)(()=>x?{position:x.nextPoint?.position,waypointHref:x.nextPoint?.href,routeHref:x.activeRoute?.href,pointIndex:x.activeRoute?.pointIndex,isRoute:!!x.activeRoute?.href,arrivalCircle:x.arrivalCircle}:null,[x]);(0,a.useEffect)(()=>(C(),W(),b.current=setInterval(()=>{W()},5e3),N.current=setInterval(()=>{C()},3e5),()=>{b.current&&clearInterval(b.current),N.current&&clearInterval(N.current)}),[C,W]);let z=(0,a.useMemo)(()=>({routes:s,waypoints:i,charts:r,isLoadingResources:c,resourcesError:u,activeCourse:x,courseCalculations:p,isLoadingCourse:f,courseError:y,fetchResources:C,fetchRoutes:M,fetchWaypoints:S,fetchCourse:W,navigateToWaypoint:$,navigateToPosition:F,activateRoute:T,clearCourse:I,goToNextWaypoint:D,goToPreviousWaypoint:A,createWaypoint:R,deleteWaypoint:P,createRoute:G,deleteRoute:L,getRouteCoordinates:E,getWaypointPosition:B,getRoutesList:O,getWaypointsList:Y,hasActiveDestination:U,getDestinationInfo:K}),[s,i,r,c,u,x,p,f,y,C,M,S,W,$,F,T,I,D,A,R,P,G,L,E,B,O,Y,U,K]);return(0,t.jsx)(k.Provider,{value:z,children:e})};e.i(67561);var M=e.i(37256);let S=(0,M.coursePaths)("distance","bearingTrue","crossTrackError","velocityMadeGood");function W(){var e,s;let{t:l}=(0,x.useTranslation)(),{activeCourse:r,courseCalculations:o,waypoints:u,routes:h,isLoadingCourse:p,navigateToWaypoint:g,activateRoute:f,clearCourse:v,goToNextWaypoint:w,goToPreviousWaypoint:b,getWaypointsList:N,getRoutesList:j,hasActiveDestination:C}=(()=>{let e=(0,a.useContext)(k);if(!e)throw Error("useNavigation must be used within a NavigationContextProvider");return e})(),W=d.default.get("debugMode"),$=(0,c.useSignalKPaths)(S),F=(0,M.courseValue)($,"distance"),T=(0,M.courseValue)($,"bearingTrue"),I=(0,M.courseValue)($,"crossTrackError"),D=(0,M.courseValue)($,"velocityMadeGood"),A=(0,c.useSignalKPath)("steering.autopilot.state"),R=(0,c.useSignalKPath)("steering.autopilot.mode"),P=(0,c.useSignalKPath)("steering.autopilot.target.headingTrue"),[G,L]=(0,a.useState)(!1),[E,B]=(0,a.useState)(!1),O=a.default.useMemo(()=>{let e=o||{},t=F??e.distance??null,a=T??e.bearingTrue??null;return null!==t||null!==a||W?{hasData:!0,distance:t??(W?5e3:null),bearingTrue:a??(W?.52:null),bearingMagnetic:e.bearingMagnetic??null,crossTrackError:I??e.crossTrackError??(W?50:null),velocityMadeGood:D??e.velocityMadeGood??(W?5.5:null),timeToGo:e.timeToGo??null,estimatedTimeOfArrival:e.estimatedTimeOfArrival??null,calcMethod:e.calcMethod}:{hasData:!1}},[o,F,T,I,D,W]),Y=async e=>{try{await g(e),L(!1)}catch(e){console.error("Failed to navigate to waypoint:",e)}},U=async e=>{try{await f(e),B(!1)}catch(e){console.error("Failed to activate route:",e)}},K=N(),z=j(),V=C();return(0,t.jsxs)(m,{title:l("widgets.course"),icon:i.faRoute,iconColorClass:"text-oGreen",hasData:O.hasData||V||K.length>0||z.length>0,noDataMessage:l("widgets.noCourseData"),children:[(0,t.jsxs)("div",{className:"absolute top-4 right-4 z-10 flex space-x-2",children:[(0,t.jsx)("button",{onClick:()=>{L(!G),B(!1)},className:`w-8 h-8 rounded-full flex items-center justify-center transition-all duration-500 shadow-soft ${G?"bg-oGreen text-hud-main":"bg-hud-elevated text-hud-secondary tesla-hover"}`,title:l("widgets.waypoints"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faLocationDot,className:"text-xs"})}),(0,t.jsx)("button",{onClick:()=>{B(!E),L(!1)},className:`w-8 h-8 rounded-full flex items-center justify-center transition-all duration-500 shadow-soft ${E?"bg-oGreen text-hud-main":"bg-hud-elevated text-hud-secondary tesla-hover"}`,title:l("widgets.routes"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faList,className:"text-xs"})})]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[G&&(0,t.jsxs)("div",{className:"mb-4 max-h-40 overflow-y-auto tesla-card space-y-1",children:[(0,t.jsx)("div",{className:"text-caption text-hud-muted mb-2 uppercase font-semibold tracking-[0.2em] px-2 pt-1",children:l("widgets.storedWaypoints")}),0===K.length?(0,t.jsx)("div",{className:"text-caption text-hud-secondary italic px-2 py-4 text-center font-semibold uppercase",children:l("widgets.noActiveNodes")}):K.map(e=>(0,t.jsxs)("button",{onClick:()=>Y(e.id),className:"w-full text-left p-2 tesla-hover rounded-sm text-caption text-hud-main flex items-center group font-semibold uppercase tracking-tight",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faLocationDot,className:"text-oYellow mr-3 text-xs opacity-50 group-hover:opacity-100"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))]}),E&&(0,t.jsxs)("div",{className:"mb-4 max-h-40 overflow-y-auto tesla-card space-y-1",children:[(0,t.jsx)("div",{className:"text-caption text-hud-muted mb-2 uppercase font-semibold tracking-[0.2em] px-2 pt-1",children:l("widgets.missionRoutes")}),0===z.length?(0,t.jsx)("div",{className:"text-caption text-hud-secondary italic px-2 py-4 text-center font-semibold uppercase",children:l("widgets.noRoutesLoaded")}):z.map(e=>(0,t.jsxs)("button",{onClick:()=>U(e.id),className:"w-full text-left p-2 tesla-hover rounded-sm text-caption text-hud-main flex items-center justify-between group font-semibold uppercase tracking-tight",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faRoute,className:"text-oGreen mr-3 text-xs opacity-50 group-hover:opacity-100"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted font-semibold",children:[e.pointCount," pts"]})]},e.id))]}),V&&(0,t.jsxs)("div",{className:"tesla-card bg-oYellow/5 mb-6 border-l-2 border-oYellow/30 animate-soft-pulse",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faCrosshairs,className:"text-oYellow text-sm"}),(0,t.jsx)("span",{className:"text-hud-main text-caption font-semibold uppercase tracking-widest truncate",children:(()=>{if(!r)return l("widgets.noDestination");if(r.activeRoute?.href){let e=h[r.activeRoute.href.split("/").pop()],t=r.activeRoute.pointIndex||0;return e?.name?`${e.name} (${t+1})`:l("widgets.activeRoute")}if(r.nextPoint?.href){let e=u[r.nextPoint.href.split("/").pop()];return e?.name||l("widgets.waypoint")}if(r.nextPoint?.position){let e=r.nextPoint.position;return`${e.latitude?.toFixed(4)}\xb0, ${e.longitude?.toFixed(4)}\xb0`}return l("widgets.noDestination")})()})]}),(0,t.jsx)("button",{onClick:v,className:"text-hud-secondary hover:text-oRed transition-colors p-1",title:l("widgets.abortNavigation"),children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faTimes,className:"text-sm"})})]}),r?.activeRoute?.href&&(0,t.jsxs)("div",{className:"flex justify-center space-x-3 mt-4",children:[(0,t.jsxs)("button",{onClick:b,className:"bg-hud-elevated hover:bg-hud-bg text-hud-main px-4 py-1.5 rounded text-caption font-semibold uppercase tracking-widest transition-all shadow-soft",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faArrowLeft,className:"mr-2"}),l("widgets.previous")]}),(0,t.jsxs)("button",{onClick:w,className:"bg-oBlue hover:bg-oBlue/80 text-hud-main px-4 py-1.5 rounded text-caption font-semibold uppercase tracking-widest transition-all shadow-lg shadow-oBlue/20",children:[l("widgets.proceed"),(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faArrowRight,className:"ml-2"})]})]})]}),A&&(0,t.jsxs)("div",{className:`tesla-card px-3 py-2 mb-3 flex items-center justify-between ${"enabled"===A?"border-l-2 border-oGreen/30":""}`,children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faRobot,className:`text-xs ${"enabled"===A?"text-oGreen":"text-hud-muted"}`}),(0,t.jsx)("span",{className:`text-caption font-semibold uppercase capitalize gliding-value ${"enabled"===A?"text-oGreen":"text-hud-secondary"}`,children:A})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4 text-caption font-semibold uppercase",children:[(0,t.jsx)("span",{className:"text-hud-main capitalize gliding-value",children:R||"—"}),(0,t.jsx)("span",{className:"text-oYellow gliding-value",children:null!==P?`${Math.round((0,y.toDegrees)(P))}\xb0`:"—"})]})]}),O.hasData&&(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faRuler,className:"text-oGreen text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:null==(e=O.distance)?l("common.na"):e<1e3?`${Math.round(e)} m`:`${(0,y.convertDistanceUnit)(e)} ${(0,y.getDistanceUnitLabel)()}`}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:l("widgets.distance")})]}),(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faCompass,className:"text-oBlue text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:null!==O.bearingTrue?`${Math.round((0,y.toDegrees)(O.bearingTrue))}\xb0`:l("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:l("widgets.bearing")})]}),(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faArrowRight,className:`${O.crossTrackError>50||O.crossTrackError<-50?"text-oRed animate-soft-pulse":"text-oGreen opacity-50"} text-xs mb-2`}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:null!==O.crossTrackError?`${Math.abs(Math.round(O.crossTrackError))}m`:l("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"XTE"})]}),(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faPlay,className:"text-oGreen text-xs mb-2 opacity-50"}),(0,t.jsxs)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:[null!==O.velocityMadeGood?`${(0,y.convertSpeedUnit)(O.velocityMadeGood)}`:l("common.na"),(0,t.jsx)("span",{className:"text-caption text-hud-secondary ml-1",children:(0,y.getSpeedUnitLabel)()})]}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"VMG"})]}),null!==O.timeToGo&&(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faClock,className:"text-oGreen text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:(e=>{if(null==e)return l("common.na");let t=Math.floor(e/3600),a=Math.floor(e%3600/60);return t>0?`${t}h ${a}m`:`${a}m`})(O.timeToGo)}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"TTG"})]}),O.estimatedTimeOfArrival&&(0,t.jsxs)("div",{className:"tesla-card text-center tesla-hover ",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faClock,className:"text-oYellow text-xs mb-2 opacity-50"}),(0,t.jsx)("div",{className:"text-hud-main text-value font-semibold gliding-value tracking-tight",children:(s=O.estimatedTimeOfArrival)?new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):l("common.na")}),(0,t.jsx)("div",{className:"text-hud-secondary text-caption uppercase font-semibold mt-2 tracking-[0.2em]",children:"ETA"})]})]})]})]})}let $=a.default.memo(({children:e,widgetName:a,className:l="",fullscreenWidget:r,toggleFullscreen:o})=>(0,t.jsxs)(s.motion.div,{layout:!0,variants:{hidden:{opacity:0,y:20},show:{opacity:1,y:0}},transition:{duration:.5,ease:[.4,0,.2,1]},className:`relative group ${l}`,children:[e,(0,t.jsx)("button",{onClick:()=>o(a),className:"absolute top-3 right-3 opacity-0 group-hover:opacity-100 transition-all duration-500 bg-hud-bg backdrop-blur-md hover:bg-hud-elevated rounded-full w-8 h-8 flex items-center justify-center text-hud-muted hover:text-hud-main z-10 shadow-soft",title:r===a?"Exit fullscreen":"Fullscreen",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:r===a?i.faCompress:i.faExpand,className:"text-xs"})})]}));$.displayName="WidgetWrapper";let F={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}};e.s(["default",0,function(){let[e,n]=(0,a.useState)(null),i=a.default.useCallback(e=>{n(t=>t===e?null:e)},[]),l=(a,s,n="")=>(0,t.jsx)($,{widgetName:a,fullscreenWidget:e,toggleFullscreen:i,className:e&&e!==a?"hidden":e===a?"w-full h-full":n,children:s});return(0,t.jsx)("div",{className:"flex flex-col h-full bg-rightPaneBg overflow-hidden",children:(0,t.jsx)("div",{className:"flex-1 p-4 min-h-0 overflow-auto scrollbar-hide",children:(0,t.jsxs)(s.motion.div,{variants:F,initial:"hidden",animate:"show",className:e?"flex h-full":"card-grid",children:[l("aisradar",(0,t.jsx)(f,{}),"sm:col-span-2 sm:row-span-2"),l("weather",(0,t.jsx)(N,{})),l("course",(0,t.jsx)(C,{children:(0,t.jsx)(W,{})})),l("tanks",(0,t.jsx)(v,{}))]})})})}],54784)},25294,function(e){e.n(e.i(54784))}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,4875,e=>{"use strict";var t=e.i(43476);e.i(67561);var i=e.i(46991),a=e.i(71645),n=e.i(85709);e.i(85269);var s=e.i(22831);let l={SOG:"navigation.speedOverGround",VMG:"performance.velocityMadeGood",STW:"navigation.speedThroughWater",POL:"performance.polarSpeedRatio"};e.s(["default",0,()=>{let{t:e}=(0,s.useTranslation)(),[r,d]=(0,a.useState)("SOG"),o=(0,a.useMemo)(()=>Object.values(l),[]),c=(0,n.useSignalKPaths)(o),m=(0,a.useMemo)(()=>{let e={};for(let[t,a]of Object.entries(l)){let n=c[a];null!=n&&(e[t]="POL"===t?100*n:(0,i.convertSpeedUnit)(n))}return e},[c]),u=Object.keys(m),h=void 0!==m[r]?r:u[0],x=m[h],p=(0,a.useCallback)(()=>{if(0===u.length)return;let e=(u.indexOf(h)+1)%u.length;d(u[e])},[u,h]);return 0===u.length?(0,t.jsxs)("div",{className:"mt-6 [@media(max-height:500px)]:mt-1.5 ml-2",children:[(0,t.jsx)("div",{className:"text-hero [@media(max-height:500px)]:text-[2.5rem] font-medium text-hud-dim tracking-tight",children:"--"}),(0,t.jsx)("div",{className:"text-caption font-semibold uppercase tracking-[0.2em] text-hud-muted ml-1",children:e("common.na")})]}):(0,t.jsxs)("div",{className:"mt-6 [@media(max-height:500px)]:mt-1.5 ml-2 select-none group",children:[(0,t.jsx)("div",{className:"text-hero [@media(max-height:500px)]:text-[2.5rem] font-medium cursor-pointer tracking-tight drop-shadow-2xl transition-all duration-300 group-hover:scale-105 active:scale-95 text-hud-main",onClick:p,role:"button",tabIndex:0,"aria-label":`Current speed: ${x} ${h}. Click to change speed type.`,children:Number.isFinite(x)?x.toFixed(1):"--"}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 ml-1",children:[(0,t.jsx)("div",{className:"text-caption font-semibold uppercase tracking-[0.3em] text-hud-secondary",children:h}),(0,t.jsx)("div",{className:"h-[2px] w-4 bg-oBlue/40 rounded-full"}),(0,t.jsx)("div",{className:"text-caption font-bold uppercase tracking-widest text-hud-muted",children:"POL"===h?"%":(0,i.getSpeedUnitLabel)()})]})]})}])},56665,function(e){e.n(e.i(4875))}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58700,e=>{"use strict";var t=e.i(43476),n=e.i(71645);e.i(85269);var a=e.i(22831),i=e.i(49721),r=e.i(68757),l=e.i(85709),o=e.i(46991),s=e.i(83402),u=e.i(83646),d=e.i(62588),g=e.i(77291),c=e.i(24752);let m=(e,t)=>{if(!Number.isFinite(e))return"--";let n=Math.abs(e),a=Math.floor(n),i=((n-a)*60).toFixed(3);return`${a}\xb0${i}'${t?e>=0?"N":"S":e>=0?"E":"W"}`},p=({card:e,onClose:n})=>{let{t:l}=(0,a.useTranslation)(),{scene:o}=(0,u.default)(),s={giveWay:o.vesselDanger,yields:o.vesselYields,close:o.vesselClose},d=e.primary.filter(e=>null!=e.value&&""!==e.value),g=(e.details||[]).filter(e=>null!=e.value&&""!==e.value);return(0,t.jsxs)("div",{className:"tesla-card !p-0 !rounded-2xl overflow-hidden select-none flex flex-col min-h-0 max-h-full",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 px-4 pt-3 pb-2 shrink-0",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-label font-semibold text-hud-main truncate",children:e.title}),e.subtitle&&(0,t.jsx)("div",{className:"text-caption text-hud-muted truncate",children:e.subtitle}),e.status&&(0,t.jsx)("span",{className:"inline-block mt-1.5 px-2 py-0.5 rounded-full text-caption font-semibold text-white",style:{background:s[e.status.tone]||o.vessel},children:e.status.text})]}),(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),n?.()},"aria-label":l("common.close"),className:"shrink-0 -mr-1 w-10 h-10 flex items-center justify-center rounded-full bg-hud-elevated text-hud-secondary hover:text-hud-main",children:(0,t.jsx)(i.FontAwesomeIcon,{icon:r.faTimes})})]}),(0,t.jsxs)("div",{className:"overflow-y-auto min-h-0 px-4 pb-3",children:[(0,t.jsx)("div",{className:"grid grid-cols-4 gap-2",children:d.map(e=>(0,t.jsxs)("div",{className:"rounded-xl bg-hud-elevated px-2 py-1.5 min-w-0",children:[(0,t.jsxs)("div",{className:"text-[0.65rem] font-semibold uppercase text-hud-muted truncate",children:[e.label,e.unit&&(0,t.jsxs)("span",{className:"normal-case font-normal",children:[" · ",e.unit]})]}),(0,t.jsx)("div",{className:"text-value font-semibold text-hud-main leading-tight truncate",children:e.value})]},e.label))}),g.length>0&&(0,t.jsx)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 mt-3",children:g.map(e=>(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2 min-w-0",children:[(0,t.jsx)("dt",{className:"text-caption text-hud-muted whitespace-nowrap",children:e.label}),(0,t.jsx)("dd",{className:"text-caption font-semibold text-hud-main truncate text-right",children:e.value})]},e.label))})]})]})},v=({onClose:e})=>{let{t:i}=(0,a.useTranslation)(),r=s.default.getAll(),u=`environment.wind.${r.preferredWindSpeedPath||"speedTrue"}`,d=`environment.wind.${r.preferredWindDirectionPath||"angleTrueWater"}`,g=(0,n.useMemo)(()=>["navigation.speedOverGround","navigation.speedThroughWater","navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","performance.velocityMadeGood","performance.polarSpeedRatio",u,d,"environment.wind.speedApparent","environment.wind.angleApparent","navigation.position","name"],[u,d]),c=(0,l.useSignalKPaths)(g),v=e=>{let t=(0,o.toDegrees)(e);return null===t?null:String(t).padStart(3,"0")},h=(e,t)=>{let n=(0,o.toKnots)(e);if(null===n)return null;let a=Number.isFinite(t)?Math.round(180*Math.abs(t)/Math.PI):null;return null===a?`${n} kn`:`${n} kn \xb7 ${a}\xb0${t<0?i("hud.portShort"):i("hud.starboardShort")}`},b=c["performance.polarSpeedRatio"],f="string"==typeof c.name?c.name:c.name?.value,x=c["navigation.position"],w=s.default.getSelectedBoat?.()||s.default.get("selectedBoat"),M="string"==typeof w?w:w?.name;return(0,t.jsx)(p,{onClose:e,card:{title:f||i("infoPanel.ownBoat"),subtitle:f?`${i("infoPanel.ownBoat")} \xb7 ${M||""}`.replace(/ · $/,""):M,primary:[{label:"SOG",value:(0,o.toKnots)(c["navigation.speedOverGround"]),unit:"kn"},{label:"STW",value:(0,o.toKnots)(c["navigation.speedThroughWater"]),unit:"kn"},{label:i("infoPanel.heading"),value:v(c["navigation.headingTrue"]??c["navigation.headingMagnetic"]),unit:"°"},{label:"COG",value:v(c["navigation.courseOverGroundTrue"]),unit:"°"}],details:[{label:"VMG",value:(0,o.toKnots)(c["performance.velocityMadeGood"])&&`${(0,o.toKnots)(c["performance.velocityMadeGood"])} kn`},{label:i("hud.polar"),value:Number.isFinite(b)&&b>0?`${Math.round(100*b)} %`:null},{label:i("hud.tws"),value:h(c[u],c[d])},{label:i("hud.aws"),value:h(c["environment.wind.speedApparent"],c["environment.wind.angleApparent"])},{label:i("infoPanel.latitude"),value:x&&m(x.latitude,!0)},{label:i("infoPanel.longitude"),value:x&&m(x.longitude,!1)}]}})},h=e=>String(e).replace(/^urn:mrn:(imo:mmsi|signalk:uuid):/,""),b=({mmsi:e,onClose:n})=>{let{t:i}=(0,a.useTranslation)(),{aisData:r}=(0,d.useAIS)({passive:!0}),{statuses:l,encounters:s}=(0,g.default)(),u=r[e];if(!u)return null;let m=u.name&&"unknown"!==u.name?u.name:h(e),v=s.find(t=>t.target.mmsi===e),b=l[e],f=null;if(v){let{role:e}=v;f={tone:"stand-on"===e.ownRole?"yields":"giveWay",text:`${i(`colregs.${e.reason}`,{name:m})} \xb7 ${i("colregs.rule",{rule:e.rule})}`}}else b&&(f={tone:b,text:i(`infoPanel.status.${b}`)});let x=u.distanceMeters,w=Number.isFinite(x)?x<1852?{value:Math.round(x),unit:"m"}:{value:(x/1852).toFixed(1),unit:"NM"}:null,M=u.tcpaSeconds,y=u.cog??u.cogMagnetic,N=u.heading??u.headingMagnetic,T=e=>{let t=(0,o.toDegrees)(e);return null===t?null:`${String(t).padStart(3,"0")}\xb0`};return(0,t.jsx)(p,{onClose:n,card:{title:m,subtitle:[i(`infoPanel.category.${(0,c.targetCategory)(u)}`),Number.isFinite(u.length)?`${Math.round(u.length)} m`:null].filter(Boolean).join(" · "),status:f,primary:[{label:i("infoPanel.range"),value:w?.value,unit:w?.unit},{label:"CPA",value:Number.isFinite(u.cpaMeters)?(u.cpaMeters/1852).toFixed(2):null,unit:"NM"},{label:"TCPA",value:Number.isFinite(M)&&M>0?Math.round(M/60):null,unit:"min"},{label:"SOG",value:(0,o.toKnots)(u.sog),unit:"kn"}],details:[{label:"COG",value:T(y)},{label:i("infoPanel.heading"),value:T(N)},{label:"MMSI",value:h(e)},{label:i("infoPanel.callsign"),value:u.callsign},{label:i("infoPanel.beam"),value:Number.isFinite(u.beam)?`${u.beam} m`:null},{label:i("infoPanel.state"),value:u.navState&&i(`infoPanel.navState.${String(u.navState).replace(/[^a-z]+(.)/gi,(e,t)=>t.toUpperCase())}`,{defaultValue:u.navState})}]}})};e.s(["default",0,({content:e,onClose:n})=>e?.kind==="own"?(0,t.jsx)(v,{onClose:n}):e?.kind==="ais"?(0,t.jsx)(b,{mmsi:e.mmsi,onClose:n}):null,"formatCoordinate",0,m])},77021,function(e){e.n(e.i(58700))},77291,24752,e=>{"use strict";var t=e.i(71645),n=e.i(62588),a=e.i(85709),i=e.i(61969),r=e.i(539);let l=Math.PI/180,o={power:1,sail:2,fishing:3,restricted:4},s=e=>{let t=String(e.navState||"").toLowerCase();if(/not under command|restricted|constrained/.test(t))return"restricted";if(/fishing/.test(t))return"fishing";if(/sailing/.test(t))return"sail";if(/motoring|engine/.test(t))return"power";let n=Number(e.shipType);return 36===n?"sail":30===n?"fishing":33===n?"restricted":"power"},u=(e,t,n)=>(0,r.wrapPi)(Math.atan2(t.x-e.x,t.y-e.y)-n),d=(e,t,n)=>{let a={x:0,y:0},i=u(a,t,e.course),s=u(t,a,t.course),d=Math.sign(s)||1,g=e=>Math.abs(e)>112.5*l;if(g(i)&&t.speed>e.speed)return{ownRole:"stand-on",rule:"13",reason:"overtakenByTarget",targetTurn:0};if(g(s)&&e.speed>t.speed)return{ownRole:"give-way",rule:"13",reason:"overtaking",targetTurn:0};let c=o[e.category]??1,m=o[t.category]??1;if(c!==m)return c<m?{ownRole:"give-way",rule:"18",reason:`giveWayTo_${t.category}`,targetTurn:0}:{ownRole:"stand-on",rule:"18",reason:`standOnFrom_${t.category}`,targetTurn:d};if("sail"===e.category&&Number.isFinite(n)){let a=(0,r.wrapPi)(n-e.course)>=0?"starboard":"port";return a!==((0,r.wrapPi)(n-t.course)>=0?"starboard":"port")?"port"===a?{ownRole:"give-way",rule:"12a-i",reason:"portTack",targetTurn:0}:{ownRole:"stand-on",rule:"12a-i",reason:"targetPortTack",targetTurn:d}:t.x*Math.sin(n)+t.y*Math.cos(n)>0?{ownRole:"stand-on",rule:"12a-ii",reason:"targetWindward",targetTurn:d}:{ownRole:"give-way",rule:"12a-ii",reason:"ownWindward",targetTurn:0}}return Math.abs((0,r.wrapPi)(t.course-e.course-Math.PI))<10*l&&Math.abs(i)<6*l?{ownRole:"both",rule:"14",reason:"headOn",targetTurn:1}:i>0?{ownRole:"give-way",rule:"15",reason:"crossingStarboard",targetTurn:0}:{ownRole:"stand-on",rule:"15",reason:"crossingPort",targetTurn:d}};e.s(["rightOfWay",0,d,"targetCategory",0,s],24752);var g=e.i(83402),c=e.i(67561);let m=[],p=["navigation.speedOverGround","navigation.courseOverGroundTrue"];e.s(["default",0,({always:e=!1}={})=>{let r,l,{targets:o}=(0,n.useAIS)({passive:!0}),{states:u}=(0,c.useOcearoContext)(),v=e||u.ais?o:m,{twd:h,heading:b}=(0,i.default)(),f=(0,a.useSignalKPaths)(p),x=(r=(0,a.useSignalKPrefix)("propulsion."),l=g.default.get("ownVesselCategory"),(0,t.useMemo)(()=>"sail"===l||"power"===l?l:Object.entries(r).some(([e,t])=>e.endsWith(".revolutions")&&Number(t)>.5||e.endsWith(".state")&&"started"===t)?"power":"sail",[r,l])),w=g.default.get("aisLengthScalingFactor")||.7;return(0,t.useMemo)(()=>{let e=f["navigation.courseOverGroundTrue"]??b,t=f["navigation.speedOverGround"]??0,n=[];if(Number.isFinite(e))for(let a of v){if("danger"!==a.risk)continue;let i=a.cog??a.cogMagnetic??a.heading;if(!Number.isFinite(i)||null===a.sceneX)continue;let r=d({course:e,speed:t,category:x},{x:a.sceneX/w,y:-a.sceneZ/w,course:i,speed:a.sog??0,category:s(a)},h);n.push({target:{...a},role:r})}n.sort((e,t)=>(e.target.tcpaSeconds??1/0)-(t.target.tcpaSeconds??1/0));let a={};for(let e of v)"close"===e.risk?a[e.mmsi]="close":"danger"===e.risk&&(a[e.mmsi]="giveWay");for(let e of n)a[e.target.mmsi]="stand-on"===e.role.ownRole?"yields":"giveWay";let i=n.filter(e=>"stand-on"!==e.role.ownRole);return{ownCategory:x,encounters:n,statuses:a,giveWay:i.length>0,giveWayTo:i[0]||null,primary:n[0]||null}},[v,h,b,f,x,w])}],77291)},61969,e=>{"use strict";var t=e.i(71645),n=e.i(85709),a=e.i(539);let i=180/Math.PI,r=["navigation.speedThroughWater","navigation.speedOverGround","navigation.headingTrue","navigation.courseOverGroundTrue","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.directionTrue","performance.polarSpeed","performance.polarSpeedRatio","navigation.courseGreatCircle.nextPoint.bearingTrue"];e.s(["default",0,()=>{let e=(0,n.useSignalKPaths)(r);return(0,t.useMemo)(()=>{let t=e["navigation.speedThroughWater"]??e["navigation.speedOverGround"]??null,n=e["navigation.headingTrue"]??e["navigation.courseOverGroundTrue"]??null,r=e["environment.wind.speedTrue"]??null,l=e["environment.wind.angleTrueWater"]??null,o=e["environment.wind.directionTrue"]??null;null===o&&Number.isFinite(l)&&Number.isFinite(n)&&(o=(0,a.wrapPi)(n+l));let s=e["performance.polarSpeed"]??(Number.isFinite(r)&&Number.isFinite(l)?(0,a.polarSpeedSi)(r,l):null),u=e["performance.polarSpeedRatio"]??null;null===u&&Number.isFinite(t)&&Number.isFinite(s)&&s>.2&&(u=t/s);let d=Number.isFinite(t)&&Number.isFinite(s)?(t-s)*1.943844:null,g=null,c=null,m=!Number.isFinite(l)||Math.abs(l)<Math.PI/2;if(Number.isFinite(r)){let e=m?(0,a.optimalUpwind)(1.943844*r):(0,a.optimalDownwind)(1.943844*r);e&&(g=e.twa/i,Number.isFinite(o)&&Number.isFinite(l)&&(c=(0,a.wrapPi)(o-Math.sign(l||1)*g)))}let p=e["navigation.courseGreatCircle.nextPoint.bearingTrue"],v=null;if(Number.isFinite(p)&&Number.isFinite(o)&&Number.isFinite(r)){let e=(0,a.bestVmcHeading)({twd:o,tws:r,bearing:p}),t=Number.isFinite(n)?(0,a.vmcForHeading)({twd:o,tws:r,bearing:p,heading:n}):null;v=e?{bearing:p,best:e,current:t}:null}return{ratio:u,polarSpeed:s,boatSpeed:t,deltaKn:d,heading:n,twd:o,tws:r,twa:l,targetTwa:g,targetHeading:c,upwind:m,vmc:v}},[e])}])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},74452,(e,t,n)=>{t.exports={vpp:{angles:[52,60,75,90,110,120,135,150],speeds:[6,8,10,12,14,16,20],52:[4.98,5.86,6.31,6.45,6.51,6.52,6.41],60:[5.25,6.11,6.56,6.73,6.79,6.82,6.79],75:[5.45,6.33,6.77,7.01,7.13,7.2,7.24],90:[5.66,6.55,7,7.25,7.38,7.53,7.7],110:[5.49,6.49,7.04,7.4,7.69,7.97,8.38],120:[5.32,6.36,6.97,7.39,7.77,8.1,8.6],135:[4.81,5.92,6.68,7.15,7.55,7.95,8.85],150:[4.09,5.17,6.04,6.61,6.99,7.31,7.93],beat_angle:[43.6,42,41.2,41.2,41.7,42.1,44.2],beat_vmg:[3.26,3.91,4.24,4.34,4.36,4.34,4.16],run_angle:[144.8,147.8,148.5,149.6,171.8,175.4,177.2],run_vmg:[3.54,4.48,5.23,5.73,6.17,6.67,7.36]}}},539,e=>{"use strict";var t=e.i(74452);let n=180/Math.PI,a=t.default.vpp,i=(e,t,n)=>e+(t-e)*n,r=(e,t)=>{if(t<=e[0])return[0,0];let n=e.length-1;if(t>=e[n])return[n-1,1];let a=0;for(;t>e[a+1];)a++;return[a,(t-e[a])/(e[a+1]-e[a])]},l=a.speeds.map((e,t)=>(e=>{let t=a.beat_angle[e],i=a.run_angle[e],r=a.beat_vmg[e]/Math.cos(t/n),l=a.run_vmg[e]/Math.abs(Math.cos(i/n)),o=[[0,0],[.7*t,.55*r],[t,r]];for(let n of a.angles)n>t&&n<i&&o.push([n,a[String(n)][e]]);return o.push([i,l]),i<180&&o.push([180,a.run_vmg[e]]),o})(t)),o=(e,t)=>{let[n,a]=r(e.map(e=>e[0]),t);return i(e[n][1],e[n+1][1],a)},s=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0)return null;let n=Math.min(180,Math.abs((t+540)%360-180)),s=a.speeds;if(e<s[0])return o(l[0],n)*(e/s[0]);let[u,d]=r(s,e);return i(o(l[u],n),o(l[u+1],n),d)},u=(e,t)=>{let[n,l]=r(a.speeds,t);return i(e[n],e[n+1],l)},d=(e,t)=>{let a=s(1.943844*e,t*n);return null===a?null:a/1.943844},g=e=>{let t=(e+Math.PI)%(2*Math.PI);return t<0&&(t+=2*Math.PI),t-Math.PI};e.s(["bestVmcHeading",0,({twd:e,tws:t,bearing:a})=>{if(![e,t,a].every(Number.isFinite)||t<=0)return null;let i=null;for(let r=-100;r<=100;r++){let l=a+r/n,o=d(t,g(e-l));if(null===o)continue;let s=o*Math.cos(l-a);(!i||s>i.vmc)&&(i={heading:g(l),speed:o,vmc:s})}return i},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(a.run_angle,e),i=s(e,t);return{twa:t,speed:i,vmg:-i*Math.cos(t/n)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(a.beat_angle,e),i=s(e,t);return{twa:t,speed:i,vmg:i*Math.cos(t/n)}},"polarSpeed",0,s,"polarSpeedSi",0,d,"vmcForHeading",0,({twd:e,tws:t,bearing:n,heading:a})=>{if(![e,t,n,a].every(Number.isFinite))return null;let i=d(t,g(e-a));return null===i?null:i*Math.cos(a-n)},"wrapPi",0,g])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58700,e=>{"use strict";var t=e.i(43476),n=e.i(71645);e.i(85269);var a=e.i(22831),i=e.i(49721),r=e.i(68757),l=e.i(85709),o=e.i(46991),s=e.i(83402),u=e.i(83646),d=e.i(62588),g=e.i(77291),c=e.i(24752);let m=(e,t)=>{if(!Number.isFinite(e))return"--";let n=Math.abs(e),a=Math.floor(n),i=((n-a)*60).toFixed(3);return`${a}\xb0${i}'${t?e>=0?"N":"S":e>=0?"E":"W"}`},p=({card:e,onClose:n})=>{let{t:l}=(0,a.useTranslation)(),{scene:o}=(0,u.default)(),s={giveWay:o.vesselDanger,yields:o.vesselYields,close:o.vesselClose},d=e.primary.filter(e=>null!=e.value&&""!==e.value),g=(e.details||[]).filter(e=>null!=e.value&&""!==e.value);return(0,t.jsxs)("div",{className:"tesla-card !p-0 !rounded-2xl overflow-hidden select-none flex flex-col min-h-0 max-h-full",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 px-4 pt-3 pb-2 shrink-0",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-label font-semibold text-hud-main truncate",children:e.title}),e.subtitle&&(0,t.jsx)("div",{className:"text-caption text-hud-muted truncate",children:e.subtitle}),e.status&&(0,t.jsx)("span",{className:"inline-block mt-1.5 px-2 py-0.5 rounded-full text-caption font-semibold text-white",style:{background:s[e.status.tone]||o.vessel},children:e.status.text})]}),(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),n?.()},"aria-label":l("common.close"),className:"shrink-0 -mr-1 w-10 h-10 flex items-center justify-center rounded-full bg-hud-elevated text-hud-secondary hover:text-hud-main",children:(0,t.jsx)(i.FontAwesomeIcon,{icon:r.faTimes})})]}),(0,t.jsxs)("div",{className:"overflow-y-auto min-h-0 px-4 pb-3",children:[(0,t.jsx)("div",{className:"grid grid-cols-4 gap-2",children:d.map(e=>(0,t.jsxs)("div",{className:"rounded-xl bg-hud-elevated px-2 py-1.5 min-w-0",children:[(0,t.jsxs)("div",{className:"text-[0.65rem] font-semibold uppercase text-hud-muted truncate",children:[e.label,e.unit&&(0,t.jsxs)("span",{className:"normal-case font-normal",children:[" · ",e.unit]})]}),(0,t.jsx)("div",{className:"text-value font-semibold text-hud-main leading-tight truncate",children:e.value})]},e.label))}),g.length>0&&(0,t.jsx)("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-1 mt-3",children:g.map(e=>(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2 min-w-0",children:[(0,t.jsx)("dt",{className:"text-caption text-hud-muted whitespace-nowrap",children:e.label}),(0,t.jsx)("dd",{className:"text-caption font-semibold text-hud-main truncate text-right",children:e.value})]},e.label))})]})]})},v=({onClose:e})=>{let{t:i}=(0,a.useTranslation)(),r=s.default.getAll(),u=`environment.wind.${r.preferredWindSpeedPath||"speedTrue"}`,d=`environment.wind.${r.preferredWindDirectionPath||"angleTrueWater"}`,g=(0,n.useMemo)(()=>["navigation.speedOverGround","navigation.speedThroughWater","navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","performance.velocityMadeGood","performance.polarSpeedRatio",u,d,"environment.wind.speedApparent","environment.wind.angleApparent","navigation.position","name"],[u,d]),c=(0,l.useSignalKPaths)(g),v=e=>{let t=(0,o.toDegrees)(e);return null===t?null:String(t).padStart(3,"0")},h=(e,t)=>{let n=(0,o.toKnots)(e);if(null===n)return null;let a=Number.isFinite(t)?Math.round(180*Math.abs(t)/Math.PI):null;return null===a?`${n} kn`:`${n} kn \xb7 ${a}\xb0${t<0?i("hud.portShort"):i("hud.starboardShort")}`},b=c["performance.polarSpeedRatio"],f="string"==typeof c.name?c.name:c.name?.value,x=c["navigation.position"],w=s.default.getSelectedBoat?.()||s.default.get("selectedBoat"),M="string"==typeof w?w:w?.name;return(0,t.jsx)(p,{onClose:e,card:{title:f||i("infoPanel.ownBoat"),subtitle:f?`${i("infoPanel.ownBoat")} \xb7 ${M||""}`.replace(/ · $/,""):M,primary:[{label:"SOG",value:(0,o.toKnots)(c["navigation.speedOverGround"]),unit:"kn"},{label:"STW",value:(0,o.toKnots)(c["navigation.speedThroughWater"]),unit:"kn"},{label:i("infoPanel.heading"),value:v(c["navigation.headingTrue"]??c["navigation.headingMagnetic"]),unit:"°"},{label:"COG",value:v(c["navigation.courseOverGroundTrue"]),unit:"°"}],details:[{label:"VMG",value:(0,o.toKnots)(c["performance.velocityMadeGood"])&&`${(0,o.toKnots)(c["performance.velocityMadeGood"])} kn`},{label:i("hud.polar"),value:Number.isFinite(b)&&b>0?`${Math.round(100*b)} %`:null},{label:i("hud.tws"),value:h(c[u],c[d])},{label:i("hud.aws"),value:h(c["environment.wind.speedApparent"],c["environment.wind.angleApparent"])},{label:i("infoPanel.latitude"),value:x&&m(x.latitude,!0)},{label:i("infoPanel.longitude"),value:x&&m(x.longitude,!1)}]}})},h=e=>String(e).replace(/^urn:mrn:(imo:mmsi|signalk:uuid):/,""),b=({mmsi:e,onClose:n})=>{let{t:i}=(0,a.useTranslation)(),{aisData:r}=(0,d.useAIS)({passive:!0}),{statuses:l,encounters:s}=(0,g.default)(),u=r[e];if(!u)return null;let m=u.name&&"unknown"!==u.name?u.name:h(e),v=s.find(t=>t.target.mmsi===e),b=l[e],f=null;if(v){let{role:e}=v;f={tone:"stand-on"===e.ownRole?"yields":"giveWay",text:`${i(`colregs.${e.reason}`,{name:m})} \xb7 ${i("colregs.rule",{rule:e.rule})}`}}else b&&(f={tone:b,text:i(`infoPanel.status.${b}`)});let x=u.distanceMeters,w=Number.isFinite(x)?x<1852?{value:Math.round(x),unit:"m"}:{value:(x/1852).toFixed(1),unit:"NM"}:null,M=u.tcpaSeconds,y=u.cog??u.cogMagnetic,N=u.heading??u.headingMagnetic,T=e=>{let t=(0,o.toDegrees)(e);return null===t?null:`${String(t).padStart(3,"0")}\xb0`};return(0,t.jsx)(p,{onClose:n,card:{title:m,subtitle:[i(`infoPanel.category.${(0,c.targetCategory)(u)}`),Number.isFinite(u.length)?`${Math.round(u.length)} m`:null].filter(Boolean).join(" · "),status:f,primary:[{label:i("infoPanel.range"),value:w?.value,unit:w?.unit},{label:"CPA",value:Number.isFinite(u.cpaMeters)?(u.cpaMeters/1852).toFixed(2):null,unit:"NM"},{label:"TCPA",value:Number.isFinite(M)&&M>0?Math.round(M/60):null,unit:"min"},{label:"SOG",value:(0,o.toKnots)(u.sog),unit:"kn"}],details:[{label:"COG",value:T(y)},{label:i("infoPanel.heading"),value:T(N)},{label:"MMSI",value:h(e)},{label:i("infoPanel.callsign"),value:u.callsign},{label:i("infoPanel.beam"),value:Number.isFinite(u.beam)?`${u.beam} m`:null},{label:i("infoPanel.state"),value:u.navState&&i(`infoPanel.navState.${String(u.navState).replace(/[^a-z]+(.)/gi,(e,t)=>t.toUpperCase())}`,{defaultValue:u.navState})}]}})};e.s(["default",0,({content:e,onClose:n})=>e?.kind==="own"?(0,t.jsx)(v,{onClose:n}):e?.kind==="ais"?(0,t.jsx)(b,{mmsi:e.mmsi,onClose:n}):null,"formatCoordinate",0,m])},77021,function(e){e.n(e.i(58700))},77291,24752,e=>{"use strict";var t=e.i(71645),n=e.i(62588),a=e.i(85709),i=e.i(61969),r=e.i(539);let l=Math.PI/180,o={power:1,sail:2,fishing:3,restricted:4},s=e=>{let t=String(e.navState||"").toLowerCase();if(/not under command|restricted|constrained/.test(t))return"restricted";if(/fishing/.test(t))return"fishing";if(/sailing/.test(t))return"sail";if(/motoring|engine/.test(t))return"power";let n=Number(e.shipType);return 36===n?"sail":30===n?"fishing":33===n?"restricted":"power"},u=(e,t,n)=>(0,r.wrapPi)(Math.atan2(t.x-e.x,t.y-e.y)-n),d=(e,t,n)=>{let a={x:0,y:0},i=u(a,t,e.course),s=u(t,a,t.course),d=Math.sign(s)||1,g=e=>Math.abs(e)>112.5*l;if(g(i)&&t.speed>e.speed)return{ownRole:"stand-on",rule:"13",reason:"overtakenByTarget",targetTurn:0};if(g(s)&&e.speed>t.speed)return{ownRole:"give-way",rule:"13",reason:"overtaking",targetTurn:0};let c=o[e.category]??1,m=o[t.category]??1;if(c!==m)return c<m?{ownRole:"give-way",rule:"18",reason:`giveWayTo_${t.category}`,targetTurn:0}:{ownRole:"stand-on",rule:"18",reason:`standOnFrom_${t.category}`,targetTurn:d};if("sail"===e.category&&Number.isFinite(n)){let a=(0,r.wrapPi)(n-e.course)>=0?"starboard":"port";return a!==((0,r.wrapPi)(n-t.course)>=0?"starboard":"port")?"port"===a?{ownRole:"give-way",rule:"12a-i",reason:"portTack",targetTurn:0}:{ownRole:"stand-on",rule:"12a-i",reason:"targetPortTack",targetTurn:d}:t.x*Math.sin(n)+t.y*Math.cos(n)>0?{ownRole:"stand-on",rule:"12a-ii",reason:"targetWindward",targetTurn:d}:{ownRole:"give-way",rule:"12a-ii",reason:"ownWindward",targetTurn:0}}return Math.abs((0,r.wrapPi)(t.course-e.course-Math.PI))<10*l&&Math.abs(i)<6*l?{ownRole:"both",rule:"14",reason:"headOn",targetTurn:1}:i>0?{ownRole:"give-way",rule:"15",reason:"crossingStarboard",targetTurn:0}:{ownRole:"stand-on",rule:"15",reason:"crossingPort",targetTurn:d}};e.s(["rightOfWay",0,d,"targetCategory",0,s],24752);var g=e.i(83402),c=e.i(67561);let m=[],p=["navigation.speedOverGround","navigation.courseOverGroundTrue"];e.s(["default",0,({always:e=!1}={})=>{let r,l,{targets:o}=(0,n.useAIS)({passive:!0}),{states:u}=(0,c.useOcearoContext)(),v=u.anchorWatch||u.parkingMode||u.moored,h=(e||u.ais)&&!v?o:m,{twd:b,heading:f}=(0,i.default)(),x=(0,a.useSignalKPaths)(p),w=(r=(0,a.useSignalKPrefix)("propulsion."),l=g.default.get("ownVesselCategory"),(0,t.useMemo)(()=>"sail"===l||"power"===l?l:Object.entries(r).some(([e,t])=>e.endsWith(".revolutions")&&Number(t)>.5||e.endsWith(".state")&&"started"===t)?"power":"sail",[r,l])),M=g.default.get("aisLengthScalingFactor")||.7;return(0,t.useMemo)(()=>{let e=x["navigation.courseOverGroundTrue"]??f,t=x["navigation.speedOverGround"]??0,n=[];if(Number.isFinite(e))for(let a of h){if("danger"!==a.risk)continue;let i=a.cog??a.cogMagnetic??a.heading;if(!Number.isFinite(i)||null===a.sceneX)continue;let r=d({course:e,speed:t,category:w},{x:a.sceneX/M,y:-a.sceneZ/M,course:i,speed:a.sog??0,category:s(a)},b);n.push({target:{...a},role:r})}n.sort((e,t)=>(e.target.tcpaSeconds??1/0)-(t.target.tcpaSeconds??1/0));let a={};for(let e of h)"close"===e.risk?a[e.mmsi]="close":"danger"===e.risk&&(a[e.mmsi]="giveWay");for(let e of n)a[e.target.mmsi]="stand-on"===e.role.ownRole?"yields":"giveWay";let i=n.filter(e=>"stand-on"!==e.role.ownRole);return{ownCategory:w,encounters:n,statuses:a,giveWay:i.length>0,giveWayTo:i[0]||null,primary:n[0]||null}},[h,b,f,x,w,M])}],77291)},61969,e=>{"use strict";var t=e.i(71645),n=e.i(85709),a=e.i(539),i=e.i(37256);let r=180/Math.PI,l=["navigation.speedThroughWater","navigation.speedOverGround","navigation.headingTrue","navigation.courseOverGroundTrue","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.directionTrue","performance.polarSpeed","performance.polarSpeedRatio",...(0,i.coursePaths)("bearingTrue")];e.s(["default",0,()=>{let e=(0,n.useSignalKPaths)(l);return(0,t.useMemo)(()=>{let t=e["navigation.speedThroughWater"]??e["navigation.speedOverGround"]??null,n=e["navigation.headingTrue"]??e["navigation.courseOverGroundTrue"]??null,l=e["environment.wind.speedTrue"]??null,o=e["environment.wind.angleTrueWater"]??null,s=e["environment.wind.directionTrue"]??null;null===s&&Number.isFinite(o)&&Number.isFinite(n)&&(s=(0,a.wrapPi)(n+o));let u=e["performance.polarSpeed"]??(Number.isFinite(l)&&Number.isFinite(o)?(0,a.polarSpeedSi)(l,o):null),d=e["performance.polarSpeedRatio"]??null;null===d&&Number.isFinite(t)&&Number.isFinite(u)&&u>.2&&(d=t/u);let g=Number.isFinite(t)&&Number.isFinite(u)?(t-u)*1.943844:null,c=null,m=null,p=!Number.isFinite(o)||Math.abs(o)<Math.PI/2;if(Number.isFinite(l)){let e=p?(0,a.optimalUpwind)(1.943844*l):(0,a.optimalDownwind)(1.943844*l);e&&(c=e.twa/r,Number.isFinite(s)&&Number.isFinite(o)&&(m=(0,a.wrapPi)(s-Math.sign(o||1)*c)))}let v=(0,i.courseValue)(e,"bearingTrue"),h=null;if(Number.isFinite(v)&&Number.isFinite(s)&&Number.isFinite(l)){let e=(0,a.bestVmcHeading)({twd:s,tws:l,bearing:v}),t=Number.isFinite(n)?(0,a.vmcForHeading)({twd:s,tws:l,bearing:v,heading:n}):null;h=e?{bearing:v,best:e,current:t}:null}return{ratio:d,polarSpeed:u,boatSpeed:t,deltaKn:g,heading:n,twd:s,tws:l,twa:o,targetTwa:c,targetHeading:m,upwind:p,vmc:h}},[e])}])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},74452,(e,t,n)=>{t.exports={vpp:{angles:[52,60,75,90,110,120,135,150],speeds:[6,8,10,12,14,16,20],52:[4.98,5.86,6.31,6.45,6.51,6.52,6.41],60:[5.25,6.11,6.56,6.73,6.79,6.82,6.79],75:[5.45,6.33,6.77,7.01,7.13,7.2,7.24],90:[5.66,6.55,7,7.25,7.38,7.53,7.7],110:[5.49,6.49,7.04,7.4,7.69,7.97,8.38],120:[5.32,6.36,6.97,7.39,7.77,8.1,8.6],135:[4.81,5.92,6.68,7.15,7.55,7.95,8.85],150:[4.09,5.17,6.04,6.61,6.99,7.31,7.93],beat_angle:[43.6,42,41.2,41.2,41.7,42.1,44.2],beat_vmg:[3.26,3.91,4.24,4.34,4.36,4.34,4.16],run_angle:[144.8,147.8,148.5,149.6,171.8,175.4,177.2],run_vmg:[3.54,4.48,5.23,5.73,6.17,6.67,7.36]}}},539,e=>{"use strict";var t=e.i(74452);let n=180/Math.PI,a=t.default.vpp,i=(e,t,n)=>e+(t-e)*n,r=(e,t)=>{if(t<=e[0])return[0,0];let n=e.length-1;if(t>=e[n])return[n-1,1];let a=0;for(;t>e[a+1];)a++;return[a,(t-e[a])/(e[a+1]-e[a])]},l=a.speeds.map((e,t)=>(e=>{let t=a.beat_angle[e],i=a.run_angle[e],r=a.beat_vmg[e]/Math.cos(t/n),l=a.run_vmg[e]/Math.abs(Math.cos(i/n)),o=[[0,0],[.7*t,.55*r],[t,r]];for(let n of a.angles)n>t&&n<i&&o.push([n,a[String(n)][e]]);return o.push([i,l]),i<180&&o.push([180,a.run_vmg[e]]),o})(t)),o=(e,t)=>{let[n,a]=r(e.map(e=>e[0]),t);return i(e[n][1],e[n+1][1],a)},s=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0)return null;let n=Math.min(180,Math.abs((t+540)%360-180)),s=a.speeds;if(e<s[0])return o(l[0],n)*(e/s[0]);let[u,d]=r(s,e);return i(o(l[u],n),o(l[u+1],n),d)},u=(e,t)=>{let[n,l]=r(a.speeds,t);return i(e[n],e[n+1],l)},d=(e,t)=>{let a=s(1.943844*e,t*n);return null===a?null:a/1.943844},g=e=>{let t=(e+Math.PI)%(2*Math.PI);return t<0&&(t+=2*Math.PI),t-Math.PI};e.s(["bestVmcHeading",0,({twd:e,tws:t,bearing:a})=>{if(![e,t,a].every(Number.isFinite)||t<=0)return null;let i=null;for(let r=-100;r<=100;r++){let l=a+r/n,o=d(t,g(e-l));if(null===o)continue;let s=o*Math.cos(l-a);(!i||s>i.vmc)&&(i={heading:g(l),speed:o,vmc:s})}return i},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(a.run_angle,e),i=s(e,t);return{twa:t,speed:i,vmg:-i*Math.cos(t/n)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(a.beat_angle,e),i=s(e,t);return{twa:t,speed:i,vmg:i*Math.cos(t/n)}},"polarSpeed",0,s,"polarSpeedSi",0,d,"vmcForHeading",0,({twd:e,tws:t,bearing:n,heading:a})=>{if(![e,t,n,a].every(Number.isFinite))return null;let i=d(t,g(e-a));return null===i?null:i*Math.cos(a-n)},"wrapPi",0,g])}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43322,e=>{e.v(t=>Promise.all(["static/chunks/3l25j666ze4c1.js"].map(t=>e.l(t))).then(()=>t(56101)))},34882,e=>{e.v(t=>Promise.all(["static/chunks/1zuex-na8y-w4.js"].map(t=>e.l(t))).then(()=>t(77021)))},59499,e=>{e.v(t=>Promise.all(["static/chunks/28wfa6j-9g_qc.js"].map(t=>e.l(t))).then(()=>t(85003)))},30150,e=>{e.v(t=>Promise.all(["static/chunks/1d81m3g9jqkob.js"].map(t=>e.l(t))).then(()=>t(84237)))},64390,e=>{e.v(t=>Promise.all(["static/chunks/3zqx8h9yg5-ch.js"].map(t=>e.l(t))).then(()=>t(39554)))},93170,e=>{e.v(t=>Promise.all(["static/chunks/0-c2-u5p6bxzo.js","static/chunks/11awvgcou7v4r.js"].map(t=>e.l(t))).then(()=>t(50226)))},48217,e=>{e.v(t=>Promise.all(["static/chunks/2n86yq1wz1yx7.js"].map(t=>e.l(t))).then(()=>t(14774)))},29882,e=>{e.v(t=>Promise.all(["static/chunks/1vchkqgn-xw-o.js"].map(t=>e.l(t))).then(()=>t(56665)))},93889,e=>{e.v(t=>Promise.all(["static/chunks/1mtfh1vqpvit2.js"].map(t=>e.l(t))).then(()=>t(58166)))},36258,e=>{e.v(t=>Promise.all(["static/chunks/2xntuu6mzh41s.js","static/chunks/3h_m2s30sr9mt.js","static/chunks/0n5v9mjln3x9c.js","static/chunks/3z29h80ysf4f1.js","static/chunks/40b8ooaw6x7my.js","static/chunks/1na56snuhu-pc.js"].map(t=>e.l(t))).then(()=>t(59465)))},97820,e=>{e.v(t=>Promise.all(["static/chunks/1_twx50ejqan5.js","static/chunks/1na56snuhu-pc.js","static/chunks/3h_m2s30sr9mt.js"].map(t=>e.l(t))).then(()=>t(69675)))},82041,e=>{e.v(t=>Promise.all(["static/chunks/0bxzs0khjn1uj.js"].map(t=>e.l(t))).then(()=>t(41994)))},73321,e=>{e.v(t=>Promise.all(["static/chunks/44f5hh9caupby.js"].map(t=>e.l(t))).then(()=>t(78938)))},11657,e=>{e.v(t=>Promise.all(["static/chunks/07gn9z0d6clzs.js"].map(t=>e.l(t))).then(()=>t(75058)))},93540,e=>{e.v(t=>Promise.all(["static/chunks/1g8fbzv0hu0i2.js"].map(t=>e.l(t))).then(()=>t(84809)))},77324,e=>{e.v(t=>Promise.all(["static/chunks/30p1dpgmonstj.js"].map(t=>e.l(t))).then(()=>t(64587)))},71762,e=>{e.v(t=>Promise.all(["static/chunks/0ath9h2eo-m4-.js"].map(t=>e.l(t))).then(()=>t(91999)))},31987,e=>{e.v(t=>Promise.all(["static/chunks/3yz0mxxv4vrfg.js"].map(t=>e.l(t))).then(()=>t(81788)))},9617,e=>{"use strict";let t={moved:!1,placingWaypoint:!1,message:null},a=new Set,s=new Set,n=e=>{t={...t,...e},a.forEach(e=>e())},i=e=>{t.moved!==e&&n({moved:e})};e.s(["getViewState",0,()=>t,"onRecenter",0,e=>(s.add(e),()=>s.delete(e)),"requestRecenter",0,()=>{s.forEach(e=>e()),i(!1)},"setCameraMoved",0,i,"setPlacingWaypoint",0,e=>n({placingWaypoint:e,message:null}),"setViewMessage",0,e=>n({message:e}),"subscribeView",0,e=>(a.add(e),()=>a.delete(e))])},32598,e=>{e.v(t=>Promise.all(["static/chunks/2393lwi8kee3m.js","static/chunks/2qylgmdj-32um.js"].map(t=>e.l(t))).then(()=>t(79224)))},32673,e=>{e.v(t=>Promise.all(["static/chunks/25v2cwta2fy-7.js"].map(t=>e.l(t))).then(()=>t(36540)))},11220,e=>{e.v(t=>Promise.all(["static/chunks/0ngl63fz0a-bo.js","static/chunks/1na56snuhu-pc.js","static/chunks/3h_m2s30sr9mt.js"].map(t=>e.l(t))).then(()=>t(27404)))},39271,e=>{"use strict";var t=e.i(43476),a=e.i(71645);e.i(85269);var s=e.i(22831),n=e.i(49721),i=e.i(68757),r=e.i(30206);let l=[10,30,60,120],o=()=>(0,a.useSyncExternalStore)(r.subscribeReplay,r.getReplayState,r.getReplayState);e.s(["default",0,()=>{let{t:e}=(0,s.useTranslation)(),a=o();if(!a.active)return null;let c=Math.max(1,a.end-a.start);return(0,t.jsxs)("div",{className:"hud-halo flex items-center gap-3 px-3 py-2 rounded-2xl bg-hud-bg/80 backdrop-blur select-none w-[min(40rem,100%)] flex-wrap",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-oBlue shrink-0",children:e("replay.title")}),(0,t.jsx)("button",{type:"button",onClick:r.togglePlay,"aria-label":e(a.playing?"replay.pause":"replay.play"),className:"w-9 h-9 rounded-full bg-hud-elevated text-hud-main flex items-center justify-center shrink-0",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:a.playing?i.faPause:i.faPlay})}),(0,t.jsx)("input",{type:"range",min:a.start,max:a.end,step:1e3,value:a.time,onChange:e=>(0,r.seekReplay)(Number(e.target.value)),"aria-label":e("replay.timeline"),className:"flex-1 min-w-0 accent-oBlue"}),(0,t.jsx)("span",{className:"text-label font-semibold tabular-nums text-hud-main shrink-0",children:new Date(a.time).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted tabular-nums shrink-0",children:[Math.round((a.time-a.start)/c*100),"%"]}),(0,t.jsx)("div",{className:"flex gap-1 shrink-0",children:l.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>(0,r.setReplaySpeed)(e),className:`px-2 py-1 rounded-lg text-caption font-semibold ${a.speed===e?"bg-oBlue text-white":"text-hud-muted hover:text-hud-main"}`,children:["×",e]},e))}),(0,t.jsx)("button",{type:"button",onClick:r.stopReplay,"aria-label":e("replay.close"),className:"w-8 h-8 rounded-full text-hud-muted hover:text-hud-main flex items-center justify-center shrink-0",children:(0,t.jsx)(n.FontAwesomeIcon,{icon:i.faXmark})})]})},"useReplay",0,o])},66984,e=>{e.v(t=>Promise.all(["static/chunks/0jpa5m78l0ib0.js"].map(t=>e.l(t))).then(()=>t(79261)))},72466,e=>{"use strict";let t={WARNING_THRESHOLD:50,DANGER_THRESHOLD:20,CHARGING_THRESHOLD:13.2,MIN_VOLTAGE:10.5,MAX_VOLTAGE:14.4};e.s(["BATTERY_CONFIG",0,t,"estimateStateOfCharge",0,e=>{if(!e||"number"!=typeof e)return 0;if(e>=13)return 100;if(e<=t.MIN_VOLTAGE)return 0;let a=[{voltage:12.85,soc:100},{voltage:12.75,soc:90},{voltage:12.65,soc:80},{voltage:12.55,soc:70},{voltage:12.45,soc:60},{voltage:12.35,soc:50},{voltage:12.25,soc:40},{voltage:12.15,soc:30},{voltage:12.05,soc:20},{voltage:11.95,soc:15},{voltage:11.8,soc:10},{voltage:11.6,soc:5},{voltage:10.5,soc:0}];for(let t=0;t<a.length-1;t++)if(e>=a[t+1].voltage){let s=a[t].voltage,n=a[t+1].voltage,i=a[t].soc,r=a[t+1].soc;return Math.round(r+(e-n)/(s-n)*(i-r))}return 0},"isBatteryCharging",0,e=>e>t.CHARGING_THRESHOLD])},58567,e=>{"use strict";let t;var a=e.i(83402);let s=/v3d|videocore|llvmpipe|swiftshader/i,n=/android|iphone|ipad|ipod|mobile/i;e.s(["RENDER_QUALITIES",0,["auto","high","pi"],"getRenderProfile",0,()=>{let e=a.default.get("renderQuality")||"auto";return"pi"===e||"auto"===e&&(()=>{if("u"<typeof navigator)return!1;if(s.test((()=>{if(void 0!==t)return t;t="";try{let e=document.createElement("canvas").getContext("webgl"),a=e?.getExtension("WEBGL_debug_renderer_info");t=String(e?.getParameter(a?a.UNMASKED_RENDERER_WEBGL:e.RENDERER)||""),e?.getExtension("WEBGL_lose_context")?.loseContext()}catch{}return t})()))return!0;if(n.test(navigator.userAgent)||navigator.maxTouchPoints>1&&/Macintosh/.test(navigator.userAgent))return!1;if(/aarch64|armv7|armv8|arm64|raspbian|raspberry/i.test(navigator.userAgent))return!0;let e=navigator.hardwareConcurrency||8,a=navigator.deviceMemory||8;return e<=4&&a<=4})()?{id:"pi",fps:30,dpr:.75,antialias:!1}:{id:"high",fps:60,dpr:Math.min(window.devicePixelRatio||1,2.5),antialias:!0}}])},37256,e=>{"use strict";let t={bearingTrue:["navigation.course.calcValues.bearingTrue","navigation.courseGreatCircle.nextPoint.bearingTrue","navigation.courseRhumbline.nextPoint.bearingTrue"],distance:["navigation.course.calcValues.distance","navigation.courseGreatCircle.nextPoint.distance","navigation.courseRhumbline.nextPoint.distance"],timeToGo:["navigation.course.calcValues.timeToGo","navigation.courseGreatCircle.nextPoint.timeToGo","navigation.courseRhumbline.nextPoint.timeToGo"],crossTrackError:["navigation.course.calcValues.crossTrackError","navigation.courseGreatCircle.crossTrackError","navigation.courseRhumbline.crossTrackError"],velocityMadeGood:["navigation.course.calcValues.velocityMadeGood","navigation.courseGreatCircle.velocityMadeGood","navigation.courseRhumbline.velocityMadeGood"]};e.s(["coursePaths",0,(...e)=>e.flatMap(e=>t[e]),"courseValue",0,(e,a)=>{for(let s of t[a]){let t=e?.[s];if(Number.isFinite(t))return t}}])},52822,(e,t,a)=>{"use strict";var s=e.r(71645),n=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,l=s.useRef,o=s.useEffect,c=s.useMemo,u=s.useDebugValue;a.useSyncExternalStoreWithSelector=function(e,t,a,s,n){var h=l(null);if(null===h.current){var m={hasValue:!1,value:null};h.current=m}else m=h.current;var v=r(e,(h=c(function(){function e(e){if(!o){if(o=!0,r=e,e=s(e),void 0!==n&&m.hasValue){var t=m.value;if(n(t,e))return l=t}return l=e}if(t=l,i(r,e))return t;var a=s(e);return void 0!==n&&n(t,a)?(r=e,t):(r=e,l=a)}var r,l,o=!1,c=void 0===a?null:a;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,a,s,n]))[0],h[1]);return o(function(){m.hasValue=!0,m.value=v},[v]),u(v),v}},30224,(e,t,a)=>{"use strict";e.i(47167),t.exports=e.r(52822)}]);
@@ -0,0 +1,48 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23320,e=>{"use strict";var t=e.i(43476),a=e.i(71645);e.i(85269);var r=e.i(22831),i=e.i(88608),n=e.i(3666),o=e.i(54983),l=e.i(83402),s=e.i(54735),u=e.i(15126),d=e.i(33227);let c=(e,t)=>e.slice(0,48).map((e,a)=>`${a},${(1-.9*Math.min(1,e/(t||1))).toFixed(3)}`).join(" ");e.s(["default",0,({wind:e=!0,current:m=!1,compact:h=!1})=>{let{t:p}=(0,r.useTranslation)(),f=(0,a.useSyncExternalStore)(i.subscribeForecast,i.getForecastHour,i.getForecastHour),x=(0,a.useSyncExternalStore)(d.subscribeCurrentScale,d.getCurrentScale,d.getCurrentScale),g=(0,a.useSyncExternalStore)(i.subscribeSeries,i.getSeries,i.getSeries),v=e&&g.wind?.values.length>1?g.wind:null,y=m&&g.current?.values.length>1?g.current:null,M=new Date(Date.now()+36e5*f),w=l.default.get("windColorMap")||"windy",b="windy"===w?25:u.WIND_MAP_TOP,S="windy"===w?`linear-gradient(to right, ${n.WINDY_SCALE.filter(([e])=>e<=25).map(([e,[t,a,r]])=>`rgb(${t},${a},${r}) ${e/25*100}%`).join(", ")})`:(0,o.cssGradient)(w);return(0,t.jsxs)("div",{className:`flex flex-col gap-1 px-3 rounded-2xl backdrop-blur select-none w-full ${h?"py-1":"py-2"}`,style:{background:"color-mix(in srgb, var(--background) 88%, transparent)"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted shrink-0",children:p("meteo.forecast")}),(0,t.jsx)("input",{type:"range",min:0,max:47,step:1,value:f,onChange:e=>(0,i.setForecastHour)(Number(e.target.value)),"aria-label":p("meteo.forecast"),className:"flex-1 min-w-0 accent-oBlue"}),(0,t.jsx)("span",{className:"text-label font-semibold tabular-nums text-hud-main shrink-0",children:0===f?p("meteo.now"):`+${f} h \xb7 ${M.toLocaleTimeString([],{weekday:"short",hour:"2-digit",minute:"2-digit"})}`})]}),(v||y)&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("svg",{viewBox:"0 0 47 1",preserveAspectRatio:"none",className:`flex-1 min-w-0 ${h?"h-5":"h-8"}`,"aria-hidden":"true",children:[v&&(0,t.jsx)("polyline",{points:c(v.values,v.top),fill:"none",className:"stroke-oGreen",strokeWidth:"2",vectorEffect:"non-scaling-stroke"}),y&&(0,t.jsx)("polyline",{points:c(y.values,y.top),fill:"none",className:"stroke-oYellow",strokeWidth:"2",vectorEffect:"non-scaling-stroke"}),(0,t.jsx)("line",{x1:f,x2:f,y1:"0",y2:"1",className:"stroke-hud-main",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-end shrink-0 text-caption font-semibold tabular-nums leading-tight",children:[v&&(0,t.jsxs)("span",{className:"text-oGreen",children:[p("toolbar.layerWind")," ",Math.round((v.values[f]??0)*1.943844)," kn"]}),y&&(0,t.jsxs)("span",{className:"text-oYellow",children:[p("toolbar.layerCurrent")," ",((y.values[f]??0)*1.943844).toFixed(1)," kn"]})]})]}),e&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[m&&(0,t.jsx)("span",{className:"text-caption text-hud-muted w-14 shrink-0",children:p("toolbar.layerWind")}),(0,t.jsx)("div",{className:"flex-1 h-2 rounded-full",style:{background:S}}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted tabular-nums shrink-0 w-14 text-right",children:["0 – ",Math.round(1.943844*b)," kn"]})]}),m&&x&&!h&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[e&&(0,t.jsx)("span",{className:"text-caption text-hud-muted w-14 shrink-0",children:p("toolbar.layerCurrent")}),(0,t.jsx)("div",{className:"flex-1 h-2 rounded-full",style:{background:(0,o.cssGradient)(l.default.get("currentColorMap")||s.DEFAULT_CURRENT_MAP)}}),(0,t.jsxs)("span",{className:"text-caption text-hud-muted tabular-nums shrink-0 w-14 text-right",children:["0 – ",Number((1.943844*x).toFixed(2))," kn"]})]})]})}])},79224,function(e){e.n(e.i(23320))},15126,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(95393),i=e.i(90072),n=e.i(92923),o=e.i(30728),l=e.i(27530),s=e.i(83402),u=e.i(85709),d=e.i(78461),c=e.i(3666),m=e.i(54983),h=e.i(69435),p=e.i(88608),f=e.i(78311),x=e.i(18032),g=e.i(83646);let v=["navigation.position","environment.wind.speedTrue","environment.wind.directionTrue"],y=(e,t)=>e&&"windy"!==e?(0,m.colorAt)(e,t/20):(0,c.windColor)(t),M=`
2
+ uniform float uScale;
3
+ varying vec2 vGround;
4
+ varying vec3 vWorld;
5
+ void main() {
6
+ vGround = position.xy / uScale;
7
+ vec4 w = modelMatrix * vec4(position, 1.0);
8
+ vWorld = w.xyz;
9
+ gl_Position = projectionMatrix * viewMatrix * w;
10
+ }
11
+ `,w=`
12
+ uniform float uScale;
13
+ uniform float uTop; // top of the air layer, world y
14
+ uniform float uTime;
15
+ uniform float uMaxSpeed; // top of the colour scale, m/s
16
+ uniform float uOpacity;
17
+ uniform float uLength; // metres of air for ~63 % of the opacity
18
+ uniform float uFlow;
19
+ uniform sampler2D uMap;
20
+ varying vec2 vGround;
21
+ varying vec3 vWorld;
22
+ ${h.NOISE_GLSL}
23
+ ${h.FIELD_GLSL}
24
+ void main() {
25
+ // Air the view ray crosses from the top of the layer down to the water
26
+ vec3 P = vWorld;
27
+ vec3 C = cameraPosition;
28
+ vec3 E = C.y > uTop ? C + (P - C) * ((C.y - uTop) / max(C.y - P.y, 1e-3)) : C;
29
+ float L = length(P - E) / uScale;
30
+ vec2 flow = flowAt(vGround);
31
+ float speed = length(flow);
32
+ float t = clamp(speed / uMaxSpeed, 0.0, 1.0);
33
+ vec3 col = texture2D(uMap, vec2(t, 0.5)).rgb;
34
+ // Gusty wisps carried by the wind, stretched along it
35
+ vec2 dir = speed > 1e-3 ? flow / speed : vec2(0.0, 1.0);
36
+ vec2 drift = vGround - flow * uTime * uFlow;
37
+ vec2 q = vec2(dot(drift, dir) / 1400.0, dot(drift, vec2(-dir.y, dir.x)) / 220.0);
38
+ float n = fbm(vec3(q, uTime * 0.05));
39
+ col *= 0.88 + 0.28 * n;
40
+ // A floor so the air right around the boat shows its colour, more
41
+ // with the depth of air crossed towards the horizon
42
+ float alpha = uOpacity * (0.3 + 0.7 * (1.0 - exp(-L / uLength))) * (0.25 + 1.5 * n * n);
43
+ alpha *= fieldMask(vGround);
44
+ if (alpha < 0.004) discard;
45
+ gl_FragColor = vec4(col, clamp(alpha, 0.0, 1.0));
46
+ #include <colorspace_fragment>
47
+ }
48
+ `,b=(e,t)=>({east:(t.longitude-e.lon)*Math.PI/180*6371e3*Math.cos(e.lat*Math.PI/180),north:(t.latitude-e.lat)*Math.PI/180*6371e3});e.s(["WIND_MAP_TOP",0,20,"default",0,({y:e=.05,sheet:S=!0})=>{let F=s.default.get("windStyle")||"volume",N=S&&"volume"===F,T="volume"===F?150:1100,E=s.default.get("windColorMap")||"windy",j=(0,u.useSignalKPaths)(v),k=j["navigation.position"],{heading:C}=(0,d.default)(),L=(0,a.useSyncExternalStore)(p.subscribeForecast,p.getForecastHour,p.getForecastHour),[A,W]=(0,a.useState)(null),{id:_}=(0,g.default)(),G="day"===_?-.6:.45,P=(0,a.useRef)(),$=s.default.get("aisLengthScalingFactor")||.7,R=k?.latitude,U=k?.longitude,D=Number.isFinite(R)?`${R.toFixed(1)},${U.toFixed(1)}`:null,H=j["environment.wind.speedTrue"],O=j["environment.wind.directionTrue"];(0,a.useEffect)(()=>{if(!D)return;let e=!1,[t,a]=D.split(",").map(Number);return(0,c.fetchWindField)(t,a).then(t=>{e||W(t)}).catch(()=>{!e&&Number.isFinite(H)&&Number.isFinite(O)&&W((0,c.uniformField)(t,a,H,O))}),()=>{e=!0}},[D]);let B=(0,a.useMemo)(()=>{let e=new Uint8Array(65536),t=new i.DataTexture(e,128,128,i.RGBAFormat);return t.magFilter=i.LinearFilter,t.minFilter=i.LinearFilter,t.colorSpace=i.SRGBColorSpace,t},[]);(0,a.useEffect)(()=>{if(!A||!S||N)return;let e=B.image.data;for(let t=0;t<128;t++)for(let a=0;a<128;a++){let r=(a/127*2-1)*c.HALF_EXTENT_M,i=(t/127*2-1)*c.HALF_EXTENT_M,n=(0,c.sampleWind)(A,r,i,L),[o,l,s]=y(E,Math.hypot(n.u,n.v)),u=(128*t+a)*4,d=Math.max(Math.abs(a/127*2-1),Math.abs(t/127*2-1));e[u]=o,e[u+1]=l,e[u+2]=s,e[u+3]=Math.round(255*Math.min(1,(1-d)*8))}B.needsUpdate=!0},[B,A,L,S,N,E]),(0,a.useEffect)(()=>()=>B.dispose(),[B]);let I=(0,a.useMemo)(()=>{let e=new o.LineSegmentsGeometry;e.setPositions(new Float32Array(46200)),e.setColors(new Float32Array(46200));let t=new l.LineMaterial({linewidth:3,vertexColors:!0,transparent:!0,opacity:.9,depthWrite:!1}),a=new n.LineSegments2(e,t);return a.frustumCulled=!1,a.renderOrder=2,{geo:e,material:t,object:a,state:Array.from({length:1100},()=>({x:0,y:0,age:4*Math.random(),life:2+3*Math.random()}))}},[]);(0,a.useEffect)(()=>()=>{I.geo.dispose(),I.material.dispose()},[I]);let X=(0,h.useFieldTexture)(N?A:null,L),z=(0,a.useMemo)(()=>new i.ShaderMaterial({uniforms:{uScale:{value:$},uTop:{value:0},uTime:{value:0},uMaxSpeed:{value:20},uOpacity:{value:Number(s.default.get("windOpacity"))||.7},uLength:{value:600},uFlow:{value:25},uMap:{value:null},uField:{value:null},uFieldHalf:{value:c.HALF_EXTENT_M},uFieldRange:{value:40}},vertexShader:M,fragmentShader:w,transparent:!0,depthWrite:!1}),[$]),K=(0,a.useMemo)(()=>"windy"===E?(()=>{let e=new Uint8Array(1024);for(let t=0;t<256;t++){let[a,r,i]=(0,c.windColor)(t/255*20);e.set([Math.round(a),Math.round(r),Math.round(i),255],4*t)}let t=new i.DataTexture(e,256,1,i.RGBAFormat);return t.magFilter=i.LinearFilter,t.colorSpace=i.SRGBColorSpace,t.needsUpdate=!0,t})():(0,m.colorMapTexture)(E),[E]);(0,a.useEffect)(()=>{z.uniforms.uMap.value=K,z.uniforms.uField.value=X},[z,K,X]),(0,a.useEffect)(()=>()=>{z.dispose(),K.dispose()},[z,K]),(0,a.useEffect)(()=>{I.geo.instanceCount=7*T},[I,T]);let[Y,q]=(0,a.useState)([]),V=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(!A||!Number.isFinite(R))return;let e=b(A.origin,{latitude:R,longitude:U}),t=Array.from({length:A.hours},(t,a)=>{let r=(0,c.sampleWind)(A,e.east,e.north,a);return Math.hypot(r.u,r.v)});return(0,p.setSeries)("wind",{start:A.start,values:t,top:Math.max(...t)}),()=>(0,p.setSeries)("wind",null)},[A,Math.round(100*R),Math.round(100*U)]);let J=(0,a.useRef)({east:0,north:0});(0,a.useEffect)(()=>{A&&Number.isFinite(R)&&(J.current=b(A.origin,{latitude:R,longitude:U}))},[A,R,U]);let Q=(0,a.useRef)();if((0,r.useFrame)(({camera:t,size:a,clock:r,gl:n},o)=>{if(!A)return;if(N&&(z.uniforms.uTime.value=r.elapsedTime,z.uniforms.uTop.value=e+150*$),Q.current){let e=t.position.length()/$;Q.current&&(Q.current.opacity=i.MathUtils.clamp(.3+(e-300)/3e3*.3,.3,.6))}let l=Math.min(o,.1),s=Math.min(c.HALF_EXTENT_M,Math.max(800,t.position.length()/$*2.5)),u=s/120,d=s/140,{east:m,north:h}=J.current;I.material.resolution.set(a.width,a.height);let p=I.geo.attributes.instanceStart.data.array,f=I.geo.attributes.instanceColorStart.data.array;if(I.state.forEach((e,t)=>{if(t>=T)return;e.age+=l,(e.age>e.life||Math.abs(e.x)>s||Math.abs(e.y)>s)&&(e.x=(2*Math.random()-1)*s,e.y=(2*Math.random()-1)*s,e.age=0,e.life=2+3*Math.random());let a=(0,c.sampleWind)(A,m+e.x,h+e.y,L),r=Math.hypot(a.u,a.v);e.x+=a.u*u*l/10,e.y+=a.v*u*l/10;let i=Math.min(1,e.age/.5,(e.life-e.age)/.7),[n,o,x]=y(E,r),g=e=>G>=0?e/255*(1-G)+G:e/255*(1+G),v=g(n),M=g(o),w=g(x),b=n/255,S=o/255,F=x/255,N=d*Math.min(1.6,.5+r/10),j=e.x,k=e.y;for(let e=0;e<7;e++){let r=0===e?a:(0,c.sampleWind)(A,m+j,h+k,L),n=Math.hypot(r.u,r.v)||1,o=j-r.u/n*N,l=k-r.v/n*N,s=(7*t+e)*6;p[s]=j*$,p[s+1]=k*$,p[s+2]=.2,p[s+3]=o*$,p[s+4]=l*$,p[s+5]=.2;let u=i*(1-e/7)**1.6,d=i*(1-(e+1)/7)**1.6,x=(7*t+e)*6;f[x]=b+(v-b)*u,f[x+1]=S+(M-S)*u,f[x+2]=F+(w-F)*u,f[x+3]=b+(v-b)*d,f[x+4]=S+(M-S)*d,f[x+5]=F+(w-F)*d,j=o,k=l}}),I.geo.attributes.instanceStart.data.needsUpdate=!0,I.geo.attributes.instanceColorStart.data.needsUpdate=!0,V.current+=o,V.current<1)return;V.current=0;let g=P.current;if(!g)return;let v=g.worldToLocal(new i.Vector3().copy(t.position)),M=m+v.x/$,w=h+v.y/$,b=Math.max(5,v.z/$),S=i.MathUtils.clamp(10*Math.round(3*b/10),60,4e3),F=Math.min(.9*s,Math.max(800,60*b)),j=(0,x.markerLattice)({cx:M,cy:w,radius:F,step:S,near:3*S,originE:M,originN:w,max:400}),k=[],C=(0,x.onScreenTest)(g,t,n.domElement);j.forEach(({e,n:t,d:a})=>{if(k.length>=10||20>Math.hypot(e-m,t-h)||!C((e-m)*$,(t-h)*$,4*$))return;let r=(0,c.sampleWind)(A,e,t,L),i=(0,c.sampleWind)(A,e,t,L+1),n=Math.hypot(r.u,r.v),[o,l,s]=y(E,n),u=e=>G>=0?e/255*(1-G)+G:e/255*(1+G);k.push({key:`${e},${t}`,x:(e-m)*$,y:(t-h)*$,z:4*$,u:r.u,v:r.v,speed:n,trend:Math.hypot(i.u,i.v)-n,color:[u(o),u(l),u(s)],len:.14*(.4+.6*Math.min(1,n/15)),d:a})}),k.sort((e,t)=>e.d-t.d).splice(10),q(e=>(0,x.sameMarkers)(e,k)?e:k)}),!A)return null;let{east:Z,north:ee}=J.current,et=2*c.HALF_EXTENT_M*$;return(0,t.jsx)("group",{rotation:[0,C,0],position:[0,e,0],children:(0,t.jsxs)("group",{ref:P,rotation:[-Math.PI/2,0,0],children:[S&&(0,t.jsxs)("mesh",{position:[-Z*$,-ee*$,0],renderOrder:1,children:[(0,t.jsx)("planeGeometry",{args:[et,et]}),N?(0,t.jsx)("primitive",{object:z,attach:"material"}):(0,t.jsx)("meshBasicMaterial",{ref:Q,map:B,transparent:!0,opacity:.6,depthWrite:!1,toneMapped:!1})]}),(0,t.jsx)("primitive",{object:I.object}),(0,t.jsx)(f.default,{items:Y,width:.025,screen:1,format:e=>String(Math.round(e)),slackLabel:"calm",maxLabels:6})]})})}])}]);