@idmwx/idmui-gl4 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3444,7 +3444,7 @@ const Fs = {
|
|
|
3444
3444
|
},
|
|
3445
3445
|
"lngLat.e": {
|
|
3446
3446
|
handler(t) {
|
|
3447
|
-
this.lngLat.lng = q.lng2pretty(t == null ? void 0 : t.lng, 2).pretty, this.lngLat.lat = q.lat2pretty(t == null ? void 0 : t.lat, 2).pretty, this.lngLat.str = `[${q.
|
|
3447
|
+
this.lngLat.lng = q.lng2pretty(t == null ? void 0 : t.lng, 2).pretty, this.lngLat.lat = q.lat2pretty(t == null ? void 0 : t.lat, 2).pretty, this.lngLat.str = `[${q.str2Lat(t == null ? void 0 : t.lat, 4)}, ${q.str2Lng(t == null ? void 0 : t.lng, 4)}]`;
|
|
3448
3448
|
},
|
|
3449
3449
|
immediate: !0
|
|
3450
3450
|
}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -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["surface-bright"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["surface-bright"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["surface-bright"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["surface-bright"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["surface-bright"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["surface-bright"]}}}],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(t)},handleClose(){this.$emit("close")}}},Vr={class:"d-flex justify-space-between align-center"},Br={class:"d-flex justify-start text-h5 my-2"},Ir={class:"d-flex justify-start align-center text-body-1 text-label ga-3"},Rr={class:"summary-box w-100"},Ar={class:"d-flex justify-space-between align-center py-2"},Or={class:"d-flex justify-center align-center text-h6 ga-2"},jr={class:"multi-color-icon","aria-hidden":"true"},Fr=["xlink:href"],Hr={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},Gr={class:"w-100 d-flex justify-start align-center"},Wr={class:"w-30 text-label font-weight-400"},Ur={class:"flex-1-1-0"},Yr={class:"w-100 d-flex justify-start align-center"},Zr={class:"w-30 text-label font-weight-400"},qr={class:"flex-1-1-0"},Xr={class:"w-100 d-flex justify-start align-center"},Kr={class:"w-30 text-label font-weight-400"},Jr={class:"flex-1-1-0"},Qr={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},$r={class:"w-100 d-flex justify-space-between align-center py-2"},el={class:"d-flex justify-center align-center text-h6 ga-2"},tl={class:"multi-color-icon","aria-hidden":"true"},ol=["xlink:href"],al={class:"w-100",style:{height:"244px"},ref:"tideEchart"},il={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},rl={class:"px-1 text-center text-label font-weight-400",width:"120"},ll={class:"px-1 text-center text-label font-weight-400",width:"120"},sl={class:"px-1 text-center text-label font-weight-400",width:"120"},nl={class:"px-1 text-center"},cl={class:"px-1 text-center"},ml={class:"px-1 text-center"};function dl(o,t,a,r,i,l){const s=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-title"),n=e.resolveComponent("v-divider"),h=e.resolveComponent("VBtnToggle"),d=e.resolveComponent("v-card");return e.openBlock(),e.createBlock(d,{class:e.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:e.withCtx(()=>{var g,f;return[e.createVNode(c,{class:"w-100"},{default:e.withCtx(()=>{var x;return[e.createElementVNode("div",Vr,[e.createElementVNode("div",Br,[e.createElementVNode("div",null,e.toDisplayString((x=a.station)==null?void 0:x.name),1)]),e.createVNode(s,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:e.withCtx(()=>t[1]||(t[1]=[e.createElementVNode("i",{class:"iconfont icon-close text-label text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),e.createElementVNode("div",Ir,[e.createElementVNode("div",null,e.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),e.createVNode(n,{class:"w-100"}),e.createElementVNode("div",{class:e.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[e.createElementVNode("div",Rr,[e.createElementVNode("div",Ar,[e.createElementVNode("div",Or,[(e.openBlock(),e.createElementBlock("svg",jr,[e.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Fr)])),e.createElementVNode("div",null,e.toDisplayString(o.$t("detail.summary")),1)])]),e.createElementVNode("div",Hr,[e.createElementVNode("div",Gr,[e.createElementVNode("div",Wr,e.toDisplayString(o.$t("tide.region")),1),e.createElementVNode("div",Ur,e.toDisplayString(((g=a.station)==null?void 0:g.Country)??((f=a.station)==null?void 0:f.city)??"-"),1)]),e.createElementVNode("div",Yr,[e.createElementVNode("div",Zr,e.toDisplayString(o.$t("tide.position")),1),e.createElementVNode("div",qr,e.toDisplayString(l.computePosition(a.station)),1)]),e.createElementVNode("div",Xr,[e.createElementVNode("div",Kr,e.toDisplayString(o.$t("time.localTime")),1),e.createElementVNode("div",Jr,e.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+e.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),e.createElementVNode("div",Qr,[e.createElementVNode("div",$r,[e.createElementVNode("div",el,[(e.openBlock(),e.createElementBlock("svg",tl,[e.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ol)])),e.createElementVNode("div",null,e.toDisplayString(o.$t("tide.tideTimes")),1)]),t[2]||(t[2]=e.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),e.createElementVNode("div",{class:e.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4"])},[e.createVNode(h,{modelValue:i.currentIndex,"onUpdate:modelValue":t[0]||(t[0]=x=>i.currentIndex=x),class:"w-100 gray-bg-2 rounded d-flex justify-space-around align-center ga-0 px-1 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.dateList,x=>(e.openBlock(),e.createBlock(s,{class:"text-none text-body-1 rounded bg-none flex-1-1-0",density:"compact",color:"primary",height:"26",value:x.index},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.label),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"]),e.createElementVNode("div",al,null,512),e.createElementVNode("table",il,[e.createElementVNode("tbody",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",rl,e.toDisplayString(o.$t("tide.tide")),1),e.createElementVNode("th",ll,e.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),e.createElementVNode("th",sl,e.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tideTableData,(x,b)=>{var _;return e.openBlock(),e.createElementBlock("tr",{key:b},[e.createElementVNode("td",nl,e.toDisplayString(o.$t(`tide.${(_=x==null?void 0:x.type)==null?void 0:_.toLowerCase()}`))+" "+e.toDisplayString(o.$t("tide.tide")),1),e.createElementVNode("td",cl,e.toDisplayString(l.computeLocalTime(x==null?void 0:x.date,a.station,"MM-DD HH:mm")),1),e.createElementVNode("td",ml,e.toDisplayString((x==null?void 0:x.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const hl=O(Mr,[["render",dl],["__scopeId","data-v-02553a04"]]),Hd="",pl={name:"IdmTideStations",components:{TideDetail:hl},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,t,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.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 t=o.features[0];t.properties&&(this.station=t.properties,this.station.name=this.locale==="en"?t.properties.Location_EN:t.properties.Location_CN,this.station.lng=t.geometry.coordinates[0],this.station.lat=t.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const t=o.features[0];if(t.properties){this.showInfo=!0,this.hoverStation=t.properties,this.hoverStation.name=this.locale==="en"?t.properties.Location_EN:t.properties.Location_CN,this.hoverStation.lng=t.geometry.coordinates[0],this.hoverStation.lat=t.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new de.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}}},gl={class:"station-box d-flex flex-column justify-center align-start ga-1"},ul={class:"d-flex justify-start align-center"},fl={class:"d-flex justify-start align-center"},yl={class:"text-label"};function bl(o,t,a,r,i,l){const s=e.resolveComponent("v-card-text"),c=e.resolveComponent("v-card"),n=e.resolveComponent("TideDetail");return e.openBlock(),e.createElementBlock("div",null,[e.withDirectives(e.createVNode(c,{id:"idmTidalInfo"},{default:e.withCtx(()=>[e.createVNode(s,{class:"pr-8 text-body-1"},{default:e.withCtx(()=>{var h,d;return[e.createElementVNode("div",gl,[e.createElementVNode("div",ul,e.toDisplayString(o.$t("tide.tideStation")),1),e.createElementVNode("div",fl,[e.createElementVNode("label",yl,e.toDisplayString((h=i.hoverStation)==null?void 0:h.name)+" , "+e.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[e.vShow,i.showInfo]]),i.showDetail?(e.openBlock(),e.createBlock(n,e.mergeProps({key:0,station:i.station,onClose:l.handleCloseDetail},o.$attrs),null,16,["station","onClose"])):e.createCommentVNode("",!0)])}const wl=O(pl,[["render",bl],["__scopeId","data-v-7f9e02c0"]]),xl={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,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function _l(o,t,a,r,i,l){return null}const kl=O(xl,[["render",_l]]),Gd="",zl={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)"}},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=T.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=T.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${T.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}, ${T.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}]`},immediate:!0}},methods:{handleBind(){var o,t;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.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 t=30;o>4?t=10:o>3&&(t=15);const a=[];for(let i=-60;i<90;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=t)for(let l=-60;l<90;l+=t)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 t;const o=this.handleComputeLatLngs();(t=this.map)==null||t.getSource(this.source).setData(V.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":.8,"text-color":this.lineColor}},this.beforeLayer)}},handleClear(){var o,t,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((t=this.map)==null||t.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 vl(o,t,a,r,i,l){var s,c,n;return a.simple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 text-caption text-right rounded",style:e.normalizeStyle({right:i.right+"px"})},[e.createElementVNode("div",null,e.toDisplayString((s=i.lngLat)==null?void 0:s.lat),1),e.createElementVNode("div",null,e.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),e.createElementVNode("div",null,e.toDisplayString((n=i.lngLat)==null?void 0:n.str),1)],4))}const fo=O(zl,[["render",vl]]),Wd="",Ll={name:"IdmFollowPort",components:{PortDetail:go},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},setup(){return{Theme:le.useTheme()}},emits:["closeAllDetail"],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,t,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.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,t,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var t,a;const o={features:[],type:"FeatureCollection"};(t=this.followList)==null||t.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,s={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(s)}}),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,t,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),(t=this.map)==null||t.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const t=o.features[0];this.portId=t.properties.id,t.properties.id&&(this.port=t.properties,this.port.lng=t.geometry.coordinates[0],this.port.lat=t.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const t=o.features[0];if(t.properties.id){this.showInfo=!0,this.hoverPort=t.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new de.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}}},Cl={class:"port-box d-flex flex-column justify-center align-start ga-1"},Pl={class:"d-flex justify-start align-center text-label"},Sl={class:"d-flex justify-start align-center text-label"};function Nl(o,t,a,r,i,l){const s=e.resolveComponent("v-card-text"),c=e.resolveComponent("v-card"),n=e.resolveComponent("PortDetail");return e.openBlock(),e.createElementBlock("div",null,[e.withDirectives(e.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-body-1 pr-8"},{default:e.withCtx(()=>[e.createElementVNode("div",Cl,[e.createElementVNode("div",null,e.toDisplayString(o.$t("port.port")),1),e.createElementVNode("div",Pl,[e.createElementVNode("span",null,e.toDisplayString(i.hoverPort.name??"-"),1)]),e.createElementVNode("div",Sl,[t[1]||(t[1]=e.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[e.vShow,i.showInfo]]),i.showDetail?(e.openBlock(),e.createBlock(n,e.mergeProps({key:0,portId:i.portId,port:i.port,forecastModel:a.forecastModel,followList:a.followList,onClose:l.handleCloseDetail,onCloseAllDetail:t[0]||(t[0]=h=>o.$emit("closeAllDetail",{followPort:!0}))},o.$attrs),null,16,["portId","port","forecastModel","followList","onClose"])):e.createCommentVNode("",!0)])}const Tl=O(Ll,[["render",Nl],["__scopeId","data-v-95e70a1f"]]),Ud="",Dl={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:le.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)?"-":T.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+T.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,t,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.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,t,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var t,a;const o={features:[],type:"FeatureCollection"};(t=this.followList)==null||t.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,t,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),(t=this.map)==null||t.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,s,c,n,h,d;const t=o.features[0];if(t.properties){const g=t.properties;g.lng=t.geometry.coordinates[0],g.lat=t.geometry.coordinates[1];const f=v(),x=(a=v(this.realTime))==null?void 0:a.diff(f,"d",!0),b={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};x>=0?(s=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||s.fetchForecastData(b):(d=(h=(n=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:n.$refs)==null?void 0:h.idmSpot)==null||d.fetchHistoryData(b)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const t=o.features[0];if(t.properties.id){this.showInfo=!0,this.position=t.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new de.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"}}},El={class:"position-box d-flex flex-column justify-center align-start ga-1"},Ml={class:"d-flex justify-start align-center text-label"},Vl={key:0,class:"d-flex justify-start align-center text-label"};function Bl(o,t,a,r,i,l){const s=e.resolveComponent("v-card-text"),c=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-body-1 pr-8"},{default:e.withCtx(()=>[e.createElementVNode("div",El,[t[0]||(t[0]=e.createElementVNode("div",null,"Location",-1)),e.createElementVNode("div",Ml,[e.createElementVNode("span",null,e.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(e.openBlock(),e.createElementBlock("div",Vl,[e.createElementVNode("span",null,e.toDisplayString(i.position.remark??"-"),1)])):e.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[e.vShow,i.showInfo]])}const Il=O(Dl,[["render",Bl],["__scopeId","data-v-82405c68"]]),Yd="",Rl={name:"IdmOtherLayerr",components:{IdmWarZone:Ga,IdmGmdssArea:Ya,IdmEcaZone:Xa,IdmAlertZone:$a,IdmPort:nr,IdmLoadLine:dr,IdmTimezone:gr,IdmVRA:yr,IdmSpecialArea:xr,IdmTerminator:zr,IdmWorld12nm:Cr,IdmWorldMarine:Nr,IdmChinaRoute:Er,IdmTideStations:wl,IdmIceAreas:kl,IdmLatLng:fo,IdmFollowPort:Tl,IdmFollowPosition:Il},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")||"light",tagLayers:[...Be.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,t){o&&t&&o!==t&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark"},immediate:!0},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,t){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=>!(t!=null&&t.includes(l))),r=t==null?void 0:t.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>t==null?void 0:t.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(s=>this.checkList.includes(s.key)&&!i.includes(s.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 t=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(t||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),t=localStorage.getItem(this.cache.mapFeatherKey);const a=t||"light";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.$emit("map",void 0),this.mapFeather=o.value},async fetchOtherLayers(){var t,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await J.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((t=i==null?void 0:i.data)==null?void 0:t.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,s=[];for(const n in l)s.push(J.get(l[n],{headers:{Authorization:this.defaultMeteoToken,key:n}}));(await Promise.all(s)).map(n=>{var g,f,x;const h=((g=n==null?void 0:n.data)==null?void 0:g.data)||(n==null?void 0:n.data),d=(x=(f=n==null?void 0:n.config)==null?void 0:f.headers)==null?void 0:x.key;this.otherLayers[d]=h})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],t=await J.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=t==null?void 0:t.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=t==null?void 0:t.data)==null?void 0:r.data)||(t==null?void 0:t.data))},handleLayersChange(o){const t=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=t,this.fetchOtherLayers()}}},Al={class:"idm-gl4-other-layer"},Ol={class:"header-box d-flex justify-space-between align-center px-4"},jl={class:"text-h5 font-weight-medium"},Fl={class:"list-box scroll pl-4 pr-2 overflow-y-auto"},Hl={class:"layers-body mt-4 d-flex justify-start align-center flex-wrap"},Gl=["onClick"],Wl={key:0,src:"https://osshz.idmwx.com/asset/dark-map.png",class:"border rounded-sm"},Ul={key:1,src:"https://osshz.idmwx.com/asset/nautical-map.png",class:"border rounded-sm"},Yl={key:2,src:"https://osshz.idmwx.com/asset/satellite-map.png",class:"border rounded-sm"},Zl={key:3,src:"https://osshz.idmwx.com/asset/light-map.png",class:"border rounded-sm"},ql={class:"text-body-2 text-center pt-1"};function Xl(o,t,a,r,i,l){var F,Q,$,ie,q,ee,re,te,oe;const s=e.resolveComponent("VBtn"),c=e.resolveComponent("VTooltip"),n=e.resolveComponent("VCardTitle"),h=e.resolveComponent("VCardItem"),d=e.resolveComponent("VCheckbox"),g=e.resolveComponent("VCardText"),f=e.resolveComponent("VCard"),x=e.resolveComponent("IdmLatLng"),b=e.resolveComponent("IdmTerminator"),_=e.resolveComponent("IdmTimezone"),p=e.resolveComponent("IdmPort"),S=e.resolveComponent("IdmAlertZone"),L=e.resolveComponent("IdmTideStations"),k=e.resolveComponent("IdmEcaZone"),w=e.resolveComponent("IdmWarZone"),u=e.resolveComponent("IdmGmdssArea"),z=e.resolveComponent("IdmLoadLine"),y=e.resolveComponent("IdmWorldMarine"),C=e.resolveComponent("IdmVRA"),E=e.resolveComponent("IdmSpecialArea"),R=e.resolveComponent("IdmWorld12nm"),j=e.resolveComponent("IdmChinaRoute"),A=e.resolveComponent("IdmIceAreas"),G=e.resolveComponent("IdmFollowPort"),W=e.resolveComponent("IdmFollowPosition");return e.openBlock(),e.createElementBlock("div",Al,[e.createElementVNode("div",{class:"menu-bar-box transition px-1 rounded",style:e.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[e.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left"},{activator:e.withCtx(({props:P})=>[e.createVNode(s,e.mergeProps(P,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:e.withCtx(()=>t[5]||(t[5]=[e.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text"])],4),e.createElementVNode("div",{class:e.normalizeClass(["available-layers transition",i.toggle?"right-bar":""]),style:e.normalizeStyle(l.listStyle)},[e.createElementVNode("div",Ol,[e.createElementVNode("div",jl,e.toDisplayString(o.$t("layer.layers")),1),e.createVNode(s,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:e.withCtx(()=>t[6]||(t[6]=[e.createElementVNode("i",{class:"iconfont icon-close text-label text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),e.createElementVNode("div",Fl,[e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"pb-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Hl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.mapFeathers,P=>(e.openBlock(),e.createElementBlock("div",{key:P.value,class:"mb-2 feather-item",onClick:U=>l.handleToggleMapFeather(P)},[e.createElementVNode("div",{class:e.normalizeClass([i.mapFeather===P.value?"active":"","img-box"])},[P.value==="dark"?(e.openBlock(),e.createElementBlock("img",Wl)):P.value==="nautical"?(e.openBlock(),e.createElementBlock("img",Ul)):P.value==="satellite"?(e.openBlock(),e.createElementBlock("img",Yl)):(e.openBlock(),e.createElementBlock("img",Zl))],2),e.createElementVNode("div",ql,e.toDisplayString(o.$t(`layer.${P.locale}`)),1)],8,Gl))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(P=>["graticule","day-night","time-zones"].includes(P.key)),P=>(e.openBlock(),e.createBlock(d,{key:P.key,modelValue:i.checkList,"onUpdate:modelValue":t[0]||(t[0]=U=>i.checkList=U),value:P.key,label:o.$t(`layer.${P.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}),e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(P=>["ports","alert-zones","tidal-stations"].includes(P.key)),P=>(e.openBlock(),e.createBlock(d,{key:P.key,modelValue:i.checkList,"onUpdate:modelValue":t[1]||(t[1]=U=>i.checkList=U),value:P.key,label:o.$t(`layer.${P.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}),e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(P=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(P.key)),P=>(e.openBlock(),e.createBlock(d,{key:P.key,modelValue:i.checkList,"onUpdate:modelValue":t[2]||(t[2]=U=>i.checkList=U),value:P.key,label:o.$t(`layer.${P.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}),e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"py-2"},{default:e.withCtx(()=>[e.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":t[3]||(t[3]=P=>i.checkList=P),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"]),e.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":t[4]||(t[4]=P=>i.checkList=P),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})])],6),a.map?(e.openBlock(),e.createBlock(x,e.mergeProps({key:0,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs),null,16,["simple","map","menu-toggle","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(b,e.mergeProps({key:1,map:a.map,area:(F=i.otherLayers)==null?void 0:F["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(_,e.mergeProps({key:2,map:a.map,zone:(Q=i.otherLayers)==null?void 0:Q["time-zones"],realTime:a.realTime},o.$attrs,{beforeLayer:"empty-layer-3"}),null,16,["map","zone","realTime"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(p,e.mergeProps({key:3,ref:"idmPorts",simple:a.simple,map:a.map,ports:($=i.otherLayers)==null?void 0:$.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,realTime:a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","realTime","theme"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(S,e.mergeProps({key:4,map:a.map,simple:a.simple,zone:(ie=i.otherLayers)==null?void 0:ie["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(L,e.mergeProps({key:5,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,defaultMeteoToken:a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,realTime:a.realTime,forecastModel:a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","defaultMeteoToken","show","theme","realTime","forecastModel"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(k,e.mergeProps({key:6,map:a.map,zone:(q=i.otherLayers)==null?void 0:q["eca-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(w,e.mergeProps({key:7,map:a.map,zone:(ee=i.otherLayers)==null?void 0:ee["war-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(u,e.mergeProps({key:8,map:a.map,area:(re=i.otherLayers)==null?void 0:re["gmdss-areas"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(z,e.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(y,e.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(C,e.mergeProps({key:11,map:a.map,area:(te=i.otherLayers)==null?void 0:te["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(E,e.mergeProps({key:12,map:a.map,area:(oe=i.otherLayers)==null?void 0:oe["special-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(R,e.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(j,e.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(A,e.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(G,e.mergeProps({key:16,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,realTime:a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","realTime"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(W,e.mergeProps({key:17,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,realTime:a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","realTime"])):e.createCommentVNode("",!0)])}const Kl=O(Rl,[["render",Xl]]);class uo{constructor(t){ae(this,"map");ae(this,"mercator");ae(this,"rampColorLayer");ae(this,"rampColorSource");ae(this,"particleLayer");ae(this,"particleSource");ae(this,"rampColorCanvas");ae(this,"particleCanvas");ae(this,"ratio");this.map=t,this.mercator=new Oa,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(t,a=0){return t>180?this.convertNLng(t-360,a+1):t<-180?this.convertNLng(t+360,a+1):[t,a]}getBoundLngLat(){var a;const t=(a=this.map)==null?void 0:a.getBounds();return t?[[t._sw.lng,t._ne.lat],[t._ne.lng,t._ne.lat],[t._ne.lng,t._sw.lat],[t._sw.lng,t._sw.lat]]:[]}getBoundPixel(){var b,_;const t=(b=this.map)==null?void 0:b.getBounds();if(!t)return[];const a=((_=this.map)==null?void 0:_.getZoom())+1,r=[t._ne.lng,t._ne.lat],i=[t._sw.lng,t._sw.lat],[l,s]=this.convertNLng(r[0]),[c,n]=this.convertNLng(i[0]),[h,d]=this.mercator.px([l,r[1]],a),[g,f]=this.mercator.px([c,i[1]],a),x=Math.round(this.mercator.size*Math.pow(2,a)*(s+n));return[g,f,h+x,d]}getBoundRange(){const t=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,t),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(t,a){const r=2**a,[i,l,s,c]=t.map(d=>~~(d/(r*256))),n=[];for(let d=c;d<=l;d++)for(let g=i;g<=s;g++)n.push([g,d]);return n.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let t=this.map.getSource(this.rampColorSource);t.setCoordinates(this.getBoundLngLat()),t=this.map.getSource(this.particleSource),t.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(t){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(t){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class _e{createShader(t,a,r){const i=t.createShader(a);if(i&&(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)))throw new Error(t.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(t,a,r,i,l,s,c){const n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),l instanceof Uint8Array?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,c,0,t.RGBA,t.UNSIGNED_BYTE,l):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),t.bindTexture(t.TEXTURE_2D,null),n}createDataBuffer(t,a,r){if(t){const i=t.createBuffer();return a==="array"?(t.bindBuffer(t.ARRAY_BUFFER,i),r&&t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW)):a==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),r&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW)),i}return null}createProgram(t,a,r){const i=t.createProgram(),l=this.createShader(t,t.VERTEX_SHADER,a),s=this.createShader(t,t.FRAGMENT_SHADER,r);if(i&&l&&s&&(t.attachShader(i,l),t.attachShader(i,s),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)))throw new Error(t.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(t,a,r){const i=this.createProgram(t,a,r);if(i){const l={program:i},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){const h=t.getActiveAttrib(i,n);l[h.name]=t.getAttribLocation(i,h.name)}const c=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let n=0;n<c;n++){const h=t.getActiveUniform(i,n);l[h.name]=t.getUniformLocation(i,h.name)}return l}}setup(t,a,r=!1,i,l){const s=document.createElement("canvas");s.width=256,s.height=1;const c=s.getContext("2d");if(c&&t){const n=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([h,d])=>{n.addColorStop(h,d)}),c.fillStyle=n,c.fillRect(0,0,256,1),{canvas:s,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):s,i,l)}}}setupParticle(t,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 s=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),n=new Float32Array(i);for(let d=0;d<i;d++)n[d]=d;const h=this.createDataBuffer(t,"array",n);return{resolution:r,total:i,texture0:s,texture1:c,indexBuffer:h}}bind(t,a,r){const i=this.createProgram(t,a,r);if(i){const l=this.createDataBuffer(t,"array",void 0),s=t.getAttribLocation(i,"a_position");t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(t,"array",c);const n=t.getAttribLocation(i,"a_texCoord");return t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(t,a,r,i,l,s){const c=this.createProgramWrapper(t,a,r),n=this.createProgramWrapper(t,i,l),h=this.createProgramWrapper(t,i,s),d=this.createDataBuffer(t,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=t.createFramebuffer();return{particle:c,screen:n,update:h,quadBuffer:d,frameBuffer:g}}draw(t,a,r,i,l,s,c){var n,h;if(a&&r){t.resize(),a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(h=a==null?void 0:a.canvas)==null?void 0:h.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*t.ratio,a.canvas.height*t.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=t.getBoundPixel(),f=t.map.getZoom()+1,x=t.getWorldCopy(g,f);for(const b of x){const _=(b[0]-g[0])*t.ratio,p=(b[1]-g[3])*t.ratio,S=b[2]*t.ratio,[L,k,w,u]=[_,S+_,p,S+p],z=new Float32Array([L,w,k,w,L,u,L,u,k,w,k,u]);a.bindBuffer(a.ARRAY_BUFFER,s),a.bufferData(a.ARRAY_BUFFER,z,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(t,a,r,i,l){var s,c;a&&(a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.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(t,a,i,l),this.updateParticles(t,a,i,l))}renderScreen(t,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(t,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(t,a,r,i,l){t&&(t.useProgram(r.program),t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(r.a_pos),t.vertexAttribPointer(r.a_pos,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,a),t.uniform1i(r.u_screen,2),t.uniform1f(r.u_opacity,l),t.drawArrays(t.TRIANGLES,0,6))}renderParticles(t,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*t.ratio),a.uniform1f(r.particle.u_point,t.ratio);const l=t.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(t,a,r,i){var s,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 n=t.getBoundRange();a.uniform4f(r.update.u_viewport,n[0],n[1],n[2],n[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(s=r==null?void 0:r.image)==null?void 0:s.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*t.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(t,a){t.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(t){return new Promise(a=>{const r=new Blob([t],{type:t.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class K{}ae(K,"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["surface-bright"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["surface-bright"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["surface-bright"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["surface-bright"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["surface-bright"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["surface-bright"]}}}],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(t)},handleClose(){this.$emit("close")}}},Vr={class:"d-flex justify-space-between align-center"},Br={class:"d-flex justify-start text-h5 my-2"},Ir={class:"d-flex justify-start align-center text-body-1 text-label ga-3"},Rr={class:"summary-box w-100"},Ar={class:"d-flex justify-space-between align-center py-2"},Or={class:"d-flex justify-center align-center text-h6 ga-2"},jr={class:"multi-color-icon","aria-hidden":"true"},Fr=["xlink:href"],Hr={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},Gr={class:"w-100 d-flex justify-start align-center"},Wr={class:"w-30 text-label font-weight-400"},Ur={class:"flex-1-1-0"},Yr={class:"w-100 d-flex justify-start align-center"},Zr={class:"w-30 text-label font-weight-400"},qr={class:"flex-1-1-0"},Xr={class:"w-100 d-flex justify-start align-center"},Kr={class:"w-30 text-label font-weight-400"},Jr={class:"flex-1-1-0"},Qr={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},$r={class:"w-100 d-flex justify-space-between align-center py-2"},el={class:"d-flex justify-center align-center text-h6 ga-2"},tl={class:"multi-color-icon","aria-hidden":"true"},ol=["xlink:href"],al={class:"w-100",style:{height:"244px"},ref:"tideEchart"},il={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},rl={class:"px-1 text-center text-label font-weight-400",width:"120"},ll={class:"px-1 text-center text-label font-weight-400",width:"120"},sl={class:"px-1 text-center text-label font-weight-400",width:"120"},nl={class:"px-1 text-center"},cl={class:"px-1 text-center"},ml={class:"px-1 text-center"};function dl(o,t,a,r,i,l){const s=e.resolveComponent("VBtn"),c=e.resolveComponent("v-card-title"),n=e.resolveComponent("v-divider"),h=e.resolveComponent("VBtnToggle"),d=e.resolveComponent("v-card");return e.openBlock(),e.createBlock(d,{class:e.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:e.withCtx(()=>{var g,f;return[e.createVNode(c,{class:"w-100"},{default:e.withCtx(()=>{var x;return[e.createElementVNode("div",Vr,[e.createElementVNode("div",Br,[e.createElementVNode("div",null,e.toDisplayString((x=a.station)==null?void 0:x.name),1)]),e.createVNode(s,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:e.withCtx(()=>t[1]||(t[1]=[e.createElementVNode("i",{class:"iconfont icon-close text-label text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),e.createElementVNode("div",Ir,[e.createElementVNode("div",null,e.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),e.createVNode(n,{class:"w-100"}),e.createElementVNode("div",{class:e.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[e.createElementVNode("div",Rr,[e.createElementVNode("div",Ar,[e.createElementVNode("div",Or,[(e.openBlock(),e.createElementBlock("svg",jr,[e.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Fr)])),e.createElementVNode("div",null,e.toDisplayString(o.$t("detail.summary")),1)])]),e.createElementVNode("div",Hr,[e.createElementVNode("div",Gr,[e.createElementVNode("div",Wr,e.toDisplayString(o.$t("tide.region")),1),e.createElementVNode("div",Ur,e.toDisplayString(((g=a.station)==null?void 0:g.Country)??((f=a.station)==null?void 0:f.city)??"-"),1)]),e.createElementVNode("div",Yr,[e.createElementVNode("div",Zr,e.toDisplayString(o.$t("tide.position")),1),e.createElementVNode("div",qr,e.toDisplayString(l.computePosition(a.station)),1)]),e.createElementVNode("div",Xr,[e.createElementVNode("div",Kr,e.toDisplayString(o.$t("time.localTime")),1),e.createElementVNode("div",Jr,e.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+e.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),e.createElementVNode("div",Qr,[e.createElementVNode("div",$r,[e.createElementVNode("div",el,[(e.openBlock(),e.createElementBlock("svg",tl,[e.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,ol)])),e.createElementVNode("div",null,e.toDisplayString(o.$t("tide.tideTimes")),1)]),t[2]||(t[2]=e.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),e.createElementVNode("div",{class:e.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4"])},[e.createVNode(h,{modelValue:i.currentIndex,"onUpdate:modelValue":t[0]||(t[0]=x=>i.currentIndex=x),class:"w-100 gray-bg-2 rounded d-flex justify-space-around align-center ga-0 px-1 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.dateList,x=>(e.openBlock(),e.createBlock(s,{class:"text-none text-body-1 rounded bg-none flex-1-1-0",density:"compact",color:"primary",height:"26",value:x.index},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.label),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"]),e.createElementVNode("div",al,null,512),e.createElementVNode("table",il,[e.createElementVNode("tbody",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",rl,e.toDisplayString(o.$t("tide.tide")),1),e.createElementVNode("th",ll,e.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),e.createElementVNode("th",sl,e.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tideTableData,(x,b)=>{var _;return e.openBlock(),e.createElementBlock("tr",{key:b},[e.createElementVNode("td",nl,e.toDisplayString(o.$t(`tide.${(_=x==null?void 0:x.type)==null?void 0:_.toLowerCase()}`))+" "+e.toDisplayString(o.$t("tide.tide")),1),e.createElementVNode("td",cl,e.toDisplayString(l.computeLocalTime(x==null?void 0:x.date,a.station,"MM-DD HH:mm")),1),e.createElementVNode("td",ml,e.toDisplayString((x==null?void 0:x.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const hl=O(Mr,[["render",dl],["__scopeId","data-v-02553a04"]]),Hd="",pl={name:"IdmTideStations",components:{TideDetail:hl},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,t,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.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 t=o.features[0];t.properties&&(this.station=t.properties,this.station.name=this.locale==="en"?t.properties.Location_EN:t.properties.Location_CN,this.station.lng=t.geometry.coordinates[0],this.station.lat=t.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const t=o.features[0];if(t.properties){this.showInfo=!0,this.hoverStation=t.properties,this.hoverStation.name=this.locale==="en"?t.properties.Location_EN:t.properties.Location_CN,this.hoverStation.lng=t.geometry.coordinates[0],this.hoverStation.lat=t.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new de.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}}},gl={class:"station-box d-flex flex-column justify-center align-start ga-1"},ul={class:"d-flex justify-start align-center"},fl={class:"d-flex justify-start align-center"},yl={class:"text-label"};function bl(o,t,a,r,i,l){const s=e.resolveComponent("v-card-text"),c=e.resolveComponent("v-card"),n=e.resolveComponent("TideDetail");return e.openBlock(),e.createElementBlock("div",null,[e.withDirectives(e.createVNode(c,{id:"idmTidalInfo"},{default:e.withCtx(()=>[e.createVNode(s,{class:"pr-8 text-body-1"},{default:e.withCtx(()=>{var h,d;return[e.createElementVNode("div",gl,[e.createElementVNode("div",ul,e.toDisplayString(o.$t("tide.tideStation")),1),e.createElementVNode("div",fl,[e.createElementVNode("label",yl,e.toDisplayString((h=i.hoverStation)==null?void 0:h.name)+" , "+e.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[e.vShow,i.showInfo]]),i.showDetail?(e.openBlock(),e.createBlock(n,e.mergeProps({key:0,station:i.station,onClose:l.handleCloseDetail},o.$attrs),null,16,["station","onClose"])):e.createCommentVNode("",!0)])}const wl=O(pl,[["render",bl],["__scopeId","data-v-7f9e02c0"]]),xl={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,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,t;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function _l(o,t,a,r,i,l){return null}const kl=O(xl,[["render",_l]]),Gd="",zl={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)"}},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=T.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=T.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${T.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${T.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,t;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.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 t=30;o>4?t=10:o>3&&(t=15);const a=[];for(let i=-60;i<90;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=t)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=t)for(let l=-60;l<90;l+=t)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 t;const o=this.handleComputeLatLngs();(t=this.map)==null||t.getSource(this.source).setData(V.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":.8,"text-color":this.lineColor}},this.beforeLayer)}},handleClear(){var o,t,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((t=this.map)==null||t.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 vl(o,t,a,r,i,l){var s,c,n;return a.simple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 text-caption text-right rounded",style:e.normalizeStyle({right:i.right+"px"})},[e.createElementVNode("div",null,e.toDisplayString((s=i.lngLat)==null?void 0:s.lat),1),e.createElementVNode("div",null,e.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),e.createElementVNode("div",null,e.toDisplayString((n=i.lngLat)==null?void 0:n.str),1)],4))}const fo=O(zl,[["render",vl]]),Wd="",Ll={name:"IdmFollowPort",components:{PortDetail:go},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},setup(){return{Theme:le.useTheme()}},emits:["closeAllDetail"],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,t,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.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,t,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var t,a;const o={features:[],type:"FeatureCollection"};(t=this.followList)==null||t.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,s={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(s)}}),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,t,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),(t=this.map)==null||t.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const t=o.features[0];this.portId=t.properties.id,t.properties.id&&(this.port=t.properties,this.port.lng=t.geometry.coordinates[0],this.port.lat=t.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const t=o.features[0];if(t.properties.id){this.showInfo=!0,this.hoverPort=t.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new de.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}}},Cl={class:"port-box d-flex flex-column justify-center align-start ga-1"},Pl={class:"d-flex justify-start align-center text-label"},Sl={class:"d-flex justify-start align-center text-label"};function Nl(o,t,a,r,i,l){const s=e.resolveComponent("v-card-text"),c=e.resolveComponent("v-card"),n=e.resolveComponent("PortDetail");return e.openBlock(),e.createElementBlock("div",null,[e.withDirectives(e.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-body-1 pr-8"},{default:e.withCtx(()=>[e.createElementVNode("div",Cl,[e.createElementVNode("div",null,e.toDisplayString(o.$t("port.port")),1),e.createElementVNode("div",Pl,[e.createElementVNode("span",null,e.toDisplayString(i.hoverPort.name??"-"),1)]),e.createElementVNode("div",Sl,[t[1]||(t[1]=e.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[e.vShow,i.showInfo]]),i.showDetail?(e.openBlock(),e.createBlock(n,e.mergeProps({key:0,portId:i.portId,port:i.port,forecastModel:a.forecastModel,followList:a.followList,onClose:l.handleCloseDetail,onCloseAllDetail:t[0]||(t[0]=h=>o.$emit("closeAllDetail",{followPort:!0}))},o.$attrs),null,16,["portId","port","forecastModel","followList","onClose"])):e.createCommentVNode("",!0)])}const Tl=O(Ll,[["render",Nl],["__scopeId","data-v-95e70a1f"]]),Ud="",Dl={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:le.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)?"-":T.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+T.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,t,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.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,t,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(t=this.map)==null||t.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var t,a;const o={features:[],type:"FeatureCollection"};(t=this.followList)==null||t.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,t,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),(t=this.map)==null||t.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,s,c,n,h,d;const t=o.features[0];if(t.properties){const g=t.properties;g.lng=t.geometry.coordinates[0],g.lat=t.geometry.coordinates[1];const f=v(),x=(a=v(this.realTime))==null?void 0:a.diff(f,"d",!0),b={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};x>=0?(s=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||s.fetchForecastData(b):(d=(h=(n=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:n.$refs)==null?void 0:h.idmSpot)==null||d.fetchHistoryData(b)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const t=o.features[0];if(t.properties.id){this.showInfo=!0,this.position=t.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new de.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"}}},El={class:"position-box d-flex flex-column justify-center align-start ga-1"},Ml={class:"d-flex justify-start align-center text-label"},Vl={key:0,class:"d-flex justify-start align-center text-label"};function Bl(o,t,a,r,i,l){const s=e.resolveComponent("v-card-text"),c=e.resolveComponent("v-card");return e.withDirectives((e.openBlock(),e.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-body-1 pr-8"},{default:e.withCtx(()=>[e.createElementVNode("div",El,[t[0]||(t[0]=e.createElementVNode("div",null,"Location",-1)),e.createElementVNode("div",Ml,[e.createElementVNode("span",null,e.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(e.openBlock(),e.createElementBlock("div",Vl,[e.createElementVNode("span",null,e.toDisplayString(i.position.remark??"-"),1)])):e.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[e.vShow,i.showInfo]])}const Il=O(Dl,[["render",Bl],["__scopeId","data-v-82405c68"]]),Yd="",Rl={name:"IdmOtherLayerr",components:{IdmWarZone:Ga,IdmGmdssArea:Ya,IdmEcaZone:Xa,IdmAlertZone:$a,IdmPort:nr,IdmLoadLine:dr,IdmTimezone:gr,IdmVRA:yr,IdmSpecialArea:xr,IdmTerminator:zr,IdmWorld12nm:Cr,IdmWorldMarine:Nr,IdmChinaRoute:Er,IdmTideStations:wl,IdmIceAreas:kl,IdmLatLng:fo,IdmFollowPort:Tl,IdmFollowPosition:Il},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")||"light",tagLayers:[...Be.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,t){o&&t&&o!==t&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark"},immediate:!0},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,t){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=>!(t!=null&&t.includes(l))),r=t==null?void 0:t.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>t==null?void 0:t.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(s=>this.checkList.includes(s.key)&&!i.includes(s.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 t=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(t||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),t=localStorage.getItem(this.cache.mapFeatherKey);const a=t||"light";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.$emit("map",void 0),this.mapFeather=o.value},async fetchOtherLayers(){var t,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await J.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((t=i==null?void 0:i.data)==null?void 0:t.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,s=[];for(const n in l)s.push(J.get(l[n],{headers:{Authorization:this.defaultMeteoToken,key:n}}));(await Promise.all(s)).map(n=>{var g,f,x;const h=((g=n==null?void 0:n.data)==null?void 0:g.data)||(n==null?void 0:n.data),d=(x=(f=n==null?void 0:n.config)==null?void 0:f.headers)==null?void 0:x.key;this.otherLayers[d]=h})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],t=await J.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=t==null?void 0:t.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=t==null?void 0:t.data)==null?void 0:r.data)||(t==null?void 0:t.data))},handleLayersChange(o){const t=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=t,this.fetchOtherLayers()}}},Al={class:"idm-gl4-other-layer"},Ol={class:"header-box d-flex justify-space-between align-center px-4"},jl={class:"text-h5 font-weight-medium"},Fl={class:"list-box scroll pl-4 pr-2 overflow-y-auto"},Hl={class:"layers-body mt-4 d-flex justify-start align-center flex-wrap"},Gl=["onClick"],Wl={key:0,src:"https://osshz.idmwx.com/asset/dark-map.png",class:"border rounded-sm"},Ul={key:1,src:"https://osshz.idmwx.com/asset/nautical-map.png",class:"border rounded-sm"},Yl={key:2,src:"https://osshz.idmwx.com/asset/satellite-map.png",class:"border rounded-sm"},Zl={key:3,src:"https://osshz.idmwx.com/asset/light-map.png",class:"border rounded-sm"},ql={class:"text-body-2 text-center pt-1"};function Xl(o,t,a,r,i,l){var F,Q,$,ie,q,ee,re,te,oe;const s=e.resolveComponent("VBtn"),c=e.resolveComponent("VTooltip"),n=e.resolveComponent("VCardTitle"),h=e.resolveComponent("VCardItem"),d=e.resolveComponent("VCheckbox"),g=e.resolveComponent("VCardText"),f=e.resolveComponent("VCard"),x=e.resolveComponent("IdmLatLng"),b=e.resolveComponent("IdmTerminator"),_=e.resolveComponent("IdmTimezone"),p=e.resolveComponent("IdmPort"),S=e.resolveComponent("IdmAlertZone"),L=e.resolveComponent("IdmTideStations"),k=e.resolveComponent("IdmEcaZone"),w=e.resolveComponent("IdmWarZone"),u=e.resolveComponent("IdmGmdssArea"),z=e.resolveComponent("IdmLoadLine"),y=e.resolveComponent("IdmWorldMarine"),C=e.resolveComponent("IdmVRA"),E=e.resolveComponent("IdmSpecialArea"),R=e.resolveComponent("IdmWorld12nm"),j=e.resolveComponent("IdmChinaRoute"),A=e.resolveComponent("IdmIceAreas"),G=e.resolveComponent("IdmFollowPort"),W=e.resolveComponent("IdmFollowPosition");return e.openBlock(),e.createElementBlock("div",Al,[e.createElementVNode("div",{class:"menu-bar-box transition px-1 rounded",style:e.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[e.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left"},{activator:e.withCtx(({props:P})=>[e.createVNode(s,e.mergeProps(P,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:e.withCtx(()=>t[5]||(t[5]=[e.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text"])],4),e.createElementVNode("div",{class:e.normalizeClass(["available-layers transition",i.toggle?"right-bar":""]),style:e.normalizeStyle(l.listStyle)},[e.createElementVNode("div",Ol,[e.createElementVNode("div",jl,e.toDisplayString(o.$t("layer.layers")),1),e.createVNode(s,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:e.withCtx(()=>t[6]||(t[6]=[e.createElementVNode("i",{class:"iconfont icon-close text-label text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),e.createElementVNode("div",Fl,[e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"pb-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Hl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.mapFeathers,P=>(e.openBlock(),e.createElementBlock("div",{key:P.value,class:"mb-2 feather-item",onClick:U=>l.handleToggleMapFeather(P)},[e.createElementVNode("div",{class:e.normalizeClass([i.mapFeather===P.value?"active":"","img-box"])},[P.value==="dark"?(e.openBlock(),e.createElementBlock("img",Wl)):P.value==="nautical"?(e.openBlock(),e.createElementBlock("img",Ul)):P.value==="satellite"?(e.openBlock(),e.createElementBlock("img",Yl)):(e.openBlock(),e.createElementBlock("img",Zl))],2),e.createElementVNode("div",ql,e.toDisplayString(o.$t(`layer.${P.locale}`)),1)],8,Gl))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(P=>["graticule","day-night","time-zones"].includes(P.key)),P=>(e.openBlock(),e.createBlock(d,{key:P.key,modelValue:i.checkList,"onUpdate:modelValue":t[0]||(t[0]=U=>i.checkList=U),value:P.key,label:o.$t(`layer.${P.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}),e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(P=>["ports","alert-zones","tidal-stations"].includes(P.key)),P=>(e.openBlock(),e.createBlock(d,{key:P.key,modelValue:i.checkList,"onUpdate:modelValue":t[1]||(t[1]=U=>i.checkList=U),value:P.key,label:o.$t(`layer.${P.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}),e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"py-2"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(P=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(P.key)),P=>(e.openBlock(),e.createBlock(d,{key:P.key,modelValue:i.checkList,"onUpdate:modelValue":t[2]||(t[2]=U=>i.checkList=U),value:P.key,label:o.$t(`layer.${P.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}),e.createVNode(f,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(n,{class:"text-subtitle-1 font-weight-medium",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),e.createVNode(g,{class:"py-2"},{default:e.withCtx(()=>[e.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":t[3]||(t[3]=P=>i.checkList=P),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"]),e.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":t[4]||(t[4]=P=>i.checkList=P),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})])],6),a.map?(e.openBlock(),e.createBlock(x,e.mergeProps({key:0,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs),null,16,["simple","map","menu-toggle","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(b,e.mergeProps({key:1,map:a.map,area:(F=i.otherLayers)==null?void 0:F["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(_,e.mergeProps({key:2,map:a.map,zone:(Q=i.otherLayers)==null?void 0:Q["time-zones"],realTime:a.realTime},o.$attrs,{beforeLayer:"empty-layer-3"}),null,16,["map","zone","realTime"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(p,e.mergeProps({key:3,ref:"idmPorts",simple:a.simple,map:a.map,ports:($=i.otherLayers)==null?void 0:$.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,realTime:a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","realTime","theme"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(S,e.mergeProps({key:4,map:a.map,simple:a.simple,zone:(ie=i.otherLayers)==null?void 0:ie["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(L,e.mergeProps({key:5,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,defaultMeteoToken:a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,realTime:a.realTime,forecastModel:a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","defaultMeteoToken","show","theme","realTime","forecastModel"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(k,e.mergeProps({key:6,map:a.map,zone:(q=i.otherLayers)==null?void 0:q["eca-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(w,e.mergeProps({key:7,map:a.map,zone:(ee=i.otherLayers)==null?void 0:ee["war-zones"]},o.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(u,e.mergeProps({key:8,map:a.map,area:(re=i.otherLayers)==null?void 0:re["gmdss-areas"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(z,e.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(y,e.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(C,e.mergeProps({key:11,map:a.map,area:(te=i.otherLayers)==null?void 0:te["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(E,e.mergeProps({key:12,map:a.map,area:(oe=i.otherLayers)==null?void 0:oe["special-area"]},o.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(R,e.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(j,e.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(A,e.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(G,e.mergeProps({key:16,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,realTime:a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","realTime"])):e.createCommentVNode("",!0),a.map?(e.openBlock(),e.createBlock(W,e.mergeProps({key:17,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,realTime:a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","realTime"])):e.createCommentVNode("",!0)])}const Kl=O(Rl,[["render",Xl]]);class uo{constructor(t){ae(this,"map");ae(this,"mercator");ae(this,"rampColorLayer");ae(this,"rampColorSource");ae(this,"particleLayer");ae(this,"particleSource");ae(this,"rampColorCanvas");ae(this,"particleCanvas");ae(this,"ratio");this.map=t,this.mercator=new Oa,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(t,a=0){return t>180?this.convertNLng(t-360,a+1):t<-180?this.convertNLng(t+360,a+1):[t,a]}getBoundLngLat(){var a;const t=(a=this.map)==null?void 0:a.getBounds();return t?[[t._sw.lng,t._ne.lat],[t._ne.lng,t._ne.lat],[t._ne.lng,t._sw.lat],[t._sw.lng,t._sw.lat]]:[]}getBoundPixel(){var b,_;const t=(b=this.map)==null?void 0:b.getBounds();if(!t)return[];const a=((_=this.map)==null?void 0:_.getZoom())+1,r=[t._ne.lng,t._ne.lat],i=[t._sw.lng,t._sw.lat],[l,s]=this.convertNLng(r[0]),[c,n]=this.convertNLng(i[0]),[h,d]=this.mercator.px([l,r[1]],a),[g,f]=this.mercator.px([c,i[1]],a),x=Math.round(this.mercator.size*Math.pow(2,a)*(s+n));return[g,f,h+x,d]}getBoundRange(){const t=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,t),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(t,a){const r=2**a,[i,l,s,c]=t.map(d=>~~(d/(r*256))),n=[];for(let d=c;d<=l;d++)for(let g=i;g<=s;g++)n.push([g,d]);return n.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let t=this.map.getSource(this.rampColorSource);t.setCoordinates(this.getBoundLngLat()),t=this.map.getSource(this.particleSource),t.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(t){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(t){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=t?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class _e{createShader(t,a,r){const i=t.createShader(a);if(i&&(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)))throw new Error(t.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(t,a,r,i,l,s,c){const n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,i),l instanceof Uint8Array?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,c,0,t.RGBA,t.UNSIGNED_BYTE,l):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,l),t.bindTexture(t.TEXTURE_2D,null),n}createDataBuffer(t,a,r){if(t){const i=t.createBuffer();return a==="array"?(t.bindBuffer(t.ARRAY_BUFFER,i),r&&t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW)):a==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),r&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW)),i}return null}createProgram(t,a,r){const i=t.createProgram(),l=this.createShader(t,t.VERTEX_SHADER,a),s=this.createShader(t,t.FRAGMENT_SHADER,r);if(i&&l&&s&&(t.attachShader(i,l),t.attachShader(i,s),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS)))throw new Error(t.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(t,a,r){const i=this.createProgram(t,a,r);if(i){const l={program:i},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){const h=t.getActiveAttrib(i,n);l[h.name]=t.getAttribLocation(i,h.name)}const c=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let n=0;n<c;n++){const h=t.getActiveUniform(i,n);l[h.name]=t.getUniformLocation(i,h.name)}return l}}setup(t,a,r=!1,i,l){const s=document.createElement("canvas");s.width=256,s.height=1;const c=s.getContext("2d");if(c&&t){const n=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([h,d])=>{n.addColorStop(h,d)}),c.fillStyle=n,c.fillRect(0,0,256,1),{canvas:s,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):s,i,l)}}}setupParticle(t,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 s=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(t,t.NEAREST,t.NEAREST,t.CLAMP_TO_EDGE,l,r,r),n=new Float32Array(i);for(let d=0;d<i;d++)n[d]=d;const h=this.createDataBuffer(t,"array",n);return{resolution:r,total:i,texture0:s,texture1:c,indexBuffer:h}}bind(t,a,r){const i=this.createProgram(t,a,r);if(i){const l=this.createDataBuffer(t,"array",void 0),s=t.getAttribLocation(i,"a_position");t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(t,"array",c);const n=t.getAttribLocation(i,"a_texCoord");return t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(t,a,r,i,l,s){const c=this.createProgramWrapper(t,a,r),n=this.createProgramWrapper(t,i,l),h=this.createProgramWrapper(t,i,s),d=this.createDataBuffer(t,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=t.createFramebuffer();return{particle:c,screen:n,update:h,quadBuffer:d,frameBuffer:g}}draw(t,a,r,i,l,s,c){var n,h;if(a&&r){t.resize(),a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(h=a==null?void 0:a.canvas)==null?void 0:h.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*t.ratio,a.canvas.height*t.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=t.getBoundPixel(),f=t.map.getZoom()+1,x=t.getWorldCopy(g,f);for(const b of x){const _=(b[0]-g[0])*t.ratio,p=(b[1]-g[3])*t.ratio,S=b[2]*t.ratio,[L,k,w,u]=[_,S+_,p,S+p],z=new Float32Array([L,w,k,w,L,u,L,u,k,w,k,u]);a.bindBuffer(a.ARRAY_BUFFER,s),a.bufferData(a.ARRAY_BUFFER,z,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(t,a,r,i,l){var s,c;a&&(a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.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(t,a,i,l),this.updateParticles(t,a,i,l))}renderScreen(t,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(t,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(t,a,r,i,l){t&&(t.useProgram(r.program),t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(r.a_pos),t.vertexAttribPointer(r.a_pos,2,t.FLOAT,!1,0,0),t.activeTexture(t.TEXTURE2),t.bindTexture(t.TEXTURE_2D,a),t.uniform1i(r.u_screen,2),t.uniform1f(r.u_opacity,l),t.drawArrays(t.TRIANGLES,0,6))}renderParticles(t,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*t.ratio),a.uniform1f(r.particle.u_point,t.ratio);const l=t.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(t,a,r,i){var s,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 n=t.getBoundRange();a.uniform4f(r.update.u_viewport,n[0],n[1],n[2],n[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(s=r==null?void 0:r.image)==null?void 0:s.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*t.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(t,a){t.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(t){return new Promise(a=>{const r=new Blob([t],{type:t.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class K{}ae(K,"vertexSchema",`
|
|
11
11
|
//canvas 坐标系上的坐标 (x, y)
|
|
12
12
|
attribute vec2 a_position; //像素坐标
|
|
13
13
|
attribute vec2 a_texCoord; //纹理坐标
|