ocearo-ui 0.1.13 → 0.1.15
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.
- package/404.html +1 -1
- package/README.md +4 -0
- package/_next/static/chunks/0f8af13e.a3c5ee19dacc5d8a.js +158 -0
- package/_next/static/chunks/1268.5bf414e7f9ec61db.js +1 -0
- package/_next/static/chunks/1909.df96cdfa30c5e1a8.js +1 -0
- package/_next/static/chunks/2012.3c05163686cc3992.js +1 -0
- package/_next/static/chunks/2117-56c2fb7501b81a48.js +2 -0
- package/_next/static/chunks/2197.03c63df4706ac55a.js +1 -0
- package/_next/static/chunks/2274.20f7a66d87bbe5ba.js +1 -0
- package/_next/static/chunks/2353.0703bc2167f53e87.js +1 -0
- package/_next/static/chunks/2591.86dc5c0cabce74d9.js +1 -0
- package/_next/static/chunks/2687.03575a688467298f.js +26 -0
- package/_next/static/chunks/2936.32b491d885b0a1fa.js +1 -0
- package/_next/static/chunks/2967.b78077975c0ab30f.js +1 -0
- package/_next/static/chunks/2975.38e51d12034b0e56.js +1 -0
- package/_next/static/chunks/3059.7f8277e00847ad2a.js +1 -0
- package/_next/static/chunks/3145.636d8a0b59460f06.js +1 -0
- package/_next/static/chunks/3746-5b56cb222d7759f3.js +1 -0
- package/_next/static/chunks/4203.53016264f2cd3444.js +114 -0
- package/_next/static/chunks/5221.21b657b6a08aa489.js +1 -0
- package/_next/static/chunks/5322.ea4bebffcd8aa1cc.js +1 -0
- package/_next/static/chunks/5487.0ca3e1f29bec024a.js +1 -0
- package/_next/static/chunks/5751.f0376bcce7ec1e3d.js +1 -0
- package/_next/static/chunks/6108.ed2af8245ea73350.js +1 -0
- package/_next/static/chunks/6154.08319169fda8a96c.js +1 -0
- package/_next/static/chunks/6412.751c9a217112d729.js +1 -0
- package/_next/static/chunks/6496.d879aa3456fbe689.js +1 -0
- package/_next/static/chunks/6728.df40db4a2492c80a.js +1 -0
- package/_next/static/chunks/6949.54ab1a3c1db751ad.js +1 -0
- package/_next/static/chunks/7188.dd19efec20eb1ffd.js +1 -0
- package/_next/static/chunks/7252.9960bb9dcab56410.js +1 -0
- package/_next/static/chunks/767.c121402a31d61693.js +38 -0
- package/_next/static/chunks/{79.c90ea1de476d64c2.js → 8079.cd1d32892d355219.js} +1 -1
- package/_next/static/chunks/8341.a4bbd4563a858c62.js +1 -0
- package/_next/static/chunks/8610.a69a39b4e8210145.js +1 -0
- package/_next/static/chunks/870fdd6f.9cc7f4d7d53d0ee1.js +1 -0
- package/_next/static/chunks/9073.8e46e378467c398c.js +1 -0
- package/_next/static/chunks/9138.615379e543873c20.js +1 -0
- package/_next/static/chunks/{250.b26c37701919cf5c.js → 9250.e4a1a448563bce56.js} +3 -3
- package/_next/static/chunks/9483.c52ef3c126f89d4a.js +1 -0
- package/_next/static/chunks/9677.e29a54e257683481.js +1 -0
- package/_next/static/chunks/app/_not-found/page-02dd9834e02ff180.js +1 -0
- package/_next/static/chunks/app/layout-df29b07cc8d7ff8a.js +1 -0
- package/_next/static/chunks/app/page-8193fd4d93865082.js +1 -0
- package/_next/static/chunks/{b536a0f1.0563944ec53282b3.js → b536a0f1.7481d3b6ed8a124b.js} +1 -1
- package/_next/static/chunks/{bd904a5c-fce155daf9e9ba55.js → bd904a5c-ee5c73978aa69cb5.js} +1 -1
- package/_next/static/chunks/fd9d1056-c7da0d4e0db639a1.js +1 -0
- package/_next/static/chunks/framework-dbde1fe7fb0f4567.js +1 -0
- package/_next/static/chunks/main-app-01921a295932d28c.js +1 -0
- package/_next/static/chunks/main-de6ed997e06652b4.js +1 -0
- package/_next/static/chunks/pages/_app-78ddf957b9a9b996.js +1 -0
- package/_next/static/chunks/pages/_error-af28e299b63bd305.js +1 -0
- package/_next/static/chunks/webpack-fe2d60e504e1ce3b.js +1 -0
- package/_next/static/css/9c269b560e97b443.css +3 -0
- package/_next/static/jLQbcwqenN1fr_0feCPZa/_buildManifest.js +1 -0
- package/boats/boats.json +5 -0
- package/index.html +1 -1
- package/index.txt +4 -4
- package/{ocearo-ui-0.1.13.tgz → ocearo-ui-0.1.15.tgz} +0 -0
- package/package.json +2 -2
- package/_next/static/chunks/0f8af13e.6652bd734d04208b.js +0 -158
- package/_next/static/chunks/117-35a8eb6f9457406b.js +0 -2
- package/_next/static/chunks/12.a4273af9b82657f2.js +0 -1
- package/_next/static/chunks/138.b9389f70773e44e6.js +0 -1
- package/_next/static/chunks/145.9caac3d586b84999.js +0 -1
- package/_next/static/chunks/154.4e0902ce8b0f7ad1.js +0 -1
- package/_next/static/chunks/188.1839b14fedef7718.js +0 -1
- package/_next/static/chunks/197.bcdd8d0debcb7089.js +0 -1
- package/_next/static/chunks/221.a545399d0aaf207f.js +0 -1
- package/_next/static/chunks/226.8e9a3229837caa21.js +0 -151
- package/_next/static/chunks/252.d7cc856ebccc7381.js +0 -1
- package/_next/static/chunks/268.8ed821c518bf7977.js +0 -1
- package/_next/static/chunks/274.f21dd1bea1190823.js +0 -1
- package/_next/static/chunks/353.c2bc481b7d81054f.js +0 -1
- package/_next/static/chunks/412.47bfcc49cfe552a4.js +0 -1
- package/_next/static/chunks/413.69878f8910eb07d8.js +0 -1
- package/_next/static/chunks/487.c2062e37ef29da57.js +0 -1
- package/_next/static/chunks/496.c440e137e5877fb7.js +0 -1
- package/_next/static/chunks/59.c2dfec0c5e965cb5.js +0 -1
- package/_next/static/chunks/610.44fac6b8e6928564.js +0 -1
- package/_next/static/chunks/677.b3c43a3f32b247f4.js +0 -1
- package/_next/static/chunks/687.798c6b33d9165736.js +0 -26
- package/_next/static/chunks/728.3987afab39b00f4e.js +0 -1
- package/_next/static/chunks/73.a6b96572b40c5751.js +0 -1
- package/_next/static/chunks/746-f1a5b23db9004a46.js +0 -1
- package/_next/static/chunks/751.a180d553d77914d3.js +0 -1
- package/_next/static/chunks/870fdd6f.5b9af4fe6d08a9fb.js +0 -1
- package/_next/static/chunks/909.1e4c462123ae73e4.js +0 -1
- package/_next/static/chunks/936.e779b5632883831e.js +0 -1
- package/_next/static/chunks/949.e273523eaad35cc5.js +0 -1
- package/_next/static/chunks/967.83ea5cd9e6c9bb4c.js +0 -1
- package/_next/static/chunks/975.8821fdf115b619c5.js +0 -1
- package/_next/static/chunks/app/_not-found/page-1beaea75cf9b93d1.js +0 -1
- package/_next/static/chunks/app/layout-5065440b6db19cf5.js +0 -1
- package/_next/static/chunks/app/page-32b46c3e73a86694.js +0 -1
- package/_next/static/chunks/fd9d1056-50d0a3499460e502.js +0 -1
- package/_next/static/chunks/framework-cf2d8f6f8d843863.js +0 -1
- package/_next/static/chunks/main-8dbe8bddfa3a978c.js +0 -1
- package/_next/static/chunks/main-app-ed02033afba81a43.js +0 -1
- package/_next/static/chunks/pages/_app-15e2daefa259f0b5.js +0 -1
- package/_next/static/chunks/pages/_error-28b803cb2479b966.js +0 -1
- package/_next/static/chunks/webpack-9a92f476391a516d.js +0 -1
- package/_next/static/css/ac42e9cb9892c616.css +0 -3
- package/_next/static/d0q-Qivu1-sUFcVbdHKxk/_buildManifest.js +0 -1
- /package/_next/static/{d0q-Qivu1-sUFcVbdHKxk → jLQbcwqenN1fr_0feCPZa}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9677],{9677:function(e,t,a){a.r(t),a.d(t,{default:function(){return x}});var s=a(7437),l=a(2265),i=a(3082),r=a(5008),c=a(1268),n=a(5217),d=e=>{let{data:t,dataKey:a,color:l,scale:r,label:c,unit:n,showPoints:d=!1,lineWidth:o=1,fillGradient:x=!1}=e,{nightMode:m}=(0,i.yC)(),h=t.filter(e=>null!==e[a]&&void 0!==e[a]);if(0===h.length)return(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:"No data available"});let g=Math.min(...h.map(e=>e[a])),u=Math.max(...h.map(e=>e[a])),v=Math.max(r.min,g-(u-g)*.1),f=Math.min(r.max,u+(u-g)*.1),j=u-g>(r.max-r.min)*.05,N=j?v:r.min,p=j?f:r.max,b=t.map((e,s)=>{let l=s/(t.length-1)*100;return null===e[a]||void 0===e[a]?{x:l,y:null,value:null,time:e.time}:{x:l,y:100-Math.min(100,Math.max(0,(e[a]-N)/(p-N)*100)),value:e[a],time:e.time}}).filter(e=>null!==e.y),y=b.reduce((e,t,a)=>e+(0===a?"M ".concat(t.x,",").concat(t.y):" L ".concat(t.x,",").concat(t.y)),""),w=Array.from({length:5}).map((e,t)=>({position:t/4*100,value:p-(p-N)/4*t}));return(0,s.jsxs)("div",{className:"h-full w-full relative",children:[(0,s.jsx)("div",{className:"absolute inset-0",children:w.map((e,t)=>(0,s.jsx)("div",{className:"absolute w-full border-t border-gray-300 opacity-40",style:{top:"".concat(e.position,"%")},children:(0,s.jsxs)("span",{className:"absolute text-xs ".concat(m?"text-oNight":"text-white"),children:[e.value.toFixed(e.value<10?1:0),n]})},t))}),(0,s.jsx)("div",{className:"absolute bottom-0 w-full",children:t.filter((e,t)=>t%10==0).map((e,a,l)=>(0,s.jsx)("span",{className:"absolute text-xs ".concat(m?"text-oNight":"text-white"," transform -translate-x-1/2"),style:{left:"".concat(10*a/(t.length-1)*100+10,"%"),bottom:"-20px"},children:e.time.split(":").slice(1).join(":")},a))}),(0,s.jsx)("div",{className:"absolute inset-0 ".concat(x?"rightPaneBg bg-opacity-30":"bg-oGray2 bg-opacity-10"," rounded-lg")}),j&&(0,s.jsxs)("div",{className:"absolute top-0 right-0 bg-oGray2 bg-opacity-70 px-2 py-1 rounded-md text-xs text-white",children:[N.toFixed(1)," - ",p.toFixed(1),n]}),(0,s.jsxs)("svg",{className:"w-full h-full",preserveAspectRatio:"none",viewBox:"0 0 100 100",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"gradient-".concat(a),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:l,stopOpacity:x?"0.5":"0.3"}),(0,s.jsx)("stop",{offset:"100%",stopColor:l,stopOpacity:x?"0.1":"0.05"})]}),x&&(0,s.jsxs)("linearGradient",{id:"line-gradient-".concat(a),x1:"0",y1:"0",x2:"1",y2:"0",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:l,stopOpacity:"0.8"}),(0,s.jsx)("stop",{offset:"100%",stopColor:l,stopOpacity:"1"})]})]}),(0,s.jsx)("path",{d:"".concat(y," L ").concat(b[b.length-1].x,",100 L ").concat(b[0].x,",100 Z"),fill:"url(#gradient-".concat(a,")"),className:x?"filter drop-shadow-md":""}),(0,s.jsx)("path",{d:y,fill:"none",stroke:x?"url(#line-gradient-".concat(a,")"):l,strokeWidth:x?1.5*o:o,strokeLinecap:"round",strokeLinejoin:"round",className:x?"filter drop-shadow-sm":""}),d&&b.map((e,t)=>(0,s.jsx)("circle",{cx:e.x,cy:e.y,r:x?.8:.5,fill:l,className:"hover:r-4 transition-all duration-150 ".concat(x?"filter drop-shadow-md":""),children:(0,s.jsx)("title",{children:"".concat(c,": ").concat(e.value.toFixed(2)).concat(n)})},t))]})]})},o=a(2079),x=()=>{let{nightMode:e,getSignalKValue:t}=(0,i.yC)(),a=(0,l.useRef)(performance.now()),x=(0,l.useRef)(performance.now()),m=(0,l.useRef)(0),[h,g]=(0,l.useState)("battery"),[u,v]=(0,l.useState)("voltage"),[f,j]=(0,l.useState)("fps"),[N,p]=(0,l.useState)("1"),[b,y]=(0,l.useState)(!1),w=(0,l.useCallback)(()=>{let e=[];for(let a=0;a<=2;a++){let s=t("electrical.batteries.".concat(a,".name")),l=t("electrical.batteries.".concat(a,".voltage"));(s||l)&&e.push({id:a.toString(),name:s||"Battery ".concat(a),hasData:!0})}return 0===e.length&&e.push({id:"1",name:"Main Battery",hasData:!0}),e},[t]),[C,G]=(0,l.useState)(()=>w()),R=(0,l.useCallback)(()=>{let e=new Date().toLocaleTimeString(),a=t("electrical.batteries.".concat(N,".voltage"))||12,s=t("electrical.batteries.".concat(N,".capacity.stateOfCharge")),l=t("electrical.batteries.".concat(N,".current"))||5,c=t("electrical.batteries.".concat(N,".temperature")),n=null!==c?(0,i.G5)(c):null,d=t("electrical.batteries.".concat(N,".chemistry")),o=t("electrical.batteries.".concat(N,".name")),x=t("electrical.batteries.".concat(N,".location")),m=t("electrical.batteries.".concat(N,".dateInstalled")),h=t("electrical.batteries.".concat(N,".manufacturer.name")),g=t("electrical.batteries.".concat(N,".manufacturer.model")),u=t("electrical.batteries.".concat(N,".manufacturer.URL")),v=t("electrical.batteries.".concat(N,".associatedBus")),f=t("electrical.batteries.".concat(N,".voltage.ripple")),j=t("electrical.batteries.".concat(N,".capacity.nominal")),p=t("electrical.batteries.".concat(N,".capacity.actual")),b=t("electrical.batteries.".concat(N,".capacity.remaining")),y=t("electrical.batteries.".concat(N,".capacity.dischargeLimit")),w=t("electrical.batteries.".concat(N,".capacity.stateOfHealth")),C=t("electrical.batteries.".concat(N,".capacity.dischargeSinceFull")),G=t("electrical.batteries.".concat(N,".capacity.timeRemaining")),R=t("electrical.batteries.".concat(N,".lifetimeDischarge")),E=t("electrical.batteries.".concat(N,".lifetimeRecharge")),A="auto"===t("steering.autopilot.state"),O=t("navigation.lights")||!1;return{time:e,voltage:a,current:l,stateOfCharge:null!==s?s:(0,r.Si)(a),power:a*l,temperature:n,autopilotState:A,instrumentsOn:l>.5,navigationLightsOn:O,chemistry:d,name:o,location:x,dateInstalled:m,manufacturer:h,model:g,manufacturerURL:u,associatedBus:v,voltageRipple:f,nominalCapacity:j,actualCapacity:p,remainingCapacity:b,dischargeLimit:y,stateOfHealth:w,dischargeSinceFull:C,timeRemaining:G,lifetimeDischarge:R,lifetimeRecharge:E}},[t,N]),[E,A]=(0,l.useState)(()=>Array(60).fill(null).map(R)),[O,S]=(0,l.useState)(()=>{let e=new Date().toLocaleTimeString();return Array(60).fill({time:e,fps:60,ms:16.67,drawCalls:0,triangles:0,geometries:0,textures:0,memory:0})}),T=(0,l.useCallback)(e=>{let a=E[E.length-1],s=t("electrical.batteries.".concat(N,".voltage"))||a.voltage,l=t("electrical.batteries.".concat(N,".current"))||a.current,c=t("electrical.batteries.".concat(N,".capacity.stateOfCharge")),n=null!==c?c:(0,r.Si)(s),d=t("electrical.batteries.".concat(N,".temperature")),o=null!==d?(0,i.G5)(d):null,x=t("electrical.batteries.".concat(N,".chemistry"))||a.chemistry,m=t("electrical.batteries.".concat(N,".name"))||a.name,h=t("electrical.batteries.".concat(N,".location"))||a.location,g=t("electrical.batteries.".concat(N,".dateInstalled"))||a.dateInstalled,u=t("electrical.batteries.".concat(N,".manufacturer.name"))||a.manufacturer,v=t("electrical.batteries.".concat(N,".manufacturer.model"))||a.model,f=t("electrical.batteries.".concat(N,".manufacturer.URL"))||a.manufacturerURL,j=t("electrical.batteries.".concat(N,".associatedBus"))||a.associatedBus,p=t("electrical.batteries.".concat(N,".voltage.ripple"))||a.voltageRipple,b=t("electrical.batteries.".concat(N,".capacity.nominal"))||a.nominalCapacity,y=t("electrical.batteries.".concat(N,".capacity.actual"))||a.actualCapacity,w=t("electrical.batteries.".concat(N,".capacity.remaining"))||a.remainingCapacity,C=t("electrical.batteries.".concat(N,".capacity.dischargeLimit"))||a.dischargeLimit,G=t("electrical.batteries.".concat(N,".capacity.stateOfHealth"))||a.stateOfHealth,R=t("electrical.batteries.".concat(N,".capacity.dischargeSinceFull"))||a.dischargeSinceFull,A=t("electrical.batteries.".concat(N,".capacity.timeRemaining"))||a.timeRemaining,O=t("electrical.batteries.".concat(N,".lifetimeDischarge"))||a.lifetimeDischarge,S=t("electrical.batteries.".concat(N,".lifetimeRecharge"))||a.lifetimeRecharge;return{time:e,voltage:s,current:l,stateOfCharge:n,power:s*l,temperature:o,autopilotState:"auto"===t("steering.autopilot.state"),instrumentsOn:l>.5,navigationLightsOn:t("navigation.lights")||!1,chemistry:x,name:m,location:h,dateInstalled:g,manufacturer:u,model:v,manufacturerURL:f,associatedBus:j,voltageRipple:p,nominalCapacity:b,actualCapacity:y,remainingCapacity:w,dischargeLimit:C,stateOfHealth:G,dischargeSinceFull:R,timeRemaining:A,lifetimeDischarge:O,lifetimeRecharge:S}},[t,E,N]),L=(0,l.useRef)(null);(0,l.useEffect)(()=>{window.__OCEARO_RENDERER&&(L.current=window.__OCEARO_RENDERER)},[]),(0,l.useEffect)(()=>{let e=setInterval(()=>{G(w())},3e4);return()=>clearInterval(e)},[w]),(0,l.useEffect)(()=>{A(Array(60).fill(null).map(R))},[N,R]),(0,l.useEffect)(()=>{let e;let t=()=>{let s=new Date().toLocaleTimeString();m.current++;let l=performance.now();if(a.current,l>=x.current+1e3){var i,r,c,n,d,o,h,g;let e=1e3*m.current/(l-x.current),t=e>0?1e3/e:0,a=0,u=0,v=0,f=0,j=0;if(window.performance&&window.performance.memory&&(j=Math.round(window.performance.memory.usedJSHeapSize/1048576)),L.current){let e=L.current.info;a=(null===(i=e.render)||void 0===i?void 0:i.calls)||0,u=(null===(r=e.render)||void 0===r?void 0:r.triangles)||0,v=(null===(c=e.memory)||void 0===c?void 0:c.geometries)||0,f=(null===(n=e.memory)||void 0===n?void 0:n.textures)||0}else if(window.__OCEARO_RENDER_INFO){let e=window.__OCEARO_RENDER_INFO;a=(null===(d=e.render)||void 0===d?void 0:d.calls)||0,u=(null===(o=e.render)||void 0===o?void 0:o.triangles)||0,v=(null===(h=e.memory)||void 0===h?void 0:h.geometries)||0,f=(null===(g=e.memory)||void 0===g?void 0:g.textures)||0}S(l=>[...l.slice(1),{time:s,fps:e,ms:t,drawCalls:a,triangles:u,geometries:v,textures:f,memory:j}]),A(e=>[...e.slice(1),T(s)]),x.current=l,m.current=0}a.current=l,e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[T]);let F={voltage:{min:10.5,max:15,step:1},current:{min:-5,max:50,step:5},soc:{min:0,max:100,step:25},temperature:{min:10,max:60,step:10}},M={fps:{min:0,max:60,step:15},drawCalls:{min:0,max:500,step:100},triangles:{min:0,max:5e5,step:1e5},memory:{min:0,max:500,step:100}},I=E[E.length-1],D=(0,r.d3)(I.voltage),P=null!==I.temperature;return(0,s.jsxs)("div",{className:"flex flex-col h-full rightPaneBg overflow-auto",children:[(0,s.jsxs)("div",{className:"flex border-b border-gray-800",children:[(0,s.jsxs)("button",{onClick:()=>g("battery"),className:"flex-1 py-3 px-4 text-sm font-medium flex items-center justify-center transition-all ".concat("battery"===h?"text-green-500 border-b-2 border-green-500":"text-gray-400 hover:text-gray-300"),children:[(0,s.jsx)(c.G,{icon:n.XEC,className:"mr-2"}),"Energy"]}),(0,s.jsxs)("button",{onClick:()=>g("graph"),className:"flex-1 py-3 px-4 text-sm font-medium flex items-center justify-center transition-all ".concat("graph"===h?"text-green-500 border-b-2 border-green-500":"text-gray-400 hover:text-gray-300"),children:[(0,s.jsx)(c.G,{icon:n.Stf,className:"mr-2"}),"Consumption"]}),(0,s.jsxs)("button",{onClick:()=>g("performance"),className:"flex-1 py-3 px-4 text-sm font-medium flex items-center justify-center transition-all ".concat("performance"===h?"text-green-500 border-b-2 border-green-500":"text-gray-400 hover:text-gray-300"),children:[(0,s.jsx)(c.G,{icon:n.ESn,className:"mr-2"}),"Performance"]})]}),(0,s.jsxs)("div",{className:"h-full",children:["battery"===h&&(0,s.jsxs)("div",{className:"p-4 flex flex-col flex-1 min-h-0 rightPaneBg",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsxs)("h2",{className:"text-xl font-bold text-white flex items-center",children:["Battery information ",I.stateOfCharge.toFixed(0),"%",(0,s.jsx)("button",{className:"ml-2 bg-oGray2 rounded-full w-6 h-6 flex items-center justify-center text-gray-400 hover:bg-oGray focus:outline-none focus:ring-1 focus:ring-green-500",onClick:()=>y(!b),"aria-label":"Battery details",children:(0,s.jsx)(c.G,{icon:n.Fuz,className:"text-xs"})})]}),(0,s.jsx)("div",{className:"flex items-center space-x-2",children:(0,s.jsx)("select",{className:"bg-oGray2 px-2 py-1 rounded text-white text-sm border border-gray-700 focus:outline-none focus:ring-1 focus:ring-green-500",value:N,onChange:e=>p(e.target.value),children:C.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))})})]}),b&&(0,s.jsxs)("div",{className:"bg-oGray2 p-4 rounded-lg mb-6 relative",children:[(0,s.jsx)("button",{className:"absolute top-2 right-2 text-gray-400 hover:text-white",onClick:()=>y(!1),"aria-label":"Close details",children:"\xd7"}),(0,s.jsx)("div",{className:"text-gray-400 text-sm font-medium mb-4",children:"BATTERY DETAILS"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[I.name&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"NAME"}),(0,s.jsx)("div",{className:"text-sm text-white",children:I.name})]}),I.location&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"LOCATION"}),(0,s.jsx)("div",{className:"text-sm text-white",children:I.location})]}),I.manufacturer&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"MAKER"}),(0,s.jsx)("div",{className:"text-sm text-white",children:I.manufacturer})]}),I.model&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"MODEL"}),(0,s.jsx)("div",{className:"text-sm text-white",children:I.model})]}),I.chemistry&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"CHEMISTRY"}),(0,s.jsx)("div",{className:"text-sm text-white",children:I.chemistry})]}),I.dateInstalled&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"INSTALLED"}),(0,s.jsx)("div",{className:"text-sm text-white",children:new Date(I.dateInstalled).toLocaleDateString()})]}),I.associatedBus&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"BUS"}),(0,s.jsx)("div",{className:"text-sm text-white",children:I.associatedBus})]}),I.stateOfHealth&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"HEALTH"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(100*I.stateOfHealth).toFixed(0),"%"]})]}),null!==I.timeRemaining&&void 0!==I.timeRemaining&&(0,s.jsxs)("div",{className:"flex items-start",children:[(0,s.jsx)("div",{className:"w-20 text-xs text-gray-400",children:"REMAINING"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(I.timeRemaining/3600).toFixed(1)," hrs"]})]})]}),(I.nominalCapacity||I.actualCapacity||I.remainingCapacity)&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("div",{className:"text-gray-400 text-xs mb-2",children:"CAPACITY"}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[I.nominalCapacity&&(0,s.jsxs)("div",{className:"bg-oGray p-2 rounded-lg text-center",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"NOMINAL"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(I.nominalCapacity/3600).toFixed(1)," Wh"]})]}),I.actualCapacity&&(0,s.jsxs)("div",{className:"bg-oGray p-2 rounded-lg text-center",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"ACTUAL"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(I.actualCapacity/3600).toFixed(1)," Wh"]})]}),I.remainingCapacity&&(0,s.jsxs)("div",{className:"bg-oGray p-2 rounded-lg text-center",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"REMAINING"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(I.remainingCapacity/3600).toFixed(1)," Wh"]})]})]})]}),(I.lifetimeDischarge||I.lifetimeRecharge)&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("div",{className:"text-gray-400 text-xs mb-2",children:"LIFETIME STATISTICS"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[I.lifetimeDischarge&&(0,s.jsxs)("div",{className:"bg-oGray p-2 rounded-lg",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"DISCHARGE"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(I.lifetimeDischarge/3600).toFixed(0)," Ah"]})]}),I.lifetimeRecharge&&(0,s.jsxs)("div",{className:"bg-oGray p-2 rounded-lg",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"RECHARGE"}),(0,s.jsxs)("div",{className:"text-sm text-white",children:[(I.lifetimeRecharge/3600).toFixed(0)," Ah"]})]})]})]})]}),(0,s.jsxs)("div",{className:"flex-1 flex flex-col justify-between",children:[(0,s.jsxs)("div",{className:"relative bg-oGray2 rounded-lg p-4 mb-6",children:[(0,s.jsxs)("div",{className:"mb-2 flex justify-between items-center",children:[(0,s.jsx)("div",{children:(0,s.jsx)("span",{className:"text-gray-400 text-sm",children:"BATTERY PERCENTAGE"})}),(0,s.jsxs)("div",{className:"px-3 py-1 rounded-lg text-sm ".concat(D?"bg-green-900 text-green-400":"bg-red-900 text-red-400"),children:[(0,s.jsx)(c.G,{icon:D?n.Tr1:n.RoX,className:"mr-2"}),D?"Charging":"Discharging"]})]}),(0,s.jsxs)("div",{className:"h-24 relative mt-4 flex flex-col justify-between",children:[(0,s.jsxs)("div",{className:"flex justify-between text-xs text-gray-400 mb-1",children:[(0,s.jsx)("span",{children:"State of Charge"}),I.dischargeLimit&&(0,s.jsxs)("span",{children:["Discharge Limit: ",(100*I.dischargeLimit).toFixed(0),"%"]})]}),(0,s.jsxs)("div",{className:"h-10 bg-oGray relative rounded-lg overflow-hidden",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 opacity-20"}),I.dischargeLimit&&(0,s.jsx)("div",{className:"absolute h-full border-r-2 border-yellow-500 border-dashed",style:{left:"".concat(100*I.dischargeLimit,"%")},children:(0,s.jsx)("div",{className:"absolute -right-1 top-0 w-2 h-2 bg-yellow-500 rounded-full"})}),(0,s.jsx)("div",{className:"h-full ".concat(D?"bg-gradient-to-r from-green-600 to-green-400":"bg-gradient-to-r from-orange-500 via-yellow-400 to-green-500"),style:{width:"".concat(I.stateOfCharge,"%")},children:(0,s.jsxs)("div",{className:"absolute top-0 h-full border-r-2 border-white",style:{left:"".concat(I.stateOfCharge,"%")},children:[(0,s.jsx)("div",{className:"absolute -right-1 top-0 w-2 h-2 bg-white rounded-full"}),(0,s.jsxs)("div",{className:"absolute -right-6 -top-6 bg-oGray2 px-1 py-0.5 rounded text-xs text-white",children:[I.stateOfCharge.toFixed(0),"%"]})]})})]}),(0,s.jsxs)("div",{className:"flex justify-between mt-2",children:[(0,s.jsxs)("div",{className:"text-xs text-white flex items-center",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-red-500 rounded-full mr-1"}),"Empty"]}),(0,s.jsx)("div",{className:"text-xs text-white bg-oGray2 px-2 py-1 rounded",children:D?"Charging":I.timeRemaining?"Time remaining: ".concat((I.timeRemaining/3600).toFixed(1)," h"):"Est. time: ".concat((I.stateOfCharge/(I.current/100)).toFixed(1)," h")}),(0,s.jsxs)("div",{className:"text-xs text-white flex items-center",children:[(0,s.jsx)("div",{className:"w-3 h-3 bg-green-500 rounded-full mr-1"}),"Full"]})]})]})]}),(0,s.jsxs)("div",{className:"bg-oGray2 rounded-lg p-4",children:[(0,s.jsx)("div",{className:"text-gray-400 text-sm font-medium mb-2",children:"POWER CONSUMPTION"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-1",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(c.G,{icon:n.zvy,className:"text-gray-400 mr-2"}),(0,s.jsx)("span",{className:"text-white",children:"Autopilot"}),I.autopilotState&&(0,s.jsx)("span",{className:"ml-2 px-1.5 py-0.5 bg-green-900 text-green-400 text-xs rounded",children:"Active"})]}),(0,s.jsxs)("div",{className:"text-sm text-white font-bold",children:[I.autopilotState?(.4*I.current).toFixed(1):"0.0","%"]})]}),(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-blue-500",style:{width:"".concat(I.autopilotState?Math.min(80,.8*I.current):0,"%")}})})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-1",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(c.G,{icon:n.ESn,className:"text-gray-400 mr-2"}),(0,s.jsx)("span",{className:"text-white",children:"Navigation Instruments"})]}),(0,s.jsxs)("div",{className:"text-sm text-white font-bold",children:[(.3*I.current).toFixed(1),"%"]})]}),(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-cyan-500",style:{width:"".concat(Math.min(60,.6*I.current),"%")}})})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-1",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(c.G,{icon:n.BDt,className:"text-gray-400 mr-2"}),(0,s.jsx)("span",{className:"text-white",children:"Navigation Lights"}),I.navigationLightsOn&&(0,s.jsx)("span",{className:"ml-2 px-1.5 py-0.5 bg-green-900 text-green-400 text-xs rounded",children:"On"})]}),(0,s.jsxs)("div",{className:"text-sm text-white font-bold",children:[(I.navigationLightsOn?.2:0).toFixed(1),"%"]})]}),(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-amber-500",style:{width:"".concat(I.navigationLightsOn?15:0,"%")}})})]}),P&&(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-1",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(c.G,{icon:n.ccn,className:"text-gray-400 mr-2"}),(0,s.jsx)("span",{className:"text-white",children:"Battery Temperature"})]}),(0,s.jsxs)("div",{className:"text-sm text-white font-bold",children:[(.01*I.temperature).toFixed(1),"%"]})]}),(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-orange-500",style:{width:"".concat(Math.min(30,.5*I.temperature),"%")}})})]}),(0,s.jsxs)("div",{className:"mt-8 rightPaneBg bg-opacity-50 p-3 rounded-lg text-sm",children:[(0,s.jsx)("div",{className:"text-white font-medium mb-2",children:"MARINE POWER SAVING TIPS"}),(0,s.jsxs)("div",{className:"flex items-center text-green-400 mb-1",children:[(0,s.jsx)(c.G,{icon:n.BDt,className:"mr-2"}),(0,s.jsxs)("span",{children:["Turn off navigation lights during daylight to save ~",(.8*I.voltage).toFixed(1)," W"]})]}),(0,s.jsxs)("div",{className:"flex items-center text-green-400 mb-1",children:[(0,s.jsx)(c.G,{icon:n.zvy,className:"mr-2"}),(0,s.jsx)("span",{children:"Use wind vane steering when possible instead of autopilot"})]}),(0,s.jsxs)("div",{className:"flex items-center text-amber-400",children:[(0,s.jsx)(c.G,{icon:n.ESn,className:"mr-2"}),(0,s.jsxs)("span",{children:["Current power usage: ",(I.voltage*I.current).toFixed(1)," W"]})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4 mt-6 text-center",children:[(0,s.jsxs)("div",{className:"bg-oGray2 p-3 rounded-lg",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"VOLTAGE"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[I.voltage.toFixed(1),"V"]}),I.voltageRipple&&(0,s.jsxs)("div",{className:"text-xs text-gray-400 mt-1",children:["Ripple: ",I.voltageRipple.toFixed(2),"V"]})]}),(0,s.jsxs)("div",{className:"bg-oGray2 p-3 rounded-lg",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"CURRENT"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[I.current.toFixed(1),"A"]})]}),(0,s.jsxs)("div",{className:"bg-oGray2 p-3 rounded-lg",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"POWER"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[(I.voltage*I.current).toFixed(0),"W"]})]})]})]})]}),"graph"===h&&(0,s.jsxs)("div",{className:"p-4 flex flex-col flex-1 min-h-0 rightPaneBg",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsx)("h2",{className:"text-xl font-bold text-white",children:"Consumption Graph"}),(0,s.jsxs)("div",{className:"flex space-x-2 bg-oGray2 rounded-lg overflow-hidden p-1",children:[(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("voltage"===u?"bg-oGray text-white":"text-gray-400"),onClick:()=>v("voltage"),children:"Voltage"}),(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("current"===u?"bg-oGray text-white":"text-gray-400"),onClick:()=>v("current"),children:"Current"}),(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("soc"===u?"bg-oGray text-white":"text-gray-400"),onClick:()=>v("soc"),children:"SoC %"}),P&&(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("temperature"===u?"bg-oGray text-white":"text-gray-400"),onClick:()=>v("temperature"),children:"Temp"})]})]}),(0,s.jsx)("div",{className:"bg-oGray2 rounded-lg p-4 mb-6",children:(0,s.jsxs)("div",{className:"h-72 relative px-4 pb-6 pt-2 overflow-hidden",children:["voltage"===u&&(0,s.jsx)(d,{data:E,dataKey:"voltage",color:"#3b82f6",scale:F.voltage,label:"Voltage",unit:"V",showPoints:!0,fillGradient:!0}),"current"===u&&(0,s.jsx)(d,{data:E,dataKey:"current",color:"#ef4444",scale:F.current,label:"Current",unit:"A",showPoints:!0,fillGradient:!0}),"soc"===u&&(0,s.jsx)(d,{data:E,dataKey:"stateOfCharge",color:"#22c55e",scale:F.soc,label:"State of Charge",unit:"%",showPoints:!0,fillGradient:!0}),"temperature"===u&&P&&(0,s.jsx)(d,{data:E,dataKey:"temperature",color:"#f97316",scale:F.temperature,label:"Temperature",unit:"\xb0C",showPoints:!0,fillGradient:!0})]})}),(0,s.jsxs)("div",{className:"bg-oGray2 rounded-lg p-4",children:[(0,s.jsx)("div",{className:"text-gray-400 text-sm font-medium mb-4",children:"DETAILED CONSUMPTION BREAKDOWN"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-6",children:[(0,s.jsx)("div",{className:"border-l-4 border-green-500 pl-4",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-gray-400",children:"REAL/NOMINAL"}),(0,s.jsx)("div",{className:"text-lg font-bold text-white",children:(()=>{let e=I.nominalCapacity,t=I.actualCapacity,a=I.stateOfHealth;return e&&t?"".concat(((t/e-1)*100).toFixed(1),"%"):a?"".concat((a-100).toFixed(1),"%"):"-0.9%"})()})]}),(0,s.jsx)("div",{className:"w-1/2",children:(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-green-500",style:{width:(()=>{let e=I.nominalCapacity,t=I.actualCapacity,a=I.stateOfHealth;return e&&t?"".concat(Math.min(100,Math.max(0,t/e*100)),"%"):a?"".concat(Math.min(100,Math.max(0,a)),"%"):"20%"})()}})})})]})}),(0,s.jsx)("div",{className:"border-l-4 border-blue-500 pl-4",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-gray-400",children:"AVERAGE CONSUMPTION"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[(I.voltage*I.current/1e3).toFixed(1)," kWh/hour"]})]}),(0,s.jsx)("div",{className:"w-1/2",children:(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-blue-500",style:{width:"35%"}})})})]})}),(0,s.jsx)("div",{className:"border-l-4 border-orange-500 pl-4",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-gray-400",children:"TEMPERATURE IMPACT"}),(0,s.jsx)("div",{className:"text-lg font-bold text-white",children:P?"".concat((.05*I.temperature).toFixed(1),"%"):"0.0%"})]}),(0,s.jsx)("div",{className:"w-1/2",children:(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-orange-500",style:{width:P?"".concat(Math.min(50,I.temperature),"%"):"10%"}})})})]})})]})]})]}),"performance"===h&&(0,s.jsxs)("div",{className:"p-4 flex flex-col flex-1 min-h-0 rightPaneBg",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,s.jsx)("h2",{className:"text-xl font-bold text-white",children:"Performance Metrics"}),(0,s.jsxs)("div",{className:"flex space-x-2 bg-oGray2 rounded-lg overflow-hidden p-1",children:[(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("fps"===f?"bg-oGray text-white":"text-gray-400"),onClick:()=>j("fps"),children:"FPS"}),(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("drawCalls"===f?"bg-oGray text-white":"text-gray-400"),onClick:()=>j("drawCalls"),children:"Calls"}),(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("triangles"===f?"bg-oGray text-white":"text-gray-400"),onClick:()=>j("triangles"),children:"Triangles"}),(0,s.jsx)("button",{className:"px-3 py-1 rounded text-sm transition-all ".concat("memory"===f?"bg-oGray text-white":"text-gray-400"),onClick:()=>j("memory"),children:"Memory"})]})]}),(0,s.jsx)("div",{className:"bg-oGray2 rounded-lg p-4 mb-6",children:(0,s.jsxs)("div",{className:"h-72 relative px-4 pb-6 pt-2 overflow-hidden rounded-lg",children:["fps"===f&&(0,s.jsx)(d,{data:O,dataKey:"fps",color:"#06b6d4",scale:M.fps,label:"FPS",unit:"",showPoints:!0,fillGradient:!0}),"drawCalls"===f&&(0,s.jsx)(d,{data:O,dataKey:"drawCalls",color:"#8b5cf6",scale:M.drawCalls,label:"Draw Calls",unit:"",showPoints:!0,fillGradient:!0}),"triangles"===f&&(0,s.jsx)(d,{data:O,dataKey:"triangles",color:"#6366f1",scale:M.triangles,label:"Triangles",unit:"",showPoints:!0,fillGradient:!0}),"memory"===f&&(0,s.jsx)(d,{data:O,dataKey:"memory",color:"#10b981",scale:M.memory,label:"Memory",unit:" MB",showPoints:!0,fillGradient:!0})]})}),(0,s.jsxs)("div",{className:"bg-oGray2 rounded-lg p-4",children:[(0,s.jsx)("div",{className:"text-gray-400 text-sm font-medium mb-4",children:"HARDWARE PERFORMANCE STATS"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsx)("div",{className:"border-l-4 border-cyan-500 pl-4",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-gray-400",children:"CURRENT FPS"}),(0,s.jsx)("div",{className:"text-lg font-bold text-white",children:O[O.length-1].fps.toFixed(1)})]}),(0,s.jsx)("div",{className:"w-1/2",children:(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-cyan-500",style:{width:"".concat(Math.min(100,O[O.length-1].fps/60*100),"%")}})})})]})}),(0,s.jsx)("div",{className:"border-l-4 border-purple-500 pl-4",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-gray-400",children:"FRAME TIME"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[O[O.length-1].ms.toFixed(1)," ms"]})]}),(0,s.jsx)("div",{className:"w-1/2",children:(0,s.jsx)("div",{className:"h-2 bg-oGray rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-purple-500",style:{width:"".concat(Math.min(100,100-O[O.length-1].ms/33.33*100),"%")}})})})]})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[(0,s.jsxs)("div",{className:"rightPaneBg bg-opacity-50 p-3 rounded-lg text-center",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"DRAW CALLS"}),(0,s.jsx)("div",{className:"text-lg font-bold text-white",children:O[O.length-1].drawCalls})]}),(0,s.jsxs)("div",{className:"rightPaneBg bg-opacity-50 p-3 rounded-lg text-center",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"TRIANGLES"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[(O[O.length-1].triangles/1e3).toFixed(1),"k"]})]}),(0,s.jsxs)("div",{className:"rightPaneBg bg-opacity-50 p-3 rounded-lg text-center",children:[(0,s.jsx)("div",{className:"text-xs text-gray-400",children:"MEMORY"}),(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[O[O.length-1].memory," MB"]})]})]}),(0,s.jsxs)("div",{className:"mt-6 rightPaneBg bg-opacity-50 p-3 rounded-lg text-sm",children:[(0,s.jsx)("div",{className:"text-white font-medium mb-2",children:"SYSTEM INFO"}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center text-gray-300",children:[(0,s.jsx)(c.G,{icon:n.zvy,className:"mr-2 text-cyan-400"}),(0,s.jsx)("span",{children:"GPU: WebGL Renderer"})]}),(0,s.jsxs)("div",{className:"flex items-center text-gray-300",children:[(0,s.jsx)(c.G,{icon:n.$v3,className:"mr-2 text-green-400"}),(0,s.jsxs)("span",{children:["Textures: ",O[O.length-1].textures||0]})]}),(0,s.jsxs)("div",{className:"flex items-center text-gray-300",children:[(0,s.jsx)(c.G,{icon:n.hGM,className:"mr-2 text-purple-400"}),(0,s.jsxs)("span",{children:["Geometries: ",O[O.length-1].geometries||0]})]}),(0,s.jsxs)("div",{className:"flex items-center text-gray-300",children:[(0,s.jsx)(c.G,{icon:n.dT$,className:"mr-2 text-blue-400"}),(0,s.jsxs)("span",{children:["Three.js ",o.UZH]})]})]})]})]})]})]})]})}},5008:function(e,t,a){a.d(t,{Si:function(){return l},d3:function(){return i},vp:function(){return s},z:function(){return r}});let s={WARNING_THRESHOLD:50,DANGER_THRESHOLD:20,CHARGING_THRESHOLD:13.2,MIN_VOLTAGE:10.5,MAX_VOLTAGE:14.4},l=e=>{if(!e||"number"!=typeof e)return 0;if(e>=13)return 100;if(e<=s.MIN_VOLTAGE)return 0;let t=[{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 a=0;a<t.length-1;a++)if(e>=t[a+1].voltage){let s=t[a].voltage,l=t[a+1].voltage,i=t[a].soc,r=t[a+1].soc;return Math.round(r+(e-l)/(s-l)*(i-r))}return 0},i=e=>e>s.CHARGING_THRESHOLD,r=e=>e>s.WARNING_THRESHOLD?"bg-oGreen":e>s.DANGER_THRESHOLD?"bg-oYellow":"bg-oRed"}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7409],{7589:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_not-found/page",function(){return n(3634)}])},3634:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}}),n(7043);let i=n(7437);n(2265);let o={fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},l={display:"inline-block"},r={display:"inline-block",margin:"0 20px 0 0",padding:"0 23px 0 0",fontSize:24,fontWeight:500,verticalAlign:"top",lineHeight:"49px"},d={fontSize:14,fontWeight:400,lineHeight:"49px",margin:0};function s(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("title",{children:"404: This page could not be found."}),(0,i.jsx)("div",{style:o,children:(0,i.jsxs)("div",{children:[(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}),(0,i.jsx)("h1",{className:"next-error-h1",style:r,children:"404"}),(0,i.jsx)("div",{style:l,children:(0,i.jsx)("h2",{style:d,children:"This page could not be found."})})]})})]})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=7589)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3185],{5189:function(e,_,s){Promise.resolve().then(s.t.bind(s,4434,23)),Promise.resolve().then(s.t.bind(s,507,23)),Promise.resolve().then(s.t.bind(s,7960,23))},7960:function(){},507:function(e){e.exports={style:{fontFamily:"'__geistMono_692ef5', '__geistMono_Fallback_692ef5'"},className:"__className_692ef5",variable:"__variable_692ef5"}},4434:function(e){e.exports={style:{fontFamily:"'__geistSans_d559d3', '__geistSans_Fallback_d559d3'"},className:"__className_d559d3",variable:"__variable_d559d3"}}},function(e){e.O(0,[9476,2971,2117,1744],function(){return e(e.s=5189)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{7343:function(e,t,n){Promise.resolve().then(n.bind(n,9670))},3082:function(e,t,n){"use strict";n.d(t,{$:function(){return x},FV:function(){return p},G5:function(){return y},HH:function(){return d},HQ:function(){return M},NU:function(){return T},Qj:function(){return b},Ux:function(){return v},YH:function(){return P},_P:function(){return g},eF:function(){return h},gK:function(){return u},n5:function(){return f},vd:function(){return m},yC:function(){return k}});var r=n(7437),a=n(2265),i=n(4578),o=n(3321),l=n(99),s=n(2079);let c=(0,a.createContext)(),u="#09bfff",d="#cc000c",g="#ffbe00",p="#0fcd4f",h="#ef4444",m="#989898",f="#424242",v=e=>null==e?null:Math.round((180*e/Math.PI+360)%360),b=e=>null==e?null:(e*w).toFixed(1),w=1.94384,y=e=>null!=e?Math.round((e-273.15)*10)/10:null,M=e=>null!=e?Math.round(19.4384*e)/10:null,x=M,T=e=>null!=e?Math.round(e/100*10)/10:null,C={autopilot:!0,anchorWatch:!1,parkingMode:!1,mob:!1,showOcean:!1,ais:!1,showPolar:!0},S={wind:{"environment.wind.angleTrueWater":s.M8C.degToRad(0),"environment.wind.speedTrue":10.288,"environment.wind.angleApparent":s.M8C.degToRad(0),"environment.wind.speedApparent":10.288},temperature:{"environment.water.temperature":290.15,"environment.outside.temperature":294.15,"propulsion.main.exhaustTemperature":368.15,"environment.inside.fridge.temperature":277.15},environment:{"environment.outside.pressure":102300,"environment.inside.relativeHumidity":.74,"environment.inside.voc":.03},performance:{"performance.beatAngle":s.M8C.degToRad(45),"performance.gybeAngle":s.M8C.degToRad(135),"performance.beatAngleVelocityMadeGood":6,"performance.gybeAngleVelocityMadeGood":5,"performance.targetAngle":s.M8C.degToRad(45),"performance.polarSpeed":8,"performance.polarSpeedRatio":.95,"performance.velocityMadeGood":5,"performance.polarVelocityMadeGood":6,"performance.polarVelocityMadeGoodRatio":.9},navigation:{"navigation.speedThroughWater":7,"navigation.headingTrue":s.M8C.degToRad(0),"navigation.courseOverGround":s.M8C.degToRad(20),"navigation.courseGreatCircle.nextPoint.bearingTrue":s.M8C.degToRad(30),"navigation.attitude":{roll:s.M8C.degToRad(5),pitch:s.M8C.degToRad(2),yaw:s.M8C.degToRad(2)}},racing:{"navigation.racing.layline":s.M8C.degToRad(10),"navigation.racing.layline.distance":100,"navigation.racing.layline.time":180,"navigation.racing.oppositeLayline":s.M8C.degToRad(45),"navigation.racing.oppositeLayline.distance":80,"navigation.racing.oppositeLayline.time":180,"navigation.racing.startLineStb":{latitude:0,longitude:0,altitude:0},"navigation.racing.startLinePort":{latitude:0,longitude:0,altitude:0},"navigation.racing.distanceStartline":50,"navigation.racing.timeToStart":120,"navigation.racing.timePortDown":60,"navigation.racing.timePortUp":70,"navigation.racing.timeStbdDown":65,"navigation.racing.timeStbdUp":75},electrical:{"electrical.batteries.1.name":"House Battery","electrical.batteries.1.location":"Under Starboard Bed","electrical.batteries.1.capacity.nominal":768,"electrical.batteries.1.capacity.actual":707,"electrical.batteries.1.capacity.remaining":601,"electrical.batteries.1.capacity.dischargeLimit":.2,"electrical.batteries.1.capacity.timeRemaining":9860,"electrical.batteries.1.lifetimeDischarge":54e4,"electrical.batteries.1.lifetimeRecharge":545e3,"electrical.batteries.1.voltage.ripple":.05,"electrical.batteries.1.chemistry":"LeadAcid","electrical.batteries.1.manufacturer.name":"VARTA","electrical.batteries.1.manufacturer.model":"Professional Dual Purpose RA 595 985","electrical.batteries.1.manufacturer.URL":"https://www.varta-automotive.com","electrical.batteries.1.dateInstalled":"2020-06-15T00:00:00Z","electrical.batteries.1.associatedBus":"House Bus","electrical.batteries.1.voltage":12.6,"electrical.batteries.1.current":-2.3,"electrical.batteries.0.name":"Engine Start Battery","electrical.batteries.0.location":"Engine Compartment","electrical.batteries.0.capacity.nominal":888,"electrical.batteries.0.capacity.actual":861,"electrical.batteries.0.chemistry":"LeadAcid","electrical.batteries.0.manufacturer.name":"VARTA","electrical.batteries.0.manufacturer.model":"Blue Dynamic E11","electrical.batteries.0.manufacturer.URL":"https://www.varta-automotive.com","electrical.batteries.0.dateInstalled":"2022-04-10T00:00:00Z","electrical.batteries.0.associatedBus":"Start Bus","electrical.batteries.0.voltage":12.4,"electrical.batteries.0.current":.1,"electrical.alternators.0.voltage":14.2,"electrical.alternators.0.current":35.5,"navigation.lights":!1,"steering.autopilot.state":"auto"},propulsion:{"propulsion.0.revolutions":25,"propulsion.0.runTime":125e3,"propulsion.0.coolantTemperature":353.15,"propulsion.0.coolantPressure":18e4,"propulsion.0.oilPressure":35e4,"propulsion.0.oilTemperature":363.15,"propulsion.0.exhaustTemperature":623.15,"propulsion.0.intakeManifoldTemperature":313.15,"propulsion.0.boostPressure":15e4,"propulsion.0.load":.45,"propulsion.0.torque":.52,"propulsion.0.state":"started","propulsion.0.fuel.rate":2778e-9,"propulsion.0.fuel.pressure":28e4,"propulsion.0.fuel.economyRate":.45,"propulsion.0.transmission.gear":1,"propulsion.0.transmission.oilPressure":32e4,"propulsion.0.transmission.oilTemperature":343.15,"propulsion.0.tilt":0,"propulsion.1.revolutions":26,"propulsion.1.runTime":128e3,"propulsion.1.coolantTemperature":355.15,"propulsion.1.coolantPressure":185e3,"propulsion.1.oilPressure":36e4,"propulsion.1.oilTemperature":365.15,"propulsion.1.exhaustTemperature":633.15,"propulsion.1.intakeManifoldTemperature":315.15,"propulsion.1.boostPressure":155e3,"propulsion.1.load":.48,"propulsion.1.torque":.54,"propulsion.1.state":"started","propulsion.1.fuel.rate":2917e-9,"propulsion.1.fuel.pressure":285e3,"propulsion.1.transmission.gear":1,"propulsion.1.transmission.oilPressure":325e3,"propulsion.1.transmission.oilTemperature":345.15,"propulsion.1.tilt":0},tanks:{"tanks.fuel.0.currentLevel":.75,"tanks.fuel.0.capacity":200,"tanks.fuel.0.currentVolume":150,"tanks.fuel.0.type":"fuel"}},P=e=>{let{children:t}=e,[n,u]=(0,a.useState)({}),[d,g]=(0,a.useState)(!1),[p,h]=(0,a.useState)(C),m=e=>Object.prototype.hasOwnProperty.call(n,e)?n[e]:null,f=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=void 0!==t?t:!p[e];if(h(t=>({...t,[e]:n})),"anchorWatch"===e)try{if(n)(0,l.k8)()&&await (0,l.Yw)("anchored");else{let e=m("propulsion.main.state")||m("propulsion.main.revolutions");(0,l.k8)()&&await (0,l.Yw)("running"===e||"number"==typeof e&&e>0?"motoring":"sailing")}}catch(e){console.error("Failed to update OcearoCore mode for anchorWatch:",(0,l.Rd)(e))}if("parkingMode"===e)try{n&&(0,l.k8)()&&await (0,l.Yw)("moored")}catch(e){console.error("Failed to update OcearoCore mode for parkingMode:",(0,l.Rd)(e))}if("racing"===e)try{n?(0,l.k8)()&&await (0,l.Yw)("racing"):(0,l.k8)()&&await (0,l.Yw)("sailing")}catch(e){console.error("Failed to update OcearoCore mode for racing:",(0,l.Rd)(e))}},v=(0,a.useRef)(null),b=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=!0,t=async()=>{let e,t;let n=new Date,r=n.getFullYear(),a=(n.getMonth()+1).toString().padStart(2,"0"),i="tides/larochelle/".concat(a,"_").concat(r,".json"),o=await fetch(i);if(!o.ok){console.warn("No tide data found");return}let l=await o.json(),s=n.toISOString().split("T")[0];if(!l[s])return;let c=new Date,d=60*c.getHours()+c.getMinutes(),g=null,p=null;for(let e of l[s].map(e=>{let[t,n,r,a]=e,[i,o]=n.split(":").map(Number);return{type:t,height:parseFloat(r),time:n,timeInMinutes:60*i+o,coef:a}}).sort((e,t)=>e.timeInMinutes-t.timeInMinutes))if(e.timeInMinutes<=d)g=e;else{p=e;break}if(!g||!p)throw Error("Cannot determine tide trend");if("tide.low"===g.type&&"tide.high"===p.type?(e="tide.high"===p.type?p:null,t="tide.low"===g.type?g:null):(e="tide.high"===g.type?g:null,t="tide.low"===p.type?p:null),e&&t){let n="".concat(c.getHours().toString().padStart(2,"0"),":").concat(c.getMinutes().toString().padStart(2,"0")),r=j(e.height,t.height,n,e.time,t.time);u(n=>({...n,"environment.tide.heightNow":r,"environment.tide.heightHigh":e.height,"environment.tide.heightLow":t.height,"environment.tide.timeLow":t.time,"environment.tide.timeHigh":e.time,"environment.tide.coeffNow":e.coef}))}else throw Error("Tide data for today is incomplete.")};return(async()=>{let{signalkUrl:t,debugMode:n}=o.Z.getAll(),r=()=>{b.current&&clearInterval(b.current);let e=0;b.current=setInterval(()=>{let t=Math.floor(91*Math.random())-45;e=(e+5)%360,u(e=>({...e,"steering.rudderAngle":s.M8C.degToRad(t),...S.temperature,...S.environment,...S.performance,...S.navigation,...S.racing,...S.electrical,...S.propulsion,...S.tanks}))},1e3)};try{let[a,o]=t.replace(/https?:\/\//,"").split(":"),l=new i.default({hostname:a||"localhost",port:parseInt(o)||3e3,useTLS:t.startsWith("https"),reconnect:!0,autoConnect:!1,notifications:!1,deltaStreamBehaviour:"self",sendMeta:"all",wsKeepaliveInterval:10});v.current=l,await l.connect(),l.on("delta",t=>{e&&t.updates.forEach(e=>{e.values&&e.values.forEach(e=>{u(t=>({...t,[e.path]:e.value}))})})}),n&&r()}catch(e){console.error("Failed to connect to SignalK:",e),r()}})(),t(),()=>{e=!1,v.current&&v.current.disconnect(),b.current&&clearInterval(b.current)}},[]),(0,r.jsx)(c.Provider,{value:{getSignalKValue:m,getDepthData:()=>{var e,t;let n=m("environment.depth.belowKeel"),r=m("environment.depth.belowSurface"),a=m("environment.depth.belowTransducer"),i=null!==(e=null!=n?n:a)&&void 0!==e?e:null,o=null!==(t=null!=r?r:null!==a?a+1.5:null)&&void 0!==t?t:null;return{belowKeel:null!==i?Math.round(10*i)/10:null,belowSurface:null!==o?Math.round(10*o)/10:null,belowTransducer:null!==a?Math.round(10*a)/10:null}},getTankData:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=n=>{let r=m("tanks.".concat(e,".").concat(t,".").concat(n));if(null===r&&0===t){var a;r=null!==(a=m("tanks.".concat(e,".main.").concat(n)))&&void 0!==a?a:m("tanks.".concat(e,".port.").concat(n))}else null===r&&1===t&&(r=m("tanks.".concat(e,".starboard.").concat(n)));return r},r=n("currentLevel"),a=n("currentVolume"),i=n("capacity");return{name:n("name"),type:n("type"),capacity:i,currentLevel:null!==r?Math.round(1e3*r)/1e3:null,currentVolume:a,pressure:n("pressure"),temperature:n("temperature"),calculatedVolume:null!==r&&null!==i?Math.round(r*i*1e3)/1e3:null}},getBoatRotationAngle:()=>{let e=m("navigation.headingTrue")||m("navigation.headingMagnetic");return m("navigation.courseOverGroundTrue")||m("navigation.courseOverGroundMagnetic")||e||0},convertLatLonToXY:(e,t)=>{if(!(null==e?void 0:e.lat)||!(null==e?void 0:e.lon)||!(null==t?void 0:t.lat)||!(null==t?void 0:t.lon))return console.warn("Invalid input to convertLatLonToXY",e,t),{x:0,y:0};let n=t.lat*Math.PI/180,r=t.lon*Math.PI/180,a=e.lat*Math.PI/180,i=e.lon*Math.PI/180-r,o=a-n,l=Math.atan2(Math.sin(i)*Math.cos(a),Math.cos(n)*Math.sin(a)-Math.sin(n)*Math.cos(a)*Math.cos(i)),s=Math.sin(o/2)*Math.sin(o/2)+Math.cos(n)*Math.cos(a)*Math.sin(i/2)*Math.sin(i/2),c=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))*6371e3;return{x:c*Math.sin(l),y:c*Math.cos(l)}},nightMode:d,setNightMode:g,states:p,toggleState:f},children:t})},k=()=>(0,a.useContext)(c),j=function(e,t,n,r,a){let i,o,l,s;if(!n||!r||!a||!/^\d{1,2}:\d{2}$/.test(n)||!/^\d{1,2}:\d{2}$/.test(r)||!/^\d{1,2}:\d{2}$/.test(a))return console.error("Invalid time format provided to calculateTideHeightUsingTwelfths"),(e+t)/2;let c=e=>{let[t,n]=e.split(":").map(Number);return 60*t+n},u=c(r),d=c(a),g=c(n),p=!1;d<=g&&g<=u?(p=!0,i=t,o=e,l=d,s=u):(i=e,o=t,l=u,s=d+(d<u?1440:0));let h=Math.abs(s-l),m=Math.abs(o-i),f=g-l;f<0&&(f+=1440);let v=m/12,b=0;return b=f<=h/6?v*Math.ceil(f/(h/12)):f<=2*h/6?2*v+v*Math.ceil((f-h/6)/(h/12)):f<=3*h/6?5*v:f<=4*h/6?8*v:f<=5*h/6?10*v:m,p?i+b:i-b}},3321:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=JSON.parse('{"F":[{"name":"Default","modelPath":"default","capabilities":["navigation","rudder","sail","color"]},{"name":"RM1080","modelPath":"rm1080","capabilities":["navigation"]},{"name":"Optimist","modelPath":"optimist","capabilities":["navigation","ais"]},{"name":"Sailboat","modelPath":"sailboat","capabilities":["navigation","ais"]},{"name":"Ship","modelPath":"ship","capabilities":["navigation","ais"]},{"name":"Windsurf","modelPath":"windsurf","capabilities":["navigation","ais"]}]}');class a{isLocalStorageAvailable(){try{return"undefined"!=typeof localStorage}catch(e){return!1}}loadConfig(){if(this.isLocalStorageAvailable()){let e=localStorage.getItem(this.configKey);if(!e)return this.saveConfig(this.defaultConfig),{...this.defaultConfig};try{return JSON.parse(e)}catch(e){return console.error("Failed to parse stored configuration:",e),{...this.defaultConfig}}}return{...this.inMemoryConfig}}saveConfig(e){this.config={...this.config,...e},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.config}}get(e){return this.config[e]}set(e,t){this.config[e]=t,this.saveConfig(this.config)}resetConfig(){this.config={...this.defaultConfig},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.defaultConfig}}getAll(){return{...this.config}}getDefaultConfig(){return{...this.defaultConfig}}getSelectedBoat(){let e=this.config.selectedBoat;return e?this.getBoatsData().find(t=>t.name===e):[]}getBoatsData(){return r.F}getComputedSignalKUrl(){return this.config.debugMode?"https://demo.signalk.org:443":"".concat(window.location.protocol,"//").concat(window.location.hostname).concat(window.location.port?":"+window.location.port:"")}getCurrentView(){return this.config.currentView||this.defaultConfig.currentView}setCurrentView(e){this.set("currentView",e)}constructor(){this.defaultConfig={signalkUrl:"http://localhost:3000",username:"",password:"",useAuthentication:!1,signalKUrlSet:!1,debugMode:!1,selectedBoat:"Default",primaryColor:null,metallicEffect:!1,aisLengthScalingFactor:.7,compassNorthUp:!1,showCustomUrls:!1,customExternalUrls:{},currentView:"default"},this.configKey="ocearoConfig",this.inMemoryConfig={...this.defaultConfig},this.config=this.loadConfig()}}var i=new a},99:function(e,t,n){"use strict";n.d(t,{Ik:function(){return d},Rd:function(){return p},Vb:function(){return g},Yw:function(){return s},aA:function(){return u},aR:function(){return c},k8:function(){return o}});var r=n(3321),a=n(2957).Buffer;let i=()=>{let e=r.Z.getAll();return{enabled:e.ocearoCoreEnabled||!0,baseUrl:"function"==typeof r.Z.getComputedSignalKUrl?r.Z.getComputedSignalKUrl():e.signalkUrl||"http://localhost:3000",timeout:1e4,username:e.username||"",password:e.password||""}},o=()=>i().enabled,l=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i();if(!n.enabled)throw Error("OcearoCore is not enabled");let r=new AbortController,o=setTimeout(()=>r.abort(),n.timeout);try{let i="".concat(n.baseUrl,"/plugins/ocearo-core").concat(e),l={"Content-Type":"application/json",...t.headers};if(n.username)try{let e="function"==typeof btoa?btoa("".concat(n.username,":").concat(n.password||"")):a.from("".concat(n.username,":").concat(n.password||"")).toString("base64");l.Authorization="Basic ".concat(e)}catch(e){}let s=await fetch(i,{signal:r.signal,headers:l,credentials:"include",...t});if(clearTimeout(o),!s.ok){let e=await s.text().catch(()=>s.statusText);throw Error("OcearoCore API error (".concat(s.status,"): ").concat(e))}return await s.json()}catch(e){if(clearTimeout(o),"AbortError"===e.name)throw Error("OcearoCore API request timed out");throw e}},s=async e=>{let t=["sailing","anchored","motoring","moored","racing"];if(!t.includes(e))throw Error("Invalid mode. Valid modes: ".concat(t.join(", ")));return await l("/mode",{method:"POST",body:JSON.stringify({mode:e})})},c=async e=>{if(!e||"object"!=typeof e)throw Error("Current data is required and must be an object");return await l("/logbook/entry",{method:"POST",body:JSON.stringify({currentData:e})})},u=async(e,t)=>{let n=new URLSearchParams;e&&n.append("startDate",e),t&&n.append("endDate",t);let r=n.toString();return await l("/logbook/all-entries".concat(r?"?".concat(r):""))},d=async e=>{if(!e||"object"!=typeof e)throw Error("Entry data is required and must be an object");return await l("/logbook/add-entry",{method:"POST",body:JSON.stringify(e)})},g=e=>({position:{latitude:e("navigation.position.latitude"),longitude:e("navigation.position.longitude")},course:e("navigation.courseOverGroundTrue")||e("navigation.headingTrue"),speed:e("navigation.speedOverGround"),wind:{speed:e("environment.wind.speedTrue"),direction:e("environment.wind.angleTrueWater")},weather:{pressure:e("environment.outside.pressure"),temperature:e("environment.outside.temperature")},engine:{hours:e("propulsion.main.runTime")},log:e("navigation.log")}),p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"OcearoCore operation";return(console.error("".concat(t," failed:"),e),e.message.includes("not enabled"))?"OcearoCore is not enabled in the configuration":e.message.includes("timed out")?"OcearoCore service is not responding (timeout)":e.message.includes("Logbook service unavailable")||e.message.includes("Logbook plugin not installed")||e.message.includes("Logbook server not available")?"SignalK-Logbook plugin is not installed. Please install it from the SignalK App Store to use logbook features.":e.message.includes("503")?"Service temporarily unavailable. Please try again later.":e.message.includes("404")?"Feature not found or not installed":e.message.includes("500")?"Internal server error. Check server logs for details.":e.message||"Unknown error occurred"}},9670:function(e,t,n){"use strict";n.r(t),n.d(t,{VIEW_MODES:function(){return m},default:function(){return v}});var r=n(7437),a=n(2265),i=n(166),o=n(376),l=n.n(o),s=n(3082);class c extends a.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.setState({error:e,errorInfo:t}),console.error("Error caught in Error Boundary:",e,t)}render(){if(this.state.hasError){let{error:e,errorInfo:t}=this.state;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center min-h-screen bg-gray-100 text-gray-900",children:[(0,r.jsx)("h1",{className:"text-3xl font-bold text-red-600 mb-4",children:"Something went wrong."}),(0,r.jsxs)("p",{className:"text-lg mb-2",children:[(0,r.jsx)("strong",{children:"Error:"})," ",e?e.toString():"Unknown error"]}),t&&(0,r.jsxs)("details",{className:"whitespace-pre-wrap bg-gray-200 p-4 rounded-lg mb-4",children:[(0,r.jsx)("summary",{className:"cursor-pointer text-blue-500 underline",children:"Stack Trace"}),(0,r.jsx)("pre",{className:"mt-2",children:t.componentStack})]}),(0,r.jsxs)("div",{className:"flex space-x-4",children:[(0,r.jsx)("button",{onClick:this.handleRefresh,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Refresh Page"}),(0,r.jsx)("button",{onClick:this.handleExitFullscreen,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Exit Fullscreen"})]})]})}return this.props.children}constructor(e){super(e),this.handleRefresh=()=>{window.location.reload()},this.handleExitFullscreen=()=>{document.fullscreenElement&&(window.close(),document.exitFullscreen().catch(e=>{console.error("Failed to exit fullscreen:",e)}))},this.state={hasError:!1,error:null,errorInfo:null}}}var u=n(3321);let d=(0,i.default)(()=>n.e(7252).then(n.bind(n,7252)),{loadableGenerated:{webpack:()=>[7252]},loading:()=>(0,r.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:"Loading..."})}),g=(0,i.default)(()=>Promise.all([n.e(3676),n.e(1268),n.e(2012)]).then(n.bind(n,2012)),{loadableGenerated:{webpack:()=>[2012]}}),p=(0,i.default)(()=>Promise.all([n.e(3676),n.e(1268),n.e(2936)]).then(n.bind(n,2936)),{loadableGenerated:{webpack:()=>[2936]}}),h=(0,i.default)(()=>Promise.all([n.e(3676),n.e(6689),n.e(1268),n.e(6496),n.e(6412)]).then(n.bind(n,6412)),{loadableGenerated:{webpack:()=>[6412]},loading:()=>(0,r.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,r.jsx)("div",{className:"text-white text-2xl",children:"Loading 3D View..."})}),ssr:!1}),m={BOAT:"boat",APP:"app",SPLIT:"split"},f=()=>window.innerWidth>=1366;function v(){let e=(0,a.useRef)(!1),[t,n]=(0,a.useState)(null),[i,o]=(0,a.useState)(()=>u.Z.getCurrentView()||"navigation"),[v,b]=(0,a.useState)(!1),[w,y]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let t;n(f()?m.SPLIT:m.BOAT),e.current=!0;let r=()=>{clearTimeout(t),t=setTimeout(()=>{n(f()?m.SPLIT:m.BOAT)},250)};return window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),clearTimeout(t)}},[]);let M=(0,a.useCallback)(()=>{b(e=>!e)},[]),x=(0,a.useCallback)(e=>{n(e)},[]),T=(0,a.useCallback)((e,t)=>{let n=window.innerWidth/5;t.x>n?x(m.BOAT):t.x<-n?x(m.APP):x(m.SPLIT)},[x]),C=(0,a.useCallback)(()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen().catch(e=>{console.error("Fullscreen error:",e.message)})},[]),S=(0,a.useCallback)(e=>{t===m.BOAT&&x(m.APP),o(e),u.Z.setCurrentView(e)},[t,x]),P=(0,a.useCallback)(()=>{w?(x(m.BOAT),y(!1)):(S("settings"),y(!0))},[w,x,S]),k=(0,a.useMemo)(()=>null===t?{}:{leftPane:"transition-all duration-300 ".concat(t===m.BOAT?"w-full":t===m.APP?"hidden":"w-2/5"," bg-leftPaneBg h-full relative"),rightPane:"transition-all duration-300 ".concat(t===m.APP?"w-full":t===m.BOAT?"hidden":"w-3/5"," h-full bg-rightPaneBg p-4")},[t]);return e.current?(0,r.jsx)(c,{children:(0,r.jsx)(s.YH,{children:(0,r.jsxs)("div",{className:"h-screen flex flex-col bg-black relative overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,r.jsx)("div",{className:k.leftPane,children:(0,r.jsx)(h,{})}),(0,r.jsx)(l(),{axis:"x",onDrag:T,position:{x:0,y:0},handle:".handle",bounds:"parent",children:(0,r.jsx)("div",{className:"handle w-1 bg-leftPaneBg h-full cursor-col-resize transition-all duration-200 flex items-center justify-center",children:(0,r.jsx)("div",{className:"rounded-full w-3 bg-gray-600 h-40 transition-all duration-200 hover:bg-gray-500"})})}),(0,r.jsx)("div",{className:k.rightPane,children:(0,r.jsx)(d,{view:i})})]}),(0,r.jsx)("div",{className:"w-full h-16 min-h-16 bg-black flex items-center justify-center shrink-0",children:(0,r.jsx)(g,{setRightView:S,toggleAppMenu:M,toggleSettings:P})}),v&&(0,r.jsx)(p,{currentViewMode:t,toggleViewMode:x,handleSetRightView:S,toggleFullscreen:C,setShowAppMenu:b})]})})}):(0,r.jsx)("div",{className:"h-screen bg-black flex items-center justify-center",children:(0,r.jsx)("div",{className:"animate-pulse text-white",children:"Loading..."})})}}},function(e){e.O(0,[5870,3746,2971,2117,1744],function(){return e(e.s=7343)}),_N_E=e.O()}]);
|