@idmwx/idmui-gl4 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1535,7 +1535,7 @@ const Xa = {
1535
1535
  },
1536
1536
  theme: {
1537
1537
  handler() {
1538
- this.mapFeather = this.theme === "light" ? "light" : "dark";
1538
+ this.theme === "light" ? this.mapFeather = ["light", "nautical"].includes(this.mapFeather) ? this.mapFeather : "light" : this.mapFeather = ["dark", "nautical"].includes(this.mapFeather) ? this.mapFeather : "dark";
1539
1539
  },
1540
1540
  immediate: !0
1541
1541
  },
@@ -1,4 +1,4 @@
1
- (function(G,Q){typeof exports=="object"&&typeof module<"u"?Q(exports,require("axios"),require("vue"),require("mapbox-gl"),require("@idm-plugin/geo"),require("@turf/turf"),require("@idm-plugin/tag-nop"),require("moment"),require("@mapbox/sphericalmercator"),require("@idm-plugin/tag"),require("@idm-plugin/meteo"),require("vuetify")):typeof define=="function"&&define.amd?define(["exports","axios","vue","mapbox-gl","@idm-plugin/geo","@turf/turf","@idm-plugin/tag-nop","moment","@mapbox/sphericalmercator","@idm-plugin/tag","@idm-plugin/meteo","vuetify"],Q):(G=typeof globalThis<"u"?globalThis:G||self,Q(G["idm-gl"]={},G.axios,G.Vue,G["mapbox-gl"],G["@idm-plugin/geo"],G["@turf/turf"],G["@idm-plugin/tag-nop"],G.moment,G["@mapbox/sphericalmercator"],G["@idm-plugin/tag"],G["@idm-plugin/meteo"],G.vuetify))})(this,function(G,Q,e,he,V,No,Pe,P,Mo,Eo,Re,Bo){"use strict";var Al=Object.defineProperty;var Vl=(G,Q,e)=>Q in G?Al(G,Q,{enumerable:!0,configurable:!0,writable:!0,value:e}):G[Q]=e;var J=(G,Q,e)=>(Vl(G,typeof Q!="symbol"?Q+"":Q,e),e);function Do(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const N=Do(No),O=(a,t)=>{const o=a.__vccOpts||a;for(const[r,i]of t)o[r]=i;return o},Ro={name:"IdmWarZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"war-zone-source",zoneLayer:"war-zone-layer",zoneLabelLayer:"war-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-color":"#f44336","fill-opacity":.4}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":1,"line-color":"#f44336"}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-1]},paint:{"icon-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Io(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Ao=O(Ro,[["render",Io]]),Vo={name:"IdmGmdssArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"gmdss-area-source",areaLayer:"gmdss-area-layer",areaLabelLayer:"gmdss-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","val"],"AreaI","#EB8996","AreaII","#6F448B","AreaIII","#3E8BD3","AreaIV","#5EBCC4","AreaV","#00AAE7","AreaVI","#9CCE6D","AreaVII","#F4AE00","AreaVIII","#EF9A85","AreaIX","#00AAA7","AreaX","#7AC49F","AreaXI","#DFDFDF","AreaXII","#FFF974","AreaXIII","#EF9A85","AreaXIV","#86A2D1","AreaXV","#EC8972","AreaXVI","#EAC2DA","AreaXVII","#B9C8E7","AreaXVIII","#BBA1C8","AreaXIX","#FAE0BD","AreaXX","#DBECC8","AreaXXI","#D496AF","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,-3.5]},paint:{"icon-opacity":.8,"text-opacity":.8,"text-color":"#000"}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Oo(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const jo=O(Vo,[["render",Oo]]),Fo={name:"IdmEcaZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String},activeWeatherLayers:{type:Array}},data(){return{source:"eca-zone-source",zoneLayer:"eca-zone-layer",zoneLabelLayer:"eca-zone-label-layer"}},watch:{zone:{handler(){this.zone?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.zone):(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"fill-outline-color":"silver","fill-opacity":.3,"fill-color":"#05f324"}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-color":"#05f324","line-width":1,"line-opacity":1}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","text-max-width":16,"text-justify":"left","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-3.5]},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ho(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Go=O(Fo,[["render",Ho]]),Ol="",Wo={name:"IdmAlertZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"alert-zone-source",polygonLayer:"alert-zone-polygon-layer",polygonLabelLayer:"alert-zone-polygon-label-layer",lineLayer:"alert-zone-line-layer",lineLabelLayer:"alert-zone-line-label-layer",pointLayer:"alert-zone-point-layer",showZone:!1,form:{}}},watch:{zone:{handler(){var a,t;this.zone?(this.handleRender(),(a=this.map)==null||a.on("click",[this.polygonLabelLayer,this.lineLabelLayer,this.pointLayer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.polygonLabelLayer,this.lineLabelLayer,this.pointLayer],this.handleClick))},immediate:!0}},methods:{handleClick(a){var r;const t=a.features[0],o=(r=this.zone)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(o){this.showZone=!0,this.form={...o.properties};const i=document.getElementById("idm-gl4-zone-info");this.marker?this.marker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.marker=new he.Marker(i).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([0,0]).addTo(this.map)}},handleRender(){var a;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.zone):(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.polygonLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"fill-outline-color":"#d57d02","fill-opacity":.4,"fill-color":"#d57d02"}},this.beforeLayer),this.map.addLayer({id:this.polygonLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-width":1,"line-color":"#d57d02"}},this.beforeLayer),this.map.addLayer({id:this.lineLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],paint:{"line-color":"#d57d02","line-width":2}},this.beforeLayer),this.map.addLayer({id:this.polygonLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"alert","icon-size":.08,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],layout:{"symbol-placement":"line-center","icon-image":"alert","icon-size":.08,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.pointLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"alert","icon-size":.08},paint:{"icon-opacity":.8}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.polygonLayer)&&this.map.removeLayer(this.polygonLayer),this.map.getLayer(this.polygonLayer+"-border")&&this.map.removeLayer(this.polygonLayer+"-border"),this.map.getLayer(this.polygonLabelLayer)&&this.map.removeLayer(this.polygonLabelLayer),this.map.getLayer(this.lineLayer)&&this.map.removeLayer(this.lineLayer),this.map.getLayer(this.lineLabelLayer)&&this.map.removeLayer(this.lineLabelLayer),this.map.getLayer(this.pointLayer)&&this.map.removeLayer(this.pointLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}},Uo={id:"idm-gl4-zone-info"},Yo=["innerHTML"];function Zo(a,t,o,r,i,l){var n;return e.withDirectives((e.openBlock(),e.createElementBlock("div",Uo,[e.createElementVNode("div",{class:"iconfont close",onClick:t[0]||(t[0]=c=>i.showZone=!1)},""),e.createElementVNode("div",{class:"rich-context",innerHTML:(n=i.form)==null?void 0:n.name},null,8,Yo)],512)),[[e.vShow,i.showZone]])}const Xo=O(Wo,[["render",Zo]]),jl="",qo={name:"IdmPort",props:{map:{type:Object},port:{type:Object},beforeLayer:{type:String},forecastModel:{type:String}},emits:["meteoMore"],data(){return{source:"port-source",layer:"port-layer",showPort:!1,form:{},marker:void 0}},computed:{computeLat(){return function(a){return V.LngLatHelper.lat2pretty(a,4).pretty}},computeLng(){return function(a){return V.LngLatHelper.lng2pretty(a,4).pretty}}},watch:{port:{handler(){var a,t;this.port?(this.handleRender(),(a=this.map)==null||a.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))},immediate:!0}},methods:{handleClick(a){var r;const t=a.features[0],o=(r=this.port)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(o){this.showPort=!0,this.form={...o.properties},this.form.lng=o.geometry.coordinates[0],this.form.lat=o.geometry.coordinates[1];const i=document.getElementById("port-info");this.marker?this.marker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.marker=new he.Marker(i).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([0,-85]).addTo(this.map)}},handleRender(){var a;this.map?this.port&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.port):(this.map.addSource(this.source,{type:"geojson",data:this.port}),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","text-anchor":"left","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[1,0]},paint:{"text-color":"rgba(0, 0, 0, 0.8)","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.showPort=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},handleClickMeteo(a){a.forecastModel=this.forecastModel,this.$emit("meteoMore",a)}}},Ko={ref:"idmPortInfo",id:"port-info"},Jo={class:"port-box"},Qo={class:"flex-start"},$o={class:"flex-start"},ea={class:"flex-start"},ta={class:"flex-start",style:{"align-items":"flex-start"}},oa={class:"meteo-forecast flex-end"};function aa(a,t,o,r,i,l){return e.withDirectives((e.openBlock(),e.createElementBlock("div",Ko,[e.createElementVNode("div",{class:"close iconfont",onClick:t[0]||(t[0]=n=>i.showPort=!1)},""),e.createElementVNode("div",Jo,[e.createElementVNode("div",Qo,[t[2]||(t[2]=e.createElementVNode("label",null,"Name : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.name),1)]),e.createElementVNode("div",$o,[t[3]||(t[3]=e.createElementVNode("label",null,"Position : ",-1)),e.createElementVNode("span",null,e.toDisplayString(l.computeLat(i.form.lat))+", "+e.toDisplayString(l.computeLng(i.form.lng)),1)]),e.createElementVNode("div",ea,[t[4]||(t[4]=e.createElementVNode("label",null,"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.loCode||"-"),1)]),e.createElementVNode("div",ta,[t[5]||(t[5]=e.createElementVNode("label",null,"Region : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.zoneName||"-"),1)]),e.createElementVNode("div",oa,[e.createElementVNode("span",{onClick:t[1]||(t[1]=n=>l.handleClickMeteo(i.form))},"Meteo Forecast")])])],512)),[[e.vShow,i.showPort]])}const ia=O(qo,[["render",aa],["__scopeId","data-v-62f79fef"]]),ra={name:"IdmLoadLine",props:{map:{type:Object},line:{type:Object},beforeLayer:{type:String}},data(){return{source:"load-line-source",lineLayer:"load-line-layer",lineLabelLayer:"load-line-label-layer"}},watch:{line:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.line&&(this.map.addSource(this.source,{type:"geojson",data:this.line}),this.map.addLayer({id:this.lineLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.75,"fill-color":["match",["get","val"],"LLGreen","#A0C0C0","LLRed","#F5A39D","LLBlue","#6B94E4","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{lbl} (Length < {shipLength}, {start} - {end})","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":.8}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.lineLayer)&&this.map.removeLayer(this.lineLayer),this.map.getLayer(this.lineLabelLayer)&&this.map.removeLayer(this.lineLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function la(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const na=O(ra,[["render",la]]),sa={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneLabelLayer:"time-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","offSet"],"-11.5","rgba(255,0,0,0.4)","-11","rgba(0,255,0,0.3)","-10.5","rgba(0,255,0,0.3)","-10","rgba(0,0,255,0.3)","-9.5","rgba(0,0,255,0.3)","-9","rgba(255,0,0,0.4)","-8.5","rgba(255,0,0,0.4)","-8","rgba(0,255,0,0.3)","-7.5","rgba(0,255,0,0.3)","-7","rgba(0,0,255,0.3)","-6.5","rgba(0,0,255,0.3)","-6","rgba(255,0,0,0.4)","-5.5","rgba(255,0,0,0.4)","-5","rgba(0,255,0,0.3)","-4.5","rgba(0,255,0,0.3)","-4","rgba(0,0,255,0.3)","-3.5","rgba(0,0,255,0.3)","-3","rgba(255,0,0,0.4)","-2.5","rgba(255,0,0,0.4)","-2","rgba(0,255,0,0.3)","-1.5","rgba(0,255,0,0.3)","-1","rgba(0,0,255,0.3)","-0.5","rgba(0,0,255,0.3)","+0","rgba(255,0,0,0.4)","+0.5","rgba(255,0,0,0.4)","+1","rgba(0,255,0,0.3)","+1.5","rgba(0,255,0,0.3)","+2","rgba(0,0,255,0.3)","+2.5","rgba(0,0,255,0.3)","+3","rgba(255,0,0,0.4)","+3.5","rgba(255,0,0,0.4)","+4","rgba(0,255,0,0.3)","+4.5","rgba(0,255,0,0.3)","+5","rgba(0,0,255,0.3)","+5.5","rgba(0,0,255,0.3)","+6","rgba(255,0,0,0.4)","+6.5","rgba(255,0,0,0.4)","+7","rgba(0,255,0,0.3)","+7.5","rgba(0,255,0,0.3)","+8","rgba(0,0,255,0.3)","+8.5","rgba(0,0,255,0.3)","+9","rgba(255,0,0,0.4)","+9.5","rgba(255,0,0,0.4)","+10","rgba(0,255,0,0.3)","+10.5","rgba(0,255,0,0.3)","+11","rgba(0,0,255,0.3)","+11.5","rgba(0,0,255,0.3)","rgba(255,0,0,0.4)"]}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{offSet}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1]},paint:{"text-opacity":.8,"text-color":"#fff"}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ca(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const ma=O(sa,[["render",ca]]),da={name:"IdmVoluntaryReportingArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"vra-source",areaLayer:"vra-layer",areaLabelLayer:"vra-label-layer"}},watch:{area:{handler(){this.area?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.4,"fill-color":"#9f30f9"}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":1,"line-color":"#9f30f9"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-3.5]},paint:{"icon-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ha(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const pa=O(da,[["render",ha]]),ga={name:"IdmSpecialArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"special-area-source",areaLayer:"special-area-layer",areaLabelLayer:"special-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.area.features.forEach(a=>{a.geometry.type==="Polygon"&&a.geometry.coordinates.forEach(t=>V.LngLatHelper.convertToMonotonicLng2(t))}),this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.4,"fill-color":["match",["get","val"],"DefaultStyle","rgb(0,0,0)","JWCriskArea","rgb(0,0,0)","rgb(0,0,0)"]}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.4,"line-color":"rgb(0,0,0)"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-3.5]},paint:{"icon-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ua(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const fa=O(ga,[["render",ua]]),ya={name:"IdmTerminator",props:{map:{type:Object},mapFeather:{type:String},area:{type:Object}},data(){return{source:"terminator-source",layer:"terminator-layer"}},computed:{layerColor(){return["satellite","dark"].includes(this.mapFeather),"rgba(0, 0, 0, 0.2)"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.layer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-color":this.layerColor}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ba(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const wa=O(ya,[["render",ba]]),xa={name:"IdmWorld12nm",props:{map:{type:Object},show:{type:Boolean},weatherLayers:{type:Object,default:()=>({})},zoom:{type:Number,default:3},left:{type:String,default:"10px"},bottom:{type:String,default:"64px"},token:{type:String,default:""}},data(){return{layer:"world-12nm-v4-20231025"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a;this.map?(a=this.map)!=null&&a.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setPaintProperty(this.layer,"line-color","rgb(210,54,83)"),this.map.setPaintProperty(this.layer,"line-width",2)):setTimeout(()=>{this.handleRender()},500)},handleClear(){var a;(a=this.map)!=null&&a.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}};function _a(a,t,o,r,i,l){return null}const ka=O(xa,[["render",_a]]),Fl="",za={name:"IdmWorldMarine",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"ne-10m-label",lineLayer:"ne-10m-outline"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a,t;this.map?((a=this.map)!=null&&a.getLayer(this.lineLayer)&&(this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),this.map.setPaintProperty(this.lineLayer,"line-width",1)),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var a,t;(a=this.map)!=null&&a.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function va(a,t,o,r,i,l){return null}const La=O(za,[["render",va]]),Ca={name:"IdmChinaRoute",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"china-route-label",lineLayer:"china-route-line",fillLayer:"china-route-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a,t,o;this.map?((a=this.map)!=null&&a.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"),(o=this.map)!=null&&o.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var a,t,o;(a=this.map)!=null&&a.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"),(o=this.map)!=null&&o.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function Pa(a,t,o,r,i,l){return null}const Sa=O(Ca,[["render",Pa]]),Hl="",Ta={name:"IdmLatLng",props:{map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:void 0,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 a;this.map&&((a=this.map)==null||a.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var a;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10},immediate:!0}},methods:{handleBind(){var a,t;this.show?((a=this.map)==null||a.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.off("zoomend",this.handleZoomEnd))},handleMouseMove(a){const t=a.lngLat,o=V.LngLatHelper.lng2pretty(t.lng,2),r=V.LngLatHelper.lat2pretty(t.lat,2),i=`[${t.lng.toFixed(4)}, ${t.lat.toFixed(4)}]`;this.lngLat={lng:o,lat:r,str:i}},handleComputeLatLngs(){var r;const a=(r=this.map)==null?void 0:r.getZoom();let t=30;a>4?t=10:a>3&&(t=15);const o=[];for(let i=-60;i<90;i+=t)o.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=t)o.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)o.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 o},handleZoomEnd(){var t;const a=this.handleComputeLatLngs();(t=this.map)==null||t.getSource(this.source).setData(N.featureCollection(a))},handleRender(){if(this.handleClear(),this.map){const a=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:a}}),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 a,t,o,r,i,l;(a=this.map)!=null&&a.getLayer(this.layer)&&((t=this.map)==null||t.removeLayer(this.layer)),(o=this.map)!=null&&o.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 Na(a,t,o,r,i,l){var n,c,s,h,d;return e.openBlock(),e.createElementBlock("div",{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((c=(n=i.lngLat)==null?void 0:n.lat)==null?void 0:c.pretty),1),e.createElementVNode("div",null,e.toDisplayString((h=(s=i.lngLat)==null?void 0:s.lng)==null?void 0:h.pretty),1),e.createElementVNode("div",null,e.toDisplayString((d=i.lngLat)==null?void 0:d.str),1)],4)}const Ie=O(Ta,[["render",Na]]),Gl="",Ma={name:"IdmOtherLayerr",components:{IdmWarZone:Ao,IdmGmdssArea:jo,IdmEcaZone:Go,IdmAlertZone:Xo,IdmPort:ia,IdmLoadLine:na,IdmTimezone:ma,IdmVRA:pa,IdmSpecialArea:fa,IdmTerminator:wa,IdmWorld12nm:ka,IdmWorldMarine:La,IdmChinaRoute:Sa,IdmLatLng:Ie},props:{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},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"light",tagLayers:[...Pe.LayerHelper.OTHER_LAYERS.filter(a=>a.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.1",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:[],followList:[]}},computed:{computeLayerClass(){return function(a,t){let o="layer flex-between";return t.some(r=>r.key===a.key)&&(o=o+" active"),o}}},watch:{isLogin:{handler(){this.isLogin&&this.fetchOtherLayers()},immediate:!0},"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var a;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10})},immediate:!0},theme:{handler(){this.mapFeather=this.theme==="light"?"light":"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(){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(a=>this.checkList.includes(a.key))||[],this.handleLayersChange()}},followList:{handler(){localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),this.$emit("followLayerList",this.followList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const a=localStorage.getItem(this.cache.versionKey);this.cache.v!==a&&(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.followListKey),this.followList=JSON.parse(t||"[]"),localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),t=localStorage.getItem(this.cache.mapFeatherKey);const o=t||"light";this.$emit("mapFeather",o),localStorage.setItem(this.cache.mapFeatherKey,o)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(a){this.$emit("map",void 0),this.mapFeather=a.value},async fetchOtherLayers(a={all:!1,dayNight:!1}){var o,r,i,l;let t=this.layerWeight;if(this.otherLayers={},t){if(a.all){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await Q.get(`${n}/api/arc/other/layers/links?l=${t}&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((o=c==null?void 0:c.data)==null?void 0:o.code)===0){const s=(r=c==null?void 0:c.data)==null?void 0:r.data,h=[];for(const m in s)h.push(Q.get(s[m],{headers:{Authorization:this.token||this.defaultMeteoToken,key:m}}));(await Promise.all(h)).map(m=>{var _,z,k;const u=((_=m==null?void 0:m.data)==null?void 0:_.data)||(m==null?void 0:m.data),g=(k=(z=m==null?void 0:m.config)==null?void 0:z.headers)==null?void 0:k.key;this.otherLayers[g]=u})}}else if(a.dayNight&&t&1024){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await Q.get(`${n}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((i=c==null?void 0:c.data)==null?void 0:i.code)===0){const s=(l=c==null?void 0:c.data)==null?void 0:l.data,h=[];for(const m in s)h.push(Q.get(s[m],{headers:{Authorization:this.token||this.defaultMeteoToken,key:m}}));(await Promise.all(h)).map(m=>{var _,z,k;const u=((_=m==null?void 0:m.data)==null?void 0:_.data)||(m==null?void 0:m.data),g=(k=(z=m==null?void 0:m.config)==null?void 0:z.headers)==null?void 0:k.key;this.otherLayers[g]=u})}}}else this.otherLayers={}},handleLayersChange(){var t;const a=(t=this.activeOtherLayers)==null?void 0:t.reduce((o,r)=>o+(r==null?void 0:r.weight),0);this.layerWeight!==a&&(this.layerWeight=a,this.fetchOtherLayers({all:!0}))}}},Ea={class:"idm-gl4-other-layer"},Ba={class:"header-box d-flex justify-space-between align-center pl-4 pr-4"},Da={class:"text-h5"},Ra={class:"list-box scroll pl-4 pr-2 overflow-y-auto"},Ia={class:"layers-body mt-4 d-flex justify-start align-center flex-wrap"},Aa=["onClick"],Va={key:0,src:"https://osshz.idmwx.com/asset/dark-map.png",class:"border rounded-sm"},Oa={key:1,src:"https://osshz.idmwx.com/asset/nautical-map.png",class:"border rounded-sm"},ja={key:2,src:"https://osshz.idmwx.com/asset/satellite-map.png",class:"border rounded-sm"},Fa={key:3,src:"https://osshz.idmwx.com/asset/light-map.png",class:"border rounded-sm"},Ha={class:"text-body-2 text-center pt-1"},Ga={class:"layers-body"},Wa={class:"layers-body"},Ua={class:"layers-body"},Ya={class:"layers-body"};function Za(a,t,o,r,i,l){var D,R,W,U,F,$,te,ie,oe,j;const n=e.resolveComponent("VBtn"),c=e.resolveComponent("VTooltip"),s=e.resolveComponent("VCardTitle"),h=e.resolveComponent("VCardItem"),d=e.resolveComponent("VCheckbox"),m=e.resolveComponent("VCardText"),u=e.resolveComponent("VCard"),g=e.resolveComponent("IdmWorld12nm"),_=e.resolveComponent("IdmWorldMarine"),z=e.resolveComponent("IdmChinaRoute"),k=e.resolveComponent("IdmWarZone"),M=e.resolveComponent("IdmGmdssArea"),v=e.resolveComponent("IdmEcaZone"),w=e.resolveComponent("IdmAlertZone"),y=e.resolveComponent("IdmPort"),b=e.resolveComponent("IdmLoadLine"),x=e.resolveComponent("IdmTimezone"),f=e.resolveComponent("IdmVRA"),L=e.resolveComponent("IdmSpecialArea"),B=e.resolveComponent("IdmTerminator"),I=e.resolveComponent("IdmLatLng");return e.openBlock(),e.createElementBlock("div",Ea,[e.createElementVNode("div",{class:"menu-bar-box transition px-1 rounded",style:e.normalizeStyle({top:o.top+10+"px",right:i.right+"px"})},[e.createVNode(c,{text:a.$t("layer.mapLayers"),location:"left"},{activator:e.withCtx(({props:C})=>[e.createVNode(n,e.mergeProps(C,{"min-width":"32",width:"32",height:"32",class:"text-none pa-0",color:i.toggle?"primary":"",onClick:l.handleMenuToggle}),{default:e.withCtx(()=>t[5]||(t[5]=[e.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["color","onClick"])]),_:1},8,["text"])],4),e.createElementVNode("div",{class:e.normalizeClass(["available-layers transition",i.toggle?"right-bar":""]),style:e.normalizeStyle({top:o.top+"px",right:i.toggle?"0px":"-280px"})},[e.createElementVNode("div",Ba,[e.createElementVNode("div",Da,e.toDisplayString(a.$t("layer.layers")),1),e.createVNode(n,{icon:"",density:"comfortable",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:e.withCtx(()=>t[6]||(t[6]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"20px"}},null,-1)])),_:1,__:[6]},8,["onClick"])]),e.createElementVNode("div",Ra,[e.createVNode(u,{class:"menu-card mx-auto my-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ia,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.mapFeathers,C=>(e.openBlock(),e.createElementBlock("div",{key:C.value,class:"mb-2 feather-item",onClick:ee=>l.handleToggleMapFeather(C)},[e.createElementVNode("div",{class:e.normalizeClass([i.mapFeather===C.value?"active":"","img-box"])},[C.value==="dark"?(e.openBlock(),e.createElementBlock("img",Va)):C.value==="nautical"?(e.openBlock(),e.createElementBlock("img",Oa)):C.value==="satellite"?(e.openBlock(),e.createElementBlock("img",ja)):(e.openBlock(),e.createElementBlock("img",Fa))],2),e.createElementVNode("div",Ha,e.toDisplayString(a.$t(`layer.${C.locale}`)),1)],8,Aa))),128))]),e.createElementVNode("div",Ga,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(C=>["graticule","day-night","time-zones"].includes(C.key)),C=>(e.openBlock(),e.createBlock(d,{key:C.key,modelValue:i.checkList,"onUpdate:modelValue":t[0]||(t[0]=ee=>i.checkList=ee),value:C.key,label:a.$t(`layer.${C.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(u,{class:"menu-card mx-auto mb-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(C=>["ports","nav-warnings","tidal-stations"].includes(C.key)),C=>(e.openBlock(),e.createBlock(d,{key:C.key,modelValue:i.checkList,"onUpdate:modelValue":t[1]||(t[1]=ee=>i.checkList=ee),value:C.key,label:a.$t(`layer.${C.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(u,{class:"menu-card mx-auto mb-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.otherLayers")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ua,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(C=>!["graticule","day-night","time-zones","ports","nav-warnings","tidal-stations"].includes(C.key)),C=>(e.openBlock(),e.createBlock(d,{key:C.key,modelValue:i.checkList,"onUpdate:modelValue":t[2]||(t[2]=ee=>i.checkList=ee),value:C.key,label:a.$t(`layer.${C.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(u,{class:"menu-card mx-auto mb-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.myFollows")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ya,[e.createVNode(d,{modelValue:i.followList,"onUpdate:modelValue":t[3]||(t[3]=C=>i.followList=C),value:"ports",label:a.$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.followList,"onUpdate:modelValue":t[4]||(t[4]=C=>i.followList=C),value:"locations",label:a.$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),o.map?(e.openBlock(),e.createBlock(g,e.mergeProps({key:0,map:o.map,token:o.token,show:i.checkList.includes("world12nm")},a.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(_,e.mergeProps({key:1,map:o.map,token:o.token,show:i.checkList.includes("worldMarine")},a.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(z,e.mergeProps({key:2,map:o.map,token:o.token,show:i.checkList.includes("chinaRoute")},a.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(k,e.mergeProps({key:3,map:o.map,zone:(D=i.otherLayers)==null?void 0:D["war-zones"]},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(M,e.mergeProps({key:4,map:o.map,area:(R=i.otherLayers)==null?void 0:R["gmdss-areas"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(v,e.mergeProps({key:5,map:o.map,zone:(W=i.otherLayers)==null?void 0:W["eca-zones"]},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(w,e.mergeProps({key:6,map:o.map,zone:(U=i.otherLayers)==null?void 0:U["alert-zones"],"before-layer":"empty-layer-3"},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(y,e.mergeProps({key:7,map:o.map,port:(F=i.otherLayers)==null?void 0:F.ports,"forecast-model":o.forecastModel},a.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","port","forecast-model"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(b,e.mergeProps({key:8,map:o.map,line:($=i.otherLayers)==null?void 0:$["load-lines"]},a.$attrs),null,16,["map","line"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(x,e.mergeProps({key:9,map:o.map,zone:(te=i.otherLayers)==null?void 0:te["time-zones"]},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(f,e.mergeProps({key:10,map:o.map,area:(ie=i.otherLayers)==null?void 0:ie["voluntary-reporting-area"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(L,e.mergeProps({key:11,map:o.map,area:(oe=i.otherLayers)==null?void 0:oe["special-area"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(B,e.mergeProps({key:12,map:o.map,area:(j=i.otherLayers)==null?void 0:j["day-night"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(I,e.mergeProps({key:13,map:o.map,"menu-toggle":o.menuToggle,show:i.checkList.includes("graticule")},a.$attrs),null,16,["map","menu-toggle","show"])):e.createCommentVNode("",!0)])}const Xa=O(Ma,[["render",Za]]);class Ne{constructor(t){J(this,"map");J(this,"mercator");J(this,"rampColorLayer");J(this,"rampColorSource");J(this,"particleLayer");J(this,"particleSource");J(this,"rampColorCanvas");J(this,"particleCanvas");J(this,"ratio");this.map=t,this.mercator=new Mo,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,o=0){return t>180?this.convertNLng(t-360,o+1):t<-180?this.convertNLng(t+360,o+1):[t,o]}getBoundLngLat(){var o;const t=(o=this.map)==null?void 0:o.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 _,z;const t=(_=this.map)==null?void 0:_.getBounds();if(!t)return[];const o=((z=this.map)==null?void 0:z.getZoom())+1,r=[t._ne.lng,t._ne.lat],i=[t._sw.lng,t._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[h,d]=this.mercator.px([l,r[1]],o),[m,u]=this.mercator.px([c,i[1]],o),g=Math.round(this.mercator.size*Math.pow(2,o)*(n+s));return[m,u,h+g,d]}getBoundRange(){const t=this.map.getZoom()+1,o=this.mercator.size*Math.pow(2,t),r=this.getBoundPixel();return[r[0]/o,r[2]/o,r[3]/o,r[1]/o]}getWorldCopy(t,o){const r=2**o,[i,l,n,c]=t.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let m=i;m<=n;m++)s.push([m,d]);return s.map(d=>{const m=2**o*256;return[d[0]*m,d[1]*m,m]})}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 o=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=t?"visible":"none";o!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(t){var i;const o=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=t?"visible":"none";o!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class ye{createShader(t,o,r){const i=t.createShader(o);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,o,r,i,l,n,c){const s=t.createTexture();return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,o),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,n,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),s}createDataBuffer(t,o,r){if(t){const i=t.createBuffer();return o==="array"?(t.bindBuffer(t.ARRAY_BUFFER,i),r&&t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW)):o==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),r&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW)),i}return null}createProgram(t,o,r){const i=t.createProgram(),l=this.createShader(t,t.VERTEX_SHADER,o),n=this.createShader(t,t.FRAGMENT_SHADER,r);if(i&&l&&n&&(t.attachShader(i,l),t.attachShader(i,n),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,o,r){const i=this.createProgram(t,o,r);if(i){const l={program:i},n=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const h=t.getActiveAttrib(i,s);l[h.name]=t.getAttribLocation(i,h.name)}const c=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const h=t.getActiveUniform(i,s);l[h.name]=t.getUniformLocation(i,h.name)}return l}}setup(t,o,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&t){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return o.forEach(([h,d])=>{s.addColorStop(h,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(t,o=1e3){const r=Math.ceil(Math.sqrt(o)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(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),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const h=this.createDataBuffer(t,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:h}}bind(t,o,r){const i=this.createProgram(t,o,r);if(i){const l=this.createDataBuffer(t,"array",void 0),n=t.getAttribLocation(i,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,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 s=t.getAttribLocation(i,"a_texCoord");return t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(t,o,r,i,l,n){const c=this.createProgramWrapper(t,o,r),s=this.createProgramWrapper(t,i,l),h=this.createProgramWrapper(t,i,n),d=this.createDataBuffer(t,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),m=t.createFramebuffer();return{particle:c,screen:s,update:h,quadBuffer:d,frameBuffer:m}}draw(t,o,r,i,l,n,c){var s,h;if(o&&r){t.resize(),o==null||o.viewport(0,0,(s=o==null?void 0:o.canvas)==null?void 0:s.width,(h=o==null?void 0:o.canvas)==null?void 0:h.height),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);try{o.useProgram(r);const d={resolution:o.getUniformLocation(r,"u_resolution"),image:o.getUniformLocation(r,"u_image"),color:o.getUniformLocation(r,"u_color"),scale:o.getUniformLocation(r,"u_scale"),uvRange:o.getUniformLocation(r,"u_range_u_v"),sRange:o.getUniformLocation(r,"u_range_s")};d.resolution&&o.uniform2f(d.resolution,o.canvas.width*t.ratio,o.canvas.height*t.ratio),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,i),d.image&&o.uniform1i(d.image,0),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,l),d.color&&o.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&o.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&o.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&o.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const m=t.getBoundPixel(),u=t.map.getZoom()+1,g=t.getWorldCopy(m,u);for(const _ of g){const z=(_[0]-m[0])*t.ratio,k=(_[1]-m[3])*t.ratio,M=_[2]*t.ratio,[v,w,y,b]=[z,M+z,k,M+k],x=new Float32Array([v,y,w,y,v,b,v,b,w,y,w,b]);o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,x,o.STATIC_DRAW),o.drawArrays(o.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(t,o,r,i,l){var n,c;o&&(o==null||o.viewport(0,0,(n=o==null?void 0:o.canvas)==null?void 0:n.width,(c=o==null?void 0:o.canvas)==null?void 0:c.height),o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,r),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,i.texture0),this.renderScreen(t,o,i,l),this.updateParticles(t,o,i,l))}renderScreen(t,o,r,i){o.bindFramebuffer(o.FRAMEBUFFER,r.frameBuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,r.screenTexture,0),o.viewport(0,0,o.canvas.width,o.canvas.height),this.renderScreenTexture(o,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(t,o,r,i),o.bindFramebuffer(o.FRAMEBUFFER,null),this.renderScreenTexture(o,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(t,o,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,o),t.uniform1i(r.u_screen,2),t.uniform1f(r.u_opacity,l),t.drawArrays(t.TRIANGLES,0,6))}renderParticles(t,o,r,i){if(o){o.useProgram(r.particle.program),o.bindBuffer(o.ARRAY_BUFFER,r.indexBuffer),o.enableVertexAttribArray(r.particle.a_index),o.vertexAttribPointer(r.particle.a_index,1,o.FLOAT,!1,0,0),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,r.color.texture),o.uniform1i(r.particle.u_factor,0),o.uniform1i(r.particle.u_particles,1),o.uniform1i(r.particle.u_color_ramp,2),o.uniform1f(r.particle.u_particles_resolution,r.resolution*t.ratio),o.uniform1f(r.particle.u_point,t.ratio);const l=t.getBoundRange();o.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),o.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),o.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),o.drawArrays(o.POINTS,0,r.total)}}updateParticles(t,o,r,i){var n,c;if(o){o.bindFramebuffer(o.FRAMEBUFFER,r.frameBuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,r.texture1,0),o.viewport(0,0,r.resolution,r.resolution),o.useProgram(r.update.program),o.bindBuffer(o.ARRAY_BUFFER,r.quadBuffer),o.enableVertexAttribArray(r.update.a_pos),o.vertexAttribPointer(r.update.a_pos,2,o.FLOAT,!1,0,0),o.uniform1i(r.update.u_factor,0),o.uniform1i(r.update.u_particles,1);const s=t.getBoundRange();o.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),o.uniform1f(r.update.u_rand_seed,Math.random()),o.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),o.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),o.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),o.uniform1f(r.update.u_speed_factor,i.speedFactor*t.ratio),o.uniform1f(r.update.u_drop_rate,i.dropRate),o.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),o.drawArrays(o.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(t,o){t.resize();const r=new Uint8Array(o.canvas.width*o.canvas.height*4).fill(0,0,o.canvas.width*o.canvas.height*4),i=this.createTexture(o,o.NEAREST,o.NEAREST,o.CLAMP_TO_EDGE,r,o.canvas.width,o.canvas.height),l=this.createTexture(o,o.NEAREST,o.NEAREST,o.CLAMP_TO_EDGE,r,o.canvas.width,o.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(t){return new Promise(o=>{const r=new Blob([t],{type:t.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>o(l)})}}class X{}J(X,"vertexSchema",`
1
+ (function(G,Q){typeof exports=="object"&&typeof module<"u"?Q(exports,require("axios"),require("vue"),require("mapbox-gl"),require("@idm-plugin/geo"),require("@turf/turf"),require("@idm-plugin/tag-nop"),require("moment"),require("@mapbox/sphericalmercator"),require("@idm-plugin/tag"),require("@idm-plugin/meteo"),require("vuetify")):typeof define=="function"&&define.amd?define(["exports","axios","vue","mapbox-gl","@idm-plugin/geo","@turf/turf","@idm-plugin/tag-nop","moment","@mapbox/sphericalmercator","@idm-plugin/tag","@idm-plugin/meteo","vuetify"],Q):(G=typeof globalThis<"u"?globalThis:G||self,Q(G["idm-gl"]={},G.axios,G.Vue,G["mapbox-gl"],G["@idm-plugin/geo"],G["@turf/turf"],G["@idm-plugin/tag-nop"],G.moment,G["@mapbox/sphericalmercator"],G["@idm-plugin/tag"],G["@idm-plugin/meteo"],G.vuetify))})(this,function(G,Q,e,he,V,No,Pe,P,Mo,Eo,Re,Bo){"use strict";var Al=Object.defineProperty;var Vl=(G,Q,e)=>Q in G?Al(G,Q,{enumerable:!0,configurable:!0,writable:!0,value:e}):G[Q]=e;var J=(G,Q,e)=>(Vl(G,typeof Q!="symbol"?Q+"":Q,e),e);function Do(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const N=Do(No),O=(a,t)=>{const o=a.__vccOpts||a;for(const[r,i]of t)o[r]=i;return o},Ro={name:"IdmWarZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"war-zone-source",zoneLayer:"war-zone-layer",zoneLabelLayer:"war-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-color":"#f44336","fill-opacity":.4}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":1,"line-color":"#f44336"}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-1]},paint:{"icon-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Io(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Ao=O(Ro,[["render",Io]]),Vo={name:"IdmGmdssArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"gmdss-area-source",areaLayer:"gmdss-area-layer",areaLabelLayer:"gmdss-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","val"],"AreaI","#EB8996","AreaII","#6F448B","AreaIII","#3E8BD3","AreaIV","#5EBCC4","AreaV","#00AAE7","AreaVI","#9CCE6D","AreaVII","#F4AE00","AreaVIII","#EF9A85","AreaIX","#00AAA7","AreaX","#7AC49F","AreaXI","#DFDFDF","AreaXII","#FFF974","AreaXIII","#EF9A85","AreaXIV","#86A2D1","AreaXV","#EC8972","AreaXVI","#EAC2DA","AreaXVII","#B9C8E7","AreaXVIII","#BBA1C8","AreaXIX","#FAE0BD","AreaXX","#DBECC8","AreaXXI","#D496AF","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,-3.5]},paint:{"icon-opacity":.8,"text-opacity":.8,"text-color":"#000"}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Oo(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const jo=O(Vo,[["render",Oo]]),Fo={name:"IdmEcaZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String},activeWeatherLayers:{type:Array}},data(){return{source:"eca-zone-source",zoneLayer:"eca-zone-layer",zoneLabelLayer:"eca-zone-label-layer"}},watch:{zone:{handler(){this.zone?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.zone):(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"fill-outline-color":"silver","fill-opacity":.3,"fill-color":"#05f324"}},this.beforeLayer),this.map.addLayer({id:this.zoneLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-color":"#05f324","line-width":1,"line-opacity":1}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","text-max-width":16,"text-justify":"left","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-3.5]},paint:{"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLayer+"-border")&&this.map.removeLayer(this.zoneLayer+"-border"),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Ho(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const Go=O(Fo,[["render",Ho]]),Ol="",Wo={name:"IdmAlertZone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"alert-zone-source",polygonLayer:"alert-zone-polygon-layer",polygonLabelLayer:"alert-zone-polygon-label-layer",lineLayer:"alert-zone-line-layer",lineLabelLayer:"alert-zone-line-label-layer",pointLayer:"alert-zone-point-layer",showZone:!1,form:{}}},watch:{zone:{handler(){var a,t;this.zone?(this.handleRender(),(a=this.map)==null||a.on("click",[this.polygonLabelLayer,this.lineLabelLayer,this.pointLayer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.polygonLabelLayer,this.lineLabelLayer,this.pointLayer],this.handleClick))},immediate:!0}},methods:{handleClick(a){var r;const t=a.features[0],o=(r=this.zone)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(o){this.showZone=!0,this.form={...o.properties};const i=document.getElementById("idm-gl4-zone-info");this.marker?this.marker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.marker=new he.Marker(i).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([0,0]).addTo(this.map)}},handleRender(){var a;this.map?(this.handleClear(),this.zone&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.zone):(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.polygonLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"fill-outline-color":"#d57d02","fill-opacity":.4,"fill-color":"#d57d02"}},this.beforeLayer),this.map.addLayer({id:this.polygonLayer+"-border",type:"line",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-width":1,"line-color":"#d57d02"}},this.beforeLayer),this.map.addLayer({id:this.lineLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],paint:{"line-color":"#d57d02","line-width":2}},this.beforeLayer),this.map.addLayer({id:this.polygonLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"alert","icon-size":.08,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["!=","disabled",!0]],layout:{"symbol-placement":"line-center","icon-image":"alert","icon-size":.08,"icon-allow-overlap":!0,"icon-rotation-alignment":"viewport"},paint:{"icon-opacity":.8}},this.beforeLayer),this.map.addLayer({id:this.pointLayer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-image":"alert","icon-size":.08},paint:{"icon-opacity":.8}},this.beforeLayer)))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.polygonLayer)&&this.map.removeLayer(this.polygonLayer),this.map.getLayer(this.polygonLayer+"-border")&&this.map.removeLayer(this.polygonLayer+"-border"),this.map.getLayer(this.polygonLabelLayer)&&this.map.removeLayer(this.polygonLabelLayer),this.map.getLayer(this.lineLayer)&&this.map.removeLayer(this.lineLayer),this.map.getLayer(this.lineLabelLayer)&&this.map.removeLayer(this.lineLabelLayer),this.map.getLayer(this.pointLayer)&&this.map.removeLayer(this.pointLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}},Uo={id:"idm-gl4-zone-info"},Yo=["innerHTML"];function Zo(a,t,o,r,i,l){var n;return e.withDirectives((e.openBlock(),e.createElementBlock("div",Uo,[e.createElementVNode("div",{class:"iconfont close",onClick:t[0]||(t[0]=c=>i.showZone=!1)},""),e.createElementVNode("div",{class:"rich-context",innerHTML:(n=i.form)==null?void 0:n.name},null,8,Yo)],512)),[[e.vShow,i.showZone]])}const Xo=O(Wo,[["render",Zo]]),jl="",qo={name:"IdmPort",props:{map:{type:Object},port:{type:Object},beforeLayer:{type:String},forecastModel:{type:String}},emits:["meteoMore"],data(){return{source:"port-source",layer:"port-layer",showPort:!1,form:{},marker:void 0}},computed:{computeLat(){return function(a){return V.LngLatHelper.lat2pretty(a,4).pretty}},computeLng(){return function(a){return V.LngLatHelper.lng2pretty(a,4).pretty}}},watch:{port:{handler(){var a,t;this.port?(this.handleRender(),(a=this.map)==null||a.on("click",[this.layer],this.handleClick)):(this.handleClear(),(t=this.map)==null||t.off("click",[this.layer],this.handleClick))},immediate:!0}},methods:{handleClick(a){var r;const t=a.features[0],o=(r=this.port)==null?void 0:r.features.filter(i=>{var l;return i.properties.id===((l=t==null?void 0:t.properties)==null?void 0:l.id)})[0];if(o){this.showPort=!0,this.form={...o.properties},this.form.lng=o.geometry.coordinates[0],this.form.lat=o.geometry.coordinates[1];const i=document.getElementById("port-info");this.marker?this.marker.setLngLat([a.lngLat.lng,a.lngLat.lat]):this.marker=new he.Marker(i).setLngLat([a.lngLat.lng,a.lngLat.lat]).setOffset([0,-85]).addTo(this.map)}},handleRender(){var a;this.map?this.port&&(this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(this.port):(this.map.addSource(this.source,{type:"geojson",data:this.port}),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","text-anchor":"left","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[1,0]},paint:{"text-color":"rgba(0, 0, 0, 0.8)","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.showPort=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},handleClickMeteo(a){a.forecastModel=this.forecastModel,this.$emit("meteoMore",a)}}},Ko={ref:"idmPortInfo",id:"port-info"},Jo={class:"port-box"},Qo={class:"flex-start"},$o={class:"flex-start"},ea={class:"flex-start"},ta={class:"flex-start",style:{"align-items":"flex-start"}},oa={class:"meteo-forecast flex-end"};function aa(a,t,o,r,i,l){return e.withDirectives((e.openBlock(),e.createElementBlock("div",Ko,[e.createElementVNode("div",{class:"close iconfont",onClick:t[0]||(t[0]=n=>i.showPort=!1)},""),e.createElementVNode("div",Jo,[e.createElementVNode("div",Qo,[t[2]||(t[2]=e.createElementVNode("label",null,"Name : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.name),1)]),e.createElementVNode("div",$o,[t[3]||(t[3]=e.createElementVNode("label",null,"Position : ",-1)),e.createElementVNode("span",null,e.toDisplayString(l.computeLat(i.form.lat))+", "+e.toDisplayString(l.computeLng(i.form.lng)),1)]),e.createElementVNode("div",ea,[t[4]||(t[4]=e.createElementVNode("label",null,"LoCode : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.loCode||"-"),1)]),e.createElementVNode("div",ta,[t[5]||(t[5]=e.createElementVNode("label",null,"Region : ",-1)),e.createElementVNode("span",null,e.toDisplayString(i.form.zoneName||"-"),1)]),e.createElementVNode("div",oa,[e.createElementVNode("span",{onClick:t[1]||(t[1]=n=>l.handleClickMeteo(i.form))},"Meteo Forecast")])])],512)),[[e.vShow,i.showPort]])}const ia=O(qo,[["render",aa],["__scopeId","data-v-62f79fef"]]),ra={name:"IdmLoadLine",props:{map:{type:Object},line:{type:Object},beforeLayer:{type:String}},data(){return{source:"load-line-source",lineLayer:"load-line-layer",lineLabelLayer:"load-line-label-layer"}},watch:{line:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.line&&(this.map.addSource(this.source,{type:"geojson",data:this.line}),this.map.addLayer({id:this.lineLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.75,"fill-color":["match",["get","val"],"LLGreen","#A0C0C0","LLRed","#F5A39D","LLBlue","#6B94E4","#ffffff"]}},this.beforeLayer),this.map.addLayer({id:this.lineLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{lbl} (Length < {shipLength}, {start} - {end})","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":.8}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.lineLayer)&&this.map.removeLayer(this.lineLayer),this.map.getLayer(this.lineLabelLayer)&&this.map.removeLayer(this.lineLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function la(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const na=O(ra,[["render",la]]),sa={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneLabelLayer:"time-zone-label-layer"}},watch:{zone:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:this.zone}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.5,"fill-color":["match",["get","offSet"],"-11.5","rgba(255,0,0,0.4)","-11","rgba(0,255,0,0.3)","-10.5","rgba(0,255,0,0.3)","-10","rgba(0,0,255,0.3)","-9.5","rgba(0,0,255,0.3)","-9","rgba(255,0,0,0.4)","-8.5","rgba(255,0,0,0.4)","-8","rgba(0,255,0,0.3)","-7.5","rgba(0,255,0,0.3)","-7","rgba(0,0,255,0.3)","-6.5","rgba(0,0,255,0.3)","-6","rgba(255,0,0,0.4)","-5.5","rgba(255,0,0,0.4)","-5","rgba(0,255,0,0.3)","-4.5","rgba(0,255,0,0.3)","-4","rgba(0,0,255,0.3)","-3.5","rgba(0,0,255,0.3)","-3","rgba(255,0,0,0.4)","-2.5","rgba(255,0,0,0.4)","-2","rgba(0,255,0,0.3)","-1.5","rgba(0,255,0,0.3)","-1","rgba(0,0,255,0.3)","-0.5","rgba(0,0,255,0.3)","+0","rgba(255,0,0,0.4)","+0.5","rgba(255,0,0,0.4)","+1","rgba(0,255,0,0.3)","+1.5","rgba(0,255,0,0.3)","+2","rgba(0,0,255,0.3)","+2.5","rgba(0,0,255,0.3)","+3","rgba(255,0,0,0.4)","+3.5","rgba(255,0,0,0.4)","+4","rgba(0,255,0,0.3)","+4.5","rgba(0,255,0,0.3)","+5","rgba(0,0,255,0.3)","+5.5","rgba(0,0,255,0.3)","+6","rgba(255,0,0,0.4)","+6.5","rgba(255,0,0,0.4)","+7","rgba(0,255,0,0.3)","+7.5","rgba(0,255,0,0.3)","+8","rgba(0,0,255,0.3)","+8.5","rgba(0,0,255,0.3)","+9","rgba(255,0,0,0.4)","+9.5","rgba(255,0,0,0.4)","+10","rgba(0,255,0,0.3)","+10.5","rgba(0,255,0,0.3)","+11","rgba(0,0,255,0.3)","+11.5","rgba(0,0,255,0.3)","rgba(255,0,0,0.4)"]}},this.beforeLayer),this.map.addLayer({id:this.zoneLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{offSet}","text-rotation-alignment":"viewport","text-size":12,"text-offset":[0,1]},paint:{"text-opacity":.8,"text-color":"#fff"}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ca(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const ma=O(sa,[["render",ca]]),da={name:"IdmVoluntaryReportingArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"vra-source",areaLayer:"vra-layer",areaLabelLayer:"vra-label-layer"}},watch:{area:{handler(){this.area?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.4,"fill-color":"#9f30f9"}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":1,"line-color":"#9f30f9"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-3.5]},paint:{"icon-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ha(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const pa=O(da,[["render",ha]]),ga={name:"IdmSpecialArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"special-area-source",areaLayer:"special-area-layer",areaLabelLayer:"special-area-label-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.area.features.forEach(a=>{a.geometry.type==="Polygon"&&a.geometry.coordinates.forEach(t=>V.LngLatHelper.convertToMonotonicLng2(t))}),this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.areaLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-opacity":.4,"fill-color":["match",["get","val"],"DefaultStyle","rgb(0,0,0)","JWCriskArea","rgb(0,0,0)","rgb(0,0,0)"]}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.4,"line-color":"rgb(0,0,0)"}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.1,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,-3.5]},paint:{"icon-opacity":.8,"text-color":"#000","text-halo-color":"#fff","text-halo-width":1}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.areaLayer)&&this.map.removeLayer(this.areaLayer),this.map.getLayer(this.areaLayer+"-border")&&this.map.removeLayer(this.areaLayer+"-border"),this.map.getLayer(this.areaLabelLayer)&&this.map.removeLayer(this.areaLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ua(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const fa=O(ga,[["render",ua]]),ya={name:"IdmTerminator",props:{map:{type:Object},mapFeather:{type:String},area:{type:Object}},data(){return{source:"terminator-source",layer:"terminator-layer"}},computed:{layerColor(){return["satellite","dark"].includes(this.mapFeather),"rgba(0, 0, 0, 0.2)"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){this.map?(this.handleClear(),this.area&&(this.map.addSource(this.source,{type:"geojson",data:this.area}),this.map.addLayer({id:this.layer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-outline-color":"silver","fill-color":this.layerColor}},this.beforeLayer))):setTimeout(()=>{this.handleRender()},500)},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ba(a,t,o,r,i,l){return e.openBlock(),e.createElementBlock("div")}const wa=O(ya,[["render",ba]]),xa={name:"IdmWorld12nm",props:{map:{type:Object},show:{type:Boolean},weatherLayers:{type:Object,default:()=>({})},zoom:{type:Number,default:3},left:{type:String,default:"10px"},bottom:{type:String,default:"64px"},token:{type:String,default:""}},data(){return{layer:"world-12nm-v4-20231025"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a;this.map?(a=this.map)!=null&&a.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setPaintProperty(this.layer,"line-color","rgb(210,54,83)"),this.map.setPaintProperty(this.layer,"line-width",2)):setTimeout(()=>{this.handleRender()},500)},handleClear(){var a;(a=this.map)!=null&&a.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}};function _a(a,t,o,r,i,l){return null}const ka=O(xa,[["render",_a]]),Fl="",za={name:"IdmWorldMarine",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"ne-10m-label",lineLayer:"ne-10m-outline"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a,t;this.map?((a=this.map)!=null&&a.getLayer(this.lineLayer)&&(this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),this.map.setPaintProperty(this.lineLayer,"line-width",1)),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var a,t;(a=this.map)!=null&&a.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(t=this.map)!=null&&t.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function va(a,t,o,r,i,l){return null}const La=O(za,[["render",va]]),Ca={name:"IdmChinaRoute",props:{map:{type:Object},show:{type:Boolean}},data(){return{labelLayer:"china-route-label",lineLayer:"china-route-line",fillLayer:"china-route-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var a,t,o;this.map?((a=this.map)!=null&&a.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"),(o=this.map)!=null&&o.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")):setTimeout(()=>{this.handleRender()},500)},handleClear(){var a,t,o;(a=this.map)!=null&&a.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"),(o=this.map)!=null&&o.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function Pa(a,t,o,r,i,l){return null}const Sa=O(Ca,[["render",Pa]]),Hl="",Ta={name:"IdmLatLng",props:{map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:void 0,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 a;this.map&&((a=this.map)==null||a.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var a;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10},immediate:!0}},methods:{handleBind(){var a,t;this.show?((a=this.map)==null||a.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(t=this.map)==null||t.off("zoomend",this.handleZoomEnd))},handleMouseMove(a){const t=a.lngLat,o=V.LngLatHelper.lng2pretty(t.lng,2),r=V.LngLatHelper.lat2pretty(t.lat,2),i=`[${t.lng.toFixed(4)}, ${t.lat.toFixed(4)}]`;this.lngLat={lng:o,lat:r,str:i}},handleComputeLatLngs(){var r;const a=(r=this.map)==null?void 0:r.getZoom();let t=30;a>4?t=10:a>3&&(t=15);const o=[];for(let i=-60;i<90;i+=t)o.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=t)o.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)o.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 o},handleZoomEnd(){var t;const a=this.handleComputeLatLngs();(t=this.map)==null||t.getSource(this.source).setData(N.featureCollection(a))},handleRender(){if(this.handleClear(),this.map){const a=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:a}}),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 a,t,o,r,i,l;(a=this.map)!=null&&a.getLayer(this.layer)&&((t=this.map)==null||t.removeLayer(this.layer)),(o=this.map)!=null&&o.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 Na(a,t,o,r,i,l){var n,c,s,h,d;return e.openBlock(),e.createElementBlock("div",{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((c=(n=i.lngLat)==null?void 0:n.lat)==null?void 0:c.pretty),1),e.createElementVNode("div",null,e.toDisplayString((h=(s=i.lngLat)==null?void 0:s.lng)==null?void 0:h.pretty),1),e.createElementVNode("div",null,e.toDisplayString((d=i.lngLat)==null?void 0:d.str),1)],4)}const Ie=O(Ta,[["render",Na]]),Gl="",Ma={name:"IdmOtherLayerr",components:{IdmWarZone:Ao,IdmGmdssArea:jo,IdmEcaZone:Go,IdmAlertZone:Xo,IdmPort:ia,IdmLoadLine:na,IdmTimezone:ma,IdmVRA:pa,IdmSpecialArea:fa,IdmTerminator:wa,IdmWorld12nm:ka,IdmWorldMarine:La,IdmChinaRoute:Sa,IdmLatLng:Ie},props:{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},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"light",tagLayers:[...Pe.LayerHelper.OTHER_LAYERS.filter(a=>a.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.1",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:[],followList:[]}},computed:{computeLayerClass(){return function(a,t){let o="layer flex-between";return t.some(r=>r.key===a.key)&&(o=o+" active"),o}}},watch:{isLogin:{handler(){this.isLogin&&this.fetchOtherLayers()},immediate:!0},"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var a;this.right=(((a=document.getElementsByClassName("right-bar")[0])==null?void 0:a.clientWidth)||0)+10})},immediate:!0},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.mapFeather=["dark","nautical"].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(){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(a=>this.checkList.includes(a.key))||[],this.handleLayersChange()}},followList:{handler(){localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),this.$emit("followLayerList",this.followList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const a=localStorage.getItem(this.cache.versionKey);this.cache.v!==a&&(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.followListKey),this.followList=JSON.parse(t||"[]"),localStorage.setItem(this.cache.followListKey,JSON.stringify(this.followList)),t=localStorage.getItem(this.cache.mapFeatherKey);const o=t||"light";this.$emit("mapFeather",o),localStorage.setItem(this.cache.mapFeatherKey,o)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(a){this.$emit("map",void 0),this.mapFeather=a.value},async fetchOtherLayers(a={all:!1,dayNight:!1}){var o,r,i,l;let t=this.layerWeight;if(this.otherLayers={},t){if(a.all){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await Q.get(`${n}/api/arc/other/layers/links?l=${t}&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((o=c==null?void 0:c.data)==null?void 0:o.code)===0){const s=(r=c==null?void 0:c.data)==null?void 0:r.data,h=[];for(const m in s)h.push(Q.get(s[m],{headers:{Authorization:this.token||this.defaultMeteoToken,key:m}}));(await Promise.all(h)).map(m=>{var _,z,k;const u=((_=m==null?void 0:m.data)==null?void 0:_.data)||(m==null?void 0:m.data),g=(k=(z=m==null?void 0:m.config)==null?void 0:z.headers)==null?void 0:k.key;this.otherLayers[g]=u})}}else if(a.dayNight&&t&1024){const n=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await Q.get(`${n}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(((i=c==null?void 0:c.data)==null?void 0:i.code)===0){const s=(l=c==null?void 0:c.data)==null?void 0:l.data,h=[];for(const m in s)h.push(Q.get(s[m],{headers:{Authorization:this.token||this.defaultMeteoToken,key:m}}));(await Promise.all(h)).map(m=>{var _,z,k;const u=((_=m==null?void 0:m.data)==null?void 0:_.data)||(m==null?void 0:m.data),g=(k=(z=m==null?void 0:m.config)==null?void 0:z.headers)==null?void 0:k.key;this.otherLayers[g]=u})}}}else this.otherLayers={}},handleLayersChange(){var t;const a=(t=this.activeOtherLayers)==null?void 0:t.reduce((o,r)=>o+(r==null?void 0:r.weight),0);this.layerWeight!==a&&(this.layerWeight=a,this.fetchOtherLayers({all:!0}))}}},Ea={class:"idm-gl4-other-layer"},Ba={class:"header-box d-flex justify-space-between align-center pl-4 pr-4"},Da={class:"text-h5"},Ra={class:"list-box scroll pl-4 pr-2 overflow-y-auto"},Ia={class:"layers-body mt-4 d-flex justify-start align-center flex-wrap"},Aa=["onClick"],Va={key:0,src:"https://osshz.idmwx.com/asset/dark-map.png",class:"border rounded-sm"},Oa={key:1,src:"https://osshz.idmwx.com/asset/nautical-map.png",class:"border rounded-sm"},ja={key:2,src:"https://osshz.idmwx.com/asset/satellite-map.png",class:"border rounded-sm"},Fa={key:3,src:"https://osshz.idmwx.com/asset/light-map.png",class:"border rounded-sm"},Ha={class:"text-body-2 text-center pt-1"},Ga={class:"layers-body"},Wa={class:"layers-body"},Ua={class:"layers-body"},Ya={class:"layers-body"};function Za(a,t,o,r,i,l){var D,R,W,U,F,$,te,ie,oe,j;const n=e.resolveComponent("VBtn"),c=e.resolveComponent("VTooltip"),s=e.resolveComponent("VCardTitle"),h=e.resolveComponent("VCardItem"),d=e.resolveComponent("VCheckbox"),m=e.resolveComponent("VCardText"),u=e.resolveComponent("VCard"),g=e.resolveComponent("IdmWorld12nm"),_=e.resolveComponent("IdmWorldMarine"),z=e.resolveComponent("IdmChinaRoute"),k=e.resolveComponent("IdmWarZone"),M=e.resolveComponent("IdmGmdssArea"),v=e.resolveComponent("IdmEcaZone"),w=e.resolveComponent("IdmAlertZone"),y=e.resolveComponent("IdmPort"),b=e.resolveComponent("IdmLoadLine"),x=e.resolveComponent("IdmTimezone"),f=e.resolveComponent("IdmVRA"),L=e.resolveComponent("IdmSpecialArea"),B=e.resolveComponent("IdmTerminator"),I=e.resolveComponent("IdmLatLng");return e.openBlock(),e.createElementBlock("div",Ea,[e.createElementVNode("div",{class:"menu-bar-box transition px-1 rounded",style:e.normalizeStyle({top:o.top+10+"px",right:i.right+"px"})},[e.createVNode(c,{text:a.$t("layer.mapLayers"),location:"left"},{activator:e.withCtx(({props:C})=>[e.createVNode(n,e.mergeProps(C,{"min-width":"32",width:"32",height:"32",class:"text-none pa-0",color:i.toggle?"primary":"",onClick:l.handleMenuToggle}),{default:e.withCtx(()=>t[5]||(t[5]=[e.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["color","onClick"])]),_:1},8,["text"])],4),e.createElementVNode("div",{class:e.normalizeClass(["available-layers transition",i.toggle?"right-bar":""]),style:e.normalizeStyle({top:o.top+"px",right:i.toggle?"0px":"-280px"})},[e.createElementVNode("div",Ba,[e.createElementVNode("div",Da,e.toDisplayString(a.$t("layer.layers")),1),e.createVNode(n,{icon:"",density:"comfortable",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:e.withCtx(()=>t[6]||(t[6]=[e.createElementVNode("i",{class:"iconfont icon-close",style:{"font-size":"20px"}},null,-1)])),_:1,__:[6]},8,["onClick"])]),e.createElementVNode("div",Ra,[e.createVNode(u,{class:"menu-card mx-auto my-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ia,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.mapFeathers,C=>(e.openBlock(),e.createElementBlock("div",{key:C.value,class:"mb-2 feather-item",onClick:ee=>l.handleToggleMapFeather(C)},[e.createElementVNode("div",{class:e.normalizeClass([i.mapFeather===C.value?"active":"","img-box"])},[C.value==="dark"?(e.openBlock(),e.createElementBlock("img",Va)):C.value==="nautical"?(e.openBlock(),e.createElementBlock("img",Oa)):C.value==="satellite"?(e.openBlock(),e.createElementBlock("img",ja)):(e.openBlock(),e.createElementBlock("img",Fa))],2),e.createElementVNode("div",Ha,e.toDisplayString(a.$t(`layer.${C.locale}`)),1)],8,Aa))),128))]),e.createElementVNode("div",Ga,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(C=>["graticule","day-night","time-zones"].includes(C.key)),C=>(e.openBlock(),e.createBlock(d,{key:C.key,modelValue:i.checkList,"onUpdate:modelValue":t[0]||(t[0]=ee=>i.checkList=ee),value:C.key,label:a.$t(`layer.${C.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(u,{class:"menu-card mx-auto mb-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(C=>["ports","nav-warnings","tidal-stations"].includes(C.key)),C=>(e.openBlock(),e.createBlock(d,{key:C.key,modelValue:i.checkList,"onUpdate:modelValue":t[1]||(t[1]=ee=>i.checkList=ee),value:C.key,label:a.$t(`layer.${C.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(u,{class:"menu-card mx-auto mb-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.otherLayers")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ua,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.tagLayers.filter(C=>!["graticule","day-night","time-zones","ports","nav-warnings","tidal-stations"].includes(C.key)),C=>(e.openBlock(),e.createBlock(d,{key:C.key,modelValue:i.checkList,"onUpdate:modelValue":t[2]||(t[2]=ee=>i.checkList=ee),value:C.key,label:a.$t(`layer.${C.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(u,{class:"menu-card mx-auto mb-3",elevation:"8"},{default:e.withCtx(()=>[e.createVNode(h,{class:"border-b-thin"},{default:e.withCtx(()=>[e.createVNode(s,{class:"text-subtitle-1",style:{"font-size":"16px !important"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.$t("layer.myFollows")),1)]),_:1})]),_:1}),e.createVNode(m,null,{default:e.withCtx(()=>[e.createElementVNode("div",Ya,[e.createVNode(d,{modelValue:i.followList,"onUpdate:modelValue":t[3]||(t[3]=C=>i.followList=C),value:"ports",label:a.$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.followList,"onUpdate:modelValue":t[4]||(t[4]=C=>i.followList=C),value:"locations",label:a.$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),o.map?(e.openBlock(),e.createBlock(g,e.mergeProps({key:0,map:o.map,token:o.token,show:i.checkList.includes("world12nm")},a.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(_,e.mergeProps({key:1,map:o.map,token:o.token,show:i.checkList.includes("worldMarine")},a.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(z,e.mergeProps({key:2,map:o.map,token:o.token,show:i.checkList.includes("chinaRoute")},a.$attrs),null,16,["map","token","show"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(k,e.mergeProps({key:3,map:o.map,zone:(D=i.otherLayers)==null?void 0:D["war-zones"]},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(M,e.mergeProps({key:4,map:o.map,area:(R=i.otherLayers)==null?void 0:R["gmdss-areas"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(v,e.mergeProps({key:5,map:o.map,zone:(W=i.otherLayers)==null?void 0:W["eca-zones"]},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(w,e.mergeProps({key:6,map:o.map,zone:(U=i.otherLayers)==null?void 0:U["alert-zones"],"before-layer":"empty-layer-3"},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(y,e.mergeProps({key:7,map:o.map,port:(F=i.otherLayers)==null?void 0:F.ports,"forecast-model":o.forecastModel},a.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","port","forecast-model"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(b,e.mergeProps({key:8,map:o.map,line:($=i.otherLayers)==null?void 0:$["load-lines"]},a.$attrs),null,16,["map","line"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(x,e.mergeProps({key:9,map:o.map,zone:(te=i.otherLayers)==null?void 0:te["time-zones"]},a.$attrs),null,16,["map","zone"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(f,e.mergeProps({key:10,map:o.map,area:(ie=i.otherLayers)==null?void 0:ie["voluntary-reporting-area"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(L,e.mergeProps({key:11,map:o.map,area:(oe=i.otherLayers)==null?void 0:oe["special-area"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(B,e.mergeProps({key:12,map:o.map,area:(j=i.otherLayers)==null?void 0:j["day-night"]},a.$attrs),null,16,["map","area"])):e.createCommentVNode("",!0),o.map?(e.openBlock(),e.createBlock(I,e.mergeProps({key:13,map:o.map,"menu-toggle":o.menuToggle,show:i.checkList.includes("graticule")},a.$attrs),null,16,["map","menu-toggle","show"])):e.createCommentVNode("",!0)])}const Xa=O(Ma,[["render",Za]]);class Ne{constructor(t){J(this,"map");J(this,"mercator");J(this,"rampColorLayer");J(this,"rampColorSource");J(this,"particleLayer");J(this,"particleSource");J(this,"rampColorCanvas");J(this,"particleCanvas");J(this,"ratio");this.map=t,this.mercator=new Mo,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,o=0){return t>180?this.convertNLng(t-360,o+1):t<-180?this.convertNLng(t+360,o+1):[t,o]}getBoundLngLat(){var o;const t=(o=this.map)==null?void 0:o.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 _,z;const t=(_=this.map)==null?void 0:_.getBounds();if(!t)return[];const o=((z=this.map)==null?void 0:z.getZoom())+1,r=[t._ne.lng,t._ne.lat],i=[t._sw.lng,t._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[h,d]=this.mercator.px([l,r[1]],o),[m,u]=this.mercator.px([c,i[1]],o),g=Math.round(this.mercator.size*Math.pow(2,o)*(n+s));return[m,u,h+g,d]}getBoundRange(){const t=this.map.getZoom()+1,o=this.mercator.size*Math.pow(2,t),r=this.getBoundPixel();return[r[0]/o,r[2]/o,r[3]/o,r[1]/o]}getWorldCopy(t,o){const r=2**o,[i,l,n,c]=t.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let m=i;m<=n;m++)s.push([m,d]);return s.map(d=>{const m=2**o*256;return[d[0]*m,d[1]*m,m]})}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 o=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=t?"visible":"none";o!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(t){var i;const o=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=t?"visible":"none";o!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class ye{createShader(t,o,r){const i=t.createShader(o);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,o,r,i,l,n,c){const s=t.createTexture();return t.bindTexture(t.TEXTURE_2D,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,o),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,n,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),s}createDataBuffer(t,o,r){if(t){const i=t.createBuffer();return o==="array"?(t.bindBuffer(t.ARRAY_BUFFER,i),r&&t.bufferData(t.ARRAY_BUFFER,r,t.STATIC_DRAW)):o==="element"&&(t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i),r&&t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW)),i}return null}createProgram(t,o,r){const i=t.createProgram(),l=this.createShader(t,t.VERTEX_SHADER,o),n=this.createShader(t,t.FRAGMENT_SHADER,r);if(i&&l&&n&&(t.attachShader(i,l),t.attachShader(i,n),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,o,r){const i=this.createProgram(t,o,r);if(i){const l={program:i},n=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const h=t.getActiveAttrib(i,s);l[h.name]=t.getAttribLocation(i,h.name)}const c=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const h=t.getActiveUniform(i,s);l[h.name]=t.getUniformLocation(i,h.name)}return l}}setup(t,o,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&t){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return o.forEach(([h,d])=>{s.addColorStop(h,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(t,t.LINEAR,t.LINEAR,t.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(t,o=1e3){const r=Math.ceil(Math.sqrt(o)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(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),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const h=this.createDataBuffer(t,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:h}}bind(t,o,r){const i=this.createProgram(t,o,r);if(i){const l=this.createDataBuffer(t,"array",void 0),n=t.getAttribLocation(i,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,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 s=t.getAttribLocation(i,"a_texCoord");return t.enableVertexAttribArray(s),t.vertexAttribPointer(s,2,t.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(t,o,r,i,l,n){const c=this.createProgramWrapper(t,o,r),s=this.createProgramWrapper(t,i,l),h=this.createProgramWrapper(t,i,n),d=this.createDataBuffer(t,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),m=t.createFramebuffer();return{particle:c,screen:s,update:h,quadBuffer:d,frameBuffer:m}}draw(t,o,r,i,l,n,c){var s,h;if(o&&r){t.resize(),o==null||o.viewport(0,0,(s=o==null?void 0:o.canvas)==null?void 0:s.width,(h=o==null?void 0:o.canvas)==null?void 0:h.height),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT);try{o.useProgram(r);const d={resolution:o.getUniformLocation(r,"u_resolution"),image:o.getUniformLocation(r,"u_image"),color:o.getUniformLocation(r,"u_color"),scale:o.getUniformLocation(r,"u_scale"),uvRange:o.getUniformLocation(r,"u_range_u_v"),sRange:o.getUniformLocation(r,"u_range_s")};d.resolution&&o.uniform2f(d.resolution,o.canvas.width*t.ratio,o.canvas.height*t.ratio),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,i),d.image&&o.uniform1i(d.image,0),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,l),d.color&&o.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&o.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&o.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&o.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const m=t.getBoundPixel(),u=t.map.getZoom()+1,g=t.getWorldCopy(m,u);for(const _ of g){const z=(_[0]-m[0])*t.ratio,k=(_[1]-m[3])*t.ratio,M=_[2]*t.ratio,[v,w,y,b]=[z,M+z,k,M+k],x=new Float32Array([v,y,w,y,v,b,v,b,w,y,w,b]);o.bindBuffer(o.ARRAY_BUFFER,n),o.bufferData(o.ARRAY_BUFFER,x,o.STATIC_DRAW),o.drawArrays(o.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(t,o,r,i,l){var n,c;o&&(o==null||o.viewport(0,0,(n=o==null?void 0:o.canvas)==null?void 0:n.width,(c=o==null?void 0:o.canvas)==null?void 0:c.height),o.disable(o.DEPTH_TEST),o.disable(o.STENCIL_TEST),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,r),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,i.texture0),this.renderScreen(t,o,i,l),this.updateParticles(t,o,i,l))}renderScreen(t,o,r,i){o.bindFramebuffer(o.FRAMEBUFFER,r.frameBuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,r.screenTexture,0),o.viewport(0,0,o.canvas.width,o.canvas.height),this.renderScreenTexture(o,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(t,o,r,i),o.bindFramebuffer(o.FRAMEBUFFER,null),this.renderScreenTexture(o,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(t,o,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,o),t.uniform1i(r.u_screen,2),t.uniform1f(r.u_opacity,l),t.drawArrays(t.TRIANGLES,0,6))}renderParticles(t,o,r,i){if(o){o.useProgram(r.particle.program),o.bindBuffer(o.ARRAY_BUFFER,r.indexBuffer),o.enableVertexAttribArray(r.particle.a_index),o.vertexAttribPointer(r.particle.a_index,1,o.FLOAT,!1,0,0),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,r.color.texture),o.uniform1i(r.particle.u_factor,0),o.uniform1i(r.particle.u_particles,1),o.uniform1i(r.particle.u_color_ramp,2),o.uniform1f(r.particle.u_particles_resolution,r.resolution*t.ratio),o.uniform1f(r.particle.u_point,t.ratio);const l=t.getBoundRange();o.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),o.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),o.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),o.drawArrays(o.POINTS,0,r.total)}}updateParticles(t,o,r,i){var n,c;if(o){o.bindFramebuffer(o.FRAMEBUFFER,r.frameBuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,r.texture1,0),o.viewport(0,0,r.resolution,r.resolution),o.useProgram(r.update.program),o.bindBuffer(o.ARRAY_BUFFER,r.quadBuffer),o.enableVertexAttribArray(r.update.a_pos),o.vertexAttribPointer(r.update.a_pos,2,o.FLOAT,!1,0,0),o.uniform1i(r.update.u_factor,0),o.uniform1i(r.update.u_particles,1);const s=t.getBoundRange();o.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),o.uniform1f(r.update.u_rand_seed,Math.random()),o.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),o.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),o.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),o.uniform1f(r.update.u_speed_factor,i.speedFactor*t.ratio),o.uniform1f(r.update.u_drop_rate,i.dropRate),o.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),o.drawArrays(o.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(t,o){t.resize();const r=new Uint8Array(o.canvas.width*o.canvas.height*4).fill(0,0,o.canvas.width*o.canvas.height*4),i=this.createTexture(o,o.NEAREST,o.NEAREST,o.CLAMP_TO_EDGE,r,o.canvas.width,o.canvas.height),l=this.createTexture(o,o.NEAREST,o.NEAREST,o.CLAMP_TO_EDGE,r,o.canvas.width,o.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(t){return new Promise(o=>{const r=new Blob([t],{type:t.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>o(l)})}}class X{}J(X,"vertexSchema",`
2
2
  //canvas 坐标系上的坐标 (x, y)
3
3
  attribute vec2 a_position; //像素坐标
4
4
  attribute vec2 a_texCoord; //纹理坐标
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idmwx/idmui-gl4",
3
3
  "private": false,
4
- "version": "0.5.3",
4
+ "version": "0.5.4",
5
5
  "description": "idm webgl4",
6
6
  "type": "module",
7
7
  "keywords": [