1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5286],{5286:(e,t,r)=>{r.r(t),r.d(t,{FishingMapApp:()=>eo});var o=r(5155),n=r(2115);let i=(0,n.createContext)(null);function a({children:e,initialActiveLayer:t="oceanColor",initialRegion:r="ECARIB",initialRegionDisplayName:a="Eastern Caribbean"}){let[l,s]=(0,n.useState)(t),[c,u]=(0,n.useState)(r),[d,p]=(0,n.useState)(a),[g,f]=(0,n.useState)(!1),h=(0,n.useMemo)(()=>({activeLayer:l,setActiveLayer:s,region:c,setRegion:u,regionDisplayName:d,setRegionDisplayName:p,showFishSpots:g,setShowFishSpots:f}),[l,c,d,g]);return(0,o.jsx)(i.Provider,{value:h,children:e})}function l(){let e=(0,n.useContext)(i);if(!e)throw Error("useFishingContext must be used inside <FishingProvider>");return e}var s=r(7999);function c(e){let t=new Date(Date.UTC(parseInt(e.substring(0,4),10),parseInt(e.substring(4,6),10)-1,parseInt(e.substring(6,8),10),parseInt(e.substring(8,10),10),parseInt(e.substring(10,12),10),0)),r=t.getHours(),o=t.getMinutes().toString().padStart(2,"0"),n=r%12||12,i=r>=12?"PM":"AM",a=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t.getDay()],l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],s=t.getDate(),c=Intl.DateTimeFormat("en-US",{timeZoneName:"short"}).formatToParts(t).find(e=>"timeZoneName"===e.type)?.value||"";return{date:`${l} ${s}`,time:`${n}:${o} ${i}`,fullDate:`${a} ${l} ${s} ${n}:${o} ${i} (${c})`}}
1function u(e,t,r){let[o,i]=(0,n.useState)([]),[a,l]=(0,n.useState)(!1),[s,c]=(0,n.useState)(null),[u,d]=(0,n.useState)(-1),p=(0,n.useRef)(!1),g=(0,n.useCallback)(async()=>{l(!0),c(null);try{let t=await fetch(`https://d1bln9ue928wzu.cloudfront.net/vision/regions/${r}/fishing/${e}/${e}_timesteps.txt`);if(!t.ok)throw Error(`Failed to fetch timesteps: ${t.status}`);let o=await t.text(),n=function(e){let t=e.trim().split("\n"),r=[];for(let e of t){if(e.startsWith("timestep")||""===e.trim())continue;let t=e.split(",");if(t.length<2&&(t=e.split(" ")),t.length>=2){let e=t[1].trim();r.push({timestep:t[0].trim(),tileUrl:e,thumbnailUrl:e.replace(/\{z\}\/\{x\}\/\{y\}\.png$/,"thumbnail.png")})}}return r.sort((e,t)=>e.timestep.localeCompare(t.timestep)),r}(o);if(0===n.length)throw Error("No timesteps found");i(n),p.current||(p.current=!0,d(n.length-1))}catch(e){c(e instanceof Error?e.message:"Unknown error")}finally{l(!1)}},[e,r]);(0,n.useEffect)(()=>{t&&(p.current=!1,g())},[g,t]);let f=(0,n.useCallback)(e=>{e>=0&&e<o.length&&d(e)},[o.length]),h=u>=0&&u<o.length?o[u]:null;return{timesteps:o,loading:a,error:s,selectedIndex:u,selectedTimestep:h,selectTimestep:f}}r(2795);let d="fish-ocean-color-source",p="fish-ocean-color-layer",g="fish-sargassum-source",f="fish-sargassum-layer",h="fish-sst-source",y="fish-sst-layer",m="fish-sst-contour-source",b="fish-sst-contour-line",x="fish-sst-contour-label";function v(e,t,r){for(let r of t)try{e.getLayer(r)&&e.removeLayer(r)}catch{}for(let t of r)try{e.getSource(t)&&e.removeSource(t)}catch{}}function S(e){v(e,[p,f,x,b,y],[d,g,m,h])}function w(e,t,r,o,n){let i,a=e.getSource(t);if(a){a.setTiles([o]),e.getLayer(r)&&e.setPaintProperty(r,"raster-opacity",n);return}e.addSource(t,{type:"raster",tiles:[o],tileSize:256,minzoom:0,maxzoom:10});try{e.getLayer("country-boundaries")?i="country-boundaries":e.getLayer("poi-label")&&(i="poi-label")}catch{}e.addLayer({id:r,type:"raster",source:t,paint:{"raster-opacity":n,"raster-resampling":"linear"}},i)}let j=null,k=null;async function L(){return j||k||(k=(async()=>{try{let e=await fetch("https://d1bln9ue928wzu.cloudfront.net/vision/regions/wavemaps-fish-map-regions.geojson");if(!e.ok)throw Error(`Fishing regions fetch failed: ${e.status}`);let t=await e.json();return j={geojson:t,regions:function(e){let t=[];for(let r of e.features??[]){let e;if(!r||!r.properties||r.geometry?.type!=="Polygon"&&r.geometry?.type!=="MultiPolygon")continue;let o=r.properties,n=String(o.regionCode??"").trim();if(!n)continue;let i=String(o.displayName??n);"number"==typeof o.north&&"number"==typeof o.south&&"number"==typeof o.east&&"number"==typeof o.west&&(e=[o.west,o.south,o.east,o.north]),t.push({code:n,displayName:i,bbox:e,feature:r})}return t.sort((e,t)=>e.displayName.localeCompare(t.displayName)),t}(t)}}catch(e){return j={geojson:{type:"FeatureCollection",features:[]},regions:[]}}finally{k=null}})())}function C(){let[e,t]=(0,n.useState)(()=>({geojson:j?.geojson??null,regions:j?.regions??[],loading:!j}));return(0,n.useEffect)(()=>{if(j)return;let e=!1;return L().then(r=>{e||t({geojson:r.geojson,regions:r.regions,loading:!1})}),()=>{e=!0}},[]),e}function z(e){if(!e.bbox)return 1/0;let[t,r,o,n]=e.bbox;return Math.abs((o-t)*(n-r))}function F(e,t,r){if(0===e.length||!N(e[0],t,r))return!1;for(let o=1;o<e.length;o++)if(N(e[o],t,r))return!1;return!0}function N(e,t,r){let o=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let a=e[n][0],l=e[n][1],s=e[i][0],c=e[i][1];l>r!=c>r&&t<(s-a)*(r-l)/(c-l)+a&&(o=!o)}return o}r(5173);var E=r(3127),M=r(8486),T=r(4601),D=r(2369);let I="pk.eyJ1IjoibWlndWVsZmNhbmFscyIsImEiOiJjbWFzcHV1amwwNXJ5Mm1vOTZja2lsZHRlIn0.i0_Y1Qo_SGSB_GLb2zEqQw";function P(){let{map:e,isStyleLoaded:t,setMap:i,setStyleLoaded:a,viewState:l}=(0,s.J)(),c=(0,n.useRef)(null),u=(0,n.useRef)(null),d=(0,E.p)();(0,n.useEffect)(()=>{if(!c.current||u.current)return;let e=c.current;e.getBoundingClientRect();let t=!1;return(async()=>{let o=(await r.e(240).then(r.t.bind(r,8849,23))).default;if(t||!I)return;o.accessToken=I;let n=new o.Map({container:e,style:"mapbox://styles/miguelfcanals/cmnxmlfwr002g01qu0dm5d8ui",projection:"mercator",center:l.center,zoom:l.zoom,pitch:l.pitch,bearing:l.bearing,minZoom:2,maxZoom:15,antialias:!0,attributionControl:!1,logoPosition:"top-left"});if(t)return n.remove();u.current=n,i(n),n.addControl(new o.AttributionControl({compact:!0}),"top-left"),n.on("style.load",()=>{if(!t){n.resize();try{n.getLayer("country-boundaries")&&n.setPaintProperty("country-boundaries","fill-opacity",.999)}catch(e){}a(!0)}}),n.on("error",e=>{}),n.on("moveend",()=>{let e=n.getCenter();(0,T.L)({center:[e.lng,e.lat],zoom:n.getZoom(),pitch:n.getPitch(),bearing:n.getBearing()})})})(),()=>{if(t=!0,u.current){try{u.current.remove()}catch{}u.current=null,i(null),a(!1)}}},[]),(0,n.useEffect)(()=>
1{if(e&&t&&d){(0,M.x3)(e,d,{lineColor:"#FFFFFF",lineOpacity:.7,labelColor:"#FFFFFF",labelHaloColor:"rgba(20, 26, 35, 0.85)"}),(0,M.EH)(e);try{let t=e.getLayer("country-boundaries")?"country-boundaries":void 0;e.getLayer("bathy-contours")&&e.moveLayer("bathy-contours",t),e.getLayer("bathy-labels")&&e.moveLayer("bathy-labels",t)}catch{}try{e.getSource("mapbox-dem")||e.addSource("mapbox-dem",{type:"raster-dem",url:"mapbox://mapbox.mapbox-terrain-dem-v1",tileSize:512,maxzoom:14}),e.getLayer("fishing-hillshade")||e.addLayer({id:"fishing-hillshade",type:"hillshade",source:"mapbox-dem",layout:{visibility:"none"},paint:{"hillshade-exaggeration":.6,"hillshade-shadow-color":"#141A23","hillshade-highlight-color":"#ffffff","hillshade-accent-color":"#4a5b8a"}})}catch(e){}}},[e,t,d]);let p=(0,n.useCallback)(()=>u.current?.zoomIn(),[]),g=(0,n.useCallback)(()=>u.current?.zoomOut(),[]),f=(0,n.useCallback)(()=>{let e=u.current;e&&e.flyTo({center:l.center,zoom:l.zoom,pitch:l.pitch,bearing:l.bearing,essential:!0})},[l]);return(0,o.jsxs)("div",{className:"cur-map-wrap",style:{flex:1,position:"relative",minHeight:0,minWidth:0},children:[(0,o.jsx)("div",{ref:c,className:"cur-map",style:{position:"absolute",inset:0,width:"100%",height:"100%"}}),(0,o.jsx)("div",{className:"cur-pin",children:(0,o.jsx)(D.kL,{})}),(0,o.jsxs)("div",{className:"cur-map-controls",children:[(0,o.jsx)("button",{className:"cur-map-btn",onClick:p,"aria-label":"Zoom in",children:(0,o.jsx)(D.uI,{})}),(0,o.jsx)("button",{className:"cur-map-btn",onClick:g,"aria-label":"Zoom out",children:(0,o.jsx)(D.YP,{})}),(0,o.jsx)("button",{className:"cur-map-btn",onClick:f,"aria-label":"Recenter",children:(0,o.jsx)(D.Sh,{})})]})]})}function W(){var e,t;let r,i,a,l,{map:c}=(0,s.J)(),[u,d]=(0,n.useState)(null);return((0,n.useEffect)(()=>{if(!c)return;let e=()=>{let e=c.getCenter();d({lng:e.lng,lat:e.lat})};return e(),c.on("move",e),()=>{c.off("move",e)}},[c]),u)?(0,o.jsxs)("div",{style:{position:"absolute",top:26,left:"50%",transform:"translateX(-50%)",background:"#11161E",border:"1px solid rgba(255, 255, 255, 0.06)",borderRadius:14,boxShadow:"0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.25)",padding:"6px 14px",fontSize:12,fontFamily:'ui-monospace, "SF Mono", Menlo, Consolas, monospace',fontWeight:600,color:"#D8DBDF",letterSpacing:"0.02em",pointerEvents:"none",zIndex:6,whiteSpace:"nowrap"},children:[(i=Math.floor(r=Math.abs(e=u.lat)),`${i}\xb0${((r-i)*60).toFixed(1)}'${e>=0?"N":"S"}`)," \xb7 ",(l=Math.floor(a=Math.abs(t=u.lng)),`${l}\xb0${((a-l)*60).toFixed(1)}'${t>=0?"E":"W"}`)]}):null}function $(){let{map:e}=(0,s.J)(),{region:t,regionDisplayName:r,setRegion:i,setRegionDisplayName:a}=l(),{regions:c,loading:u}=C(),[d,p]=(0,n.useState)(!1),g=(0,n.useRef)(null);return(0,n.useEffect)(()=>{if(!d)return;let e=e=>{g.current&&(g.current.contains(e.target)||p(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[d]),(0,o.jsxs)("div",{ref:g,style:{position:"absolute",top:26,right:26,zIndex:6,pointerEvents:"auto"},children:[(0,o.jsxs)("button",{onClick:()=>p(e=>!e),style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px 10px 12px",minWidth:200,background:"#11161E",border:"1.5px solid rgba(255, 255, 255, 0.08)",borderRadius:14,boxShadow:"0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 20px rgba(0, 0, 0, 0.40), 0 0 0 4px rgba(0, 0, 0, 0.08)",color:"#D8DBDF",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',fontSize:13,fontWeight:700,letterSpacing:"0.01em",cursor:"pointer",transition:"background 0.14s, border-color 0.14s, box-shadow 0.14s, transform 0.10s"},onMouseEnter:e=>{let t=e.currentTarget;t.style.borderColor="rgba(105, 212, 190, 0.75)",t.style.boxShadow="0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(0, 0, 0, 0.10)",t.style.transform="translateY(-1px)"},onMouseLeave:e=>{let t=e.currentTarget;t.style.borderColor="rgba(105, 212, 190, 0.45)",t.style.boxShadow="0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 20px rgba(0, 0, 0, 0.40), 0 0 0 4px rgba(0, 0, 0, 0.08)",t.style.transform="translateY(0)"},"aria-haspopup":"listbox","aria-expanded":d,title:"Switch fishing region",children:[(0,o.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#69D4BE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 1118 0z"}),(0,o.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),(0,o.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{fontSize:9,fontWeight:800,letterSpacing:"0.10em",textTransform:"uppercase",color:"rgba(105, 212, 190, 0.75)",lineHeight:1,marginBottom:3},children:"Region"}),(0,o.jsx)("span",{style:{fontSize:13,fontWeight:700,lineHeight:1.15,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:220},children:r})]}),(0,o.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#69D4BE",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:d?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.16s ease",flexShrink:0},children:(0,o.jsx)("path",{d:"M6 9l6 6 6-6"})})]}),d&&(0,o.jsxs)("div",{role:"listbox",style:{position:"absolute",top:"calc(100% + 6px)",right:0,minWidth:220,background:"#11161E",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:14,boxShadow:"0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 12px 32px rgba(0, 0, 0, 0.4)",padding:4,maxHeight:320,overflowY:"auto"},children:[u&&(0,o.jsx)("div",{style:{padding:"10px 12px",fontSize:12,color:"rgba(255,255,255,0.6)"},children:"Loading regionsâ¦"}),!u&&0===c.length&&(0,o.jsx)("div",{style:{padding:"10px 12px",fontSize:12,color:"rgba(255,255,255,0.6)"},children:"No regions available"}),c.map(r=>{let n=r.code===t;return(0,o.jsx)("button",{role:"option","aria-selected":n,onClick:()=>(t=>{if(i(t.code),a(t.displayName),p(!1),e){if(t.bbox){let[r,o,n,i]=t.bbox;e.fitBounds([[r,o],[n,i]],{padding:60,essential:!0});return}if("Polygon"===t.feature.geometry.type||"MultiPolygon"===t.feature.geometry.type){let[r,o,n,i]=function(e){let t=1/0,r=1/0,o=-1/0,n=-1/0;for(let i of"Polygon"===e.type?[e.coordinates]:e.coordinates)for(let e of i)for(let[i,a]of e)i<t&&(t=i),i>o&&(o=i),a<r&&(r=a),a>n&&(n=a);return[t,r,o,n]}(t.feature.geometry);e.fitBounds([[r,o],[n,i]],{padding:60,essential:!0})}}})(r),style:{display:"block",width:"100%",textAlign:"left",padding:"8px 12px",borderRadius:14,border:"none",background:n?"rgba(105, 212, 190, 0.08)":"transparent",color:n?"var(--app-accent, #69d4be)":"#D8DBDF",fontSize:12,fontWeight:n?700:500,letterSpacing:"0.02em",cursor:"pointer",transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{n||(e.currentTarget.style.background="rgba(255,255,255,0.04)")},onMouseLeave:e=>{n||(e.currentTarget.style.background="transparent")},children:r.displayName},r.code)})]})]})}let R="fishing-regions-src",B="fishing-regions-fill",A="fishing-regions-line",H="fishing-regions-line-shadow";function O(){let{map:e,isStyleLoaded:t}=(0,s.J)(),{geojson:r}=C(),{region:o,setRegion:i,setRegionDisplayName:a}=l();return(0,n.useEffect)(()=>
1{if(!e||!t||!r)return;let n=e.getSource(R);n?n.setData(r):e.addSource(R,{type:"geojson",data:r}),e.getLayer(B)||e.addLayer({id:B,type:"fill",source:R,paint:{"fill-color":"rgba(105, 212, 190, 0.08)","fill-outline-color":"rgba(105, 212, 190, 0.0)"}}),e.getLayer(H)||e.addLayer({id:H,type:"line",source:R,paint:{"line-color":"rgba(20, 26, 35, 0.55)","line-width":1.4},layout:{"line-join":"round","line-cap":"round"}}),e.getLayer(A)?(e.setPaintProperty(A,"line-color",["case",["==",["get","regionCode"],o],"#FFFFFF","rgba(105, 212, 190, 0.45)"]),e.setPaintProperty(A,"line-width",["case",["==",["get","regionCode"],o],.9,.6])):e.addLayer({id:A,type:"line",source:R,paint:{"line-color":["case",["==",["get","regionCode"],o],"#FFFFFF","rgba(105, 212, 190, 0.45)"],"line-width":["case",["==",["get","regionCode"],o],.9,.6]},layout:{"line-join":"round","line-cap":"round"}});let l=async t=>{let o=t.features?.[0];if(!o)return;let n=o.properties,l=String(n?.regionCode??"").trim(),s=String(n?.displayName??l);if(!l)return;i(l),a(s);let c="number"==typeof n?.north?n.north:NaN,u="number"==typeof n?.south?n.south:NaN,d="number"==typeof n?.east?n.east:NaN,p="number"==typeof n?.west?n.west:NaN;if(Number.isFinite(c)&&Number.isFinite(u)&&Number.isFinite(d)&&Number.isFinite(p))return void e.fitBounds([[p,u],[d,c]],{padding:60,essential:!0});let g=r.features.find(e=>e.properties?.regionCode===l),f=g?.geometry;if(f?.type==="Polygon"||f?.type==="MultiPolygon"){let[t,r,o,n]=function(e){let t=1/0,r=1/0,o=-1/0,n=-1/0;for(let i of"Polygon"===e.type?[e.coordinates]:e.coordinates)for(let e of i)for(let[i,a]of e)i<t&&(t=i),i>o&&(o=i),a<r&&(r=a),a>n&&(n=a);return[t,r,o,n]}(f);e.fitBounds([[t,r],[o,n]],{padding:60,essential:!0})}};e.on("click",B,l);let s=()=>{e.getCanvas().style.cursor="pointer"},c=()=>{e.getCanvas().style.cursor=""};return e.on("mouseenter",B,s),e.on("mouseleave",B,c),()=>{try{e.off("click",B,l),e.off("mouseenter",B,s),e.off("mouseleave",B,c),e.getLayer(A)&&e.removeLayer(A),e.getLayer(H)&&e.removeLayer(H),e.getLayer(B)&&e.removeLayer(B),e.getSource(R)&&e.removeSource(R)}catch{}}},[e,t,r,o,i,a]),null}let J={background:"#141A23",border:"rgba(255, 255, 255, 0.08)",color:"#69D4BE"},U={background:"#69D4BE",border:"#FFFFFF",color:"#141A23"};function _(e,t,r){e.style.cursor="pointer",e.style.padding="5px 10px",e.style.borderRadius="999px",e.style.fontSize="11px",e.style.fontWeight="800",e.style.letterSpacing="0.02em",e.style.fontFamily="Helvetica Neue, Helvetica, Arial, sans-serif",e.style.whiteSpace="nowrap",e.style.userSelect="none",e.style.background=t.background,e.style.border=`1px solid ${t.border}`,e.style.color=t.color,e.style.boxShadow=r?"0 4px 18px rgba(0, 0, 0, 0.35)":"0 2px 10px rgba(0, 0, 0, 0.35)",e.style.transition="background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s",e.style.pointerEvents="auto",e.style.zIndex="5"}function Z(){let{map:e,isStyleLoaded:t}=(0,s.J)(),{region:o,setRegion:i,setRegionDisplayName:a}=l(),{regions:c}=C(),u=(0,n.useRef)([]);return(0,n.useEffect)(()=>{if(!e||!t||0===c.length)return;let n=!1;return(async()=>{let t=(await r.e(240).then(r.t.bind(r,8849,23))).default;if(!n){for(let e of u.current)try{e.marker.remove()}catch{}for(let r of(u.current=[],c)){if(!r.bbox)continue;let[n,,l,s]=r.bbox,c=(l+n)/2,d=r.code===o,p=document.createElement("div");p.textContent=r.displayName,_(p,d?U:J,d),p.addEventListener("click",t=>{t.stopPropagation(),i(r.code),a(r.displayName),e.fitBounds([[n,r.bbox[1]],[l,s]],{padding:60,essential:!0})});let g=new t.Marker({element:p,anchor:"bottom"}).setLngLat([c,s]).addTo(e);u.current.push({marker:g,el:p,code:r.code})}}})(),()=>{for(let e of(n=!0,u.current))try{e.marker.remove()}catch{}u.current=[]}},[e,t,c]),(0,n.useEffect)(()=>{for(let e of u.current){let t=e.code===o;_(e.el,t?U:J,t)}},[o]),null}let Y="#69D4BE",V="#141A23",q=[{key:"oceanColor",label:"Ocean",sub:"Color",icon:(0,o.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,o.jsx)("path",{d:"M2 12h20"}),(0,o.jsx)("path",{d:"M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z"})]})},{key:"sargassum",label:"Algae",sub:"Index",icon:(0,o.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,o.jsx)("path",{d:"M7 20h10"}),(0,o.jsx)("path",{d:"M10 20c5.5-2.5.8-6.4 3-10"}),(0,o.jsx)("path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z"}),(0,o.jsx)("path",{d:"M14.1 6a7 7 0 00-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z"})]})},{key:"sst",label:"SST",sub:"",icon:(0,o.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,o.jsx)("path",{d:"M14 4v10.54a4 4 0 11-4 0V4a2 2 0 014 0z"})})}],X="0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 20px rgba(0, 0, 0, 0.40), 0 0 0 4px rgba(0, 0, 0, 0.08)";function G(){let{activeLayer:e,setActiveLayer:t}=l();return(0,o.jsx)("div",{style:{display:"flex",gap:6,pointerEvents:"auto"},children:q.map(r=>{let n=e===r.key;return(0,o.jsxs)("button",{onClick:()=>t(n?null:r.key),title:`${r.label} ${r.sub}`.trim(),"aria-pressed":n,style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:3,padding:"8px 12px",minWidth:72,height:48,boxSizing:"border-box",background:n?Y:"#11161E",border:n?"1.5px solid #FFFFFF":"1.5px solid rgba(105, 212, 190, 0.45)",borderRadius:14,boxShadow:n?"0 1px 0 rgba(255, 255, 255, 0.10) inset, 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(0, 0, 0, 0.15)":X,color:n?V:"#D8DBDF",fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',fontSize:12,fontWeight:800,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",transition:"background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s, transform 0.10s"},onMouseEnter:e=>{if(n)return;let t=e.currentTarget;t.style.borderColor="rgba(105, 212, 190, 0.75)",t.style.boxShadow="0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(0, 0, 0, 0.10)",t.style.transform="translateY(-1px)"},onMouseLeave:e=>{if(n)return;let t=e.currentTarget;t.style.borderColor="rgba(105, 212, 190, 0.45)",t.style.boxShadow=X,t.style.transform="translateY(0)"},children:[(0,o.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:5,color:n?V:Y},children:[r.icon,(0,o.jsx)("span",{style:{color:n?V:"#D8DBDF"},children:r.label})]}),r.sub&&(0,o.jsx)("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.08em",lineHeight:1,opacity:n?.8:.65},children:r.sub})]},r.key)})})}var K=r(6255);let Q={chl:"Ocean Color",afai:"Algae Index (Sargassum)",sst:"Sea Surface Temperature"},ee={chl:"Credit: Dr. C. Hu (USF) & CARICOOS",afai:"Credit: Dr. C. Hu (USF) & CARICOOS",sst:"MUR SST (JPL/NASA)"};function et({timesteps:e,selectedIndex:t,onSelectIndex:r,loading:i,type:a}){let l=(0,n.useRef)(null);(0,n.useEffect)(()=>
1{if(!l.current||t<0)return;let e=l.current.children[t];e&&e.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[t]);let s=(0,n.useCallback)(e=>{r(e)},[r]),u=t>=0&&t<e.length?e[t]:null,d=u?c(u.timestep):null;return i?(0,o.jsx)("div",{className:"wm-time-slider-container",children:(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--app-text-secondary)",fontSize:12},children:"Loading satellite imageryâ¦"})}):0===e.length?(0,o.jsx)("div",{className:"wm-time-slider-container",children:(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--app-text-muted)",fontSize:12},children:"No imagery available"})}):(0,o.jsxs)("div",{className:"wm-time-slider-container",style:{padding:0},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"2px 12px",borderBottom:"1px solid var(--app-border)",flexShrink:0,height:20},children:[(0,o.jsx)("span",{style:{fontSize:11,fontWeight:700,color:"var(--app-text)",whiteSpace:"nowrap"},children:Q[a]}),(0,o.jsx)("span",{style:{fontSize:9,fontWeight:500,color:"var(--app-text-muted)",whiteSpace:"nowrap"},children:ee[a]}),d&&(0,o.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"var(--app-text-secondary)",marginLeft:"auto",whiteSpace:"nowrap"},children:d.fullDate})]}),(0,o.jsx)("div",{ref:l,style:{display:"flex",gap:5,overflowX:"auto",overflowY:"hidden",padding:"3px 12px",flex:1,alignItems:"stretch",scrollbarWidth:"none"},children:e.map((e,r)=>{let n=r===t,i=c(e.timestep);return(0,o.jsxs)("button",{onClick:()=>s(r),style:{width:100,minWidth:100,alignSelf:"stretch",borderRadius:6,overflow:"hidden",position:"relative",cursor:"pointer",background:"var(--app-bg-active)",padding:0,border:n?"2px solid var(--app-accent)":"2px solid var(--app-border)",opacity:n?1:.6,transition:"border-color 0.15s, opacity 0.15s",flexShrink:0},children:[(0,o.jsx)("img",{src:e.thumbnailUrl,alt:i.date,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"},loading:"lazy"}),(0,o.jsx)("span",{style:{position:"absolute",bottom:2,right:2,background:"rgba(0,0,0,0.65)",padding:"1px 4px",borderRadius:3,fontSize:8,fontWeight:700,color:"#fff",lineHeight:"1.2"},children:i.time}),(0,o.jsx)("span",{style:{position:"absolute",top:2,left:2,background:"rgba(0,0,0,0.65)",padding:"1px 4px",borderRadius:3,fontSize:7,fontWeight:600,color:"rgba(255,255,255,0.85)",lineHeight:"1.2"},children:i.date})]},e.timestep)})})]})}function er(){let{activeLayer:e,setRegion:t,setRegionDisplayName:r}=l(),{map:i,isStyleLoaded:a}=(0,s.J)(),{regions:c}=C(),j=(0,n.useRef)(!1);(0,n.useEffect)(()=>{j.current||!i||!a||0===c.length||"u">typeof navigator&&navigator.geolocation&&(j.current=!0,navigator.geolocation.getCurrentPosition(e=>{let o,n=e.coords.longitude,a=e.coords.latitude,l=0===(o=c.filter(e=>(function(e,t,r){if(e.bbox){let[o,n,i,a]=e.bbox;if(t<o||t>i||r<n||r>a)return!1}let o=e.feature.geometry;if("Polygon"===o.type)return F(o.coordinates,t,r);if("MultiPolygon"===o.type){for(let e of o.coordinates)if(F(e,t,r))return!0}return!1})(e,n,a))).length?null:(o.sort((e,t)=>z(e)-z(t)),o[0]);l&&(t(l.code),r(l.displayName),i.flyTo({center:[n,a],zoom:8,duration:1200,essential:!0}))},e=>{},{enableHighAccuracy:!1,maximumAge:6e4,timeout:8e3}))},[i,a,c,t,r]);let{chlTimesteps:k,afaiTimesteps:L,sstTimesteps:N}=function(){let{map:e,isStyleLoaded:t}=(0,s.J)(),{activeLayer:r,region:o}=l(),i=(0,n.useRef)(null),a=u("chl",!0,o),c=u("afai",!0,o),j=u("sst",!0,o);return(0,n.useEffect)(()=>{let o;if(e&&t){if(!r){i.current&&(S(e),i.current=null);return}if("oceanColor"===r?o=a.selectedTimestep?.tileUrl:"sargassum"===r?o=c.selectedTimestep?.tileUrl:"sst"===r&&(o=j.selectedTimestep?.tileUrl),o){"oceanColor"!==r&&v(e,[p],[d]),"sargassum"!==r&&v(e,[f],[g]),"sst"!==r&&v(e,[x,b,y],[m,h]),"oceanColor"===r?w(e,d,p,o,.85):"sargassum"===r?w(e,g,f,o,.85):"sst"===r&&(w(e,h,y,o,.85),function(e,t,r){let o,n=t.replace(/\{z\}\/\{x\}\/\{y\}\.png$/,"SST_CONTOURS/{z}/{x}/{y}.pbf"),i=e.getSource(m);if(i)return i.setTiles([n]);e.addSource(m,{type:"vector",tiles:[n],maxzoom:10});try{e.getLayer("country-boundaries")?o="country-boundaries":e.getLayer("poi-label")&&(o="poi-label")}catch{}e.addLayer({id:b,type:"line",source:m,"source-layer":"sst_contours",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"#000000","line-width":1,"line-opacity":.7}},o),e.addLayer({id:x,type:"symbol",source:m,"source-layer":"sst_contours",filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","text-field":r?["concat",["to-string",["get","level_f"]],"\xb0F"]:["concat",["to-string",["get","level_c"]],"\xb0C"],"text-size":11,"text-max-angle":30,"text-padding":10,"symbol-spacing":150,"text-font":["DIN Pro Medium","Arial Unicode MS Regular"]},paint:{"text-color":"#000000","text-halo-color":"rgba(255, 255, 255, 0.8)","text-halo-width":1.5,"text-opacity":.7}},o)}(e,o,!0)),i.current=r;
1try{let t=e.getLayer("country-boundaries")?"country-boundaries":void 0;e.getLayer("bathy-contours")&&e.moveLayer("bathy-contours",t),e.getLayer("bathy-labels")&&e.moveLayer("bathy-labels",t),e.getLayer(b)&&e.moveLayer(b,t),e.getLayer(x)&&e.moveLayer(x,t)}catch{}}}},[e,t,r,!0,a.selectedTimestep,c.selectedTimestep,j.selectedTimestep]),(0,n.useEffect)(()=>()=>{if(e&&t)try{S(e)}catch{}i.current=null},[e,t]),{chlTimesteps:a,afaiTimesteps:c,sstTimesteps:j}}(),[E,M]=(0,n.useState)(!1),T=(0,n.useCallback)(()=>{if(!i)return;let e=!E;if(M(e),e){try{i.getSource("mapbox-dem")&&i.setTerrain({source:"mapbox-dem",exaggeration:2}),i.getLayer("fishing-hillshade")&&i.setLayoutProperty("fishing-hillshade","visibility","visible")}catch{}i.easeTo({pitch:60,duration:600})}else{i.easeTo({pitch:0,bearing:0,duration:600});try{i.setTerrain(null),i.getLayer("fishing-hillshade")&&i.setLayoutProperty("fishing-hillshade","visibility","none")}catch{}}},[i,E]);(0,n.useEffect)(()=>{if(!i||!a)return;let e=()=>{M(i.getPitch()>0||Math.abs(i.getBearing())>.5)};return i.on("pitchend",e),i.on("rotateend",e),()=>{i.off("pitchend",e),i.off("rotateend",e)}},[i,a]);let D="oceanColor"===e?k:"sargassum"===e?L:"sst"===e?N:null;return(0,o.jsx)("div",{className:"cur-root",children:(0,o.jsxs)("div",{className:"app-map-pad",children:[(0,o.jsx)(P,{}),(0,o.jsx)(W,{}),(0,o.jsx)($,{}),(0,o.jsx)(O,{}),(0,o.jsx)(Z,{}),(0,o.jsxs)("div",{className:"absolute z-20",style:{position:"absolute",bottom:142,right:26,display:"flex",flexDirection:"column",alignItems:"flex-end",gap:8,zIndex:20,pointerEvents:"none"},children:[(0,o.jsx)(K.g,{is3D:E,onToggle:T}),(0,o.jsx)(G,{})]}),D&&(0,o.jsx)("div",{className:"app-map-slider",children:(0,o.jsx)(et,{timesteps:D.timesteps,selectedIndex:D.selectedIndex,onSelectIndex:D.selectTimestep,loading:D.loading,type:"sargassum"===e?"afai":"sst"===e?"sst":"chl"})})]})})}function eo(){let[e]=(0,n.useState)(()=>{let e=(0,T.D)();return{center:e.center,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing}});return(0,n.useEffect)(()=>{if(e.center||void 0!==e.zoom){let e=new URLSearchParams(window.location.search);e.delete("center"),e.delete("zoom"),e.delete("pitch"),e.delete("bearing");let t=e.toString();window.history.replaceState({},"",`${window.location.pathname}${t?"?"+t:""}`)}},[]),(0,o.jsx)(a,{children:(0,o.jsx)(s.K,{initialViewState:e,children:(0,o.jsx)(er,{})})})}},7999:(e,t,r)=>{r.d(t,{J:()=>s,K:()=>l});var o=r(5155),n=r(2115);let i={center:[-122.4,37.8],zoom:3,pitch:0,bearing:0},a=(0,n.createContext)(null);function l({children:e,initialViewState:t}){let[r,l]=(0,n.useState)(null),[s,c]=(0,n.useState)(!1),u={...i};t&&(void 0!==t.center&&(u.center=t.center),void 0!==t.zoom&&(u.zoom=t.zoom),void 0!==t.pitch&&(u.pitch=t.pitch),void 0!==t.bearing&&(u.bearing=t.bearing));let[d,p]=(0,n.useState)(u),g=(0,n.useCallback)(e=>{l(e)},[]),f=(0,n.useCallback)(e=>{p(t=>({...t,...e}))},[]);return(0,o.jsx)(a.Provider,{value:{map:r,isStyleLoaded:s,viewState:d,setMap:g,setStyleLoaded:c,updateViewState:f},children:e})}function s(){let e=(0,n.useContext)(a);if(!e)throw Error("useMapContext must be used within a MapProvider");return e}},8486:(e,t,r)=>{r.d(t,{EH:()=>l,x3:()=>a,yp:()=>s});let o="bathy-source",n="bathy-contours",i="bathy-labels";function a(e,t,r={}){let{lineColor:s="#000000",lineOpacity:c=.45,labelColor:u="#101010",labelHaloColor:d="rgba(255, 255, 255, 0.85)"}=r;if(t)try{let r=`https://d1h9jkkt6suqx0.cloudfront.net/static/bathymetry/v1/{z}/{x}/{y}.pbf?${t}`,a=e.getSource(o);if(a){a.setTiles([r]),l(e);return}e.addSource(o,{type:"vector",tiles:[r],minzoom:0,maxzoom:7});let p=e.getLayer("country-boundaries")?"country-boundaries":void 0;e.getLayer(n)||e.addLayer({id:n,type:"line",source:o,"source-layer":"bathymetry",minzoom:6,filter:["==",["geometry-type"],"LineString"],paint:{"line-color":s,"line-opacity":c,"line-width":["interpolate",["linear"],["zoom"],6,.8,10,1.4],"line-blur":["interpolate",["linear"],["zoom"],6,.3,10,.6]},layout:{"line-join":"round","line-cap":"round"}},p),e.getLayer(i)||e.addLayer({id:i,type:"symbol",source:o,"source-layer":"bathymetry",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["in",["get","elev"],["literal",[-50,-100,-200,-500,-1e3,-2e3]]]],layout:{"symbol-placement":"line-center","text-field":["concat",["to-string",["abs",["get","elev"]]]," m / ",["match",["get","elev"],-10,"35",-20,"65",-40,"130",-50,"165",-100,"330",-200,"655",-300,"985",-500,"1640",-1e3,"3280",-2e3,"6560",-3e3,"9845",-4e3,"13125",""]," ft"],"text-font":["Open Sans Regular","Arial Unicode MS Regular"],"text-size":11,"text-letter-spacing":.05,"text-max-angle":60,"text-padding":1,"text-keep-upright":!0},paint:{"text-color":u,"text-halo-color":d,"text-halo-width":1.4,"text-opacity":.9}},p),l(e)}catch(e){}}function l(e){if(e.getLayer(n))try{let t,r=e.getStyle()?.layers;if(!r)return;let o=r.map(e=>e.id),a=o.indexOf("raster-overlay-layer-A"),l=o.indexOf("raster-overlay-layer-B"),s=Math.max(a,l);if(s<0)return;let c=o.indexOf(n),u=o.indexOf(i);for(let e=s+1;e<o.length;e++)if(o[e]!==n&&o[e]!==i){t=o[e];break}c>=0&&c<=s&&e.moveLayer(n,t),u>=0&&u<=s&&e.moveLayer(i,t)}catch(e){}}function s(e){try{e.getLayer(i)&&e.removeLayer(i),e.getLayer(n)&&e.removeLayer(n),e.getSource(o)&&e.removeSource(o)}catch(e){}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.