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,180 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,10502,97776,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(90874),i=e.i(95393),n=e.i(90072),o=e.i(85709),l=e.i(66799),s=e.i(83402),u=e.i(78461),h=e.i(3950),m=e.i(83646);let c="https://tile.openstreetmap.org/{z}/{x}/{y}.png",d="https://gis.charttools.noaa.gov/arcgis/rest/services/MCS/NOAAChartDisplay/MapServer/exts/MaritimeChartService/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=TRUE&STYLES=&LAYERS=0,1,2,3,4,5,6,7,8,9,10,11,12&CRS=EPSG:3857&WIDTH=256&HEIGHT=256&BBOX={bbox}",f=[[24,50,-126,-66],[51,72,-180,-129],[18,23,-161,-154],[17,19,-68,-64],[13,21,144,146.5],[-15,-14,-171,-169]],p=(e,t)=>f.some(([a,r,i,n])=>e>=a&&e<=r&&t>=i&&t<=n),g={day:"brightness(0.72) saturate(1.15) contrast(1.05)",dark:"invert(1) hue-rotate(180deg) brightness(0.82) saturate(0.7) contrast(0.92)",night:"invert(1) brightness(0.55) sepia(1) hue-rotate(-38deg) saturate(2.4) contrast(0.95)"},v={day:"none",dark:"brightness(0.62)",night:"brightness(0.4) sepia(1) hue-rotate(-38deg) saturate(2)"},y={day:"none",dark:"brightness(0.9)",night:"sepia(1) hue-rotate(-38deg) saturate(2.4) brightness(0.7)"},w=h.tileUrl;function M(e,t){return 156543.03*Math.cos(e*Math.PI/180)/Math.pow(2,t)}let b=new Map,x=0,F=[];function N(e){if(b.has(e))return b.get(e);let t=()=>(0,h.cachedImage)(e).catch(()=>null),a=e.includes("WMSServer"),r=async()=>{for(let e=0;e<3;e++){let a=await t();if(a)return a;await new Promise(t=>{setTimeout(t,1500*(e+1))})}return null},i=a?new Promise(e=>{let t=()=>{x++,r().then(e,()=>e(null)).finally(()=>{x--,F.shift()?.()})};x<6?t():F.push(t)}).then(t=>(t||b.delete(e),t)):t();return b.set(e,i),i}async function S(e,t,a,r){let i=await N(w(e,t,a,r));if(i)return{img:i,sx:0,sy:0,sSize:256};for(let n=1;n<=3&&t-n>=1;n++){let o=t-n,l=a>>n,s=r>>n;if(i=await N(w(e,o,l,s))){let e=256/Math.pow(2,n);return{img:i,sx:(a-(l<<n))*e,sy:(r-(s<<n))*e,sSize:e}}}return null}let D=null;async function C(e,t,a,r,i=1,n="none"){let o,{latitude:l,longitude:s}=t,u=256*i,h=n&&"none"!==n,m=e;h&&(D||((D=document.createElement("canvas")).width=1024,D.height=1024),e=D.getContext("2d"));let c=(s+180)/360*Math.pow(2,a),d=(1-Math.log(Math.tan(o=l*Math.PI/180)+1/Math.cos(o))/Math.PI)/2*Math.pow(2,a),f=c*u-512,p=d*u-512,g=Math.floor(f/u),v=Math.floor(p/u),y=Math.ceil(1024/u)+2,w=Math.pow(2,a),M=[];for(let e=0;e<y;e++)for(let t=0;t<y;t++){let r=g+t,i=v+e;if(i<0||i>=w)continue;let n=(r%w+w)%w,o=Math.round(r*u-f),l=Math.round(i*u-p);M.push({z:a,x:n,y:i,screenLeft:o,screenTop:l})}let b=await Promise.all(M.map(e=>S(r,e.z,e.x,e.y)));h&&e.clearRect(0,0,1024,1024);for(let t=0;t<M.length;t++){let a=b[t];if(!a)continue;let{screenLeft:r,screenTop:i}=M[t];e.drawImage(a.img,a.sx,a.sy,a.sSize,a.sSize,r,i,u,u)}h&&(m.filter=n,m.drawImage(D,0,0),m.filter="none")}async function E(e,t,a,r){let i=e.getContext("2d");for(let e of(i.clearRect(0,0,1024,1024),r)){if(!e?.template||null!=e.maxBaseZoom&&a>e.maxBaseZoom)continue;let r=Math.min(a,e.maxZoom??a),n=Math.pow(2,a-r);await C(i,t,r,e.template,n,e.filter||"none")}}e.s(["NOAA_ENC_TEMPLATE",0,d,"default",0,function({mode:e="chart",opacity:h=1}){let{heading:f}=(0,u.default)(),w=(0,a.useRef)(),b=(0,a.useRef)(null),x=(0,a.useRef)(null),F=(0,a.useRef)(!1),N=(0,a.useRef)({position:null,zoom:null}),S=(0,a.useRef)(0),{id:D}=(0,m.default)(),C=h<1?"day":D,T=g[C]||g.day,$=(0,a.useRef)([]),{gl:k}=(0,r.useThree)(),P=s.default.get("aisLengthScalingFactor")||.7,[R,z]=(0,a.useState)(16),[I,A]=(0,a.useState)(500),j=(0,o.useSignalKPath)("navigation.position"),L=(0,a.useRef)(null);(0,a.useEffect)(()=>{L.current=j},[j]);let O=j?.latitude!=null&&j?.longitude!=null,G=O&&p(j.latitude,j.longitude),[U,_]=(0,a.useState)(!1),W=h<1&&(G||U)?Math.max(h,.55):h;(0,i.useFrame)(({camera:t})=>{if(S.current++,S.current%15!=0)return;let a=L.current;if(a?.latitude==null)return;let r=Math.min(Math.max(4*(t.position.length()/P),"meteo"===e?3e3:500),6e4),i=Math.max(3,Math.min("meteo"===e?15:$.current[0]?.template===c?19:18,Math.round(Math.log2(156543.03*Math.cos(a.latitude*Math.PI/180)/(r/1024)))));i!==R&&z(i)});let B=(0,a.useRef)(!1),H=(0,a.useRef)(null),Z=(0,a.useCallback)((e=!1)=>{if(F.current){B.current=!0;return}let t=L.current;if(t?.latitude==null||t?.longitude==null)return;let a=N.current;if(!e&&a.position&&a.zoom===R){let e=48*M(t.latitude,R)/111320,r=Math.abs(t.latitude-a.position.latitude),i=Math.abs(t.longitude-a.position.longitude);if(r<e&&i<e)return}let r=b.current,i=x.current;if(!r||!i)return;F.current=!0,N.current={position:t,zoom:R};let n=1024*M(t.latitude,R);E(r,t,R,$.current).then(()=>{i.needsUpdate=!0,A(n/2*P)}).catch(e=>console.warn("MapPlane3D: tile rendering failed:",e?.message||e)).finally(()=>{F.current=!1,B.current&&(B.current=!1,H.current?.())})},[R,P]);(0,a.useEffect)(()=>{H.current=Z},[Z]),(0,a.useEffect)(()=>{let e=document.createElement("canvas");e.width=1024,e.height=1024,b.current=e;let t=new n.CanvasTexture(e);return t.minFilter=n.LinearMipmapLinearFilter,t.magFilter=n.LinearFilter,t.anisotropy=k.capabilities.getMaxAnisotropy(),t.generateMipmaps=!0,x.current=t,w.current&&(w.current.material.map=t,w.current.material.needsUpdate=!0),()=>{t.dispose()}},[k]),(0,a.useEffect)(()=>{let t=!1,a=()=>{t||H.current?.(!0)},r=[{template:c,maxZoom:19,filter:T},..."meteo"===e?[]:G?[{template:d,maxZoom:18,filter:v[C]}]:[{template:"https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png",maxZoom:18,filter:y[C]}]];return($.current=r,"meteo"===e)?(a(),fetch("https://api.rainviewer.com/public/weather-maps.json").then(e=>e.json()).then(e=>{let r=e?.radar?.past,i=r?.[r.length-1]?.path;i&&!t&&($.current=[...$.current,{template:`https://tilecache.rainviewer.com${i}/256/{z}/{x}/{y}/2/1_1.png`,maxZoom:7,maxBaseZoom:12}],a())}).catch(()=>{}),()=>{t=!0}):(l.default.apiCall("/signalk/v1/api/resources/charts").then(e=>{if(t||!e||"object"!=typeof e)return;let r=Object.values(e),i=r.find(e=>"openstreetmap"!==e.identifier&&e.tilemapUrl)||r.find(e=>e.tilemapUrl);if(_(!!i?.tilemapUrl&&"openstreetmap"!==i.identifier),i?.tilemapUrl){let e=i.tilemapUrl.includes("{z}")?i.tilemapUrl:`${i.tilemapUrl}/{z}/{x}/{y}.png`,t=Number(i.maxzoom??i.maxZoom);$.current=[{template:e,maxZoom:Number.isFinite(t)&&t>0?Math.min(t,18):18,filter:v[C]}]}a()}).catch(()=>{t||($.current=r,a())}),()=>{t=!0})},[e,C,G]),(0,a.useEffect)(()=>{Z()},[j,e,R]),(0,a.useEffect)(()=>{w.current&&x.current&&(w.current.material.map=x.current,w.current.material.needsUpdate=!0)});let V=(0,a.useMemo)(()=>new n.PlaneGeometry(1,1),[]),Y=(0,a.useMemo)(()=>new n.MeshBasicMaterial({side:n.DoubleSide,transparent:h<1,opacity:h,depthWrite:h>=1,polygonOffset:!0,polygonOffsetFactor:2,polygonOffsetUnits:8}),[h]);return((0,a.useEffect)(()=>{Y.opacity=W},[Y,W]),(0,a.useEffect)(()=>()=>{V.dispose(),Y.dispose()},[V,Y]),O)?(0,t.jsx)("group",{rotation:[0,f,0],children:(0,t.jsx)("mesh",{ref:w,geometry:V,material:Y,rotation:[-Math.PI/2,0,0],position:[0,-.1,0],scale:[2*I,2*I,1]})}):null},"inUsWaters",0,p],10502);let T=["https://overpass-api.de/api/interpreter","https://maps.mail.ru/osm/tools/overpass/api/interpreter"],$=["cardinal","lateral","isolated_danger","safe_water","special_purpose"],k=`^(buoy|beacon)_(${$.join("|")})$`,P=e=>Math.round(10*e)/10,R=(e,t,a)=>{let r=a/111320,i=a/(111320*Math.max(.1,Math.cos(e*Math.PI/180))),n=[];for(let a=Math.floor((e-r)/.1);a<=Math.floor((e+r)/.1);a++)for(let e=Math.floor((t-i)/.1);e<=Math.floor((t+i)/.1);e++)n.push({s:P(.1*a),w:P(.1*e),key:`${a}:${e}`});return n},z=({s:e,w:t})=>`${T[0]}?data=${encodeURIComponent(`[out:json];node["seamark:type"~"${k}"](${e},${t},${P(e+.1)},${P(t+.1)});out body;`)}`,I=e=>e?String(e).split(";").map(e=>e.trim().toLowerCase()).filter(Boolean):[],A=e=>{let t=parseFloat(e);return Number.isFinite(t)?t:null},j=e=>{let t=e.tags||{},a=t["seamark:type"]||"",[r,...i]=a.split("_"),n=i.join("_"),o=e=>t[`seamark:${a}:${e}`],l=t["seamark:light:character"]?{character:t["seamark:light:character"],group:t["seamark:light:group"]||"",period:A(t["seamark:light:period"]),colour:I(t["seamark:light:colour"])[0]||"white"}:null;return{id:e.id,lat:e.lat,lon:e.lon,name:t["seamark:name"]||t.name||"",kind:n,beacon:"beacon"===r,category:(o("category")||"").toLowerCase(),shape:(o("shape")||"").toLowerCase(),colours:I(o("colour")),pattern:(o("colour_pattern")||"").toLowerCase(),system:(o("system")||"").toLowerCase(),height:A(o("height")),topmark:t["seamark:topmark:shape"]?{shape:t["seamark:topmark:shape"].toLowerCase(),colours:I(t["seamark:topmark:colour"])}:null,light:l}},L=0,O=e=>e.filter(e=>"node"===e.type&&Number.isFinite(e.lat)&&Number.isFinite(e.lon)).map(j).filter(e=>$.includes(e.kind)),G=async(e,t=25)=>{let a=Math.min(...e.map(e=>e.s)),r=Math.min(...e.map(e=>e.w)),i=P(Math.max(...e.map(e=>e.s))+.1),n=P(Math.max(...e.map(e=>e.w))+.1),o=`[out:json][timeout:${t}];node["seamark:type"~"${k}"](${a},${r},${i},${n});out body;`;for(let t of T)try{let a=await fetch(`${t}?data=${encodeURIComponent(o)}`,{referrerPolicy:"strict-origin-when-cross-origin"});if(!a.ok)continue;let r=await a.json();if(r.remark&&/error|timeout|runtime/i.test(r.remark))continue;let i=r.elements||[],n={};return await Promise.all(e.map(e=>{n[e.key]=i.filter(t=>t.lat>=e.s&&t.lat<e.s+.1&&t.lon>=e.w&&t.lon<e.w+.1);let t=JSON.stringify({elements:n[e.key]});return(0,h.storeCached)(z(e),new Response(t,{headers:{"Content-Type":"application/json"}}))})),n}catch{}throw Error("Overpass unreachable")},U=async e=>{let t={},a=[];for(let r of e){let e=await (0,h.readCached)(z(r)).catch(()=>null);e?t[r.key]=O((await e.json()).elements||[]):a.push(r)}if(a.length&&Date.now()>=L)try{let e=await G(a);Object.entries(e).forEach(([e,a])=>{t[e]=O(a)})}catch{L=Date.now()+12e4}return t},_=async(e,t,a)=>{let r=R(e,t,a);return r.length?Object.keys(await G(r,90)).length:0};e.s(["cellsAround",0,R,"loadCells",0,U,"prefetchSeamarks",0,_],97776)},71415,47233,e=>{"use strict";var t=e.i(43476),a=e.i(71645),r=e.i(90072),i=e.i(60099),n=e.i(43758),o=e.i(83646),l=e.i(83402),s=e.i(85709),u=e.i(78461),h=e.i(3950),m=e.i(48390);e.i(85269);var c=e.i(22831),d=e.i(95393),f=e.i(54983),p=e.i(78311),g=e.i(18032),v=e.i(54735),y=e.i(69435);let w=`
|
|
2
|
+
attribute float aDepth;
|
|
3
|
+
attribute vec2 aGround;
|
|
4
|
+
varying float vDepth;
|
|
5
|
+
varying vec2 vGround;
|
|
6
|
+
varying vec3 vLocal;
|
|
7
|
+
varying vec3 vWorld;
|
|
8
|
+
void main() {
|
|
9
|
+
vDepth = aDepth;
|
|
10
|
+
vGround = aGround;
|
|
11
|
+
vLocal = position;
|
|
12
|
+
// Same expression as the seabed's: the same depth, no fighting
|
|
13
|
+
vec4 w = modelMatrix * vec4(position, 1.0);
|
|
14
|
+
vWorld = w.xyz;
|
|
15
|
+
gl_Position = projectionMatrix * viewMatrix * w;
|
|
16
|
+
}
|
|
17
|
+
`,M=`
|
|
18
|
+
uniform vec3 uCam; // camera in the mesh frame (x east, y north, z up)
|
|
19
|
+
uniform float uScale; // scene units per metre
|
|
20
|
+
uniform float uTime;
|
|
21
|
+
uniform float uMax; // speed at the top of the colour map, m/s
|
|
22
|
+
uniform float uOpacity; // opacity of a deep column
|
|
23
|
+
uniform float uDepthScale; // metres of water for ~63 % of it
|
|
24
|
+
uniform float uFlow; // drift of the pattern, times the current
|
|
25
|
+
uniform sampler2D uMap;
|
|
26
|
+
varying float vDepth;
|
|
27
|
+
varying vec2 vGround;
|
|
28
|
+
varying vec3 vLocal;
|
|
29
|
+
varying vec3 vWorld;
|
|
30
|
+
${y.NOISE_GLSL}
|
|
31
|
+
${y.FIELD_GLSL}
|
|
32
|
+
|
|
33
|
+
void main() {
|
|
34
|
+
if (vDepth <= 0.05) discard;
|
|
35
|
+
// Water the view ray crosses from the surface down to this point of
|
|
36
|
+
// the bottom, counted up to twice the depth: grazing rays cross
|
|
37
|
+
// hundreds of metres, and the far seabed would vanish under the colour
|
|
38
|
+
vec3 P = vLocal;
|
|
39
|
+
vec3 C = uCam;
|
|
40
|
+
vec3 E = C.z > 0.0 ? C + (P - C) * (C.z / (C.z - P.z)) : C;
|
|
41
|
+
float L = min(length(P - E) / uScale, vDepth * 2.0);
|
|
42
|
+
// Surface current; the column's mean is ~7/8 of it (1/7 power law)
|
|
43
|
+
vec2 flow = flowAt(vGround);
|
|
44
|
+
float t = clamp(length(flow) * 0.875 / uMax, 0.0, 1.0);
|
|
45
|
+
vec3 col = texture2D(uMap, vec2(t, 0.5)).rgb;
|
|
46
|
+
// A soft pattern drifting with the stream (sped up so it shows) and
|
|
47
|
+
// stretched along it: the direction reads without a single line
|
|
48
|
+
float fl = length(flow);
|
|
49
|
+
vec2 dir = fl > 1e-3 ? flow / fl : vec2(0.0, 1.0);
|
|
50
|
+
vec2 drift = vGround - flow * uTime * uFlow;
|
|
51
|
+
vec2 q = vec2(dot(drift, dir) / 240.0, dot(drift, vec2(-dir.y, dir.x)) / 36.0);
|
|
52
|
+
float n = fbm(vec3(q, uTime * 0.04));
|
|
53
|
+
float streak = mix(1.0, 0.6 + 0.8 * n, smoothstep(0.02, 0.25, t));
|
|
54
|
+
col *= 0.85 + 0.3 * n * smoothstep(0.02, 0.25, t);
|
|
55
|
+
// Slack water stays light: the veil thickens with the speed too
|
|
56
|
+
float alpha = uOpacity * (1.0 - exp(-L / uDepthScale)) * streak * mix(0.3, 1.0, t);
|
|
57
|
+
alpha *= fieldMask(vGround) * (1.0 - smoothstep(1500.0, 2100.0, length(vWorld.xz)));
|
|
58
|
+
if (alpha < 0.004) discard;
|
|
59
|
+
gl_FragColor = vec4(col, clamp(alpha, 0.0, 1.0));
|
|
60
|
+
#include <colorspace_fragment>
|
|
61
|
+
}
|
|
62
|
+
`,b=({geometry:e})=>{let{field:i,hour:n,top:o}=(0,v.useCurrentField)(),s=l.default.get("aisLengthScalingFactor")||.7,u=l.default.get("currentColorMap")||v.DEFAULT_CURRENT_MAP,h=(0,y.useFieldTexture)(i,n,4),m=(0,a.useMemo)(()=>new r.ShaderMaterial({uniforms:{uCam:{value:new r.Vector3},uScale:{value:s},uTime:{value:0},uMax:{value:1},uOpacity:{value:Number(l.default.get("currentOpacity"))||.75},uDepthScale:{value:8},uFlow:{value:12},uMap:{value:null},uField:{value:null},uFieldHalf:{value:1},uFieldRange:{value:4}},vertexShader:w,fragmentShader:M,transparent:!0,depthWrite:!1,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1}),[s]);(0,a.useEffect)(()=>()=>m.dispose(),[m]);let c=(0,a.useMemo)(()=>(0,f.colorMapTexture)(u),[u]);(0,a.useEffect)(()=>()=>c.dispose(),[c]),(0,a.useEffect)(()=>{let e=m.uniforms;e.uMap.value=c,e.uField.value=h,e.uFieldHalf.value=i?.half??1,e.uMax.value=o},[m,c,h,i,o]);let b=(0,a.useRef)(),x=(0,a.useMemo)(()=>new r.Vector3,[]),[F,N]=(0,a.useState)([]),S=(0,a.useRef)(1);return((0,d.useFrame)(({camera:t,clock:a,gl:r},l)=>{let h=b.current;if(!h)return;h.updateWorldMatrix(!0,!1);let c=h.worldToLocal(x.copy(t.position));if(m.uniforms.uCam.value.copy(c),m.uniforms.uTime.value=a.elapsedTime,S.current+=l,S.current<1||!i)return;S.current=0;let d=e.attributes.position,f=e.attributes.aGround,p=f.getX(0)-d.getX(0)/s,y=f.getY(0)-d.getY(0)/s,w=(0,v.currentMarkers)({field:i,hour:n,top:o,mapName:u,refE:p,refN:y,scale:s,radius:1450,z:.3,onScreen:(0,g.onScreenTest)(b.current,t,r.domElement),cx:p+c.x/s,cy:y+c.y/s,heightM:Math.max(5,c.z/s),isWater:(t,a)=>((e,t,a)=>{let{width:r,widthSegments:i}=e.parameters,n=(t+r/2)/r*i,o=(r/2-a)/r*i;if(n<0||o<0||n>=i||o>=i)return NaN;let l=Math.floor(n),s=Math.floor(o),u=n-l,h=o-s,m=e.attributes.aDepth.array,c=(e,t)=>m[t*(i+1)+e];return(c(l,s)*(1-u)+c(l+1,s)*u)*(1-h)+(c(l,s+1)*(1-u)+c(l+1,s+1)*u)*h})(e,t,a)>1.5});N(e=>(0,g.sameMarkers)(e,w)?e:w)}),i)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("mesh",{ref:b,rotation:[-Math.PI/2,0,0],geometry:e,material:m,renderOrder:2}),(0,t.jsx)("group",{rotation:[-Math.PI/2,0,0],children:(0,t.jsx)(p.default,{items:F,width:v.CURRENT_ARROW_WIDTH,screen:1})})]}):null},x=(e,t)=>{let a=.09/Math.cos(e*Math.PI/180);return{south:e-.09,north:e+.09,west:t-a,east:t+a}},F={emodnet:{datum:"cd",pixels:192,url:(e,t)=>`https://ows.emodnet-bathymetry.eu/wcs?service=WCS&version=1.0.0&request=GetCoverage&coverage=emodnet:mean&crs=EPSG:4326&bbox=${e.west},${e.south},${e.east},${e.north}&format=image/tiff&width=${t}&height=${t}`},noaa:{datum:"msl",pixels:384,url:(e,t)=>`https://gis.ngdc.noaa.gov/arcgis/rest/services/DEM_mosaics/DEM_all/ImageServer/exportImage?bbox=${e.west},${e.south},${e.east},${e.north}&bboxSR=4326&imageSR=4326&size=${t},${t}&format=tiff&pixelType=F32&interpolation=RSP_BilinearInterpolation&f=image`}},N=new Map,S=async(e,t)=>{let a=F[e],r=await (0,h.cachedFetch)(a.url(t,a.pixels),{kind:"tile"});if(!r.ok)throw Error(`${e} ${r.status}`);let{width:i,height:n,values:o}=(e=>{let t=new DataView(e),a=18761===t.getUint16(0),r=e=>t.getUint16(e,a),i=e=>t.getUint32(e,a);if(42!==r(2))throw Error("Not a TIFF");let n=i(4),o={},l={1:1,3:2,4:4,11:4,12:8,16:8};for(let e=0;e<r(n);e++){let a=n+2+12*e,s=r(a),u=r(a+2),h=i(a+4),m=(l[u]||1)*h<=4?a+8:i(a+8),c=e=>3===u?r(m+2*e):4===u?i(m+4*e):t.getUint8(m+e);o[s]=Array.from({length:h},(e,t)=>c(t))}let s=o[256][0],u=o[257][0];if((o[259]?.[0]??1)!==1)throw Error("Compressed TIFF");if((o[258]?.[0]??32)!==32)throw Error("Not 32-bit");let h=new Float32Array(s*u).fill(NaN),m=(e,r,i,n,o)=>{for(let l=0;l<o;l++)for(let o=0;o<n;o++){if(r+o>=s||i+l>=u)continue;let m=t.getFloat32(e+(l*n+o)*4,a);h[(i+l)*s+r+o]=12e3>Math.abs(m)?m:NaN}};if(o[322]){let e=o[322][0],t=o[323][0],a=Math.ceil(s/e);o[324].forEach((r,i)=>m(r,i%a*e,Math.floor(i/a)*t,e,t))}else{let e=o[278]?.[0]??u;o[273].forEach((t,a)=>m(t,0,a*e,s,Math.min(e,u-a*e)))}return{width:s,height:u,values:h}})(await r.arrayBuffer()),l=0;for(let e=0;e<o.length;e++)Number.isFinite(o[e])&&l++;if(l<.2*o.length)throw Error(`${e}: not covered`);let s=(t.north-t.south)*111320/n;return{heights:o,width:i,height:n,nw:{lat:t.north,lon:t.west},se:{lat:t.south,lon:t.east},linear:!0,datum:a.datum,source:e,resolution:s}},D=(e,t)=>({lat:.04*Math.round(e/.04),lon:.04*Math.round(t/.04)}),C=(e,t)=>e>=15&&e<=90&&t>=-36&&t<=43?["emodnet","noaa"]:["noaa"],E=async(e,t)=>{let{lat:a,lon:r}=D(e,t),i=`${a.toFixed(2)},${r.toFixed(2)}`;if(N.has(i))return N.get(i);let n=x(a,r),o=C(a,r),l=null;for(let e of o)try{l=await S(e,n);break}catch(t){console.warn(`Regional bathymetry: ${e} unavailable (${t.message})`)}if(l)for(N.set(i,l);N.size>3;)N.delete(N.keys().next().value);return l},T=(e,t,a)=>{let{heights:r,width:i,height:n,nw:o,se:l}=e,s=(a-o.lon)/(l.lon-o.lon)*(i-1),u=(o.lat-t)/(o.lat-l.lat)*(n-1);if(s<0||u<0||s>i-1||u>n-1)return NaN;let h=Math.min(i-2,Math.floor(s)),m=Math.min(n-2,Math.floor(u)),c=s-h,d=u-m,f=(e,t)=>r[t*i+e];return(f(h,m)*(1-c)+f(h+1,m)*c)*(1-d)+(f(h,m+1)*(1-c)+f(h+1,m+1)*c)*d};e.s(["loadRegionalSeabed",0,E,"regionalHeightAt",0,T,"regionalSeabedUrls",0,(e,t)=>{let a=D(e,t),r=x(a.lat,a.lon);return C(a.lat,a.lon).map(e=>F[e].url(r,F[e].pixels))}],47233);let $="https://elevation-tiles-prod.s3.amazonaws.com/terrarium/{z}/{x}/{y}.png",k=10,P=.1,R=["navigation.position","design.draft","environment.tide.heightNow","environment.tide.heightHigh","environment.tide.heightLow","environment.depth.belowSurface","environment.depth.belowKeel","environment.depth.belowTransducer","environment.depth.surfaceToTransducer"],z=(e,t,a)=>{let r=2**a,i=e*Math.PI/180,n=(1-Math.log(Math.tan(i)+1/Math.cos(i))/Math.PI)/2*r;return{x:(t+180)/360*r,y:n}},I=(e,t,a)=>{let r=2**a;return{lat:180*Math.atan(Math.sinh(Math.PI*(1-2*t/r)))/Math.PI,lon:e/r*360-180}},A=new Map,j=async(e,t,a=$,r=k)=>{let i=z(e,t,r),n=Math.floor(i.x)-1,o=Math.floor(i.y)-1,l=`${a}|${r}/${n},${o}`;if(A.has(l))return A.get(l);let s=document.createElement("canvas");s.width=768,s.height=768;let u=s.getContext("2d",{willReadFrequently:!0});if(!(await Promise.all(Array.from({length:9},async(e,t)=>{let i=n+t%3,l=o+Math.floor(t/3),s=a.replace("{z}",r).replace("{x}",i).replace("{y}",l);try{let e=await (0,h.cachedImage)(s);return u.drawImage(e,t%3*256,256*Math.floor(t/3)),!0}catch{return!1}}))).some(Boolean))return null;let m=u.getImageData(0,0,768,768).data,c=new Float32Array(589824);for(let e=0;e<589824;e++)c[e]=m[4*e+3]<255?NaN:256*m[4*e]+m[4*e+1]+m[4*e+2]/256-32768;let d={heights:c,size:768,nw:I(n,o,r),se:I(n+3,o+3,r),z:r};return A.set(l,d),d},L=async(e,t)=>{let a=(0,m.bathymetryTileTemplate)(),[r,i]=await Promise.all([j(e,t),a?j(e,t,a,13).catch(()=>null):null]);if(!r&&!i)throw Error("No bathymetry");return{global:r,shom:i}},O=(e,t,a)=>{let{heights:r,size:i,nw:n,se:o,z:l}=e,s=(a-n.lon)/(o.lon-n.lon)*(i-1),u=z(n.lat,n.lon,l),h=z(o.lat,o.lon,l),m=(z(t,a,l).y-u.y)/(h.y-u.y)*(i-1);if(s<0||m<0||s>i-1||m>i-1)return NaN;let c=Math.min(i-2,Math.floor(s)),d=Math.min(i-2,Math.floor(m)),f=s-c,p=m-d,g=(e,t)=>r[t*i+e];return(g(c,d)*(1-f)+g(c+1,d)*f)*(1-p)+(g(c,d+1)*(1-f)+g(c+1,d+1)*f)*p},G=`
|
|
63
|
+
attribute float aDepth;
|
|
64
|
+
attribute float aDrying;
|
|
65
|
+
attribute vec2 aGround;
|
|
66
|
+
varying float vDepth;
|
|
67
|
+
varying float vDrying;
|
|
68
|
+
varying vec2 vGround;
|
|
69
|
+
varying vec3 vWorld;
|
|
70
|
+
void main() {
|
|
71
|
+
vDepth = aDepth;
|
|
72
|
+
vDrying = aDrying;
|
|
73
|
+
vGround = aGround;
|
|
74
|
+
vec4 w = modelMatrix * vec4(position, 1.0);
|
|
75
|
+
vWorld = w.xyz;
|
|
76
|
+
gl_Position = projectionMatrix * viewMatrix * w;
|
|
77
|
+
}
|
|
78
|
+
`,U=`
|
|
79
|
+
uniform float uDanger;
|
|
80
|
+
uniform vec3 uShallow;
|
|
81
|
+
uniform vec3 uMid;
|
|
82
|
+
uniform vec3 uDeep;
|
|
83
|
+
uniform vec3 uLand;
|
|
84
|
+
uniform vec3 uDrying;
|
|
85
|
+
uniform vec3 uLine;
|
|
86
|
+
uniform vec3 uDangerColor;
|
|
87
|
+
uniform vec3 uFade;
|
|
88
|
+
uniform float uFadeNear;
|
|
89
|
+
uniform float uFadeFar;
|
|
90
|
+
varying float vDepth;
|
|
91
|
+
varying float vDrying;
|
|
92
|
+
varying vec2 vGround;
|
|
93
|
+
varying vec3 vWorld;
|
|
94
|
+
|
|
95
|
+
float contour(float d, float level, float width) {
|
|
96
|
+
float w = fwidth(d);
|
|
97
|
+
return 1.0 - smoothstep(0.0, w * width, abs(d - level));
|
|
98
|
+
}
|
|
99
|
+
float gridLines(vec2 p, float spacing, float width) {
|
|
100
|
+
vec2 g = abs(fract(p / spacing - 0.5) - 0.5) * spacing;
|
|
101
|
+
vec2 w = fwidth(p) * width;
|
|
102
|
+
vec2 l = 1.0 - smoothstep(vec2(0.0), w, g);
|
|
103
|
+
return max(l.x, l.y);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
void main() {
|
|
107
|
+
vec3 c;
|
|
108
|
+
if (vDepth <= 0.0) {
|
|
109
|
+
c = vDrying > 0.5 ? uDrying : uLand;
|
|
110
|
+
} else if (vDepth < 6.0) {
|
|
111
|
+
c = mix(uShallow, uMid, vDepth / 6.0);
|
|
112
|
+
} else {
|
|
113
|
+
// Darker with depth, as light fades under water: the relief reads at a glance
|
|
114
|
+
c = mix(uMid, uDeep, clamp((vDepth - 6.0) / 18.0, 0.0, 1.0));
|
|
115
|
+
}
|
|
116
|
+
// Relief: hill shading from the north-west, as on a shaded survey
|
|
117
|
+
vec3 n = normalize(cross(dFdx(vWorld), dFdy(vWorld)));
|
|
118
|
+
if (n.y < 0.0) n = -n;
|
|
119
|
+
c *= 0.5 + 0.65 * clamp(dot(n, normalize(vec3(-0.6, 0.7, -0.5))), 0.0, 1.0);
|
|
120
|
+
// Too shallow for us: orange hatching (not a fill, which reads as land)
|
|
121
|
+
if (vDepth > 0.0 && vDepth < uDanger) {
|
|
122
|
+
float hatch = step(0.55, fract((vGround.x + vGround.y) / 14.0));
|
|
123
|
+
c = mix(c, uDangerColor, 0.25 + 0.45 * hatch);
|
|
124
|
+
}
|
|
125
|
+
// The survey grid, fading out with distance before it shimmers
|
|
126
|
+
float dist = length(vWorld.xz);
|
|
127
|
+
float gridFade = 1.0 - smoothstep(900.0, 1700.0, dist);
|
|
128
|
+
float minor = gridLines(vGround, 50.0, 1.5) * 0.55;
|
|
129
|
+
float major = gridLines(vGround, 250.0, 2.4) * 0.85;
|
|
130
|
+
c = mix(c, uLine, max(minor, major) * gridFade * (vDepth > 0.0 ? 1.0 : 0.4));
|
|
131
|
+
// Isobaths, the drying line bold
|
|
132
|
+
float lines = max(max(contour(vDepth, 2.0, 1.5), contour(vDepth, 5.0, 1.5)), max(contour(vDepth, 10.0, 1.5), contour(vDepth, 20.0, 1.5)));
|
|
133
|
+
lines = max(lines, max(contour(vDepth, 30.0, 1.2), contour(vDepth, 50.0, 1.2)) * 0.7);
|
|
134
|
+
lines = max(lines, contour(vDepth, 0.0, 2.5));
|
|
135
|
+
lines = max(lines, contour(vDepth, uDanger, 2.0) * 0.9);
|
|
136
|
+
c = mix(c, uLine * 0.75, clamp(lines, 0.0, 1.0) * 0.85);
|
|
137
|
+
c = mix(c, uFade, smoothstep(uFadeNear, uFadeFar, dist));
|
|
138
|
+
gl_FragColor = vec4(c, 1.0);
|
|
139
|
+
#include <colorspace_fragment>
|
|
140
|
+
}
|
|
141
|
+
`,_={light:{water:"#8fd3ff",waterOpacity:.18,shallow:"#b5e0f2",mid:"#5fa8d8",deep:"#1c4f86",land:"#e2d6b8",drying:"#c7d3a6",line:"#0f3557",danger:"#e8873a",fade:"#e8eef3",text:"#0f2f4f",halo:"#ffffff"},dark:{water:"#7cc8f2",waterOpacity:.12,shallow:"#3a8fbc",mid:"#1d5f8c",deep:"#0b2238",land:"#4a4434",drying:"#34472e",line:"#8fdcff",danger:"#f0a060",fade:"#16191e",text:"#e6f4ff",halo:"#101216"},night:{water:"#c0503c",waterOpacity:.1,shallow:"#7a2a1e",mid:"#4f1a12",deep:"#24100c",land:"#3a1a10",drying:"#3a2410",line:"#ff8a72",danger:"#ffad80",fade:"#120807",text:"#ffb3a3",halo:"#0f0706"}},W=[96,40],B=`
|
|
142
|
+
attribute vec3 aCenter;
|
|
143
|
+
attribute vec2 aCell;
|
|
144
|
+
uniform vec2 uAtlas;
|
|
145
|
+
uniform float uSize;
|
|
146
|
+
varying vec2 vUv;
|
|
147
|
+
varying float vFade;
|
|
148
|
+
void main() {
|
|
149
|
+
vec4 mv = modelViewMatrix * vec4(aCenter, 1.0);
|
|
150
|
+
float d = -mv.z;
|
|
151
|
+
// Constant size on screen (like the HUD text), none right under the camera
|
|
152
|
+
float size = d * uSize;
|
|
153
|
+
mv.xy += position.xy * vec2(size * 2.4, size);
|
|
154
|
+
vUv = (aCell + vec2(position.x + 0.5, 0.5 - position.y)) / uAtlas;
|
|
155
|
+
vFade = (1.0 - smoothstep(1100.0, 1700.0, length(aCenter.xz))) * smoothstep(25.0, 60.0, d);
|
|
156
|
+
gl_Position = projectionMatrix * mv;
|
|
157
|
+
}
|
|
158
|
+
`,H=`
|
|
159
|
+
uniform sampler2D uMap;
|
|
160
|
+
varying vec2 vUv;
|
|
161
|
+
varying float vFade;
|
|
162
|
+
void main() {
|
|
163
|
+
vec4 t = texture2D(uMap, vUv);
|
|
164
|
+
if (t.a * vFade < 0.05) discard;
|
|
165
|
+
gl_FragColor = vec4(t.rgb, t.a * vFade);
|
|
166
|
+
#include <colorspace_fragment>
|
|
167
|
+
}
|
|
168
|
+
`,Z=({items:e,palette:i})=>{let{geometry:n,material:o}=(0,a.useMemo)(()=>{if(!e.length)return{};let[t,a]=W,n=Math.ceil(e.length/16),o=document.createElement("canvas");o.width=16*t,o.height=a*n;let l=o.getContext("2d");l.textAlign="center",l.textBaseline="middle";let s=new r.PlaneGeometry(1,1),u=new r.InstancedBufferGeometry;u.index=s.index,u.setAttribute("position",s.attributes.position);let h=new Float32Array(3*e.length),m=new Float32Array(2*e.length);e.forEach((e,r)=>{let n=r%16*t,o=Math.floor(r/16)*a;l.font=`${e.danger?700:600} 28px Inter, Roboto, Arial, sans-serif`,l.lineWidth=7,l.strokeStyle=i.halo,l.strokeText(e.text,n+t/2,o+a/2+1),l.fillStyle=e.danger?i.danger:i.text,l.fillText(e.text,n+t/2,o+a/2+1),h.set(e.position,3*r),m.set([r%16,Math.floor(r/16)],2*r)}),u.setAttribute("aCenter",new r.InstancedBufferAttribute(h,3)),u.setAttribute("aCell",new r.InstancedBufferAttribute(m,2)),u.instanceCount=e.length;let c=new r.CanvasTexture(o);c.colorSpace=r.SRGBColorSpace,c.flipY=!1,c.anisotropy=4;let d=new r.ShaderMaterial({uniforms:{uMap:{value:c},uAtlas:{value:new r.Vector2(16,n)},uSize:{value:.03}},vertexShader:B,fragmentShader:H,transparent:!0,depthWrite:!1});return s.dispose(),{geometry:u,material:d}},[e,i]);return((0,a.useEffect)(()=>()=>{n?.dispose(),o?.uniforms.uMap.value.dispose(),o?.dispose()},[n,o]),n)?(0,t.jsx)("mesh",{geometry:n,material:o,frustumCulled:!1,renderOrder:3}):null},V=e=>e<10?e.toFixed(1):String(Math.round(e));e.s(["BATHY_ZOOM",0,10,"TERRARIUM",0,$,"default",0,({y:e=-.1,current:h=!1})=>{let d,f=(0,s.useSignalKPaths)(R),{t:p}=(0,c.useTranslation)(),{id:g}=(0,o.default)(),v=f["navigation.position"],{heading:y}=(0,u.default)(),[w,M]=(0,a.useState)(null),x=l.default.get("aisLengthScalingFactor")||.7,F=Number.isFinite(f["design.draft"]?.maximum)?f["design.draft"].maximum:Number(l.default.get("boatDraft"))||2,N=f["environment.depth.belowSurface"],S=f["environment.depth.belowKeel"],D=f["environment.depth.belowTransducer"],C=f["environment.depth.surfaceToTransducer"],$=Number.isFinite(N)?N:Number.isFinite(S)?S+F:Number.isFinite(D)?D+(Number.isFinite(C)?C:0):null,I=_[g]||_.light,A=v?.latitude,j=v?.longitude,W=Number.isFinite(A)?(d=z(A,j,k),`${Math.floor(d.x)},${Math.floor(d.y)}`):null;(0,a.useEffect)(()=>{if(!W)return;let e=!1,t=null,a=()=>L(A,j).then(r=>{!e&&(M(r),!r.shom&&(0,m.bathymetryTileTemplate)()&&(t=setTimeout(a,6e4)))}).catch(()=>{e||(t=setTimeout(a,6e4))});return a(),()=>{e=!0,clearTimeout(t)}},[W]);let[B,H]=(0,a.useState)(null),Y=Number.isFinite(A)?`${Math.round(A/.04)},${Math.round(j/.04)}`:null;(0,a.useEffect)(()=>{if(!Y)return;let e=!1,t=null,a=()=>E(A,j).then(r=>{e||(r?H(r):t=setTimeout(a,6e4))});return a(),()=>{e=!0,clearTimeout(t)}},[Y]);let K=(e,t)=>B?T(B,e,t):NaN,q=B&&B.resolution<60,X=Number.isFinite(A)?Math.round(5e3*A):null,J=Number.isFinite(j)?Math.round(5e3*j):null,Q=(0,a.useMemo)(()=>{if(!w&&!B||null===X)return{};let e=w?.shom?O(w?.shom,A,j):NaN,t=K(A,j);return{survey:Number.isFinite(e)?e:B?.datum==="cd"?t:NaN,global:B?.datum==="msl"&&Number.isFinite(t)?t:w?.global?O(w?.global,A,j):NaN}},[w,B,X,J]),ee=(({tideNow:e,tideHigh:t,tideLow:a,measured:r,surveyHere:i,globalHere:n})=>{let o=(e,t=P)=>Math.round(e/t)*t;if(Number.isFinite(e)){let r=Number.isFinite(t)&&Number.isFinite(a)?e-(t+a)/2:0;return{cd:o(e),msl:o(r),source:"tide"}}if(Number.isFinite(r)&&(Number.isFinite(i)||Number.isFinite(n))){let e=Number.isFinite(i)?r+i:0,t=Number.isFinite(n)?r+n:0;return{cd:o(e,.5),msl:o(t,.5),source:"sounder"}}return{cd:0,msl:0,source:"datum"}})({tideNow:f["environment.tide.heightNow"],tideHigh:f["environment.tide.heightHigh"],tideLow:f["environment.tide.heightLow"],measured:$,surveyHere:Q.survey,globalHere:Q.global}),[et,ea]=(0,a.useState)({cd:NaN,msl:NaN});(0,a.useEffect)(()=>{let e=(e,t)=>Number.isFinite(e)?1e-6>Math.abs(e-t):!Number.isFinite(t);if(e(et.cd,ee.cd)&&e(et.msl,ee.msl))return;let t={cd:ee.cd,msl:ee.msl},a=setTimeout(()=>ea(t),Number.isFinite(et.cd)||Number.isFinite(et.msl)?2e4:0);return()=>clearTimeout(a)},[ee.cd,ee.msl,et]);let er=Number.isFinite(et.cd)||!Number.isFinite(ee.cd)?et.cd:ee.cd,ei=Number.isFinite(et.msl)||!Number.isFinite(ee.msl)?et.msl:ee.msl,en=(0,a.useMemo)(()=>w||B?(e,t)=>{let a=w?.shom?O(w?.shom,e,t):NaN;if(Number.isFinite(a))return{h:a-er,drying:a<6.5};let r=K(e,t);if(Number.isFinite(r))return"cd"===B.datum?{h:r-er,drying:r<6.5}:{h:r-ei,drying:r<3};let i=w?.global?O(w?.global,e,t):NaN;return Number.isFinite(i)?{h:i-ei,drying:i<3}:null}:null,[w,B,er,ei]),eo=Math.round((Number.isFinite($)?$:F+1)*2)/2,el=(0,a.useMemo)(()=>{if(!en||!Number.isFinite(A))return en;let e=w?.shom&&Number.isFinite(O(w?.shom,A,j))||q&&Number.isFinite(K(A,j));return((e,t,a,r,i)=>{let n=e(t,a),o=-r;if(!n||n.h<=o)return e;let l=o-n.h,s=111320*Math.cos(t*Math.PI/180);return(r,n)=>{let o=e(r,n);if(!o)return o;let u=Math.hypot((r-t)*111320,(n-a)*s)/i;if(u>=1)return o;let h=1-u*u*(3-2*u);return{h:o.h+l*h,drying:!(h>.5)&&o.drying}}})(en,A,j,eo,e?60:350)},[en,eo,X,J]),es=(0,a.useMemo)(()=>{let e,t;if(!el||!Number.isFinite(A))return null;let a=w?.shom||q?240:160,i=(w?.shom,1),n=new r.PlaneGeometry(6e3*x,6e3*x,a,a),o=n.attributes.position,l=new Float32Array(o.count),s=new Float32Array(o.count),u=new Float32Array(2*o.count),h=111320*Math.cos(A*Math.PI/180),m=(e=Math.round(10*A)/10,t=Math.round(10*j)/10,{east:(j-t)*111320*Math.cos(e*Math.PI/180),north:(A-e)*111320});for(let e=0;e<o.count;e++){let t=o.getX(e)/x,a=o.getY(e)/x,r=el(A+a/111320,j+t/h),n=r?r.h:0;l[e]=-n,s[e]=+!!r?.drying,u[2*e]=m.east+t,u[2*e+1]=m.north+a,o.setZ(e,n<0?n*i*x:(.15+ +Math.min(n,4))*x)}n.setAttribute("aDepth",new r.BufferAttribute(l,1)),n.setAttribute("aDrying",new r.BufferAttribute(s,1)),n.setAttribute("aGround",new r.BufferAttribute(u,2)),n.computeVertexNormals();let c=[],d=250*Math.ceil((m.east-1500)/250),f=250*Math.ceil((m.north-1500)/250);for(let e=d;e<=m.east+1500;e+=250)for(let t=f;t<=m.north+1500;t+=250){let a=e-m.east+125,r=t-m.north+125;if(Math.hypot(a,r)>1500)continue;let n=el(A+r/111320,j+a/h);if(!n||n.h>=-.1)continue;let o=-n.h;c.push({text:V(o),danger:o<F+1,position:[a*x,n.h*i*x+2,-r*x]})}let p=el(A,j);return{geometry:n,items:c,exaggeration:i,bottom:p&&p.h<0?p.h*i*x:null,depthHere:p?-p.h:null}},[el,x,F,A&&Math.round(500*A),j&&Math.round(500*j)]);(0,a.useEffect)(()=>()=>es?.geometry.dispose(),[es]);let eu=(0,a.useMemo)(()=>new r.ShaderMaterial({uniforms:{uDanger:{value:3},uShallow:{value:new r.Color},uMid:{value:new r.Color},uDeep:{value:new r.Color},uLand:{value:new r.Color},uDrying:{value:new r.Color},uLine:{value:new r.Color},uDangerColor:{value:new r.Color},uFade:{value:new r.Color},uFadeNear:{value:1500},uFadeFar:{value:2100}},vertexShader:G,fragmentShader:U}),[]);(0,a.useEffect)(()=>{let e=eu.uniforms;e.uDanger.value=F+1,e.uShallow.value.set(I.shallow),e.uMid.value.set(I.mid),e.uDeep.value.set(I.deep),e.uLand.value.set(I.land),e.uDrying.value.set(I.drying),e.uLine.value.set(I.line),e.uDangerColor.value.set(I.danger),e.uFade.value.set(I.fade)},[eu,F,I]),(0,a.useEffect)(()=>()=>eu.dispose(),[eu]);let eh=(0,a.useMemo)(()=>new r.ShaderMaterial({uniforms:{uColor:{value:new r.Color},uOpacity:{value:.16}},vertexShader:`
|
|
169
|
+
varying float vDist;
|
|
170
|
+
void main() {
|
|
171
|
+
vDist = length(position.xy);
|
|
172
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
173
|
+
}`,fragmentShader:`
|
|
174
|
+
uniform vec3 uColor;
|
|
175
|
+
uniform float uOpacity;
|
|
176
|
+
varying float vDist;
|
|
177
|
+
void main() {
|
|
178
|
+
gl_FragColor = vec4(uColor, uOpacity * (1.0 - smoothstep(1500.0, 2100.0, vDist)));
|
|
179
|
+
#include <colorspace_fragment>
|
|
180
|
+
}`,transparent:!0,depthWrite:!1,side:r.DoubleSide}),[]);if((0,a.useEffect)(()=>{let e=eh.uniforms;e.uColor.value.set(I.water),e.uOpacity.value=I.waterOpacity},[eh,I]),(0,a.useEffect)(()=>()=>eh.dispose(),[eh]),!es||!Number.isFinite(A))return null;let em=es.depthHere,ec=Number.isFinite($)&&Number.isFinite(em)&&"tide"===ee.source?$-em:null,ed=(Number.isFinite($)?-$*es.exaggeration*x:null)??es.bottom,ef=null!==ec&&Math.abs(ec)>=.3,ep=Number.isFinite($)?$:em,eg=-F*x;return(0,t.jsxs)("group",{rotation:[0,y,0],position:[0,e,0],children:[(0,t.jsx)("mesh",{rotation:[-Math.PI/2,0,0],geometry:es.geometry,material:eu,renderOrder:-2}),h&&(0,t.jsx)(b,{geometry:es.geometry}),(0,t.jsx)("mesh",{rotation:[-Math.PI/2,0,0],material:eh,renderOrder:1,children:(0,t.jsx)("circleGeometry",{args:[3e3*x,96]})}),(0,t.jsx)(Z,{items:es.items,palette:I}),null!==ed&&ed<eg&&(0,t.jsxs)("group",{children:[(0,t.jsx)(n.default,{points:[[0,eg,0],[0,ed,0]],color:I.line,lineWidth:2,dashed:!0,dashSize:1.2,gapSize:.8}),(0,t.jsxs)("mesh",{position:[0,ed,0],rotation:[-Math.PI/2,0,0],children:[(0,t.jsx)("ringGeometry",{args:[1.2,1.8,32]}),(0,t.jsx)("meshBasicMaterial",{color:I.line,transparent:!0,opacity:.8,side:r.DoubleSide})]}),ef&&null!==es.bottom&&(0,t.jsxs)("mesh",{position:[0,es.bottom,0],rotation:[-Math.PI/2,0,0],children:[(0,t.jsx)("ringGeometry",{args:[1,1.4,32]}),(0,t.jsx)("meshBasicMaterial",{color:I.danger,transparent:!0,opacity:.8,side:r.DoubleSide})]}),Number.isFinite(ep)&&(0,t.jsx)(i.Html,{position:[0,ed/2,0],zIndexRange:[5,0],style:{pointerEvents:"none"},children:(0,t.jsxs)("div",{className:"ml-3 -translate-y-1/2 whitespace-nowrap px-1.5 py-px rounded-md text-caption font-semibold tabular-nums text-hud-main bg-hud-bg/70 backdrop-blur-sm",children:[V(ep)," m",ef&&(0,t.jsxs)("span",{className:"ml-1.5 font-normal text-hud-muted",children:[p("bathymetry.chartDepth",{depth:V(em)})," ","(",ec>0?"+":"−",Math.abs(ec).toFixed(1),")"]}),"sounder"===ee.source&&(0,t.jsx)("span",{className:"ml-1.5 font-normal text-hud-muted",children:p("bathymetry.levelFromSounder")})]})})]})]})}],71415)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,48390,t=>{"use strict";var e=t.i(67034),r=t.i(83402);let n=()=>{let t,e=r.default.getAll();return t=e.signalKUrlSet&&e.signalkUrl?r.default.normalizeSignalKUrl(e.signalkUrl):"function"==typeof r.default.getComputedSignalKUrl?r.default.getComputedSignalKUrl():e.signalkUrl||"http://localhost:3000",{enabled:!1!==e.ocearoCoreEnabled,baseUrl:t,timeout:6e4,useAuthentication:e.useAuthentication||!1,username:e.username||"",password:e.password||""}},o=async(t,r={})=>{let o=n();if(!o.enabled)throw Error("OcearoCore is not enabled");let i=new AbortController,{timeout:a,...s}=r,u=setTimeout(()=>i.abort(),a||o.timeout);try{let r=`${o.baseUrl}/plugins/ocearo-core${t}`,n={"Content-Type":"application/json",...s.headers};if(o.useAuthentication&&o.username)try{let t="function"==typeof btoa?btoa(`${o.username}:${o.password||""}`):e.Buffer.from(`${o.username}:${o.password||""}`).toString("base64");n.Authorization=`Basic ${t}`}catch(t){}let a=await fetch(r,{signal:i.signal,headers:n,credentials:"include",...s});if(clearTimeout(u),!a.ok){let t=a.headers.get("content-type")||"";if(404===a.status||t.includes("text/html")){let t=Error(`OcearoCore plugin not available at ${r}`);throw t.name="NetworkError",t}let e=await a.text().catch(()=>a.statusText);throw Error(`OcearoCore API error (${a.status}): ${e}`)}return await a.json()}catch(t){if(clearTimeout(u),"AbortError"===t.name){let t=Error("OcearoCore API request timed out");throw t.name="TimeoutError",t}if("TypeError"===t.name&&("Failed to fetch"===t.message||t.message.includes("NetworkError"))){let t=Error(`OcearoCore server unreachable at ${o.baseUrl}`);throw t.name="NetworkError",t}throw t}},i=async()=>{try{return await o("/status")}catch(t){return console.warn("Failed to get OcearoCore status:",t),{error:t.message,available:!1}}},a=async(t,e={})=>{let r=["weather","sail","alerts","ais","status","logbook","route","racing","briefing"];if(!r.includes(t))throw Error(`Invalid analysis type. Valid types: ${r.join(", ")}`);return await o("/analyze",{method:"POST",timeout:12e4,body:JSON.stringify({type:t,...e})})},s=async t=>{let e=["sailing","anchored","motoring","moored","racing"];if(!e.includes(t))throw Error(`Invalid mode. Valid modes: ${e.join(", ")}`);return await o("/mode",{method:"POST",body:JSON.stringify({mode:t})})},u=async()=>await o("/dnd"),f=async(t,e)=>{let r=["off","safety","all"];if(!r.includes(t))throw Error(`Invalid DND mode. Valid modes: ${r.join(", ")}`);let n={mode:t};return"number"==typeof e&&e>0&&(n.durationMinutes=e),await o("/dnd",{method:"POST",body:JSON.stringify(n)})},l=async(t=[])=>await o("/logbook/analyze",{method:"POST",body:JSON.stringify({entries:t})}),h=async t=>{if(!t||"object"!=typeof t)throw Error("Current data is required and must be an object");return await o("/logbook/entry",{method:"POST",body:JSON.stringify({currentData:t})})},c=async(t,e=null)=>{if(!t||"object"!=typeof t)throw Error("Fuel data is required and must be an object");try{let r={datetime:new Date().toISOString(),type:"fuel_refill",position:e||{latitude:null,longitude:null},fuel:{liters:t.liters,cost:t.cost,additive:t.additive||!1,engineHoursAtRefill:t.engineHours,previousEngineHours:t.previousEngineHours||null,hoursSinceLastRefill:t.hoursSinceLastRefill||null},liters:t.liters,author:"fuel_log",text:`Fuel refill: ${t.liters}L - ${t.cost}€${t.additive?" (with additive)":""} - Engine hours: ${t.engineHours}h`};return await o("/logbook/fuel",{method:"POST",body:JSON.stringify(r)})}catch(n){let r={datetime:new Date().toISOString(),type:"fuel_refill",position:e||{latitude:null,longitude:null},fuel:{liters:t.liters,cost:t.cost,additive:t.additive||!1,engineHoursAtRefill:t.engineHours,previousEngineHours:t.previousEngineHours||null,hoursSinceLastRefill:t.hoursSinceLastRefill||null},author:"fuel_log",text:`Fuel refill: ${t.liters}L - ${t.cost}€${t.additive?" (with additive)":""} - Engine hours: ${t.engineHours}h`};return await w(r)}},g=async()=>{try{let t=await o("/logbook/fuel");if(Array.isArray(t)&&t.length>=0)return t}catch(t){}return(await b()).filter(t=>"fuel_refill"===t.type||"fuel_log"===t.author)},p=(t,e=null)=>{if(!t||0===t.length)return{averageConsumption:null,totalLiters:0,totalCost:0,refillCount:0,estimatedTankLevel:null,lastRefill:null};let r=[...t].sort((t,e)=>new Date(t.datetime)-new Date(e.datetime)),n=0,o=0,i=0,a=[];for(let t=0;t<r.length;t++){let e=r[t].fuel||{};if(n+=e.liters||0,o+=e.cost||0,e.hoursSinceLastRefill&&e.hoursSinceLastRefill>0){let t=e.liters||0,r=e.hoursSinceLastRefill;t>0&&r>0&&(a.push(t/r),i+=r)}}let s=a.length>0?a.reduce((t,e)=>t+e,0)/a.length:null,u=a.length>0?Math.max(...a):null,f=r[r.length-1],l=f?.fuel||{};return{averageConsumption:s?Math.round(10*s)/10:null,worstConsumption:u?Math.round(10*u)/10:null,totalLiters:Math.round(10*n)/10,totalCost:Math.round(100*o)/100,refillCount:r.length,totalHours:Math.round(10*i)/10,lastRefill:f?{date:new Date(f.datetime),liters:l.liters,engineHours:l.engineHoursAtRefill}:null}},d=async t=>{let e=Number.isFinite(t)&&t>0?`?limit=${t}`:"";return await o(`/navigation/anchor/track${e}`)},y=async()=>await o("/bathymetry/status"),m=async(t,e,r)=>await o("/bathymetry/download",{method:"POST",body:JSON.stringify({lat:t,lon:e,radiusNm:r})}),b=async(t,e)=>{let r=new URLSearchParams;t&&r.append("startDate",t),e&&r.append("endDate",e);let n=r.toString(),i=`/logbook/all-entries${n?`?${n}`:""}`;return await o(i)},w=async t=>{if(!t||"object"!=typeof t)throw Error("Entry data is required and must be an object");return await o("/logbook/add-entry",{method:"POST",body:JSON.stringify(t)})};t.s(["addFuelLogEntry",0,c,"addLogbookEntry",0,w,"analyzeLogbookWithOcearoCore",0,l,"bathymetryTileTemplate",0,()=>{let t=n();return t.enabled?`${t.baseUrl}/plugins/ocearo-core/bathymetry/tiles/{z}/{x}/{y}.png`:null},"calculateFuelStats",0,p,"downloadBathymetry",0,m,"estimateTankLevel",0,(t,e,r,n=null)=>{let o=p(t,r);if(!o.lastRefill||!o.averageConsumption||!e)return{estimatedLiters:null,estimatedPercent:null,hoursRemaining:null,basedOnSensor:null!==n,sensorLevel:null!==n?Math.round(100*n):null};let i=e-o.lastRefill.engineHours,a=o.worstConsumption||o.averageConsumption,s=i*o.averageConsumption,u=t=>{let e;if(r)e=r-t;else{if(!o.lastRefill.liters)return null;e=o.lastRefill.liters-t}return Math.max(0,e)},f=u(s),l=u(i*a),h=t=>null!==t&&r?Math.round(Math.max(0,Math.min(100,t/r*100))):null,c=null!==f&&o.averageConsumption>0?Math.max(0,f/o.averageConsumption):null,g=null!==l&&a>0?Math.max(0,l/a):null;return{estimatedLiters:null!==f?Math.round(10*f)/10:null,estimatedLitersWorst:null!==l?Math.round(10*l)/10:null,estimatedPercent:h(f),estimatedPercentWorst:h(l),hoursRemaining:null!==c?Math.round(10*c)/10:null,hoursRemainingWorst:null!==g?Math.round(10*g)/10:null,hoursSinceLastRefill:Math.round(10*i)/10,estimatedUsed:Math.round(10*s)/10,basedOnSensor:null!==n,sensorLevel:null!==n?Math.round(100*n):null}},"fetchFuelLogEntries",0,g,"fetchLogbookEntries",0,b,"generateOcearoCoreLogbookEntry",0,h,"getAnchorTrack",0,d,"getBathymetryStatus",0,y,"getOcearoCoreDnd",0,u,"getOcearoCoreStatus",0,i,"handleOcearoCoreError",0,(t,e="OcearoCore operation")=>"NetworkError"===t.name?(console.warn(`${e} failed: OcearoCore server unreachable.`,t.message),"OcearoCore server unreachable. Please check if the service is running."):"TimeoutError"===t.name||t.message.includes("timed out")?(console.warn(`${e} failed: OcearoCore request timed out.`),"OcearoCore service is not responding (timeout)"):(console.warn(`${e} failed:`,t.message),t.message.includes("not enabled"))?"OcearoCore is not enabled in the configuration":t.message.includes("Logbook write failed")||t.message.includes("Logbook manager not initialized")?"Logbook service error. Please check the ocearo-core plugin status.":t.message.includes("503")?"Service temporarily unavailable. Please try again later.":t.message.includes("404")?"Feature not found or not installed":t.message.includes("500")?"Internal server error. Check server logs for details.":t.message||"Unknown error occurred","isOcearoCoreEnabled",0,()=>n().enabled,"makeOcearoCoreApiCall",0,o,"requestAnalysis",0,a,"setOcearoCoreDnd",0,f,"updateOcearoCoreMode",0,s])},67034,(t,e,r)=>{var n={872:function(t,e){"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return(r+n)*3/4-n},e.toByteArray=function(t){var e,r,i=u(t),a=i[0],s=i[1],f=new o((a+s)*3/4-s),l=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],f[l++]=e>>16&255,f[l++]=e>>8&255,f[l++]=255&e;return 2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,f[l++]=255&e),1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,f[l++]=e>>8&255,f[l++]=255&e),f},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],a=0,s=n-o;a<s;a+=16383)i.push(function(t,e,n){for(var o,i=[],a=e;a<n;a+=3)o=(t[a]<<16&0xff0000)+(t[a+1]<<8&65280)+(255&t[a+2]),i.push(r[o>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}(t,a,a+16383>s?s:a+16383));return 1===o?i.push(r[(e=t[n-1])>>2]+r[e<<4&63]+"=="):2===o&&i.push(r[(e=(t[n-2]<<8)+t[n-1])>>10]+r[e>>4&63]+r[e<<2&63]+"="),i.join("")};for(var r=[],n=[],o="u">typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,s=i.length;a<s;++a)r[a]=i[a],n[i.charCodeAt(a)]=a;function u(t){var e=t.length;if(e%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");-1===r&&(r=e);var n=r===e?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},230:function(t,e,r){"use strict";var n=r(872),o=r(321),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(t){if(t>0x7fffffff)throw RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t){var n=t,o=e;if(("string"!=typeof o||""===o)&&(o="utf8"),!s.isEncoding(o))throw TypeError("Unknown encoding: "+o);var i=0|g(n,o),u=a(i),f=u.write(n,o);return f!==i&&(u=u.slice(0,f)),u}if(ArrayBuffer.isView(t))return h(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(L(t,ArrayBuffer)||t&&L(t.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(L(t,SharedArrayBuffer)||t&&L(t.buffer,SharedArrayBuffer)))return function(t,e,r){var n;if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),s.prototype),n}(t,e,r);if("number"==typeof t)throw TypeError('The "value" argument must not be of type number. Received type number');var l=t.valueOf&&t.valueOf();if(null!=l&&l!==t)return s.from(l,e,r);var p=function(t){if(s.isBuffer(t)){var e=0|c(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||function(t){return t!=t}(t.length)?a(0):h(t):"Buffer"===t.type&&Array.isArray(t.data)?h(t.data):void 0}(t);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return s.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function f(t){if("number"!=typeof t)throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return f(t),a(t<0?0:0|c(t))}function h(t){for(var e=t.length<0?0:0|c(t.length),r=a(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}e.Buffer=s,e.SlowBuffer=function(t){return+t!=t&&(t=0),s.alloc(+t)},e.INSPECT_MAX_BYTES=50,e.kMaxLength=0x7fffffff,s.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),!s.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),s.poolSize=8192,s.from=function(t,e,r){return u(t,e,r)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array),s.alloc=function(t,e,r){return(f(t),t<=0)?a(t):void 0!==e?"string"==typeof r?a(t).fill(e,r):a(t).fill(e):a(t)},s.allocUnsafe=function(t){return l(t)},s.allocUnsafeSlow=function(t){return l(t)};function c(t){if(t>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|t}function g(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||L(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(t).length;default:if(o)return n?-1:B(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var o,i,a,s=!1;if((void 0===e||e<0)&&(e=0),e>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(e>>>=0)))return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=x[t[i]];return o}(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}(this,e,r);case"latin1":case"binary":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}(this,e,r);case"base64":return o=this,i=e,a=r,0===i&&a===o.length?n.fromByteArray(o):n.fromByteArray(o.slice(i,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}(this,e,r);default:if(s)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),s=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){var i;if(0===t.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length)if(o)return -1;else r=t.length-1;else if(r<0)if(!o)return -1;else r=0;if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e){if(e&=255,"function"==typeof Uint8Array.prototype.indexOf)if(o)return Uint8Array.prototype.indexOf.call(t,e,r);else return Uint8Array.prototype.lastIndexOf.call(t,e,r);return m(t,[e],r,n,o)}throw TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){var i,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return -1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var l=-1;for(i=r;i<s;i++)if(f(t,i)===f(e,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else -1!==l&&(i-=i-l),l=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var h=!0,c=0;c<u;c++)if(f(t,i+c)!==f(e,c)){h=!1;break}if(h)return i}return -1}s.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==s.prototype},s.compare=function(t,e){if(L(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),L(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(t)||!s.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:+(n<r)},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s.alloc(0);if(void 0===e)for(r=0,e=0;r<t.length;++r)e+=t[r].length;var r,n=s.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var i=t[r];if(L(i,Uint8Array)&&(i=s.from(i)),!s.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},s.byteLength=g,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},s.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},s.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},s.prototype.toString=function(){var t=this.length;return 0===t?"":0==arguments.length?b(this,0,t):p.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},i&&(s.prototype[i]=s.prototype.inspect),s.prototype.compare=function(t,e,r,n,o){if(L(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return -1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),h=0;h<u;++h)if(f[h]!==l[h]){i=f[h],a=l[h];break}return i<a?-1:+(a<i)},s.prototype.includes=function(t,e,r){return -1!==this.indexOf(t,e,r)},s.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},s.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)};function b(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,a,s,u,f=t[o],l=null,h=f>239?4:f>223?3:f>191?2:1;if(o+h<=r)switch(h){case 1:f<128&&(l=f);break;case 2:(192&(i=t[o+1]))==128&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],(192&i)==128&&(192&a)==128&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],(192&i)==128&&(192&a)==128&&(192&s)==128&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=h}var c=n,g=c.length;if(g<=4096)return String.fromCharCode.apply(String,c);for(var p="",d=0;d<g;)p+=String.fromCharCode.apply(String,c.slice(d,d+=4096));return p}function w(t,e,r){if(t%1!=0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}function v(t,e,r,n,o,i){if(!s.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw RangeError('"value" argument is out of bounds');if(r+n>t.length)throw RangeError("Index out of range")}function E(t,e,r,n,o,i){if(r+n>t.length||r<0)throw RangeError("Index out of range")}function C(t,e,r,n,i){return e*=1,r>>>=0,i||E(t,e,r,4,34028234663852886e22,-34028234663852886e22),o.write(t,e,r,n,23,4),r+4}function S(t,e,r,n,i){return e*=1,r>>>=0,i||E(t,e,r,8,17976931348623157e292,-17976931348623157e292),o.write(t,e,r,n,52,8),r+8}s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o,i,a,s,u,f,l,h,c=this.length-e;if((void 0===r||r>c)&&(r=c),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var g=!1;;)switch(n){case"hex":return function(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s,u=parseInt(e.substr(2*a,2),16);if((s=u)!=s)break;t[r+a]=u}return a}(this,t,e,r);case"utf8":case"utf-8":return o=e,i=r,T(B(t,this.length-o),this,o,i);case"ascii":return a=e,s=r,T(O(t),this,a,s);case"latin1":case"binary":return function(t,e,r,n){return T(O(e),t,r,n)}(this,t,e,r);case"base64":return u=e,f=r,T(U(t),this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l=e,h=r,T(function(t,e){for(var r,n,o=[],i=0;i<t.length&&!((e-=2)<0);++i)n=(r=t.charCodeAt(i))>>8,o.push(r%256),o.push(n);return o}(t,this.length-l),this,l,h);default:if(g)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),g=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return Object.setPrototypeOf(n,s.prototype),n},s.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},s.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||w(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||w(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+0x1000000*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||w(t,4,this.length),0x1000000*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return(t>>>=0,e||w(t,1,this.length),128&this[t])?-((255-this[t]+1)*1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||w(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||w(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?0xffff0000|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||w(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||w(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||w(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||w(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||w(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||w(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;v(this,t,e,r,o,0)}var i=1,a=0;for(this[e]=255&t;++a<r&&(i*=256);)this[e+a]=t/i&255;return e+r},s.prototype.writeUIntBE=function(t,e,r,n){if(t*=1,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;v(this,t,e,r,o,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,4,0xffffffff,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,4,0xffffffff,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t*=1,e>>>=0,!n){var o=Math.pow(2,8*r-1);v(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i<r&&(a*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/a|0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t*=1,e>>>=0,!n){var o=Math.pow(2,8*r-1);v(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a|0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,4,0x7fffffff,-0x80000000),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t*=1,e>>>=0,r||v(this,t,e,4,0x7fffffff,-0x80000000),t<0&&(t=0xffffffff+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return S(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return S(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r||0===t.length||0===this.length)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o=n-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var i=o-1;i>=0;--i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===t.length){var o,i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var a=s.isBuffer(t)?t:s.from(t,n),u=a.length;if(0===u)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=a[o%u]}return this};var A=/[^+/0-9A-Za-z-_]/g;function B(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319||a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function O(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function U(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(A,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function T(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length)&&!(o>=t.length);++o)e[o+r]=t[o];return o}function L(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}var x=function(){for(var t="0123456789abcdef",e=Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()},321:function(t,e){e.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<<s)-1,f=u>>1,l=-7,h=r?o-1:0,c=r?-1:1,g=t[e+h];for(h+=c,i=g&(1<<-l)-1,g>>=-l,l+=s;l>0;i=256*i+t[e+h],h+=c,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=c,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(g?-1:1);a+=Math.pow(2,n),i-=f}return(g?-1:1)*a*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<<f)-1,h=l>>1,c=5960464477539062e-23*(23===o),g=n?0:i-1,p=n?1:-1,d=+(e<0||0===e&&1/e<0);for(isNaN(e=Math.abs(e))||e===1/0?(s=+!!isNaN(e),a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?e+=c/u:e+=c*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,o),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,o),a=0));o>=8;t[r+g]=255&s,g+=p,s/=256,o-=8);for(a=a<<o|s,f+=o;f>0;t[r+g]=255&a,g+=p,a/=256,f-=8);t[r+g-p]|=128*d}}},o={};function i(t){var e=o[t];if(void 0!==e)return e.exports;var r=o[t]={exports:{}},a=!0;try{n[t](r,r.exports,i),a=!1}finally{a&&delete o[t]}return r.exports}i.ab="/ROOT/node_modules/next/dist/compiled/buffer/",e.exports=i(230)},79866,(t,e,r)=>{e.exports={boats:[{name:"Racer 10.8",modelPath:"racer",capabilities:["navigation","sail","color"]},{name:"Catamaran 14",modelPath:"catamaran",capabilities:["navigation","sail","color"]},{name:"Sailboat",modelPath:"default",capabilities:["navigation","rudder","sail","color"]},{name:"Ship",modelPath:"ship",capabilities:["navigation","ais"]},{name:"Windsurf",modelPath:"windsurf",capabilities:["navigation","ais"]},{name:"Wing foil",modelPath:"wingfoil",capabilities:["navigation","ais"]}]}},83402,t=>{"use strict";var e=t.i(79866);let r=new class{constructor(){this.defaultConfig={signalkUrl:"http://localhost:3000",username:"",password:"",useAuthentication:!1,signalKUrlSet:!1,debugMode:!1,selectedBoat:"Racer 10.8",primaryColor:null,metallicEffect:!1,aisLengthScalingFactor:.7,compassNorthUp:!1,hide3DCompass:!1,hideTrueWind:!1,showCustomUrls:!1,customExternalUrls:{},currentView:"default",theme:"dark",language:"en",distanceUnits:"nm",depthUnits:"m",speedUnits:"kn",temperatureUnits:"C",positionFormat:"DD",preferTrueValues:!0,preferredWindSpeedPath:"speedTrue",preferredWindDirectionPath:"directionTrue",preferredHeadingPath:"courseOverGroundTrue",debugWindOverride:!1,debugWindSpeed:10,debugWindDirection:0,debugShowAxes:!1,showSailTrimSliders:!0,showRigging:!0,showSeamarks3D:!0,seamarksOverpass:!0,staleDataTimeout:30},this.configKey="ocearoConfig",this.inMemoryConfig={...this.defaultConfig},this.config=this.loadConfig()}isLocalStorageAvailable(){try{return"u">typeof localStorage}catch{return!1}}loadConfig(){if(this.isLocalStorageAvailable()){let t=localStorage.getItem(this.configKey);if(!t)return this.saveConfig(this.defaultConfig),{...this.defaultConfig};try{let e={...this.defaultConfig,...JSON.parse(t)};return(e.boatChosen||"Default"!==e.selectedBoat)&&"RM1080"!==e.selectedBoat&&"Optimist"!==e.selectedBoat||(e.selectedBoat="Racer 10.8"),"Default"===e.selectedBoat&&(e.selectedBoat="Sailboat"),e}catch(t){return console.error("Failed to parse stored configuration:",t),{...this.defaultConfig}}}return{...this.inMemoryConfig}}saveConfig(t){this.config={...this.config,...t},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.config}}get(t){return this.config[t]}set(t,e){this.config[t]=e,this.saveConfig(this.config)}resetConfig(){this.config={...this.defaultConfig},this.isLocalStorageAvailable()?localStorage.setItem(this.configKey,JSON.stringify(this.config)):this.inMemoryConfig={...this.defaultConfig}}getAll(){return{...this.config}}getDefaultConfig(){return{...this.defaultConfig}}getSelectedBoat(){let t=this.config.selectedBoat;return t?this.getBoatsData().find(e=>e.name===t):null}getBoatsData(){return e.default.boats}getSignalKUrl(){return this.config.signalKUrlSet&&this.config.signalkUrl?this.normalizeSignalKUrl(this.config.signalkUrl):this.getComputedSignalKUrl()}normalizeSignalKUrl(t){let e=String(t).trim().replace(/\/+$/,"");if(!e)return e;e=e.replace(/^wss:\/\//i,"https://").replace(/^ws:\/\//i,"http://");let r="https:"===window.location.protocol;return/^https?:\/\//i.test(e)||(e=`${r?"https":"http"}://${e}`),e=e.replace(/^https?:/i,t=>t.toLowerCase()),r&&e.startsWith("http://")&&(e="https://"+e.slice(7).replace(/:80(?=\/|$)/,"")),e}getComputedSignalKUrl(){return this.config.debugMode?"https://demo.signalk.org:443":`${window.location.protocol}//${window.location.hostname}${window.location.port?":"+window.location.port:""}`}getCurrentView(){return this.config.currentView||this.defaultConfig.currentView}setCurrentView(t){this.set("currentView",t)}};t.s(["default",0,r])}]);
|