@idmwx/idmui-gl4 3.8.8 → 3.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3VYIPD3A-6864e218.js → chunk-3VYIPD3A-dfe332ad.js} +1 -1
- package/dist/{chunk-ANSXOGKI-0216fce8.js → chunk-ANSXOGKI-df0c78fe.js} +1 -1
- package/dist/{chunk-T4JIPPZO-23f7d1a2.js → chunk-T4JIPPZO-142adda6.js} +1 -1
- package/dist/{download-5dec8930.js → download-93c2a207.js} +3 -3
- package/dist/{index-8cf42e41.js → index-43f1204c.js} +114 -108
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +3 -3
- package/dist/mapbox/src/components/marker/draw.vue.d.ts +13 -7
- package/dist/{rasterize-JS5G2XHH-bbe24225.js → rasterize-JS5G2XHH-6a4ffccb.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{toBlob-6b52e5a0.js → toBlob-d6c76b35.js} +3 -3
- package/dist/{toCanvas-241b5c0b.js → toCanvas-b79de871.js} +2 -2
- package/dist/{toImg-ba3ec91a.js → toImg-53c56812.js} +3 -3
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -416,15 +416,15 @@ ${a==="fragment"?`out vec4 fragColor;
|
|
|
416
416
|
<path
|
|
417
417
|
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"
|
|
418
418
|
fill="#ffffff" p-id="18386"></path>
|
|
419
|
-
</svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${E.geometry.coordinates[1]>=0?"center north":"center south"}">${$}</div>`;const ue=new pe.Marker(he).setLngLat(E.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",J)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((W=this.map)==null||W.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,s,c,m,d,g,u,f,p,h,y,k,x,b,A;const e=t.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(L=>{var v;return L.geometry.type==="LineString"&&L.properties.type==="forecast"&&L.properties.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)}),r=(s=(n=this.tropicals)==null?void 0:n.data)==null?void 0:s.features.filter(L=>{var v;return L.geometry.type==="LineString"&&L.properties.type==="history"&&L.properties.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)});this.activeTropicals={name:((c=e==null?void 0:e.properties)==null?void 0:c.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(L=>L.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(f=a[0])==null?void 0:f.properties)==null?void 0:p.showCircle,checked:(k=(y=(h=this.tropicals)==null?void 0:h.list)==null?void 0:y.find(L=>{var v;return L.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)}))==null?void 0:k.checked,tropicalId:(A=(b=(x=this.tropicals)==null?void 0:x.list)==null?void 0:b.find(L=>{var v;return L.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)}))==null?void 0:A.id},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([t.lngLat.lng,t.lngLat.lat])},drawTropicalsInfoMaker(t){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(t).setOffset([220,0]):this.activeTropicalsMarker=new pe.Marker(e).setLngLat(t).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var t;(t=this.activeTropicalsMarker)==null||t.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(t){var r,i,l,n,s,c;t.disabled=!t.disabled;const e=`${t.name}-${t.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=t.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=t.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(V.featureCollection(a)),(c=(s=this.map)==null?void 0:s.getSource(this.clusterSource))==null||c.setData(V.featureCollection(a)),this.handleDateChange()},handleReport(t){this.$emit("tropicalReport",t)},handleToggleCircles(t){var e,a;t.showCircle=!t.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===t.name&&(r.properties.showCircle=t.showCircle)}),this.handleRender()},handleComputePolygons(t){const e=[];for(const a of t){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},s=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(s)}return e},handleComputeArc(t,e,a){var l;const r=[];for(const n in e){const s=e[n]??0;let c;switch(n){case"ne":c=V.lineArc(t,s,0,90,{steps:s>0?32:1,units:"nauticalmiles"});break;case"se":c=V.lineArc(t,s,90,180,{steps:s>0?32:1,units:"nauticalmiles"});break;case"sw":c=V.lineArc(t,s,180,270,{steps:s>0?32:1,units:"nauticalmiles"});break;case"nw":c=V.lineArc(t,s,270,360,{steps:s>0?32:1,units:"nauticalmiles"});break}r.push(...(l=c==null?void 0:c.geometry)==null?void 0:l.coordinates)}const i=V.lineString(r);return V.lineToPolygon(i,{properties:a})},handleHover(t){var i,l,n,s,c;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(t.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=(s=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:s.date,(c=this.hoverMarker)==null||c.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new pe.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var t;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(t=this.hoverMarker)==null||t.remove(),this.hoverMarker=void 0},handleCheck(){var e,a;const t=(e=this.activeTropicals)==null?void 0:e.tropicalId;t&&de.put(`${this.gateway}/api/arc/meteo2/tropicals/${t}`,{checked:!((a=this.activeTropicals)!=null&&a.checked)},{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(r=>{var i,l,n;((i=r.data)==null?void 0:i.code)===0&&(this.activeTropicals.checked=(n=(l=r.data)==null?void 0:l.data)==null?void 0:n.checked)})}}},ud={class:"idm-tropical-gl4"},fd={class:"pb-1"},yd={class:"text-h5 font-weight-600"},bd={key:0,class:"text-h5 font-weight-600"},wd={class:"text-body-1"},xd={class:"text-label"},kd={class:"d-flex justify-space-between align-center"},Ad={class:"w-60"},Ld={class:"text-label pr-1"},vd={class:"flex-1-1-0"},Cd={class:"text-label pr-1"},zd={class:"py-2 d-flex justify-space-between align-center"},_d={class:"w-60"},Sd={class:"text-label pr-1"},Pd={class:"flex-1-1-0"},Nd={class:"text-label pr-1"},Md={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},Td={class:"text-label pr-1",style:{width:"70px"}},Vd={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Ed={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},Rd={class:"pa-1"},Dd={class:"legend d-flex justify-start align-center py-2"},Bd={class:"label"},Id={class:"legend d-flex justify-start align-center py-2"},Fd={class:"label"},Gd={class:"legend d-flex justify-start align-center py-2"},jd={class:"label"},Wd={class:"pa-1"},Zd={class:"legend d-flex justify-start align-center py-2"},Hd={class:"label"},Xd={class:"legend d-flex justify-start align-center py-2"},Od={class:"label"},Yd={class:"legend d-flex justify-start align-center py-2"},Ud={class:"label"},Jd={class:"pa-1"},Kd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Qd={class:"label"},qd={class:"label"},$d={class:"w-100 legend d-flex justify-start align-center py-2"},eh={class:"label"},th={class:"w-100 legend d-flex justify-start align-center py-2"},oh={class:"label"},ah={key:1,class:"my-3 w-100",style:{height:"80px"}},ih={class:"w-100 d-flex justify-space-between align-center"},rh={class:"legend d-flex justify-start align-center"},lh={class:"label"},nh={class:"legend d-flex justify-start align-center"},sh={class:"label"},ch={class:"legend d-flex justify-start align-center"},mh={class:"label"},dh={class:"legend d-flex justify-start align-center"},hh={class:"label"},ph={class:"legend d-flex justify-start align-center"},gh={class:"label"},uh={class:"legend d-flex justify-start align-center"},fh={class:"label"},yh={class:"w-100 d-flex justify-space-between align-center"},bh={class:"legend d-flex justify-start align-center"},wh={class:"label"},xh={class:"legend d-flex justify-start align-center"},kh={class:"label"},Ah={class:"legend d-flex justify-start align-center"},Lh={class:"label"},vh={class:"legend d-flex justify-start align-center"},Ch={class:"label"},zh={class:"d-flex justify-star align-center"},_h={class:"font-weight-600 mr-1"},Sh={class:""},Ph={class:"d-flex flex-column justify-center align-start ga-2"},Nh={key:0,class:"d-flex justify-start align-center"},Mh={class:"text-label pr-1"},Th={key:1,class:"d-flex justify-start align-center"},Vh={class:"text-label pr-1"},Eh={key:2,class:"d-flex justify-start align-center"},Rh={class:"text-label pr-1"},Dh={key:3,class:"d-flex justify-start align-center"},Bh={class:"text-label pr-1"},Ih={key:4,class:"d-flex justify-start align-center"},Fh={class:"text-label pr-1"},Gh={key:5,class:"d-flex justify-start align-center"},jh={class:"text-label pr-1"},Wh={class:"d-flex justify-start align-center"},Zh={class:"text-label pr-1"},Hh={key:6,class:"d-flex justify-start align-center"},Xh={class:"text-label pr-1"},Oh={key:7,class:"d-flex justify-start align-center"},Yh={class:"text-label pr-1"},Uh={class:"d-flex justify-start align-center"},Jh={class:"text-label pr-1"};function Kh(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VCardText"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VIcon"),g=o.resolveComponent("VCardActions"),u=o.resolveComponent("VCard"),f=o.resolveComponent("VCardTitle");return o.openBlock(),o.createElementBlock("div",ud,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:p})=>[o.createVNode(n,o.mergeProps(p,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[3]||(e[3]=[o.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[3]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!t.$attrs.hideTropicalsLegend?(o.openBlock(),o.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:o.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[o.createVNode(u,{class:o.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:o.withCtx(()=>[o.createVNode(c,null,{default:o.withCtx(()=>{var p,h,y,k,x,b,A,L,v,C,_,N;return[o.createElementVNode("div",fd,[o.createElementVNode("span",yd,o.toDisplayString(a.locale==="en"?(p=i.activeTropicals)==null?void 0:p.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((y=i.activeTropicals)==null?void 0:y.Name)||"-"),1),(x=(k=i.activeTropicals)==null?void 0:k.history)!=null&&x.levelI18n?(o.openBlock(),o.createElementBlock("span",bd," , "+o.toDisplayString(t.$t("tropical."+((A=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:A.levelI18n))),1)):o.createCommentVNode("",!0)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:o.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:o.withCtx(()=>e[4]||(e[4]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[4]},8,["onClick"]),o.createElementVNode("div",wd,[o.createElementVNode("span",xd,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((v=(L=i.activeTropicals)==null?void 0:L.history)==null?void 0:v.updated)||((N=(_=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:_.filter(M=>!M.disabled)[0])==null?void 0:N.date),a.timeZone)),1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var p,h,y,k,x,b,A,L,v;return[o.createElementVNode("div",kd,[o.createElementVNode("div",Ad,[o.createElementVNode("label",Ld,o.toDisplayString(t.$t("weather.windSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((h=(p=i.activeTropicals)==null?void 0:p.history)==null?void 0:h.kts)||"-")+" kts",1),o.createElementVNode("span",null,", BF "+o.toDisplayString(l.computeBF(((k=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:k.kts)||"-")),1)]),o.createElementVNode("div",vd,[o.createElementVNode("label",Cd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",zd,[o.createElementVNode("div",_d,[o.createElementVNode("label",Sd,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.kts)||"-")+" kts",1)]),o.createElementVNode("div",Pd,[o.createElementVNode("label",Nd,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=l.computeMovement(i.activeTropicals))==null?void 0:L.deg)||"-")+"°",1)])]),o.createElementVNode("div",Md,[o.createElementVNode("label",Td,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",Vd,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((v=i.activeTropicals)==null?void 0:v.forecasts,(C,_)=>(o.openBlock(),o.createBlock(n,{key:_,density:"compact",variant:C.disabled?"text":"flat",color:C.disabled?"":"primary","min-width":30,class:o.normalizeClass(["model text-none text-body-1 px-1",C.disabled?"btn-border-1 btn-bg-1":""]),onClick:o.withModifiers(N=>l.handleForecastToggle(C),["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),o.createVNode(m),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(g,{key:0,class:"d-flex justify-space-between"},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=o.withModifiers(p=>i.showLegend=!i.showLegend,["stop"]))},{prepend:o.withCtx(()=>e[5]||(e[5]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("weather.legend")),1)]),_:1},8,["color"]),a.platform==="ops"?(o.openBlock(),o.createBlock(n,{key:0,variant:"text",density:"compact",class:"text-none text-body-1","prepend-icon":"",onClick:e[1]||(e[1]=o.withModifiers(p=>l.handleCheck(),["stop"]))},{prepend:o.withCtx(()=>[i.activeTropicals.checked?(o.openBlock(),o.createBlock(d,{key:0,color:"primary"},{default:o.withCtx(()=>e[6]||(e[6]=[o.createTextVNode("mdi-checkbox-marked",-1)])),_:1,__:[6]})):(o.openBlock(),o.createBlock(d,{key:1,class:"text-label"},{default:o.withCtx(()=>e[7]||(e[7]=[o.createTextVNode("mdi-checkbox-blank-outline",-1)])),_:1,__:[7]}))]),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("status.checked"))+" ",1)]),_:1})):o.createCommentVNode("",!0),o.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[2]||(e[2]=o.withModifiers(p=>l.handleReport(i.activeTropicals),["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.viewReport")),1)]),_:1})]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(o.openBlock(),o.createElementBlock("div",Ed,[o.createElementVNode("div",Rd,[o.createElementVNode("div",Dd,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Bd,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",Id,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Fd,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",Gd,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",jd,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",Wd,[o.createElementVNode("div",Zd,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",Hd,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",Xd,[e[12]||(e[12]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",Od,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",Yd,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",Ud,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",Jd,[o.createElementVNode("div",Kd,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",Qd,o.toDisplayString(t.$t("tropical.history")),1),e[15]||(e[15]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",qd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",$d,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",eh,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",th,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",oh,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",ah,[o.withDirectives(o.createVNode(u,{elevation:"16"},{default:o.withCtx(()=>[o.createVNode(c,null,{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(["pa-1 w-100 d-flex flex-column justify-space-between align-center",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",ih,[o.createElementVNode("div",rh,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",lh,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",nh,[e[19]||(e[19]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",sh,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",ch,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",mh,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",dh,[e[21]||(e[21]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",hh,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",ph,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",gh,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",uh,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",fh,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",yh,[o.createElementVNode("div",bh,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",wh,o.toDisplayString(t.$t("tropical.history")),1)]),o.createElementVNode("div",xh,[e[25]||(e[25]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",kh,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Ah,[e[26]||(e[26]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Lh,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",vh,[e[27]||(e[27]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Ch,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])],2),[[o.vShow,i.showLegend]])]),_:1})]),_:1},512),[[o.vShow,i.showLegend]])]))],2)):o.createCommentVNode("",!0),o.withDirectives(o.createVNode(u,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"290"},{default:o.withCtx(()=>[o.createVNode(f,null,{default:o.withCtx(()=>{var p,h,y,k;return[o.createElementVNode("div",zh,[o.createElementVNode("span",_h,o.toDisplayString(a.locale==="en"?(p=i.hoverPoint)==null?void 0:p.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((y=i.hoverPoint)==null?void 0:y.Name)),1),o.createElementVNode("span",Sh," ["+o.toDisplayString(t.$t("tropical."+((k=i.hoverPoint)==null?void 0:k.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1"},{default:o.withCtx(()=>{var p,h,y,k,x,b,A,L,v,C,_,N,M,T,I,X,Q,q,le,S;return[o.createElementVNode("div",Ph,[((p=i.hoverPoint)==null?void 0:p.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Nh,[o.createElementVNode("label",Mh,o.toDisplayString(t.$t("tropical.updated"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((h=i.hoverPoint)==null?void 0:h.update,a.timeZone)),1)])):o.createCommentVNode("",!0),((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Th,[o.createElementVNode("label",Vh,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((k=i.hoverPoint)==null?void 0:k.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((x=i.hoverPoint)==null?void 0:x.type)==="history"?(o.openBlock(),o.createElementBlock("div",Eh,[o.createElementVNode("label",Rh,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((A=i.hoverPoint)==null?void 0:A.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Dh,[o.createElementVNode("label",Bh,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=i.hoverPoint)==null?void 0:L.model)??"-"),1)])):o.createCommentVNode("",!0),((v=i.hoverPoint)==null?void 0:v.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Ih,[o.createElementVNode("label",Fh,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((_=JSON.parse(((C=i.hoverPoint)==null?void 0:C.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((N=i.hoverPoint)==null?void 0:N.type)==="history"?(o.openBlock(),o.createElementBlock("div",Gh,[o.createElementVNode("label",jh,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((M=i.hoverPoint)==null?void 0:M.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",Wh,[o.createElementVNode("label",Zh,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.pressure)??"-")+" hPa",1)]),((I=i.hoverPoint)==null?void 0:I.type)==="history"?(o.openBlock(),o.createElementBlock("div",Hh,[o.createElementVNode("label",Xh,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((Q=JSON.parse(((X=i.hoverPoint)==null?void 0:X.movement)||"{}"))==null?void 0:Q.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((q=i.hoverPoint)==null?void 0:q.type)==="history"?(o.openBlock(),o.createElementBlock("div",Oh,[o.createElementVNode("label",Yh,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((S=JSON.parse(((le=i.hoverPoint)==null?void 0:le.movement)||"{}"))==null?void 0:S.deg)??"-")+" °",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",Uh,[o.createElementVNode("label",Jh,o.toDisplayString(t.$t("tropical.position"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[o.vShow,i.showHoverPoint]])])}const Oo=K(gd,[["render",Kh]]),ub="",Qh={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 t=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-t)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-t)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-t)/2}px`}},hourOptions(){const t=[];for(let e=0;e<24;e++)t.push(e<10?`0${e}:00`:`${e}:00`);return t.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return z.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>z.tz(z(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(t,e){t!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(t,e){t&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=z(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${z.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(t,e){t!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${z.tz(z().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(t){var i;const e=z(t).utc().date(),a=Math.ceil(z(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=z(t))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=z.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${z.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${z.tz(z().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,s,c;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const t=z().utc().date(),e=Math.ceil(z().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=z())==null?void 0:i.utc().set({date:t,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=z.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=z())==null?void 0:l.utc())==null?void 0:n.set({date:t+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((c=(s=z())==null?void 0:s.utc())==null?void 0:c.set({date:t+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(t){const e=t||z.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?z.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):z.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 t=z(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${e}`,r=z.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 t=z.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=t.clone().format("YYYY-MM-DD"),this.currentTime=t.clone().format("HH:00")},handleClickOutside(t){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(t.target)&&(this.showDatePicker=!1)}}},qh={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},$h={class:"pa-0",style:{width:"320px"}},ep={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},tp={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function op(t,e,a,r,i,l){const n=o.resolveComponent("VDatePicker"),s=o.resolveComponent("VDivider"),c=o.resolveComponent("VListItemTitle"),m=o.resolveComponent("VListItem"),d=o.resolveComponent("VList"),g=o.resolveComponent("VCardText"),u=o.resolveComponent("VBtn"),f=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",qh,[o.createElementVNode("div",{style:o.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:o.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))},o.toDisplayString(i.currentDateTime)+" | UTC "+o.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(o.openBlock(),o.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:o.normalizeStyle(l.getStyle)},{default:o.withCtx(()=>[o.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",$h,[o.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"])]),o.createVNode(s,{class:"h-100",vertical:""}),o.createElementVNode("div",ep,[o.createElementVNode("div",tp,o.toDisplayString(t.$t("time.time")),1),o.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.hourOptions,(h,y)=>(o.openBlock(),o.createBlock(m,{key:y,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:o.withCtx(()=>[o.createVNode(c,{class:"text-body-2 font-weight-600 text-center",onClick:k=>i.currentTime=h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),o.createVNode(s),o.createVNode(f,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:o.withCtx(()=>[o.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):o.createCommentVNode("",!0)],512)}const ho=K(Qh,[["render",op]]),fb="",ap={name:"IdmPoint",components:{DateTimePicker:ho},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:[t=>t!=null&&t!==""||"required",t=>/^\d{1,3}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=180||"0 ~ 180"],lngMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"],latDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,2}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=90||"0 ~ 90"],latMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return z.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>z.tz(z(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>z.tz(z(t),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return t=>{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=>z.tz(z(),n).utcOffset()===e*60))==null?void 0:l[0];return t?z.tz(z(t),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(t){return!t||t.lng===null||t.lng===void 0||isNaN(t.lng)||t.lat===null||t.lat===void 0||isNaN(t.lat)?"-":P.LngLatHelper.lat2pretty(t==null?void 0:t.lat,2).pretty+" / "+P.LngLatHelper.lng2pretty(t==null?void 0:t.lng,2).pretty}},computeRoundPrecision(){return function(t,e=4){return t==null||isNaN(t)||isNaN(e)?"-":P.LngLatHelper.roundPrecision(t,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.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 t;(t=this.$refs.spotForm)==null||t.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var t,e,a,r,i,l;this.showMeteo?((a=(e=(t=this.$parent)==null?void 0:t.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,s;this.$parent.playerBottom=((s=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:s.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(t,e){!t&&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 t=>{t!=null&&t.valid&&this.fetchData()})},cancelForm(){var t;(t=this.$refs.spotForm)==null||t.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;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 t=z();((a=z(this.realTime))==null?void 0:a.diff(t,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Qt.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:z(t.dateTime).utc().format(),forecastDays:t.day??3,weatherModels:e,marineModels:a};await de.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=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Qt.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:z(t.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await de.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=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(t){var a,r,i,l,n,s,c,m,d,g,u,f,p,h,y,k,x,b,A,L,v,C,_,N,M,T,I,X,Q,q,le,S,W,Z,ee,j,B,J,E,O,$,he,ue;this.currentHourData={},this.positionGmt=(r=(a=t==null?void 0:t.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=t==null?void 0:t.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Qt.Meteo2Assist.pickHourly(t,z(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=t.lat,this.currentHourData.lng=t.lng,this.currentHourData.temp=this.computeRoundPrecision((s=e==null?void 0:e.weather)==null?void 0:s.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(c=e==null?void 0:e.weather)==null?void 0:c.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=(f=e==null?void 0:e.weather)==null?void 0:f.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((y=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:y.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((x=(k=e==null?void 0:e.weather)==null?void 0:k.wind)==null?void 0:x.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((A=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:A.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((v=(L=e==null?void 0:e.wave)==null?void 0:L.sig)==null?void 0:v.height,1)??"-",this.currentHourData.sigwaveDir=(_=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:_.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((M=(N=e==null?void 0:e.wave)==null?void 0:N.sig)==null?void 0:M.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((I=(T=e==null?void 0:e.wave)==null?void 0:T.wd)==null?void 0:I.height,1)??"-",this.currentHourData.windwaveDir=(Q=(X=e==null?void 0:e.wave)==null?void 0:X.wd)==null?void 0:Q.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((le=(q=e==null?void 0:e.wave)==null?void 0:q.wd)==null?void 0:le.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((W=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:W.height,1)??"-",this.currentHourData.swellDir=(ee=(Z=e==null?void 0:e.wave)==null?void 0:Z.swell)==null?void 0:ee.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(j=e==null?void 0:e.wave)==null?void 0:j.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((J=e==null?void 0:e.current)==null?void 0:J.speed,1)??"-",this.currentHourData.currentDir=(E=e==null?void 0:e.current)==null?void 0:E.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((O=e==null?void 0:e.current)==null?void 0:O.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=($=e==null?void 0:e.weather)==null?void 0:$.url,this.currentHourData.sit=(he=e==null?void 0:e.ice)==null?void 0:he.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=t.lat>=65||t.lat<=-65},handleBind(){var t,e;this.toggle?((t=this.map)==null||t.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(t){if(t.originalEvent.stopPropagation(),t.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(t.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(t){if(isNaN(t.lat)||isNaN(t.lng))return!1;this.form.latDegree=Number(P.LngLatHelper.lat2pretty(t.lat).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(t.lat).minute),this.form.latDirection=P.LngLatHelper.lat2pretty(t.lat).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(t.lng).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(t.lng).minute),this.form.lngDirection=P.LngLatHelper.lng2pretty(t.lng).direction},handleDrawInfoMarker(t){this.drawPositionMarker(t),this.simple||this.drawMeteoInfoMarker(t)},drawPositionMarker(t){t&&(this.map.flyTo({center:t,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 pe.Marker(e).setLngLat(t).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(t){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(t):this.meteoInfoMarker=new pe.Marker(e).setLngLat(t).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var t,e;(t=this.positionMarker)==null||t.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 t=((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",t)}}},ip={class:"idm-gl4-spot"},rp={class:"d-flex justify-start align-center"},lp={class:"text-h6 font-weight-600"},np={class:"d-flex justify-start align-center ga-1 mb-2"},sp={class:"text-label"},cp={class:"w-100 d-flex ma-0"},mp={class:"w-30 pa-0 d-flex"},dp={class:"flex-1-1-0 pa-0 d-flex"},hp={class:"pa-0"},pp={class:"d-flex justify-start align-center ga-1 mb-2"},gp={class:"text-label"},up={class:"w-100 d-flex ma-0"},fp={class:"w-30 pa-0 d-flex"},yp={class:"flex-1-1-0 pa-0 d-flex"},bp={class:"pa-0"},wp={class:"d-flex justify-start align-center ga-1 mb-2"},xp={class:"text-label"},kp={class:"d-flex justify-start align-center ga-1 mb-2"},Ap={class:"text-label"},Lp={class:"d-flex justify-start align-center"},vp={class:"mx-2"},Cp={class:"mx-0 py-2 d-flex align-center justify-start"},zp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},_p={class:"pa-0 px-0"},Sp={class:"mx-0 py-2 d-flex align-center justify-start"},Pp={cols:"9",class:"pa-0 px-0"},Np={class:"mx-0 py-2 d-flex align-center justify-start"},Mp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Tp={style:{width:"150px"},class:"pa-0 text-left"},Vp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Ep={cols:"3",class:"pa-0 px-0 text-left"},Rp={class:"mx-0 py-2 d-flex align-center justify-start"},Dp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Bp={style:{width:"150px"},class:"pa-0 text-left"},Ip={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Fp={cols:"3",class:"pa-0 text-left"},Gp={class:"mx-0 py-2 d-flex align-center justify-start"},jp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Wp={style:{width:"150px"},class:"pa-0 text-left"},Zp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Hp={class:"pa-0 text-left"},Xp={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},Op={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Yp={style:{width:"150px"},class:"pa-0 text-left"},Up={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Jp={class:"pa-0 text-left"},Kp={class:"d-flex justify-space-between align-center"},Qp={class:"d-flex justify-start align-center"},qp={class:"mx-1"},$p={class:"d-flex justify-end align-center"},eg={class:"mx-0 py-1 d-flex align-center justify-start"},tg={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},og={class:"pa-0 px-0"},ag={class:"mx-0 py-1 d-flex align-center justify-start"},ig={class:"pa-0 px-0"},rg={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},lg={class:"d-flex flex-column align-start justify-center ga-3"},ng={class:"text-label pr-2"},sg={class:"text-label pr-2"},cg={class:"text-label pr-2"},mg={key:0},dg={class:"text-label pr-2"},hg={class:"d-flex flex-column align-start justify-center ga-3"},pg={class:"text-label pr-2"},gg={class:"text-label pr-2"},ug={class:"text-label pr-2"},fg={key:0},yg={class:"text-label pr-2"},bg={id:"idm-position-icon"},wg={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},xg=["xlink:href"];function kg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VCardTitle"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VTextField"),g=o.resolveComponent("DateTimePicker"),u=o.resolveComponent("VCol"),f=o.resolveComponent("VRow"),p=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),y=o.resolveComponent("VCardActions"),k=o.resolveComponent("VForm"),x=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",ip,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:b})=>[o.createVNode(n,o.mergeProps(b,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[8]||(e[8]=[o.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?(o.openBlock(),o.createBlock(x,{key:0,class:"spot-form-card",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",rp,[o.createElementVNode("div",lp,o.toDisplayString(t.$t("spot.spotWeather")),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(k,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.submitForm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(h,{class:"text-body-1 pa-4 py-2"},{default:o.withCtx(()=>[o.createElementVNode("div",np,[o.createElementVNode("div",sp,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",cp,[o.createElementVNode("div",mp,[o.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=b=>i.form.latDegree=b),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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),o.createElementVNode("div",dp,[o.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=b=>i.form.latMinute=b),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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),o.createElementVNode("div",hp,[o.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]=b=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDirection),1)]),_:1})])]),o.createElementVNode("div",pp,[o.createElementVNode("div",gp,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",up,[o.createElementVNode("div",fp,[o.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=b=>i.form.lngDegree=b),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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),o.createElementVNode("div",yp,[o.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=b=>i.form.lngMinute=b),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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),o.createElementVNode("div",bp,[o.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.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDirection),1)]),_:1})])]),o.createElementVNode("div",wp,[o.createElementVNode("div",xp,[o.createTextVNode(o.toDisplayString(t.$t("spot.dateTime")),1),e[16]||(e[16]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(f,{class:"ma-0 mb-4"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(g,o.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},t.$attrs,{onDateTime:e[6]||(e[6]=b=>i.form.dateTime=b)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),o.createElementVNode("div",kp,[o.createElementVNode("div",Ap,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(f,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=b=>i.form.forecastModel=b),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"GFS",class:o.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:o.withCtx(()=>e[18]||(e[18]=[o.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),o.createVNode(n,{density:"compact",height:"30",class:o.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:o.withCtx(()=>e[19]||(e[19]=[o.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.createVNode(m),o.createVNode(y,{class:"d-flex justify-end align-center ga-4 pa-4 py-2"},{default:o.withCtx(()=>[o.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):o.createCommentVNode("",!0),i.showMeteo&&!a.simple?(o.openBlock(),o.createBlock(x,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",Lp,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",vp,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:o.withCtx(()=>{var b,A;return[o.createElementVNode("div",Cp,[o.createElementVNode("div",zp,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",_p,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Sp,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Pp,o.toDisplayString(l.computedLocalTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),o.createElementVNode("div",Np,[o.createElementVNode("div",Mp,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",Tp,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",Vp,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",Ep,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),o.createElementVNode("div",Rp,[o.createElementVNode("div",Dp,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",Bp,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),o.createElementVNode("div",Ip,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",Fp,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),o.createElementVNode("div",Gp,[o.createElementVNode("div",jp,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",Wp,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",Zp,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",Hp,o.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",Xp,[o.createElementVNode("div",Op,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("div",Yp,o.toDisplayString(i.currentHourData.sit??"-")+"m",1),o.createElementVNode("div",Up,o.toDisplayString(t.$t("weather.sic")),1),o.createElementVNode("div",Jp,o.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):o.createCommentVNode("",!0)]}),_:1}),o.createVNode(m),o.createVNode(y,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(A=>{var L,v;return(A==null?void 0:A.id)===i.form.followId||((L=A==null?void 0:A.coordinate)==null?void 0:L.lng)===i.form.lng&&((v=A==null?void 0:A.coordinate)==null?void 0:v.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{prepend:o.withCtx(()=>e[23]||(e[23]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleFollow,["stop"])},{prepend:o.withCtx(()=>e[24]||(e[24]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),o.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:o.withModifiers(l.handleMeteoMore,["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):o.createCommentVNode("",!0),i.showMeteo&&a.simple?(o.openBlock(),o.createBlock(x,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:o.withCtx(()=>[o.createVNode(c,null,{default:o.withCtx(()=>{var b;return[o.createElementVNode("div",Kp,[o.createElementVNode("div",Qp,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",qp,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",$p,[(b=a.followList)!=null&&b.some(A=>{var L,v;return(A==null?void 0:A.id)===i.form.followId||((L=A==null?void 0:A.coordinate)==null?void 0:L.lng)===i.form.lng&&((v=A==null?void 0:A.coordinate)==null?void 0:v.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{default:o.withCtx(()=>e[26]||(e[26]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleFollow,["stop"])},{default:o.withCtx(()=>e[27]||(e[27]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[28]||(e[28]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=o.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:o.withCtx(()=>{var b,A;return[o.createElementVNode("div",eg,[o.createElementVNode("div",tg,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",og,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",ag,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",ig,o.toDisplayString(l.computedLocalTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),o.createElementVNode("div",rg,[o.createElementVNode("div",lg,[o.createElementVNode("div",null,[o.createElementVNode("span",ng,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1)]),o.createElementVNode("div",null,[o.createElementVNode("span",sg,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",cg,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",mg,[o.createElementVNode("span",dg,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",hg,[o.createElementVNode("div",null,[o.createElementVNode("span",pg,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",gg,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",ug,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",fg,[o.createElementVNode("span",yg,o.toDisplayString(t.$t("weather.sic")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):o.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",bg,[(o.openBlock(),o.createElementBlock("svg",wg,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,xg)]))],512),[[o.vShow,i.showMeteo]])])}const Ag=K(ap,[["render",kg]]),yb="",Lg={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:be.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 t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var t,e,a;if(this.toggle)this.handleBind();else{(t=this.map)==null||t.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=V.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 t,e,a,r,i;(t=this.map)==null||t.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 t,e,a,r,i;(t=this.map)==null||t.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(t){if(t.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(t){var a,r,i,l,n,s,c,m,d,g;const e=(r=(a=t.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(y=>y.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(y=>{var k;return((k=y._element)==null?void 0:k.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(s=(n=t.target)==null?void 0:n._lngLat)==null?void 0:s.lat]);let p;u.features.forEach((y,k)=>{if(y.geometry.type==="Point"&&y.properties.id===e.split("-")[1]){p=k;return}});const h=u.features.filter(y=>y.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(c=t.target)==null?void 0:c._lngLat)==null?void 0:m.lng,lat:(g=(d=t.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(t){var a,r,i,l,n,s,c,m,d,g;const e=(r=(a=t.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 y;return((y=h._element)==null?void 0:y.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(s=(n=t.target)==null?void 0:n._lngLat)==null?void 0:s.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(c=t.target)==null?void 0:c._lngLat)==null?void 0:m.lng,(g=(d=t.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(t){var a,r,i,l;t.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=t.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 s=this.geojson.filter(c=>c.id===e.split("-")[0])[0].features.filter(c=>c.geometry.type==="Point");if(s.length>2&&s.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 pe.Marker(m).setOffset([24,0]).setLngLat([t.lngLat.lng,t.lngLat.lat]).addTo(this.map)}}},handleClick(t){var a,r,i,l,n,s;(a=this.contextmenu)==null||a.remove();const e=t.originalEvent.target.className;if(e==="marker-close"){const c=(i=(r=t.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===c)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==c),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const c=(s=(n=t.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:s.split("-"),m=this.geojson.filter(d=>d.id===c[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==c[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let c=this.geojson.at(-1);c||(c=V.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(c)),c.features=c.features.filter(d=>d.geometry.type==="Point");const m=V.feature({type:"Point",coordinates:[t.lngLat.lng,t.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});c.features.push(m),this.handlePointUpdate(c)}},handlePointUpdate(t){const e=t.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],s=l.properties,c={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=P.LaneHelper.calculateDistance(c,m,s.mode==="RL",4),g=P.LaneHelper.calculateBearing(c,m,s.mode==="RL",2);a=P.LngLatHelper.roundPrecision(a+d,4);let u;s.mode==="RL"?u=P.LngLatHelper.convertToMonotonicLng([c,m]):u=P.LngLatHelper.convertToMonotonicLng(P.LaneHelper.interpolateCoordinates(c,m,200));const f=V.lineString(u.map(h=>[h.lng,h.lat]));f.properties.dist=d,f.properties.bearing=g,f.properties.total=a,f.properties.name="Line "+this.currentLineIndex,r.push(f);const p=e[i];p.properties.totalDist=P.LngLatHelper.roundPrecision((s.totalDist?s.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),t.total=a}return this.handleRender(t),t},handleTmpPointUpdate(t,e,a,r){const i=V.featureCollection([]);let l,n;if(e){const c=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=P.LaneHelper.calculateDistance(m,d,c.mode==="RL",4),n=P.LaneHelper.calculateBearing(m,d,c.mode==="RL",2);let g;c.mode==="RL"?g=P.LngLatHelper.convertToMonotonicLng([m,d]):g=P.LngLatHelper.convertToMonotonicLng(P.LaneHelper.interpolateCoordinates(m,d,200));const u=V.lineString(g.map(f=>[f.lng,f.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const c=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=P.LaneHelper.calculateDistance(m,d,c.mode==="RL",4),n=P.LaneHelper.calculateBearing(m,d,c.mode==="RL",2);let g;c.mode==="RL"?g=P.LngLatHelper.convertToMonotonicLng([m,d]):g=P.LngLatHelper.convertToMonotonicLng(P.LaneHelper.interpolateCoordinates(m,d,200));const u=V.lineString(g.map(f=>[f.lng,f.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 s;if(r)s=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const c=P.LngLatHelper.roundPrecision((t.total??0)+l,1);s=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${c}</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=s,this.tipMarker.setLngLat([a.lng,a.lat]);else{const c=document.createElement("div");c.className="idm-gl4-measure-tip-marker",c.innerHTML=s,this.tipMarker=new pe.Marker(c).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(t){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=V.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:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=V.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(t){var e;if((e=t==null?void 0:t.features)!=null&&e.length){const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(t):this.map.addSource(a,{type:"geojson",data:t}),this.handleClear(t,!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=t.features.filter(s=>s.geometry.type==="Point");for(const s of n){const c=document.createElement("div");c.id=`${t.id}-${s.properties.id}`,c.className=`${t.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,c.innerHTML='<div class="marker-circle"></div>';const m=new pe.Marker({element:c,draggable:!0,contextmenu:!0}).setLngLat(s.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[t.id]?this.pointMarkers[t.id].push(m):this.pointMarkers[t.id]=[m]}if(t.closed){const s=n.at(-1),m=t.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="${t.id}" class="marker-close">X</div>`,this.closeMarkers[t.id]=new pe.Marker(d).setOffset([0,-30]).setLngLat(s.geometry.coordinates).addTo(this.map)}}},handleClear(t,e=!0){var n,s,c,m,d,g,u,f,p,h;const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(s=this.map)!=null&&s.getLayer(i)&&this.map.removeLayer(i),(c=this.map)!=null&&c.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[t.id])==null||g.remove(),this.closeMarkers[t.id]=void 0,(u=this.pointMarkers[t.id])==null||u.forEach(y=>{y==null||y.remove()}),this.pointMarkers[t.id]=[],(f=this.tipMarker)==null||f.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)}}},vg={class:"idm-gl4-measure"};function Cg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",vg,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:c})=>[o.createVNode(n,o.mergeProps(c,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[0]||(e[0]=[o.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 zg=K(Lg,[["render",Cg]]),bb="",_g={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:be.useTheme()}},data(){var t;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(t=this.Theme.current.value.colors)==null?void 0:t["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 t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var t;this.map&&(this.handleBindMap(),(t=this.editLayer)!=null&&t.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 t,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((t=this.editLayer)!=null&&t.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,s,c,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const t=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!t)return;const a=(t.features||(t.type==="Feature"?[t]:[]))[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=(s=a.geometry)==null?void 0:s.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(P.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(g).minute),this.form.latDir=P.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=P.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=(c=this.originalProperties)==null?void 0:c.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(t),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 t=document.createElement("div");t.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new pe.Marker({element:t,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:t,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[t,e]],this.form.latDegree=Number(P.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(e).minute),this.form.latDir=P.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(t).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(t).minute),this.form.lngDir=P.LngLatHelper.lng2pretty(t).direction},clearEditMarkers(){this.editMarkers.forEach(t=>t.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(t){this.drawCoords=t.geometry.coordinates.map(r=>[...r]);const e=V.featureCollection([t,...this.drawCoords.map(r=>V.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 pe.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(V.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(V.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(V.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=V.point([a,r]),l=V.lineString(this.drawCoords),n=V.nearestPointOnLine(l,i);if(n){const s=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(s+1,0,[a,r]),this.handlerRenderEditLine(V.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",t),this._edgeContextMenuHandler=t},showDeleteButton(t,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(t);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const s=c=>{c.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",s),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(t){this.handleSetDrawSource(t);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(t){this.clearEditMarkers();const e=t.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 pe.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:s,lat:c}=n.getLngLat();this.handleRenderVertexLabel([s,c])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:s,lat:c}=n.getLngLat();this.handleUpdateVertexLabel([s,c]),this.drawCoords[i]=[s,c],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:s,lat:c}=n.getLngLat();this.drawCoords[i]=[s,c],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",s=>{s.preventDefault(),s.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=V.point([i,l]),s=V.lineString([...this.drawCoords,this.drawCoords[0]]),c=V.nearestPointOnLine(s,n);if(c){const m=c.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(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(P.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(a).minute),this.form.latDir=P.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=P.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:t,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(t),s=parseFloat(e),c=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(c))return;const d=(n+(isNaN(s)?0:s)/60)*(a==="S"?-1:1),g=(c+(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(t,e){var i;if((i=this.pointMarker)==null||i.remove(),!t||!t.length)return;const[a,r]=t[0];this.pointMarker=new pe.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(t){t.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(t){if(!t||t.length<1)return;const e=[];t==null||t.forEach((i,l)=>{e.push(P.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(t==null?void 0:t.length)>=2&&e.push(P.GeoJsonHelper.drawLine(t));const a=2,r=V.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(t,e){const a=P.GeoJsonHelper.drawLine([t,e]),r=V.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:t[0],lat:t[1]},l={lng:e[0],lat:e[1]},n=P.LaneHelper.calculateDistance(i,l,!0,2),s=P.LaneHelper.calculateBearing(i,l,!0,2);let c=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]};c+=P.LaneHelper.calculateDistance(g,u,!0,4)}c=P.LngLatHelper.roundPrecision(c+n,1);const m=`
|
|
419
|
+
</svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${E.geometry.coordinates[1]>=0?"center north":"center south"}">${$}</div>`;const ue=new pe.Marker(he).setLngLat(E.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ue)}this.$emit("tropicalCenterPoints",J)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((W=this.map)==null||W.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,s,c,m,d,g,u,f,p,h,y,k,x,b,A;const e=t.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(L=>{var v;return L.geometry.type==="LineString"&&L.properties.type==="forecast"&&L.properties.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)}),r=(s=(n=this.tropicals)==null?void 0:n.data)==null?void 0:s.features.filter(L=>{var v;return L.geometry.type==="LineString"&&L.properties.type==="history"&&L.properties.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)});this.activeTropicals={name:((c=e==null?void 0:e.properties)==null?void 0:c.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(L=>L.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(f=a[0])==null?void 0:f.properties)==null?void 0:p.showCircle,checked:(k=(y=(h=this.tropicals)==null?void 0:h.list)==null?void 0:y.find(L=>{var v;return L.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)}))==null?void 0:k.checked,tropicalId:(A=(b=(x=this.tropicals)==null?void 0:x.list)==null?void 0:b.find(L=>{var v;return L.name===((v=e==null?void 0:e.properties)==null?void 0:v.name)}))==null?void 0:A.id},this.showTropicalsInfo=!0,this.simple||this.drawTropicalsInfoMaker([t.lngLat.lng,t.lngLat.lat])},drawTropicalsInfoMaker(t){this.$nextTick(()=>{const e=document.getElementById("idm-tropical-gl4-info");this.activeTropicalsMarker?this.activeTropicalsMarker.setLngLat(t).setOffset([220,0]):this.activeTropicalsMarker=new pe.Marker(e).setLngLat(t).setOffset([220,0]).addTo(this.map)})},handleCloseInfoMarker(){this.showTropicalsInfo=!1,this.$nextTick(()=>{var t;(t=this.activeTropicalsMarker)==null||t.remove(),this.activeTropicalsMarker=void 0})},handleForecastToggle(t){var r,i,l,n,s,c;t.disabled=!t.disabled;const e=`${t.name}-${t.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=t.disabled)}),this.interpolateData.forEach(m=>{m.properties.category===e&&(m.properties.disabled=t.disabled)}),(n=(l=this.map)==null?void 0:l.getSource(this.source))==null||n.setData(V.featureCollection(a)),(c=(s=this.map)==null?void 0:s.getSource(this.clusterSource))==null||c.setData(V.featureCollection(a)),this.handleDateChange()},handleReport(t){this.$emit("tropicalReport",t)},handleToggleCircles(t){var e,a;t.showCircle=!t.showCircle,(a=(e=this.tropicals.data)==null?void 0:e.features)==null||a.forEach(r=>{r.properties.name===t.name&&(r.properties.showCircle=t.showCircle)}),this.handleRender()},handleComputePolygons(t){const e=[];for(const a of t){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},s=this.handleComputeArc(a.geometry.coordinates,n,{...a.properties,level:10});e.push(s)}return e},handleComputeArc(t,e,a){var l;const r=[];for(const n in e){const s=e[n]??0;let c;switch(n){case"ne":c=V.lineArc(t,s,0,90,{steps:s>0?32:1,units:"nauticalmiles"});break;case"se":c=V.lineArc(t,s,90,180,{steps:s>0?32:1,units:"nauticalmiles"});break;case"sw":c=V.lineArc(t,s,180,270,{steps:s>0?32:1,units:"nauticalmiles"});break;case"nw":c=V.lineArc(t,s,270,360,{steps:s>0?32:1,units:"nauticalmiles"});break}r.push(...(l=c==null?void 0:c.geometry)==null?void 0:l.coordinates)}const i=V.lineString(r);return V.lineToPolygon(i,{properties:a})},handleHover(t){var i,l,n,s,c;this.map.getCanvas().style.cursor="pointer";const a=this.map.queryRenderedFeatures(t.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=(s=(n=r==null?void 0:r[0])==null?void 0:n.properties)==null?void 0:s.date,(c=this.hoverMarker)==null||c.remove(),this.showHoverPoint=!0,this.$nextTick(()=>{const m=document.getElementById("tropicalHoverMarkerInfo").cloneNode(!0);this.hoverMarker=new pe.Marker(m).setLngLat(a.geometry.coordinates).setOffset([160,0]).addTo(this.map)}))},handleLeave(){var t;this.map.getCanvas().style.cursor="grab",this.showHoverPoint=!1,(t=this.hoverMarker)==null||t.remove(),this.hoverMarker=void 0},handleCheck(){var e,a;const t=(e=this.activeTropicals)==null?void 0:e.tropicalId;t&&de.put(`${this.gateway}/api/arc/meteo2/tropicals/${t}`,{checked:!((a=this.activeTropicals)!=null&&a.checked)},{headers:{Authorization:this.token||this.defaultMeteoToken}}).then(r=>{var i,l,n;((i=r.data)==null?void 0:i.code)===0&&(this.activeTropicals.checked=(n=(l=r.data)==null?void 0:l.data)==null?void 0:n.checked)})}}},ud={class:"idm-tropical-gl4"},fd={class:"pb-1"},yd={class:"text-h5 font-weight-600"},bd={key:0,class:"text-h5 font-weight-600"},wd={class:"text-body-1"},xd={class:"text-label"},kd={class:"d-flex justify-space-between align-center"},Ad={class:"w-60"},Ld={class:"text-label pr-1"},vd={class:"flex-1-1-0"},Cd={class:"text-label pr-1"},zd={class:"py-2 d-flex justify-space-between align-center"},_d={class:"w-60"},Sd={class:"text-label pr-1"},Pd={class:"flex-1-1-0"},Nd={class:"text-label pr-1"},Md={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},Td={class:"text-label pr-1",style:{width:"70px"}},Vd={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},Ed={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},Rd={class:"pa-1"},Dd={class:"legend d-flex justify-start align-center py-2"},Bd={class:"label"},Id={class:"legend d-flex justify-start align-center py-2"},Fd={class:"label"},Gd={class:"legend d-flex justify-start align-center py-2"},jd={class:"label"},Wd={class:"pa-1"},Zd={class:"legend d-flex justify-start align-center py-2"},Hd={class:"label"},Xd={class:"legend d-flex justify-start align-center py-2"},Od={class:"label"},Yd={class:"legend d-flex justify-start align-center py-2"},Ud={class:"label"},Jd={class:"pa-1"},Kd={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Qd={class:"label"},qd={class:"label"},$d={class:"w-100 legend d-flex justify-start align-center py-2"},eh={class:"label"},th={class:"w-100 legend d-flex justify-start align-center py-2"},oh={class:"label"},ah={key:1,class:"my-3 w-100",style:{height:"80px"}},ih={class:"w-100 d-flex justify-space-between align-center"},rh={class:"legend d-flex justify-start align-center"},lh={class:"label"},nh={class:"legend d-flex justify-start align-center"},sh={class:"label"},ch={class:"legend d-flex justify-start align-center"},mh={class:"label"},dh={class:"legend d-flex justify-start align-center"},hh={class:"label"},ph={class:"legend d-flex justify-start align-center"},gh={class:"label"},uh={class:"legend d-flex justify-start align-center"},fh={class:"label"},yh={class:"w-100 d-flex justify-space-between align-center"},bh={class:"legend d-flex justify-start align-center"},wh={class:"label"},xh={class:"legend d-flex justify-start align-center"},kh={class:"label"},Ah={class:"legend d-flex justify-start align-center"},Lh={class:"label"},vh={class:"legend d-flex justify-start align-center"},Ch={class:"label"},zh={class:"d-flex justify-star align-center"},_h={class:"font-weight-600 mr-1"},Sh={class:""},Ph={class:"d-flex flex-column justify-center align-start ga-2"},Nh={key:0,class:"d-flex justify-start align-center"},Mh={class:"text-label pr-1"},Th={key:1,class:"d-flex justify-start align-center"},Vh={class:"text-label pr-1"},Eh={key:2,class:"d-flex justify-start align-center"},Rh={class:"text-label pr-1"},Dh={key:3,class:"d-flex justify-start align-center"},Bh={class:"text-label pr-1"},Ih={key:4,class:"d-flex justify-start align-center"},Fh={class:"text-label pr-1"},Gh={key:5,class:"d-flex justify-start align-center"},jh={class:"text-label pr-1"},Wh={class:"d-flex justify-start align-center"},Zh={class:"text-label pr-1"},Hh={key:6,class:"d-flex justify-start align-center"},Xh={class:"text-label pr-1"},Oh={key:7,class:"d-flex justify-start align-center"},Yh={class:"text-label pr-1"},Uh={class:"d-flex justify-start align-center"},Jh={class:"text-label pr-1"};function Kh(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VCardText"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VIcon"),g=o.resolveComponent("VCardActions"),u=o.resolveComponent("VCard"),f=o.resolveComponent("VCardTitle");return o.openBlock(),o.createElementBlock("div",ud,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+86+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("tropical.tropicals"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:p})=>[o.createVNode(n,o.mergeProps(p,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[3]||(e[3]=[o.createElementVNode("i",{class:"iconfont icon-Tropical text-h4"},null,-1)])),_:2,__:[3]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),i.showTropicalsInfo&&!t.$attrs.hideTropicalsLegend?(o.openBlock(),o.createElementBlock("div",{key:0,id:"idm-tropical-gl4-info",ref:"tropicalsInfo",class:o.normalizeClass(["idm-tropical-gl4-info",a.simple?"page":"dialog"])},[o.createVNode(u,{class:o.normalizeClass(["w-100",a.simple?"rounded-t-4 bg-none":""]),elevation:a.simple?0:16},{default:o.withCtx(()=>[o.createVNode(c,null,{default:o.withCtx(()=>{var p,h,y,k,x,b,A,L,v,C,_,N;return[o.createElementVNode("div",fd,[o.createElementVNode("span",yd,o.toDisplayString(a.locale==="en"?(p=i.activeTropicals)==null?void 0:p.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((y=i.activeTropicals)==null?void 0:y.Name)||"-"),1),(x=(k=i.activeTropicals)==null?void 0:k.history)!=null&&x.levelI18n?(o.openBlock(),o.createElementBlock("span",bd," , "+o.toDisplayString(t.$t("tropical."+((A=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:A.levelI18n))),1)):o.createCommentVNode("",!0)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"close",onClick:o.withModifiers(l.handleCloseInfoMarker,["stop"])},{default:o.withCtx(()=>e[4]||(e[4]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[4]},8,["onClick"]),o.createElementVNode("div",wd,[o.createElementVNode("span",xd,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((v=(L=i.activeTropicals)==null?void 0:L.history)==null?void 0:v.updated)||((N=(_=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:_.filter(M=>!M.disabled)[0])==null?void 0:N.date),a.timeZone)),1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var p,h,y,k,x,b,A,L,v;return[o.createElementVNode("div",kd,[o.createElementVNode("div",Ad,[o.createElementVNode("label",Ld,o.toDisplayString(t.$t("weather.windSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((h=(p=i.activeTropicals)==null?void 0:p.history)==null?void 0:h.kts)||"-")+" kts",1),o.createElementVNode("span",null,", BF "+o.toDisplayString(l.computeBF(((k=(y=i.activeTropicals)==null?void 0:y.history)==null?void 0:k.kts)||"-")),1)]),o.createElementVNode("div",vd,[o.createElementVNode("label",Cd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(x=i.activeTropicals)==null?void 0:x.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",zd,[o.createElementVNode("div",_d,[o.createElementVNode("label",Sd,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.kts)||"-")+" kts",1)]),o.createElementVNode("div",Pd,[o.createElementVNode("label",Nd,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=l.computeMovement(i.activeTropicals))==null?void 0:L.deg)||"-")+"°",1)])]),o.createElementVNode("div",Md,[o.createElementVNode("label",Td,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",Vd,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((v=i.activeTropicals)==null?void 0:v.forecasts,(C,_)=>(o.openBlock(),o.createBlock(n,{key:_,density:"compact",variant:C.disabled?"text":"flat",color:C.disabled?"":"primary","min-width":30,class:o.normalizeClass(["model text-none text-body-1 px-1",C.disabled?"btn-border-1 btn-bg-1":""]),onClick:o.withModifiers(N=>l.handleForecastToggle(C),["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(C.model),1)]),_:2},1032,["variant","color","class","onClick"]))),128))])])]}),_:1}),o.createVNode(m),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(g,{key:0,class:"d-flex justify-space-between"},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact","prepend-icon":"",variant:"text",color:i.showLegend?"primary":"",class:"text-none text-body-1",onClick:e[0]||(e[0]=o.withModifiers(p=>i.showLegend=!i.showLegend,["stop"]))},{prepend:o.withCtx(()=>e[5]||(e[5]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("weather.legend")),1)]),_:1},8,["color"]),a.platform==="ops"?(o.openBlock(),o.createBlock(n,{key:0,variant:"text",density:"compact",class:"text-none text-body-1","prepend-icon":"",onClick:e[1]||(e[1]=o.withModifiers(p=>l.handleCheck(),["stop"]))},{prepend:o.withCtx(()=>[i.activeTropicals.checked?(o.openBlock(),o.createBlock(d,{key:0,color:"primary"},{default:o.withCtx(()=>e[6]||(e[6]=[o.createTextVNode("mdi-checkbox-marked",-1)])),_:1,__:[6]})):(o.openBlock(),o.createBlock(d,{key:1,class:"text-label"},{default:o.withCtx(()=>e[7]||(e[7]=[o.createTextVNode("mdi-checkbox-blank-outline",-1)])),_:1,__:[7]}))]),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("status.checked"))+" ",1)]),_:1})):o.createCommentVNode("",!0),o.createVNode(n,{variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:e[2]||(e[2]=o.withModifiers(p=>l.handleReport(i.activeTropicals),["stop"]))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.viewReport")),1)]),_:1})]),_:1}))]),_:1},8,["class","elevation"]),a.simple?(o.openBlock(),o.createElementBlock("div",Ed,[o.createElementVNode("div",Rd,[o.createElementVNode("div",Dd,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Bd,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",Id,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Fd,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",Gd,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",jd,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",Wd,[o.createElementVNode("div",Zd,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",Hd,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",Xd,[e[12]||(e[12]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",Od,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",Yd,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",Ud,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",Jd,[o.createElementVNode("div",Kd,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",Qd,o.toDisplayString(t.$t("tropical.history")),1),e[15]||(e[15]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",qd,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",$d,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",eh,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",th,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",oh,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",ah,[o.withDirectives(o.createVNode(u,{elevation:"16"},{default:o.withCtx(()=>[o.createVNode(c,null,{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(["pa-1 w-100 d-flex flex-column justify-space-between align-center",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",ih,[o.createElementVNode("div",rh,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",lh,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",nh,[e[19]||(e[19]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",sh,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",ch,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",mh,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",dh,[e[21]||(e[21]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",hh,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",ph,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",gh,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",uh,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",fh,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",yh,[o.createElementVNode("div",bh,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",wh,o.toDisplayString(t.$t("tropical.history")),1)]),o.createElementVNode("div",xh,[e[25]||(e[25]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",kh,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Ah,[e[26]||(e[26]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Lh,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",vh,[e[27]||(e[27]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Ch,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])],2),[[o.vShow,i.showLegend]])]),_:1})]),_:1},512),[[o.vShow,i.showLegend]])]))],2)):o.createCommentVNode("",!0),o.withDirectives(o.createVNode(u,{id:"tropicalHoverMarkerInfo",elevation:"16","max-width":"290"},{default:o.withCtx(()=>[o.createVNode(f,null,{default:o.withCtx(()=>{var p,h,y,k;return[o.createElementVNode("div",zh,[o.createElementVNode("span",_h,o.toDisplayString(a.locale==="en"?(p=i.hoverPoint)==null?void 0:p.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((y=i.hoverPoint)==null?void 0:y.Name)),1),o.createElementVNode("span",Sh," ["+o.toDisplayString(t.$t("tropical."+((k=i.hoverPoint)==null?void 0:k.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1"},{default:o.withCtx(()=>{var p,h,y,k,x,b,A,L,v,C,_,N,M,T,I,X,Q,q,le,S;return[o.createElementVNode("div",Ph,[((p=i.hoverPoint)==null?void 0:p.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Nh,[o.createElementVNode("label",Mh,o.toDisplayString(t.$t("tropical.updated"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((h=i.hoverPoint)==null?void 0:h.update,a.timeZone)),1)])):o.createCommentVNode("",!0),((y=i.hoverPoint)==null?void 0:y.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Th,[o.createElementVNode("label",Vh,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((k=i.hoverPoint)==null?void 0:k.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((x=i.hoverPoint)==null?void 0:x.type)==="history"?(o.openBlock(),o.createElementBlock("div",Eh,[o.createElementVNode("label",Rh,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((b=i.hoverPoint)==null?void 0:b.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((A=i.hoverPoint)==null?void 0:A.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Dh,[o.createElementVNode("label",Bh,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((L=i.hoverPoint)==null?void 0:L.model)??"-"),1)])):o.createCommentVNode("",!0),((v=i.hoverPoint)==null?void 0:v.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",Ih,[o.createElementVNode("label",Fh,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((_=JSON.parse(((C=i.hoverPoint)==null?void 0:C.wind)||"{}"))==null?void 0:_.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((N=i.hoverPoint)==null?void 0:N.type)==="history"?(o.openBlock(),o.createElementBlock("div",Gh,[o.createElementVNode("label",jh,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((M=i.hoverPoint)==null?void 0:M.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",Wh,[o.createElementVNode("label",Zh,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.pressure)??"-")+" hPa",1)]),((I=i.hoverPoint)==null?void 0:I.type)==="history"?(o.openBlock(),o.createElementBlock("div",Hh,[o.createElementVNode("label",Xh,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((Q=JSON.parse(((X=i.hoverPoint)==null?void 0:X.movement)||"{}"))==null?void 0:Q.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((q=i.hoverPoint)==null?void 0:q.type)==="history"?(o.openBlock(),o.createElementBlock("div",Oh,[o.createElementVNode("label",Yh,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((S=JSON.parse(((le=i.hoverPoint)==null?void 0:le.movement)||"{}"))==null?void 0:S.deg)??"-")+" °",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",Uh,[o.createElementVNode("label",Jh,o.toDisplayString(t.$t("tropical.position"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computePosition(i.hoverPoint)),1)])])]}),_:1})]),_:1},512),[[o.vShow,i.showHoverPoint]])])}const Oo=K(gd,[["render",Kh]]),ub="",Qh={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 t=this.width||220;return this.position==="top"?{bottom:"40px",left:`-${(420-t)/2}px`}:this.position==="bottom"?{top:"40px",left:`-${(420-t)/2}px`}:this.position==="left"?{bottom:"-140px",left:"-428px"}:this.position==="right"?{bottom:"-140px",right:"-428px"}:{bottom:"40px",left:`-${(420-t)/2}px`}},hourOptions(){const t=[];for(let e=0;e<24;e++)t.push(e<10?`0${e}:00`:`${e}:00`);return t.filter((e,a)=>(a-this.timeZone)%this.intervalHour===0)},timeZoneNames(){return z.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>z.tz(z(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},utcTimeZoneName(){return"Africa/Abidjan"},localTimeZoneName(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai"}},watch:{timeZone:{handler(t,e){t!==e&&(this.handleResetDateTime(this.dateTime),this.handleResetMinMax())}},dateTime:{handler(t,e){t&&this.handleResetDateTime(this.dateTime)},immediate:!0},currentTimestamp:{handler(){this.currentDateTimeZ=z(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${z.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`},immediate:!0},currentRealTime:{handler(t,e){t!==e&&this.$emit("currentRealTime",this.currentRealTime)}}},mounted(){this.timer=setInterval(()=>{this.currentRealTime=`${z.tz(z().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(t){var i;const e=z(t).utc().date(),a=Math.ceil(z(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=z(t))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=z.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${z.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${z.tz(z().unix()*1e3,this.timeZoneName).clone().format("HH:mm")}`},handleResetMinMax(){var i,l,n,s,c;if(this.dayAbout.h==null||this.dayAbout.f==null)return;const t=z().utc().date(),e=Math.ceil(z().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=z())==null?void 0:i.utc().set({date:t,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=z.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=z())==null?void 0:l.utc())==null?void 0:n.set({date:t+this.dayAbout.h,hour:0,minute:0,second:0,millisecond:0}).unix())*1e3,this.maxTimestamp=((c=(s=z())==null?void 0:s.utc())==null?void 0:c.set({date:t+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(t){const e=t||z.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?z.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):z.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 t=z(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${e}`,r=z.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 t=z.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=t.clone().format("YYYY-MM-DD"),this.currentTime=t.clone().format("HH:00")},handleClickOutside(t){const e=this.$refs.idmGl4Timepicker;e&&!e.contains(t.target)&&(this.showDatePicker=!1)}}},qh={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},$h={class:"pa-0",style:{width:"320px"}},ep={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},tp={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function op(t,e,a,r,i,l){const n=o.resolveComponent("VDatePicker"),s=o.resolveComponent("VDivider"),c=o.resolveComponent("VListItemTitle"),m=o.resolveComponent("VListItem"),d=o.resolveComponent("VList"),g=o.resolveComponent("VCardText"),u=o.resolveComponent("VBtn"),f=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",qh,[o.createElementVNode("div",{style:o.normalizeStyle({height:a.height+"px",width:a.width?a.width+"px":"auto"}),class:o.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))},o.toDisplayString(i.currentDateTime)+" | UTC "+o.toDisplayString(a.timeZone<0?a.timeZone:"+"+a.timeZone),7),i.showDatePicker?(o.openBlock(),o.createBlock(p,{key:0,class:"card-box d-flex flex-column border elevation-12",style:o.normalizeStyle(l.getStyle)},{default:o.withCtx(()=>[o.createVNode(g,{class:"w-100 flex-1-1-0 d-flex pa-0 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",$h,[o.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"])]),o.createVNode(s,{class:"h-100",vertical:""}),o.createElementVNode("div",ep,[o.createElementVNode("div",tp,o.toDisplayString(t.$t("time.time")),1),o.createVNode(d,{class:"pa-0 flex-1-1-0 scroll"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.hourOptions,(h,y)=>(o.openBlock(),o.createBlock(m,{key:y,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:o.withCtx(()=>[o.createVNode(c,{class:"text-body-2 font-weight-600 text-center",onClick:k=>i.currentTime=h},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(h),1)]),_:2},1032,["onClick"])]),_:2},1032,["value","active","variant"]))),128))]),_:1})])]),_:1}),o.createVNode(s),o.createVNode(f,{class:"w-100 d-flex justify-end align-center px-4 ga-4",style:{height:"50px"}},{default:o.withCtx(()=>[o.createVNode(u,{size:"small",variant:"tonal",class:"text-none text-body-1 px-4",onClick:l.handleCancelDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(u,{size:"small",variant:"flat",color:"primary",class:"text-none text-body-1 px-4",onClick:l.handleConfirmDate},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["onClick"])]),_:1})]),_:1},8,["style"])):o.createCommentVNode("",!0)],512)}const ho=K(Qh,[["render",op]]),fb="",ap={name:"IdmPoint",components:{DateTimePicker:ho},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:[t=>t!=null&&t!==""||"required",t=>/^\d{1,3}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=180||"0 ~ 180"],lngMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"],latDegree:[t=>t!=null&&t!==""||"required",t=>/^\d{1,2}$/.test(t)||"number",t=>parseInt(t)>=0&&parseInt(t)<=90||"0 ~ 90"],latMinute:[t=>t===void 0||t===null&&t===""||/^\d{1,2}(\.\d+)?$/.test(t)||"number",t=>t===void 0||t===null&&t===""||parseInt(t)>=0&&parseInt(t)<=59||"0 ~ 59"]},meteoData:void 0,currentHourData:{},positionOffset:void 0,positionGmt:void 0,positionMarker:void 0,meteoInfoMarker:void 0}},computed:{timeZoneNames(){return z.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>z.tz(z(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>z.tz(z(t),this.timeZoneName).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(this.timeZone>=0?"+":"")+this.timeZone+")"},computedLocalTime(){return t=>{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=>z.tz(z(),n).utcOffset()===e*60))==null?void 0:l[0];return t?z.tz(z(t),a).clone().format("YYYY-MM-DD HHmm")+" (UTC "+(e>=0?"+":"")+e+")":"-"}},computePosition(){return function(t){return!t||t.lng===null||t.lng===void 0||isNaN(t.lng)||t.lat===null||t.lat===void 0||isNaN(t.lat)?"-":P.LngLatHelper.lat2pretty(t==null?void 0:t.lat,2).pretty+" / "+P.LngLatHelper.lng2pretty(t==null?void 0:t.lng,2).pretty}},computeRoundPrecision(){return function(t,e=4){return t==null||isNaN(t)||isNaN(e)?"-":P.LngLatHelper.roundPrecision(t,e)}}},watch:{"menuToggle.v":{handler(){this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.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 t;(t=this.$refs.spotForm)==null||t.resetValidation()})):this.handleCloseForm()}},showMeteo:{handler(){var t,e,a,r,i,l;this.showMeteo?((a=(e=(t=this.$parent)==null?void 0:t.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("spot",!0),this.simple&&this.$nextTick(()=>{var n,s;this.$parent.playerBottom=((s=(n=this.$refs.spotMeteo)==null?void 0:n.$el)==null?void 0:s.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(t,e){!t&&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 t=>{t!=null&&t.valid&&this.fetchData()})},cancelForm(){var t;(t=this.$refs.spotForm)==null||t.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;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 t=z();((a=z(this.realTime))==null?void 0:a.diff(t,"d",!0))>=0?await this.fetchForecastData(this.form):await this.fetchHistoryData(this.form)},async fetchForecastData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Qt.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:z(t.dateTime).utc().format(),forecastDays:t.day??3,weatherModels:e,marineModels:a};await de.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=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1})},async fetchHistoryData(t){this.loading=!0,this.showMeteo=!0,this.form.lng=t.lng,this.form.lat=t.lat,this.form.followId=t.followId,this.handleDrawInfoMarker([t.lng,t.lat]),this.meteoData=[];const{weatherModels:e,marineModels:a}=Qt.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:z(t.dateTime).utc().format(),forecastDays:2,pastDays:1,weatherModels:e,marineModels:a};await de.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=t.lng,this.meteoData.lat=t.lat,this.initTableData(this.meteoData),this.loading=!1):this.loading=!1}).catch(()=>{this.loading=!1}),this.loading=!1},initTableData(t){var a,r,i,l,n,s,c,m,d,g,u,f,p,h,y,k,x,b,A,L,v,C,_,N,M,T,I,X,Q,q,le,S,W,Z,ee,j,B,J,E,O,$,he,ue;this.currentHourData={},this.positionGmt=(r=(a=t==null?void 0:t.weather)==null?void 0:a[0])==null?void 0:r.timezone,this.positionOffset=(l=(i=t==null?void 0:t.weather)==null?void 0:i[0])==null?void 0:l.offset;const e=((n=Qt.Meteo2Assist.pickHourly(t,z(this.form.dateTime)))==null?void 0:n[0])||{};this.currentHourData.utc=e.utc,this.currentHourData.lat=t.lat,this.currentHourData.lng=t.lng,this.currentHourData.temp=this.computeRoundPrecision((s=e==null?void 0:e.weather)==null?void 0:s.temp,0)??"-",this.currentHourData.precipProbability=this.computeRoundPrecision((m=(c=e==null?void 0:e.weather)==null?void 0:c.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=(f=e==null?void 0:e.weather)==null?void 0:f.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((y=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:y.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((x=(k=e==null?void 0:e.weather)==null?void 0:k.wind)==null?void 0:x.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((A=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:A.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((v=(L=e==null?void 0:e.wave)==null?void 0:L.sig)==null?void 0:v.height,1)??"-",this.currentHourData.sigwaveDir=(_=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:_.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((M=(N=e==null?void 0:e.wave)==null?void 0:N.sig)==null?void 0:M.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((I=(T=e==null?void 0:e.wave)==null?void 0:T.wd)==null?void 0:I.height,1)??"-",this.currentHourData.windwaveDir=(Q=(X=e==null?void 0:e.wave)==null?void 0:X.wd)==null?void 0:Q.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((le=(q=e==null?void 0:e.wave)==null?void 0:q.wd)==null?void 0:le.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((W=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:W.height,1)??"-",this.currentHourData.swellDir=(ee=(Z=e==null?void 0:e.wave)==null?void 0:Z.swell)==null?void 0:ee.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((B=(j=e==null?void 0:e.wave)==null?void 0:j.swell)==null?void 0:B.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((J=e==null?void 0:e.current)==null?void 0:J.speed,1)??"-",this.currentHourData.currentDir=(E=e==null?void 0:e.current)==null?void 0:E.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((O=e==null?void 0:e.current)==null?void 0:O.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=($=e==null?void 0:e.weather)==null?void 0:$.url,this.currentHourData.sit=(he=e==null?void 0:e.ice)==null?void 0:he.sit,this.currentHourData.sic=this.computeRoundPrecision(((ue=e==null?void 0:e.ice)==null?void 0:ue.sic)*100,0)??"-",this.currentHourData.showIce=t.lat>=65||t.lat<=-65},handleBind(){var t,e;this.toggle?((t=this.map)==null||t.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(t){if(t.originalEvent.stopPropagation(),t.originalEvent.target.className==="mapboxgl-canvas")this.handleGetPosition(t.lngLat),this.$nextTick(()=>{this.fetchData()});else return!1},handleGetPosition(t){if(isNaN(t.lat)||isNaN(t.lng))return!1;this.form.latDegree=Number(P.LngLatHelper.lat2pretty(t.lat).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(t.lat).minute),this.form.latDirection=P.LngLatHelper.lat2pretty(t.lat).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(t.lng).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(t.lng).minute),this.form.lngDirection=P.LngLatHelper.lng2pretty(t.lng).direction},handleDrawInfoMarker(t){this.drawPositionMarker(t),this.simple||this.drawMeteoInfoMarker(t)},drawPositionMarker(t){t&&(this.map.flyTo({center:t,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 pe.Marker(e).setLngLat(t).setOffset([0,-15]).addTo(this.map)}))},drawMeteoInfoMarker(t){this.$nextTick(()=>{var a;const e=document.getElementById("idm-gl4-spot-meteo");this.meteoInfoMarker?(a=this.meteoInfoMarker)==null||a.setLngLat(t):this.meteoInfoMarker=new pe.Marker(e).setLngLat(t).setOffset([0,-190]).addTo(this.map)})},handleMeteoMore(){this.form.forecastModel=this.forecastModel,this.$emit("meteoMore",this.form)},handleCloseMeteo(){this.showMeteo=!1,this.$nextTick(()=>{var t,e;(t=this.positionMarker)==null||t.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 t=((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",t)}}},ip={class:"idm-gl4-spot"},rp={class:"d-flex justify-start align-center"},lp={class:"text-h6 font-weight-600"},np={class:"d-flex justify-start align-center ga-1 mb-2"},sp={class:"text-label"},cp={class:"w-100 d-flex ma-0"},mp={class:"w-30 pa-0 d-flex"},dp={class:"flex-1-1-0 pa-0 d-flex"},hp={class:"pa-0"},pp={class:"d-flex justify-start align-center ga-1 mb-2"},gp={class:"text-label"},up={class:"w-100 d-flex ma-0"},fp={class:"w-30 pa-0 d-flex"},yp={class:"flex-1-1-0 pa-0 d-flex"},bp={class:"pa-0"},wp={class:"d-flex justify-start align-center ga-1 mb-2"},xp={class:"text-label"},kp={class:"d-flex justify-start align-center ga-1 mb-2"},Ap={class:"text-label"},Lp={class:"d-flex justify-start align-center"},vp={class:"mx-2"},Cp={class:"mx-0 py-2 d-flex align-center justify-start"},zp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},_p={class:"pa-0 px-0"},Sp={class:"mx-0 py-2 d-flex align-center justify-start"},Pp={cols:"9",class:"pa-0 px-0"},Np={class:"mx-0 py-2 d-flex align-center justify-start"},Mp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Tp={style:{width:"150px"},class:"pa-0 text-left"},Vp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Ep={cols:"3",class:"pa-0 px-0 text-left"},Rp={class:"mx-0 py-2 d-flex align-center justify-start"},Dp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Bp={style:{width:"150px"},class:"pa-0 text-left"},Ip={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Fp={cols:"3",class:"pa-0 text-left"},Gp={class:"mx-0 py-2 d-flex align-center justify-start"},jp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Wp={style:{width:"150px"},class:"pa-0 text-left"},Zp={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Hp={class:"pa-0 text-left"},Xp={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},Op={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},Yp={style:{width:"150px"},class:"pa-0 text-left"},Up={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},Jp={class:"pa-0 text-left"},Kp={class:"d-flex justify-space-between align-center"},Qp={class:"d-flex justify-start align-center"},qp={class:"mx-1"},$p={class:"d-flex justify-end align-center"},eg={class:"mx-0 py-1 d-flex align-center justify-start"},tg={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},og={class:"pa-0 px-0"},ag={class:"mx-0 py-1 d-flex align-center justify-start"},ig={class:"pa-0 px-0"},rg={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},lg={class:"d-flex flex-column align-start justify-center ga-3"},ng={class:"text-label pr-2"},sg={class:"text-label pr-2"},cg={class:"text-label pr-2"},mg={key:0},dg={class:"text-label pr-2"},hg={class:"d-flex flex-column align-start justify-center ga-3"},pg={class:"text-label pr-2"},gg={class:"text-label pr-2"},ug={class:"text-label pr-2"},fg={key:0},yg={class:"text-label pr-2"},bg={id:"idm-position-icon"},wg={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},xg=["xlink:href"];function kg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VCardTitle"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VTextField"),g=o.resolveComponent("DateTimePicker"),u=o.resolveComponent("VCol"),f=o.resolveComponent("VRow"),p=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),y=o.resolveComponent("VCardActions"),k=o.resolveComponent("VForm"),x=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",ip,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("spot.spotsMeteo"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:b})=>[o.createVNode(n,o.mergeProps(b,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[8]||(e[8]=[o.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?(o.openBlock(),o.createBlock(x,{key:0,class:"spot-form-card",style:o.normalizeStyle({top:a.top+a.paddingTop+126+"px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",rp,[o.createElementVNode("div",lp,o.toDisplayString(t.$t("spot.spotWeather")),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleCloseForm},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(k,{ref:"spotForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.submitForm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(h,{class:"text-body-1 pa-4 py-2"},{default:o.withCtx(()=>[o.createElementVNode("div",np,[o.createElementVNode("div",sp,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",cp,[o.createElementVNode("div",mp,[o.createVNode(d,{modelValue:i.form.latDegree,"onUpdate:modelValue":e[0]||(e[0]=b=>i.form.latDegree=b),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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),o.createElementVNode("div",dp,[o.createVNode(d,{modelValue:i.form.latMinute,"onUpdate:modelValue":e[1]||(e[1]=b=>i.form.latMinute=b),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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),o.createElementVNode("div",hp,[o.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]=b=>i.form.latDirection=i.form.latDirection==="N"?"S":"N")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDirection),1)]),_:1})])]),o.createElementVNode("div",pp,[o.createElementVNode("div",gp,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",up,[o.createElementVNode("div",fp,[o.createVNode(d,{modelValue:i.form.lngDegree,"onUpdate:modelValue":e[3]||(e[3]=b=>i.form.lngDegree=b),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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),o.createElementVNode("div",yp,[o.createVNode(d,{modelValue:i.form.lngMinute,"onUpdate:modelValue":e[4]||(e[4]=b=>i.form.lngMinute=b),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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),o.createElementVNode("div",bp,[o.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.lngDirection=i.form.lngDirection==="E"?"W":"E")},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDirection),1)]),_:1})])]),o.createElementVNode("div",wp,[o.createElementVNode("div",xp,[o.createTextVNode(o.toDisplayString(t.$t("spot.dateTime")),1),e[16]||(e[16]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(f,{class:"ma-0 mb-4"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(g,o.mergeProps({"date-time":i.form.dateTime,"time-zone":a.timeZone},t.$attrs,{onDateTime:e[6]||(e[6]=b=>i.form.dateTime=b)}),null,16,["date-time","time-zone"])]),_:1})]),_:1}),o.createElementVNode("div",kp,[o.createElementVNode("div",Ap,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(f,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"12",class:"pa-0"},{default:o.withCtx(()=>[o.createVNode(p,{modelValue:i.form.forecastModel,"onUpdate:modelValue":e[7]||(e[7]=b=>i.form.forecastModel=b),class:"w-100",rounded:"",height:"30",density:"compact",group:"",mandatory:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"GFS",class:o.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:o.withCtx(()=>e[18]||(e[18]=[o.createTextVNode(" NOAA ",-1)])),_:1,__:[18]},8,["class","color"]),o.createVNode(n,{density:"compact",height:"30",class:o.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:o.withCtx(()=>e[19]||(e[19]=[o.createTextVNode(" ECMWF ",-1)])),_:1,__:[19]},8,["class","color"])]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),o.createVNode(m),o.createVNode(y,{class:"d-flex justify-end align-center ga-4 pa-4 py-2"},{default:o.withCtx(()=>[o.createVNode(n,{size:"small",variant:"tonal",class:"text-none text-body-1 btn-bg-1",onClick:l.cancelForm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{ref:"submitSpot",loading:i.loading,size:"small",variant:"flat",color:"primary",type:"submit",class:"text-none text-body-1"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1},8,["style"])):o.createCommentVNode("",!0),i.showMeteo&&!a.simple?(o.openBlock(),o.createBlock(x,{key:1,id:"idm-gl4-spot-meteo",class:"spot-meteo",style:{width:"490px","z-index":"9"}},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("div",Lp,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",vp,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]),_:1}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-1"},{default:o.withCtx(()=>{var b,A;return[o.createElementVNode("div",Cp,[o.createElementVNode("div",zp,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",_p,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Sp,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Pp,o.toDisplayString(l.computedLocalTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),o.createElementVNode("div",Np,[o.createElementVNode("div",Mp,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",Tp,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",Vp,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",Ep,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),o.createElementVNode("div",Rp,[o.createElementVNode("div",Dp,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",Bp,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),o.createElementVNode("div",Ip,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",Fp,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),o.createElementVNode("div",Gp,[o.createElementVNode("div",jp,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",Wp,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",Zp,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",Hp,o.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",Xp,[o.createElementVNode("div",Op,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("div",Yp,o.toDisplayString(i.currentHourData.sit??"-")+"m",1),o.createElementVNode("div",Up,o.toDisplayString(t.$t("weather.sic")),1),o.createElementVNode("div",Jp,o.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):o.createCommentVNode("",!0)]}),_:1}),o.createVNode(m),o.createVNode(y,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(A=>{var L,v;return(A==null?void 0:A.id)===i.form.followId||((L=A==null?void 0:A.coordinate)==null?void 0:L.lng)===i.form.lng&&((v=A==null?void 0:A.coordinate)==null?void 0:v.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,id:"idm-gl4-spot-meteo-follow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{prepend:o.withCtx(()=>e[23]||(e[23]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h6 text-warning"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(" "+o.toDisplayString(t.$t("actions.unfollow")),1)]),_:1},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,id:"idm-gl4-spot-meteo-unfollow",class:"text-none text-body-1",variant:"text",density:"compact",height:"32",onClick:o.withModifiers(l.handleFollow,["stop"])},{prepend:o.withCtx(()=>e[24]||(e[24]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h6"},null,-1)])),default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.follow"))+" ",1)]),_:1},8,["onClick"])),o.createVNode(n,{height:"32",variant:"text",density:"compact","append-icon":"mdi-chevron-right",class:"text-none text-body-1",onClick:o.withModifiers(l.handleMeteoMore,["stop"])},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("spot.forecast")),1)]),_:1},8,["onClick"])]}),_:1})]),_:1})):o.createCommentVNode("",!0),i.showMeteo&&a.simple?(o.openBlock(),o.createBlock(x,{key:2,ref:"spotMeteo",class:"position-absolute bottom-0 rounded-t-4",style:{width:"100vw","z-index":"1001"}},{default:o.withCtx(()=>[o.createVNode(c,null,{default:o.withCtx(()=>{var b;return[o.createElementVNode("div",Kp,[o.createElementVNode("div",Qp,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",qp,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",$p,[(b=a.followList)!=null&&b.some(A=>{var L,v;return(A==null?void 0:A.id)===i.form.followId||((L=A==null?void 0:A.coordinate)==null?void 0:L.lng)===i.form.lng&&((v=A==null?void 0:A.coordinate)==null?void 0:v.lat)===i.form.lat})?(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1 rounded-circle",variant:"text",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleCancelFollow,["stop"])},{default:o.withCtx(()=>e[26]||(e[26]=[o.createElementVNode("i",{class:"iconfont icon-yishoucang text-h4 text-warning"},null,-1)])),_:1,__:[26]},8,["onClick"])):(o.openBlock(),o.createBlock(n,{key:1,class:"text-none text-body-1 rounded-circle",variant:"plain",density:"compact",height:"32",width:"28","min-width":"28",onClick:o.withModifiers(l.handleFollow,["stop"])},{default:o.withCtx(()=>e[27]||(e[27]=[o.createElementVNode("i",{class:"iconfont icon-weishoucang text-h4"},null,-1)])),_:1,__:[27]},8,["onClick"])),o.createVNode(n,{class:"mr-n2",density:"comfortable",icon:"",variant:"plain",onClick:o.withModifiers(l.handleCloseMeteo,["stop"])},{default:o.withCtx(()=>e[28]||(e[28]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[28]},8,["onClick"])])]),e[29]||(e[29]=o.createElementVNode("div",{class:"px-5 py-0 text-label text-body-1"},"Spot Weather",-1))]}),_:1,__:[29]}),o.createVNode(m),o.createVNode(h,{class:"text-body-1 px-0 py-2"},{default:o.withCtx(()=>{var b,A;return[o.createElementVNode("div",eg,[o.createElementVNode("div",tg,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",og,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",ag,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",ig,o.toDisplayString(l.computedLocalTime((A=i.currentHourData)==null?void 0:A.utc)),1)]),o.createElementVNode("div",rg,[o.createElementVNode("div",lg,[o.createElementVNode("div",null,[o.createElementVNode("span",ng,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1)]),o.createElementVNode("div",null,[o.createElementVNode("span",sg,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",cg,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",mg,[o.createElementVNode("span",dg,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",hg,[o.createElementVNode("div",null,[o.createElementVNode("span",pg,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",gg,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1)]),o.createElementVNode("div",null,[o.createElementVNode("span",ug,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.visibility??"-")+" nm",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",fg,[o.createElementVNode("span",yg,o.toDisplayString(t.$t("weather.sic")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):o.createCommentVNode("",!0)])])]}),_:1})]),_:1},512)):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("div",bg,[(o.openBlock(),o.createElementBlock("svg",wg,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,xg)]))],512),[[o.vShow,i.showMeteo]])])}const Ag=K(ap,[["render",kg]]),yb="",Lg={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:be.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 t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})},immediate:!0},toggle:{handler(){var t,e,a;if(this.toggle)this.handleBind();else{(t=this.map)==null||t.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=V.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 t,e,a,r,i;(t=this.map)==null||t.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 t,e,a,r,i;(t=this.map)==null||t.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(t){if(t.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(t){var a,r,i,l,n,s,c,m,d,g;const e=(r=(a=t.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(y=>y.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(y=>{var k;return((k=y._element)==null?void 0:k.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(s=(n=t.target)==null?void 0:n._lngLat)==null?void 0:s.lat]);let p;u.features.forEach((y,k)=>{if(y.geometry.type==="Point"&&y.properties.id===e.split("-")[1]){p=k;return}});const h=u.features.filter(y=>y.geometry.type==="Point");this.handleTmpPointUpdate(u,h[p-1],{lng:(m=(c=t.target)==null?void 0:c._lngLat)==null?void 0:m.lng,lat:(g=(d=t.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(t){var a,r,i,l,n,s,c,m,d,g;const e=(r=(a=t.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 y;return((y=h._element)==null?void 0:y.id)===e})[0].setLngLat([(l=(i=t.target)==null?void 0:i._lngLat)==null?void 0:l.lng,(s=(n=t.target)==null?void 0:n._lngLat)==null?void 0:s.lat]);const p=u.features.filter(h=>h.geometry.type==="Point"&&h.properties.id===e.split("-")[1])[0];p.geometry.coordinates=[(m=(c=t.target)==null?void 0:c._lngLat)==null?void 0:m.lng,(g=(d=t.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(t){var a,r,i,l;t.preventDefault(),(a=this.contextmenu)==null||a.remove();const e=(l=(i=(r=t.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 s=this.geojson.filter(c=>c.id===e.split("-")[0])[0].features.filter(c=>c.geometry.type==="Point");if(s.length>2&&s.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 pe.Marker(m).setOffset([24,0]).setLngLat([t.lngLat.lng,t.lngLat.lat]).addTo(this.map)}}},handleClick(t){var a,r,i,l,n,s;(a=this.contextmenu)==null||a.remove();const e=t.originalEvent.target.className;if(e==="marker-close"){const c=(i=(r=t.originalEvent)==null?void 0:r.srcElement)==null?void 0:i.id,m=this.geojson.filter(d=>d.id===c)[0];m&&this.handleClear(m,!0),this.geojson=this.geojson.filter(d=>d.id!==c),!this.toggle&&!((l=this.geojson)!=null&&l.some(d=>d.closed))&&this.handleUnbind()}else if(e==="del-point"){const c=(s=(n=t.originalEvent.target.id)==null?void 0:n.replace("del-",""))==null?void 0:s.split("-"),m=this.geojson.filter(d=>d.id===c[0])[0];m.features=m.features.filter(d=>d.geometry.type==="Point"&&d.properties.id!==c[1]),this.handlePointUpdate(m)}else if(e!=="marker-label"&&this.toggle){let c=this.geojson.at(-1);c||(c=V.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(c)),c.features=c.features.filter(d=>d.geometry.type==="Point");const m=V.feature({type:"Point",coordinates:[t.lngLat.lng,t.lngLat.lat]},{id:new Date().getTime().toString(),mode:this.navigation,sumLabel:"Start"});c.features.push(m),this.handlePointUpdate(c)}},handlePointUpdate(t){const e=t.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],s=l.properties,c={lng:l.geometry.coordinates[0],lat:l.geometry.coordinates[1]},m={lng:n.geometry.coordinates[0],lat:n.geometry.coordinates[1]},d=P.LaneHelper.calculateDistance(c,m,s.mode==="RL",4),g=P.LaneHelper.calculateBearing(c,m,s.mode==="RL",2);a=P.LngLatHelper.roundPrecision(a+d,4);let u;s.mode==="RL"?u=P.LngLatHelper.convertToMonotonicLng([c,m]):u=P.LngLatHelper.convertToMonotonicLng(P.LaneHelper.interpolateCoordinates(c,m,200));const f=V.lineString(u.map(h=>[h.lng,h.lat]));f.properties.dist=d,f.properties.bearing=g,f.properties.total=a,f.properties.name="Line "+this.currentLineIndex,r.push(f);const p=e[i];p.properties.totalDist=P.LngLatHelper.roundPrecision((s.totalDist?s.totalDist:0)+d,4),p.properties.sumLabel=p.properties.totalDist+" nm"}e.push(...r),t.total=a}return this.handleRender(t),t},handleTmpPointUpdate(t,e,a,r){const i=V.featureCollection([]);let l,n;if(e){const c=e.properties,m={lng:e.geometry.coordinates[0],lat:e.geometry.coordinates[1]},d={lng:a.lng,lat:a.lat};l=P.LaneHelper.calculateDistance(m,d,c.mode==="RL",4),n=P.LaneHelper.calculateBearing(m,d,c.mode==="RL",2);let g;c.mode==="RL"?g=P.LngLatHelper.convertToMonotonicLng([m,d]):g=P.LngLatHelper.convertToMonotonicLng(P.LaneHelper.interpolateCoordinates(m,d,200));const u=V.lineString(g.map(f=>[f.lng,f.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}if(r){const c=a.properties,m=a,d={lng:r.geometry.coordinates[0],lat:r.geometry.coordinates[1]};l=P.LaneHelper.calculateDistance(m,d,c.mode==="RL",4),n=P.LaneHelper.calculateBearing(m,d,c.mode==="RL",2);let g;c.mode==="RL"?g=P.LngLatHelper.convertToMonotonicLng([m,d]):g=P.LngLatHelper.convertToMonotonicLng(P.LaneHelper.interpolateCoordinates(m,d,200));const u=V.lineString(g.map(f=>[f.lng,f.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 s;if(r)s=`<div class="marker-label">${this.$t("measure.dragTips")}</div>`;else{const c=P.LngLatHelper.roundPrecision((t.total??0)+l,1);s=`<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${c}</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=s,this.tipMarker.setLngLat([a.lng,a.lat]);else{const c=document.createElement("div");c.className="idm-gl4-measure-tip-marker",c.innerHTML=s,this.tipMarker=new pe.Marker(c).setOffset([140,0]).setLngLat([a.lng,a.lat]).addTo(this.map)}},handleMove(t){this.map.getCanvas().style.cursor="crosshair";let e=this.geojson.at(-1);e||(e=V.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:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=V.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(t){var e;if((e=t==null?void 0:t.features)!=null&&e.length){const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;this.map.getSource(a)?this.map.getSource(a).setData(t):this.map.addSource(a,{type:"geojson",data:t}),this.handleClear(t,!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=t.features.filter(s=>s.geometry.type==="Point");for(const s of n){const c=document.createElement("div");c.id=`${t.id}-${s.properties.id}`,c.className=`${t.closed?"idm-gl4-measure-marker closed":"idm-gl4-measure-marker"}`,c.innerHTML='<div class="marker-circle"></div>';const m=new pe.Marker({element:c,draggable:!0,contextmenu:!0}).setLngLat(s.geometry.coordinates).addTo(this.map);m.on("drag",this.handleDrag),m.on("dragend",this.handleDragEnd),this.pointMarkers[t.id]?this.pointMarkers[t.id].push(m):this.pointMarkers[t.id]=[m]}if(t.closed){const s=n.at(-1),m=t.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="${t.id}" class="marker-close">X</div>`,this.closeMarkers[t.id]=new pe.Marker(d).setOffset([0,-30]).setLngLat(s.geometry.coordinates).addTo(this.map)}}},handleClear(t,e=!0){var n,s,c,m,d,g,u,f,p,h;const a=`${t.id}-${this.source}`,r=`${t.id}-${this.layer}`,i=`${t.id}-${this.labelLayer}`,l=`${t.id}-${this.sumLayer}`;(n=this.map)!=null&&n.getLayer(r)&&this.map.removeLayer(r),(s=this.map)!=null&&s.getLayer(i)&&this.map.removeLayer(i),(c=this.map)!=null&&c.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[t.id])==null||g.remove(),this.closeMarkers[t.id]=void 0,(u=this.pointMarkers[t.id])==null||u.forEach(y=>{y==null||y.remove()}),this.pointMarkers[t.id]=[],(f=this.tipMarker)==null||f.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)}}},vg={class:"idm-gl4-measure"};function Cg(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",vg,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+166+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("measure.measure"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:c})=>[o.createVNode(n,o.mergeProps(c,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[0]||(e[0]=[o.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 zg=K(Lg,[["render",Cg]]),bb="",_g={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},right:{type:Number,default:10},menuToggle:{type:Object,default:()=>({})},editLayer:{type:Object,default:null},group:{type:Object,default:()=>({})}},emits:["close","save","hideLayer"],setup(){return{Theme:be.useTheme()}},data(){var t;return{markerType:"Point",form:{latDegree:"",latMinute:"",latDir:"N",lngDegree:"",lngMinute:"",lngDir:"E",areaType:"Polygon",color:(t=this.Theme.current.value.colors)==null?void 0:t["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 t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},immediate:!0},"form.areaType"(){var t;(t=this.editLayer)!=null&&t.id||(this.markerType==="Area"?this.form.name=`${this.form.areaType} 1`:this.form.name=`${this.markerType} 1`,this.handleClearDraw())},map:{handler(){var t;this.map&&(this.handleBindMap(),(t=this.editLayer)!=null&&t.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 t,e;this.map&&(this.markerType==="Point"?(this.map.on("click",this.handleMapClickPoint),this.map.getCanvas().style.cursor="crosshair"):this.markerType==="Line"&&!((t=this.editLayer)!=null&&t.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,s,c,m;if(!((i=this.editLayer)!=null&&i.extend)||!this.map)return;const t=typeof this.editLayer.extend=="string"?JSON.parse(this.editLayer.extend):this.editLayer.extend;if(!t)return;const a=(t.features||(t.type==="Feature"?[t]:[]))[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=(s=a.geometry)==null?void 0:s.type;if(r==="Point"){this.markerType="Point";const[d,g]=a.geometry.coordinates;this.drawCoords=[[d,g]],this.form.latDegree=Number(P.LngLatHelper.lat2pretty(g).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(g).minute),this.form.latDir=P.LngLatHelper.lat2pretty(g).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(d).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(d).minute),this.form.lngDir=P.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=(c=this.originalProperties)==null?void 0:c.shape)==null?void 0:m.toLowerCase(),this.$nextTick(()=>{this.handlerRenderEditPolygon(t),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 t=document.createElement("div");t.className="idm-gl4-point-center-ring";const e=this.pointMarker.getLngLat();this.pointHighlightMarker=new pe.Marker({element:t,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:t,lat:e}=this.pointMarker.getLngLat();this.drawCoords=[[t,e]],this.form.latDegree=Number(P.LngLatHelper.lat2pretty(e).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(e).minute),this.form.latDir=P.LngLatHelper.lat2pretty(e).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(t).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(t).minute),this.form.lngDir=P.LngLatHelper.lng2pretty(t).direction},clearEditMarkers(){this.editMarkers.forEach(t=>t.remove()),this.editMarkers=[],this._edgeContextMenuHandler&&this.map&&(this.map.off("contextmenu",this._edgeContextMenuHandler),this._edgeContextMenuHandler=null)},handlerRenderEditLine(t){this.drawCoords=t.geometry.coordinates.map(r=>[...r]);const e=V.featureCollection([t,...this.drawCoords.map(r=>V.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 pe.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(V.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(V.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(V.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=V.point([a,r]),l=V.lineString(this.drawCoords),n=V.nearestPointOnLine(l,i);if(n){const s=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(s+1,0,[a,r]),this.handlerRenderEditLine(V.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",t),this._edgeContextMenuHandler=t},showDeleteButton(t,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(t);l.style.left=`${n.x}px`,l.style.top=`${n.y}px`;const s=c=>{c.stopPropagation(),e(),this.hideDeleteButton()};l.addEventListener("click",s),i.appendChild(l),this.deleteBtn=l,this.map.once("click",()=>this.hideDeleteButton())},hideDeleteButton(){this.deleteBtn&&(this.deleteBtn.remove(),this.deleteBtn=null)},handlerRenderEditPolygon(t){this.handleSetDrawSource(t);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(t){this.clearEditMarkers();const e=t.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 pe.Marker({element:l,draggable:!0}).setLngLat(r).addTo(this.map);n.on("dragstart",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:s,lat:c}=n.getLngLat();this.handleRenderVertexLabel([s,c])}),n.on("drag",()=>{this.map.getCanvas().style.cursor="pointer";const{lng:s,lat:c}=n.getLngLat();this.handleUpdateVertexLabel([s,c]),this.drawCoords[i]=[s,c],this.handleRenderPolygonFill(this.drawCoords)}),n.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:s,lat:c}=n.getLngLat();this.drawCoords[i]=[s,c],this.handleRenderPolygonFill(this.drawCoords),this.handleClearVertexLabels()}),l.addEventListener("contextmenu",s=>{s.preventDefault(),s.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=V.point([i,l]),s=V.lineString([...this.drawCoords,this.drawCoords[0]]),c=V.nearestPointOnLine(s,n);if(c){const m=c.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(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords=[[e,a]],this.form.latDegree=Number(P.LngLatHelper.lat2pretty(a).degree),this.form.latMinute=Number(P.LngLatHelper.lat2pretty(a).minute),this.form.latDir=P.LngLatHelper.lat2pretty(a).direction,this.form.lngDegree=Number(P.LngLatHelper.lng2pretty(e).degree),this.form.lngMinute=Number(P.LngLatHelper.lng2pretty(e).minute),this.form.lngDir=P.LngLatHelper.lng2pretty(e).direction,this.handleRenderPoint(this.drawCoords,this.form.color),(r=this.editLayer)!=null&&r.id&&this.setupPointEdit()},handleChangePoint(){var u;const{latDegree:t,latMinute:e,latDir:a,lngDegree:r,lngMinute:i,lngDir:l}=this.form,n=parseFloat(t),s=parseFloat(e),c=parseFloat(r),m=parseFloat(i);if(isNaN(n)||isNaN(c))return;const d=(n+(isNaN(s)?0:s)/60)*(a==="S"?-1:1),g=(c+(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(t,e){var i;if((i=this.pointMarker)==null||i.remove(),!t||!t.length)return;const[a,r]=t[0];this.pointMarker=new pe.Marker({color:e}).setLngLat([a,r]).addTo(this.map)},handleMapClickLine(t){var r;const{lng:e,lat:a}=t.lngLat;this.drawCoords.push([e,a]),this.handleRenderLine(this.drawCoords),(r=this.editLayer)!=null&&r.id&&this.setupLineEdit()},handleMapMoveLine(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat;this.handleRenderTmpLine(this.drawCoords.at(-1),[e,a])},handleMapDblClickLine(t){t.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(t){if(!t||t.length<1)return;const e=[];t==null||t.forEach((i,l)=>{e.push(P.GeoJsonHelper.drawPoint(i==null?void 0:i[1],i==null?void 0:i[0]))}),(t==null?void 0:t.length)>=2&&e.push(P.GeoJsonHelper.drawLine(t));const a=2,r=V.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(t,e){const a=P.GeoJsonHelper.drawLine([t,e]),r=V.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:t[0],lat:t[1]},l={lng:e[0],lat:e[1]},n=P.LaneHelper.calculateDistance(i,l,!0,2),s=P.LaneHelper.calculateBearing(i,l,!0,2);let c=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]};c+=P.LaneHelper.calculateDistance(g,u,!0,4)}c=P.LngLatHelper.roundPrecision(c+n,1);const m=`
|
|
420
420
|
<div class="marker-label">${this.$t("measure.totalDistance")}: <b>${c}</b>nm, ${this.$t("measure.bearing")}: <b>${s}</b>°</div>
|
|
421
|
-
<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 pe.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(t){var r;const{lng:e,lat:a}=t.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(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(t){t.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(t){var i;let e=[];if(t==null||t.forEach((l,n)=>{e.push(V.point(l))}),(t==null?void 0:t.length)>2){const l=[...t,t[0]];e.push(P.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=V.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(t,e=8){this.handleClearVertexLabels();const a=P.LngLatHelper.lat2pretty(t[1],4).pretty,r=P.LngLatHelper.lng2pretty(t[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 pe.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(t).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(t){this.handleClearVertexLabels();const e=t.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=t.length,e[1]/=t.length,t.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=P.LngLatHelper.lat2pretty(a[1],4).pretty,s=P.LngLatHelper.lng2pretty(a[0],4).pretty,c=document.createElement("div");c.className="idm-gl4-draw-corner-label "+l,c.innerHTML=`<span class="corner-text">${n} <br/> ${s}</span>`;const m=new pe.Marker(c,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(t){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(t);const a=P.LngLatHelper.lat2pretty(t[1],4).pretty,r=P.LngLatHelper.lng2pretty(t[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(t=>t.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=V.featureCollection([V.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=V.distance(V.point(r),V.point(i),{units:"nauticalmiles"}),n=P.GeoJsonHelper.drawCircle(r[0],r[1],l),s=V.featureCollection([V.point(r),n]);this.handleSetDrawSource(s),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=V.distance(V.point(e),V.point(a),{units:"nauticalmiles"}),i=P.GeoJsonHelper.drawCircle(e[0],e[1],r),l=V.featureCollection([V.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(t){const e=P.LngLatHelper.lat2pretty(t[1],4).pretty,a=P.LngLatHelper.lng2pretty(t[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 pe.Marker(r,{anchor:"bottom-right"}).setLngLat(t).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(t,e,a){const r=P.LngLatHelper.roundPrecision(a,2),i=V.featureCollection([V.lineString([t,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=[(t[0]+e[0])/2,(t[1]+e[1])/2],n=this.map.project(t),s=this.map.project(e),c=s.x-n.x,m=s.y-n.y;let d=Math.atan2(m,c)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const g=16,u=(d-90)*Math.PI/180,f=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"),y=document.createElement("span");y.className="idm-gl4-draw-radius-label",y.style.transform=`rotate(${d}deg)`,y.style.transformOrigin="center",y.style.display="inline-block",y.textContent=`${r} nm`,h.appendChild(y);const k=new pe.Marker(h,{anchor:"center",offset:[f,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(k)},handleClearCircleLabels(){var t,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(t=this.map)!=null&&t.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=P.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),s=V.featureCollection([l,...n.map(c=>V.point(c))]);this.handleSetDrawSource(s),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=P.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=V.featureCollection([r,...i.map(n=>V.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const t=(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",t):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":t}}),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(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[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:s,anchor:c})=>{const m=P.LngLatHelper.lat2pretty(s[1],4).pretty,d=P.LngLatHelper.lng2pretty(s[0],4).pretty,g=document.createElement("div");g.className="idm-gl4-draw-corner-label "+c,g.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new pe.Marker(g,{anchor:c}).setLngLat(s).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(t=>t.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const t=(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",t):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":t}})},handleSetDrawSource(t){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(t):this.map.addSource(this.drawSource,{type:"geojson",data:t})},handleClearTmp(){var t,e,a;(t=this.map)!=null&&t.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 t=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",t),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",t),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",t),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",t),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",t),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=t)})},handleClearDraw(t=!1){var a,r,i,l,n;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const s of e)(a=this.map)!=null&&a.getLayer(s)&&((r=this.map)==null||r.removeLayer(s));(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 t=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[s,c]=this.drawCoords[0];t=V.featureCollection([P.GeoJsonHelper.drawPoint(c,s,{...this.originalProperties,color:this.form.color,name:this.form.name})]),(n=t.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=[],s=P.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(c=>({lng:c==null?void 0:c[0],lat:c==null?void 0:c[1]})));for(const c of s)c.length>1&&n.push(P.GeoJsonHelper.drawLine(c,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));t=V.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,s,c;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(!((s=d==null?void 0:d.features)!=null&&s.length))return;let g=((c=d.features)==null?void 0:c.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;t=V.featureCollection(g)}}),!t)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:t};this.saving=!0,await((r=this.editLayer)!=null&&r.id?de.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):de.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,s,c,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((s=this.editLayer)==null?void 0:s.id)||((m=(c=l.data)==null?void 0:c.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},Sg={class:"text-h6 font-weight-600"},Pg={class:"text-label mb-1"},Ng={class:"text-label mb-1"},Mg={class:"mb-1"},Tg={class:"text-label mb-1"},Vg={class:"mb-1"},Eg={class:"text-label mb-1"},Rg={class:"mb-1"},Dg={class:"text-label mb-1"},Bg={class:"color-picker-row d-flex align-start ga-2"},Ig=["value"],Fg={class:"mb-n2"},Gg={class:"text-label mb-1"},jg={class:"mb-1"},Wg={class:"text-label mb-1"},Zg={class:"color-picker-row d-flex align-start ga-2"},Hg=["value"],Xg={class:"mb-n2"},Og={class:"text-label mb-1"},Yg={key:0,class:"mb-3"},Ug={class:"text-label mb-1"},Jg={class:"mb-1"},Kg={class:"text-label mb-1"},Qg={class:"color-picker-row d-flex align-start ga-2"},qg=["value"],$g={class:"mb-n2"},eu={class:"text-label mb-1"};function tu(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VCardTitle"),c=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),d=o.resolveComponent("VCardText"),g=o.resolveComponent("VBtnToggle"),u=o.resolveComponent("VCol"),f=o.resolveComponent("VRow"),p=o.resolveComponent("VCardActions"),h=o.resolveComponent("VForm"),y=o.resolveComponent("VCard");return o.openBlock(),o.createBlock(y,{class:"idm-gl4-draw-dialog-card",elevation:"4"},{default:o.withCtx(()=>{var k;return[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("span",Sg,o.toDisplayString((x=a.editLayer)!=null&&x.id?t.$t("actions.edit"):t.$t("actions.addMarker")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),o.createVNode(c),o.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",Pg,o.toDisplayString(t.$t("marker.group")),1),o.createVNode(m,{"model-value":(x=a.group)==null?void 0:x.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(k=a.editLayer)!=null&&k.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",Ng,[o.createTextVNode(o.toDisplayString(t.$t("marker.markerType")),1),e[22]||(e[22]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(g,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=b=>i.markerType=b),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((x=a.editLayer)!=null&&x.id)},{default:o.withCtx(()=>[o.createVNode(n,{value:"Point",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.point")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Line",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.line")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Area",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(o.openBlock(),o.createBlock(h,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",Mg,[o.createElementVNode("div",Tg,[o.createTextVNode(o.toDisplayString(t.$t("marker.lat")),1),e[23]||(e[23]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(f,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=x=>i.form.latDegree=x),e[2]||(e[2]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),o.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=x=>i.form.latMinute=x),e[4]||(e[4]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),o.createVNode(u,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.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]=x=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Vg,[o.createElementVNode("div",Eg,[o.createTextVNode(o.toDisplayString(t.$t("marker.lng")),1),e[26]||(e[26]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(f,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=x=>i.form.lngDegree=x),e[7]||(e[7]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),o.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=x=>i.form.lngMinute=x),e[9]||(e[9]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),o.createVNode(u,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.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]=x=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Rg,[o.createElementVNode("div",Dg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[29]||(e[29]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Bg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=x=>i.form.color=x.target.value)},null,40,Ig),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=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"])])]),o.createElementVNode("div",Fg,[o.createElementVNode("div",Gg,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[30]||(e[30]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=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}),o.createVNode(c),o.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Line"?(o.openBlock(),o.createBlock(h,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",jg,[o.createElementVNode("div",Wg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[31]||(e[31]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Zg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=x=>i.form.color=x.target.value)},null,40,Hg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=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"])])]),o.createElementVNode("div",Xg,[o.createElementVNode("div",Og,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[32]||(e[32]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=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}),o.createVNode(c),o.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Area"?(o.openBlock(),o.createBlock(h,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>{var x,b;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Yg,[o.createElementVNode("div",Ug,[o.createTextVNode(o.toDisplayString(t.$t("marker.areaType")),1),e[33]||(e[33]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(g,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=A=>i.form.areaType=A),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((b=a.editLayer)!=null&&b.id)},{default:o.withCtx(()=>[o.createVNode(n,{value:"Polygon",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.polygon")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Circle",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.circle")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Rect",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),o.createElementVNode("div",Jg,[o.createElementVNode("div",Kg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[34]||(e[34]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Qg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=A=>i.form.color=A.target.value)},null,40,qg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=A=>i.form.color=A),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",$g,[o.createElementVNode("div",eu,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[35]||(e[35]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=A=>i.form.name=A),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),o.createVNode(c),o.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>{var x;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"])),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0)]}),_:1})}const ou=K(_g,[["render",tu]]),wb="",au={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:be.useTheme()}},data(){var t;return{form:{groupName:"",name:"",file:null,format:"",extend:void 0,color:(t=this.Theme.current.value.colors)==null?void 0:t["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(t){var e;(e=this.form.extend)!=null&&e.features&&this.form.extend.features.forEach(a=>{a.properties.color=t}),this.handleDrawLayers()},immediate:!0}},mounted(){var t;this.form.groupName=((t=this.group)==null?void 0:t.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var t;this.form={groupName:((t=this.group)==null?void 0:t.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(t){const e=t.target.files[0];e&&this.onUpload(e)},handleDrop(t){this.isDragOver=!1;const e=t.dataTransfer.files[0];e&&this.onUpload(e)},async onUpload(t){var r,i,l,n;if(t.size>10485760){this.fileError=this.$t("marker.fileTooLarge");return}this.form.file=t,this.fileError="",this.form.name=(r=t.name.split("."))==null?void 0:r[0];const a=(i=t.name.split(".").pop())==null?void 0:i.toLowerCase();try{let s;if(a==="json"||a==="geojson"){const c=await t.text();s=JSON.parse(c)}else if(a==="kml"){const c=await t.text();s=await P.GeoJsonHelper.convertKML2GeoJSON(c)}else if(a==="kmz"){const c=await t.arrayBuffer();s=await P.GeoJsonHelper.convertKMZ2GeoJSON(c)}else if(a==="zip"||a==="shp"){const c=await t.arrayBuffer();s=await P.GeoJsonHelper.convertZIP2GeoJSON(c)}else{this.fileError="Unsupported format: "+a;return}this.form.extend=s,this.form.format="geojson",(n=(l=this.form.extend)==null?void 0:l.features)==null||n.forEach(c=>{c.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:t}=await this.$refs.importForm.validate();if(!t)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await de.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};de.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 t=this.form.extend,e=this.previewSourceId,a=t.features||(t.type==="Feature"?[t]:[]);a.forEach(i=>{var n,s,c;const l=((n=i==null?void 0:i.properties)==null?void 0:n.color)||((s=this.Theme.current.value.colors)==null?void 0:s["map-green"]);if(((c=i.geometry)==null?void 0:c.type)==="Point"){const[m,d]=i.geometry.coordinates;this.previewMarkers.push(new pe.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(t):this.map.addSource(e,{type:"geojson",data:t});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 t=this.previewSourceId;[`${t}-vertex`,`${t}-point`,`${t}-line`,`${t}-fill`,`${t}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(t)&&this.map.removeSource(t)}}},iu={class:"text-h6 font-weight-600"},ru={class:"mb-4"},lu={class:"text-label mb-1"},nu={class:"mb-1"},su={class:"text-label mb-1"},cu={class:"color-picker-row d-flex align-start ga-2"},mu=["value"],du={class:"text-body-2 text-center text-label"},hu={class:"text-body-1 text-primary mt-2 cursor-pointer"},pu={class:"text-body-2 text-left text-label mt-1"},gu={key:0,class:"text-body-2 text-left text-danger mt-1"},uu={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},fu={class:"text-body-2 text-truncate"};function yu(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VCardTitle"),c=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),d=o.resolveComponent("VIcon"),g=o.resolveComponent("VCardText"),u=o.resolveComponent("VCardActions"),f=o.resolveComponent("VForm"),p=o.resolveComponent("VCard");return o.openBlock(),o.createBlock(p,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",iu,o.toDisplayString(t.$t("marker.importLayer")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(c),o.createVNode(f,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleConfirm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(g,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ru,[o.createElementVNode("div",lu,[o.createTextVNode(o.toDisplayString(t.$t("marker.group")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.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"])]),o.createElementVNode("div",nu,[o.createElementVNode("div",su,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[11]||(e[11]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",cu,[o.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,mu),o.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"])])]),o.createElementVNode("div",{class:o.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]=o.withModifiers(h=>i.isDragOver=!0,["prevent"])),onDragleave:e[5]||(e[5]=o.withModifiers(h=>i.isDragOver=!1,["prevent"])),onDragover:e[6]||(e[6]=o.withModifiers(()=>{},["prevent"])),onDrop:e[7]||(e[7]=o.withModifiers((...h)=>l.handleDrop&&l.handleDrop(...h),["prevent"])),onClick:e[8]||(e[8]=(...h)=>l.handleSelectFile&&l.handleSelectFile(...h))},[o.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:o.withCtx(()=>e[12]||(e[12]=[o.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[12]}),o.createElementVNode("div",du,o.toDisplayString(t.$t("marker.uploadHint")),1),o.createElementVNode("div",hu,o.toDisplayString(t.$t("marker.selectFile")),1),o.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),o.createElementVNode("div",pu,o.toDisplayString(t.$t("marker.uploadLimit")),1),i.fileError?(o.openBlock(),o.createElementBlock("div",gu,o.toDisplayString(i.fileError),1)):o.createCommentVNode("",!0),i.form.file?(o.openBlock(),o.createElementBlock("div",uu,[o.createElementVNode("span",fu,[o.createVNode(d,{size:"16",color:"success",class:"mr-1"},{default:o.withCtx(()=>e[13]||(e[13]=[o.createTextVNode("mdi-check-circle",-1)])),_:1,__:[13]}),o.createTextVNode(" "+o.toDisplayString(i.form.file.name),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:o.withCtx(()=>[o.createVNode(d,{size:"16"},{default:o.withCtx(()=>e[14]||(e[14]=[o.createTextVNode("mdi-close",-1)])),_:1,__:[14]})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),_:1}),o.createVNode(c),o.createVNode(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.reset")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const bu=K(au,[["render",yu]]),xb="",wu={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(t){this.localName=(t==null?void 0:t.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var t;!this.group||!((t=this.localName)!=null&&t.trim())||(this.saving=!0,await de.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}))}}},xu={class:"text-h6 font-weight-600"},ku={class:"text-label mb-2"};function Au(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VCardTitle"),c=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),d=o.resolveComponent("VCardText"),g=o.resolveComponent("VCardActions"),u=o.resolveComponent("VCard"),f=o.resolveComponent("VDialog");return o.openBlock(),o.createBlock(f,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=p=>t.$emit("update:modelValue",p))},{default:o.withCtx(()=>[o.createVNode(u,{class:"",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",xu,o.toDisplayString(t.$t("actions.editGroup")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),o.createVNode(c),o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ku,[o.createTextVNode(o.toDisplayString(t.$t("marker.groupName")),1),e[3]||(e[3]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.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}),o.createVNode(c),o.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const Lu=K(wu,[["render",Au]]),vu={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}}},Cu={class:"text-body-1 pb-1"},zu={class:"text-body-1"};function _u(t,e,a,r,i,l){const n=o.resolveComponent("VIcon"),s=o.resolveComponent("VBtn"),c=o.resolveComponent("VCardTitle"),m=o.resolveComponent("VCardText"),d=o.resolveComponent("VCardActions"),g=o.resolveComponent("VCard"),u=o.resolveComponent("VDialog");return o.openBlock(),o.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=f=>i.showDialog=f),width:"500","min-width":"500","max-width":"500"},{default:o.withCtx(()=>[o.createVNode(g,{class:""},{default:o.withCtx(()=>[o.createVNode(c,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:o.withCtx(()=>[o.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),o.createElementVNode("div",null,o.toDisplayString(a.title),1),o.createVNode(s,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:o.withCtx(()=>e[1]||(e[1]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),o.createVNode(m,{class:"py-4 text-center"},{default:o.withCtx(()=>[o.createElementVNode("p",Cu,o.toDisplayString(a.tips),1),o.createElementVNode("p",zu,o.toDisplayString(t.$t("tips.doYouWantToContinue")),1)]),_:1}),o.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:o.withCtx(()=>[o.createVNode(s,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(s,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const Su=K(vu,[["render",_u]]),kb="",Ab="",Pu={name:"IdmMarker",components:{IdmDrawMarker:ou,IdmImportMarker:bu,IdmGroupDialog:Lu,DeleteDialog:Su},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:0},paddingTop:{type:Number,default:8},menuToggle:{type:Object,default:{}}},emits:["map","menuToggle","theme","login"],setup(){return{Theme:be.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",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.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(t){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=t,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(t,e){t==="group"?(this.currentGroup=e,this.currentLayer=void 0):t==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var t;this.currentGroup?this.handleDeleteGroup((t=this.currentGroup)==null?void 0:t.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(t){t&&(this.deleteLoading=!0,await de.delete(`${this.gateway}/api/arc/lygroups/${t}`,{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(t){this.handleCloseDraw(),this.currentGroup=t||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(t){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=t||void 0,this.importDialog=!0},handleImportLayer(t){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(t){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(t,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=t,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await de.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(t=>{var e,a,r,i,l,n;if(((e=t.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=t.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const s=[];(l=this.layerGroup)==null||l.forEach(c=>{var m;c.show=!0,(m=c.layers)==null||m.forEach(d=>{var u;d.layerGroupId=c.id;const g=typeof d.extend=="string"?JSON.parse(d.extend):d.extend;(u=g==null?void 0:g.features)==null||u.forEach(f=>{f.properties.lgId=c.id,f.properties.layerId=d.id,f.properties.name||(f.properties.name=d.name)}),s.push(d)})}),this.layers=s,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(t){this.deleteLoading=!0,await de.delete(`${this.gateway}/api/arc/layers/${t.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(t){if(!this.map||!(t!=null&&t.extend))return;const e=typeof t.extend=="string"?JSON.parse(t.extend):t.extend;if(!e)return;const a=`marker-layer-${t.id}`;this.handleClearLayerMarkers(t.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(s=>{var c,m;return(((c=s.geometry)==null?void 0:c.type)==="Point"||((m=s.geometry)==null?void 0:m.type)==="MultiPoint")&&s.properties.shape==="point"})){const s=[];r.forEach(c=>{var u,f,p,h;const m=(u=c.geometry)==null?void 0:u.type,d=((f=c.properties)==null?void 0:f.name)||"",g=((p=c.properties)==null?void 0:p.color)||t.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[y,k]=c.geometry.coordinates,x=`<div style="font-size:12px;line-height:1.5;">
|
|
421
|
+
<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 pe.Marker(d).setOffset([140,0]).setLngLat([e[0],e[1]]).addTo(this.map)}},handleRefreshLine(){this.drawCoords.length>=1&&this.handleRenderLine(this.drawCoords)},handleMapClickPolygon(t){var r;const{lng:e,lat:a}=t.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(t){if(!this.drawCoords.length)return;const{lng:e,lat:a}=t.lngLat,r=[...this.drawCoords,[e,a]];r.length>=1&&this.handleRenderPolygonFill(r),this.handleRenderAllVertexLabels(r)},handleMapDblClickPolygon(t){t.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(t){var i;let e=[];if(t==null||t.forEach((l,n)=>{e.push(V.point(l))}),(t==null?void 0:t.length)>2){const l=[...t,t[0]];e.push(P.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=V.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(t,e=8){this.handleClearVertexLabels();const a=P.LngLatHelper.lat2pretty(t[1],4).pretty,r=P.LngLatHelper.lng2pretty(t[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 pe.Marker(i,{anchor:"bottom",offset:[0,e]}).setLngLat(t).addTo(this.map);this.polygonVertexMarkers.push(l)},handleRenderAllVertexLabels(t){this.handleClearVertexLabels();const e=t.reduce((a,r)=>[a[0]+r[0],a[1]+r[1]],[0,0]);e[0]/=t.length,e[1]/=t.length,t.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=P.LngLatHelper.lat2pretty(a[1],4).pretty,s=P.LngLatHelper.lng2pretty(a[0],4).pretty,c=document.createElement("div");c.className="idm-gl4-draw-corner-label "+l,c.innerHTML=`<span class="corner-text">${n} <br/> ${s}</span>`;const m=new pe.Marker(c,{anchor:l}).setLngLat(a).addTo(this.map);this.polygonVertexMarkers.push(m)})},handleUpdateVertexLabel(t){if(!this.polygonVertexMarkers.length)return;const e=this.polygonVertexMarkers[0];e.setLngLat(t);const a=P.LngLatHelper.lat2pretty(t[1],4).pretty,r=P.LngLatHelper.lng2pretty(t[0],4).pretty,i=e.getElement().querySelector(".corner-text");i&&(i.innerHTML=`${a} <br/> ${r}`)},handleClearVertexLabels(){this.polygonVertexMarkers.forEach(t=>t.remove()),this.polygonVertexMarkers=[]},handleMapClickCircle(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0){this.drawCoords.push([e,a]);const r=V.featureCollection([V.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=V.distance(V.point(r),V.point(i),{units:"nauticalmiles"}),n=P.GeoJsonHelper.drawCircle(r[0],r[1],l),s=V.featureCollection([V.point(r),n]);this.handleSetDrawSource(s),this.handleRenderAreaLayers(),this.handleRenderRadiusLine(r,i,l),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickCircle),this.map.off("mousemove",this.handleMapMoveCircle)}},handleMapMoveCircle(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=V.distance(V.point(e),V.point(a),{units:"nauticalmiles"}),i=P.GeoJsonHelper.drawCircle(e[0],e[1],r),l=V.featureCollection([V.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(t){const e=P.LngLatHelper.lat2pretty(t[1],4).pretty,a=P.LngLatHelper.lng2pretty(t[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 pe.Marker(r,{anchor:"bottom-right"}).setLngLat(t).addTo(this.map);this.circleMarkers.push(i)},handleRenderRadiusLine(t,e,a){const r=P.LngLatHelper.roundPrecision(a,2),i=V.featureCollection([V.lineString([t,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=[(t[0]+e[0])/2,(t[1]+e[1])/2],n=this.map.project(t),s=this.map.project(e),c=s.x-n.x,m=s.y-n.y;let d=Math.atan2(m,c)*180/Math.PI;d>90&&(d-=180),d<-90&&(d+=180);const g=16,u=(d-90)*Math.PI/180,f=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"),y=document.createElement("span");y.className="idm-gl4-draw-radius-label",y.style.transform=`rotate(${d}deg)`,y.style.transformOrigin="center",y.style.display="inline-block",y.textContent=`${r} nm`,h.appendChild(y);const k=new pe.Marker(h,{anchor:"center",offset:[f,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(k)},handleClearCircleLabels(){var t,e;this.circleMarkers.forEach(a=>a.remove()),this.circleMarkers=[],(t=this.map)!=null&&t.getLayer(this.drawRadiusLayer)&&this.map.removeLayer(this.drawRadiusLayer),(e=this.map)!=null&&e.getSource(this.drawRadiusSource)&&this.map.removeSource(this.drawRadiusSource)},buildRectFeatureCollection(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[1],e[1]);return[[a,l],[r,l],[r,i],[a,i]]},handleMapClickRect(t){const{lng:e,lat:a}=t.lngLat;if(this.drawCoords.length===0)this.drawCoords.push([e,a]);else{const r=this.drawCoords[0],i=[e,a],l=P.GeoJsonHelper.drawRect(r,i);delete l.bbox;const n=this.buildRectFeatureCollection(r,i),s=V.featureCollection([l,...n.map(c=>V.point(c))]);this.handleSetDrawSource(s),this.handleRenderRectLayers(),this.handleRenderRectCorners(r,i),this.drawCoords=[r,i],this.map.off("click",this.handleMapClickRect),this.map.off("mousemove",this.handleMapMoveRect)}},handleMapMoveRect(t){if(this.drawCoords.length!==1)return;const e=this.drawCoords[0],a=[t.lngLat.lng,t.lngLat.lat],r=P.GeoJsonHelper.drawRect(e,a),i=this.buildRectFeatureCollection(e,a),l=V.featureCollection([r,...i.map(n=>V.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const t=(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",t):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":t}}),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(t,e){const a=Math.min(t[0],e[0]),r=Math.max(t[0],e[0]),i=Math.min(t[1],e[1]),l=Math.max(t[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:s,anchor:c})=>{const m=P.LngLatHelper.lat2pretty(s[1],4).pretty,d=P.LngLatHelper.lng2pretty(s[0],4).pretty,g=document.createElement("div");g.className="idm-gl4-draw-corner-label "+c,g.innerHTML=`<span class="corner-text">${m} <br/> ${d}</span>`;const u=new pe.Marker(g,{anchor:c}).setLngLat(s).addTo(this.map);this.rectCornerMarkers.push(u)})},handleClearRectCorners(){this.rectCornerMarkers.forEach(t=>t.remove()),this.rectCornerMarkers=[]},handleRenderAreaLayers(){var e;const t=(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",t):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":t}})},handleSetDrawSource(t){this.map.getSource(this.drawSource)?this.map.getSource(this.drawSource).setData(t):this.map.addSource(this.drawSource,{type:"geojson",data:t})},handleClearTmp(){var t,e,a;(t=this.map)!=null&&t.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 t=this.form.color;this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",t),this.map.getLayer(this.drawLineLayer)&&this.map.setPaintProperty(this.drawLineLayer,"line-color",t),this.map.getLayer(this.drawFillLayer)&&this.map.setPaintProperty(this.drawFillLayer,"fill-color",t),this.map.getLayer(this.drawRadiusLayer)&&this.map.setPaintProperty(this.drawRadiusLayer,"line-color",t),this.map.getLayer(this.drawTmpLayer)&&this.map.setPaintProperty(this.drawTmpLayer,"line-color",t),this.editMarkers.forEach(e=>{e.getElement()&&(e.getElement().style.backgroundColor=t)})},handleClearDraw(t=!1){var a,r,i,l,n;this.handleClearTmp(),this.hideDeleteButton();const e=[this.drawPointLayer,this.drawLineLayer,this.drawFillLayer];for(const s of e)(a=this.map)!=null&&a.getLayer(s)&&((r=this.map)==null||r.removeLayer(s));(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 t=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[s,c]=this.drawCoords[0];t=V.featureCollection([P.GeoJsonHelper.drawPoint(c,s,{...this.originalProperties,color:this.form.color,name:this.form.name})]),(n=t.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=[],s=P.LaneHelper.generateRouteAccordingToWaypoints(this.drawCoords.map(c=>({lng:c==null?void 0:c[0],lat:c==null?void 0:c[1]})));for(const c of s)c.length>1&&n.push(P.GeoJsonHelper.drawLine(c,{properties:{...this.originalProperties,color:this.form.color,name:this.form.name}}));t=V.featureCollection(n)}}):this.markerType==="Area"&&await this.$refs.areaForm.validate().then(l=>{var n,s,c;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(!((s=d==null?void 0:d.features)!=null&&s.length))return;let g=((c=d.features)==null?void 0:c.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;t=V.featureCollection(g)}}),!t)return!1;const e={name:this.form.name,format:"geojson",color:this.form.color,extend:t};this.saving=!0,await((r=this.editLayer)!=null&&r.id?de.put(`${this.gateway}/api/arc/layers/${this.editLayer.id}`,e,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}):de.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,s,c,m;((n=l.data)==null?void 0:n.code)===0&&this.$emit("save",{...e,id:((s=this.editLayer)==null?void 0:s.id)||((m=(c=l.data)==null?void 0:c.data)==null?void 0:m.id)}),this.saving=!1}).catch(l=>{console.error("save marker error",l),this.saving=!1})}}},Sg={class:"text-h6 font-weight-600"},Pg={class:"text-label mb-1"},Ng={class:"text-label mb-1"},Mg={class:"mb-1"},Tg={class:"text-label mb-1"},Vg={class:"mb-1"},Eg={class:"text-label mb-1"},Rg={class:"mb-1"},Dg={class:"text-label mb-1"},Bg={class:"color-picker-row d-flex align-start ga-2"},Ig=["value"],Fg={class:"mb-n2"},Gg={class:"text-label mb-1"},jg={class:"mb-1"},Wg={class:"text-label mb-1"},Zg={class:"color-picker-row d-flex align-start ga-2"},Hg=["value"],Xg={class:"mb-n2"},Og={class:"text-label mb-1"},Yg={key:0,class:"mb-3"},Ug={class:"text-label mb-1"},Jg={class:"mb-1"},Kg={class:"text-label mb-1"},Qg={class:"color-picker-row d-flex align-start ga-2"},qg=["value"],$g={class:"mb-n2"},eu={class:"text-label mb-1"};function tu(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VCardTitle"),c=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),d=o.resolveComponent("VCardText"),g=o.resolveComponent("VBtnToggle"),u=o.resolveComponent("VCol"),f=o.resolveComponent("VRow"),p=o.resolveComponent("VCardActions"),h=o.resolveComponent("VForm"),y=o.resolveComponent("VCard");return o.openBlock(),o.createBlock(y,{class:"idm-gl4-draw-dialog-card transition",elevation:"4",style:o.normalizeStyle({top:a.top+a.paddingTop+60+"px",right:a.right+50+"px"})},{default:o.withCtx(()=>{var k;return[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("span",Sg,o.toDisplayString((x=a.editLayer)!=null&&x.id?t.$t("actions.edit"):t.$t("actions.addMarker")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[21]||(e[21]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[21]},8,["onClick"])]}),_:1}),o.createVNode(c),o.createVNode(d,{class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",Pg,o.toDisplayString(t.$t("marker.group")),1),o.createVNode(m,{"model-value":(x=a.group)==null?void 0:x.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(k=a.editLayer)!=null&&k.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var x;return[o.createElementVNode("div",Ng,[o.createTextVNode(o.toDisplayString(t.$t("marker.markerType")),1),e[22]||(e[22]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(g,{modelValue:i.markerType,"onUpdate:modelValue":e[0]||(e[0]=b=>i.markerType=b),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((x=a.editLayer)!=null&&x.id)},{default:o.withCtx(()=>[o.createVNode(n,{value:"Point",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.point")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Line",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.line")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Area",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.area")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])]}),_:1})),i.markerType==="Point"?(o.openBlock(),o.createBlock(h,{key:1,ref:"pointForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",Mg,[o.createElementVNode("div",Tg,[o.createTextVNode(o.toDisplayString(t.$t("marker.lat")),1),e[23]||(e[23]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(f,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=x=>i.form.latDegree=x),e[2]||(e[2]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[24]}),o.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=x=>i.form.latMinute=x),e[4]||(e[4]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[25]}),o.createVNode(u,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.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]=x=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Vg,[o.createElementVNode("div",Eg,[o.createTextVNode(o.toDisplayString(t.$t("marker.lng")),1),e[26]||(e[26]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(f,{class:"ma-0"},{default:o.withCtx(()=>[o.createVNode(u,{cols:"4",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=x=>i.form.lngDegree=x),e[7]||(e[7]=x=>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]=o.createElementVNode("span",{class:"px-1"},"°",-1))]),_:1,__:[27]}),o.createVNode(u,{cols:"6",class:"pa-0 d-flex"},{default:o.withCtx(()=>[o.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=x=>i.form.lngMinute=x),e[9]||(e[9]=x=>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]=o.createElementVNode("span",{class:"px-1"},"'",-1))]),_:1,__:[28]}),o.createVNode(u,{cols:"2",class:"pa-0"},{default:o.withCtx(()=>[o.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]=x=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDir),1)]),_:1})]),_:1})]),_:1})]),o.createElementVNode("div",Rg,[o.createElementVNode("div",Dg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[29]||(e[29]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Bg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=x=>i.form.color=x.target.value)},null,40,Ig),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=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"])])]),o.createElementVNode("div",Fg,[o.createElementVNode("div",Gg,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[30]||(e[30]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[13]||(e[13]=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}),o.createVNode(c),o.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Line"?(o.openBlock(),o.createBlock(h,{key:2,ref:"lineForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",jg,[o.createElementVNode("div",Wg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[31]||(e[31]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Zg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=x=>i.form.color=x.target.value)},null,40,Hg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=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"])])]),o.createElementVNode("div",Xg,[o.createElementVNode("div",Og,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[32]||(e[32]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[16]||(e[16]=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}),o.createVNode(c),o.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0),i.markerType==="Area"?(o.openBlock(),o.createBlock(h,{key:3,ref:"areaForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleSave,["prevent"])},{default:o.withCtx(()=>[o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>{var x,b;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Yg,[o.createElementVNode("div",Ug,[o.createTextVNode(o.toDisplayString(t.$t("marker.areaType")),1),e[33]||(e[33]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(g,{modelValue:i.form.areaType,"onUpdate:modelValue":e[17]||(e[17]=A=>i.form.areaType=A),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((b=a.editLayer)!=null&&b.id)},{default:o.withCtx(()=>[o.createVNode(n,{value:"Polygon",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.polygon")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Circle",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.circle")),1)]),_:1},8,["class","color"]),o.createVNode(n,{value:"Rect",class:o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("marker.rect")),1)]),_:1},8,["class","color"])]),_:1},8,["modelValue","disabled"])])),o.createElementVNode("div",Jg,[o.createElementVNode("div",Kg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[34]||(e[34]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Qg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=A=>i.form.color=A.target.value)},null,40,qg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=A=>i.form.color=A),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",$g,[o.createElementVNode("div",eu,[o.createTextVNode(o.toDisplayString(t.$t("marker.name")),1),e[35]||(e[35]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createVNode(m,{modelValue:i.form.name,"onUpdate:modelValue":e[20]||(e[20]=A=>i.form.name=A),density:"compact",variant:"outlined",rules:i.formRules.name,autocomplete:"off",class:"input-btn-bg-1"},null,8,["modelValue","rules"])])]}),_:1}),o.createVNode(c),o.createVNode(p,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>{var x;return[(x=a.editLayer)!=null&&x.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(n,{key:0,class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClearDraw},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.clear")),1)]),_:1},8,["onClick"])),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.saving},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.save")),1)]),_:1},8,["loading"])]}),_:1})]),_:1},8,["onSubmit"])):o.createCommentVNode("",!0)]}),_:1},8,["style"])}const ou=K(_g,[["render",tu]]),wb="",au={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:be.useTheme()}},data(){var t;return{form:{groupName:"",name:"",file:null,format:"",extend:void 0,color:(t=this.Theme.current.value.colors)==null?void 0:t["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(t){var e;(e=this.form.extend)!=null&&e.features&&this.form.extend.features.forEach(a=>{a.properties.color=t}),this.handleDrawLayers()},immediate:!0}},mounted(){var t;this.form.groupName=((t=this.group)==null?void 0:t.name)||"Import layer 1"},beforeUnmount(){this.handleClearPreview()},methods:{handleClose(){this.$emit("close")},handleReset(){var t;this.form={groupName:((t=this.group)==null?void 0:t.name)||"Import layer 1",file:null,format:"",extend:void 0},this.fileError=""},handleSelectFile(){this.$refs.fileInput.click()},handleFileChange(t){const e=t.target.files[0];e&&this.onUpload(e)},handleDrop(t){this.isDragOver=!1;const e=t.dataTransfer.files[0];e&&this.onUpload(e)},async onUpload(t){var r,i,l,n;if(t.size>10485760){this.fileError=this.$t("marker.fileTooLarge");return}this.form.file=t,this.fileError="",this.form.name=(r=t.name.split("."))==null?void 0:r[0];const a=(i=t.name.split(".").pop())==null?void 0:i.toLowerCase();try{let s;if(a==="json"||a==="geojson"){const c=await t.text();s=JSON.parse(c)}else if(a==="kml"){const c=await t.text();s=await P.GeoJsonHelper.convertKML2GeoJSON(c)}else if(a==="kmz"){const c=await t.arrayBuffer();s=await P.GeoJsonHelper.convertKMZ2GeoJSON(c)}else if(a==="zip"||a==="shp"){const c=await t.arrayBuffer();s=await P.GeoJsonHelper.convertZIP2GeoJSON(c)}else{this.fileError="Unsupported format: "+a;return}this.form.extend=s,this.form.format="geojson",(n=(l=this.form.extend)==null?void 0:l.features)==null||n.forEach(c=>{c.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:t}=await this.$refs.importForm.validate();if(!t)return;if(!this.form.file){this.fileError=this.$t("marker.fileRequired");return}this.uploading=!0;let e=this.group.id;if(e||await de.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};de.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 t=this.form.extend,e=this.previewSourceId,a=t.features||(t.type==="Feature"?[t]:[]);a.forEach(i=>{var n,s,c;const l=((n=i==null?void 0:i.properties)==null?void 0:n.color)||((s=this.Theme.current.value.colors)==null?void 0:s["map-green"]);if(((c=i.geometry)==null?void 0:c.type)==="Point"){const[m,d]=i.geometry.coordinates;this.previewMarkers.push(new pe.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(t):this.map.addSource(e,{type:"geojson",data:t});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 t=this.previewSourceId;[`${t}-vertex`,`${t}-point`,`${t}-line`,`${t}-fill`,`${t}-outline`].forEach(a=>{this.map.getLayer(a)&&this.map.removeLayer(a)}),this.map.getSource(t)&&this.map.removeSource(t)}}},iu={class:"text-h6 font-weight-600"},ru={class:"mb-4"},lu={class:"text-label mb-1"},nu={class:"mb-1"},su={class:"text-label mb-1"},cu={class:"color-picker-row d-flex align-start ga-2"},mu=["value"],du={class:"text-body-2 text-center text-label"},hu={class:"text-body-1 text-primary mt-2 cursor-pointer"},pu={class:"text-body-2 text-left text-label mt-1"},gu={key:0,class:"text-body-2 text-left text-danger mt-1"},uu={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},fu={class:"text-body-2 text-truncate"};function yu(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VCardTitle"),c=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),d=o.resolveComponent("VIcon"),g=o.resolveComponent("VCardText"),u=o.resolveComponent("VCardActions"),f=o.resolveComponent("VForm"),p=o.resolveComponent("VCard");return o.openBlock(),o.createBlock(p,{class:"idm-gl4-import-dialog-card",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",iu,o.toDisplayString(t.$t("marker.importLayer")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[9]||(e[9]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[9]},8,["onClick"])]),_:1}),o.createVNode(c),o.createVNode(f,{ref:"importForm",autocomplete:"off",class:"form-box",onSubmit:o.withModifiers(l.handleConfirm,["prevent"])},{default:o.withCtx(()=>[o.createVNode(g,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ru,[o.createElementVNode("div",lu,[o.createTextVNode(o.toDisplayString(t.$t("marker.group")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.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"])]),o.createElementVNode("div",nu,[o.createElementVNode("div",su,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[11]||(e[11]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",cu,[o.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,mu),o.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"])])]),o.createElementVNode("div",{class:o.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]=o.withModifiers(h=>i.isDragOver=!0,["prevent"])),onDragleave:e[5]||(e[5]=o.withModifiers(h=>i.isDragOver=!1,["prevent"])),onDragover:e[6]||(e[6]=o.withModifiers(()=>{},["prevent"])),onDrop:e[7]||(e[7]=o.withModifiers((...h)=>l.handleDrop&&l.handleDrop(...h),["prevent"])),onClick:e[8]||(e[8]=(...h)=>l.handleSelectFile&&l.handleSelectFile(...h))},[o.createVNode(d,{size:"36",color:"grey",class:"mb-2"},{default:o.withCtx(()=>e[12]||(e[12]=[o.createTextVNode("mdi-cloud-upload-outline",-1)])),_:1,__:[12]}),o.createElementVNode("div",du,o.toDisplayString(t.$t("marker.uploadHint")),1),o.createElementVNode("div",hu,o.toDisplayString(t.$t("marker.selectFile")),1),o.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),o.createElementVNode("div",pu,o.toDisplayString(t.$t("marker.uploadLimit")),1),i.fileError?(o.openBlock(),o.createElementBlock("div",gu,o.toDisplayString(i.fileError),1)):o.createCommentVNode("",!0),i.form.file?(o.openBlock(),o.createElementBlock("div",uu,[o.createElementVNode("span",fu,[o.createVNode(d,{size:"16",color:"success",class:"mr-1"},{default:o.withCtx(()=>e[13]||(e[13]=[o.createTextVNode("mdi-check-circle",-1)])),_:1,__:[13]}),o.createTextVNode(" "+o.toDisplayString(i.form.file.name),1)]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",size:"small",class:"file-remove-btn",onClick:l.handleRemoveFile},{default:o.withCtx(()=>[o.createVNode(d,{size:"16"},{default:o.withCtx(()=>e[14]||(e[14]=[o.createTextVNode("mdi-close",-1)])),_:1,__:[14]})]),_:1},8,["onClick"])])):o.createCommentVNode("",!0)]),_:1}),o.createVNode(c),o.createVNode(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleReset},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.reset")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",type:"submit",loading:i.uploading},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["onSubmit"])]),_:1})}const bu=K(au,[["render",yu]]),xb="",wu={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(t){this.localName=(t==null?void 0:t.name)||""},immediate:!0}},methods:{handleClose(){this.$emit("update:modelValue",!1)},async handleConfirm(){var t;!this.group||!((t=this.localName)!=null&&t.trim())||(this.saving=!0,await de.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}))}}},xu={class:"text-h6 font-weight-600"},ku={class:"text-label mb-2"};function Au(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VCardTitle"),c=o.resolveComponent("VDivider"),m=o.resolveComponent("VTextField"),d=o.resolveComponent("VCardText"),g=o.resolveComponent("VCardActions"),u=o.resolveComponent("VCard"),f=o.resolveComponent("VDialog");return o.openBlock(),o.createBlock(f,{"model-value":a.modelValue,"max-width":"320",persistent:"","onUpdate:modelValue":e[1]||(e[1]=p=>t.$emit("update:modelValue",p))},{default:o.withCtx(()=>[o.createVNode(u,{class:"",elevation:"4"},{default:o.withCtx(()=>[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>[o.createElementVNode("span",xu,o.toDisplayString(t.$t("actions.editGroup")),1),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleClose},{default:o.withCtx(()=>e[2]||(e[2]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[2]},8,["onClick"])]),_:1}),o.createVNode(c),o.createVNode(d,{class:"px-4 text-body-1"},{default:o.withCtx(()=>[o.createElementVNode("div",ku,[o.createTextVNode(o.toDisplayString(t.$t("marker.groupName")),1),e[3]||(e[3]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.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}),o.createVNode(c),o.createVNode(g,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>[o.createVNode(n,{class:"text-none text-body-1",variant:"tonal",density:"comfortable",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(n,{class:"text-none text-body-1",variant:"flat",color:"primary",density:"comfortable",loading:i.saving,onClick:l.handleConfirm},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.confirm")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["model-value"])}const Lu=K(wu,[["render",Au]]),vu={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}}},Cu={class:"text-body-1 pb-1"},zu={class:"text-body-1"};function _u(t,e,a,r,i,l){const n=o.resolveComponent("VIcon"),s=o.resolveComponent("VBtn"),c=o.resolveComponent("VCardTitle"),m=o.resolveComponent("VCardText"),d=o.resolveComponent("VCardActions"),g=o.resolveComponent("VCard"),u=o.resolveComponent("VDialog");return o.openBlock(),o.createBlock(u,{modelValue:i.showDialog,"onUpdate:modelValue":e[0]||(e[0]=f=>i.showDialog=f),width:"500","min-width":"500","max-width":"500"},{default:o.withCtx(()=>[o.createVNode(g,{class:""},{default:o.withCtx(()=>[o.createVNode(c,{class:"text-h6 font-weight-600 d-flex justify-center align-center py-4"},{default:o.withCtx(()=>[o.createVNode(n,{color:"warning",icon:"mdi-alert-circle",size:"small",class:"mr-2"}),o.createElementVNode("div",null,o.toDisplayString(a.title),1),o.createVNode(s,{icon:"",density:"compact",variant:"plain",class:"position-absolute top-0 right-0 mt-2 mr-2",onClick:l.handleClose},{default:o.withCtx(()=>e[1]||(e[1]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[1]},8,["onClick"])]),_:1}),o.createVNode(m,{class:"py-4 text-center"},{default:o.withCtx(()=>[o.createElementVNode("p",Cu,o.toDisplayString(a.tips),1),o.createElementVNode("p",zu,o.toDisplayString(t.$t("tips.doYouWantToContinue")),1)]),_:1}),o.createVNode(d,{class:"w-100 d-flex justify-center align-center ga-8 py-6"},{default:o.withCtx(()=>[o.createVNode(s,{variant:"tonal",class:"text-none text-body-1",height:"32",onClick:l.handleClose},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.cancel")),1)]),_:1},8,["onClick"]),o.createVNode(s,{loading:a.loading,variant:"flat",color:"danger",class:"text-none text-body-1",height:"32",onClick:l.handleDelete},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.delete")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const Su=K(vu,[["render",_u]]),kb="",Ab="",Pu={name:"IdmMarker",components:{IdmDrawMarker:ou,IdmImportMarker:bu,IdmGroupDialog:Lu,DeleteDialog:Su},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:0},paddingTop:{type:Number,default:8},menuToggle:{type:Object,default:{}}},emits:["map","menuToggle","theme","login"],setup(){return{Theme:be.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",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.markerLayers,this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.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(t){this.drawDialog=!1,this.importDialog=!1,this.currentGroup=t,this.groupDialog=!0},handleSaveGroup(){this.fetchAllLayers(),this.groupDialog=!1,this.currentGroup=void 0},handleOpenDelete(t,e){t==="group"?(this.currentGroup=e,this.currentLayer=void 0):t==="layer"&&(this.currentGroup=void 0,this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){var t;this.currentGroup?this.handleDeleteGroup((t=this.currentGroup)==null?void 0:t.id):this.currentLayer&&this.handleDeleteLayer(this.currentLayer)},async handleDeleteGroup(t){t&&(this.deleteLoading=!0,await de.delete(`${this.gateway}/api/arc/lygroups/${t}`,{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(t){this.handleCloseDraw(),this.currentGroup=t||this.layerGroup.find(e=>e.name==="Custom Layers"),this.importDialog=!1,this.drawDialog=!0},handleOpenImportDialog(t){this.drawDialog=!1,this.handleCloseDraw(),this.currentGroup=t||void 0,this.importDialog=!0},handleImportLayer(t){this.fetchAllLayers(),this.importDialog=!1},handleSaveMarker(t){this.fetchAllLayers(),this.drawDialog=!1,this.currentLayer=null},handleCloseDraw(){this.drawDialog=!1,this.currentLayer=null,this.autoActive&&this.handleDrawAllLayers(),this.currentGroup=void 0},handleEditLayer(t,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=t,this.currentLayer=e,this.drawDialog=!0},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await de.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken,version:"new"}}).then(t=>{var e,a,r,i,l,n;if(((e=t.data)==null?void 0:e.code)===0){this.loading=!1,this.layerGroup=((i=(r=(a=t.data)==null?void 0:a.data)==null?void 0:r.rows)==null?void 0:i.reverse())||[];const s=[];(l=this.layerGroup)==null||l.forEach(c=>{var m;c.show=!0,(m=c.layers)==null||m.forEach(d=>{var u;d.layerGroupId=c.id;const g=typeof d.extend=="string"?JSON.parse(d.extend):d.extend;(u=g==null?void 0:g.features)==null||u.forEach(f=>{f.properties.lgId=c.id,f.properties.layerId=d.id,f.properties.name||(f.properties.name=d.name)}),s.push(d)})}),this.layers=s,this.handleDrawAllLayers(),(n=this.$refs.drawDialog)==null||n.handleClearDraw()}}).catch(()=>{this.loading=!1})},async handleDeleteLayer(t){this.deleteLoading=!0,await de.delete(`${this.gateway}/api/arc/layers/${t.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(t){if(!this.map||!(t!=null&&t.extend))return;const e=typeof t.extend=="string"?JSON.parse(t.extend):t.extend;if(!e)return;const a=`marker-layer-${t.id}`;this.handleClearLayerMarkers(t.id);const r=e.features||(e.type==="Feature"?[e]:[]);if(r.some(s=>{var c,m;return(((c=s.geometry)==null?void 0:c.type)==="Point"||((m=s.geometry)==null?void 0:m.type)==="MultiPoint")&&s.properties.shape==="point"})){const s=[];r.forEach(c=>{var u,f,p,h;const m=(u=c.geometry)==null?void 0:u.type,d=((f=c.properties)==null?void 0:f.name)||"",g=((p=c.properties)==null?void 0:p.color)||t.color||((h=this.Theme.current.value.colors)==null?void 0:h["map-green"]);if(m==="Point"){const[y,k]=c.geometry.coordinates,x=`<div style="font-size:12px;line-height:1.5;">
|
|
422
422
|
<div style="font-weight:600;">${d}</div>
|
|
423
423
|
<div>${P.LngLatHelper.lat2pretty(k,4).pretty}, ${P.LngLatHelper.lng2pretty(y,4).pretty}</div>
|
|
424
424
|
</div>`,b=new pe.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(x),A=new pe.Marker({color:g}).setLngLat([y,k]).addTo(this.map),L=A.getElement();L.addEventListener("mouseenter",()=>b.setLngLat([y,k]).addTo(this.map)),L.addEventListener("mouseleave",()=>b.remove()),s.push(A)}else m==="MultiPoint"&&c.geometry.coordinates.forEach(([y,k])=>{const x=`<div style="font-size:12px;line-height:1.5;">
|
|
425
425
|
<div style="font-weight:600;">${d}</div>
|
|
426
426
|
<div>${P.LngLatHelper.lat2pretty(k,4).pretty}, ${P.LngLatHelper.lng2pretty(y,4).pretty}</div>
|
|
427
|
-
</div>`,b=new pe.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(x),A=new pe.Marker({color:g}).setLngLat([y,k]).addTo(this.map),L=A.getElement();L.addEventListener("mouseenter",()=>b.setLngLat([y,k]).addTo(this.map)),L.addEventListener("mouseleave",()=>b.remove()),s.push(A)})}),this.layerMarkers[t.id]=s}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(s=>{var c;return l.add((c=s.geometry)==null?void 0:c.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(t=>{this.handleRenderLayer(t)}),this.drawnLayerIds=this.layers.map(t=>t.id))},handleClearAllLayers(){this.map&&(Object.keys(this.layerMarkers).forEach(t=>{this.handleClearLayerMarkers(t)}),this.drawnLayerIds.forEach(t=>{const e=`marker-layer-${t}`;[`${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(t){if(!this.map||!t)return;this.handleClearLayerMarkers(t);const e=`marker-layer-${t}`;[`${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(t){const e=this.layerMarkers[t];e&&(e.forEach(a=>a.remove()),delete this.layerMarkers[t])},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)})}}},Nu={class:"idm-gl4-marker"},Mu={class:"w-100 px-4 d-flex flex-column justify-start align-start"},Tu={class:"w-100 header-box d-flex justify-space-between align-center pr-4"},Vu={class:"d-flex justify-start align-center ga-3"},Eu={class:"text-h5 font-weight-medium"},Ru={class:"search-box w-100 mb-3"},Du={class:"multi-color-icon",style:{height:"20px",width:"20px"},"aria-hidden":"true"},Bu={key:0,class:"w-100 d-flex justify-space-between align-center ga-4"},Iu={key:0,class:"w-100 d-flex justify-center align-center",style:{height:"200px"}},Fu={key:1,class:"w-100 d-flex justify-center align-center"},Gu={class:"text-body-1"},ju={key:2,class:"list-box w-100 flex-1-1-0 px-4 pb-2 scroll overflow-y-auto"},Wu={class:"group-label text-body-1 d-flex justify-space-between align-center py-4"},Zu={class:"d-flex justify-start align-center pl-2 cursor-pointer"},Hu=["onClick"],Xu={key:0},Ou={key:0,class:"layer-list flex-1-1-0 overflow-y-hidden pb-2"},Yu={class:"d-flex align-center justify-start ga-2"},Uu={class:"font-weight-600 layer-name"},Ju={key:0,class:"layer-actions d-flex align-center justify-end ga-1"};function Ku(t,e,a,r,i,l){var C;const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VSwitch"),m=o.resolveComponent("VIcon"),d=o.resolveComponent("VTextField"),g=o.resolveComponent("VProgressCircular"),u=o.resolveComponent("VChip"),f=o.resolveComponent("VListItemTitle"),p=o.resolveComponent("VListItem"),h=o.resolveComponent("VList"),y=o.resolveComponent("VCard"),k=o.resolveComponent("VMenu"),x=o.resolveComponent("VDivider"),b=o.resolveComponent("IdmDrawMarker"),A=o.resolveComponent("IdmImportMarker"),L=o.resolveComponent("IdmGroupDialog"),v=o.resolveComponent("DeleteDialog");return o.openBlock(),o.createElementBlock("div",Nu,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+206+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("marker.markers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:_})=>[o.createVNode(n,o.mergeProps(_,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[7]||(e[7]=[o.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),o.createElementVNode("div",{class:o.normalizeClass(["main-box transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:o.normalizeStyle(l.listStyle)},[o.createElementVNode("div",Mu,[o.createElementVNode("div",Tu,[o.createElementVNode("div",Vu,[o.createElementVNode("div",Eu,o.toDisplayString(t.$t("marker.markers")),1),o.createVNode(c,{modelValue:i.autoActive,"onUpdate:modelValue":e[0]||(e[0]=_=>i.autoActive=_),class:"small-switch",inset:"",color:"primary","base-color":"disabled","hide-details":""},null,8,["modelValue"]),o.createVNode(n,{class:"ml-n8",density:"compact",icon:"",variant:"text",onClick:l.fetchAllLayers},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-refresh"})]),_:1},8,["onClick"])]),o.createVNode(n,{class:"mr-n6",density:"comfortable",icon:"",variant:"plain",onClick:l.handleMenuToggle},{default:o.withCtx(()=>e[8]||(e[8]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[8]},8,["onClick"])]),o.createElementVNode("div",Ru,[o.createVNode(d,{modelValue:i.keyword,"onUpdate:modelValue":e[1]||(e[1]=_=>i.keyword=_),"clear-icon":"mdi-close",clearable:"",density:"compact","hide-details":"",variant:"outlined",autocomplete:"off",class:"input-btn-bg-1"},{"prepend-inner":o.withCtx(()=>[(o.openBlock(),o.createElementBlock("svg",Du,e[9]||(e[9]=[o.createElementVNode("use",{"xlink:href":"#icon-search"},null,-1)])))]),_:1},8,["modelValue"])]),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Bu,[o.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]=_=>l.handleOpenDrawMarkers())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.add")),1)]),_:1}),o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.import")),1)]),_:1},8,["onClick"])]))]),i.loading?(o.openBlock(),o.createElementBlock("div",Iu,[o.createVNode(g,{color:"primary",indeterminate:"",size:"36",width:"4"})])):i.layerGroup.length===0?(o.openBlock(),o.createElementBlock("div",Fu,[o.createElementVNode("div",Gu,o.toDisplayString(t.$t("tips.noData")),1)])):(o.openBlock(),o.createElementBlock("div",ju,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.layerGroup,(_,N)=>{var M;return o.openBlock(),o.createElementBlock("div",{key:_.name,class:o.normalizeClass(["btn-bg-1",_.index===i.layerGroup.length?"rounded-b":_.index===1?"rounded-t":""])},[o.createElementVNode("div",Wu,[o.createElementVNode("div",Zu,[_.show?(o.openBlock(),o.createBlock(m,{key:0,icon:"mdi-chevron-down",onClick:T=>_.show=!1},null,8,["onClick"])):(o.openBlock(),o.createBlock(m,{key:1,icon:"mdi-chevron-right",onClick:T=>_.show=!0},null,8,["onClick"])),i.loading?(o.openBlock(),o.createBlock(g,{key:3,class:"mx-2",color:"primary",indeterminate:"",size:"16",width:"2"})):(o.openBlock(),o.createBlock(u,{key:2,density:"compact",variant:"flat",class:"font-weight-600 mr-2",color:"primary",onClick:T=>_.show=!_.show},{default:o.withCtx(()=>{var T;return[o.createTextVNode(o.toDisplayString((T=_.layers)==null?void 0:T.length),1)]}),_:2},1032,["onClick"])),o.createElementVNode("div",{class:"",onClick:T=>_.show=!_.show},o.toDisplayString(_.name),9,Hu)]),_.name!=="Custom Layers"&&!a.simple?(o.openBlock(),o.createElementBlock("div",Xu,[o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mx-1"},{default:o.withCtx(()=>[e[10]||(e[10]=o.createElementVNode("i",{class:"iconfont icon-dots-vertical text-h4 cursor-pointer"},null,-1)),o.createVNode(k,{activator:"parent","min-width":"240",class:"drop-menu"},{default:o.withCtx(()=>[o.createVNode(y,{class:"pa-2 px-0"},{default:o.withCtx(()=>[o.createVNode(h,{class:""},{default:o.withCtx(()=>[o.createVNode(p,{value:"account",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:o.withCtx(()=>[o.createVNode(f,{class:"text-body-1 d-flex jusity-center align-center",onClick:T=>l.handleOpenDrawMarkers(_)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-plus-circle-outline mr-4",size:"16"}),o.createElementVNode("span",null,o.toDisplayString(t.$t("actions.addMarker")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(p,{value:"help",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:o.withCtx(()=>[o.createVNode(f,{class:"text-body-1 d-flex jusity-center align-center",onClick:T=>l.handleEditGroup(_)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-pencil mr-4",size:"16"}),o.createElementVNode("span",null,o.toDisplayString(t.$t("actions.editGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(p,{value:"loginOut",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:o.withCtx(()=>[o.createVNode(f,{class:"text-body-1 d-flex jusity-center align-center",onClick:T=>l.handleOpenDelete("group",_)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-trash-can-outline mr-4",size:"16"}),o.createElementVNode("span",null,o.toDisplayString(t.$t("actions.deleteGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2,__:[10]},1024)])):o.createCommentVNode("",!0)]),_.show?(o.openBlock(),o.createElementBlock("div",Ou,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((M=_.layers)==null?void 0:M.filter(T=>{var I;return((I=T.name)==null?void 0:I.indexOf(i.keyword))>-1}),T=>{var I;return o.openBlock(),o.createElementBlock("div",{key:T.id,class:o.normalizeClass(["layer-item pa-2 mx-2 rounded cursor-pointer d-flex align-center justify-space-between ga-4",((I=i.currentLayer)==null?void 0:I.id)===T.id?"active":""])},[o.createElementVNode("div",Yu,[o.createElementVNode("span",Uu,o.toDisplayString(T==null?void 0:T.name),1)]),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ju,[o.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:X=>l.handleEditLayer(_,T)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-pencil",size:"16"})]),_:2},1032,["onClick"]),o.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:X=>l.handleOpenDelete("layer",T)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-trash-can-outline",size:"16"})]),_:2},1032,["onClick"])]))],2)}),128))])):o.createCommentVNode("",!0),N<i.layerGroup.length-1?(o.openBlock(),o.createBlock(x,{key:1,class:"w-100",thickness:"1"})):o.createCommentVNode("",!0)],2)}),128))]))],6),i.drawDialog?(o.openBlock(),o.createBlock(b,{ref:"drawDialog",key:((C=i.currentLayer)==null?void 0:C.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"])):o.createCommentVNode("",!0),i.importDialog?(o.openBlock(),o.createBlock(A,{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]=_=>{i.importDialog=!1,i.currentGroup=void 0}),onImport:l.handleImportLayer},null,8,["map","gateway","token","default-meteo-token","layer-group","group","onImport"])):o.createCommentVNode("",!0),o.createVNode(L,{modelValue:i.groupDialog,"onUpdate:modelValue":e[4]||(e[4]=_=>i.groupDialog=_),group:i.currentGroup,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,onClose:e[5]||(e[5]=_=>{i.groupDialog=!1,i.currentGroup=void 0}),onSaved:l.fetchAllLayers},null,8,["modelValue","group","gateway","token","default-meteo-token","onSaved"]),o.createVNode(v,{ref:"deleteDialog",title:t.$t("actions.delete"),tips:t.$t("tips.deleteText"),loading:i.deleteLoading,onDelete:e[6]||(e[6]=_=>l.confirmDelete())},null,8,["title","tips","loading"])])}const Qu=K(Pu,[["render",Ku]]);var R={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 qu(t="soft"){switch(R.session.__counterEpoch=(R.session.__counterEpoch||0)+1,t){case"auto":{R.session.styleMap=new Map,R.session.nodeMap=new Map;return}case"soft":{R.session.styleMap=new Map,R.session.nodeMap=new Map,R.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{R.session.styleMap=new Map,R.session.nodeMap=new Map,R.session.styleCache=new WeakMap,R.computedStyle=new WeakMap,R.baseStyle=new Map,R.defaultStyle=new Map,R.image=new Map,R.background=new Map,R.resource=new Map,R.font=new Set;return}default:{R.session.styleMap=new Map,R.session.nodeMap=new Map,R.session.styleCache=new WeakMap;return}}}function Yo(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let a=e[2].trim();return a.startsWith("#")?null:a}function $u(t){if(!t||t==="none")return"";let e=t.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 Ro(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ef(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:a=12}={}){let r=new Map,i=0;function l(n,s,c){if(i>=a)return;let m=Date.now();(r.get(s)||0)>m||(r.set(s,m+e),i++,n==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(n,s){l("warn",n,s)},errorOnce(n,s){l("error",n,s)},reset(){r.clear(),i=0}}}var da=ef("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Uo=new Map,Do=new Map;function tf(t){return/^data:|^blob:|^about:blank$/i.test(t)}function of(t,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(t,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 af(t,e){if(!e||tf(t)||of(t,e))return!1;try{let a=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(t,a);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function rf(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",Ro(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${Ro(t)}`;let a=e.includes("?")?"&":"?";return`${e}${a}url=${encodeURIComponent(t)}`}function ha(t){return new Promise((e,a)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>a(new Error("read_failed")),r.readAsDataURL(t)})}function lf(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function Ot(t,e={}){let a=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",l=e.errorTTL??8e3,n=e.headers||{},s=!!e.silent;if(/^data:/i.test(t))try{if(a==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(a==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,y="",k=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(y)?atob(k):decodeURIComponent(k),b=new Uint8Array([...x].map(L=>L.charCodeAt(0))),A=new Blob([b],{type:(y||"").split(";")[0]||""});return{ok:!0,data:A,status:200,url:t,fromCache:!1,mime:A.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let y=await fetch(t);if(!y.ok)return{ok:!1,data:null,status:y.status,url:t,fromCache:!1,reason:"http_error"};let k=await y.blob(),x=k.type||y.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await ha(k),status:y.status,url:t,fromCache:!1,mime:x}:a==="text"?{ok:!0,data:await k.text(),status:y.status,url:t,fromCache:!1,mime:x}:{ok:!0,data:k,status:y.status,url:t,fromCache:!1,mime:x}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return a==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:a==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=lf(t,{as:a,timeout:r,useProxy:i,errorTTL:l}),m=Do.get(c);if(m&&m.until>Date.now())return{...m.result,fromCache:!0};m&&Do.delete(c);let d=Uo.get(c);if(d)return d;let g=af(t,i)?rf(t,i):t,u=e.credentials;if(!u)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",k=new URL(t,y);u=typeof location<"u"&&k.origin===location.origin?"include":"omit"}catch{u="omit"}let f=new AbortController,p=setTimeout(()=>f.abort("timeout"),r),h=(async()=>{try{let y=await fetch(g,{signal:f.signal,credentials:u,headers:n});if(!y.ok){let b={ok:!1,data:null,status:y.status,url:g,fromCache:!1,reason:"http_error"};if(l>0&&Do.set(c,{until:Date.now()+l,result:b}),!s){let A=`${y.status} ${y.statusText||""}`.trim();da.warnOnce(`http:${y.status}:${a}:${new URL(t,(location==null?void 0:location.href)??"http://localhost/").origin}`,`HTTP error ${A} while fetching ${a} ${t}`)}return e.onError&&e.onError(b),b}if(a==="text")return{ok:!0,data:await y.text(),status:y.status,url:g,fromCache:!1};let k=await y.blob(),x=k.type||y.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await ha(k),status:y.status,url:g,fromCache:!1,mime:x}:{ok:!0,data:k,status:y.status,url:g,fromCache:!1,mime:x}}catch(y){let k=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:g,fromCache:!1,reason:k};if(!/^blob:/i.test(t)&&l>0&&Do.set(c,{until:Date.now()+l,result:x}),!s){let b=`${k}:${a}:${new URL(t,(location==null?void 0:location.href)??"http://localhost/").origin}`,A=k==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:k==="abort"?`Request aborted while fetching ${a} ${t}`:`Network/CORS issue while fetching ${a} ${t}. A proxy may be required`;da.errorOnce(b,A)}return e.onError&&e.onError(x),x}finally{clearTimeout(p),Uo.delete(c)}})();return Uo.set(c,h),h}async function pa(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let a=Yo(t);if(!a)return t;let r=Ro(a);if(R.background.has(r)){let i=R.background.get(r);return i?`url("${i}")`:"none"}try{let i=await Ot(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(R.background.set(r,i.data),`url("${i.data}")`):(R.background.set(r,null),"none")}catch{return R.background.set(r,null),"none"}}var nf=new Set(["meta","script","noscript","title","link","template"]),Jo=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 sf(t){if(t=String(t).toLowerCase(),Jo.has(t)){let l={};return R.defaultStyle.set(t,l),l}if(R.defaultStyle.has(t))return R.defaultStyle.get(t);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(t);a.style.all="initial",e.appendChild(a);let r=getComputedStyle(a),i={};for(let l of r){if(ga(l))continue;let n=r.getPropertyValue(l);i[l]=n}return e.removeChild(a),R.defaultStyle.set(t,i),i}var cf=/(?:^|-)(animation|transition)(?:-|$)/i,mf=/^(--|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,df=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 ga(t){let e=String(t).toLowerCase();return!!(df.has(e)||mf.test(e)||cf.test(e))}function Ko(t,e){if(e=String(e||"").toLowerCase(),Jo.has(e))return"";let a=[],r=sf(e);for(let[i,l]of Object.entries(t)){if(ga(i))continue;let n=r[i];l&&l!==n&&a.push(`${i}:${l}`)}return a.sort(),a.join(";")}function hf(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(a=>e.add(a.tagName.toLowerCase())),Array.from(e))}function pf(t){let e=new Map;for(let r of t){let i=R.defaultStyle.get(r);if(!i)continue;let l=Object.entries(i).map(([n,s])=>`${n}:${s};`).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} }
|
|
427
|
+
</div>`,b=new pe.Popup({offset:40,closeButton:!1,closeOnClick:!1,anchor:"bottom",className:"marker-popup-dark"}).setHTML(x),A=new pe.Marker({color:g}).setLngLat([y,k]).addTo(this.map),L=A.getElement();L.addEventListener("mouseenter",()=>b.setLngLat([y,k]).addTo(this.map)),L.addEventListener("mouseleave",()=>b.remove()),s.push(A)})}),this.layerMarkers[t.id]=s}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(s=>{var c;return l.add((c=s.geometry)==null?void 0:c.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(t=>{this.handleRenderLayer(t)}),this.drawnLayerIds=this.layers.map(t=>t.id))},handleClearAllLayers(){this.map&&(Object.keys(this.layerMarkers).forEach(t=>{this.handleClearLayerMarkers(t)}),this.drawnLayerIds.forEach(t=>{const e=`marker-layer-${t}`;[`${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(t){if(!this.map||!t)return;this.handleClearLayerMarkers(t);const e=`marker-layer-${t}`;[`${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(t){const e=this.layerMarkers[t];e&&(e.forEach(a=>a.remove()),delete this.layerMarkers[t])},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)})}}},Nu={class:"idm-gl4-marker"},Mu={class:"w-100 px-4 d-flex flex-column justify-start align-start"},Tu={class:"w-100 header-box d-flex justify-space-between align-center pr-4"},Vu={class:"d-flex justify-start align-center ga-3"},Eu={class:"text-h5 font-weight-medium"},Ru={class:"search-box w-100 mb-3"},Du={class:"multi-color-icon",style:{height:"20px",width:"20px"},"aria-hidden":"true"},Bu={key:0,class:"w-100 d-flex justify-space-between align-center ga-4"},Iu={key:0,class:"w-100 d-flex justify-center align-center",style:{height:"200px"}},Fu={key:1,class:"w-100 d-flex justify-center align-center"},Gu={class:"text-body-1"},ju={key:2,class:"list-box w-100 flex-1-1-0 px-4 pb-2 scroll overflow-y-auto"},Wu={class:"group-label text-body-1 d-flex justify-space-between align-center py-4"},Zu={class:"d-flex justify-start align-center pl-2 cursor-pointer"},Hu=["onClick"],Xu={key:0},Ou={key:0,class:"layer-list flex-1-1-0 overflow-y-hidden pb-2"},Yu={class:"d-flex align-center justify-start ga-2"},Uu={class:"font-weight-600 layer-name"},Ju={key:0,class:"layer-actions d-flex align-center justify-end ga-1"};function Ku(t,e,a,r,i,l){var C;const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VSwitch"),m=o.resolveComponent("VIcon"),d=o.resolveComponent("VTextField"),g=o.resolveComponent("VProgressCircular"),u=o.resolveComponent("VChip"),f=o.resolveComponent("VListItemTitle"),p=o.resolveComponent("VListItem"),h=o.resolveComponent("VList"),y=o.resolveComponent("VCard"),k=o.resolveComponent("VMenu"),x=o.resolveComponent("VDivider"),b=o.resolveComponent("IdmDrawMarker"),A=o.resolveComponent("IdmImportMarker"),L=o.resolveComponent("IdmGroupDialog"),v=o.resolveComponent("DeleteDialog");return o.openBlock(),o.createElementBlock("div",Nu,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+206+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("marker.markers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:_})=>[o.createVNode(n,o.mergeProps(_,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.toggle?"bg-primary active-border":""],onClick:l.handleMenuToggle}),{default:o.withCtx(()=>e[7]||(e[7]=[o.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),o.createElementVNode("div",{class:o.normalizeClass(["main-box transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:o.normalizeStyle(l.listStyle)},[o.createElementVNode("div",Mu,[o.createElementVNode("div",Tu,[o.createElementVNode("div",Vu,[o.createElementVNode("div",Eu,o.toDisplayString(t.$t("marker.markers")),1),o.createVNode(c,{modelValue:i.autoActive,"onUpdate:modelValue":e[0]||(e[0]=_=>i.autoActive=_),class:"small-switch",inset:"",color:"primary","base-color":"disabled","hide-details":""},null,8,["modelValue"]),o.createVNode(n,{class:"ml-n8",density:"compact",icon:"",variant:"text",onClick:l.fetchAllLayers},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-refresh"})]),_:1},8,["onClick"])]),o.createVNode(n,{class:"mr-n6",density:"comfortable",icon:"",variant:"plain",onClick:l.handleMenuToggle},{default:o.withCtx(()=>e[8]||(e[8]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[8]},8,["onClick"])]),o.createElementVNode("div",Ru,[o.createVNode(d,{modelValue:i.keyword,"onUpdate:modelValue":e[1]||(e[1]=_=>i.keyword=_),"clear-icon":"mdi-close",clearable:"",density:"compact","hide-details":"",variant:"outlined",autocomplete:"off",class:"input-btn-bg-1"},{"prepend-inner":o.withCtx(()=>[(o.openBlock(),o.createElementBlock("svg",Du,e[9]||(e[9]=[o.createElementVNode("use",{"xlink:href":"#icon-search"},null,-1)])))]),_:1},8,["modelValue"])]),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Bu,[o.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]=_=>l.handleOpenDrawMarkers())},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.add")),1)]),_:1}),o.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:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("actions.import")),1)]),_:1},8,["onClick"])]))]),i.loading?(o.openBlock(),o.createElementBlock("div",Iu,[o.createVNode(g,{color:"primary",indeterminate:"",size:"36",width:"4"})])):i.layerGroup.length===0?(o.openBlock(),o.createElementBlock("div",Fu,[o.createElementVNode("div",Gu,o.toDisplayString(t.$t("tips.noData")),1)])):(o.openBlock(),o.createElementBlock("div",ju,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.layerGroup,(_,N)=>{var M;return o.openBlock(),o.createElementBlock("div",{key:_.name,class:o.normalizeClass(["btn-bg-1",_.index===i.layerGroup.length?"rounded-b":_.index===1?"rounded-t":""])},[o.createElementVNode("div",Wu,[o.createElementVNode("div",Zu,[_.show?(o.openBlock(),o.createBlock(m,{key:0,icon:"mdi-chevron-down",onClick:T=>_.show=!1},null,8,["onClick"])):(o.openBlock(),o.createBlock(m,{key:1,icon:"mdi-chevron-right",onClick:T=>_.show=!0},null,8,["onClick"])),i.loading?(o.openBlock(),o.createBlock(g,{key:3,class:"mx-2",color:"primary",indeterminate:"",size:"16",width:"2"})):(o.openBlock(),o.createBlock(u,{key:2,density:"compact",variant:"flat",class:"font-weight-600 mr-2",color:"primary",onClick:T=>_.show=!_.show},{default:o.withCtx(()=>{var T;return[o.createTextVNode(o.toDisplayString((T=_.layers)==null?void 0:T.length),1)]}),_:2},1032,["onClick"])),o.createElementVNode("div",{class:"",onClick:T=>_.show=!_.show},o.toDisplayString(_.name),9,Hu)]),_.name!=="Custom Layers"&&!a.simple?(o.openBlock(),o.createElementBlock("div",Xu,[o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mx-1"},{default:o.withCtx(()=>[e[10]||(e[10]=o.createElementVNode("i",{class:"iconfont icon-dots-vertical text-h4 cursor-pointer"},null,-1)),o.createVNode(k,{activator:"parent","min-width":"240",class:"drop-menu"},{default:o.withCtx(()=>[o.createVNode(y,{class:"pa-2 px-0"},{default:o.withCtx(()=>[o.createVNode(h,{class:""},{default:o.withCtx(()=>[o.createVNode(p,{value:"account",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:o.withCtx(()=>[o.createVNode(f,{class:"text-body-1 d-flex jusity-center align-center",onClick:T=>l.handleOpenDrawMarkers(_)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-plus-circle-outline mr-4",size:"16"}),o.createElementVNode("span",null,o.toDisplayString(t.$t("actions.addMarker")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(p,{value:"help",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:o.withCtx(()=>[o.createVNode(f,{class:"text-body-1 d-flex jusity-center align-center",onClick:T=>l.handleEditGroup(_)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-pencil mr-4",size:"16"}),o.createElementVNode("span",null,o.toDisplayString(t.$t("actions.editGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024),o.createVNode(p,{value:"loginOut",variant:"flat",rounded:"",height:"38","min-height":"38"},{default:o.withCtx(()=>[o.createVNode(f,{class:"text-body-1 d-flex jusity-center align-center",onClick:T=>l.handleOpenDelete("group",_)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-trash-can-outline mr-4",size:"16"}),o.createElementVNode("span",null,o.toDisplayString(t.$t("actions.deleteGroup")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2,__:[10]},1024)])):o.createCommentVNode("",!0)]),_.show?(o.openBlock(),o.createElementBlock("div",Ou,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((M=_.layers)==null?void 0:M.filter(T=>{var I;return((I=T.name)==null?void 0:I.indexOf(i.keyword))>-1}),T=>{var I;return o.openBlock(),o.createElementBlock("div",{key:T.id,class:o.normalizeClass(["layer-item pa-2 mx-2 rounded cursor-pointer d-flex align-center justify-space-between ga-4",((I=i.currentLayer)==null?void 0:I.id)===T.id?"active":""])},[o.createElementVNode("div",Yu,[o.createElementVNode("span",Uu,o.toDisplayString(T==null?void 0:T.name),1)]),a.simple?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ju,[o.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:X=>l.handleEditLayer(_,T)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-pencil",size:"16"})]),_:2},1032,["onClick"]),o.createVNode(n,{class:"",density:"compact",icon:"",variant:"text",onClick:X=>l.handleOpenDelete("layer",T)},{default:o.withCtx(()=>[o.createVNode(m,{icon:"mdi-trash-can-outline",size:"16"})]),_:2},1032,["onClick"])]))],2)}),128))])):o.createCommentVNode("",!0),N<i.layerGroup.length-1?(o.openBlock(),o.createBlock(x,{key:1,class:"w-100",thickness:"1"})):o.createCommentVNode("",!0)],2)}),128))]))],6),i.drawDialog?(o.openBlock(),o.createBlock(b,{ref:"drawDialog",key:((C=i.currentLayer)==null?void 0:C.id)||"new",map:a.map,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,"edit-layer":i.currentLayer,group:i.currentGroup,right:i.right,onClose:l.handleCloseDraw,onSave:l.handleSaveMarker,onHideLayer:l.handleClearLayer},null,8,["map","gateway","token","default-meteo-token","edit-layer","group","right","onClose","onSave","onHideLayer"])):o.createCommentVNode("",!0),i.importDialog?(o.openBlock(),o.createBlock(A,{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]=_=>{i.importDialog=!1,i.currentGroup=void 0}),onImport:l.handleImportLayer},null,8,["map","gateway","token","default-meteo-token","layer-group","group","onImport"])):o.createCommentVNode("",!0),o.createVNode(L,{modelValue:i.groupDialog,"onUpdate:modelValue":e[4]||(e[4]=_=>i.groupDialog=_),group:i.currentGroup,gateway:a.gateway,token:a.token,"default-meteo-token":a.defaultMeteoToken,onClose:e[5]||(e[5]=_=>{i.groupDialog=!1,i.currentGroup=void 0}),onSaved:l.fetchAllLayers},null,8,["modelValue","group","gateway","token","default-meteo-token","onSaved"]),o.createVNode(v,{ref:"deleteDialog",title:t.$t("actions.delete"),tips:t.$t("tips.deleteText"),loading:i.deleteLoading,onDelete:e[6]||(e[6]=_=>l.confirmDelete())},null,8,["title","tips","loading"])])}const Qu=K(Pu,[["render",Ku]]);var R={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 qu(t="soft"){switch(R.session.__counterEpoch=(R.session.__counterEpoch||0)+1,t){case"auto":{R.session.styleMap=new Map,R.session.nodeMap=new Map;return}case"soft":{R.session.styleMap=new Map,R.session.nodeMap=new Map,R.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{R.session.styleMap=new Map,R.session.nodeMap=new Map,R.session.styleCache=new WeakMap,R.computedStyle=new WeakMap,R.baseStyle=new Map,R.defaultStyle=new Map,R.image=new Map,R.background=new Map,R.resource=new Map,R.font=new Set;return}default:{R.session.styleMap=new Map,R.session.nodeMap=new Map,R.session.styleCache=new WeakMap;return}}}function Yo(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let a=e[2].trim();return a.startsWith("#")?null:a}function $u(t){if(!t||t==="none")return"";let e=t.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 Ro(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}function ef(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:a=12}={}){let r=new Map,i=0;function l(n,s,c){if(i>=a)return;let m=Date.now();(r.get(s)||0)>m||(r.set(s,m+e),i++,n==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(n,s){l("warn",n,s)},errorOnce(n,s){l("error",n,s)},reset(){r.clear(),i=0}}}var da=ef("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),Uo=new Map,Do=new Map;function tf(t){return/^data:|^blob:|^about:blank$/i.test(t)}function of(t,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(t,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 af(t,e){if(!e||tf(t)||of(t,e))return!1;try{let a=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(t,a);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!e}}function rf(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",Ro(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${Ro(t)}`;let a=e.includes("?")?"&":"?";return`${e}${a}url=${encodeURIComponent(t)}`}function ha(t){return new Promise((e,a)=>{let r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>a(new Error("read_failed")),r.readAsDataURL(t)})}function lf(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function Ot(t,e={}){let a=e.as??"blob",r=e.timeout??3e3,i=e.useProxy||"",l=e.errorTTL??8e3,n=e.headers||{},s=!!e.silent;if(/^data:/i.test(t))try{if(a==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(a==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,y="",k=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(y)?atob(k):decodeURIComponent(k),b=new Uint8Array([...x].map(L=>L.charCodeAt(0))),A=new Blob([b],{type:(y||"").split(";")[0]||""});return{ok:!0,data:A,status:200,url:t,fromCache:!1,mime:A.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let y=await fetch(t);if(!y.ok)return{ok:!1,data:null,status:y.status,url:t,fromCache:!1,reason:"http_error"};let k=await y.blob(),x=k.type||y.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await ha(k),status:y.status,url:t,fromCache:!1,mime:x}:a==="text"?{ok:!0,data:await k.text(),status:y.status,url:t,fromCache:!1,mime:x}:{ok:!0,data:k,status:y.status,url:t,fromCache:!1,mime:x}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return a==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:a==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=lf(t,{as:a,timeout:r,useProxy:i,errorTTL:l}),m=Do.get(c);if(m&&m.until>Date.now())return{...m.result,fromCache:!0};m&&Do.delete(c);let d=Uo.get(c);if(d)return d;let g=af(t,i)?rf(t,i):t,u=e.credentials;if(!u)try{let y=typeof location<"u"&&location.href?location.href:"http://localhost/",k=new URL(t,y);u=typeof location<"u"&&k.origin===location.origin?"include":"omit"}catch{u="omit"}let f=new AbortController,p=setTimeout(()=>f.abort("timeout"),r),h=(async()=>{try{let y=await fetch(g,{signal:f.signal,credentials:u,headers:n});if(!y.ok){let b={ok:!1,data:null,status:y.status,url:g,fromCache:!1,reason:"http_error"};if(l>0&&Do.set(c,{until:Date.now()+l,result:b}),!s){let A=`${y.status} ${y.statusText||""}`.trim();da.warnOnce(`http:${y.status}:${a}:${new URL(t,(location==null?void 0:location.href)??"http://localhost/").origin}`,`HTTP error ${A} while fetching ${a} ${t}`)}return e.onError&&e.onError(b),b}if(a==="text")return{ok:!0,data:await y.text(),status:y.status,url:g,fromCache:!1};let k=await y.blob(),x=k.type||y.headers.get("content-type")||"";return a==="dataURL"?{ok:!0,data:await ha(k),status:y.status,url:g,fromCache:!1,mime:x}:{ok:!0,data:k,status:y.status,url:g,fromCache:!1,mime:x}}catch(y){let k=y&&typeof y=="object"&&"name"in y&&y.name==="AbortError"?String(y.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:g,fromCache:!1,reason:k};if(!/^blob:/i.test(t)&&l>0&&Do.set(c,{until:Date.now()+l,result:x}),!s){let b=`${k}:${a}:${new URL(t,(location==null?void 0:location.href)??"http://localhost/").origin}`,A=k==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${t}`:k==="abort"?`Request aborted while fetching ${a} ${t}`:`Network/CORS issue while fetching ${a} ${t}. A proxy may be required`;da.errorOnce(b,A)}return e.onError&&e.onError(x),x}finally{clearTimeout(p),Uo.delete(c)}})();return Uo.set(c,h),h}async function pa(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let a=Yo(t);if(!a)return t;let r=Ro(a);if(R.background.has(r)){let i=R.background.get(r);return i?`url("${i}")`:"none"}try{let i=await Ot(r,{as:"dataURL",useProxy:e.useProxy});return i.ok?(R.background.set(r,i.data),`url("${i.data}")`):(R.background.set(r,null),"none")}catch{return R.background.set(r,null),"none"}}var nf=new Set(["meta","script","noscript","title","link","template"]),Jo=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 sf(t){if(t=String(t).toLowerCase(),Jo.has(t)){let l={};return R.defaultStyle.set(t,l),l}if(R.defaultStyle.has(t))return R.defaultStyle.get(t);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(t);a.style.all="initial",e.appendChild(a);let r=getComputedStyle(a),i={};for(let l of r){if(ga(l))continue;let n=r.getPropertyValue(l);i[l]=n}return e.removeChild(a),R.defaultStyle.set(t,i),i}var cf=/(?:^|-)(animation|transition)(?:-|$)/i,mf=/^(--|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,df=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 ga(t){let e=String(t).toLowerCase();return!!(df.has(e)||mf.test(e)||cf.test(e))}function Ko(t,e){if(e=String(e||"").toLowerCase(),Jo.has(e))return"";let a=[],r=sf(e);for(let[i,l]of Object.entries(t)){if(ga(i))continue;let n=r[i];l&&l!==n&&a.push(`${i}:${l}`)}return a.sort(),a.join(";")}function hf(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(a=>e.add(a.tagName.toLowerCase())),Array.from(e))}function pf(t){let e=new Map;for(let r of t){let i=R.defaultStyle.get(r);if(!i)continue;let l=Object.entries(i).map(([n,s])=>`${n}:${s};`).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} }
|
|
428
428
|
`;return a}function gf(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),a=new Map,r=1;for(let i of e)a.set(i,`c${r++}`);return a}function ua(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let a=R.computedStyle.get(t);if(a||(a=new Map,R.computedStyle.set(t,a)),!a.has(e)){let r=window.getComputedStyle(t,e);a.set(e,r)}return a.get(e)}function fa(t){let e={};for(let a of t)e[a]=t.getPropertyValue(a);return e}function ya(t){let e=[],a=0,r=0;for(let i=0;i<t.length;i++){let l=t[i];l==="("&&a++,l===")"&&a--,l===","&&a===0&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e}var uf=[/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__||{}),Qo=[];function ff(t){let e=Array.isArray(t)?t:[t];for(let a of e)a instanceof RegExp?Qo.push(a):typeof a=="string"?Qo.push(new RegExp(a,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",a)}function Ut(t){let e=typeof t=="string"?t:"",a=[...uf,...Qo];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 yf(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var ba=new Map;function bf(t=""){let e=Object.create(null),a=String(t||""),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 wf(t,e,a){let r=String(t||""),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),s="outlined";/\brounded\b/.test(l)||/\bround\b/.test(l)?s="rounded":/\bsharp\b/.test(l)?s="sharp":/\boutlined\b/.test(l)&&(s="outlined");let c=n===1,m=null;if(c&&(s==="outlined"&&oo.materialIconsFilled?m={url:oo.materialIconsFilled,alias:"snapdom-mi-filled"}:s==="rounded"&&oo.materialIconsRound?m={url:oo.materialIconsRound,alias:"snapdom-mi-round"}:s==="sharp"&&oo.materialIconsSharp&&(m={url:oo.materialIconsSharp,alias:"snapdom-mi-sharp"})),!m)return{familyForMeasure:r,familyForCanvas:r};if(!ba.has(m.alias))try{let g=new FontFace(m.alias,`url(${m.url})`,{style:"normal",weight:"400"});document.fonts.add(g),await g.load(),ba.set(m.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let d=`"${m.alias}"`;return{familyForMeasure:d,familyForCanvas:d}}async function xf(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function kf(t){var i,l;let e=((i=t.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=t.color)==null?void 0:l.trim();return r&&r!=="inherit"?r:"#000"}async function Af(t,{family:e="Material Icons",weight:a="normal",fontSize:r=32,color:i="#000",variation:l="",className:n=""}={}){let s=String(e||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,m=bf(l),{familyForMeasure:d,familyForCanvas:g}=await wf(s,n,m);await xf(g.replace(/^["']+|["']+$/g,""),r);let u=document.createElement("span");u.textContent=t,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 f=u.getBoundingClientRect(),p=Math.max(1,Math.ceil(f.width)),h=Math.max(1,Math.ceil(f.height));document.body.removeChild(u);let y=document.createElement("canvas");y.width=p*c,y.height=h*c;let k=y.getContext("2d");k.scale(c,c),k.font=`${a?`${a} `:""}${r}px ${g}`,k.textAlign="left",k.textBaseline="top",k.fillStyle=i;try{k.fontKerning="normal"}catch{}return k.fillText(t,0,0),{dataUrl:y.toDataURL(),width:p,height:h}}async function Lf(t,e){if(!(t instanceof Element))return 0;let a='.material-icons, [class*="material-symbols"]',r=Array.from(t.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 s=r[n],c=i[n]||null;try{let m=getComputedStyle(c||s),d=m.fontFamily||"Material Icons";if(!yf(d))continue;let g=(c||s).textContent.trim();if(!g)continue;let u=parseInt(m.fontSize,10)||24,f=m.fontWeight&&m.fontWeight!=="normal"?m.fontWeight:"normal",p=kf(m),h=m.fontVariationSettings&&m.fontVariationSettings!=="normal"?m.fontVariationSettings:"",y=(c||s).className||"",{dataUrl:k,width:x,height:b}=await Af(g,{family:d,weight:f,fontSize:u,color:p,variation:h,className:y});s.textContent="";let A=s.ownerDocument.createElement("img");A.src=k,A.alt=g,A.style.height=`${u}px`,A.style.width=`${Math.max(1,Math.round(x/b*u))}px`,A.style.objectFit="contain",A.style.verticalAlign=getComputedStyle(s).verticalAlign||"baseline",s.appendChild(A),l++}catch{}}return l}async function vf(t,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=t,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 s=n.getBoundingClientRect(),c=Math.ceil(s.width),m=Math.ceil(s.height);document.body.removeChild(n);let d=document.createElement("canvas");d.width=Math.max(1,c*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(t,0,0),{dataUrl:d.toDataURL(),width:c,height:m}}var Cf=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Bo(t){if(!t)return"";for(let e of t.split(",")){let a=e.trim().replace(/^['"]+|['"]+$/g,"");if(a&&!Cf.has(a.toLowerCase()))return a}return""}function Io(t){let e=String(t??"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 Fo(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function zf(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function _f(t){let e=String(t||"400").trim(),a=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(a){let i=Io(a[1]),l=Io(a[2]);return{min:Math.min(i,l),max:Math.max(i,l)}}let r=Io(e);return{min:r,max:r}}function Sf(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Pf(t){let e=String(t||"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 Nf(t,e){if(!t)return!1;try{let a=new URL(t,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,"+"),s=l.toLowerCase().replace(/\s+/g,"-");if(i.includes(n)||i.includes(s))return!0}return!1}catch{return!1}}function Mf(t){var a;let e=new Set;for(let r of t||[]){let i=(a=String(r).split("__")[0])==null?void 0:a.trim();i&&e.add(i)}return e}function wa(t,e){return t&&t.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 qo=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Go=4;async function Tf(t,e,a){if(!t)return t;let r=new Set;function i(s,c){try{return new URL(s,c||location.href).href}catch{return s}}async function l(s,c,m=0){if(m>Go)return console.warn(`[snapDOM] @import depth exceeded (${Go}) at ${c}`),s;let d="",g=0,u;for(;u=qo.exec(s);){d+=s.slice(g,u.index),g=qo.lastIndex;let f=(u[2]||u[4]||"").trim(),p=i(f,c);if(r.has(p)){console.warn(`[snapDOM] Skipping circular @import: ${p}`);continue}r.add(p);let h="";try{let y=await Ot(p,{as:"text",useProxy:a,silent:!0});y.ok&&typeof y.data=="string"&&(h=y.data)}catch{}h?(h=wa(h,p),h=await l(h,p,m+1),d+=`
|
|
429
429
|
/* inlined: ${p} */
|
|
430
430
|
${h}
|