ocearo-ui 0.1.21 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/404.html +1 -1
  2. package/README.fr.md +31 -1
  3. package/README.md +31 -1
  4. package/__next.__PAGE__.txt +2 -2
  5. package/__next._full.txt +3 -3
  6. package/__next._head.txt +1 -1
  7. package/__next._index.txt +2 -2
  8. package/__next._tree.txt +2 -2
  9. package/_next/static/chunks/0-z15txb4-uhu.js +409 -0
  10. package/_next/static/chunks/{29-ag86gvlc40.js → 0kinaai2rvd43.js} +1 -1
  11. package/_next/static/chunks/0qj7yy4f6sk8y.js +455 -0
  12. package/_next/static/chunks/0yf1ifg_o1bq6.js +1 -0
  13. package/_next/static/chunks/0zbzk2ob0li1n.js +1 -0
  14. package/_next/static/chunks/17ma1x64d-211.js +1 -0
  15. package/_next/static/chunks/19xb2y6sgfnza.js +1 -0
  16. package/_next/static/chunks/1q572rz5m8mb-.js +1 -0
  17. package/_next/static/chunks/{2baz6j1q913qw.js → 1rkf8qtk5-48h.js} +1 -1
  18. package/_next/static/chunks/26e1o1as-77nq.js +172 -0
  19. package/_next/static/chunks/2fy4q1c5l3tpj.js +1 -0
  20. package/_next/static/chunks/2lw7kypuhij1_.css +3 -0
  21. package/_next/static/chunks/{1porlo35ga4zu.js → 2q_83f24jeg0e.js} +1 -1
  22. package/_next/static/chunks/2udirievybq_j.js +1 -0
  23. package/_next/static/chunks/3myql5zu0rstt.js +425 -0
  24. package/_not-found/__next._full.txt +2 -2
  25. package/_not-found/__next._head.txt +1 -1
  26. package/_not-found/__next._index.txt +2 -2
  27. package/_not-found/__next._not-found.__PAGE__.txt +1 -1
  28. package/_not-found/__next._not-found.txt +1 -1
  29. package/_not-found/__next._tree.txt +2 -2
  30. package/_not-found.html +1 -1
  31. package/_not-found.txt +2 -2
  32. package/index.html +1 -1
  33. package/index.txt +3 -3
  34. package/package.json +1 -1
  35. package/settings/__next._full.txt +3 -3
  36. package/settings/__next._head.txt +1 -1
  37. package/settings/__next._index.txt +2 -2
  38. package/settings/__next._tree.txt +2 -2
  39. package/settings/__next.settings.__PAGE__.txt +2 -2
  40. package/settings/__next.settings.txt +1 -1
  41. package/settings.html +1 -1
  42. package/settings.txt +3 -3
  43. package/_next/static/chunks/08gn5_gd6amkq.js +0 -1
  44. package/_next/static/chunks/0utifqhyv2cuc.js +0 -1
  45. package/_next/static/chunks/0wzr1__so6xme.js +0 -1
  46. package/_next/static/chunks/11ln9lzzbo35q.js +0 -1
  47. package/_next/static/chunks/1w1ua0-p5lk1e.js +0 -38
  48. package/_next/static/chunks/1wv5e5qomv-7g.css +0 -3
  49. package/_next/static/chunks/2lez3uww9j4t0.js +0 -135
  50. package/_next/static/chunks/2uao1hfsz-oy8.js +0 -1
  51. package/_next/static/chunks/2yghvponatk1x.js +0 -135
  52. package/_next/static/chunks/31i14-jemhnic.js +0 -863
  53. package/_next/static/chunks/3dt63tw_9r0jt.js +0 -38
  54. package/_next/static/chunks/3sgrkzk20mxs6.js +0 -54
  55. /package/_next/static/{hlKDicTyNGfd7dmHqo5m5 → sct9rcMTcCyBLHTxQQ75-}/_buildManifest.js +0 -0
  56. /package/_next/static/{hlKDicTyNGfd7dmHqo5m5 → sct9rcMTcCyBLHTxQQ75-}/_clientMiddlewareManifest.js +0 -0
  57. /package/_next/static/{hlKDicTyNGfd7dmHqo5m5 → sct9rcMTcCyBLHTxQQ75-}/_ssgManifest.js +0 -0
