@idmwx/idmui-gl4 3.5.8 → 3.5.9

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.
@@ -7,7 +7,7 @@
7
7
  <span style="display:inline-block; height: 8px;width: 8px;border-radius: 50%;background-color: ${l.color}"></span>
8
8
  <span>${l.seriesName} : </span>
9
9
  <strong>${l.value[1]}m</strong>
10
- </div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)},handleClose(){this.$emit("close")}}},$n={class:"d-flex justify-space-between align-center"},es={class:"d-flex justify-start text-h5 my-2"},ts={class:"d-flex justify-start align-center text-h6 text-label ga-3"},os={class:"summary-box w-100"},as={class:"d-flex justify-space-between align-center py-2"},is={class:"d-flex justify-center align-center text-h6 ga-2"},rs={class:"multi-color-icon","aria-hidden":"true"},ls=["xlink:href"],ns={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},ss={class:"w-100 d-flex justify-start align-center"},cs={class:"w-30 text-label font-weight-400"},ms={class:"flex-1-1-0"},ds={class:"w-100 d-flex justify-start align-center"},hs={class:"w-30 text-label font-weight-400"},ps={class:"flex-1-1-0"},gs={class:"w-100 d-flex justify-start align-center"},us={class:"w-30 text-label font-weight-400"},fs={class:"flex-1-1-0"},ys={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},bs={class:"w-100 d-flex justify-space-between align-center py-2"},ws={class:"d-flex justify-center align-center text-h6 ga-2"},xs={class:"multi-color-icon","aria-hidden":"true"},ks=["xlink:href"],As={ref:"tideEchart",class:"w-100",style:{height:"244px"}},Ls={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},Cs={class:"px-1 text-center text-label font-weight-400",width:"120"},vs={class:"px-1 text-center text-label font-weight-400",width:"120"},zs={class:"px-1 text-center text-label font-weight-400",width:"120"},_s={class:"px-1 text-center"},Ss={class:"px-1 text-center"},Ns={class:"px-1 text-center"};function Ms(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var y;return[t.createElementVNode("div",$n,[t.createElementVNode("div",es,[t.createElementVNode("div",null,t.toDisplayString((y=a.station)==null?void 0:y.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),t.createElementVNode("div",ts,[t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),t.createVNode(s,{class:"w-100"}),t.createElementVNode("div",{class:t.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",os,[t.createElementVNode("div",as,[t.createElementVNode("div",is,[(t.openBlock(),t.createElementBlock("svg",rs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ls)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)])]),t.createElementVNode("div",ns,[t.createElementVNode("div",ss,[t.createElementVNode("div",cs,t.toDisplayString(o.$t("tide.region")),1),t.createElementVNode("div",ms,t.toDisplayString(((g=a.station)==null?void 0:g.Country)??((u=a.station)==null?void 0:u.city)??"-"),1)]),t.createElementVNode("div",ds,[t.createElementVNode("div",hs,t.toDisplayString(o.$t("tide.position")),1),t.createElementVNode("div",ps,t.toDisplayString(l.computePosition(a.station)),1)]),t.createElementVNode("div",gs,[t.createElementVNode("div",us,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",fs,t.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+t.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),t.createElementVNode("div",ys,[t.createElementVNode("div",bs,[t.createElementVNode("div",ws,[(t.openBlock(),t.createElementBlock("svg",xs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ks)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),e[2]||(e[2]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4 py-2"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=y=>i.currentIndex=y),class:"w-100 d-flex justify-space-around align-center ga-0 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,y=>(t.openBlock(),t.createBlock(n,{key:y.label,class:t.normalizeClass(["text-none text-body-1 flex-1-1-0",`bg-${y.index===i.currentIndex?"bg-primary":"gray-bg-2"}`]),density:"compact",color:"primary",height:"26",value:y.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["class","value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("div",As,null,512),t.createElementVNode("table",Ls,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Cs,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",vs,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",zs,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(y,p)=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:p},[t.createElementVNode("td",_s,t.toDisplayString(o.$t(`tide.${(h=y==null?void 0:y.type)==null?void 0:h.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",Ss,t.toDisplayString(l.computeLocalTime(y==null?void 0:y.date,a.station,"MM-DD HH:mm")),1),t.createElementVNode("td",Ns,t.toDisplayString((y==null?void 0:y.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const Ps=Q(qn,[["render",Ms],["__scopeId","data-v-5c51381d"]]),j1="",Vs={name:"IdmTideStations",components:{TideDetail:Ps},props:{map:{type:Object},show:{type:Boolean},locale:{type:String},beforeLayer:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,hoverStation:void 0,marker:null,showDetail:!1,station:void 0}},watch:{show:{handler(){var o,e,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleRender(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}"))},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")},handleClick(o){const e=o.features[0];e.properties&&(this.station=e.properties,this.station.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.station.lng=e.geometry.coordinates[0],this.station.lat=e.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties){this.showInfo=!0,this.hoverStation=e.properties,this.hoverStation.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.hoverStation.lng=e.geometry.coordinates[0],this.hoverStation.lat=e.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-60]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverStation={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Ts={class:"station-box d-flex flex-column justify-center align-start ga-1"},Es={class:"d-flex justify-start align-center"},Ds={class:"d-flex justify-start align-center"},Rs={class:"text-label"};function Bs(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("TideDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmTidalInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"pr-8 text-body-1"},{default:t.withCtx(()=>{var m,d;return[t.createElementVNode("div",Ts,[t.createElementVNode("div",Es,t.toDisplayString(o.$t("tide.tideStation")),1),t.createElementVNode("div",Ds,[t.createElementVNode("label",Rs,t.toDisplayString((m=i.hoverStation)==null?void 0:m.name)+" , "+t.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,station:i.station},o.$attrs,{onClose:l.handleCloseDetail}),null,16,["station","onClose"])):t.createCommentVNode("",!0)])}const Is=Q(Vs,[["render",Bs],["__scopeId","data-v-ad725d5e"]]),Fs={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function Gs(o,e,a,r,i,l){return null}const js=Q(Fs,[["render",Gs]]),W1="",Ws={name:"IdmLatLng",props:{simple:{type:Boolean,default:!1},map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"},labelColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.5)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${N.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${N.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,e;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(e=this.map)==null||e.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let e=30;o>4?e=10:o>3&&(e=15);const a=[];for(let i=-60;i<90;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=e)for(let l=-60;l<90;l+=e)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var e;const o=this.handleComputeLatLngs();(e=this.map)==null||e.getSource(this.source).setData(T.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":1,"text-color":this.labelColor}},this.beforeLayer)}},handleClear(){var o,e,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((e=this.map)==null||e.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function Zs(o,e,a,r,i,l){var n,c,s;return a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 py-1 text-caption text-right rounded",style:t.normalizeStyle({right:i.right+"px"})},[t.createElementVNode("div",null,t.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),t.createElementVNode("div",null,t.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),t.createElementVNode("div",null,t.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4))}const jo=Q(Ws,[["render",Zs]]),Z1="",Xs={name:"IdmFollowPort",components:{PortDetail:No},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-port-source",layer:"follow-port-layer",showInfo:!1,portId:"",hoverPort:{},port:{},marker:void 0,showDetail:!1}},watch:{show:{handler(){var o,e,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,n={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(n)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new me.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Hs={class:"port-box d-flex flex-column justify-center align-start ga-1"},Os={class:"d-flex justify-start align-center text-label"},Ys={class:"d-flex justify-start align-center text-label"};function Us(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Hs,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",Os,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",Ys,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel,"follow-list":a.followList},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{followPort:!0}))}),null,16,["port-id","port","forecast-model","follow-list","onClose"])):t.createCommentVNode("",!0)])}const Js=Q(Xs,[["render",Us],["__scopeId","data-v-9b28c4ea"]]),X1="",Ks={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-coordinate-source",layer:"follow-coordinate-layer",position:{},showInfo:!1,marker:null}},computed:{computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,e,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{if(r.coordinate){const i=r.coordinate,l={type:"Feature",properties:{id:r.id,remark:r.remark,...r.coordinate},geometry:{type:"Point",coordinates:[i.lng,i.lat]}};o.features.push(l)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1.1,"icon-image":"location","icon-offset":[0,-16]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.off("click",[this.layer],this.handleClick),(e=this.map)==null||e.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,n,c,s,m,d;const e=o.features[0];if(e.properties){const g=e.properties;g.lng=e.geometry.coordinates[0],g.lat=e.geometry.coordinates[1];const u=v(),y=(a=v(this.realTime))==null?void 0:a.diff(u,"d",!0),p={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};y>=0?(n=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||n.fetchForecastData(p):(d=(m=(s=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:s.$refs)==null?void 0:m.idmSpot)==null||d.fetchHistoryData(p)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.position=e.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new me.Marker(r).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"}}},Qs={class:"position-box d-flex flex-column justify-center align-start ga-1"},qs={class:"d-flex justify-start align-center text-label"},$s={key:0,class:"d-flex justify-start align-center text-label"};function ec(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard");return t.withDirectives((t.openBlock(),t.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Qs,[e[0]||(e[0]=t.createElementVNode("div",null,"Location",-1)),t.createElementVNode("div",qs,[t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(t.openBlock(),t.createElementBlock("div",$s,[t.createElementVNode("span",null,t.toDisplayString(i.position.remark??"-"),1)])):t.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[t.vShow,i.showInfo]])}const tc=Q(Ks,[["render",ec],["__scopeId","data-v-1de14e27"]]),H1="",oc={name:"IdmOtherLayerr",components:{IdmWarZone:il,IdmGmdssArea:nl,IdmEcaZone:ml,IdmAlertZone:gl,IdmPort:Cn,IdmLoadLine:_n,IdmTimezone:Mn,IdmVRA:Tn,IdmSpecialArea:Rn,IdmTerminator:Fn,IdmWorld12nm:Wn,IdmWorldMarine:Hn,IdmChinaRoute:Un,IdmNsrAreas:Qn,IdmTideStations:Is,IdmIceAreas:js,IdmLatLng:jo,IdmFollowPort:Js,IdmFollowPosition:tc},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"dark",tagLayers:[...eo.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[]}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},realTime:{handler(o,e){o&&e&&o!==e&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.theme==="dark"&&(this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark")}},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,e){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(e!=null&&e.includes(l))),r=e==null?void 0:e.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>e==null?void 0:e.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(e||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),e=localStorage.getItem(this.cache.mapFeatherKey);const a=e||"dark";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.mapFeather=o.value},async fetchOtherLayers(){var e,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await ce.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((e=i==null?void 0:i.data)==null?void 0:e.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,n=[];for(const s in l)n.push(ce.get(l[s],{headers:{Authorization:this.defaultMeteoToken,key:s}}));(await Promise.all(n)).map(s=>{var g,u,y;const m=((g=s==null?void 0:s.data)==null?void 0:g.data)||(s==null?void 0:s.data),d=(y=(u=s==null?void 0:s.config)==null?void 0:u.headers)==null?void 0:y.key;this.otherLayers[d]=m})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],e=await ce.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=e==null?void 0:e.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=e==null?void 0:e.data)==null?void 0:r.data)||(e==null?void 0:e.data))},handleLayersChange(o){const e=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=e,this.fetchOtherLayers()}}},ac={class:"idm-gl4-other-layer"},ic={class:"header-box w-100 d-flex justify-space-between align-center px-4"},rc={class:"text-h5 font-weight-medium"},lc={class:"layers-body mt-4 mb-2 d-flex justify-start align-center flex-wrap"},nc=["onClick"],sc={key:0,src:"https://ossimg.ormwx.com/asset/dark-map.png",class:"border rounded-sm"},cc={key:1,src:"https://ossimg.ormwx.com/asset/nautical-map.png",class:"border rounded-sm"},mc={key:2,src:"https://ossimg.ormwx.com/asset/satellite-map.png",class:"border rounded-sm"},dc={key:3,src:"https://ossimg.ormwx.com/asset/light-map.png",class:"border rounded-sm"},hc={class:"text-body-2 text-center pt-2"};function pc(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardItem"),d=t.resolveComponent("VCheckbox"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCard"),y=t.resolveComponent("IdmPort"),p=t.resolveComponent("IdmTideStations"),h=t.resolveComponent("IdmLatLng"),f=t.resolveComponent("IdmTerminator"),w=t.resolveComponent("IdmTimezone"),b=t.resolveComponent("IdmAlertZone"),L=t.resolveComponent("IdmEcaZone"),k=t.resolveComponent("IdmWarZone"),C=t.resolveComponent("IdmGmdssArea"),A=t.resolveComponent("IdmLoadLine"),_=t.resolveComponent("IdmWorldMarine"),z=t.resolveComponent("IdmVRA"),P=t.resolveComponent("IdmSpecialArea"),V=t.resolveComponent("IdmWorld12nm"),M=t.resolveComponent("IdmChinaRoute"),j=t.resolveComponent("IdmIceAreas"),U=t.resolveComponent("IdmNsrAreas"),K=t.resolveComponent("IdmFollowPort"),de=t.resolveComponent("IdmFollowPosition");return t.openBlock(),t.createElementBlock("div",ac,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box transition px-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[t.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:I})=>[t.createVNode(n,t.mergeProps(I,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",ic,[t.createElementVNode("div",rc,t.toDisplayString(o.$t("layer.layers")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[6]||(e[6]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 flex-1-1-0 scroll overflow-y-auto",a.simple?"px-3":"pl-4 pr-2"])},[t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"pb-2"},{default:t.withCtx(()=>[t.createElementVNode("div",lc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.mapFeathers,I=>(t.openBlock(),t.createElementBlock("div",{key:I.value,class:"mb-4 feather-item",onClick:ie=>l.handleToggleMapFeather(I)},[t.createElementVNode("div",{class:t.normalizeClass([i.mapFeather===I.value?"active":"","img-box"])},[I.value==="dark"?(t.openBlock(),t.createElementBlock("img",sc)):I.value==="nautical"?(t.openBlock(),t.createElementBlock("img",cc)):I.value==="satellite"?(t.openBlock(),t.createElementBlock("img",mc)):(t.openBlock(),t.createElementBlock("img",dc))],2),t.createElementVNode("div",hc,t.toDisplayString(o.$t(`layer.${I.locale}`)),1)],8,nc))),128))]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["graticule","day-night","time-zones"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[0]||(e[0]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2 mx-n1","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[1]||(e[1]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[2]||(e[2]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=I=>i.checkList=I),value:"follow-ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[4]||(e[4]=I=>i.checkList=I),value:"follow-positions",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(y,t.mergeProps({key:0,ref:"idmPorts",simple:a.simple,map:a.map,ports:(ne=i.otherLayers)==null?void 0:ne.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","real-time","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(p,t.mergeProps({key:1,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,"real-time":a.realTime,"forecast-model":a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","default-meteo-token","show","theme","real-time","forecast-model"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(h,t.mergeProps({key:2,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","menu-toggle","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(f,t.mergeProps({key:3,map:a.map,area:(S=i.otherLayers)==null?void 0:S["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:4,map:a.map,zone:(Z=i.otherLayers)==null?void 0:Z["time-zones"],"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","zone","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:5,map:a.map,simple:a.simple,zone:(H=i.otherLayers)==null?void 0:H["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:6,map:a.map,zone:(q=i.otherLayers)==null?void 0:q["eca-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:7,map:a.map,zone:(W=i.otherLayers)==null?void 0:W["war-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:8,map:a.map,area:(B=i.otherLayers)==null?void 0:B["gmdss-areas"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:11,map:a.map,area:(J=i.otherLayers)==null?void 0:J["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:12,map:a.map,area:(E=i.otherLayers)==null?void 0:E["special-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(M,t.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:16,map:a.map,show:i.checkList.includes("nsr")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:17,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:18,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","real-time"])):t.createCommentVNode("",!0)])}const gc=Q(oc,[["render",pc]]);class Mo{constructor(e){pe(this,"map");pe(this,"mercator");pe(this,"rampColorLayer");pe(this,"rampColorSource");pe(this,"particleLayer");pe(this,"particleSource");pe(this,"rampColorCanvas");pe(this,"particleCanvas");pe(this,"ratio");this.map=e,this.mercator=new qr,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,a=0){return e>180?this.convertNLng(e-360,a+1):e<-180?this.convertNLng(e+360,a+1):[e,a]}getBoundLngLat(){var a;const e=(a=this.map)==null?void 0:a.getBounds();return e?[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]:[]}getBoundPixel(){var p,h;const e=(p=this.map)==null?void 0:p.getBounds();if(!e)return[];const a=((h=this.map)==null?void 0:h.getZoom())+1,r=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[m,d]=this.mercator.px([l,r[1]],a),[g,u]=this.mercator.px([c,i[1]],a),y=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[g,u,m+y,d]}getBoundRange(){const e=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,e),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(e,a){const r=2**a,[i,l,n,c]=e.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let g=i;g<=n;g++)s.push([g,d]);return s.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let e=this.map.getSource(this.rampColorSource);e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(e){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class $e{createShader(e,a,r){const i=e.createShader(a);if(i&&(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,a,r,i,l,n,c){const s=e.createTexture();return e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),l instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,c,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.bindTexture(e.TEXTURE_2D,null),s}createDataBuffer(e,a,r){if(e){const i=e.createBuffer();return a==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),r&&e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)):a==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),r&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)),i}return null}createProgram(e,a,r){const i=e.createProgram(),l=this.createShader(e,e.VERTEX_SHADER,a),n=this.createShader(e,e.FRAGMENT_SHADER,r);if(i&&l&&n&&(e.attachShader(i,l),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,a,r){const i=this.createProgram(e,a,r);if(i){const l={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const m=e.getActiveAttrib(i,s);l[m.name]=e.getAttribLocation(i,m.name)}const c=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const m=e.getActiveUniform(i,s);l[m.name]=e.getUniformLocation(i,m.name)}return l}}setup(e,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&e){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([m,d])=>{s.addColorStop(m,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(e,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const m=this.createDataBuffer(e,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:m}}bind(e,a,r){const i=this.createProgram(e,a,r);if(i){const l=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",c);const s=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(e,a,r,i,l,n){const c=this.createProgramWrapper(e,a,r),s=this.createProgramWrapper(e,i,l),m=this.createProgramWrapper(e,i,n),d=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=e.createFramebuffer();return{particle:c,screen:s,update:m,quadBuffer:d,frameBuffer:g}}draw(e,a,r,i,l,n,c){var s,m;if(a&&r){e.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(m=a==null?void 0:a.canvas)==null?void 0:m.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const d={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};d.resolution&&a.uniform2f(d.resolution,a.canvas.width*e.ratio,a.canvas.height*e.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),d.image&&a.uniform1i(d.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),d.color&&a.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&a.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&a.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&a.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const g=e.getBoundPixel(),u=e.map.getZoom()+1,y=e.getWorldCopy(g,u);for(const p of y){const h=(p[0]-g[0])*e.ratio,f=(p[1]-g[3])*e.ratio,w=p[2]*e.ratio,[b,L,k,C]=[h,w+h,f,w+f],A=new Float32Array([b,k,L,k,b,C,b,C,L,k,L,C]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(e,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(e,a,i,l),this.updateParticles(e,a,i,l))}renderScreen(e,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(e,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(e,a,r,i,l){e&&(e.useProgram(r.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r.a_pos),e.vertexAttribPointer(r.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(r.u_screen,2),e.uniform1f(r.u_opacity,l),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*e.ratio),a.uniform1f(r.particle.u_point,e.ratio);const l=e.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(e,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=e.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*e.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(e,a){e.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(e){return new Promise(a=>{const r=new Blob([e],{type:e.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class fe{}pe(fe,"vertexSchema",`
10
+ </div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)},handleClose(){this.$emit("close")}}},$n={class:"d-flex justify-space-between align-center"},es={class:"d-flex justify-start text-h5 my-2"},ts={class:"d-flex justify-start align-center text-h6 text-label ga-3"},os={class:"summary-box w-100"},as={class:"d-flex justify-space-between align-center py-2"},is={class:"d-flex justify-center align-center text-h6 ga-2"},rs={class:"multi-color-icon","aria-hidden":"true"},ls=["xlink:href"],ns={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},ss={class:"w-100 d-flex justify-start align-center"},cs={class:"w-30 text-label font-weight-400"},ms={class:"flex-1-1-0"},ds={class:"w-100 d-flex justify-start align-center"},hs={class:"w-30 text-label font-weight-400"},ps={class:"flex-1-1-0"},gs={class:"w-100 d-flex justify-start align-center"},us={class:"w-30 text-label font-weight-400"},fs={class:"flex-1-1-0"},ys={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},bs={class:"w-100 d-flex justify-space-between align-center py-2"},ws={class:"d-flex justify-center align-center text-h6 ga-2"},xs={class:"multi-color-icon","aria-hidden":"true"},ks=["xlink:href"],As={ref:"tideEchart",class:"w-100",style:{height:"244px"}},Ls={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},Cs={class:"px-1 text-center text-label font-weight-400",width:"120"},vs={class:"px-1 text-center text-label font-weight-400",width:"120"},zs={class:"px-1 text-center text-label font-weight-400",width:"120"},_s={class:"px-1 text-center"},Ss={class:"px-1 text-center"},Ns={class:"px-1 text-center"};function Ms(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var y;return[t.createElementVNode("div",$n,[t.createElementVNode("div",es,[t.createElementVNode("div",null,t.toDisplayString((y=a.station)==null?void 0:y.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),t.createElementVNode("div",ts,[t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),t.createVNode(s,{class:"w-100"}),t.createElementVNode("div",{class:t.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",os,[t.createElementVNode("div",as,[t.createElementVNode("div",is,[(t.openBlock(),t.createElementBlock("svg",rs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ls)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)])]),t.createElementVNode("div",ns,[t.createElementVNode("div",ss,[t.createElementVNode("div",cs,t.toDisplayString(o.$t("tide.region")),1),t.createElementVNode("div",ms,t.toDisplayString(((g=a.station)==null?void 0:g.Country)??((u=a.station)==null?void 0:u.city)??"-"),1)]),t.createElementVNode("div",ds,[t.createElementVNode("div",hs,t.toDisplayString(o.$t("tide.position")),1),t.createElementVNode("div",ps,t.toDisplayString(l.computePosition(a.station)),1)]),t.createElementVNode("div",gs,[t.createElementVNode("div",us,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",fs,t.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+t.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),t.createElementVNode("div",ys,[t.createElementVNode("div",bs,[t.createElementVNode("div",ws,[(t.openBlock(),t.createElementBlock("svg",xs,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ks)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),e[2]||(e[2]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4 py-2"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=y=>i.currentIndex=y),class:"w-100 d-flex justify-space-around align-center ga-0 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,y=>(t.openBlock(),t.createBlock(n,{key:y.label,class:t.normalizeClass(["text-none text-body-1 flex-1-1-0",`bg-${y.index===i.currentIndex?"bg-primary":"gray-bg-2"}`]),density:"compact",color:"primary",height:"26",value:y.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["class","value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("div",As,null,512),t.createElementVNode("table",Ls,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",Cs,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",vs,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",zs,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(y,p)=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:p},[t.createElementVNode("td",_s,t.toDisplayString(o.$t(`tide.${(h=y==null?void 0:y.type)==null?void 0:h.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",Ss,t.toDisplayString(l.computeLocalTime(y==null?void 0:y.date,a.station,"MM-DD HH:mm")),1),t.createElementVNode("td",Ns,t.toDisplayString((y==null?void 0:y.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const Ps=Q(qn,[["render",Ms],["__scopeId","data-v-5c51381d"]]),j1="",Vs={name:"IdmTideStations",components:{TideDetail:Ps},props:{map:{type:Object},show:{type:Boolean},locale:{type:String},beforeLayer:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,hoverStation:void 0,marker:null,showDetail:!1,station:void 0}},watch:{show:{handler(){var o,e,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleRender(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}"))},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")},handleClick(o){const e=o.features[0];e.properties&&(this.station=e.properties,this.station.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.station.lng=e.geometry.coordinates[0],this.station.lat=e.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties){this.showInfo=!0,this.hoverStation=e.properties,this.hoverStation.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.hoverStation.lng=e.geometry.coordinates[0],this.hoverStation.lat=e.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new me.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-60]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverStation={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Ts={class:"station-box d-flex flex-column justify-center align-start ga-1"},Es={class:"d-flex justify-start align-center"},Ds={class:"d-flex justify-start align-center"},Rs={class:"text-label"};function Bs(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("TideDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmTidalInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"pr-8 text-body-1"},{default:t.withCtx(()=>{var m,d;return[t.createElementVNode("div",Ts,[t.createElementVNode("div",Es,t.toDisplayString(o.$t("tide.tideStation")),1),t.createElementVNode("div",Ds,[t.createElementVNode("label",Rs,t.toDisplayString((m=i.hoverStation)==null?void 0:m.name)+" , "+t.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,station:i.station},o.$attrs,{onClose:l.handleCloseDetail}),null,16,["station","onClose"])):t.createCommentVNode("",!0)])}const Is=Q(Vs,[["render",Bs],["__scopeId","data-v-ad725d5e"]]),Fs={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function Gs(o,e,a,r,i,l){return null}const js=Q(Fs,[["render",Gs]]),W1="",Ws={name:"IdmLatLng",props:{simple:{type:Boolean,default:!1},map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"},labelColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.5)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${N.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${N.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,e;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(e=this.map)==null||e.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let e=30;o>4?e=10:o>3&&(e=15);const a=[];for(let i=-60;i<90;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=e)for(let l=-60;l<90;l+=e)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var e;const o=this.handleComputeLatLngs();(e=this.map)==null||e.getSource(this.source).setData(T.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":1,"text-color":this.labelColor}},this.beforeLayer)}},handleClear(){var o,e,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((e=this.map)==null||e.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function Zs(o,e,a,r,i,l){var n,c,s;return a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 py-1 text-caption text-right rounded",style:t.normalizeStyle({right:i.right+"px"})},[t.createElementVNode("div",null,t.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),t.createElementVNode("div",null,t.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),t.createElementVNode("div",null,t.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4))}const jo=Q(Ws,[["render",Zs]]),Z1="",Xs={name:"IdmFollowPort",components:{PortDetail:No},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-port-source",layer:"follow-port-layer",showInfo:!1,portId:"",hoverPort:{},port:{},marker:void 0,showDetail:!1}},watch:{show:{handler(){var o,e,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,n={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(n)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new me.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Hs={class:"port-box d-flex flex-column justify-center align-start ga-1"},Os={class:"d-flex justify-start align-center text-label"},Ys={class:"d-flex justify-start align-center text-label"};function Us(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Hs,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",Os,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",Ys,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel,"follow-list":a.followList},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{followPort:!0}))}),null,16,["port-id","port","forecast-model","follow-list","onClose"])):t.createCommentVNode("",!0)])}const Js=Q(Xs,[["render",Us],["__scopeId","data-v-9b28c4ea"]]),X1="",Ks={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-coordinate-source",layer:"follow-coordinate-layer",position:{},showInfo:!1,marker:null}},computed:{computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,e,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{if(r.coordinate){const i=r.coordinate,l={type:"Feature",properties:{id:r.id,remark:r.remark,...r.coordinate},geometry:{type:"Point",coordinates:[i.lng,i.lat]}};o.features.push(l)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1.1,"icon-image":"location","icon-offset":[0,-16]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.off("click",[this.layer],this.handleClick),(e=this.map)==null||e.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,n,c,s,m,d;const e=o.features[0];if(e.properties){const g=e.properties;g.lng=e.geometry.coordinates[0],g.lat=e.geometry.coordinates[1];const u=v(),y=(a=v(this.realTime))==null?void 0:a.diff(u,"d",!0),p={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};y>=0?(n=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||n.fetchForecastData(p):(d=(m=(s=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:s.$refs)==null?void 0:m.idmSpot)==null||d.fetchHistoryData(p)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.position=e.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new me.Marker(r).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"}}},Qs={class:"position-box d-flex flex-column justify-center align-start ga-1"},qs={class:"d-flex justify-start align-center text-label"},$s={key:0,class:"d-flex justify-start align-center text-label"};function ec(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard");return t.withDirectives((t.openBlock(),t.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Qs,[e[0]||(e[0]=t.createElementVNode("div",null,"Location",-1)),t.createElementVNode("div",qs,[t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(t.openBlock(),t.createElementBlock("div",$s,[t.createElementVNode("span",null,t.toDisplayString(i.position.remark??"-"),1)])):t.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[t.vShow,i.showInfo]])}const tc=Q(Ks,[["render",ec],["__scopeId","data-v-1de14e27"]]),H1="",oc={name:"IdmOtherLayerr",components:{IdmWarZone:il,IdmGmdssArea:nl,IdmEcaZone:ml,IdmAlertZone:gl,IdmPort:Cn,IdmLoadLine:_n,IdmTimezone:Mn,IdmVRA:Tn,IdmSpecialArea:Rn,IdmTerminator:Fn,IdmWorld12nm:Wn,IdmWorldMarine:Hn,IdmChinaRoute:Un,IdmNsrAreas:Qn,IdmTideStations:Is,IdmIceAreas:js,IdmLatLng:jo,IdmFollowPort:Js,IdmFollowPosition:tc},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"dark",tagLayers:[...eo.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[]}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},realTime:{handler(o,e){o&&e&&o!==e&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.theme==="dark"&&(this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark")}},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,e){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(e!=null&&e.includes(l))),r=e==null?void 0:e.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>e==null?void 0:e.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(e||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),e=localStorage.getItem(this.cache.mapFeatherKey);const a=e||"dark";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.mapFeather=o.value},async fetchOtherLayers(){var e,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await ce.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((e=i==null?void 0:i.data)==null?void 0:e.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,n=[];for(const s in l)n.push(ce.get(l[s],{headers:{Authorization:this.defaultMeteoToken,key:s}}));(await Promise.all(n)).map(s=>{var g,u,y;const m=((g=s==null?void 0:s.data)==null?void 0:g.data)||(s==null?void 0:s.data),d=(y=(u=s==null?void 0:s.config)==null?void 0:u.headers)==null?void 0:y.key;this.otherLayers[d]=m})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],e=await ce.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=e==null?void 0:e.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=e==null?void 0:e.data)==null?void 0:r.data)||(e==null?void 0:e.data))},handleLayersChange(o){const e=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=e,this.fetchOtherLayers()}}},ac={class:"idm-gl4-other-layer"},ic={class:"header-box w-100 d-flex justify-space-between align-center px-4"},rc={class:"text-h5 font-weight-medium"},lc={class:"layers-body mt-4 mb-2 d-flex justify-start align-center flex-wrap"},nc=["onClick"],sc={key:0,src:"https://ossimg.ormwx.com/asset/dark-map.png",class:"border rounded-sm"},cc={key:1,src:"https://ossimg.ormwx.com/asset/nautical-map.png",class:"border rounded-sm"},mc={key:2,src:"https://ossimg.ormwx.com/asset/satellite-map.png",class:"border rounded-sm"},dc={key:3,src:"https://ossimg.ormwx.com/asset/light-map.png",class:"border rounded-sm"},hc={class:"text-body-2 text-center pt-2"};function pc(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardItem"),d=t.resolveComponent("VCheckbox"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCard"),y=t.resolveComponent("IdmPort"),p=t.resolveComponent("IdmTideStations"),h=t.resolveComponent("IdmLatLng"),f=t.resolveComponent("IdmTerminator"),w=t.resolveComponent("IdmTimezone"),b=t.resolveComponent("IdmAlertZone"),L=t.resolveComponent("IdmEcaZone"),k=t.resolveComponent("IdmWarZone"),C=t.resolveComponent("IdmGmdssArea"),A=t.resolveComponent("IdmLoadLine"),_=t.resolveComponent("IdmWorldMarine"),z=t.resolveComponent("IdmVRA"),P=t.resolveComponent("IdmSpecialArea"),V=t.resolveComponent("IdmWorld12nm"),M=t.resolveComponent("IdmChinaRoute"),j=t.resolveComponent("IdmIceAreas"),U=t.resolveComponent("IdmNsrAreas"),K=t.resolveComponent("IdmFollowPort"),de=t.resolveComponent("IdmFollowPosition");return t.openBlock(),t.createElementBlock("div",ac,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box transition px-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[t.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:I})=>[t.createVNode(n,t.mergeProps(I,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",ic,[t.createElementVNode("div",rc,t.toDisplayString(o.$t("layer.layers")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[6]||(e[6]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 flex-1-1-0 scroll overflow-y-auto",a.simple?"px-3":"pl-4 pr-2"])},[t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"pb-2"},{default:t.withCtx(()=>[t.createElementVNode("div",lc,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.mapFeathers,I=>(t.openBlock(),t.createElementBlock("div",{key:I.value,class:"mb-4 feather-item",onClick:ie=>l.handleToggleMapFeather(I)},[t.createElementVNode("div",{class:t.normalizeClass([i.mapFeather===I.value?"active":"","img-box"])},[I.value==="dark"?(t.openBlock(),t.createElementBlock("img",sc)):I.value==="nautical"?(t.openBlock(),t.createElementBlock("img",cc)):I.value==="satellite"?(t.openBlock(),t.createElementBlock("img",mc)):(t.openBlock(),t.createElementBlock("img",dc))],2),t.createElementVNode("div",hc,t.toDisplayString(o.$t(`layer.${I.locale}`)),1)],8,nc))),128))]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["graticule","day-night","time-zones"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[0]||(e[0]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2 mx-n1","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>["ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[1]||(e[1]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(I=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(I.key)),I=>(t.openBlock(),t.createBlock(d,{key:I.key,modelValue:i.checkList,"onUpdate:modelValue":e[2]||(e[2]=ie=>i.checkList=ie),value:I.key,label:o.$t(`layer.${I.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=I=>i.checkList=I),value:"follow-ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[4]||(e[4]=I=>i.checkList=I),value:"follow-positions",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(y,t.mergeProps({key:0,ref:"idmPorts",simple:a.simple,map:a.map,ports:(ne=i.otherLayers)==null?void 0:ne.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","real-time","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(p,t.mergeProps({key:1,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,"real-time":a.realTime,"forecast-model":a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","default-meteo-token","show","theme","real-time","forecast-model"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(h,t.mergeProps({key:2,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","menu-toggle","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(f,t.mergeProps({key:3,map:a.map,area:(S=i.otherLayers)==null?void 0:S["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:4,map:a.map,zone:(Z=i.otherLayers)==null?void 0:Z["time-zones"],"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","zone","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:5,map:a.map,simple:a.simple,zone:(H=i.otherLayers)==null?void 0:H["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:6,map:a.map,zone:(q=i.otherLayers)==null?void 0:q["eca-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:7,map:a.map,zone:(W=i.otherLayers)==null?void 0:W["war-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:8,map:a.map,area:(B=i.otherLayers)==null?void 0:B["gmdss-areas"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:11,map:a.map,area:(J=i.otherLayers)==null?void 0:J["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:12,map:a.map,area:(E=i.otherLayers)==null?void 0:E["special-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(M,t.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:16,map:a.map,show:i.checkList.includes("nsr")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:17,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:18,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","real-time"])):t.createCommentVNode("",!0)])}const gc=Q(oc,[["render",pc]]);class Mo{constructor(e){pe(this,"map");pe(this,"mercator");pe(this,"rampColorLayer");pe(this,"rampColorSource");pe(this,"particleLayer");pe(this,"particleSource");pe(this,"rampColorCanvas");pe(this,"particleCanvas");pe(this,"ratio");this.map=e,this.mercator=new qr,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,a=0){return e>180?this.convertNLng(e-360,a+1):e<-180?this.convertNLng(e+360,a+1):[e,a]}getBoundLngLat(){var a;const e=(a=this.map)==null?void 0:a.getBounds();return e?[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]:[]}getBoundPixel(){var p,h;const e=(p=this.map)==null?void 0:p.getBounds();if(!e)return[];const a=((h=this.map)==null?void 0:h.getZoom())+1,r=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[m,d]=this.mercator.px([l,r[1]],a),[g,u]=this.mercator.px([c,i[1]],a),y=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[g,u,m+y,d]}getBoundRange(){const e=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,e),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(e,a){const r=2**a,[i,l,n,c]=e.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let g=i;g<=n;g++)s.push([g,d]);return s.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let e=this.map.getSource(this.rampColorSource);e==null||e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e==null||e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){var i;if(!((i=this.map)!=null&&i.getLayer(this.rampColorLayer)))return;const a=this.map.getLayoutProperty(this.rampColorLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(e){var i;if(!((i=this.map)!=null&&i.getLayer(this.particleLayer)))return;const a=this.map.getLayoutProperty(this.particleLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class $e{createShader(e,a,r){const i=e.createShader(a);if(i&&(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,a,r,i,l,n,c){const s=e.createTexture();return e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),l instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,c,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.bindTexture(e.TEXTURE_2D,null),s}createDataBuffer(e,a,r){if(e){const i=e.createBuffer();return a==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),r&&e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)):a==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),r&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)),i}return null}createProgram(e,a,r){const i=e.createProgram(),l=this.createShader(e,e.VERTEX_SHADER,a),n=this.createShader(e,e.FRAGMENT_SHADER,r);if(i&&l&&n&&(e.attachShader(i,l),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,a,r){const i=this.createProgram(e,a,r);if(i){const l={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const m=e.getActiveAttrib(i,s);l[m.name]=e.getAttribLocation(i,m.name)}const c=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const m=e.getActiveUniform(i,s);l[m.name]=e.getUniformLocation(i,m.name)}return l}}setup(e,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&e){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([m,d])=>{s.addColorStop(m,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(e,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const m=this.createDataBuffer(e,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:m}}bind(e,a,r){const i=this.createProgram(e,a,r);if(i){const l=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",c);const s=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(e,a,r,i,l,n){const c=this.createProgramWrapper(e,a,r),s=this.createProgramWrapper(e,i,l),m=this.createProgramWrapper(e,i,n),d=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=e.createFramebuffer();return{particle:c,screen:s,update:m,quadBuffer:d,frameBuffer:g}}draw(e,a,r,i,l,n,c){var s,m;if(a&&r){e.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(m=a==null?void 0:a.canvas)==null?void 0:m.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const d={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};d.resolution&&a.uniform2f(d.resolution,a.canvas.width*e.ratio,a.canvas.height*e.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),d.image&&a.uniform1i(d.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),d.color&&a.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&a.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&a.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&a.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const g=e.getBoundPixel(),u=e.map.getZoom()+1,y=e.getWorldCopy(g,u);for(const p of y){const h=(p[0]-g[0])*e.ratio,f=(p[1]-g[3])*e.ratio,w=p[2]*e.ratio,[b,L,k,C]=[h,w+h,f,w+f],A=new Float32Array([b,k,L,k,b,C,b,C,L,k,L,C]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,A,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(e,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(e,a,i,l),this.updateParticles(e,a,i,l))}renderScreen(e,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(e,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(e,a,r,i,l){e&&(e.useProgram(r.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r.a_pos),e.vertexAttribPointer(r.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(r.u_screen,2),e.uniform1f(r.u_opacity,l),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*e.ratio),a.uniform1f(r.particle.u_point,e.ratio);const l=e.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(e,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=e.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*e.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(e,a){e.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(e){return new Promise(a=>{const r=new Blob([e],{type:e.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class fe{}pe(fe,"vertexSchema",`
11
11
  //canvas 坐标系上的坐标 (x, y)
12
12
  attribute vec2 a_position; //像素坐标
13
13
  attribute vec2 a_texCoord; //纹理坐标
@@ -200,7 +200,7 @@
200
200
  <path d="M10 2.5V17.5" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
201
201
  <path d="M5 7.5L10 2.5L15 7.5" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
202
202
  </svg>`;s.src="data:image/svg+xml;base64,"+window.btoa(m);const d=[s];let g=0;d.forEach(u=>{u.onload=()=>{g++,this.map.hasImage("currentDirIcon")||this.map.addImage("currentDirIcon",s),g===1&&this.map.addLayer({id:this.directionLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"currentDirIcon","icon-size":["interpolate",["linear"],["get","spd"],.5,.3,1,.5,1.5,.7,2,.8,3.5,1],"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,0],[360,360]]}},paint:{"icon-opacity":this.opacity}},this.beforeLayer)}}),i=new Date().valueOf()-(a+r),console.log("[current] add elapsed: ",i,", total: ",r+=i)}}},handleClear(){this.map.getLayer(this.speedLayer)&&this.map.removeLayer(this.speedLayer),this.map.getLayer(this.speedLabelLayer)&&this.map.removeLayer(this.speedLabelLayer),this.map.getLayer(this.directionLayer)&&this.map.removeLayer(this.directionLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Cc(o,e,a,r,i,l){return null}const vc=Q(Lc,[["render",Cc]]),Y1="",zc={name:"IdmCurrentParticle",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Mo},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,wrapper:void 0,animation:void 0,particleContext:void 0,particleTexture:void 0,particleOptions:{fadeOpacity:.96,speedFactor:4,dropRate:.005,dropRateBump:.01,uvRange:[-2.5,2.6],sRange:[0,3],scale:.3},paused:!1,initial:!0,right:10}},watch:{"factor.version":{async handler(){var o,e;(o=this.factor)!=null&&o.active?await this.handleRender():this.handleClear(),(e=this.factor)!=null&&e.particle||this.handleClearParticle()},immediate:!0},"factor.particle":{async handler(o,e){o!==e&&e!==void 0&&(o?(this.handleClear(),await this.handleRender()):this.handleClearParticle())}},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{async handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;await this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[current-particle] add elapsed: ",a,", total: ",e+=a)}},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0/255,"rgba(95, 143, 197,1)"],[5/255,"rgba(64,127,115,1)"],[10/255,"rgb(58,164,58)"],[15/255,"rgb(191,182,67)"],[20/255,"rgb(197,154,68)"],[30/255,"rgb(160,70,94)"],[40/255,"rgb(138,84,166)"],[45/255,"rgb(82,113,165)"],[50/255,"rgb(84,142,152)"],[65/255,"rgb(150,181,184)"],[80/255,"rgb(195,194,194)"],[254/255,"rgb(195,194,194)"],[1,"rgb(195,194,194)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.uvFragmentSchema);this.program=e,this.aPositionBuffer=a}this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){this.particleContext=this.viewport.particleCanvas.getContext("webgl");const o=[[0,"rgb(183,224,224)"],[1,"rgb(199,202,202)"],[.6,"rgb(199,202,202)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,Ne.vertexSchema,Ne.fragmentSchema,Ne.quadVertSchema,Ne.screenFragmentSchema,Ne.updateFragmentSchema),this.wrapper.color=this.webgl.setup(this.particleContext,o,!0,16,16),this.wrapper={...this.wrapper,...this.webgl.setupParticle(this.particleContext,9e3),...this.webgl.resize(this.viewport,this.particleContext)},this.viewport.map.on("resize",this.handleResize),this.viewport.map.on("movestart",this.handlePause),this.viewport.map.on("moveend",this.handlePlay)}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.LINEAR,this.particleContext.CLAMP_TO_EDGE,o),this.wrapper.image=o}this.initial&&(this.initial=!1,this.handlePlay()),this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer,this.particleOptions),this.viewport.toggle(!0)},handleResize(){this.wrapper={...this.wrapper,...this.webgl.resize(this.viewport,this.particleContext)}},handlePause(){this.paused=!0,this.animation&&(cancelAnimationFrame(this.animation),this.viewport.toggleParticle(!1))},handlePlay(){this.paused=!1,this.animation=requestAnimationFrame(()=>{this.webgl.drawParticle(this.viewport,this.particleContext,this.particleTexture,this.wrapper,this.particleOptions),this.viewport.toggleParticle(!0),this.handlePlay()})},handleClearParticle(){var o,e,a,r,i,l,n;(o=this.viewport)==null||o.toggleParticle(!1),this.particleContext=void 0,this.initial=!0,(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("resize",this.handleResize),(i=(r=this.viewport)==null?void 0:r.map)==null||i.off("movestart",this.handlePause),(n=(l=this.viewport)==null?void 0:l.map)==null||n.off("moveend",this.handlePlay),this.handlePause()},handleClear(){var o;(o=this.viewport)==null||o.toggle(!1),this.context=void 0,this.etime=void 0,this.handleClearParticle()}}},_c={key:0};function Sc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",_c,[t.createElementVNode("div",{class:"legend-bars-gl4 current",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"kts",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.4",-1),t.createElementVNode("span",null,"0.8",-1),t.createElementVNode("span",null,"1.6",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3.2",-1)]),4)])):t.createCommentVNode("",!0)}const Nc=Q(zc,[["render",Sc]]),U1="",Mc={name:"IdmSigWave",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[sig-wave] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(50, 158, 186)"],[10/255,"rgb(50, 158, 186)"],[20/255,"rgb(48, 128, 164)"],[30/255,"rgb(48, 99, 142)"],[40/255,"rgb(57, 61, 143)"],[50/255,"rgb(179, 86, 189)"],[60/255,"rgb(154, 45, 123)"],[80/255,"rgb(134, 48, 48)"],[120/255,"rgb(194, 77, 91)"],[150/255,"rgb(192, 118, 105)"],[180/255,"rgb(192, 163, 157)"],[1,"rgb(192, 163, 157)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Pc={key:0};function Vc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Pc,[t.createElementVNode("div",{class:"legend-bars-gl4 sig-wave",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"6",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const Tc=Q(Mc,[["render",Vc],["__scopeId","data-v-b562523c"]]),Ec={name:"IdmSigWaveHeight",props:{map:{type:Object},sigWaveHeight:{type:Object},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{right:10,toggle:!1,showCaption:!1,source:"sig-wave-height-source",heightLayer:"sig-wave-height-layer",heightLabelLayer:"sig-wave-height-label-layer",empty:T.featureCollection([])}},watch:{"sigWaveHeight.version":{handler(){var o;(o=this.sigWaveHeight)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleMenuToggle(){this.toggle=!this.toggle,this.showCaption=!this.showCaption},handleRender(){var o,e;if(this.sigWaveHeight){const a=new Date().valueOf();let r=0,i=0,l=this.empty;this.sigWaveHeight.active&&(l=this.sigWaveHeight.data),(o=this.map)!=null&&o.getSource(this.source)?((e=this.map)==null||e.getSource(this.source).setData(l),i=new Date().valueOf()-(a+r),console.log("[sig-wave-height] update elapsed: ",i,", total: ",r+=i)):(this.map.addSource(this.source,{type:"geojson",data:l}),this.map.addLayer({id:this.heightLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-opacity":.8,"fill-color":["step",["get","val"],"rgba(0,235,156,0)",2,"rgba(0,235,156,0.4)",3,"#ffed00",4,"#ff9800",5,"#f77800",6,"#e4711e",7,"#e06128",8,"#dc5132",9,"#d5453c",10,"#cd3a46",12,"#be2c50",14,"#b41a5a"]}},this.beforeLayer),this.map.addLayer({id:this.heightLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","symbol-spacing":100,"text-field":["format",["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":10},paint:{"text-color":["step",["get","val"],"rgba(0, 0, 0, 0.7)",9,"rgba(255,255,255,0.8)"]}},this.beforeLayer),i=new Date().valueOf()-(a+r),console.log("[sig-wave-height] add elapsed: ",i,", total: ",r+=i))}},handleClear(){this.map.getLayer(this.heightLayer)&&this.map.removeLayer(this.heightLayer),this.map.getLayer(this.heightLabelLayer)&&this.map.removeLayer(this.heightLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Dc(o,e,a,r,i,l){return null}const Rc=Q(Ec,[["render",Dc]]),J1="",Bc={name:"IdmSwell",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[sig-wave] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(50, 158, 186)"],[10/255,"rgb(50, 158, 186)"],[20/255,"rgb(48, 128, 164)"],[30/255,"rgb(48, 99, 142)"],[40/255,"rgb(57, 61, 143)"],[50/255,"rgb(179, 86, 189)"],[60/255,"rgb(154, 45, 123)"],[80/255,"rgb(134, 48, 48)"],[120/255,"rgb(194, 77, 91)"],[150/255,"rgb(192, 118, 105)"],[180/255,"rgb(192, 163, 157)"],[1,"rgb(192, 163, 157)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Ic={key:0};function Fc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Ic,[t.createElementVNode("div",{class:"legend-bars-gl4 swell",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"6",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const Gc=Q(Bc,[["render",Fc],["__scopeId","data-v-7ee2face"]]),jc={name:"IdmPrmsl",props:{map:{type:Object},prmsl:{type:Object},beforeLayer:{type:String},showRampColor:{type:Boolean},activeWeatherLayers:{type:Array},theme:{type:String}},data(){return{right:10,toggle:!1,source:"prmsl-source",layer:"prmsl-layer",labelLayer:"prmsl-label-layer",pointLabelLayer:"prmsl-point-label-layer",empty:T.featureCollection([])}},watch:{"prmsl.version":{handler(){var o;(o=this.prmsl)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleRender(){var o,e,a;if(this.prmsl){const r=new Date().valueOf();let i=0,l=0,n=this.empty;this.prmsl.active&&(n=this.prmsl.data),(o=this.map)!=null&&o.getSource(this.source)?((e=this.map)==null||e.getSource(this.source).setData(n),l=new Date().valueOf()-(r+i),console.log("[prmsl] update elapsed: ",l,", total: ",i+=l)):(this.map.addSource(this.source,{type:"geojson",data:n}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"line-width":1,"line-opacity":this.theme==="light"?1:.3}},this.beforeLayer),(a=this.map)==null||a.addLayer({id:this.labelLayer,type:"symbol",source:this.source,minzoom:4,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-rotation-alignment":"viewport","text-field":"{val}","text-size":10},paint:{"text-color":"black","text-halo-color":"rgba(255,255,255,1)","text-opacity":.7,"text-halo-width":1}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-allow-overlap":!0,"text-field":["format",["get","type"],{"font-scale":1.03},`
203
- `,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.theme==="light"?["step",["get","val"],"rgba(0, 0, 0, 0.5)",920,"rgba(0, 0, 0, 0.5)",980,"rgba(0, 0, 0, 0.7)",1100,"rgba(0, 0, 0, 0.7)"]:"rgba(0,0,0,1)","text-halo-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"text-halo-width":1}},this.beforeLayer),l=new Date().valueOf()-(r+i),console.log("[prmsl] add elapsed: ",l,", total: ",i+=l))}},handleClear(){this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.labelLayer)&&this.map.removeLayer(this.labelLayer),this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Wc(o,e,a,r,i,l){return null}const Zc=Q(jc,[["render",Wc]]),K1="",Xc={name:"IdmIceEdge",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-edge] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(86, 169, 230, 0)"],[1/255,"rgba(86, 169, 230, 0)"],[25/255,"rgba(86, 169, 230, 1)"],[25/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 84, 39, 1)"],[250/255,"rgba(230, 84, 39, 1)"],[1,"rgba(230, 84, 39, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Hc={key:0};function Oc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Hc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-edge",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",{style:{color:"rgba(var(--v-theme-black), 0.7)"}},"%",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"70",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"90",-1),t.createElementVNode("span",null,null,-1)]),4)])):t.createCommentVNode("",!0)}const Yc=Q(Xc,[["render",Oc]]),Q1="",Uc={name:"IdmCover",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-cover] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(68, 1, 84, 0)"],[1/255,"rgba(63, 72, 137, 0)"],[50/255,"rgba(53, 125, 177, 1)"],[100/255,"rgba(33, 145, 140, 1)"],[150/255,"rgba(45, 178, 125, 1)"],[200/255,"rgba(112, 207, 87, 1)"],[250/255,"rgba(253, 231, 37, 0.8)"],[1,"rgba(253, 231, 37, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Jc={key:0};function Kc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Jc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-cover",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"%",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,"60",-1),t.createElementVNode("span",null,"80",-1),t.createElementVNode("span",null,"100",-1)]),4)])):t.createCommentVNode("",!0)}const Qc=Q(Uc,[["render",Kc],["__scopeId","data-v-3d1a7675"]]),q1="",qc={name:"IdmThickness",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-thickness] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(4, 6, 19, 0)"],[1/255,"rgba(4, 6, 19, 0)"],[20/255,"rgba(51, 50, 102, 1)"],[40/255,"rgba(63, 82, 158, 1)"],[50/255,"rgba(66, 123, 183, 1)"],[60/255,"rgba(92, 161, 197, 1)"],[80/255,"rgba(134, 199, 212, 0.7)"],[100/255,"rgba(134, 199, 212, 1)"],[150/255,"rgba(234, 253, 2536, 0.8)"],[250/255,"rgba(234, 253, 2536, 0.9)"],[1,"rgba(234, 253, 2536, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},$c={key:0};function em(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",$c,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-thickness",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.6",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1)]),4)])):t.createCommentVNode("",!0)}const tm=Q(qc,[["render",em]]),$1="",om={name:"IdmPrecip3h",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},deeimmediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[precip3h] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(59, 126, 162, 0)"],[14/255,"rgba(84,170,230, 0)"],[15/255,"rgba(172, 210, 255, 0.8)"],[20/255,"rgba(51,202,248,0.8)"],[30/255,"rgba(3,248,103,0.8)"],[49/255,"rgba(14,201,3,0.8)"],[57/255,"rgba(190,226,2,0.8)"],[73/255,"rgba(248,1,1,0.8)"],[82/255,"rgba(197,5,58,0.8)"],[1,"rgba(197,5,58,0.8)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},am={key:0};function im(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",am,[t.createElementVNode("div",{class:"legend-bars-gl4 precip3h",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"mm",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"7",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1)]),4)])):t.createCommentVNode("",!0)}const rm=Q(om,[["render",im]]),eb="",lm={name:"IdmVisibility",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{right:10,program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[visibility] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(189,50,160,0.8)"],[8/255,"rgba(208,56,56,0.8)"],[27/255,"rgba(190,226,2,0.8)"],[60/255,"rgba(3,236,118,0.8)"],[160/255,"rgba(172, 210,255,0.8)"],[161/255,"rgba(172, 210,255,0)"],[1,"rgba(144,144,144,0)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},nm={key:0};function sm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",nm,[t.createElementVNode("div",{class:"legend-bars-gl4 visibility",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"nm",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const cm=Q(lm,[["render",sm]]),tb="",mm={name:"IdmWaterTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[water-temp] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(95, 143, 197)"],[46/255,"rgba(95, 143, 197)"],[69/255,"rgb(80, 140, 62)"],[92/255,"rgb(121, 146, 28)"],[115/255,"rgb(171, 161, 14)"],[138/255,"rgb(223, 177, 69)"],[161/255,"rgb(243, 150, 6)"],[184/255,"rgb(236, 95, 21)"],[207/255,"rgb(190, 65, 18)"],[230/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},dm={key:0};function hm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",dm,[t.createElementVNode("div",{class:"legend-bars-gl4 water-temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const pm=Q(mm,[["render",hm]]),ob="",gm={name:"IdmTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0;this.handleDraw(),new Date().valueOf()-(o+e)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(149, 137, 211)"],[100/255,"rgb(149, 137, 211)"],[110/255,"rgb(150, 209, 216)"],[120/255,"rgb(129, 204, 197)"],[130/255,"rgb(103, 180, 186)"],[140/255,"rgb(95, 143, 197)"],[150/255,"rgb(80, 140, 62)"],[160/255,"rgb(121, 146, 28)"],[170/255,"rgb(171, 161, 14)"],[180/255,"rgb(223, 177, 6)"],[190/255,"rgb(243, 150, 6)"],[200/255,"rgb(236, 95, 21)"],[210/255,"rgb(190, 65, 18)"],[220/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},um={key:0};function fm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",um,[t.createElementVNode("div",{class:"legend-bars-gl4 temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"-20",-1),t.createElementVNode("span",null,"-10",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const ym=Q(gm,[["render",fm]]),ab="",bm={name:"IdmGlLayer",components:{IdmWindBarb:bc,IdmWindParticle:Ac,IdmCurrentDirection:vc,IdmCurrentParticle:Nc,IdmWave:Tc,IdmSigWaveHeight:Rc,IdmSwell:Gc,IdmPrmsl:Zc,IdmIceEdge:Yc,IdmIceCover:Qc,IdmIceThickness:tm,IdmPrecip3h:rm,IdmVisibility:cm,IdmWaterTemp:pm,IdmTemp:ym},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},theme:{type:String},map:{type:Object},mapFeather:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},defaultMeteoToken:{type:String},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},realTime:{type:String},forecastModel:{type:String},beforeLayer:{type:String}},emits:["forecastModel","menuToggle","weatherCheckList","autoActive","weatherRendered"],data(){return{right:10,toggle:!1,autoActive:!0,weatherWeight:0,allLayers:[...eo.LayerHelper.WEATHER_LAYERS],tagLayers:[...eo.LayerHelper.WEATHER_LAYERS.filter(o=>!o.hide)],checkList:[],renderKey:"",iceToggleValue:void 0,waveToggleValue:void 0,weatherLayers:{},activeWeatherLayers:[],cache:{v:"0.0.1",versionKey:"weatherLayerCacheVersionGL4",autoActiveKey:"autoActiveCacheGL4",checkListKey:"weatherCheckListCacheGL4"},models:{},currentModel:localStorage.getItem("forecastModelCacheGL4")==="GFS"?"GFS":"ECMWF",zoom:6,viewport:void 0,particleFactor:void 0,showWindParticle:!0,showCurrentParticle:!0,legendToggle:!1,legend:{barbs:[2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,0],current:[{label:"0-0.5 kts",size:.3,color:"rgb(58, 164, 58)"},{label:"0.5-1 kts",size:.4,color:"#ffff00"},{label:"1-1.5 kts",size:.6,color:"#ff9500"},{label:"1.5-2 kts",size:.8,color:"#f44336"},{label:">= 2 kts",size:1,color:"#e4711e"}],sigWaveHeight:[{label:"< 2 m",color:"rgba(0,235,156,0)"},{label:"2-3 m",color:"rgba(0,235,156,0.4)"},{label:"3-4 m",color:"#ffed00"},{label:"4-5 m",color:"#ff9800"},{label:"5-6 m",color:"#f77800"},{label:"6-7 m",color:"#e4711e"},{label:"7-8 m",color:"#e06128"},{label:"8-9 m",color:"#dc5132"},{label:"9-10 m",color:"#d5453c"},{label:"10-12 m",color:"#cd3a46"},{label:"12-14 m",color:"#be2c50"},{label:"> 14 m",color:"#aa1a5a"}]}}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}},computeDateZ(){return function(o){var e;if(o){const a=v(o);return`${(e=a==null?void 0:a.utc())==null?void 0:e.format("MMM-DD/HHmm")}Z`}return"-"}},computeDateUpdate(){return function(o){return o?v(o).fromNow():"-"}},overlaysKeys(){return this.tagLayers.filter(o=>o.overlays).map(o=>o.key)},rendersKeys(){return this.allLayers.filter(o=>!o.overlays&&o.enabled).map(o=>o.key)},showTipMenu(){return this.checkList.includes("wind")||this.checkList.includes("current-direction")||this.checkList.includes("sig-wave-height")},barbsIconName(){var e,a,r;const o=[];for(let i=0;i<((a=(e=this.legend)==null?void 0:e.barbs)==null?void 0:a.length);i++){const l=((r=this.legend)==null?void 0:r.barbs[i])||0,n=l<10?`00${l}kts`:l<100?`0${l}kts`:`${l}kts`;o.push("icon-a-"+n)}return o}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.weatherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})}},currentModel:{handler(o,e){this.$emit("forecastModel",o),localStorage.setItem("forecastModelCacheGL4",o)},immediate:!0},forecastModel:{handler(o,e){o&&o!==e&&this.handleWeatherLayerChange({sourceChanged:!0})}},map:{handler(){this.map&&(this.fetchCache(),this.map.on("move",this.handleMove4Weather),this.viewport=new Mo(this.map),this.handleRampColorInitial())},immediate:!0},realTime:{handler(o,e){o&&e&&v(o).utc().format("yyyy-MM-DD HH")!==v(e).utc().format("yyyy-MM-DD HH")&&this.$nextTick(()=>{this.fetchWeatherLayers()})},immediate:!0},renderKey:{handler(o,e){if(o&&o!==e){const a=this.checkList.filter(r=>!this.rendersKeys.some(i=>i===r));o==="wave-group"?(this.waveToggleValue=this.waveToggleValue||"sig-wave",this.checkList=[...a,"wave-group",this.waveToggleValue]):o==="ice-forecast"?(this.iceToggleValue=this.iceToggleValue||"ice-cover",this.checkList=[...a,"ice-forecast",this.iceToggleValue||"ice-cover"]):this.checkList=[...a,o]}else!o&&e&&(this.checkList=this.checkList.filter(a=>a!==e))}},checkList:{handler(o,e){var a,r,i,l,n,c;this.handleCheckListChange(o,e),this.$emit("weatherCheckList",o),this.autoActive&&this.checkList.length?(i=(r=(a=this.$parent)==null?void 0:a.$refs)==null?void 0:r.idmBottomBar)==null||i.handleToggle("weather",!0):(c=(n=(l=this.$parent)==null?void 0:l.$refs)==null?void 0:n.idmBottomBar)==null||c.handleToggle("weather",!1)}},autoActive:{handler(o){var e,a,r,i,l,n;localStorage.setItem(this.cache.autoActiveKey,this.autoActive),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(c=>this.checkList.includes(c.key)):[],this.handleWeatherLayerChange(),this.autoActive&&this.checkList.length?(r=(a=(e=this.$parent)==null?void 0:e.$refs)==null?void 0:a.idmBottomBar)==null||r.handleToggle("weather",!0):(n=(l=(i=this.$parent)==null?void 0:i.$refs)==null?void 0:l.idmBottomBar)==null||n.handleToggle("weather",!1),this.$emit("autoActive",this.autoActive)}},iceToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"ice-forecast",this.iceToggleValue]}}},waveToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"wave-group",this.waveToggleValue]}}},showWindParticle:{handler(o){let e="wind-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},showCurrentParticle:{handler(o){let e="current-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},isLogin:{handler(o){o?this.fetchModels():this.models={}},immediate:!0}},mounted(){this.fetchModels()},methods:{arraysEqual(o,e){if((o==null?void 0:o.length)!==(e==null?void 0:e.length))return!1;for(let a=0;a<(o==null?void 0:o.length);a++)if((o==null?void 0:o[a])!==(e==null?void 0:e[a]))return!1;return!0},fetchCache(){var a,r;const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.autoActiveKey),localStorage.removeItem(this.cache.checkListKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.autoActiveKey);this.autoActive=e!=="false",localStorage.setItem(this.cache.autoActiveKey,this.autoActive),e=localStorage.getItem(this.cache.checkListKey),this.waveToggleValue=(a=JSON.parse(e))!=null&&a.some(i=>i==="swell")?"swell":void 0,this.iceToggleValue=(r=JSON.parse(e))!=null&&r.some(i=>i==="ice-thickness")?"ice-thickness":void 0,this.checkList=JSON.parse(e||JSON.stringify(["wind","sig-wave-height"])),this.checkList.find(i=>this.rendersKeys.includes(i))&&(this.renderKey=this.checkList.find(i=>this.rendersKeys.includes(i))),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList))},handleMenuToggle(){this.$emit("menuToggle","weatherLayers")},handleFastWeatherToggle(o){let e=[];this.checkList.includes(o)?e=this.checkList.filter(a=>a!==o):(e=[...this.checkList,o],this.checkList=e),this.handleCheckListChange(e,this.checkList)},handleCheckListChange(o,e){if(this.arraysEqual(o,e))return this.handleMove4Weather(),!1;const a=[...new Set(o)],r=a==null?void 0:a.filter(n=>!(e!=null&&e.includes(n)))[0],i=e==null?void 0:e.filter(n=>!(a!=null&&a.includes(n)))[0],l=this.checkList.filter(n=>!this.rendersKeys.some(c=>c===n));if(r)if(r==="ice-cover"||r==="ice-thickness"||r==="ice-forecast")this.checkList=[...l,"ice-forecast",this.iceToggleValue||"ice-cover"],this.iceToggleValue=this.iceToggleValue||"ice-cover";else if(r==="sig-wave"||r==="swell"||r==="wave-group")this.checkList=[...l,"wave-group",this.waveToggleValue||"sig-wave"],this.waveToggleValue=this.waveToggleValue||"sig-wave";else if(this.rendersKeys.includes(r))this.checkList=[...l,r];else{const n=a.filter(s=>!this.rendersKeys.includes(s)),c=this.checkList.filter(s=>this.rendersKeys.includes(s));this.checkList=[...n,...c]}i&&(i==="ice-forecast"?(this.checkList=a.filter(n=>!["ice-cover","ice-thickness","ice-forecast"].includes(n)),this.iceToggleValue=void 0):i==="wave-group"?(this.checkList=a.filter(n=>!["wave-group","sig-wave","swell"].includes(n)),this.waveToggleValue=void 0):this.checkList=a),this.checkList.includes("wind-particle")&&!(e!=null&&e.includes("wind-particle"))&&(this.showWindParticle=!0),this.checkList.includes("current-particle")&&!(e!=null&&e.includes("current-particle"))&&(this.showCurrentParticle=!0),localStorage.setItem(this.cache.checkListKey,JSON.stringify(a)),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(n=>a.includes(n.key)):[],this.handleWeatherLayerChange()},async fetchModels(){this.models={};const o=await ce.get(`${this.gateway}/api/arc/meteo2/models2`,{headers:{Authorization:this.defaultMeteoToken}});(o==null?void 0:o.data.code)===0&&(this.models=o==null?void 0:o.data.data)},async fetchWeatherLayers(o={}){var r,i,l,n,c,s,m,d,g;const e=new Date().valueOf();let a=0;if(this.map){const u=((r=this.map)==null?void 0:r.getZoom())+1,y=(i=this.map)==null?void 0:i.getBounds(),p=`${y._sw.lng},${y._sw.lat},${y._ne.lng},${y._ne.lat}`;if(this.particleFactor&&((l=this.$refs.layer)!=null&&l.autoActive)){const h=eo.LayerHelper.WEATHER_LAYERS.find(f=>{var w;return((w=f.peer)==null?void 0:w.weight)===this.particleFactor.weight});this.particleFactor.particle&&(this.showWindParticle||this.showCurrentParticle)?this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight:this.weatherWeight+h.weight:this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight-h.weight:this.weatherWeight}if(this.weatherWeight>0){let h=this.weatherWeight;if(h>0){const f=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],w=await ce.get(`${f}/api/arc/weather/layers2/links?l=${h}&v=${this.forecastModel}&z=${u}&bbox=${p}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(new Date().valueOf()-(e+a),((n=w==null?void 0:w.data)==null?void 0:n.code)===0){const b=(c=w==null?void 0:w.data)==null?void 0:c.data,L=[];for(const C in b)L.push(ce.get(b[C],{headers:{Authorization:this.defaultMeteoToken,key:C},responseType:/\.(jpg|png)$/.test(b[C])?"blob":"json"}).catch(A=>{console.log(`[${C}] fetch layer error: ${A}`)}));const k=await Promise.all(L);this.weatherLayers={},k.map(C=>{var z,P,V,M;const A=((z=C==null?void 0:C.data)==null?void 0:z.data)||(C==null?void 0:C.data);let _=(V=(P=C==null?void 0:C.config)==null?void 0:P.headers)==null?void 0:V.key;_&&A&&(this.weatherLayers[_]={raw:A,type:((M=C==null?void 0:C.config)==null?void 0:M.responseType)==="blob"?"image":"json",etime:w.data.etime})})}if(new Date().valueOf()-(e+a),this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const b=(s=this.weatherLayers["swell-direction"])==null?void 0:s.raw,L=(m=this.weatherLayers["swell-height"])==null?void 0:m.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers.swell={type:"json",direction:b,height:{raw:L},etime:w.data.etime}}if(this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const b=(d=this.weatherLayers["current-direction"])==null?void 0:d.raw,L=(g=this.weatherLayers["current-speed"])==null?void 0:g.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:b,speed:{raw:L},etime:w.data.etime}}}}this.handleWeatherLayerToggle(),this.handleDrawWeather4Json(),this.$nextTick(()=>{var h,f,w,b,L;(L=(b=(w=(f=(h=this.$parent)==null?void 0:h.$refs)==null?void 0:f.idmBottomBar)==null?void 0:w.$refs)==null?void 0:b.capture)==null||L.captureCurrentFrame()})}},handleWeatherLayerToggle(){for(const o in this.weatherLayers)this.weatherLayers[o].active=!1,this.weatherLayers[o].version=Math.random()+1;for(const o of this.activeWeatherLayers){let e=o.key;e==="current-direction"&&(e="current"),this.weatherLayers[e]&&(this.weatherLayers[e].active=!0,this.weatherLayers[e].version=Math.random()+1,e==="wind-particle"&&(this.weatherLayers[e].particle=this.showWindParticle),e==="current-particle"&&(this.weatherLayers[e].particle=this.showCurrentParticle))}},handleWeatherLayerChange(o={sourceChanged:!1}){var a;const e=(a=this.activeWeatherLayers)==null?void 0:a.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);o!=null&&o.sourceChanged||this.weatherWeight!==e?(this.weatherWeight=e,this.fetchWeatherLayers()):this.handleWeatherLayerToggle()},handleRampColorInitial(){var o,e,a,r,i,l,n,c,s,m,d,g;this.viewport.map.getSource((o=this.viewport)==null?void 0:o.rampColorSource)||this.viewport.map.addSource((e=this.viewport)==null?void 0:e.rampColorSource,{type:"canvas",canvas:(a=this.viewport)==null?void 0:a.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((r=this.viewport)==null?void 0:r.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(i=this.viewport)==null?void 0:i.rampColorLayer,source:(l=this.viewport)==null?void 0:l.rampColorSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.viewport.map.getSource((n=this.viewport)==null?void 0:n.particleSource)||this.viewport.map.addSource((c=this.viewport)==null?void 0:c.particleSource,{type:"canvas",canvas:(s=this.viewport)==null?void 0:s.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((m=this.viewport)==null?void 0:m.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(d=this.viewport)==null?void 0:d.particleLayer,source:(g=this.viewport)==null?void 0:g.particleSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer)},handleDrawWeather4Json(){var i,l,n,c,s,m,d;const o=new Date().valueOf();let e=0;const a=(i=this.map)==null?void 0:i.getBounds(),r=(l=this.map)==null?void 0:l.getZoom();if(a&&r){const g=N.LngLatHelper.convertToStdLng(a._sw.lng),u=N.LngLatHelper.convertToStdLng(a._ne.lng),y=Math.floor(a._sw.lat),p=Math.ceil(a._ne.lat);for(const h in this.weatherLayers){let f=!1;if(this.weatherLayers[h].active&&this.weatherLayers[h].type==="json"){let w=[];if(h==="swell"){f=!0;const b=((n=this.weatherLayers[h])==null?void 0:n.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,M,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,M,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].height;if(L){if(!L.data){const k=[];for(const C in(c=L.raw)==null?void 0:c.LineString){const A=L.raw.LineString[C];for(const _ of A)k.push(T.lineString(_,{val:Number(C)}));L.data=T.featureCollection(k)}}if(L.data){const k=this.handleBboxClip(L.data,a);w=w.concat(k)}new Date().valueOf()-(o+e)}}else if(h==="current"){f=!0;const b=((s=this.weatherLayers[h])==null?void 0:s.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,M,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,M,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<this.zoom/2?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].speed;if(L){if(!L.data){const C=[];for(const A in(m=L.raw)==null?void 0:m.Polygon){const _=L.raw.Polygon[A];for(const z of _)C.push(T.polygon(z,{val:Number(A)}))}L.data=T.featureCollection(C)}const k=r<this.zoom?L.data.features.filter(C=>C.properties.val>.5):L.data.features;w=w.concat(k),new Date().valueOf()-(o+e)}}else if(h==="wind"){f=!0;const b=this.weatherLayers.wind.raw;for(const L in b)if(L>y&&L<p&&(!(r<=this.zoom)||L%(r<2?10:r<4?5:3)===0)){const k=b[L].lng;g>u?k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const M=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(M)}}else if((C>=g&&C<=180||C>=-180&&C<=u)&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const M=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(M)}}):k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const M=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(M)}}else if(C>=g&&C<=u&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const M=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(M)}})}new Date().valueOf()-(o+e)}else if(h==="sig-wave-height"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.Polygon){const C=b.Polygon[k];for(const A of C)L.push(T.polygon(A,{val:Number(k)}))}for(const k in b.MultiPolygon){const C=b.MultiPolygon[k];for(const A of C)L.push(T.multiPolygon(A,{val:Number(k)}))}for(const k in b.Point){const C=b.Point[k];for(let A=0;A<((d=C.lng)==null?void 0:d.length);A++)L.push(T.point([C.lng[A],k],{val:Number(C.val[A])}))}w=w.concat(L)}}new Date().valueOf()-(o+e)}else if(h==="prmsl"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.LineString){const C=b.LineString[k];for(const A of C)L.push(T.lineString(A,{val:Number(k)}))}for(const k in b.Point)b.Point[k].lng.forEach((C,A)=>{C=N.LngLatHelper.convertToStdLng(C),L.push(T.point([C,k],{val:b.Point[k].val[A],type:b.Point[k].type[A]}))});w=w.concat(L)}}new Date().valueOf()-(o+e)}w.length&&(this.weatherLayers[h].data=T.featureCollection(w)),f&&(this.weatherLayers[h].version=Math.random()+1)}}}},handleMove4Weather(){for(const o in this.weatherLayers)this.weatherLayers[o].active&&this.weatherLayers[o].type==="image"&&(this.weatherLayers[o].active=!0,this.weatherLayers[o].version=Math.random()+1);this.handleDrawWeather4Json()},handleBboxClip(o,e){const a=[],r=N.LngLatHelper.convertToStdLng(e._sw.lng),i=N.LngLatHelper.convertToStdLng(e._ne.lng);return o.features.forEach(l=>{if(l.geometry.type!=="Point")if(r>i){let n=[r,e._sw.lat,180,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c),n=[-180,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n),c.geometry.coordinates.length&&a.push(c)}else{const n=[r,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c)}else a.push(l)}),a}}},wm={class:"idm-gl4-meteo-layers"},xm={key:0,class:"legend-tip-btn-gl4"},km={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},Am={class:"d-flex flex-row justify-center align-center"},Lm={class:"text-caption"},Cm={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},vm={class:"d-flex flex-row justify-center align-center"},zm={key:0,style:{width:"24px",height:"12px",border:"1px solid rgba(var(--v-border-color), var(--v-border-opacity))"}},_m={class:"text-caption px-2"},Sm={class:"d-flex flex-row justify-start align-start flex-wrap text-body-2 ml-n1"},Nm={class:"d-flex flex-row justify-start align-center"},Mm={class:"d-flex flex-row justify-center align-center",style:{width:"40px"}},Pm={class:"text-caption"},Vm={class:"d-flex justify-start align-center ga-3"},Tm={class:"text-h5 font-weight-medium"},Em={key:0,class:"w-100 d-flex justify-space-between align-center ga-1 mb-2 px-3"},Dm={key:0,class:"d-flex justify-start align-center ga-4 pl-6"},Rm={key:1,class:"d-flex justify-start align-center ga-4 pl-6"},Bm={class:"text-body-1 py-2"},Im={class:"text-body-1 font-weight-medium"},Fm={class:"text-body-2 text-label"},Gm={class:"text-body-2 text-label"},jm={class:"text-body-2 text-label mb-3"},Wm={class:"text-body-1 font-weight-medium"},Zm={class:"text-body-2 text-label"},Xm={class:"text-body-2 text-label"},Hm={class:"text-body-2 text-label mb-3"},Om={class:"text-body-1 py-2"},Ym={class:"text-body-1 font-weight-medium"},Um={class:"text-body-2 text-label"},Jm={class:"text-body-2 text-label"},Km={class:"text-body-2 text-label mb-3"},Qm={class:"text-body-1 font-weight-medium"},qm={class:"text-body-2 text-label"},$m={class:"text-body-2 text-label"},ed={class:"text-body-2 text-label mb-3"},td={class:"text-body-1 py-2"},od={class:"text-body-1 font-weight-medium"},ad={class:"text-body-2 text-label"},id={class:"text-body-2 text-label"},rd={class:"text-body-2 text-label mb-3"};function ld(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCard"),g=t.resolveComponent("VSwitch"),u=t.resolveComponent("VBtnToggle"),y=t.resolveComponent("VCardTitle"),p=t.resolveComponent("VCardItem"),h=t.resolveComponent("VCheckbox"),f=t.resolveComponent("VRadio"),w=t.resolveComponent("IdmWindBarb"),b=t.resolveComponent("IdmSigWaveHeight"),L=t.resolveComponent("IdmCurrentDirection"),k=t.resolveComponent("IdmPrmsl"),C=t.resolveComponent("IdmWindParticle"),A=t.resolveComponent("IdmCurrentParticle"),_=t.resolveComponent("IdmWave"),z=t.resolveComponent("IdmSwell"),P=t.resolveComponent("IdmIceEdge"),V=t.resolveComponent("IdmIceCover"),M=t.resolveComponent("IdmIceThickness"),j=t.resolveComponent("IdmPrecip3h"),U=t.resolveComponent("IdmVisibility"),K=t.resolveComponent("IdmWaterTemp"),de=t.resolveComponent("IdmTemp");return t.openBlock(),t.createElementBlock("div",wm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+46+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("weather.weatherLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-Weather text-h4"},null,-1)])),_:2,__:[9]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),l.showTipMenu?(t.openBlock(),t.createElementBlock("div",xm,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box pa-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({right:i.right+"px",top:a.simple?"394px":"490px"})},[t.createVNode(c,{text:o.$t("weather.legend"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.legendToggle?"bg-primary active-border":""],onClick:e[0]||(e[0]=se=>i.legendToggle=!i.legendToggle)}),{default:t.withCtx(()=>e[10]||(e[10]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),_:2,__:[10]},1040,["class"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),i.legendToggle?(t.openBlock(),t.createBlock(d,{key:0,elevation:"16",class:"card-info d-flex justify-center align-start",style:t.normalizeStyle({position:"absolute",top:a.simple?"200px":"340px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-1",style:{width:"120px"}},{default:t.withCtx(()=>[e[11]||(e[11]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-1"},"Wind Level",-1)),t.createElementVNode("div",km,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.barbs,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"w-50 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Am,[t.createElementVNode("i",{class:t.normalizeClass(["iconfont",l.barbsIconName[se]]),style:t.normalizeStyle({color:a.theme==="dark"?"#fff":"#000"})},null,6),t.createElementVNode("span",Lm,t.toDisplayString(Number(X)<10?`00${X}kts`:Number(X)<100?`0${X}kts`:`${X}kts`),1)])]))),128))])]),_:1,__:[11]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[12]||(e[12]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2"},"Wave Height",-1)),t.createElementVNode("div",Cm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.sigWaveHeight,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",vm,[se===0?(t.openBlock(),t.createElementBlock("div",zm)):(t.openBlock(),t.createElementBlock("div",{key:1,style:t.normalizeStyle({width:"24px",height:"12px",background:X.color})},null,4)),t.createElementVNode("div",_m,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[12]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label pl-0 pr-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[13]||(e[13]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-2"},"Current",-1)),t.createElementVNode("div",Sm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.current,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-center align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Nm,[t.createElementVNode("div",Mm,[t.createElementVNode("i",{class:"iconfont icon-a-direction-arrow text-label",style:t.normalizeStyle({fontSize:40*X.size+"px"})},null,4)]),t.createElementVNode("div",Pm,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[13]})]),_:1},8,["style"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",{class:t.normalizeClass(["header-box w-100 d-flex justify-space-between align-center",a.simple?"px-3":"px-4"])},[t.createElementVNode("div",Vm,[t.createElementVNode("div",Tm,t.toDisplayString(o.$t("weather.weather")),1),t.createVNode(g,{modelValue:i.autoActive,"onUpdate:modelValue":e[1]||(e[1]=X=>i.autoActive=X),class:"small-switch",color:"primary","base-color":"disabled",inset:"","hide-details":""},null,8,["modelValue"])]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[14]||(e[14]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[14]},8,["onClick"])],2),a.simple?(t.openBlock(),t.createElementBlock("div",Em,[t.createElementVNode("div",null,t.toDisplayString(o.$t("weather.forecastModel")),1),t.createVNode(u,{modelValue:i.currentModel,"onUpdate:modelValue":e[2]||(e[2]=X=>i.currentModel=X),rounded:"",height:"28",density:"compact",mandatory:"",group:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"28",value:"GFS",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[15]||(e[15]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[15]},8,["color"]),t.createVNode(n,{density:"compact",height:"28",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[16]||(e[16]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[16]},8,["color"])]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 scroll overflow-y-auto",[i.autoActive?"":"cursor-not-allowed",a.simple?"px-3":"pl-4 pr-2"]])},[t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.overlays")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>X.overlays),X=>(t.openBlock(),t.createBlock(h,{key:X.key,modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=se=>i.checkList=se),value:X.key,label:o.$t(`weather.${X.locale}`),disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label","disabled"]))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.renders")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>!X.overlays),X=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:X.key},[t.createVNode(f,{modelValue:i.renderKey,"onUpdate:modelValue":e[4]||(e[4]=se=>i.renderKey=se),label:o.$t(`weather.${X.locale}`),value:X.key,disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"text-body-2 py-1","hide-details":"",onClick:se=>i.renderKey=i.renderKey===X.key?"":X.key},null,8,["modelValue","label","value","disabled","onClick"]),i.renderKey==="wind-particle"&&X.key==="wind-particle"?(t.openBlock(),t.createElementBlock("div",Dm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showWindParticle,"onUpdate:modelValue":e[5]||(e[5]=se=>i.showWindParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"",style:{"font-size":"14px"},"hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="current-particle"&&X.key==="current-particle"?(t.openBlock(),t.createElementBlock("div",Rm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showCurrentParticle,"onUpdate:modelValue":e[6]||(e[6]=se=>i.showCurrentParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",inset:"",density:"compact",height:"20","hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="wave-group"&&X.key==="wave-group"?(t.openBlock(),t.createBlock(u,{key:2,modelValue:i.waveToggleValue,"onUpdate:modelValue":e[7]||(e[7]=se=>i.waveToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"sig-wave",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="sig-wave"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.significant")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="swell"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"swell"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.swell")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0),i.renderKey==="ice-forecast"&&X.key==="ice-forecast"?(t.openBlock(),t.createBlock(u,{key:3,modelValue:i.iceToggleValue,"onUpdate:modelValue":e[8]||(e[8]=se=>i.iceToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"ice-cover",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-cover"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.coverage")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-thickness"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"ice-thickness"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.thickness")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1)]),_:1})]),_:1}),t.createVNode(s,{class:""},{default:t.withCtx(()=>{var X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue,te,Ce,Y,O,Je,Ie,Se,F,Xt,$,ve,Ke,tt,ot,R,Qe,G,qe,Ot,ae,$t,re,go,uo,fo,yo,bo,wo,xo,ko,Ao,Lo,Co,vo,zo,_o;return[t.createElementVNode("div",Bm,t.toDisplayString(o.$t("weather.atmospheric")),1),t.createElementVNode("div",Im,t.toDisplayString((Ae=(se=(X=i.models)==null?void 0:X.weather)==null?void 0:se.NOAA)==null?void 0:Ae.source)+" "+t.toDisplayString((Ge=(Fe=(Le=i.models)==null?void 0:Le.weather)==null?void 0:Fe.NOAA)==null?void 0:Ge.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Ve=(je=(ze=(De=i.models)==null?void 0:De.weather)==null?void 0:ze.NOAA)==null?void 0:je.meta)==null?void 0:Ve.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Fm,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Gm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ze=(We=(Re=(Te=i.models)==null?void 0:Te.weather)==null?void 0:Re.NOAA)==null?void 0:We.meta)==null?void 0:Ze.availabilityTime)),1),t.createElementVNode("div",jm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_e=(xe=(we=(Be=i.models)==null?void 0:Be.weather)==null?void 0:we.NOAA)==null?void 0:xe.meta)==null?void 0:_e.initialisationTime)),1),t.createElementVNode("div",Wm,t.toDisplayString((Oe=(He=(Xe=i.models)==null?void 0:Xe.weather)==null?void 0:He.ECMWF)==null?void 0:Oe.source)+" "+t.toDisplayString((it=(at=(Me=i.models)==null?void 0:Me.weather)==null?void 0:at.ECMWF)==null?void 0:it.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((st=(nt=(lt=(rt=i.models)==null?void 0:rt.weather)==null?void 0:lt.ECMWF)==null?void 0:nt.meta)==null?void 0:st.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Zm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",Xm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((ht=(dt=(mt=(ct=i.models)==null?void 0:ct.weather)==null?void 0:mt.ECMWF)==null?void 0:dt.meta)==null?void 0:ht.availabilityTime)),1),t.createElementVNode("div",Hm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((ft=(ut=(gt=(pt=i.models)==null?void 0:pt.weather)==null?void 0:gt.ECMWF)==null?void 0:ut.meta)==null?void 0:ft.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",Om,t.toDisplayString(o.$t("weather.wave")),1),t.createElementVNode("div",Ym,t.toDisplayString((xt=(wt=(bt=(yt=i.models)==null?void 0:yt.marine)==null?void 0:bt.wave)==null?void 0:wt.NOAA)==null?void 0:xt.source)+" "+t.toDisplayString((Ct=(Lt=(At=(kt=i.models)==null?void 0:kt.marine)==null?void 0:At.wave)==null?void 0:Lt.NOAA)==null?void 0:Ct.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Nt=(St=(_t=(zt=(vt=i.models)==null?void 0:vt.marine)==null?void 0:zt.wave)==null?void 0:_t.NOAA)==null?void 0:St.meta)==null?void 0:Nt.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Um,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Jm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Et=(Tt=(Vt=(Pt=(Mt=i.models)==null?void 0:Mt.marine)==null?void 0:Pt.wave)==null?void 0:Vt.NOAA)==null?void 0:Tt.meta)==null?void 0:Et.availabilityTime)),1),t.createElementVNode("div",Km,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((Ft=(It=(Bt=(Rt=(Dt=i.models)==null?void 0:Dt.marine)==null?void 0:Rt.wave)==null?void 0:Bt.NOAA)==null?void 0:It.meta)==null?void 0:Ft.initialisationTime)),1),t.createElementVNode("div",Qm,t.toDisplayString((Ee=(Pe=(jt=(Gt=i.models)==null?void 0:Gt.marine)==null?void 0:jt.wave)==null?void 0:Pe.ECMWF)==null?void 0:Ee.source)+" "+t.toDisplayString((et=(Zt=(Ye=(Wt=i.models)==null?void 0:Wt.marine)==null?void 0:Ye.wave)==null?void 0:Zt.ECMWF)==null?void 0:et.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Y=(Ce=(te=(Ue=(ke=i.models)==null?void 0:ke.marine)==null?void 0:Ue.wave)==null?void 0:te.ECMWF)==null?void 0:Ce.meta)==null?void 0:Y.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",qm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",$m,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((F=(Se=(Ie=(Je=(O=i.models)==null?void 0:O.marine)==null?void 0:Je.wave)==null?void 0:Ie.ECMWF)==null?void 0:Se.meta)==null?void 0:F.availabilityTime)),1),t.createElementVNode("div",ed,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((tt=(Ke=(ve=($=(Xt=i.models)==null?void 0:Xt.marine)==null?void 0:$.wave)==null?void 0:ve.ECMWF)==null?void 0:Ke.meta)==null?void 0:tt.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",td,t.toDisplayString(o.$t("weather.currents")),1),t.createElementVNode("div",od,t.toDisplayString((G=(Qe=(R=(ot=i.models)==null?void 0:ot.marine)==null?void 0:R.current)==null?void 0:Qe.ECMWF)==null?void 0:G.source)+" "+t.toDisplayString(($t=(ae=(Ot=(qe=i.models)==null?void 0:qe.marine)==null?void 0:Ot.current)==null?void 0:ae.ECMWF)==null?void 0:$t.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((yo=(fo=(uo=(go=(re=i.models)==null?void 0:re.marine)==null?void 0:go.current)==null?void 0:uo.ECMWF)==null?void 0:fo.meta)==null?void 0:yo.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",ad,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",id,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ao=(ko=(xo=(wo=(bo=i.models)==null?void 0:bo.marine)==null?void 0:wo.current)==null?void 0:xo.ECMWF)==null?void 0:ko.meta)==null?void 0:Ao.availabilityTime)),1),t.createElementVNode("div",rd,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_o=(zo=(vo=(Co=(Lo=i.models)==null?void 0:Lo.marine)==null?void 0:Co.current)==null?void 0:vo.ECMWF)==null?void 0:zo.meta)==null?void 0:_o.initialisationTime)),1)]}),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:1,ref:"windBarb",map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-3",wind:(ne=i.weatherLayers)==null?void 0:ne.wind,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","wind","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:2,map:a.map,"before-layer":"empty-layer-2","sig-wave-height":(S=i.weatherLayers)==null?void 0:S["sig-wave-height"],"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs),null,16,["map","sig-wave-height","menu-toggle","active-weather-layers"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:3,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-2",current:(Z=i.weatherLayers)==null?void 0:Z.current,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","current","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:4,map:a.map,"before-layer":"empty-layer-3",prmsl:(H=i.weatherLayers)==null?void 0:H.prmsl,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs,{theme:a.theme}),null,16,["map","prmsl","menu-toggle","active-weather-layers","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:5,viewport:i.viewport,factor:(q=i.weatherLayers)==null?void 0:q["wind-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:6,viewport:i.viewport,factor:(W=i.weatherLayers)==null?void 0:W["current-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:7,viewport:i.viewport,factor:(B=i.weatherLayers)==null?void 0:B["sig-wave"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:8,map:a.map,viewport:i.viewport,factor:(J=i.weatherLayers)==null?void 0:J.swell,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers,simple:a.simple},o.$attrs),null,16,["map","viewport","factor","menu-toggle","active-weather-layers","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:9,viewport:i.viewport,factor:(E=i.weatherLayers)==null?void 0:E["ice-edge"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:10,viewport:i.viewport,factor:(I=i.weatherLayers)==null?void 0:I["ice-cover"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(M,t.mergeProps({key:11,viewport:i.viewport,factor:(ie=i.weatherLayers)==null?void 0:ie["ice-thickness"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:12,viewport:i.viewport,factor:(ge=i.weatherLayers)==null?void 0:ge.precip3h,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:13,viewport:i.viewport,factor:(ue=i.weatherLayers)==null?void 0:ue.visibility,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:14,viewport:i.viewport,factor:(oe=i.weatherLayers)==null?void 0:oe["water-temp"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:15,viewport:i.viewport,factor:(he=i.weatherLayers)==null?void 0:he.temp,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0)])}const nd=Q(bm,[["render",ld]]),no=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"GFS",alias:"GFS",model:"gfs_seamless",provider:"NOAA",country:"United States",resolution:25,tips:"3-25km",length:16,frequency:1,models:["gfs_seamless"],categories:"ncep_gfs013,ncep_gfs025,ncep_gfs_graphcast025,ncep_hrrr_conus,ncep_nbm_conus",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:2,name:"ECMWF",alias:"ECMWF",model:"ecmwf_ifs025",provider:"ECMWF",country:"European Union",resolution:25,tips:"25km",length:15,frequency:6,models:["ecmwf_ifs025","ecmwf_aifs025_single","ecmwf_ifs"],categories:"ecmwf_ifs025,ecmwf_aifs025_single,ecmwf_ifs",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:3,disabled:!0,name:"ICON",alias:"ECMWF",model:"icon_seamless",provider:"Deutscher Wetterdienst (DWD)",country:"Germany",resolution:13,tips:"2-13km",length:7.5,frequency:3,models:["icon_seamless","icon_global","icon_eu","icon_d2"],categories:"dwd_icon,dwd_icon_eps,dwd_icon_d2,dwd_icon_d2_eps,dwd_icon_eu,dwd_icon_eu_eps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:4,name:"ARPEGE",disabled:!0,alias:"ECMWF",model:"arpege_seamless",provider:"Météo-France",country:"France",resolution:25,tips:"1-25km",length:4,frequency:1,models:["arpege_seamless","arpege_world","arpege_europe"],categories:"meteofrance_arpege_europe,meteofrance_arpege_europe_probabilities,meteofrance_arpege_world025",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:5,name:"UKMO",disabled:!0,alias:"ECMWF",model:"ukmo_seamless",provider:"UK Met Office",country:"United Kingdom",resolution:10,tips:"2-10km",length:7,frequency:1,models:["ukmo_seamless","ukmo_global_deterministic_10km","ukmo_uk_deterministic_2km"],categories:"ukmo_global_deterministic_10km,ukmo_uk_deterministic_2km",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:6,name:"JMA",disabled:!0,alias:"GFS",model:"jma_seamless",provider:"JMA",country:"Japan",resolution:55,tips:"5-55km",length:11,frequency:3,models:["jma_seamless","jma_msm","jma_gsm"],categories:"jma_gsm,jma_msm",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:7,name:"GEM",disabled:!0,alias:"GFS",model:"gem_seamless",provider:"Canadian Weather Service",country:"Canada",resolution:2.5,tips:"2.5km",length:10,frequency:6,models:["gem_seamless","gem_global","gem_regional"],categories:"cmc_gem_gdps,cmc_gem_hrdps,cmc_gem_rdps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:8,name:"GRAPES",disabled:!0,alias:"GFS",model:"cma_grapes_global",provider:"China Meteorological Administration (CMA)",country:"China",resolution:15,tips:"15km",length:10,frequency:6,models:["cma_grapes_global"],categories:"cma_grapes_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:9,name:"ACCESS-G",disabled:!0,alias:"GFS",model:"bom_access_global",provider:"Australian Bureau of Meteorology (BOM)",country:"Australia",resolution:15,tips:"15km",length:10,frequency:6,models:["bom_access_global"],categories:"bom_access_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"}],so=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"MFWAM",alias:"ECMWF",model:"meteofrance_wave",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:12,models:["meteofrance_wave"],categories:"meteofrance_wave",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:2,disabled:!0,name:"SMOC",alias:"ECMWF",model:"meteofrance_currents",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:24,models:["meteofrance_currents"],categories:"meteofrance_currents, meteofrance_sea_surface_temperature",variables:"ocean_u_current,ocean_v_current,invert_barometer_height,sea_level_height_msl,sea_surface_temperature"},{rank:3,disabled:!0,name:"EWAM",alias:"ECMWF",model:"ewam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:8,frequency:2,models:["ewam"],categories:"dwd_ewam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:4,disabled:!0,name:"GWAM",alias:"ECMWF",model:"gwam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:4,frequency:2,models:["gwam"],categories:"dwd_gwam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:5,disabled:!0,name:"ECWAM",alias:"ECMWF",model:"ecmwf_wam025",provider:"ECMWF",country:"Europe",resolution:25,tips:"25km",length:10,frequency:6,models:["ecmwf_wam025"],categories:"ecmwf_wam025",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:6,name:"GFSWave",alias:"GFS",model:"ncep_gfswave025",provider:"NCEP",country:"USA",resolution:25,tips:"25km",length:10,frequency:6,models:["ncep_gfswave025","ncep_gfswave016"],categories:"ncep_gfswave025,ncep_gfswave016",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:7,disabled:!0,name:"ERA5-Ocean",alias:"ECMWF",model:"era5_ocean",provider:"Copernicus",country:"Europe",resolution:50,tips:"50km",length:-5,frequency:1,models:["era5_ocean"],categories:"copernicus_era5_ocean",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"}];let la=class{static standardWeatherModels(){return no.filter(e=>!e.disabled&&e.alias)}static standardMarineModels(){return so.filter(e=>!e.disabled&&e.alias)}static autoPickLayerModel(e,a="copernicus"){return a=a||"copernicus",a=a==null?void 0:a.toLowerCase(),a=["gfs","ecmwf","copernicus"].includes(a)?a:"copernicus",e=e==null?void 0:e.toLowerCase(),e==="gfs"?"gfs":["ec","ecmwf"].includes(e)?"ecmwf":["copernicus","cmems"].includes(e)?"copernicus":a}static autoPickPeerModel(e,a,r="copernicus"){if(a=this.autoPickLayerModel(a,r),$r.LayerHelper.WEATHER_LAYERS.reduce((i,l)=>l.atmos?i+l.weight:i,0)&e.weight){if(a==="copernicus")return"ecmwf"}else{if(["sig-wave","sig-wave-height","sig-wave-height-contour"].includes(e.key))return a;if(a==="ecmwf")return"copernicus"}return a}static autoPickMeteoModel(e="best_match"){var a,r;e=e==null?void 0:e.toLowerCase(),e=e==="ec"?"ecmwf":e;const i=e.toLowerCase().split(","),l=[],n=[];for(const c of i){let s=no.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c}),m=so.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c});s=s||no.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=m==null?void 0:m.alias)==null?void 0:u.toLowerCase())}),m=m||so.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=s==null?void 0:s.alias)==null?void 0:u.toLowerCase())}),s=s||no[0],m=m||so[0],l.push((a=s.models)!=null&&a.includes(c)?c:s.model),n.push((r=m.models)!=null&&r.includes(c)?c:m.model)}return{weatherModels:l.join(","),marineModels:n.join(",")}}static autoPickSubCategories(e){e=e.toUpperCase();const a=no.filter(l=>l.alias===e),r=so.filter(l=>l.alias===e),i=[];return a.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),r.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),i}static pickHourly(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,M,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue;const te=typeof a=="string"?v(a):a;let Ce=te.clone();const Y=e==null?void 0:e.weather,O=e==null?void 0:e.marine,Je=((i=(r=Y==null?void 0:Y[0])==null?void 0:r.hourly)==null?void 0:i.date)||((n=(l=O==null?void 0:O[0])==null?void 0:l.hourly)==null?void 0:n.date),Ie=v.utc(Je),Se=Ie.clone().add(((m=(s=(c=Y==null?void 0:Y[0])==null?void 0:c.hourly)==null?void 0:s.time)==null?void 0:m.at(0))||((u=(g=(d=O==null?void 0:O[0])==null?void 0:d.hourly)==null?void 0:g.time)==null?void 0:u.at(0)),"h"),F=Ie.clone().add(((h=(p=(y=Y==null?void 0:Y[0])==null?void 0:y.hourly)==null?void 0:p.time)==null?void 0:h.at(-1))||((b=(w=(f=O==null?void 0:O[0])==null?void 0:f.hourly)==null?void 0:w.time)==null?void 0:b.at(-1)),"h"),Xt=[];Ce=Ce.isBefore(Se)?Se.clone():Ce,Ce=Ce.isAfter(F)?F.clone():Ce;const $=Ce.utc().diff(Se,"h",!1);let ve,Ke;if(Y!=null&&Y.length){let tt=0,ot=0,R=0;for(const Qe of Y){const G=Qe==null?void 0:Qe.hourly;for(let re=$-($-1)%3;re<=$;re++)tt+=((L=G==null?void 0:G.precipitation)==null?void 0:L.at(re))??0;for(let re=$-($-1)%6;re<=$;re++)ot+=((k=G==null?void 0:G.precipitation)==null?void 0:k.at(re))??0;for(let re=$-($-1)%12;re<=$;re++)R+=((C=G==null?void 0:G.precipitation)==null?void 0:C.at(re))??0;const qe=((A=G==null?void 0:G.wind_direction_10m)==null?void 0:A.at($))??((z=(_=G==null?void 0:G.wind_direction_10m)==null?void 0:_.filter(re=>re!==null))==null?void 0:z.at(-1));ve={temp:((P=G==null?void 0:G.temperature_2m)==null?void 0:P.at($))??((M=(V=G==null?void 0:G.temperature_2m)==null?void 0:V.filter(re=>re!==null))==null?void 0:M.at(-1)),apparentTemp:((j=G==null?void 0:G.apparent_temperature)==null?void 0:j.at($))??((K=(U=G==null?void 0:G.apparent_temperature)==null?void 0:U.filter(re=>re!==null))==null?void 0:K.at(-1)),rh:((de=G==null?void 0:G.relative_humidity_2m)==null?void 0:de.at($))??((S=(ne=G==null?void 0:G.relative_humidity_2m)==null?void 0:ne.filter(re=>re!==null))==null?void 0:S.at(-1)),dp:((Z=G==null?void 0:G.dew_point_2m)==null?void 0:Z.at($))??((q=(H=G==null?void 0:G.dew_point_2m)==null?void 0:H.filter(re=>re!==null))==null?void 0:q.at(-1)),precip:{probability:((W=G==null?void 0:G.precipitation_probability)==null?void 0:W.at($))??0,sum:((B=G==null?void 0:G.precipitation)==null?void 0:B.at($))??0,sum1Hours:((J=G==null?void 0:G.precipitation)==null?void 0:J.at($))??0,sum3Hours:Math.round(tt*100)/100,sum6Hours:Math.round(ot*100)/100,sum12Hours:Math.round(R*100)/100},pmsl:((E=G==null?void 0:G.pressure_msl)==null?void 0:E.at($))??((ie=(I=G==null?void 0:G.pressure_msl)==null?void 0:I.filter(re=>re!==null))==null?void 0:ie.at(-1)),psurf:((ge=G==null?void 0:G.surface_pressure)==null?void 0:ge.at($))??((oe=(ue=G==null?void 0:G.surface_pressure)==null?void 0:ue.filter(re=>re!==null))==null?void 0:oe.at(-1)),code:((he=G==null?void 0:G.weather_code)==null?void 0:he.at($))??((se=(X=G==null?void 0:G.weather_code)==null?void 0:X.filter(re=>re!==null))==null?void 0:se.at(-1)),visibility:this.m2nm(((Ae=G==null?void 0:G.visibility)==null?void 0:Ae.at($))??((Fe=(Le=G==null?void 0:G.visibility)==null?void 0:Le.filter(re=>re!==null))==null?void 0:Fe.at(-1))),wind:{speed:((Ge=G==null?void 0:G.wind_speed_10m)==null?void 0:Ge.at($))??((ze=(De=G==null?void 0:G.wind_speed_10m)==null?void 0:De.filter(re=>re!==null))==null?void 0:ze.at(-1)),kts:((je=G==null?void 0:G.wind_speed_10m)==null?void 0:je.at($))??((Te=(Ve=G==null?void 0:G.wind_speed_10m)==null?void 0:Ve.filter(re=>re!==null))==null?void 0:Te.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,gusts:((Re=G==null?void 0:G.wind_gusts_10m)==null?void 0:Re.at($))??((Ze=(We=G==null?void 0:G.wind_gusts_10m)==null?void 0:We.filter(re=>re!==null))==null?void 0:Ze.at(-1))},isDay:(Be=G==null?void 0:G.is_day)==null?void 0:Be.at($)};const{name:Ot,url:ae,bg:$t}=this.parseWeatherCode(ve.code,ve.isDay);ve.name=Ot,ve.url=ae,ve.bg=$t,ve.wind.scale=this.beaufort(this.kts2ms(ve.wind.kts)),ve.wind.direction=this.degree2Direction(ve.wind.degree),Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:Qe.model,weather:{...ve}})}}if(O!=null&&O.length){let tt=0;for(const ot of O){const R=ot==null?void 0:ot.hourly,Qe=((we=R==null?void 0:R.wave_direction)==null?void 0:we.at($))??((_e=(xe=R==null?void 0:R.wave_direction)==null?void 0:xe.filter(ae=>ae!==null))==null?void 0:_e.at(-1)),G=((Xe=R==null?void 0:R.swell_wave_direction)==null?void 0:Xe.at($))??((Oe=(He=R==null?void 0:R.swell_wave_direction)==null?void 0:He.filter(ae=>ae!==null))==null?void 0:Oe.at(-1)),qe=((Me=R==null?void 0:R.wind_wave_direction)==null?void 0:Me.at($))??((it=(at=R==null?void 0:R.wind_wave_direction)==null?void 0:at.filter(ae=>ae!==null))==null?void 0:it.at(-1)),Ot=((rt=R==null?void 0:R.ocean_current_direction)==null?void 0:rt.at($))??((nt=(lt=R==null?void 0:R.ocean_current_direction)==null?void 0:lt.filter(ae=>ae!==null))==null?void 0:nt.at(-1));Ke={wave:{sig:{height:((st=R==null?void 0:R.wave_height)==null?void 0:st.at($))??((mt=(ct=R==null?void 0:R.wave_height)==null?void 0:ct.filter(ae=>ae!==null))==null?void 0:mt.at(-1)),degree:Qe,bearing:Qe!==null?Math.round((Qe+180)%360):null,period:((dt=R==null?void 0:R.wave_period)==null?void 0:dt.at($))??((pt=(ht=R==null?void 0:R.wave_period)==null?void 0:ht.filter(ae=>ae!==null))==null?void 0:pt.at(-1))},swell:{height:((gt=R==null?void 0:R.swell_wave_height)==null?void 0:gt.at($))??((ft=(ut=R==null?void 0:R.swell_wave_height)==null?void 0:ut.filter(ae=>ae!==null))==null?void 0:ft.at(-1)),degree:G,bearing:G!==null?Math.round((G+180)%360):null,period:((yt=R==null?void 0:R.swell_wave_period)==null?void 0:yt.at($))??((wt=(bt=R==null?void 0:R.swell_wave_period)==null?void 0:bt.filter(ae=>ae!==null))==null?void 0:wt.at(-1)),peakPeriod:((xt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:xt.at($))??((At=(kt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:kt.filter(ae=>ae!==null))==null?void 0:At.at(-1))},wd:{height:((Lt=R==null?void 0:R.wind_wave_height)==null?void 0:Lt.at($))??((vt=(Ct=R==null?void 0:R.wind_wave_height)==null?void 0:Ct.filter(ae=>ae!==null))==null?void 0:vt.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,period:((zt=R==null?void 0:R.wind_wave_period)==null?void 0:zt.at($))??((St=(_t=R==null?void 0:R.wind_wave_period)==null?void 0:_t.filter(ae=>ae!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Nt.at($))??((Pt=(Mt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Mt.filter(ae=>ae!==null))==null?void 0:Pt.at(-1))}},current:{speed:((Vt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Vt.at($))??((Et=(Tt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Tt.filter(ae=>ae!==null))==null?void 0:Et.at(-1)),kts:((Dt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Dt.at($))??((Bt=(Rt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Rt.filter(ae=>ae!==null))==null?void 0:Bt.at(-1)),degree:Ot,bearing:Ot},sst:((It=R==null?void 0:R.sea_surface_temperature)==null?void 0:It.at($))??((Gt=(Ft=R==null?void 0:R.sea_surface_temperature)==null?void 0:Ft.filter(ae=>ae!==null))==null?void 0:Gt.at(-1)),height:((jt=R==null?void 0:R.sea_level_height_msl)==null?void 0:jt.at($))??((Ee=(Pe=R==null?void 0:R.sea_level_height_msl)==null?void 0:Pe.filter(ae=>ae!==null))==null?void 0:Ee.at(-1)),ice:{sit:((Wt=R==null?void 0:R.sea_ice_thickness)==null?void 0:Wt.at($))??((Zt=(Ye=R==null?void 0:R.sea_ice_thickness)==null?void 0:Ye.filter(ae=>ae!==null))==null?void 0:Zt.at(-1)),sic:((et=R==null?void 0:R.sea_ice_concentration)==null?void 0:et.at($))??((Ue=(ke=R==null?void 0:R.sea_ice_concentration)==null?void 0:ke.filter(ae=>ae!==null))==null?void 0:Ue.at(-1))}},Ke.wave=this.parseWave(Ke.wave,ve==null?void 0:ve.wind),Ke.current.direction=this.degree2Direction(Ke.current.degree),Xt[tt]?Object.assign(Xt[tt],Ke):Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:ot.model,...Ke}),tt++}}return Xt}static toLegacy(e){var a,r,i,l,n,c,s,m,d,g;return{wind:(a=e==null?void 0:e.weather)==null?void 0:a.wind,visibility:(r=e==null?void 0:e.weather)==null?void 0:r.visibility,temp:(i=e==null?void 0:e.weather)==null?void 0:i.temp,prmsl:(l=e==null?void 0:e.weather)==null?void 0:l.pmsl,gusts:{kts:(c=(n=e==null?void 0:e.weather)==null?void 0:n.wind)==null?void 0:c.gusts},precip:(s=e==null?void 0:e.weather)==null?void 0:s.precip,code:(m=e==null?void 0:e.weather)==null?void 0:m.code,name:(d=e==null?void 0:e.weather)==null?void 0:d.name,url:(g=e==null?void 0:e.weather)==null?void 0:g.url,wave:e==null?void 0:e.wave,current:e==null?void 0:e.current,sst:e==null?void 0:e.sst,height:e==null?void 0:e.height,utc:e==null?void 0:e.utc,source:e==null?void 0:e.model,ice:e==null?void 0:e.ice}}static pickDaily(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,M,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt;const jt=typeof a=="string"?v(a):a;let Pe=jt.clone();const Ee=e==null?void 0:e.weather,Wt=e==null?void 0:e.marine,Ye=v((l=(i=(r=Ee==null?void 0:Ee[0])==null?void 0:r.daily)==null?void 0:i.time)==null?void 0:l.at(0)),Zt=v((s=(c=(n=Ee==null?void 0:Ee[0])==null?void 0:n.daily)==null?void 0:c.time)==null?void 0:s.at(-1)),et=[];Pe=Pe.isBefore(Ye)?Ye.clone():Pe,Pe=Pe.isAfter(Zt)?Zt.clone():Pe;let ke,Ue;const te=Pe.diff(Ye,"d",!1);if(Ee)for(const Ce of Ee){const Y=Ce.daily,O=((m=Y.wind_direction_10m_dominant)==null?void 0:m.at(te))??((g=(d=Y.wind_direction_10m_dominant)==null?void 0:d.filter(F=>F!==null))==null?void 0:g.at(-1));ke={code:((u=Y.weather_code)==null?void 0:u.at(te))??((p=(y=Y.weather_code)==null?void 0:y.filter(F=>F!==null))==null?void 0:p.at(-1)),temp:{max:((h=Y.temperature_2m_max)==null?void 0:h.at(te))??((w=(f=Y.temperature_2m_max)==null?void 0:f.filter(F=>F!==null))==null?void 0:w.at(-1)),min:((b=Y.temperature_2m_min)==null?void 0:b.at(te))??((k=(L=Y.temperature_2m_min)==null?void 0:L.filter(F=>F!==null))==null?void 0:k.at(-1)),mean:((C=Y.temperature_2m_mean)==null?void 0:C.at(te))??((_=(A=Y.temperature_2m_mean)==null?void 0:A.filter(F=>F!==null))==null?void 0:_.at(-1))},apparentTemp:{max:((z=Y.apparent_temperature_max)==null?void 0:z.at(te))??((V=(P=Y.apparent_temperature_max)==null?void 0:P.filter(F=>F!==null))==null?void 0:V.at(-1)),min:((M=Y.apparent_temperature_min)==null?void 0:M.at(te))??((U=(j=Y.apparent_temperature_min)==null?void 0:j.filter(F=>F!==null))==null?void 0:U.at(-1))},precip:{sum:((K=Y.precipitation_sum)==null?void 0:K.at(te))??((ne=(de=Y.precipitation_sum)==null?void 0:de.filter(F=>F!==null))==null?void 0:ne.at(-1)),rainSum:((S=Y.rain_sum)==null?void 0:S.at(te))??((H=(Z=Y.rain_sum)==null?void 0:Z.filter(F=>F!==null))==null?void 0:H.at(-1)),snowfallSum:((q=Y.snowfall_sum)==null?void 0:q.at(te))??((B=(W=Y.snowfall_sum)==null?void 0:W.filter(F=>F!==null))==null?void 0:B.at(-1)),showersSum:((J=Y.showers_sum)==null?void 0:J.at(te))??((I=(E=Y.showers_sum)==null?void 0:E.filter(F=>F!==null))==null?void 0:I.at(-1)),hours:((ie=Y.precipitation_hours)==null?void 0:ie.at(te))??0,probability:((ge=Y.precipitation_probability_max)==null?void 0:ge.at(te))??0},rh:{max:((ue=Y.relative_humidity_2m_max)==null?void 0:ue.at(te))??((he=(oe=Y.relative_humidity_2m_max)==null?void 0:oe.filter(F=>F!==null))==null?void 0:he.at(-1)),min:((X=Y.relative_humidity_2m_min)==null?void 0:X.at(te))??((Ae=(se=Y.relative_humidity_2m_min)==null?void 0:se.filter(F=>F!==null))==null?void 0:Ae.at(-1)),mean:((Le=Y.relative_humidity_2m_mean)==null?void 0:Le.at(te))??((Ge=(Fe=Y.relative_humidity_2m_mean)==null?void 0:Fe.filter(F=>F!==null))==null?void 0:Ge.at(-1))},wind:{speed:((De=Y.wind_speed_10m_max)==null?void 0:De.at(te))??((je=(ze=Y.wind_speed_10m_max)==null?void 0:ze.filter(F=>F!==null))==null?void 0:je.at(-1)),kts:((Ve=Y.wind_speed_10m_max)==null?void 0:Ve.at(te))??((Re=(Te=Y.wind_speed_10m_max)==null?void 0:Te.filter(F=>F!==null))==null?void 0:Re.at(-1)),degree:O,gusts:((We=Y.wind_gusts_10m_max)==null?void 0:We.at(te))??((Be=(Ze=Y.wind_gusts_10m_max)==null?void 0:Ze.filter(F=>F!==null))==null?void 0:Be.at(-1)),mean:((we=Y.wind_speed_10m_mean)==null?void 0:we.at(te))??((_e=(xe=Y.wind_speed_10m_mean)==null?void 0:xe.filter(F=>F!==null))==null?void 0:_e.at(-1)),bearing:O!==null?Math.round((O+180)%360):null},visibility:{max:this.m2nm(((Xe=Y.visibility_max)==null?void 0:Xe.at(te))??((Oe=(He=Y.visibility_max)==null?void 0:He.filter(F=>F!==null))==null?void 0:Oe.at(-1))),min:this.m2nm(((Me=Y.visibility_min)==null?void 0:Me.at(te))??((it=(at=Y.visibility_min)==null?void 0:at.filter(F=>F!==null))==null?void 0:it.at(-1))),mean:this.m2nm(((rt=Y.visibility_mean)==null?void 0:rt.at(te))??((nt=(lt=Y.visibility_mean)==null?void 0:lt.filter(F=>F!==null))==null?void 0:nt.at(-1)))}};const{name:Je,url:Ie,bg:Se}=this.parseWeatherCode(ke.code,!0);ke.name=Je,ke.url=Ie,ke.bg=Se,ke.wind.scale=this.beaufort(this.kts2ms(ke.wind.kts)),ke.wind.direction=this.degree2Direction(ke.wind.degree),et.push({utc:jt.utc().format(),realUTC:Ye.add(te,"d").utc().format(),model:Ce.model,weather:{...ke}})}if(Wt){let Ce=0;for(const Y of Wt){const O=Y.daily,Je=((st=O==null?void 0:O.wave_direction_dominant)==null?void 0:st.at(te))||((mt=(ct=O==null?void 0:O.wave_direction_dominant)==null?void 0:ct.filter(F=>F!==null))==null?void 0:mt.at(-1)),Ie=((dt=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:dt.at(te))||((pt=(ht=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:ht.filter(F=>F!==null))==null?void 0:pt.at(-1)),Se=((gt=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:gt.at(te))||((ft=(ut=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:ut.filter(F=>F!==null))==null?void 0:ft.at(-1));Ue={wave:{sig:{height:((yt=O==null?void 0:O.wave_height_max)==null?void 0:yt.at(te))||((wt=(bt=O==null?void 0:O.wave_height_max)==null?void 0:bt.filter(F=>F!==null))==null?void 0:wt.at(-1)),degree:Je,period:((xt=O==null?void 0:O.wave_period_max)==null?void 0:xt.at(te))||((At=(kt=O==null?void 0:O.wave_period_max)==null?void 0:kt.filter(F=>F!==null))==null?void 0:At.at(-1)),bearing:Je!==null?Math.round((Je+180)%360):null},swell:{height:((Lt=O==null?void 0:O.swell_wave_height_max)==null?void 0:Lt.at(te))??((vt=(Ct=O==null?void 0:O.swell_wave_height_max)==null?void 0:Ct.filter(F=>F!==null))==null?void 0:vt.at(-1)),degree:Ie,period:((zt=O==null?void 0:O.swell_wave_period_max)==null?void 0:zt.at(te))??((St=(_t=O==null?void 0:O.swell_wave_period_max)==null?void 0:_t.filter(F=>F!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Nt.at(te))??((Pt=(Mt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Mt.filter(F=>F!==null))==null?void 0:Pt.at(-1)),bearing:Ie!==null?Math.round((Ie+180)%360):null},wd:{height:((Vt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Vt.at(te))??((Et=(Tt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Tt.filter(F=>F!==null))==null?void 0:Et.at(-1)),degree:Se,period:((Dt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Dt.at(te))??((Bt=(Rt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Rt.filter(F=>F!==null))==null?void 0:Bt.at(-1)),peakPeriod:((It=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:It.at(te))??((Gt=(Ft=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:Ft.filter(F=>F!==null))==null?void 0:Gt.at(-1)),bearing:Se!==null?Math.round((Se+180)%360):null}}},Ue.wave=this.parseWave(Ue.wave,ke==null?void 0:ke.wind),Object.assign(et[Ce]||{},Ue),Ce++}}return et}static parseWave(e,a){if(e.sig.direction=this.degree2Direction(e.sig.degree),e.swell.direction=this.degree2Direction(e.swell.degree),e.wd.direction=this.degree2Direction(e.wd.degree),e.sig.scale=this.douglas(e.sig.height),e.swell.scale=this.douglas(e.swell.height),e.wd.scale=this.douglas(e.wd.height),e.sig.height==0){const r=Math.sqrt(Math.pow(e.swell.height||0,2)+Math.pow(e.wd.height||0,2));e.sig.height=r?Math.round(r*100)/100:.1}if(e.swell.height===0)if(e.sig.height>e.wd.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.wd.height||0,2)));e.swell.height=Math.round(r*100)/100}else{const r=Math.round(.12*this.kts2ms((a==null?void 0:a.kts)||0)*100)/100,i=r>1?r/10:r>.5?r/5:r>.3?r/2:r,l=Math.max(e.sig.height,e.wd.height);e.swell.height=Math.round((i<l?i:l/2)*100)/100}if(e.wd.height===0)if(e.sig.height>e.swell.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.swell.height||0,2))),i=.24*this.kts2ms((a==null?void 0:a.kts)||0);e.wd.height=Math.round(Math.min(r,i)*100)/100}else{const r=.24*this.kts2ms((a==null?void 0:a.kts)||0),i=Math.max(e.sig.height,e.swell.height);e.wd.height=Math.round((r<i?r:i/2)*100)/100}if(e.swell.height>=e.sig.height&&(e.swell.height=Math.round(e.sig.height*.8*100)/100),e.wd.height>=e.sig.height&&(e.wd.height=Math.round(e.sig.height*.8*100)/100),!e.sig.period){const r=Math.max(e.swell.period,e.wd.period);e.sig.period=Math.round(6*Math.sqrt(e.sig.height)),e.sig.period=isNaN(r)?void 0:e.sig.period>r?r:e.sig.period}if(!e.swell.period){e.swell.period=Math.round(6*Math.sqrt(e.swell.height));const r=Math.max(e.sig.period,e.wd.period);e.swell.period=isNaN(r)?void 0:e.swell.period>r?r:e.swell.period}if(!e.wd.period){e.wd.period=Math.round(6*Math.sqrt(e.wd.height));const r=Math.max(e.sig.period,e.swell.period);e.wd.period=isNaN(r)?void 0:e.wd.period>r?r:e.wd.period}return e}static parseWeatherCode(e,a){const r=this.weatherCode(e);return(a?r.day:r.night)||{}}static weatherCode(e){const a={code:e};switch(e){case 0:a.day={name:"Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 1:a.day={name:"Mainly Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Mainly Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 2:a.day={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"},a.night={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"};break;case 3:a.day={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"},a.night={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"};break;case 45:a.day={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 48:a.day={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 51:a.day={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 53:a.day={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 55:a.day={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 56:a.day={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 57:a.day={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 61:a.day={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 63:a.day={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 65:a.day={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 66:a.day={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 67:a.day={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 71:a.day={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 73:a.day={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 75:a.day={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 77:a.day={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 80:a.day={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 81:a.day={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 82:a.day={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 85:a.day={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 86:a.day={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 95:a.day={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 96:a.day={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 99:a.day={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break}return a}static kts2ms(e){return isNaN(e)||e===null?e:Math.round(e*1852/3600*1e4)/1e4}static kts2kmh(e){return isNaN(e)||e===null?e:e*1.852}static m2nm(e){return isNaN(e)||e===null?e:Math.round(e/1e3/1.852*1e4)/1e4}static kmh2kts(e){return isNaN(e)||e===null?e:this.ms2kts(e*1e3/3600)}static ms2kts(e){return isNaN(e)||e===null?e:Math.round(e*3600/1852*1e4)/1e4}static degree2Radian(e){if(isNaN(e)||e===null)return e;let a=e%360/360*2*Math.PI;return a=a<0?a+2*Math.PI:a,a}static degree2Direction(e){const a=this.degree2Radian(e);if(isNaN(a)||a===null)return null;let r="N/A";const i=Math.PI/16;return a<i?r="N":a>=i&&a<3*i?r="NNE":a>=3*i&&a<5*i?r="NE":a>=5*i&&a<7*i?r="ENE":a>=7*i&&a<9*i?r="E":a>=9*i&&a<11*i?r="ESE":a>=11*i&&a<13*i?r="SE":a>=13*i&&a<15*i?r="SSE":a>=15*i&&a<17*i?r="S":a>=17*i&&a<19*i?r="SSW":a>=19*i&&a<21*i?r="SW":a>=21*i&&a<23*i?r="WSW":a>=23*i&&a<25*i?r="W":a>=25*i&&a<27*i?r="WNW":a>=27*i&&a<29*i?r="NW":a>=29*i&&a<31*i?r="NNW":a>=31*i&&a<32*i&&(r="N"),r}static beaufort(e){let a=0;return isNaN(e)||(e=Math.round(e*10)/10,e<=.2?a=0:e<=1.5?a=1:e<=3.3?a=2:e<=5.4?a=3:e<=7.9?a=4:e<=10.7?a=5:e<=13.8?a=6:e<=17.1?a=7:e<=20.7?a=8:e<=22.4?a=9:e<=28.4?a=10:e<=32.6?a=11:e<=36.9?a=12:e<=41.4?a=13:e<=46.1?a=14:e<=50.9?a=15:e<=55.9?a=16:e<=61.2?a=17:e>61.2&&(a=18)),a}static douglas(e){let a="Calm";return isNaN(e)||e<=.1?a="Calm":e<=.5?a="Smooth":e<=1.25?a="Slight":e<=2.5?a="Moderate":e<=4?a="Rough":e<=6?a="VeryRough":e<=9?a="High":e<=14?a="VeryHigh":a="Precipitous",a}};const ib="",sd={name:"IdmTropicals",props:{simple:{type:Boolean,default:!1},permission:{type:Number},locale:{type:String},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},timeZone:{type:Number},token:{type:String},defaultMeteoToken:{type:String},gateway:{type:String,default:"aa"},assistGateway:{type:Array,default:[]},forecastModel:{type:String},realTime:{type:String},beforeLayer:{type:String}},emits:["tropical","tropicalCenterPoints","tropicalProbability","tropicalNotification"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,helper:eo.CompanyHelper,tropicals:void 0,tropicalCacheKey:"tropicalCacheGL4",source:"tropicals-source",clusterSource:"tropicals-cluster-source",historyLayer:"tropicals-history-layer",forecastLayer:"tropicals-forecast-layer",forecastModelLayer:"tropicals-forecast-model-layer",forecastNameLayer:"tropicals-forecast-name-layer",pointCircleLayer:"tropicals-point-circle-layer",pointLabelLayer:"tropicals-point-label-layer",historyPointCircleLayer:"history-tropicals-point-circle-layer",historyPointLabelLayer:"history-tropicals-point-label-layer",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicalsInfo:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:T.featureCollection([]),showLegend:!1,showHoverPoint:!1,hoverPoint:void 0,hoverMarker:void 0}},computed:{hoverLayers(){return[this.forecastNameLayer,this.forecastLayer,this.historyLayer,this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]},clickLayers(){return[this.forecastNameLayer,this.historyLayer]},computeTime(){return(o,e)=>{if(o){const a=v(o).utcOffset(e),r=e<0?e:"+"+e;return`${a==null?void 0:a.format("MMM-DD/HHmm")} (UTC${r}) ${a==null?void 0:a.fromNow()} `}return"-"}},computeTzTime(){return(o,e,a="MM-DD HH:mm")=>{var r,i;if(o){const l=e||0,n=(i=(r=v(o))==null?void 0:r.utcOffset(l))==null?void 0:i.format(a),c=`(UTC ${l>=0?"+":""}${l})`;return n+" "+c}return"-"}},computeTimezone(){return this.timeZone<0?this.timeZone:"+"+this.timeZone},computeBF(){return function(o){const e=la.kts2ms(o);return la.beaufort(e)}},computeMovement(){return function(o){var e,a;return(a=(e=o==null?void 0:o.forecasts)==null?void 0:e.find(r=>!r.disabled))==null?void 0:a.movement}},computePosition(){return o=>!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},map:{handler(){this.map?(this.toggle=localStorage.getItem(this.tropicalCacheKey)==="true"||!1,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle&&this.fetchTropicals()):this.handleClear()}},showTropicalsInfo:{handler(){this.$emit("tropical",this.showTropicalsInfo),this.simple&&this.showTropicalsInfo?this.$nextTick(()=>{var o,e;this.$parent.playerBottom=((e=(o=this.$refs.tropicalsInfo)==null?void 0:o.$el)==null?void 0:e.clientHeight)+10}):this.simple&&(this.$parent.playerBottom=30)},immediate:!0},"tropicals.version":{handler(){this.handleRefresh()}},timeZone:{handler(o,e){o!==e&&this.handleRefresh()}},realTime:{handler(o){this.map&&o&&this.toggle&&this.handleRender()}},locale:{handler(o){this.map&&this.toggle&&this.handleRefresh()}}},methods:{handleMenuToggle(){var o,e,a;this.toggle=!this.toggle,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle?this.fetchTropicals():(this.handleClear(),(a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("tropical",!1))},async fetchTropicals(){var i,l,n;const o=new Date().valueOf();let e=0,a=0,r=(i=eo.LayerHelper.WEATHER_LAYERS.find(c=>c.key==="tropicals"))==null?void 0:i.weight;if(r>0){const c=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],s=await ce.get(`${c}/api/arc/weather/layers2/links?l=${r}&v=${this.forecastModel}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(a=new Date().valueOf()-(o+e),console.log("weather links elapsed: ",a,", total: ",e+=a),((l=s==null?void 0:s.data)==null?void 0:l.code)===0){const m=(n=s==null?void 0:s.data)==null?void 0:n.data;await ce.get(m.tropicals,{headers:{Authorization:this.defaultMeteoToken,key:"tropicals"},responseType:/\.(jpg|png)$/.test(m.tropicals)?"blob":"json"}).then(d=>{var y,p,h;const g=N.TropicalHelper.convert2Geojson(((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data));((h=(p=d==null?void 0:d.config)==null?void 0:p.headers)==null?void 0:h.key)&&g&&(this.tropicals={data:g,active:!0,cached:!0,type:"json",etime:s.data.etime,version:Math.random()+1})}).catch(d=>{console.log(`tropicals fetch layer error: ${d}`)})}a=new Date().valueOf()-(o+e),console.log("tropicals elapsed: ",a,", total: ",e+=a)}},handleRefresh(){var e,a;(((a=(e=this.tropicals)==null?void 0:e.data)==null?void 0:a.features)||[]).forEach(r=>{var l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_;let i="";switch(!0){case(((l=r.properties.wind)==null?void 0:l.kts)<32||((n=r.properties)==null?void 0:n.kts)<32):i="td";break;case(((c=r.properties.wind)==null?void 0:c.kts)<47||((s=r.properties)==null?void 0:s.kts)<47):i="ts";break;case(((m=r.properties.wind)==null?void 0:m.kts)<63||((d=r.properties)==null?void 0:d.kts)<63):i="sts";break;case(((g=r.properties.wind)==null?void 0:g.kts)<79||((u=r.properties)==null?void 0:u.kts)<79):i="ty";break;case(((y=r.properties.wind)==null?void 0:y.kts)<94||((p=r.properties)==null?void 0:p.kts)<94):i="sty";break;case(((h=r.properties.wind)==null?void 0:h.kts)>=94||((f=r.properties)==null?void 0:f.kts)>=94):i="superTy";break;default:i="superTy";break}r.properties.levelI18n=i,((w=r.geometry)==null?void 0:w.type)==="Point"&&((b=r.properties)!=null&&b.important)&&(r.properties.format=(k=(L=v(r.properties.date))==null?void 0:L.utcOffset(this.timeZone))==null?void 0:k.format(`MMM-DD/HHmm [(utc${this.computeTimezone})]`)),((C=r.geometry)==null?void 0:C.type)==="Point"&&(r.properties.Name=((_=(A=r.properties.name)==null?void 0:A.trim())==null?void 0:_.replace(/^./,z=>z.toUpperCase()))||r.properties.nameCn,r.properties.nameCn=r.properties.nameCn||r.properties.Name||"-")}),this.handleInit()},handleInit(){var o,e,a,r,i,l,n,c,s,m,d,g;this.handleClear(),this.tropicals&&this.map&&(this.handleRender(),(o=this.map)==null||o.on("click",this.clickLayers,this.handleClick),(e=this.map)==null||e.on("mousemove",this.hoverLayers,this.handleHover),(a=this.map)==null||a.on("mouseleave",this.hoverLayers,this.handleLeave)),((l=(i=(r=this.tropicals)==null?void 0:r.data)==null?void 0:i.features)==null?void 0:l.length)>0?(s=(c=(n=this.$parent)==null?void 0:n.$refs)==null?void 0:c.idmBottomBar)==null||s.handleToggle("tropical",!0):(g=(d=(m=this.$parent)==null?void 0:m.$refs)==null?void 0:d.idmBottomBar)==null||g.handleToggle("tropical",!1)},handleRender(){var o,e,a,r,i,l,n,c,s,m;if(this.tropicals&&this.map){const d=new Date().valueOf();let g=0,u=0;(o=this.map)!=null&&o.getSource(this.source)?((a=this.map)==null||a.getSource(this.source).setData((e=this.tropicals)!=null&&e.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropicals] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.source,{type:"geojson",data:(r=this.tropicals)!=null&&r.active?(i=this.tropicals)==null?void 0:i.data:this.empty}),this.map.addLayer({id:this.historyLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","history"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-width":3,"line-opacity":.7}},this.beforeLayer),this.map.addLayer({id:this.forecastLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"line-width":2,"line-opacity":1,"line-dasharray":[1,2]}},this.beforeLayer),this.map.addLayer({id:this.forecastModelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"symbol-placement":"line","text-field":"{model}","text-rotation-alignment":"viewport","text-size":12},paint:{"text-color":this.Theme.current.value.dark?"#333":"#fff","text-opacity":1,"text-halo-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"text-halo-width":4}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((c=this.map)==null||c.getSource(this.clusterSource).setData((n=this.tropicals)!=null&&n.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropical] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(s=this.tropicals)!=null&&s.active?(m=this.tropicals)==null?void 0:m.data:this.empty}),this.map.addLayer({id:this.pointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.pointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":4,"circle-color":["case",["boolean",["==",["get","kts",["get","wind"]],null]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],32]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],47]],this.Theme.current.value.colors["tropicals-ts"],["boolean",["<",["get","kts",["get","wind"]],63]],this.Theme.current.value.colors["tropicals-sts"],["boolean",["<",["get","kts",["get","wind"]],79]],this.Theme.current.value.colors["tropicals-ty"],["boolean",["<",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-sty"],["boolean",[">=",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-super-ty"],"#fff"]}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":6,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":"rgba(0,0,0,0.7)"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-inner",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":3,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["==","important",!0]],layout:{"text-field":["get",this.locale==="en"?"Name":"nameCn"],"text-anchor":"bottom","text-size":16,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-offset":[0,2]},paint:{"text-color":this.Theme.current.value.colors["map-blue"],"text-halo-color":"#ffffff","text-halo-width":2}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u));const y=N.TropicalHelper.interpolate(this.tropicals,1);this.interpolateData=JSON.parse(JSON.stringify(y)),this.handleDateChange()}},handleClear(){var o,e,a,r;this.map&&(this.map.getLayer(this.historyLayer)&&this.map.removeLayer(this.historyLayer),this.map.getLayer(this.forecastLayer)&&this.map.removeLayer(this.forecastLayer),this.map.getLayer(this.forecastModelLayer)&&this.map.removeLayer(this.forecastModelLayer),this.map.getLayer(this.forecastNameLayer)&&this.map.removeLayer(this.forecastNameLayer),this.map.getLayer(this.pointCircleLayer)&&this.map.removeLayer(this.pointCircleLayer),this.map.getLayer(this.pointCircleLayer+"-border")&&this.map.removeLayer(this.pointCircleLayer+"-border"),this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.historyPointCircleLayer)&&this.map.removeLayer(this.historyPointCircleLayer),this.map.getLayer(this.historyPointCircleLayer+"-border")&&this.map.removeLayer(this.historyPointCircleLayer+"-border"),this.map.getLayer(this.historyPointCircleLayer+"-inner")&&this.map.removeLayer(this.historyPointCircleLayer+"-inner"),this.map.getLayer(this.historyPointLabelLayer)&&this.map.removeLayer(this.historyPointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(o=this.interpolateMarkers)==null||o.forEach(i=>i==null?void 0:i.remove()),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.map.getSource(this.clusterSource)&&this.map.removeSource(this.clusterSource),this.map.getSource(this.interpolateSource)&&this.map.removeSource(this.interpolateSource)),(e=this.map)==null||e.off("click",this.clickLayers,this.handleClick),(a=this.map)==null||a.off("mousemove",this.hoverLayers,this.handleHover),(r=this.map)==null||r.off("mouseleave",this.hoverLayers,this.handleLeave),this.handleCloseInfoMarker()},handleDateChange(){var o,e,a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,M,j,U,K,de,ne,S,Z;if((o=this.interpolateMarkers)==null||o.forEach(H=>H==null?void 0:H.remove()),(e=this.interpolateData)!=null&&e.length&&this.tropicals.active){const H=v(this.realTime).utc().set({minute:0,second:0,millisecond:0}),q=this.interpolateData.filter(E=>E.properties.date===(H==null?void 0:H.format())&&!E.properties.disabled),W=this.handleComputePolygons(q),B=T.featureCollection([...q]);W.forEach(E=>{B.features.push(E)}),(a=this.map)!=null&&a.getSource(this.interpolateSource)?(r=this.map)==null||r.getSource(this.interpolateSource).setData(B):((i=this.map)==null||i.addSource(this.interpolateSource,{type:"geojson",data:B}),(l=this.map)==null||l.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-opacity":1,"line-color":["match",["get","level"],7,this.Theme.current.value.colors["tropicals-r7"],10,this.Theme.current.value.colors["tropicals-r10"],this.Theme.current.value.colors["tropicals-r10"]],"line-width":1}},"empty-layer-3")),this.interpolateMarkers=[];const J=[];for(const E of q)if(!E.properties.disabled){if(!J.some(oe=>{var he;return oe.properties.name===((he=E.properties)==null?void 0:he.name)})){const oe=((c=(n=this.tropicals.data.features.find(he=>{var X;return he.properties.name===((X=E.properties)==null?void 0:X.name)}))==null?void 0:n.properties)==null?void 0:c.nameCn)||((s=E.properties)==null?void 0:s.Name)||"-";E.properties.nameCn=oe,E.properties.Name=((d=(m=E.properties.name)==null?void 0:m.trim())==null?void 0:d.replace(/^./,he=>he.toUpperCase()))||E.properties.nameCn,J.push(E)}let I=this.Theme.current.value.colors["tropicals-ty"];((u=(g=E.properties)==null?void 0:g.wind)==null?void 0:u.kts)<32||!((p=(y=E.properties)==null?void 0:y.wind)!=null&&p.kts)?I=this.Theme.current.value.colors["tropicals-td"]:((f=(h=E.properties)==null?void 0:h.wind)==null?void 0:f.kts)>=32&&((b=(w=E.properties)==null?void 0:w.wind)==null?void 0:b.kts)<47?I=this.Theme.current.value.colors["tropicals-ts"]:((k=(L=E.properties)==null?void 0:L.wind)==null?void 0:k.kts)>=47&&((A=(C=E.properties)==null?void 0:C.wind)==null?void 0:A.kts)<63?I=this.Theme.current.value.colors["tropicals-sts"]:((z=(_=E.properties)==null?void 0:_.wind)==null?void 0:z.kts)>=63&&((V=(P=E.properties)==null?void 0:P.wind)==null?void 0:V.kts)<79?I=this.Theme.current.value.colors["tropicals-ty"]:((j=(M=E.properties)==null?void 0:M.wind)==null?void 0:j.kts)>=79&&((K=(U=E.properties)==null?void 0:U.wind)==null?void 0:K.kts)<94?I=this.Theme.current.value.colors["tropicals-sty"]:((ne=(de=E.properties)==null?void 0:de.wind)==null?void 0:ne.kts)>=94?I=this.Theme.current.value.colors["tropicals-super-ty"]:I=this.Theme.current.value.colors["tropicals-ty"];const ie=`<svg t="1719918955501"
203
+ `,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.theme==="light"?["step",["get","val"],"rgba(0, 0, 0, 0.5)",920,"rgba(0, 0, 0, 0.5)",980,"rgba(0, 0, 0, 0.7)",1100,"rgba(0, 0, 0, 0.7)"]:"rgba(0,0,0,1)","text-halo-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"text-halo-width":1}},this.beforeLayer),l=new Date().valueOf()-(r+i),console.log("[prmsl] add elapsed: ",l,", total: ",i+=l))}},handleClear(){this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.labelLayer)&&this.map.removeLayer(this.labelLayer),this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Wc(o,e,a,r,i,l){return null}const Zc=Q(jc,[["render",Wc]]),K1="",Xc={name:"IdmIceEdge",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-edge] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(86, 169, 230, 0)"],[1/255,"rgba(86, 169, 230, 0)"],[25/255,"rgba(86, 169, 230, 1)"],[25/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 84, 39, 1)"],[250/255,"rgba(230, 84, 39, 1)"],[1,"rgba(230, 84, 39, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Hc={key:0};function Oc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Hc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-edge",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",{style:{color:"rgba(var(--v-theme-black), 0.7)"}},"%",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"70",-1),t.createElementVNode("span",null,null,-1),t.createElementVNode("span",null,"90",-1),t.createElementVNode("span",null,null,-1)]),4)])):t.createCommentVNode("",!0)}const Yc=Q(Xc,[["render",Oc]]),Q1="",Uc={name:"IdmCover",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-cover] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(68, 1, 84, 0)"],[1/255,"rgba(63, 72, 137, 0)"],[50/255,"rgba(53, 125, 177, 1)"],[100/255,"rgba(33, 145, 140, 1)"],[150/255,"rgba(45, 178, 125, 1)"],[200/255,"rgba(112, 207, 87, 1)"],[250/255,"rgba(253, 231, 37, 0.8)"],[1,"rgba(253, 231, 37, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},Jc={key:0};function Kc(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",Jc,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-cover",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"%",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"40",-1),t.createElementVNode("span",null,"60",-1),t.createElementVNode("span",null,"80",-1),t.createElementVNode("span",null,"100",-1)]),4)])):t.createCommentVNode("",!0)}const Qc=Q(Uc,[["render",Kc],["__scopeId","data-v-3d1a7675"]]),q1="",qc={name:"IdmThickness",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object},bottom:{type:String,default:"70px"}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[ice-thickness] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(4, 6, 19, 0)"],[1/255,"rgba(4, 6, 19, 0)"],[20/255,"rgba(51, 50, 102, 1)"],[40/255,"rgba(63, 82, 158, 1)"],[50/255,"rgba(66, 123, 183, 1)"],[60/255,"rgba(92, 161, 197, 1)"],[80/255,"rgba(134, 199, 212, 0.7)"],[100/255,"rgba(134, 199, 212, 1)"],[150/255,"rgba(234, 253, 2536, 0.8)"],[250/255,"rgba(234, 253, 2536, 0.9)"],[1,"rgba(234, 253, 2536, 1)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},$c={key:0};function em(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",$c,[t.createElementVNode("div",{class:"legend-bars-gl4 ice-thickness",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"m",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.6",-1),t.createElementVNode("span",null,"1",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1)]),4)])):t.createCommentVNode("",!0)}const tm=Q(qc,[["render",em]]),$1="",om={name:"IdmPrecip3h",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},deeimmediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[precip3h] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(59, 126, 162, 0)"],[14/255,"rgba(84,170,230, 0)"],[15/255,"rgba(172, 210, 255, 0.8)"],[20/255,"rgba(51,202,248,0.8)"],[30/255,"rgba(3,248,103,0.8)"],[49/255,"rgba(14,201,3,0.8)"],[57/255,"rgba(190,226,2,0.8)"],[73/255,"rgba(248,1,1,0.8)"],[82/255,"rgba(197,5,58,0.8)"],[1,"rgba(197,5,58,0.8)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},am={key:0};function im(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",am,[t.createElementVNode("div",{class:"legend-bars-gl4 precip3h",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"mm",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"2",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"7",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1)]),4)])):t.createCommentVNode("",!0)}const rm=Q(om,[["render",im]]),eb="",lm={name:"IdmVisibility",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{right:10,program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[visibility] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(189,50,160,0.8)"],[8/255,"rgba(208,56,56,0.8)"],[27/255,"rgba(190,226,2,0.8)"],[60/255,"rgba(3,236,118,0.8)"],[160/255,"rgba(172, 210,255,0.8)"],[161/255,"rgba(172, 210,255,0)"],[1,"rgba(144,144,144,0)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},nm={key:0};function sm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",nm,[t.createElementVNode("div",{class:"legend-bars-gl4 visibility",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"nm",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"0.5",-1),t.createElementVNode("span",null,"1.5",-1),t.createElementVNode("span",null,"3",-1),t.createElementVNode("span",null,"9",-1)]),4)])):t.createCommentVNode("",!0)}const cm=Q(lm,[["render",sm]]),tb="",mm={name:"IdmWaterTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(o+e),console.log("[water-temp] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgba(95, 143, 197)"],[46/255,"rgba(95, 143, 197)"],[69/255,"rgb(80, 140, 62)"],[92/255,"rgb(121, 146, 28)"],[115/255,"rgb(171, 161, 14)"],[138/255,"rgb(223, 177, 69)"],[161/255,"rgb(243, 150, 6)"],[184/255,"rgb(236, 95, 21)"],[207/255,"rgb(190, 65, 18)"],[230/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},dm={key:0};function hm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",dm,[t.createElementVNode("div",{class:"legend-bars-gl4 water-temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const pm=Q(mm,[["render",hm]]),ob="",gm={name:"IdmTemp",props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:Object},bottom:{type:String,default:"70px"},menuToggle:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,right:10}},watch:{"factor.version":{handler(){var o;(o=this.factor)!=null&&o.active?this.handleRender():this.handleClear()},immediate:!0},"menuToggle.v":{handler(){var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)},immediate:!0}},methods:{handleRender(){if(this.factor){const o=new Date().valueOf();let e=0;this.handleDraw(),new Date().valueOf()-(o+e)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){this.context=this.viewport.rampColorCanvas.getContext("webgl");const o=[[0,"rgb(149, 137, 211)"],[100/255,"rgb(149, 137, 211)"],[110/255,"rgb(150, 209, 216)"],[120/255,"rgb(129, 204, 197)"],[130/255,"rgb(103, 180, 186)"],[140/255,"rgb(95, 143, 197)"],[150/255,"rgb(80, 140, 62)"],[160/255,"rgb(121, 146, 28)"],[170/255,"rgb(171, 161, 14)"],[180/255,"rgb(223, 177, 6)"],[190/255,"rgb(243, 150, 6)"],[200/255,"rgb(236, 95, 21)"],[210/255,"rgb(190, 65, 18)"],[220/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,o);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),this.etime!==this.factor.etime){this.etime=this.factor.etime;const o=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,o)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}},um={key:0};function fm(o,e,a,r,i,l){var n;return(n=a.factor)!=null&&n.active?(t.openBlock(),t.createElementBlock("div",um,[t.createElementVNode("div",{class:"legend-bars-gl4 temp",style:t.normalizeStyle({right:i.right+"px"})},e[0]||(e[0]=[t.createElementVNode("span",null,"°C",-1),t.createElementVNode("span",null,"-20",-1),t.createElementVNode("span",null,"-10",-1),t.createElementVNode("span",null,"0",-1),t.createElementVNode("span",null,"10",-1),t.createElementVNode("span",null,"20",-1),t.createElementVNode("span",null,"30",-1),t.createElementVNode("span",null,"40",-1)]),4)])):t.createCommentVNode("",!0)}const ym=Q(gm,[["render",fm]]),ab="",bm={name:"IdmGlLayer",components:{IdmWindBarb:bc,IdmWindParticle:Ac,IdmCurrentDirection:vc,IdmCurrentParticle:Nc,IdmWave:Tc,IdmSigWaveHeight:Rc,IdmSwell:Gc,IdmPrmsl:Zc,IdmIceEdge:Yc,IdmIceCover:Qc,IdmIceThickness:tm,IdmPrecip3h:rm,IdmVisibility:cm,IdmWaterTemp:pm,IdmTemp:ym},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},theme:{type:String},map:{type:Object},mapFeather:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},defaultMeteoToken:{type:String},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},realTime:{type:String},forecastModel:{type:String},beforeLayer:{type:String}},emits:["forecastModel","menuToggle","weatherCheckList","autoActive","weatherRendered"],data(){return{right:10,toggle:!1,autoActive:!0,weatherWeight:0,allLayers:[...eo.LayerHelper.WEATHER_LAYERS],tagLayers:[...eo.LayerHelper.WEATHER_LAYERS.filter(o=>!o.hide)],checkList:[],renderKey:"",iceToggleValue:void 0,waveToggleValue:void 0,weatherLayers:{},activeWeatherLayers:[],cache:{v:"0.0.1",versionKey:"weatherLayerCacheVersionGL4",autoActiveKey:"autoActiveCacheGL4",checkListKey:"weatherCheckListCacheGL4"},models:{},currentModel:localStorage.getItem("forecastModelCacheGL4")==="GFS"?"GFS":"ECMWF",zoom:6,viewport:void 0,particleFactor:void 0,showWindParticle:!0,showCurrentParticle:!0,legendToggle:!1,legend:{barbs:[2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,0],current:[{label:"0-0.5 kts",size:.3,color:"rgb(58, 164, 58)"},{label:"0.5-1 kts",size:.4,color:"#ffff00"},{label:"1-1.5 kts",size:.6,color:"#ff9500"},{label:"1.5-2 kts",size:.8,color:"#f44336"},{label:">= 2 kts",size:1,color:"#e4711e"}],sigWaveHeight:[{label:"< 2 m",color:"rgba(0,235,156,0)"},{label:"2-3 m",color:"rgba(0,235,156,0.4)"},{label:"3-4 m",color:"#ffed00"},{label:"4-5 m",color:"#ff9800"},{label:"5-6 m",color:"#f77800"},{label:"6-7 m",color:"#e4711e"},{label:"7-8 m",color:"#e06128"},{label:"8-9 m",color:"#dc5132"},{label:"9-10 m",color:"#d5453c"},{label:"10-12 m",color:"#cd3a46"},{label:"12-14 m",color:"#be2c50"},{label:"> 14 m",color:"#aa1a5a"}]}}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}},computeDateZ(){return function(o){var e;if(o){const a=v(o);return`${(e=a==null?void 0:a.utc())==null?void 0:e.format("MMM-DD/HHmm")}Z`}return"-"}},computeDateUpdate(){return function(o){return o?v(o).fromNow():"-"}},overlaysKeys(){return this.tagLayers.filter(o=>o.overlays).map(o=>o.key)},rendersKeys(){return this.allLayers.filter(o=>!o.overlays&&o.enabled).map(o=>o.key)},showTipMenu(){return this.checkList.includes("wind")||this.checkList.includes("current-direction")||this.checkList.includes("sig-wave-height")},barbsIconName(){var e,a,r;const o=[];for(let i=0;i<((a=(e=this.legend)==null?void 0:e.barbs)==null?void 0:a.length);i++){const l=((r=this.legend)==null?void 0:r.barbs[i])||0,n=l<10?`00${l}kts`:l<100?`0${l}kts`:`${l}kts`;o.push("icon-a-"+n)}return o}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.weatherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})}},currentModel:{handler(o,e){this.$emit("forecastModel",o),localStorage.setItem("forecastModelCacheGL4",o)},immediate:!0},forecastModel:{handler(o,e){o&&o!==e&&this.handleWeatherLayerChange({sourceChanged:!0})}},map:{handler(){const o=this.map;o&&(this.viewport=new Mo(o),o.once("idle",()=>{this.map===o&&(this.fetchCache(),o.on("move",this.handleMove4Weather),this.handleRampColorInitial())}),o.triggerRepaint())},immediate:!0},realTime:{handler(o,e){o&&e&&v(o).utc().format("yyyy-MM-DD HH")!==v(e).utc().format("yyyy-MM-DD HH")&&this.$nextTick(()=>{this.fetchWeatherLayers()})},immediate:!0},renderKey:{handler(o,e){if(o&&o!==e){const a=this.checkList.filter(r=>!this.rendersKeys.some(i=>i===r));o==="wave-group"?(this.waveToggleValue=this.waveToggleValue||"sig-wave",this.checkList=[...a,"wave-group",this.waveToggleValue]):o==="ice-forecast"?(this.iceToggleValue=this.iceToggleValue||"ice-cover",this.checkList=[...a,"ice-forecast",this.iceToggleValue||"ice-cover"]):this.checkList=[...a,o]}else!o&&e&&(this.checkList=this.checkList.filter(a=>a!==e))}},checkList:{handler(o,e){var a,r,i,l,n,c;this.handleCheckListChange(o,e),this.$emit("weatherCheckList",o),this.autoActive&&this.checkList.length?(i=(r=(a=this.$parent)==null?void 0:a.$refs)==null?void 0:r.idmBottomBar)==null||i.handleToggle("weather",!0):(c=(n=(l=this.$parent)==null?void 0:l.$refs)==null?void 0:n.idmBottomBar)==null||c.handleToggle("weather",!1)}},autoActive:{handler(o){var e,a,r,i,l,n;localStorage.setItem(this.cache.autoActiveKey,this.autoActive),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(c=>this.checkList.includes(c.key)):[],this.handleWeatherLayerChange(),this.autoActive&&this.checkList.length?(r=(a=(e=this.$parent)==null?void 0:e.$refs)==null?void 0:a.idmBottomBar)==null||r.handleToggle("weather",!0):(n=(l=(i=this.$parent)==null?void 0:i.$refs)==null?void 0:l.idmBottomBar)==null||n.handleToggle("weather",!1),this.$emit("autoActive",this.autoActive)}},iceToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"ice-forecast",this.iceToggleValue]}}},waveToggleValue:{handler(o){if(o){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"wave-group",this.waveToggleValue]}}},showWindParticle:{handler(o){let e="wind-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},showCurrentParticle:{handler(o){let e="current-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=o,this.weatherLayers[e].version=Math.random()+1)}},isLogin:{handler(o){o?this.fetchModels():this.models={}},immediate:!0}},mounted(){this.fetchModels()},methods:{arraysEqual(o,e){if((o==null?void 0:o.length)!==(e==null?void 0:e.length))return!1;for(let a=0;a<(o==null?void 0:o.length);a++)if((o==null?void 0:o[a])!==(e==null?void 0:e[a]))return!1;return!0},fetchCache(){var a,r;const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.autoActiveKey),localStorage.removeItem(this.cache.checkListKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.autoActiveKey);this.autoActive=e!=="false",localStorage.setItem(this.cache.autoActiveKey,this.autoActive),e=localStorage.getItem(this.cache.checkListKey),this.waveToggleValue=(a=JSON.parse(e))!=null&&a.some(i=>i==="swell")?"swell":void 0,this.iceToggleValue=(r=JSON.parse(e))!=null&&r.some(i=>i==="ice-thickness")?"ice-thickness":void 0,this.checkList=JSON.parse(e||JSON.stringify(["wind","sig-wave-height"])),this.checkList.find(i=>this.rendersKeys.includes(i))&&(this.renderKey=this.checkList.find(i=>this.rendersKeys.includes(i))),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList))},handleMenuToggle(){this.$emit("menuToggle","weatherLayers")},handleFastWeatherToggle(o){let e=[];this.checkList.includes(o)?e=this.checkList.filter(a=>a!==o):(e=[...this.checkList,o],this.checkList=e),this.handleCheckListChange(e,this.checkList)},handleCheckListChange(o,e){if(this.arraysEqual(o,e))return this.handleMove4Weather(),!1;const a=[...new Set(o)],r=a==null?void 0:a.filter(n=>!(e!=null&&e.includes(n)))[0],i=e==null?void 0:e.filter(n=>!(a!=null&&a.includes(n)))[0],l=this.checkList.filter(n=>!this.rendersKeys.some(c=>c===n));if(r)if(r==="ice-cover"||r==="ice-thickness"||r==="ice-forecast")this.checkList=[...l,"ice-forecast",this.iceToggleValue||"ice-cover"],this.iceToggleValue=this.iceToggleValue||"ice-cover";else if(r==="sig-wave"||r==="swell"||r==="wave-group")this.checkList=[...l,"wave-group",this.waveToggleValue||"sig-wave"],this.waveToggleValue=this.waveToggleValue||"sig-wave";else if(this.rendersKeys.includes(r))this.checkList=[...l,r];else{const n=a.filter(s=>!this.rendersKeys.includes(s)),c=this.checkList.filter(s=>this.rendersKeys.includes(s));this.checkList=[...n,...c]}i&&(i==="ice-forecast"?(this.checkList=a.filter(n=>!["ice-cover","ice-thickness","ice-forecast"].includes(n)),this.iceToggleValue=void 0):i==="wave-group"?(this.checkList=a.filter(n=>!["wave-group","sig-wave","swell"].includes(n)),this.waveToggleValue=void 0):this.checkList=a),this.checkList.includes("wind-particle")&&!(e!=null&&e.includes("wind-particle"))&&(this.showWindParticle=!0),this.checkList.includes("current-particle")&&!(e!=null&&e.includes("current-particle"))&&(this.showCurrentParticle=!0),localStorage.setItem(this.cache.checkListKey,JSON.stringify(a)),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(n=>a.includes(n.key)):[],this.handleWeatherLayerChange()},async fetchModels(){this.models={};const o=await ce.get(`${this.gateway}/api/arc/meteo2/models2`,{headers:{Authorization:this.defaultMeteoToken}});(o==null?void 0:o.data.code)===0&&(this.models=o==null?void 0:o.data.data)},async fetchWeatherLayers(o={}){var r,i,l,n,c,s,m,d,g;const e=new Date().valueOf();let a=0;if(this.map){const u=((r=this.map)==null?void 0:r.getZoom())+1,y=(i=this.map)==null?void 0:i.getBounds(),p=`${y._sw.lng},${y._sw.lat},${y._ne.lng},${y._ne.lat}`;if(this.particleFactor&&((l=this.$refs.layer)!=null&&l.autoActive)){const h=eo.LayerHelper.WEATHER_LAYERS.find(f=>{var w;return((w=f.peer)==null?void 0:w.weight)===this.particleFactor.weight});this.particleFactor.particle&&(this.showWindParticle||this.showCurrentParticle)?this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight:this.weatherWeight+h.weight:this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight-h.weight:this.weatherWeight}if(this.weatherWeight>0){let h=this.weatherWeight;if(h>0){const f=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],w=await ce.get(`${f}/api/arc/weather/layers2/links?l=${h}&v=${this.forecastModel}&z=${u}&bbox=${p}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(new Date().valueOf()-(e+a),((n=w==null?void 0:w.data)==null?void 0:n.code)===0){const b=(c=w==null?void 0:w.data)==null?void 0:c.data,L=[];for(const C in b)L.push(ce.get(b[C],{headers:{Authorization:this.defaultMeteoToken,key:C},responseType:/\.(jpg|png)$/.test(b[C])?"blob":"json"}).catch(A=>{console.log(`[${C}] fetch layer error: ${A}`)}));const k=await Promise.all(L);this.weatherLayers={},k.map(C=>{var z,P,V,M;const A=((z=C==null?void 0:C.data)==null?void 0:z.data)||(C==null?void 0:C.data);let _=(V=(P=C==null?void 0:C.config)==null?void 0:P.headers)==null?void 0:V.key;_&&A&&(this.weatherLayers[_]={raw:A,type:((M=C==null?void 0:C.config)==null?void 0:M.responseType)==="blob"?"image":"json",etime:w.data.etime})})}if(new Date().valueOf()-(e+a),this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const b=(s=this.weatherLayers["swell-direction"])==null?void 0:s.raw,L=(m=this.weatherLayers["swell-height"])==null?void 0:m.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers.swell={type:"json",direction:b,height:{raw:L},etime:w.data.etime}}if(this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const b=(d=this.weatherLayers["current-direction"])==null?void 0:d.raw,L=(g=this.weatherLayers["current-speed"])==null?void 0:g.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:b,speed:{raw:L},etime:w.data.etime}}}}this.handleWeatherLayerToggle(),this.handleDrawWeather4Json(),this.$nextTick(()=>{var h,f,w,b,L;(L=(b=(w=(f=(h=this.$parent)==null?void 0:h.$refs)==null?void 0:f.idmBottomBar)==null?void 0:w.$refs)==null?void 0:b.capture)==null||L.captureCurrentFrame()})}},handleWeatherLayerToggle(){for(const o in this.weatherLayers)this.weatherLayers[o].active=!1,this.weatherLayers[o].version=Math.random()+1;for(const o of this.activeWeatherLayers){let e=o.key;e==="current-direction"&&(e="current"),this.weatherLayers[e]&&(this.weatherLayers[e].active=!0,this.weatherLayers[e].version=Math.random()+1,e==="wind-particle"&&(this.weatherLayers[e].particle=this.showWindParticle),e==="current-particle"&&(this.weatherLayers[e].particle=this.showCurrentParticle))}},handleWeatherLayerChange(o={sourceChanged:!1}){var a;const e=(a=this.activeWeatherLayers)==null?void 0:a.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);o!=null&&o.sourceChanged||this.weatherWeight!==e?(this.weatherWeight=e,this.fetchWeatherLayers()):this.handleWeatherLayerToggle()},handleRampColorInitial(){var o,e,a,r,i,l,n,c,s,m,d,g;this.viewport.map.getSource((o=this.viewport)==null?void 0:o.rampColorSource)||this.viewport.map.addSource((e=this.viewport)==null?void 0:e.rampColorSource,{type:"canvas",canvas:(a=this.viewport)==null?void 0:a.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((r=this.viewport)==null?void 0:r.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(i=this.viewport)==null?void 0:i.rampColorLayer,source:(l=this.viewport)==null?void 0:l.rampColorSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.viewport.map.getSource((n=this.viewport)==null?void 0:n.particleSource)||this.viewport.map.addSource((c=this.viewport)==null?void 0:c.particleSource,{type:"canvas",canvas:(s=this.viewport)==null?void 0:s.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((m=this.viewport)==null?void 0:m.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(d=this.viewport)==null?void 0:d.particleLayer,source:(g=this.viewport)==null?void 0:g.particleSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer)},handleDrawWeather4Json(){var i,l,n,c,s,m,d;const o=new Date().valueOf();let e=0;const a=(i=this.map)==null?void 0:i.getBounds(),r=(l=this.map)==null?void 0:l.getZoom();if(a&&r){const g=N.LngLatHelper.convertToStdLng(a._sw.lng),u=N.LngLatHelper.convertToStdLng(a._ne.lng),y=Math.floor(a._sw.lat),p=Math.ceil(a._ne.lat);for(const h in this.weatherLayers){let f=!1;if(this.weatherLayers[h].active&&this.weatherLayers[h].type==="json"){let w=[];if(h==="swell"){f=!0;const b=((n=this.weatherLayers[h])==null?void 0:n.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,M,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,M,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].height;if(L){if(!L.data){const k=[];for(const C in(c=L.raw)==null?void 0:c.LineString){const A=L.raw.LineString[C];for(const _ of A)k.push(T.lineString(_,{val:Number(C)}));L.data=T.featureCollection(k)}}if(L.data){const k=this.handleBboxClip(L.data,a);w=w.concat(k)}new Date().valueOf()-(o+e)}}else if(h==="current"){f=!0;const b=((s=this.weatherLayers[h])==null?void 0:s.direction)||{};for(const k in b)if(k>y&&k<p&&(!(r<=this.zoom)||k%(r<2?10:r<4?5:3)===0)){const C=b[k].lng;g>u?C.forEach((A,_)=>{var z,P,V,M,j,U;if(r<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if((A>=g&&A<=180||A>=-180&&A<=u)&&(!(r<=this.zoom)||A%(r<2?10:r<4?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}}):C.forEach((A,_)=>{var z,P,V,M,j,U;if(g<2){if((A>=0&&A<=360||A>=-360&&A<=0)&&A%10===0){const K=T.point([A,k],{val:((z=b[k].val)==null?void 0:z[_])||((P=b[k].dir)==null?void 0:P[_]),spd:(V=b[k].spd)==null?void 0:V[_]});w.push(K)}}else if(A>=g&&A<=u&&(!(r<=this.zoom)||A%(r<this.zoom/2?5:3)===0)){const K=T.point([A,k],{val:((M=b[k].val)==null?void 0:M[_])||((j=b[k].dir)==null?void 0:j[_]),spd:(U=b[k].spd)==null?void 0:U[_]});w.push(K)}})}new Date().valueOf()-(o+e);const L=this.weatherLayers[h].speed;if(L){if(!L.data){const C=[];for(const A in(m=L.raw)==null?void 0:m.Polygon){const _=L.raw.Polygon[A];for(const z of _)C.push(T.polygon(z,{val:Number(A)}))}L.data=T.featureCollection(C)}const k=r<this.zoom?L.data.features.filter(C=>C.properties.val>.5):L.data.features;w=w.concat(k),new Date().valueOf()-(o+e)}}else if(h==="wind"){f=!0;const b=this.weatherLayers.wind.raw;for(const L in b)if(L>y&&L<p&&(!(r<=this.zoom)||L%(r<2?10:r<4?5:3)===0)){const k=b[L].lng;g>u?k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const M=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(M)}}else if((C>=g&&C<=180||C>=-180&&C<=u)&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const M=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(M)}}):k.forEach((C,A)=>{var _,z,P,V;if(r<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const M=T.point([C,L],{dir:((_=b[L].val)==null?void 0:_[A])||((z=b[L].dir)==null?void 0:z[A]),spd:b[L].spd[A]});w.push(M)}}else if(C>=g&&C<=u&&(!(r<=this.zoom)||C%(r<2?10:r<4?5:3)===0)){const M=T.point([C,L],{dir:((P=b[L].val)==null?void 0:P[A])||((V=b[L].dir)==null?void 0:V[A]),spd:b[L].spd[A]});w.push(M)}})}new Date().valueOf()-(o+e)}else if(h==="sig-wave-height"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.Polygon){const C=b.Polygon[k];for(const A of C)L.push(T.polygon(A,{val:Number(k)}))}for(const k in b.MultiPolygon){const C=b.MultiPolygon[k];for(const A of C)L.push(T.multiPolygon(A,{val:Number(k)}))}for(const k in b.Point){const C=b.Point[k];for(let A=0;A<((d=C.lng)==null?void 0:d.length);A++)L.push(T.point([C.lng[A],k],{val:Number(C.val[A])}))}w=w.concat(L)}}new Date().valueOf()-(o+e)}else if(h==="prmsl"){if(this.weatherLayers[h].data)w=this.weatherLayers[h].data;else{f=!0;const b=this.weatherLayers[h].raw;if(b){const L=[];for(const k in b.LineString){const C=b.LineString[k];for(const A of C)L.push(T.lineString(A,{val:Number(k)}))}for(const k in b.Point)b.Point[k].lng.forEach((C,A)=>{C=N.LngLatHelper.convertToStdLng(C),L.push(T.point([C,k],{val:b.Point[k].val[A],type:b.Point[k].type[A]}))});w=w.concat(L)}}new Date().valueOf()-(o+e)}w.length&&(this.weatherLayers[h].data=T.featureCollection(w)),f&&(this.weatherLayers[h].version=Math.random()+1)}}}},handleMove4Weather(){for(const o in this.weatherLayers)this.weatherLayers[o].active&&this.weatherLayers[o].type==="image"&&(this.weatherLayers[o].active=!0,this.weatherLayers[o].version=Math.random()+1);this.handleDrawWeather4Json()},handleBboxClip(o,e){const a=[],r=N.LngLatHelper.convertToStdLng(e._sw.lng),i=N.LngLatHelper.convertToStdLng(e._ne.lng);return o.features.forEach(l=>{if(l.geometry.type!=="Point")if(r>i){let n=[r,e._sw.lat,180,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c),n=[-180,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n),c.geometry.coordinates.length&&a.push(c)}else{const n=[r,e._sw.lat,i,e._ne.lat],c=T.bboxClip(l,n);c.geometry.coordinates.length&&a.push(c)}else a.push(l)}),a}}},wm={class:"idm-gl4-meteo-layers"},xm={key:0,class:"legend-tip-btn-gl4"},km={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},Am={class:"d-flex flex-row justify-center align-center"},Lm={class:"text-caption"},Cm={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},vm={class:"d-flex flex-row justify-center align-center"},zm={key:0,style:{width:"24px",height:"12px",border:"1px solid rgba(var(--v-border-color), var(--v-border-opacity))"}},_m={class:"text-caption px-2"},Sm={class:"d-flex flex-row justify-start align-start flex-wrap text-body-2 ml-n1"},Nm={class:"d-flex flex-row justify-start align-center"},Mm={class:"d-flex flex-row justify-center align-center",style:{width:"40px"}},Pm={class:"text-caption"},Vm={class:"d-flex justify-start align-center ga-3"},Tm={class:"text-h5 font-weight-medium"},Em={key:0,class:"w-100 d-flex justify-space-between align-center ga-1 mb-2 px-3"},Dm={key:0,class:"d-flex justify-start align-center ga-4 pl-6"},Rm={key:1,class:"d-flex justify-start align-center ga-4 pl-6"},Bm={class:"text-body-1 py-2"},Im={class:"text-body-1 font-weight-medium"},Fm={class:"text-body-2 text-label"},Gm={class:"text-body-2 text-label"},jm={class:"text-body-2 text-label mb-3"},Wm={class:"text-body-1 font-weight-medium"},Zm={class:"text-body-2 text-label"},Xm={class:"text-body-2 text-label"},Hm={class:"text-body-2 text-label mb-3"},Om={class:"text-body-1 py-2"},Ym={class:"text-body-1 font-weight-medium"},Um={class:"text-body-2 text-label"},Jm={class:"text-body-2 text-label"},Km={class:"text-body-2 text-label mb-3"},Qm={class:"text-body-1 font-weight-medium"},qm={class:"text-body-2 text-label"},$m={class:"text-body-2 text-label"},ed={class:"text-body-2 text-label mb-3"},td={class:"text-body-1 py-2"},od={class:"text-body-1 font-weight-medium"},ad={class:"text-body-2 text-label"},id={class:"text-body-2 text-label"},rd={class:"text-body-2 text-label mb-3"};function ld(o,e,a,r,i,l){var ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCard"),g=t.resolveComponent("VSwitch"),u=t.resolveComponent("VBtnToggle"),y=t.resolveComponent("VCardTitle"),p=t.resolveComponent("VCardItem"),h=t.resolveComponent("VCheckbox"),f=t.resolveComponent("VRadio"),w=t.resolveComponent("IdmWindBarb"),b=t.resolveComponent("IdmSigWaveHeight"),L=t.resolveComponent("IdmCurrentDirection"),k=t.resolveComponent("IdmPrmsl"),C=t.resolveComponent("IdmWindParticle"),A=t.resolveComponent("IdmCurrentParticle"),_=t.resolveComponent("IdmWave"),z=t.resolveComponent("IdmSwell"),P=t.resolveComponent("IdmIceEdge"),V=t.resolveComponent("IdmIceCover"),M=t.resolveComponent("IdmIceThickness"),j=t.resolveComponent("IdmPrecip3h"),U=t.resolveComponent("IdmVisibility"),K=t.resolveComponent("IdmWaterTemp"),de=t.resolveComponent("IdmTemp");return t.openBlock(),t.createElementBlock("div",wm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+46+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("weather.weatherLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-Weather text-h4"},null,-1)])),_:2,__:[9]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),l.showTipMenu?(t.openBlock(),t.createElementBlock("div",xm,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box pa-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({right:i.right+"px",top:a.simple?"394px":"580px"})},[t.createVNode(c,{text:o.$t("weather.legend"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:X})=>[t.createVNode(n,t.mergeProps(X,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.legendToggle?"bg-primary active-border":""],onClick:e[0]||(e[0]=se=>i.legendToggle=!i.legendToggle)}),{default:t.withCtx(()=>e[10]||(e[10]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),_:2,__:[10]},1040,["class"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),i.legendToggle?(t.openBlock(),t.createBlock(d,{key:0,elevation:"16",class:"card-info d-flex justify-center align-start",style:t.normalizeStyle({position:"absolute",top:a.simple?"200px":"340px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-1",style:{width:"120px"}},{default:t.withCtx(()=>[e[11]||(e[11]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-1"},"Wind Level",-1)),t.createElementVNode("div",km,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.barbs,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:X,class:"w-50 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Am,[t.createElementVNode("i",{class:t.normalizeClass(["iconfont",l.barbsIconName[se]]),style:t.normalizeStyle({color:a.theme==="dark"?"#fff":"#000"})},null,6),t.createElementVNode("span",Lm,t.toDisplayString(Number(X)<10?`00${X}kts`:Number(X)<100?`0${X}kts`:`${X}kts`),1)])]))),128))])]),_:1,__:[11]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label px-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[12]||(e[12]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2"},"Wave Height",-1)),t.createElementVNode("div",Cm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.sigWaveHeight,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[t.createElementVNode("div",vm,[se===0?(t.openBlock(),t.createElementBlock("div",zm)):(t.openBlock(),t.createElementBlock("div",{key:1,style:t.normalizeStyle({width:"24px",height:"12px",background:X.color})},null,4)),t.createElementVNode("div",_m,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[12]}),t.createVNode(m,{vertical:""}),t.createVNode(s,{class:"d-flex flex-column justify-center align-start text-label pl-0 pr-2",style:{width:"100px"}},{default:t.withCtx(()=>[e[13]||(e[13]=t.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-2"},"Current",-1)),t.createElementVNode("div",Sm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.legend.current,(X,se)=>(t.openBlock(),t.createElementBlock("div",{key:se,class:"w-100 d-flex flex-row justify-center align-center py-1 px-0 ma-0"},[t.createElementVNode("div",Nm,[t.createElementVNode("div",Mm,[t.createElementVNode("i",{class:"iconfont icon-a-direction-arrow text-label",style:t.normalizeStyle({fontSize:40*X.size+"px"})},null,4)]),t.createElementVNode("div",Pm,t.toDisplayString(X.label),1)])]))),128))])]),_:1,__:[13]})]),_:1},8,["style"])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",{class:t.normalizeClass(["header-box w-100 d-flex justify-space-between align-center",a.simple?"px-3":"px-4"])},[t.createElementVNode("div",Vm,[t.createElementVNode("div",Tm,t.toDisplayString(o.$t("weather.weather")),1),t.createVNode(g,{modelValue:i.autoActive,"onUpdate:modelValue":e[1]||(e[1]=X=>i.autoActive=X),class:"small-switch",color:"primary","base-color":"disabled",inset:"","hide-details":""},null,8,["modelValue"])]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[14]||(e[14]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[14]},8,["onClick"])],2),a.simple?(t.openBlock(),t.createElementBlock("div",Em,[t.createElementVNode("div",null,t.toDisplayString(o.$t("weather.forecastModel")),1),t.createVNode(u,{modelValue:i.currentModel,"onUpdate:modelValue":e[2]||(e[2]=X=>i.currentModel=X),rounded:"",height:"28",density:"compact",mandatory:"",group:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"28",value:"GFS",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[15]||(e[15]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[15]},8,["color"]),t.createVNode(n,{density:"compact",height:"28",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[16]||(e[16]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[16]},8,["color"])]),_:1},8,["modelValue"])])):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 scroll overflow-y-auto",[i.autoActive?"":"cursor-not-allowed",a.simple?"px-3":"pl-4 pr-2"]])},[t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.overlays")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>X.overlays),X=>(t.openBlock(),t.createBlock(h,{key:X.key,modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=se=>i.checkList=se),value:X.key,label:o.$t(`weather.${X.locale}`),disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label","disabled"]))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.renders")),1)]),_:1})]),_:1}),t.createVNode(s,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(X=>!X.overlays),X=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:X.key},[t.createVNode(f,{modelValue:i.renderKey,"onUpdate:modelValue":e[4]||(e[4]=se=>i.renderKey=se),label:o.$t(`weather.${X.locale}`),value:X.key,disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"text-body-2 py-1","hide-details":"",onClick:se=>i.renderKey=i.renderKey===X.key?"":X.key},null,8,["modelValue","label","value","disabled","onClick"]),i.renderKey==="wind-particle"&&X.key==="wind-particle"?(t.openBlock(),t.createElementBlock("div",Dm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showWindParticle,"onUpdate:modelValue":e[5]||(e[5]=se=>i.showWindParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"",style:{"font-size":"14px"},"hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="current-particle"&&X.key==="current-particle"?(t.openBlock(),t.createElementBlock("div",Rm,[t.createElementVNode("span",null,t.toDisplayString(o.$t("weather.particleAnimatiom")),1),t.createVNode(g,{modelValue:i.showCurrentParticle,"onUpdate:modelValue":e[6]||(e[6]=se=>i.showCurrentParticle=se),label:"",class:"small-switch",color:"primary","base-color":"disabled",inset:"",density:"compact",height:"20","hide-details":""},null,8,["modelValue"])])):t.createCommentVNode("",!0),i.renderKey==="wave-group"&&X.key==="wave-group"?(t.openBlock(),t.createBlock(u,{key:2,modelValue:i.waveToggleValue,"onUpdate:modelValue":e[7]||(e[7]=se=>i.waveToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"sig-wave",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="sig-wave"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.significant")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.waveToggleValue==="swell"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"swell"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.swell")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0),i.renderKey==="ice-forecast"&&X.key==="ice-forecast"?(t.openBlock(),t.createBlock(u,{key:3,modelValue:i.iceToggleValue,"onUpdate:modelValue":e[8]||(e[8]=se=>i.iceToggleValue=se),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"ice-cover",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-cover"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.coverage")),1)]),_:1},8,["color","disabled"]),t.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-thickness"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"ice-thickness"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.thickness")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):t.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1}),t.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(p,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1)]),_:1})]),_:1}),t.createVNode(s,{class:""},{default:t.withCtx(()=>{var X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue,te,Ce,Y,O,Je,Ie,Se,F,Xt,$,ve,Ke,tt,ot,R,Qe,G,qe,Ot,ae,$t,re,go,uo,fo,yo,bo,wo,xo,ko,Ao,Lo,Co,vo,zo,_o;return[t.createElementVNode("div",Bm,t.toDisplayString(o.$t("weather.atmospheric")),1),t.createElementVNode("div",Im,t.toDisplayString((Ae=(se=(X=i.models)==null?void 0:X.weather)==null?void 0:se.NOAA)==null?void 0:Ae.source)+" "+t.toDisplayString((Ge=(Fe=(Le=i.models)==null?void 0:Le.weather)==null?void 0:Fe.NOAA)==null?void 0:Ge.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Ve=(je=(ze=(De=i.models)==null?void 0:De.weather)==null?void 0:ze.NOAA)==null?void 0:je.meta)==null?void 0:Ve.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Fm,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Gm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ze=(We=(Re=(Te=i.models)==null?void 0:Te.weather)==null?void 0:Re.NOAA)==null?void 0:We.meta)==null?void 0:Ze.availabilityTime)),1),t.createElementVNode("div",jm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_e=(xe=(we=(Be=i.models)==null?void 0:Be.weather)==null?void 0:we.NOAA)==null?void 0:xe.meta)==null?void 0:_e.initialisationTime)),1),t.createElementVNode("div",Wm,t.toDisplayString((Oe=(He=(Xe=i.models)==null?void 0:Xe.weather)==null?void 0:He.ECMWF)==null?void 0:Oe.source)+" "+t.toDisplayString((it=(at=(Me=i.models)==null?void 0:Me.weather)==null?void 0:at.ECMWF)==null?void 0:it.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((st=(nt=(lt=(rt=i.models)==null?void 0:rt.weather)==null?void 0:lt.ECMWF)==null?void 0:nt.meta)==null?void 0:st.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Zm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",Xm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((ht=(dt=(mt=(ct=i.models)==null?void 0:ct.weather)==null?void 0:mt.ECMWF)==null?void 0:dt.meta)==null?void 0:ht.availabilityTime)),1),t.createElementVNode("div",Hm,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((ft=(ut=(gt=(pt=i.models)==null?void 0:pt.weather)==null?void 0:gt.ECMWF)==null?void 0:ut.meta)==null?void 0:ft.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",Om,t.toDisplayString(o.$t("weather.wave")),1),t.createElementVNode("div",Ym,t.toDisplayString((xt=(wt=(bt=(yt=i.models)==null?void 0:yt.marine)==null?void 0:bt.wave)==null?void 0:wt.NOAA)==null?void 0:xt.source)+" "+t.toDisplayString((Ct=(Lt=(At=(kt=i.models)==null?void 0:kt.marine)==null?void 0:At.wave)==null?void 0:Lt.NOAA)==null?void 0:Ct.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Nt=(St=(_t=(zt=(vt=i.models)==null?void 0:vt.marine)==null?void 0:zt.wave)==null?void 0:_t.NOAA)==null?void 0:St.meta)==null?void 0:Nt.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",Um,t.toDisplayString(o.$t("weather.source"))+": NOAA",1),t.createElementVNode("div",Jm,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Et=(Tt=(Vt=(Pt=(Mt=i.models)==null?void 0:Mt.marine)==null?void 0:Pt.wave)==null?void 0:Vt.NOAA)==null?void 0:Tt.meta)==null?void 0:Et.availabilityTime)),1),t.createElementVNode("div",Km,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((Ft=(It=(Bt=(Rt=(Dt=i.models)==null?void 0:Dt.marine)==null?void 0:Rt.wave)==null?void 0:Bt.NOAA)==null?void 0:It.meta)==null?void 0:Ft.initialisationTime)),1),t.createElementVNode("div",Qm,t.toDisplayString((Ee=(Pe=(jt=(Gt=i.models)==null?void 0:Gt.marine)==null?void 0:jt.wave)==null?void 0:Pe.ECMWF)==null?void 0:Ee.source)+" "+t.toDisplayString((et=(Zt=(Ye=(Wt=i.models)==null?void 0:Wt.marine)==null?void 0:Ye.wave)==null?void 0:Zt.ECMWF)==null?void 0:et.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((Y=(Ce=(te=(Ue=(ke=i.models)==null?void 0:ke.marine)==null?void 0:Ue.wave)==null?void 0:te.ECMWF)==null?void 0:Ce.meta)==null?void 0:Y.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",qm,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",$m,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((F=(Se=(Ie=(Je=(O=i.models)==null?void 0:O.marine)==null?void 0:Je.wave)==null?void 0:Ie.ECMWF)==null?void 0:Se.meta)==null?void 0:F.availabilityTime)),1),t.createElementVNode("div",ed,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((tt=(Ke=(ve=($=(Xt=i.models)==null?void 0:Xt.marine)==null?void 0:$.wave)==null?void 0:ve.ECMWF)==null?void 0:Ke.meta)==null?void 0:tt.initialisationTime)),1),t.createVNode(m),t.createElementVNode("div",td,t.toDisplayString(o.$t("weather.currents")),1),t.createElementVNode("div",od,t.toDisplayString((G=(Qe=(R=(ot=i.models)==null?void 0:ot.marine)==null?void 0:R.current)==null?void 0:Qe.ECMWF)==null?void 0:G.source)+" "+t.toDisplayString(($t=(ae=(Ot=(qe=i.models)==null?void 0:qe.marine)==null?void 0:Ot.current)==null?void 0:ae.ECMWF)==null?void 0:$t.spatialResolution)+t.toDisplayString(o.$t("units.km"))+" "+t.toDisplayString((yo=(fo=(uo=(go=(re=i.models)==null?void 0:re.marine)==null?void 0:go.current)==null?void 0:uo.ECMWF)==null?void 0:fo.meta)==null?void 0:yo.days)+t.toDisplayString(o.$t("units.days")),1),t.createElementVNode("div",ad,t.toDisplayString(o.$t("weather.source"))+": ECMWF",1),t.createElementVNode("div",id,t.toDisplayString(o.$t("weather.lastUpdate"))+": "+t.toDisplayString(l.computeDateUpdate((Ao=(ko=(xo=(wo=(bo=i.models)==null?void 0:bo.marine)==null?void 0:wo.current)==null?void 0:xo.ECMWF)==null?void 0:ko.meta)==null?void 0:Ao.availabilityTime)),1),t.createElementVNode("div",rd,t.toDisplayString(o.$t("weather.referenceTime"))+": "+t.toDisplayString(l.computeDateZ((_o=(zo=(vo=(Co=(Lo=i.models)==null?void 0:Lo.marine)==null?void 0:Co.current)==null?void 0:vo.ECMWF)==null?void 0:zo.meta)==null?void 0:_o.initialisationTime)),1)]}),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:1,ref:"windBarb",map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-3",wind:(ne=i.weatherLayers)==null?void 0:ne.wind,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","wind","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:2,map:a.map,"before-layer":"empty-layer-2","sig-wave-height":(S=i.weatherLayers)==null?void 0:S["sig-wave-height"],"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs),null,16,["map","sig-wave-height","menu-toggle","active-weather-layers"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(L,t.mergeProps({key:3,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-2",current:(Z=i.weatherLayers)==null?void 0:Z.current,"menu-toggle":a.menuToggle},o.$attrs),null,16,["map","map-feather","current","menu-toggle"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:4,map:a.map,"before-layer":"empty-layer-3",prmsl:(H=i.weatherLayers)==null?void 0:H.prmsl,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers},o.$attrs,{theme:a.theme}),null,16,["map","prmsl","menu-toggle","active-weather-layers","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:5,viewport:i.viewport,factor:(q=i.weatherLayers)==null?void 0:q["wind-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:6,viewport:i.viewport,factor:(W=i.weatherLayers)==null?void 0:W["current-particle"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:7,viewport:i.viewport,factor:(B=i.weatherLayers)==null?void 0:B["sig-wave"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:8,map:a.map,viewport:i.viewport,factor:(J=i.weatherLayers)==null?void 0:J.swell,"menu-toggle":a.menuToggle,"active-weather-layers":i.activeWeatherLayers,simple:a.simple},o.$attrs),null,16,["map","viewport","factor","menu-toggle","active-weather-layers","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:9,viewport:i.viewport,factor:(E=i.weatherLayers)==null?void 0:E["ice-edge"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:10,viewport:i.viewport,factor:(I=i.weatherLayers)==null?void 0:I["ice-cover"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(M,t.mergeProps({key:11,viewport:i.viewport,factor:(ie=i.weatherLayers)==null?void 0:ie["ice-thickness"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(j,t.mergeProps({key:12,viewport:i.viewport,factor:(ge=i.weatherLayers)==null?void 0:ge.precip3h,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(U,t.mergeProps({key:13,viewport:i.viewport,factor:(ue=i.weatherLayers)==null?void 0:ue.visibility,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(K,t.mergeProps({key:14,viewport:i.viewport,factor:(oe=i.weatherLayers)==null?void 0:oe["water-temp"],"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(de,t.mergeProps({key:15,viewport:i.viewport,factor:(he=i.weatherLayers)==null?void 0:he.temp,"menu-toggle":a.menuToggle,simple:a.simple},o.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):t.createCommentVNode("",!0)])}const nd=Q(bm,[["render",ld]]),no=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"GFS",alias:"GFS",model:"gfs_seamless",provider:"NOAA",country:"United States",resolution:25,tips:"3-25km",length:16,frequency:1,models:["gfs_seamless"],categories:"ncep_gfs013,ncep_gfs025,ncep_gfs_graphcast025,ncep_hrrr_conus,ncep_nbm_conus",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:2,name:"ECMWF",alias:"ECMWF",model:"ecmwf_ifs025",provider:"ECMWF",country:"European Union",resolution:25,tips:"25km",length:15,frequency:6,models:["ecmwf_ifs025","ecmwf_aifs025_single","ecmwf_ifs"],categories:"ecmwf_ifs025,ecmwf_aifs025_single,ecmwf_ifs",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:3,disabled:!0,name:"ICON",alias:"ECMWF",model:"icon_seamless",provider:"Deutscher Wetterdienst (DWD)",country:"Germany",resolution:13,tips:"2-13km",length:7.5,frequency:3,models:["icon_seamless","icon_global","icon_eu","icon_d2"],categories:"dwd_icon,dwd_icon_eps,dwd_icon_d2,dwd_icon_d2_eps,dwd_icon_eu,dwd_icon_eu_eps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:4,name:"ARPEGE",disabled:!0,alias:"ECMWF",model:"arpege_seamless",provider:"Météo-France",country:"France",resolution:25,tips:"1-25km",length:4,frequency:1,models:["arpege_seamless","arpege_world","arpege_europe"],categories:"meteofrance_arpege_europe,meteofrance_arpege_europe_probabilities,meteofrance_arpege_world025",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:5,name:"UKMO",disabled:!0,alias:"ECMWF",model:"ukmo_seamless",provider:"UK Met Office",country:"United Kingdom",resolution:10,tips:"2-10km",length:7,frequency:1,models:["ukmo_seamless","ukmo_global_deterministic_10km","ukmo_uk_deterministic_2km"],categories:"ukmo_global_deterministic_10km,ukmo_uk_deterministic_2km",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:6,name:"JMA",disabled:!0,alias:"GFS",model:"jma_seamless",provider:"JMA",country:"Japan",resolution:55,tips:"5-55km",length:11,frequency:3,models:["jma_seamless","jma_msm","jma_gsm"],categories:"jma_gsm,jma_msm",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:7,name:"GEM",disabled:!0,alias:"GFS",model:"gem_seamless",provider:"Canadian Weather Service",country:"Canada",resolution:2.5,tips:"2.5km",length:10,frequency:6,models:["gem_seamless","gem_global","gem_regional"],categories:"cmc_gem_gdps,cmc_gem_hrdps,cmc_gem_rdps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:8,name:"GRAPES",disabled:!0,alias:"GFS",model:"cma_grapes_global",provider:"China Meteorological Administration (CMA)",country:"China",resolution:15,tips:"15km",length:10,frequency:6,models:["cma_grapes_global"],categories:"cma_grapes_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:9,name:"ACCESS-G",disabled:!0,alias:"GFS",model:"bom_access_global",provider:"Australian Bureau of Meteorology (BOM)",country:"Australia",resolution:15,tips:"15km",length:10,frequency:6,models:["bom_access_global"],categories:"bom_access_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"}],so=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"MFWAM",alias:"ECMWF",model:"meteofrance_wave",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:12,models:["meteofrance_wave"],categories:"meteofrance_wave",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:2,disabled:!0,name:"SMOC",alias:"ECMWF",model:"meteofrance_currents",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:24,models:["meteofrance_currents"],categories:"meteofrance_currents, meteofrance_sea_surface_temperature",variables:"ocean_u_current,ocean_v_current,invert_barometer_height,sea_level_height_msl,sea_surface_temperature"},{rank:3,disabled:!0,name:"EWAM",alias:"ECMWF",model:"ewam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:8,frequency:2,models:["ewam"],categories:"dwd_ewam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:4,disabled:!0,name:"GWAM",alias:"ECMWF",model:"gwam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:4,frequency:2,models:["gwam"],categories:"dwd_gwam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:5,disabled:!0,name:"ECWAM",alias:"ECMWF",model:"ecmwf_wam025",provider:"ECMWF",country:"Europe",resolution:25,tips:"25km",length:10,frequency:6,models:["ecmwf_wam025"],categories:"ecmwf_wam025",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:6,name:"GFSWave",alias:"GFS",model:"ncep_gfswave025",provider:"NCEP",country:"USA",resolution:25,tips:"25km",length:10,frequency:6,models:["ncep_gfswave025","ncep_gfswave016"],categories:"ncep_gfswave025,ncep_gfswave016",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:7,disabled:!0,name:"ERA5-Ocean",alias:"ECMWF",model:"era5_ocean",provider:"Copernicus",country:"Europe",resolution:50,tips:"50km",length:-5,frequency:1,models:["era5_ocean"],categories:"copernicus_era5_ocean",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"}];let la=class{static standardWeatherModels(){return no.filter(e=>!e.disabled&&e.alias)}static standardMarineModels(){return so.filter(e=>!e.disabled&&e.alias)}static autoPickLayerModel(e,a="copernicus"){return a=a||"copernicus",a=a==null?void 0:a.toLowerCase(),a=["gfs","ecmwf","copernicus"].includes(a)?a:"copernicus",e=e==null?void 0:e.toLowerCase(),e==="gfs"?"gfs":["ec","ecmwf"].includes(e)?"ecmwf":["copernicus","cmems"].includes(e)?"copernicus":a}static autoPickPeerModel(e,a,r="copernicus"){if(a=this.autoPickLayerModel(a,r),$r.LayerHelper.WEATHER_LAYERS.reduce((i,l)=>l.atmos?i+l.weight:i,0)&e.weight){if(a==="copernicus")return"ecmwf"}else{if(["sig-wave","sig-wave-height","sig-wave-height-contour"].includes(e.key))return a;if(a==="ecmwf")return"copernicus"}return a}static autoPickMeteoModel(e="best_match"){var a,r;e=e==null?void 0:e.toLowerCase(),e=e==="ec"?"ecmwf":e;const i=e.toLowerCase().split(","),l=[],n=[];for(const c of i){let s=no.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c}),m=so.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(c))||((u=d.alias)==null?void 0:u.toLowerCase())===c||((y=d.name)==null?void 0:y.toLowerCase())===c});s=s||no.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=m==null?void 0:m.alias)==null?void 0:u.toLowerCase())}),m=m||so.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=s==null?void 0:s.alias)==null?void 0:u.toLowerCase())}),s=s||no[0],m=m||so[0],l.push((a=s.models)!=null&&a.includes(c)?c:s.model),n.push((r=m.models)!=null&&r.includes(c)?c:m.model)}return{weatherModels:l.join(","),marineModels:n.join(",")}}static autoPickSubCategories(e){e=e.toUpperCase();const a=no.filter(l=>l.alias===e),r=so.filter(l=>l.alias===e),i=[];return a.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),r.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),i}static pickHourly(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,M,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt,jt,Pe,Ee,Wt,Ye,Zt,et,ke,Ue;const te=typeof a=="string"?v(a):a;let Ce=te.clone();const Y=e==null?void 0:e.weather,O=e==null?void 0:e.marine,Je=((i=(r=Y==null?void 0:Y[0])==null?void 0:r.hourly)==null?void 0:i.date)||((n=(l=O==null?void 0:O[0])==null?void 0:l.hourly)==null?void 0:n.date),Ie=v.utc(Je),Se=Ie.clone().add(((m=(s=(c=Y==null?void 0:Y[0])==null?void 0:c.hourly)==null?void 0:s.time)==null?void 0:m.at(0))||((u=(g=(d=O==null?void 0:O[0])==null?void 0:d.hourly)==null?void 0:g.time)==null?void 0:u.at(0)),"h"),F=Ie.clone().add(((h=(p=(y=Y==null?void 0:Y[0])==null?void 0:y.hourly)==null?void 0:p.time)==null?void 0:h.at(-1))||((b=(w=(f=O==null?void 0:O[0])==null?void 0:f.hourly)==null?void 0:w.time)==null?void 0:b.at(-1)),"h"),Xt=[];Ce=Ce.isBefore(Se)?Se.clone():Ce,Ce=Ce.isAfter(F)?F.clone():Ce;const $=Ce.utc().diff(Se,"h",!1);let ve,Ke;if(Y!=null&&Y.length){let tt=0,ot=0,R=0;for(const Qe of Y){const G=Qe==null?void 0:Qe.hourly;for(let re=$-($-1)%3;re<=$;re++)tt+=((L=G==null?void 0:G.precipitation)==null?void 0:L.at(re))??0;for(let re=$-($-1)%6;re<=$;re++)ot+=((k=G==null?void 0:G.precipitation)==null?void 0:k.at(re))??0;for(let re=$-($-1)%12;re<=$;re++)R+=((C=G==null?void 0:G.precipitation)==null?void 0:C.at(re))??0;const qe=((A=G==null?void 0:G.wind_direction_10m)==null?void 0:A.at($))??((z=(_=G==null?void 0:G.wind_direction_10m)==null?void 0:_.filter(re=>re!==null))==null?void 0:z.at(-1));ve={temp:((P=G==null?void 0:G.temperature_2m)==null?void 0:P.at($))??((M=(V=G==null?void 0:G.temperature_2m)==null?void 0:V.filter(re=>re!==null))==null?void 0:M.at(-1)),apparentTemp:((j=G==null?void 0:G.apparent_temperature)==null?void 0:j.at($))??((K=(U=G==null?void 0:G.apparent_temperature)==null?void 0:U.filter(re=>re!==null))==null?void 0:K.at(-1)),rh:((de=G==null?void 0:G.relative_humidity_2m)==null?void 0:de.at($))??((S=(ne=G==null?void 0:G.relative_humidity_2m)==null?void 0:ne.filter(re=>re!==null))==null?void 0:S.at(-1)),dp:((Z=G==null?void 0:G.dew_point_2m)==null?void 0:Z.at($))??((q=(H=G==null?void 0:G.dew_point_2m)==null?void 0:H.filter(re=>re!==null))==null?void 0:q.at(-1)),precip:{probability:((W=G==null?void 0:G.precipitation_probability)==null?void 0:W.at($))??0,sum:((B=G==null?void 0:G.precipitation)==null?void 0:B.at($))??0,sum1Hours:((J=G==null?void 0:G.precipitation)==null?void 0:J.at($))??0,sum3Hours:Math.round(tt*100)/100,sum6Hours:Math.round(ot*100)/100,sum12Hours:Math.round(R*100)/100},pmsl:((E=G==null?void 0:G.pressure_msl)==null?void 0:E.at($))??((ie=(I=G==null?void 0:G.pressure_msl)==null?void 0:I.filter(re=>re!==null))==null?void 0:ie.at(-1)),psurf:((ge=G==null?void 0:G.surface_pressure)==null?void 0:ge.at($))??((oe=(ue=G==null?void 0:G.surface_pressure)==null?void 0:ue.filter(re=>re!==null))==null?void 0:oe.at(-1)),code:((he=G==null?void 0:G.weather_code)==null?void 0:he.at($))??((se=(X=G==null?void 0:G.weather_code)==null?void 0:X.filter(re=>re!==null))==null?void 0:se.at(-1)),visibility:this.m2nm(((Ae=G==null?void 0:G.visibility)==null?void 0:Ae.at($))??((Fe=(Le=G==null?void 0:G.visibility)==null?void 0:Le.filter(re=>re!==null))==null?void 0:Fe.at(-1))),wind:{speed:((Ge=G==null?void 0:G.wind_speed_10m)==null?void 0:Ge.at($))??((ze=(De=G==null?void 0:G.wind_speed_10m)==null?void 0:De.filter(re=>re!==null))==null?void 0:ze.at(-1)),kts:((je=G==null?void 0:G.wind_speed_10m)==null?void 0:je.at($))??((Te=(Ve=G==null?void 0:G.wind_speed_10m)==null?void 0:Ve.filter(re=>re!==null))==null?void 0:Te.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,gusts:((Re=G==null?void 0:G.wind_gusts_10m)==null?void 0:Re.at($))??((Ze=(We=G==null?void 0:G.wind_gusts_10m)==null?void 0:We.filter(re=>re!==null))==null?void 0:Ze.at(-1))},isDay:(Be=G==null?void 0:G.is_day)==null?void 0:Be.at($)};const{name:Ot,url:ae,bg:$t}=this.parseWeatherCode(ve.code,ve.isDay);ve.name=Ot,ve.url=ae,ve.bg=$t,ve.wind.scale=this.beaufort(this.kts2ms(ve.wind.kts)),ve.wind.direction=this.degree2Direction(ve.wind.degree),Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:Qe.model,weather:{...ve}})}}if(O!=null&&O.length){let tt=0;for(const ot of O){const R=ot==null?void 0:ot.hourly,Qe=((we=R==null?void 0:R.wave_direction)==null?void 0:we.at($))??((_e=(xe=R==null?void 0:R.wave_direction)==null?void 0:xe.filter(ae=>ae!==null))==null?void 0:_e.at(-1)),G=((Xe=R==null?void 0:R.swell_wave_direction)==null?void 0:Xe.at($))??((Oe=(He=R==null?void 0:R.swell_wave_direction)==null?void 0:He.filter(ae=>ae!==null))==null?void 0:Oe.at(-1)),qe=((Me=R==null?void 0:R.wind_wave_direction)==null?void 0:Me.at($))??((it=(at=R==null?void 0:R.wind_wave_direction)==null?void 0:at.filter(ae=>ae!==null))==null?void 0:it.at(-1)),Ot=((rt=R==null?void 0:R.ocean_current_direction)==null?void 0:rt.at($))??((nt=(lt=R==null?void 0:R.ocean_current_direction)==null?void 0:lt.filter(ae=>ae!==null))==null?void 0:nt.at(-1));Ke={wave:{sig:{height:((st=R==null?void 0:R.wave_height)==null?void 0:st.at($))??((mt=(ct=R==null?void 0:R.wave_height)==null?void 0:ct.filter(ae=>ae!==null))==null?void 0:mt.at(-1)),degree:Qe,bearing:Qe!==null?Math.round((Qe+180)%360):null,period:((dt=R==null?void 0:R.wave_period)==null?void 0:dt.at($))??((pt=(ht=R==null?void 0:R.wave_period)==null?void 0:ht.filter(ae=>ae!==null))==null?void 0:pt.at(-1))},swell:{height:((gt=R==null?void 0:R.swell_wave_height)==null?void 0:gt.at($))??((ft=(ut=R==null?void 0:R.swell_wave_height)==null?void 0:ut.filter(ae=>ae!==null))==null?void 0:ft.at(-1)),degree:G,bearing:G!==null?Math.round((G+180)%360):null,period:((yt=R==null?void 0:R.swell_wave_period)==null?void 0:yt.at($))??((wt=(bt=R==null?void 0:R.swell_wave_period)==null?void 0:bt.filter(ae=>ae!==null))==null?void 0:wt.at(-1)),peakPeriod:((xt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:xt.at($))??((At=(kt=R==null?void 0:R.swell_wave_peak_period)==null?void 0:kt.filter(ae=>ae!==null))==null?void 0:At.at(-1))},wd:{height:((Lt=R==null?void 0:R.wind_wave_height)==null?void 0:Lt.at($))??((vt=(Ct=R==null?void 0:R.wind_wave_height)==null?void 0:Ct.filter(ae=>ae!==null))==null?void 0:vt.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,period:((zt=R==null?void 0:R.wind_wave_period)==null?void 0:zt.at($))??((St=(_t=R==null?void 0:R.wind_wave_period)==null?void 0:_t.filter(ae=>ae!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Nt.at($))??((Pt=(Mt=R==null?void 0:R.wind_wave_peak_period)==null?void 0:Mt.filter(ae=>ae!==null))==null?void 0:Pt.at(-1))}},current:{speed:((Vt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Vt.at($))??((Et=(Tt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Tt.filter(ae=>ae!==null))==null?void 0:Et.at(-1)),kts:((Dt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Dt.at($))??((Bt=(Rt=R==null?void 0:R.ocean_current_velocity)==null?void 0:Rt.filter(ae=>ae!==null))==null?void 0:Bt.at(-1)),degree:Ot,bearing:Ot},sst:((It=R==null?void 0:R.sea_surface_temperature)==null?void 0:It.at($))??((Gt=(Ft=R==null?void 0:R.sea_surface_temperature)==null?void 0:Ft.filter(ae=>ae!==null))==null?void 0:Gt.at(-1)),height:((jt=R==null?void 0:R.sea_level_height_msl)==null?void 0:jt.at($))??((Ee=(Pe=R==null?void 0:R.sea_level_height_msl)==null?void 0:Pe.filter(ae=>ae!==null))==null?void 0:Ee.at(-1)),ice:{sit:((Wt=R==null?void 0:R.sea_ice_thickness)==null?void 0:Wt.at($))??((Zt=(Ye=R==null?void 0:R.sea_ice_thickness)==null?void 0:Ye.filter(ae=>ae!==null))==null?void 0:Zt.at(-1)),sic:((et=R==null?void 0:R.sea_ice_concentration)==null?void 0:et.at($))??((Ue=(ke=R==null?void 0:R.sea_ice_concentration)==null?void 0:ke.filter(ae=>ae!==null))==null?void 0:Ue.at(-1))}},Ke.wave=this.parseWave(Ke.wave,ve==null?void 0:ve.wind),Ke.current.direction=this.degree2Direction(Ke.current.degree),Xt[tt]?Object.assign(Xt[tt],Ke):Xt.push({utc:te.utc().format(),realUTC:Se.add($,"h").format(),model:ot.model,...Ke}),tt++}}return Xt}static toLegacy(e){var a,r,i,l,n,c,s,m,d,g;return{wind:(a=e==null?void 0:e.weather)==null?void 0:a.wind,visibility:(r=e==null?void 0:e.weather)==null?void 0:r.visibility,temp:(i=e==null?void 0:e.weather)==null?void 0:i.temp,prmsl:(l=e==null?void 0:e.weather)==null?void 0:l.pmsl,gusts:{kts:(c=(n=e==null?void 0:e.weather)==null?void 0:n.wind)==null?void 0:c.gusts},precip:(s=e==null?void 0:e.weather)==null?void 0:s.precip,code:(m=e==null?void 0:e.weather)==null?void 0:m.code,name:(d=e==null?void 0:e.weather)==null?void 0:d.name,url:(g=e==null?void 0:e.weather)==null?void 0:g.url,wave:e==null?void 0:e.wave,current:e==null?void 0:e.current,sst:e==null?void 0:e.sst,height:e==null?void 0:e.height,utc:e==null?void 0:e.utc,source:e==null?void 0:e.model,ice:e==null?void 0:e.ice}}static pickDaily(e,a){var r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,M,j,U,K,de,ne,S,Z,H,q,W,B,J,E,I,ie,ge,ue,oe,he,X,se,Ae,Le,Fe,Ge,De,ze,je,Ve,Te,Re,We,Ze,Be,we,xe,_e,Xe,He,Oe,Me,at,it,rt,lt,nt,st,ct,mt,dt,ht,pt,gt,ut,ft,yt,bt,wt,xt,kt,At,Lt,Ct,vt,zt,_t,St,Nt,Mt,Pt,Vt,Tt,Et,Dt,Rt,Bt,It,Ft,Gt;const jt=typeof a=="string"?v(a):a;let Pe=jt.clone();const Ee=e==null?void 0:e.weather,Wt=e==null?void 0:e.marine,Ye=v((l=(i=(r=Ee==null?void 0:Ee[0])==null?void 0:r.daily)==null?void 0:i.time)==null?void 0:l.at(0)),Zt=v((s=(c=(n=Ee==null?void 0:Ee[0])==null?void 0:n.daily)==null?void 0:c.time)==null?void 0:s.at(-1)),et=[];Pe=Pe.isBefore(Ye)?Ye.clone():Pe,Pe=Pe.isAfter(Zt)?Zt.clone():Pe;let ke,Ue;const te=Pe.diff(Ye,"d",!1);if(Ee)for(const Ce of Ee){const Y=Ce.daily,O=((m=Y.wind_direction_10m_dominant)==null?void 0:m.at(te))??((g=(d=Y.wind_direction_10m_dominant)==null?void 0:d.filter(F=>F!==null))==null?void 0:g.at(-1));ke={code:((u=Y.weather_code)==null?void 0:u.at(te))??((p=(y=Y.weather_code)==null?void 0:y.filter(F=>F!==null))==null?void 0:p.at(-1)),temp:{max:((h=Y.temperature_2m_max)==null?void 0:h.at(te))??((w=(f=Y.temperature_2m_max)==null?void 0:f.filter(F=>F!==null))==null?void 0:w.at(-1)),min:((b=Y.temperature_2m_min)==null?void 0:b.at(te))??((k=(L=Y.temperature_2m_min)==null?void 0:L.filter(F=>F!==null))==null?void 0:k.at(-1)),mean:((C=Y.temperature_2m_mean)==null?void 0:C.at(te))??((_=(A=Y.temperature_2m_mean)==null?void 0:A.filter(F=>F!==null))==null?void 0:_.at(-1))},apparentTemp:{max:((z=Y.apparent_temperature_max)==null?void 0:z.at(te))??((V=(P=Y.apparent_temperature_max)==null?void 0:P.filter(F=>F!==null))==null?void 0:V.at(-1)),min:((M=Y.apparent_temperature_min)==null?void 0:M.at(te))??((U=(j=Y.apparent_temperature_min)==null?void 0:j.filter(F=>F!==null))==null?void 0:U.at(-1))},precip:{sum:((K=Y.precipitation_sum)==null?void 0:K.at(te))??((ne=(de=Y.precipitation_sum)==null?void 0:de.filter(F=>F!==null))==null?void 0:ne.at(-1)),rainSum:((S=Y.rain_sum)==null?void 0:S.at(te))??((H=(Z=Y.rain_sum)==null?void 0:Z.filter(F=>F!==null))==null?void 0:H.at(-1)),snowfallSum:((q=Y.snowfall_sum)==null?void 0:q.at(te))??((B=(W=Y.snowfall_sum)==null?void 0:W.filter(F=>F!==null))==null?void 0:B.at(-1)),showersSum:((J=Y.showers_sum)==null?void 0:J.at(te))??((I=(E=Y.showers_sum)==null?void 0:E.filter(F=>F!==null))==null?void 0:I.at(-1)),hours:((ie=Y.precipitation_hours)==null?void 0:ie.at(te))??0,probability:((ge=Y.precipitation_probability_max)==null?void 0:ge.at(te))??0},rh:{max:((ue=Y.relative_humidity_2m_max)==null?void 0:ue.at(te))??((he=(oe=Y.relative_humidity_2m_max)==null?void 0:oe.filter(F=>F!==null))==null?void 0:he.at(-1)),min:((X=Y.relative_humidity_2m_min)==null?void 0:X.at(te))??((Ae=(se=Y.relative_humidity_2m_min)==null?void 0:se.filter(F=>F!==null))==null?void 0:Ae.at(-1)),mean:((Le=Y.relative_humidity_2m_mean)==null?void 0:Le.at(te))??((Ge=(Fe=Y.relative_humidity_2m_mean)==null?void 0:Fe.filter(F=>F!==null))==null?void 0:Ge.at(-1))},wind:{speed:((De=Y.wind_speed_10m_max)==null?void 0:De.at(te))??((je=(ze=Y.wind_speed_10m_max)==null?void 0:ze.filter(F=>F!==null))==null?void 0:je.at(-1)),kts:((Ve=Y.wind_speed_10m_max)==null?void 0:Ve.at(te))??((Re=(Te=Y.wind_speed_10m_max)==null?void 0:Te.filter(F=>F!==null))==null?void 0:Re.at(-1)),degree:O,gusts:((We=Y.wind_gusts_10m_max)==null?void 0:We.at(te))??((Be=(Ze=Y.wind_gusts_10m_max)==null?void 0:Ze.filter(F=>F!==null))==null?void 0:Be.at(-1)),mean:((we=Y.wind_speed_10m_mean)==null?void 0:we.at(te))??((_e=(xe=Y.wind_speed_10m_mean)==null?void 0:xe.filter(F=>F!==null))==null?void 0:_e.at(-1)),bearing:O!==null?Math.round((O+180)%360):null},visibility:{max:this.m2nm(((Xe=Y.visibility_max)==null?void 0:Xe.at(te))??((Oe=(He=Y.visibility_max)==null?void 0:He.filter(F=>F!==null))==null?void 0:Oe.at(-1))),min:this.m2nm(((Me=Y.visibility_min)==null?void 0:Me.at(te))??((it=(at=Y.visibility_min)==null?void 0:at.filter(F=>F!==null))==null?void 0:it.at(-1))),mean:this.m2nm(((rt=Y.visibility_mean)==null?void 0:rt.at(te))??((nt=(lt=Y.visibility_mean)==null?void 0:lt.filter(F=>F!==null))==null?void 0:nt.at(-1)))}};const{name:Je,url:Ie,bg:Se}=this.parseWeatherCode(ke.code,!0);ke.name=Je,ke.url=Ie,ke.bg=Se,ke.wind.scale=this.beaufort(this.kts2ms(ke.wind.kts)),ke.wind.direction=this.degree2Direction(ke.wind.degree),et.push({utc:jt.utc().format(),realUTC:Ye.add(te,"d").utc().format(),model:Ce.model,weather:{...ke}})}if(Wt){let Ce=0;for(const Y of Wt){const O=Y.daily,Je=((st=O==null?void 0:O.wave_direction_dominant)==null?void 0:st.at(te))||((mt=(ct=O==null?void 0:O.wave_direction_dominant)==null?void 0:ct.filter(F=>F!==null))==null?void 0:mt.at(-1)),Ie=((dt=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:dt.at(te))||((pt=(ht=O==null?void 0:O.swell_wave_direction_dominant)==null?void 0:ht.filter(F=>F!==null))==null?void 0:pt.at(-1)),Se=((gt=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:gt.at(te))||((ft=(ut=O==null?void 0:O.wind_wave_direction_dominant)==null?void 0:ut.filter(F=>F!==null))==null?void 0:ft.at(-1));Ue={wave:{sig:{height:((yt=O==null?void 0:O.wave_height_max)==null?void 0:yt.at(te))||((wt=(bt=O==null?void 0:O.wave_height_max)==null?void 0:bt.filter(F=>F!==null))==null?void 0:wt.at(-1)),degree:Je,period:((xt=O==null?void 0:O.wave_period_max)==null?void 0:xt.at(te))||((At=(kt=O==null?void 0:O.wave_period_max)==null?void 0:kt.filter(F=>F!==null))==null?void 0:At.at(-1)),bearing:Je!==null?Math.round((Je+180)%360):null},swell:{height:((Lt=O==null?void 0:O.swell_wave_height_max)==null?void 0:Lt.at(te))??((vt=(Ct=O==null?void 0:O.swell_wave_height_max)==null?void 0:Ct.filter(F=>F!==null))==null?void 0:vt.at(-1)),degree:Ie,period:((zt=O==null?void 0:O.swell_wave_period_max)==null?void 0:zt.at(te))??((St=(_t=O==null?void 0:O.swell_wave_period_max)==null?void 0:_t.filter(F=>F!==null))==null?void 0:St.at(-1)),peakPeriod:((Nt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Nt.at(te))??((Pt=(Mt=O==null?void 0:O.swell_wave_peak_period_max)==null?void 0:Mt.filter(F=>F!==null))==null?void 0:Pt.at(-1)),bearing:Ie!==null?Math.round((Ie+180)%360):null},wd:{height:((Vt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Vt.at(te))??((Et=(Tt=O==null?void 0:O.wind_wave_height_max)==null?void 0:Tt.filter(F=>F!==null))==null?void 0:Et.at(-1)),degree:Se,period:((Dt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Dt.at(te))??((Bt=(Rt=O==null?void 0:O.wind_wave_period_max)==null?void 0:Rt.filter(F=>F!==null))==null?void 0:Bt.at(-1)),peakPeriod:((It=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:It.at(te))??((Gt=(Ft=O==null?void 0:O.wind_wave_peak_period_max)==null?void 0:Ft.filter(F=>F!==null))==null?void 0:Gt.at(-1)),bearing:Se!==null?Math.round((Se+180)%360):null}}},Ue.wave=this.parseWave(Ue.wave,ke==null?void 0:ke.wind),Object.assign(et[Ce]||{},Ue),Ce++}}return et}static parseWave(e,a){if(e.sig.direction=this.degree2Direction(e.sig.degree),e.swell.direction=this.degree2Direction(e.swell.degree),e.wd.direction=this.degree2Direction(e.wd.degree),e.sig.scale=this.douglas(e.sig.height),e.swell.scale=this.douglas(e.swell.height),e.wd.scale=this.douglas(e.wd.height),e.sig.height==0){const r=Math.sqrt(Math.pow(e.swell.height||0,2)+Math.pow(e.wd.height||0,2));e.sig.height=r?Math.round(r*100)/100:.1}if(e.swell.height===0)if(e.sig.height>e.wd.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.wd.height||0,2)));e.swell.height=Math.round(r*100)/100}else{const r=Math.round(.12*this.kts2ms((a==null?void 0:a.kts)||0)*100)/100,i=r>1?r/10:r>.5?r/5:r>.3?r/2:r,l=Math.max(e.sig.height,e.wd.height);e.swell.height=Math.round((i<l?i:l/2)*100)/100}if(e.wd.height===0)if(e.sig.height>e.swell.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.swell.height||0,2))),i=.24*this.kts2ms((a==null?void 0:a.kts)||0);e.wd.height=Math.round(Math.min(r,i)*100)/100}else{const r=.24*this.kts2ms((a==null?void 0:a.kts)||0),i=Math.max(e.sig.height,e.swell.height);e.wd.height=Math.round((r<i?r:i/2)*100)/100}if(e.swell.height>=e.sig.height&&(e.swell.height=Math.round(e.sig.height*.8*100)/100),e.wd.height>=e.sig.height&&(e.wd.height=Math.round(e.sig.height*.8*100)/100),!e.sig.period){const r=Math.max(e.swell.period,e.wd.period);e.sig.period=Math.round(6*Math.sqrt(e.sig.height)),e.sig.period=isNaN(r)?void 0:e.sig.period>r?r:e.sig.period}if(!e.swell.period){e.swell.period=Math.round(6*Math.sqrt(e.swell.height));const r=Math.max(e.sig.period,e.wd.period);e.swell.period=isNaN(r)?void 0:e.swell.period>r?r:e.swell.period}if(!e.wd.period){e.wd.period=Math.round(6*Math.sqrt(e.wd.height));const r=Math.max(e.sig.period,e.swell.period);e.wd.period=isNaN(r)?void 0:e.wd.period>r?r:e.wd.period}return e}static parseWeatherCode(e,a){const r=this.weatherCode(e);return(a?r.day:r.night)||{}}static weatherCode(e){const a={code:e};switch(e){case 0:a.day={name:"Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 1:a.day={name:"Mainly Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Mainly Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 2:a.day={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"},a.night={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"};break;case 3:a.day={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"},a.night={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"};break;case 45:a.day={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 48:a.day={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 51:a.day={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 53:a.day={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 55:a.day={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 56:a.day={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 57:a.day={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 61:a.day={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 63:a.day={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 65:a.day={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 66:a.day={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 67:a.day={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 71:a.day={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 73:a.day={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 75:a.day={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 77:a.day={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 80:a.day={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 81:a.day={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 82:a.day={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 85:a.day={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 86:a.day={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 95:a.day={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 96:a.day={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 99:a.day={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break}return a}static kts2ms(e){return isNaN(e)||e===null?e:Math.round(e*1852/3600*1e4)/1e4}static kts2kmh(e){return isNaN(e)||e===null?e:e*1.852}static m2nm(e){return isNaN(e)||e===null?e:Math.round(e/1e3/1.852*1e4)/1e4}static kmh2kts(e){return isNaN(e)||e===null?e:this.ms2kts(e*1e3/3600)}static ms2kts(e){return isNaN(e)||e===null?e:Math.round(e*3600/1852*1e4)/1e4}static degree2Radian(e){if(isNaN(e)||e===null)return e;let a=e%360/360*2*Math.PI;return a=a<0?a+2*Math.PI:a,a}static degree2Direction(e){const a=this.degree2Radian(e);if(isNaN(a)||a===null)return null;let r="N/A";const i=Math.PI/16;return a<i?r="N":a>=i&&a<3*i?r="NNE":a>=3*i&&a<5*i?r="NE":a>=5*i&&a<7*i?r="ENE":a>=7*i&&a<9*i?r="E":a>=9*i&&a<11*i?r="ESE":a>=11*i&&a<13*i?r="SE":a>=13*i&&a<15*i?r="SSE":a>=15*i&&a<17*i?r="S":a>=17*i&&a<19*i?r="SSW":a>=19*i&&a<21*i?r="SW":a>=21*i&&a<23*i?r="WSW":a>=23*i&&a<25*i?r="W":a>=25*i&&a<27*i?r="WNW":a>=27*i&&a<29*i?r="NW":a>=29*i&&a<31*i?r="NNW":a>=31*i&&a<32*i&&(r="N"),r}static beaufort(e){let a=0;return isNaN(e)||(e=Math.round(e*10)/10,e<=.2?a=0:e<=1.5?a=1:e<=3.3?a=2:e<=5.4?a=3:e<=7.9?a=4:e<=10.7?a=5:e<=13.8?a=6:e<=17.1?a=7:e<=20.7?a=8:e<=22.4?a=9:e<=28.4?a=10:e<=32.6?a=11:e<=36.9?a=12:e<=41.4?a=13:e<=46.1?a=14:e<=50.9?a=15:e<=55.9?a=16:e<=61.2?a=17:e>61.2&&(a=18)),a}static douglas(e){let a="Calm";return isNaN(e)||e<=.1?a="Calm":e<=.5?a="Smooth":e<=1.25?a="Slight":e<=2.5?a="Moderate":e<=4?a="Rough":e<=6?a="VeryRough":e<=9?a="High":e<=14?a="VeryHigh":a="Precipitous",a}};const ib="",sd={name:"IdmTropicals",props:{simple:{type:Boolean,default:!1},permission:{type:Number},locale:{type:String},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},timeZone:{type:Number},token:{type:String},defaultMeteoToken:{type:String},gateway:{type:String,default:"aa"},assistGateway:{type:Array,default:[]},forecastModel:{type:String},realTime:{type:String},beforeLayer:{type:String}},emits:["tropical","tropicalCenterPoints","tropicalProbability","tropicalNotification"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,helper:eo.CompanyHelper,tropicals:void 0,tropicalCacheKey:"tropicalCacheGL4",source:"tropicals-source",clusterSource:"tropicals-cluster-source",historyLayer:"tropicals-history-layer",forecastLayer:"tropicals-forecast-layer",forecastModelLayer:"tropicals-forecast-model-layer",forecastNameLayer:"tropicals-forecast-name-layer",pointCircleLayer:"tropicals-point-circle-layer",pointLabelLayer:"tropicals-point-label-layer",historyPointCircleLayer:"history-tropicals-point-circle-layer",historyPointLabelLayer:"history-tropicals-point-label-layer",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicalsInfo:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:T.featureCollection([]),showLegend:!1,showHoverPoint:!1,hoverPoint:void 0,hoverMarker:void 0}},computed:{hoverLayers(){return[this.forecastNameLayer,this.forecastLayer,this.historyLayer,this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]},clickLayers(){return[this.forecastNameLayer,this.historyLayer]},computeTime(){return(o,e)=>{if(o){const a=v(o).utcOffset(e),r=e<0?e:"+"+e;return`${a==null?void 0:a.format("MMM-DD/HHmm")} (UTC${r}) ${a==null?void 0:a.fromNow()} `}return"-"}},computeTzTime(){return(o,e,a="MM-DD HH:mm")=>{var r,i;if(o){const l=e||0,n=(i=(r=v(o))==null?void 0:r.utcOffset(l))==null?void 0:i.format(a),c=`(UTC ${l>=0?"+":""}${l})`;return n+" "+c}return"-"}},computeTimezone(){return this.timeZone<0?this.timeZone:"+"+this.timeZone},computeBF(){return function(o){const e=la.kts2ms(o);return la.beaufort(e)}},computeMovement(){return function(o){var e,a;return(a=(e=o==null?void 0:o.forecasts)==null?void 0:e.find(r=>!r.disabled))==null?void 0:a.movement}},computePosition(){return o=>!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":N.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+N.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},map:{handler(){this.map?(this.toggle=localStorage.getItem(this.tropicalCacheKey)==="true"||!1,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle&&this.fetchTropicals()):this.handleClear()}},showTropicalsInfo:{handler(){this.$emit("tropical",this.showTropicalsInfo),this.simple&&this.showTropicalsInfo?this.$nextTick(()=>{var o,e;this.$parent.playerBottom=((e=(o=this.$refs.tropicalsInfo)==null?void 0:o.$el)==null?void 0:e.clientHeight)+10}):this.simple&&(this.$parent.playerBottom=30)},immediate:!0},"tropicals.version":{handler(){this.handleRefresh()}},timeZone:{handler(o,e){o!==e&&this.handleRefresh()}},realTime:{handler(o){this.map&&o&&this.toggle&&this.handleRender()}},locale:{handler(o){this.map&&this.toggle&&this.handleRefresh()}}},methods:{handleMenuToggle(){var o,e,a;this.toggle=!this.toggle,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle?this.fetchTropicals():(this.handleClear(),(a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("tropical",!1))},async fetchTropicals(){var i,l,n;const o=new Date().valueOf();let e=0,a=0,r=(i=eo.LayerHelper.WEATHER_LAYERS.find(c=>c.key==="tropicals"))==null?void 0:i.weight;if(r>0){const c=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],s=await ce.get(`${c}/api/arc/weather/layers2/links?l=${r}&v=${this.forecastModel}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(a=new Date().valueOf()-(o+e),console.log("weather links elapsed: ",a,", total: ",e+=a),((l=s==null?void 0:s.data)==null?void 0:l.code)===0){const m=(n=s==null?void 0:s.data)==null?void 0:n.data;await ce.get(m.tropicals,{headers:{Authorization:this.defaultMeteoToken,key:"tropicals"},responseType:/\.(jpg|png)$/.test(m.tropicals)?"blob":"json"}).then(d=>{var y,p,h;const g=N.TropicalHelper.convert2Geojson(((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data));((h=(p=d==null?void 0:d.config)==null?void 0:p.headers)==null?void 0:h.key)&&g&&(this.tropicals={data:g,active:!0,cached:!0,type:"json",etime:s.data.etime,version:Math.random()+1})}).catch(d=>{console.log(`tropicals fetch layer error: ${d}`)})}a=new Date().valueOf()-(o+e),console.log("tropicals elapsed: ",a,", total: ",e+=a)}},handleRefresh(){var e,a;(((a=(e=this.tropicals)==null?void 0:e.data)==null?void 0:a.features)||[]).forEach(r=>{var l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_;let i="";switch(!0){case(((l=r.properties.wind)==null?void 0:l.kts)<32||((n=r.properties)==null?void 0:n.kts)<32):i="td";break;case(((c=r.properties.wind)==null?void 0:c.kts)<47||((s=r.properties)==null?void 0:s.kts)<47):i="ts";break;case(((m=r.properties.wind)==null?void 0:m.kts)<63||((d=r.properties)==null?void 0:d.kts)<63):i="sts";break;case(((g=r.properties.wind)==null?void 0:g.kts)<79||((u=r.properties)==null?void 0:u.kts)<79):i="ty";break;case(((y=r.properties.wind)==null?void 0:y.kts)<94||((p=r.properties)==null?void 0:p.kts)<94):i="sty";break;case(((h=r.properties.wind)==null?void 0:h.kts)>=94||((f=r.properties)==null?void 0:f.kts)>=94):i="superTy";break;default:i="superTy";break}r.properties.levelI18n=i,((w=r.geometry)==null?void 0:w.type)==="Point"&&((b=r.properties)!=null&&b.important)&&(r.properties.format=(k=(L=v(r.properties.date))==null?void 0:L.utcOffset(this.timeZone))==null?void 0:k.format(`MMM-DD/HHmm [(utc${this.computeTimezone})]`)),((C=r.geometry)==null?void 0:C.type)==="Point"&&(r.properties.Name=((_=(A=r.properties.name)==null?void 0:A.trim())==null?void 0:_.replace(/^./,z=>z.toUpperCase()))||r.properties.nameCn,r.properties.nameCn=r.properties.nameCn||r.properties.Name||"-")}),this.handleInit()},handleInit(){var o,e,a,r,i,l,n,c,s,m,d,g;this.handleClear(),this.tropicals&&this.map&&(this.handleRender(),(o=this.map)==null||o.on("click",this.clickLayers,this.handleClick),(e=this.map)==null||e.on("mousemove",this.hoverLayers,this.handleHover),(a=this.map)==null||a.on("mouseleave",this.hoverLayers,this.handleLeave)),((l=(i=(r=this.tropicals)==null?void 0:r.data)==null?void 0:i.features)==null?void 0:l.length)>0?(s=(c=(n=this.$parent)==null?void 0:n.$refs)==null?void 0:c.idmBottomBar)==null||s.handleToggle("tropical",!0):(g=(d=(m=this.$parent)==null?void 0:m.$refs)==null?void 0:d.idmBottomBar)==null||g.handleToggle("tropical",!1)},handleRender(){var o,e,a,r,i,l,n,c,s,m;if(this.tropicals&&this.map){const d=new Date().valueOf();let g=0,u=0;(o=this.map)!=null&&o.getSource(this.source)?((a=this.map)==null||a.getSource(this.source).setData((e=this.tropicals)!=null&&e.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropicals] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.source,{type:"geojson",data:(r=this.tropicals)!=null&&r.active?(i=this.tropicals)==null?void 0:i.data:this.empty}),this.map.addLayer({id:this.historyLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","history"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-width":3,"line-opacity":.7}},this.beforeLayer),this.map.addLayer({id:this.forecastLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"line-width":2,"line-opacity":1,"line-dasharray":[1,2]}},this.beforeLayer),this.map.addLayer({id:this.forecastModelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"symbol-placement":"line","text-field":"{model}","text-rotation-alignment":"viewport","text-size":12},paint:{"text-color":this.Theme.current.value.dark?"#333":"#fff","text-opacity":1,"text-halo-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"text-halo-width":4}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((c=this.map)==null||c.getSource(this.clusterSource).setData((n=this.tropicals)!=null&&n.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropical] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(s=this.tropicals)!=null&&s.active?(m=this.tropicals)==null?void 0:m.data:this.empty}),this.map.addLayer({id:this.pointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.pointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":4,"circle-color":["case",["boolean",["==",["get","kts",["get","wind"]],null]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],32]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],47]],this.Theme.current.value.colors["tropicals-ts"],["boolean",["<",["get","kts",["get","wind"]],63]],this.Theme.current.value.colors["tropicals-sts"],["boolean",["<",["get","kts",["get","wind"]],79]],this.Theme.current.value.colors["tropicals-ty"],["boolean",["<",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-sty"],["boolean",[">=",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-super-ty"],"#fff"]}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":6,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":"rgba(0,0,0,0.7)"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-inner",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":3,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["==","important",!0]],layout:{"text-field":["get",this.locale==="en"?"Name":"nameCn"],"text-anchor":"bottom","text-size":16,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-offset":[0,2]},paint:{"text-color":this.Theme.current.value.colors["map-blue"],"text-halo-color":"#ffffff","text-halo-width":2}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u));const y=N.TropicalHelper.interpolate(this.tropicals,1);this.interpolateData=JSON.parse(JSON.stringify(y)),this.handleDateChange()}},handleClear(){var o,e,a,r;this.map&&(this.map.getLayer(this.historyLayer)&&this.map.removeLayer(this.historyLayer),this.map.getLayer(this.forecastLayer)&&this.map.removeLayer(this.forecastLayer),this.map.getLayer(this.forecastModelLayer)&&this.map.removeLayer(this.forecastModelLayer),this.map.getLayer(this.forecastNameLayer)&&this.map.removeLayer(this.forecastNameLayer),this.map.getLayer(this.pointCircleLayer)&&this.map.removeLayer(this.pointCircleLayer),this.map.getLayer(this.pointCircleLayer+"-border")&&this.map.removeLayer(this.pointCircleLayer+"-border"),this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.historyPointCircleLayer)&&this.map.removeLayer(this.historyPointCircleLayer),this.map.getLayer(this.historyPointCircleLayer+"-border")&&this.map.removeLayer(this.historyPointCircleLayer+"-border"),this.map.getLayer(this.historyPointCircleLayer+"-inner")&&this.map.removeLayer(this.historyPointCircleLayer+"-inner"),this.map.getLayer(this.historyPointLabelLayer)&&this.map.removeLayer(this.historyPointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(o=this.interpolateMarkers)==null||o.forEach(i=>i==null?void 0:i.remove()),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.map.getSource(this.clusterSource)&&this.map.removeSource(this.clusterSource),this.map.getSource(this.interpolateSource)&&this.map.removeSource(this.interpolateSource)),(e=this.map)==null||e.off("click",this.clickLayers,this.handleClick),(a=this.map)==null||a.off("mousemove",this.hoverLayers,this.handleHover),(r=this.map)==null||r.off("mouseleave",this.hoverLayers,this.handleLeave),this.handleCloseInfoMarker()},handleDateChange(){var o,e,a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,L,k,C,A,_,z,P,V,M,j,U,K,de,ne,S,Z;if((o=this.interpolateMarkers)==null||o.forEach(H=>H==null?void 0:H.remove()),(e=this.interpolateData)!=null&&e.length&&this.tropicals.active){const H=v(this.realTime).utc().set({minute:0,second:0,millisecond:0}),q=this.interpolateData.filter(E=>E.properties.date===(H==null?void 0:H.format())&&!E.properties.disabled),W=this.handleComputePolygons(q),B=T.featureCollection([...q]);W.forEach(E=>{B.features.push(E)}),(a=this.map)!=null&&a.getSource(this.interpolateSource)?(r=this.map)==null||r.getSource(this.interpolateSource).setData(B):((i=this.map)==null||i.addSource(this.interpolateSource,{type:"geojson",data:B}),(l=this.map)==null||l.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-opacity":1,"line-color":["match",["get","level"],7,this.Theme.current.value.colors["tropicals-r7"],10,this.Theme.current.value.colors["tropicals-r10"],this.Theme.current.value.colors["tropicals-r10"]],"line-width":1}},"empty-layer-3")),this.interpolateMarkers=[];const J=[];for(const E of q)if(!E.properties.disabled){if(!J.some(oe=>{var he;return oe.properties.name===((he=E.properties)==null?void 0:he.name)})){const oe=((c=(n=this.tropicals.data.features.find(he=>{var X;return he.properties.name===((X=E.properties)==null?void 0:X.name)}))==null?void 0:n.properties)==null?void 0:c.nameCn)||((s=E.properties)==null?void 0:s.Name)||"-";E.properties.nameCn=oe,E.properties.Name=((d=(m=E.properties.name)==null?void 0:m.trim())==null?void 0:d.replace(/^./,he=>he.toUpperCase()))||E.properties.nameCn,J.push(E)}let I=this.Theme.current.value.colors["tropicals-ty"];((u=(g=E.properties)==null?void 0:g.wind)==null?void 0:u.kts)<32||!((p=(y=E.properties)==null?void 0:y.wind)!=null&&p.kts)?I=this.Theme.current.value.colors["tropicals-td"]:((f=(h=E.properties)==null?void 0:h.wind)==null?void 0:f.kts)>=32&&((b=(w=E.properties)==null?void 0:w.wind)==null?void 0:b.kts)<47?I=this.Theme.current.value.colors["tropicals-ts"]:((k=(L=E.properties)==null?void 0:L.wind)==null?void 0:k.kts)>=47&&((A=(C=E.properties)==null?void 0:C.wind)==null?void 0:A.kts)<63?I=this.Theme.current.value.colors["tropicals-sts"]:((z=(_=E.properties)==null?void 0:_.wind)==null?void 0:z.kts)>=63&&((V=(P=E.properties)==null?void 0:P.wind)==null?void 0:V.kts)<79?I=this.Theme.current.value.colors["tropicals-ty"]:((j=(M=E.properties)==null?void 0:M.wind)==null?void 0:j.kts)>=79&&((K=(U=E.properties)==null?void 0:U.wind)==null?void 0:K.kts)<94?I=this.Theme.current.value.colors["tropicals-sty"]:((ne=(de=E.properties)==null?void 0:de.wind)==null?void 0:ne.kts)>=94?I=this.Theme.current.value.colors["tropicals-super-ty"]:I=this.Theme.current.value.colors["tropicals-ty"];const ie=`<svg t="1719918955501"
204
204
  class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" p-id="18382"
205
205
  xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
206
206
  <path