@idmwx/idmui-gl4 3.5.0 → 3.5.1

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.
@@ -2,12 +2,12 @@
2
2
  <span style="display:inline-block; height: 8px;width: 8px;border-radius: 50%;background-color: ${l.color}"></span>
3
3
  <span>${l.seriesName} : </span>
4
4
  <strong>${l.value[1]}m</strong>
5
- </div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],selected:{Speed:!0,Draught:!1},textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)}}},Ar={class:"d-flex justify-space-between align-center"},Lr={class:"d-flex justify-start text-h5 my-2"},Cr={key:0,class:"d-flex justify-end align-center ga-2"},vr={key:1,class:"d-flex justify-end align-center"},zr={class:"d-flex justify-start align-center text-body-1 text-label ga-3"},_r={key:0,class:"btns-box w-100 d-flex justify-center align-center ga-2 mt-2 px-5",style:{height:"48px"}},Sr={class:"summary-box"},Nr={class:"d-flex justify-space-between align-center py-2"},Mr={class:"d-flex justify-center align-center text-h6 ga-2"},Pr={class:"multi-color-icon","aria-hidden":"true"},Vr=["xlink:href"],Tr={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},Er={class:"w-100 d-flex justify-start align-center"},Dr={class:"w-30 text-label font-weight-400"},Rr={class:"flex-1-1-0"},Br={class:"w-100 d-flex justify-start align-center"},Ir={class:"w-30 text-label font-weight-400"},Fr={class:"flex-1-1-0"},Gr={class:"w-100 d-flex justify-start align-center"},jr={class:"w-30 text-label font-weight-400"},Wr={class:"flex-1-1-0"},Zr={class:"table-box w-100 mt-2"},Xr={class:"w-100 d-flex justify-space-between align-center py-2"},Hr={class:"d-flex justify-center align-center text-h6 ga-2"},Or={class:"multi-color-icon","aria-hidden":"true"},Yr=["xlink:href"],Ur={"fixed-header":"",density:"compact",class:"w-100 forecast-table bg-none"},Jr={class:"px-1 text-left text-label font-weight-400",width:"120"},Kr={key:0,class:""},Qr={class:"px-1 text-center"},qr=["src"],$r={key:1},el={class:"px-1 text-center"},tl=["src"],ol={key:1},al={class:"px-1 text-center"},il=["src"],rl={key:1},ll={class:"px-1 text-center"},nl=["src"],sl={key:1},cl={class:"table-box w-100 mt-2 d-flex flex-column justify-start align-center"},ml={class:"w-100 d-flex justify-space-between align-center py-2"},dl={class:"d-flex justify-center align-center text-h6 ga-2"},hl={class:"multi-color-icon","aria-hidden":"true"},pl=["xlink:href"],gl={class:"text-body-2 ga-2"},ul={ref:"tideEchart",class:"w-100",style:{height:"200px"}},fl={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},yl={class:"px-1 text-center text-label font-weight-400",width:"120"},bl={class:"px-1 text-center text-label font-weight-400",width:"120"},wl={class:"px-1 text-center text-label font-weight-400",width:"120"},xl={class:"px-1 text-center"},kl={class:"px-1 text-center"},Al={class:"px-1 text-center"};function Ll(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["port-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u,y;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var p,h,f,w,b,A;return[t.createElementVNode("div",Ar,[t.createElementVNode("div",Lr,[t.createElementVNode("div",{class:t.normalizeClass(["fi mr-2 rounded elevation-4",`fi-${(p=a.port)!=null&&p.cntLoCode?(f=(h=a.port)==null?void 0:h.cntLoCode)==null?void 0:f.toLowerCase():"xx"}`]),style:{width:"36px",height:"24px"}},null,2),t.createElementVNode("div",null,t.toDisplayString((w=a.port)==null?void 0:w.name),1)]),a.simple?(t.openBlock(),t.createElementBlock("div",Cr,[(b=a.followList)!=null&&b.some(x=>{var C;return((C=x.port)==null?void 0:C.id)===a.portId})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:l.handleCancelFollow},{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[2]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:l.handleFollow},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"])),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[4]},8,["onClick"])])):(t.openBlock(),t.createElementBlock("div",vr,[t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[5]},8,["onClick"])]))]),t.createElementVNode("div",zr,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",null,[e[6]||(e[6]=t.createElementVNode("label",null,"UN/LOCODE: ",-1)),t.createElementVNode("span",null,t.toDisplayString((A=a.port)==null?void 0:A.cntLoCode),1)])])]}),_:1}),t.createVNode(s,{class:"w-100"}),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",_r,[(g=a.followList)!=null&&g.some(p=>{var h;return((h=p.port)==null?void 0:h.id)===a.portId})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded flex-1-1-0 btn-bg-3",variant:"tonal",density:"compact",height:"32",onClick:l.handleCancelFollow},{prepend:t.withCtx(()=>e[7]||(e[7]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded flex-1-1-0 btn-bg-3",variant:"tonal",density:"compact",height:"32",onClick:l.handleFollow},{prepend:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{class:"text-none text-body-1 rounded flex-1-1-0 btn-bg-3",variant:"tonal",density:"compact",height:"32",onClick:l.handleMeteoMore},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.7dayForcast")),1)]),_:1},8,["onClick"])])),t.createElementVNode("div",{ref:"scrollDom",class:t.normalizeClass(["w-100 pt-0 flex-1-1-0 overflow-y-auto scroll mb-4",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",Sr,[t.createElementVNode("div",Nr,[t.createElementVNode("div",Mr,[(t.openBlock(),t.createElementBlock("svg",Pr,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Vr)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)]),e[9]||(e[9]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",Tr,[t.createElementVNode("div",Er,[t.createElementVNode("div",Dr,t.toDisplayString(o.$t("port.region")),1),t.createElementVNode("div",Rr,t.toDisplayString(((u=a.port)==null?void 0:u.region)??((y=a.port)==null?void 0:y.city)??"-"),1)]),t.createElementVNode("div",Br,[t.createElementVNode("div",Ir,t.toDisplayString(o.$t("port.position")),1),t.createElementVNode("div",Fr,t.toDisplayString(l.computePosition(a.port)),1)]),t.createElementVNode("div",Gr,[t.createElementVNode("div",jr,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",Wr,t.toDisplayString(l.computeLocalTime(a.realTime,a.port))+" "+t.toDisplayString(l.computeTimeOffset(a.port)),1)])])]),t.createElementVNode("div",Zr,[t.createElementVNode("div",Xr,[t.createElementVNode("div",Hr,[(t.openBlock(),t.createElementBlock("svg",Or,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Yr)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("weather.weather")),1)]),e[10]||(e[10]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=p=>i.currentIndex=p),class:"w-100 gray-bg-1 rounded d-flex justify-space-around align-center ga-0 px-1 mb-2",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,p=>(t.openBlock(),t.createBlock(n,{key:p.index,class:"text-none text-body-1 rounded flex-1-1-0",density:"compact",color:"primary",height:"26",value:p.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(p.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("table",Ur,[t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tableData,p=>(t.openBlock(),t.createElementBlock("tr",{key:p.id},[t.createElementVNode("th",Jr,[t.createTextVNode(t.toDisplayString(o.$t(`${p.key}`))+" ",1),p.unit?(t.openBlock(),t.createElementBlock("span",Kr," ( "+t.toDisplayString(p.unit)+" )",1)):t.createCommentVNode("",!0)]),t.createElementVNode("td",Qr,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value0,style:{height:"30px"}},null,8,qr)):(t.openBlock(),t.createElementBlock("span",$r,t.toDisplayString((p==null?void 0:p.value0)??"-"),1))]),t.createElementVNode("td",el,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value1,style:{height:"30px"}},null,8,tl)):(t.openBlock(),t.createElementBlock("span",ol,t.toDisplayString((p==null?void 0:p.value1)??"-"),1))]),t.createElementVNode("td",al,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value2,style:{height:"30px"}},null,8,il)):(t.openBlock(),t.createElementBlock("span",rl,t.toDisplayString((p==null?void 0:p.value2)??"-"),1))]),t.createElementVNode("td",ll,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value3,style:{height:"30px"}},null,8,nl)):(t.openBlock(),t.createElementBlock("span",sl,t.toDisplayString((p==null?void 0:p.value3)??"-"),1))])]))),128))])])],2)]),t.createElementVNode("div",cl,[t.createElementVNode("div",ml,[t.createElementVNode("div",dl,[(t.openBlock(),t.createElementBlock("svg",hl,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,pl)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),t.createElementVNode("div",gl,[i.showTideDetail?(t.openBlock(),t.createBlock(n,{key:0,icon:"mdi-eye-outline",density:"compact",variant:"plain",size:"small",onClick:e[1]||(e[1]=p=>i.showTideDetail=!1)})):(t.openBlock(),t.createBlock(n,{key:1,icon:"mdi-eye-off-outline",density:"compact",variant:"plain",size:"small",onClick:l.handleTide},null,8,["onClick"]))])]),i.showTideDetail?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4"])},[t.createElementVNode("div",ul,null,512),t.createElementVNode("table",fl,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",yl,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",bl,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",wl,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(p,h)=>{var f;return t.openBlock(),t.createElementBlock("tr",{key:h},[t.createElementVNode("td",xl,t.toDisplayString(o.$t(`tide.${(f=p==null?void 0:p.type)==null?void 0:f.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",kl,t.toDisplayString(l.computeLocalTime(p==null?void 0:p.date,a.port,"MM-DD HH:mm")),1),t.createElementVNode("td",Al,t.toDisplayString((p==null?void 0:p.height)??"-")+" m",1)])}),128))])])],2)):t.createCommentVNode("",!0)])],2)]}),_:1},8,["class"])}const No=K(kr,[["render",Ll],["__scopeId","data-v-df4ebba5"]]),jy="",Cl={name:"IdmPort",components:{PortDetail:No},props:{map:{type:Object},ports:{type:Object},beforeLayer:{type:String},forecastModel:{type:String}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"port-source",layer:"port-layer",showInfo:!1,showDetail:!1,portId:void 0,port:{},hoverPort:{},marker:void 0}},watch:{ports:{handler(){var o,e,a,r,i,l;this.ports?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0}},methods:{handleRender(){var o;this.ports&&(this.map.getSource(this.source)?(o=this.map)==null||o.getSource(this.source).setData(this.ports):(this.map.addSource(this.source,{type:"geojson",data:this.ports}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"icon-allow-overlap":!1,"icon-ignore-placement":!1,"icon-padding":4,"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer)))},handleClear(){this.showInfo=!1,this.showDetail=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new de.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},vl={class:"port-box d-flex flex-column justify-center align-start ga-1"},zl={class:"d-flex justify-start align-center text-label"},_l={class:"d-flex justify-start align-center text-label"};function Sl(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmPortInfo",ref:"idmPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",vl,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",zl,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",_l,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{ports:!0}))}),null,16,["port-id","port","forecast-model","onClose"])):t.createCommentVNode("",!0)])}const Nl=K(Cl,[["render",Sl],["__scopeId","data-v-d5b056e5"]]),Ml={name:"IdmLoadLine",props:{map:{type:Object},show:{type:Boolean},beforeLayer:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{layer:"loadlines-fill",labelLayer:"loadlines-label"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function Pl(o,e,a,r,i,l){return t.openBlock(),t.createElementBlock("div")}const Vl=K(Ml,[["render",Pl]]),Tl={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneBorderLayer:"time-zone-border-layer",zoneLabelLayer:"time-zone-label-layer",marker:null}},computed:{timeZoneName(){return o=>{var a;return(a=v.tz.names().filter(r=>v.tz(v(),r).utcOffset()===o*60))==null?void 0:a[0]}}},watch:{zone:{handler(){var o,e,a,r;this.zone?(this.handleRender(),(o=this.map)==null||o.on("mousemove",[this.zoneLayer],this.handleHover),(e=this.map)==null||e.on("click",[this.zoneLayer],this.handleHover)):(this.handleClear(),(a=this.map)==null||a.off("mousemove",[this.zoneLayer],this.handleHover),(r=this.map)==null||r.off("click",[this.zoneLayer],this.handleHover))},immediate:!0}},methods:{handleRender(){var e;this.handleClear();let o={features:[],type:"FeatureCollection"};o.features=(e=this.zone.features)==null?void 0:e.map(a=>(a.properties.opacity=0,a.properties.lineOpacity=.2,a.properties.width=1,a)),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"]],paint:{"fill-opacity":["get","opacity"],"fill-color":["match",["get","offSet"],"-11.5","rgba(255, 92, 88, 1)","-11","rgba(39, 195, 70, 1)","-10.5","rgba(39, 195, 70, 1)","-10","rgba(40, 106, 255, 1)","-9.5","rgba(40, 106, 255, 1)","-9","rgba(255, 92, 88, 1)","-8.5","rgba(255, 92, 88, 1)","-8","rgba(39, 195, 70, 1)","-7.5","rgba(39, 195, 70, 1)","-7","rgba(40, 106, 255, 1)","-6.5","rgba(40, 106, 255, 1)","-6","rgba(255, 92, 88, 1)","-5.5","rgba(255, 92, 88, 1)","-5","rgba(39, 195, 70, 1)","-4.5","rgba(39, 195, 70, 1)","-4","rgba(40, 106, 255, 1)","-3.5","rgba(40, 106, 255, 1)","-3","rgba(255, 92, 88, 1)","-2.5","rgba(255, 92, 88, 1)","-2","rgba(39, 195, 70, 1)","-1.5","rgba(39, 195, 70, 1)","-1","rgba(40, 106, 255, 1)","-0.5","rgba(40, 106, 255, 1)","+0","rgba(255, 92, 88, 1)","+0.5","rgba(255, 92, 88, 1)","+1","rgba(39, 195, 70, 1)","+1.5","rgba(39, 195, 70, 1)","+2","rgba(40, 106, 255, 1)","+2.5","rgba(40, 106, 255, 1)","+3","rgba(255, 92, 88, 1)","+3.5","rgba(255, 92, 88, 1)","+4","rgba(39, 195, 70, 1)","+4.5","rgba(39, 195, 70, 1)","+5","rgba(40, 106, 255, 1)","+5.5","rgba(40, 106, 255, 1)","+6","rgba(255, 92, 88, 1)","+6.5","rgba(255, 92, 88, 1)","+7","rgba(39, 195, 70, 1)","+7.5","rgba(39, 195, 70, 1)","+8","rgba(40, 106, 255, 1)","+8.5","rgba(40, 106, 255, 1)","+9","rgba(255, 92, 88, 1)","+9.5","rgba(255, 92, 88, 1)","+10","rgba(39, 195, 70, 1)","+10.5","rgba(39, 195, 70, 1)","+11","rgba(40, 106, 255, 1)","+11.5","rgba(40, 106, 255, 1)","rgba(255, 92, 88, 1)"]}},this.beforeLayer),this.map.addLayer({id:this.zoneBorderLayer,type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-opacity":["get","lineOpacity"],"line-width":["get","width"]}},this.beforeLayer))},handleClear(){var o;this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneBorderLayer)&&this.map.removeLayer(this.zoneBorderLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.marker)==null||o.remove()},handleHover(o){var e,a,r;if(o.features.length){(e=this.marker)==null||e.remove();let i={features:[],type:"FeatureCollection"};i.features=(a=this.zone.features)==null?void 0:a.map(n=>{const c=JSON.parse(JSON.stringify(n));return c.properties.offSet===o.features[0].properties.offSet?(c.properties.opacity=.25,c.properties.lineOpacity=.7,c.properties.width=2):(c.properties.opacity=0,c.properties.lineOpacity=.2,c.properties.width=1),c}),(r=this.map.getSource(this.source))==null||r.setData(i);const l=document.createElement("div");l.className="v-card--variant-elevated rounded px-2 py-1 text-body-1",l.innerHTML=`<div>UTC ${o.features[0].properties.offSet}:00</div>
5
+ </div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],selected:{Speed:!0,Draught:!1},textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)}}},Ar={class:"d-flex justify-space-between align-center"},Lr={class:"d-flex justify-start text-h5 my-2"},Cr={key:0,class:"d-flex justify-end align-center ga-2"},vr={key:1,class:"d-flex justify-end align-center"},zr={class:"d-flex justify-start align-center text-h6 text-label ga-3"},_r={key:0,class:"btns-box w-100 d-flex justify-center align-center ga-2 mt-2 px-5",style:{height:"48px"}},Sr={class:"summary-box"},Nr={class:"d-flex justify-space-between align-center py-2"},Mr={class:"d-flex justify-center align-center text-h6 ga-2"},Pr={class:"multi-color-icon","aria-hidden":"true"},Vr=["xlink:href"],Tr={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},Er={class:"w-100 d-flex justify-start align-center"},Dr={class:"w-30 text-label font-weight-400"},Rr={class:"flex-1-1-0"},Br={class:"w-100 d-flex justify-start align-center"},Ir={class:"w-30 text-label font-weight-400"},Fr={class:"flex-1-1-0"},Gr={class:"w-100 d-flex justify-start align-center"},jr={class:"w-30 text-label font-weight-400"},Wr={class:"flex-1-1-0"},Zr={class:"table-box w-100 mt-2"},Xr={class:"w-100 d-flex justify-space-between align-center py-2"},Hr={class:"d-flex justify-center align-center text-h6 ga-2"},Or={class:"multi-color-icon","aria-hidden":"true"},Yr=["xlink:href"],Ur={"fixed-header":"",density:"compact",class:"w-100 forecast-table bg-none"},Jr={class:"px-1 text-left text-label font-weight-400",width:"120"},Kr={key:0,class:""},Qr={class:"px-1 text-center"},qr=["src"],$r={key:1},el={class:"px-1 text-center"},tl=["src"],ol={key:1},al={class:"px-1 text-center"},il=["src"],rl={key:1},ll={class:"px-1 text-center"},nl=["src"],sl={key:1},cl={class:"table-box w-100 mt-2 d-flex flex-column justify-start align-center"},ml={class:"w-100 d-flex justify-space-between align-center py-2"},dl={class:"d-flex justify-center align-center text-h6 ga-2"},hl={class:"multi-color-icon","aria-hidden":"true"},pl=["xlink:href"],gl={class:"text-body-2 ga-2"},ul={ref:"tideEchart",class:"w-100",style:{height:"200px"}},fl={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},yl={class:"px-1 text-center text-label font-weight-400",width:"120"},bl={class:"px-1 text-center text-label font-weight-400",width:"120"},wl={class:"px-1 text-center text-label font-weight-400",width:"120"},xl={class:"px-1 text-center"},kl={class:"px-1 text-center"},Al={class:"px-1 text-center"};function Ll(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["port-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u,y;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var p,h,f,w,b,A;return[t.createElementVNode("div",Ar,[t.createElementVNode("div",Lr,[t.createElementVNode("div",{class:t.normalizeClass(["fi mr-2 rounded elevation-4",`fi-${(p=a.port)!=null&&p.cntLoCode?(f=(h=a.port)==null?void 0:h.cntLoCode)==null?void 0:f.toLowerCase():"xx"}`]),style:{width:"36px",height:"24px"}},null,2),t.createElementVNode("div",null,t.toDisplayString((w=a.port)==null?void 0:w.name),1)]),a.simple?(t.openBlock(),t.createElementBlock("div",Cr,[(b=a.followList)!=null&&b.some(x=>{var C;return((C=x.port)==null?void 0:C.id)===a.portId})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:l.handleCancelFollow},{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[2]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:l.handleFollow},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"])),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[4]},8,["onClick"])])):(t.openBlock(),t.createElementBlock("div",vr,[t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[5]},8,["onClick"])]))]),t.createElementVNode("div",zr,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",null,[e[6]||(e[6]=t.createElementVNode("label",null,"UN/LOCODE: ",-1)),t.createElementVNode("span",null,t.toDisplayString((A=a.port)==null?void 0:A.cntLoCode),1)])])]}),_:1}),t.createVNode(s,{class:"w-100"}),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",_r,[(g=a.followList)!=null&&g.some(p=>{var h;return((h=p.port)==null?void 0:h.id)===a.portId})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded flex-1-1-0 btn-bg-3",variant:"tonal",density:"compact",height:"32",onClick:l.handleCancelFollow},{prepend:t.withCtx(()=>e[7]||(e[7]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded flex-1-1-0 btn-bg-3",variant:"tonal",density:"compact",height:"32",onClick:l.handleFollow},{prepend:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{class:"text-none text-body-1 rounded flex-1-1-0 btn-bg-3",variant:"tonal",density:"compact",height:"32",onClick:l.handleMeteoMore},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.7dayForcast")),1)]),_:1},8,["onClick"])])),t.createElementVNode("div",{ref:"scrollDom",class:t.normalizeClass(["w-100 pt-0 flex-1-1-0 overflow-y-auto scroll mb-4",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",Sr,[t.createElementVNode("div",Nr,[t.createElementVNode("div",Mr,[(t.openBlock(),t.createElementBlock("svg",Pr,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Vr)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)]),e[9]||(e[9]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",Tr,[t.createElementVNode("div",Er,[t.createElementVNode("div",Dr,t.toDisplayString(o.$t("port.region")),1),t.createElementVNode("div",Rr,t.toDisplayString(((u=a.port)==null?void 0:u.region)??((y=a.port)==null?void 0:y.city)??"-"),1)]),t.createElementVNode("div",Br,[t.createElementVNode("div",Ir,t.toDisplayString(o.$t("port.position")),1),t.createElementVNode("div",Fr,t.toDisplayString(l.computePosition(a.port)),1)]),t.createElementVNode("div",Gr,[t.createElementVNode("div",jr,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",Wr,t.toDisplayString(l.computeLocalTime(a.realTime,a.port))+" "+t.toDisplayString(l.computeTimeOffset(a.port)),1)])])]),t.createElementVNode("div",Zr,[t.createElementVNode("div",Xr,[t.createElementVNode("div",Hr,[(t.openBlock(),t.createElementBlock("svg",Or,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Yr)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("weather.weather")),1)]),e[10]||(e[10]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4 py-2"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=p=>i.currentIndex=p),class:"w-100 d-flex justify-space-around align-center ga-0 mb-2",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,p=>(t.openBlock(),t.createBlock(n,{key:p.index,class:"text-none text-body-1 flex-1-1-0 gray-bg-2",density:"compact",color:"primary",height:"26",value:p.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(p.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("table",Ur,[t.createElementVNode("tbody",null,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tableData,p=>(t.openBlock(),t.createElementBlock("tr",{key:p.id},[t.createElementVNode("th",Jr,[t.createTextVNode(t.toDisplayString(o.$t(`${p.key}`))+" ",1),p.unit?(t.openBlock(),t.createElementBlock("span",Kr," ( "+t.toDisplayString(p.unit)+" )",1)):t.createCommentVNode("",!0)]),t.createElementVNode("td",Qr,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value0,style:{height:"30px"}},null,8,qr)):(t.openBlock(),t.createElementBlock("span",$r,t.toDisplayString((p==null?void 0:p.value0)??"-"),1))]),t.createElementVNode("td",el,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value1,style:{height:"30px"}},null,8,tl)):(t.openBlock(),t.createElementBlock("span",ol,t.toDisplayString((p==null?void 0:p.value1)??"-"),1))]),t.createElementVNode("td",al,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value2,style:{height:"30px"}},null,8,il)):(t.openBlock(),t.createElementBlock("span",rl,t.toDisplayString((p==null?void 0:p.value2)??"-"),1))]),t.createElementVNode("td",ll,[p.img?(t.openBlock(),t.createElementBlock("img",{key:0,src:p==null?void 0:p.value3,style:{height:"30px"}},null,8,nl)):(t.openBlock(),t.createElementBlock("span",sl,t.toDisplayString((p==null?void 0:p.value3)??"-"),1))])]))),128))])])],2)]),t.createElementVNode("div",cl,[t.createElementVNode("div",ml,[t.createElementVNode("div",dl,[(t.openBlock(),t.createElementBlock("svg",hl,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,pl)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),t.createElementVNode("div",gl,[i.showTideDetail?(t.openBlock(),t.createBlock(n,{key:0,icon:"mdi-eye-outline",density:"compact",variant:"plain",size:"small",onClick:e[1]||(e[1]=p=>i.showTideDetail=!1)})):(t.openBlock(),t.createBlock(n,{key:1,icon:"mdi-eye-off-outline",density:"compact",variant:"plain",size:"small",onClick:l.handleTide},null,8,["onClick"]))])]),i.showTideDetail?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4"])},[t.createElementVNode("div",ul,null,512),t.createElementVNode("table",fl,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",yl,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",bl,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",wl,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(p,h)=>{var f;return t.openBlock(),t.createElementBlock("tr",{key:h},[t.createElementVNode("td",xl,t.toDisplayString(o.$t(`tide.${(f=p==null?void 0:p.type)==null?void 0:f.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",kl,t.toDisplayString(l.computeLocalTime(p==null?void 0:p.date,a.port,"MM-DD HH:mm")),1),t.createElementVNode("td",Al,t.toDisplayString((p==null?void 0:p.height)??"-")+" m",1)])}),128))])])],2)):t.createCommentVNode("",!0)])],2)]}),_:1},8,["class"])}const No=K(kr,[["render",Ll],["__scopeId","data-v-6adcdfea"]]),jy="",Cl={name:"IdmPort",components:{PortDetail:No},props:{map:{type:Object},ports:{type:Object},beforeLayer:{type:String},forecastModel:{type:String}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"port-source",layer:"port-layer",showInfo:!1,showDetail:!1,portId:void 0,port:{},hoverPort:{},marker:void 0}},watch:{ports:{handler(){var o,e,a,r,i,l;this.ports?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0}},methods:{handleRender(){var o;this.ports&&(this.map.getSource(this.source)?(o=this.map)==null||o.getSource(this.source).setData(this.ports):(this.map.addSource(this.source,{type:"geojson",data:this.ports}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"icon-allow-overlap":!1,"icon-ignore-placement":!1,"icon-padding":4,"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer)))},handleClear(){this.showInfo=!1,this.showDetail=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new de.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},vl={class:"port-box d-flex flex-column justify-center align-start ga-1"},zl={class:"d-flex justify-start align-center text-label"},_l={class:"d-flex justify-start align-center text-label"};function Sl(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmPortInfo",ref:"idmPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",vl,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",zl,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",_l,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{ports:!0}))}),null,16,["port-id","port","forecast-model","onClose"])):t.createCommentVNode("",!0)])}const Nl=K(Cl,[["render",Sl],["__scopeId","data-v-d5b056e5"]]),Ml={name:"IdmLoadLine",props:{map:{type:Object},show:{type:Boolean},beforeLayer:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{layer:"loadlines-fill",labelLayer:"loadlines-label"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function Pl(o,e,a,r,i,l){return t.openBlock(),t.createElementBlock("div")}const Vl=K(Ml,[["render",Pl]]),Tl={name:"IdmTimezone",props:{map:{type:Object},zone:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"time-zone-source",zoneLayer:"time-zone-layer",zoneBorderLayer:"time-zone-border-layer",zoneLabelLayer:"time-zone-label-layer",marker:null}},computed:{timeZoneName(){return o=>{var a;return(a=v.tz.names().filter(r=>v.tz(v(),r).utcOffset()===o*60))==null?void 0:a[0]}}},watch:{zone:{handler(){var o,e,a,r;this.zone?(this.handleRender(),(o=this.map)==null||o.on("mousemove",[this.zoneLayer],this.handleHover),(e=this.map)==null||e.on("click",[this.zoneLayer],this.handleHover)):(this.handleClear(),(a=this.map)==null||a.off("mousemove",[this.zoneLayer],this.handleHover),(r=this.map)==null||r.off("click",[this.zoneLayer],this.handleHover))},immediate:!0}},methods:{handleRender(){var e;this.handleClear();let o={features:[],type:"FeatureCollection"};o.features=(e=this.zone.features)==null?void 0:e.map(a=>(a.properties.opacity=0,a.properties.lineOpacity=.2,a.properties.width=1,a)),this.zone&&(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.zoneLayer,type:"fill",source:this.source,filter:["all",["==","$type","Polygon"]],paint:{"fill-opacity":["get","opacity"],"fill-color":["match",["get","offSet"],"-11.5","rgba(255, 92, 88, 1)","-11","rgba(39, 195, 70, 1)","-10.5","rgba(39, 195, 70, 1)","-10","rgba(40, 106, 255, 1)","-9.5","rgba(40, 106, 255, 1)","-9","rgba(255, 92, 88, 1)","-8.5","rgba(255, 92, 88, 1)","-8","rgba(39, 195, 70, 1)","-7.5","rgba(39, 195, 70, 1)","-7","rgba(40, 106, 255, 1)","-6.5","rgba(40, 106, 255, 1)","-6","rgba(255, 92, 88, 1)","-5.5","rgba(255, 92, 88, 1)","-5","rgba(39, 195, 70, 1)","-4.5","rgba(39, 195, 70, 1)","-4","rgba(40, 106, 255, 1)","-3.5","rgba(40, 106, 255, 1)","-3","rgba(255, 92, 88, 1)","-2.5","rgba(255, 92, 88, 1)","-2","rgba(39, 195, 70, 1)","-1.5","rgba(39, 195, 70, 1)","-1","rgba(40, 106, 255, 1)","-0.5","rgba(40, 106, 255, 1)","+0","rgba(255, 92, 88, 1)","+0.5","rgba(255, 92, 88, 1)","+1","rgba(39, 195, 70, 1)","+1.5","rgba(39, 195, 70, 1)","+2","rgba(40, 106, 255, 1)","+2.5","rgba(40, 106, 255, 1)","+3","rgba(255, 92, 88, 1)","+3.5","rgba(255, 92, 88, 1)","+4","rgba(39, 195, 70, 1)","+4.5","rgba(39, 195, 70, 1)","+5","rgba(40, 106, 255, 1)","+5.5","rgba(40, 106, 255, 1)","+6","rgba(255, 92, 88, 1)","+6.5","rgba(255, 92, 88, 1)","+7","rgba(39, 195, 70, 1)","+7.5","rgba(39, 195, 70, 1)","+8","rgba(40, 106, 255, 1)","+8.5","rgba(40, 106, 255, 1)","+9","rgba(255, 92, 88, 1)","+9.5","rgba(255, 92, 88, 1)","+10","rgba(39, 195, 70, 1)","+10.5","rgba(39, 195, 70, 1)","+11","rgba(40, 106, 255, 1)","+11.5","rgba(40, 106, 255, 1)","rgba(255, 92, 88, 1)"]}},this.beforeLayer),this.map.addLayer({id:this.zoneBorderLayer,type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-opacity":["get","lineOpacity"],"line-width":["get","width"]}},this.beforeLayer))},handleClear(){var o;this.map.getLayer(this.zoneLayer)&&this.map.removeLayer(this.zoneLayer),this.map.getLayer(this.zoneBorderLayer)&&this.map.removeLayer(this.zoneBorderLayer),this.map.getLayer(this.zoneLabelLayer)&&this.map.removeLayer(this.zoneLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.marker)==null||o.remove()},handleHover(o){var e,a,r;if(o.features.length){(e=this.marker)==null||e.remove();let i={features:[],type:"FeatureCollection"};i.features=(a=this.zone.features)==null?void 0:a.map(n=>{const c=JSON.parse(JSON.stringify(n));return c.properties.offSet===o.features[0].properties.offSet?(c.properties.opacity=.25,c.properties.lineOpacity=.7,c.properties.width=2):(c.properties.opacity=0,c.properties.lineOpacity=.2,c.properties.width=1),c}),(r=this.map.getSource(this.source))==null||r.setData(i);const l=document.createElement("div");l.className="v-card--variant-elevated rounded px-2 py-1 text-body-1",l.innerHTML=`<div>UTC ${o.features[0].properties.offSet}:00</div>
6
6
  <div>${v.tz(v().format(),this.timeZoneName(o.features[0].properties.offSet)).format("MM-DD HH:mm")}`,this.marker=new de.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-30]).addTo(this.map)}},handleLeave(){}}};function El(o,e,a,r,i,l){return t.openBlock(),t.createElementBlock("div")}const Dl=K(Tl,[["render",El]]),Rl={name:"IdmVoluntaryReportingArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:ye.useTheme()}},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.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-opacity":.3,"fill-color":"rgba(144, 96, 217, 1)"}},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":"rgba(164, 125, 222, 1)"}},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,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))},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 Bl(o,e,a,r,i,l){return t.openBlock(),t.createElementBlock("div")}const Il=K(Rl,[["render",Bl]]),Fl={name:"IdmSpecialArea",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},setup(){return{Theme:ye.useTheme()}},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.handleClear(),this.area&&(this.area.features.forEach(o=>{o.geometry.type==="Polygon"&&o.geometry.coordinates.forEach(e=>M.LngLatHelper.convertToMonotonicLng2(e))}),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-opacity":.25,"fill-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.areaLayer+"-border",type:"line",source:this.source,filter:["==","$type","Polygon"],paint:{"line-width":1,"line-opacity":.7,"line-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.areaLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-size":.7,"icon-image":"identify","text-anchor":"top","text-field":"{lbl}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1],"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer))},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 Gl(o,e,a,r,i,l){return t.openBlock(),t.createElementBlock("div")}const jl=K(Fl,[["render",Gl]]),Wl={name:"IdmTerminator",props:{map:{type:Object},area:{type:Object},beforeLayer:{type:String}},data(){return{source:"terminator-source",layer:"terminator-layer"}},watch:{area:{handler(){this.handleRender()},immediate:!0}},methods:{handleRender(){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":"rgba(255,255,255,0.3)","fill-color":"rgba(0, 0, 0, 0.3)"}},this.beforeLayer))},handleClear(){this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Zl(o,e,a,r,i,l){return t.openBlock(),t.createElementBlock("div")}const Xl=K(Wl,[["render",Zl]]),Hl={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 o;(o=this.map)!=null&&o.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))},handleClear(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")}}};function Ol(o,e,a,r,i,l){return null}const Yl=K(Hl,[["render",Ol]]),Wy="",Ul={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 o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&(this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),this.map.setPaintProperty(this.lineLayer,"line-width",1)),(e=this.map)!=null&&e.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function Jl(o,e,a,r,i,l){return null}const Kl=K(Ul,[["render",Jl]]),Ql={name:"IdmChinaRoute",props:{map:{type:Object},show:{type:Boolean},locale:{type:String,default:"zhHans"}},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 o,e,a;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible"),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&(this.map.setLayoutProperty(this.labelLayer,"visibility","visible"),this.map.setLayoutProperty(this.labelLayer,"text-field",this.locale==="en"?"{route_name_en}":"{route_name}"))},handleClear(){var o,e,a;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none"),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&this.map.setLayoutProperty(this.labelLayer,"visibility","none")}}};function ql(o,e,a,r,i,l){return null}const $l=K(Ql,[["render",ql]]),Zy="",Xy="",en={name:"IdmTideStations",props:{simple:{type:Boolean,default:!1},map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"dark"},locale:{type:String},realTime:{type:String},timeZone:{type:Number},forecastModel:{type:String},station:{type:Object}},emits:["close","closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{tideData:{},tideTableData:[],currentIndex:0,xDate:[],echartData:{}}},computed:{dateList(){var a,r,i,l;const o=[],e=(a=this.station)!=null&&a.lng&&((r=this.station)!=null&&r.lat)?M.LngLatHelper.guessTimeZoneOffset((i=this.station)==null?void 0:i.lng,(l=this.station)==null?void 0:l.lat):0;for(let n=0;n<4;n++){let c={index:n,dateTimeList:[],label:v().utcOffset(e).add(n,"days").format("MM-DD ddd"),startTime:v().utcOffset(e).add(n,"days").set({hour:0,minute:0,second:0,millisecond:0}).format(),dateTime:v().utcOffset(e).add(n,"days").format()};for(let s=0;s<4;s++)c.dateTimeList.push(v(c.startTime).utcOffset(e).add(s*3,"hours").utc().format());o.push(c)}return o},computeLocalTime(){return function(o,e,a="yyyy-MM-DD HH:mm"){if(!o||!e||e.lng===null||e.lng===void 0||isNaN(e.lng)||e.lat===null||e.lat===void 0||isNaN(e.lat))return"-";const r=e!=null&&e.lng&&(e!=null&&e.lat)?M.LngLatHelper.guessTimeZoneOffset(e==null?void 0:e.lng,e==null?void 0:e.lat):0;return v(o).utcOffset(r).format(a)}},computeTimeOffset(){return function(o){if(!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat))return"-";const e=M.LngLatHelper.guessTimeZoneOffset(o==null?void 0:o.lng,o==null?void 0:o.lat);return"( UTC "+(e>=0?"+":"")+e+" )"}},computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},computeRoundPrecision(){return function(o,e=4){return o==null||isNaN(o)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(o,e)}}},watch:{theme:{handler(){this.$nextTick(()=>{this.initEchart()})}},currentIndex:{handler(){this.initTideTableData(this.tideData)}},station:{handler(){this.$emit("closeAllDetail",{tide:!0}),this.fetchTidesData()},immediate:!0}},methods:{async fetchTidesData(){var a,r,i,l;this.tideLoading=!0,this.tideData={};let o={lat:this.station.lat,lng:this.station.lng,date:(r=(a=this.dateList)==null?void 0:a[this.currentIndex])==null?void 0:r.dateTime,pastDays:1,forecastDays:5,extremes:!0,heights:!0},e=await me.post(`${this.gateway}/api/arc/meteo2/spot/tides/forecast`,o,{headers:{Authorization:this.token||this.defaultMeteoToken}});((i=e==null?void 0:e.data)==null?void 0:i.code)===0&&(this.tideData=((l=e==null?void 0:e.data)==null?void 0:l.data)||{},this.tideLoading=!1,this.initTideTableData(this.tideData))},initTideTableData(o){var e,a;this.tideTableData=Kt.TidesAssist.pickDailyExtremes(o,(a=(e=this.dateList)==null?void 0:e[this.currentIndex])==null?void 0:a.dateTime),this.initEchartData()},initEchartData(){var o;this.xDate=[],this.echartData={height:[]},(o=this.tideTableData)==null||o.forEach(e=>{this.xDate.push(this.computeLocalTime(e.date,this.station,"MM-DD HH:mm")),this.echartData.height.push([this.computeLocalTime(e.date,this.station,"MM-DD HH:mm"),e.height??void 0,"m"])}),this.initEchart()},initEchart(){So.dispose(this.$refs.tideEchart.style);const o=So.init(this.$refs.tideEchart),e={animation:!1,tooltip:{trigger:"axis",formatter:function(a){var i;let r=`<div style="font-size: 13px;">${(i=a[0])==null?void 0:i.value[0]}</div>`;return a.forEach(l=>{l.seriesName.indexOf("Min")<=-1&&l.seriesName.indexOf("Max")<=-1&&(r+=`<div style="font-size: 13px;">
7
7
  <span style="display:inline-block; height: 8px;width: 8px;border-radius: 50%;background-color: ${l.color}"></span>
8
8
  <span>${l.seriesName} : </span>
9
9
  <strong>${l.value[1]}m</strong>
10
- </div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)},handleClose(){this.$emit("close")}}},tn={class:"d-flex justify-space-between align-center"},on={class:"d-flex justify-start text-h5 my-2"},an={class:"d-flex justify-start align-center text-body-1 text-label ga-3"},rn={class:"summary-box w-100"},ln={class:"d-flex justify-space-between align-center py-2"},nn={class:"d-flex justify-center align-center text-h6 ga-2"},sn={class:"multi-color-icon","aria-hidden":"true"},cn=["xlink:href"],mn={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},dn={class:"w-100 d-flex justify-start align-center"},hn={class:"w-30 text-label font-weight-400"},pn={class:"flex-1-1-0"},gn={class:"w-100 d-flex justify-start align-center"},un={class:"w-30 text-label font-weight-400"},fn={class:"flex-1-1-0"},yn={class:"w-100 d-flex justify-start align-center"},bn={class:"w-30 text-label font-weight-400"},wn={class:"flex-1-1-0"},xn={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},kn={class:"w-100 d-flex justify-space-between align-center py-2"},An={class:"d-flex justify-center align-center text-h6 ga-2"},Ln={class:"multi-color-icon","aria-hidden":"true"},Cn=["xlink:href"],vn={ref:"tideEchart",class:"w-100",style:{height:"244px"}},zn={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},_n={class:"px-1 text-center text-label font-weight-400",width:"120"},Sn={class:"px-1 text-center text-label font-weight-400",width:"120"},Nn={class:"px-1 text-center text-label font-weight-400",width:"120"},Mn={class:"px-1 text-center"},Pn={class:"px-1 text-center"},Vn={class:"px-1 text-center"};function Tn(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var y;return[t.createElementVNode("div",tn,[t.createElementVNode("div",on,[t.createElementVNode("div",null,t.toDisplayString((y=a.station)==null?void 0:y.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),t.createElementVNode("div",an,[t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),t.createVNode(s,{class:"w-100"}),t.createElementVNode("div",{class:t.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",rn,[t.createElementVNode("div",ln,[t.createElementVNode("div",nn,[(t.openBlock(),t.createElementBlock("svg",sn,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,cn)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)])]),t.createElementVNode("div",mn,[t.createElementVNode("div",dn,[t.createElementVNode("div",hn,t.toDisplayString(o.$t("tide.region")),1),t.createElementVNode("div",pn,t.toDisplayString(((g=a.station)==null?void 0:g.Country)??((u=a.station)==null?void 0:u.city)??"-"),1)]),t.createElementVNode("div",gn,[t.createElementVNode("div",un,t.toDisplayString(o.$t("tide.position")),1),t.createElementVNode("div",fn,t.toDisplayString(l.computePosition(a.station)),1)]),t.createElementVNode("div",yn,[t.createElementVNode("div",bn,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",wn,t.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+t.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),t.createElementVNode("div",xn,[t.createElementVNode("div",kn,[t.createElementVNode("div",An,[(t.openBlock(),t.createElementBlock("svg",Ln,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Cn)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),e[2]||(e[2]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=y=>i.currentIndex=y),class:"w-100 gray-bg-2 rounded d-flex justify-space-around align-center ga-0 px-1 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,y=>(t.openBlock(),t.createBlock(n,{key:y.label,class:"text-none text-body-1 rounded flex-1-1-0",density:"compact",color:"primary",height:"26",value:y.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("div",vn,null,512),t.createElementVNode("table",zn,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",_n,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",Sn,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",Nn,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(y,p)=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:p},[t.createElementVNode("td",Mn,t.toDisplayString(o.$t(`tide.${(h=y==null?void 0:y.type)==null?void 0:h.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",Pn,t.toDisplayString(l.computeLocalTime(y==null?void 0:y.date,a.station,"MM-DD HH:mm")),1),t.createElementVNode("td",Vn,t.toDisplayString((y==null?void 0:y.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const En=K(en,[["render",Tn],["__scopeId","data-v-3f9ec7de"]]),Hy="",Dn={name:"IdmTideStations",components:{TideDetail:En},props:{map:{type:Object},show:{type:Boolean},locale:{type:String},beforeLayer:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,hoverStation:void 0,marker:null,showDetail:!1,station:void 0}},watch:{show:{handler(){var o,e,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleRender(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}"))},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")},handleClick(o){const e=o.features[0];e.properties&&(this.station=e.properties,this.station.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.station.lng=e.geometry.coordinates[0],this.station.lat=e.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties){this.showInfo=!0,this.hoverStation=e.properties,this.hoverStation.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.hoverStation.lng=e.geometry.coordinates[0],this.hoverStation.lat=e.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new de.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-60]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverStation={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Rn={class:"station-box d-flex flex-column justify-center align-start ga-1"},Bn={class:"d-flex justify-start align-center"},In={class:"d-flex justify-start align-center"},Fn={class:"text-label"};function Gn(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("TideDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmTidalInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"pr-8 text-body-1"},{default:t.withCtx(()=>{var m,d;return[t.createElementVNode("div",Rn,[t.createElementVNode("div",Bn,t.toDisplayString(o.$t("tide.tideStation")),1),t.createElementVNode("div",In,[t.createElementVNode("label",Fn,t.toDisplayString((m=i.hoverStation)==null?void 0:m.name)+" , "+t.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,station:i.station},o.$attrs,{onClose:l.handleCloseDetail}),null,16,["station","onClose"])):t.createCommentVNode("",!0)])}const jn=K(Dn,[["render",Gn],["__scopeId","data-v-ad725d5e"]]),Wn={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function Zn(o,e,a,r,i,l){return null}const Xn=K(Wn,[["render",Zn]]),Oy="",Hn={name:"IdmLatLng",props:{simple:{type:Boolean,default:!1},map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"},labelColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.5)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${M.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${M.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,e;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(e=this.map)==null||e.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let e=30;o>4?e=10:o>3&&(e=15);const a=[];for(let i=-60;i<90;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=e)for(let l=-60;l<90;l+=e)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var e;const o=this.handleComputeLatLngs();(e=this.map)==null||e.getSource(this.source).setData(E.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":1,"text-color":this.labelColor}},this.beforeLayer)}},handleClear(){var o,e,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((e=this.map)==null||e.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function On(o,e,a,r,i,l){var n,c,s;return a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 text-caption text-right rounded",style:t.normalizeStyle({right:i.right+"px"})},[t.createElementVNode("div",null,t.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),t.createElementVNode("div",null,t.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),t.createElementVNode("div",null,t.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4))}const jo=K(Hn,[["render",On]]),Yy="",Yn={name:"IdmFollowPort",components:{PortDetail:No},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-port-source",layer:"follow-port-layer",showInfo:!1,portId:"",hoverPort:{},port:{},marker:void 0,showDetail:!1}},watch:{show:{handler(){var o,e,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,n={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(n)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new de.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Un={class:"port-box d-flex flex-column justify-center align-start ga-1"},Jn={class:"d-flex justify-start align-center text-label"},Kn={class:"d-flex justify-start align-center text-label"};function Qn(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Un,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",Jn,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",Kn,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel,"follow-list":a.followList},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{followPort:!0}))}),null,16,["port-id","port","forecast-model","follow-list","onClose"])):t.createCommentVNode("",!0)])}const qn=K(Yn,[["render",Qn],["__scopeId","data-v-9b28c4ea"]]),Uy="",$n={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-coordinate-source",layer:"follow-coordinate-layer",position:{},showInfo:!1,marker:null}},computed:{computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,e,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{if(r.coordinate){const i=r.coordinate,l={type:"Feature",properties:{id:r.id,remark:r.remark,...r.coordinate},geometry:{type:"Point",coordinates:[i.lng,i.lat]}};o.features.push(l)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1.1,"icon-image":"location","icon-offset":[0,-16]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.off("click",[this.layer],this.handleClick),(e=this.map)==null||e.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,n,c,s,m,d;const e=o.features[0];if(e.properties){const g=e.properties;g.lng=e.geometry.coordinates[0],g.lat=e.geometry.coordinates[1];const u=v(),y=(a=v(this.realTime))==null?void 0:a.diff(u,"d",!0),p={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};y>=0?(n=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||n.fetchForecastData(p):(d=(m=(s=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:s.$refs)==null?void 0:m.idmSpot)==null||d.fetchHistoryData(p)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.position=e.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new de.Marker(r).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"}}},es={class:"position-box d-flex flex-column justify-center align-start ga-1"},ts={class:"d-flex justify-start align-center text-label"},os={key:0,class:"d-flex justify-start align-center text-label"};function as(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard");return t.withDirectives((t.openBlock(),t.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",es,[e[0]||(e[0]=t.createElementVNode("div",null,"Location",-1)),t.createElementVNode("div",ts,[t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(t.openBlock(),t.createElementBlock("div",os,[t.createElementVNode("span",null,t.toDisplayString(i.position.remark??"-"),1)])):t.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[t.vShow,i.showInfo]])}const is=K($n,[["render",as],["__scopeId","data-v-1de14e27"]]),Jy="",rs={name:"IdmOtherLayerr",components:{IdmWarZone:mr,IdmGmdssArea:pr,IdmEcaZone:fr,IdmAlertZone:xr,IdmPort:Nl,IdmLoadLine:Vl,IdmTimezone:Dl,IdmVRA:Il,IdmSpecialArea:jl,IdmTerminator:Xl,IdmWorld12nm:Yl,IdmWorldMarine:Kl,IdmChinaRoute:$l,IdmTideStations:jn,IdmIceAreas:Xn,IdmLatLng:jo,IdmFollowPort:qn,IdmFollowPosition:is},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList","tempFeatherCount"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"dark",tagLayers:[...eo.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[]}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},realTime:{handler(o,e){o&&e&&o!==e&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.theme==="dark"&&(this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark")}},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,e){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(e!=null&&e.includes(l))),r=e==null?void 0:e.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>e==null?void 0:e.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(e||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),e=localStorage.getItem(this.cache.mapFeatherKey);const a=e||"dark";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.mapFeather=o.value,(this.mapFeather==="light"||this.mapFeather==="dark")&&this.$emit("tempFeatherCount")},async fetchOtherLayers(){var e,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await me.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((e=i==null?void 0:i.data)==null?void 0:e.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,n=[];for(const s in l)n.push(me.get(l[s],{headers:{Authorization:this.defaultMeteoToken,key:s}}));(await Promise.all(n)).map(s=>{var g,u,y;const m=((g=s==null?void 0:s.data)==null?void 0:g.data)||(s==null?void 0:s.data),d=(y=(u=s==null?void 0:s.config)==null?void 0:u.headers)==null?void 0:y.key;this.otherLayers[d]=m})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],e=await me.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=e==null?void 0:e.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=e==null?void 0:e.data)==null?void 0:r.data)||(e==null?void 0:e.data))},handleLayersChange(o){const e=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=e,this.fetchOtherLayers()}}},ls={class:"idm-gl4-other-layer"},ns={class:"header-box w-100 d-flex justify-space-between align-center px-4"},ss={class:"text-h5 font-weight-medium"},cs={class:"layers-body mt-4 mb-2 d-flex justify-start align-center flex-wrap"},ms=["onClick"],ds={key:0,src:"https://ossimg.ormwx.com/asset/dark-map.png",class:"border rounded-sm"},hs={key:1,src:"https://ossimg.ormwx.com/asset/nautical-map.png",class:"border rounded-sm"},ps={key:2,src:"https://ossimg.ormwx.com/asset/satellite-map.png",class:"border rounded-sm"},gs={key:3,src:"https://ossimg.ormwx.com/asset/light-map.png",class:"border rounded-sm"},us={class:"text-body-2 text-center pt-2"};function fs(o,e,a,r,i,l){var se,le,N,j,Z,Q,G,B,U;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardItem"),d=t.resolveComponent("VCheckbox"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCard"),y=t.resolveComponent("IdmPort"),p=t.resolveComponent("IdmTideStations"),h=t.resolveComponent("IdmLatLng"),f=t.resolveComponent("IdmTerminator"),w=t.resolveComponent("IdmTimezone"),b=t.resolveComponent("IdmAlertZone"),A=t.resolveComponent("IdmEcaZone"),x=t.resolveComponent("IdmWarZone"),C=t.resolveComponent("IdmGmdssArea"),k=t.resolveComponent("IdmLoadLine"),_=t.resolveComponent("IdmWorldMarine"),z=t.resolveComponent("IdmVRA"),P=t.resolveComponent("IdmSpecialArea"),T=t.resolveComponent("IdmWorld12nm"),V=t.resolveComponent("IdmChinaRoute"),O=t.resolveComponent("IdmIceAreas"),Y=t.resolveComponent("IdmFollowPort"),J=t.resolveComponent("IdmFollowPosition");return t.openBlock(),t.createElementBlock("div",ls,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box transition px-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[t.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:S})=>[t.createVNode(n,t.mergeProps(S,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",ns,[t.createElementVNode("div",ss,t.toDisplayString(o.$t("layer.layers")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[6]||(e[6]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 flex-1-1-0 scroll overflow-y-auto",a.simple?"px-3":"pl-4 pr-2"])},[t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"pb-2"},{default:t.withCtx(()=>[t.createElementVNode("div",cs,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.mapFeathers,S=>(t.openBlock(),t.createElementBlock("div",{key:S.value,class:"mb-4 feather-item",onClick:ee=>l.handleToggleMapFeather(S)},[t.createElementVNode("div",{class:t.normalizeClass([i.mapFeather===S.value?"active":"","img-box"])},[S.value==="dark"?(t.openBlock(),t.createElementBlock("img",ds)):S.value==="nautical"?(t.openBlock(),t.createElementBlock("img",hs)):S.value==="satellite"?(t.openBlock(),t.createElementBlock("img",ps)):(t.openBlock(),t.createElementBlock("img",gs))],2),t.createElementVNode("div",us,t.toDisplayString(o.$t(`layer.${S.locale}`)),1)],8,ms))),128))]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(S=>["graticule","day-night","time-zones"].includes(S.key)),S=>(t.openBlock(),t.createBlock(d,{key:S.key,modelValue:i.checkList,"onUpdate:modelValue":e[0]||(e[0]=ee=>i.checkList=ee),value:S.key,label:o.$t(`layer.${S.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2 mx-n1","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(S=>["ports","alert-zones","tidal-stations"].includes(S.key)),S=>(t.openBlock(),t.createBlock(d,{key:S.key,modelValue:i.checkList,"onUpdate:modelValue":e[1]||(e[1]=ee=>i.checkList=ee),value:S.key,label:o.$t(`layer.${S.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(S=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(S.key)),S=>(t.openBlock(),t.createBlock(d,{key:S.key,modelValue:i.checkList,"onUpdate:modelValue":e[2]||(e[2]=ee=>i.checkList=ee),value:S.key,label:o.$t(`layer.${S.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=S=>i.checkList=S),value:"follow-ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[4]||(e[4]=S=>i.checkList=S),value:"follow-positions",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(y,t.mergeProps({key:0,ref:"idmPorts",simple:a.simple,map:a.map,ports:(se=i.otherLayers)==null?void 0:se.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","real-time","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(p,t.mergeProps({key:1,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,"real-time":a.realTime,"forecast-model":a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","default-meteo-token","show","theme","real-time","forecast-model"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(h,t.mergeProps({key:2,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","menu-toggle","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(f,t.mergeProps({key:3,map:a.map,area:(le=i.otherLayers)==null?void 0:le["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:4,map:a.map,zone:(N=i.otherLayers)==null?void 0:N["time-zones"],"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","zone","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:5,map:a.map,simple:a.simple,zone:(j=i.otherLayers)==null?void 0:j["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:6,map:a.map,zone:(Z=i.otherLayers)==null?void 0:Z["eca-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(x,t.mergeProps({key:7,map:a.map,zone:(Q=i.otherLayers)==null?void 0:Q["war-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:8,map:a.map,area:(G=i.otherLayers)==null?void 0:G["gmdss-areas"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:11,map:a.map,area:(B=i.otherLayers)==null?void 0:B["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:12,map:a.map,area:(U=i.otherLayers)==null?void 0:U["special-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(T,t.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(O,t.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(Y,t.mergeProps({key:16,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(J,t.mergeProps({key:17,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","real-time"])):t.createCommentVNode("",!0)])}const ys=K(rs,[["render",fs]]);class Mo{constructor(e){pe(this,"map");pe(this,"mercator");pe(this,"rampColorLayer");pe(this,"rampColorSource");pe(this,"particleLayer");pe(this,"particleSource");pe(this,"rampColorCanvas");pe(this,"particleCanvas");pe(this,"ratio");this.map=e,this.mercator=new ir,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,a=0){return e>180?this.convertNLng(e-360,a+1):e<-180?this.convertNLng(e+360,a+1):[e,a]}getBoundLngLat(){var a;const e=(a=this.map)==null?void 0:a.getBounds();return e?[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]:[]}getBoundPixel(){var p,h;const e=(p=this.map)==null?void 0:p.getBounds();if(!e)return[];const a=((h=this.map)==null?void 0:h.getZoom())+1,r=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[m,d]=this.mercator.px([l,r[1]],a),[g,u]=this.mercator.px([c,i[1]],a),y=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[g,u,m+y,d]}getBoundRange(){const e=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,e),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(e,a){const r=2**a,[i,l,n,c]=e.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let g=i;g<=n;g++)s.push([g,d]);return s.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let e=this.map.getSource(this.rampColorSource);e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(e){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class $e{createShader(e,a,r){const i=e.createShader(a);if(i&&(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,a,r,i,l,n,c){const s=e.createTexture();return e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),l instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,c,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.bindTexture(e.TEXTURE_2D,null),s}createDataBuffer(e,a,r){if(e){const i=e.createBuffer();return a==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),r&&e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)):a==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),r&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)),i}return null}createProgram(e,a,r){const i=e.createProgram(),l=this.createShader(e,e.VERTEX_SHADER,a),n=this.createShader(e,e.FRAGMENT_SHADER,r);if(i&&l&&n&&(e.attachShader(i,l),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,a,r){const i=this.createProgram(e,a,r);if(i){const l={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const m=e.getActiveAttrib(i,s);l[m.name]=e.getAttribLocation(i,m.name)}const c=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const m=e.getActiveUniform(i,s);l[m.name]=e.getUniformLocation(i,m.name)}return l}}setup(e,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&e){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([m,d])=>{s.addColorStop(m,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(e,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const m=this.createDataBuffer(e,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:m}}bind(e,a,r){const i=this.createProgram(e,a,r);if(i){const l=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",c);const s=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(e,a,r,i,l,n){const c=this.createProgramWrapper(e,a,r),s=this.createProgramWrapper(e,i,l),m=this.createProgramWrapper(e,i,n),d=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=e.createFramebuffer();return{particle:c,screen:s,update:m,quadBuffer:d,frameBuffer:g}}draw(e,a,r,i,l,n,c){var s,m;if(a&&r){e.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(m=a==null?void 0:a.canvas)==null?void 0:m.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const d={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};d.resolution&&a.uniform2f(d.resolution,a.canvas.width*e.ratio,a.canvas.height*e.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),d.image&&a.uniform1i(d.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),d.color&&a.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&a.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&a.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&a.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const g=e.getBoundPixel(),u=e.map.getZoom()+1,y=e.getWorldCopy(g,u);for(const p of y){const h=(p[0]-g[0])*e.ratio,f=(p[1]-g[3])*e.ratio,w=p[2]*e.ratio,[b,A,x,C]=[h,w+h,f,w+f],k=new Float32Array([b,x,A,x,b,C,b,C,A,x,A,C]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,k,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(e,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(e,a,i,l),this.updateParticles(e,a,i,l))}renderScreen(e,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(e,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(e,a,r,i,l){e&&(e.useProgram(r.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r.a_pos),e.vertexAttribPointer(r.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(r.u_screen,2),e.uniform1f(r.u_opacity,l),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*e.ratio),a.uniform1f(r.particle.u_point,e.ratio);const l=e.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(e,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=e.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*e.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(e,a){e.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(e){return new Promise(a=>{const r=new Blob([e],{type:e.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class fe{}pe(fe,"vertexSchema",`
10
+ </div>`)}),r}},legend:{show:!0,right:20,top:0,itemWidth:30,data:["Height"],textStyle:{color:this.Theme.current.value.colors["on-surface"]}},grid:{top:40,left:10,right:10,bottom:30,containLabel:!0},xAxis:[{type:"category",data:this.xDate,boundaryGap:!0,axisTick:{alignWithLabel:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{interval:"auto",margin:15,textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],yAxis:[{name:"(m)",show:!0,nameLocation:"end",position:"left",nameGap:15,splitNumber:5,splitLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-split"]}},alignTicks:!0,axisLine:{show:!0,lineStyle:{color:this.Theme.current.value.colors["echart-axis"]}},axisLabel:{textStyle:{fontSize:12,color:this.Theme.current.value.colors["echart-axis"]}}}],series:[{name:"Height",type:"line",showSymbol:!0,yAxisIndex:0,lineStyle:{color:this.Theme.current.value.colors["map-perple"]},itemStyle:{color:this.Theme.current.value.colors["map-perple"]},data:this.echartData.height}]};o==null||o.setOption(e)},handleClose(){this.$emit("close")}}},tn={class:"d-flex justify-space-between align-center"},on={class:"d-flex justify-start text-h5 my-2"},an={class:"d-flex justify-start align-center text-h6 text-label ga-3"},rn={class:"summary-box w-100"},ln={class:"d-flex justify-space-between align-center py-2"},nn={class:"d-flex justify-center align-center text-h6 ga-2"},sn={class:"multi-color-icon","aria-hidden":"true"},cn=["xlink:href"],mn={class:"gray-bg-2 rounded d-flex flex-column ga-4 pa-4"},dn={class:"w-100 d-flex justify-start align-center"},hn={class:"w-30 text-label font-weight-400"},pn={class:"flex-1-1-0"},gn={class:"w-100 d-flex justify-start align-center"},un={class:"w-30 text-label font-weight-400"},fn={class:"flex-1-1-0"},yn={class:"w-100 d-flex justify-start align-center"},bn={class:"w-30 text-label font-weight-400"},wn={class:"flex-1-1-0"},xn={class:"table-box w-100 mt-2 mb-4 d-flex flex-column justify-start align-center"},kn={class:"w-100 d-flex justify-space-between align-center py-2"},An={class:"d-flex justify-center align-center text-h6 ga-2"},Ln={class:"multi-color-icon","aria-hidden":"true"},Cn=["xlink:href"],vn={ref:"tideEchart",class:"w-100",style:{height:"244px"}},zn={"fixed-header":"",density:"compact",class:"w-100 tide-table bg-none"},_n={class:"px-1 text-center text-label font-weight-400",width:"120"},Sn={class:"px-1 text-center text-label font-weight-400",width:"120"},Nn={class:"px-1 text-center text-label font-weight-400",width:"120"},Mn={class:"px-1 text-center"},Pn={class:"px-1 text-center"},Vn={class:"px-1 text-center"};function Tn(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VBtnToggle"),d=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(d,{class:t.normalizeClass(["tide-detail-container d-flex flex-column justify-start align-center",a.simple?"page":"dialog"])},{default:t.withCtx(()=>{var g,u;return[t.createVNode(c,{class:"w-100"},{default:t.withCtx(()=>{var y;return[t.createElementVNode("div",tn,[t.createElementVNode("div",on,[t.createElementVNode("div",null,t.toDisplayString((y=a.station)==null?void 0:y.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),t.createElementVNode("div",an,[t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideStation")),1)])]}),_:1}),t.createVNode(s,{class:"w-100"}),t.createElementVNode("div",{class:t.normalizeClass(["w-100 pt-0 pb-0 overflow-y-auto scroll",a.simple?"px-3":"px-5"])},[t.createElementVNode("div",rn,[t.createElementVNode("div",ln,[t.createElementVNode("div",nn,[(t.openBlock(),t.createElementBlock("svg",sn,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,cn)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("detail.summary")),1)])]),t.createElementVNode("div",mn,[t.createElementVNode("div",dn,[t.createElementVNode("div",hn,t.toDisplayString(o.$t("tide.region")),1),t.createElementVNode("div",pn,t.toDisplayString(((g=a.station)==null?void 0:g.Country)??((u=a.station)==null?void 0:u.city)??"-"),1)]),t.createElementVNode("div",gn,[t.createElementVNode("div",un,t.toDisplayString(o.$t("tide.position")),1),t.createElementVNode("div",fn,t.toDisplayString(l.computePosition(a.station)),1)]),t.createElementVNode("div",yn,[t.createElementVNode("div",bn,t.toDisplayString(o.$t("time.localTime")),1),t.createElementVNode("div",wn,t.toDisplayString(l.computeLocalTime(a.realTime,a.station))+" "+t.toDisplayString(l.computeTimeOffset(a.station)),1)])])]),t.createElementVNode("div",xn,[t.createElementVNode("div",kn,[t.createElementVNode("div",An,[(t.openBlock(),t.createElementBlock("svg",Ln,[t.createElementVNode("use",{"xlink:href":`#icon-title-${a.theme}`},null,8,Cn)])),t.createElementVNode("div",null,t.toDisplayString(o.$t("tide.tideTimes")),1)]),e[2]||(e[2]=t.createElementVNode("div",{class:"text-body-2 text-success ga-2"},null,-1))]),t.createElementVNode("div",{class:t.normalizeClass(["w-100 gray-bg-2 rounded",a.simple?"pa-2":"pa-4 py-2"])},[t.createVNode(m,{modelValue:i.currentIndex,"onUpdate:modelValue":e[0]||(e[0]=y=>i.currentIndex=y),class:"w-100 d-flex justify-space-around align-center ga-0 mb-4",density:"compact",group:"",height:"26","min-height":"26",rounded:"1",mandatory:""},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.dateList,y=>(t.openBlock(),t.createBlock(n,{key:y.label,class:"text-none text-body-1 flex-1-1-0 gray-bg-2",density:"compact",color:"primary",height:"26",value:y.index},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"]),t.createElementVNode("div",vn,null,512),t.createElementVNode("table",zn,[t.createElementVNode("tbody",null,[t.createElementVNode("tr",null,[t.createElementVNode("th",_n,t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("th",Sn,t.toDisplayString(o.$t("time.time"))+" ( LT ) ",1),t.createElementVNode("th",Nn,t.toDisplayString(o.$t("tide.height"))+" ( m )",1)]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tideTableData,(y,p)=>{var h;return t.openBlock(),t.createElementBlock("tr",{key:p},[t.createElementVNode("td",Mn,t.toDisplayString(o.$t(`tide.${(h=y==null?void 0:y.type)==null?void 0:h.toLowerCase()}`))+" "+t.toDisplayString(o.$t("tide.tide")),1),t.createElementVNode("td",Pn,t.toDisplayString(l.computeLocalTime(y==null?void 0:y.date,a.station,"MM-DD HH:mm")),1),t.createElementVNode("td",Vn,t.toDisplayString((y==null?void 0:y.height)??"-")+" m",1)])}),128))])])],2)])],2)]}),_:1},8,["class"])}const En=K(en,[["render",Tn],["__scopeId","data-v-69fa2a3c"]]),Hy="",Dn={name:"IdmTideStations",components:{TideDetail:En},props:{map:{type:Object},show:{type:Boolean},locale:{type:String},beforeLayer:{type:String}},data(){return{layer:"tide-stations",showInfo:!1,hoverStation:void 0,marker:null,showDetail:!1,station:void 0}},watch:{show:{handler(){var o,e,a,r,i,l;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):(this.handleClear(),(r=this.map)==null||r.off("click",[this.layer],this.handleClick),(i=this.map)==null||i.off("mousemove",[this.layer],this.handleHover),(l=this.map)==null||l.off("mouseleave",[this.layer],this.handleLeave))},immediate:!0},locale:{handler(){this.show&&this.handleRender()},immediate:!0}},methods:{handleRender(){var o;(o=this.map)!=null&&o.getLayer(this.layer)&&(this.map.setLayoutProperty(this.layer,"visibility","visible"),this.map.setLayoutProperty(this.layer,"text-field",this.locale==="en"?"{Location_EN}":"{Location_CN}"))},handleClear(){var o;this.showInfo=!1,(o=this.map)!=null&&o.getLayer(this.layer)&&this.map.setLayoutProperty(this.layer,"visibility","none")},handleClick(o){const e=o.features[0];e.properties&&(this.station=e.properties,this.station.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.station.lng=e.geometry.coordinates[0],this.station.lat=e.geometry.coordinates[1],this.showDetail=!0)},handleHover(o){var a,r;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties){this.showInfo=!0,this.hoverStation=e.properties,this.hoverStation.name=this.locale==="en"?e.properties.Location_EN:e.properties.Location_CN,this.hoverStation.lng=e.geometry.coordinates[0],this.hoverStation.lat=e.geometry.coordinates[1],(a=this.marker)==null||a.remove();const i=(r=document.getElementById("idmTidalInfo"))==null?void 0:r.cloneNode(!0);this.marker=new de.Marker(i).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-60]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverStation={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Rn={class:"station-box d-flex flex-column justify-center align-start ga-1"},Bn={class:"d-flex justify-start align-center"},In={class:"d-flex justify-start align-center"},Fn={class:"text-label"};function Gn(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("TideDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmTidalInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"pr-8 text-body-1"},{default:t.withCtx(()=>{var m,d;return[t.createElementVNode("div",Rn,[t.createElementVNode("div",Bn,t.toDisplayString(o.$t("tide.tideStation")),1),t.createElementVNode("div",In,[t.createElementVNode("label",Fn,t.toDisplayString((m=i.hoverStation)==null?void 0:m.name)+" , "+t.toDisplayString(((d=i.hoverStation)==null?void 0:d.Country)||"-"),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,station:i.station},o.$attrs,{onClose:l.handleCloseDetail}),null,16,["station","onClose"])):t.createCommentVNode("",!0)])}const jn=K(Dn,[["render",Gn],["__scopeId","data-v-ad725d5e"]]),Wn={name:"IdmIceAreas",props:{map:{type:Object},show:{type:Boolean}},data(){return{lineLayer:"ice-area-line",fillLayer:"ice-area-fill"}},watch:{show:{handler(){this.show?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","visible"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","visible")},handleClear(){var o,e;(o=this.map)!=null&&o.getLayer(this.lineLayer)&&this.map.setLayoutProperty(this.lineLayer,"visibility","none"),(e=this.map)!=null&&e.getLayer(this.fillLayer)&&this.map.setLayoutProperty(this.fillLayer,"visibility","none")}}};function Zn(o,e,a,r,i,l){return null}const Xn=K(Wn,[["render",Zn]]),Oy="",Hn={name:"IdmLatLng",props:{simple:{type:Boolean,default:!1},map:{type:Object},show:{type:Boolean},mapFeather:{type:String},beforeLayer:{type:String},menuToggle:{type:Object}},data(){return{lngLat:{e:{lng:0,lat:0},lng:0,lat:0,str:""},source:"idm-lat-lng-source",layer:"idm-lat-lng-layer",labelLayer:"idm-lat-lng-label-layer",right:10}},computed:{lineColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.3)":"rgba(0, 0, 0, 0.3)"},labelColor(){return["satellite","dark"].includes(this.mapFeather)?"rgba(255, 255, 255, 0.8)":"rgba(0, 0, 0, 0.5)"}},watch:{show:{handler(){this.handleBind()},immediate:!0},map:{handler(){var o;this.map&&((o=this.map)==null||o.on("mousemove",this.handleMouseMove))},immediate:!0},"menuToggle.v":{handler(){var o;this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10},immediate:!0},"lngLat.e":{handler(o){this.lngLat.lng=M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty,this.lngLat.lat=M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty,this.lngLat.str=`[${M.LngLatHelper.str2Lat(o==null?void 0:o.lat,4)}, ${M.LngLatHelper.str2Lng(o==null?void 0:o.lng,4)}]`},immediate:!0}},methods:{handleBind(){var o,e;this.show?((o=this.map)==null||o.on("zoomend",this.handleZoomEnd),this.handleRender()):(this.handleClear(),(e=this.map)==null||e.off("zoomend",this.handleZoomEnd))},handleMouseMove(o){this.lngLat.e=o.lngLat},handleComputeLatLngs(){var r;const o=(r=this.map)==null?void 0:r.getZoom();let e=30;o>4?e=10:o>3&&(e=15);const a=[];for(let i=-60;i<90;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[-180,i],[180,i]]}});for(let i=-180;i<180;i+=e)a.push({type:"Feature",geometry:{type:"LineString",coordinates:[[i,-90],[i,90]]}});for(let i=180;i>-180;i-=e)for(let l=-60;l<90;l+=e)a.push({type:"Feature",geometry:{type:"Point",coordinates:[i,l]},properties:{val:`${l>0?l+" N":l===0?l:l*-1+" S"}, ${i>0?i+" E":i*-1+" W"}`}});return a},handleZoomEnd(){var e;const o=this.handleComputeLatLngs();(e=this.map)==null||e.getSource(this.source).setData(E.featureCollection(o))},handleRender(){if(this.handleClear(),this.map){const o=this.handleComputeLatLngs();this.map.addSource(this.source,{type:"geojson",data:{type:"FeatureCollection",features:o}}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":this.lineColor,"line-width":1}},this.beforeLayer),this.map.addLayer({id:this.labelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-field":"{val}","text-rotation-alignment":"viewport","text-offset":[0,1],"text-size":10,"text-allow-overlap":!0},paint:{"text-opacity":1,"text-color":this.labelColor}},this.beforeLayer)}},handleClear(){var o,e,a,r,i,l;(o=this.map)!=null&&o.getLayer(this.layer)&&((e=this.map)==null||e.removeLayer(this.layer)),(a=this.map)!=null&&a.getLayer(this.labelLayer)&&((r=this.map)==null||r.removeLayer(this.labelLayer)),(i=this.map)!=null&&i.getSource(this.source)&&((l=this.map)==null||l.removeSource(this.source))}}};function On(o,e,a,r,i,l){var n,c,s;return a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:0,class:"idm-lat-lng-tip-gl4 pa-2 text-caption text-right rounded",style:t.normalizeStyle({right:i.right+"px"})},[t.createElementVNode("div",null,t.toDisplayString((n=i.lngLat)==null?void 0:n.lat),1),t.createElementVNode("div",null,t.toDisplayString((c=i.lngLat)==null?void 0:c.lng),1),t.createElementVNode("div",null,t.toDisplayString((s=i.lngLat)==null?void 0:s.str),1)],4))}const jo=K(Hn,[["render",On]]),Yy="",Yn={name:"IdmFollowPort",components:{PortDetail:No},props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array}},emits:["closeAllDetail"],setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-port-source",layer:"follow-port-layer",showInfo:!1,portId:"",hoverPort:{},port:{},marker:void 0,showDetail:!1}},watch:{show:{handler(){var o,e,a;this.show?(this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{var i;if((i=r.port)!=null&&i.id){const l=r.port,n={type:"Feature",properties:l,geometry:{type:"Point",coordinates:[l.lng,l.lat]}};o.features.push(n)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1,"icon-image":"port","icon-offset":[0,-13],"text-anchor":"bottom","text-field":"{name}","text-rotation-alignment":"viewport","text-size":10,"text-offset":[0,1.6]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.showInfo=!1,this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)},handleClick(o){const e=o.features[0];this.portId=e.properties.id,e.properties.id&&(this.port=e.properties,this.port.lng=e.geometry.coordinates[0],this.port.lat=e.geometry.coordinates[1],this.port.forecastModel=this.forecastModel,this.showDetail=!0)},handleHover(o){var r,i;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.hoverPort=e.properties,(r=this.marker)==null||r.remove();const l=(i=document.getElementById("idmFollowPortInfo"))==null?void 0:i.cloneNode(!0);this.marker=new de.Marker(l).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,this.hoverPort={},(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"},handleCloseDetail(){this.showDetail=!1}}},Un={class:"port-box d-flex flex-column justify-center align-start ga-1"},Jn={class:"d-flex justify-start align-center text-label"},Kn={class:"d-flex justify-start align-center text-label"};function Qn(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard"),s=t.resolveComponent("PortDetail");return t.openBlock(),t.createElementBlock("div",null,[t.withDirectives(t.createVNode(c,{id:"idmFollowPortInfo",ref:"idmFollowPortInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",Un,[t.createElementVNode("div",null,t.toDisplayString(o.$t("port.port")),1),t.createElementVNode("div",Jn,[t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.name??"-"),1)]),t.createElementVNode("div",Kn,[e[1]||(e[1]=t.createElementVNode("label",{class:"pr-1"},"LoCode : ",-1)),t.createElementVNode("span",null,t.toDisplayString(i.hoverPort.loCode??"-"),1)])])]),_:1})]),_:1},512),[[t.vShow,i.showInfo]]),i.showDetail?(t.openBlock(),t.createBlock(s,t.mergeProps({key:0,"port-id":i.portId,port:i.port,"forecast-model":a.forecastModel,"follow-list":a.followList},o.$attrs,{onClose:l.handleCloseDetail,onCloseAllDetail:e[0]||(e[0]=m=>o.$emit("closeAllDetail",{followPort:!0}))}),null,16,["port-id","port","forecast-model","follow-list","onClose"])):t.createCommentVNode("",!0)])}const qn=K(Yn,[["render",Qn],["__scopeId","data-v-9b28c4ea"]]),Uy="",$n={name:"IdmFollowPosition",props:{map:{type:Object},beforeLayer:{type:String},forecastModel:{type:String},show:{type:Boolean},followList:{type:Array},realTime:{type:String}},setup(){return{Theme:ye.useTheme()}},data(){return{source:"follow-coordinate-source",layer:"follow-coordinate-layer",position:{},showInfo:!1,marker:null}},computed:{computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}}},watch:{show:{handler(){var o,e,a;this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()},immediate:!0},followList:{handler(){var o,e,a;this.followList&&this.show?(this.handleClear(),this.handleRender(),(o=this.map)==null||o.on("click",[this.layer],this.handleClick),(e=this.map)==null||e.on("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.on("mouseleave",[this.layer],this.handleLeave)):this.handleClear()}}},methods:{handleRender(){var e,a;const o={features:[],type:"FeatureCollection"};(e=this.followList)==null||e.forEach(r=>{if(r.coordinate){const i=r.coordinate,l={type:"Feature",properties:{id:r.id,remark:r.remark,...r.coordinate},geometry:{type:"Point",coordinates:[i.lng,i.lat]}};o.features.push(l)}}),this.map.getSource(this.source)?(a=this.map)==null||a.getSource(this.source).setData(o):(this.map.addSource(this.source,{type:"geojson",data:o}),this.map.addLayer({id:this.layer,type:"symbol",source:this.source,filter:["all",["==","$type","Point"],["!=","disabled",!0]],layout:{"symbol-placement":"point","icon-size":1.1,"icon-image":"location","icon-offset":[0,-16]},paint:{"text-color":this.Theme.current.value.colors["on-surface"],"text-halo-width":1}},this.beforeLayer))},handleClear(){var o,e,a;this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source),(o=this.map)==null||o.off("click",[this.layer],this.handleClick),(e=this.map)==null||e.off("mousemove",[this.layer],this.handleHover),(a=this.map)==null||a.off("mouseleave",[this.layer],this.handleLeave)},handleClick(o){var a,r,i,l,n,c,s,m,d;const e=o.features[0];if(e.properties){const g=e.properties;g.lng=e.geometry.coordinates[0],g.lat=e.geometry.coordinates[1];const u=v(),y=(a=v(this.realTime))==null?void 0:a.diff(u,"d",!0),p={followId:g.id,lat:g.lat,lng:g.lng,datetime:this.realTime,forecastModel:this.forecastModel};y>=0?(n=(l=(i=(r=this.$parent)==null?void 0:r.$parent)==null?void 0:i.$refs)==null?void 0:l.idmSpot)==null||n.fetchForecastData(p):(d=(m=(s=(c=this.$parent)==null?void 0:c.$parent)==null?void 0:s.$refs)==null?void 0:m.idmSpot)==null||d.fetchHistoryData(p)}},handleHover(o){var a;this.map.getCanvas().style.cursor="pointer";const e=o.features[0];if(e.properties.id){this.showInfo=!0,this.position=e.properties,(a=this.marker)==null||a.remove();const r=document.getElementById("idmFollowPositionInfo").cloneNode(!0);this.marker=new de.Marker(r).setLngLat([o.lngLat.lng,o.lngLat.lat]).setOffset([0,-70]).addTo(this.map)}},handleLeave(){var o;this.showInfo=!1,(o=this.marker)==null||o.remove(),this.map.getCanvas().style.cursor="grab"}}},es={class:"position-box d-flex flex-column justify-center align-start ga-1"},ts={class:"d-flex justify-start align-center text-label"},os={key:0,class:"d-flex justify-start align-center text-label"};function as(o,e,a,r,i,l){const n=t.resolveComponent("VCardText"),c=t.resolveComponent("VCard");return t.withDirectives((t.openBlock(),t.createBlock(c,{id:"idmFollowPositionInfo",ref:"idmFollowPositionInfo"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-body-1 pr-8"},{default:t.withCtx(()=>[t.createElementVNode("div",es,[e[0]||(e[0]=t.createElementVNode("div",null,"Location",-1)),t.createElementVNode("div",ts,[t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.position)),1)]),i.position.remark?(t.openBlock(),t.createElementBlock("div",os,[t.createElementVNode("span",null,t.toDisplayString(i.position.remark??"-"),1)])):t.createCommentVNode("",!0)])]),_:1})]),_:1},512)),[[t.vShow,i.showInfo]])}const is=K($n,[["render",as],["__scopeId","data-v-1de14e27"]]),Jy="",rs={name:"IdmOtherLayerr",components:{IdmWarZone:mr,IdmGmdssArea:pr,IdmEcaZone:fr,IdmAlertZone:xr,IdmPort:Nl,IdmLoadLine:Vl,IdmTimezone:Dl,IdmVRA:Il,IdmSpecialArea:jl,IdmTerminator:Xl,IdmWorld12nm:Yl,IdmWorldMarine:Kl,IdmChinaRoute:$l,IdmTideStations:jn,IdmIceAreas:Xn,IdmLatLng:jo,IdmFollowPort:qn,IdmFollowPosition:is},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},ts:{type:String},forecastModel:{type:String},realTime:{type:String}},emits:["map","other","menuToggle","mapFeather","theme","followLayerList","otherCheckList","tempFeatherCount"],data(){return{right:10,toggle:!1,mapFeather:localStorage.getItem("mapFeathersCacheGL4")||"dark",tagLayers:[...eo.LayerHelper.OTHER_LAYERS.filter(o=>o.enabled)],layerWeight:0,otherLayers:{},activeOtherLayers:[],cache:{v:"0.0.2",versionKey:"otherLayerCacheVersionGL4",checkListKey:"otherChecklistCacheGL4",followListKey:"otherFollowListCacheGL4",mapFeatherKey:"mapFeathersCacheGL4"},mapFeathers:[{name:"Light Map",value:"light",locale:"lightMap"},{name:"Dark Map",value:"dark",locale:"darkMap"},{name:"Satelite Map",value:"satellite",locale:"satelliteMap"},{name:"Nautical Map",value:"nautical",locale:"nauticalMap"}],checkList:[]}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.otherLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},realTime:{handler(o,e){o&&e&&o!==e&&this.checkList.includes("day-night")&&this.fetchDayNightLayer()}},theme:{handler(){this.theme==="light"?this.mapFeather=["light","nautical"].includes(this.mapFeather)?this.mapFeather:"light":this.theme==="dark"&&(this.mapFeather=["dark","satellite"].includes(this.mapFeather)?this.mapFeather:"dark")}},mapFeather:{handler(){localStorage.setItem(this.cache.mapFeatherKey,this.mapFeather),this.$emit("mapFeather",this.mapFeather),this.$emit("theme",["light","nautical"].includes(this.mapFeather)?"light":"dark")},immediate:!0},checkList:{handler(o,e){localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),this.activeOtherLayers=this.tagLayers.filter(l=>this.checkList.includes(l.key))||[];const a=o==null?void 0:o.filter(l=>!(e!=null&&e.includes(l))),r=e==null?void 0:e.filter(l=>!(o!=null&&o.includes(l))),i=o==null?void 0:o.filter(l=>e==null?void 0:e.includes(l));if((r==null?void 0:r.length)>0&&r.forEach(l=>{this.otherLayers[l]=void 0,delete this.otherLayers[l]}),(a==null?void 0:a.length)>0){const l=this.tagLayers.filter(n=>this.checkList.includes(n.key)&&!i.includes(n.key))||[];this.handleLayersChange(l)}this.$emit("otherCheckList",this.checkList)}}},async mounted(){this.fetchCache()},methods:{fetchCache(){const o=localStorage.getItem(this.cache.versionKey);this.cache.v!==o&&(localStorage.removeItem(this.cache.checkListKey),localStorage.removeItem(this.cache.followListKey),localStorage.removeItem(this.cache.mapFeatherKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.checkListKey);this.checkList=JSON.parse(e||'["eca-zones"]'),localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList)),e=localStorage.getItem(this.cache.mapFeatherKey);const a=e||"dark";this.$emit("mapFeather",a),localStorage.setItem(this.cache.mapFeatherKey,a)},handleMenuToggle(){this.$emit("menuToggle","otherLayers")},handleToggleMapFeather(o){this.mapFeather=o.value,(this.mapFeather==="light"||this.mapFeather==="dark")&&this.$emit("tempFeatherCount")},async fetchOtherLayers(){var e,a;let o=this.layerWeight;if(o){const r=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],i=await me.get(`${r}/api/arc/other/layers/links?l=${o}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(((e=i==null?void 0:i.data)==null?void 0:e.code)===0){const l=(a=i==null?void 0:i.data)==null?void 0:a.data,n=[];for(const s in l)n.push(me.get(l[s],{headers:{Authorization:this.defaultMeteoToken,key:s}}));(await Promise.all(n)).map(s=>{var g,u,y;const m=((g=s==null?void 0:s.data)==null?void 0:g.data)||(s==null?void 0:s.data),d=(y=(u=s==null?void 0:s.config)==null?void 0:u.headers)==null?void 0:y.key;this.otherLayers[d]=m})}}},async fetchDayNightLayer(){var a,r;const o=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],e=await me.get(`${o}/api/arc/other/layers/links?l=1024&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});((a=e==null?void 0:e.data)==null?void 0:a.code)===0&&(this.otherLayers["day-night"]=((r=e==null?void 0:e.data)==null?void 0:r.data)||(e==null?void 0:e.data))},handleLayersChange(o){const e=o==null?void 0:o.reduce((a,r)=>a+(r==null?void 0:r.weight),0);this.layerWeight=e,this.fetchOtherLayers()}}},ls={class:"idm-gl4-other-layer"},ns={class:"header-box w-100 d-flex justify-space-between align-center px-4"},ss={class:"text-h5 font-weight-medium"},cs={class:"layers-body mt-4 mb-2 d-flex justify-start align-center flex-wrap"},ms=["onClick"],ds={key:0,src:"https://ossimg.ormwx.com/asset/dark-map.png",class:"border rounded-sm"},hs={key:1,src:"https://ossimg.ormwx.com/asset/nautical-map.png",class:"border rounded-sm"},ps={key:2,src:"https://ossimg.ormwx.com/asset/satellite-map.png",class:"border rounded-sm"},gs={key:3,src:"https://ossimg.ormwx.com/asset/light-map.png",class:"border rounded-sm"},us={class:"text-body-2 text-center pt-2"};function fs(o,e,a,r,i,l){var se,le,N,j,Z,Q,G,B,U;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardItem"),d=t.resolveComponent("VCheckbox"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCard"),y=t.resolveComponent("IdmPort"),p=t.resolveComponent("IdmTideStations"),h=t.resolveComponent("IdmLatLng"),f=t.resolveComponent("IdmTerminator"),w=t.resolveComponent("IdmTimezone"),b=t.resolveComponent("IdmAlertZone"),A=t.resolveComponent("IdmEcaZone"),x=t.resolveComponent("IdmWarZone"),C=t.resolveComponent("IdmGmdssArea"),k=t.resolveComponent("IdmLoadLine"),_=t.resolveComponent("IdmWorldMarine"),z=t.resolveComponent("IdmVRA"),P=t.resolveComponent("IdmSpecialArea"),T=t.resolveComponent("IdmWorld12nm"),V=t.resolveComponent("IdmChinaRoute"),O=t.resolveComponent("IdmIceAreas"),Y=t.resolveComponent("IdmFollowPort"),J=t.resolveComponent("IdmFollowPosition");return t.openBlock(),t.createElementBlock("div",ls,[t.createElementVNode("div",{class:t.normalizeClass(["menu-bar-box transition px-1 rounded",a.simple?"simple":""]),style:t.normalizeStyle({top:a.top+10+"px",right:i.right+"px",paddingTop:a.paddingTop+"px",height:a.menuHeight+"px"})},[t.createVNode(c,{text:o.$t("layer.mapLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:S})=>[t.createVNode(n,t.mergeProps(S,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[5]||(e[5]=[t.createElementVNode("i",{class:"iconfont icon-Layer text-h4"},null,-1)])),_:2,__:[5]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),t.createElementVNode("div",{class:t.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",ns,[t.createElementVNode("div",ss,t.toDisplayString(o.$t("layer.layers")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[6]||(e[6]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[6]},8,["onClick"])]),t.createElementVNode("div",{class:t.normalizeClass(["list-box w-100 flex-1-1-0 scroll overflow-y-auto",a.simple?"px-3":"pl-4 pr-2"])},[t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.mapFeathers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"pb-2"},{default:t.withCtx(()=>[t.createElementVNode("div",cs,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.mapFeathers,S=>(t.openBlock(),t.createElementBlock("div",{key:S.value,class:"mb-4 feather-item",onClick:ee=>l.handleToggleMapFeather(S)},[t.createElementVNode("div",{class:t.normalizeClass([i.mapFeather===S.value?"active":"","img-box"])},[S.value==="dark"?(t.openBlock(),t.createElementBlock("img",ds)):S.value==="nautical"?(t.openBlock(),t.createElementBlock("img",hs)):S.value==="satellite"?(t.openBlock(),t.createElementBlock("img",ps)):(t.openBlock(),t.createElementBlock("img",gs))],2),t.createElementVNode("div",us,t.toDisplayString(o.$t(`layer.${S.locale}`)),1)],8,ms))),128))]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(S=>["graticule","day-night","time-zones"].includes(S.key)),S=>(t.openBlock(),t.createBlock(d,{key:S.key,modelValue:i.checkList,"onUpdate:modelValue":e[0]||(e[0]=ee=>i.checkList=ee),value:S.key,label:o.$t(`layer.${S.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2 mx-n1","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.pointsOfInteresting")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(S=>["ports","alert-zones","tidal-stations"].includes(S.key)),S=>(t.openBlock(),t.createBlock(d,{key:S.key,modelValue:i.checkList,"onUpdate:modelValue":e[1]||(e[1]=ee=>i.checkList=ee),value:S.key,label:o.$t(`layer.${S.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.otherLayers")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.tagLayers.filter(S=>!["graticule","day-night","time-zones","ports","alert-zones","tidal-stations"].includes(S.key)),S=>(t.openBlock(),t.createBlock(d,{key:S.key,modelValue:i.checkList,"onUpdate:modelValue":e[2]||(e[2]=ee=>i.checkList=ee),value:S.key,label:o.$t(`layer.${S.locale}`),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label"]))),128))]),_:1})]),_:1}),t.createVNode(u,{class:"block-bg mx-auto mb-3",elevation:"0"},{default:t.withCtx(()=>[t.createVNode(m,{class:"border-b-thin"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("layer.myFollows")),1)]),_:1})]),_:1}),t.createVNode(g,{class:"py-2 mx-n1"},{default:t.withCtx(()=>[t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=S=>i.checkList=S),value:"follow-ports",label:o.$t("layer.ports"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"]),t.createVNode(d,{modelValue:i.checkList,"onUpdate:modelValue":e[4]||(e[4]=S=>i.checkList=S),value:"follow-positions",label:o.$t("layer.locations"),color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})],2)],6),a.map?(t.openBlock(),t.createBlock(y,t.mergeProps({key:0,ref:"idmPorts",simple:a.simple,map:a.map,ports:(se=i.otherLayers)==null?void 0:se.ports,gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime,theme:a.theme},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","ports","gateway","token","forecast-model","real-time","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(p,t.mergeProps({key:1,ref:"idmIideStation",simple:a.simple,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,show:i.checkList.includes("tidal-stations"),theme:a.theme,"real-time":a.realTime,"forecast-model":a.forecastModel,"before-layer":"empty-layer-3"},o.$attrs),null,16,["simple","map","gateway","token","default-meteo-token","show","theme","real-time","forecast-model"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(h,t.mergeProps({key:2,simple:a.simple,map:a.map,"menu-toggle":a.menuToggle,show:i.checkList.includes("graticule")},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","menu-toggle","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(f,t.mergeProps({key:3,map:a.map,area:(le=i.otherLayers)==null?void 0:le["day-night"]},o.$attrs,{"before-layer":"empty-layer-2"}),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(w,t.mergeProps({key:4,map:a.map,zone:(N=i.otherLayers)==null?void 0:N["time-zones"],"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["map","zone","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(b,t.mergeProps({key:5,map:a.map,simple:a.simple,zone:(j=i.otherLayers)==null?void 0:j["alert-zones"]},o.$attrs,{"before-layer":"empty-layer-3",theme:a.theme}),null,16,["map","simple","zone","theme"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(A,t.mergeProps({key:6,map:a.map,zone:(Z=i.otherLayers)==null?void 0:Z["eca-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(x,t.mergeProps({key:7,map:a.map,zone:(Q=i.otherLayers)==null?void 0:Q["war-zones"]},o.$attrs),null,16,["map","zone"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(C,t.mergeProps({key:8,map:a.map,area:(G=i.otherLayers)==null?void 0:G["gmdss-areas"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(k,t.mergeProps({key:9,map:a.map,show:i.checkList.includes("load-lines")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(_,t.mergeProps({key:10,map:a.map,token:a.token,show:i.checkList.includes("worldMarine")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(z,t.mergeProps({key:11,map:a.map,area:(B=i.otherLayers)==null?void 0:B["voluntary-reporting-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(P,t.mergeProps({key:12,map:a.map,area:(U=i.otherLayers)==null?void 0:U["special-area"]},o.$attrs),null,16,["map","area"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(T,t.mergeProps({key:13,map:a.map,token:a.token,show:i.checkList.includes("world12nm")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(V,t.mergeProps({key:14,map:a.map,token:a.token,show:i.checkList.includes("chinaRoute")},o.$attrs),null,16,["map","token","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(O,t.mergeProps({key:15,map:a.map,show:i.checkList.includes("ice-areas")},o.$attrs),null,16,["map","show"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(Y,t.mergeProps({key:16,ref:"idmFollowPort",simple:a.simple,map:a.map,show:i.checkList.includes("follow-ports"),gateway:a.gateway,token:a.token,"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs,{"before-layer":"empty-layer-3"}),null,16,["simple","map","show","gateway","token","forecast-model","real-time"])):t.createCommentVNode("",!0),a.map?(t.openBlock(),t.createBlock(J,t.mergeProps({key:17,ref:"idmFollowPosition",simple:a.simple,map:a.map,show:i.checkList.includes("follow-positions"),"forecast-model":a.forecastModel,"real-time":a.realTime},o.$attrs),null,16,["simple","map","show","forecast-model","real-time"])):t.createCommentVNode("",!0)])}const ys=K(rs,[["render",fs]]);class Mo{constructor(e){pe(this,"map");pe(this,"mercator");pe(this,"rampColorLayer");pe(this,"rampColorSource");pe(this,"particleLayer");pe(this,"particleSource");pe(this,"rampColorCanvas");pe(this,"particleCanvas");pe(this,"ratio");this.map=e,this.mercator=new ir,this.rampColorLayer="ramp-color-layer",this.rampColorSource="ramp-color-source",this.particleLayer="particle-layer",this.particleSource="particle-source",this.rampColorCanvas=document.createElement("canvas"),this.particleCanvas=document.createElement("canvas"),this.ratio=window.devicePixelRatio}convertNLng(e,a=0){return e>180?this.convertNLng(e-360,a+1):e<-180?this.convertNLng(e+360,a+1):[e,a]}getBoundLngLat(){var a;const e=(a=this.map)==null?void 0:a.getBounds();return e?[[e._sw.lng,e._ne.lat],[e._ne.lng,e._ne.lat],[e._ne.lng,e._sw.lat],[e._sw.lng,e._sw.lat]]:[]}getBoundPixel(){var p,h;const e=(p=this.map)==null?void 0:p.getBounds();if(!e)return[];const a=((h=this.map)==null?void 0:h.getZoom())+1,r=[e._ne.lng,e._ne.lat],i=[e._sw.lng,e._sw.lat],[l,n]=this.convertNLng(r[0]),[c,s]=this.convertNLng(i[0]),[m,d]=this.mercator.px([l,r[1]],a),[g,u]=this.mercator.px([c,i[1]],a),y=Math.round(this.mercator.size*Math.pow(2,a)*(n+s));return[g,u,m+y,d]}getBoundRange(){const e=this.map.getZoom()+1,a=this.mercator.size*Math.pow(2,e),r=this.getBoundPixel();return[r[0]/a,r[2]/a,r[3]/a,r[1]/a]}getWorldCopy(e,a){const r=2**a,[i,l,n,c]=e.map(d=>~~(d/(r*256))),s=[];for(let d=c;d<=l;d++)for(let g=i;g<=n;g++)s.push([g,d]);return s.map(d=>{const g=2**a*256;return[d[0]*g,d[1]*g,g]})}resize(){let e=this.map.getSource(this.rampColorSource);e.setCoordinates(this.getBoundLngLat()),e=this.map.getSource(this.particleSource),e.setCoordinates(this.getBoundLngLat()),this.rampColorCanvas.width=this.map._canvas.clientWidth,this.rampColorCanvas.height=this.map._canvas.clientHeight,this.particleCanvas.width=this.map._canvas.clientWidth,this.particleCanvas.height=this.map._canvas.clientHeight}toggle(e){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.rampColorLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.rampColorLayer,"visibility",r)}toggleParticle(e){var i;const a=(i=this.map)==null?void 0:i.getLayoutProperty(this.particleLayer,"visibility"),r=e?"visible":"none";a!==r&&this.map.setLayoutProperty(this.particleLayer,"visibility",r)}}class $e{createShader(e,a,r){const i=e.createShader(a);if(i&&(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)))throw new Error(e.getShaderInfoLog(i)||"error happened while create shader...");return i}createTexture(e,a,r,i,l,n,c){const s=e.createTexture();return e.bindTexture(e.TEXTURE_2D,s),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,r),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,i),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,i),l instanceof Uint8Array?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,c,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,l),e.bindTexture(e.TEXTURE_2D,null),s}createDataBuffer(e,a,r){if(e){const i=e.createBuffer();return a==="array"?(e.bindBuffer(e.ARRAY_BUFFER,i),r&&e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW)):a==="element"&&(e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),r&&e.bufferData(e.ELEMENT_ARRAY_BUFFER,r,e.STATIC_DRAW)),i}return null}createProgram(e,a,r){const i=e.createProgram(),l=this.createShader(e,e.VERTEX_SHADER,a),n=this.createShader(e,e.FRAGMENT_SHADER,r);if(i&&l&&n&&(e.attachShader(i,l),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)))throw new Error(e.getProgramInfoLog(i)||"error happened while creating ramp color program");return i}createProgramWrapper(e,a,r){const i=this.createProgram(e,a,r);if(i){const l={program:i},n=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const m=e.getActiveAttrib(i,s);l[m.name]=e.getAttribLocation(i,m.name)}const c=e.getProgramParameter(i,e.ACTIVE_UNIFORMS);for(let s=0;s<c;s++){const m=e.getActiveUniform(i,s);l[m.name]=e.getUniformLocation(i,m.name)}return l}}setup(e,a,r=!1,i,l){const n=document.createElement("canvas");n.width=256,n.height=1;const c=n.getContext("2d");if(c&&e){const s=c==null?void 0:c.createLinearGradient(0,0,256,0);return a.forEach(([m,d])=>{s.addColorStop(m,d)}),c.fillStyle=s,c.fillRect(0,0,256,1),{canvas:n,texture:this.createTexture(e,e.LINEAR,e.LINEAR,e.CLAMP_TO_EDGE,r?new Uint8Array(c.getImageData(0,0,256,1).data):n,i,l)}}}setupParticle(e,a=1e3){const r=Math.ceil(Math.sqrt(a)),i=r*r,l=new Uint8Array(i*4);for(let d=0;d<l.length;d++)l[d]=Math.floor(Math.random()*256);const n=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),c=this.createTexture(e,e.NEAREST,e.NEAREST,e.CLAMP_TO_EDGE,l,r,r),s=new Float32Array(i);for(let d=0;d<i;d++)s[d]=d;const m=this.createDataBuffer(e,"array",s);return{resolution:r,total:i,texture0:n,texture1:c,indexBuffer:m}}bind(e,a,r){const i=this.createProgram(e,a,r);if(i){const l=this.createDataBuffer(e,"array",void 0),n=e.getAttribLocation(i,"a_position");e.enableVertexAttribArray(n),e.vertexAttribPointer(n,2,e.FLOAT,!1,0,0);const c=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);this.createDataBuffer(e,"array",c);const s=e.getAttribLocation(i,"a_texCoord");return e.enableVertexAttribArray(s),e.vertexAttribPointer(s,2,e.FLOAT,!1,0,0),{program:i,aPositionBuffer:l}}return{}}bindParticle(e,a,r,i,l,n){const c=this.createProgramWrapper(e,a,r),s=this.createProgramWrapper(e,i,l),m=this.createProgramWrapper(e,i,n),d=this.createDataBuffer(e,"array",new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])),g=e.createFramebuffer();return{particle:c,screen:s,update:m,quadBuffer:d,frameBuffer:g}}draw(e,a,r,i,l,n,c){var s,m;if(a&&r){e.resize(),a==null||a.viewport(0,0,(s=a==null?void 0:a.canvas)==null?void 0:s.width,(m=a==null?void 0:a.canvas)==null?void 0:m.height),a.clearColor(0,0,0,0),a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);try{a.useProgram(r);const d={resolution:a.getUniformLocation(r,"u_resolution"),image:a.getUniformLocation(r,"u_image"),color:a.getUniformLocation(r,"u_color"),scale:a.getUniformLocation(r,"u_scale"),uvRange:a.getUniformLocation(r,"u_range_u_v"),sRange:a.getUniformLocation(r,"u_range_s")};d.resolution&&a.uniform2f(d.resolution,a.canvas.width*e.ratio,a.canvas.height*e.ratio),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i),d.image&&a.uniform1i(d.image,0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,l),d.color&&a.uniform1i(d.color,1),c!=null&&c.uvRange&&(c!=null&&c.sRange)&&(d.uvRange&&a.uniform2f(d.uvRange,c.uvRange[0],c.uvRange[1]),d.sRange&&a.uniform2f(d.sRange,c.sRange[0],c.sRange[1])),d.scale&&a.uniform1f(d.scale,(c==null?void 0:c.scale)||1);const g=e.getBoundPixel(),u=e.map.getZoom()+1,y=e.getWorldCopy(g,u);for(const p of y){const h=(p[0]-g[0])*e.ratio,f=(p[1]-g[3])*e.ratio,w=p[2]*e.ratio,[b,A,x,C]=[h,w+h,f,w+f],k=new Float32Array([b,x,A,x,b,C,b,C,A,x,A,C]);a.bindBuffer(a.ARRAY_BUFFER,n),a.bufferData(a.ARRAY_BUFFER,k,a.STATIC_DRAW),a.drawArrays(a.TRIANGLES,0,6)}}catch(d){console.log(`render failed...${d}`)}}}drawParticle(e,a,r,i,l){var n,c;a&&(a==null||a.viewport(0,0,(n=a==null?void 0:a.canvas)==null?void 0:n.width,(c=a==null?void 0:a.canvas)==null?void 0:c.height),a.disable(a.DEPTH_TEST),a.disable(a.STENCIL_TEST),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,i.texture0),this.renderScreen(e,a,i,l),this.updateParticles(e,a,i,l))}renderScreen(e,a,r,i){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.screenTexture,0),a.viewport(0,0,a.canvas.width,a.canvas.height),this.renderScreenTexture(a,r.backgroundTexture,r.screen,r.quadBuffer,.95),this.renderParticles(e,a,r,i),a.bindFramebuffer(a.FRAMEBUFFER,null),this.renderScreenTexture(a,r.screenTexture,r.screen,r.quadBuffer,1);const l=r.backgroundTexture;r.backgroundTexture=r.screenTexture,r.screenTexture=l}renderScreenTexture(e,a,r,i,l){e&&(e.useProgram(r.program),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r.a_pos),e.vertexAttribPointer(r.a_pos,2,e.FLOAT,!1,0,0),e.activeTexture(e.TEXTURE2),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(r.u_screen,2),e.uniform1f(r.u_opacity,l),e.drawArrays(e.TRIANGLES,0,6))}renderParticles(e,a,r,i){if(a){a.useProgram(r.particle.program),a.bindBuffer(a.ARRAY_BUFFER,r.indexBuffer),a.enableVertexAttribArray(r.particle.a_index),a.vertexAttribPointer(r.particle.a_index,1,a.FLOAT,!1,0,0),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,r.color.texture),a.uniform1i(r.particle.u_factor,0),a.uniform1i(r.particle.u_particles,1),a.uniform1i(r.particle.u_color_ramp,2),a.uniform1f(r.particle.u_particles_resolution,r.resolution*e.ratio),a.uniform1f(r.particle.u_point,e.ratio);const l=e.getBoundRange();a.uniform4f(r.particle.u_viewport,l[0],l[1],l[2],l[3]),a.uniform2f(r.particle.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.particle.u_factor_max,i.uvRange[1],i.uvRange[1]),a.drawArrays(a.POINTS,0,r.total)}}updateParticles(e,a,r,i){var n,c;if(a){a.bindFramebuffer(a.FRAMEBUFFER,r.frameBuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r.texture1,0),a.viewport(0,0,r.resolution,r.resolution),a.useProgram(r.update.program),a.bindBuffer(a.ARRAY_BUFFER,r.quadBuffer),a.enableVertexAttribArray(r.update.a_pos),a.vertexAttribPointer(r.update.a_pos,2,a.FLOAT,!1,0,0),a.uniform1i(r.update.u_factor,0),a.uniform1i(r.update.u_particles,1);const s=e.getBoundRange();a.uniform4f(r.update.u_viewport,s[0],s[1],s[2],s[3]),a.uniform1f(r.update.u_rand_seed,Math.random()),a.uniform2f(r.update.u_factor_res,(n=r==null?void 0:r.image)==null?void 0:n.width,(c=r==null?void 0:r.image)==null?void 0:c.height),a.uniform2f(r.update.u_factor_min,i.uvRange[0],i.uvRange[0]),a.uniform2f(r.update.u_factor_max,i.uvRange[1],i.uvRange[1]),a.uniform1f(r.update.u_speed_factor,i.speedFactor*e.ratio),a.uniform1f(r.update.u_drop_rate,i.dropRate),a.uniform1f(r.update.u_drop_rate_bump,i.dropRateBump),a.drawArrays(a.TRIANGLES,0,6)}const l=r.texture0;r.texture0=r.texture1,r.texture1=l}resize(e,a){e.resize();const r=new Uint8Array(a.canvas.width*a.canvas.height*4).fill(0,0,a.canvas.width*a.canvas.height*4),i=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height),l=this.createTexture(a,a.NEAREST,a.NEAREST,a.CLAMP_TO_EDGE,r,a.canvas.width,a.canvas.height);return{screenTexture:i,backgroundTexture:l}}async loadImg(e){return new Promise(a=>{const r=new Blob([e],{type:e.type}),i=URL.createObjectURL(r),l=new Image;l.crossOrigin="anonymous",l.src=i,l.onload=()=>a(l)})}}class fe{}pe(fe,"vertexSchema",`
11
11
  //canvas 坐标系上的坐标 (x, y)
12
12
  attribute vec2 a_position; //像素坐标
13
13
  attribute vec2 a_texCoord; //纹理坐标
@@ -214,7 +214,7 @@
214
214
  <path
215
215
  d="M420.66666667 959.17a16.08 16.08 0 0 1-15.91-13.49A15.89 15.89 0 0 1 415.50666667 928c1.49-0.55 38.88-14.76 72.79-65.52A354.55 354.55 0 0 1 162.66666667 509.17a450.14 450.14 0 0 1 450.5-450.5 16.07 16.07 0 0 1 15.91 13.48 15.88 15.88 0 0 1-10.75 17.66c-1.58 0.58-39.13 14.9-73.07 65.95A354.22 354.22 0 0 1 871.66666667 509.17a16 16 0 0 1-0.52 4.05A450.14 450.14 0 0 1 420.66666667 959.17zM554.80666667 94.72C351.57666667 123.2 194.66666667 298.21 194.66666667 509.17c0 177.08 144.06 321.74 321.13 322.48a16 16 0 0 1 14.07 23.49c-16.11 30.42-34.27 52.37-50.85 68C682.25666667 894.63 839.16666667 719.63 839.16666667 508.67a15.94 15.94 0 0 1 0.47-3.86C837.30666667 329.33 693.82666667 187 517.80666667 186.67A16 16 0 0 1 503.66666667 163.21c16.21-30.69 34.47-52.79 51.14-68.49z"
216
216
  fill="#ffffff" p-id="18386"></path>
217
- </svg>`,ge=document.createElement("div");ge.className="idm-tropical-gl4-hourly-marker",ge.innerHTML=`<div class="${S.geometry.coordinates[1]>=0?"center north":"center south"}">${ce}</div>`;const ue=new de.Marker(ge).setLngLat(S.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",U)}else(N=this.map)!=null&&N.getSource(this.interpolateSource)&&((j=this.map)==null||j.getSource(this.interpolateSource).setData(this.empty))},handleClick(o){var i,l,n,c,s,m,d,g,u,y,p;const e=o.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((g=e==null?void 0:e.properties)==null?void 0:g.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([o.lngLat.lng,o.lngLat.lat])},drawTropicalsInfoMaker(o){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(o).setOffset([220,0]):this.activeTropicalsMarker=new de.Marker(e).setLngLat(o).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var o;(o=this.activeTropicalsMarker)==null||o.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(o){var r,i,l,n,c,s;o.disabled=!o.disabled;const e=`${o.name}-${o.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(E.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(E.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(o){this.$emit("tropicalProbability",o)},handleToggleCircles(o){var e,a;o.showCircle=!o.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===o.name&&(r.properties.showCircle=o.showCircle)}),this.handleRender()},handleComputePolygons(o){const e=[];for(const a of o){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(o,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=E.lineArc(o,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=E.lineArc(o,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=E.lineArc(o,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=E.lineArc(o,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=E.lineString(r);return E.lineToPolygon(i,{properties:a})},handleNotification(o){this.$emit("tropicalNotification",o)},handleHover(o){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(o.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new de.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var o;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(o=this.hoverMarker)==null||o.remove(),this.hoverMarker=void 0}}},hm={class:"idm-tropical-gl4"},pm={class:"pb-1"},gm={class:"text-h5 font-weight-600"},um={key:0,class:"text-h5 font-weight-600"},fm={class:"text-body-1"},ym={class:"text-label"},bm={class:"d-flex justify-space-between align-center"},wm={class:"w-60"},xm={class:"text-label pr-1"},km={class:"flex-1-1-0"},Am={class:"text-label pr-1"},Lm={class:"py-2 d-flex justify-space-between align-center"},Cm={class:"w-60"},vm={class:"text-label pr-1"},zm={class:"flex-1-1-0"},_m={class:"text-label pr-1"},Sm={class:"d-flex align-center flex-1-1-100 justify-space-between mt-n1"},Nm={class:"text-label pr-1",style:{width:"70px"}},Mm={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Pm={class:"more"},Vm={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},Tm={class:"pa-1"},Em={class:"legend d-flex justify-start align-center py-2"},Dm={class:"label"},Rm={class:"legend d-flex justify-start align-center py-2"},Bm={class:"label"},Im={class:"legend d-flex justify-start align-center py-2"},Fm={class:"label"},Gm={class:"pa-1"},jm={class:"legend d-flex justify-start align-center py-2"},Wm={class:"label"},Zm={class:"legend d-flex justify-start align-center py-2"},Xm={class:"label"},Hm={class:"legend d-flex justify-start align-center py-2"},Om={class:"label"},Ym={class:"pa-1"},Um={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Jm={class:"label"},Km={class:"label"},Qm={class:"w-100 legend d-flex justify-start align-center py-2"},qm={class:"label"},$m={class:"w-100 legend d-flex justify-start align-center py-2"},ed={class:"label"},td={key:1,class:"my-3 w-100",style:{height:"80px"}},od={class:"legend d-flex justify-start align-center"},ad={class:"label"},id={class:"legend d-flex justify-start align-center"},rd={class:"label"},ld={class:"legend d-flex justify-start align-center"},nd={class:"label"},sd={class:"legend d-flex justify-start align-center"},cd={class:"label"},md={class:"legend d-flex justify-start align-center"},dd={class:"label"},hd={class:"legend d-flex justify-start align-center"},pd={class:"label"},gd={class:"legend d-flex justify-start align-center"},ud={class:"label"},fd={class:"legend d-flex justify-start align-center"},yd={class:"label"},bd={class:"legend d-flex justify-start align-center"},wd={class:"label"},xd={class:"legend d-flex justify-start align-center"},kd={class:"label"},Ad={class:"d-flex justify-star align-center"},Ld={class:"font-weight-600 mr-1"},Cd={class:""},vd={class:"port-box d-flex flex-column justify-center align-start ga-2"},zd={key:0,class:"d-flex justify-start align-center"},_d={class:"text-label pr-1"},Sd={key:1,class:"d-flex justify-start align-center"},Nd={class:"text-label pr-1"},Md={key:2,class:"d-flex justify-start align-center"},Pd={class:"text-label pr-1"},Vd={key:3,class:"d-flex justify-start align-center"},Td={class:"text-label pr-1"},Ed={key:4,class:"d-flex justify-start align-center"},Dd={class:"text-label pr-1"},Rd={key:5,class:"d-flex justify-start align-center"},Bd={class:"text-label pr-1"},Id={class:"d-flex justify-start align-center"},Fd={class:"text-label pr-1"},Gd={key:6,class:"d-flex justify-start align-center"},jd={class:"text-label pr-1"},Wd={key:7,class:"d-flex justify-start align-center"},Zd={class:"text-label pr-1"},Xd={class:"d-flex justify-start align-center"},Hd={class:"text-label pr-1"};function Od(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VCardTitle");return t.openBlock(),t.createElementBlock("div",hm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:y})=>[t.createVNode(n,t.mergeProps(y,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!o.$attrs.hideTropicalsLegend?(t.openBlock(),t.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:t.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[t.createVNode(g,{class:t.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z;return[t.createElementVNode("div",pm,[t.createElementVNode("span",gm,t.toDisplayString(a.locale==="en"?(y=i.activeTropicals)==null?void 0:y.Name:((p=i.activeTropicals)==null?void 0:p.nameCn)||((h=i.activeTropicals)==null?void 0:h.Name)||"-"),1),(w=(f=i.activeTropicals)==null?void 0:f.history)!=null&&w.levelI18n?(t.openBlock(),t.createElementBlock("span",um," , "+t.toDisplayString(o.$t("tropical."+((A=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:A.levelI18n))),1)):t.createCommentVNode("",!0)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:t.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),t.createElementVNode("div",fm,[t.createElementVNode("span",ym,t.toDisplayString(o.$t("actions.lastUpdate"))+": ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTime(((C=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:C.updated)||((z=(_=(k=i.activeTropicals)==null?void 0:k.forecasts)==null?void 0:_.filter(P=>!P.disabled)[0])==null?void 0:z.date),a.timeZone)),1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1 py-3"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C;return[t.createElementVNode("div",bm,[t.createElementVNode("div",wm,[t.createElementVNode("label",xm,t.toDisplayString(o.$t("weather.windSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((p=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:p.kts)||"-")+" kts",1),t.createElementVNode("span",null,", BF "+t.toDisplayString(l.computeBF(((f=(h=i.activeTropicals)==null?void 0:h.history)==null?void 0:f.kts)||"-")),1)]),t.createElementVNode("div",km,[t.createElementVNode("label",Am,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((b=(w=i.activeTropicals)==null?void 0:w.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),t.createElementVNode("div",Lm,[t.createElementVNode("div",Cm,[t.createElementVNode("label",vm,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.kts)||"-")+" kts",1)]),t.createElementVNode("div",zm,[t.createElementVNode("label",_m,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),t.createElementVNode("div",Sm,[t.createElementVNode("label",Nm,t.toDisplayString(o.$t("tropical.models"))+" : ",1),t.createElementVNode("div",Mm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((C=i.activeTropicals)==null?void 0:C.forecasts,(k,_)=>(t.openBlock(),t.createBlock(n,{key:_,density:"compact",variant:k.disabled?"text":"flat",color:k.disabled?"":"primary","min-width":30,class:t.normalizeClass(["model text-none text-body-1 px-1",k.disabled?"btn-border-1 btn-bg-1":""]),onClick:t.withModifiers(z=>l.handleForecastToggle(k),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(k.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),t.createVNode(m),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=t.withModifiers(y=>i.showLegend=!i.showLegend,["stop"]))},{prepend:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("weather.legend")),1)]),_:1},8,["color"]),t.createElementVNode("div",Pm,[t.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=t.withModifiers(y=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(t.openBlock(),t.createElementBlock("div",Vm,[t.createElementVNode("div",Tm,[t.createElementVNode("div",Em,[e[5]||(e[5]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",Dm,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",Rm,[e[6]||(e[6]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",Bm,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",Im,[e[7]||(e[7]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",Fm,t.toDisplayString(o.$t("tropical.sty")),1)])]),t.createElementVNode("div",Gm,[t.createElementVNode("div",jm,[e[8]||(e[8]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",Wm,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",Zm,[e[9]||(e[9]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",Xm,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",Hm,[e[10]||(e[10]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",Om,t.toDisplayString(o.$t("tropical.superTy")),1)])]),t.createElementVNode("div",Ym,[t.createElementVNode("div",Um,[e[11]||(e[11]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Jm,t.toDisplayString(o.$t("tropical.history")),1),e[12]||(e[12]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Km,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Qm,[e[13]||(e[13]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",qm,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",$m,[e[14]||(e[14]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",ed,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])])])):(t.openBlock(),t.createElementBlock("div",td,[t.withDirectives(t.createVNode(g,{elevation:"16"},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[t.createElementVNode("div",od,[e[15]||(e[15]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",ad,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",id,[e[16]||(e[16]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",rd,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",ld,[e[17]||(e[17]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",nd,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",sd,[e[18]||(e[18]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",cd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",md,[e[19]||(e[19]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",dd,t.toDisplayString(o.$t("tropical.sty")),1)]),t.createElementVNode("div",hd,[e[20]||(e[20]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",pd,t.toDisplayString(o.$t("tropical.superTy")),1)]),t.createElementVNode("div",gd,[e[21]||(e[21]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",ud,t.toDisplayString(o.$t("tropical.history")),1)]),t.createElementVNode("div",fd,[e[22]||(e[22]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",yd,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",bd,[e[23]||(e[23]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",wd,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",xd,[e[24]||(e[24]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",kd,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])],2),[[t.vShow,i.showLegend]])]),_:1})]),_:1},512),[[t.vShow,i.showLegend]])]))],2)):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(g,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"280"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>{var y,p,h,f;return[t.createElementVNode("div",Ad,[t.createElementVNode("span",Ld,t.toDisplayString(a.locale==="en"?(y=i.hoverPoint)==null?void 0:y.Name:((p=i.hoverPoint)==null?void 0:p.nameCn)||((h=i.hoverPoint)==null?void 0:h.Name)),1),t.createElementVNode("span",Cd," ["+t.toDisplayString(o.$t("tropical."+((f=i.hoverPoint)==null?void 0:f.levelI18n)))+"]",1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z,P,T,V,O,Y,J,se,le;return[t.createElementVNode("div",vd,[((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",zd,[t.createElementVNode("label",_d,t.toDisplayString(o.$t("tropical.updated"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((p=i.hoverPoint)==null?void 0:p.update,a.timeZone)),1)])):t.createCommentVNode("",!0),((h=i.hoverPoint)==null?void 0:h.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Sd,[t.createElementVNode("label",Nd,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((f=i.hoverPoint)==null?void 0:f.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((w=i.hoverPoint)==null?void 0:w.type)==="history"?(t.openBlock(),t.createElementBlock("div",Md,[t.createElementVNode("label",Pd,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((A=i.hoverPoint)==null?void 0:A.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Vd,[t.createElementVNode("label",Td,t.toDisplayString(o.$t("tropical.model"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):t.createCommentVNode("",!0),((C=i.hoverPoint)==null?void 0:C.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Ed,[t.createElementVNode("label",Dd,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((_=JSON.parse(((k=i.hoverPoint)==null?void 0:k.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(t.openBlock(),t.createElementBlock("div",Rd,[t.createElementVNode("label",Bd,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((P=i.hoverPoint)==null?void 0:P.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Id,[t.createElementVNode("label",Fd,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((T=i.hoverPoint)==null?void 0:T.pressure)??"-")+" hPa",1)]),((V=i.hoverPoint)==null?void 0:V.type)==="history"?(t.openBlock(),t.createElementBlock("div",Gd,[t.createElementVNode("label",jd,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((Y=JSON.parse(((O=i.hoverPoint)==null?void 0:O.movement)||"{}"))==null?void 0:Y.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((J=i.hoverPoint)==null?void 0:J.type)==="history"?(t.openBlock(),t.createElementBlock("div",Wd,[t.createElementVNode("label",Zd,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((le=JSON.parse(((se=i.hoverPoint)==null?void 0:se.movement)||"{}"))==null?void 0:le.deg)??"-")+" °",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Xd,[t.createElementVNode("label",Hd,t.toDisplayString(o.$t("tropical.position"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showHoverPoint]])])}const Wo=K(dm,[["render",Od]]),c1="",Yd={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const o=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-o)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-o)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-o)/2}px`}},hourOptions(){const o=[];for(let e=0;e<24;e++)o.push(e<10?`0${e}:00`:`${e}:00`);return o.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(o,e){o!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(o,e){o&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(o,e){o!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(o){var i;const e=v(o).utc().date(),a=Math.ceil(v(o).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(o))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const o=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:o,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:o+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:o+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(o){const e=o||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const o=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${o} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const o=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=o.clone().format("YYYY-MM-DD"),this.currentTime=o.clone().format("HH:00")},handleClickOutside(o){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(o.target)&&(this.showDatePicker=!1)}}},Ud={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},Jd={class:"pa-0",style:{width:"320px"}},Kd={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},Qd={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function qd(o,e,a,r,i,l){const n=t.resolveComponent("VDatePicker"),c=t.resolveComponent("VDivider"),s=t.resolveComponent("VListItemTitle"),m=t.resolveComponent("VListItem"),d=t.resolveComponent("VList"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VBtn"),y=t.resolveComponent("VCardActions"),p=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",Ud,[t.createElementVNode("div",{style:t.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:t.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},t.toDisplayString(i.currentDateTime)+" | UTC "+t.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(t.openBlock(),t.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:t.normalizeStyle(l.getStyle)},{default:t.withCtx(()=>[t.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Jd,[t.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),t.createVNode(c,{class:"h-100",vertical:""}),t.createElementVNode("div",Kd,[t.createElementVNode("div",Qd,t.toDisplayString(o.$t("time.time")),1),t.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.hourOptions,(h,f)=>(t.openBlock(),t.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),t.createVNode(c),t.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:t.withCtx(()=>[t.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):t.createCommentVNode("",!0)],512)}const to=K(Yd,[["render",qd]]),m1="",$d={name:"IdmPoint",components:{DateTimePicker:to},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array,default:()=>[]}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,3}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=180||"0 ~ 180"],lngMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"],latDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,2}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=90||"0 ~ 90"],latMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},computedTzTime(){return o=>v.tz(v(o),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return o=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(((i=this.positionOffset)==null?void 0:i.slice(0,1))==="+"?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return o?v.tz(v(o),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},computeRoundPrecision(){return function(o,e=4){return o==null||isNaN(o)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(o,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?(this.realTime&&(this.form.dateTime=this.realTime),this.$nextTick(()=>{var o;(o=this.$refs.spotForm)==null||o.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var o,e,a,r,i,l;this.showMeteo?((a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(o,e){!o&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async o=>{o!=null&&o.valid&&this.fetchData()})},cancelForm(){var o;(o=this.$refs.spotForm)==null||o.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;if(isNaN(this.form.latDegree)||isNaN(this.form.latMinute)||isNaN(this.form.lngDegree)||isNaN(this.form.lngMinute))return!1;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const o=v();((a=v(this.realTime))==null?void 0:a.diff(o,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel);let r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:o.day??3,weatherModels:e,marineModels:a};await me.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel),r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await me.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(o){var a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,A,x,C,k,_,z,P,T,V,O,Y,J,se,le,N,j,Z,Q,G,B,U,S,ee,ce,ge,ue;this.currentHourData={},this.positionGmt=(r=(a=o==null?void 0:o.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=o==null?void 0:o.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Kt.Meteo2Assist.pickHourly(o,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=o.lat,this.currentHourData.lng=o.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((g=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:g.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((p=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((b=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:b.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((x=(A=e==null?void 0:e.weather)==null?void 0:A.wind)==null?void 0:x.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(z=(_=e==null?void 0:e.wave)==null?void 0:_.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(P=e==null?void 0:e.wave)==null?void 0:P.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((O=(V=e==null?void 0:e.wave)==null?void 0:V.wd)==null?void 0:O.height,1)??"-",this.currentHourData.windwaveDir=(J=(Y=e==null?void 0:e.wave)==null?void 0:Y.wd)==null?void 0:J.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((le=(se=e==null?void 0:e.wave)==null?void 0:se.wd)==null?void 0:le.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((j=(N=e==null?void 0:e.wave)==null?void 0:N.swell)==null?void 0:j.height,1)??"-",this.currentHourData.swellDir=(Q=(Z=e==null?void 0:e.wave)==null?void 0:Z.swell)==null?void 0:Q.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(G=e==null?void 0:e.wave)==null?void 0:G.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((U=e==null?void 0:e.current)==null?void 0:U.speed,1)??"-",this.currentHourData.currentDir=(S=e==null?void 0:e.current)==null?void 0:S.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((ee=e==null?void 0:e.current)==null?void 0:ee.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(ce=e==null?void 0:e.weather)==null?void 0:ce.url,this.currentHourData.sit=(ge=e==null?void 0:e.ice)==null?void 0:ge.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=o.lat>=65||o.lat<=-65},handleBind(){var o,e;this.toggle?((o=this.map)==null||o.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(o){if(o.originalEvent.stopPropagation(),o.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(o.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(o){if(isNaN(o.lat)||isNaN(o.lng))return!1;this.form.latDegree=Number(M.LngLatHelper.lat2pretty(o.lat).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(o.lat).minute),this.form.latDirection=M.LngLatHelper.lat2pretty(o.lat).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(o.lng).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(o.lng).minute),this.form.lngDirection=M.LngLatHelper.lng2pretty(o.lng).direction},handleDrawInfoMarker(o){this.drawPositionMarker(o),this.simple||this.drawMeteoInfoMarker(o)},drawPositionMarker(o){o&&(this.map.flyTo({center:o,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new de.Marker(e).setLngLat(o).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(o){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(o):this.meteoInfoMarker=new de.Marker(e).setLngLat(o).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var o,e;(o=this.positionMarker)==null||o.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const o=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",o)}}},eh={class:"idm-gl4-spot"},th={class:"d-flex justify-start align-center"},oh={class:"text-h6 font-weight-600"},ah={class:"d-flex justify-start align-center ga-1 mb-2"},ih={class:"text-label"},rh={class:"w-100 d-flex ma-0"},lh={class:"w-30 pa-0 d-flex"},nh={class:"flex-1-1-0 pa-0 d-flex"},sh={class:"pa-0"},ch={class:"d-flex justify-start align-center ga-1 mb-2"},mh={class:"text-label"},dh={class:"w-100 d-flex ma-0"},hh={class:"w-30 pa-0 d-flex"},ph={class:"flex-1-1-0 pa-0 d-flex"},gh={class:"pa-0"},uh={class:"d-flex justify-start align-center ga-1 mb-2"},fh={class:"text-label"},yh={class:"d-flex justify-start align-center ga-1 mb-2"},bh={class:"text-label"},wh={class:"d-flex justify-start align-center"},xh={class:"mx-2"},kh={class:"mx-0 py-2 d-flex align-center justify-start"},Ah={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Lh={class:"pa-0 px-0"},Ch={class:"mx-0 py-2 d-flex align-center justify-start"},vh={cols:"9",class:"pa-0 px-0"},zh={class:"mx-0 py-2 d-flex align-center justify-start"},_h={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Sh={style:{width:"150px"},class:"pa-0 text-left"},Nh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Mh={cols:"3",class:"pa-0 px-0 text-left"},Ph={class:"mx-0 py-2 d-flex align-center justify-start"},Vh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Th={style:{width:"150px"},class:"pa-0 text-left"},Eh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Dh={cols:"3",class:"pa-0 text-left"},Rh={class:"mx-0 py-2 d-flex align-center justify-start"},Bh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Ih={style:{width:"150px"},class:"pa-0 text-left"},Fh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Gh={class:"pa-0 text-left"},jh={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},Wh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Zh={style:{width:"150px"},class:"pa-0 text-left"},Xh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Hh={class:"pa-0 text-left"},Oh={class:"d-flex justify-space-between align-center"},Yh={class:"d-flex justify-start align-center"},Uh={class:"mx-1"},Jh={class:"d-flex justify-end align-center"},Kh={class:"mx-0 py-1 d-flex align-center justify-start"},Qh={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},qh={class:"pa-0 px-0"},$h={class:"mx-0 py-1 d-flex align-center justify-start"},ep={class:"pa-0 px-0"},tp={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},op={class:"d-flex flex-column align-start justify-center ga-3"},ap={class:"text-label pr-2"},ip={class:"text-label pr-2"},rp={class:"text-label pr-2"},lp={key:0},np={class:"text-label pr-2"},sp={class:"d-flex flex-column align-start justify-center ga-3"},cp={class:"text-label pr-2"},mp={class:"text-label pr-2"},dp={class:"text-label pr-2"},hp={key:0},pp={class:"text-label pr-2"},gp={id:"idm-position-icon"},up={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},fp=["xlink:href"];function yp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("DateTimePicker"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VBtnToggle"),h=t.resolveComponent("VCardText"),f=t.resolveComponent("VCardActions"),w=t.resolveComponent("VForm"),b=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",eh,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:A})=>[t.createVNode(n,t.mergeProps(A,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(t.openBlock(),t.createBlock(b,{key:0,class:"spot-form-card",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",th,[t.createElementVNode("div",oh,t.toDisplayString(o.$t("spot.spotWeather")),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.submitForm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(h,{class:"text-body-1 pa-4"},{default:t.withCtx(()=>[t.createElementVNode("div",ah,[t.createElementVNode("div",ih,[t.createTextVNode(t.toDisplayString(o.$t("spot.lat")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",rh,[t.createElementVNode("div",lh,[t.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=A=>i.form.latDegree=A),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",nh,[t.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=A=>i.form.latMinute=A),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",sh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=A=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDirection),1)]),_:1})])]),t.createElementVNode("div",ch,[t.createElementVNode("div",mh,[t.createTextVNode(t.toDisplayString(o.$t("spot.lng")),1),e[13]||(e[13]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",dh,[t.createElementVNode("div",hh,[t.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=A=>i.form.lngDegree=A),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",ph,[t.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=A=>i.form.lngMinute=A),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",gh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=A=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDirection),1)]),_:1})])]),t.createElementVNode("div",uh,[t.createElementVNode("div",fh,[t.createTextVNode(t.toDisplayString(o.$t("spot.dateTime")),1),e[16]||(e[16]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0 mb-4"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(g,t.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},o.$attrs,{onDateTime:e[6]||(e[6]=A=>i.form.dateTime=A)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),t.createElementVNode("div",yh,[t.createElementVNode("div",bh,[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1),e[17]||(e[17]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0 mb-2"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=A=>i.form.forecastModel=A),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"GFS",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[18]||(e[18]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),t.createVNode(n,{density:"compact",height:"30",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[19]||(e[19]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):t.createCommentVNode("",!0),i.showMeteo&&!a.simple?(t.openBlock(),t.createBlock(b,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",wh,[e[20]||(e[20]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",xh,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",kh,[t.createElementVNode("div",Ah,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",Lh,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",Ch,[e[22]||(e[22]=t.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",vh,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",zh,[t.createElementVNode("div",_h,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("div",Sh,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1),t.createElementVNode("div",Nh,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("div",Mh,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),t.createElementVNode("div",Ph,[t.createElementVNode("div",Vh,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("div",Th,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),t.createElementVNode("div",Eh,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("div",Dh,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),t.createElementVNode("div",Rh,[t.createElementVNode("div",Bh,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("div",Ih,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),t.createElementVNode("div",Fh,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("div",Gh,t.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",jh,[t.createElementVNode("div",Wh,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("div",Zh,t.toDisplayString(i.currentHourData.sit??"-")+"m",1),t.createElementVNode("div",Xh,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("div",Hh,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)]}),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var A;return[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{prepend:t.withCtx(()=>e[23]||(e[23]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleFollow,["stop"])},{prepend:t.withCtx(()=>e[24]||(e[24]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:t.withModifiers(l.handleMeteoMore,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):t.createCommentVNode("",!0),i.showMeteo&&a.simple?(t.openBlock(),t.createBlock(b,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var A;return[t.createElementVNode("div",Oh,[t.createElementVNode("div",Yh,[e[25]||(e[25]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",Uh,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createElementVNode("div",Jh,[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{default:t.withCtx(()=>e[26]||(e[26]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleFollow,["stop"])},{default:t.withCtx(()=>e[27]||(e[27]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[28]||(e[28]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=t.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",Kh,[t.createElementVNode("div",Qh,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",qh,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",$h,[e[30]||(e[30]=t.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",ep,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",tp,[t.createElementVNode("div",op,[t.createElementVNode("div",null,[t.createElementVNode("span",ap,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1)]),t.createElementVNode("div",null,[t.createElementVNode("span",ip,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",rp,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",lp,[t.createElementVNode("span",np,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",sp,[t.createElementVNode("div",null,[t.createElementVNode("span",cp,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",mp,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",dp,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",hp,[t.createElementVNode("span",pp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",gp,[(t.openBlock(),t.createElementBlock("svg",up,[t.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,fp)]))],512),[[t.vShow,i.showMeteo]])])}const bp=K($d,[["render",yp]]),d1="",wp={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var o,e,a;if(this.toggle)this.handleBind();else{(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(o){if(o.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let p;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat,properties:h[p].properties},p===h.length-1?void 0:h[p+1])}},handleDragEnd(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(o){var a,r,i,l;o.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=o.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${this.$t("actions.detele")}</span>`,this.contextmenu=new de.Marker(m).setOffset([24,0]).setLngLat([o.lngLat.lng,o.lngLat.lat]).addTo(this.map)}}},handleClick(o){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=o.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=o.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=o.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=E.feature({type:"Point",coordinates:[o.lngLat.lng,o.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(o){const e=o.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=M.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),g=M.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=M.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=M.LngLatHelper.convertToMonotonicLng([s,m]):u=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(s,m,200));const y=E.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=M.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),o.total=a}return this.handleRender(o),o},handleTmpPointUpdate(o,e,a,r){const i=E.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=M.LngLatHelper.convertToMonotonicLng([m,d]):g=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=M.LngLatHelper.convertToMonotonicLng([m,d]):g=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=M.LngLatHelper.roundPrecision((o.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new de.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(o){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:o.lngLat.lng,lat:o.lngLat.lat})},handleDblClick(o){o.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(o){var e;if((e=o==null?void 0:o.features)!=null&&e.length){const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(o):this.map.addSource(a,{type:"geojson",data:o}),this.handleClear(o,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=o.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${o.id}-${c.properties.id}`,s.className=`${o.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new de.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[o.id]?this.pointMarkers[o.id].push(m):this.pointMarkers[o.id]=[m]}if(o.closed){const c=n.at(-1),m=o.features.filter(g=>g.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${o.id}" class="marker-close">X</div>`,this.closeMarkers[o.id]=new de.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(o,e=!0){var n,c,s,m,d,g,u,y,p,h;const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(g=this.closeMarkers[o.id])==null||g.remove(),this.closeMarkers[o.id]=void 0,(u=this.pointMarkers[o.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[o.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},xp={class:"idm-gl4-measure"};function kp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip");return t.openBlock(),t.createElementBlock("div",xp,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:s})=>[t.createVNode(n,t.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[0]||(e[0]=[t.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const Ap=K(wp,[["render",kp]]),h1="",Lp={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},emits:["close","save","hideLayer"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,pointHighlightMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var o;this.map&&(this.handleBindMap(),(o=this.editLayer)!=null&&o.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var o,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((o=this.editLayer)!=null&&o.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const o=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!o)return;const a=(o.features||(o.type==="Feature"?[o]:[]))[0];if(!a)return;this.originalProperties=a.properties||{},this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.originalProperties)==null?void 0:l.color)||((n=this.Theme.current.value.colors)==null?void 0:n["map-green"])||"#4CAF50";const r=(c=a.geometry)==null?void 0:c.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(g).minute),this.form.latDir=M.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(d).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(m=(s=this.originalProperties)==null?void 0:s.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(o),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){var a;if(!this.pointMarker)return;this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag),(a=this.pointHighlightMarker)==null||a.remove();const o=document.createElement("div");o.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new de.Marker({element:o,anchor:"center",offset:[0,0]}).setLngLat(e).addTo(this.map),this.pointMarker.on("drag",()=>{var r;(r=this.pointHighlightMarker)==null||r.setLngLat(this.pointMarker.getLngLat())})},handlePointDrag(){const{lng:o,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[o,e]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(e).minute),this.form.latDir=M.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(o).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(o).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(o).direction},clearEditMarkers(){this.editMarkers.forEach(o=>o.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(o){this.drawCoords=o.geometry.coordinates.map(r=>[...r]);const e=E.featureCollection([o,...this.drawCoords.map(r=>E.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new de.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const o=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=E.point([a,r]),l=E.lineString(this.drawCoords),n=E.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",o),this._edgeContextMenuHandler=o},showDeleteButton(o,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(o);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(o){this.handleSetDrawSource(o);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(o){this.clearEditMarkers();const e=o.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new de.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=E.point([i,l]),c=E.lineString([...this.drawCoords,this.drawCoords[0]]),s=E.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(a).minute),this.form.latDir=M.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:o,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(o),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),g=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[g,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(o,e){var i;if((i=this.pointMarker)==null||i.remove(),!o||!o.length)return;const[a,r]=o[0];this.pointMarker=new de.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(o){o.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(o){if(!o||o.length<1)return;const e=[];o==null||o.forEach((i,l)=>{e.push(M.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(o==null?void 0:o.length)>=2&&e.push(M.GeoJsonHelper.drawLine(o));const a=2,r=E.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(o,e){const a=M.GeoJsonHelper.drawLine([o,e]),r=E.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:o[0],lat:o[1]},l={lng:e[0],lat:e[1]},n=M.LaneHelper.calculateDistance(i,l,!0,2),c=M.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const g={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=M.LaneHelper.calculateDistance(g,u,!0,4)}s=M.LngLatHelper.roundPrecision(s+n,1);const m=`
217
+ </svg>`,ge=document.createElement("div");ge.className="idm-tropical-gl4-hourly-marker",ge.innerHTML=`<div class="${S.geometry.coordinates[1]>=0?"center north":"center south"}">${ce}</div>`;const ue=new de.Marker(ge).setLngLat(S.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",U)}else(N=this.map)!=null&&N.getSource(this.interpolateSource)&&((j=this.map)==null||j.getSource(this.interpolateSource).setData(this.empty))},handleClick(o){var i,l,n,c,s,m,d,g,u,y,p;const e=o.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="forecast"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)}),r=(c=(n=this.tropicals)==null?void 0:n.data)==null?void 0:c.features.filter(h=>{var f;return h.geometry.type==="LineString"&&h.properties.type==="history"&&h.properties.name===((f=e==null?void 0:e.properties)==null?void 0:f.name)});this.activeTropicals={name:((s=e==null?void 0:e.properties)==null?void 0:s.name)||"-",nameCn:((m=e==null?void 0:e.properties)==null?void 0:m.nameCn)||((d=e==null?void 0:e.properties)==null?void 0:d.name)||"-",Name:((g=e==null?void 0:e.properties)==null?void 0:g.Name)||"-",forecasts:a.map(h=>h.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([o.lngLat.lng,o.lngLat.lat])},drawTropicalsInfoMaker(o){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(o).setOffset([220,0]):this.activeTropicalsMarker=new de.Marker(e).setLngLat(o).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var o;(o=this.activeTropicalsMarker)==null||o.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(o){var r,i,l,n,c,s;o.disabled=!o.disabled;const e=`${o.name}-${o.model}`,a=(i=(r=this.map)==null?void 0:r.getSource(this.source)._data)==null?void 0:i.features;a.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=o.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(E.featureCollection(a)),(s=(c=this.map)==null?void 0:c.getSource(this.clusterSource))==null||s.setData(E.featureCollection(a)),this.handleDateChange()},handleStrikeProbability(o){this.$emit("tropicalProbability",o)},handleToggleCircles(o){var e,a;o.showCircle=!o.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===o.name&&(r.properties.showCircle=o.showCircle)}),this.handleRender()},handleComputePolygons(o){const e=[];for(const a of o){const r=a.properties.wind,i={ne:r.r7ne>=0?r.r7ne:void 0,se:r.r7se>=0?r.r7se:void 0,sw:r.r7sw>=0?r.r7sw:void 0,nw:r.r7nw>=0?r.r7nw:void 0},l=this.handleComputeArc(a.geometry.coordinates,i,{...a.properties,level:7});e.push(l);const n={ne:r.r10ne>=0?r.r10ne:void 0,se:r.r10se>=0?r.r10se:void 0,sw:r.r10sw>=0?r.r10sw:void 0,nw:r.r10nw>=0?r.r10nw:void 0},c=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(c)}return e},handleComputeArc(o,e,a){var l;const r=[];for(const n in e){const c=e[n]??0;let s;switch(n){case"ne":s=E.lineArc(o,c,0,90,{steps:c>0?32:1,units:"nauticalmiles"});break;case"se":s=E.lineArc(o,c,90,180,{steps:c>0?32:1,units:"nauticalmiles"});break;case"sw":s=E.lineArc(o,c,180,270,{steps:c>0?32:1,units:"nauticalmiles"});break;case"nw":s=E.lineArc(o,c,270,360,{steps:c>0?32:1,units:"nauticalmiles"});break}r.push(...(l=s==null?void 0:s.geometry)==null?void 0:l.coordinates)}const i=E.lineString(r);return E.lineToPolygon(i,{properties:a})},handleNotification(o){this.$emit("tropicalNotification",o)},handleHover(o){var i,l,n,c,s;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(o.point,{layers:[this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]})[0];this.hoverPoint=a==null?void 0:a.properties;const r=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(m=>{var d;return m.geometry.type==="LineString"&&m.properties.type==="forecast"&&m.properties.name===((d=a==null?void 0:a.properties)==null?void 0:d.name)});this.hoverPoint&&(this.hoverPoint.lng=a.geometry.coordinates[0],this.hoverPoint.lat=a.geometry.coordinates[1],this.hoverPoint.update=(c=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:c.date,(s=this.hoverMarker)==null||s.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new de.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var o;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(o=this.hoverMarker)==null||o.remove(),this.hoverMarker=void 0}}},hm={class:"idm-tropical-gl4"},pm={class:"pb-1"},gm={class:"text-h5 font-weight-600"},um={key:0,class:"text-h5 font-weight-600"},fm={class:"text-body-1"},ym={class:"text-label"},bm={class:"d-flex justify-space-between align-center"},wm={class:"w-60"},xm={class:"text-label pr-1"},km={class:"flex-1-1-0"},Am={class:"text-label pr-1"},Lm={class:"py-2 d-flex justify-space-between align-center"},Cm={class:"w-60"},vm={class:"text-label pr-1"},zm={class:"flex-1-1-0"},_m={class:"text-label pr-1"},Sm={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},Nm={class:"text-label pr-1",style:{width:"70px"}},Mm={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Pm={class:"more"},Vm={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},Tm={class:"pa-1"},Em={class:"legend d-flex justify-start align-center py-2"},Dm={class:"label"},Rm={class:"legend d-flex justify-start align-center py-2"},Bm={class:"label"},Im={class:"legend d-flex justify-start align-center py-2"},Fm={class:"label"},Gm={class:"pa-1"},jm={class:"legend d-flex justify-start align-center py-2"},Wm={class:"label"},Zm={class:"legend d-flex justify-start align-center py-2"},Xm={class:"label"},Hm={class:"legend d-flex justify-start align-center py-2"},Om={class:"label"},Ym={class:"pa-1"},Um={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Jm={class:"label"},Km={class:"label"},Qm={class:"w-100 legend d-flex justify-start align-center py-2"},qm={class:"label"},$m={class:"w-100 legend d-flex justify-start align-center py-2"},ed={class:"label"},td={key:1,class:"my-3 w-100",style:{height:"80px"}},od={class:"legend d-flex justify-start align-center"},ad={class:"label"},id={class:"legend d-flex justify-start align-center"},rd={class:"label"},ld={class:"legend d-flex justify-start align-center"},nd={class:"label"},sd={class:"legend d-flex justify-start align-center"},cd={class:"label"},md={class:"legend d-flex justify-start align-center"},dd={class:"label"},hd={class:"legend d-flex justify-start align-center"},pd={class:"label"},gd={class:"legend d-flex justify-start align-center"},ud={class:"label"},fd={class:"legend d-flex justify-start align-center"},yd={class:"label"},bd={class:"legend d-flex justify-start align-center"},wd={class:"label"},xd={class:"legend d-flex justify-start align-center"},kd={class:"label"},Ad={class:"d-flex justify-star align-center"},Ld={class:"font-weight-600 mr-1"},Cd={class:""},vd={class:"d-flex flex-column justify-center align-start ga-2"},zd={key:0,class:"d-flex justify-start align-center"},_d={class:"text-label pr-1"},Sd={key:1,class:"d-flex justify-start align-center"},Nd={class:"text-label pr-1"},Md={key:2,class:"d-flex justify-start align-center"},Pd={class:"text-label pr-1"},Vd={key:3,class:"d-flex justify-start align-center"},Td={class:"text-label pr-1"},Ed={key:4,class:"d-flex justify-start align-center"},Dd={class:"text-label pr-1"},Rd={key:5,class:"d-flex justify-start align-center"},Bd={class:"text-label pr-1"},Id={class:"d-flex justify-start align-center"},Fd={class:"text-label pr-1"},Gd={key:6,class:"d-flex justify-start align-center"},jd={class:"text-label pr-1"},Wd={key:7,class:"d-flex justify-start align-center"},Zd={class:"text-label pr-1"},Xd={class:"d-flex justify-start align-center"},Hd={class:"text-label pr-1"};function Od(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardText"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VCardTitle");return t.openBlock(),t.createElementBlock("div",hm,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:y})=>[t.createVNode(n,t.mergeProps(y,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[2]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!o.$attrs.hideTropicalsLegend?(t.openBlock(),t.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:t.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[t.createVNode(g,{class:t.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z;return[t.createElementVNode("div",pm,[t.createElementVNode("span",gm,t.toDisplayString(a.locale==="en"?(y=i.activeTropicals)==null?void 0:y.Name:((p=i.activeTropicals)==null?void 0:p.nameCn)||((h=i.activeTropicals)==null?void 0:h.Name)||"-"),1),(w=(f=i.activeTropicals)==null?void 0:f.history)!=null&&w.levelI18n?(t.openBlock(),t.createElementBlock("span",um," , "+t.toDisplayString(o.$t("tropical."+((A=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:A.levelI18n))),1)):t.createCommentVNode("",!0)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:t.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:t.withCtx(()=>e[3]||(e[3]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[3]},8,["onClick"]),t.createElementVNode("div",fm,[t.createElementVNode("span",ym,t.toDisplayString(o.$t("actions.lastUpdate"))+": ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTime(((C=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:C.updated)||((z=(_=(k=i.activeTropicals)==null?void 0:k.forecasts)==null?void 0:_.filter(P=>!P.disabled)[0])==null?void 0:z.date),a.timeZone)),1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1 py-3"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C;return[t.createElementVNode("div",bm,[t.createElementVNode("div",wm,[t.createElementVNode("label",xm,t.toDisplayString(o.$t("weather.windSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((p=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:p.kts)||"-")+" kts",1),t.createElementVNode("span",null,", BF "+t.toDisplayString(l.computeBF(((f=(h=i.activeTropicals)==null?void 0:h.history)==null?void 0:f.kts)||"-")),1)]),t.createElementVNode("div",km,[t.createElementVNode("label",Am,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((b=(w=i.activeTropicals)==null?void 0:w.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),t.createElementVNode("div",Lm,[t.createElementVNode("div",Cm,[t.createElementVNode("label",vm,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.kts)||"-")+" kts",1)]),t.createElementVNode("div",zm,[t.createElementVNode("label",_m,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=l.computeMovement(i.activeTropicals))==null?void 0:x.deg)||"-")+"°",1)])]),t.createElementVNode("div",Sm,[t.createElementVNode("label",Nm,t.toDisplayString(o.$t("tropical.models"))+" : ",1),t.createElementVNode("div",Mm,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((C=i.activeTropicals)==null?void 0:C.forecasts,(k,_)=>(t.openBlock(),t.createBlock(n,{key:_,density:"compact",variant:k.disabled?"text":"flat",color:k.disabled?"":"primary","min-width":30,class:t.normalizeClass(["model text-none text-body-1 px-1",k.disabled?"btn-border-1 btn-bg-1":""]),onClick:t.withModifiers(z=>l.handleForecastToggle(k),["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(k.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),t.createVNode(m),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"d-flex justify-space-between"},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=t.withModifiers(y=>i.showLegend=!i.showLegend,["stop"]))},{prepend:t.withCtx(()=>e[4]||(e[4]=[t.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("weather.legend")),1)]),_:1},8,["color"]),t.createElementVNode("div",Pm,[t.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[1]||(e[1]=t.withModifiers(y=>l.handleStrikeProbability(i.activeTropicals),["stop"]))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.viewReport")),1)]),_:1})])]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(t.openBlock(),t.createElementBlock("div",Vm,[t.createElementVNode("div",Tm,[t.createElementVNode("div",Em,[e[5]||(e[5]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",Dm,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",Rm,[e[6]||(e[6]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",Bm,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",Im,[e[7]||(e[7]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",Fm,t.toDisplayString(o.$t("tropical.sty")),1)])]),t.createElementVNode("div",Gm,[t.createElementVNode("div",jm,[e[8]||(e[8]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",Wm,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",Zm,[e[9]||(e[9]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",Xm,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",Hm,[e[10]||(e[10]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",Om,t.toDisplayString(o.$t("tropical.superTy")),1)])]),t.createElementVNode("div",Ym,[t.createElementVNode("div",Um,[e[11]||(e[11]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",Jm,t.toDisplayString(o.$t("tropical.history")),1),e[12]||(e[12]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",Km,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",Qm,[e[13]||(e[13]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",qm,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",$m,[e[14]||(e[14]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",ed,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])])])):(t.openBlock(),t.createElementBlock("div",td,[t.withDirectives(t.createVNode(g,{elevation:"16"},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",{class:t.normalizeClass(["pa-1 d-flex justify-space-between align-center flex-wrap",a.locale==="zhHans"?" ga-2":" ga-3"])},[t.createElementVNode("div",od,[e[15]||(e[15]=t.createElementVNode("div",{class:"icon td"},null,-1)),t.createElementVNode("div",ad,t.toDisplayString(o.$t("tropical.td")),1)]),t.createElementVNode("div",id,[e[16]||(e[16]=t.createElementVNode("div",{class:"icon ts"},null,-1)),t.createElementVNode("div",rd,t.toDisplayString(o.$t("tropical.ts")),1)]),t.createElementVNode("div",ld,[e[17]||(e[17]=t.createElementVNode("div",{class:"icon sts"},null,-1)),t.createElementVNode("div",nd,t.toDisplayString(o.$t("tropical.sts")),1)]),t.createElementVNode("div",sd,[e[18]||(e[18]=t.createElementVNode("div",{class:"icon ty"},null,-1)),t.createElementVNode("div",cd,t.toDisplayString(o.$t("tropical.ty")),1)]),t.createElementVNode("div",md,[e[19]||(e[19]=t.createElementVNode("div",{class:"icon sty"},null,-1)),t.createElementVNode("div",dd,t.toDisplayString(o.$t("tropical.sty")),1)]),t.createElementVNode("div",hd,[e[20]||(e[20]=t.createElementVNode("div",{class:"icon supper-ty"},null,-1)),t.createElementVNode("div",pd,t.toDisplayString(o.$t("tropical.superTy")),1)]),t.createElementVNode("div",gd,[e[21]||(e[21]=t.createElementVNode("div",{class:"icon history"},null,-1)),t.createElementVNode("div",ud,t.toDisplayString(o.$t("tropical.history")),1)]),t.createElementVNode("div",fd,[e[22]||(e[22]=t.createElementVNode("div",{class:"icon forecast"},null,-1)),t.createElementVNode("div",yd,t.toDisplayString(o.$t("tropical.forecast")),1)]),t.createElementVNode("div",bd,[e[23]||(e[23]=t.createElementVNode("div",{class:"icon r7"},null,-1)),t.createElementVNode("div",wd,"35kts "+t.toDisplayString(o.$t("tropical.radii")),1)]),t.createElementVNode("div",xd,[e[24]||(e[24]=t.createElementVNode("div",{class:"icon r10"},null,-1)),t.createElementVNode("div",kd,"50kts "+t.toDisplayString(o.$t("tropical.radii")),1)])],2),[[t.vShow,i.showLegend]])]),_:1})]),_:1},512),[[t.vShow,i.showLegend]])]))],2)):t.createCommentVNode("",!0),t.withDirectives(t.createVNode(g,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"290"},{default:t.withCtx(()=>[t.createVNode(u,null,{default:t.withCtx(()=>{var y,p,h,f;return[t.createElementVNode("div",Ad,[t.createElementVNode("span",Ld,t.toDisplayString(a.locale==="en"?(y=i.hoverPoint)==null?void 0:y.Name:((p=i.hoverPoint)==null?void 0:p.nameCn)||((h=i.hoverPoint)==null?void 0:h.Name)),1),t.createElementVNode("span",Cd," ["+t.toDisplayString(o.$t("tropical."+((f=i.hoverPoint)==null?void 0:f.levelI18n)))+"]",1)])]}),_:1}),t.createVNode(m),t.createVNode(s,{class:"text-body-1"},{default:t.withCtx(()=>{var y,p,h,f,w,b,A,x,C,k,_,z,P,T,V,O,Y,J,se,le;return[t.createElementVNode("div",vd,[((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",zd,[t.createElementVNode("label",_d,t.toDisplayString(o.$t("tropical.updated"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((p=i.hoverPoint)==null?void 0:p.update,a.timeZone)),1)])):t.createCommentVNode("",!0),((h=i.hoverPoint)==null?void 0:h.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Sd,[t.createElementVNode("label",Nd,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((f=i.hoverPoint)==null?void 0:f.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((w=i.hoverPoint)==null?void 0:w.type)==="history"?(t.openBlock(),t.createElementBlock("div",Md,[t.createElementVNode("label",Pd,t.toDisplayString(o.$t("tropical.forecast"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):t.createCommentVNode("",!0),((A=i.hoverPoint)==null?void 0:A.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Vd,[t.createElementVNode("label",Td,t.toDisplayString(o.$t("tropical.model"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((x=i.hoverPoint)==null?void 0:x.model)??"-"),1)])):t.createCommentVNode("",!0),((C=i.hoverPoint)==null?void 0:C.type)==="forecast"?(t.openBlock(),t.createElementBlock("div",Ed,[t.createElementVNode("label",Dd,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((_=JSON.parse(((k=i.hoverPoint)==null?void 0:k.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((z=i.hoverPoint)==null?void 0:z.type)==="history"?(t.openBlock(),t.createElementBlock("div",Rd,[t.createElementVNode("label",Bd,t.toDisplayString(o.$t("weather.wind"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((P=i.hoverPoint)==null?void 0:P.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Id,[t.createElementVNode("label",Fd,t.toDisplayString(o.$t("weather.pressure"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((T=i.hoverPoint)==null?void 0:T.pressure)??"-")+" hPa",1)]),((V=i.hoverPoint)==null?void 0:V.type)==="history"?(t.openBlock(),t.createElementBlock("div",Gd,[t.createElementVNode("label",jd,t.toDisplayString(o.$t("tropical.moveSpeed"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((Y=JSON.parse(((O=i.hoverPoint)==null?void 0:O.movement)||"{}"))==null?void 0:Y.kts)??"-")+" kts",1)])):t.createCommentVNode("",!0),((J=i.hoverPoint)==null?void 0:J.type)==="history"?(t.openBlock(),t.createElementBlock("div",Wd,[t.createElementVNode("label",Zd,t.toDisplayString(o.$t("tropical.moveDir"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(((le=JSON.parse(((se=i.hoverPoint)==null?void 0:se.movement)||"{}"))==null?void 0:le.deg)??"-")+" °",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Xd,[t.createElementVNode("label",Hd,t.toDisplayString(o.$t("tropical.position"))+" : ",1),t.createElementVNode("span",null,t.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[t.vShow,i.showHoverPoint]])])}const Wo=K(dm,[["render",Od]]),c1="",Yd={name:"DateTimePicker",props:{width:{type:Number,default:null},height:{type:Number,default:30},position:{type:String,default:"top"},bgClass:{type:String,default:""},locale:{type:String,default:"en"},style:{type:Object,default:{}},intervalHour:{type:Number,default:3},timeZone:{type:Number},dateTime:{type:String},dayAbout:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1}},emits:["dateTime","currentTimestamp","currentRealTime","minTimestamp","maxTimestamp"],data(){return{showDatePicker:!1,minDate:void 0,maxDate:void 0,minTimestamp:void 0,maxTimestamp:void 0,currentDate:void 0,currentTime:void 0,currentTimestamp:void 0,currentDateTimeZ:void 0,currentDateTime:void 0,currentRealTime:void 0,timer:null}},computed:{getStyle(){const o=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-o)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-o)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-o)/2}px`}},hourOptions(){const o=[];for(let e=0;e<24;e++)o.push(e<10?`0${e}:00`:`${e}:00`);return o.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(o,e){o!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(o,e){o&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=v(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(o,e){o!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},100),document.addEventListener("click",this.handleClickOutside)},unmounted(){clearInterval(this.timer),this.handleCancelDate(),document.removeEventListener("click",this.handleClickOutside)},methods:{handleReset(){this.handleResetDateTime(),this.handleResetMinMax()},handleResetDateTime(o){var i;const e=v(o).utc().date(),a=Math.ceil(v(o).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=v(o))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${v.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${v.tz(v().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,c,s;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const o=v().utc().date(),e=Math.ceil(v().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=v())==null?void 0:i.utc().set({date:o,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=v.tz(a,this.timeZoneName).clone();this.minDate=r.clone().add(this.dayAbout.h,"day").format("yyyy-MM-DD"),this.maxDate=r.clone().add(this.dayAbout.f,"day").format("yyyy-MM-DD"),this.minTimestamp=((n=(l=v())==null?void 0:l.utc())==null?void 0:n.set({date:o+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((s=(c=v())==null?void 0:c.utc())==null?void 0:s.set({date:o+this.dayAbout.f,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.$emit("minTimestamp",this.minTimestamp),this.$emit("maxTimestamp",this.maxTimestamp)},handleOpenDatePicker(){this.disabled||(this.showDatePicker=!this.showDatePicker)},handleUpdateMonth(o){const e=o||v.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):v.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("M月");this.$nextTick(()=>{const r=document.querySelector(".v-date-picker-controls__month-btn");r.innerText=a})},handleConfirmDate(){const o=v(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${o} ${e}`,r=v.tz(a,"YYYY-MM-DD HH:00",this.timeZoneName).clone().tz(this.localTimeZoneName);this.currentTimestamp=r.unix()*1e3,this.showDatePicker=!1},handleCancelDate(){this.showDatePicker=!1;const o=v.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=o.clone().format("YYYY-MM-DD"),this.currentTime=o.clone().format("HH:00")},handleClickOutside(o){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(o.target)&&(this.showDatePicker=!1)}}},Ud={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},Jd={class:"pa-0",style:{width:"320px"}},Kd={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},Qd={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function qd(o,e,a,r,i,l){const n=t.resolveComponent("VDatePicker"),c=t.resolveComponent("VDivider"),s=t.resolveComponent("VListItemTitle"),m=t.resolveComponent("VListItem"),d=t.resolveComponent("VList"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VBtn"),y=t.resolveComponent("VCardActions"),p=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",Ud,[t.createElementVNode("div",{style:t.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:t.normalizeClass([[a.bgClass,{"cursor-pointer":!a.disabled}],"rounded text-body-1 btn-border-1 btn-bg-1 d-flex align-center justify-center px-2"]),onClick:e[0]||(e[0]=(...h)=>l.handleOpenDatePicker&&l.handleOpenDatePicker(...h))},t.toDisplayString(i.currentDateTime)+" | UTC "+t.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(t.openBlock(),t.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:t.normalizeStyle(l.getStyle)},{default:t.withCtx(()=>[t.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Jd,[t.createVNode(n,{modelValue:i.currentDate,"onUpdate:modelValue":e[1]||(e[1]=h=>i.currentDate=h),min:i.minDate,max:i.maxDate,"weekday-format":"narrow",color:"primary",density:"compact",class:"w-100","hide-header":""},null,8,["modelValue","min","max"])]),t.createVNode(c,{class:"h-100",vertical:""}),t.createElementVNode("div",Kd,[t.createElementVNode("div",Qd,t.toDisplayString(o.$t("time.time")),1),t.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.hourOptions,(h,f)=>(t.openBlock(),t.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-body-2 font-weight-600 text-center",onClick:w=>i.currentTime=h},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),t.createVNode(c),t.createVNode(y,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:t.withCtx(()=>[t.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):t.createCommentVNode("",!0)],512)}const to=K(Yd,[["render",qd]]),m1="",$d={name:"IdmPoint",components:{DateTimePicker:to},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},token:{type:String},defaultMeteoToken:{type:String},theme:{type:String,default:"zh"},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},gateway:{type:String},timeZone:{type:Number},forecastModel:{type:String},realTime:{type:String},followList:{type:Array,default:()=>[]}},emits:["meteoMore","follow","cancelFollow","login"],data(){return{right:10,toggle:!1,showForm:!1,showMeteo:!1,loading:!1,form:{lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:""},formRules:{lngDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,3}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=180||"0 ~ 180"],lngMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"],latDegree:[o=>o!=null&&o!==""||"required",o=>/^\d{1,2}$/.test(o)||"number",o=>parseInt(o)>=0&&parseInt(o)<=90||"0 ~ 90"],latMinute:[o=>o===void 0||o===null&&o===""||/^\d{1,2}(\.\d+)?$/.test(o)||"number",o=>o===void 0||o===null&&o===""||parseInt(o)>=0&&parseInt(o)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return v.tz.names()},timeZoneName(){var o;return(o=this.timeZoneNames.filter(e=>v.tz(v(),e).utcOffset()===this.timeZone*60))==null?void 0:o[0]},computedTzTime(){return o=>v.tz(v(o),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return o=>{var r,i,l;const e=Number((r=this.positionOffset)==null?void 0:r.slice(1,3))*(((i=this.positionOffset)==null?void 0:i.slice(0,1))==="+"?1:-1),a=(l=this.timeZoneNames.filter(n=>v.tz(v(),n).utcOffset()===e*60))==null?void 0:l[0];return o?v.tz(v(o),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(o){return!o||o.lng===null||o.lng===void 0||isNaN(o.lng)||o.lat===null||o.lat===void 0||isNaN(o.lat)?"-":M.LngLatHelper.lat2pretty(o==null?void 0:o.lat,2).pretty+" / "+M.LngLatHelper.lng2pretty(o==null?void 0:o.lng,2).pretty}},computeRoundPrecision(){return function(o,e=4){return o==null||isNaN(o)||isNaN(e)?"-":M.LngLatHelper.roundPrecision(o,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){this.toggle?this.showForm=!0:(this.showForm=!1,this.showMeteo=!1),this.map&&this.handleBind()},immediate:!0},map:{handler(){this.map&&this.toggle&&this.handleBind()}},showForm:{handler(){this.showForm?(this.realTime&&(this.form.dateTime=this.realTime),this.$nextTick(()=>{var o;(o=this.$refs.spotForm)==null||o.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var o,e,a,r,i,l;this.showMeteo?((a=(e=(o=this.$parent)==null?void 0:o.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,c;this.$parent.playerBottom=((c=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:c.clientHeight)+10})):((l=(i=(r=this.$parent)==null?void 0:r.$refs)==null?void 0:i.idmBottomBar)==null||l.handleToggle("spot",!1),this.simple&&(this.$parent.playerBottom=30))}},realTime:{handler(){this.realTime&&(this.form.dateTime=this.realTime,this.showMeteo&&this.fetchData())}},forecastModel:{handler(){this.form.forecastModel=this.forecastModel},immediate:!0},"form.forecastModel":{handler(o,e){!o&&e&&(this.form.forecastModel=e==="GFS"?"ECMWF":"GFS")}}},methods:{handleMenuToggle(){this.isLogin?this.toggle=!this.toggle:this.$emit("login")},submitForm(){this.handleCloseMeteo(),this.$refs.spotForm.validate().then(async o=>{o!=null&&o.valid&&this.fetchData()})},cancelForm(){var o;(o=this.$refs.spotForm)==null||o.reset(),this.form={lng:void 0,lngDegree:void 0,lngMinute:void 0,lngDirection:"E",lat:void 0,latDegree:void 0,latMinute:void 0,latDirection:"N",dateTime:void 0,forecastModel:this.forecastModel}},handleCloseForm(){this.showForm=!1,this.cancelForm(),this.toggle=!1},async fetchData(){var a;if(isNaN(this.form.latDegree)||isNaN(this.form.latMinute)||isNaN(this.form.lngDegree)||isNaN(this.form.lngMinute))return!1;this.form.lat=(Number(this.form.latDegree??0)+Number(this.form.latMinute??0)/60)*(this.form.latDirection==="N"?1:-1),this.form.lng=(Number(this.form.lngDegree??0)+Number(this.form.lngMinute??0)/60)*(this.form.lngDirection==="E"?1:-1);const o=v();((a=v(this.realTime))==null?void 0:a.diff(o,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel);let r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:o.day??3,weatherModels:e,marineModels:a};await me.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(o){this.loading=!0,this.showMeteo=!0,this.form.lng=o.lng,this.form.lat=o.lat,this.form.followId=o.followId,this.handleDrawInfoMarker([o.lng,o.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Kt.Meteo2Assist.autoPickMeteoModel(o.forecastModel),r={lat:o.lat,lng:o.lng,datetime:v(o.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await me.post(`${this.gateway}/api/arc/meteo2/spot/forecast`,r,{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(i=>{(i==null?void 0:i.data.code)===0?(this.meteoData=i==null?void 0:i.data.data,this.meteoData.lng=o.lng,this.meteoData.lat=o.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(o){var a,r,i,l,n,c,s,m,d,g,u,y,p,h,f,w,b,A,x,C,k,_,z,P,T,V,O,Y,J,se,le,N,j,Z,Q,G,B,U,S,ee,ce,ge,ue;this.currentHourData={},this.positionGmt=(r=(a=o==null?void 0:o.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=o==null?void 0:o.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Kt.Meteo2Assist.pickHourly(o,v(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=o.lat,this.currentHourData.lng=o.lng,this.currentHourData.temp=this.computeRoundPrecision((c=e==null?void 0:e.weather)==null?void 0:c.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(s=e==null?void 0:e.weather)==null?void 0:s.precip)==null?void 0:m.probability,0)??"-",this.currentHourData.precip1h=this.computeRoundPrecision((g=(d=e==null?void 0:e.weather)==null?void 0:d.precip)==null?void 0:g.sum,0)??"-",this.currentHourData.visibility=this.computeRoundPrecision((u=e==null?void 0:e.weather)==null?void 0:u.visibility,0)??"-",this.currentHourData.windSpeed=this.computeRoundPrecision((p=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((b=(w=e==null?void 0:e.weather)==null?void 0:w.wind)==null?void 0:b.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((x=(A=e==null?void 0:e.weather)==null?void 0:A.wind)==null?void 0:x.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((k=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:k.height,1)??"-",this.currentHourData.sigwaveDir=(z=(_=e==null?void 0:e.wave)==null?void 0:_.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(P=e==null?void 0:e.wave)==null?void 0:P.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((O=(V=e==null?void 0:e.wave)==null?void 0:V.wd)==null?void 0:O.height,1)??"-",this.currentHourData.windwaveDir=(J=(Y=e==null?void 0:e.wave)==null?void 0:Y.wd)==null?void 0:J.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((le=(se=e==null?void 0:e.wave)==null?void 0:se.wd)==null?void 0:le.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((j=(N=e==null?void 0:e.wave)==null?void 0:N.swell)==null?void 0:j.height,1)??"-",this.currentHourData.swellDir=(Q=(Z=e==null?void 0:e.wave)==null?void 0:Z.swell)==null?void 0:Q.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(G=e==null?void 0:e.wave)==null?void 0:G.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((U=e==null?void 0:e.current)==null?void 0:U.speed,1)??"-",this.currentHourData.currentDir=(S=e==null?void 0:e.current)==null?void 0:S.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((ee=e==null?void 0:e.current)==null?void 0:ee.speed,1)??"-",this.currentHourData.seaLevel=this.computeRoundPrecision(e==null?void 0:e.height,1)??"-",this.currentHourData.seaTemp=this.computeRoundPrecision(e==null?void 0:e.sst,0)??"-",this.currentHourData.weatherUrls=(ce=e==null?void 0:e.weather)==null?void 0:ce.url,this.currentHourData.sit=(ge=e==null?void 0:e.ice)==null?void 0:ge.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=o.lat>=65||o.lat<=-65},handleBind(){var o,e;this.toggle?((o=this.map)==null||o.on("click",this.handleClick),this.map&&(this.map.getCanvas().style.cursor="crosshair")):((e=this.map)==null||e.off("click",this.handleClick),this.handleCloseMeteo(),this.map&&(this.map.getCanvas().style.cursor="grab"))},handleClick(o){if(o.originalEvent.stopPropagation(),o.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(o.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(o){if(isNaN(o.lat)||isNaN(o.lng))return!1;this.form.latDegree=Number(M.LngLatHelper.lat2pretty(o.lat).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(o.lat).minute),this.form.latDirection=M.LngLatHelper.lat2pretty(o.lat).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(o.lng).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(o.lng).minute),this.form.lngDirection=M.LngLatHelper.lng2pretty(o.lng).direction},handleDrawInfoMarker(o){this.drawPositionMarker(o),this.simple||this.drawMeteoInfoMarker(o)},drawPositionMarker(o){o&&(this.map.flyTo({center:o,duration:300}),this.$nextTick(()=>{var a,r;(a=this.positionMarker)==null||a.remove();const e=(r=document.getElementById("idm-position-icon"))==null?void 0:r.cloneNode(!0);this.positionMarker=new de.Marker(e).setLngLat(o).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(o){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(o):this.meteoInfoMarker=new de.Marker(e).setLngLat(o).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var o,e;(o=this.positionMarker)==null||o.remove(),this.positionMarker=void 0,(e=this.meteoInfoMarker)==null||e.remove(),this.meteoInfoMarker=void 0})},handleFollow(){this.$emit("follow",this.form)},handleCancelFollow(){var e,a,r;const o=((e=this.form)==null?void 0:e.followId)||((r=(a=this.followList)==null?void 0:a.find(i=>{var l,n;return(i==null?void 0:i.id)===this.form.followId||((l=i==null?void 0:i.coordinate)==null?void 0:l.lng)===this.form.lng&&((n=i==null?void 0:i.coordinate)==null?void 0:n.lat)===this.form.lat}))==null?void 0:r.id);this.$emit("cancelFollow",o)}}},eh={class:"idm-gl4-spot"},th={class:"d-flex justify-start align-center"},oh={class:"text-h6 font-weight-600"},ah={class:"d-flex justify-start align-center ga-1 mb-2"},ih={class:"text-label"},rh={class:"w-100 d-flex ma-0"},lh={class:"w-30 pa-0 d-flex"},nh={class:"flex-1-1-0 pa-0 d-flex"},sh={class:"pa-0"},ch={class:"d-flex justify-start align-center ga-1 mb-2"},mh={class:"text-label"},dh={class:"w-100 d-flex ma-0"},hh={class:"w-30 pa-0 d-flex"},ph={class:"flex-1-1-0 pa-0 d-flex"},gh={class:"pa-0"},uh={class:"d-flex justify-start align-center ga-1 mb-2"},fh={class:"text-label"},yh={class:"d-flex justify-start align-center ga-1 mb-2"},bh={class:"text-label"},wh={class:"d-flex justify-start align-center"},xh={class:"mx-2"},kh={class:"mx-0 py-2 d-flex align-center justify-start"},Ah={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Lh={class:"pa-0 px-0"},Ch={class:"mx-0 py-2 d-flex align-center justify-start"},vh={cols:"9",class:"pa-0 px-0"},zh={class:"mx-0 py-2 d-flex align-center justify-start"},_h={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Sh={style:{width:"150px"},class:"pa-0 text-left"},Nh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Mh={cols:"3",class:"pa-0 px-0 text-left"},Ph={class:"mx-0 py-2 d-flex align-center justify-start"},Vh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Th={style:{width:"150px"},class:"pa-0 text-left"},Eh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Dh={cols:"3",class:"pa-0 text-left"},Rh={class:"mx-0 py-2 d-flex align-center justify-start"},Bh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Ih={style:{width:"150px"},class:"pa-0 text-left"},Fh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Gh={class:"pa-0 text-left"},jh={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},Wh={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Zh={style:{width:"150px"},class:"pa-0 text-left"},Xh={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Hh={class:"pa-0 text-left"},Oh={class:"d-flex justify-space-between align-center"},Yh={class:"d-flex justify-start align-center"},Uh={class:"mx-1"},Jh={class:"d-flex justify-end align-center"},Kh={class:"mx-0 py-1 d-flex align-center justify-start"},Qh={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},qh={class:"pa-0 px-0"},$h={class:"mx-0 py-1 d-flex align-center justify-start"},ep={class:"pa-0 px-0"},tp={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},op={class:"d-flex flex-column align-start justify-center ga-3"},ap={class:"text-label pr-2"},ip={class:"text-label pr-2"},rp={class:"text-label pr-2"},lp={key:0},np={class:"text-label pr-2"},sp={class:"d-flex flex-column align-start justify-center ga-3"},cp={class:"text-label pr-2"},mp={class:"text-label pr-2"},dp={class:"text-label pr-2"},hp={key:0},pp={class:"text-label pr-2"},gp={id:"idm-position-icon"},up={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},fp=["xlink:href"];function yp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VDivider"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("DateTimePicker"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VBtnToggle"),h=t.resolveComponent("VCardText"),f=t.resolveComponent("VCardActions"),w=t.resolveComponent("VForm"),b=t.resolveComponent("VCard");return t.openBlock(),t.createElementBlock("div",eh,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:A})=>[t.createVNode(n,t.mergeProps(A,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h4"},null,-1)])),_:2,__:[8]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showForm&&!a.simple?(t.openBlock(),t.createBlock(b,{key:0,class:"spot-form-card",style:t.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",th,[t.createElementVNode("div",oh,t.toDisplayString(o.$t("spot.spotWeather")),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(w,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.submitForm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(h,{class:"text-body-1 pa-4 py-2"},{default:t.withCtx(()=>[t.createElementVNode("div",ah,[t.createElementVNode("div",ih,[t.createTextVNode(t.toDisplayString(o.$t("spot.lat")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",rh,[t.createElementVNode("div",lh,[t.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=A=>i.form.latDegree=A),rules:i.formRules.latDegree,label:"",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[11]||(e[11]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",nh,[t.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=A=>i.form.latMinute=A),rules:i.formRules.latMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[12]||(e[12]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",sh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[2]||(e[2]=A=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDirection),1)]),_:1})])]),t.createElementVNode("div",ch,[t.createElementVNode("div",mh,[t.createTextVNode(t.toDisplayString(o.$t("spot.lng")),1),e[13]||(e[13]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createElementVNode("div",dh,[t.createElementVNode("div",hh,[t.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=A=>i.form.lngDegree=A),rules:i.formRules.lngDegree,density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[14]||(e[14]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),t.createElementVNode("div",ph,[t.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=A=>i.form.lngMinute=A),rules:i.formRules.lngMinute,label:"",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[15]||(e[15]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),t.createElementVNode("div",gh,[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=A=>i.form.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDirection),1)]),_:1})])]),t.createElementVNode("div",uh,[t.createElementVNode("div",fh,[t.createTextVNode(t.toDisplayString(o.$t("spot.dateTime")),1),e[16]||(e[16]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0 mb-4"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(g,t.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},o.$attrs,{onDateTime:e[6]||(e[6]=A=>i.form.dateTime=A)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),t.createElementVNode("div",yh,[t.createElementVNode("div",bh,[t.createTextVNode(t.toDisplayString(o.$t("weather.forecastModel")),1),e[17]||(e[17]=t.createElementVNode("span",{class:"text-danger"},"*",-1))])]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"12",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=A=>i.form.forecastModel=A),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:t.withCtx(()=>[t.createVNode(n,{density:"compact",height:"30",value:"GFS",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="GFS"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="GFS"?"primary":"","base-color":""},{default:t.withCtx(()=>e[18]||(e[18]=[t.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),t.createVNode(n,{density:"compact",height:"30",class:t.normalizeClass(["text-none flex-1-1-0",i.form.forecastModel==="ECMWF"?"":"btn-border-1 btn-bg-1"]),color:i.form.forecastModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:t.withCtx(()=>e[19]||(e[19]=[t.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-end align-center ga-4 pa-4 py-2"},{default:t.withCtx(()=>[t.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):t.createCommentVNode("",!0),i.showMeteo&&!a.simple?(t.openBlock(),t.createBlock(b,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:t.withCtx(()=>[t.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("div",wh,[e[20]||(e[20]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",xh,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",kh,[t.createElementVNode("div",Ah,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",Lh,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",Ch,[e[22]||(e[22]=t.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",vh,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",zh,[t.createElementVNode("div",_h,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("div",Sh,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1),t.createElementVNode("div",Nh,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("div",Mh,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),t.createElementVNode("div",Ph,[t.createElementVNode("div",Vh,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("div",Th,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),t.createElementVNode("div",Eh,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("div",Dh,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),t.createElementVNode("div",Rh,[t.createElementVNode("div",Bh,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("div",Ih,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),t.createElementVNode("div",Fh,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("div",Gh,t.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",jh,[t.createElementVNode("div",Wh,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("div",Zh,t.toDisplayString(i.currentHourData.sit??"-")+"m",1),t.createElementVNode("div",Xh,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("div",Hh,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)]}),_:1}),t.createVNode(m),t.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var A;return[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{prepend:t.withCtx(()=>e[23]||(e[23]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(o.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:t.withModifiers(l.handleFollow,["stop"])},{prepend:t.withCtx(()=>e[24]||(e[24]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),t.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:t.withModifiers(l.handleMeteoMore,["stop"])},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):t.createCommentVNode("",!0),i.showMeteo&&a.simple?(t.openBlock(),t.createBlock(b,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:t.withCtx(()=>[t.createVNode(s,null,{default:t.withCtx(()=>{var A;return[t.createElementVNode("div",Oh,[t.createElementVNode("div",Yh,[e[25]||(e[25]=t.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),t.createElementVNode("div",Uh,t.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),t.createElementVNode("div",Jh,[(A=a.followList)!=null&&A.some(x=>{var C,k;return(x==null?void 0:x.id)===i.form.followId||((C=x==null?void 0:x.coordinate)==null?void 0:C.lng)===i.form.lng&&((k=x==null?void 0:x.coordinate)==null?void 0:k.lat)===i.form.lat})?(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleCancelFollow,["stop"])},{default:t.withCtx(()=>e[26]||(e[26]=[t.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(t.openBlock(),t.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:t.withModifiers(l.handleFollow,["stop"])},{default:t.withCtx(()=>e[27]||(e[27]=[t.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),t.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:t.withModifiers(l.handleCloseMeteo,["stop"])},{default:t.withCtx(()=>e[28]||(e[28]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=t.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),t.createVNode(m),t.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:t.withCtx(()=>{var A,x;return[t.createElementVNode("div",Kh,[t.createElementVNode("div",Qh,t.toDisplayString(o.$t("time.time")),1),t.createElementVNode("div",qh,t.toDisplayString(l.computedTzTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),t.createElementVNode("div",$h,[e[30]||(e[30]=t.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),t.createElementVNode("div",ep,t.toDisplayString(l.computedLocalTime((x=i.currentHourData)==null?void 0:x.utc)),1)]),t.createElementVNode("div",tp,[t.createElementVNode("div",op,[t.createElementVNode("div",null,[t.createElementVNode("span",ap,t.toDisplayString(o.$t("weather.wind")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windDir??"-")+"/"+t.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+t.toDisplayString(i.currentHourData.windLevel??"-"),1)]),t.createElementVNode("div",null,[t.createElementVNode("span",ip,t.toDisplayString(o.$t("weather.sigWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",rp,t.toDisplayString(o.$t("weather.windWave")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+t.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",lp,[t.createElementVNode("span",np,t.toDisplayString(o.$t("weather.sit")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",sp,[t.createElementVNode("div",null,[t.createElementVNode("span",cp,t.toDisplayString(o.$t("weather.swell")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.swellDir??"-")+"/"+t.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+t.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",mp,t.toDisplayString(o.$t("weather.current")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.currentDir??"-")+"/"+t.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),t.createElementVNode("div",null,[t.createElementVNode("span",dp,t.toDisplayString(o.$t("weather.visibility")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(t.openBlock(),t.createElementBlock("div",hp,[t.createElementVNode("span",pp,t.toDisplayString(o.$t("weather.sic")),1),t.createElementVNode("span",null,t.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):t.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):t.createCommentVNode("",!0),t.withDirectives(t.createElementVNode("div",gp,[(t.openBlock(),t.createElementBlock("svg",up,[t.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,fp)]))],512),[[t.vShow,i.showMeteo]])])}const bp=K($d,[["render",yp]]),d1="",wp={name:"IdmMeasure",props:{simple:{type:Boolean,default:!1},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,geojson:[],source:"measure-source",layer:"measure-layer",labelLayer:"measure-label-layer",sumLayer:"measure-suml-layer",tmpSource:"measure-tmp-source",tmpLayer:"measure-tmp-layer",tmpLabelLayer:"measure-tmp-label-layer",closeMarkers:{},pointMarkers:{},tipMarker:void 0,contextmenu:void 0,navigation:"RL",currentLineIndex:1}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var o,e,a;if(this.toggle)this.handleBind();else{(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),this.map;let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().addEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.on("mousemove",this.handleMove),(a=this.map)==null||a.on("dblclick",this.handleDblClick),(r=this.map)==null||r.on("click",this.handleClick),(i=this.map)==null||i.on("contextmenu",this.handleContextmenu),this.map&&(this.map.getCanvas().style.cursor="crosshair")},handleUnbind(){var o,e,a,r,i;(o=this.map)==null||o.getCanvas().removeEventListener("keydown",this.handleKeydown),(e=this.map)==null||e.off("mousemove",this.handleMove),(a=this.map)==null||a.off("dblclick",this.handleDblClick),(r=this.map)==null||r.off("click",this.handleClick),(i=this.map)==null||i.off("contextmenu",this.handleContextmenu);for(const l of this.geojson)this.handleClear(l,!0);this.geojson=[],this.map&&(this.map.getCanvas().style.cursor="grab")},handleKeydown(o){if(o.key==="Shift"){this.navigation=this.navigation==="RL"?"GC":"RL";const e=this.geojson.at(-1),a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&(a.at(-1).properties.mode=this.navigation),this.handleRender(e)}},handleDrag(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var w;return((w=f._element)==null?void 0:w.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);let p;u.features.forEach((f,w)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=w;return}});const h=u.features.filter(f=>f.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,lat:(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat,properties:h[p].properties},p===h.length-1?void 0:h[p+1])}},handleDragEnd(o){var a,r,i,l,n,c,s,m,d,g;const e=(r=(a=o.target)==null?void 0:a._element)==null?void 0:r.id;if((e==null?void 0:e.split("-").length)===2){const u=this.geojson.filter(h=>h.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(h=>{var f;return((f=h._element)==null?void 0:f.id)===e})[0].setLngLat([(l=(i=o.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(c=(n=o.target)==null?void 0:n._lngLat)==null?void 0:c.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(s=o.target)==null?void 0:s._lngLat)==null?void 0:m.lng,(g=(d=o.target)==null?void 0:d._lngLat)==null?void 0:g.lat],u.features=u.features.filter(h=>h.geometry.type==="Point"),this.handlePointUpdate(u)}},handleContextmenu(o){var a,r,i,l;o.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=o.originalEvent)==null?void 0:r.target)==null?void 0:i.parentElement)==null?void 0:l.id;if((e==null?void 0:e.split("-").length)===2){const c=this.geojson.filter(s=>s.id===e.split("-")[0])[0].features.filter(s=>s.geometry.type==="Point");if(c.length>2&&c.filter(m=>m.properties.id===(e==null?void 0:e.split("-")[1]))[0]){const m=document.createElement("div");m.className="idm-gl4-measure-contextmenu-marker",m.innerHTML=`<span id="del-${e}" class="del-point">${this.$t("actions.detele")}</span>`,this.contextmenu=new de.Marker(m).setOffset([24,0]).setLngLat([o.lngLat.lng,o.lngLat.lat]).addTo(this.map)}}},handleClick(o){var a,r,i,l,n,c;(a=this.contextmenu)==null||a.remove();const e=o.originalEvent.target.className;if(e==="marker-close"){const s=(i=(r=o.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===s)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==s),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const s=(c=(n=o.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:c.split("-"),m=this.geojson.filter(d=>d.id===s[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==s[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let s=this.geojson.at(-1);s||(s=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(s)),s.features=s.features.filter(d=>d.geometry.type==="Point");const m=E.feature({type:"Point",coordinates:[o.lngLat.lng,o.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});s.features.push(m),this.handlePointUpdate(s)}},handlePointUpdate(o){const e=o.features;if(e.length>1){let a=0;const r=[];for(let i=1;i<e.length;i++){const l=e[i-1],n=e[i],c=l.properties,s={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=M.LaneHelper.calculateDistance(s,m,c.mode==="RL",4),g=M.LaneHelper.calculateBearing(s,m,c.mode==="RL",2);a=M.LngLatHelper.roundPrecision(a+d,4);let u;c.mode==="RL"?u=M.LngLatHelper.convertToMonotonicLng([s,m]):u=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(s,m,200));const y=E.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=M.LngLatHelper.roundPrecision((c.totalDist?c.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),o.total=a}return this.handleRender(o),o},handleTmpPointUpdate(o,e,a,r){const i=E.featureCollection([]);let l,n;if(e){const s=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=M.LngLatHelper.convertToMonotonicLng([m,d]):g=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const s=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=M.LaneHelper.calculateDistance(m,d,s.mode==="RL",4),n=M.LaneHelper.calculateBearing(m,d,s.mode==="RL",2);let g;s.mode==="RL"?g=M.LngLatHelper.convertToMonotonicLng([m,d]):g=M.LngLatHelper.convertToMonotonicLng(M.LaneHelper.interpolateCoordinates(m,d,200));const u=E.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let c;if(r)c=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const s=M.LngLatHelper.roundPrecision((o.total??0)+l,1);c=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${n}</b>°</div><div class="marker-label"> ${this.$t("measure.mode")}${this.navigation==="RL"?"RL":"GC"}, ${this.$t("measure.switchTips")}</div><div class="marker-label">${this.$t("measure.clickTips")}</div>`}if(this.tipMarker)this.tipMarker._element.innerHTML=c,this.tipMarker.setLngLat([a.lng,a.lat]);else{const s=document.createElement("div");s.className="idm-gl4-measure-tip-marker",s.innerHTML=c,this.tipMarker=new de.Marker(s).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(o){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:o.lngLat.lng,lat:o.lngLat.lat})},handleDblClick(o){o.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(o){var e;if((e=o==null?void 0:o.features)!=null&&e.length){const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(o):this.map.addSource(a,{type:"geojson",data:o}),this.handleClear(o,!1),this.map.addLayer({id:r,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2}}),this.map.addLayer({id:i,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}}),this.map.addLayer({id:l,type:"symbol",source:a,filter:["==","$type","Point"],layout:{"text-field":"{sumLabel}","text-rotation-alignment":"map","text-size":12,"text-offset":[0,1.5]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});const n=o.features.filter(c=>c.geometry.type==="Point");for(const c of n){const s=document.createElement("div");s.id=`${o.id}-${c.properties.id}`,s.className=`${o.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,s.innerHTML='<div class="marker-circle"></div>';const m=new de.Marker({element:s,draggable:!0,contextmenu:!0}).setLngLat(c.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[o.id]?this.pointMarkers[o.id].push(m):this.pointMarkers[o.id]=[m]}if(o.closed){const c=n.at(-1),m=o.features.filter(g=>g.geometry.type==="LineString").at(-1),d=document.createElement("div");d.className="idm-gl4-measure-summary-marker",d.innerHTML=`<div class="marker-label">${m.properties.name}</div><div id="${o.id}" class="marker-close">X</div>`,this.closeMarkers[o.id]=new de.Marker(d).setOffset([0,-30]).setLngLat(c.geometry.coordinates).addTo(this.map)}}},handleClear(o,e=!0){var n,c,s,m,d,g,u,y,p,h;const a=`${o.id}-${this.source}`,r=`${o.id}-${this.layer}`,i=`${o.id}-${this.labelLayer}`,l=`${o.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(c=this.map)!=null&&c.getLayer(i)&&this.map.removeLayer(i),(s=this.map)!=null&&s.getLayer(l)&&this.map.removeLayer(l),(m=this.map)!=null&&m.getLayer(this.tmpLayer)&&this.map.removeLayer(this.tmpLayer),(d=this.map)!=null&&d.getLayer(this.tmpLabelLayer)&&this.map.removeLayer(this.tmpLabelLayer),(g=this.closeMarkers[o.id])==null||g.remove(),this.closeMarkers[o.id]=void 0,(u=this.pointMarkers[o.id])==null||u.forEach(f=>{f==null||f.remove()}),this.pointMarkers[o.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},xp={class:"idm-gl4-measure"};function kp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip");return t.openBlock(),t.createElementBlock("div",xp,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:s})=>[t.createVNode(n,t.mergeProps(s,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[0]||(e[0]=[t.createElementVNode("i",{class:"iconfont icon-a-Measuredistance text-h4"},null,-1)])),_:2,__:[0]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4)])}const Ap=K(wp,[["render",kp]]),h1="",Lp={name:"IdmDrawMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},simple:{type:Boolean,default:!1},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},emits:["close","save","hideLayer"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"],name:""},formRules:{lngDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,3}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=180||"0 ~ 180"],lngMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],latDegree:[e=>e!=null&&e!==""||"required",e=>/^\d{1,2}$/.test(e)||"number",e=>parseInt(e)>=0&&parseInt(e)<=90||"0 ~ 90"],latMinute:[e=>e==null||e===""||/^\d{1,2}(\.\d+)?$/.test(e)||"number",e=>e==null||e===""||parseInt(e)>=0&&parseInt(e)<=59||"0 ~ 59"],color:[e=>e!=null&&e!==""||"required"],name:[e=>e!=null&&e!==""||"required"]},saving:!1,drawSource:"draw-marker-source",drawPointLayer:"draw-marker-point-layer",drawLineLayer:"draw-marker-line-layer",drawFillLayer:"draw-marker-fill-layer",drawTmpSource:"draw-marker-tmp-source",drawTmpLayer:"draw-marker-tmp-layer",drawCoords:[],rectCornerMarkers:[],polygonVertexMarkers:[],circleMarkers:[],drawRadiusSource:"draw-marker-radius-source",drawRadiusLayer:"draw-marker-radius-layer",tipMarker:null,pointMarker:null,pointHighlightMarker:null,editMarkers:[],deleteBtn:null,originalProperties:{}}},watch:{markerType:{handler(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var o;(o=this.editLayer)!=null&&o.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var o;this.map&&(this.handleBindMap(),(o=this.editLayer)!=null&&o.id&&this.loadEditLayer())},immediate:!0},"form.color":{handler(){this.handleChangePoint(),this.handleUpdateLayerColors()},immediate:!0}},beforeUnmount(){this.handleClearDraw(!0),this.handleUnbindMap()},methods:{handleClose(){this.handleClearDraw(!0),this.handleUnbindMap(),this.$emit("close")},handleBindMap(){var o,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((o=this.editLayer)!=null&&o.id)?(this.map.on("click",this.handleMapClickLine),this.map.on("mousemove",this.handleMapMoveLine),this.map.on("dblclick",this.handleMapDblClickLine),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Area"&&!((e=this.editLayer)!=null&&e.id)&&(this.form.areaType==="Polygon"?(this.map.on("click",this.handleMapClickPolygon),this.map.on("mousemove",this.handleMapMovePolygon),this.map.on("dblclick",this.handleMapDblClickPolygon)):this.form.areaType==="Circle"?(this.map.on("click",this.handleMapClickCircle),this.map.on("mousemove",this.handleMapMoveCircle)):this.form.areaType==="Rect"&&(this.map.on("click",this.handleMapClickRect),this.map.on("mousemove",this.handleMapMoveRect)),this.map.getCanvas().style.cursor="crosshair"))},handleUnbindMap(){this.map&&(this.map.off("click",this.handleMapClickPoint),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon),this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle),this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect),this.map.getCanvas().style.cursor="grab")},handleRebindMap(){this.handleUnbindMap(),this.handleBindMap()},loadEditLayer(){var i,l,n,c,s,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const o=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!o)return;const a=(o.features||(o.type==="Feature"?[o]:[]))[0];if(!a)return;this.originalProperties=a.properties||{},this.form.name=this.editLayer.name||"",this.form.color=this.editLayer.color||((l=this.originalProperties)==null?void 0:l.color)||((n=this.Theme.current.value.colors)==null?void 0:n["map-green"])||"#4CAF50";const r=(c=a.geometry)==null?void 0:c.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(g).minute),this.form.latDir=M.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(d).direction,this.handleRenderPoint(this.drawCoords,this.form.color),this.setupPointEdit()}else r==="LineString"?(this.markerType="Line",this.$nextTick(()=>{this.handlerRenderEditLine(a),this.setupLineEdit(),this.handleUnbindMap()})):r==="Polygon"&&(this.markerType="Area",this.form.areaType=(m=(s=this.originalProperties)==null?void 0:s.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(o),this.setupPolygonEdit(a),this.handleUnbindMap()}));this.$emit("hideLayer",this.editLayer.id)},setupPointEdit(){var a;if(!this.pointMarker)return;this.pointMarker.setDraggable(!0),this.pointMarker.off("drag",this.handlePointDrag),this.pointMarker.on("drag",this.handlePointDrag),this.pointMarker.off("dragend",this.handlePointDrag),this.pointMarker.on("dragend",this.handlePointDrag),(a=this.pointHighlightMarker)==null||a.remove();const o=document.createElement("div");o.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new de.Marker({element:o,anchor:"center",offset:[0,0]}).setLngLat(e).addTo(this.map),this.pointMarker.on("drag",()=>{var r;(r=this.pointHighlightMarker)==null||r.setLngLat(this.pointMarker.getLngLat())})},handlePointDrag(){const{lng:o,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[o,e]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(e).minute),this.form.latDir=M.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(o).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(o).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(o).direction},clearEditMarkers(){this.editMarkers.forEach(o=>o.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(o){this.drawCoords=o.geometry.coordinates.map(r=>[...r]);const e=E.featureCollection([o,...this.drawCoords.map(r=>E.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new de.Marker({element:r,draggable:!0}).setLngLat(e).addTo(this.map);i.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleRenderVertexLabel([l,n],40)}),i.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:l,lat:n}=i.getLngLat();this.handleUpdateVertexLabel([l,n]),this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const o=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=E.point([a,r]),l=E.lineString(this.drawCoords),n=E.nearestPointOnLine(l,i);if(n){const c=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(c+1,0,[a,r]),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",o),this._edgeContextMenuHandler=o},showDeleteButton(o,e,a,r="delete"){this.hideDeleteButton();const i=this.map.getContainer(),l=document.createElement("button");l.textContent=a||this.$t("actions.delete"),l.className=r==="add"?"idm-gl4-edit-add-btn":"idm-gl4-edit-delete-btn";const n=this.map.project(o);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const c=s=>{s.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",c),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(o){this.handleSetDrawSource(o);const e=3;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",e),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":e}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},setupPolygonEdit(o){this.clearEditMarkers();const e=o.geometry.coordinates[0].slice(0,-1);this.drawCoords=e.map(r=>[...r]),this.drawCoords.forEach((r,i)=>{const l=document.createElement("div");l.className="idm-gl4-edit-vertex",l.style.backgroundColor=this.form.color;const n=new de.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleRenderVertexLabel([c,s])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:c,lat:s}=n.getLngLat();this.handleUpdateVertexLabel([c,s]),this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:c,lat:s}=n.getLngLat();this.drawCoords[i]=[c,s],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",c=>{c.preventDefault(),c.stopPropagation(),this.drawCoords.length>3&&this.showDeleteButton(r,()=>{this.drawCoords.splice(i,1),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})})}),this.editMarkers.push(n)});const a=r=>{r.preventDefault();const{lng:i,lat:l}=r.lngLat,n=E.point([i,l]),c=E.lineString([...this.drawCoords,this.drawCoords[0]]),s=E.nearestPointOnLine(c,n);if(s){const m=s.properties.index,d=m>=this.drawCoords.length-1?this.drawCoords.length-1:m;this.showDeleteButton([i,l],()=>{this.drawCoords.splice(d+1,0,[i,l]),this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels(),this.setupPolygonEdit({geometry:{type:"Polygon",coordinates:[[...this.drawCoords,this.drawCoords[0]]]},properties:this.originalProperties})},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",a),this._edgeContextMenuHandler=a},handleMapClickPoint(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(M.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(M.LngLatHelper.lat2pretty(a).minute),this.form.latDir=M.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(M.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(M.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=M.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:o,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(o),c=parseFloat(e),s=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(s))return;const d=(n+(isNaN(c)?0:c)/60)*(a==="S"?-1:1),g=(s+(isNaN(m)?0:m)/60)*(l==="W"?-1:1);this.drawCoords=[[g,d]],this.handleRenderPoint(this.drawCoords,this.form.color),(u=this.editLayer)!=null&&u.id&&this.setupPointEdit()},handleRenderPoint(o,e){var i;if((i=this.pointMarker)==null||i.remove(),!o||!o.length)return;const[a,r]=o[0];this.pointMarker=new de.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(o){o.preventDefault(),this.drawCoords.length>1&&this.drawCoords.pop(),this.handleRenderLine(this.drawCoords),this.handleClearTmp(),this.map.off("click",this.handleMapClickLine),this.map.off("mousemove",this.handleMapMoveLine),this.map.off("dblclick",this.handleMapDblClickLine)},handleRenderLine(o){if(!o||o.length<1)return;const e=[];o==null||o.forEach((i,l)=>{e.push(M.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(o==null?void 0:o.length)>=2&&e.push(M.GeoJsonHelper.drawLine(o));const a=2,r=E.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(o,e){const a=M.GeoJsonHelper.drawLine([o,e]),r=E.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng:o[0],lat:o[1]},l={lng:e[0],lat:e[1]},n=M.LaneHelper.calculateDistance(i,l,!0,2),c=M.LaneHelper.calculateBearing(i,l,!0,2);let s=0;for(let d=1;d<this.drawCoords.length;d++){const g={lng:this.drawCoords[d-1][0],lat:this.drawCoords[d-1][1]},u={lng:this.drawCoords[d][0],lat:this.drawCoords[d][1]};s+=M.LaneHelper.calculateDistance(g,u,!0,4)}s=M.LngLatHelper.roundPrecision(s+n,1);const m=`
218
218
  <div class="marker-label">${this.$t("measure.totalDistance")}: <b>${s}</b>nm, ${this.$t("measure.bearing")}: <b>${c}</b>°</div>
219
219
  <div class="marker-label"> ${this.$t("measure.clickTips")}</div>`;if(this.tipMarker)this.tipMarker._element.innerHTML=m,this.tipMarker.setLngLat([e[0],e[1]]);else{const d=document.createElement("div");d.className="idm-gl4-draw-tip-marker",d.innerHTML=m,this.tipMarker=new de.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(o){var r;const{lng:e,lat:a}=o.lngLat;this.drawCoords.push([e,a]),this.drawCoords.length>=3&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupPolygonEdit()},handleMapMovePolygon(o){if(!this.drawCoords.length)return;const{lng:e,lat:a}=o.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(o){o.preventDefault(),this.drawCoords.length>=1&&this.drawCoords.pop(),this.drawCoords.length>=1&&this.handleRenderPolygonFill(this.drawCoords),this.handleRenderAllVertexLabels(this.drawCoords),this.map.off("click",this.handleMapClickPolygon),this.map.off("mousemove",this.handleMapMovePolygon),this.map.off("dblclick",this.handleMapDblClickPolygon)},handleRenderPolygonFill(o){var i;let e=[];if(o==null||o.forEach((l,n)=>{e.push(E.point(l))}),(o==null?void 0:o.length)>2){const l=[...o,o[0]];e.push(M.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=E.featureCollection(e);this.handleSetDrawSource(a);const r=(i=this.editLayer)!=null&&i.id?3:2;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",r),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":r}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderVertexLabel(o,e=8){this.handleClearVertexLabels();const a=M.LngLatHelper.lat2pretty(o[1],4).pretty,r=M.LngLatHelper.lng2pretty(o[0],4).pretty,i=document.createElement("div");i.className="idm-gl4-draw-corner-label center",i.innerHTML=`<span class="corner-text">${a} <br/> ${r}</span>`;const l=new de.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(o).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(o){this.handleClearVertexLabels();const e=o.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=o.length,e[1]/=o.length,o.forEach(a=>{const r=a[0]-e[0],i=a[1]-e[1];let l="center";i>=0&&r>=0?l="bottom-left":i>=0&&r<0?l="bottom-right":i<0&&r>=0?l="top-left":l="top-right";const n=M.LngLatHelper.lat2pretty(a[1],4).pretty,c=M.LngLatHelper.lng2pretty(a[0],4).pretty,s=document.createElement("div");s.className="idm-gl4-draw-corner-label "+l,s.innerHTML=`<span class="corner-text">${n} <br/> ${c}</span>`;const m=new de.Marker(s,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(o){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(o);const a=M.LngLatHelper.lat2pretty(o[1],4).pretty,r=M.LngLatHelper.lng2pretty(o[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(o=>o.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=E.featureCollection([E.point([e,a])]);this.handleSetDrawSource(r),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),this.handleRenderCircleCenterLabel([e,a])}else{const r=this.drawCoords[0],i=[e,a],l=E.distance(E.point(r),E.point(i),{units:"nauticalmiles"}),n=M.GeoJsonHelper.drawCircle(r[0],r[1],l),c=E.featureCollection([E.point(r),n]);this.handleSetDrawSource(c),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=E.distance(E.point(e),E.point(a),{units:"nauticalmiles"}),i=M.GeoJsonHelper.drawCircle(e[0],e[1],r),l=E.featureCollection([E.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(o){const e=M.LngLatHelper.lat2pretty(o[1],4).pretty,a=M.LngLatHelper.lng2pretty(o[0],4).pretty,r=document.createElement("div");r.className="idm-gl4-draw-corner-label bottom-right",r.innerHTML=`<span class="corner-text">${e} <br/> ${a}</span>`;const i=new de.Marker(r,{anchor:"bottom-right"}).setLngLat(o).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(o,e,a){const r=M.LngLatHelper.roundPrecision(a,2),i=E.featureCollection([E.lineString([o,e])]);this.map.getSource(this.drawRadiusSource)?this.map.getSource(this.drawRadiusSource).setData(i):this.map.addSource(this.drawRadiusSource,{type:"geojson",data:i}),this.map.getLayer(this.drawRadiusLayer)||this.map.addLayer({id:this.drawRadiusLayer,type:"line",source:this.drawRadiusSource,layout:{"line-cap":"round"},paint:{"line-color":this.form.color,"line-width":1.5,"line-dasharray":[4,3]}});const l=[(o[0]+e[0])/2,(o[1]+e[1])/2],n=this.map.project(o),c=this.map.project(e),s=c.x-n.x,m=c.y-n.y;let d=Math.atan2(m,s)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const g=16,u=(d-90)*Math.PI/180,y=Math.round(Math.cos(u)*g),p=Math.round(Math.sin(u)*g);this.circleMarkers.length>1&&(this.circleMarkers[1].remove(),this.circleMarkers.splice(1,1));const h=document.createElement("div"),f=document.createElement("span");f.className="idm-gl4-draw-radius-label",f.style.transform=`rotate(${d}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const w=new de.Marker(h,{anchor:"center",offset:[y,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(w)},handleClearCircleLabels(){var o,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(o=this.map)!=null&&o.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(o){const{lng:e,lat:a}=o.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=M.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),c=E.featureCollection([l,...n.map(s=>E.point(s))]);this.handleSetDrawSource(c),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(o){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[o.lngLat.lng,o.lngLat.lat],r=M.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=E.featureCollection([r,...i.map(n=>E.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}}),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}})},handleRenderRectCorners(o,e){const a=Math.min(o[0],e[0]),r=Math.max(o[0],e[0]),i=Math.min(o[1],e[1]),l=Math.max(o[1],e[1]),n=[{coord:[a,l],anchor:"bottom-right"},{coord:[r,l],anchor:"bottom-left"},{coord:[r,i],anchor:"top-left"},{coord:[a,i],anchor:"top-right"}];this.handleClearRectCorners(),n.forEach(({coord:c,anchor:s})=>{const m=M.LngLatHelper.lat2pretty(c[1],4).pretty,d=M.LngLatHelper.lng2pretty(c[0],4).pretty,g=document.createElement("div");g.className="idm-gl4-draw-corner-label "+s,g.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new de.Marker(g,{anchor:s}).setLngLat(c).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(o=>o.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const o=(e=this.editLayer)!=null&&e.id?3:2;this.map.getLayer(this.drawFillLayer)||this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.getLayer(this.drawLineLayer)?this.map.setPaintProperty(this.drawLineLayer,"line-width",o):this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":o}})},handleSetDrawSource(o){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(o):this.map.addSource(this.drawSource,{type:"geojson",data:o})},handleClearTmp(){var o,e,a;(o=this.map)!=null&&o.getLayer(this.drawTmpLayer)&&this.map.removeLayer(this.drawTmpLayer),(e=this.map)!=null&&e.getSource(this.drawTmpSource)&&this.map.removeSource(this.drawTmpSource),(a=this.tipMarker)==null||a.remove(),this.tipMarker=null},handleUpdateLayerColors(){if(!this.map)return;const o=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",o),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",o),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",o),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",o),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",o),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=o)})},handleClearDraw(o=!1){var a,r,i,l,n;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const c of e)(a=this.map)!=null&&a.getLayer(c)&&((r=this.map)==null||r.removeLayer(c));(i=this.map)!=null&&i.getSource(this.drawSource)&&this.map.removeSource(this.drawSource),this.drawCoords=[],this.originalProperties={},this.handleClearRectCorners(),this.handleClearVertexLabels(),this.handleClearCircleLabels(),(l=this.pointMarker)==null||l.remove(),this.pointMarker=null,(n=this.pointHighlightMarker)==null||n.remove(),this.pointHighlightMarker=null,this.clearEditMarkers(),this.handleRebindMap()},async handleSave(){var r,i;let o=null;if(this.markerType==="Point"?await this.$refs.pointForm.validate().then(l=>{var n;if(l!=null&&l.valid){if(!this.drawCoords.length)return;const[c,s]=this.drawCoords[0];o=E.featureCollection([M.GeoJsonHelper.drawPoint(s,c,{...this.originalProperties,color:this.form.color,name:this.form.name})]),(n=o.features)==null||n.forEach(m=>{m.properties.color=this.form.color,m.properties.name=this.form.name})}}):this.markerType==="Line"?await this.$refs.lineForm.validate().then(l=>{if(l!=null&&l.valid){if(this.drawCoords.length<2)return;const n=[],c=M.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(s=>({lng:s==null?void 0:s[0],lat:s==null?void 0:s[1]})));for(const s of c)s.length>1&&n.push(M.GeoJsonHelper.drawLine(s,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));o=E.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,c,s;if(l!=null&&l.valid){const m=(n=this.map)==null?void 0:n.getSource(this.drawSource);if(!m)return;const d=m._data;if(!((c=d==null?void 0:d.features)!=null&&c.length))return;let g=((s=d.features)==null?void 0:s.filter(u=>u.geometry.type==="Polygon"))||[];if(g=g==null?void 0:g.map(u=>(u.properties.name=this.form.name,u.properties.color=this.form.color,u)),!g.length)return;o=E.featureCollection(g)}}),!o)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:o};this.saving=!0,await((r=this.editLayer)!=null&&r.id?me.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):me.post(`${this.gateway}/api/arc/lygroups/${(i=this.group)==null?void 0:i.id}/layers`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}})).then(l=>{var n,c,s,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((c=this.editLayer)==null?void 0:c.id)||((m=(s=l.data)==null?void 0:s.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},Cp={class:"text-h6 font-weight-600"},vp={class:"text-label mb-1"},zp={class:"text-label mb-1"},_p={class:"mb-1"},Sp={class:"text-label mb-1"},Np={class:"mb-1"},Mp={class:"text-label mb-1"},Pp={class:"mb-1"},Vp={class:"text-label mb-1"},Tp={class:"color-picker-row d-flex align-start ga-2"},Ep=["value"],Dp={class:"mb-n2"},Rp={class:"text-label mb-1"},Bp={class:"mb-1"},Ip={class:"text-label mb-1"},Fp={class:"color-picker-row d-flex align-start ga-2"},Gp=["value"],jp={class:"mb-n2"},Wp={class:"text-label mb-1"},Zp={key:0,class:"mb-3"},Xp={class:"text-label mb-1"},Hp={class:"mb-1"},Op={class:"text-label mb-1"},Yp={class:"color-picker-row d-flex align-start ga-2"},Up=["value"],Jp={class:"mb-n2"},Kp={class:"text-label mb-1"};function Qp(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VBtnToggle"),u=t.resolveComponent("VCol"),y=t.resolveComponent("VRow"),p=t.resolveComponent("VCardActions"),h=t.resolveComponent("VForm"),f=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(f,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:t.withCtx(()=>{var w;return[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("span",Cp,t.toDisplayString((b=a.editLayer)!=null&&b.id?o.$t("actions.edit"):o.$t("actions.addMarker")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[21]||(e[21]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),t.createVNode(s),t.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",vp,t.toDisplayString(o.$t("marker.group")),1),t.createVNode(m,{"model-value":(b=a.group)==null?void 0:b.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(w=a.editLayer)!=null&&w.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:t.withCtx(()=>{var b;return[t.createElementVNode("div",zp,[t.createTextVNode(t.toDisplayString(o.$t("marker.markerType")),1),e[22]||(e[22]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=A=>i.markerType=A),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((b=a.editLayer)!=null&&b.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Point",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Point"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Point"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.point")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Line",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Line"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.markerType==="Line"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.line")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Area",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.markerType==="Area"?"":"btn-border-1 btn-bg-1"]),color:i.markerType==="Area"?"primary":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(t.openBlock(),t.createBlock(h,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",_p,[t.createElementVNode("div",Sp,[t.createTextVNode(t.toDisplayString(o.$t("marker.lat")),1),e[23]||(e[23]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=b=>i.form.latDegree=b),e[2]||(e[2]=b=>l.handleChangePoint())],rules:i.formRules.latDegree,label:"",autocomplete:"off",density:"compact",variant:"outlined",height:"32px","min-height":"32px",required:"",dense:"",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[24]||(e[24]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=b=>i.form.latMinute=b),e[4]||(e[4]=b=>l.handleChangePoint())],rules:i.formRules.latMinute,label:"",height:"32px","min-height":"32px",autocomplete:"off",density:"compact",variant:"outlined",class:"text-body-1 input-btn-bg-1",required:"",dense:""},null,8,["modelValue","rules"]),e[25]||(e[25]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[5]||(e[5]=b=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",Np,[t.createElementVNode("div",Mp,[t.createTextVNode(t.toDisplayString(o.$t("marker.lng")),1),e[26]||(e[26]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(y,{class:"ma-0"},{default:t.withCtx(()=>[t.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=b=>i.form.lngDegree=b),e[7]||(e[7]=b=>l.handleChangePoint())],rules:i.formRules.lngDegree,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[27]||(e[27]=t.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),t.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:t.withCtx(()=>[t.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=b=>i.form.lngMinute=b),e[9]||(e[9]=b=>l.handleChangePoint())],rules:i.formRules.lngMinute,density:"compact",variant:"outlined",autocomplete:"off",class:"text-body-1 input-btn-bg-1"},null,8,["modelValue","rules"]),e[28]||(e[28]=t.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),t.createVNode(u,{cols:"2",class:"pa-0"},{default:t.withCtx(()=>[t.createVNode(n,{variant:"outlined",density:"compact",width:"32","min-width":"32",height:"32",class:"text-body-1 bg-primary",style:{border:"1px solid rgba(var(--v-theme-on-surface), 0.38)"},onClick:e[10]||(e[10]=b=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),t.createElementVNode("div",Pp,[t.createElementVNode("div",Vp,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[29]||(e[29]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Tp,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=b=>i.form.color=b.target.value)},null,40,Ep),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Dp,[t.createElementVNode("div",Rp,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[30]||(e[30]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Line"?(t.openBlock(),t.createBlock(h,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",Bp,[t.createElementVNode("div",Ip,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[31]||(e[31]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Fp,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=b=>i.form.color=b.target.value)},null,40,Gp),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=b=>i.form.color=b),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",jp,[t.createElementVNode("div",Wp,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[32]||(e[32]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=b=>i.form.name=b),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0),i.markerType==="Area"?(t.openBlock(),t.createBlock(h,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleSave,["prevent"])},{default:t.withCtx(()=>[t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>{var b,A;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Zp,[t.createElementVNode("div",Xp,[t.createTextVNode(t.toDisplayString(o.$t("marker.areaType")),1),e[33]||(e[33]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(g,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=x=>i.form.areaType=x),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((A=a.editLayer)!=null&&A.id)},{default:t.withCtx(()=>[t.createVNode(n,{value:"Polygon",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Polygon"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Polygon"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.polygon")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Circle",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Circle"?"":"btn-border-1 btn-bg-1"]),style:{"border-left":"0 !important","border-right":"0 !important"},color:i.form.areaType==="Circle"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.circle")),1)]),_:1},8,["class","color"]),t.createVNode(n,{value:"Rect",class:t.normalizeClass(["flex-1-1-0 text-none text-body-1",i.form.areaType==="Rect"?"":"btn-border-1 btn-bg-1"]),color:i.form.areaType==="Rect"?"primary":"","base-color":"",height:"32px","min-height":"32px"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),t.createElementVNode("div",Hp,[t.createElementVNode("div",Op,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[34]||(e[34]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",Yp,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=x=>i.form.color=x.target.value)},null,40,Up),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=x=>i.form.color=x),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",Jp,[t.createElementVNode("div",Kp,[t.createTextVNode(t.toDisplayString(o.$t("marker.name")),1),e[35]||(e[35]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=x=>i.form.name=x),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),t.createVNode(s),t.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>{var b;return[(b=a.editLayer)!=null&&b.id?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(n,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.clear")),1)]),_:1},8,["onClick"])),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):t.createCommentVNode("",!0)]}),_:1})}const qp=K(Lp,[["render",Qp]]),p1="",$p={name:"IdmImportMarker",props:{map:{type:Object},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String},group:{type:Object,default:null}},emits:["close","import"],setup(){return{Theme:ye.useTheme()}},data(){var o;return{form:{groupName:"",name:"",file:null,format:"",extend:void 0,color:(o=this.Theme.current.value.colors)==null?void 0:o["map-green"]},formRules:{groupName:[e=>e!=null&&e!==""||"required"],color:[e=>e!=null&&e!==""||"required"]},isDragOver:!1,uploading:!1,fileError:"",previewSourceId:"__import_preview__",previewMarkers:[]}},watch:{"form.color":{handler(o){var e;(e=this.form.extend)!=null&&e.features&&this.form.extend.features.forEach(a=>{a.properties.color=o}),this.handleDrawLayers()},immediate:!0}},mounted(){var o;this.form.groupName=((o=this.group)==null?void 0:o.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var o;this.form={groupName:((o=this.group)==null?void 0:o.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(o){const e=o.target.files[0];e&&this.onUpload(e)},handleDrop(o){this.isDragOver=!1;const e=o.dataTransfer.files[0];e&&this.onUpload(e)},async onUpload(o){var r,i,l,n;if(o.size>10485760){this.fileError=this.$t("marker.fileTooLarge");return}this.form.file=o,this.fileError="",this.form.name=(r=o.name.split("."))==null?void 0:r[0];const a=(i=o.name.split(".").pop())==null?void 0:i.toLowerCase();try{let c;if(a==="json"||a==="geojson"){const s=await o.text();c=JSON.parse(s)}else if(a==="kml"){const s=await o.text();c=await M.GeoJsonHelper.convertKML2GeoJSON(s)}else if(a==="kmz"){const s=await o.arrayBuffer();c=await M.GeoJsonHelper.convertKMZ2GeoJSON(s)}else if(a==="zip"||a==="shp"){const s=await o.arrayBuffer();c=await M.GeoJsonHelper.convertZIP2GeoJSON(s)}else{this.fileError="Unsupported format: "+a;return}this.form.extend=c,this.form.format="geojson",(n=(l=this.form.extend)==null?void 0:l.features)==null||n.forEach(s=>{s.properties.color=this.form.color}),this.handleDrawLayers()}catch{this.fileError="Failed to parse file",this.form.file=null}},handleRemoveFile(){this.form.file=null,this.$refs.fileInput.value="",this.handleClearPreview()},async handleConfirm(){const{valid:o}=await this.$refs.importForm.validate();if(!o)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await me.post(`${this.gateway}/api/arc/lygroups`,{name:this.form.groupName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i,l;((i=r.data)==null?void 0:i.code)===0&&(e=(l=r.data.data)==null?void 0:l.id)}),!e){this.uploading=!1;return}const a={format:this.form.format,extend:this.form.extend};me.post(`${this.gateway}/api/arc/lygroups/${e}/layers`,a,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(r=>{var i;((i=r.data)==null?void 0:i.code)===0&&(this.$emit("import"),this.uploading=!1)}).catch(r=>{this.uploading=!1})},handleDrawLayers(){if(!this.map||!this.form.extend)return;const o=this.form.extend,e=this.previewSourceId,a=o.features||(o.type==="Feature"?[o]:[]);a.forEach(i=>{var n,c,s;const l=((n=i==null?void 0:i.properties)==null?void 0:n.color)||((c=this.Theme.current.value.colors)==null?void 0:c["map-green"]);if(((s=i.geometry)==null?void 0:s.type)==="Point"){const[m,d]=i.geometry.coordinates;this.previewMarkers.push(new de.Marker({color:l}).setLngLat([m,d]).addTo(this.map))}i.properties.color||(i.properties.color=l)}),this.map.getSource(e)?this.map.getSource(e).setData(o):this.map.addSource(e,{type:"geojson",data:o});const r=new Set(a.map(i=>{var l;return(l=i.geometry)==null?void 0:l.type}));(r.has("LineString")||r.has("MultiLineString"))&&!this.map.getLayer(`${e}-line`)&&this.map.addLayer({id:`${e}-line`,type:"line",source:e,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),(r.has("Polygon")||r.has("MultiPolygon"))&&(this.map.getLayer(`${e}-fill`)||this.map.addLayer({id:`${e}-fill`,type:"fill",source:e,filter:["==","$type","Polygon"],paint:{"fill-color":["get","color"],"fill-opacity":.35}}),this.map.getLayer(`${e}-outline`)||this.map.addLayer({id:`${e}-outline`,type:"line",source:e,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}))},handleClearPreview(){if(!this.map)return;this.previewMarkers.forEach(a=>a.remove()),this.previewMarkers=[];const o=this.previewSourceId;[`${o}-vertex`,`${o}-point`,`${o}-line`,`${o}-fill`,`${o}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(o)&&this.map.removeSource(o)}}},eg={class:"text-h6 font-weight-600"},tg={class:"mb-4"},og={class:"text-label mb-1"},ag={class:"mb-1"},ig={class:"text-label mb-1"},rg={class:"color-picker-row d-flex align-start ga-2"},lg=["value"],ng={class:"text-body-2 text-center text-label"},sg={class:"text-body-1 text-primary mt-2 cursor-pointer"},cg={class:"text-body-2 text-left text-label mt-1"},mg={key:0,class:"text-body-2 text-left text-danger mt-1"},dg={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},hg={class:"text-body-2 text-truncate"};function pg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VIcon"),g=t.resolveComponent("VCardText"),u=t.resolveComponent("VCardActions"),y=t.resolveComponent("VForm"),p=t.resolveComponent("VCard");return t.openBlock(),t.createBlock(p,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",eg,t.toDisplayString(o.$t("marker.importLayer")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[9]||(e[9]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(y,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:t.withModifiers(l.handleConfirm,["prevent"])},{default:t.withCtx(()=>[t.createVNode(g,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",tg,[t.createElementVNode("div",og,[t.createTextVNode(t.toDisplayString(o.$t("marker.group")),1),e[10]||(e[10]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.form.groupName,"onUpdate:modelValue":e[0]||(e[0]=h=>i.form.groupName=h),density:"compact",variant:"outlined","hide-details":"",class:"input-btn-bg-1"},null,8,["modelValue"])]),t.createElementVNode("div",ag,[t.createElementVNode("div",ig,[t.createTextVNode(t.toDisplayString(o.$t("marker.color")),1),e[11]||(e[11]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createElementVNode("div",rg,[t.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[1]||(e[1]=h=>i.form.color=h.target.value)},null,40,lg),t.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[2]||(e[2]=h=>i.form.color=h),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),t.createElementVNode("div",{class:t.normalizeClass(["upload-area btn-bg-1 d-flex flex-column justify-center align-center pa-4",{"drag-over":i.isDragOver,"upload-error":i.fileError}]),onDragenter:e[4]||(e[4]=t.withModifiers(h=>i.isDragOver=!0,["prevent"])),onDragleave:e[5]||(e[5]=t.withModifiers(h=>i.isDragOver=!1,["prevent"])),onDragover:e[6]||(e[6]=t.withModifiers(()=>{},["prevent"])),onDrop:e[7]||(e[7]=t.withModifiers((...h)=>l.handleDrop&&l.handleDrop(...h),["prevent"])),onClick:e[8]||(e[8]=(...h)=>l.handleSelectFile&&l.handleSelectFile(...h))},[t.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:t.withCtx(()=>e[12]||(e[12]=[t.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[12]}),t.createElementVNode("div",ng,t.toDisplayString(o.$t("marker.uploadHint")),1),t.createElementVNode("div",sg,t.toDisplayString(o.$t("marker.selectFile")),1),t.createElementVNode("input",{ref:"fileInput",type:"file",style:{display:"none"},accept:".json,.geojson,.zip,.shp,.kml,.kmz",onChange:e[3]||(e[3]=(...h)=>l.handleFileChange&&l.handleFileChange(...h))},null,544)],34),t.createElementVNode("div",cg,t.toDisplayString(o.$t("marker.uploadLimit")),1),i.fileError?(t.openBlock(),t.createElementBlock("div",mg,t.toDisplayString(i.fileError),1)):t.createCommentVNode("",!0),i.form.file?(t.openBlock(),t.createElementBlock("div",dg,[t.createElementVNode("span",hg,[t.createVNode(d,{size:"16",color:"success",class:"mr-1"},{default:t.withCtx(()=>e[13]||(e[13]=[t.createTextVNode("mdi-check-circle",-1)])),_:1,__:[13]}),t.createTextVNode(" "+t.toDisplayString(i.form.file.name),1)]),t.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:t.withCtx(()=>[t.createVNode(d,{size:"16"},{default:t.withCtx(()=>e[14]||(e[14]=[t.createTextVNode("mdi-close",-1)])),_:1,__:[14]})]),_:1},8,["onClick"])])):t.createCommentVNode("",!0)]),_:1}),t.createVNode(s),t.createVNode(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.reset")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const gg=K($p,[["render",pg]]),g1="",ug={name:"IdmGroupDialog",props:{modelValue:{type:Boolean,default:!1},group:{type:Object,default:null},gateway:{type:String},token:{type:String},defaultMeteoToken:{type:String}},emits:["update:modelValue","saved"],data(){return{localName:"",saving:!1}},watch:{group:{handler(o){this.localName=(o==null?void 0:o.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var o;!this.group||!((o=this.localName)!=null&&o.trim())||(this.saving=!0,await me.put(`${this.gateway}/api/arc/lygroups/${this.group.id}`,{name:this.localName},{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&this.$emit("saved")}).finally(()=>{this.saving=!1}))}}},fg={class:"text-h6 font-weight-600"},yg={class:"text-label mb-2"};function bg(o,e,a,r,i,l){const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VCardTitle"),s=t.resolveComponent("VDivider"),m=t.resolveComponent("VTextField"),d=t.resolveComponent("VCardText"),g=t.resolveComponent("VCardActions"),u=t.resolveComponent("VCard"),y=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(y,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=p=>o.$emit("update:modelValue",p))},{default:t.withCtx(()=>[t.createVNode(u,{class:"",elevation:"4"},{default:t.withCtx(()=>[t.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:t.withCtx(()=>[t.createElementVNode("span",fg,t.toDisplayString(o.$t("actions.editGroup")),1),t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:t.withCtx(()=>e[2]||(e[2]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),t.createVNode(s),t.createVNode(d,{class:"px-4 text-body-1"},{default:t.withCtx(()=>[t.createElementVNode("div",yg,[t.createTextVNode(t.toDisplayString(o.$t("marker.groupName")),1),e[3]||(e[3]=t.createElementVNode("span",{class:"text-danger"},"*",-1))]),t.createVNode(m,{modelValue:i.localName,"onUpdate:modelValue":e[0]||(e[0]=p=>i.localName=p),density:"compact",variant:"outlined","hide-details":"",autocomplete:"off",height:"32px","min-height":"32px",class:"input-btn-bg-1"},null,8,["modelValue"])]),_:1}),t.createVNode(s),t.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:t.withCtx(()=>[t.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const wg=K(ug,[["render",bg]]),xg={name:"DeleteDialog",props:{title:{type:String},tips:{type:String},loading:{type:Boolean,default:!1}},emits:["close","delete"],data(){return{showDialog:!1}},methods:{handleClose(){this.showDialog=!1},handleDelete(){this.$emit("delete")},open(){this.showDialog=!0}}},kg={class:"text-body-1 pb-1"},Ag={class:"text-body-1"};function Lg(o,e,a,r,i,l){const n=t.resolveComponent("VIcon"),c=t.resolveComponent("VBtn"),s=t.resolveComponent("VCardTitle"),m=t.resolveComponent("VCardText"),d=t.resolveComponent("VCardActions"),g=t.resolveComponent("VCard"),u=t.resolveComponent("VDialog");return t.openBlock(),t.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=y=>i.showDialog=y),width:"500","min-width":"500","max-width":"500"},{default:t.withCtx(()=>[t.createVNode(g,{class:""},{default:t.withCtx(()=>[t.createVNode(s,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:t.withCtx(()=>[t.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),t.createElementVNode("div",null,t.toDisplayString(a.title),1),t.createVNode(c,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:t.withCtx(()=>e[1]||(e[1]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),t.createVNode(m,{class:"py-4 text-center"},{default:t.withCtx(()=>[t.createElementVNode("p",kg,t.toDisplayString(a.tips),1),t.createElementVNode("p",Ag,t.toDisplayString(o.$t("tips.doYouWantToContinue")),1)]),_:1}),t.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:t.withCtx(()=>[t.createVNode(c,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.cancel")),1)]),_:1},8,["onClick"]),t.createVNode(c,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const Cg=K(xg,[["render",Lg]]),u1="",f1="",vg={name:"IdmMarker",components:{IdmDrawMarker:qp,IdmImportMarker:gg,IdmGroupDialog:wg,DeleteDialog:Cg},props:{simple:{type:Boolean,default:!1},map:{type:Object},theme:{type:String},token:{type:String},isLogin:{type:Boolean,default:!1},defaultMeteoToken:{type:String},gateway:{type:String},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}}},emits:["map","menuToggle","theme","login"],setup(){return{Theme:ye.useTheme()}},data(){return{right:10,toggle:!1,autoActive:localStorage.getItem("autoActiveMarkersGL4")==="true"||void 0,keyword:"",drawDialog:!1,importDialog:!1,loading:!1,deleteDialog:!1,deleteLoading:!1,layerGroup:[],layers:[],groupIndex:0,currentLayer:void 0,drawnLayerIds:[],layerMarkers:{},groupDialog:!1,currentGroup:null,currentGroupId:"",currentGroupName:""}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px"}:{top:this.top+"px",right:this.toggle?"0px":"-280px"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var o;this.simple||(this.right=(((o=document.getElementsByClassName("right-bar")[0])==null?void 0:o.clientWidth)||0)+10)})},immediate:!0},toggle:{async handler(){this.toggle&&(localStorage.getItem("autoActiveMarkersGL4")||(this.autoActive=!0))}},autoActive:{async handler(){(this.autoActive===!0||this.autoActive===!1)&&localStorage.setItem("autoActiveMarkersGL4",this.autoActive),this.layerGroup.length===0&&await this.fetchAllLayers(),this.autoActive?this.handleDrawAllLayers():this.handleClearAllLayers()},immediate:!0},map:{handler(){this.map&&(this.handleDrawAllLayers(),this.map.on("zoom",this.handleZoomChange))}}},methods:{handleMenuToggle(){this.isLogin?(this.toggle=!this.toggle,this.$emit("menuToggle","markerLayers")):this.$emit("login")},handleEditGroup(o){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=o,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(o,e){o==="group"?(this.currentGroup=e,this.currentLayer=void 0):o==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var o;this.currentGroup?this.handleDeleteGroup((o=this.currentGroup)==null?void 0:o.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(o){o&&(this.deleteLoading=!0,await me.delete(`${this.gateway}/api/arc/lygroups/${o}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.fetchAllLayers(),this.currentGroup=void 0,this.$refs.deleteDialog.handleClose(),this.deleteLoading=!1)}).catch(()=>{this.deleteLoading=!1}))},handleOpenDrawMarkers(o){this.handleCloseDraw(),this.currentGroup=o||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(o){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=o||void 0,this.importDialog=!0},handleImportLayer(o){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(o){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(o,e){var a;this.importDialog=!1,this.drawDialog&&((a=this.currentLayer)!=null&&a.id)&&this.currentLayer.id!==e.id&&this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=o,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await me.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(o=>{var e,a,r,i,l,n;if(((e=o.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=o.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const c=[];(l=this.layerGroup)==null||l.forEach(s=>{var m;s.show=!0,(m=s.layers)==null||m.forEach(d=>{var u;d.layerGroupId=s.id;const g=typeof d.extend=="string"?JSON.parse(d.extend):d.extend;(u=g==null?void 0:g.features)==null||u.forEach(y=>{y.properties.lgId=s.id,y.properties.layerId=d.id,y.properties.name||(y.properties.name=d.name)}),c.push(d)})}),this.layers=c,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(o){this.deleteLoading=!0,await me.delete(`${this.gateway}/api/arc/layers/${o.id}`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&(this.deleteLoading=!1,this.fetchAllLayers(),this.$refs.deleteDialog.handleClose())}).catch(()=>{this.deleteLoading=!1})},handleRenderLayer(o){if(!this.map||!(o!=null&&o.extend))return;const e=typeof o.extend=="string"?JSON.parse(o.extend):o.extend;if(!e)return;const a=`marker-layer-${o.id}`;this.handleClearLayerMarkers(o.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(c=>{var s,m;return(((s=c.geometry)==null?void 0:s.type)==="Point"||((m=c.geometry)==null?void 0:m.type)==="MultiPoint")&&c.properties.shape==="point"})){const c=[];r.forEach(s=>{var u,y,p,h;const m=(u=s.geometry)==null?void 0:u.type,d=((y=s.properties)==null?void 0:y.name)||"",g=((p=s.properties)==null?void 0:p.color)||o.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[f,w]=s.geometry.coordinates,b=`<div style="font-size:12px;line-height:1.5;">
220
220
  <div style="font-weight:600;">${d}</div>
@@ -222,7 +222,7 @@
222
222
  </div>`,A=new de.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(b),x=new de.Marker({color:g}).setLngLat([f,w]).addTo(this.map),C=x.getElement();C.addEventListener("mouseenter",()=>A.setLngLat([f,w]).addTo(this.map)),C.addEventListener("mouseleave",()=>A.remove()),c.push(x)}else m==="MultiPoint"&&s.geometry.coordinates.forEach(([f,w])=>{const b=`<div style="font-size:12px;line-height:1.5;">
223
223
  <div style="font-weight:600;">${d}</div>
224
224
  <div>${M.LngLatHelper.lat2pretty(w,4).pretty}, ${M.LngLatHelper.lng2pretty(f,4).pretty}</div>
225
- </div>`,A=new de.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(b),x=new de.Marker({color:g}).setLngLat([f,w]).addTo(this.map),C=x.getElement();C.addEventListener("mouseenter",()=>A.setLngLat([f,w]).addTo(this.map)),C.addEventListener("mouseleave",()=>A.remove()),c.push(x)})}),this.layerMarkers[o.id]=c}this.map.getSource(a)?this.map.getSource(a).setData(e):this.map.addSource(a,{type:"geojson",data:e});const l=new Set;(e.features||(e.type==="Feature"?[e]:[])).forEach(c=>{var s;return l.add((s=c.geometry)==null?void 0:s.type)}),(l.has("LineString")||l.has("MultiLineString"))&&!this.map.getLayer(`${a}-line`)&&(this.map.addLayer({id:`${a}-line`,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),this.map.addLayer({id:`${a}-line-label`,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-field":["get","name"],"text-size":12,"text-anchor":"center","text-allow-overlap":!1,visibility:this.map.getZoom()>4?"visible":"none"},paint:{"text-color":"#ffffff","text-halo-color":["get","color"],"text-halo-width":1}})),(l.has("Polygon")||l.has("MultiPolygon"))&&(this.map.getLayer(`${a}-fill`)||this.map.addLayer({id:`${a}-fill`,type:"fill",source:a,filter:["==","$type","Polygon"],paint:{"fill-color":["get","color"],"fill-opacity":.35}}),this.map.getLayer(`${a}-outline`)||this.map.addLayer({id:`${a}-outline`,type:"line",source:a,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),this.map.getLayer(`${a}-polygon-label`)||this.map.addLayer({id:`${a}-polygon-label`,type:"symbol",source:a,filter:["==","$type","Polygon"],layout:{"symbol-placement":"point","text-field":["get","name"],"text-size":12,"text-allow-overlap":!1,visibility:this.map.getZoom()>4?"visible":"none"},paint:{"text-color":"#ffffff","text-halo-color":["get","color"],"text-halo-width":1}}))},handleDrawAllLayers(){!this.autoActive||!this.map||!this.layers.length||(this.handleClearAllLayers(),this.layers.forEach(o=>{this.handleRenderLayer(o)}),this.drawnLayerIds=this.layers.map(o=>o.id))},handleClearAllLayers(){this.map&&(Object.keys(this.layerMarkers).forEach(o=>{this.handleClearLayerMarkers(o)}),this.drawnLayerIds.forEach(o=>{const e=`marker-layer-${o}`;[`${e}-point`,`${e}-line`,`${e}-line-label`,`${e}-fill`,`${e}-outline`,`${e}-polygon-label`].forEach(r=>{this.map.getLayer(r)&&this.map.removeLayer(r)}),this.map.getSource(e)&&this.map.removeSource(e)}),this.drawnLayerIds=[],this.currentLayer=void 0)},handleClearLayer(o){if(!this.map||!o)return;this.handleClearLayerMarkers(o);const e=`marker-layer-${o}`;[`${e}-point`,`${e}-line`,`${e}-line-label`,`${e}-fill`,`${e}-outline`,`${e}-polygon-label`].forEach(r=>{this.map.getLayer(r)&&this.map.removeLayer(r)}),this.map.getSource(e)&&this.map.removeSource(e)},handleClearLayerMarkers(o){const e=this.layerMarkers[o];e&&(e.forEach(a=>a.remove()),delete this.layerMarkers[o])},handleZoomChange(){if(!this.map)return;const e=this.map.getZoom()>4?"visible":"none";this.drawnLayerIds.forEach(a=>{const r=`marker-layer-${a}`,i=`${r}-line-label`,l=`${r}-polygon-label`;this.map.getLayer(i)&&this.map.setLayoutProperty(i,"visibility",e),this.map.getLayer(l)&&this.map.setLayoutProperty(l,"visibility",e)})}}},zg={class:"idm-gl4-marker"},_g={class:"w-100 px-4 d-flex flex-column justify-start align-start"},Sg={class:"w-100 header-box d-flex justify-space-between align-center pr-4"},Ng={class:"d-flex justify-start align-center ga-3"},Mg={class:"text-h5 font-weight-medium"},Pg={class:"search-box w-100 mb-3"},Vg={class:"multi-color-icon",style:{height:"20px",width:"20px"},"aria-hidden":"true"},Tg={key:0,class:"w-100 d-flex justify-space-between align-center ga-4"},Eg={key:0,class:"w-100 d-flex justify-center align-center",style:{height:"200px"}},Dg={key:1,class:"w-100 d-flex justify-center align-center"},Rg={class:"text-body-1"},Bg={key:2,class:"list-box w-100 flex-1-1-0 px-4 pb-2 scroll overflow-y-auto"},Ig={class:"group-label text-body-1 d-flex justify-space-between align-center py-4"},Fg={class:"d-flex justify-start align-center pl-2 cursor-pointer"},Gg=["onClick"],jg={key:0},Wg={key:0,class:"layer-list flex-1-1-0 overflow-y-hidden pb-2"},Zg={class:"d-flex align-center justify-start ga-2"},Xg={class:"font-weight-600 layer-name"},Hg={key:0,class:"layer-actions d-flex align-center justify-end ga-1"};function Og(o,e,a,r,i,l){var _;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VSwitch"),m=t.resolveComponent("VIcon"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("VProgressCircular"),u=t.resolveComponent("VChip"),y=t.resolveComponent("VListItemTitle"),p=t.resolveComponent("VListItem"),h=t.resolveComponent("VList"),f=t.resolveComponent("VCard"),w=t.resolveComponent("VMenu"),b=t.resolveComponent("VDivider"),A=t.resolveComponent("IdmDrawMarker"),x=t.resolveComponent("IdmImportMarker"),C=t.resolveComponent("IdmGroupDialog"),k=t.resolveComponent("DeleteDialog");return t.openBlock(),t.createElementBlock("div",zg,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+206+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("marker.markers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:z})=>[t.createVNode(n,t.mergeProps(z,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[7]||(e[7]=[t.createElementVNode("i",{class:"iconfont icon-compass text-h4"},null,-1)])),_:2,__:[7]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),t.createElementVNode("div",{class:t.normalizeClass(["main-box transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",_g,[t.createElementVNode("div",Sg,[t.createElementVNode("div",Ng,[t.createElementVNode("div",Mg,t.toDisplayString(o.$t("marker.markers")),1),t.createVNode(s,{modelValue:i.autoActive,"onUpdate:modelValue":e[0]||(e[0]=z=>i.autoActive=z),class:"small-switch",inset:"",color:"primary","base-color":"disabled","hide-details":""},null,8,["modelValue"]),t.createVNode(n,{class:"ml-n8",density:"compact",icon:"",variant:"text",onClick:l.fetchAllLayers},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-refresh"})]),_:1},8,["onClick"])]),t.createVNode(n,{class:"mr-n6",density:"comfortable",icon:"",variant:"plain",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[8]},8,["onClick"])]),t.createElementVNode("div",Pg,[t.createVNode(d,{modelValue:i.keyword,"onUpdate:modelValue":e[1]||(e[1]=z=>i.keyword=z),"clear-icon":"mdi-close",clearable:"",density:"compact","hide-details":"",variant:"outlined",autocomplete:"off",class:"input-btn-bg-1"},{"prepend-inner":t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",Vg,e[9]||(e[9]=[t.createElementVNode("use",{"xlink:href":"#icon-search"},null,-1)])))]),_:1},8,["modelValue"])]),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Tg,[t.createVNode(n,{class:"flex-1-1-0 text-none mb-3 text-body-1 font-weight-600",color:"primary",variant:"text",density:"compact",height:"32","max-height":"32","prepend-icon":"mdi-plus",onClick:e[2]||(e[2]=z=>l.handleOpenDrawMarkers())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.add")),1)]),_:1}),t.createVNode(n,{class:"flex-1-1-0 text-none mb-3 text-body-1 font-weight-600",color:"primary",variant:"text",density:"compact",height:"32","max-height":"32","prepend-icon":"mdi-import",onClick:l.handleOpenImportDialog},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.import")),1)]),_:1},8,["onClick"])]))]),i.loading?(t.openBlock(),t.createElementBlock("div",Eg,[t.createVNode(g,{color:"primary",indeterminate:"",size:"36",width:"4"})])):i.layerGroup.length===0?(t.openBlock(),t.createElementBlock("div",Dg,[t.createElementVNode("div",Rg,t.toDisplayString(o.$t("tips.noData")),1)])):(t.openBlock(),t.createElementBlock("div",Bg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.layerGroup,(z,P)=>{var T;return t.openBlock(),t.createElementBlock("div",{key:z.name,class:t.normalizeClass(["btn-bg-1",z.index===i.layerGroup.length?"rounded-b":z.index===1?"rounded-t":""])},[t.createElementVNode("div",Ig,[t.createElementVNode("div",Fg,[z.show?(t.openBlock(),t.createBlock(m,{key:0,icon:"mdi-chevron-down",onClick:V=>z.show=!1},null,8,["onClick"])):(t.openBlock(),t.createBlock(m,{key:1,icon:"mdi-chevron-right",onClick:V=>z.show=!0},null,8,["onClick"])),i.loading?(t.openBlock(),t.createBlock(g,{key:3,class:"mx-2",color:"primary",indeterminate:"",size:"16",width:"2"})):(t.openBlock(),t.createBlock(u,{key:2,density:"compact",variant:"tonal",class:"font-weight-600 mr-2",color:"primary",onClick:V=>z.show=!z.show},{default:t.withCtx(()=>{var V;return[t.createTextVNode(t.toDisplayString((V=z.layers)==null?void 0:V.length),1)]}),_:2},1032,["onClick"])),t.createElementVNode("div",{class:"",onClick:V=>z.show=!z.show},t.toDisplayString(z.name),9,Gg)]),z.name!=="Custom Layers"&&!a.simple?(t.openBlock(),t.createElementBlock("div",jg,[t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mx-1"},{default:t.withCtx(()=>[e[10]||(e[10]=t.createElementVNode("i",{class:"iconfont icon-dots-vertical text-h4 cursor-pointer"},null,-1)),t.createVNode(w,{activator:"parent","min-width":"240",class:"drop-menu"},{default:t.withCtx(()=>[t.createVNode(f,{class:"pa-2 px-0"},{default:t.withCtx(()=>[t.createVNode(h,{class:""},{default:t.withCtx(()=>[t.createVNode(p,{value:"account",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-body-1 d-flex jusity-center align-center",onClick:V=>l.handleOpenDrawMarkers(z)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-plus-circle-outline mr-4",size:"16"}),t.createElementVNode("span",null,t.toDisplayString(o.$t("actions.addMarker")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(p,{value:"help",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-body-1 d-flex jusity-center align-center",onClick:V=>l.handleEditGroup(z)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-pencil mr-4",size:"16"}),t.createElementVNode("span",null,t.toDisplayString(o.$t("actions.editGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(p,{value:"loginOut",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-body-1 d-flex jusity-center align-center",onClick:V=>l.handleOpenDelete("group",z)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-trash-can-outline mr-4",size:"16"}),t.createElementVNode("span",null,t.toDisplayString(o.$t("actions.deleteGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2,__:[10]},1024)])):t.createCommentVNode("",!0)]),z.show?(t.openBlock(),t.createElementBlock("div",Wg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((T=z.layers)==null?void 0:T.filter(V=>{var O;return((O=V.name)==null?void 0:O.indexOf(i.keyword))>-1}),V=>{var O;return t.openBlock(),t.createElementBlock("div",{key:V.id,class:t.normalizeClass(["layer-item py-3 px-2 mx-2 rounded cursor-pointer d-flex align-center justify-space-between ga-4",((O=i.currentLayer)==null?void 0:O.id)===V.id?"active":""])},[t.createElementVNode("div",Zg,[t.createElementVNode("span",Xg,t.toDisplayString(V==null?void 0:V.name),1)]),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Hg,[t.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:Y=>l.handleEditLayer(z,V)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-pencil",size:"16"})]),_:2},1032,["onClick"]),t.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:Y=>l.handleOpenDelete("layer",V)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-trash-can-outline",size:"16"})]),_:2},1032,["onClick"])]))],2)}),128))])):t.createCommentVNode("",!0),P<i.layerGroup.length-1?(t.openBlock(),t.createBlock(b,{key:1,class:"w-100",thickness:"1"})):t.createCommentVNode("",!0)],2)}),128))]))],6),i.drawDialog?(t.openBlock(),t.createBlock(A,{ref:"drawDialog",key:((_=i.currentLayer)==null?void 0:_.id)||"new",map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,"edit-layer":i.currentLayer,group:i.currentGroup,onClose:l.handleCloseDraw,onSave:l.handleSaveMarker,onHideLayer:l.handleClearLayer},null,8,["map","gateway","token","default-meteo-token","edit-layer","group","onClose","onSave","onHideLayer"])):t.createCommentVNode("",!0),i.importDialog?(t.openBlock(),t.createBlock(x,{key:1,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,"layer-group":i.layerGroup,group:i.currentGroup,onClose:e[3]||(e[3]=z=>{i.importDialog=!1,i.currentGroup=void 0}),onImport:l.handleImportLayer},null,8,["map","gateway","token","default-meteo-token","layer-group","group","onImport"])):t.createCommentVNode("",!0),t.createVNode(C,{modelValue:i.groupDialog,"onUpdate:modelValue":e[4]||(e[4]=z=>i.groupDialog=z),group:i.currentGroup,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,onClose:e[5]||(e[5]=z=>{i.groupDialog=!1,i.currentGroup=void 0}),onSaved:l.fetchAllLayers},null,8,["modelValue","group","gateway","token","default-meteo-token","onSaved"]),t.createVNode(k,{ref:"deleteDialog",title:o.$t("actions.delete"),tips:o.$t("tips.deleteText"),loading:i.deleteLoading,onDelete:e[6]||(e[6]=z=>l.confirmDelete())},null,8,["title","tips","loading"])])}const Yg=K(vg,[["render",Og]]);var D={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function Ug(o="soft"){switch(D.session.__counterEpoch=(D.session.__counterEpoch||0)+1,o){case"auto":{D.session.styleMap=new Map,D.session.nodeMap=new Map;return}case"soft":{D.session.styleMap=new Map,D.session.nodeMap=new Map,D.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{D.session.styleMap=new Map,D.session.nodeMap=new Map,D.session.styleCache=new WeakMap,D.computedStyle=new WeakMap,D.baseStyle=new Map,D.defaultStyle=new Map,D.image=new Map,D.background=new Map,D.resource=new Map,D.font=new Set;return}default:{D.session.styleMap=new Map,D.session.nodeMap=new Map,D.session.styleCache=new WeakMap;return}}}function Zo(o){let e=o.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let a=e[2].trim();return a.startsWith("#")?null:a}function Jg(o){if(!o||o==="none")return"";let e=o.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(a,r)=>{let i=r.split(",").map(l=>l.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(a,r)=>{let i=r.split(",").map(l=>l.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function Po(o){if(/%[0-9A-Fa-f]{2}/.test(o))return o;try{return encodeURI(o)}catch{return o}}function Kg(o="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:a=12}={}){let r=new Map,i=0;function l(n,c,s){if(i>=a)return;let m=Date.now();(r.get(c)||0)>m||(r.set(c,m+e),i++,n==="warn"&&console&&console.warn?console.warn(`${o} ${s}`):console&&console.error&&console.error(`${o} ${s}`))}return{warnOnce(n,c){l("warn",n,c)},errorOnce(n,c){l("error",n,c)},reset(){r.clear(),i=0}}}var na=Kg("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Xo=new Map,Vo=new Map;function Qg(o){return/^data:|^blob:|^about:blank$/i.test(o)}function qg(o,e){try{let a=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,i=new URL(r||".",a),l=new URL(o,a);if(l.origin===i.origin)return!0;let n=l.searchParams;if(n&&(n.has("url")||n.has("target")))return!0}catch{}return!1}function $g(o,e){if(!e||Qg(o)||qg(o,e))return!1;try{let a=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(o,a);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function eu(o,e){if(!e)return o;if(e.includes("{url}"))return e.replace("{urlRaw}",Po(o)).replace("{url}",encodeURIComponent(o));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(o)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(o)}`;if(e.endsWith("/"))return`${e}${Po(o)}`;let a=e.includes("?")?"&":"?";return`${e}${a}url=${encodeURIComponent(o)}`}function sa(o){return new Promise((e,a)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>a(new Error("read_failed")),r.readAsDataURL(o)})}function tu(o,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,o].join("|")}async function Ht(o,e={}){let a=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",l=e.errorTTL??8e3,n=e.headers||{},c=!!e.silent;if(/^data:/i.test(o))try{if(a==="text")return{ok:!0,data:String(o),status:200,url:o,fromCache:!1};if(a==="dataURL")return{ok:!0,data:String(o),status:200,url:o,fromCache:!1,mime:String(o).slice(5).split(";")[0]||""};let[,f="",w=""]=String(o).match(/^data:([^,]*),(.*)$/)||[],b=/;base64/i.test(f)?atob(w):decodeURIComponent(w),A=new Uint8Array([...b].map(C=>C.charCodeAt(0))),x=new Blob([A],{type:(f||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:o,fromCache:!1,mime:x.type||""}}catch{return{ok:!1,data:null,status:0,url:o,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(o))try{let f=await fetch(o);if(!f.ok)return{ok:!1,data:null,status:f.status,url:o,fromCache:!1,reason:"http_error"};let w=await f.blob(),b=w.type||f.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await sa(w),status:f.status,url:o,fromCache:!1,mime:b}:a==="text"?{ok:!0,data:await w.text(),status:f.status,url:o,fromCache:!1,mime:b}:{ok:!0,data:w,status:f.status,url:o,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:o,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(o))return a==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:o,fromCache:!1,mime:"image/png"}:{ok:!0,data:a==="text"?"":new Blob([]),status:200,url:o,fromCache:!1};let s=tu(o,{as:a,timeout:r,useProxy:i,errorTTL:l}),m=Vo.get(s);if(m&&m.until>Date.now())return{...m.result,fromCache:!0};m&&Vo.delete(s);let d=Xo.get(s);if(d)return d;let g=$g(o,i)?eu(o,i):o,u=e.credentials;if(!u)try{let f=typeof location<"u"&&location.href?location.href:"http://localhost/",w=new URL(o,f);u=typeof location<"u"&&w.origin===location.origin?"include":"omit"}catch{u="omit"}let y=new AbortController,p=setTimeout(()=>y.abort("timeout"),r),h=(async()=>{try{let f=await fetch(g,{signal:y.signal,credentials:u,headers:n});if(!f.ok){let A={ok:!1,data:null,status:f.status,url:g,fromCache:!1,reason:"http_error"};if(l>0&&Vo.set(s,{until:Date.now()+l,result:A}),!c){let x=`${f.status} ${f.statusText||""}`.trim();na.warnOnce(`http:${f.status}:${a}:${new URL(o,(location==null?void 0:location.href)??"http://localhost/").origin}`,`HTTP error ${x} while fetching ${a} ${o}`)}return e.onError&&e.onError(A),A}if(a==="text")return{ok:!0,data:await f.text(),status:f.status,url:g,fromCache:!1};let w=await f.blob(),b=w.type||f.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await sa(w),status:f.status,url:g,fromCache:!1,mime:b}:{ok:!0,data:w,status:f.status,url:g,fromCache:!1,mime:b}}catch(f){let w=f&&typeof f=="object"&&"name"in f&&f.name==="AbortError"?String(f.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:g,fromCache:!1,reason:w};if(!/^blob:/i.test(o)&&l>0&&Vo.set(s,{until:Date.now()+l,result:b}),!c){let A=`${w}:${a}:${new URL(o,(location==null?void 0:location.href)??"http://localhost/").origin}`,x=w==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${o}`:w==="abort"?`Request aborted while fetching ${a} ${o}`:`Network/CORS issue while fetching ${a} ${o}. A proxy may be required`;na.errorOnce(A,x)}return e.onError&&e.onError(b),b}finally{clearTimeout(p),Xo.delete(s)}})();return Xo.set(s,h),h}async function ca(o,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(o)||o.trim()==="none")return o;let a=Zo(o);if(!a)return o;let r=Po(a);if(D.background.has(r)){let i=D.background.get(r);return i?`url("${i}")`:"none"}try{let i=await Ht(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(D.background.set(r,i.data),`url("${i.data}")`):(D.background.set(r,null),"none")}catch{return D.background.set(r,null),"none"}}var ou=new Set(["meta","script","noscript","title","link","template"]),Ho=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]);function au(o){if(o=String(o).toLowerCase(),Ho.has(o)){let l={};return D.defaultStyle.set(o,l),l}if(D.defaultStyle.has(o))return D.defaultStyle.get(o);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let a=document.createElement(o);a.style.all="initial",e.appendChild(a);let r=getComputedStyle(a),i={};for(let l of r){if(ma(l))continue;let n=r.getPropertyValue(l);i[l]=n}return e.removeChild(a),D.defaultStyle.set(o,i),i}var iu=/(?:^|-)(animation|transition)(?:-|$)/i,ru=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,lu=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function ma(o){let e=String(o).toLowerCase();return!!(lu.has(e)||ru.test(e)||iu.test(e))}function Oo(o,e){if(e=String(e||"").toLowerCase(),Ho.has(e))return"";let a=[],r=au(e);for(let[i,l]of Object.entries(o)){if(ma(i))continue;let n=r[i];l&&l!==n&&a.push(`${i}:${l}`)}return a.sort(),a.join(";")}function nu(o){let e=new Set;return o.nodeType!==Node.ELEMENT_NODE&&o.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(o.tagName&&e.add(o.tagName.toLowerCase()),typeof o.querySelectorAll=="function"&&o.querySelectorAll("*").forEach(a=>e.add(a.tagName.toLowerCase())),Array.from(e))}function su(o){let e=new Map;for(let r of o){let i=D.defaultStyle.get(r);if(!i)continue;let l=Object.entries(i).map(([n,c])=>`${n}:${c};`).sort().join("");l&&(e.has(l)||e.set(l,[]),e.get(l).push(r))}let a="";for(let[r,i]of e.entries())a+=`${i.join(",")} { ${r} }
225
+ </div>`,A=new de.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(b),x=new de.Marker({color:g}).setLngLat([f,w]).addTo(this.map),C=x.getElement();C.addEventListener("mouseenter",()=>A.setLngLat([f,w]).addTo(this.map)),C.addEventListener("mouseleave",()=>A.remove()),c.push(x)})}),this.layerMarkers[o.id]=c}this.map.getSource(a)?this.map.getSource(a).setData(e):this.map.addSource(a,{type:"geojson",data:e});const l=new Set;(e.features||(e.type==="Feature"?[e]:[])).forEach(c=>{var s;return l.add((s=c.geometry)==null?void 0:s.type)}),(l.has("LineString")||l.has("MultiLineString"))&&!this.map.getLayer(`${a}-line`)&&(this.map.addLayer({id:`${a}-line`,type:"line",source:a,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),this.map.addLayer({id:`${a}-line-label`,type:"symbol",source:a,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-field":["get","name"],"text-size":12,"text-anchor":"center","text-allow-overlap":!1,visibility:this.map.getZoom()>4?"visible":"none"},paint:{"text-color":"#ffffff","text-halo-color":["get","color"],"text-halo-width":1}})),(l.has("Polygon")||l.has("MultiPolygon"))&&(this.map.getLayer(`${a}-fill`)||this.map.addLayer({id:`${a}-fill`,type:"fill",source:a,filter:["==","$type","Polygon"],paint:{"fill-color":["get","color"],"fill-opacity":.35}}),this.map.getLayer(`${a}-outline`)||this.map.addLayer({id:`${a}-outline`,type:"line",source:a,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["get","color"],"line-width":2}}),this.map.getLayer(`${a}-polygon-label`)||this.map.addLayer({id:`${a}-polygon-label`,type:"symbol",source:a,filter:["==","$type","Polygon"],layout:{"symbol-placement":"point","text-field":["get","name"],"text-size":12,"text-allow-overlap":!1,visibility:this.map.getZoom()>4?"visible":"none"},paint:{"text-color":"#ffffff","text-halo-color":["get","color"],"text-halo-width":1}}))},handleDrawAllLayers(){!this.autoActive||!this.map||!this.layers.length||(this.handleClearAllLayers(),this.layers.forEach(o=>{this.handleRenderLayer(o)}),this.drawnLayerIds=this.layers.map(o=>o.id))},handleClearAllLayers(){this.map&&(Object.keys(this.layerMarkers).forEach(o=>{this.handleClearLayerMarkers(o)}),this.drawnLayerIds.forEach(o=>{const e=`marker-layer-${o}`;[`${e}-point`,`${e}-line`,`${e}-line-label`,`${e}-fill`,`${e}-outline`,`${e}-polygon-label`].forEach(r=>{this.map.getLayer(r)&&this.map.removeLayer(r)}),this.map.getSource(e)&&this.map.removeSource(e)}),this.drawnLayerIds=[],this.currentLayer=void 0)},handleClearLayer(o){if(!this.map||!o)return;this.handleClearLayerMarkers(o);const e=`marker-layer-${o}`;[`${e}-point`,`${e}-line`,`${e}-line-label`,`${e}-fill`,`${e}-outline`,`${e}-polygon-label`].forEach(r=>{this.map.getLayer(r)&&this.map.removeLayer(r)}),this.map.getSource(e)&&this.map.removeSource(e)},handleClearLayerMarkers(o){const e=this.layerMarkers[o];e&&(e.forEach(a=>a.remove()),delete this.layerMarkers[o])},handleZoomChange(){if(!this.map)return;const e=this.map.getZoom()>4?"visible":"none";this.drawnLayerIds.forEach(a=>{const r=`marker-layer-${a}`,i=`${r}-line-label`,l=`${r}-polygon-label`;this.map.getLayer(i)&&this.map.setLayoutProperty(i,"visibility",e),this.map.getLayer(l)&&this.map.setLayoutProperty(l,"visibility",e)})}}},zg={class:"idm-gl4-marker"},_g={class:"w-100 px-4 d-flex flex-column justify-start align-start"},Sg={class:"w-100 header-box d-flex justify-space-between align-center pr-4"},Ng={class:"d-flex justify-start align-center ga-3"},Mg={class:"text-h5 font-weight-medium"},Pg={class:"search-box w-100 mb-3"},Vg={class:"multi-color-icon",style:{height:"20px",width:"20px"},"aria-hidden":"true"},Tg={key:0,class:"w-100 d-flex justify-space-between align-center ga-4"},Eg={key:0,class:"w-100 d-flex justify-center align-center",style:{height:"200px"}},Dg={key:1,class:"w-100 d-flex justify-center align-center"},Rg={class:"text-body-1"},Bg={key:2,class:"list-box w-100 flex-1-1-0 px-4 pb-2 scroll overflow-y-auto"},Ig={class:"group-label text-body-1 d-flex justify-space-between align-center py-4"},Fg={class:"d-flex justify-start align-center pl-2 cursor-pointer"},Gg=["onClick"],jg={key:0},Wg={key:0,class:"layer-list flex-1-1-0 overflow-y-hidden pb-2"},Zg={class:"d-flex align-center justify-start ga-2"},Xg={class:"font-weight-600 layer-name"},Hg={key:0,class:"layer-actions d-flex align-center justify-end ga-1"};function Og(o,e,a,r,i,l){var _;const n=t.resolveComponent("VBtn"),c=t.resolveComponent("VTooltip"),s=t.resolveComponent("VSwitch"),m=t.resolveComponent("VIcon"),d=t.resolveComponent("VTextField"),g=t.resolveComponent("VProgressCircular"),u=t.resolveComponent("VChip"),y=t.resolveComponent("VListItemTitle"),p=t.resolveComponent("VListItem"),h=t.resolveComponent("VList"),f=t.resolveComponent("VCard"),w=t.resolveComponent("VMenu"),b=t.resolveComponent("VDivider"),A=t.resolveComponent("IdmDrawMarker"),x=t.resolveComponent("IdmImportMarker"),C=t.resolveComponent("IdmGroupDialog"),k=t.resolveComponent("DeleteDialog");return t.openBlock(),t.createElementBlock("div",zg,[t.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:t.normalizeStyle({top:a.top+a.paddingTop+206+"px",right:i.right+"px"})},[t.createVNode(c,{text:o.$t("marker.markers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:t.withCtx(({props:z})=>[t.createVNode(n,t.mergeProps(z,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:t.withCtx(()=>e[7]||(e[7]=[t.createElementVNode("i",{class:"iconfont icon-compass text-h4"},null,-1)])),_:2,__:[7]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),t.createElementVNode("div",{class:t.normalizeClass(["main-box transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:t.normalizeStyle(l.listStyle)},[t.createElementVNode("div",_g,[t.createElementVNode("div",Sg,[t.createElementVNode("div",Ng,[t.createElementVNode("div",Mg,t.toDisplayString(o.$t("marker.markers")),1),t.createVNode(s,{modelValue:i.autoActive,"onUpdate:modelValue":e[0]||(e[0]=z=>i.autoActive=z),class:"small-switch",inset:"",color:"primary","base-color":"disabled","hide-details":""},null,8,["modelValue"]),t.createVNode(n,{class:"ml-n8",density:"compact",icon:"",variant:"text",onClick:l.fetchAllLayers},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-refresh"})]),_:1},8,["onClick"])]),t.createVNode(n,{class:"mr-n6",density:"comfortable",icon:"",variant:"plain",onClick:l.handleMenuToggle},{default:t.withCtx(()=>e[8]||(e[8]=[t.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[8]},8,["onClick"])]),t.createElementVNode("div",Pg,[t.createVNode(d,{modelValue:i.keyword,"onUpdate:modelValue":e[1]||(e[1]=z=>i.keyword=z),"clear-icon":"mdi-close",clearable:"",density:"compact","hide-details":"",variant:"outlined",autocomplete:"off",class:"input-btn-bg-1"},{"prepend-inner":t.withCtx(()=>[(t.openBlock(),t.createElementBlock("svg",Vg,e[9]||(e[9]=[t.createElementVNode("use",{"xlink:href":"#icon-search"},null,-1)])))]),_:1},8,["modelValue"])]),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Tg,[t.createVNode(n,{class:"flex-1-1-0 text-none mb-3 text-body-1 font-weight-600",color:"primary",variant:"text",density:"compact",height:"32","max-height":"32","prepend-icon":"mdi-plus",onClick:e[2]||(e[2]=z=>l.handleOpenDrawMarkers())},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.add")),1)]),_:1}),t.createVNode(n,{class:"flex-1-1-0 text-none mb-3 text-body-1 font-weight-600",color:"primary",variant:"text",density:"compact",height:"32","max-height":"32","prepend-icon":"mdi-import",onClick:l.handleOpenImportDialog},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.$t("actions.import")),1)]),_:1},8,["onClick"])]))]),i.loading?(t.openBlock(),t.createElementBlock("div",Eg,[t.createVNode(g,{color:"primary",indeterminate:"",size:"36",width:"4"})])):i.layerGroup.length===0?(t.openBlock(),t.createElementBlock("div",Dg,[t.createElementVNode("div",Rg,t.toDisplayString(o.$t("tips.noData")),1)])):(t.openBlock(),t.createElementBlock("div",Bg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(i.layerGroup,(z,P)=>{var T;return t.openBlock(),t.createElementBlock("div",{key:z.name,class:t.normalizeClass(["btn-bg-1",z.index===i.layerGroup.length?"rounded-b":z.index===1?"rounded-t":""])},[t.createElementVNode("div",Ig,[t.createElementVNode("div",Fg,[z.show?(t.openBlock(),t.createBlock(m,{key:0,icon:"mdi-chevron-down",onClick:V=>z.show=!1},null,8,["onClick"])):(t.openBlock(),t.createBlock(m,{key:1,icon:"mdi-chevron-right",onClick:V=>z.show=!0},null,8,["onClick"])),i.loading?(t.openBlock(),t.createBlock(g,{key:3,class:"mx-2",color:"primary",indeterminate:"",size:"16",width:"2"})):(t.openBlock(),t.createBlock(u,{key:2,density:"compact",variant:"flat",class:"font-weight-600 mr-2",color:"primary",onClick:V=>z.show=!z.show},{default:t.withCtx(()=>{var V;return[t.createTextVNode(t.toDisplayString((V=z.layers)==null?void 0:V.length),1)]}),_:2},1032,["onClick"])),t.createElementVNode("div",{class:"",onClick:V=>z.show=!z.show},t.toDisplayString(z.name),9,Gg)]),z.name!=="Custom Layers"&&!a.simple?(t.openBlock(),t.createElementBlock("div",jg,[t.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mx-1"},{default:t.withCtx(()=>[e[10]||(e[10]=t.createElementVNode("i",{class:"iconfont icon-dots-vertical text-h4 cursor-pointer"},null,-1)),t.createVNode(w,{activator:"parent","min-width":"240",class:"drop-menu"},{default:t.withCtx(()=>[t.createVNode(f,{class:"pa-2 px-0"},{default:t.withCtx(()=>[t.createVNode(h,{class:""},{default:t.withCtx(()=>[t.createVNode(p,{value:"account",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-body-1 d-flex jusity-center align-center",onClick:V=>l.handleOpenDrawMarkers(z)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-plus-circle-outline mr-4",size:"16"}),t.createElementVNode("span",null,t.toDisplayString(o.$t("actions.addMarker")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(p,{value:"help",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-body-1 d-flex jusity-center align-center",onClick:V=>l.handleEditGroup(z)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-pencil mr-4",size:"16"}),t.createElementVNode("span",null,t.toDisplayString(o.$t("actions.editGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024),t.createVNode(p,{value:"loginOut",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:t.withCtx(()=>[t.createVNode(y,{class:"text-body-1 d-flex jusity-center align-center",onClick:V=>l.handleOpenDelete("group",z)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-trash-can-outline mr-4",size:"16"}),t.createElementVNode("span",null,t.toDisplayString(o.$t("actions.deleteGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2,__:[10]},1024)])):t.createCommentVNode("",!0)]),z.show?(t.openBlock(),t.createElementBlock("div",Wg,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList((T=z.layers)==null?void 0:T.filter(V=>{var O;return((O=V.name)==null?void 0:O.indexOf(i.keyword))>-1}),V=>{var O;return t.openBlock(),t.createElementBlock("div",{key:V.id,class:t.normalizeClass(["layer-item pa-2 mx-2 rounded cursor-pointer d-flex align-center justify-space-between ga-4",((O=i.currentLayer)==null?void 0:O.id)===V.id?"active":""])},[t.createElementVNode("div",Zg,[t.createElementVNode("span",Xg,t.toDisplayString(V==null?void 0:V.name),1)]),a.simple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Hg,[t.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:Y=>l.handleEditLayer(z,V)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-pencil",size:"16"})]),_:2},1032,["onClick"]),t.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:Y=>l.handleOpenDelete("layer",V)},{default:t.withCtx(()=>[t.createVNode(m,{icon:"mdi-trash-can-outline",size:"16"})]),_:2},1032,["onClick"])]))],2)}),128))])):t.createCommentVNode("",!0),P<i.layerGroup.length-1?(t.openBlock(),t.createBlock(b,{key:1,class:"w-100",thickness:"1"})):t.createCommentVNode("",!0)],2)}),128))]))],6),i.drawDialog?(t.openBlock(),t.createBlock(A,{ref:"drawDialog",key:((_=i.currentLayer)==null?void 0:_.id)||"new",map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,"edit-layer":i.currentLayer,group:i.currentGroup,onClose:l.handleCloseDraw,onSave:l.handleSaveMarker,onHideLayer:l.handleClearLayer},null,8,["map","gateway","token","default-meteo-token","edit-layer","group","onClose","onSave","onHideLayer"])):t.createCommentVNode("",!0),i.importDialog?(t.openBlock(),t.createBlock(x,{key:1,map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,"layer-group":i.layerGroup,group:i.currentGroup,onClose:e[3]||(e[3]=z=>{i.importDialog=!1,i.currentGroup=void 0}),onImport:l.handleImportLayer},null,8,["map","gateway","token","default-meteo-token","layer-group","group","onImport"])):t.createCommentVNode("",!0),t.createVNode(C,{modelValue:i.groupDialog,"onUpdate:modelValue":e[4]||(e[4]=z=>i.groupDialog=z),group:i.currentGroup,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,onClose:e[5]||(e[5]=z=>{i.groupDialog=!1,i.currentGroup=void 0}),onSaved:l.fetchAllLayers},null,8,["modelValue","group","gateway","token","default-meteo-token","onSaved"]),t.createVNode(k,{ref:"deleteDialog",title:o.$t("actions.delete"),tips:o.$t("tips.deleteText"),loading:i.deleteLoading,onDelete:e[6]||(e[6]=z=>l.confirmDelete())},null,8,["title","tips","loading"])])}const Yg=K(vg,[["render",Og]]);var D={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}};function Ug(o="soft"){switch(D.session.__counterEpoch=(D.session.__counterEpoch||0)+1,o){case"auto":{D.session.styleMap=new Map,D.session.nodeMap=new Map;return}case"soft":{D.session.styleMap=new Map,D.session.nodeMap=new Map,D.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{D.session.styleMap=new Map,D.session.nodeMap=new Map,D.session.styleCache=new WeakMap,D.computedStyle=new WeakMap,D.baseStyle=new Map,D.defaultStyle=new Map,D.image=new Map,D.background=new Map,D.resource=new Map,D.font=new Set;return}default:{D.session.styleMap=new Map,D.session.nodeMap=new Map,D.session.styleCache=new WeakMap;return}}}function Zo(o){let e=o.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let a=e[2].trim();return a.startsWith("#")?null:a}function Jg(o){if(!o||o==="none")return"";let e=o.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(a,r)=>{let i=r.split(",").map(l=>l.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(a,r)=>{let i=r.split(",").map(l=>l.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function Po(o){if(/%[0-9A-Fa-f]{2}/.test(o))return o;try{return encodeURI(o)}catch{return o}}function Kg(o="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:a=12}={}){let r=new Map,i=0;function l(n,c,s){if(i>=a)return;let m=Date.now();(r.get(c)||0)>m||(r.set(c,m+e),i++,n==="warn"&&console&&console.warn?console.warn(`${o} ${s}`):console&&console.error&&console.error(`${o} ${s}`))}return{warnOnce(n,c){l("warn",n,c)},errorOnce(n,c){l("error",n,c)},reset(){r.clear(),i=0}}}var na=Kg("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Xo=new Map,Vo=new Map;function Qg(o){return/^data:|^blob:|^about:blank$/i.test(o)}function qg(o,e){try{let a=typeof location<"u"&&location.href?location.href:"http://localhost/",r=e.includes("{url}")?e.split("{url}")[0]:e,i=new URL(r||".",a),l=new URL(o,a);if(l.origin===i.origin)return!0;let n=l.searchParams;if(n&&(n.has("url")||n.has("target")))return!0}catch{}return!1}function $g(o,e){if(!e||Qg(o)||qg(o,e))return!1;try{let a=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(o,a);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function eu(o,e){if(!e)return o;if(e.includes("{url}"))return e.replace("{urlRaw}",Po(o)).replace("{url}",encodeURIComponent(o));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(o)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(o)}`;if(e.endsWith("/"))return`${e}${Po(o)}`;let a=e.includes("?")?"&":"?";return`${e}${a}url=${encodeURIComponent(o)}`}function sa(o){return new Promise((e,a)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>a(new Error("read_failed")),r.readAsDataURL(o)})}function tu(o,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,o].join("|")}async function Ht(o,e={}){let a=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",l=e.errorTTL??8e3,n=e.headers||{},c=!!e.silent;if(/^data:/i.test(o))try{if(a==="text")return{ok:!0,data:String(o),status:200,url:o,fromCache:!1};if(a==="dataURL")return{ok:!0,data:String(o),status:200,url:o,fromCache:!1,mime:String(o).slice(5).split(";")[0]||""};let[,f="",w=""]=String(o).match(/^data:([^,]*),(.*)$/)||[],b=/;base64/i.test(f)?atob(w):decodeURIComponent(w),A=new Uint8Array([...b].map(C=>C.charCodeAt(0))),x=new Blob([A],{type:(f||"").split(";")[0]||""});return{ok:!0,data:x,status:200,url:o,fromCache:!1,mime:x.type||""}}catch{return{ok:!1,data:null,status:0,url:o,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(o))try{let f=await fetch(o);if(!f.ok)return{ok:!1,data:null,status:f.status,url:o,fromCache:!1,reason:"http_error"};let w=await f.blob(),b=w.type||f.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await sa(w),status:f.status,url:o,fromCache:!1,mime:b}:a==="text"?{ok:!0,data:await w.text(),status:f.status,url:o,fromCache:!1,mime:b}:{ok:!0,data:w,status:f.status,url:o,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:o,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(o))return a==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:o,fromCache:!1,mime:"image/png"}:{ok:!0,data:a==="text"?"":new Blob([]),status:200,url:o,fromCache:!1};let s=tu(o,{as:a,timeout:r,useProxy:i,errorTTL:l}),m=Vo.get(s);if(m&&m.until>Date.now())return{...m.result,fromCache:!0};m&&Vo.delete(s);let d=Xo.get(s);if(d)return d;let g=$g(o,i)?eu(o,i):o,u=e.credentials;if(!u)try{let f=typeof location<"u"&&location.href?location.href:"http://localhost/",w=new URL(o,f);u=typeof location<"u"&&w.origin===location.origin?"include":"omit"}catch{u="omit"}let y=new AbortController,p=setTimeout(()=>y.abort("timeout"),r),h=(async()=>{try{let f=await fetch(g,{signal:y.signal,credentials:u,headers:n});if(!f.ok){let A={ok:!1,data:null,status:f.status,url:g,fromCache:!1,reason:"http_error"};if(l>0&&Vo.set(s,{until:Date.now()+l,result:A}),!c){let x=`${f.status} ${f.statusText||""}`.trim();na.warnOnce(`http:${f.status}:${a}:${new URL(o,(location==null?void 0:location.href)??"http://localhost/").origin}`,`HTTP error ${x} while fetching ${a} ${o}`)}return e.onError&&e.onError(A),A}if(a==="text")return{ok:!0,data:await f.text(),status:f.status,url:g,fromCache:!1};let w=await f.blob(),b=w.type||f.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await sa(w),status:f.status,url:g,fromCache:!1,mime:b}:{ok:!0,data:w,status:f.status,url:g,fromCache:!1,mime:b}}catch(f){let w=f&&typeof f=="object"&&"name"in f&&f.name==="AbortError"?String(f.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:g,fromCache:!1,reason:w};if(!/^blob:/i.test(o)&&l>0&&Vo.set(s,{until:Date.now()+l,result:b}),!c){let A=`${w}:${a}:${new URL(o,(location==null?void 0:location.href)??"http://localhost/").origin}`,x=w==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${o}`:w==="abort"?`Request aborted while fetching ${a} ${o}`:`Network/CORS issue while fetching ${a} ${o}. A proxy may be required`;na.errorOnce(A,x)}return e.onError&&e.onError(b),b}finally{clearTimeout(p),Xo.delete(s)}})();return Xo.set(s,h),h}async function ca(o,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(o)||o.trim()==="none")return o;let a=Zo(o);if(!a)return o;let r=Po(a);if(D.background.has(r)){let i=D.background.get(r);return i?`url("${i}")`:"none"}try{let i=await Ht(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(D.background.set(r,i.data),`url("${i.data}")`):(D.background.set(r,null),"none")}catch{return D.background.set(r,null),"none"}}var ou=new Set(["meta","script","noscript","title","link","template"]),Ho=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]);function au(o){if(o=String(o).toLowerCase(),Ho.has(o)){let l={};return D.defaultStyle.set(o,l),l}if(D.defaultStyle.has(o))return D.defaultStyle.get(o);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let a=document.createElement(o);a.style.all="initial",e.appendChild(a);let r=getComputedStyle(a),i={};for(let l of r){if(ma(l))continue;let n=r.getPropertyValue(l);i[l]=n}return e.removeChild(a),D.defaultStyle.set(o,i),i}var iu=/(?:^|-)(animation|transition)(?:-|$)/i,ru=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,lu=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"]);function ma(o){let e=String(o).toLowerCase();return!!(lu.has(e)||ru.test(e)||iu.test(e))}function Oo(o,e){if(e=String(e||"").toLowerCase(),Ho.has(e))return"";let a=[],r=au(e);for(let[i,l]of Object.entries(o)){if(ma(i))continue;let n=r[i];l&&l!==n&&a.push(`${i}:${l}`)}return a.sort(),a.join(";")}function nu(o){let e=new Set;return o.nodeType!==Node.ELEMENT_NODE&&o.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(o.tagName&&e.add(o.tagName.toLowerCase()),typeof o.querySelectorAll=="function"&&o.querySelectorAll("*").forEach(a=>e.add(a.tagName.toLowerCase())),Array.from(e))}function su(o){let e=new Map;for(let r of o){let i=D.defaultStyle.get(r);if(!i)continue;let l=Object.entries(i).map(([n,c])=>`${n}:${c};`).sort().join("");l&&(e.has(l)||e.set(l,[]),e.get(l).push(r))}let a="";for(let[r,i]of e.entries())a+=`${i.join(",")} { ${r} }
226
226
  `;return a}function cu(o){let e=Array.from(new Set(o.values())).filter(Boolean).sort(),a=new Map,r=1;for(let i of e)a.set(i,`c${r++}`);return a}function da(o,e=null){if(!(o instanceof Element))return window.getComputedStyle(o,e);let a=D.computedStyle.get(o);if(a||(a=new Map,D.computedStyle.set(o,a)),!a.has(e)){let r=window.getComputedStyle(o,e);a.set(e,r)}return a.get(e)}function ha(o){let e={};for(let a of o)e[a]=o.getPropertyValue(a);return e}function pa(o){let e=[],a=0,r=0;for(let i=0;i<o.length;i++){let l=o[i];l==="("&&a++,l===")"&&a--,l===","&&a===0&&(e.push(o.slice(r,i).trim()),r=i+1)}return e.push(o.slice(r).trim()),e}var mu=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],oo=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),Yo=[];function du(o){let e=Array.isArray(o)?o:[o];for(let a of e)a instanceof RegExp?Yo.push(a):typeof a=="string"?Yo.push(new RegExp(a,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",a)}function Yt(o){let e=typeof o=="string"?o:"",a=[...mu,...Yo];for(let r of a)if(r instanceof RegExp&&r.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}function hu(o=""){let e=String(o).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var ga=new Map;function pu(o=""){let e=Object.create(null),a=String(o||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(a);)e[i[1].toUpperCase()]=Number(i[2]);return e}async function gu(o,e,a){let r=String(o||""),i=r.toLowerCase(),l=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let n=a&&(a.FILL??a.fill),c="outlined";/\brounded\b/.test(l)||/\bround\b/.test(l)?c="rounded":/\bsharp\b/.test(l)?c="sharp":/\boutlined\b/.test(l)&&(c="outlined");let s=n===1,m=null;if(s&&(c==="outlined"&&oo.materialIconsFilled?m={url:oo.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&oo.materialIconsRound?m={url:oo.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&oo.materialIconsSharp&&(m={url:oo.materialIconsSharp,alias:"snapdom-mi-sharp"})),!m)return{familyForMeasure:r,familyForCanvas:r};if(!ga.has(m.alias))try{let g=new FontFace(m.alias,`url(${m.url})`,{style:"normal",weight:"400"});document.fonts.add(g),await g.load(),ga.set(m.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let d=`"${m.alias}"`;return{familyForMeasure:d,familyForCanvas:d}}async function uu(o="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(o).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function fu(o){var i,l;let e=((i=o.getPropertyValue("-webkit-text-fill-color"))==null?void 0:i.trim())||"",a=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!a&&e.toLowerCase()!=="currentcolor")return e;let r=(l=o.color)==null?void 0:l.trim();return r&&r!=="inherit"?r:"#000"}async function yu(o,{family:e="Material Icons",weight:a="normal",fontSize:r=32,color:i="#000",variation:l="",className:n=""}={}){let c=String(e||"").replace(/^['"]+|['"]+$/g,""),s=window.devicePixelRatio||1,m=pu(l),{familyForMeasure:d,familyForCanvas:g}=await gu(c,n,m);await uu(g.replace(/^["']+|["']+$/g,""),r);let u=document.createElement("span");u.textContent=o,u.style.position="absolute",u.style.visibility="hidden",u.style.left="-99999px",u.style.whiteSpace="nowrap",u.style.fontFamily=d,u.style.fontWeight=String(a||"normal"),u.style.fontSize=`${r}px`,u.style.lineHeight="1",u.style.margin="0",u.style.padding="0",u.style.fontFeatureSettings="'liga' 1",u.style.fontVariantLigatures="normal",u.style.color=i,document.body.appendChild(u);let y=u.getBoundingClientRect(),p=Math.max(1,Math.ceil(y.width)),h=Math.max(1,Math.ceil(y.height));document.body.removeChild(u);let f=document.createElement("canvas");f.width=p*s,f.height=h*s;let w=f.getContext("2d");w.scale(s,s),w.font=`${a?`${a} `:""}${r}px ${g}`,w.textAlign="left",w.textBaseline="top",w.fillStyle=i;try{w.fontKerning="normal"}catch{}return w.fillText(o,0,0),{dataUrl:f.toDataURL(),width:p,height:h}}async function bu(o,e){if(!(o instanceof Element))return 0;let a='.material-icons, [class*="material-symbols"]',r=Array.from(o.querySelectorAll(a)).filter(n=>n&&n.textContent&&n.textContent.trim());if(r.length===0)return 0;let i=e instanceof Element?Array.from(e.querySelectorAll(a)).filter(n=>n&&n.textContent&&n.textContent.trim()):[],l=0;for(let n=0;n<r.length;n++){let c=r[n],s=i[n]||null;try{let m=getComputedStyle(s||c),d=m.fontFamily||"Material Icons";if(!hu(d))continue;let g=(s||c).textContent.trim();if(!g)continue;let u=parseInt(m.fontSize,10)||24,y=m.fontWeight&&m.fontWeight!=="normal"?m.fontWeight:"normal",p=fu(m),h=m.fontVariationSettings&&m.fontVariationSettings!=="normal"?m.fontVariationSettings:"",f=(s||c).className||"",{dataUrl:w,width:b,height:A}=await yu(g,{family:d,weight:y,fontSize:u,color:p,variation:h,className:f});c.textContent="";let x=c.ownerDocument.createElement("img");x.src=w,x.alt=g,x.style.height=`${u}px`,x.style.width=`${Math.max(1,Math.round(b/A*u))}px`,x.style.objectFit="contain",x.style.verticalAlign=getComputedStyle(c).verticalAlign||"baseline",c.appendChild(x),l++}catch{}}return l}async function wu(o,e,a,r=32,i="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let l=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let n=document.createElement("span");n.textContent=o,n.style.position="absolute",n.style.visibility="hidden",n.style.fontFamily=`"${e}"`,n.style.fontWeight=a||"normal",n.style.fontSize=`${r}px`,n.style.lineHeight="1",n.style.whiteSpace="nowrap",n.style.padding="0",n.style.margin="0",document.body.appendChild(n);let c=n.getBoundingClientRect(),s=Math.ceil(c.width),m=Math.ceil(c.height);document.body.removeChild(n);let d=document.createElement("canvas");d.width=Math.max(1,s*l),d.height=Math.max(1,m*l);let g=d.getContext("2d");return g.scale(l,l),g.font=a?`${a} ${r}px "${e}"`:`${r}px "${e}"`,g.textAlign="left",g.textBaseline="top",g.fillStyle=i,g.fillText(o,0,0),{dataUrl:d.toDataURL(),width:s,height:m}}var xu=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function To(o){if(!o)return"";for(let e of o.split(",")){let a=e.trim().replace(/^['"]+|['"]+$/g,"");if(a&&!xu.has(a.toLowerCase()))return a}return""}function Eo(o){let e=String(o??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let a=parseInt(e,10);return Number.isFinite(a)?Math.min(900,Math.max(100,a)):400}function Do(o){let e=String(o??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function ku(o){let e=String(o??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Au(o){let e=String(o||"400").trim(),a=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(a){let i=Eo(a[1]),l=Eo(a[2]);return{min:Math.min(i,l),max:Math.max(i,l)}}let r=Eo(e);return{min:r,max:r}}function Lu(o){let e=String(o||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Cu(o){let e=String(o||"100%").trim(),a=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(a){let l=parseFloat(a[1]),n=parseFloat(a[2]);return{min:Math.min(l,n),max:Math.max(l,n)}}let r=e.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function vu(o,e){if(!o)return!1;try{let a=new URL(o,location.href);if(a.origin===location.origin)return!0;let r=a.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>r.endsWith(l)))return!0;let i=(a.pathname+a.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i))return!0;for(let l of e){let n=l.toLowerCase().replace(/\s+/g,"+"),c=l.toLowerCase().replace(/\s+/g,"-");if(i.includes(n)||i.includes(c))return!0}return!1}catch{return!1}}function zu(o){var a;let e=new Set;for(let r of o||[]){let i=(a=String(r).split("__")[0])==null?void 0:a.trim();i&&e.add(i)}return e}function ua(o,e){return o&&o.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(a,r,i)=>{let l=(i||"").trim();if(!l||/^data:|^blob:|^https?:|^file:|^about:/i.test(l))return a;let n=l;try{n=new URL(l,e||location.href).href}catch{}return`url("${n}")`})}var Uo=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Ro=4;async function _u(o,e,a){if(!o)return o;let r=new Set;function i(c,s){try{return new URL(c,s||location.href).href}catch{return c}}async function l(c,s,m=0){if(m>Ro)return console.warn(`[snapDOM] @import depth exceeded (${Ro}) at ${s}`),c;let d="",g=0,u;for(;u=Uo.exec(c);){d+=c.slice(g,u.index),g=Uo.lastIndex;let y=(u[2]||u[4]||"").trim(),p=i(y,s);if(r.has(p)){console.warn(`[snapDOM] Skipping circular @import: ${p}`);continue}r.add(p);let h="";try{let f=await Ht(p,{as:"text",useProxy:a,silent:!0});f.ok&&typeof f.data=="string"&&(h=f.data)}catch{}h?(h=ua(h,p),h=await l(h,p,m+1),d+=`
227
227
  /* inlined: ${p} */
228
228
  ${h}