@@ -0,0 +1,409 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,62588,e=>{"use strict";var t=e.i(43476),n=e.i(71645);e.i(49018);var i=e.i(83402),a=e.i(66799),r=e.i(67561),o=e.i(85709);let s=(0,n.createContext)(),l=(e,t,n,i)=>{let a=n.split(".").reduce((e,t)=>e?.[t],i);void 0!==a&&(e[t]=a)};e.s(["AISProvider",0,({children:e})=>{let[u,c]=(0,n.useState)({}),[d,f]=(0,n.useState)([]),p=(0,n.useRef)(null),h=(0,n.useRef)({}),v=(0,n.useRef)(null),{convertLatLonToXY:m}=(0,r.useOcearoContext)(),g=(0,o.useSignalKPath)("navigation.position"),y=(0,n.useRef)(),S=(0,n.useRef)(),b=(0,n.useCallback)(e=>{if(e.latitude&&e.longitude&&g&&g.latitude&&g.longitude&&e.latitude!=g.latitude&&e.longitude!=g.longitude){let t=i.default.get("aisLengthScalingFactor")||.7,{x:n,y:a}=m({lat:e.latitude,lon:e.longitude},{lat:g.latitude,lon:g.longitude});e.sceneX=n*t,e.sceneZ=-a*t,e.rotationAngleY=(e=>{if(!e)return 0;let t=e.heading||e.headingMagnetic;return e.cog||e.cogMagnetic||t||0})(e),e.distanceMeters=Math.sqrt(n**2+a**2);let r=e.visible;return e.visible=e.distanceMeters>10&&e.distanceMeters<=5e3,r!==e.visible}return!1},[g,m]),w=(0,n.useCallback)(()=>{v.current&&(clearTimeout(v.current),v.current=null);let e=Object.values(u).filter(e=>e.visible);((e,t)=>{if(e.length!==t.length)return!0;let n=new Set(e.map(e=>e.mmsi)),i=new Set(t.map(e=>e.mmsi));if(n.size!==i.size)return!0;for(let e of n)if(!i.has(e))return!0;return!1})(d,e)&&(console.log(`Updating visible vessels: ${e.length} vessels`),f(e))},[u,d]),x=(0,n.useCallback)(()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{w(),v.current=null},100)},[w]);return(0,n.useEffect)(()=>{y.current=b,S.current=x},[b,x]),(0,n.useEffect)(()=>{let e=setInterval(()=>{let e=Date.now();c(t=>{let n=!1,i={...t};return(Object.entries(i).forEach(([t,a])=>{e-a.lastUpdate>6e5&&(delete i[t],n=!0)}),n)?(x(),i):t})},6e4);return()=>clearInterval(e)},[x]),(0,n.useEffect)(()=>{let e=async e=>{console.log("Fetching static vessel info...");try{let t=await e.API().then(e=>e.vessels()),n=Object.entries(t).map(([e,t])=>{let n={mmsi:e};return l(n,"name","name",t),l(n,"latitude","navigation.position.value.latitude",t),l(n,"longitude","navigation.position.value.longitude",t),l(n,"sog","navigation.speedOverGround.value",t),l(n,"cog","navigation.courseOverGroundTrue.value",t),l(n,"cogMagnetic","navigation.courseOverGroundMagnetic.value",t),l(n,"heading","navigation.headingTrue.value",t),l(n,"headingMagnetic","navigation.headingMagnetic.value",t),l(n,"length","design.length.value.overall",t),l(n,"beam","design.beam.value",t),l(n,"callsign","communication.callsignVhf",t),l(n,"shipType","design.aisShipType.value.id",t),n.lastUpdate=Date.now(),n.distanceMeters=null,n.sceneX=null,n.sceneZ=null,n.rotationAngleY=null,n.visible=!1,n}),i={};if(n.forEach(e=>{e.mmsi&&"self"!=e.mmsi&&(null!==e.latitude||null!==e.longitude)&&(y.current(e),i[e.mmsi]=e)}),console.log(`Fetched ${n.length} vessels.`),Object.keys(i).length>0){console.log(`Initializing AIS data with ${Object.keys(i).length} vessels`),c(i);let e=Object.values(i).filter(e=>e.visible);f(e),console.log(`${e.length} vessels initially visible`)}}catch(e){console.error("Error fetching static info:",e)}},t=e=>{if(!e?.updates)return void console.warn("Missing delta or no updates:",e);let t=e.context.replace("vessels.","");t?(h.current[t]=Date.now(),c(n=>{let i=n[t]||{mmsi:t,name:"unknown",latitude:null,longitude:null,sog:null,cog:null,cogMagnetic:null,heading:null,headingMagnetic:null,distanceMeters:null,sceneX:null,sceneZ:null,rotationAngleY:null,visible:!1,length:null,beam:null,shipType:null};i.lastUpdate=h.current[t];let a=!1,r=!1;return e.updates.forEach(e=>{e.values&&e.values.forEach(e=>{switch(e.path){case"name":i.name=e.value;break;case"navigation.position":i.latitude=e.value.latitude,i.longitude=e.value.longitude,a=!0;break;case"navigation.speedOverGround":i.sog=e.value;break;case"navigation.courseOverGroundTrue":i.cog=e.value,r=!0;break;case"navigation.courseOverGroundMagnetic":i.cogMagnetic=e.value,r=!0;break;case"navigation.headingTrue":i.heading=e.value,r=!0;break;case"navigation.headingMagnetic":i.headingMagnetic=e.value,r=!0;break;case"design.aisShipType":i.shipType=e.value?.id??e.value;break;case"design.length":i.length=e.value?.overall??e.value;break;case"design.beam":i.beam=e.value;break;case"communication.callsignVhf":i.callsign=e.value}})}),(y.current(i)||a||r)&&S.current(),{...n,[t]:i}})):console.warn("Update without MMSI context:",e)};return(async()=>{try{let{signalkUrl:n}=i.default.getAll();if(console.log("SignalK URL:",n),!n)throw Error("SignalK URL is undefined or invalid.");console.log(`Connecting to SignalK at: ${n}`);let r=a.default.createClient({subscriptions:[{context:"vessels.*",subscribe:[{path:"navigation.position"},{path:"navigation.speedOverGround"},{path:"navigation.courseOverGroundTrue"},{path:"navigation.courseOverGroundMagnetic"},{path:"navigation.headingTrue"},{path:"navigation.headingMagnetic"},{path:"name"},{path:"design.aisShipType"},{path:"design.length"},{path:"design.beam"},{path:"communication.callsignVhf"}]}]});p.current=r,await r.connect(),console.log("SignalK client connected."),await e(r),r.on("delta",t)}catch(e){console.warn("Error connecting to SignalK:",e)}})(),()=>{console.log("Disconnecting SignalK client..."),v.current&&clearTimeout(v.current),p.current?.disconnect()}},[]),(0,t.jsx)(s.Provider,{value:{aisData:u,vesselIds:d},children:e})},"useAIS",0,()=>(0,n.useContext)(s)])},43216,e=>{"use strict";let t,n;var i=e.i(31067),a=e.i(71645),r=e.i(90072),o=e.i(28600),s=r,l=r;let u=new l.Box3,c=new l.Vector3;class d extends l.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 l.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 l.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,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.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 n=new l.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new l.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new l.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));let i=new l.InstancedInterleavedBuffer(n,2*t,1);return this.setAttribute("instanceColorStart",new l.InterleavedBufferAttribute(i,t,0)),this.setAttribute("instanceColorEnd",new l.InterleavedBufferAttribute(i,t,t)),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 l.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 l.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),u.setFromBufferAttribute(t),this.boundingBox.union(u))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new l.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let a=0,r=e.count;a<r;a++)c.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(c)),c.fromBufferAttribute(t,a),i=Math.max(i,n.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(i),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(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}var f=r,p=e.i(8560),h=e.i(31497);class v extends f.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:f.UniformsUtils.clone(f.UniformsUtils.merge([p.UniformsLib.common,p.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new f.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
2
+ #include <common>
3
+ #include <fog_pars_vertex>
4
+ #include <logdepthbuf_pars_vertex>
5
+ #include <clipping_planes_pars_vertex>
6
+
7
+ uniform float linewidth;
8
+ uniform vec2 resolution;
9
+
10
+ attribute vec3 instanceStart;
11
+ attribute vec3 instanceEnd;
12
+
13
+ #ifdef USE_COLOR
14
+ #ifdef USE_LINE_COLOR_ALPHA
15
+ varying vec4 vLineColor;
16
+ attribute vec4 instanceColorStart;
17
+ attribute vec4 instanceColorEnd;
18
+ #else
19
+ varying vec3 vLineColor;
20
+ attribute vec3 instanceColorStart;
21
+ attribute vec3 instanceColorEnd;
22
+ #endif
23
+ #endif
24
+
25
+ #ifdef WORLD_UNITS
26
+
27
+ varying vec4 worldPos;
28
+ varying vec3 worldStart;
29
+ varying vec3 worldEnd;
30
+
31
+ #ifdef USE_DASH
32
+
33
+ varying vec2 vUv;
34
+
35
+ #endif
36
+
37
+ #else
38
+
39
+ varying vec2 vUv;
40
+
41
+ #endif
42
+
43
+ #ifdef USE_DASH
44
+
45
+ uniform float dashScale;
46
+ attribute float instanceDistanceStart;
47
+ attribute float instanceDistanceEnd;
48
+ varying float vLineDistance;
49
+
50
+ #endif
51
+
52
+ void trimSegment( const in vec4 start, inout vec4 end ) {
53
+
54
+ // trim end segment so it terminates between the camera plane and the near plane
55
+
56
+ // conservative estimate of the near plane
57
+ float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
58
+ float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
59
+ float nearEstimate = - 0.5 * b / a;
60
+
61
+ float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
62
+
63
+ end.xyz = mix( start.xyz, end.xyz, alpha );
64
+
65
+ }
66
+
67
+ void main() {
68
+
69
+ #ifdef USE_COLOR
70
+
71
+ vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
72
+
73
+ #endif
74
+
75
+ #ifdef USE_DASH
76
+
77
+ vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
78
+ vUv = uv;
79
+
80
+ #endif
81
+
82
+ float aspect = resolution.x / resolution.y;
83
+
84
+ // camera space
85
+ vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
86
+ vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
87
+
88
+ #ifdef WORLD_UNITS
89
+
90
+ worldStart = start.xyz;
91
+ worldEnd = end.xyz;
92
+
93
+ #else
94
+
95
+ vUv = uv;
96
+
97
+ #endif
98
+
99
+ // special case for perspective projection, and segments that terminate either in, or behind, the camera plane
100
+ // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
101
+ // but we need to perform ndc-space calculations in the shader, so we must address this issue directly
102
+ // perhaps there is a more elegant solution -- WestLangley
103
+
104
+ bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
105
+
106
+ if ( perspective ) {
107
+
108
+ if ( start.z < 0.0 && end.z >= 0.0 ) {
109
+
110
+ trimSegment( start, end );
111
+
112
+ } else if ( end.z < 0.0 && start.z >= 0.0 ) {
113
+
114
+ trimSegment( end, start );
115
+
116
+ }
117
+
118
+ }
119
+
120
+ // clip space
121
+ vec4 clipStart = projectionMatrix * start;
122
+ vec4 clipEnd = projectionMatrix * end;
123
+
124
+ // ndc space
125
+ vec3 ndcStart = clipStart.xyz / clipStart.w;
126
+ vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
127
+
128
+ // direction
129
+ vec2 dir = ndcEnd.xy - ndcStart.xy;
130
+
131
+ // account for clip-space aspect ratio
132
+ dir.x *= aspect;
133
+ dir = normalize( dir );
134
+
135
+ #ifdef WORLD_UNITS
136
+
137
+ // get the offset direction as perpendicular to the view vector
138
+ vec3 worldDir = normalize( end.xyz - start.xyz );
139
+ vec3 offset;
140
+ if ( position.y < 0.5 ) {
141
+
142
+ offset = normalize( cross( start.xyz, worldDir ) );
143
+
144
+ } else {
145
+
146
+ offset = normalize( cross( end.xyz, worldDir ) );
147
+
148
+ }
149
+
150
+ // sign flip
151
+ if ( position.x < 0.0 ) offset *= - 1.0;
152
+
153
+ float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
154
+
155
+ // don't extend the line if we're rendering dashes because we
156
+ // won't be rendering the endcaps
157
+ #ifndef USE_DASH
158
+
159
+ // extend the line bounds to encompass endcaps
160
+ start.xyz += - worldDir * linewidth * 0.5;
161
+ end.xyz += worldDir * linewidth * 0.5;
162
+
163
+ // shift the position of the quad so it hugs the forward edge of the line
164
+ offset.xy -= dir * forwardOffset;
165
+ offset.z += 0.5;
166
+
167
+ #endif
168
+
169
+ // endcaps
170
+ if ( position.y > 1.0 || position.y < 0.0 ) {
171
+
172
+ offset.xy += dir * 2.0 * forwardOffset;
173
+
174
+ }
175
+
176
+ // adjust for linewidth
177
+ offset *= linewidth * 0.5;
178
+
179
+ // set the world position
180
+ worldPos = ( position.y < 0.5 ) ? start : end;
181
+ worldPos.xyz += offset;
182
+
183
+ // project the worldpos
184
+ vec4 clip = projectionMatrix * worldPos;
185
+
186
+ // shift the depth of the projected points so the line
187
+ // segments overlap neatly
188
+ vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
189
+ clip.z = clipPose.z * clip.w;
190
+
191
+ #else
192
+
193
+ vec2 offset = vec2( dir.y, - dir.x );
194
+ // undo aspect ratio adjustment
195
+ dir.x /= aspect;
196
+ offset.x /= aspect;
197
+
198
+ // sign flip
199
+ if ( position.x < 0.0 ) offset *= - 1.0;
200
+
201
+ // endcaps
202
+ if ( position.y < 0.0 ) {
203
+
204
+ offset += - dir;
205
+
206
+ } else if ( position.y > 1.0 ) {
207
+
208
+ offset += dir;
209
+
210
+ }
211
+
212
+ // adjust for linewidth
213
+ offset *= linewidth;
214
+
215
+ // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
216
+ offset /= resolution.y;
217
+
218
+ // select end
219
+ vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
220
+
221
+ // back to clip space
222
+ offset *= clip.w;
223
+
224
+ clip.xy += offset;
225
+
226
+ #endif
227
+
228
+ gl_Position = clip;
229
+
230
+ vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
231
+
232
+ #include <logdepthbuf_vertex>
233
+ #include <clipping_planes_vertex>
234
+ #include <fog_vertex>
235
+
236
+ }
237
+ `,fragmentShader:`
238
+ uniform vec3 diffuse;
239
+ uniform float opacity;
240
+ uniform float linewidth;
241
+
242
+ #ifdef USE_DASH
243
+
244
+ uniform float dashOffset;
245
+ uniform float dashSize;
246
+ uniform float gapSize;
247
+
248
+ #endif
249
+
250
+ varying float vLineDistance;
251
+
252
+ #ifdef WORLD_UNITS
253
+
254
+ varying vec4 worldPos;
255
+ varying vec3 worldStart;
256
+ varying vec3 worldEnd;
257
+
258
+ #ifdef USE_DASH
259
+
260
+ varying vec2 vUv;
261
+
262
+ #endif
263
+
264
+ #else
265
+
266
+ varying vec2 vUv;
267
+
268
+ #endif
269
+
270
+ #include <common>
271
+ #include <fog_pars_fragment>
272
+ #include <logdepthbuf_pars_fragment>
273
+ #include <clipping_planes_pars_fragment>
274
+
275
+ #ifdef USE_COLOR
276
+ #ifdef USE_LINE_COLOR_ALPHA
277
+ varying vec4 vLineColor;
278
+ #else
279
+ varying vec3 vLineColor;
280
+ #endif
281
+ #endif
282
+
283
+ vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
284
+
285
+ float mua;
286
+ float mub;
287
+
288
+ vec3 p13 = p1 - p3;
289
+ vec3 p43 = p4 - p3;
290
+
291
+ vec3 p21 = p2 - p1;
292
+
293
+ float d1343 = dot( p13, p43 );
294
+ float d4321 = dot( p43, p21 );
295
+ float d1321 = dot( p13, p21 );
296
+ float d4343 = dot( p43, p43 );
297
+ float d2121 = dot( p21, p21 );
298
+
299
+ float denom = d2121 * d4343 - d4321 * d4321;
300
+
301
+ float numer = d1343 * d4321 - d1321 * d4343;
302
+
303
+ mua = numer / denom;
304
+ mua = clamp( mua, 0.0, 1.0 );
305
+ mub = ( d1343 + d4321 * ( mua ) ) / d4343;
306
+ mub = clamp( mub, 0.0, 1.0 );
307
+
308
+ return vec2( mua, mub );
309
+
310
+ }
311
+
312
+ void main() {
313
+
314
+ #include <clipping_planes_fragment>
315
+
316
+ #ifdef USE_DASH
317
+
318
+ if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
319
+
320
+ if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
321
+
322
+ #endif
323
+
324
+ float alpha = opacity;
325
+
326
+ #ifdef WORLD_UNITS
327
+
328
+ // Find the closest points on the view ray and the line segment
329
+ vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
330
+ vec3 lineDir = worldEnd - worldStart;
331
+ vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
332
+
333
+ vec3 p1 = worldStart + lineDir * params.x;
334
+ vec3 p2 = rayEnd * params.y;
335
+ vec3 delta = p1 - p2;
336
+ float len = length( delta );
337
+ float norm = len / linewidth;
338
+
339
+ #ifndef USE_DASH
340
+
341
+ #ifdef USE_ALPHA_TO_COVERAGE
342
+
343
+ float dnorm = fwidth( norm );
344
+ alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
345
+
346
+ #else
347
+
348
+ if ( norm > 0.5 ) {
349
+
350
+ discard;
351
+
352
+ }
353
+
354
+ #endif
355
+
356
+ #endif
357
+
358
+ #else
359
+
360
+ #ifdef USE_ALPHA_TO_COVERAGE
361
+
362
+ // artifacts appear on some hardware if a derivative is taken within a conditional
363
+ float a = vUv.x;
364
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
365
+ float len2 = a * a + b * b;
366
+ float dlen = fwidth( len2 );
367
+
368
+ if ( abs( vUv.y ) > 1.0 ) {
369
+
370
+ alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
371
+
372
+ }
373
+
374
+ #else
375
+
376
+ if ( abs( vUv.y ) > 1.0 ) {
377
+
378
+ float a = vUv.x;
379
+ float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
380
+ float len2 = a * a + b * b;
381
+
382
+ if ( len2 > 1.0 ) discard;
383
+
384
+ }
385
+
386
+ #endif
387
+
388
+ #endif
389
+
390
+ vec4 diffuseColor = vec4( diffuse, alpha );
391
+ #ifdef USE_COLOR
392
+ #ifdef USE_LINE_COLOR_ALPHA
393
+ diffuseColor *= vLineColor;
394
+ #else
395
+ diffuseColor.rgb *= vLineColor;
396
+ #endif
397
+ #endif
398
+
399
+ #include <logdepthbuf_fragment>
400
+
401
+ gl_FragColor = diffuseColor;
402
+
403
+ #include <tonemapping_fragment>
404
+ #include <${h.version>=154?"colorspace_fragment":"encodings_fragment"}>
405
+ #include <fog_fragment>
406
+ #include <premultiplied_alpha_fragment>
407
+
408
+ }
409
+ `,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(e){!!e!="USE_DASH"in this.defines&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){!!e!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}let m=h.version>=125?"uv1":"uv2",g=new s.Vector4,y=new s.Vector3,S=new s.Vector3,b=new s.Vector4,w=new s.Vector4,x=new s.Vector4,E=new s.Vector3,A=new s.Matrix4,_=new s.Line3,U=new s.Vector3,L=new s.Box3,M=new s.Sphere,O=new s.Vector4;function z(e,t,i){return O.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),O.multiplyScalar(1/O.w),O.x=n/i.width,O.y=n/i.height,O.applyMatrix4(e.projectionMatrixInverse),O.multiplyScalar(1/O.w),Math.abs(Math.max(O.x,O.y))}class B extends s.Mesh{constructor(e=new d,t=new v({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let e=0,a=0,r=t.count;e<r;e++,a+=2)y.fromBufferAttribute(t,e),S.fromBufferAttribute(n,e),i[a]=0===a?0:i[a-1],i[a+1]=i[a]+y.distanceTo(S);let a=new s.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new s.InterleavedBufferAttribute(a,1,0)),e.setAttribute("instanceDistanceEnd",new s.InterleavedBufferAttribute(a,1,1)),this}raycast(e,i){let a,r,o=this.material.worldUnits,l=e.camera;null!==l||o||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');let u=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let c=this.matrixWorld,d=this.geometry,f=this.material;if(n=f.linewidth+u,null===d.boundingSphere&&d.computeBoundingSphere(),M.copy(d.boundingSphere).applyMatrix4(c),o)a=.5*n;else{let e=Math.max(l.near,M.distanceToPoint(t.origin));a=z(l,e,f.resolution)}if(M.radius+=a,!1!==t.intersectsSphere(M)){if(null===d.boundingBox&&d.computeBoundingBox(),L.copy(d.boundingBox).applyMatrix4(c),o)r=.5*n;else{let e=Math.max(l.near,L.distanceToPoint(t.origin));r=z(l,e,f.resolution)}L.expandByScalar(r),!1!==t.intersectsBox(L)&&(o?function(e,i){let a=e.matrixWorld,r=e.geometry,o=r.attributes.instanceStart,l=r.attributes.instanceEnd,u=Math.min(r.instanceCount,o.count);for(let r=0;r<u;r++){_.start.fromBufferAttribute(o,r),_.end.fromBufferAttribute(l,r),_.applyMatrix4(a);let u=new s.Vector3,c=new s.Vector3;t.distanceSqToSegment(_.start,_.end,c,u),c.distanceTo(u)<.5*n&&i.push({point:c,pointOnLine:u,distance:t.origin.distanceTo(c),object:e,face:null,faceIndex:r,uv:null,[m]:null})}}(this,i):function(e,i,a){let r=i.projectionMatrix,o=e.material.resolution,l=e.matrixWorld,u=e.geometry,c=u.attributes.instanceStart,d=u.attributes.instanceEnd,f=Math.min(u.instanceCount,c.count),p=-i.near;t.at(1,x),x.w=1,x.applyMatrix4(i.matrixWorldInverse),x.applyMatrix4(r),x.multiplyScalar(1/x.w),x.x*=o.x/2,x.y*=o.y/2,x.z=0,E.copy(x),A.multiplyMatrices(i.matrixWorldInverse,l);for(let i=0;i<f;i++){if(b.fromBufferAttribute(c,i),w.fromBufferAttribute(d,i),b.w=1,w.w=1,b.applyMatrix4(A),w.applyMatrix4(A),b.z>p&&w.z>p)continue;if(b.z>p){let e=b.z-w.z,t=(b.z-p)/e;b.lerp(w,t)}else if(w.z>p){let e=w.z-b.z,t=(w.z-p)/e;w.lerp(b,t)}b.applyMatrix4(r),w.applyMatrix4(r),b.multiplyScalar(1/b.w),w.multiplyScalar(1/w.w),b.x*=o.x/2,b.y*=o.y/2,w.x*=o.x/2,w.y*=o.y/2,_.start.copy(b),_.start.z=0,_.end.copy(w),_.end.z=0;let u=_.closestPointToPointParameter(E,!0);_.at(u,U);let f=s.MathUtils.lerp(b.z,w.z,u),h=f>=-1&&f<=1,v=E.distanceTo(U)<.5*n;if(h&&v){_.start.fromBufferAttribute(c,i),_.end.fromBufferAttribute(d,i),_.start.applyMatrix4(l),_.end.applyMatrix4(l);let n=new s.Vector3,r=new s.Vector3;t.distanceSqToSegment(_.start,_.end,r,n),a.push({point:r,pointOnLine:n,distance:t.origin.distanceTo(r),object:e,face:null,faceIndex:i,uv:null,[m]:null})}}}(this,l,i))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(g),this.material.uniforms.resolution.value.set(g.z,g.w))}}class C extends d{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e,t=3){let n=e.length-t,i=new Float32Array(2*n);if(3===t)for(let a=0;a<n;a+=t)i[2*a]=e[a],i[2*a+1]=e[a+1],i[2*a+2]=e[a+2],i[2*a+3]=e[a+3],i[2*a+4]=e[a+4],i[2*a+5]=e[a+5];else for(let a=0;a<n;a+=t)i[2*a]=e[a],i[2*a+1]=e[a+1],i[2*a+2]=e[a+2],i[2*a+3]=e[a+3],i[2*a+4]=e[a+4],i[2*a+5]=e[a+5],i[2*a+6]=e[a+6],i[2*a+7]=e[a+7];return super.setColors(i,t),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class T extends B{constructor(e=new C,t=new v({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let D=a.forwardRef(function({points:e,color:t=0xffffff,vertexColors:n,linewidth:s,lineWidth:l,segments:u,dashed:c,...f},p){var h,m;let g=(0,o.useThree)(e=>e.size),y=a.useMemo(()=>u?new B:new T,[u]),[S]=a.useState(()=>new v),b=(null==n||null==(h=n[0])?void 0:h.length)===4?4:3,w=a.useMemo(()=>{let i=u?new d:new C,a=e.map(e=>{let t=Array.isArray(e);return e instanceof r.Vector3||e instanceof r.Vector4?[e.x,e.y,e.z]:e instanceof r.Vector2?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e});if(i.setPositions(a.flat()),n){t=0xffffff;let e=n.map(e=>e instanceof r.Color?e.toArray():e);i.setColors(e.flat(),b)}return i},[e,u,n,b]);return a.useLayoutEffect(()=>{y.computeLineDistances()},[e,y]),a.useLayoutEffect(()=>{c?S.defines.USE_DASH="":delete S.defines.USE_DASH,S.needsUpdate=!0},[c,S]),a.useEffect(()=>()=>{w.dispose(),S.dispose()},[w]),a.createElement("primitive",(0,i.default)({object:y,ref:p},f),a.createElement("primitive",{object:w,attach:"geometry"}),a.createElement("primitive",(0,i.default)({object:S,attach:"material",color:t,vertexColors:!!n,resolution:[g.width,g.height],linewidth:null!=(m=null!=s?s:l)?m:1,dashed:c,transparent:4===b},f)))});e.s(["Line",0,D],43216)}]);
@@ -6,4 +6,4 @@
6
6
  ${x}px !important;
7
7
  ${j}px !important;
8
8
  }
9
- `),()=>{p.current?.removeAttribute("data-motion-pop-id"),b.contains(y)&&b.removeChild(y)}},[n]),(0,t.jsx)(d,{isPresent:n,childRef:p,sizeRef:f,pop:a,children:!1===a?e:i.cloneElement(e,{ref:x})})}let h=({children:e,initial:n,isPresent:a,onExitComplete:i,custom:u,presenceAffectsLayout:c,mode:d,anchorX:h,anchorY:f,root:g})=>{let x=(0,o.useConstant)(p),j=(0,s.useId)(),y=(0,s.useRef)(a),b=(0,s.useRef)(i);(0,l.useIsomorphicLayoutEffect)(()=>{y.current=a,b.current=i});let v=!0,w=(0,s.useMemo)(()=>(v=!1,{id:j,initial:n,isPresent:a,custom:u,onExitComplete:e=>{for(let t of(x.set(e,!0),x.values()))if(!t)return;i&&i()},register:e=>(x.set(e,!1),()=>{x.delete(e),y.current||x.size||b.current?.()})}),[a,x,i]);return c&&v&&(w={...w}),(0,s.useMemo)(()=>{x.forEach((e,t)=>x.set(t,!1))},[a]),s.useEffect(()=>{a||x.size||!i||i()},[a]),e=(0,t.jsx)(m,{pop:"popLayout"===d,isPresent:a,anchorX:h,anchorY:f,root:g,children:e}),(0,t.jsx)(r.PresenceContext.Provider,{value:w,children:e})};function p(){return new Map}var f=e.i(64978);let g=e=>e.key||"";function x(e){let t=[];return s.Children.forEach(e,e=>{(0,s.isValidElement)(e)&&t.push(e)}),t}e.s(["AnimatePresence",0,({children:e,custom:r,initial:a=!0,onExitComplete:i,presenceAffectsLayout:u=!0,mode:c="sync",propagate:d=!1,anchorX:m="left",anchorY:p="top",root:j})=>{let[y,b]=(0,f.usePresence)(d),v=(0,s.useMemo)(()=>x(e),[e]),w=d&&!y?[]:v.map(g),k=(0,s.useRef)(!0),P=(0,s.useRef)(v),E=(0,o.useConstant)(()=>new Map),C=(0,s.useRef)(new Set),[R,$]=(0,s.useState)(v),[A,M]=(0,s.useState)(v);(0,l.useIsomorphicLayoutEffect)(()=>{k.current=!1,P.current=v;for(let e=0;e<A.length;e++){let t=g(A[e]);w.includes(t)?(E.delete(t),C.current.delete(t)):!0!==E.get(t)&&E.set(t,!1)}},[A,w.length,w.join("-")]);let L=[];if(v!==R){let e=[...v];for(let t=0;t<A.length;t++){let s=A[t],n=g(s);w.includes(n)||(e.splice(t,0,s),L.push(s))}return"wait"===c&&L.length&&(e=L),M(x(e)),$(v),null}let{forceRender:T}=(0,s.useContext)(n.LayoutGroupContext);return(0,t.jsx)(t.Fragment,{children:A.map(e=>{let s=g(e),n=(!d||!!y)&&(v===A||w.includes(s));return(0,t.jsx)(h,{isPresent:n,initial:(!k.current||!!a)&&void 0,custom:r,presenceAffectsLayout:u,mode:c,root:j,onExitComplete:n?void 0:()=>{if(C.current.has(s)||!E.has(s))return;C.current.add(s),E.set(s,!0);let e=!0;E.forEach(t=>{t||(e=!1)}),e&&(T?.(),M(P.current),d&&b?.(),i&&i())},anchorX:m,anchorY:p,children:e},s)})})}],88653)},68192,e=>{"use strict";var t=e.i(43476),s=e.i(71645),n=e.i(70703),o=e.i(46932),l=e.i(88653),r=e.i(67561);e.i(85269);var a=e.i(22831),i=e.i(85709),u=e.i(83402);let c=({messageKey:e})=>{let{t:s}=(0,a.useTranslation)();return(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center text-hud-main",children:s(e)})},d=(0,n.default)(()=>e.A(56489),{loadableGenerated:{modules:[92094]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingDocuments"})}),m=(0,n.default)(()=>e.A(22155),{loadableGenerated:{modules:[34900]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingSettings"})}),h=(0,n.default)(()=>e.A(30455),{loadableGenerated:{modules:[13268]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingMediaPlayer"})}),p=(0,n.default)(()=>e.A(71074),{loadableGenerated:{modules:[65862]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingBatteryMonitor"})}),f=(0,n.default)(()=>e.A(3523),{loadableGenerated:{modules:[8161]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingEngineMonitor"})}),g=(0,n.default)(()=>e.A(88913),{loadableGenerated:{modules:[25294]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingDashboard"})}),x=(0,n.default)(()=>e.A(26371),{loadableGenerated:{modules:[70127]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingLogbook"})}),j=(0,n.default)(()=>e.A(58293),{loadableGenerated:{modules:[33946]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingAutopilot"})}),y=(0,n.default)(()=>e.A(47853),{loadableGenerated:{modules:[58652]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loading"})}),b={latitude:46.1591,longitude:-1.1522},v={navigation:e=>!e||e.includes("localhost:3000")?null:`${e}/@signalk/freeboard-sk/`,instrument:e=>`${e}/@mxtommy/kip/`,dashboard:e=>e.replace(":3000",":3001")+"/grafana",webcam1:()=>"https://pv.viewsurf.com/2080/Chatelaillon-Port?i=NzU4Mjp1bmRlZmluZWQ",webcam2:()=>"https://pv.viewsurf.com/1478/Chatelaillon-Plage?i=NTkyMDp1bmRlZmluZWQ",weather:(e,t)=>t&&`https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=mm&metricTemp=\xb0C&metricWind=kt&zoom=10&overlay=wind&product=ecmwf&level=surface&lat=${t.latitude}&lon=${t.longitude}&message=true`};e.s(["default",0,({view:e})=>{let{t:n}=(0,a.useTranslation)(),{nightMode:c}=(0,r.useOcearoContext)(),[w,k]=(0,s.useState)(b),[P,E]=(0,s.useState)(null),{signalkUrl:C}=u.default.getAll(),R=(0,i.useSignalKPath)("navigation.position");(0,s.useEffect)(()=>{E(null)},[e]),(0,s.useEffect)(()=>{R&&k(e=>e?Math.abs(e.latitude-R.latitude)>.01||Math.abs(e.longitude-R.longitude)>.01?R:e:R)},[R]);let $=(0,s.useMemo)(()=>{let t=u.default.getAll(),s=t.customExternalUrls||{};if(t.showCustomUrls&&s[e])try{if("string"==typeof s[e]&&s[e].includes("${signalkUrl}"))return s[e].replace("${signalkUrl}",C).replace("${latitude}",w?.latitude||b.latitude).replace("${longitude}",w?.longitude||b.longitude);return s[e]}catch(e){console.error("Error using custom URL:",e)}let n=v[e];if(!n)return null;try{return n(C,w)}catch(e){return console.error("Error generating URL:",e),null}},[e,w,C]),A=["motor","logbook","autopilot","battery","dashboard","debug"].includes(e);return(0,t.jsx)("div",{className:"flex flex-col w-full h-full overflow-hidden bg-hud-bg backdrop-blur-sm relative z-0",children:(0,t.jsx)(l.AnimatePresence,{mode:"wait",children:(0,t.jsx)(o.motion.div,{initial:{opacity:0,x:10,scale:.99},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:-10,scale:.99},transition:{duration:.4,ease:[.16,1,.3,1]},style:{flex:"1 1 0%",minHeight:0},className:`flex flex-col w-full absolute inset-0 ${A?"overflow-hidden":"overflow-auto"}`,children:(()=>{if(P)return(0,t.jsx)("div",{className:"text-oRed p-4 font-black uppercase text-xs",children:P});switch(e){case"manual":return(0,t.jsx)(d,{path:"/docs"});case"settings":return(0,t.jsx)(m,{});case"mediaplayer":return(0,t.jsx)(h,{});case"battery":return(0,t.jsx)(p,{});case"motor":return(0,t.jsx)(f,{});case"dashboard":return(0,t.jsx)(g,{});case"logbook":return(0,t.jsx)(x,{});case"autopilot":return(0,t.jsx)(j,{});case"debug":return(0,t.jsx)(y,{});default:if(!$)return(0,t.jsx)("div",{className:"text-hud-muted p-4 text-sm",children:n("errors.failedToLoadExternal")});return(0,t.jsx)("iframe",{className:"flex-grow border-none",src:$,title:"External Application",onError:()=>E(n("errors.failedToLoadExternal"))})}})()},e)})})}])},42602,e=>{e.n(e.i(68192))},56489,e=>{e.v(t=>Promise.all(["static/chunks/0l9s4rhr00adq.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(92094)))},22155,e=>{e.v(t=>Promise.all(["static/chunks/070stlm97b9a2.js"].map(t=>e.l(t))).then(()=>t(34900)))},30455,e=>{e.v(t=>Promise.all(["static/chunks/43ps2cu5ahf8n.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(13268)))},71074,e=>{e.v(t=>Promise.all(["static/chunks/3iuz3f0429awx.js","static/chunks/3rhgquok36e79.js","static/chunks/28y-j215vt42m.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(65862)))},3523,e=>{e.v(t=>Promise.all(["static/chunks/0ri_um14-5x7u.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(8161)))},88913,e=>{e.v(t=>Promise.all(["static/chunks/2uao1hfsz-oy8.js","static/chunks/0uvr7xkt_5uno.js","static/chunks/0utifqhyv2cuc.js","static/chunks/2nxsyowmuwpjy.js","static/chunks/27hn45pv56pv7.js","static/chunks/2yghvponatk1x.js","static/chunks/3m57lnggu30tr.js"].map(t=>e.l(t))).then(()=>t(25294)))},26371,e=>{e.v(t=>Promise.all(["static/chunks/2pwmb4pkqygy_.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(70127)))},58293,e=>{e.v(t=>Promise.all(["static/chunks/2a0yjir_3mk1m.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(33946)))},47853,e=>{e.v(t=>Promise.all(["static/chunks/1sq_733weprvs.js"].map(t=>e.l(t))).then(()=>t(58652)))}]);
9
+ `),()=>{p.current?.removeAttribute("data-motion-pop-id"),b.contains(y)&&b.removeChild(y)}},[n]),(0,t.jsx)(d,{isPresent:n,childRef:p,sizeRef:f,pop:a,children:!1===a?e:i.cloneElement(e,{ref:x})})}let h=({children:e,initial:n,isPresent:a,onExitComplete:i,custom:u,presenceAffectsLayout:c,mode:d,anchorX:h,anchorY:f,root:g})=>{let x=(0,o.useConstant)(p),j=(0,s.useId)(),y=(0,s.useRef)(a),b=(0,s.useRef)(i);(0,l.useIsomorphicLayoutEffect)(()=>{y.current=a,b.current=i});let w=!0,v=(0,s.useMemo)(()=>(w=!1,{id:j,initial:n,isPresent:a,custom:u,onExitComplete:e=>{for(let t of(x.set(e,!0),x.values()))if(!t)return;i&&i()},register:e=>(x.set(e,!1),()=>{x.delete(e),y.current||x.size||b.current?.()})}),[a,x,i]);return c&&w&&(v={...v}),(0,s.useMemo)(()=>{x.forEach((e,t)=>x.set(t,!1))},[a]),s.useEffect(()=>{a||x.size||!i||i()},[a]),e=(0,t.jsx)(m,{pop:"popLayout"===d,isPresent:a,anchorX:h,anchorY:f,root:g,children:e}),(0,t.jsx)(r.PresenceContext.Provider,{value:v,children:e})};function p(){return new Map}var f=e.i(64978);let g=e=>e.key||"";function x(e){let t=[];return s.Children.forEach(e,e=>{(0,s.isValidElement)(e)&&t.push(e)}),t}e.s(["AnimatePresence",0,({children:e,custom:r,initial:a=!0,onExitComplete:i,presenceAffectsLayout:u=!0,mode:c="sync",propagate:d=!1,anchorX:m="left",anchorY:p="top",root:j})=>{let[y,b]=(0,f.usePresence)(d),w=(0,s.useMemo)(()=>x(e),[e]),v=d&&!y?[]:w.map(g),k=(0,s.useRef)(!0),P=(0,s.useRef)(w),E=(0,o.useConstant)(()=>new Map),C=(0,s.useRef)(new Set),[R,$]=(0,s.useState)(w),[A,M]=(0,s.useState)(w);(0,l.useIsomorphicLayoutEffect)(()=>{k.current=!1,P.current=w;for(let e=0;e<A.length;e++){let t=g(A[e]);v.includes(t)?(E.delete(t),C.current.delete(t)):!0!==E.get(t)&&E.set(t,!1)}},[A,v.length,v.join("-")]);let L=[];if(w!==R){let e=[...w];for(let t=0;t<A.length;t++){let s=A[t],n=g(s);v.includes(n)||(e.splice(t,0,s),L.push(s))}return"wait"===c&&L.length&&(e=L),M(x(e)),$(w),null}let{forceRender:T}=(0,s.useContext)(n.LayoutGroupContext);return(0,t.jsx)(t.Fragment,{children:A.map(e=>{let s=g(e),n=(!d||!!y)&&(w===A||v.includes(s));return(0,t.jsx)(h,{isPresent:n,initial:(!k.current||!!a)&&void 0,custom:r,presenceAffectsLayout:u,mode:c,root:j,onExitComplete:n?void 0:()=>{if(C.current.has(s)||!E.has(s))return;C.current.add(s),E.set(s,!0);let e=!0;E.forEach(t=>{t||(e=!1)}),e&&(T?.(),M(P.current),d&&b?.(),i&&i())},anchorX:m,anchorY:p,children:e},s)})})}],88653)},68192,e=>{"use strict";var t=e.i(43476),s=e.i(71645),n=e.i(70703),o=e.i(46932),l=e.i(88653),r=e.i(67561);e.i(85269);var a=e.i(22831),i=e.i(85709),u=e.i(83402);let c=({messageKey:e})=>{let{t:s}=(0,a.useTranslation)();return(0,t.jsx)("div",{className:"w-full h-full flex items-center justify-center text-hud-main",children:s(e)})},d=(0,n.default)(()=>e.A(56489),{loadableGenerated:{modules:[92094]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingDocuments"})}),m=(0,n.default)(()=>e.A(22155),{loadableGenerated:{modules:[34900]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingSettings"})}),h=(0,n.default)(()=>e.A(30455),{loadableGenerated:{modules:[13268]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingMediaPlayer"})}),p=(0,n.default)(()=>e.A(71074),{loadableGenerated:{modules:[65862]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingBatteryMonitor"})}),f=(0,n.default)(()=>e.A(3523),{loadableGenerated:{modules:[8161]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingEngineMonitor"})}),g=(0,n.default)(()=>e.A(88913),{loadableGenerated:{modules:[25294]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingDashboard"})}),x=(0,n.default)(()=>e.A(26371),{loadableGenerated:{modules:[70127]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingLogbook"})}),j=(0,n.default)(()=>e.A(58293),{loadableGenerated:{modules:[33946]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loadingAutopilot"})}),y=(0,n.default)(()=>e.A(47853),{loadableGenerated:{modules:[58652]},loading:()=>(0,t.jsx)(c,{messageKey:"common.loading"})}),b={latitude:46.1591,longitude:-1.1522},w={navigation:e=>!e||e.includes("localhost:3000")?null:`${e}/@signalk/freeboard-sk/`,instrument:e=>`${e}/@mxtommy/kip/`,dashboard:e=>e.replace(":3000",":3001")+"/grafana",webcam1:()=>"https://pv.viewsurf.com/2080/Chatelaillon-Port?i=NzU4Mjp1bmRlZmluZWQ",webcam2:()=>"https://pv.viewsurf.com/1478/Chatelaillon-Plage?i=NTkyMDp1bmRlZmluZWQ",weather:(e,t)=>t&&`https://embed.windy.com/embed.html?type=map&location=coordinates&metricRain=mm&metricTemp=\xb0C&metricWind=kt&zoom=10&overlay=wind&product=ecmwf&level=surface&lat=${t.latitude}&lon=${t.longitude}&message=true`};e.s(["default",0,({view:e})=>{let{t:n}=(0,a.useTranslation)(),{nightMode:c}=(0,r.useOcearoContext)(),[v,k]=(0,s.useState)(b),[P,E]=(0,s.useState)(null),{signalkUrl:C}=u.default.getAll(),R=(0,i.useSignalKPath)("navigation.position");(0,s.useEffect)(()=>{E(null)},[e]),(0,s.useEffect)(()=>{R&&k(e=>e?Math.abs(e.latitude-R.latitude)>.01||Math.abs(e.longitude-R.longitude)>.01?R:e:R)},[R]);let $=(0,s.useMemo)(()=>{let t=u.default.getAll(),s=t.customExternalUrls||{};if(t.showCustomUrls&&s[e])try{if("string"==typeof s[e]&&s[e].includes("${signalkUrl}"))return s[e].replace("${signalkUrl}",C).replace("${latitude}",v?.latitude||b.latitude).replace("${longitude}",v?.longitude||b.longitude);return s[e]}catch(e){console.error("Error using custom URL:",e)}let n=w[e];if(!n)return null;try{return n(C,v)}catch(e){return console.error("Error generating URL:",e),null}},[e,v,C]),A=["motor","logbook","autopilot","battery","dashboard","debug"].includes(e);return(0,t.jsx)("div",{className:"flex flex-col w-full h-full overflow-hidden bg-hud-bg backdrop-blur-sm relative z-0",children:(0,t.jsx)(l.AnimatePresence,{mode:"wait",children:(0,t.jsx)(o.motion.div,{initial:{opacity:0,x:10,scale:.99},animate:{opacity:1,x:0,scale:1},exit:{opacity:0,x:-10,scale:.99},transition:{duration:.4,ease:[.16,1,.3,1]},style:{flex:"1 1 0%",minHeight:0},className:`flex flex-col w-full absolute inset-0 ${A?"overflow-hidden":"overflow-auto"}`,children:(()=>{if(P)return(0,t.jsx)("div",{className:"text-oRed p-4 font-black uppercase text-xs",children:P});switch(e){case"manual":return(0,t.jsx)(d,{path:"/docs"});case"settings":return(0,t.jsx)(m,{});case"mediaplayer":return(0,t.jsx)(h,{});case"battery":return(0,t.jsx)(p,{});case"motor":return(0,t.jsx)(f,{});case"dashboard":return(0,t.jsx)(g,{});case"logbook":return(0,t.jsx)(x,{});case"autopilot":return(0,t.jsx)(j,{});case"debug":return(0,t.jsx)(y,{});default:if(!$)return(0,t.jsx)("div",{className:"text-hud-muted p-4 text-sm",children:n("errors.failedToLoadExternal")});return(0,t.jsx)("iframe",{className:"flex-grow border-none",src:$,title:"External Application",onError:()=>E(n("errors.failedToLoadExternal"))})}})()},e)})})}])},42602,e=>{e.n(e.i(68192))},56489,e=>{e.v(t=>Promise.all(["static/chunks/0l9s4rhr00adq.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(92094)))},22155,e=>{e.v(t=>Promise.all(["static/chunks/070stlm97b9a2.js"].map(t=>e.l(t))).then(()=>t(34900)))},30455,e=>{e.v(t=>Promise.all(["static/chunks/43ps2cu5ahf8n.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(13268)))},71074,e=>{e.v(t=>Promise.all(["static/chunks/3iuz3f0429awx.js","static/chunks/3rhgquok36e79.js","static/chunks/28y-j215vt42m.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(65862)))},3523,e=>{e.v(t=>Promise.all(["static/chunks/0ri_um14-5x7u.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(8161)))},88913,e=>{e.v(t=>Promise.all(["static/chunks/2udirievybq_j.js","static/chunks/1q572rz5m8mb-.js","static/chunks/2nxsyowmuwpjy.js","static/chunks/0uvr7xkt_5uno.js"].map(t=>e.l(t))).then(()=>t(25294)))},26371,e=>{e.v(t=>Promise.all(["static/chunks/2pwmb4pkqygy_.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(70127)))},58293,e=>{e.v(t=>Promise.all(["static/chunks/2a0yjir_3mk1m.js","static/chunks/2nxsyowmuwpjy.js"].map(t=>e.l(t))).then(()=>t(33946)))},47853,e=>{e.v(t=>Promise.all(["static/chunks/1sq_733weprvs.js"].map(t=>e.l(t))).then(()=>t(58652)))}]);