ocearo-ui 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/404.html +1 -1
- package/CHANGELOG.md +364 -0
- package/README.fr.md +28 -31
- package/README.md +28 -31
- package/__next.__PAGE__.txt +3 -3
- package/__next._full.txt +3 -3
- package/__next._tree.txt +2 -2
- package/_next/static/chunks/01ij-cuy61l35.js +1 -0
- package/_next/static/chunks/047e3x_ahxnrl.js +1 -0
- package/_next/static/chunks/0ath9h2eo-m4-.js +1 -0
- package/_next/static/chunks/0bxzs0khjn1uj.js +1 -0
- package/_next/static/chunks/0ejjon45nq_-h.js +9 -0
- package/_next/static/chunks/{1quvj-861o57h.js → 0kdc_niwgmx_8.js} +1 -1
- package/_next/static/chunks/{1bvrvkcwf3ge-.js → 0ngl63fz0a-bo.js} +1 -1
- package/_next/static/chunks/0ucob1nu_x8bl.js +1 -0
- package/_next/static/chunks/0wi5jop1ihbm6.js +2 -0
- package/_next/static/chunks/18e6nw0w7akkb.js +180 -0
- package/_next/static/chunks/18vlmqe7txbmt.js +1 -0
- package/_next/static/chunks/{3utjjgdhnlx86.js → 192c42s2wc7qe.js} +1 -1
- package/_next/static/chunks/1_twx50ejqan5.js +1 -0
- package/_next/static/chunks/1na56snuhu-pc.js +346 -0
- package/_next/static/chunks/1vchkqgn-xw-o.js +1 -0
- package/_next/static/chunks/20p1hr--2grl8.js +9 -0
- package/_next/static/chunks/2393lwi8kee3m.js +48 -0
- package/_next/static/chunks/25v2cwta2fy-7.js +393 -0
- package/_next/static/chunks/28wfa6j-9g_qc.js +1 -0
- package/_next/static/chunks/290k3k__vbum2.js +121 -0
- package/_next/static/chunks/2cecf_xnd_9em.js +1 -0
- package/_next/static/chunks/2die6btm3_mhq.js +1 -0
- package/_next/static/chunks/2hm43avzk8_jb.js +503 -0
- package/_next/static/chunks/2ijx7rln4jshb.css +3 -0
- package/_next/static/chunks/2q_bl16zedyyo.js +503 -0
- package/_next/static/chunks/2xntuu6mzh41s.js +1 -0
- package/_next/static/chunks/30p1dpgmonstj.js +1 -0
- package/_next/static/chunks/31p7nz0hfuym7.js +1 -0
- package/_next/static/chunks/{1e-w_-usen7fy.js → 34nhy77liurum.js} +2 -2
- package/_next/static/chunks/37g-wmrgbgd6h.js +739 -0
- package/_next/static/chunks/{18_i6mf6hb_c7.js → 395ffa6t18601.js} +1 -1
- package/_next/static/chunks/3bai186_bv3i_.js +1 -0
- package/_next/static/chunks/3h_m2s30sr9mt.js +430 -0
- package/_next/static/chunks/3j453-2u58qbv.js +1 -0
- package/_next/static/chunks/3k-r-4veivdjr.js +1 -0
- package/_next/static/chunks/3yz0mxxv4vrfg.js +1 -0
- package/_not-found/__next._full.txt +2 -2
- package/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/_not-found/__next._tree.txt +2 -2
- package/_not-found.html +1 -1
- package/_not-found.txt +2 -2
- package/boats/boats.json +11 -19
- package/boats/windsurf/assets/license.txt +6 -8
- package/boats/windsurf/assets/rider.glb +0 -0
- package/boats/wingfoil/assets/license.txt +9 -0
- package/boats/wingfoil/assets/rider.glb +0 -0
- package/guide/bathymetry.jpg +0 -0
- package/guide/weather.jpg +0 -0
- package/index.html +1 -1
- package/index.txt +3 -3
- package/package.json +27 -5
- package/settings/__next._full.txt +3 -3
- package/settings/__next._tree.txt +2 -2
- package/settings/__next.settings.__PAGE__.txt +3 -3
- package/settings.html +1 -1
- package/settings.txt +3 -3
- package/_next/static/chunks/0-19-ljntm5ig.js +0 -1
- package/_next/static/chunks/0-g-ujyrfgutp.js +0 -2
- package/_next/static/chunks/0-jqvc-r0kh0c.js +0 -1
- package/_next/static/chunks/05do10p9ldt1p.js +0 -409
- package/_next/static/chunks/0c91q-13wh8hk.js +0 -1
- package/_next/static/chunks/0fv1wwxeyagln.js +0 -446
- package/_next/static/chunks/0jucaltuccn03.js +0 -1
- package/_next/static/chunks/0m7wbuocx-b4_.js +0 -9
- package/_next/static/chunks/0o7hu-sypv2u9.js +0 -1
- package/_next/static/chunks/0ujzg6ofy2r73.js +0 -1
- package/_next/static/chunks/162bfkgcudvew.js +0 -9
- package/_next/static/chunks/1bo0ke8gjc1c2.js +0 -1
- package/_next/static/chunks/1do-2zwq3ws0f.js +0 -346
- package/_next/static/chunks/1ho2ekxa9io1_.js +0 -1
- package/_next/static/chunks/1m3-nchdgcxy1.css +0 -3
- package/_next/static/chunks/271ys-u920uqd.js +0 -564
- package/_next/static/chunks/2_iau6x7s0vil.js +0 -1131
- package/_next/static/chunks/2ab6q6u6uo_bf.js +0 -1
- package/_next/static/chunks/2pt-apz8_pa4j.js +0 -1
- package/_next/static/chunks/2rnpgrmuyhpkd.js +0 -119
- package/_next/static/chunks/2w71oj1brox5z.js +0 -1
- package/_next/static/chunks/3e5jmzthktu9w.js +0 -1
- package/_next/static/chunks/3r8nellt-dsed.js +0 -1
- package/_next/static/chunks/3wwn1rti8oc_r.js +0 -1
- package/_next/static/chunks/41odv061mfm6t.js +0 -1
- package/boats/optimist/Scene.jsx +0 -28
- package/boats/optimist/assets/license.txt +0 -11
- package/boats/optimist/assets/scene-transformed.glb +0 -0
- package/boats/sailboat/Scene.jsx +0 -21
- package/boats/sailboat/assets/license.txt +0 -10
- package/boats/sailboat/assets/scene-transformed.glb +0 -0
- package/boats/windsurf/Scene.jsx +0 -22
- package/boats/windsurf/assets/scene-transformed.glb +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_buildManifest.js +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_clientMiddlewareManifest.js +0 -0
- /package/_next/static/{m52l9mE01yTljNwbWjYQ7 → 0nycI4RUzRHiehQwdbDCp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43758,e=>{"use strict";var t=e.i(43476),i=e.i(71645),n=e.i(90072),r=e.i(90874),a=e.i(92923),o=a,s=e.i(30728);class l extends s.LineSegmentsGeometry{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setPositions(i),this}setColors(e){let t=e.length-3,i=new Float32Array(2*t);for(let n=0;n<t;n+=3)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];return super.setColors(i),this}setFromPoints(e){let t=e.length-1,i=new Float32Array(6*t);for(let n=0;n<t;n++)i[6*n]=e[n].x,i[6*n+1]=e[n].y,i[6*n+2]=e[n].z||0,i[6*n+3]=e[n+1].x,i[6*n+4]=e[n+1].y,i[6*n+5]=e[n+1].z||0;return super.setPositions(i),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}var u=e.i(27530);class d extends o.LineSegments2{constructor(e=new l,t=new u.LineMaterial({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let c=e=>e instanceof n.Vector3||e instanceof n.Vector4?[e.x,e.y,e.z]:e instanceof n.Vector2?[e.x,e.y,0]:Array.isArray(e)?2===e.length?[e[0],e[1],0]:[e[0],e[1],e[2]]:[e,0,0],f=e=>e instanceof n.Color?e.toArray():e,h=(0,i.forwardRef)(function({points:e,color:n=0xffffff,vertexColors:o,linewidth:h,lineWidth:p,segments:m,dashed:g,...v},y){let w=(0,r.useThree)(e=>e.size),x=(0,i.useMemo)(()=>m?new a.LineSegments2:new d,[m]),[S]=(0,i.useState)(()=>new u.LineMaterial),b=o?.[0]?.length===4?4:3,M=e.flatMap(c),E=M.join(","),P=o?o.flatMap(f):null,_=P?P.join(","):"",A=(0,i.useMemo)(()=>{let e=m?new s.LineSegmentsGeometry:new l;return e.setPositions(M),P&&e.setColors(P,b),e},[E,_,m,b]);return(0,i.useLayoutEffect)(()=>{x.computeLineDistances()},[A,x]),(0,i.useLayoutEffect)(()=>{g?S.defines.USE_DASH="":delete S.defines.USE_DASH,S.needsUpdate=!0},[g,S]),(0,i.useEffect)(()=>()=>A.dispose(),[A]),(0,i.useEffect)(()=>()=>S.dispose(),[S]),(0,t.jsxs)("primitive",{object:x,ref:y,...v,children:[(0,t.jsx)("primitive",{object:A,attach:"geometry"}),(0,t.jsx)("primitive",{object:S,attach:"material",color:o?0xffffff:n,vertexColors:!!o,resolution:[w.width,w.height],linewidth:h??p??1,dashed:g,transparent:4===b,...v})]})});e.s(["default",0,h],43758)},78461,e=>{"use strict";var t=e.i(71645),i=e.i(85709),n=e.i(67561);let r=["navigation.headingTrue","navigation.headingMagnetic","navigation.courseOverGroundTrue","navigation.courseOverGroundMagnetic","navigation.position"],a=null;e.s(["default",0,()=>{let{convertLatLonToXY:e}=(0,n.useOcearoContext)(),o=(0,i.useSignalKPaths)(r),s=o["navigation.headingTrue"]??o["navigation.headingMagnetic"]??o["navigation.courseOverGroundTrue"]??o["navigation.courseOverGroundMagnetic"],l=Number.isFinite(s),u=o["navigation.position"],d=Number.isFinite(u?.latitude)&&Number.isFinite(u?.longitude);return{heading:l?s:0,offset:(0,t.useMemo)(()=>{if(!d)return{x:0,y:0};let t={lat:u.latitude,lon:u.longitude};return e(t,(a||(a=t),a))},[u,d,e]),hasFix:d,hasHeading:l}},"getSessionOrigin",0,()=>a])},5941,e=>{"use strict";let t=[1,.8,.6];function i(e){return t[Math.min(Math.max(e,0),2)]}function n(e,t){return Math.max(.05,Math.min(1,1-.6*e-.3*t))}function r(e,t){return Math.PI/6*Math.max(0,1-1.9438444924574*t/30)*(1-e)}function a(e,t,i){let n=Math.min(1,1.9438444924574*(e.tws||0)/30),r=t.tension||.5;switch(i){case"mainSheet":return Math.min(1,.5*n+.3*r+.3*t.mainCar);case"jibSheet":return Math.min(1,.5*n+.3*r+.3*t.jibCar);case"vang":return Math.min(1,.6*n+.4*r);case"cunningham":return Math.min(1,.4*n+.6*r);case"backstay":return Math.min(1,Math.max(0,1-Math.abs(Math.atan2(Math.sin(e.awa||0),Math.cos(e.awa||0)))/Math.PI)*n*.9+.3*r);default:return r}}function o(e){let t=Math.max(0,Math.min(1,e));if(t<=.5){let e=2*t;return{r:e,g:1-.3*e,b:0}}return{r:1,g:.7*(1-(t-.5)*2),b:0}}e.s(["getReefHeightFactor",0,i,"tensionToColor",0,o,"updateSailTrim",0,function({tws:e=0,twa:t=0,awa:s=0,mainCar:l=.5,jibCar:u=.5,tension:d=.5}){let c,f=(c=1.9438444924574*e)>25?2:+(c>18),h=i(f),p=n(l,d),m=n(u,d),g=r(l,e),v=r(u,e),y={tws:e,twa:t,awa:s},w={mainCar:l,jibCar:u,tension:d},x={mainSheet:a(y,w,"mainSheet"),jibSheet:a(y,w,"jibSheet"),vang:a(y,w,"vang"),cunningham:a(y,w,"cunningham"),backstay:a(y,w,"backstay")},S={mainSheet:o(x.mainSheet),jibSheet:o(x.jibSheet),vang:o(x.vang),cunningham:o(x.cunningham),backstay:o(x.backstay)};return{reefLevel:f,reefHeightFactor:h,mainCamber:p,jibCamber:m,mainTwist:g,jibTwist:v,tensions:x,tensionColors:S}}])},77291,24752,e=>{"use strict";var t=e.i(71645),i=e.i(62588),n=e.i(85709),r=e.i(61969),a=e.i(539);let o=Math.PI/180,s={power:1,sail:2,fishing:3,restricted:4},l=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 i=Number(e.shipType);return 36===i?"sail":30===i?"fishing":33===i?"restricted":"power"},u=(e,t,i)=>(0,a.wrapPi)(Math.atan2(t.x-e.x,t.y-e.y)-i),d=(e,t,i)=>{let n={x:0,y:0},r=u(n,t,e.course),l=u(t,n,t.course),d=Math.sign(l)||1,c=e=>Math.abs(e)>112.5*o;if(c(r)&&t.speed>e.speed)return{ownRole:"stand-on",rule:"13",reason:"overtakenByTarget",targetTurn:0};if(c(l)&&e.speed>t.speed)return{ownRole:"give-way",rule:"13",reason:"overtaking",targetTurn:0};let f=s[e.category]??1,h=s[t.category]??1;if(f!==h)return f<h?{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(i)){let n=(0,a.wrapPi)(i-e.course)>=0?"starboard":"port";return n!==((0,a.wrapPi)(i-t.course)>=0?"starboard":"port")?"port"===n?{ownRole:"give-way",rule:"12a-i",reason:"portTack",targetTurn:0}:{ownRole:"stand-on",rule:"12a-i",reason:"targetPortTack",targetTurn:d}:t.x*Math.sin(i)+t.y*Math.cos(i)>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,a.wrapPi)(t.course-e.course-Math.PI))<10*o&&Math.abs(r)<6*o?{ownRole:"both",rule:"14",reason:"headOn",targetTurn:1}:r>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,l],24752);var c=e.i(83402),f=e.i(67561);let h=[],p=["navigation.speedOverGround","navigation.courseOverGroundTrue"];e.s(["default",0,({always:e=!1}={})=>{let a,o,{targets:s}=(0,i.useAIS)({passive:!0}),{states:u}=(0,f.useOcearoContext)(),m=u.anchorWatch||u.parkingMode||u.moored,g=(e||u.ais)&&!m?s:h,{twd:v,heading:y}=(0,r.default)(),w=(0,n.useSignalKPaths)(p),x=(a=(0,n.useSignalKPrefix)("propulsion."),o=c.default.get("ownVesselCategory"),(0,t.useMemo)(()=>"sail"===o||"power"===o?o:Object.entries(a).some(([e,t])=>e.endsWith(".revolutions")&&Number(t)>.5||e.endsWith(".state")&&"started"===t)?"power":"sail",[a,o])),S=c.default.get("aisLengthScalingFactor")||.7;return(0,t.useMemo)(()=>{let e=w["navigation.courseOverGroundTrue"]??y,t=w["navigation.speedOverGround"]??0,i=[];if(Number.isFinite(e))for(let n of g){if("danger"!==n.risk)continue;let r=n.cog??n.cogMagnetic??n.heading;if(!Number.isFinite(r)||null===n.sceneX)continue;let a=d({course:e,speed:t,category:x},{x:n.sceneX/S,y:-n.sceneZ/S,course:r,speed:n.sog??0,category:l(n)},v);i.push({target:{...n},role:a})}i.sort((e,t)=>(e.target.tcpaSeconds??1/0)-(t.target.tcpaSeconds??1/0));let n={};for(let e of g)"close"===e.risk?n[e.mmsi]="close":"danger"===e.risk&&(n[e.mmsi]="giveWay");for(let e of i)n[e.target.mmsi]="stand-on"===e.role.ownRole?"yields":"giveWay";let r=i.filter(e=>"stand-on"!==e.role.ownRole);return{ownCategory:x,encounters:i,statuses:n,giveWay:r.length>0,giveWayTo:r[0]||null,primary:i[0]||null}},[g,v,y,w,x,S])}],77291)},61969,e=>{"use strict";var t=e.i(71645),i=e.i(85709),n=e.i(539),r=e.i(37256);let a=180/Math.PI,o=["navigation.speedThroughWater","navigation.speedOverGround","navigation.headingTrue","navigation.courseOverGroundTrue","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.directionTrue","performance.polarSpeed","performance.polarSpeedRatio",...(0,r.coursePaths)("bearingTrue")];e.s(["default",0,()=>{let e=(0,i.useSignalKPaths)(o);return(0,t.useMemo)(()=>{let t=e["navigation.speedThroughWater"]??e["navigation.speedOverGround"]??null,i=e["navigation.headingTrue"]??e["navigation.courseOverGroundTrue"]??null,o=e["environment.wind.speedTrue"]??null,s=e["environment.wind.angleTrueWater"]??null,l=e["environment.wind.directionTrue"]??null;null===l&&Number.isFinite(s)&&Number.isFinite(i)&&(l=(0,n.wrapPi)(i+s));let u=e["performance.polarSpeed"]??(Number.isFinite(o)&&Number.isFinite(s)?(0,n.polarSpeedSi)(o,s):null),d=e["performance.polarSpeedRatio"]??null;null===d&&Number.isFinite(t)&&Number.isFinite(u)&&u>.2&&(d=t/u);let c=Number.isFinite(t)&&Number.isFinite(u)?(t-u)*1.943844:null,f=null,h=null,p=!Number.isFinite(s)||Math.abs(s)<Math.PI/2;if(Number.isFinite(o)){let e=p?(0,n.optimalUpwind)(1.943844*o):(0,n.optimalDownwind)(1.943844*o);e&&(f=e.twa/a,Number.isFinite(l)&&Number.isFinite(s)&&(h=(0,n.wrapPi)(l-Math.sign(s||1)*f)))}let m=(0,r.courseValue)(e,"bearingTrue"),g=null;if(Number.isFinite(m)&&Number.isFinite(l)&&Number.isFinite(o)){let e=(0,n.bestVmcHeading)({twd:l,tws:o,bearing:m}),t=Number.isFinite(i)?(0,n.vmcForHeading)({twd:l,tws:o,bearing:m,heading:i}):null;g=e?{bearing:m,best:e,current:t}:null}return{ratio:d,polarSpeed:u,boatSpeed:t,deltaKn:c,heading:i,twd:l,tws:o,twa:s,targetTwa:f,targetHeading:h,upwind:p,vmc:g}},[e])}])},83646,e=>{"use strict";var t=e.i(67561);e.s(["default",0,()=>(0,t.useOcearoContext)().tokens])},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},60099,e=>{"use strict";let t,i;var n=e.i(31067),r=e.i(71645),a=e.i(88014),o=e.i(90072),s=e.i(90874),l=e.i(95393);let u=new o.Vector3,d=new o.Vector3,c=new o.Vector3,f=new o.Vector2;function h(e,t,i){let n=u.setFromMatrixPosition(e.matrixWorld);n.project(t);let r=i.width/2,a=i.height/2;return[n.x*r+r,-(n.y*a)+a]}let p=e=>1e-10>Math.abs(e)?0:e;function m(e,t,i=""){let n="matrix3d(";for(let i=0;16!==i;i++)n+=p(t[i]*e.elements[i])+(15!==i?",":")");return i+n}let g=(t=[1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1],e=>m(e,t)),v=(i=e=>[1/e,1/e,1/e,1,-1/e,-1/e,-1/e,-1,1/e,1/e,1/e,1,1,1,1,1],(e,t)=>m(e,i(t),"translate(-50%,-50%)")),y=r.forwardRef(({children:e,eps:t=.001,style:i,className:m,prepend:y,center:w,fullscreen:x,portal:S,distanceFactor:b,sprite:M=!1,transform:E=!1,occlude:P,onOcclude:_,castShadow:A,receiveShadow:T,material:z,geometry:U,zIndexRange:L=[0x1000037,0],calculatePosition:F=h,as:B="div",wrapperClass:D,pointerEvents:O="auto",...W},N)=>{let{gl:C,camera:R,scene:I,size:j,raycaster:V,events:H,viewport:G}=(0,s.useThree)(),[k]=r.useState(()=>document.createElement(B)),$=r.useRef(null),K=r.useRef(null),q=r.useRef(0),X=r.useRef([0,0]),Z=r.useRef(null),J=r.useRef(null),Q=(null==S?void 0:S.current)||H.connected||C.domElement.parentNode,Y=r.useRef(null),ee=r.useRef(!1),et=r.useMemo(()=>{var e;return P&&"blending"!==P||Array.isArray(P)&&P.length&&(e=P[0])&&"object"==typeof e&&"current"in e},[P]);r.useLayoutEffect(()=>{let e=C.domElement;P&&"blending"===P?(e.style.zIndex=`${Math.floor(L[0]/2)}`,e.style.position="absolute",e.style.pointerEvents="none"):(e.style.zIndex=null,e.style.position=null,e.style.pointerEvents=null)},[P]),r.useLayoutEffect(()=>{if(K.current){let e=$.current=a.createRoot(k);if(I.updateMatrixWorld(),E)k.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{let e=F(K.current,R,j);k.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${e[0]}px,${e[1]}px,0);transform-origin:0 0;`}return Q&&(y?Q.prepend(k):Q.appendChild(k)),()=>{Q&&Q.removeChild(k),e.unmount()}}},[Q,E]),r.useLayoutEffect(()=>{D&&(k.className=D)},[D]);let ei=r.useMemo(()=>E?{position:"absolute",top:0,left:0,width:j.width,height:j.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:w?"translate3d(-50%,-50%,0)":"none",...x&&{top:-j.height/2,left:-j.width/2,width:j.width,height:j.height},...i},[i,w,x,j,E]),en=r.useMemo(()=>({position:"absolute",pointerEvents:O}),[O]);r.useLayoutEffect(()=>{var t,n;ee.current=!1,E?null==(t=$.current)||t.render(r.createElement("div",{ref:Z,style:ei},r.createElement("div",{ref:J,style:en},r.createElement("div",{ref:N,className:m,style:i,children:e})))):null==(n=$.current)||n.render(r.createElement("div",{ref:N,style:ei,className:m,children:e}))});let er=r.useRef(!0);(0,l.useFrame)(e=>{if(K.current){R.updateMatrixWorld(),K.current.updateWorldMatrix(!0,!1);let e=E?X.current:F(K.current,R,j);if(E||Math.abs(q.current-R.zoom)>t||Math.abs(X.current[0]-e[0])>t||Math.abs(X.current[1]-e[1])>t){var i;let t,n,r,a,s=(i=K.current,t=u.setFromMatrixPosition(i.matrixWorld),n=d.setFromMatrixPosition(R.matrixWorld),r=t.sub(n),a=R.getWorldDirection(c),r.angleTo(a)>Math.PI/2),l=!1;et&&(Array.isArray(P)?l=P.map(e=>e.current):"blending"!==P&&(l=[I]));let h=er.current;l?er.current=function(e,t,i,n){let r=u.setFromMatrixPosition(e.matrixWorld),a=r.clone();a.project(t),f.set(a.x,a.y),i.setFromCamera(f,t);let o=i.intersectObjects(n,!0);if(o.length){let e=o[0].distance;return r.distanceTo(i.ray.origin)<e}return!0}(K.current,R,V,l)&&!s:er.current=!s,h!==er.current&&(_?_(!er.current):k.style.display=er.current?"block":"none");let m=Math.floor(L[0]/2),y=P?et?[L[0],m]:[m-1,0]:L;if(k.style.zIndex=`${function(e,t,i){if(t instanceof o.PerspectiveCamera||t instanceof o.OrthographicCamera){let n=u.setFromMatrixPosition(e.matrixWorld),r=d.setFromMatrixPosition(t.matrixWorld),a=n.distanceTo(r),o=(i[1]-i[0])/(t.far-t.near),s=i[1]-o*t.far;return Math.round(o*a+s)}}(K.current,R,y)}`,E){let[e,t]=[j.width/2,j.height/2],i=R.projectionMatrix.elements[5]*t,{isOrthographicCamera:n,top:r,left:a,bottom:o,right:s}=R,l=g(R.matrixWorldInverse),u=n?`scale(${i})translate(${p(-(s+a)/2)}px,${p((r+o)/2)}px)`:`translateZ(${i}px)`,d=K.current.matrixWorld;M&&((d=R.matrixWorldInverse.clone().transpose().copyPosition(d).scale(K.current.scale)).elements[3]=d.elements[7]=d.elements[11]=0,d.elements[15]=1),k.style.width=j.width+"px",k.style.height=j.height+"px",k.style.perspective=n?"":`${i}px`,Z.current&&J.current&&(Z.current.style.transform=`${u}${l}translate(${e}px,${t}px)`,J.current.style.transform=v(d,1/((b||10)/400)))}else{let t=void 0===b?1:function(e,t){if(t instanceof o.OrthographicCamera)return t.zoom;if(!(t instanceof o.PerspectiveCamera))return 1;{let i=u.setFromMatrixPosition(e.matrixWorld),n=d.setFromMatrixPosition(t.matrixWorld);return 1/(2*Math.tan(t.fov*Math.PI/180/2)*i.distanceTo(n))}}(K.current,R)*b;k.style.transform=`translate3d(${e[0]}px,${e[1]}px,0) scale(${t})`}X.current=e,q.current=R.zoom}}if(!et&&Y.current&&!ee.current)if(E){if(Z.current){let e=Z.current.children[0];if(null!=e&&e.clientWidth&&null!=e&&e.clientHeight){let{isOrthographicCamera:t}=R;if(t||U)W.scale&&(Array.isArray(W.scale)?W.scale instanceof o.Vector3?Y.current.scale.copy(W.scale.clone().divideScalar(1)):Y.current.scale.set(1/W.scale[0],1/W.scale[1],1/W.scale[2]):Y.current.scale.setScalar(1/W.scale));else{let t=(b||10)/400,i=e.clientWidth*t,n=e.clientHeight*t;Y.current.scale.set(i,n,1)}ee.current=!0}}}else{let t=k.children[0];if(null!=t&&t.clientWidth&&null!=t&&t.clientHeight){let e=1/G.factor,i=t.clientWidth*e,n=t.clientHeight*e;Y.current.scale.set(i,n,1),ee.current=!0}Y.current.lookAt(e.camera.position)}});let ea=r.useMemo(()=>({vertexShader:E?void 0:`
|
|
2
|
+
/*
|
|
3
|
+
This shader is from the THREE's SpriteMaterial.
|
|
4
|
+
We need to turn the backing plane into a Sprite
|
|
5
|
+
(make it always face the camera) if "transfrom"
|
|
6
|
+
is false.
|
|
7
|
+
*/
|
|
8
|
+
#include <common>
|
|
9
|
+
|
|
10
|
+
void main() {
|
|
11
|
+
vec2 center = vec2(0., 1.);
|
|
12
|
+
float rotation = 0.0;
|
|
13
|
+
|
|
14
|
+
// This is somewhat arbitrary, but it seems to work well
|
|
15
|
+
// Need to figure out how to derive this dynamically if it even matters
|
|
16
|
+
float size = 0.03;
|
|
17
|
+
|
|
18
|
+
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
|
|
19
|
+
vec2 scale;
|
|
20
|
+
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
|
|
21
|
+
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
|
|
22
|
+
|
|
23
|
+
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
|
|
24
|
+
if ( isPerspective ) scale *= - mvPosition.z;
|
|
25
|
+
|
|
26
|
+
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
|
|
27
|
+
vec2 rotatedPosition;
|
|
28
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
29
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
30
|
+
mvPosition.xy += rotatedPosition;
|
|
31
|
+
|
|
32
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
33
|
+
}
|
|
34
|
+
`,fragmentShader:`
|
|
35
|
+
void main() {
|
|
36
|
+
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
37
|
+
}
|
|
38
|
+
`}),[E]);return r.createElement("group",(0,n.default)({},W,{ref:K}),P&&!et&&r.createElement("mesh",{castShadow:A,receiveShadow:T,ref:Y},U||r.createElement("planeGeometry",null),z||r.createElement("shaderMaterial",{side:o.DoubleSide,vertexShader:ea.vertexShader,fragmentShader:ea.fragmentShader})))});e.s(["Html",0,y])},95393,e=>{"use strict";var t=e.i(61949);e.s(["useFrame",()=>t.F])},92923,30728,27530,e=>{"use strict";let t,i;var n=e.i(90072),r=n;let a=new r.Box3,o=new r.Vector3;class s extends r.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let i=new r.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(i,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new r.WireframeGeometry(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new r.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),a.setFromBufferAttribute(t),this.boundingBox.union(a))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let r=0,a=e.count;r<a;r++)o.fromBufferAttribute(e,r),n=Math.max(n,i.distanceToSquared(o)),o.fromBufferAttribute(t,r),n=Math.max(n,i.distanceToSquared(o));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}e.s(["LineSegmentsGeometry",0,s],30728);var l=e.i(8560),u=n;l.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new u.Vector2},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},l.ShaderLib.line={uniforms:u.UniformsUtils.merge([l.UniformsLib.common,l.UniformsLib.fog,l.UniformsLib.line]),vertexShader:`
|
|
39
|
+
#include <common>
|
|
40
|
+
#include <color_pars_vertex>
|
|
41
|
+
#include <fog_pars_vertex>
|
|
42
|
+
#include <logdepthbuf_pars_vertex>
|
|
43
|
+
#include <clipping_planes_pars_vertex>
|
|
44
|
+
|
|
45
|
+
uniform float linewidth;
|
|
46
|
+
uniform vec2 resolution;
|
|
47
|
+
|
|
48
|
+
attribute vec3 instanceStart;
|
|
49
|
+
attribute vec3 instanceEnd;
|
|
50
|
+
|
|
51
|
+
attribute vec3 instanceColorStart;
|
|
52
|
+
attribute vec3 instanceColorEnd;
|
|
53
|
+
|
|
54
|
+
#ifdef WORLD_UNITS
|
|
55
|
+
|
|
56
|
+
varying vec4 worldPos;
|
|
57
|
+
varying vec3 worldStart;
|
|
58
|
+
varying vec3 worldEnd;
|
|
59
|
+
|
|
60
|
+
#ifdef USE_DASH
|
|
61
|
+
|
|
62
|
+
varying vec2 vUv;
|
|
63
|
+
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#else
|
|
67
|
+
|
|
68
|
+
varying vec2 vUv;
|
|
69
|
+
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#ifdef USE_DASH
|
|
73
|
+
|
|
74
|
+
uniform float dashScale;
|
|
75
|
+
attribute float instanceDistanceStart;
|
|
76
|
+
attribute float instanceDistanceEnd;
|
|
77
|
+
varying float vLineDistance;
|
|
78
|
+
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
float trimSegmentAlpha( const in vec4 start, const in vec4 end ) {
|
|
82
|
+
|
|
83
|
+
// compute the interpolation factor needed to trim the segment so it terminates
|
|
84
|
+
// between the camera plane and the near plane
|
|
85
|
+
|
|
86
|
+
// conservative estimate of the near plane
|
|
87
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
88
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
89
|
+
|
|
90
|
+
// we need different nearEstimate formula for reversed and default depth buffer
|
|
91
|
+
// a is positive with a reversed depth buffer so it can be used for controlling the code flow
|
|
92
|
+
float nearEstimate = ( a > 0.0 ) ? ( - b / ( a + 1.0 ) ) : ( - 0.5 * b / a );
|
|
93
|
+
|
|
94
|
+
return ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
void main() {
|
|
99
|
+
|
|
100
|
+
#ifdef USE_COLOR
|
|
101
|
+
|
|
102
|
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
103
|
+
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
float aspect = resolution.x / resolution.y;
|
|
107
|
+
|
|
108
|
+
// camera space
|
|
109
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
110
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
111
|
+
|
|
112
|
+
#ifdef USE_DASH
|
|
113
|
+
|
|
114
|
+
float lineDistanceStart = dashScale * instanceDistanceStart;
|
|
115
|
+
float lineDistanceEnd = dashScale * instanceDistanceEnd;
|
|
116
|
+
|
|
117
|
+
#endif
|
|
118
|
+
|
|
119
|
+
#ifdef WORLD_UNITS
|
|
120
|
+
|
|
121
|
+
worldStart = start.xyz;
|
|
122
|
+
worldEnd = end.xyz;
|
|
123
|
+
|
|
124
|
+
#else
|
|
125
|
+
|
|
126
|
+
vUv = uv;
|
|
127
|
+
|
|
128
|
+
#endif
|
|
129
|
+
|
|
130
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
131
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
132
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
133
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
134
|
+
|
|
135
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
136
|
+
|
|
137
|
+
if ( perspective ) {
|
|
138
|
+
|
|
139
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
140
|
+
|
|
141
|
+
float alpha = trimSegmentAlpha( start, end );
|
|
142
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
143
|
+
|
|
144
|
+
#ifdef USE_DASH
|
|
145
|
+
|
|
146
|
+
lineDistanceEnd = mix( lineDistanceStart, lineDistanceEnd, alpha );
|
|
147
|
+
|
|
148
|
+
#endif
|
|
149
|
+
|
|
150
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
151
|
+
|
|
152
|
+
float alpha = trimSegmentAlpha( end, start );
|
|
153
|
+
start.xyz = mix( end.xyz, start.xyz, alpha );
|
|
154
|
+
|
|
155
|
+
#ifdef USE_DASH
|
|
156
|
+
|
|
157
|
+
lineDistanceStart = mix( lineDistanceEnd, lineDistanceStart, alpha );
|
|
158
|
+
|
|
159
|
+
#endif
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
#ifdef USE_DASH
|
|
166
|
+
|
|
167
|
+
vLineDistance = ( position.y < 0.5 ) ? lineDistanceStart : lineDistanceEnd;
|
|
168
|
+
vUv = uv;
|
|
169
|
+
|
|
170
|
+
#endif
|
|
171
|
+
|
|
172
|
+
// clip space
|
|
173
|
+
vec4 clipStart = projectionMatrix * start;
|
|
174
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
175
|
+
|
|
176
|
+
// ndc space
|
|
177
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
178
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
179
|
+
|
|
180
|
+
// direction
|
|
181
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
182
|
+
|
|
183
|
+
// account for clip-space aspect ratio
|
|
184
|
+
dir.x *= aspect;
|
|
185
|
+
dir = normalize( dir );
|
|
186
|
+
|
|
187
|
+
#ifdef WORLD_UNITS
|
|
188
|
+
|
|
189
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
190
|
+
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
191
|
+
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
192
|
+
vec3 worldFwd = cross( worldDir, worldUp );
|
|
193
|
+
worldPos = position.y < 0.5 ? start: end;
|
|
194
|
+
|
|
195
|
+
// height offset
|
|
196
|
+
float hw = linewidth * 0.5;
|
|
197
|
+
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
198
|
+
|
|
199
|
+
// don't extend the line if we're rendering dashes because we
|
|
200
|
+
// won't be rendering the endcaps
|
|
201
|
+
#ifndef USE_DASH
|
|
202
|
+
|
|
203
|
+
// cap extension
|
|
204
|
+
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
205
|
+
|
|
206
|
+
// add width to the box
|
|
207
|
+
worldPos.xyz += worldFwd * hw;
|
|
208
|
+
|
|
209
|
+
// endcaps
|
|
210
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
211
|
+
|
|
212
|
+
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
213
|
+
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
#endif
|
|
217
|
+
|
|
218
|
+
// project the worldpos
|
|
219
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
220
|
+
|
|
221
|
+
// shift the depth of the projected points so the line
|
|
222
|
+
// segments overlap neatly
|
|
223
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
224
|
+
clip.z = clipPose.z * clip.w;
|
|
225
|
+
|
|
226
|
+
#else
|
|
227
|
+
|
|
228
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
229
|
+
// undo aspect ratio adjustment
|
|
230
|
+
dir.x /= aspect;
|
|
231
|
+
offset.x /= aspect;
|
|
232
|
+
|
|
233
|
+
// sign flip
|
|
234
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
235
|
+
|
|
236
|
+
// endcaps
|
|
237
|
+
if ( position.y < 0.0 ) {
|
|
238
|
+
|
|
239
|
+
offset += - dir;
|
|
240
|
+
|
|
241
|
+
} else if ( position.y > 1.0 ) {
|
|
242
|
+
|
|
243
|
+
offset += dir;
|
|
244
|
+
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// adjust for linewidth
|
|
248
|
+
offset *= linewidth;
|
|
249
|
+
|
|
250
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
251
|
+
offset /= resolution.y;
|
|
252
|
+
|
|
253
|
+
// select end
|
|
254
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
255
|
+
|
|
256
|
+
// back to clip space
|
|
257
|
+
offset *= clip.w;
|
|
258
|
+
|
|
259
|
+
clip.xy += offset;
|
|
260
|
+
|
|
261
|
+
#endif
|
|
262
|
+
|
|
263
|
+
gl_Position = clip;
|
|
264
|
+
|
|
265
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
266
|
+
|
|
267
|
+
#include <logdepthbuf_vertex>
|
|
268
|
+
#include <clipping_planes_vertex>
|
|
269
|
+
#include <fog_vertex>
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
`,fragmentShader:`
|
|
273
|
+
uniform vec3 diffuse;
|
|
274
|
+
uniform float opacity;
|
|
275
|
+
uniform float linewidth;
|
|
276
|
+
|
|
277
|
+
#ifdef USE_DASH
|
|
278
|
+
|
|
279
|
+
uniform float dashOffset;
|
|
280
|
+
uniform float dashSize;
|
|
281
|
+
uniform float gapSize;
|
|
282
|
+
|
|
283
|
+
#endif
|
|
284
|
+
|
|
285
|
+
varying float vLineDistance;
|
|
286
|
+
|
|
287
|
+
#ifdef WORLD_UNITS
|
|
288
|
+
|
|
289
|
+
varying vec4 worldPos;
|
|
290
|
+
varying vec3 worldStart;
|
|
291
|
+
varying vec3 worldEnd;
|
|
292
|
+
|
|
293
|
+
#ifdef USE_DASH
|
|
294
|
+
|
|
295
|
+
varying vec2 vUv;
|
|
296
|
+
|
|
297
|
+
#endif
|
|
298
|
+
|
|
299
|
+
#else
|
|
300
|
+
|
|
301
|
+
varying vec2 vUv;
|
|
302
|
+
|
|
303
|
+
#endif
|
|
304
|
+
|
|
305
|
+
#include <common>
|
|
306
|
+
#include <color_pars_fragment>
|
|
307
|
+
#include <fog_pars_fragment>
|
|
308
|
+
#include <logdepthbuf_pars_fragment>
|
|
309
|
+
#include <clipping_planes_pars_fragment>
|
|
310
|
+
|
|
311
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
312
|
+
|
|
313
|
+
float mua;
|
|
314
|
+
float mub;
|
|
315
|
+
|
|
316
|
+
vec3 p13 = p1 - p3;
|
|
317
|
+
vec3 p43 = p4 - p3;
|
|
318
|
+
|
|
319
|
+
vec3 p21 = p2 - p1;
|
|
320
|
+
|
|
321
|
+
float d1343 = dot( p13, p43 );
|
|
322
|
+
float d4321 = dot( p43, p21 );
|
|
323
|
+
float d1321 = dot( p13, p21 );
|
|
324
|
+
float d4343 = dot( p43, p43 );
|
|
325
|
+
float d2121 = dot( p21, p21 );
|
|
326
|
+
|
|
327
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
328
|
+
|
|
329
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
330
|
+
|
|
331
|
+
mua = numer / denom;
|
|
332
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
333
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
334
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
335
|
+
|
|
336
|
+
return vec2( mua, mub );
|
|
337
|
+
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
void main() {
|
|
341
|
+
|
|
342
|
+
float alpha = opacity;
|
|
343
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
344
|
+
|
|
345
|
+
#include <clipping_planes_fragment>
|
|
346
|
+
|
|
347
|
+
#ifdef USE_DASH
|
|
348
|
+
|
|
349
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
350
|
+
|
|
351
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
352
|
+
|
|
353
|
+
#endif
|
|
354
|
+
|
|
355
|
+
#ifdef WORLD_UNITS
|
|
356
|
+
|
|
357
|
+
// Find the closest points on the view ray and the line segment
|
|
358
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
359
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
360
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
361
|
+
|
|
362
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
363
|
+
vec3 p2 = rayEnd * params.y;
|
|
364
|
+
vec3 delta = p1 - p2;
|
|
365
|
+
float len = length( delta );
|
|
366
|
+
float norm = len / linewidth;
|
|
367
|
+
|
|
368
|
+
#ifndef USE_DASH
|
|
369
|
+
|
|
370
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
371
|
+
|
|
372
|
+
float dnorm = fwidth( norm );
|
|
373
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
374
|
+
|
|
375
|
+
#else
|
|
376
|
+
|
|
377
|
+
if ( norm > 0.5 ) {
|
|
378
|
+
|
|
379
|
+
discard;
|
|
380
|
+
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
#endif
|
|
384
|
+
|
|
385
|
+
#endif
|
|
386
|
+
|
|
387
|
+
#else
|
|
388
|
+
|
|
389
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
390
|
+
|
|
391
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
392
|
+
float a = vUv.x;
|
|
393
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
394
|
+
float len2 = a * a + b * b;
|
|
395
|
+
float dlen = fwidth( len2 );
|
|
396
|
+
|
|
397
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
398
|
+
|
|
399
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
400
|
+
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
#else
|
|
404
|
+
|
|
405
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
406
|
+
|
|
407
|
+
float a = vUv.x;
|
|
408
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
409
|
+
float len2 = a * a + b * b;
|
|
410
|
+
|
|
411
|
+
if ( len2 > 1.0 ) discard;
|
|
412
|
+
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
#endif
|
|
416
|
+
|
|
417
|
+
#endif
|
|
418
|
+
|
|
419
|
+
#include <logdepthbuf_fragment>
|
|
420
|
+
#include <color_fragment>
|
|
421
|
+
|
|
422
|
+
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
423
|
+
|
|
424
|
+
#include <tonemapping_fragment>
|
|
425
|
+
#include <colorspace_fragment>
|
|
426
|
+
#include <fog_fragment>
|
|
427
|
+
#include <premultiplied_alpha_fragment>
|
|
428
|
+
|
|
429
|
+
}
|
|
430
|
+
`};class d extends u.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:u.UniformsUtils.clone(l.ShaderLib.line.uniforms),vertexShader:l.ShaderLib.line.vertexShader,fragmentShader:l.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){!0===e!==this.worldUnits&&(this.needsUpdate=!0),!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){!0===e!==this.dashed&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(!0===e!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===e?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}e.s(["LineMaterial",0,d],27530);let c=new n.Vector4,f=new n.Vector3,h=new n.Vector3,p=new n.Vector4,m=new n.Vector4,g=new n.Vector4,v=new n.Vector3,y=new n.Matrix4,w=new n.Line3,x=new n.Vector3,S=new n.Box3,b=new n.Sphere,M=new n.Vector4;function E(e,t,n){return M.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),M.multiplyScalar(1/M.w),M.x=i/n.width,M.y=i/n.height,M.applyMatrix4(e.projectionMatrixInverse),M.multiplyScalar(1/M.w),Math.abs(Math.max(M.x,M.y))}class P extends n.Mesh{constructor(e=new s,t=new d({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,r=new Float32Array(2*t.count);for(let e=0,n=0,a=t.count;e<a;e++,n+=2)f.fromBufferAttribute(t,e),h.fromBufferAttribute(i,e),r[n]=0===n?0:r[n-1],r[n+1]=r[n]+f.distanceTo(h);let a=new n.InstancedInterleavedBuffer(r,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(a,1,1)),this}raycast(e,r){let a,o,s=this.material.worldUnits,l=e.camera;if(null!==l||s||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),!1===s&&(0===this.material.resolution.x||0===this.material.resolution.y))return;let u=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let d=this.matrixWorld,c=this.geometry,f=this.material;if(i=f.linewidth+u,null===c.boundingSphere&&c.computeBoundingSphere(),b.copy(c.boundingSphere).applyMatrix4(d),s)a=.5*i;else{let e=Math.max(l.near,b.distanceToPoint(t.origin));a=E(l,e,f.resolution)}if(b.radius+=a,!1!==t.intersectsSphere(b)){if(null===c.boundingBox&&c.computeBoundingBox(),S.copy(c.boundingBox).applyMatrix4(d),s)o=.5*i;else{let e=Math.max(l.near,S.distanceToPoint(t.origin));o=E(l,e,f.resolution)}S.expandByScalar(o),!1!==t.intersectsBox(S)&&(s?function(e,r){let a=e.matrixWorld,o=e.geometry,s=o.attributes.instanceStart,l=o.attributes.instanceEnd,u=Math.min(o.instanceCount,s.count);for(let o=0;o<u;o++){w.start.fromBufferAttribute(s,o),w.end.fromBufferAttribute(l,o),w.applyMatrix4(a);let u=new n.Vector3,d=new n.Vector3;t.distanceSqToSegment(w.start,w.end,d,u),d.distanceTo(u)<.5*i&&r.push({point:d,pointOnLine:u,distance:t.origin.distanceTo(d),object:e,face:null,faceIndex:o,uv:null,uv1:null})}}(this,r):function(e,r,a){let o=r.projectionMatrix,s=e.material.resolution,l=e.matrixWorld,u=e.geometry,d=u.attributes.instanceStart,c=u.attributes.instanceEnd,f=Math.min(u.instanceCount,d.count),h=-r.near;t.at(1,g),g.w=1,g.applyMatrix4(r.matrixWorldInverse),g.applyMatrix4(o),g.multiplyScalar(1/g.w),g.x*=s.x/2,g.y*=s.y/2,g.z=0,v.copy(g),y.multiplyMatrices(r.matrixWorldInverse,l);for(let r=0;r<f;r++){if(p.fromBufferAttribute(d,r),m.fromBufferAttribute(c,r),p.w=1,m.w=1,p.applyMatrix4(y),m.applyMatrix4(y),p.z>h&&m.z>h)continue;if(p.z>h){let e=p.z-m.z,t=(p.z-h)/e;p.lerp(m,t)}else if(m.z>h){let e=m.z-p.z,t=(m.z-h)/e;m.lerp(p,t)}p.applyMatrix4(o),m.applyMatrix4(o),p.multiplyScalar(1/p.w),m.multiplyScalar(1/m.w),p.x*=s.x/2,p.y*=s.y/2,m.x*=s.x/2,m.y*=s.y/2,w.start.copy(p),w.start.z=0,w.end.copy(m),w.end.z=0;let u=w.closestPointToPointParameter(v,!0);w.at(u,x);let f=n.MathUtils.lerp(p.z,m.z,u),g=f>=-1&&f<=1,S=v.distanceTo(x)<.5*i;if(g&&S){w.start.fromBufferAttribute(d,r),w.end.fromBufferAttribute(c,r),w.start.applyMatrix4(l),w.end.applyMatrix4(l);let i=new n.Vector3,o=new n.Vector3;t.distanceSqToSegment(w.start,w.end,o,i),a.push({point:o,pointOnLine:i,distance:t.origin.distanceTo(o),object:e,face:null,faceIndex:r,uv:null,uv1:null})}}}(this,l,r))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(c),this.material.uniforms.resolution.value.set(c.z,c.w))}}e.s(["LineSegments2",0,P],92923)},74452,(e,t,i)=>{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 i=180/Math.PI,n=t.default.vpp,r=(e,t,i)=>e+(t-e)*i,a=(e,t)=>{if(t<=e[0])return[0,0];let i=e.length-1;if(t>=e[i])return[i-1,1];let n=0;for(;t>e[n+1];)n++;return[n,(t-e[n])/(e[n+1]-e[n])]},o=n.speeds.map((e,t)=>(e=>{let t=n.beat_angle[e],r=n.run_angle[e],a=n.beat_vmg[e]/Math.cos(t/i),o=n.run_vmg[e]/Math.abs(Math.cos(r/i)),s=[[0,0],[.7*t,.55*a],[t,a]];for(let i of n.angles)i>t&&i<r&&s.push([i,n[String(i)][e]]);return s.push([r,o]),r<180&&s.push([180,n.run_vmg[e]]),s})(t)),s=(e,t)=>{let[i,n]=a(e.map(e=>e[0]),t);return r(e[i][1],e[i+1][1],n)},l=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0)return null;let i=Math.min(180,Math.abs((t+540)%360-180)),l=n.speeds;if(e<l[0])return s(o[0],i)*(e/l[0]);let[u,d]=a(l,e);return r(s(o[u],i),s(o[u+1],i),d)},u=(e,t)=>{let[i,o]=a(n.speeds,t);return r(e[i],e[i+1],o)},d=(e,t)=>{let n=l(1.943844*e,t*i);return null===n?null:n/1.943844},c=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:n})=>{if(![e,t,n].every(Number.isFinite)||t<=0)return null;let r=null;for(let a=-100;a<=100;a++){let o=n+a/i,s=d(t,c(e-o));if(null===s)continue;let l=s*Math.cos(o-n);(!r||l>r.vmc)&&(r={heading:c(o),speed:s,vmc:l})}return r},"optimalDownwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(n.run_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:-r*Math.cos(t/i)}},"optimalUpwind",0,e=>{if(!Number.isFinite(e)||e<=0)return null;let t=u(n.beat_angle,e),r=l(e,t);return{twa:t,speed:r,vmg:r*Math.cos(t/i)}},"polarSpeed",0,l,"polarSpeedSi",0,d,"vmcForHeading",0,({twd:e,tws:t,bearing:i,heading:n})=>{if(![e,t,i,n].every(Number.isFinite))return null;let r=d(t,c(e-n));return null===r?null:r*Math.cos(n-i)},"wrapPi",0,c])}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,76103,e=>{"use strict";var t=e.i(43476),o=e.i(71645),a=e.i(67561),s=e.i(49721),n=e.i(68757),l=e.i(83402),i=e.i(46991),r=e.i(48390),d=e.i(46932),c=e.i(88653);e.i(85269);var u=e.i(22831),m=e.i(44485),x=e.i(30206);let b=()=>{let{t:e,i18n:a}=(0,u.useTranslation)(),[l,i]=(0,o.useState)(null),[r,d]=(0,o.useState)(null),[c,b]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=!1;return(0,m.listVoyages)().then(t=>{e||i(t)}).catch(t=>{e||(d(t.message),i([]))}),()=>{e=!0}},[]);let p=(0,o.useCallback)(async e=>{b(e.id);try{let t=await (0,m.getSamples)(e.start,e.end);(0,x.startReplay)(e,t)}finally{b(null)}},[]),h=new Intl.DateTimeFormat(a.language,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});return(0,t.jsxs)("div",{className:"p-4 flex flex-col gap-4",children:[(0,t.jsxs)("h3",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRoute,className:"mr-2 text-oBlue text-xs"}),e("replay.voyages")]}),(0,t.jsx)("p",{className:"text-caption text-hud-muted max-w-prose",children:e("replay.explain")}),r&&(0,t.jsx)("div",{className:"text-caption text-oRed",children:r}),l&&0===l.length&&(0,t.jsx)("div",{className:"tesla-card p-4 text-label text-hud-secondary",children:e("replay.none")}),(0,t.jsx)("ul",{className:"flex flex-col gap-2",children:l?.map(o=>{let a;return(0,t.jsxs)("li",{className:"tesla-card px-4 py-3 flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-label font-semibold text-hud-main",children:h.format(new Date(o.start))}),(0,t.jsxs)("div",{className:"text-caption text-hud-muted tabular-nums",children:[(a=Math.round((o.end-o.start)/6e4))<60?`${a} min`:`${Math.floor(a/60)} h ${String(a%60).padStart(2,"0")}`," · ",(o.distanceM/1852).toFixed(1)," NM · ",e("replay.max")," ",(1.943844*o.maxSog).toFixed(1)," kn"]})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>p(o),disabled:c===o.id,className:"bg-oBlue hover:bg-oBlue/80 text-white px-3 py-1.5 rounded text-caption font-semibold uppercase flex items-center gap-2 disabled:opacity-50",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faPlay}),e("replay.replay")]})]},o.id)})})]})};e.s(["default",0,()=>{let e,m,x,p,h,g,f,y,v,N,{t:j}=(0,u.useTranslation)(),{states:w,toggleState:k,getSignalKValue:C}=(0,a.useOcearoContext)(),S=w?.racing??!1,[F,A]=(0,o.useState)("logbook"),T=(0,o.useMemo)(()=>["navigation.position","navigation.courseOverGroundTrue","navigation.headingTrue","navigation.speedOverGround","environment.wind.speedTrue","environment.wind.angleTrueWater","environment.wind.speedApparent","environment.wind.angleApparent","environment.outside.pressure","environment.outside.temperature","environment.depth.belowKeel","environment.depth.belowTransducer","navigation.log","propulsion.main.runTime"],[]),B=(0,o.useCallback)(()=>Object.fromEntries(T.map(e=>[e,C(e)])),[T,C]),[R,O]=(0,o.useState)([]),[G,I]=(0,o.useState)(!1),[$,E]=(0,o.useState)(null),[D,L]=(0,o.useState)("UTC"),P=(0,o.useMemo)(()=>({row:new Intl.DateTimeFormat("en-GB",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",timeZone:D}),day:new Intl.DateTimeFormat("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric",timeZone:D}),time:new Intl.DateTimeFormat("fr-FR",{hour:"2-digit",minute:"2-digit",timeZone:D})}),[D]),[Y,M]=(0,o.useState)(null),[K,W]=(0,o.useState)(!1),[z,J]=(0,o.useState)({text:"",author:"manual"}),[U,V]=(0,o.useState)(!1),[Z,_]=(0,o.useState)(null),[H,q]=(0,o.useState)(null),[Q,X]=(0,o.useState)(!1);l.default.getAll();let ee=(0,r.isOcearoCoreEnabled)(),et=(0,o.useCallback)(async()=>{I(!0),E(null);try{let e=(await (0,r.fetchLogbookEntries)()).map(e=>{let t=e.point||("number"==typeof e.position?.latitude?e.position:null);return{...e,date:new Date(e.datetime||e.date),point:t?{...t,toString:()=>"number"==typeof t.latitude&&"number"==typeof t.longitude?`${t.latitude.toFixed(6)}, ${t.longitude.toFixed(6)}`:"Invalid coordinates"}:null}});O(e)}catch(e){"NetworkError"!==e.name&&"TimeoutError"!==e.name&&console.warn("Error fetching logbook entries:",e),E((0,r.handleOcearoCoreError)(e,"Logbook fetch")),l.default.get("debugMode")?O(eo()):O([])}finally{I(!1)}},[]),eo=()=>[{datetime:new Date().toISOString(),date:new Date,course:45,speed:{sog:6.5},wind:{speed:12,direction:180},observations:{seaState:2,cloudCoverage:3,visibility:7},barometer:1013.2,point:{latitude:46.1591,longitude:-1.1522,toString:()=>"46.159100, -1.152200"},position:{source:"GPS",latitude:46.1591,longitude:-1.1522},log:125.5,engine:{hours:245.2},author:"Captain",text:"Departing La Rochelle, good conditions"},{datetime:new Date(Date.now()-36e5).toISOString(),date:new Date(Date.now()-36e5),heading:42,speed:{sog:7.2},wind:{speed:15,direction:200},observations:{seaState:3,cloudCoverage:2,visibility:8},barometer:1012.8,point:{latitude:46.2591,longitude:-1.2522,toString:()=>"46.259100, -1.252200"},position:{source:"GPS",latitude:46.2591,longitude:-1.2522},log:132.1,engine:{hours:245.8},author:"auto",text:"Wind picking up, adjusting course"}],ea=(0,o.useCallback)(()=>{M(null),J({text:"",author:"manual"}),W(!0)},[]),es=(0,o.useCallback)(async()=>{let e=B();try{let t;if(Y)t={...Y,author:z.author||Y.author||"manual",text:z.text||Y.text||"Manual entry"},delete t.date,delete t.point;else{let o=e["navigation.position"]||{},a=e["navigation.headingTrue"],s=e["environment.wind.speedTrue"],n=e["environment.wind.speedApparent"],l=null==s,r=l?e["environment.wind.angleApparent"]:e["environment.wind.angleTrueWater"],d={},c=(0,i.msToKnots)(l?n:s);if(null!==c&&(d.speed=c),null!=a&&null!=r){let e=(0,i.toDegrees)(a+r);null!==e&&(d.direction=e)}l&&Object.keys(d).length&&(d.apparent=!0);let u=e["environment.depth.belowKeel"]??e["environment.depth.belowTransducer"],m=e["navigation.log"],x=e["propulsion.main.runTime"];t={datetime:new Date().toISOString(),position:{latitude:o.latitude||46.1591,longitude:o.longitude||-1.1522,source:"GPS"},course:(0,i.toDegrees)(e["navigation.courseOverGroundTrue"]??a),speed:{sog:(0,i.msToKnots)(e["navigation.speedOverGround"])},wind:d,barometer:(0,i.convertPressure)(e["environment.outside.pressure"]),log:Number.isFinite(m)?parseFloat((m/1852).toFixed(1)):null,depth:Number.isFinite(u)?parseFloat(u.toFixed(1)):null,engine:{hours:Number.isFinite(x)?parseFloat((x/3600).toFixed(1)):null},author:z.author||"manual",text:z.text||"Manual entry"}}await (0,r.addLogbookEntry)(t),W(!1),M(null),et()}catch(e){console.warn("Error saving entry:",e),E((0,r.handleOcearoCoreError)(e,"Save logbook entry"))}},[B,et,z,Y]),en=(0,o.useCallback)(async()=>{let e=B();if(!ee)return void E(j("logbook.ocearoCoreNotEnabled"));try{X(!0),E(null);let t={position:e["navigation.position"],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"]},o=await (0,r.generateOcearoCoreLogbookEntry)(t);await et(),o&&o.analysis&&(_(o.analysis),q("auto-entry"),A("analysis"))}catch(e){E((0,r.handleOcearoCoreError)(e,"OcearoCore entry generation"))}finally{X(!1)}},[ee,B,et,j]),el=(0,o.useCallback)(async e=>{if(!ee)return void E(j("logbook.ocearoCoreNotEnabled"));try{V(!0),_(null),q(e),E(null),A("analysis");let t=await (0,r.requestAnalysis)(e);_(t),console.log("OcearoCore Analysis:",t)}catch(e){E((0,r.handleOcearoCoreError)(e,"OcearoCore analysis"))}finally{V(!1)}},[ee,j]),ei=(0,o.useCallback)(async()=>{if(!ee)return void E(j("logbook.ocearoCoreNotEnabled"));try{V(!0),_(null),q("logbook"),E(null),A("analysis");let e=await (0,r.analyzeLogbookWithOcearoCore)();_(e),console.log("Logbook Analysis:",e)}catch(e){E((0,r.handleOcearoCoreError)(e,"Logbook analysis"))}finally{V(!1)}},[ee,j]),er=(0,o.useCallback)(e=>{M(e),J({text:e.text||"",author:e.author||"manual"}),W(!0)},[]),ed=(e,t="")=>Number.isFinite(e)?`${e}${t}`:"",ec=e=>Number.isFinite(e.course)?`${e.course}\xb0`:Number.isFinite(e.heading)?`HDT ${e.heading}\xb0`:"";(0,o.useEffect)(()=>{et()},[et]);let eu={safety:{color:"text-oRed",border:"border-oRed/40",bg:"bg-oRed/10"},alert:{color:"text-oRed",border:"border-oRed/40",bg:"bg-oRed/10"},weather:{color:"text-oYellow",border:"border-oYellow/40",bg:"bg-oYellow/10"},startup_analysis:{color:"text-oGreen",border:"border-oGreen/40",bg:"bg-oGreen/10"},briefing:{color:"text-oGreen",border:"border-oGreen/40",bg:"bg-oGreen/10"},racing:{color:"text-oYellow",border:"border-oYellow/40",bg:"bg-oYellow/10"},maintenance:{color:"text-oYellow",border:"border-oYellow/40",bg:"bg-oYellow/10"},hourly_entry:{color:"text-oBlue",border:"border-oBlue/40",bg:"bg-oBlue/10"},navigation:{color:"text-oBlue",border:"border-oBlue/40",bg:"bg-oBlue/10"},default:{color:"text-hud-secondary",border:"border-hud",bg:"bg-hud-elevated"}};return(0,t.jsxs)("div",{className:"flex flex-col h-full bg-rightPaneBg overflow-hidden",children:[ee&&(0,t.jsxs)("div",{className:`flex items-center justify-between px-4 py-2 border-b transition-all duration-500 ${S?"bg-oYellow/10 border-oYellow/30":"bg-hud-bg border-hud"}`,children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faTrophy,className:`text-xs transition-colors duration-300 ${S?"text-oYellow animate-soft-pulse":"text-hud-muted"}`}),(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-main",children:S?j("logbook.racingModeActive"):j("logbook.racingMode")}),S&&(0,t.jsxs)("span",{className:"text-caption font-semibold uppercase tracking-widest text-oYellow opacity-70",children:["— ",j("logbook.racingModeAISInfo")]})]}),(0,t.jsx)("button",{onClick:()=>k("racing"),className:`relative inline-flex h-5 w-10 items-center rounded-full transition-colors duration-300 focus:outline-none ${S?"bg-oYellow":"bg-hud-elevated border border-hud"}`,"aria-label":j("logbook.racingMode"),children:(0,t.jsx)("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-hud-main shadow transition-transform duration-300 ${S?"translate-x-5":"translate-x-1"}`})})]}),(0,t.jsx)("div",{className:"flex border-b border-hud bg-hud-bg overflow-x-auto scrollbar-hide",children:[{id:"timeline",label:j("logbook.missionTimeline"),icon:n.faTimeline},{id:"logbook",label:j("logbook.tacticalLog"),icon:n.faBook},{id:"analysis",label:j("logbook.fleetIntelligence"),icon:n.faChartLine},{id:"voyages",label:j("replay.voyages"),icon:n.faRoute}].map(e=>(0,t.jsxs)("button",{onClick:()=>A(e.id),className:`flex-1 py-3 px-3 whitespace-nowrap text-caption font-semibold uppercase flex items-center justify-center transition-all duration-500 ${F===e.id?"text-oGreen border-b-2 border-oGreen bg-hud-bg":"text-hud-secondary hover:text-hud-main tesla-hover"}`,children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:e.icon,className:"mr-2"}),e.label]},e.id))}),(0,t.jsx)("div",{className:"flex-1 flex flex-col min-h-0",children:(0,t.jsx)(c.AnimatePresence,{mode:"wait",children:(0,t.jsxs)(d.motion.div,{initial:{opacity:0,x:10},animate:{opacity:1,x:0},exit:{opacity:0,x:-10},transition:{duration:.4,ease:"easeOut"},className:"h-full overflow-auto scrollbar-hide",children:["logbook"===F&&(0,t.jsxs)("div",{className:"p-4 flex flex-col h-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("h3",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faBook,className:"mr-2 text-oBlue text-xs"}),j("logbook.logbookEntries")]}),(0,t.jsxs)("div",{className:"flex space-x-3",children:[ee&&(0,t.jsxs)("button",{className:"bg-oGreen/10 text-oGreen hover:bg-oGreen/20 px-3 py-1.5 rounded text-caption font-semibold uppercase transition-all duration-300 flex items-center shadow-soft border border-oGreen/20 disabled:opacity-50",onClick:en,disabled:Q||G,children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRobot,className:`mr-2 ${Q?"animate-spin":""}`}),Q?j("logbook.aiEntryGenerating"):j("logbook.aiEntry")]}),(0,t.jsxs)("button",{className:"bg-oBlue hover:bg-oBlue/80 text-hud-main px-3 py-1.5 rounded text-caption font-semibold uppercase transition-all duration-300 flex items-center shadow-soft",onClick:ea,disabled:G,children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faPlus,className:"mr-2"}),j("logbook.add")]})]})]}),$&&(0,t.jsx)("div",{className:"bg-oRed/10 text-oRed p-3 rounded text-caption font-semibold uppercase mb-4 animate-soft-pulse border border-oRed/20",children:$}),(0,t.jsx)("div",{className:"tesla-card flex-1 overflow-auto ",children:(0,t.jsxs)("table",{className:"w-full text-caption font-semibold uppercase tracking-tight",children:[(0,t.jsx)("thead",{className:"sticky top-0 bg-hud-bg backdrop-blur-md z-10",children:(0,t.jsxs)("tr",{className:"text-hud-secondary border-b border-hud",children:[(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.time")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.courseCol")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.sog")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.weatherCol")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.baro")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.depth")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.position")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.log")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.eng")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.by")}),(0,t.jsx)("th",{className:"p-3 text-left",children:j("logbook.noteCol")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-hud",children:R.map((e,o)=>(0,t.jsxs)("tr",{onClick:()=>er(e),className:"tesla-hover cursor-pointer text-hud-main",children:[(0,t.jsx)("td",{className:"p-3 whitespace-nowrap opacity-60",children:P.row.format(e.date)}),(0,t.jsx)("td",{className:"p-3 gliding-value",children:ec(e)}),(0,t.jsx)("td",{className:"p-3 gliding-value",children:ed(e.speed?.sog,"kt")}),(0,t.jsx)("td",{className:"p-3 text-hud-secondary font-bold normal-case whitespace-nowrap",children:(e=>{let t=[];if(e.wind){let o=[];Number.isFinite(e.wind.speed)&&o.push(`${e.wind.speed}kt`),Number.isFinite(e.wind.direction)&&o.push(`${e.wind.direction}\xb0`),o.length&&t.push(`${e.wind.apparent?j("logbook.windApparentShort"):""}${o.join(" ")}`.trim())}return e.observations&&(Number.isFinite(e.observations.seaState)&&t.push(j("logbook.seaStateShort",{value:e.observations.seaState})),Number.isFinite(e.observations.cloudCoverage)&&t.push(`☁ ${e.observations.cloudCoverage}/8`),Number.isFinite(e.observations.visibility)&&t.push(j("logbook.visibilityShort",{value:e.observations.visibility+1}))),t.join(" · ")})(e)}),(0,t.jsx)("td",{className:"p-3 gliding-value opacity-60",children:ed(e.barometer)}),(0,t.jsx)("td",{className:"p-3 gliding-value",children:ed(e.depth,"m")}),(0,t.jsx)("td",{className:"p-3 text-caption text-hud-muted font-mono tracking-tighter",children:e.point?e.point.toString():"n/a"}),(0,t.jsx)("td",{className:"p-3 gliding-value",children:ed(e.log,"NM")}),(0,t.jsx)("td",{className:"p-3 gliding-value",children:ed(e.engine?.hours,"h")}),(0,t.jsx)("td",{className:"p-3 text-oBlue opacity-80",children:e.author||"auto"}),(0,t.jsx)("td",{className:"p-3 normal-case font-bold text-hud-secondary truncate max-w-xs",children:e.text})]},e.datetime||o))})]})})]}),"voyages"===F&&(0,t.jsx)(b,{}),"timeline"===F&&(()=>{let e=[...R].reverse(),o=[];for(let t of e){let e=P.day.format(t.date),a=o[o.length-1];a&&a.day===e?a.items.push(t):o.push({day:e,items:[t]})}return o.reverse(),(0,t.jsxs)("div",{className:"p-4 space-y-6",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-6",children:[(0,t.jsxs)("h3",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faTimeline,className:"mr-2 text-oGreen text-xs"}),j("logbook.cruiseTimeline")]}),(0,t.jsxs)("div",{className:"flex space-x-3",children:[ee&&(0,t.jsxs)("button",{className:"bg-oGreen/10 text-oGreen hover:bg-oGreen/20 px-3 py-1.5 rounded text-caption font-semibold uppercase transition-all duration-300 flex items-center shadow-soft border border-oGreen/20 disabled:opacity-50",onClick:en,disabled:Q||G,children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRobot,className:`mr-2 ${Q?"animate-spin":""}`}),Q?j("logbook.aiEntryGenerating"):j("logbook.aiAuto")]}),(0,t.jsxs)("button",{className:"bg-oBlue hover:bg-oBlue/80 text-hud-main px-3 py-1.5 rounded text-caption font-semibold uppercase transition-all duration-300 flex items-center shadow-soft",onClick:ea,disabled:G,children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faPlus,className:"mr-2"}),j("logbook.add")]})]})]}),$&&(0,t.jsx)("div",{className:"bg-oRed/10 text-oRed p-3 rounded text-caption font-semibold uppercase mb-4 animate-soft-pulse border border-oRed/20",children:$}),(0,t.jsx)("div",{className:"space-y-6",children:o.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-3",children:[(0,t.jsx)("div",{className:"w-2 h-2 rounded-full bg-oBlue mr-3"}),(0,t.jsx)("span",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest",children:e.day}),(0,t.jsx)("div",{className:"flex-1 h-px bg-hud-border ml-4 opacity-40"}),(0,t.jsx)("span",{className:"text-caption font-semibold text-hud-muted ml-3",children:e.items.length})]}),(0,t.jsx)("div",{className:"space-y-2 ml-1 pl-4 border-l border-hud",children:e.items.map((e,o)=>{let a=e.entryType||e.analysis?.type||"default",s=eu[a]||eu.default,n=(e=>{let t=[],o=ec(e);if(o&&t.push({label:j("logbook.courseCol"),value:o}),Number.isFinite(e.speed?.sog)&&t.push({label:j("logbook.speed"),value:`${e.speed.sog}kt`}),Number.isFinite(e.wind?.speed)){let o=Number.isFinite(e.wind.direction)?` ${e.wind.direction}\xb0`:"";t.push({label:j("logbook.weatherCol"),value:`${e.wind.speed}kt${o}`})}return Number.isFinite(e.barometer)&&t.push({label:j("logbook.baro"),value:`${e.barometer}`}),Number.isFinite(e.depth)&&t.push({label:j("logbook.depth"),value:`${e.depth}m`}),Number.isFinite(e.log)&&t.push({label:j("logbook.log"),value:`${e.log}NM`}),Number.isFinite(e.engine?.hours)&&t.push({label:j("logbook.eng"),value:`${e.engine.hours}h`}),e.point&&"number"==typeof e.point.latitude&&t.push({label:j("logbook.coord"),value:e.point.toString(),mono:!0}),t})(e);return(0,t.jsxs)("div",{onClick:()=>er(e),className:"tesla-card tesla-hover cursor-pointer group",children:[(0,t.jsxs)("div",{className:"px-4 py-2 flex justify-between items-center border-b border-hud",children:[(0,t.jsxs)("div",{className:"flex items-center min-w-0 gap-3",children:[(0,t.jsx)("span",{className:"text-label font-semibold text-hud-main tracking-tight",children:P.time.format(e.date)}),(0,t.jsx)("span",{className:`px-2 py-0.5 rounded-sm text-caption font-semibold uppercase tracking-widest border ${s.color} ${s.border} ${s.bg}`,children:j(`logbook.types.${a}`,{defaultValue:a.replace(/_/g," ")})})]}),(0,t.jsx)("div",{className:"text-caption font-semibold text-hud-muted uppercase tracking-tighter truncate ml-3",children:e.author||"system"})]}),(0,t.jsxs)("div",{className:"p-4",children:[e.text&&(0,t.jsx)("div",{className:"text-caption font-bold text-hud-secondary normal-case leading-relaxed mb-3",children:e.text}),n.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-caption font-semibold uppercase tracking-tight text-hud-secondary",children:n.map(e=>(0,t.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,t.jsx)("span",{className:"text-hud-dim",children:e.label}),(0,t.jsx)("span",{className:`text-hud-main ${e.mono?"font-mono text-caption":"gliding-value"}`,children:e.value})]},e.label))})]})]},e.datetime||o)})})]},e.day))})]})})(),"analysis"===F&&(0,t.jsxs)("div",{className:"p-4 space-y-6",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsxs)("h3",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest flex items-center mb-2",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faChartLine,className:"mr-2 text-oBlue text-xs"}),j("logbook.fleetIntelligence")]}),(0,t.jsx)("p",{className:"text-hud-secondary text-caption font-semibold uppercase tracking-tighter",children:j("logbook.aiPoweredAnalysis")})]}),ee&&(0,t.jsxs)("div",{className:"tesla-card mb-6 ",children:[(0,t.jsx)("h4",{className:"text-caption font-semibold text-hud-secondary mb-4 uppercase tracking-widest",children:j("logbook.selectOperation")}),(0,t.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[{id:"logbook",label:"LOGBOOK",icon:n.faBook,color:"bg-oBlue",action:ei},{id:"weather",label:"WEATHER",icon:n.faCloudSun,color:"bg-oBlue",action:()=>el("weather")},{id:"sail",label:"SAIL",icon:n.faCompass,color:"bg-oGreen",action:()=>el("sail")},{id:"alerts",label:"ALERTS",icon:n.faRobot,color:"bg-oRed",action:()=>el("alerts")},{id:"status",label:"STATUS",icon:n.faTachometerAlt,color:"bg-hud-muted",action:()=>el("status")},{id:"racing",label:j("logbook.racingAdvice"),icon:n.faTrophy,color:S?"bg-oYellow":"bg-oYellow/40",action:()=>el("racing")}].map(e=>(0,t.jsxs)("button",{className:"tesla-card tesla-hover flex flex-col items-center justify-center space-y-3 group ",onClick:e.action,disabled:U,children:[(0,t.jsx)("div",{className:`${e.color} w-10 h-10 rounded-full flex items-center justify-center shadow-lg group-hover:scale-110 transition-transform duration-500`,children:(0,t.jsx)(s.FontAwesomeIcon,{icon:e.icon,className:"text-hud-main text-sm"})}),(0,t.jsx)("span",{className:"text-caption font-semibold text-hud-main tracking-widest",children:e.label})]},e.id))})]}),$&&(0,t.jsx)("div",{className:"bg-oRed/10 text-oRed p-3 rounded text-caption font-semibold uppercase mb-4 animate-soft-pulse border border-oRed/20",children:$}),U&&(0,t.jsxs)("div",{className:"tesla-card text-center ",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRobot,className:"text-4xl text-oGreen mb-6 animate-soft-pulse"}),(0,t.jsx)("h4",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest mb-4",children:j("logbook.neuralProcessing")}),(0,t.jsx)("div",{className:"w-48 mx-auto bg-hud-elevated h-1 rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"bg-oGreen h-full animate-progress-indefinite rounded-full",style:{width:"40%"}})}),(0,t.jsxs)("p",{className:"text-hud-muted text-caption font-semibold uppercase mt-4 tracking-tighter italic",children:[j("logbook.processNode")," ",H]})]}),Z&&!U&&(e=Z.analysis&&"object"==typeof Z.analysis?Z.analysis:null,m="string"==typeof Z.analysis?Z.analysis:null,x=void 0!==Z.settings&&!Z.analysis,p=m||e?.text||e?.summary||Z.aiAnalysis||("string"==typeof Z.summary?Z.summary:null)||x&&(Z.settings?.analysis?.speech||Z.course?.analysis?.speech)||null,h=Z.speechText||("string"==typeof Z.speech?Z.speech:null)||e?.speech||(x?Z.settings?.analysis?.speech||Z.course?.analysis?.speech:null),f=Array.isArray(g=Z.recommendations||e?.recommendations||(x&&Z.settings?.adjustments?.length>0?Z.settings.adjustments.map(e=>e.action||e.message||JSON.stringify(e)):null))?g:null,v=Array.isArray(y=Z.insights||e?.expertAdvice)?y:null,N=Z.data||Z.weatherData||Z.assessment||(x?{course:Z.course,settings:Z.settings}:null),(0,t.jsxs)("div",{className:"tesla-card animate-fade-in",children:[(0,t.jsxs)("div",{className:"flex items-center mb-6 border-b border-hud pb-4",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faChartLine,className:"text-oGreen mr-3 text-sm"}),(0,t.jsxs)("h4",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest",children:[j("logbook.operationReport")," ",H]})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[p&&(0,t.jsxs)("div",{className:"tesla-card border-l-2 border-oBlue/30 ",children:[(0,t.jsx)("h5",{className:"text-caption font-semibold text-oBlue mb-3 uppercase tracking-widest",children:j("logbook.executiveSummary")}),(0,t.jsx)("p",{className:"text-hud-secondary text-caption font-bold leading-relaxed italic normal-case",children:p})]}),(v||f)&&(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[v&&(0,t.jsxs)("div",{className:"tesla-card ",children:[(0,t.jsxs)("h5",{className:"text-caption font-semibold text-oBlue mb-3 uppercase tracking-widest flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRobot,className:"mr-2 text-xs"}),j("logbook.strategicInsights")]}),(0,t.jsx)("ul",{className:"space-y-2",children:v.map((e,o)=>{let a="string"==typeof e?e:e&&"object"==typeof e?e.text||e.message||e.insight||JSON.stringify(e):String(e);return(0,t.jsxs)("li",{className:"text-caption font-bold text-hud-secondary normal-case flex items-start",children:[(0,t.jsx)("span",{className:"text-oBlue mr-2 opacity-50",children:"›"}),a]},o)})})]}),f&&(0,t.jsxs)("div",{className:"tesla-card ",children:[(0,t.jsxs)("h5",{className:"text-caption font-semibold text-oGreen mb-3 uppercase tracking-widest flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faChartLine,className:"mr-2 text-xs"}),j("logbook.operationalAdvice")]}),(0,t.jsx)("ul",{className:"space-y-2",children:f.map((e,o)=>{let a;return a="string"==typeof e?e:e&&"object"==typeof e?"string"==typeof e.message?e.message:e.message&&"object"==typeof e.message?e.message.message||e.text||e.action||JSON.stringify(e.message):e.text||e.action||JSON.stringify(e):String(e),(0,t.jsxs)("li",{className:"text-caption font-bold text-hud-secondary normal-case flex items-start",children:[(0,t.jsx)("span",{className:"text-oGreen mr-2 opacity-50",children:"✓"}),a]},o)})})]})]}),h&&(0,t.jsxs)("div",{className:"bg-oBlue/5 p-4 rounded-sm border border-oBlue/10 shadow-soft",children:[(0,t.jsxs)("h5",{className:"text-caption font-semibold text-oBlue mb-2 uppercase tracking-widest flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRobot,className:"mr-2 animate-soft-pulse"}),j("logbook.voiceTelemetry")]}),(0,t.jsx)("p",{className:"text-hud-secondary text-caption font-bold leading-relaxed italic normal-case",children:h})]}),N&&(0,t.jsxs)("div",{className:"tesla-card ",children:[(0,t.jsx)("h5",{className:"text-caption font-semibold text-hud-secondary mb-3 uppercase tracking-widest",children:j("logbook.rawTelemetryData")}),(0,t.jsx)("pre",{className:"text-oGreen/70 text-caption font-mono overflow-auto max-h-40 font-bold scrollbar-thin",children:JSON.stringify(N,null,2)})]}),Z.timestamp&&(0,t.jsxs)("div",{className:"text-hud-dim text-caption font-semibold text-right uppercase tracking-tighter",children:[j("logbook.generated")," ",new Date(Z.timestamp).toLocaleString()," ","// OCEAROCORE V2.4"]})]})]})),!Z&&!U&&(0,t.jsx)("div",{className:"tesla-card text-center ",children:(0,t.jsxs)("div",{className:"text-hud-muted",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faRobot,size:"3x",className:"mb-6 opacity-20"}),(0,t.jsx)("h4",{className:"text-caption font-semibold text-hud-main uppercase tracking-widest mb-3",children:j("logbook.diagnosticReady")}),(0,t.jsx)("p",{className:"text-caption font-semibold uppercase tracking-tight max-w-xs mx-auto leading-relaxed",children:j("logbook.diagnosticReadyDesc")})]})})]})]},F)})}),K&&(0,t.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",onClick:()=>W(!1),children:(0,t.jsxs)("div",{className:"bg-hud-bg backdrop-blur-xl rounded-3xl p-6 sm:p-8 max-w-md w-full mx-4 shadow-2xl border border-hud max-h-[90vh] overflow-y-auto",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-8",children:[(0,t.jsxs)("h3",{className:"text-value font-semibold text-hud-main flex items-center tracking-tight",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faBook,className:"mr-3 text-oBlue"}),Y?j("logbook.editEntry"):j("logbook.manualEntry")]}),(0,t.jsx)("button",{onClick:()=>W(!1),className:"w-10 h-10 rounded-full flex items-center justify-center text-hud-secondary hover:text-hud-main hover:bg-hud-elevated transition-all duration-300",children:(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faTimes,size:"lg"})})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-caption font-semibold uppercase tracking-widest text-hud-secondary mb-2 flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faUser,className:"mr-2 text-oBlue"}),j("logbook.author")]}),(0,t.jsx)("input",{type:"text",value:z.author,onChange:e=>J({...z,author:e.target.value}),className:"w-full bg-hud-elevated text-hud-main px-4 py-3 rounded-xl border border-hud focus:border-oBlue focus:outline-none transition-all duration-300 font-bold",placeholder:j("logbook.authorPlaceholder")})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-caption font-semibold uppercase tracking-widest text-hud-secondary mb-2 flex items-center",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faStickyNote,className:"mr-2 text-oYellow"}),j("logbook.note")]}),(0,t.jsx)("textarea",{value:z.text,onChange:e=>J({...z,text:e.target.value}),className:"w-full bg-hud-elevated text-hud-main px-4 py-3 rounded-xl border border-hud focus:border-oBlue focus:outline-none transition-all duration-300 font-bold min-h-[120px]",placeholder:j("logbook.notePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex justify-end space-x-4 pt-6 border-t border-hud",children:[(0,t.jsx)("button",{onClick:()=>W(!1),className:"px-6 py-3 bg-hud-elevated hover:bg-hud-bg text-hud-main font-bold rounded-xl transition-all duration-300",children:j("logbook.cancel")}),(0,t.jsxs)("button",{onClick:es,className:"px-8 py-3 bg-oBlue hover:bg-oBlue/80 text-hud-main font-bold rounded-xl transition-all duration-300 flex items-center shadow-lg shadow-oBlue/20",children:[(0,t.jsx)(s.FontAwesomeIcon,{icon:n.faPlus,className:"mr-2"}),j("logbook.saveEntry")]})]})]})]})})]})}],76103)},70127,function(e){e.n(e.i(76103))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,50124,e=>{"use strict";var t=e.i(43476),a=e.i(71645),n=e.i(49721),r=e.i(68757),l=e.i(46991),i=e.i(85709);e.i(85269);var o=e.i(22831);let s={waterTemp:{key:"waterTemp",path:"environment.water.temperature",icon:r.faWater,labelKey:"temperature.waterTemperature",format:e=>`${e}${(0,l.getTemperatureUnitLabel)()}`,transform:l.convertTemperatureUnit},airTemp:{key:"airTemp",path:"environment.outside.temperature",icon:r.faThermometerHalf,labelKey:"temperature.airTemperature",format:e=>`${e}${(0,l.getTemperatureUnitLabel)()}`,transform:l.convertTemperatureUnit},engineRoomTemp:{key:"engineRoomTemp",path:"environment.inside.engineRoom.temperature",icon:r.faFire,labelKey:"temperature.engineRoomTemperature",format:e=>`${e}${(0,l.getTemperatureUnitLabel)()}`,transform:l.convertTemperatureUnit},lazaretteTemp:{key:"lazaretteTemp",path:"environment.inside.lazarette.temperature",icon:r.faThermometerHalf,labelKey:"temperature.lazaretteTemperature",format:e=>`${e}${(0,l.getTemperatureUnitLabel)()}`,transform:l.convertTemperatureUnit},fridgeTemp:{key:"fridgeTemp",path:"environment.inside.fridge.temperature",icon:r.faSnowflake,labelKey:"temperature.fridgeTemperature",format:e=>`${e}${(0,l.getTemperatureUnitLabel)()}`,transform:l.convertTemperatureUnit}},u=({mode:e,value:a,icon:r})=>{let{t:l}=(0,o.useTranslation)();if(!a&&0!==a)return null;let i=l(s[e].labelKey);return(0,t.jsxs)("div",{className:"flex items-center flex-shrink-0 space-x-2 sm:space-x-3 px-2 sm:px-3 py-1.5 transition-all duration-300 text-hud-main",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:r,className:"text-base sm:text-lg opacity-80"}),(0,t.jsxs)("div",{className:"flex flex-col flex-shrink-0",children:[(0,t.jsx)("span",{className:"ocearo-large-label text-caption font-semibold uppercase tracking-widest text-hud-muted leading-none mb-1",children:i.split(" ")[0]}),(0,t.jsx)("span",{className:"text-label sm:text-value lg:text-label xl:text-value font-bold tracking-tight leading-none whitespace-nowrap",children:s[e].format(a)})]})]})},c=()=>{let{t:e}=(0,o.useTranslation)(),[n,r]=(0,a.useState)([]),[l,c]=(0,a.useState)(null),m=(0,a.useMemo)(()=>Object.values(s).map(e=>e.path),[]),d=(0,i.useSignalKPaths)(m),p=(0,a.useMemo)(()=>Object.entries(s).reduce((e,[t,a])=>{let n=d[a.path];return e[t]=null!==n?a.transform(n):null,e},{}),[d]);(0,a.useEffect)(()=>{let e=Object.entries(p).filter(([e,t])=>null!==t).map(([e])=>e);r(e),e.length>0&&!e.includes(l)&&c(e[0])},[p,l]);let f=(0,a.useCallback)(()=>{if(n.length<=1)return;let e=(n.indexOf(l)+1)%n.length;c(n[e])},[n,l]);return 0===n.length?null:(0,t.jsx)("div",{className:"cursor-pointer flex items-center group",onClick:f,title:`Toggle Temperature Display (${n.length} sensors available)`,role:"button",tabIndex:0,onKeyPress:e=>"Enter"===e.key&&f(),"aria-label":e(l?s[l].labelKey:"common.na"),children:l&&(0,t.jsx)(u,{mode:l,value:p[l],icon:s[l].icon})})};e.i(67561);let m={pressure:{key:"pressure",path:"environment.outside.pressure",icon:r.faCloud,labelKey:"environmental.pressure",format:e=>`${e} hPa`,transform:l.convertPressure},humidity:{key:"humidity",path:"environment.inside.relativeHumidity",icon:r.faDroplet,labelKey:"environmental.humidity",format:e=>`${e.toFixed(1)}%`,transform:e=>100*e},voc:{key:"voc",path:"environment.inside.voc",icon:r.faWind,labelKey:"environmental.voc",format:e=>`${Math.round(e)} kΩ`,transform:e=>e/1e3},co2:{key:"co2",path:"environment.inside.co2",icon:r.faLungs,labelKey:"environmental.co2",format:e=>`${Math.round(e)} ppm`,transform:e=>e},pm25:{key:"pm25",path:"environment.inside.pm25",icon:r.faSmog,labelKey:"environmental.pm25",format:e=>`${Math.round(e)} \xb5g/m\xb3`,transform:e=>e},dewPoint:{key:"dewPoint",path:"environment.inside.dewPoint",icon:r.faTemperatureLow,labelKey:"environmental.dewPoint",format:e=>`${e.toFixed(1)}${(0,l.getTemperatureUnitLabel)()}`,transform:l.convertTemperatureUnit},outsideHumidity:{key:"outsideHumidity",path:"environment.outside.relativeHumidity",icon:r.faDroplet,labelKey:"environmental.outsideHumidity",format:e=>`${Math.round(e)}%`,transform:e=>100*e},uvIndex:{key:"uvIndex",path:"environment.outside.uvIndex",icon:r.faSun,labelKey:"environmental.uvIndex",format:e=>e.toFixed(1),transform:e=>e},visibility:{key:"visibility",path:"environment.outside.visibility",icon:r.faEye,labelKey:"environmental.visibility",format:e=>`${e>=10?Math.round(e):e.toFixed(1)} NM`,transform:e=>e/1852}},d=({mode:e,value:a,icon:r})=>{let{t:l}=(0,o.useTranslation)();return a||0===a?(0,t.jsxs)("div",{className:"flex items-center flex-shrink-0 space-x-2 sm:space-x-3 px-2 sm:px-3 py-1.5 transition-all duration-300 text-hud-main",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:r,className:"text-base sm:text-lg opacity-80"}),(0,t.jsxs)("div",{className:"flex flex-col flex-shrink-0",children:[(0,t.jsx)("span",{className:"ocearo-large-label text-caption font-semibold uppercase tracking-widest text-hud-muted leading-none mb-1",children:l(m[e].labelKey)}),(0,t.jsx)("span",{className:"text-label sm:text-value font-bold tracking-tight leading-none whitespace-nowrap",children:m[e].format(a)})]})]}):null},p=()=>{let[e,n]=(0,a.useState)([]),[r,l]=(0,a.useState)(null),o=(0,a.useMemo)(()=>Object.values(m).map(e=>e.path),[]),s=(0,i.useSignalKPaths)(o),u=(0,a.useMemo)(()=>Object.entries(m).reduce((e,[t,a])=>{let n=s[a.path];return e[t]=null!=n?a.transform(n):null,e},{}),[s]);(0,a.useEffect)(()=>{let e=Object.entries(u).filter(([e,t])=>null!==t).map(([e])=>e);n(e),e.length>0&&!e.includes(r)&&l(e[0])},[u,r]);let c=(0,a.useCallback)(()=>{if(e.length<=1)return;let t=(e.indexOf(r)+1)%e.length;l(e[t])},[e,r]);return 0===e.length?null:(0,t.jsx)("div",{className:"cursor-pointer flex items-center group",onClick:c,title:`Toggle Environmental Display (${e.length} modes available)`,role:"button",tabIndex:0,onKeyPress:e=>"Enter"===e.key&&c(),children:r&&(0,t.jsx)(d,{mode:r,value:u[r],icon:m[r].icon})})};var f=e.i(74080),h=e.i(66799),x=e.i(71029);let b=()=>{let{t:e}=(0,o.useTranslation)(),l=(0,x.useMobSupport)(),i=(0,x.useActiveMobs)(),[s,u]=(0,a.useState)(!1),[c,m]=(0,a.useState)(!1),[d,p]=(0,a.useState)(null),b=(0,a.useRef)(null),v=(0,a.useRef)(null);if((0,a.useEffect)(()=>()=>{clearTimeout(b.current),clearTimeout(v.current)},[]),!l.raise)return null;let g=(e,t=!1)=>{clearTimeout(v.current),p({text:e,isError:t}),v.current=setTimeout(()=>p(null),4e3)},y=async()=>{m(!0);try{await h.default.raiseMob(),p(null)}catch(t){g(e("mob.raiseFailed",{error:t?.message||t}),!0)}finally{m(!1)}},w=()=>{c||b.current||(u(!0),b.current=setTimeout(()=>{b.current=null,u(!1),y()},1e3))},k=()=>{b.current&&(clearTimeout(b.current),b.current=null,u(!1),g(e("mob.holdHint")))},T=i.length>0;return(0,t.jsxs)("div",{className:"flex-shrink-0",children:[(0,t.jsxs)("button",{type:"button",onPointerDown:w,onPointerUp:k,onPointerLeave:k,onPointerCancel:k,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||e.repeat||(e.preventDefault(),w())},onKeyUp:e=>{("Enter"===e.key||" "===e.key)&&k()},onContextMenu:e=>e.preventDefault(),disabled:c,className:"text-oRed flex flex-col items-center justify-center p-1 sm:p-2 rounded-xl tesla-hover transition-all duration-300 group select-none touch-none disabled:opacity-60","aria-label":e("mob.buttonLabel"),title:e("mob.holdHint"),children:[(0,t.jsxs)("div",{className:`relative w-7 h-7 sm:w-10 sm:h-10 flex items-center justify-center rounded-full overflow-hidden border-2 border-oRed ${T?"animate-pulse bg-oRed/30":""}`,children:[(0,t.jsx)("span",{className:`absolute inset-0 rounded-full bg-oRed origin-center ${s?"scale-100 duration-1000 ease-linear":"scale-0 duration-150"} transition-transform`,"aria-hidden":"true"}),(0,t.jsx)(n.FontAwesomeIcon,{icon:r.faLifeRing,className:`relative text-base sm:text-xl ${s?"text-white":""}`})]}),(0,t.jsx)("span",{className:"ocearo-large-label text-caption font-semibold uppercase tracking-[0.2em] mt-1",children:e("mob.short")})]}),d&&(0,f.createPortal)((0,t.jsx)("div",{role:"status",className:`fixed bottom-20 left-4 max-w-[20rem] px-3 py-2 rounded-lg border text-label z-50 shadow-lg ${d.isError?"bg-oRed text-white border-oRed":"bg-hud-elevated text-hud-main border-hud"}`,children:d.text}),document.body)]})};var v=e.i(83402),g=e.i(48390);let y=["off","safety","all"],w={off:{icon:r.faVolumeHigh,badgeColor:null},safety:{icon:r.faShieldHalved,badgeColor:"bg-oYellow"},all:{icon:r.faVolumeXmark,badgeColor:"bg-oRed"}},k=({icon:e,onClick:a,label:r,textColor:l,badgeColor:i,wideOnly:o})=>(0,t.jsxs)("button",{onClick:a,className:`${l} ${o?"hidden lg:flex":"flex"} flex-shrink-0 flex-col items-center justify-center p-1 sm:p-2 rounded-xl tesla-hover transition-all duration-300 group relative`,"aria-label":r,children:[(0,t.jsxs)("div",{className:"w-7 h-7 sm:w-10 sm:h-10 flex items-center justify-center rounded-lg group-hover:bg-hud-elevated transition-colors relative",children:[(0,t.jsx)(n.FontAwesomeIcon,{icon:e,className:"text-base sm:text-xl group-hover:scale-110 transition-transform"}),i&&(0,t.jsx)("span",{className:`absolute top-0 right-0 w-2.5 h-2.5 rounded-full border-2 border-leftPaneBg ${i} animate-pulse`})]}),(0,t.jsx)("span",{className:"ocearo-large-label text-caption font-semibold uppercase tracking-[0.2em] mt-1 opacity-60 group-hover:opacity-100 transition-opacity",children:r})]});e.s(["default",0,({setRightView:e,toggleLayout:n,toggleAppMenu:l})=>{let{t:i}=(0,o.useTranslation)(),[s,u]=(0,a.useState)("off");(0,a.useEffect)(()=>{if(!(0,g.isOcearoCoreEnabled)())return;let e=!1,t=async()=>{try{let t=await (0,g.getOcearoCoreDnd)();!e&&t?.mode&&u(t.mode)}catch(e){}};t();let a=setInterval(t,3e4);return()=>{e=!0,clearInterval(a)}},[]);let m=async()=>{let e=y[(y.indexOf(s)+1)%y.length];u(e);try{await (0,g.setOcearoCoreDnd)(e)}catch(e){console.warn("Failed to set DND mode:",e),u(s)}},d=v.default.getAll(),f=d.debugMode?"bg-oYellow":d.signalKUrlSet?null:"bg-oBlue",h=[{section:"left",items:[{icon:r.faShip,onClick:()=>n(),label:i("nav.view")},...(0,g.isOcearoCoreEnabled)()?[{icon:w[s].icon,onClick:m,label:i(`nav.dnd.${s}`),badgeColor:w[s].badgeColor}]:[]]},{section:"center",items:[{icon:r.faMapMarkedAlt,onClick:()=>e("navigation"),wideOnly:!0,label:i("nav.nav")},{icon:r.faCloudSun,onClick:()=>e("weather"),wideOnly:!0,label:i("nav.weather")},{icon:r.faTh,onClick:l,badgeColor:f,label:i("nav.apps")},{icon:r.faTachometerAlt,onClick:()=>e("dashboard"),wideOnly:!0,label:i("nav.dashboard")},{icon:r.faHandsHelping,onClick:()=>e("manual"),wideOnly:!0,label:i("nav.help")}]}],x=e=>{let a=h.find(t=>t.section===e);return a?a.items.map((a,n)=>(0,t.jsx)(k,{icon:a.icon,onClick:a.onClick,label:a.label,textColor:"text-hud-main",badgeColor:a.badgeColor,wideOnly:a.wideOnly},`${e}-${n}`)):null};return(0,t.jsxs)("div",{className:"flex items-center justify-between w-full h-full bg-leftPaneBg px-1 sm:px-6 overflow-x-auto overflow-y-hidden scrollbar-hide",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-0.5 sm:space-x-3 xl:space-x-6 flex-shrink-0 sm:flex-1 min-w-0",children:[x("left"),(0,t.jsx)(b,{}),(0,t.jsx)("div",{className:"hidden sm:block h-8 w-[1px] bg-hud-muted opacity-20 mx-1 sm:mx-2"}),(0,t.jsx)("div",{className:"flex min-w-0 overflow-hidden",children:(0,t.jsx)(c,{})})]}),(0,t.jsx)("div",{className:"flex flex-shrink-0 items-center justify-center space-x-0.5 sm:space-x-3 xl:space-x-8 px-1 sm:px-0",children:x("center")}),(0,t.jsx)("div",{className:"hidden sm:flex items-center justify-end space-x-0.5 sm:space-x-3 xl:space-x-6 flex-shrink-0 sm:flex-1 min-w-0 overflow-hidden",children:(0,t.jsx)(p,{})})]})}],50124)},61891,function(e){e.n(e.i(50124))},71029,e=>{"use strict";var t=e.i(71645),a=e.i(85709),n=e.i(66799),r=e.i(46991);let l="notifications.mob",i=e=>e*Math.PI/180;e.s(["distanceAndBearing",0,(e,t)=>{if(!Number.isFinite(e?.latitude)||!Number.isFinite(e?.longitude)||!Number.isFinite(t?.latitude)||!Number.isFinite(t?.longitude))return null;let a=i(e.latitude),n=i(t.latitude),l=i(t.longitude-e.longitude),o=Math.sin((n-a)/2)**2+Math.cos(a)*Math.cos(n)*Math.sin(l/2)**2;return{distance:2*r.EARTH_RADIUS_METERS*Math.asin(Math.min(1,Math.sqrt(o))),bearing:(180*Math.atan2(Math.sin(l)*Math.cos(n),Math.cos(a)*Math.sin(n)-Math.sin(a)*Math.cos(n)*Math.cos(l))/Math.PI+360)%360}},"useActiveMobs",0,()=>{let e=(0,a.useSignalKPrefix)(l);return(0,t.useMemo)(()=>Object.entries(e).filter(([e,t])=>(e===l||e.startsWith(`${l}.`))&&t?.state&&"normal"!==t.state).map(([e,t])=>({...t,path:e})).sort((e,t)=>String(e.createdAt??"").localeCompare(String(t.createdAt??""))),[e])},"useMobSupport",0,()=>{let e=(()=>{let[e,a]=(0,t.useState)(null);return(0,t.useEffect)(()=>{let e=!1,t=null,r=async()=>{let l=await n.default.getFeatures();e||(l?a(l):t=setTimeout(r,3e4))};return r(),()=>{e=!0,clearTimeout(t)}},[]),e})();return(0,t.useMemo)(()=>({raise:!!e?.apis.includes("notifications"),navigate:!!e?.apis.includes("course")}),[e])}],71029)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,14922,37917,e=>{"use strict";var t=e.i(43476),i=e.i(71645);e.s(["default",0,({title:e,right:i,className:s="",children:n})=>(0,t.jsxs)("div",{className:`hud-halo px-1 py-1 select-none ${s}`,children:[(e||i)&&(0,t.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted",children:e}),i]}),n]})],14922);let s=({values:e,width:i=240,height:s=60,color:n="var(--color-oBlue)",marker:l=null,endDot:a=!1,invert:r=!1})=>{let d=e.filter(Number.isFinite);if(d.length<2)return(0,t.jsx)("svg",{width:i,height:s});let c=Math.min(...d),u=Math.max(...d)-c||1,h=i/(e.length-1),o=e=>(r?(e-c)/u:1-(e-c)/u)*(s-8)+4,x="";e.forEach((e,t)=>{Number.isFinite(e)&&(x+=`${x?"L":"M"}${(t*h).toFixed(1)},${o(e).toFixed(1)}`)});let m=`${x}L${i},${r?0:s}L0,${r?0:s}Z`,p=null;if(null!==l){let t=l*(e.length-1),s=Math.min(e.length-2,Math.floor(t)),n=e[s],a=e[s+1];Number.isFinite(n)&&Number.isFinite(a)&&(p={x:l*i,y:o(n+(a-n)*(t-s))})}let f=e[e.length-1];return(0,t.jsxs)("svg",{width:i,height:s,className:"block overflow-visible",children:[(0,t.jsx)("path",{d:m,fill:n,opacity:"0.12"}),(0,t.jsx)("path",{d:x,fill:"none",stroke:n,strokeWidth:"2",strokeLinejoin:"round"}),null!==l&&(0,t.jsx)("line",{x1:l*i,x2:l*i,y1:"0",y2:s,stroke:"var(--hud-text-main)",strokeWidth:"1.5"}),p&&(0,t.jsx)("circle",{cx:p.x,cy:p.y,r:"4",fill:n,stroke:"var(--hud-text-main)",strokeWidth:"1.5"}),a&&Number.isFinite(f)&&(0,t.jsx)("circle",{cx:i,cy:o(f),r:"3.5",fill:n})]})},n=e=>{let n=(0,i.useRef)(null),[l,a]=(0,i.useState)(0);return(0,i.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>a(Math.floor(e.contentRect.width)));return t.observe(e),()=>t.disconnect()},[]),(0,t.jsx)("div",{ref:n,className:"w-full",style:{height:e.height},children:l>0&&(0,t.jsx)(s,{...e,width:l})})};e.s(["default",0,({fluid:e=!1,...i})=>e?(0,t.jsx)(n,{...i}):(0,t.jsx)(s,{...i})],37917)},14077,e=>{"use strict";var t=e.i(43476),i=e.i(71645);e.i(85269);var s=e.i(22831),n=e.i(85709),l=e.i(46991),a=e.i(14922),r=e.i(37917);let d=["environment.wind.speedTrue","environment.wind.speedApparent","environment.wind.directionTrue"],c=({from:e,size:i=14})=>(0,t.jsx)("svg",{width:i,height:i,viewBox:"-8 -8 16 16",className:"inline-block shrink-0",style:{transform:`rotate(${(180*e/Math.PI+180)%360}deg)`},children:(0,t.jsx)("path",{d:"M0,-7 L5,5 L0,2 L-5,5 Z",fill:"currentColor"})});e.s(["default",0,({compact:e=!1})=>{let{t:u}=(0,s.useTranslation)(),h=(0,n.useSignalKPaths)(d),o=h["environment.wind.speedTrue"],x=!Number.isFinite(o),m=x?h["environment.wind.speedApparent"]:o,p=h["environment.wind.directionTrue"],f=(0,i.useRef)(m),[v,j]=(0,i.useState)([]);if((0,i.useEffect)(()=>{f.current=m},[m]),(0,i.useEffect)(()=>{let e=setInterval(()=>{let e=f.current;Number.isFinite(e)&&j(t=>[...t.slice(-119),e])},5e3);return()=>clearInterval(e)},[]),!Number.isFinite(m))return e?null:(0,t.jsx)(a.default,{title:u("hud.wind"),className:"w-[17rem]",children:(0,t.jsx)("span",{className:"text-value font-semibold text-hud-muted",children:"--"})});let N=(0,l.getSpeedUnitLabel)(),b=(0,l.convertSpeedUnit)(m),g=v.length?(0,l.convertSpeedUnit)(Math.max(...v,m)):null,w=Number.isFinite(g)&&Number.isFinite(b)&&g-b>=1,y=Number.isFinite(p)&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-caption font-semibold text-hud-secondary whitespace-nowrap",children:[(0,t.jsx)(c,{from:p}),Math.round((180*p/Math.PI%360+360)%360),"°"]}),F=u(x?"hud.windApparent":"hud.wind");return e?(0,t.jsxs)("div",{className:"tesla-card !p-3 !rounded-2xl select-none",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"text-caption font-semibold uppercase tracking-widest text-hud-muted truncate",children:F}),y]}),(0,t.jsxs)("div",{className:"flex items-baseline gap-1",children:[(0,t.jsx)("span",{className:"text-value font-semibold leading-tight text-hud-main",children:b?.toFixed(1)}),(0,t.jsx)("span",{className:"text-caption text-hud-secondary",children:N})]}),(0,t.jsx)(r.default,{fluid:!0,values:v,height:22,endDot:!0})]}):(0,t.jsxs)(a.default,{title:F,className:"w-[17rem]",children:[(0,t.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,t.jsx)("span",{className:"text-value font-semibold text-hud-main",children:b?.toFixed(1)}),(0,t.jsx)("span",{className:"text-caption text-hud-secondary",children:N}),y,w&&(0,t.jsx)("span",{className:"text-caption text-hud-muted whitespace-nowrap",children:u("hud.gust",{value:g.toFixed(0)})})]}),(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(r.default,{values:v,width:240,height:48,endDot:!0})}),(0,t.jsx)("div",{className:"text-caption text-hud-muted mt-1",children:u("hud.depthHistory")})]})}])},81788,function(e){e.n(e.i(14077))}]);
|