@idmwx/idmui-gl4 3.9.5 → 3.9.6

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.
@@ -620,7 +620,7 @@ ${a==="fragment"?`out vec4 fragColor;
620
620
  <path d="M10 2.5V17.5" stroke="${this.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
621
621
  <path d="M5 7.5L10 2.5L15 7.5" stroke="${this.color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
622
622
  </svg>`;n.src="data:image/svg+xml;base64,"+window.btoa(s);const c=[n];let m=0;c.forEach(d=>{d.onload=()=>{m++,this.map.hasImage("currentDirIcon")?this.map.updateImage("currentDirIcon",n):this.map.addImage("currentDirIcon",n),m===1&&!this.map.getLayer(this.directionLayer)&&this.map.addLayer({id:this.directionLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"currentDirIcon","icon-size":["interpolate",["linear"],["get","spd"],.5,.3,1,.5,1.5,.7,2,.8,3.5,1],"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,0],[360,360]]}},paint:{"icon-opacity":this.opacity}},this.beforeLayer)}}),i=new Date().valueOf()-(a+r)}}},handleClear(){this.map.getLayer(this.speedLayer)&&this.map.removeLayer(this.speedLayer),this.map.getLayer(this.speedLabelLayer)&&this.map.removeLayer(this.speedLabelLayer),this.map.getLayer(this.directionLayer)&&this.map.removeLayer(this.directionLayer),this.map.hasImage("currentDirIcon")&&this.map.removeImage("currentDirIcon"),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function Kc(t,e,a,r,i,l){return null}const Qc=Q(Jc,[["render",Kc]]),qc={name:"IdmCurrentParticle",components:{LegendBar:it},props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:[to,eo]}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0,wrapper:void 0,animation:void 0,particleContext:void 0,particleTexture:void 0,particleCount:this.simple?6e3:13e3,particleOptions:{fadeOpacity:.99,speedFactor:this.simple?1.2:2,dropRate:.005,dropRateBump:.01,uvRange:[-2.5,2.6],sRange:[0,3],scale:.3},paused:!1,initial:!0}},watch:{"factor.version":{async handler(){var t,e;(t=this.factor)!=null&&t.active?await this.handleRender():this.handleClear(),(e=this.factor)!=null&&e.particle||this.handleClearParticle()},immediate:!0},"factor.particle":{async handler(t,e){t!==e&&e!==void 0&&(t?(this.handleClear(),await this.handleRender()):this.handleClearParticle())}}},beforeUnmount(){this.handleClear()},methods:{async handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;await this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[current-particle] add elapsed: ",a,", total: ",e+=a)}},handleSetup(){var t;if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const e=[[0/255,"rgba(95, 143, 197,1)"],[5/255,"rgba(64,127,115,1)"],[10/255,"rgb(58,164,58)"],[15/255,"rgb(191,182,67)"],[20/255,"rgb(197,154,68)"],[30/255,"rgb(160,70,94)"],[40/255,"rgb(138,84,166)"],[45/255,"rgb(82,113,165)"],[50/255,"rgb(84,142,152)"],[65/255,"rgb(150,181,184)"],[80/255,"rgb(195,194,194)"],[254/255,"rgb(195,194,194)"],[1,"rgb(195,194,194)"]];this.rampColor=this.webgl.setup(this.context,e);const{program:a,aPositionBuffer:r}=this.webgl.bind(this.context,fe.vertexSchema,fe.uvFragmentSchema);this.program=a,this.aPositionBuffer=r}(t=this.factor)!=null&&t.particle&&this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){if(this.particleContext=this.webgl.createParticleContext(this.viewport.particleCanvas),!this.particleContext)return;const t=[[0,"rgb(183,224,224)"],[1,"rgb(199,202,202)"],[.6,"rgb(199,202,202)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,...at.getSources(this.webgl.isWebGL2(this.particleContext))),this.wrapper.color=this.webgl.setup(this.particleContext,t,!0,16,16),this.wrapper={...this.wrapper,...this.webgl.setupParticle(this.particleContext,this.particleCount),...this.webgl.resize(this.viewport,this.particleContext)},this.viewport.map.on("resize",this.handleResize),this.viewport.map.on("movestart",this.handlePause),this.viewport.map.on("moveend",this.handlePlay)}},async handleDraw(){var a;if(this.handleSetup(),!this.context)return;const t=this.context,e=this.factor.etime;if(this.etime!==e||this.particleContext&&!this.particleTexture){const r=await this.webgl.loadImg(this.factor.raw);if(this.context!==t||!((a=this.factor)!=null&&a.active)||this.factor.etime!==e)return;this.etime=e,this.context.deleteTexture(this.texture||null),this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,r),this.particleContext&&this.wrapper&&this.factor.particle&&(this.particleContext.deleteTexture(this.particleTexture||null),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.LINEAR,this.particleContext.CLAMP_TO_EDGE,r),this.wrapper.image=r)}this.initial&&this.particleTexture&&(this.initial=!1,this.handlePlay()),this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer,this.particleOptions),this.viewport.toggle(!0)},handleResize(){!this.particleContext||!this.wrapper||(this.wrapper={...this.wrapper,...this.webgl.resize(this.viewport,this.particleContext,this.wrapper)})},handlePause(){var t;this.paused=!0,this.animation!=null&&cancelAnimationFrame(this.animation),this.animation=void 0,(t=this.viewport)==null||t.toggleParticle(!1)},handlePlay(){var t,e;!((t=this.factor)!=null&&t.active)||!((e=this.factor)!=null&&e.particle)||!this.particleContext||!this.particleTexture||!this.wrapper||this.animation!=null||(this.paused=!1,this.animation=requestAnimationFrame(()=>{var a,r;this.animation=void 0,!(this.paused||!((a=this.factor)!=null&&a.active)||!((r=this.factor)!=null&&r.particle)||!this.particleContext||!this.wrapper)&&(this.webgl.drawParticle(this.viewport,this.particleContext,this.particleTexture,this.wrapper,this.particleOptions),this.viewport.toggleParticle(!0),this.handlePlay())}))},handleClearParticle(){var t,e,a,r,i,l,n;this.handlePause(),this.webgl.destroyParticle(this.particleContext,this.wrapper),(t=this.particleContext)==null||t.deleteTexture(this.particleTexture||null),this.wrapper=void 0,this.particleTexture=void 0,this.particleContext=void 0,this.initial=!0,(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("resize",this.handleResize),(i=(r=this.viewport)==null?void 0:r.map)==null||i.off("movestart",this.handlePause),(n=(l=this.viewport)==null?void 0:l.map)==null||n.off("moveend",this.handlePlay)},handleClear(){var t;(t=this.viewport)==null||t.toggle(!1),this.context=void 0,this.etime=void 0,this.handleClearParticle()}}},$c={key:0};function em(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",$c,[o.createVNode(n,o.mergeProps({class:"current",unit:"kts",labels:[0,.4,.8,1.6,2,3.2],simple:a.simple},t.$attrs),null,16,["simple"])])):o.createCommentVNode("",!0)}const tm=Q(qc,[["render",em]]),om={name:"IdmSigWaveParticle",components:{LegendBar:it},props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:[to,eo]}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,rendererKey:"sig-wave-particle",backgroundFragmentSchema:fe.sigWaveFragmentSchema,etime:void 0,dataSource:void 0,imageSource:void 0,imageEtime:void 0,imagePromise:void 0,drawVersion:0,wrapper:void 0,animation:void 0,lastParticleFrameTime:void 0,particleContext:void 0,particleTexture:void 0,particleCount:this.simple?3e3:9e3,particleOptions:{fadeOpacity:0,lineLength:6,lineOpacity:.9,speedFactor:this.simple?.1:.2,dropRate:0,dropRateBump:0,uvRange:[0,12.75],sRange:[0,12.75]},paused:!1,initial:!0}},watch:{"factor.version":{async handler(){var t,e;(t=this.factor)!=null&&t.active?await this.handleRender():this.handleClear(),(e=this.factor)!=null&&e.particle||this.handleClearParticle()},immediate:!0},"factor.particle":{async handler(t,e){var a;t!==e&&e!==void 0&&(t&&((a=this.factor)!=null&&a.active)?(this.handleClear(),await this.handleRender()):this.handleClearParticle())}}},beforeUnmount(){this.handleClear(),this.imagePromise=void 0,this.imageSource=void 0,this.imageEtime=void 0},methods:{async handleRender(){var t;if(!(!((t=this.factor)!=null&&t.active)||!this.viewport))try{const e=new Date().valueOf();let a=0,r=0;await this.handleDraw(),r=new Date().valueOf()-(e+a),console.log(`[${this.rendererKey}] add elapsed: `,r,", total: ",a+=r)}catch(e){this.handleClear(),console.error(`[${this.rendererKey}] Render failed:`,e)}},handleSetup(){var t;if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const e=[[0,"rgb(50, 158, 186)"],[10/255,"rgb(50, 158, 186)"],[20/255,"rgb(48, 128, 164)"],[30/255,"rgb(48, 99, 142)"],[40/255,"rgb(57, 61, 143)"],[50/255,"rgb(179, 86, 189)"],[60/255,"rgb(154, 45, 123)"],[80/255,"rgb(134, 48, 48)"],[120/255,"rgb(194, 77, 91)"],[150/255,"rgb(192, 118, 105)"],[180/255,"rgb(192, 163, 157)"],[1,"rgb(192, 163, 157)"]];this.rampColor=this.webgl.setup(this.context,e);const{program:a,aPositionBuffer:r}=this.webgl.bind(this.context,fe.vertexSchema,this.backgroundFragmentSchema);this.program=a,this.aPositionBuffer=r}(t=this.factor)!=null&&t.particle&&this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){if(this.particleContext=this.webgl.createParticleContext(this.viewport.particleCanvas),!this.particleContext)return;const t=[[0,"rgb(183,224,224)"],[1,"rgb(217,220,220)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,...go.getSources(this.webgl.isWebGL2(this.particleContext))),this.wrapper.color=this.webgl.setup(this.particleContext,t,!0,16,16),this.wrapper={...this.wrapper,...this.webgl.setupParticle(this.particleContext,this.particleCount,"lines",!0),...this.webgl.resize(this.viewport,this.particleContext)},this.viewport.map.on("resize",this.handleResize),this.viewport.map.on("movestart",this.handlePause),this.viewport.map.on("moveend",this.handlePlay)}},async handleDraw(){var i;this.handleSetup();const t=this.context;if(!t)return;const e=++this.drawVersion,{raw:a,etime:r}=this.factor;if(!this.texture||this.etime!==r||this.dataSource!==a||this.particleContext&&!this.particleTexture){(this.imageSource!==a||this.imageEtime!==r||!this.imagePromise)&&(this.imageSource=a,this.imageEtime=r,this.imagePromise=this.webgl.loadImg(a));let l;try{l=await this.imagePromise}catch(n){if(e!==this.drawVersion)return;throw this.imagePromise=void 0,n}if(e!==this.drawVersion||this.context!==t||!((i=this.factor)!=null&&i.active)||this.factor.raw!==a||this.factor.etime!==r)return;this.etime=r,this.dataSource=a,this.context.deleteTexture(this.texture||null),this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,l),this.particleContext&&this.wrapper&&this.factor.particle&&(this.particleContext.deleteTexture(this.particleTexture||null),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.NEAREST,this.particleContext.CLAMP_TO_EDGE,l),this.wrapper.image=l,this.wrapper.resetLifecycle=!0,this.lastParticleFrameTime=void 0)}this.initial&&this.particleTexture&&(this.initial=!1,this.handlePlay()),this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer,this.particleOptions),this.viewport.toggle(!0)},handleResize(){!this.particleContext||!this.wrapper||(this.wrapper={...this.wrapper,...this.webgl.resize(this.viewport,this.particleContext,this.wrapper)})},handlePause(){var t;this.paused=!0,this.animation!=null&&cancelAnimationFrame(this.animation),this.animation=void 0,this.lastParticleFrameTime=void 0,this.particleContext&&((t=this.viewport)==null||t.toggleParticle(!1))},handlePlay(){var t,e;!((t=this.factor)!=null&&t.active)||!((e=this.factor)!=null&&e.particle)||!this.particleContext||!this.particleTexture||!this.wrapper||this.animation!=null||(this.paused=!1,this.animation=requestAnimationFrame(a=>{var i,l;if(this.animation=void 0,this.paused||!((i=this.factor)!=null&&i.active)||!((l=this.factor)!=null&&l.particle)||!this.particleContext||!this.wrapper)return;const r=this.lastParticleFrameTime==null?0:Math.max(0,(a-this.lastParticleFrameTime)/1e3);this.lastParticleFrameTime=a,this.webgl.drawParticle(this.viewport,this.particleContext,this.particleTexture,this.wrapper,this.particleOptions,r),this.viewport.toggleParticle(!0),this.handlePlay()}))},handleClearParticle(){var t,e,a,r,i,l,n;this.handlePause(),this.webgl.destroyParticle(this.particleContext,this.wrapper),(t=this.particleContext)==null||t.deleteTexture(this.particleTexture||null),this.wrapper=void 0,this.particleTexture=void 0,this.particleContext=void 0,this.initial=!0,(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("resize",this.handleResize),(i=(r=this.viewport)==null?void 0:r.map)==null||i.off("movestart",this.handlePause),(n=(l=this.viewport)==null?void 0:l.map)==null||n.off("moveend",this.handlePlay)},handleClear(){var t,e;++this.drawVersion,this.context&&((t=this.viewport)==null||t.toggle(!1),this.context.deleteTexture(this.texture||null),this.context.deleteTexture(((e=this.rampColor)==null?void 0:e.texture)||null),this.context.deleteBuffer(this.aPositionBuffer||null),this.context.deleteProgram(this.program||null)),this.context=void 0,this.texture=void 0,this.rampColor=void 0,this.aPositionBuffer=void 0,this.program=void 0,this.etime=void 0,this.dataSource=void 0,this.handleClearParticle()}}},am={key:0};function im(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",am,[o.createVNode(n,o.mergeProps({class:"sig-wave-particle",unit:"m",labels:[.5,1,1.5,2,6,9],simple:a.simple},t.$attrs),null,16,["simple"])])):o.createCommentVNode("",!0)}const rm=Q(om,[["render",im]]),lm={name:"IdmSigWaveHeight",props:{map:{type:Object},sigWaveHeight:{type:Object},beforeLayer:{type:String}},data(){return{source:"sig-wave-height-source",heightLayer:"sig-wave-height-layer",heightLabelLayer:"sig-wave-height-label-layer",empty:E.featureCollection([])}},watch:{"sigWaveHeight.version":{handler(){var t;(t=this.sigWaveHeight)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){var t,e;if(this.sigWaveHeight){const a=new Date().valueOf();let r=0,i=0,l=this.empty;this.sigWaveHeight.active&&(l=this.sigWaveHeight.data),(t=this.map)!=null&&t.getSource(this.source)?((e=this.map)==null||e.getSource(this.source).setData(l),i=new Date().valueOf()-(a+r),console.log("[sig-wave-height] update elapsed: ",i,", total: ",r+=i)):(this.map.addSource(this.source,{type:"geojson",data:l}),this.map.addLayer({id:this.heightLayer,type:"fill",source:this.source,filter:["==","$type","Polygon"],paint:{"fill-opacity":.8,"fill-color":["step",["get","val"],"rgba(0,235,156,0)",2,"rgba(0,235,156,0.4)",3,"#ffed00",4,"#ff9800",5,"#f77800",6,"#e4711e",7,"#e06128",8,"#dc5132",9,"#d5453c",10,"#cd3a46",12,"#be2c50",14,"#b41a5a"]}},this.beforeLayer),this.map.addLayer({id:this.heightLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","symbol-spacing":100,"text-field":["format",["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":10},paint:{"text-color":["step",["get","val"],"rgba(0, 0, 0, 0.7)",9,"rgba(255,255,255,0.8)"]}},this.beforeLayer),i=new Date().valueOf()-(a+r),console.log("[sig-wave-height] add elapsed: ",i,", total: ",r+=i))}},handleClear(){this.map.getLayer(this.heightLayer)&&this.map.removeLayer(this.heightLayer),this.map.getLayer(this.heightLabelLayer)&&this.map.removeLayer(this.heightLabelLayer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function nm(t,e,a,r,i,l){return null}const sm=Q(lm,[["render",nm]]),cm={name:"IdmSwellParticle",components:{LegendBar:it},props:{simple:{type:Boolean,default:!1},factor:{type:Object},viewport:{type:[to,eo]}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,rendererKey:"swell-particle",backgroundFragmentSchema:fe.fragmentSchema,etime:void 0,dataSource:void 0,imageSource:void 0,imagePromise:void 0,drawVersion:0,wrapper:void 0,animation:void 0,lastParticleFrameTime:void 0,particleContext:void 0,particleTexture:void 0,particleCount:this.simple?3e3:9e3,particleOptions:{fadeOpacity:0,lineLength:6,lineOpacity:.9,speedFactor:this.simple?.1:.2,dropRate:0,dropRateBump:0,uvRange:[0,12.75],sRange:[0,12.75]},paused:!1,initial:!0}},watch:{"factor.version":{async handler(){var t,e;(t=this.factor)!=null&&t.active?await this.handleRender():this.handleClear(),(e=this.factor)!=null&&e.particle||this.handleClearParticle()},immediate:!0},"factor.particle":{async handler(t,e){var a;t!==e&&e!==void 0&&(t&&((a=this.factor)!=null&&a.active)?(this.handleClear(),await this.handleRender()):this.handleClearParticle())}}},beforeUnmount(){this.handleClear(),this.imagePromise=void 0,this.imageSource=void 0},methods:{async handleRender(){var t;if(!(!((t=this.factor)!=null&&t.active)||!this.viewport))try{const e=new Date().valueOf();await this.handleDraw(),console.log(`[${this.rendererKey}] 渲染耗时: `,new Date().valueOf()-e)}catch(e){this.handleClear(),console.error(`[${this.rendererKey}] 渲染失败:`,e)}},handleSetup(){var t;if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const e=[[0,"rgb(50, 158, 186)"],[10/255,"rgb(50, 158, 186)"],[20/255,"rgb(48, 128, 164)"],[30/255,"rgb(48, 99, 142)"],[40/255,"rgb(57, 61, 143)"],[50/255,"rgb(179, 86, 189)"],[60/255,"rgb(154, 45, 123)"],[80/255,"rgb(134, 48, 48)"],[120/255,"rgb(194, 77, 91)"],[150/255,"rgb(192, 118, 105)"],[180/255,"rgb(192, 163, 157)"],[1,"rgb(192, 163, 157)"]];this.rampColor=this.webgl.setup(this.context,e);const{program:a,aPositionBuffer:r}=this.webgl.bind(this.context,fe.vertexSchema,this.backgroundFragmentSchema);this.program=a,this.aPositionBuffer=r}(t=this.factor)!=null&&t.particle&&this.handleParticleSetup()},handleParticleSetup(){if(!this.particleContext){if(this.particleContext=this.webgl.createParticleContext(this.viewport.particleCanvas),!this.particleContext)return;const t=[[0,"rgb(183,224,224)"],[1,"rgb(217,220,220)"]];this.wrapper=this.webgl.bindParticle(this.particleContext,...go.getSources(this.webgl.isWebGL2(this.particleContext))),this.wrapper.color=this.webgl.setup(this.particleContext,t,!0,16,16),this.wrapper={...this.wrapper,...this.webgl.setupParticle(this.particleContext,this.particleCount,"lines",!0),...this.webgl.resize(this.viewport,this.particleContext)},this.viewport.map.on("resize",this.handleResize),this.viewport.map.on("movestart",this.handlePause),this.viewport.map.on("moveend",this.handlePlay)}},async handleDraw(){var i;this.handleSetup();const t=this.context;if(!t)return;const e=++this.drawVersion,{raw:a,etime:r}=this.factor;if(!this.texture||this.etime!==r||this.dataSource!==a||this.particleContext&&!this.particleTexture){(this.imageSource!==a||!this.imagePromise)&&(this.imageSource=a,this.imagePromise=this.webgl.loadImg(a));let l;try{l=await this.imagePromise}catch(n){if(e!==this.drawVersion)return;throw this.imagePromise=void 0,n}if(e!==this.drawVersion||this.context!==t||!((i=this.factor)!=null&&i.active)||this.factor.raw!==a||this.factor.etime!==r)return;this.etime=r,this.dataSource=a,this.context.deleteTexture(this.texture||null),this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,l),this.particleContext&&this.wrapper&&this.factor.particle&&(this.particleContext.deleteTexture(this.particleTexture||null),this.particleTexture=this.webgl.createTexture(this.particleContext,this.particleContext.NEAREST,this.particleContext.NEAREST,this.particleContext.CLAMP_TO_EDGE,l),this.wrapper.image=l,this.wrapper.resetLifecycle=!0,this.lastParticleFrameTime=void 0)}this.initial&&this.particleTexture&&(this.initial=!1,this.handlePlay()),this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer,this.particleOptions),this.viewport.toggle(!0)},handleResize(){!this.particleContext||!this.wrapper||(this.wrapper={...this.wrapper,...this.webgl.resize(this.viewport,this.particleContext,this.wrapper)})},handlePause(){var t;this.paused=!0,this.animation!=null&&cancelAnimationFrame(this.animation),this.animation=void 0,this.lastParticleFrameTime=void 0,this.particleContext&&((t=this.viewport)==null||t.toggleParticle(!1))},handlePlay(){var t,e;!((t=this.factor)!=null&&t.active)||!((e=this.factor)!=null&&e.particle)||!this.particleContext||!this.particleTexture||!this.wrapper||this.animation!=null||(this.paused=!1,this.animation=requestAnimationFrame(a=>{var i,l;if(this.animation=void 0,this.paused||!((i=this.factor)!=null&&i.active)||!((l=this.factor)!=null&&l.particle)||!this.particleContext||!this.wrapper)return;const r=this.lastParticleFrameTime==null?0:Math.max(0,(a-this.lastParticleFrameTime)/1e3);this.lastParticleFrameTime=a,this.webgl.drawParticle(this.viewport,this.particleContext,this.particleTexture,this.wrapper,this.particleOptions,r),this.viewport.toggleParticle(!0),this.handlePlay()}))},handleClearParticle(){var t,e,a,r,i,l,n;this.handlePause(),this.webgl.destroyParticle(this.particleContext,this.wrapper),(t=this.particleContext)==null||t.deleteTexture(this.particleTexture||null),this.wrapper=void 0,this.particleTexture=void 0,this.particleContext=void 0,this.initial=!0,(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("resize",this.handleResize),(i=(r=this.viewport)==null?void 0:r.map)==null||i.off("movestart",this.handlePause),(n=(l=this.viewport)==null?void 0:l.map)==null||n.off("moveend",this.handlePlay)},handleClear(){var t,e;++this.drawVersion,this.context&&((t=this.viewport)==null||t.toggle(!1),this.context.deleteTexture(this.texture||null),this.context.deleteTexture(((e=this.rampColor)==null?void 0:e.texture)||null),this.context.deleteBuffer(this.aPositionBuffer||null),this.context.deleteProgram(this.program||null)),this.context=void 0,this.texture=void 0,this.rampColor=void 0,this.aPositionBuffer=void 0,this.program=void 0,this.etime=void 0,this.dataSource=void 0,this.handleClearParticle()}}},mm={key:0};function dm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",mm,[o.createVNode(n,o.mergeProps({class:"swell",unit:"m",labels:[.5,1,1.5,2,6,9],simple:a.simple},t.$attrs),null,16,["simple"])])):o.createCommentVNode("",!0)}const hm=Q(cm,[["render",dm]]),pm={name:"IdmSwellDirection",props:{map:{type:Object},swell:{type:Object},beforeLayer:{type:String},mapFeather:{type:String},hasRampLayer:{type:Boolean},nautical:{type:String}},data(){return{source:"swell-source",directionLayer:"swell-direction-layer",heightLayer:"swell-height-layer",heightLabelLayer:"swell-height-label-layer",empty:E.featureCollection([])}},computed:{opacity(){return(this.mapFeather==="light"||this.nautical==="hi"||this.nautical==="i4")&&!this.hasRampLayer?.6:.7},color(){return(this.mapFeather==="light"||this.nautical==="hi"||this.nautical==="i4")&&!this.hasRampLayer?"#000623":"#ffffff"}},watch:{"swell.version":{handler(){var t;(t=this.swell)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0},color:{handler(){var t;(t=this.swell)!=null&&t.active&&(this.handleClear(),this.handleRender())}}},methods:{handleRender(){var t,e;if(this.swell){const a=new Date().valueOf();let r=0,i=this.empty;if(this.swell.active&&(i=this.swell.data),(t=this.map)!=null&&t.getSource(this.source))(e=this.map)==null||e.getSource(this.source).setData(i),new Date().valueOf()-(a+r);else{this.map.addSource(this.source,{type:"geojson",data:i}),this.map.addLayer({id:this.heightLayer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-opacity":1,"line-width":1,"line-color":["match",["get","val"],2,"rgba(255,255,0,0.9)",3,"rgba(255,149,0,0.9)",4,"rgba(244,67,54,0.9)",5,"rgba(162,2,31,0.9)",6,"rgba(162,2,31,0.9)","rgba(162,2,31,0.9)"]}},this.beforeLayer),this.map.addLayer({id:this.heightLabelLayer,type:"symbol",source:this.source,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-rotation-alignment":"viewport","text-field":"{val}m","text-size":11},paint:{"text-color":["step",["get","val"],"black",4,"white",5,"white",6,"white"],"text-halo-color":["match",["get","val"],2,"rgba(255,255,0,0.7)",3,"rgba(255,149,0,0.7)",4,"rgba(244,67,54,0.7)",5,"rgba(162,13,2,0.7)",6,"rgba(162,13,2,0.7)","rgba(162,13,2,0.7)"],"text-halo-width":2}},this.beforeLayer);const l=new Image(72,72);let n=`<svg t="1752721890391" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12518" width="200" height="200"><path d="M481.386772 959.514313 481.386772 334.713224c-56.000432 37.288255-92.523253 55.876612-142.312216 57.787124 85.834924-84.884272 130.528845-195.161888 172.552961-328.434218 40.259936 133.272329 89.39296 238.731196 172.622546 328.434218-54.105269-5.729491-86.780459-21.201881-146.338926-58.965973l0 625.979938L481.386772 959.514313z" p-id="12519" fill="${this.color}"></path></svg>`,s="data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(n)));l.src=s,l.onload=()=>{this.map.hasImage("swellDirIconWhite")?this.map.updateImage("swellDirIconWhite",l):this.map.addImage("swellDirIconWhite",l),this.map.getLayer(this.directionLayer)||this.map.addLayer({id:this.directionLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","icon-image":"swellDirIconWhite","icon-size":{base:1,stops:[[2,.32],[6,.5]]},"icon-offset":[0,-20],"icon-allow-overlap":!0,"icon-rotation-alignment":"map","icon-rotate":{property:"val",stops:[[0,180],[360,540]]}},paint:{"icon-opacity":this.opacity}},this.beforeLayer)},new Date().valueOf()-(a+r)}}},handleClear(){this.map.getLayer(this.heightLayer)&&this.map.removeLayer(this.heightLayer),this.map.getLayer(this.heightLabelLayer)&&this.map.removeLayer(this.heightLabelLayer),this.map.getLayer(this.directionLayer)&&this.map.removeLayer(this.directionLayer),this.map.hasImage("swellDirIconWhite")&&this.map.removeImage("swellDirIconWhite"),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function um(t,e,a,r,i,l){return o.openBlock(),o.createElementBlock("div")}const gm=Q(pm,[["render",um]]),fm={name:"IdmPrmsl",props:{map:{type:Object},prmsl:{type:Object},beforeLayer:{type:String},theme:{type:String},hasRampLayer:{type:Boolean},nautical:{type:String}},data(){return{source:"prmsl-source",layer:"prmsl-layer",labelLayer:"prmsl-label-layer",pointLabelLayer:"prmsl-point-label-layer",empty:E.featureCollection([])}},computed:{opacity(){return(this.theme==="light"||this.nautical==="hi"||this.nautical==="i4")&&!this.hasRampLayer?1:.3}},watch:{"prmsl.version":{handler(){var t;(t=this.prmsl)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0},opacity:{handler(){var t;(t=this.prmsl)!=null&&t.active&&(this.handleClear(),this.handleRender())}}},methods:{handleRender(){var t,e,a;if(this.prmsl){const r=new Date().valueOf();let i=0,l=0,n=this.empty;this.prmsl.active&&(n=this.prmsl.data),(t=this.map)!=null&&t.getSource(this.source)?((e=this.map)==null||e.getSource(this.source).setData(n),l=new Date().valueOf()-(r+i),console.log("[prmsl] update elapsed: ",l,", total: ",i+=l)):(this.map.addSource(this.source,{type:"geojson",data:n}),this.map.addLayer({id:this.layer,type:"line",source:this.source,filter:["==","$type","LineString"],paint:{"line-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"line-width":1,"line-opacity":this.opacity}},this.beforeLayer),(a=this.map)==null||a.addLayer({id:this.labelLayer,type:"symbol",source:this.source,minzoom:4,filter:["==","$type","LineString"],layout:{"symbol-placement":"line","text-rotation-alignment":"viewport","text-field":"{val}","text-size":10},paint:{"text-color":"black","text-halo-color":"rgba(255,255,255,1)","text-opacity":.7,"text-halo-width":1}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.source,filter:["==","$type","Point"],layout:{"symbol-placement":"point","text-allow-overlap":!0,"text-field":["format",["get","type"],{"font-scale":1.03},`
623
- `,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.theme==="light"?["step",["get","val"],"rgba(0, 0, 0, 0.5)",920,"rgba(0, 0, 0, 0.5)",980,"rgba(0, 0, 0, 0.7)",1100,"rgba(0, 0, 0, 0.7)"]:"rgba(0,0,0,1)","text-halo-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"text-halo-width":1}},this.beforeLayer),l=new Date().valueOf()-(r+i),console.log("[prmsl] add elapsed: ",l,", total: ",i+=l))}},handleClear(){this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.labelLayer)&&this.map.removeLayer(this.labelLayer),this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ym(t,e,a,r,i,l){return null}const bm=Q(fm,[["render",ym]]),wm={name:"IdmIceEdge",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[ice-edge] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(86, 169, 230, 0)"],[1/255,"rgba(86, 169, 230, 0)"],[25/255,"rgba(86, 169, 230, 1)"],[25/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 84, 39, 1)"],[250/255,"rgba(230, 84, 39, 1)"],[1,"rgba(230, 84, 39, 1)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},xm={key:0};function km(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",xm,[o.createVNode(n,o.mergeProps({class:"ice-edge",unit:"%",labels:["",10,"","",40,"","",70,"",90,""],"unit-color":"rgba(var(--v-theme-black), 0.7)"},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Am=Q(wm,[["render",km]]),Lm={name:"IdmCover",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[ice-cover] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(68, 1, 84, 0)"],[1/255,"rgba(63, 72, 137, 0)"],[50/255,"rgba(53, 125, 177, 1)"],[100/255,"rgba(33, 145, 140, 1)"],[150/255,"rgba(45, 178, 125, 1)"],[200/255,"rgba(112, 207, 87, 1)"],[250/255,"rgba(253, 231, 37, 0.8)"],[1,"rgba(253, 231, 37, 1)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},vm={key:0};function Cm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",vm,[o.createVNode(n,o.mergeProps({class:"ice-cover",unit:"%",labels:[20,40,60,80,100]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const _m=Q(Lm,[["render",Cm]]),zm={name:"IdmThickness",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[ice-thickness] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(4, 6, 19, 0)"],[1/255,"rgba(4, 6, 19, 0)"],[20/255,"rgba(51, 50, 102, 1)"],[40/255,"rgba(63, 82, 158, 1)"],[50/255,"rgba(66, 123, 183, 1)"],[60/255,"rgba(92, 161, 197, 1)"],[80/255,"rgba(134, 199, 212, 0.7)"],[100/255,"rgba(134, 199, 212, 1)"],[150/255,"rgba(234, 253, 2536, 0.8)"],[250/255,"rgba(234, 253, 2536, 0.9)"],[1,"rgba(234, 253, 2536, 1)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Sm={key:0};function Pm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Sm,[o.createVNode(n,o.mergeProps({class:"ice-thickness",unit:"m",labels:[0,.6,1,1.5,2,3]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Mm=Q(zm,[["render",Pm]]),Tm={name:"IdmPrecip3h",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},deeimmediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[precip3h] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(59, 126, 162, 0)"],[14/255,"rgba(84,170,230, 0)"],[15/255,"rgba(172, 210, 255, 0.8)"],[20/255,"rgba(51,202,248,0.8)"],[30/255,"rgba(3,248,103,0.8)"],[49/255,"rgba(14,201,3,0.8)"],[57/255,"rgba(190,226,2,0.8)"],[73/255,"rgba(248,1,1,0.8)"],[82/255,"rgba(197,5,58,0.8)"],[1,"rgba(197,5,58,0.8)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Nm={key:0};function Em(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Nm,[o.createVNode(n,o.mergeProps({class:"precip3h",unit:"mm",labels:[1.5,2,3,7,10,20,30]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Vm=Q(Tm,[["render",Em]]),Rm={name:"IdmVisibility",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[visibility] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(189,50,160,0.8)"],[8/255,"rgba(208,56,56,0.8)"],[27/255,"rgba(190,226,2,0.8)"],[60/255,"rgba(3,236,118,0.8)"],[160/255,"rgba(172, 210,255,0.8)"],[161/255,"rgba(172, 210,255,0)"],[1,"rgba(144,144,144,0)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Dm={key:0};function Bm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Dm,[o.createVNode(n,o.mergeProps({class:"visibility",unit:"nm",labels:[0,.5,1.5,3,9]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Im=Q(Rm,[["render",Bm]]),Fm={name:"IdmWaterTemp",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[water-temp] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(95, 143, 197)"],[46/255,"rgba(95, 143, 197)"],[69/255,"rgb(80, 140, 62)"],[92/255,"rgb(121, 146, 28)"],[115/255,"rgb(171, 161, 14)"],[138/255,"rgb(223, 177, 69)"],[161/255,"rgb(243, 150, 6)"],[184/255,"rgb(236, 95, 21)"],[207/255,"rgb(190, 65, 18)"],[230/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Gm={key:0};function jm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Gm,[o.createVNode(n,o.mergeProps({class:"water-temp",unit:"°C",labels:[0,10,20,30,40]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Wm=Q(Fm,[["render",jm]]),Zm={name:"IdmTemp",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0;this.handleDraw(),new Date().valueOf()-(t+e)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgb(149, 137, 211)"],[100/255,"rgb(149, 137, 211)"],[110/255,"rgb(150, 209, 216)"],[120/255,"rgb(129, 204, 197)"],[130/255,"rgb(103, 180, 186)"],[140/255,"rgb(95, 143, 197)"],[150/255,"rgb(80, 140, 62)"],[160/255,"rgb(121, 146, 28)"],[170/255,"rgb(171, 161, 14)"],[180/255,"rgb(223, 177, 6)"],[190/255,"rgb(243, 150, 6)"],[200/255,"rgb(236, 95, 21)"],[210/255,"rgb(190, 65, 18)"],[220/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Hm={key:0};function Xm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Hm,[o.createVNode(n,o.mergeProps({class:"temp",unit:"°C",labels:[-20,-10,0,10,20,30,40]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Om=Q(Zm,[["render",Xm]]),jb="",Ym={name:"IdmGlLayer",components:{IdmWindBarb:Wc,IdmWindParticle:Uc,IdmCurrentDirection:Qc,IdmCurrentParticle:tm,IdmSigWaveParticle:rm,IdmSigWaveHeight:sm,IdmSwellParticle:hm,IdmSwellDirection:gm,IdmPrmsl:bm,IdmIceEdge:Am,IdmIceCover:_m,IdmIceThickness:Mm,IdmPrecip3h:Vm,IdmVisibility:Im,IdmWaterTemp:Wm,IdmTemp:Om},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},theme:{type:String},map:{type:Object},mapFeather:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},defaultMeteoToken:{type:String},top:{type:Number,default:0},paddingTop:{type:Number,default:8},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},realTime:{type:String},forecastModel:{type:String},beforeLayer:{type:String},platform:{type:String},projection:{type:String}},emits:["forecastModel","menuToggle","weatherCheckList","autoActive","weatherRendered","rampLayersReady"],data(){const t=[...ho.LayerHelper.WEATHER_LAYERS];return{right:10,toggle:!1,autoActive:!0,weatherWeight:0,allLayers:t,tagLayers:t.filter(e=>!e.hide),checkList:[],renderKey:"",iceToggleValue:void 0,weatherLayers:{},activeWeatherLayers:[],cache:{v:"0.0.4",versionKey:"weatherLayerCacheVersionGL4",autoActiveKey:"autoActiveCacheGL4",checkListKey:"weatherCheckListCacheGL4"},models:{},currentModel:localStorage.getItem("forecastModelCacheGL4")==="GFS"?"GFS":"ECMWF",zoom:6,viewport:void 0,viewportSeq:0,particleFactor:void 0,showWindParticle:!0,showCurrentParticle:!0,showSigWaveParticle:!0,showSwellParticle:!0,legendToggle:!1,legend:{barbs:[2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,0],current:[{label:"0-0.5 kts",size:.3,color:"rgb(58, 164, 58)"},{label:"0.5-1 kts",size:.4,color:"#ffff00"},{label:"1-1.5 kts",size:.6,color:"#ff9500"},{label:"1.5-2 kts",size:.8,color:"#f44336"},{label:">= 2 kts",size:1,color:"#e4711e"}],sigWaveHeight:[{label:"< 2 m",color:"rgba(0,235,156,0)"},{label:"2-3 m",color:"rgba(0,235,156,0.4)"},{label:"3-4 m",color:"#ffed00"},{label:"4-5 m",color:"#ff9800"},{label:"5-6 m",color:"#f77800"},{label:"6-7 m",color:"#e4711e"},{label:"7-8 m",color:"#e06128"},{label:"8-9 m",color:"#dc5132"},{label:"9-10 m",color:"#d5453c"},{label:"10-12 m",color:"#cd3a46"},{label:"12-14 m",color:"#be2c50"},{label:"> 14 m",color:"#aa1a5a"}]}}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}},computeDateZ(){return function(t){var e;if(t){const a=_(t);return`${(e=a==null?void 0:a.utc())==null?void 0:e.format("MMM-DD/HHmm")}Z`}return"-"}},computeDateUpdate(){return function(t){return t?_(t).fromNow():"-"}},overlaysKeys(){return this.tagLayers.filter(t=>t.overlays).map(t=>t.key)},rendersKeys(){return this.allLayers.filter(t=>!t.overlays&&t.enabled).map(t=>t.key)},showTipMenu(){return this.checkList.includes("wind")||this.checkList.includes("current-direction")||this.checkList.includes("sig-wave-height")},barbsIconName(){var e,a,r;const t=[];for(let i=0;i<((a=(e=this.legend)==null?void 0:e.barbs)==null?void 0:a.length);i++){const l=((r=this.legend)==null?void 0:r.barbs[i])||0,n=l<10?`00${l}kts`:l<100?`0${l}kts`:`${l}kts`;t.push("icon-a-"+n)}return t},lengendTipTop(){return this.platform==="ops"?this.top+this.menuHeight+322:this.top+this.menuHeight+232},viewportKey(){return this.viewport?(this.viewport.isGlobe?"globe":"mercator")+"-"+this.viewportSeq:"none"}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.weatherLayers,this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})}},currentModel:{handler(t,e){this.$emit("forecastModel",t),localStorage.setItem("forecastModelCacheGL4",t)},immediate:!0},forecastModel:{handler(t,e){t&&t!==e&&this.handleWeatherLayerChange({sourceChanged:!0})}},map:{handler(){var e,a,r,i;const t=this.map;(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("move",this.handleMove4Weather),(i=(r=this.viewport)==null?void 0:r.cleanup)==null||i.call(r),this.viewport=void 0,t&&(this.viewportSeq+=1,this.projection==="globe"?this.viewport=new eo(t):this.viewport=new to(t),t.once("idle",()=>{this.map===t&&(this.fetchCache(),t.on("move",this.handleMove4Weather),this.handleRampColorInitial())}),t.triggerRepaint())},immediate:!0},projection:{handler(t,e){var a,r;!t||t===e||!this.map||!this.viewport||((r=(a=this.viewport)==null?void 0:a.cleanup)==null||r.call(a),this.viewportSeq+=1,t==="globe"?this.viewport=new eo(this.map):this.viewport=new to(this.map),this.handleRampColorInitial(),this.handleMove4Weather(),this.map.triggerRepaint())}},realTime:{handler(t,e){t&&e&&_(t).utc().format("yyyy-MM-DD HH")!==_(e).utc().format("yyyy-MM-DD HH")&&this.$nextTick(()=>{this.fetchWeatherLayers()})},immediate:!0},renderKey:{handler(t,e){if(t&&t!==e){const a=this.checkList.filter(r=>!this.rendersKeys.some(i=>i===r));t==="ice-forecast"?(this.iceToggleValue=this.iceToggleValue||"ice-cover",this.checkList=[...a,"ice-forecast",this.iceToggleValue||"ice-cover"]):this.checkList=[...a,t]}else!t&&e&&(this.checkList=this.checkList.filter(a=>a!==e))}},checkList:{handler(t,e){var a,r,i,l,n,s;this.handleCheckListChange(t,e),this.$emit("weatherCheckList",t),this.autoActive&&this.checkList.length?(i=(r=(a=this.$parent)==null?void 0:a.$refs)==null?void 0:r.idmBottomBar)==null||i.handleToggle("weather",!0):(s=(n=(l=this.$parent)==null?void 0:l.$refs)==null?void 0:n.idmBottomBar)==null||s.handleToggle("weather",!1)}},autoActive:{handler(t){var e,a,r,i,l,n;localStorage.setItem(this.cache.autoActiveKey,this.autoActive),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(s=>this.checkList.includes(s.key)):[],this.handleWeatherLayerChange(),this.autoActive&&this.checkList.length?(r=(a=(e=this.$parent)==null?void 0:e.$refs)==null?void 0:a.idmBottomBar)==null||r.handleToggle("weather",!0):(n=(l=(i=this.$parent)==null?void 0:i.$refs)==null?void 0:l.idmBottomBar)==null||n.handleToggle("weather",!1),this.$emit("autoActive",this.autoActive)}},iceToggleValue:{handler(t){if(t){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"ice-forecast",this.iceToggleValue]}}},showWindParticle:{handler(t){let e="wind-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=t,this.weatherLayers[e].version=Math.random()+1)}},showCurrentParticle:{handler(t){let e="current-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=t,this.weatherLayers[e].version=Math.random()+1)}},showSigWaveParticle:{handler(t){const e=this.weatherLayers["sig-wave-particle"];e&&(e.particle=t)}},showSwellParticle:{handler(t){const e=this.weatherLayers["swell-particle"];e&&(e.particle=t)}},isLogin:{handler(t){t?this.fetchModels():this.models={}},immediate:!0}},mounted(){this.fetchModels()},beforeUnmount(){var t,e,a,r;(e=(t=this.viewport)==null?void 0:t.map)==null||e.off("move",this.handleMove4Weather),(r=(a=this.viewport)==null?void 0:a.cleanup)==null||r.call(a),this.viewport=void 0},methods:{arraysEqual(t,e){if((t==null?void 0:t.length)!==(e==null?void 0:e.length))return!1;for(let a=0;a<(t==null?void 0:t.length);a++)if((t==null?void 0:t[a])!==(e==null?void 0:e[a]))return!1;return!0},normalizeWaveSelection(t){const e=t.map(a=>a==="sig-wave"?"sig-wave-particle":a==="swell"?"swell-particle":a);return[...new Set(e)].filter(a=>this.allLayers.some(r=>r.key===a))},fetchCache(){const t=localStorage.getItem(this.cache.versionKey);this.cache.v!==t&&(localStorage.removeItem(this.cache.autoActiveKey),localStorage.removeItem(this.cache.checkListKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.autoActiveKey);this.autoActive=e!=="false",localStorage.setItem(this.cache.autoActiveKey,this.autoActive),e=localStorage.getItem(this.cache.checkListKey);const a=JSON.parse(e||JSON.stringify(["wind","sig-wave-height"]));this.iceToggleValue=a.includes("ice-thickness")?"ice-thickness":void 0,this.checkList=this.normalizeWaveSelection(a),this.renderKey=this.checkList.find(r=>this.rendersKeys.includes(r))||"",localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList))},handleMenuToggle(){this.$emit("menuToggle","weatherLayers")},handleFastWeatherToggle(t){let e=[];this.checkList.includes(t)?e=this.checkList.filter(a=>a!==t):(e=[...this.checkList,t],this.checkList=e),this.handleCheckListChange(e,this.checkList)},handleCheckListChange(t,e){if(this.arraysEqual(t,e))return this.handleMove4Weather(),!1;const a=[...new Set(t)],r=a==null?void 0:a.filter(n=>!(e!=null&&e.includes(n)))[0],i=e==null?void 0:e.filter(n=>!(a!=null&&a.includes(n)))[0],l=this.checkList.filter(n=>!this.rendersKeys.some(s=>s===n));if(r)if(r==="ice-cover"||r==="ice-thickness"||r==="ice-forecast")this.checkList=[...l,"ice-forecast",this.iceToggleValue||"ice-cover"],this.iceToggleValue=this.iceToggleValue||"ice-cover";else if(this.rendersKeys.includes(r))this.checkList=[...l,r];else{const n=a.filter(c=>!this.rendersKeys.includes(c)),s=this.checkList.filter(c=>this.rendersKeys.includes(c));this.checkList=[...n,...s]}i&&(i==="ice-forecast"?(this.checkList=a.filter(n=>!["ice-cover","ice-thickness","ice-forecast"].includes(n)),this.iceToggleValue=void 0):this.checkList=a),this.checkList.includes("wind-particle")&&!(e!=null&&e.includes("wind-particle"))&&(this.showWindParticle=!0),this.checkList.includes("current-particle")&&!(e!=null&&e.includes("current-particle"))&&(this.showCurrentParticle=!0),this.checkList.includes("sig-wave-particle")&&!(e!=null&&e.includes("sig-wave-particle"))&&(this.showSigWaveParticle=!0),this.checkList.includes("swell-particle")&&!(e!=null&&e.includes("swell-particle"))&&(this.showSwellParticle=!0),localStorage.setItem(this.cache.checkListKey,JSON.stringify(a)),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(n=>a.includes(n.key)):[],this.handleWeatherLayerChange()},async fetchModels(){this.models={};const t=await de.get(`${this.gateway}/api/arc/meteo2/models2`,{headers:{Authorization:this.defaultMeteoToken}});(t==null?void 0:t.data.code)===0&&(this.models=t==null?void 0:t.data.data)},async fetchWeatherLayers(t={}){var r,i,l,n,s,c,m,d,g;const e=new Date().valueOf();let a=0;if(this.map){const u=((r=this.map)==null?void 0:r.getZoom())+1,y=(i=this.map)==null?void 0:i.getBounds(),p=`${y._sw.lng},${y._sw.lat},${y._ne.lng},${y._ne.lat}`;if(this.particleFactor&&((l=this.$refs.layer)!=null&&l.autoActive)){const h=ho.LayerHelper.WEATHER_LAYERS.find(f=>{var x;return((x=f.peer)==null?void 0:x.weight)===this.particleFactor.weight});this.particleFactor.particle&&(this.showWindParticle||this.showCurrentParticle)?this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight:this.weatherWeight+h.weight:this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight-h.weight:this.weatherWeight}if(this.weatherWeight>0){let h=this.weatherWeight;if(h>0){const f=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],x=await de.get(`${f}/api/arc/weather/layers2/links?l=${h}&v=${this.forecastModel}&z=${u}&bbox=${p}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(new Date().valueOf()-(e+a),((n=x==null?void 0:x.data)==null?void 0:n.code)===0){const v=(s=x==null?void 0:x.data)==null?void 0:s.data,b=[];for(const A in v)b.push(de.get(v[A],{headers:{Authorization:this.defaultMeteoToken,key:A},responseType:/\.(jpg|png)$/.test(v[A])?"blob":"json"}).catch(L=>{console.log(`[${A}] fetch layer error: ${L}`)}));const k=await Promise.all(b);this.weatherLayers={},k.map(A=>{var z,M,T,N;const L=((z=A==null?void 0:A.data)==null?void 0:z.data)||(A==null?void 0:A.data);let C=(T=(M=A==null?void 0:A.config)==null?void 0:M.headers)==null?void 0:T.key;C==="sig-wave"&&(C="sig-wave-particle"),C==="swell"&&(C="swell-particle"),C&&L&&(this.weatherLayers[C]={raw:L,type:((N=A==null?void 0:A.config)==null?void 0:N.responseType)==="blob"?"image":"json",etime:x.data.etime})})}if(new Date().valueOf()-(e+a),this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const v=(c=this.weatherLayers["current-direction"])==null?void 0:c.raw,b=(m=this.weatherLayers["current-speed"])==null?void 0:m.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:v,speed:{raw:b},etime:x.data.etime}}if(this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const v=(d=this.weatherLayers["swell-direction"])==null?void 0:d.raw,b=(g=this.weatherLayers["swell-height"])==null?void 0:g.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers["swell-direction-contour"]={type:"json",direction:v,height:{raw:b},etime:x.data.etime}}}}this.handleWeatherLayerToggle(),this.handleDrawWeather4Json(),this.$nextTick(()=>{var h,f,x,v,b;(b=(v=(x=(f=(h=this.$parent)==null?void 0:h.$refs)==null?void 0:f.idmBottomBar)==null?void 0:x.$refs)==null?void 0:v.capture)==null||b.captureCurrentFrame()})}},handleWeatherLayerToggle(){for(const t in this.weatherLayers)this.weatherLayers[t].active=!1,this.weatherLayers[t].version=Math.random()+1;for(const t of this.activeWeatherLayers){let e=t.key;e==="current-direction"&&(e="current"),this.weatherLayers[e]&&(this.weatherLayers[e].active=!0,this.weatherLayers[e].version=Math.random()+1,e==="wind-particle"&&(this.weatherLayers[e].particle=this.showWindParticle),e==="current-particle"&&(this.weatherLayers[e].particle=this.showCurrentParticle),e==="sig-wave-particle"&&(this.weatherLayers[e].particle=this.showSigWaveParticle),e==="swell-particle"&&(this.weatherLayers[e].particle=this.showSwellParticle))}},handleWeatherLayerChange(t={sourceChanged:!1}){var a;const e=(a=this.activeWeatherLayers)==null?void 0:a.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);t!=null&&t.sourceChanged||this.weatherWeight!==e?(this.weatherWeight=e,this.fetchWeatherLayers()):this.handleWeatherLayerToggle()},handleRampColorInitial(){var t,e,a,r,i,l,n,s,c,m,d,g,u;if((t=this.viewport)!=null&&t.isGlobe){this.viewport.initGlobeLayers(this.beforeLayer),this.$emit("rampLayersReady");return}this.viewport.map.getSource((e=this.viewport)==null?void 0:e.rampColorSource)||this.viewport.map.addSource((a=this.viewport)==null?void 0:a.rampColorSource,{type:"canvas",canvas:(r=this.viewport)==null?void 0:r.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((i=this.viewport)==null?void 0:i.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(l=this.viewport)==null?void 0:l.rampColorLayer,source:(n=this.viewport)==null?void 0:n.rampColorSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.viewport.map.getSource((s=this.viewport)==null?void 0:s.particleSource)||this.viewport.map.addSource((c=this.viewport)==null?void 0:c.particleSource,{type:"canvas",canvas:(m=this.viewport)==null?void 0:m.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((d=this.viewport)==null?void 0:d.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(g=this.viewport)==null?void 0:g.particleLayer,source:(u=this.viewport)==null?void 0:u.particleSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.$emit("rampLayersReady")},handleDrawWeather4Json(){var l,n,s,c,m,d,g;const t=new Date().valueOf();let e=0,a=0;const r=(l=this.map)==null?void 0:l.getBounds(),i=(n=this.map)==null?void 0:n.getZoom();if(r&&i){const u=P.LngLatHelper.convertToStdLng(r._sw.lng),y=P.LngLatHelper.convertToStdLng(r._ne.lng),p=Math.floor(r._sw.lat),h=Math.ceil(r._ne.lat);for(const f in this.weatherLayers){let x=!1;if(this.weatherLayers[f].active&&this.weatherLayers[f].type==="json"){let v=[];if(f==="current"){x=!0;const b=((s=this.weatherLayers[f])==null?void 0:s.direction)||{};for(const A in b)if(A>p&&A<h&&(!(i<=this.zoom)||A%(i<2?10:i<4?5:3)===0)){const L=b[A].lng;u>y?L.forEach((C,z)=>{var M,T,N,F,O,q;if(i<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if((C>=u&&C<=180||C>=-180&&C<=y)&&(!(i<=this.zoom)||C%(i<2?10:i<4?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}}):L.forEach((C,z)=>{var M,T,N,F,O,q;if(u<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if(C>=u&&C<=y&&(!(i<=this.zoom)||C%(i<this.zoom/2?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}})}a=new Date().valueOf()-(t+e);const k=this.weatherLayers[f].speed;if(k){if(!k.data){const L=[];for(const C in(c=k.raw)==null?void 0:c.Polygon){const z=k.raw.Polygon[C];for(const M of z)L.push(E.polygon(M,{val:Number(C)}))}k.data=E.featureCollection(L)}const A=i<this.zoom?k.data.features.filter(L=>L.properties.val>.5):k.data.features;v=v.concat(A),a=new Date().valueOf()-(t+e)}}else if(f==="wind"){x=!0;const b=this.weatherLayers.wind.raw;for(const k in b)if(k>p&&k<h&&(!(i<=this.zoom)||k%(i<2?10:i<4?5:3)===0)){const A=b[k].lng;u>y?A.forEach((L,C)=>{var z,M,T,N;if(i<2){if((L>=0&&L<=360||L>=-360&&L<=0)&&L%10===0){const F=E.point([L,k],{dir:((z=b[k].val)==null?void 0:z[C])||((M=b[k].dir)==null?void 0:M[C]),spd:b[k].spd[C]});v.push(F)}}else if((L>=u&&L<=180||L>=-180&&L<=y)&&(!(i<=this.zoom)||L%(i<2?10:i<4?5:3)===0)){const F=E.point([L,k],{dir:((T=b[k].val)==null?void 0:T[C])||((N=b[k].dir)==null?void 0:N[C]),spd:b[k].spd[C]});v.push(F)}}):A.forEach((L,C)=>{var z,M,T,N;if(i<2){if((L>=0&&L<=360||L>=-360&&L<=0)&&L%10===0){const F=E.point([L,k],{dir:((z=b[k].val)==null?void 0:z[C])||((M=b[k].dir)==null?void 0:M[C]),spd:b[k].spd[C]});v.push(F)}}else if(L>=u&&L<=y&&(!(i<=this.zoom)||L%(i<2?10:i<4?5:3)===0)){const F=E.point([L,k],{dir:((T=b[k].val)==null?void 0:T[C])||((N=b[k].dir)==null?void 0:N[C]),spd:b[k].spd[C]});v.push(F)}})}a=new Date().valueOf()-(t+e)}else if(f==="sig-wave-height"){if(this.weatherLayers[f].data)v=this.weatherLayers[f].data;else{x=!0;const b=this.weatherLayers[f].raw;if(b){const k=[];for(const A in b.Polygon){const L=b.Polygon[A];for(const C of L)k.push(E.polygon(C,{val:Number(A)}))}for(const A in b.MultiPolygon){const L=b.MultiPolygon[A];for(const C of L)k.push(E.multiPolygon(C,{val:Number(A)}))}for(const A in b.Point){const L=b.Point[A];for(let C=0;C<((m=L.lng)==null?void 0:m.length);C++)k.push(E.point([L.lng[C],A],{val:Number(L.val[C])}))}v=v.concat(k)}}a=new Date().valueOf()-(t+e)}else if(f==="prmsl"){if(this.weatherLayers[f].data)v=this.weatherLayers[f].data;else{x=!0;const b=this.weatherLayers[f].raw;if(b){const k=[];for(const A in b.LineString){const L=b.LineString[A];for(const C of L)k.push(E.lineString(C,{val:Number(A)}))}for(const A in b.Point)b.Point[A].lng.forEach((L,C)=>{L=P.LngLatHelper.convertToStdLng(L),k.push(E.point([L,A],{val:b.Point[A].val[C],type:b.Point[A].type[C]}))});v=v.concat(k)}}a=new Date().valueOf()-(t+e)}else if(f==="swell-direction-contour"){x=!0;const b=((d=this.weatherLayers[f])==null?void 0:d.direction)||{};for(const A in b)if(A>p&&A<h&&(!(i<=this.zoom)||A%(i<2?10:i<4?5:3)===0)){const L=b[A].lng;u>y?L.forEach((C,z)=>{var M,T,N,F,O,q;if(i<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if((C>=u&&C<=180||C>=-180&&C<=y)&&(!(i<=this.zoom)||C%(i<2?10:i<4?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}}):L.forEach((C,z)=>{var M,T,N,F,O,q;if(u<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if(C>=u&&C<=y&&(!(i<=this.zoom)||C%(i<2?10:i<4?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}})}a=new Date().valueOf()-(t+e),console.log("swell direction elapsed: ",a,", total: ",e+=a);const k=this.weatherLayers[f].height;if(k){if(!k.data){const A=[];for(const L in(g=k.raw)==null?void 0:g.LineString){const C=k.raw.LineString[L];for(const z of C)A.push(E.lineString(z,{val:Number(L)}));k.data=E.featureCollection(A)}}if(k.data){const A=this.handleBboxClip(k.data,r);v=v.concat(A)}a=new Date().valueOf()-(t+e),console.log("swell height elapsed: ",a,", total: ",e+=a)}}v.length&&(this.weatherLayers[f].data=E.featureCollection(v)),x&&(this.weatherLayers[f].version=Math.random()+1)}}}},handleBboxClip(t,e){const a=[],r=P.LngLatHelper.convertToStdLng(e._sw.lng),i=P.LngLatHelper.convertToStdLng(e._ne.lng);return t.features.forEach(l=>{if(l.geometry.type!=="Point")if(r>i){let n=[r,e._sw.lat,180,e._ne.lat],s=E.bboxClip(l,n);s.geometry.coordinates.length&&a.push(s),n=[-180,e._sw.lat,i,e._ne.lat],s=E.bboxClip(l,n),s.geometry.coordinates.length&&a.push(s)}else{const n=[r,e._sw.lat,i,e._ne.lat],s=E.bboxClip(l,n);s.geometry.coordinates.length&&a.push(s)}else a.push(l)}),a},handleMove4Weather(){for(const t in this.weatherLayers)this.weatherLayers[t].active&&this.weatherLayers[t].type==="image"&&(this.weatherLayers[t].active=!0,this.weatherLayers[t].version=Math.random()+1);this.handleDrawWeather4Json()}}},Um={class:"idm-gl4-meteo-layers"},Jm={key:0,class:"legend-tip-btn-gl4"},Km={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},Qm={class:"d-flex flex-row justify-center align-center"},qm={class:"text-caption"},$m={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},ed={class:"d-flex flex-row justify-center align-center"},td={key:0,style:{width:"24px",height:"12px",border:"1px solid rgba(var(--v-border-color), var(--v-border-opacity))"}},od={class:"text-caption px-2"},ad={class:"d-flex flex-row justify-start align-start flex-wrap text-body-2 ml-n1"},id={class:"d-flex flex-row justify-start align-center"},rd={class:"d-flex flex-row justify-center align-center",style:{width:"40px"}},ld={class:"text-caption"},nd={class:"d-flex justify-start align-center ga-3"},sd={class:"text-h5 font-weight-medium"},cd={key:0,class:"w-100 d-flex justify-space-between align-center ga-1 mb-2 px-3"},md={key:0,class:"d-flex justify-start align-center ga-4 pl-6"},dd={key:1,class:"d-flex justify-start align-center ga-4 pl-6"},hd={key:2,class:"d-flex justify-start align-center ga-4 pl-6"},pd={key:3,class:"d-flex justify-start align-center ga-4 pl-6"},ud={class:"text-body-1 py-2"},gd={class:"text-body-1 font-weight-medium"},fd={class:"text-body-2 text-label"},yd={class:"text-body-2 text-label"},bd={class:"text-body-2 text-label mb-3"},wd={class:"text-body-1 font-weight-medium"},xd={class:"text-body-2 text-label"},kd={class:"text-body-2 text-label"},Ad={class:"text-body-2 text-label mb-3"},Ld={class:"text-body-1 py-2"},vd={class:"text-body-1 font-weight-medium"},Cd={class:"text-body-2 text-label"},_d={class:"text-body-2 text-label"},zd={class:"text-body-2 text-label mb-3"},Sd={class:"text-body-1 font-weight-medium"},Pd={class:"text-body-2 text-label"},Md={class:"text-body-2 text-label"},Td={class:"text-body-2 text-label mb-3"},Nd={class:"text-body-1 py-2"},Ed={class:"text-body-1 font-weight-medium"},Vd={class:"text-body-2 text-label"},Rd={class:"text-body-2 text-label"},Dd={class:"text-body-2 text-label mb-3"};function Bd(t,e,a,r,i,l){var S,Z,H,te,W,I,K,V,Y,ee,he,ge,re,ue,ye,ze;const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VCardText"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VCard"),g=o.resolveComponent("VSwitch"),u=o.resolveComponent("VBtnToggle"),y=o.resolveComponent("VCardTitle"),p=o.resolveComponent("VCardItem"),h=o.resolveComponent("VCheckbox"),f=o.resolveComponent("VRadio"),x=o.resolveComponent("IdmWindBarb"),v=o.resolveComponent("IdmSigWaveHeight"),b=o.resolveComponent("IdmCurrentDirection"),k=o.resolveComponent("IdmSwellDirection"),A=o.resolveComponent("IdmPrmsl"),L=o.resolveComponent("IdmWindParticle"),C=o.resolveComponent("IdmCurrentParticle"),z=o.resolveComponent("IdmSigWaveParticle"),M=o.resolveComponent("IdmSwellParticle"),T=o.resolveComponent("IdmIceEdge"),N=o.resolveComponent("IdmIceCover"),F=o.resolveComponent("IdmIceThickness"),O=o.resolveComponent("IdmPrecip3h"),q=o.resolveComponent("IdmVisibility"),$=o.resolveComponent("IdmWaterTemp"),le=o.resolveComponent("IdmTemp");return o.openBlock(),o.createElementBlock("div",Um,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+46+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("weather.weatherLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:J})=>[o.createVNode(n,o.mergeProps(J,{"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[10]||(e[10]=[o.createElementVNode("i",{class:"iconfont icon-Weather text-h4"},null,-1)])),_:2,__:[10]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),l.showTipMenu?(o.openBlock(),o.createElementBlock("div",Jm,[o.createElementVNode("div",{class:o.normalizeClass(["menu-bar-box pa-1 rounded",a.simple?"simple":""]),style:o.normalizeStyle({right:i.right+"px",top:a.simple?"426px":l.lengendTipTop+"px"})},[o.createVNode(s,{text:t.$t("weather.legend"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:J})=>[o.createVNode(n,o.mergeProps(J,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.legendToggle?"bg-primary active-border":""],onClick:e[0]||(e[0]=ne=>i.legendToggle=!i.legendToggle)}),{default:o.withCtx(()=>e[11]||(e[11]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),_:2,__:[11]},1040,["class"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),i.legendToggle?(o.openBlock(),o.createBlock(d,{key:0,elevation:"16",class:"card-info d-flex justify-center align-start",style:o.normalizeStyle({position:"absolute",top:a.simple?"200px":"340px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex flex-column justify-center align-start text-label px-1",style:{width:"120px"}},{default:o.withCtx(()=>[e[12]||(e[12]=o.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-1"},"Wind Level",-1)),o.createElementVNode("div",Km,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.legend.barbs,(J,ne)=>(o.openBlock(),o.createElementBlock("div",{key:J,class:"w-50 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[o.createElementVNode("div",Qm,[o.createElementVNode("i",{class:o.normalizeClass(["iconfont",l.barbsIconName[ne]]),style:o.normalizeStyle({color:a.theme==="dark"?"#fff":"#000"})},null,6),o.createElementVNode("span",qm,o.toDisplayString(Number(J)<10?`00${J}kts`:Number(J)<100?`0${J}kts`:`${J}kts`),1)])]))),128))])]),_:1,__:[12]}),o.createVNode(m,{vertical:""}),o.createVNode(c,{class:"d-flex flex-column justify-center align-start text-label px-2",style:{width:"100px"}},{default:o.withCtx(()=>[e[13]||(e[13]=o.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2"},"Wave Height",-1)),o.createElementVNode("div",$m,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.legend.sigWaveHeight,(J,ne)=>(o.openBlock(),o.createElementBlock("div",{key:ne,class:"w-100 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[o.createElementVNode("div",ed,[ne===0?(o.openBlock(),o.createElementBlock("div",td)):(o.openBlock(),o.createElementBlock("div",{key:1,style:o.normalizeStyle({width:"24px",height:"12px",background:J.color})},null,4)),o.createElementVNode("div",od,o.toDisplayString(J.label),1)])]))),128))])]),_:1,__:[13]}),o.createVNode(m,{vertical:""}),o.createVNode(c,{class:"d-flex flex-column justify-center align-start text-label pl-0 pr-2",style:{width:"100px"}},{default:o.withCtx(()=>[e[14]||(e[14]=o.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-2"},"Current",-1)),o.createElementVNode("div",ad,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.legend.current,(J,ne)=>(o.openBlock(),o.createElementBlock("div",{key:ne,class:"w-100 d-flex flex-row justify-center align-center py-1 px-0 ma-0"},[o.createElementVNode("div",id,[o.createElementVNode("div",rd,[o.createElementVNode("i",{class:"iconfont icon-a-direction-arrow text-label",style:o.normalizeStyle({fontSize:40*J.size+"px"})},null,4)]),o.createElementVNode("div",ld,o.toDisplayString(J.label),1)])]))),128))])]),_:1,__:[14]})]),_:1},8,["style"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:o.normalizeStyle(l.listStyle)},[o.createElementVNode("div",{class:o.normalizeClass(["header-box w-100 d-flex justify-space-between align-center",a.simple?"px-3":"px-4"])},[o.createElementVNode("div",nd,[o.createElementVNode("div",sd,o.toDisplayString(t.$t("weather.weather")),1),o.createVNode(g,{modelValue:i.autoActive,"onUpdate:modelValue":e[1]||(e[1]=J=>i.autoActive=J),class:"small-switch",color:"primary","base-color":"disabled",inset:"","hide-details":""},null,8,["modelValue"])]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:o.withCtx(()=>e[15]||(e[15]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[15]},8,["onClick"])],2),a.simple?(o.openBlock(),o.createElementBlock("div",cd,[o.createElementVNode("div",null,o.toDisplayString(t.$t("weather.forecastModel")),1),o.createVNode(u,{modelValue:i.currentModel,"onUpdate:modelValue":e[2]||(e[2]=J=>i.currentModel=J),rounded:"",height:"28",density:"compact",mandatory:"",group:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"28",value:"GFS",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="GFS"?"primary":"","base-color":""},{default:o.withCtx(()=>e[16]||(e[16]=[o.createTextVNode(" NOAA ",-1)])),_:1,__:[16]},8,["color"]),o.createVNode(n,{density:"compact",height:"28",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:o.withCtx(()=>e[17]||(e[17]=[o.createTextVNode(" ECMWF ",-1)])),_:1,__:[17]},8,["color"])]),_:1},8,["modelValue"])])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["list-box w-100 scroll overflow-y-auto",[i.autoActive?"":"cursor-not-allowed",a.simple?"px-3":"pl-4 pr-2"]])},[o.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:o.withCtx(()=>[o.createVNode(p,{class:"border-b-thin"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-h6"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.overlays")),1)]),_:1})]),_:1}),o.createVNode(c,{class:"py-2 mx-n1"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.tagLayers.filter(J=>J.overlays),J=>(o.openBlock(),o.createBlock(h,{key:J.key,modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=ne=>i.checkList=ne),value:J.key,label:t.$t(`weather.${J.locale}`),disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label","disabled"]))),128))]),_:1})]),_:1}),o.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:o.withCtx(()=>[o.createVNode(p,{class:"border-b-thin"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-h6"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.renders")),1)]),_:1})]),_:1}),o.createVNode(c,{class:"py-2 mx-n1"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.tagLayers.filter(J=>!J.overlays),J=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:J.key},[o.createVNode(f,{modelValue:i.renderKey,"onUpdate:modelValue":e[4]||(e[4]=ne=>i.renderKey=ne),label:t.$t(`weather.${J.locale}`),value:J.key,disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"text-body-2 py-1","hide-details":"",onClick:ne=>i.renderKey=i.renderKey===J.key?"":J.key},null,8,["modelValue","label","value","disabled","onClick"]),i.renderKey==="wind-particle"&&J.key==="wind-particle"?(o.openBlock(),o.createElementBlock("div",md,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showWindParticle,"onUpdate:modelValue":e[5]||(e[5]=ne=>i.showWindParticle=ne),label:"",class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"",style:{"font-size":"14px"},"hide-details":""},null,8,["modelValue"])])):o.createCommentVNode("",!0),i.renderKey==="current-particle"&&J.key==="current-particle"?(o.openBlock(),o.createElementBlock("div",dd,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showCurrentParticle,"onUpdate:modelValue":e[6]||(e[6]=ne=>i.showCurrentParticle=ne),label:"",class:"small-switch",color:"primary","base-color":"disabled",inset:"",density:"compact",height:"20","hide-details":""},null,8,["modelValue"])])):o.createCommentVNode("",!0),i.renderKey==="sig-wave-particle"&&J.key==="sig-wave-particle"?(o.openBlock(),o.createElementBlock("div",hd,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showSigWaveParticle,"onUpdate:modelValue":e[7]||(e[7]=ne=>i.showSigWaveParticle=ne),class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"","hide-details":"",disabled:!i.autoActive},null,8,["modelValue","disabled"])])):o.createCommentVNode("",!0),i.renderKey==="swell-particle"&&J.key==="swell-particle"?(o.openBlock(),o.createElementBlock("div",pd,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showSwellParticle,"onUpdate:modelValue":e[8]||(e[8]=ne=>i.showSwellParticle=ne),class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"","hide-details":"",disabled:!i.autoActive},null,8,["modelValue","disabled"])])):o.createCommentVNode("",!0),i.renderKey==="ice-forecast"&&J.key==="ice-forecast"?(o.openBlock(),o.createBlock(u,{key:4,modelValue:i.iceToggleValue,"onUpdate:modelValue":e[9]||(e[9]=ne=>i.iceToggleValue=ne),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"ice-cover",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-cover"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.coverage")),1)]),_:1},8,["color","disabled"]),o.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-thickness"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"ice-thickness"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.thickness")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):o.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1}),o.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:o.withCtx(()=>[o.createVNode(p,{class:"border-b-thin"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-h6"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1)]),_:1})]),_:1}),o.createVNode(c,{class:""},{default:o.withCtx(()=>{var J,ne,Fe,Ge,Re,Ce,je,Ne,Ee,De,We,Ze,Be,xe,ke,_e,He,Xe,Oe,Pe,rt,lt,nt,st,ct,mt,dt,ht,pt,ut,gt,ft,yt,bt,wt,xt,kt,At,Lt,vt,Ct,_t,zt,St,Pt,Mt,Tt,Nt,Et,Vt,Rt,Dt,Bt,It,Ft,Gt,jt,Wt,Zt,Me,Ve,Ht,Ye,Xt,et,Ae,Ue,ie,Le,U,X,Je,Ie,Se,G,Ot,oe,ve,Ke,tt,ot,B,Qe,j,qe,Ut,se,io,me,Lo,vo,Co,_o,zo,So,Po,Mo,To,No,Eo,Vo,Ro,Do,Bo,Io;return[o.createElementVNode("div",ud,o.toDisplayString(t.$t("weather.atmospheric")),1),o.createElementVNode("div",gd,o.toDisplayString((Fe=(ne=(J=i.models)==null?void 0:J.weather)==null?void 0:ne.NOAA)==null?void 0:Fe.source)+" "+o.toDisplayString((Ce=(Re=(Ge=i.models)==null?void 0:Ge.weather)==null?void 0:Re.NOAA)==null?void 0:Ce.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((De=(Ee=(Ne=(je=i.models)==null?void 0:je.weather)==null?void 0:Ne.NOAA)==null?void 0:Ee.meta)==null?void 0:De.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",fd,o.toDisplayString(t.$t("weather.source"))+": NOAA",1),o.createElementVNode("div",yd,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((xe=(Be=(Ze=(We=i.models)==null?void 0:We.weather)==null?void 0:Ze.NOAA)==null?void 0:Be.meta)==null?void 0:xe.availabilityTime)),1),o.createElementVNode("div",bd,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((Xe=(He=(_e=(ke=i.models)==null?void 0:ke.weather)==null?void 0:_e.NOAA)==null?void 0:He.meta)==null?void 0:Xe.initialisationTime)),1),o.createElementVNode("div",wd,o.toDisplayString((rt=(Pe=(Oe=i.models)==null?void 0:Oe.weather)==null?void 0:Pe.ECMWF)==null?void 0:rt.source)+" "+o.toDisplayString((st=(nt=(lt=i.models)==null?void 0:lt.weather)==null?void 0:nt.ECMWF)==null?void 0:st.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((ht=(dt=(mt=(ct=i.models)==null?void 0:ct.weather)==null?void 0:mt.ECMWF)==null?void 0:dt.meta)==null?void 0:ht.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",xd,o.toDisplayString(t.$t("weather.source"))+": ECMWF",1),o.createElementVNode("div",kd,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((ft=(gt=(ut=(pt=i.models)==null?void 0:pt.weather)==null?void 0:ut.ECMWF)==null?void 0:gt.meta)==null?void 0:ft.availabilityTime)),1),o.createElementVNode("div",Ad,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((xt=(wt=(bt=(yt=i.models)==null?void 0:yt.weather)==null?void 0:bt.ECMWF)==null?void 0:wt.meta)==null?void 0:xt.initialisationTime)),1),o.createVNode(m),o.createElementVNode("div",Ld,o.toDisplayString(t.$t("weather.wave")),1),o.createElementVNode("div",vd,o.toDisplayString((vt=(Lt=(At=(kt=i.models)==null?void 0:kt.marine)==null?void 0:At.wave)==null?void 0:Lt.NOAA)==null?void 0:vt.source)+" "+o.toDisplayString((St=(zt=(_t=(Ct=i.models)==null?void 0:Ct.marine)==null?void 0:_t.wave)==null?void 0:zt.NOAA)==null?void 0:St.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((Et=(Nt=(Tt=(Mt=(Pt=i.models)==null?void 0:Pt.marine)==null?void 0:Mt.wave)==null?void 0:Tt.NOAA)==null?void 0:Nt.meta)==null?void 0:Et.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",Cd,o.toDisplayString(t.$t("weather.source"))+": NOAA",1),o.createElementVNode("div",_d,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((It=(Bt=(Dt=(Rt=(Vt=i.models)==null?void 0:Vt.marine)==null?void 0:Rt.wave)==null?void 0:Dt.NOAA)==null?void 0:Bt.meta)==null?void 0:It.availabilityTime)),1),o.createElementVNode("div",zd,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((Zt=(Wt=(jt=(Gt=(Ft=i.models)==null?void 0:Ft.marine)==null?void 0:Gt.wave)==null?void 0:jt.NOAA)==null?void 0:Wt.meta)==null?void 0:Zt.initialisationTime)),1),o.createElementVNode("div",Sd,o.toDisplayString((Ye=(Ht=(Ve=(Me=i.models)==null?void 0:Me.marine)==null?void 0:Ve.wave)==null?void 0:Ht.ECMWF)==null?void 0:Ye.source)+" "+o.toDisplayString((Ue=(Ae=(et=(Xt=i.models)==null?void 0:Xt.marine)==null?void 0:et.wave)==null?void 0:Ae.ECMWF)==null?void 0:Ue.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((Je=(X=(U=(Le=(ie=i.models)==null?void 0:ie.marine)==null?void 0:Le.wave)==null?void 0:U.ECMWF)==null?void 0:X.meta)==null?void 0:Je.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",Pd,o.toDisplayString(t.$t("weather.source"))+": ECMWF",1),o.createElementVNode("div",Md,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((oe=(Ot=(G=(Se=(Ie=i.models)==null?void 0:Ie.marine)==null?void 0:Se.wave)==null?void 0:G.ECMWF)==null?void 0:Ot.meta)==null?void 0:oe.availabilityTime)),1),o.createElementVNode("div",Td,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((B=(ot=(tt=(Ke=(ve=i.models)==null?void 0:ve.marine)==null?void 0:Ke.wave)==null?void 0:tt.ECMWF)==null?void 0:ot.meta)==null?void 0:B.initialisationTime)),1),o.createVNode(m),o.createElementVNode("div",Nd,o.toDisplayString(t.$t("weather.currents")),1),o.createElementVNode("div",Ed,o.toDisplayString((Ut=(qe=(j=(Qe=i.models)==null?void 0:Qe.marine)==null?void 0:j.current)==null?void 0:qe.ECMWF)==null?void 0:Ut.source)+" "+o.toDisplayString((Lo=(me=(io=(se=i.models)==null?void 0:se.marine)==null?void 0:io.current)==null?void 0:me.ECMWF)==null?void 0:Lo.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((So=(zo=(_o=(Co=(vo=i.models)==null?void 0:vo.marine)==null?void 0:Co.current)==null?void 0:_o.ECMWF)==null?void 0:zo.meta)==null?void 0:So.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",Vd,o.toDisplayString(t.$t("weather.source"))+": ECMWF",1),o.createElementVNode("div",Rd,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((Eo=(No=(To=(Mo=(Po=i.models)==null?void 0:Po.marine)==null?void 0:Mo.current)==null?void 0:To.ECMWF)==null?void 0:No.meta)==null?void 0:Eo.availabilityTime)),1),o.createElementVNode("div",Dd,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((Io=(Bo=(Do=(Ro=(Vo=i.models)==null?void 0:Vo.marine)==null?void 0:Ro.current)==null?void 0:Do.ECMWF)==null?void 0:Bo.meta)==null?void 0:Io.initialisationTime)),1)]}),_:1})]),_:1})],2)],6),a.map?(o.openBlock(),o.createBlock(x,o.mergeProps({key:1,ref:"windBarb",map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-3",wind:(S=i.weatherLayers)==null?void 0:S.wind},t.$attrs),null,16,["map","map-feather","wind"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(v,o.mergeProps({key:2,map:a.map,"before-layer":"empty-layer-2","sig-wave-height":(Z=i.weatherLayers)==null?void 0:Z["sig-wave-height"]},t.$attrs),null,16,["map","sig-wave-height"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(b,o.mergeProps({key:3,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-1",current:(H=i.weatherLayers)==null?void 0:H.current},t.$attrs),null,16,["map","map-feather","current"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(k,o.mergeProps({key:4,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-1",swell:(te=i.weatherLayers)==null?void 0:te["swell-direction-contour"]},t.$attrs,{theme:a.theme}),null,16,["map","map-feather","swell","theme"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(A,o.mergeProps({key:5,map:a.map,"before-layer":"empty-layer-3",prmsl:(W=i.weatherLayers)==null?void 0:W.prmsl},t.$attrs,{theme:a.theme}),null,16,["map","prmsl","theme"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(L,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(I=i.weatherLayers)==null?void 0:I["wind-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(C,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(K=i.weatherLayers)==null?void 0:K["current-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(z,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(V=i.weatherLayers)==null?void 0:V["sig-wave-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(M,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(Y=i.weatherLayers)==null?void 0:Y["swell-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(T,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ee=i.weatherLayers)==null?void 0:ee["ice-edge"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(N,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(he=i.weatherLayers)==null?void 0:he["ice-cover"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(F,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ge=i.weatherLayers)==null?void 0:ge["ice-thickness"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(O,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(re=i.weatherLayers)==null?void 0:re.precip3h,"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(q,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ue=i.weatherLayers)==null?void 0:ue.visibility,"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock($,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ye=i.weatherLayers)==null?void 0:ye["water-temp"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(le,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ze=i.weatherLayers)==null?void 0:ze.temp,"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0)])}const Id=Q(Ym,[["render",Bd]]),fo=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"GFS",alias:"GFS",model:"gfs_seamless",provider:"NOAA",country:"United States",resolution:25,tips:"3-25km",length:16,frequency:1,models:["gfs_seamless"],categories:"ncep_gfs013,ncep_gfs025,ncep_gfs_graphcast025,ncep_hrrr_conus,ncep_nbm_conus",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:2,name:"ECMWF",alias:"ECMWF",model:"ecmwf_ifs025",provider:"ECMWF",country:"European Union",resolution:25,tips:"25km",length:15,frequency:6,models:["ecmwf_ifs025","ecmwf_aifs025_single","ecmwf_ifs"],categories:"ecmwf_ifs025,ecmwf_aifs025_single,ecmwf_ifs",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:3,disabled:!0,name:"ICON",alias:"ECMWF",model:"icon_seamless",provider:"Deutscher Wetterdienst (DWD)",country:"Germany",resolution:13,tips:"2-13km",length:7.5,frequency:3,models:["icon_seamless","icon_global","icon_eu","icon_d2"],categories:"dwd_icon,dwd_icon_eps,dwd_icon_d2,dwd_icon_d2_eps,dwd_icon_eu,dwd_icon_eu_eps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:4,name:"ARPEGE",disabled:!0,alias:"ECMWF",model:"arpege_seamless",provider:"Météo-France",country:"France",resolution:25,tips:"1-25km",length:4,frequency:1,models:["arpege_seamless","arpege_world","arpege_europe"],categories:"meteofrance_arpege_europe,meteofrance_arpege_europe_probabilities,meteofrance_arpege_world025",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:5,name:"UKMO",disabled:!0,alias:"ECMWF",model:"ukmo_seamless",provider:"UK Met Office",country:"United Kingdom",resolution:10,tips:"2-10km",length:7,frequency:1,models:["ukmo_seamless","ukmo_global_deterministic_10km","ukmo_uk_deterministic_2km"],categories:"ukmo_global_deterministic_10km,ukmo_uk_deterministic_2km",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:6,name:"JMA",disabled:!0,alias:"GFS",model:"jma_seamless",provider:"JMA",country:"Japan",resolution:55,tips:"5-55km",length:11,frequency:3,models:["jma_seamless","jma_msm","jma_gsm"],categories:"jma_gsm,jma_msm",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:7,name:"GEM",disabled:!0,alias:"GFS",model:"gem_seamless",provider:"Canadian Weather Service",country:"Canada",resolution:2.5,tips:"2.5km",length:10,frequency:6,models:["gem_seamless","gem_global","gem_regional"],categories:"cmc_gem_gdps,cmc_gem_hrdps,cmc_gem_rdps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:8,name:"GRAPES",disabled:!0,alias:"GFS",model:"cma_grapes_global",provider:"China Meteorological Administration (CMA)",country:"China",resolution:15,tips:"15km",length:10,frequency:6,models:["cma_grapes_global"],categories:"cma_grapes_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:9,name:"ACCESS-G",disabled:!0,alias:"GFS",model:"bom_access_global",provider:"Australian Bureau of Meteorology (BOM)",country:"Australia",resolution:15,tips:"15km",length:10,frequency:6,models:["bom_access_global"],categories:"bom_access_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"}],yo=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"MFWAM",alias:"ECMWF",model:"meteofrance_wave",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:12,models:["meteofrance_wave"],categories:"meteofrance_wave",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:2,disabled:!0,name:"SMOC",alias:"ECMWF",model:"meteofrance_currents",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:24,models:["meteofrance_currents"],categories:"meteofrance_currents, meteofrance_sea_surface_temperature",variables:"ocean_u_current,ocean_v_current,invert_barometer_height,sea_level_height_msl,sea_surface_temperature"},{rank:3,disabled:!0,name:"EWAM",alias:"ECMWF",model:"ewam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:8,frequency:2,models:["ewam"],categories:"dwd_ewam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:4,disabled:!0,name:"GWAM",alias:"ECMWF",model:"gwam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:4,frequency:2,models:["gwam"],categories:"dwd_gwam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:5,disabled:!0,name:"ECWAM",alias:"ECMWF",model:"ecmwf_wam025",provider:"ECMWF",country:"Europe",resolution:25,tips:"25km",length:10,frequency:6,models:["ecmwf_wam025"],categories:"ecmwf_wam025",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:6,name:"GFSWave",alias:"GFS",model:"ncep_gfswave025",provider:"NCEP",country:"USA",resolution:25,tips:"25km",length:10,frequency:6,models:["ncep_gfswave025","ncep_gfswave016"],categories:"ncep_gfswave025,ncep_gfswave016",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:7,disabled:!0,name:"ERA5-Ocean",alias:"ECMWF",model:"era5_ocean",provider:"Copernicus",country:"Europe",resolution:50,tips:"50km",length:-5,frequency:1,models:["era5_ocean"],categories:"copernicus_era5_ocean",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"}];let va=class{static standardWeatherModels(){return fo.filter(e=>!e.disabled&&e.alias)}static standardMarineModels(){return yo.filter(e=>!e.disabled&&e.alias)}static autoPickLayerModel(e,a="copernicus"){return a=a||"copernicus",a=a==null?void 0:a.toLowerCase(),a=["gfs","ecmwf","copernicus"].includes(a)?a:"copernicus",e=e==null?void 0:e.toLowerCase(),e==="gfs"?"gfs":["ec","ecmwf"].includes(e)?"ecmwf":["copernicus","cmems"].includes(e)?"copernicus":a}static autoPickPeerModel(e,a,r="copernicus"){if(a=this.autoPickLayerModel(a,r),pl.LayerHelper.WEATHER_LAYERS.reduce((i,l)=>l.atmos?i+l.weight:i,0)&e.weight){if(a==="copernicus")return"ecmwf"}else{if(["sig-wave","sig-wave-height","sig-wave-height-contour"].includes(e.key))return a;if(a==="ecmwf")return"copernicus"}return a}static autoPickMeteoModel(e="best_match"){var a,r;e=e==null?void 0:e.toLowerCase(),e=e==="ec"?"ecmwf":e;const i=e.toLowerCase().split(","),l=[],n=[];for(const s of i){let c=fo.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(s))||((u=d.alias)==null?void 0:u.toLowerCase())===s||((y=d.name)==null?void 0:y.toLowerCase())===s}),m=yo.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(s))||((u=d.alias)==null?void 0:u.toLowerCase())===s||((y=d.name)==null?void 0:y.toLowerCase())===s});c=c||fo.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=m==null?void 0:m.alias)==null?void 0:u.toLowerCase())}),m=m||yo.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=c==null?void 0:c.alias)==null?void 0:u.toLowerCase())}),c=c||fo[0],m=m||yo[0],l.push((a=c.models)!=null&&a.includes(s)?s:c.model),n.push((r=m.models)!=null&&r.includes(s)?s:m.model)}return{weatherModels:l.join(","),marineModels:n.join(",")}}static autoPickSubCategories(e){e=e.toUpperCase();const a=fo.filter(l=>l.alias===e),r=yo.filter(l=>l.alias===e),i=[];return a.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),r.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),i}static pickHourly(e,a){var r,i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z,H,te,W,I,K,V,Y,ee,he,ge,re,ue,ye,ze,J,ne,Fe,Ge,Re,Ce,je,Ne,Ee,De,We,Ze,Be,xe,ke,_e,He,Xe,Oe,Pe,rt,lt,nt,st,ct,mt,dt,ht,pt,ut,gt,ft,yt,bt,wt,xt,kt,At,Lt,vt,Ct,_t,zt,St,Pt,Mt,Tt,Nt,Et,Vt,Rt,Dt,Bt,It,Ft,Gt,jt,Wt,Zt,Me,Ve,Ht,Ye,Xt,et,Ae,Ue;const ie=typeof a=="string"?_(a):a;let Le=ie.clone();const U=e==null?void 0:e.weather,X=e==null?void 0:e.marine,Je=((i=(r=U==null?void 0:U[0])==null?void 0:r.hourly)==null?void 0:i.date)||((n=(l=X==null?void 0:X[0])==null?void 0:l.hourly)==null?void 0:n.date),Ie=_.utc(Je),Se=Ie.clone().add(((m=(c=(s=U==null?void 0:U[0])==null?void 0:s.hourly)==null?void 0:c.time)==null?void 0:m.at(0))||((u=(g=(d=X==null?void 0:X[0])==null?void 0:d.hourly)==null?void 0:g.time)==null?void 0:u.at(0)),"h"),G=Ie.clone().add(((h=(p=(y=U==null?void 0:U[0])==null?void 0:y.hourly)==null?void 0:p.time)==null?void 0:h.at(-1))||((v=(x=(f=X==null?void 0:X[0])==null?void 0:f.hourly)==null?void 0:x.time)==null?void 0:v.at(-1)),"h"),Ot=[];Le=Le.isBefore(Se)?Se.clone():Le,Le=Le.isAfter(G)?G.clone():Le;const oe=Le.utc().diff(Se,"h",!1);let ve,Ke;if(U!=null&&U.length){let tt=0,ot=0,B=0;for(const Qe of U){const j=Qe==null?void 0:Qe.hourly;for(let me=oe-(oe-1)%3;me<=oe;me++)tt+=((b=j==null?void 0:j.precipitation)==null?void 0:b.at(me))??0;for(let me=oe-(oe-1)%6;me<=oe;me++)ot+=((k=j==null?void 0:j.precipitation)==null?void 0:k.at(me))??0;for(let me=oe-(oe-1)%12;me<=oe;me++)B+=((A=j==null?void 0:j.precipitation)==null?void 0:A.at(me))??0;const qe=((L=j==null?void 0:j.wind_direction_10m)==null?void 0:L.at(oe))??((z=(C=j==null?void 0:j.wind_direction_10m)==null?void 0:C.filter(me=>me!==null))==null?void 0:z.at(-1));ve={temp:((M=j==null?void 0:j.temperature_2m)==null?void 0:M.at(oe))??((N=(T=j==null?void 0:j.temperature_2m)==null?void 0:T.filter(me=>me!==null))==null?void 0:N.at(-1)),apparentTemp:((F=j==null?void 0:j.apparent_temperature)==null?void 0:F.at(oe))??((q=(O=j==null?void 0:j.apparent_temperature)==null?void 0:O.filter(me=>me!==null))==null?void 0:q.at(-1)),rh:(($=j==null?void 0:j.relative_humidity_2m)==null?void 0:$.at(oe))??((S=(le=j==null?void 0:j.relative_humidity_2m)==null?void 0:le.filter(me=>me!==null))==null?void 0:S.at(-1)),dp:((Z=j==null?void 0:j.dew_point_2m)==null?void 0:Z.at(oe))??((te=(H=j==null?void 0:j.dew_point_2m)==null?void 0:H.filter(me=>me!==null))==null?void 0:te.at(-1)),precip:{probability:((W=j==null?void 0:j.precipitation_probability)==null?void 0:W.at(oe))??0,sum:((I=j==null?void 0:j.precipitation)==null?void 0:I.at(oe))??0,sum1Hours:((K=j==null?void 0:j.precipitation)==null?void 0:K.at(oe))??0,sum3Hours:Math.round(tt*100)/100,sum6Hours:Math.round(ot*100)/100,sum12Hours:Math.round(B*100)/100},pmsl:((V=j==null?void 0:j.pressure_msl)==null?void 0:V.at(oe))??((ee=(Y=j==null?void 0:j.pressure_msl)==null?void 0:Y.filter(me=>me!==null))==null?void 0:ee.at(-1)),psurf:((he=j==null?void 0:j.surface_pressure)==null?void 0:he.at(oe))??((re=(ge=j==null?void 0:j.surface_pressure)==null?void 0:ge.filter(me=>me!==null))==null?void 0:re.at(-1)),code:((ue=j==null?void 0:j.weather_code)==null?void 0:ue.at(oe))??((ze=(ye=j==null?void 0:j.weather_code)==null?void 0:ye.filter(me=>me!==null))==null?void 0:ze.at(-1)),visibility:this.m2nm(((J=j==null?void 0:j.visibility)==null?void 0:J.at(oe))??((Fe=(ne=j==null?void 0:j.visibility)==null?void 0:ne.filter(me=>me!==null))==null?void 0:Fe.at(-1))),wind:{speed:((Ge=j==null?void 0:j.wind_speed_10m)==null?void 0:Ge.at(oe))??((Ce=(Re=j==null?void 0:j.wind_speed_10m)==null?void 0:Re.filter(me=>me!==null))==null?void 0:Ce.at(-1)),kts:((je=j==null?void 0:j.wind_speed_10m)==null?void 0:je.at(oe))??((Ee=(Ne=j==null?void 0:j.wind_speed_10m)==null?void 0:Ne.filter(me=>me!==null))==null?void 0:Ee.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,gusts:((De=j==null?void 0:j.wind_gusts_10m)==null?void 0:De.at(oe))??((Ze=(We=j==null?void 0:j.wind_gusts_10m)==null?void 0:We.filter(me=>me!==null))==null?void 0:Ze.at(-1))},isDay:(Be=j==null?void 0:j.is_day)==null?void 0:Be.at(oe)};const{name:Ut,url:se,bg:io}=this.parseWeatherCode(ve.code,ve.isDay);ve.name=Ut,ve.url=se,ve.bg=io,ve.wind.scale=this.beaufort(this.kts2ms(ve.wind.kts)),ve.wind.direction=this.degree2Direction(ve.wind.degree),Ot.push({utc:ie.utc().format(),realUTC:Se.add(oe,"h").format(),model:Qe.model,weather:{...ve}})}}if(X!=null&&X.length){let tt=0;for(const ot of X){const B=ot==null?void 0:ot.hourly,Qe=((xe=B==null?void 0:B.wave_direction)==null?void 0:xe.at(oe))??((_e=(ke=B==null?void 0:B.wave_direction)==null?void 0:ke.filter(se=>se!==null))==null?void 0:_e.at(-1)),j=((He=B==null?void 0:B.swell_wave_direction)==null?void 0:He.at(oe))??((Oe=(Xe=B==null?void 0:B.swell_wave_direction)==null?void 0:Xe.filter(se=>se!==null))==null?void 0:Oe.at(-1)),qe=((Pe=B==null?void 0:B.wind_wave_direction)==null?void 0:Pe.at(oe))??((lt=(rt=B==null?void 0:B.wind_wave_direction)==null?void 0:rt.filter(se=>se!==null))==null?void 0:lt.at(-1)),Ut=((nt=B==null?void 0:B.ocean_current_direction)==null?void 0:nt.at(oe))??((ct=(st=B==null?void 0:B.ocean_current_direction)==null?void 0:st.filter(se=>se!==null))==null?void 0:ct.at(-1));Ke={wave:{sig:{height:((mt=B==null?void 0:B.wave_height)==null?void 0:mt.at(oe))??((ht=(dt=B==null?void 0:B.wave_height)==null?void 0:dt.filter(se=>se!==null))==null?void 0:ht.at(-1)),degree:Qe,bearing:Qe!==null?Math.round((Qe+180)%360):null,period:((pt=B==null?void 0:B.wave_period)==null?void 0:pt.at(oe))??((gt=(ut=B==null?void 0:B.wave_period)==null?void 0:ut.filter(se=>se!==null))==null?void 0:gt.at(-1))},swell:{height:((ft=B==null?void 0:B.swell_wave_height)==null?void 0:ft.at(oe))??((bt=(yt=B==null?void 0:B.swell_wave_height)==null?void 0:yt.filter(se=>se!==null))==null?void 0:bt.at(-1)),degree:j,bearing:j!==null?Math.round((j+180)%360):null,period:((wt=B==null?void 0:B.swell_wave_period)==null?void 0:wt.at(oe))??((kt=(xt=B==null?void 0:B.swell_wave_period)==null?void 0:xt.filter(se=>se!==null))==null?void 0:kt.at(-1)),peakPeriod:((At=B==null?void 0:B.swell_wave_peak_period)==null?void 0:At.at(oe))??((vt=(Lt=B==null?void 0:B.swell_wave_peak_period)==null?void 0:Lt.filter(se=>se!==null))==null?void 0:vt.at(-1))},wd:{height:((Ct=B==null?void 0:B.wind_wave_height)==null?void 0:Ct.at(oe))??((zt=(_t=B==null?void 0:B.wind_wave_height)==null?void 0:_t.filter(se=>se!==null))==null?void 0:zt.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,period:((St=B==null?void 0:B.wind_wave_period)==null?void 0:St.at(oe))??((Mt=(Pt=B==null?void 0:B.wind_wave_period)==null?void 0:Pt.filter(se=>se!==null))==null?void 0:Mt.at(-1)),peakPeriod:((Tt=B==null?void 0:B.wind_wave_peak_period)==null?void 0:Tt.at(oe))??((Et=(Nt=B==null?void 0:B.wind_wave_peak_period)==null?void 0:Nt.filter(se=>se!==null))==null?void 0:Et.at(-1))}},current:{speed:((Vt=B==null?void 0:B.ocean_current_velocity)==null?void 0:Vt.at(oe))??((Dt=(Rt=B==null?void 0:B.ocean_current_velocity)==null?void 0:Rt.filter(se=>se!==null))==null?void 0:Dt.at(-1)),kts:((Bt=B==null?void 0:B.ocean_current_velocity)==null?void 0:Bt.at(oe))??((Ft=(It=B==null?void 0:B.ocean_current_velocity)==null?void 0:It.filter(se=>se!==null))==null?void 0:Ft.at(-1)),degree:Ut,bearing:Ut},sst:((Gt=B==null?void 0:B.sea_surface_temperature)==null?void 0:Gt.at(oe))??((Wt=(jt=B==null?void 0:B.sea_surface_temperature)==null?void 0:jt.filter(se=>se!==null))==null?void 0:Wt.at(-1)),height:((Zt=B==null?void 0:B.sea_level_height_msl)==null?void 0:Zt.at(oe))??((Ve=(Me=B==null?void 0:B.sea_level_height_msl)==null?void 0:Me.filter(se=>se!==null))==null?void 0:Ve.at(-1)),ice:{sit:((Ht=B==null?void 0:B.sea_ice_thickness)==null?void 0:Ht.at(oe))??((Xt=(Ye=B==null?void 0:B.sea_ice_thickness)==null?void 0:Ye.filter(se=>se!==null))==null?void 0:Xt.at(-1)),sic:((et=B==null?void 0:B.sea_ice_concentration)==null?void 0:et.at(oe))??((Ue=(Ae=B==null?void 0:B.sea_ice_concentration)==null?void 0:Ae.filter(se=>se!==null))==null?void 0:Ue.at(-1))}},Ke.wave=this.parseWave(Ke.wave,ve==null?void 0:ve.wind),Ke.current.direction=this.degree2Direction(Ke.current.degree),Ot[tt]?Object.assign(Ot[tt],Ke):Ot.push({utc:ie.utc().format(),realUTC:Se.add(oe,"h").format(),model:ot.model,...Ke}),tt++}}return Ot}static toLegacy(e){var a,r,i,l,n,s,c,m,d,g;return{wind:(a=e==null?void 0:e.weather)==null?void 0:a.wind,visibility:(r=e==null?void 0:e.weather)==null?void 0:r.visibility,temp:(i=e==null?void 0:e.weather)==null?void 0:i.temp,prmsl:(l=e==null?void 0:e.weather)==null?void 0:l.pmsl,gusts:{kts:(s=(n=e==null?void 0:e.weather)==null?void 0:n.wind)==null?void 0:s.gusts},precip:(c=e==null?void 0:e.weather)==null?void 0:c.precip,code:(m=e==null?void 0:e.weather)==null?void 0:m.code,name:(d=e==null?void 0:e.weather)==null?void 0:d.name,url:(g=e==null?void 0:e.weather)==null?void 0:g.url,wave:e==null?void 0:e.wave,current:e==null?void 0:e.current,sst:e==null?void 0:e.sst,height:e==null?void 0:e.height,utc:e==null?void 0:e.utc,source:e==null?void 0:e.model,ice:e==null?void 0:e.ice}}static pickDaily(e,a){var r,i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z,H,te,W,I,K,V,Y,ee,he,ge,re,ue,ye,ze,J,ne,Fe,Ge,Re,Ce,je,Ne,Ee,De,We,Ze,Be,xe,ke,_e,He,Xe,Oe,Pe,rt,lt,nt,st,ct,mt,dt,ht,pt,ut,gt,ft,yt,bt,wt,xt,kt,At,Lt,vt,Ct,_t,zt,St,Pt,Mt,Tt,Nt,Et,Vt,Rt,Dt,Bt,It,Ft,Gt,jt,Wt;const Zt=typeof a=="string"?_(a):a;let Me=Zt.clone();const Ve=e==null?void 0:e.weather,Ht=e==null?void 0:e.marine,Ye=_((l=(i=(r=Ve==null?void 0:Ve[0])==null?void 0:r.daily)==null?void 0:i.time)==null?void 0:l.at(0)),Xt=_((c=(s=(n=Ve==null?void 0:Ve[0])==null?void 0:n.daily)==null?void 0:s.time)==null?void 0:c.at(-1)),et=[];Me=Me.isBefore(Ye)?Ye.clone():Me,Me=Me.isAfter(Xt)?Xt.clone():Me;let Ae,Ue;const ie=Me.diff(Ye,"d",!1);if(Ve)for(const Le of Ve){const U=Le.daily,X=((m=U.wind_direction_10m_dominant)==null?void 0:m.at(ie))??((g=(d=U.wind_direction_10m_dominant)==null?void 0:d.filter(G=>G!==null))==null?void 0:g.at(-1));Ae={code:((u=U.weather_code)==null?void 0:u.at(ie))??((p=(y=U.weather_code)==null?void 0:y.filter(G=>G!==null))==null?void 0:p.at(-1)),temp:{max:((h=U.temperature_2m_max)==null?void 0:h.at(ie))??((x=(f=U.temperature_2m_max)==null?void 0:f.filter(G=>G!==null))==null?void 0:x.at(-1)),min:((v=U.temperature_2m_min)==null?void 0:v.at(ie))??((k=(b=U.temperature_2m_min)==null?void 0:b.filter(G=>G!==null))==null?void 0:k.at(-1)),mean:((A=U.temperature_2m_mean)==null?void 0:A.at(ie))??((C=(L=U.temperature_2m_mean)==null?void 0:L.filter(G=>G!==null))==null?void 0:C.at(-1))},apparentTemp:{max:((z=U.apparent_temperature_max)==null?void 0:z.at(ie))??((T=(M=U.apparent_temperature_max)==null?void 0:M.filter(G=>G!==null))==null?void 0:T.at(-1)),min:((N=U.apparent_temperature_min)==null?void 0:N.at(ie))??((O=(F=U.apparent_temperature_min)==null?void 0:F.filter(G=>G!==null))==null?void 0:O.at(-1))},precip:{sum:((q=U.precipitation_sum)==null?void 0:q.at(ie))??((le=($=U.precipitation_sum)==null?void 0:$.filter(G=>G!==null))==null?void 0:le.at(-1)),rainSum:((S=U.rain_sum)==null?void 0:S.at(ie))??((H=(Z=U.rain_sum)==null?void 0:Z.filter(G=>G!==null))==null?void 0:H.at(-1)),snowfallSum:((te=U.snowfall_sum)==null?void 0:te.at(ie))??((I=(W=U.snowfall_sum)==null?void 0:W.filter(G=>G!==null))==null?void 0:I.at(-1)),showersSum:((K=U.showers_sum)==null?void 0:K.at(ie))??((Y=(V=U.showers_sum)==null?void 0:V.filter(G=>G!==null))==null?void 0:Y.at(-1)),hours:((ee=U.precipitation_hours)==null?void 0:ee.at(ie))??0,probability:((he=U.precipitation_probability_max)==null?void 0:he.at(ie))??0},rh:{max:((ge=U.relative_humidity_2m_max)==null?void 0:ge.at(ie))??((ue=(re=U.relative_humidity_2m_max)==null?void 0:re.filter(G=>G!==null))==null?void 0:ue.at(-1)),min:((ye=U.relative_humidity_2m_min)==null?void 0:ye.at(ie))??((J=(ze=U.relative_humidity_2m_min)==null?void 0:ze.filter(G=>G!==null))==null?void 0:J.at(-1)),mean:((ne=U.relative_humidity_2m_mean)==null?void 0:ne.at(ie))??((Ge=(Fe=U.relative_humidity_2m_mean)==null?void 0:Fe.filter(G=>G!==null))==null?void 0:Ge.at(-1))},wind:{speed:((Re=U.wind_speed_10m_max)==null?void 0:Re.at(ie))??((je=(Ce=U.wind_speed_10m_max)==null?void 0:Ce.filter(G=>G!==null))==null?void 0:je.at(-1)),kts:((Ne=U.wind_speed_10m_max)==null?void 0:Ne.at(ie))??((De=(Ee=U.wind_speed_10m_max)==null?void 0:Ee.filter(G=>G!==null))==null?void 0:De.at(-1)),degree:X,gusts:((We=U.wind_gusts_10m_max)==null?void 0:We.at(ie))??((Be=(Ze=U.wind_gusts_10m_max)==null?void 0:Ze.filter(G=>G!==null))==null?void 0:Be.at(-1)),mean:((xe=U.wind_speed_10m_mean)==null?void 0:xe.at(ie))??((_e=(ke=U.wind_speed_10m_mean)==null?void 0:ke.filter(G=>G!==null))==null?void 0:_e.at(-1)),bearing:X!==null?Math.round((X+180)%360):null},visibility:{max:this.m2nm(((He=U.visibility_max)==null?void 0:He.at(ie))??((Oe=(Xe=U.visibility_max)==null?void 0:Xe.filter(G=>G!==null))==null?void 0:Oe.at(-1))),min:this.m2nm(((Pe=U.visibility_min)==null?void 0:Pe.at(ie))??((lt=(rt=U.visibility_min)==null?void 0:rt.filter(G=>G!==null))==null?void 0:lt.at(-1))),mean:this.m2nm(((nt=U.visibility_mean)==null?void 0:nt.at(ie))??((ct=(st=U.visibility_mean)==null?void 0:st.filter(G=>G!==null))==null?void 0:ct.at(-1)))}};const{name:Je,url:Ie,bg:Se}=this.parseWeatherCode(Ae.code,!0);Ae.name=Je,Ae.url=Ie,Ae.bg=Se,Ae.wind.scale=this.beaufort(this.kts2ms(Ae.wind.kts)),Ae.wind.direction=this.degree2Direction(Ae.wind.degree),et.push({utc:Zt.utc().format(),realUTC:Ye.add(ie,"d").utc().format(),model:Le.model,weather:{...Ae}})}if(Ht){let Le=0;for(const U of Ht){const X=U.daily,Je=((mt=X==null?void 0:X.wave_direction_dominant)==null?void 0:mt.at(ie))||((ht=(dt=X==null?void 0:X.wave_direction_dominant)==null?void 0:dt.filter(G=>G!==null))==null?void 0:ht.at(-1)),Ie=((pt=X==null?void 0:X.swell_wave_direction_dominant)==null?void 0:pt.at(ie))||((gt=(ut=X==null?void 0:X.swell_wave_direction_dominant)==null?void 0:ut.filter(G=>G!==null))==null?void 0:gt.at(-1)),Se=((ft=X==null?void 0:X.wind_wave_direction_dominant)==null?void 0:ft.at(ie))||((bt=(yt=X==null?void 0:X.wind_wave_direction_dominant)==null?void 0:yt.filter(G=>G!==null))==null?void 0:bt.at(-1));Ue={wave:{sig:{height:((wt=X==null?void 0:X.wave_height_max)==null?void 0:wt.at(ie))||((kt=(xt=X==null?void 0:X.wave_height_max)==null?void 0:xt.filter(G=>G!==null))==null?void 0:kt.at(-1)),degree:Je,period:((At=X==null?void 0:X.wave_period_max)==null?void 0:At.at(ie))||((vt=(Lt=X==null?void 0:X.wave_period_max)==null?void 0:Lt.filter(G=>G!==null))==null?void 0:vt.at(-1)),bearing:Je!==null?Math.round((Je+180)%360):null},swell:{height:((Ct=X==null?void 0:X.swell_wave_height_max)==null?void 0:Ct.at(ie))??((zt=(_t=X==null?void 0:X.swell_wave_height_max)==null?void 0:_t.filter(G=>G!==null))==null?void 0:zt.at(-1)),degree:Ie,period:((St=X==null?void 0:X.swell_wave_period_max)==null?void 0:St.at(ie))??((Mt=(Pt=X==null?void 0:X.swell_wave_period_max)==null?void 0:Pt.filter(G=>G!==null))==null?void 0:Mt.at(-1)),peakPeriod:((Tt=X==null?void 0:X.swell_wave_peak_period_max)==null?void 0:Tt.at(ie))??((Et=(Nt=X==null?void 0:X.swell_wave_peak_period_max)==null?void 0:Nt.filter(G=>G!==null))==null?void 0:Et.at(-1)),bearing:Ie!==null?Math.round((Ie+180)%360):null},wd:{height:((Vt=X==null?void 0:X.wind_wave_height_max)==null?void 0:Vt.at(ie))??((Dt=(Rt=X==null?void 0:X.wind_wave_height_max)==null?void 0:Rt.filter(G=>G!==null))==null?void 0:Dt.at(-1)),degree:Se,period:((Bt=X==null?void 0:X.wind_wave_period_max)==null?void 0:Bt.at(ie))??((Ft=(It=X==null?void 0:X.wind_wave_period_max)==null?void 0:It.filter(G=>G!==null))==null?void 0:Ft.at(-1)),peakPeriod:((Gt=X==null?void 0:X.wind_wave_peak_period_max)==null?void 0:Gt.at(ie))??((Wt=(jt=X==null?void 0:X.wind_wave_peak_period_max)==null?void 0:jt.filter(G=>G!==null))==null?void 0:Wt.at(-1)),bearing:Se!==null?Math.round((Se+180)%360):null}}},Ue.wave=this.parseWave(Ue.wave,Ae==null?void 0:Ae.wind),Object.assign(et[Le]||{},Ue),Le++}}return et}static parseWave(e,a){if(e.sig.direction=this.degree2Direction(e.sig.degree),e.swell.direction=this.degree2Direction(e.swell.degree),e.wd.direction=this.degree2Direction(e.wd.degree),e.sig.scale=this.douglas(e.sig.height),e.swell.scale=this.douglas(e.swell.height),e.wd.scale=this.douglas(e.wd.height),e.sig.height==0){const r=Math.sqrt(Math.pow(e.swell.height||0,2)+Math.pow(e.wd.height||0,2));e.sig.height=r?Math.round(r*100)/100:.1}if(e.swell.height===0)if(e.sig.height>e.wd.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.wd.height||0,2)));e.swell.height=Math.round(r*100)/100}else{const r=Math.round(.12*this.kts2ms((a==null?void 0:a.kts)||0)*100)/100,i=r>1?r/10:r>.5?r/5:r>.3?r/2:r,l=Math.max(e.sig.height,e.wd.height);e.swell.height=Math.round((i<l?i:l/2)*100)/100}if(e.wd.height===0)if(e.sig.height>e.swell.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.swell.height||0,2))),i=.24*this.kts2ms((a==null?void 0:a.kts)||0);e.wd.height=Math.round(Math.min(r,i)*100)/100}else{const r=.24*this.kts2ms((a==null?void 0:a.kts)||0),i=Math.max(e.sig.height,e.swell.height);e.wd.height=Math.round((r<i?r:i/2)*100)/100}if(e.swell.height>=e.sig.height&&(e.swell.height=Math.round(e.sig.height*.8*100)/100),e.wd.height>=e.sig.height&&(e.wd.height=Math.round(e.sig.height*.8*100)/100),!e.sig.period){const r=Math.max(e.swell.period,e.wd.period);e.sig.period=Math.round(6*Math.sqrt(e.sig.height)),e.sig.period=isNaN(r)?void 0:e.sig.period>r?r:e.sig.period}if(!e.swell.period){e.swell.period=Math.round(6*Math.sqrt(e.swell.height));const r=Math.max(e.sig.period,e.wd.period);e.swell.period=isNaN(r)?void 0:e.swell.period>r?r:e.swell.period}if(!e.wd.period){e.wd.period=Math.round(6*Math.sqrt(e.wd.height));const r=Math.max(e.sig.period,e.swell.period);e.wd.period=isNaN(r)?void 0:e.wd.period>r?r:e.wd.period}return e}static parseWeatherCode(e,a){const r=this.weatherCode(e);return(a?r.day:r.night)||{}}static weatherCode(e){const a={code:e};switch(e){case 0:a.day={name:"Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 1:a.day={name:"Mainly Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Mainly Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 2:a.day={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"},a.night={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"};break;case 3:a.day={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"},a.night={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"};break;case 45:a.day={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 48:a.day={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 51:a.day={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 53:a.day={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 55:a.day={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 56:a.day={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 57:a.day={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 61:a.day={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 63:a.day={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 65:a.day={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 66:a.day={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 67:a.day={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 71:a.day={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 73:a.day={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 75:a.day={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 77:a.day={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 80:a.day={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 81:a.day={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 82:a.day={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 85:a.day={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 86:a.day={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 95:a.day={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 96:a.day={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 99:a.day={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break}return a}static kts2ms(e){return isNaN(e)||e===null?e:Math.round(e*1852/3600*1e4)/1e4}static kts2kmh(e){return isNaN(e)||e===null?e:e*1.852}static m2nm(e){return isNaN(e)||e===null?e:Math.round(e/1e3/1.852*1e4)/1e4}static kmh2kts(e){return isNaN(e)||e===null?e:this.ms2kts(e*1e3/3600)}static ms2kts(e){return isNaN(e)||e===null?e:Math.round(e*3600/1852*1e4)/1e4}static degree2Radian(e){if(isNaN(e)||e===null)return e;let a=e%360/360*2*Math.PI;return a=a<0?a+2*Math.PI:a,a}static degree2Direction(e){const a=this.degree2Radian(e);if(isNaN(a)||a===null)return null;let r="N/A";const i=Math.PI/16;return a<i?r="N":a>=i&&a<3*i?r="NNE":a>=3*i&&a<5*i?r="NE":a>=5*i&&a<7*i?r="ENE":a>=7*i&&a<9*i?r="E":a>=9*i&&a<11*i?r="ESE":a>=11*i&&a<13*i?r="SE":a>=13*i&&a<15*i?r="SSE":a>=15*i&&a<17*i?r="S":a>=17*i&&a<19*i?r="SSW":a>=19*i&&a<21*i?r="SW":a>=21*i&&a<23*i?r="WSW":a>=23*i&&a<25*i?r="W":a>=25*i&&a<27*i?r="WNW":a>=27*i&&a<29*i?r="NW":a>=29*i&&a<31*i?r="NNW":a>=31*i&&a<32*i&&(r="N"),r}static beaufort(e){let a=0;return isNaN(e)||(e=Math.round(e*10)/10,e<=.2?a=0:e<=1.5?a=1:e<=3.3?a=2:e<=5.4?a=3:e<=7.9?a=4:e<=10.7?a=5:e<=13.8?a=6:e<=17.1?a=7:e<=20.7?a=8:e<=22.4?a=9:e<=28.4?a=10:e<=32.6?a=11:e<=36.9?a=12:e<=41.4?a=13:e<=46.1?a=14:e<=50.9?a=15:e<=55.9?a=16:e<=61.2?a=17:e>61.2&&(a=18)),a}static douglas(e){let a="Calm";return isNaN(e)||e<=.1?a="Calm":e<=.5?a="Smooth":e<=1.25?a="Slight":e<=2.5?a="Moderate":e<=4?a="Rough":e<=6?a="VeryRough":e<=9?a="High":e<=14?a="VeryHigh":a="Precipitous",a}};const Wb="",Fd={name:"IdmTropicals",props:{simple:{type:Boolean,default:!1},permission:{type:Number},locale:{type:String},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},timeZone:{type:Number},token:{type:String},defaultMeteoToken:{type:String},gateway:{type:String,default:"aa"},assistGateway:{type:Array,default:[]},forecastModel:{type:String},realTime:{type:String},beforeLayer:{type:String},platform:{type:String}},emits:["tropical","tropicalCenterPoints","tropicalReport"],setup(){return{Theme:be.useTheme()}},data(){return{right:10,toggle:!1,helper:ho.CompanyHelper,tropicals:void 0,tropicalCacheKey:"tropicalCacheGL4",source:"tropicals-source",clusterSource:"tropicals-cluster-source",historyLayer:"tropicals-history-layer",forecastLayer:"tropicals-forecast-layer",forecastModelLayer:"tropicals-forecast-model-layer",forecastNameLayer:"tropicals-forecast-name-layer",pointCircleLayer:"tropicals-point-circle-layer",pointLabelLayer:"tropicals-point-label-layer",historyPointCircleLayer:"history-tropicals-point-circle-layer",historyPointLabelLayer:"history-tropicals-point-label-layer",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicalsInfo:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:E.featureCollection([]),showLegend:!1,showHoverPoint:!1,hoverPoint:void 0,hoverMarker:void 0}},computed:{hoverLayers(){return[this.forecastNameLayer,this.forecastLayer,this.historyLayer,this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]},clickLayers(){return[this.forecastNameLayer,this.historyLayer]},computeTime(){return(t,e)=>{if(t){const a=_(t).utcOffset(e),r=e<0?e:"+"+e;return`${a==null?void 0:a.format("MMM-DD/HHmm")} (UTC${r}) ${a==null?void 0:a.fromNow()} `}return"-"}},computeTzTime(){return(t,e,a="MM-DD HH:mm")=>{var r,i;if(t){const l=e||0,n=(i=(r=_(t))==null?void 0:r.utcOffset(l))==null?void 0:i.format(a),s=`(UTC ${l>=0?"+":""}${l})`;return n+" "+s}return"-"}},computeTimezone(){return this.timeZone<0?this.timeZone:"+"+this.timeZone},computeBF(){return function(t){const e=va.kts2ms(t);return va.beaufort(e)}},computeMovement(){return function(t){var e,a;return(a=(e=t==null?void 0:t.forecasts)==null?void 0:e.find(r=>!r.disabled))==null?void 0:a.movement}},computePosition(){return t=>!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}},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},map:{handler(){this.map?(this.toggle=localStorage.getItem(this.tropicalCacheKey)==="true"||!1,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle&&this.fetchTropicals()):this.handleClear()}},showTropicalsInfo:{handler(){this.$emit("tropical",this.showTropicalsInfo),this.simple&&this.showTropicalsInfo?this.$nextTick(()=>{var t,e;this.$parent.playerBottom=((e=(t=this.$refs.tropicalsInfo)==null?void 0:t.$el)==null?void 0:e.clientHeight)+10}):this.simple&&(this.$parent.playerBottom=30)},immediate:!0},"tropicals.version":{handler(){this.handleRefresh()}},timeZone:{handler(t,e){t!==e&&this.handleRefresh()}},realTime:{handler(t){this.map&&t&&this.toggle&&this.handleRender()}},locale:{handler(t){this.map&&this.toggle&&this.handleRefresh()}}},methods:{handleMenuToggle(){var t,e,a;this.toggle=!this.toggle,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle?this.fetchTropicals():(this.handleClear(),(a=(e=(t=this.$parent)==null?void 0:t.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("tropical",!1))},async fetchTropicals(){var i,l,n;const t=new Date().valueOf();let e=0,a=0,r=(i=ho.LayerHelper.WEATHER_LAYERS.find(s=>s.key==="tropicals"))==null?void 0:i.weight;if(r>0){const s=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await de.get(`${s}/api/arc/weather/layers2/links?l=${r}&v=${this.forecastModel}&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(a=new Date().valueOf()-(t+e),console.log("weather links elapsed: ",a,", total: ",e+=a),((l=c==null?void 0:c.data)==null?void 0:l.code)===0){const m=(n=c==null?void 0:c.data)==null?void 0:n.data;await de.get(m.tropicals,{headers:{Authorization:this.token||this.defaultMeteoToken,key:"tropicals"},responseType:/\.(jpg|png)$/.test(m.tropicals)?"blob":"json"}).then(d=>{var y,p,h,f;const g=P.TropicalHelper.convert2Geojson(((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data));((h=(p=d==null?void 0:d.config)==null?void 0:p.headers)==null?void 0:h.key)&&g&&(this.tropicals={data:g,list:(f=d.data)==null?void 0:f.data,active:!0,cached:!0,type:"json",etime:c.data.etime,version:Math.random()+1})}).catch(d=>{console.log(`tropicals fetch layer error: ${d}`)})}a=new Date().valueOf()-(t+e),console.log("tropicals elapsed: ",a,", total: ",e+=a)}},handleRefresh(){var e,a;(((a=(e=this.tropicals)==null?void 0:e.data)==null?void 0:a.features)||[]).forEach(r=>{var l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C;let i="";switch(!0){case(((l=r.properties.wind)==null?void 0:l.kts)<32||((n=r.properties)==null?void 0:n.kts)<32):i="td";break;case(((s=r.properties.wind)==null?void 0:s.kts)<47||((c=r.properties)==null?void 0:c.kts)<47):i="ts";break;case(((m=r.properties.wind)==null?void 0:m.kts)<63||((d=r.properties)==null?void 0:d.kts)<63):i="sts";break;case(((g=r.properties.wind)==null?void 0:g.kts)<79||((u=r.properties)==null?void 0:u.kts)<79):i="ty";break;case(((y=r.properties.wind)==null?void 0:y.kts)<94||((p=r.properties)==null?void 0:p.kts)<94):i="sty";break;case(((h=r.properties.wind)==null?void 0:h.kts)>=94||((f=r.properties)==null?void 0:f.kts)>=94):i="superTy";break;default:i="superTy";break}r.properties.levelI18n=i,((x=r.geometry)==null?void 0:x.type)==="Point"&&((v=r.properties)!=null&&v.important)&&(r.properties.format=(k=(b=_(r.properties.date))==null?void 0:b.utcOffset(this.timeZone))==null?void 0:k.format(`MMM-DD/HHmm [(utc${this.computeTimezone})]`)),((A=r.geometry)==null?void 0:A.type)==="Point"&&(r.properties.Name=((C=(L=r.properties.name)==null?void 0:L.trim())==null?void 0:C.replace(/^./,z=>z.toUpperCase()))||r.properties.nameCn,r.properties.nameCn=r.properties.nameCn||r.properties.Name||"-")}),this.handleInit()},handleInit(){var t,e,a,r,i,l,n,s,c,m,d,g;this.handleClear(),this.tropicals&&this.map&&(this.handleRender(),(t=this.map)==null||t.on("click",this.clickLayers,this.handleClick),(e=this.map)==null||e.on("mousemove",this.hoverLayers,this.handleHover),(a=this.map)==null||a.on("mouseleave",this.hoverLayers,this.handleLeave)),((l=(i=(r=this.tropicals)==null?void 0:r.data)==null?void 0:i.features)==null?void 0:l.length)>0?(c=(s=(n=this.$parent)==null?void 0:n.$refs)==null?void 0:s.idmBottomBar)==null||c.handleToggle("tropical",!0):(g=(d=(m=this.$parent)==null?void 0:m.$refs)==null?void 0:d.idmBottomBar)==null||g.handleToggle("tropical",!1)},handleRender(){var t,e,a,r,i,l,n,s,c,m;if(this.tropicals&&this.map){const d=new Date().valueOf();let g=0,u=0;(t=this.map)!=null&&t.getSource(this.source)?((a=this.map)==null||a.getSource(this.source).setData((e=this.tropicals)!=null&&e.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g)):(this.map.addSource(this.source,{type:"geojson",data:(r=this.tropicals)!=null&&r.active?(i=this.tropicals)==null?void 0:i.data:this.empty}),this.map.addLayer({id:this.historyLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","history"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-width":3,"line-opacity":.7}},this.beforeLayer),this.map.addLayer({id:this.forecastLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"line-width":2,"line-opacity":1,"line-dasharray":[1,2]}},this.beforeLayer),this.map.addLayer({id:this.forecastModelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"symbol-placement":"line","text-field":"{model}","text-rotation-alignment":"viewport","text-size":12},paint:{"text-color":this.Theme.current.value.dark?"#333":"#fff","text-opacity":1,"text-halo-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"text-halo-width":4}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((s=this.map)==null||s.getSource(this.clusterSource).setData((n=this.tropicals)!=null&&n.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropical] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(c=this.tropicals)!=null&&c.active?(m=this.tropicals)==null?void 0:m.data:this.empty}),this.map.addLayer({id:this.pointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.pointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":4,"circle-color":["case",["boolean",["==",["get","kts",["get","wind"]],null]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],32]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],47]],this.Theme.current.value.colors["tropicals-ts"],["boolean",["<",["get","kts",["get","wind"]],63]],this.Theme.current.value.colors["tropicals-sts"],["boolean",["<",["get","kts",["get","wind"]],79]],this.Theme.current.value.colors["tropicals-ty"],["boolean",["<",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-sty"],["boolean",[">=",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-super-ty"],"#fff"]}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":6,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":"rgba(0,0,0,0.7)"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-inner",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":3,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["==","important",!0]],layout:{"text-field":["get",this.locale==="en"?"Name":"nameCn"],"text-anchor":"bottom","text-size":16,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-offset":[0,2]},paint:{"text-color":this.Theme.current.value.colors["map-blue"],"text-halo-color":"#ffffff","text-halo-width":2}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u));const y=P.TropicalHelper.interpolate(this.tropicals,1);this.interpolateData=JSON.parse(JSON.stringify(y)),this.handleDateChange()}},handleClear(){var t,e,a,r;this.map&&(this.map.getLayer(this.historyLayer)&&this.map.removeLayer(this.historyLayer),this.map.getLayer(this.forecastLayer)&&this.map.removeLayer(this.forecastLayer),this.map.getLayer(this.forecastModelLayer)&&this.map.removeLayer(this.forecastModelLayer),this.map.getLayer(this.forecastNameLayer)&&this.map.removeLayer(this.forecastNameLayer),this.map.getLayer(this.pointCircleLayer)&&this.map.removeLayer(this.pointCircleLayer),this.map.getLayer(this.pointCircleLayer+"-border")&&this.map.removeLayer(this.pointCircleLayer+"-border"),this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.historyPointCircleLayer)&&this.map.removeLayer(this.historyPointCircleLayer),this.map.getLayer(this.historyPointCircleLayer+"-border")&&this.map.removeLayer(this.historyPointCircleLayer+"-border"),this.map.getLayer(this.historyPointCircleLayer+"-inner")&&this.map.removeLayer(this.historyPointCircleLayer+"-inner"),this.map.getLayer(this.historyPointLabelLayer)&&this.map.removeLayer(this.historyPointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(t=this.interpolateMarkers)==null||t.forEach(i=>i==null?void 0:i.remove()),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.map.getSource(this.clusterSource)&&this.map.removeSource(this.clusterSource),this.map.getSource(this.interpolateSource)&&this.map.removeSource(this.interpolateSource)),(e=this.map)==null||e.off("click",this.clickLayers,this.handleClick),(a=this.map)==null||a.off("mousemove",this.hoverLayers,this.handleHover),(r=this.map)==null||r.off("mouseleave",this.hoverLayers,this.handleLeave),this.handleCloseInfoMarker()},handleDateChange(){var t,e,a,r,i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z;if((t=this.interpolateMarkers)==null||t.forEach(H=>H==null?void 0:H.remove()),(e=this.interpolateData)!=null&&e.length&&this.tropicals.active){const H=_(this.realTime).utc().set({minute:0,second:0,millisecond:0}),te=this.interpolateData.filter(V=>V.properties.date===(H==null?void 0:H.format())&&!V.properties.disabled),W=this.handleComputePolygons(te),I=E.featureCollection([...te]);W.forEach(V=>{I.features.push(V)}),(a=this.map)!=null&&a.getSource(this.interpolateSource)?(r=this.map)==null||r.getSource(this.interpolateSource).setData(I):((i=this.map)==null||i.addSource(this.interpolateSource,{type:"geojson",data:I}),(l=this.map)==null||l.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-opacity":1,"line-color":["match",["get","level"],7,this.Theme.current.value.colors["tropicals-r7"],10,this.Theme.current.value.colors["tropicals-r10"],this.Theme.current.value.colors["tropicals-r10"]],"line-width":1}},"empty-layer-3")),this.interpolateMarkers=[];const K=[];for(const V of te)if(!V.properties.disabled){if(!K.some(re=>{var ue;return re.properties.name===((ue=V.properties)==null?void 0:ue.name)})){const re=((s=(n=this.tropicals.data.features.find(ue=>{var ye;return ue.properties.name===((ye=V.properties)==null?void 0:ye.name)}))==null?void 0:n.properties)==null?void 0:s.nameCn)||((c=V.properties)==null?void 0:c.Name)||"-";V.properties.nameCn=re,V.properties.Name=((d=(m=V.properties.name)==null?void 0:m.trim())==null?void 0:d.replace(/^./,ue=>ue.toUpperCase()))||V.properties.nameCn,K.push(V)}let Y=this.Theme.current.value.colors["tropicals-ty"];((u=(g=V.properties)==null?void 0:g.wind)==null?void 0:u.kts)<32||!((p=(y=V.properties)==null?void 0:y.wind)!=null&&p.kts)?Y=this.Theme.current.value.colors["tropicals-td"]:((f=(h=V.properties)==null?void 0:h.wind)==null?void 0:f.kts)>=32&&((v=(x=V.properties)==null?void 0:x.wind)==null?void 0:v.kts)<47?Y=this.Theme.current.value.colors["tropicals-ts"]:((k=(b=V.properties)==null?void 0:b.wind)==null?void 0:k.kts)>=47&&((L=(A=V.properties)==null?void 0:A.wind)==null?void 0:L.kts)<63?Y=this.Theme.current.value.colors["tropicals-sts"]:((z=(C=V.properties)==null?void 0:C.wind)==null?void 0:z.kts)>=63&&((T=(M=V.properties)==null?void 0:M.wind)==null?void 0:T.kts)<79?Y=this.Theme.current.value.colors["tropicals-ty"]:((F=(N=V.properties)==null?void 0:N.wind)==null?void 0:F.kts)>=79&&((q=(O=V.properties)==null?void 0:O.wind)==null?void 0:q.kts)<94?Y=this.Theme.current.value.colors["tropicals-sty"]:((le=($=V.properties)==null?void 0:$.wind)==null?void 0:le.kts)>=94?Y=this.Theme.current.value.colors["tropicals-super-ty"]:Y=this.Theme.current.value.colors["tropicals-ty"];const ee=`<svg t="1719918955501"
623
+ `,["get","val"],{"font-scale":1}],"text-rotation-alignment":"map","text-line-height":1.3,"text-size":12,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"]},paint:{"text-color":this.theme==="light"?["step",["get","val"],"rgba(0, 0, 0, 0.5)",920,"rgba(0, 0, 0, 0.5)",980,"rgba(0, 0, 0, 0.7)",1100,"rgba(0, 0, 0, 0.7)"]:"rgba(0,0,0,1)","text-halo-color":["step",["get","val"],"rgba(162,13,2,1)",920,"rgba(255, 96, 98, 1)",980,"rgba(255, 246, 184, 1)",1100,"rgba(199,171,250,1)"],"text-halo-width":1}},this.beforeLayer),l=new Date().valueOf()-(r+i),console.log("[prmsl] add elapsed: ",l,", total: ",i+=l))}},handleClear(){this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.labelLayer)&&this.map.removeLayer(this.labelLayer),this.map.getLayer(this.layer)&&this.map.removeLayer(this.layer),this.map.getSource(this.source)&&this.map.removeSource(this.source)}}};function ym(t,e,a,r,i,l){return null}const bm=Q(fm,[["render",ym]]),wm={name:"IdmIceEdge",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[ice-edge] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(86, 169, 230, 0)"],[1/255,"rgba(86, 169, 230, 0)"],[25/255,"rgba(86, 169, 230, 1)"],[25/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(47, 226, 155, 1)"],[100/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(213, 253, 37, 1)"],[175/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 176, 39, 1)"],[225/255,"rgba(230, 84, 39, 1)"],[250/255,"rgba(230, 84, 39, 1)"],[1,"rgba(230, 84, 39, 1)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},xm={key:0};function km(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",xm,[o.createVNode(n,o.mergeProps({class:"ice-edge",unit:"%",labels:["",10,"","",40,"","",70,"",90,""],"unit-color":"rgba(var(--v-theme-black), 0.7)"},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Am=Q(wm,[["render",km]]),Lm={name:"IdmCover",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[ice-cover] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(68, 1, 84, 0)"],[1/255,"rgba(63, 72, 137, 0)"],[50/255,"rgba(53, 125, 177, 1)"],[100/255,"rgba(33, 145, 140, 1)"],[150/255,"rgba(45, 178, 125, 1)"],[200/255,"rgba(112, 207, 87, 1)"],[250/255,"rgba(253, 231, 37, 0.8)"],[1,"rgba(253, 231, 37, 1)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},vm={key:0};function Cm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",vm,[o.createVNode(n,o.mergeProps({class:"ice-cover",unit:"%",labels:[20,40,60,80,100]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const _m=Q(Lm,[["render",Cm]]),zm={name:"IdmThickness",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[ice-thickness] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(4, 6, 19, 0)"],[1/255,"rgba(4, 6, 19, 0)"],[20/255,"rgba(51, 50, 102, 1)"],[40/255,"rgba(63, 82, 158, 1)"],[50/255,"rgba(66, 123, 183, 1)"],[60/255,"rgba(92, 161, 197, 1)"],[80/255,"rgba(134, 199, 212, 0.7)"],[100/255,"rgba(134, 199, 212, 1)"],[150/255,"rgba(234, 253, 2536, 0.8)"],[250/255,"rgba(234, 253, 2536, 0.9)"],[1,"rgba(234, 253, 2536, 1)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Sm={key:0};function Pm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Sm,[o.createVNode(n,o.mergeProps({class:"ice-thickness",unit:"m",labels:[0,.6,1,1.5,2,3]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Mm=Q(zm,[["render",Pm]]),Tm={name:"IdmPrecip3h",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},deeimmediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[precip3h] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(59, 126, 162, 0)"],[14/255,"rgba(84,170,230, 0)"],[15/255,"rgba(172, 210, 255, 0.8)"],[20/255,"rgba(51,202,248,0.8)"],[30/255,"rgba(3,248,103,0.8)"],[49/255,"rgba(14,201,3,0.8)"],[57/255,"rgba(190,226,2,0.8)"],[73/255,"rgba(248,1,1,0.8)"],[82/255,"rgba(197,5,58,0.8)"],[1,"rgba(197,5,58,0.8)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Nm={key:0};function Em(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Nm,[o.createVNode(n,o.mergeProps({class:"precip3h",unit:"mm",labels:[1.5,2,3,7,10,20,30]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Vm=Q(Tm,[["render",Em]]),Rm={name:"IdmVisibility",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[visibility] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(189,50,160,0.8)"],[8/255,"rgba(208,56,56,0.8)"],[27/255,"rgba(190,226,2,0.8)"],[60/255,"rgba(3,236,118,0.8)"],[160/255,"rgba(172, 210,255,0.8)"],[161/255,"rgba(172, 210,255,0)"],[1,"rgba(144,144,144,0)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Dm={key:0};function Bm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Dm,[o.createVNode(n,o.mergeProps({class:"visibility",unit:"nm",labels:[0,.5,1.5,3,9]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Im=Q(Rm,[["render",Bm]]),Fm={name:"IdmWaterTemp",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0,a=0;this.handleDraw(),a=new Date().valueOf()-(t+e),console.log("[water-temp] add elapsed: ",a,", total: ",e+=a)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgba(95, 143, 197)"],[46/255,"rgba(95, 143, 197)"],[69/255,"rgb(80, 140, 62)"],[92/255,"rgb(121, 146, 28)"],[115/255,"rgb(171, 161, 14)"],[138/255,"rgb(223, 177, 69)"],[161/255,"rgb(243, 150, 6)"],[184/255,"rgb(236, 95, 21)"],[207/255,"rgb(190, 65, 18)"],[230/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Gm={key:0};function jm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Gm,[o.createVNode(n,o.mergeProps({class:"water-temp",unit:"°C",labels:[0,10,20,30,40]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Wm=Q(Fm,[["render",jm]]),Zm={name:"IdmTemp",components:{LegendBar:it},props:{factor:{type:Object},viewport:{type:Object}},data(){return{program:void 0,context:void 0,texture:void 0,rampColor:void 0,aPositionBuffer:void 0,webgl:new $e,etime:void 0}},watch:{"factor.version":{handler(){var t;(t=this.factor)!=null&&t.active?this.handleRender():this.handleClear()},immediate:!0}},methods:{handleRender(){if(this.factor){const t=new Date().valueOf();let e=0;this.handleDraw(),new Date().valueOf()-(t+e)}},handleClear(){this.context=void 0,this.etime=void 0,this.viewport.toggle(!1)},handleSetup(){if(!this.context){if(this.context=this.webgl.createContext(this.viewport.rampColorCanvas),!this.context)return;const t=[[0,"rgb(149, 137, 211)"],[100/255,"rgb(149, 137, 211)"],[110/255,"rgb(150, 209, 216)"],[120/255,"rgb(129, 204, 197)"],[130/255,"rgb(103, 180, 186)"],[140/255,"rgb(95, 143, 197)"],[150/255,"rgb(80, 140, 62)"],[160/255,"rgb(121, 146, 28)"],[170/255,"rgb(171, 161, 14)"],[180/255,"rgb(223, 177, 6)"],[190/255,"rgb(243, 150, 6)"],[200/255,"rgb(236, 95, 21)"],[210/255,"rgb(190, 65, 18)"],[220/255,"rgb(138, 43, 10)"],[1,"rgb(138, 43, 10)"]];this.rampColor=this.webgl.setup(this.context,t);const{program:e,aPositionBuffer:a}=this.webgl.bind(this.context,fe.vertexSchema,fe.fragmentSchema);this.program=e,this.aPositionBuffer=a}},async handleDraw(){if(this.handleSetup(),!!this.context){if(this.etime!==this.factor.etime){this.etime=this.factor.etime;const t=await this.webgl.loadImg(this.factor.raw);this.texture=this.webgl.createTexture(this.context,this.context.NEAREST,this.context.LINEAR,this.context.CLAMP_TO_EDGE,t)}this.webgl.draw(this.viewport,this.context,this.program,this.texture,this.rampColor.texture,this.aPositionBuffer),this.viewport.toggle(!0)}}}},Hm={key:0};function Xm(t,e,a,r,i,l){var s;const n=o.resolveComponent("LegendBar");return(s=a.factor)!=null&&s.active?(o.openBlock(),o.createElementBlock("div",Hm,[o.createVNode(n,o.mergeProps({class:"temp",unit:"°C",labels:[-20,-10,0,10,20,30,40]},t.$attrs),null,16)])):o.createCommentVNode("",!0)}const Om=Q(Zm,[["render",Xm]]),jb="",Ym={name:"IdmGlLayer",components:{IdmWindBarb:Wc,IdmWindParticle:Uc,IdmCurrentDirection:Qc,IdmCurrentParticle:tm,IdmSigWaveParticle:rm,IdmSigWaveHeight:sm,IdmSwellParticle:hm,IdmSwellDirection:gm,IdmPrmsl:bm,IdmIceEdge:Am,IdmIceCover:_m,IdmIceThickness:Mm,IdmPrecip3h:Vm,IdmVisibility:Im,IdmWaterTemp:Wm,IdmTemp:Om},props:{simple:{type:Boolean,default:!1},isLogin:{type:Boolean,default:!1},theme:{type:String},map:{type:Object},mapFeather:{type:String},gateway:{type:String},assistGateway:{type:Array,default:[]},defaultMeteoToken:{type:String},top:{type:Number,default:0},paddingTop:{type:Number,default:8},menuHeight:{type:Number,default:248},menuToggle:{type:Object,default:{}},realTime:{type:String},forecastModel:{type:String},beforeLayer:{type:String},platform:{type:String},projection:{type:String}},emits:["forecastModel","menuToggle","weatherCheckList","autoActive","weatherRendered","rampLayersReady"],data(){const t=[...ho.LayerHelper.WEATHER_LAYERS];return{right:10,toggle:!1,autoActive:!0,weatherWeight:0,allLayers:t,tagLayers:t.filter(e=>!e.hide),checkList:[],renderKey:"",iceToggleValue:void 0,weatherLayers:{},activeWeatherLayers:[],cache:{v:"0.0.4",versionKey:"weatherLayerCacheVersionGL4",autoActiveKey:"autoActiveCacheGL4",checkListKey:"weatherCheckListCacheGL4"},models:{},currentModel:localStorage.getItem("forecastModelCacheGL4")==="GFS"?"GFS":"ECMWF",zoom:6,viewport:void 0,viewportSeq:0,particleFactor:void 0,showWindParticle:!0,showCurrentParticle:!0,showSigWaveParticle:!0,showSwellParticle:!0,legendToggle:!1,legend:{barbs:[2,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,0],current:[{label:"0-0.5 kts",size:.3,color:"rgb(58, 164, 58)"},{label:"0.5-1 kts",size:.4,color:"#ffff00"},{label:"1-1.5 kts",size:.6,color:"#ff9500"},{label:"1.5-2 kts",size:.8,color:"#f44336"},{label:">= 2 kts",size:1,color:"#e4711e"}],sigWaveHeight:[{label:"< 2 m",color:"rgba(0,235,156,0)"},{label:"2-3 m",color:"rgba(0,235,156,0.4)"},{label:"3-4 m",color:"#ffed00"},{label:"4-5 m",color:"#ff9800"},{label:"5-6 m",color:"#f77800"},{label:"6-7 m",color:"#e4711e"},{label:"7-8 m",color:"#e06128"},{label:"8-9 m",color:"#dc5132"},{label:"9-10 m",color:"#d5453c"},{label:"10-12 m",color:"#cd3a46"},{label:"12-14 m",color:"#be2c50"},{label:"> 14 m",color:"#aa1a5a"}]}}},computed:{listStyle(){return this.simple?{top:this.top+"px",left:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}:{top:this.top+"px",right:this.toggle?"0px":"-280px",height:"calc(100vh - "+this.top+"px)"}},computeDateZ(){return function(t){var e;if(t){const a=_(t);return`${(e=a==null?void 0:a.utc())==null?void 0:e.format("MMM-DD/HHmm")}Z`}return"-"}},computeDateUpdate(){return function(t){return t?_(t).fromNow():"-"}},overlaysKeys(){return this.tagLayers.filter(t=>t.overlays).map(t=>t.key)},rendersKeys(){return this.allLayers.filter(t=>!t.overlays&&t.enabled).map(t=>t.key)},showTipMenu(){return this.checkList.includes("wind")||this.checkList.includes("current-direction")||this.checkList.includes("sig-wave-height")},barbsIconName(){var e,a,r;const t=[];for(let i=0;i<((a=(e=this.legend)==null?void 0:e.barbs)==null?void 0:a.length);i++){const l=((r=this.legend)==null?void 0:r.barbs[i])||0,n=l<10?`00${l}kts`:l<100?`0${l}kts`:`${l}kts`;t.push("icon-a-"+n)}return t},lengendTipTop(){return this.platform==="ops"?this.top+this.menuHeight+322:this.top+this.menuHeight+232},viewportKey(){return this.viewport?(this.viewport.isGlobe?"globe":"mercator")+"-"+this.viewportSeq:"none"}},watch:{"menuToggle.v":{handler(){this.toggle=this.menuToggle.weatherLayers,this.$nextTick(()=>{var t;this.simple||(this.right=(((t=document.getElementsByClassName("right-bar")[0])==null?void 0:t.clientWidth)||0)+10)})}},currentModel:{handler(t,e){this.$emit("forecastModel",t),localStorage.setItem("forecastModelCacheGL4",t)},immediate:!0},forecastModel:{handler(t,e){t&&t!==e&&this.handleWeatherLayerChange({sourceChanged:!0})}},map:{handler(){var e,a,r,i;const t=this.map;(a=(e=this.viewport)==null?void 0:e.map)==null||a.off("move",this.handleMove4Weather),(i=(r=this.viewport)==null?void 0:r.cleanup)==null||i.call(r),this.viewport=void 0,t&&(this.viewportSeq+=1,this.projection==="globe"?this.viewport=new eo(t):this.viewport=new to(t),t.once("idle",()=>{this.map===t&&(this.fetchCache(),t.on("move",this.handleMove4Weather),this.handleRampColorInitial())}),t.triggerRepaint())},immediate:!0},projection:{handler(t,e){var a,r;!t||t===e||!this.map||!this.viewport||((r=(a=this.viewport)==null?void 0:a.cleanup)==null||r.call(a),this.viewportSeq+=1,t==="globe"?this.viewport=new eo(this.map):this.viewport=new to(this.map),this.handleRampColorInitial(),this.handleMove4Weather(),this.map.triggerRepaint())}},realTime:{handler(t,e){t&&e&&_(t).utc().format("yyyy-MM-DD HH")!==_(e).utc().format("yyyy-MM-DD HH")&&this.$nextTick(()=>{this.fetchWeatherLayers()})},immediate:!0},renderKey:{handler(t,e){if(t&&t!==e){const a=this.checkList.filter(r=>!this.rendersKeys.some(i=>i===r));t==="ice-forecast"?(this.iceToggleValue=this.iceToggleValue||"ice-cover",this.checkList=[...a,"ice-forecast",this.iceToggleValue||"ice-cover"]):this.checkList=[...a,t]}else!t&&e&&(this.checkList=this.checkList.filter(a=>a!==e))}},checkList:{handler(t,e){var a,r,i,l,n,s;this.handleCheckListChange(t,e),this.$emit("weatherCheckList",t),this.autoActive&&this.checkList.length?(i=(r=(a=this.$parent)==null?void 0:a.$refs)==null?void 0:r.idmBottomBar)==null||i.handleToggle("weather",!0):(s=(n=(l=this.$parent)==null?void 0:l.$refs)==null?void 0:n.idmBottomBar)==null||s.handleToggle("weather",!1)}},autoActive:{handler(t){var e,a,r,i,l,n;localStorage.setItem(this.cache.autoActiveKey,this.autoActive),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(s=>this.checkList.includes(s.key)):[],this.handleWeatherLayerChange(),this.autoActive&&this.checkList.length?(r=(a=(e=this.$parent)==null?void 0:e.$refs)==null?void 0:a.idmBottomBar)==null||r.handleToggle("weather",!0):(n=(l=(i=this.$parent)==null?void 0:i.$refs)==null?void 0:l.idmBottomBar)==null||n.handleToggle("weather",!1),this.$emit("autoActive",this.autoActive)}},iceToggleValue:{handler(t){if(t){const e=this.checkList.filter(a=>!this.rendersKeys.some(r=>r===a));this.checkList=[...e,"ice-forecast",this.iceToggleValue]}}},showWindParticle:{handler(t){let e="wind-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=t,this.weatherLayers[e].version=Math.random()+1)}},showCurrentParticle:{handler(t){let e="current-particle";this.weatherLayers[e]&&(this.weatherLayers[e].particle=t,this.weatherLayers[e].version=Math.random()+1)}},showSigWaveParticle:{handler(t){const e=this.weatherLayers["sig-wave-particle"];e&&(e.particle=t)}},showSwellParticle:{handler(t){const e=this.weatherLayers["swell-particle"];e&&(e.particle=t)}},isLogin:{handler(t){t?this.fetchModels():this.models={}},immediate:!0}},mounted(){this.fetchModels()},beforeUnmount(){var t,e,a,r;(e=(t=this.viewport)==null?void 0:t.map)==null||e.off("move",this.handleMove4Weather),(r=(a=this.viewport)==null?void 0:a.cleanup)==null||r.call(a),this.viewport=void 0},methods:{arraysEqual(t,e){if((t==null?void 0:t.length)!==(e==null?void 0:e.length))return!1;for(let a=0;a<(t==null?void 0:t.length);a++)if((t==null?void 0:t[a])!==(e==null?void 0:e[a]))return!1;return!0},normalizeWaveSelection(t){const e=t.map(a=>a==="sig-wave"?"sig-wave-particle":a==="swell"?"swell-particle":a);return[...new Set(e)].filter(a=>this.allLayers.some(r=>r.key===a))},fetchCache(){const t=localStorage.getItem(this.cache.versionKey);this.cache.v!==t&&(localStorage.removeItem(this.cache.autoActiveKey),localStorage.removeItem(this.cache.checkListKey),localStorage.setItem(this.cache.versionKey,this.cache.v));let e=localStorage.getItem(this.cache.autoActiveKey);this.autoActive=e!=="false",localStorage.setItem(this.cache.autoActiveKey,this.autoActive),e=localStorage.getItem(this.cache.checkListKey);const a=JSON.parse(e||JSON.stringify(["wind","sig-wave-height"]));this.iceToggleValue=a.includes("ice-thickness")?"ice-thickness":void 0,this.checkList=this.normalizeWaveSelection(a),this.renderKey=this.checkList.find(r=>this.rendersKeys.includes(r))||"",localStorage.setItem(this.cache.checkListKey,JSON.stringify(this.checkList))},handleMenuToggle(){this.$emit("menuToggle","weatherLayers")},handleFastWeatherToggle(t){let e=[];this.checkList.includes(t)?e=this.checkList.filter(a=>a!==t):(e=[...this.checkList,t],this.checkList=e),this.handleCheckListChange(e,this.checkList)},handleCheckListChange(t,e){if(this.arraysEqual(t,e))return this.handleMove4Weather(),!1;const a=[...new Set(t)],r=a==null?void 0:a.filter(n=>!(e!=null&&e.includes(n)))[0],i=e==null?void 0:e.filter(n=>!(a!=null&&a.includes(n)))[0],l=this.checkList.filter(n=>!this.rendersKeys.some(s=>s===n));if(r)if(r==="ice-cover"||r==="ice-thickness"||r==="ice-forecast")this.checkList=[...l,"ice-forecast",this.iceToggleValue||"ice-cover"],this.iceToggleValue=this.iceToggleValue||"ice-cover";else if(this.rendersKeys.includes(r))this.checkList=[...l,r];else{const n=a.filter(c=>!this.rendersKeys.includes(c)),s=this.checkList.filter(c=>this.rendersKeys.includes(c));this.checkList=[...n,...s]}i&&(i==="ice-forecast"?(this.checkList=a.filter(n=>!["ice-cover","ice-thickness","ice-forecast"].includes(n)),this.iceToggleValue=void 0):this.checkList=a),this.checkList.includes("wind-particle")&&!(e!=null&&e.includes("wind-particle"))&&(this.showWindParticle=!0),this.checkList.includes("current-particle")&&!(e!=null&&e.includes("current-particle"))&&(this.showCurrentParticle=!0),this.checkList.includes("sig-wave-particle")&&!(e!=null&&e.includes("sig-wave-particle"))&&(this.showSigWaveParticle=!0),this.checkList.includes("swell-particle")&&!(e!=null&&e.includes("swell-particle"))&&(this.showSwellParticle=!0),localStorage.setItem(this.cache.checkListKey,JSON.stringify(a)),this.activeWeatherLayers=this.autoActive?this.allLayers.filter(n=>a.includes(n.key)):[],this.handleWeatherLayerChange()},async fetchModels(){this.models={};const t=await de.get(`${this.gateway}/api/arc/meteo2/models2`,{headers:{Authorization:this.defaultMeteoToken}});(t==null?void 0:t.data.code)===0&&(this.models=t==null?void 0:t.data.data)},async fetchWeatherLayers(t={}){var r,i,l,n,s,c,m,d,g;const e=new Date().valueOf();let a=0;if(this.map){const u=((r=this.map)==null?void 0:r.getZoom())+1,y=(i=this.map)==null?void 0:i.getBounds(),p=`${y._sw.lng},${y._sw.lat},${y._ne.lng},${y._ne.lat}`;if(this.particleFactor&&((l=this.$refs.layer)!=null&&l.autoActive)){const h=ho.LayerHelper.WEATHER_LAYERS.find(f=>{var x;return((x=f.peer)==null?void 0:x.weight)===this.particleFactor.weight});this.particleFactor.particle&&(this.showWindParticle||this.showCurrentParticle)?this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight:this.weatherWeight+h.weight:this.weatherWeight=this.weatherWeight&h.weight?this.weatherWeight-h.weight:this.weatherWeight}if(this.weatherWeight>0){let h=this.weatherWeight;if(h>0){const f=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],x=await de.get(`${f}/api/arc/weather/layers2/links?l=${h}&v=${this.forecastModel}&z=${u}&bbox=${p}&t=${this.realTime}`,{headers:{Authorization:this.defaultMeteoToken}});if(new Date().valueOf()-(e+a),((n=x==null?void 0:x.data)==null?void 0:n.code)===0){const v=(s=x==null?void 0:x.data)==null?void 0:s.data,b=[];for(const A in v)b.push(de.get(v[A],{headers:{Authorization:this.defaultMeteoToken,key:A},responseType:/\.(jpg|png)$/.test(v[A])?"blob":"json"}).catch(L=>{console.log(`[${A}] fetch layer error: ${L}`)}));const k=await Promise.all(b);this.weatherLayers={},k.map(A=>{var z,M,T,N;const L=((z=A==null?void 0:A.data)==null?void 0:z.data)||(A==null?void 0:A.data);let C=(T=(M=A==null?void 0:A.config)==null?void 0:M.headers)==null?void 0:T.key;C==="sig-wave"&&(C="sig-wave-particle"),C==="swell"&&(C="swell-particle"),C&&L&&(this.weatherLayers[C]={raw:L,type:((N=A==null?void 0:A.config)==null?void 0:N.responseType)==="blob"?"image":"json",etime:x.data.etime})})}if(new Date().valueOf()-(e+a),this.weatherLayers["current-direction"]||this.weatherLayers["current-speed"]){const v=(c=this.weatherLayers["current-direction"])==null?void 0:c.raw,b=(m=this.weatherLayers["current-speed"])==null?void 0:m.raw;delete this.weatherLayers["current-direction"],delete this.weatherLayers["current-speed"],this.weatherLayers.current={type:"json",direction:v,speed:{raw:b},etime:x.data.etime}}if(this.weatherLayers["swell-direction"]||this.weatherLayers["swell-height"]){const v=(d=this.weatherLayers["swell-direction"])==null?void 0:d.raw,b=(g=this.weatherLayers["swell-height"])==null?void 0:g.raw;delete this.weatherLayers["swell-direction"],delete this.weatherLayers["swell-height"],this.weatherLayers["swell-direction-contour"]={type:"json",direction:v,height:{raw:b},etime:x.data.etime}}}}this.handleWeatherLayerToggle(),this.handleDrawWeather4Json(),this.$nextTick(()=>{var h,f,x,v,b;(b=(v=(x=(f=(h=this.$parent)==null?void 0:h.$refs)==null?void 0:f.idmBottomBar)==null?void 0:x.$refs)==null?void 0:v.capture)==null||b.captureCurrentFrame()})}},handleWeatherLayerToggle(){for(const t in this.weatherLayers)this.weatherLayers[t].active=!1,this.weatherLayers[t].version=Math.random()+1;for(const t of this.activeWeatherLayers){let e=t.key;e==="current-direction"&&(e="current"),this.weatherLayers[e]&&(this.weatherLayers[e].active=!0,this.weatherLayers[e].version=Math.random()+1,e==="wind-particle"&&(this.weatherLayers[e].particle=this.showWindParticle),e==="current-particle"&&(this.weatherLayers[e].particle=this.showCurrentParticle),e==="sig-wave-particle"&&(this.weatherLayers[e].particle=this.showSigWaveParticle),e==="swell-particle"&&(this.weatherLayers[e].particle=this.showSwellParticle))}},handleWeatherLayerChange(t={sourceChanged:!1}){var a;const e=(a=this.activeWeatherLayers)==null?void 0:a.reduce((r,i)=>r+(r&(i==null?void 0:i.weight)?0:i==null?void 0:i.weight),0);t!=null&&t.sourceChanged||this.weatherWeight!==e?(this.weatherWeight=e,this.fetchWeatherLayers()):this.handleWeatherLayerToggle()},handleRampColorInitial(){var t,e,a,r,i,l,n,s,c,m,d,g,u;if((t=this.viewport)!=null&&t.isGlobe){this.viewport.initGlobeLayers(this.beforeLayer),this.$emit("rampLayersReady");return}this.viewport.map.getSource((e=this.viewport)==null?void 0:e.rampColorSource)||this.viewport.map.addSource((a=this.viewport)==null?void 0:a.rampColorSource,{type:"canvas",canvas:(r=this.viewport)==null?void 0:r.rampColorCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((i=this.viewport)==null?void 0:i.rampColorLayer)||this.viewport.map.addLayer({type:"raster",id:(l=this.viewport)==null?void 0:l.rampColorLayer,source:(n=this.viewport)==null?void 0:n.rampColorSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.viewport.map.getSource((s=this.viewport)==null?void 0:s.particleSource)||this.viewport.map.addSource((c=this.viewport)==null?void 0:c.particleSource,{type:"canvas",canvas:(m=this.viewport)==null?void 0:m.particleCanvas,animate:!0,coordinates:this.viewport.getBoundLngLat()}),this.viewport.map.getLayer((d=this.viewport)==null?void 0:d.particleLayer)||this.viewport.map.addLayer({type:"raster",id:(g=this.viewport)==null?void 0:g.particleLayer,source:(u=this.viewport)==null?void 0:u.particleSource,layout:{visibility:"none"},paint:{"raster-fade-duration":0}},this.beforeLayer),this.$emit("rampLayersReady")},handleDrawWeather4Json(){var l,n,s,c,m,d,g;const t=new Date().valueOf();let e=0,a=0;const r=(l=this.map)==null?void 0:l.getBounds(),i=(n=this.map)==null?void 0:n.getZoom();if(r&&i){const u=P.LngLatHelper.convertToStdLng(r._sw.lng),y=P.LngLatHelper.convertToStdLng(r._ne.lng),p=Math.floor(r._sw.lat),h=Math.ceil(r._ne.lat);for(const f in this.weatherLayers){let x=!1;if(this.weatherLayers[f].active&&this.weatherLayers[f].type==="json"){let v=[];if(f==="current"){x=!0;const b=((s=this.weatherLayers[f])==null?void 0:s.direction)||{};for(const A in b)if(A>p&&A<h&&(!(i<=this.zoom)||A%(i<2?10:i<4?5:3)===0)){const L=b[A].lng;u>y?L.forEach((C,z)=>{var M,T,N,F,O,q;if(i<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if((C>=u&&C<=180||C>=-180&&C<=y)&&(!(i<=this.zoom)||C%(i<2?10:i<4?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}}):L.forEach((C,z)=>{var M,T,N,F,O,q;if(u<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if(C>=u&&C<=y&&(!(i<=this.zoom)||C%(i<this.zoom/2?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}})}a=new Date().valueOf()-(t+e);const k=this.weatherLayers[f].speed;if(k){if(!k.data){const L=[];for(const C in(c=k.raw)==null?void 0:c.Polygon){const z=k.raw.Polygon[C];for(const M of z)L.push(E.polygon(M,{val:Number(C)}))}k.data=E.featureCollection(L)}const A=i<this.zoom?k.data.features.filter(L=>L.properties.val>.5):k.data.features;v=v.concat(A),a=new Date().valueOf()-(t+e)}}else if(f==="wind"){x=!0;const b=this.weatherLayers.wind.raw;for(const k in b)if(k>p&&k<h&&(!(i<=this.zoom)||k%(i<2?10:i<4?5:3)===0)){const A=b[k].lng;u>y?A.forEach((L,C)=>{var z,M,T,N;if(i<2){if((L>=0&&L<=360||L>=-360&&L<=0)&&L%10===0){const F=E.point([L,k],{dir:((z=b[k].val)==null?void 0:z[C])||((M=b[k].dir)==null?void 0:M[C]),spd:b[k].spd[C]});v.push(F)}}else if((L>=u&&L<=180||L>=-180&&L<=y)&&(!(i<=this.zoom)||L%(i<2?10:i<4?5:3)===0)){const F=E.point([L,k],{dir:((T=b[k].val)==null?void 0:T[C])||((N=b[k].dir)==null?void 0:N[C]),spd:b[k].spd[C]});v.push(F)}}):A.forEach((L,C)=>{var z,M,T,N;if(i<2){if((L>=0&&L<=360||L>=-360&&L<=0)&&L%10===0){const F=E.point([L,k],{dir:((z=b[k].val)==null?void 0:z[C])||((M=b[k].dir)==null?void 0:M[C]),spd:b[k].spd[C]});v.push(F)}}else if(L>=u&&L<=y&&(!(i<=this.zoom)||L%(i<2?10:i<4?5:3)===0)){const F=E.point([L,k],{dir:((T=b[k].val)==null?void 0:T[C])||((N=b[k].dir)==null?void 0:N[C]),spd:b[k].spd[C]});v.push(F)}})}a=new Date().valueOf()-(t+e)}else if(f==="sig-wave-height"){if(this.weatherLayers[f].data)v=this.weatherLayers[f].data;else{x=!0;const b=this.weatherLayers[f].raw;if(b){const k=[];for(const A in b.Polygon){const L=b.Polygon[A];for(const C of L)k.push(E.polygon(C,{val:Number(A)}))}for(const A in b.MultiPolygon){const L=b.MultiPolygon[A];for(const C of L)k.push(E.multiPolygon(C,{val:Number(A)}))}for(const A in b.Point){const L=b.Point[A];for(let C=0;C<((m=L.lng)==null?void 0:m.length);C++)k.push(E.point([L.lng[C],A],{val:Number(L.val[C])}))}v=v.concat(k)}}a=new Date().valueOf()-(t+e)}else if(f==="prmsl"){if(this.weatherLayers[f].data)v=this.weatherLayers[f].data;else{x=!0;const b=this.weatherLayers[f].raw;if(b){const k=[];for(const A in b.LineString){const L=b.LineString[A];for(const C of L)k.push(E.lineString(C,{val:Number(A)}))}for(const A in b.Point)b.Point[A].lng.forEach((L,C)=>{L=P.LngLatHelper.convertToStdLng(L),k.push(E.point([L,A],{val:b.Point[A].val[C],type:b.Point[A].type[C]}))});v=v.concat(k)}}a=new Date().valueOf()-(t+e)}else if(f==="swell-direction-contour"){x=!0;const b=((d=this.weatherLayers[f])==null?void 0:d.direction)||{};for(const A in b)if(A>p&&A<h&&(!(i<=this.zoom)||A%(i<2?10:i<4?5:3)===0)){const L=b[A].lng;u>y?L.forEach((C,z)=>{var M,T,N,F,O,q;if(i<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if((C>=u&&C<=180||C>=-180&&C<=y)&&(!(i<=this.zoom)||C%(i<2?10:i<4?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}}):L.forEach((C,z)=>{var M,T,N,F,O,q;if(u<2){if((C>=0&&C<=360||C>=-360&&C<=0)&&C%10===0){const $=E.point([C,A],{val:((M=b[A].val)==null?void 0:M[z])||((T=b[A].dir)==null?void 0:T[z]),spd:(N=b[A].spd)==null?void 0:N[z]});v.push($)}}else if(C>=u&&C<=y&&(!(i<=this.zoom)||C%(i<2?10:i<4?5:3)===0)){const $=E.point([C,A],{val:((F=b[A].val)==null?void 0:F[z])||((O=b[A].dir)==null?void 0:O[z]),spd:(q=b[A].spd)==null?void 0:q[z]});v.push($)}})}a=new Date().valueOf()-(t+e),console.log("swell direction elapsed: ",a,", total: ",e+=a);const k=this.weatherLayers[f].height;if(k){if(!k.data){const A=[];for(const L in(g=k.raw)==null?void 0:g.LineString){const C=k.raw.LineString[L];for(const z of C)A.push(E.lineString(z,{val:Number(L)}));k.data=E.featureCollection(A)}}if(k.data){const A=this.handleBboxClip(k.data,r);v=v.concat(A)}a=new Date().valueOf()-(t+e),console.log("swell height elapsed: ",a,", total: ",e+=a)}}v.length&&(this.weatherLayers[f].data=E.featureCollection(v)),x&&(this.weatherLayers[f].version=Math.random()+1)}}}},handleBboxClip(t,e){const a=[],r=P.LngLatHelper.convertToStdLng(e._sw.lng),i=P.LngLatHelper.convertToStdLng(e._ne.lng);return t.features.forEach(l=>{if(l.geometry.type!=="Point")if(r>i){let n=[r,e._sw.lat,180,e._ne.lat],s=E.bboxClip(l,n);s.geometry.coordinates.length&&a.push(s),n=[-180,e._sw.lat,i,e._ne.lat],s=E.bboxClip(l,n),s.geometry.coordinates.length&&a.push(s)}else{const n=[r,e._sw.lat,i,e._ne.lat],s=E.bboxClip(l,n);s.geometry.coordinates.length&&a.push(s)}else a.push(l)}),a},handleMove4Weather(){for(const t in this.weatherLayers)this.weatherLayers[t].active&&this.weatherLayers[t].type==="image"&&(this.weatherLayers[t].active=!0,this.weatherLayers[t].version=Math.random()+1);this.handleDrawWeather4Json()}}},Um={class:"idm-gl4-meteo-layers"},Jm={key:0,class:"legend-tip-btn-gl4"},Km={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},Qm={class:"d-flex flex-row justify-center align-center"},qm={class:"text-caption"},$m={class:"d-flex flex-row justify-start align-center flex-wrap text-body-2"},ed={class:"d-flex flex-row justify-center align-center"},td={key:0,style:{width:"24px",height:"12px",border:"1px solid rgba(var(--v-border-color), var(--v-border-opacity))"}},od={class:"text-caption px-2"},ad={class:"d-flex flex-row justify-start align-start flex-wrap text-body-2 ml-n1"},id={class:"d-flex flex-row justify-start align-center"},rd={class:"d-flex flex-row justify-center align-center",style:{width:"40px"}},ld={class:"text-caption"},nd={class:"d-flex justify-start align-center ga-3"},sd={class:"text-h5 font-weight-medium"},cd={key:0,class:"w-100 d-flex justify-space-between align-center ga-1 mb-2 px-3"},md={key:0,class:"d-flex justify-start align-center ga-4 pl-6"},dd={key:1,class:"d-flex justify-start align-center ga-4 pl-6"},hd={key:2,class:"d-flex justify-start align-center ga-4 pl-6"},pd={key:3,class:"d-flex justify-start align-center ga-4 pl-6"},ud={class:"text-body-1 py-2"},gd={class:"text-body-1 font-weight-medium"},fd={class:"text-body-2 text-label"},yd={class:"text-body-2 text-label"},bd={class:"text-body-2 text-label mb-3"},wd={class:"text-body-1 font-weight-medium"},xd={class:"text-body-2 text-label"},kd={class:"text-body-2 text-label"},Ad={class:"text-body-2 text-label mb-3"},Ld={class:"text-body-1 py-2"},vd={class:"text-body-1 font-weight-medium"},Cd={class:"text-body-2 text-label"},_d={class:"text-body-2 text-label"},zd={class:"text-body-2 text-label mb-3"},Sd={class:"text-body-1 font-weight-medium"},Pd={class:"text-body-2 text-label"},Md={class:"text-body-2 text-label"},Td={class:"text-body-2 text-label mb-3"},Nd={class:"text-body-1 py-2"},Ed={class:"text-body-1 font-weight-medium"},Vd={class:"text-body-2 text-label"},Rd={class:"text-body-2 text-label"},Dd={class:"text-body-2 text-label mb-3"};function Bd(t,e,a,r,i,l){var S,Z,H,te,W,I,K,V,Y,ee,he,ge,re,ue,ye,ze;const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip"),c=o.resolveComponent("VCardText"),m=o.resolveComponent("VDivider"),d=o.resolveComponent("VCard"),g=o.resolveComponent("VSwitch"),u=o.resolveComponent("VBtnToggle"),y=o.resolveComponent("VCardTitle"),p=o.resolveComponent("VCardItem"),h=o.resolveComponent("VCheckbox"),f=o.resolveComponent("VRadio"),x=o.resolveComponent("IdmWindBarb"),v=o.resolveComponent("IdmSigWaveHeight"),b=o.resolveComponent("IdmCurrentDirection"),k=o.resolveComponent("IdmSwellDirection"),A=o.resolveComponent("IdmPrmsl"),L=o.resolveComponent("IdmWindParticle"),C=o.resolveComponent("IdmCurrentParticle"),z=o.resolveComponent("IdmSigWaveParticle"),M=o.resolveComponent("IdmSwellParticle"),T=o.resolveComponent("IdmIceEdge"),N=o.resolveComponent("IdmIceCover"),F=o.resolveComponent("IdmIceThickness"),O=o.resolveComponent("IdmPrecip3h"),q=o.resolveComponent("IdmVisibility"),$=o.resolveComponent("IdmWaterTemp"),le=o.resolveComponent("IdmTemp");return o.openBlock(),o.createElementBlock("div",Um,[o.createElementVNode("div",{class:"menu-bar-box transition pa-1",style:o.normalizeStyle({top:a.top+a.paddingTop+46+"px",right:i.right+"px"})},[o.createVNode(s,{text:t.$t("weather.weatherLayers"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:J})=>[o.createVNode(n,o.mergeProps(J,{"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[10]||(e[10]=[o.createElementVNode("i",{class:"iconfont icon-Weather text-h4"},null,-1)])),_:2,__:[10]},1040,["class","onClick"])]),_:1},8,["text","open-on-focus","open-on-hover"])],4),l.showTipMenu?(o.openBlock(),o.createElementBlock("div",Jm,[o.createElementVNode("div",{class:o.normalizeClass(["menu-bar-box pa-1 rounded",a.simple?"simple":""]),style:o.normalizeStyle({right:i.right+"px",top:a.simple?"426px":l.lengendTipTop+"px"})},[o.createVNode(s,{text:t.$t("weather.legend"),location:"left",interactive:!0,"open-on-click":!1,"open-on-focus":!a.simple,"open-on-hover":!a.simple},{activator:o.withCtx(({props:J})=>[o.createVNode(n,o.mergeProps(J,{"min-width":"32",width:"32",height:"32",class:["text-none pa-0",i.legendToggle?"bg-primary active-border":""],onClick:e[0]||(e[0]=ne=>i.legendToggle=!i.legendToggle)}),{default:o.withCtx(()=>e[11]||(e[11]=[o.createElementVNode("i",{class:"iconfont icon-Legend text-h4"},null,-1)])),_:2,__:[11]},1040,["class"])]),_:1},8,["text","open-on-focus","open-on-hover"])],6),i.legendToggle?(o.openBlock(),o.createBlock(d,{key:0,elevation:"16",class:"card-info d-flex justify-center align-start",style:o.normalizeStyle({position:"absolute",top:a.simple?"200px":"340px",right:i.right+50+"px"})},{default:o.withCtx(()=>[o.createVNode(c,{class:"d-flex flex-column justify-center align-start text-label px-1",style:{width:"120px"}},{default:o.withCtx(()=>[e[12]||(e[12]=o.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-1"},"Wind Level",-1)),o.createElementVNode("div",Km,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.legend.barbs,(J,ne)=>(o.openBlock(),o.createElementBlock("div",{key:J,class:"w-50 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[o.createElementVNode("div",Qm,[o.createElementVNode("i",{class:o.normalizeClass(["iconfont",l.barbsIconName[ne]]),style:o.normalizeStyle({color:a.theme==="dark"?"#fff":"#000"})},null,6),o.createElementVNode("span",qm,o.toDisplayString(Number(J)<10?`00${J}kts`:Number(J)<100?`0${J}kts`:`${J}kts`),1)])]))),128))])]),_:1,__:[12]}),o.createVNode(m,{vertical:""}),o.createVNode(c,{class:"d-flex flex-column justify-center align-start text-label px-2",style:{width:"100px"}},{default:o.withCtx(()=>[e[13]||(e[13]=o.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2"},"Wave Height",-1)),o.createElementVNode("div",$m,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.legend.sigWaveHeight,(J,ne)=>(o.openBlock(),o.createElementBlock("div",{key:ne,class:"w-100 d-flex flex-row justify-start align-center py-1 px-0 ma-0"},[o.createElementVNode("div",ed,[ne===0?(o.openBlock(),o.createElementBlock("div",td)):(o.openBlock(),o.createElementBlock("div",{key:1,style:o.normalizeStyle({width:"24px",height:"12px",background:J.color})},null,4)),o.createElementVNode("div",od,o.toDisplayString(J.label),1)])]))),128))])]),_:1,__:[13]}),o.createVNode(m,{vertical:""}),o.createVNode(c,{class:"d-flex flex-column justify-center align-start text-label pl-0 pr-2",style:{width:"100px"}},{default:o.withCtx(()=>[e[14]||(e[14]=o.createElementVNode("div",{class:"text-body-2 font-weight-600 mb-2 mx-2"},"Current",-1)),o.createElementVNode("div",ad,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.legend.current,(J,ne)=>(o.openBlock(),o.createElementBlock("div",{key:ne,class:"w-100 d-flex flex-row justify-center align-center py-1 px-0 ma-0"},[o.createElementVNode("div",id,[o.createElementVNode("div",rd,[o.createElementVNode("i",{class:"iconfont icon-a-direction-arrow text-label",style:o.normalizeStyle({fontSize:40*J.size+"px"})},null,4)]),o.createElementVNode("div",ld,o.toDisplayString(J.label),1)])]))),128))])]),_:1,__:[14]})]),_:1},8,["style"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["available-layers transition d-flex flex-column justify-start align-start",i.toggle?"right-bar":""]),style:o.normalizeStyle(l.listStyle)},[o.createElementVNode("div",{class:o.normalizeClass(["header-box w-100 d-flex justify-space-between align-center",a.simple?"px-3":"px-4"])},[o.createElementVNode("div",nd,[o.createElementVNode("div",sd,o.toDisplayString(t.$t("weather.weather")),1),o.createVNode(g,{modelValue:i.autoActive,"onUpdate:modelValue":e[1]||(e[1]=J=>i.autoActive=J),class:"small-switch",color:"primary","base-color":"disabled",inset:"","hide-details":""},null,8,["modelValue"])]),o.createVNode(n,{icon:"",density:"compact",variant:"plain",class:"mr-n2",onClick:l.handleMenuToggle},{default:o.withCtx(()=>e[15]||(e[15]=[o.createElementVNode("i",{class:"iconfont icon-close text-h4"},null,-1)])),_:1,__:[15]},8,["onClick"])],2),a.simple?(o.openBlock(),o.createElementBlock("div",cd,[o.createElementVNode("div",null,o.toDisplayString(t.$t("weather.forecastModel")),1),o.createVNode(u,{modelValue:i.currentModel,"onUpdate:modelValue":e[2]||(e[2]=J=>i.currentModel=J),rounded:"",height:"28",density:"compact",mandatory:"",group:""},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"28",value:"GFS",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="GFS"?"primary":"","base-color":""},{default:o.withCtx(()=>e[16]||(e[16]=[o.createTextVNode(" NOAA ",-1)])),_:1,__:[16]},8,["color"]),o.createVNode(n,{density:"compact",height:"28",class:"text-none btn-bg-2 px-1 text-body-1 mt-1",color:i.currentModel==="ECMWF"?"primary":"","base-color":"",value:"ECMWF"},{default:o.withCtx(()=>e[17]||(e[17]=[o.createTextVNode(" ECMWF ",-1)])),_:1,__:[17]},8,["color"])]),_:1},8,["modelValue"])])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["list-box w-100 scroll overflow-y-auto",[i.autoActive?"":"cursor-not-allowed",a.simple?"px-3":"pl-4 pr-2"]])},[o.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:o.withCtx(()=>[o.createVNode(p,{class:"border-b-thin"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-h6"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.overlays")),1)]),_:1})]),_:1}),o.createVNode(c,{class:"py-2 mx-n1"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.tagLayers.filter(J=>J.overlays),J=>(o.openBlock(),o.createBlock(h,{key:J.key,modelValue:i.checkList,"onUpdate:modelValue":e[3]||(e[3]=ne=>i.checkList=ne),value:J.key,label:t.$t(`weather.${J.locale}`),disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"flex-1-0-100 text-body-2","hide-details":""},null,8,["modelValue","value","label","disabled"]))),128))]),_:1})]),_:1}),o.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:o.withCtx(()=>[o.createVNode(p,{class:"border-b-thin"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-h6"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.renders")),1)]),_:1})]),_:1}),o.createVNode(c,{class:"py-2 mx-n1"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.tagLayers.filter(J=>!J.overlays),J=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:J.key},[o.createVNode(f,{modelValue:i.renderKey,"onUpdate:modelValue":e[4]||(e[4]=ne=>i.renderKey=ne),label:t.$t(`weather.${J.locale}`),value:J.key,disabled:!i.autoActive,color:"primary",density:"compact",style:{height:"36px"},class:"text-body-2 py-1","hide-details":"",onClick:ne=>i.renderKey=i.renderKey===J.key?"":J.key},null,8,["modelValue","label","value","disabled","onClick"]),i.renderKey==="wind-particle"&&J.key==="wind-particle"?(o.openBlock(),o.createElementBlock("div",md,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showWindParticle,"onUpdate:modelValue":e[5]||(e[5]=ne=>i.showWindParticle=ne),label:"",class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"",style:{"font-size":"14px"},"hide-details":""},null,8,["modelValue"])])):o.createCommentVNode("",!0),i.renderKey==="current-particle"&&J.key==="current-particle"?(o.openBlock(),o.createElementBlock("div",dd,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showCurrentParticle,"onUpdate:modelValue":e[6]||(e[6]=ne=>i.showCurrentParticle=ne),label:"",class:"small-switch",color:"primary","base-color":"disabled",inset:"",density:"compact",height:"20","hide-details":""},null,8,["modelValue"])])):o.createCommentVNode("",!0),i.renderKey==="sig-wave-particle"&&J.key==="sig-wave-particle"?(o.openBlock(),o.createElementBlock("div",hd,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showSigWaveParticle,"onUpdate:modelValue":e[7]||(e[7]=ne=>i.showSigWaveParticle=ne),class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"","hide-details":"",disabled:!i.autoActive},null,8,["modelValue","disabled"])])):o.createCommentVNode("",!0),i.renderKey==="swell-particle"&&J.key==="swell-particle"?(o.openBlock(),o.createElementBlock("div",pd,[o.createElementVNode("span",null,o.toDisplayString(t.$t("weather.particleAnimatiom")),1),o.createVNode(g,{modelValue:i.showSwellParticle,"onUpdate:modelValue":e[8]||(e[8]=ne=>i.showSwellParticle=ne),class:"small-switch",color:"primary","base-color":"disabled",density:"compact",inset:"","hide-details":"",disabled:!i.autoActive},null,8,["modelValue","disabled"])])):o.createCommentVNode("",!0),i.renderKey==="ice-forecast"&&J.key==="ice-forecast"?(o.openBlock(),o.createBlock(u,{key:4,modelValue:i.iceToggleValue,"onUpdate:modelValue":e[9]||(e[9]=ne=>i.iceToggleValue=ne),class:"w-100 pl-7 rounded",rounded:"0",height:"30",density:"compact",group:"",mandatory:"",disabled:!i.autoActive},{default:o.withCtx(()=>[o.createVNode(n,{density:"compact",height:"30",value:"ice-cover",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-cover"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.coverage")),1)]),_:1},8,["color","disabled"]),o.createVNode(n,{density:"compact",height:"30",class:"w-50 text-none px-2 text-body-1",color:i.iceToggleValue==="ice-thickness"?"primary":"","base-color":"grey-lighten-1",disabled:!i.autoActive,value:"ice-thickness"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.thickness")),1)]),_:1},8,["color","disabled"])]),_:1},8,["modelValue","disabled"])):o.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1}),o.createVNode(d,{class:"block-bg mx-auto mb-2",elevation:"0"},{default:o.withCtx(()=>[o.createVNode(p,{class:"border-b-thin"},{default:o.withCtx(()=>[o.createVNode(y,{class:"text-h6"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1)]),_:1})]),_:1}),o.createVNode(c,{class:""},{default:o.withCtx(()=>{var J,ne,Fe,Ge,Re,Ce,je,Ne,Ee,De,We,Ze,Be,xe,ke,_e,He,Xe,Oe,Pe,rt,lt,nt,st,ct,mt,dt,ht,pt,ut,gt,ft,yt,bt,wt,xt,kt,At,Lt,vt,Ct,_t,zt,St,Pt,Mt,Tt,Nt,Et,Vt,Rt,Dt,Bt,It,Ft,Gt,jt,Wt,Zt,Me,Ve,Ht,Ye,Xt,et,Ae,Ue,ie,Le,U,X,Je,Ie,Se,G,Ot,oe,ve,Ke,tt,ot,B,Qe,j,qe,Ut,se,io,me,Lo,vo,Co,_o,zo,So,Po,Mo,To,No,Eo,Vo,Ro,Do,Bo,Io;return[o.createElementVNode("div",ud,o.toDisplayString(t.$t("weather.atmospheric")),1),o.createElementVNode("div",gd,o.toDisplayString((Fe=(ne=(J=i.models)==null?void 0:J.weather)==null?void 0:ne.NOAA)==null?void 0:Fe.source)+" "+o.toDisplayString((Ce=(Re=(Ge=i.models)==null?void 0:Ge.weather)==null?void 0:Re.NOAA)==null?void 0:Ce.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((De=(Ee=(Ne=(je=i.models)==null?void 0:je.weather)==null?void 0:Ne.NOAA)==null?void 0:Ee.meta)==null?void 0:De.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",fd,o.toDisplayString(t.$t("weather.source"))+": NOAA",1),o.createElementVNode("div",yd,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((xe=(Be=(Ze=(We=i.models)==null?void 0:We.weather)==null?void 0:Ze.NOAA)==null?void 0:Be.meta)==null?void 0:xe.availabilityTime)),1),o.createElementVNode("div",bd,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((Xe=(He=(_e=(ke=i.models)==null?void 0:ke.weather)==null?void 0:_e.NOAA)==null?void 0:He.meta)==null?void 0:Xe.initialisationTime)),1),o.createElementVNode("div",wd,o.toDisplayString((rt=(Pe=(Oe=i.models)==null?void 0:Oe.weather)==null?void 0:Pe.ECMWF)==null?void 0:rt.source)+" "+o.toDisplayString((st=(nt=(lt=i.models)==null?void 0:lt.weather)==null?void 0:nt.ECMWF)==null?void 0:st.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((ht=(dt=(mt=(ct=i.models)==null?void 0:ct.weather)==null?void 0:mt.ECMWF)==null?void 0:dt.meta)==null?void 0:ht.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",xd,o.toDisplayString(t.$t("weather.source"))+": ECMWF",1),o.createElementVNode("div",kd,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((ft=(gt=(ut=(pt=i.models)==null?void 0:pt.weather)==null?void 0:ut.ECMWF)==null?void 0:gt.meta)==null?void 0:ft.availabilityTime)),1),o.createElementVNode("div",Ad,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((xt=(wt=(bt=(yt=i.models)==null?void 0:yt.weather)==null?void 0:bt.ECMWF)==null?void 0:wt.meta)==null?void 0:xt.initialisationTime)),1),o.createVNode(m),o.createElementVNode("div",Ld,o.toDisplayString(t.$t("weather.wave")),1),o.createElementVNode("div",vd,o.toDisplayString((vt=(Lt=(At=(kt=i.models)==null?void 0:kt.marine)==null?void 0:At.wave)==null?void 0:Lt.NOAA)==null?void 0:vt.source)+" "+o.toDisplayString((St=(zt=(_t=(Ct=i.models)==null?void 0:Ct.marine)==null?void 0:_t.wave)==null?void 0:zt.NOAA)==null?void 0:St.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((Et=(Nt=(Tt=(Mt=(Pt=i.models)==null?void 0:Pt.marine)==null?void 0:Mt.wave)==null?void 0:Tt.NOAA)==null?void 0:Nt.meta)==null?void 0:Et.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",Cd,o.toDisplayString(t.$t("weather.source"))+": NOAA",1),o.createElementVNode("div",_d,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((It=(Bt=(Dt=(Rt=(Vt=i.models)==null?void 0:Vt.marine)==null?void 0:Rt.wave)==null?void 0:Dt.NOAA)==null?void 0:Bt.meta)==null?void 0:It.availabilityTime)),1),o.createElementVNode("div",zd,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((Zt=(Wt=(jt=(Gt=(Ft=i.models)==null?void 0:Ft.marine)==null?void 0:Gt.wave)==null?void 0:jt.NOAA)==null?void 0:Wt.meta)==null?void 0:Zt.initialisationTime)),1),o.createElementVNode("div",Sd,o.toDisplayString((Ye=(Ht=(Ve=(Me=i.models)==null?void 0:Me.marine)==null?void 0:Ve.wave)==null?void 0:Ht.ECMWF)==null?void 0:Ye.source)+" "+o.toDisplayString((Ue=(Ae=(et=(Xt=i.models)==null?void 0:Xt.marine)==null?void 0:et.wave)==null?void 0:Ae.ECMWF)==null?void 0:Ue.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((Je=(X=(U=(Le=(ie=i.models)==null?void 0:ie.marine)==null?void 0:Le.wave)==null?void 0:U.ECMWF)==null?void 0:X.meta)==null?void 0:Je.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",Pd,o.toDisplayString(t.$t("weather.source"))+": ECMWF",1),o.createElementVNode("div",Md,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((oe=(Ot=(G=(Se=(Ie=i.models)==null?void 0:Ie.marine)==null?void 0:Se.wave)==null?void 0:G.ECMWF)==null?void 0:Ot.meta)==null?void 0:oe.availabilityTime)),1),o.createElementVNode("div",Td,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((B=(ot=(tt=(Ke=(ve=i.models)==null?void 0:ve.marine)==null?void 0:Ke.wave)==null?void 0:tt.ECMWF)==null?void 0:ot.meta)==null?void 0:B.initialisationTime)),1),o.createVNode(m),o.createElementVNode("div",Nd,o.toDisplayString(t.$t("weather.currents")),1),o.createElementVNode("div",Ed,o.toDisplayString((Ut=(qe=(j=(Qe=i.models)==null?void 0:Qe.marine)==null?void 0:j.current)==null?void 0:qe.ECMWF)==null?void 0:Ut.source)+" "+o.toDisplayString((Lo=(me=(io=(se=i.models)==null?void 0:se.marine)==null?void 0:io.current)==null?void 0:me.ECMWF)==null?void 0:Lo.spatialResolution)+o.toDisplayString(t.$t("units.km"))+" "+o.toDisplayString((So=(zo=(_o=(Co=(vo=i.models)==null?void 0:vo.marine)==null?void 0:Co.current)==null?void 0:_o.ECMWF)==null?void 0:zo.meta)==null?void 0:So.days)+o.toDisplayString(t.$t("units.days")),1),o.createElementVNode("div",Vd,o.toDisplayString(t.$t("weather.source"))+": ECMWF",1),o.createElementVNode("div",Rd,o.toDisplayString(t.$t("weather.lastUpdate"))+": "+o.toDisplayString(l.computeDateUpdate((Eo=(No=(To=(Mo=(Po=i.models)==null?void 0:Po.marine)==null?void 0:Mo.current)==null?void 0:To.ECMWF)==null?void 0:No.meta)==null?void 0:Eo.availabilityTime)),1),o.createElementVNode("div",Dd,o.toDisplayString(t.$t("weather.referenceTime"))+": "+o.toDisplayString(l.computeDateZ((Io=(Bo=(Do=(Ro=(Vo=i.models)==null?void 0:Vo.marine)==null?void 0:Ro.current)==null?void 0:Do.ECMWF)==null?void 0:Bo.meta)==null?void 0:Io.initialisationTime)),1)]}),_:1})]),_:1})],2)],6),a.map?(o.openBlock(),o.createBlock(x,o.mergeProps({key:1,ref:"windBarb",map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-3",wind:(S=i.weatherLayers)==null?void 0:S.wind},t.$attrs),null,16,["map","map-feather","wind"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(v,o.mergeProps({key:2,map:a.map,"before-layer":"empty-layer-2","sig-wave-height":(Z=i.weatherLayers)==null?void 0:Z["sig-wave-height"]},t.$attrs),null,16,["map","sig-wave-height"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(b,o.mergeProps({key:3,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-1",current:(H=i.weatherLayers)==null?void 0:H.current},t.$attrs),null,16,["map","map-feather","current"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(k,o.mergeProps({key:4,map:a.map,"map-feather":a.mapFeather,"before-layer":"empty-layer-1",swell:(te=i.weatherLayers)==null?void 0:te["swell-direction-contour"]},t.$attrs,{theme:a.theme}),null,16,["map","map-feather","swell","theme"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(A,o.mergeProps({key:5,map:a.map,"before-layer":"empty-layer-3",prmsl:(W=i.weatherLayers)==null?void 0:W.prmsl},t.$attrs,{theme:a.theme}),null,16,["map","prmsl","theme"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(L,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(I=i.weatherLayers)==null?void 0:I["wind-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(C,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(K=i.weatherLayers)==null?void 0:K["current-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(z,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(V=i.weatherLayers)==null?void 0:V["sig-wave-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(M,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(Y=i.weatherLayers)==null?void 0:Y["swell-particle"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(T,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ee=i.weatherLayers)==null?void 0:ee["ice-edge"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(N,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(he=i.weatherLayers)==null?void 0:he["ice-cover"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(F,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ge=i.weatherLayers)==null?void 0:ge["ice-thickness"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(O,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(re=i.weatherLayers)==null?void 0:re.precip3h,"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(q,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ue=i.weatherLayers)==null?void 0:ue.visibility,"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock($,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ye=i.weatherLayers)==null?void 0:ye["water-temp"],"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0),a.map?(o.openBlock(),o.createBlock(le,o.mergeProps({key:l.viewportKey,viewport:i.viewport,factor:(ze=i.weatherLayers)==null?void 0:ze.temp,"menu-toggle":a.menuToggle,simple:a.simple},t.$attrs),null,16,["viewport","factor","menu-toggle","simple"])):o.createCommentVNode("",!0)])}const Id=Q(Ym,[["render",Bd]]),fo=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"GFS",alias:"GFS",model:"gfs_seamless",provider:"NOAA",country:"United States",resolution:25,tips:"3-25km",length:16,frequency:1,models:["gfs_seamless"],categories:"ncep_gfs013,ncep_gfs025,ncep_gfs_graphcast025,ncep_hrrr_conus,ncep_nbm_conus",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:2,name:"ECMWF",alias:"ECMWF",model:"ecmwf_ifs025",provider:"ECMWF",country:"European Union",resolution:25,tips:"25km",length:15,frequency:6,models:["ecmwf_ifs025","ecmwf_aifs025_single","ecmwf_ifs"],categories:"ecmwf_ifs025,ecmwf_aifs025_single,ecmwf_ifs",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:3,disabled:!0,name:"ICON",alias:"ECMWF",model:"icon_seamless",provider:"Deutscher Wetterdienst (DWD)",country:"Germany",resolution:13,tips:"2-13km",length:7.5,frequency:3,models:["icon_seamless","icon_global","icon_eu","icon_d2"],categories:"dwd_icon,dwd_icon_eps,dwd_icon_d2,dwd_icon_d2_eps,dwd_icon_eu,dwd_icon_eu_eps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:4,name:"ARPEGE",disabled:!0,alias:"ECMWF",model:"arpege_seamless",provider:"Météo-France",country:"France",resolution:25,tips:"1-25km",length:4,frequency:1,models:["arpege_seamless","arpege_world","arpege_europe"],categories:"meteofrance_arpege_europe,meteofrance_arpege_europe_probabilities,meteofrance_arpege_world025",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:5,name:"UKMO",disabled:!0,alias:"ECMWF",model:"ukmo_seamless",provider:"UK Met Office",country:"United Kingdom",resolution:10,tips:"2-10km",length:7,frequency:1,models:["ukmo_seamless","ukmo_global_deterministic_10km","ukmo_uk_deterministic_2km"],categories:"ukmo_global_deterministic_10km,ukmo_uk_deterministic_2km",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:6,name:"JMA",disabled:!0,alias:"GFS",model:"jma_seamless",provider:"JMA",country:"Japan",resolution:55,tips:"5-55km",length:11,frequency:3,models:["jma_seamless","jma_msm","jma_gsm"],categories:"jma_gsm,jma_msm",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:7,name:"GEM",disabled:!0,alias:"GFS",model:"gem_seamless",provider:"Canadian Weather Service",country:"Canada",resolution:2.5,tips:"2.5km",length:10,frequency:6,models:["gem_seamless","gem_global","gem_regional"],categories:"cmc_gem_gdps,cmc_gem_hrdps,cmc_gem_rdps",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:8,name:"GRAPES",disabled:!0,alias:"GFS",model:"cma_grapes_global",provider:"China Meteorological Administration (CMA)",country:"China",resolution:15,tips:"15km",length:10,frequency:6,models:["cma_grapes_global"],categories:"cma_grapes_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"},{rank:9,name:"ACCESS-G",disabled:!0,alias:"GFS",model:"bom_access_global",provider:"Australian Bureau of Meteorology (BOM)",country:"Australia",resolution:15,tips:"15km",length:10,frequency:6,models:["bom_access_global"],categories:"bom_access_global",variables:"temperature_2m,relative_humidity_2m,dew_point_2m,apparent_temperature,precipitation_probability,precipitation,rain,showers,snowfall_water_equivalent,snowfall,frozen_precipitation_percent,pressure_msl,cloud_cover,visibility,wind_speed_10m,wind_u_component_10m,wind_v_component_10m,wind_direction_10m,wind_gusts_10m,cape,lifted_index,weather_code"}],yo=[{rank:0,name:"Best Match",alias:"BEST MATCH",model:"best_match",models:["best_match"]},{rank:1,name:"MFWAM",alias:"ECMWF",model:"meteofrance_wave",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:12,models:["meteofrance_wave"],categories:"meteofrance_wave",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:2,disabled:!0,name:"SMOC",alias:"ECMWF",model:"meteofrance_currents",provider:"MeteoFrance",country:"France",resolution:8,tips:"8km",length:10,frequency:24,models:["meteofrance_currents"],categories:"meteofrance_currents, meteofrance_sea_surface_temperature",variables:"ocean_u_current,ocean_v_current,invert_barometer_height,sea_level_height_msl,sea_surface_temperature"},{rank:3,disabled:!0,name:"EWAM",alias:"ECMWF",model:"ewam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:8,frequency:2,models:["ewam"],categories:"dwd_ewam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:4,disabled:!0,name:"GWAM",alias:"ECMWF",model:"gwam",provider:"DWD",country:"Germany",resolution:5,tips:"5km",length:4,frequency:2,models:["gwam"],categories:"dwd_gwam",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:5,disabled:!0,name:"ECWAM",alias:"ECMWF",model:"ecmwf_wam025",provider:"ECMWF",country:"Europe",resolution:25,tips:"25km",length:10,frequency:6,models:["ecmwf_wam025"],categories:"ecmwf_wam025",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:6,name:"GFSWave",alias:"GFS",model:"ncep_gfswave025",provider:"NCEP",country:"USA",resolution:25,tips:"25km",length:10,frequency:6,models:["ncep_gfswave025","ncep_gfswave016"],categories:"ncep_gfswave025,ncep_gfswave016",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"},{rank:7,disabled:!0,name:"ERA5-Ocean",alias:"ECMWF",model:"era5_ocean",provider:"Copernicus",country:"Europe",resolution:50,tips:"50km",length:-5,frequency:1,models:["era5_ocean"],categories:"copernicus_era5_ocean",variables:"swell_wave_direction,swell_wave_height,swell_wave_period,swell_wave_peak_period,wave_direction,wave_height,wave_period,wind_wave_direction,wind_wave_height,wind_wave_period,wind_wave_peak_period"}];let va=class{static standardWeatherModels(){return fo.filter(e=>!e.disabled&&e.alias)}static standardMarineModels(){return yo.filter(e=>!e.disabled&&e.alias)}static autoPickLayerModel(e,a="copernicus"){return a=a||"copernicus",a=a==null?void 0:a.toLowerCase(),a=["gfs","ecmwf","copernicus"].includes(a)?a:"copernicus",e=e==null?void 0:e.toLowerCase(),e==="gfs"?"gfs":["ec","ecmwf"].includes(e)?"ecmwf":["copernicus","cmems"].includes(e)?"copernicus":a}static autoPickPeerModel(e,a,r="copernicus"){if(a=this.autoPickLayerModel(a,r),pl.LayerHelper.WEATHER_LAYERS.reduce((i,l)=>l.atmos?i+l.weight:i,0)&e.weight){if(a==="copernicus")return"ecmwf"}else{if(["sig-wave","sig-wave-height","sig-wave-height-contour"].includes(e.key))return a;if(a==="ecmwf")return"copernicus"}return a}static autoPickMeteoModel(e="best_match"){var a,r;e=e==null?void 0:e.toLowerCase(),e=e==="ec"?"ecmwf":e;const i=e.toLowerCase().split(","),l=[],n=[];for(const s of i){let c=fo.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(s))||((u=d.alias)==null?void 0:u.toLowerCase())===s||((y=d.name)==null?void 0:y.toLowerCase())===s}),m=yo.find(d=>{var g,u,y;return((g=d.models)==null?void 0:g.includes(s))||((u=d.alias)==null?void 0:u.toLowerCase())===s||((y=d.name)==null?void 0:y.toLowerCase())===s});c=c||fo.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=m==null?void 0:m.alias)==null?void 0:u.toLowerCase())}),m=m||yo.find(d=>{var g,u;return((g=d.alias)==null?void 0:g.toLowerCase())===((u=c==null?void 0:c.alias)==null?void 0:u.toLowerCase())}),c=c||fo[0],m=m||yo[0],l.push((a=c.models)!=null&&a.includes(s)?s:c.model),n.push((r=m.models)!=null&&r.includes(s)?s:m.model)}return{weatherModels:l.join(","),marineModels:n.join(",")}}static autoPickSubCategories(e){e=e.toUpperCase();const a=fo.filter(l=>l.alias===e),r=yo.filter(l=>l.alias===e),i=[];return a.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),r.forEach(l=>{l.categories&&i.push(...l.categories.split(","))}),i}static pickHourly(e,a){var r,i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z,H,te,W,I,K,V,Y,ee,he,ge,re,ue,ye,ze,J,ne,Fe,Ge,Re,Ce,je,Ne,Ee,De,We,Ze,Be,xe,ke,_e,He,Xe,Oe,Pe,rt,lt,nt,st,ct,mt,dt,ht,pt,ut,gt,ft,yt,bt,wt,xt,kt,At,Lt,vt,Ct,_t,zt,St,Pt,Mt,Tt,Nt,Et,Vt,Rt,Dt,Bt,It,Ft,Gt,jt,Wt,Zt,Me,Ve,Ht,Ye,Xt,et,Ae,Ue;const ie=typeof a=="string"?_(a):a;let Le=ie.clone();const U=e==null?void 0:e.weather,X=e==null?void 0:e.marine,Je=((i=(r=U==null?void 0:U[0])==null?void 0:r.hourly)==null?void 0:i.date)||((n=(l=X==null?void 0:X[0])==null?void 0:l.hourly)==null?void 0:n.date),Ie=_.utc(Je),Se=Ie.clone().add(((m=(c=(s=U==null?void 0:U[0])==null?void 0:s.hourly)==null?void 0:c.time)==null?void 0:m.at(0))||((u=(g=(d=X==null?void 0:X[0])==null?void 0:d.hourly)==null?void 0:g.time)==null?void 0:u.at(0)),"h"),G=Ie.clone().add(((h=(p=(y=U==null?void 0:U[0])==null?void 0:y.hourly)==null?void 0:p.time)==null?void 0:h.at(-1))||((v=(x=(f=X==null?void 0:X[0])==null?void 0:f.hourly)==null?void 0:x.time)==null?void 0:v.at(-1)),"h"),Ot=[];Le=Le.isBefore(Se)?Se.clone():Le,Le=Le.isAfter(G)?G.clone():Le;const oe=Le.utc().diff(Se,"h",!1);let ve,Ke;if(U!=null&&U.length){let tt=0,ot=0,B=0;for(const Qe of U){const j=Qe==null?void 0:Qe.hourly;for(let me=oe-(oe-1)%3;me<=oe;me++)tt+=((b=j==null?void 0:j.precipitation)==null?void 0:b.at(me))??0;for(let me=oe-(oe-1)%6;me<=oe;me++)ot+=((k=j==null?void 0:j.precipitation)==null?void 0:k.at(me))??0;for(let me=oe-(oe-1)%12;me<=oe;me++)B+=((A=j==null?void 0:j.precipitation)==null?void 0:A.at(me))??0;const qe=((L=j==null?void 0:j.wind_direction_10m)==null?void 0:L.at(oe))??((z=(C=j==null?void 0:j.wind_direction_10m)==null?void 0:C.filter(me=>me!==null))==null?void 0:z.at(-1));ve={temp:((M=j==null?void 0:j.temperature_2m)==null?void 0:M.at(oe))??((N=(T=j==null?void 0:j.temperature_2m)==null?void 0:T.filter(me=>me!==null))==null?void 0:N.at(-1)),apparentTemp:((F=j==null?void 0:j.apparent_temperature)==null?void 0:F.at(oe))??((q=(O=j==null?void 0:j.apparent_temperature)==null?void 0:O.filter(me=>me!==null))==null?void 0:q.at(-1)),rh:(($=j==null?void 0:j.relative_humidity_2m)==null?void 0:$.at(oe))??((S=(le=j==null?void 0:j.relative_humidity_2m)==null?void 0:le.filter(me=>me!==null))==null?void 0:S.at(-1)),dp:((Z=j==null?void 0:j.dew_point_2m)==null?void 0:Z.at(oe))??((te=(H=j==null?void 0:j.dew_point_2m)==null?void 0:H.filter(me=>me!==null))==null?void 0:te.at(-1)),precip:{probability:((W=j==null?void 0:j.precipitation_probability)==null?void 0:W.at(oe))??0,sum:((I=j==null?void 0:j.precipitation)==null?void 0:I.at(oe))??0,sum1Hours:((K=j==null?void 0:j.precipitation)==null?void 0:K.at(oe))??0,sum3Hours:Math.round(tt*100)/100,sum6Hours:Math.round(ot*100)/100,sum12Hours:Math.round(B*100)/100},pmsl:((V=j==null?void 0:j.pressure_msl)==null?void 0:V.at(oe))??((ee=(Y=j==null?void 0:j.pressure_msl)==null?void 0:Y.filter(me=>me!==null))==null?void 0:ee.at(-1)),psurf:((he=j==null?void 0:j.surface_pressure)==null?void 0:he.at(oe))??((re=(ge=j==null?void 0:j.surface_pressure)==null?void 0:ge.filter(me=>me!==null))==null?void 0:re.at(-1)),code:((ue=j==null?void 0:j.weather_code)==null?void 0:ue.at(oe))??((ze=(ye=j==null?void 0:j.weather_code)==null?void 0:ye.filter(me=>me!==null))==null?void 0:ze.at(-1)),visibility:this.m2nm(((J=j==null?void 0:j.visibility)==null?void 0:J.at(oe))??((Fe=(ne=j==null?void 0:j.visibility)==null?void 0:ne.filter(me=>me!==null))==null?void 0:Fe.at(-1))),wind:{speed:((Ge=j==null?void 0:j.wind_speed_10m)==null?void 0:Ge.at(oe))??((Ce=(Re=j==null?void 0:j.wind_speed_10m)==null?void 0:Re.filter(me=>me!==null))==null?void 0:Ce.at(-1)),kts:((je=j==null?void 0:j.wind_speed_10m)==null?void 0:je.at(oe))??((Ee=(Ne=j==null?void 0:j.wind_speed_10m)==null?void 0:Ne.filter(me=>me!==null))==null?void 0:Ee.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,gusts:((De=j==null?void 0:j.wind_gusts_10m)==null?void 0:De.at(oe))??((Ze=(We=j==null?void 0:j.wind_gusts_10m)==null?void 0:We.filter(me=>me!==null))==null?void 0:Ze.at(-1))},isDay:(Be=j==null?void 0:j.is_day)==null?void 0:Be.at(oe)};const{name:Ut,url:se,bg:io}=this.parseWeatherCode(ve.code,ve.isDay);ve.name=Ut,ve.url=se,ve.bg=io,ve.wind.scale=this.beaufort(this.kts2ms(ve.wind.kts)),ve.wind.direction=this.degree2Direction(ve.wind.degree),Ot.push({utc:ie.utc().format(),realUTC:Se.add(oe,"h").format(),model:Qe.model,weather:{...ve}})}}if(X!=null&&X.length){let tt=0;for(const ot of X){const B=ot==null?void 0:ot.hourly,Qe=((xe=B==null?void 0:B.wave_direction)==null?void 0:xe.at(oe))??((_e=(ke=B==null?void 0:B.wave_direction)==null?void 0:ke.filter(se=>se!==null))==null?void 0:_e.at(-1)),j=((He=B==null?void 0:B.swell_wave_direction)==null?void 0:He.at(oe))??((Oe=(Xe=B==null?void 0:B.swell_wave_direction)==null?void 0:Xe.filter(se=>se!==null))==null?void 0:Oe.at(-1)),qe=((Pe=B==null?void 0:B.wind_wave_direction)==null?void 0:Pe.at(oe))??((lt=(rt=B==null?void 0:B.wind_wave_direction)==null?void 0:rt.filter(se=>se!==null))==null?void 0:lt.at(-1)),Ut=((nt=B==null?void 0:B.ocean_current_direction)==null?void 0:nt.at(oe))??((ct=(st=B==null?void 0:B.ocean_current_direction)==null?void 0:st.filter(se=>se!==null))==null?void 0:ct.at(-1));Ke={wave:{sig:{height:((mt=B==null?void 0:B.wave_height)==null?void 0:mt.at(oe))??((ht=(dt=B==null?void 0:B.wave_height)==null?void 0:dt.filter(se=>se!==null))==null?void 0:ht.at(-1)),degree:Qe,bearing:Qe!==null?Math.round((Qe+180)%360):null,period:((pt=B==null?void 0:B.wave_period)==null?void 0:pt.at(oe))??((gt=(ut=B==null?void 0:B.wave_period)==null?void 0:ut.filter(se=>se!==null))==null?void 0:gt.at(-1))},swell:{height:((ft=B==null?void 0:B.swell_wave_height)==null?void 0:ft.at(oe))??((bt=(yt=B==null?void 0:B.swell_wave_height)==null?void 0:yt.filter(se=>se!==null))==null?void 0:bt.at(-1)),degree:j,bearing:j!==null?Math.round((j+180)%360):null,period:((wt=B==null?void 0:B.swell_wave_period)==null?void 0:wt.at(oe))??((kt=(xt=B==null?void 0:B.swell_wave_period)==null?void 0:xt.filter(se=>se!==null))==null?void 0:kt.at(-1)),peakPeriod:((At=B==null?void 0:B.swell_wave_peak_period)==null?void 0:At.at(oe))??((vt=(Lt=B==null?void 0:B.swell_wave_peak_period)==null?void 0:Lt.filter(se=>se!==null))==null?void 0:vt.at(-1))},wd:{height:((Ct=B==null?void 0:B.wind_wave_height)==null?void 0:Ct.at(oe))??((zt=(_t=B==null?void 0:B.wind_wave_height)==null?void 0:_t.filter(se=>se!==null))==null?void 0:zt.at(-1)),degree:qe,bearing:qe!==null?Math.round((qe+180)%360):null,period:((St=B==null?void 0:B.wind_wave_period)==null?void 0:St.at(oe))??((Mt=(Pt=B==null?void 0:B.wind_wave_period)==null?void 0:Pt.filter(se=>se!==null))==null?void 0:Mt.at(-1)),peakPeriod:((Tt=B==null?void 0:B.wind_wave_peak_period)==null?void 0:Tt.at(oe))??((Et=(Nt=B==null?void 0:B.wind_wave_peak_period)==null?void 0:Nt.filter(se=>se!==null))==null?void 0:Et.at(-1))}},current:{speed:((Vt=B==null?void 0:B.ocean_current_velocity)==null?void 0:Vt.at(oe))??((Dt=(Rt=B==null?void 0:B.ocean_current_velocity)==null?void 0:Rt.filter(se=>se!==null))==null?void 0:Dt.at(-1)),kts:((Bt=B==null?void 0:B.ocean_current_velocity)==null?void 0:Bt.at(oe))??((Ft=(It=B==null?void 0:B.ocean_current_velocity)==null?void 0:It.filter(se=>se!==null))==null?void 0:Ft.at(-1)),degree:Ut,bearing:Ut},sst:((Gt=B==null?void 0:B.sea_surface_temperature)==null?void 0:Gt.at(oe))??((Wt=(jt=B==null?void 0:B.sea_surface_temperature)==null?void 0:jt.filter(se=>se!==null))==null?void 0:Wt.at(-1)),height:((Zt=B==null?void 0:B.sea_level_height_msl)==null?void 0:Zt.at(oe))??((Ve=(Me=B==null?void 0:B.sea_level_height_msl)==null?void 0:Me.filter(se=>se!==null))==null?void 0:Ve.at(-1)),ice:{sit:((Ht=B==null?void 0:B.sea_ice_thickness)==null?void 0:Ht.at(oe))??((Xt=(Ye=B==null?void 0:B.sea_ice_thickness)==null?void 0:Ye.filter(se=>se!==null))==null?void 0:Xt.at(-1)),sic:((et=B==null?void 0:B.sea_ice_concentration)==null?void 0:et.at(oe))??((Ue=(Ae=B==null?void 0:B.sea_ice_concentration)==null?void 0:Ae.filter(se=>se!==null))==null?void 0:Ue.at(-1))}},Ke.wave=this.parseWave(Ke.wave,ve==null?void 0:ve.wind),Ke.current.direction=this.degree2Direction(Ke.current.degree),Ot[tt]?Object.assign(Ot[tt],Ke):Ot.push({utc:ie.utc().format(),realUTC:Se.add(oe,"h").format(),model:ot.model,...Ke}),tt++}}return Ot}static toLegacy(e){var a,r,i,l,n,s,c,m,d,g;return{wind:(a=e==null?void 0:e.weather)==null?void 0:a.wind,visibility:(r=e==null?void 0:e.weather)==null?void 0:r.visibility,temp:(i=e==null?void 0:e.weather)==null?void 0:i.temp,prmsl:(l=e==null?void 0:e.weather)==null?void 0:l.pmsl,gusts:{kts:(s=(n=e==null?void 0:e.weather)==null?void 0:n.wind)==null?void 0:s.gusts},precip:(c=e==null?void 0:e.weather)==null?void 0:c.precip,code:(m=e==null?void 0:e.weather)==null?void 0:m.code,name:(d=e==null?void 0:e.weather)==null?void 0:d.name,url:(g=e==null?void 0:e.weather)==null?void 0:g.url,wave:e==null?void 0:e.wave,current:e==null?void 0:e.current,sst:e==null?void 0:e.sst,height:e==null?void 0:e.height,utc:e==null?void 0:e.utc,source:e==null?void 0:e.model,ice:e==null?void 0:e.ice}}static pickDaily(e,a){var r,i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z,H,te,W,I,K,V,Y,ee,he,ge,re,ue,ye,ze,J,ne,Fe,Ge,Re,Ce,je,Ne,Ee,De,We,Ze,Be,xe,ke,_e,He,Xe,Oe,Pe,rt,lt,nt,st,ct,mt,dt,ht,pt,ut,gt,ft,yt,bt,wt,xt,kt,At,Lt,vt,Ct,_t,zt,St,Pt,Mt,Tt,Nt,Et,Vt,Rt,Dt,Bt,It,Ft,Gt,jt,Wt;const Zt=typeof a=="string"?_(a):a;let Me=Zt.clone();const Ve=e==null?void 0:e.weather,Ht=e==null?void 0:e.marine,Ye=_((l=(i=(r=Ve==null?void 0:Ve[0])==null?void 0:r.daily)==null?void 0:i.time)==null?void 0:l.at(0)),Xt=_((c=(s=(n=Ve==null?void 0:Ve[0])==null?void 0:n.daily)==null?void 0:s.time)==null?void 0:c.at(-1)),et=[];Me=Me.isBefore(Ye)?Ye.clone():Me,Me=Me.isAfter(Xt)?Xt.clone():Me;let Ae,Ue;const ie=Me.diff(Ye,"d",!1);if(Ve)for(const Le of Ve){const U=Le.daily,X=((m=U.wind_direction_10m_dominant)==null?void 0:m.at(ie))??((g=(d=U.wind_direction_10m_dominant)==null?void 0:d.filter(G=>G!==null))==null?void 0:g.at(-1));Ae={code:((u=U.weather_code)==null?void 0:u.at(ie))??((p=(y=U.weather_code)==null?void 0:y.filter(G=>G!==null))==null?void 0:p.at(-1)),temp:{max:((h=U.temperature_2m_max)==null?void 0:h.at(ie))??((x=(f=U.temperature_2m_max)==null?void 0:f.filter(G=>G!==null))==null?void 0:x.at(-1)),min:((v=U.temperature_2m_min)==null?void 0:v.at(ie))??((k=(b=U.temperature_2m_min)==null?void 0:b.filter(G=>G!==null))==null?void 0:k.at(-1)),mean:((A=U.temperature_2m_mean)==null?void 0:A.at(ie))??((C=(L=U.temperature_2m_mean)==null?void 0:L.filter(G=>G!==null))==null?void 0:C.at(-1))},apparentTemp:{max:((z=U.apparent_temperature_max)==null?void 0:z.at(ie))??((T=(M=U.apparent_temperature_max)==null?void 0:M.filter(G=>G!==null))==null?void 0:T.at(-1)),min:((N=U.apparent_temperature_min)==null?void 0:N.at(ie))??((O=(F=U.apparent_temperature_min)==null?void 0:F.filter(G=>G!==null))==null?void 0:O.at(-1))},precip:{sum:((q=U.precipitation_sum)==null?void 0:q.at(ie))??((le=($=U.precipitation_sum)==null?void 0:$.filter(G=>G!==null))==null?void 0:le.at(-1)),rainSum:((S=U.rain_sum)==null?void 0:S.at(ie))??((H=(Z=U.rain_sum)==null?void 0:Z.filter(G=>G!==null))==null?void 0:H.at(-1)),snowfallSum:((te=U.snowfall_sum)==null?void 0:te.at(ie))??((I=(W=U.snowfall_sum)==null?void 0:W.filter(G=>G!==null))==null?void 0:I.at(-1)),showersSum:((K=U.showers_sum)==null?void 0:K.at(ie))??((Y=(V=U.showers_sum)==null?void 0:V.filter(G=>G!==null))==null?void 0:Y.at(-1)),hours:((ee=U.precipitation_hours)==null?void 0:ee.at(ie))??0,probability:((he=U.precipitation_probability_max)==null?void 0:he.at(ie))??0},rh:{max:((ge=U.relative_humidity_2m_max)==null?void 0:ge.at(ie))??((ue=(re=U.relative_humidity_2m_max)==null?void 0:re.filter(G=>G!==null))==null?void 0:ue.at(-1)),min:((ye=U.relative_humidity_2m_min)==null?void 0:ye.at(ie))??((J=(ze=U.relative_humidity_2m_min)==null?void 0:ze.filter(G=>G!==null))==null?void 0:J.at(-1)),mean:((ne=U.relative_humidity_2m_mean)==null?void 0:ne.at(ie))??((Ge=(Fe=U.relative_humidity_2m_mean)==null?void 0:Fe.filter(G=>G!==null))==null?void 0:Ge.at(-1))},wind:{speed:((Re=U.wind_speed_10m_max)==null?void 0:Re.at(ie))??((je=(Ce=U.wind_speed_10m_max)==null?void 0:Ce.filter(G=>G!==null))==null?void 0:je.at(-1)),kts:((Ne=U.wind_speed_10m_max)==null?void 0:Ne.at(ie))??((De=(Ee=U.wind_speed_10m_max)==null?void 0:Ee.filter(G=>G!==null))==null?void 0:De.at(-1)),degree:X,gusts:((We=U.wind_gusts_10m_max)==null?void 0:We.at(ie))??((Be=(Ze=U.wind_gusts_10m_max)==null?void 0:Ze.filter(G=>G!==null))==null?void 0:Be.at(-1)),mean:((xe=U.wind_speed_10m_mean)==null?void 0:xe.at(ie))??((_e=(ke=U.wind_speed_10m_mean)==null?void 0:ke.filter(G=>G!==null))==null?void 0:_e.at(-1)),bearing:X!==null?Math.round((X+180)%360):null},visibility:{max:this.m2nm(((He=U.visibility_max)==null?void 0:He.at(ie))??((Oe=(Xe=U.visibility_max)==null?void 0:Xe.filter(G=>G!==null))==null?void 0:Oe.at(-1))),min:this.m2nm(((Pe=U.visibility_min)==null?void 0:Pe.at(ie))??((lt=(rt=U.visibility_min)==null?void 0:rt.filter(G=>G!==null))==null?void 0:lt.at(-1))),mean:this.m2nm(((nt=U.visibility_mean)==null?void 0:nt.at(ie))??((ct=(st=U.visibility_mean)==null?void 0:st.filter(G=>G!==null))==null?void 0:ct.at(-1)))}};const{name:Je,url:Ie,bg:Se}=this.parseWeatherCode(Ae.code,!0);Ae.name=Je,Ae.url=Ie,Ae.bg=Se,Ae.wind.scale=this.beaufort(this.kts2ms(Ae.wind.kts)),Ae.wind.direction=this.degree2Direction(Ae.wind.degree),et.push({utc:Zt.utc().format(),realUTC:Ye.add(ie,"d").utc().format(),model:Le.model,weather:{...Ae}})}if(Ht){let Le=0;for(const U of Ht){const X=U.daily,Je=((mt=X==null?void 0:X.wave_direction_dominant)==null?void 0:mt.at(ie))||((ht=(dt=X==null?void 0:X.wave_direction_dominant)==null?void 0:dt.filter(G=>G!==null))==null?void 0:ht.at(-1)),Ie=((pt=X==null?void 0:X.swell_wave_direction_dominant)==null?void 0:pt.at(ie))||((gt=(ut=X==null?void 0:X.swell_wave_direction_dominant)==null?void 0:ut.filter(G=>G!==null))==null?void 0:gt.at(-1)),Se=((ft=X==null?void 0:X.wind_wave_direction_dominant)==null?void 0:ft.at(ie))||((bt=(yt=X==null?void 0:X.wind_wave_direction_dominant)==null?void 0:yt.filter(G=>G!==null))==null?void 0:bt.at(-1));Ue={wave:{sig:{height:((wt=X==null?void 0:X.wave_height_max)==null?void 0:wt.at(ie))||((kt=(xt=X==null?void 0:X.wave_height_max)==null?void 0:xt.filter(G=>G!==null))==null?void 0:kt.at(-1)),degree:Je,period:((At=X==null?void 0:X.wave_period_max)==null?void 0:At.at(ie))||((vt=(Lt=X==null?void 0:X.wave_period_max)==null?void 0:Lt.filter(G=>G!==null))==null?void 0:vt.at(-1)),bearing:Je!==null?Math.round((Je+180)%360):null},swell:{height:((Ct=X==null?void 0:X.swell_wave_height_max)==null?void 0:Ct.at(ie))??((zt=(_t=X==null?void 0:X.swell_wave_height_max)==null?void 0:_t.filter(G=>G!==null))==null?void 0:zt.at(-1)),degree:Ie,period:((St=X==null?void 0:X.swell_wave_period_max)==null?void 0:St.at(ie))??((Mt=(Pt=X==null?void 0:X.swell_wave_period_max)==null?void 0:Pt.filter(G=>G!==null))==null?void 0:Mt.at(-1)),peakPeriod:((Tt=X==null?void 0:X.swell_wave_peak_period_max)==null?void 0:Tt.at(ie))??((Et=(Nt=X==null?void 0:X.swell_wave_peak_period_max)==null?void 0:Nt.filter(G=>G!==null))==null?void 0:Et.at(-1)),bearing:Ie!==null?Math.round((Ie+180)%360):null},wd:{height:((Vt=X==null?void 0:X.wind_wave_height_max)==null?void 0:Vt.at(ie))??((Dt=(Rt=X==null?void 0:X.wind_wave_height_max)==null?void 0:Rt.filter(G=>G!==null))==null?void 0:Dt.at(-1)),degree:Se,period:((Bt=X==null?void 0:X.wind_wave_period_max)==null?void 0:Bt.at(ie))??((Ft=(It=X==null?void 0:X.wind_wave_period_max)==null?void 0:It.filter(G=>G!==null))==null?void 0:Ft.at(-1)),peakPeriod:((Gt=X==null?void 0:X.wind_wave_peak_period_max)==null?void 0:Gt.at(ie))??((Wt=(jt=X==null?void 0:X.wind_wave_peak_period_max)==null?void 0:jt.filter(G=>G!==null))==null?void 0:Wt.at(-1)),bearing:Se!==null?Math.round((Se+180)%360):null}}},Ue.wave=this.parseWave(Ue.wave,Ae==null?void 0:Ae.wind),Object.assign(et[Le]||{},Ue),Le++}}return et}static parseWave(e,a){if(e.sig.direction=this.degree2Direction(e.sig.degree),e.swell.direction=this.degree2Direction(e.swell.degree),e.wd.direction=this.degree2Direction(e.wd.degree),e.sig.scale=this.douglas(e.sig.height),e.swell.scale=this.douglas(e.swell.height),e.wd.scale=this.douglas(e.wd.height),e.sig.height==0){const r=Math.sqrt(Math.pow(e.swell.height||0,2)+Math.pow(e.wd.height||0,2));e.sig.height=r?Math.round(r*100)/100:.1}if(e.swell.height===0)if(e.sig.height>e.wd.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.wd.height||0,2)));e.swell.height=Math.round(r*100)/100}else{const r=Math.round(.12*this.kts2ms((a==null?void 0:a.kts)||0)*100)/100,i=r>1?r/10:r>.5?r/5:r>.3?r/2:r,l=Math.max(e.sig.height,e.wd.height);e.swell.height=Math.round((i<l?i:l/2)*100)/100}if(e.wd.height===0)if(e.sig.height>e.swell.height){const r=Math.sqrt(Math.abs(Math.pow(e.sig.height||0,2)-Math.pow(e.swell.height||0,2))),i=.24*this.kts2ms((a==null?void 0:a.kts)||0);e.wd.height=Math.round(Math.min(r,i)*100)/100}else{const r=.24*this.kts2ms((a==null?void 0:a.kts)||0),i=Math.max(e.sig.height,e.swell.height);e.wd.height=Math.round((r<i?r:i/2)*100)/100}if(e.swell.height>=e.sig.height&&(e.swell.height=Math.round(e.sig.height*.8*100)/100),e.wd.height>=e.sig.height&&(e.wd.height=Math.round(e.sig.height*.8*100)/100),!e.sig.period){const r=Math.max(e.swell.period,e.wd.period);e.sig.period=Math.round(6*Math.sqrt(e.sig.height)),e.sig.period=isNaN(r)?void 0:e.sig.period>r?r:e.sig.period}if(!e.swell.period){e.swell.period=Math.round(6*Math.sqrt(e.swell.height));const r=Math.max(e.sig.period,e.wd.period);e.swell.period=isNaN(r)?void 0:e.swell.period>r?r:e.swell.period}if(!e.wd.period){e.wd.period=Math.round(6*Math.sqrt(e.wd.height));const r=Math.max(e.sig.period,e.swell.period);e.wd.period=isNaN(r)?void 0:e.wd.period>r?r:e.wd.period}return e}static parseWeatherCode(e,a){const r=this.weatherCode(e);return(a?r.day:r.night)||{}}static weatherCode(e){const a={code:e};switch(e){case 0:a.day={name:"Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 1:a.day={name:"Mainly Sunny",url:"https://ossimg.ormwx.com/asset/weather/01d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"},a.night={name:"Mainly Clear",url:"https://ossimg.ormwx.com/asset/weather/01n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg1.png"};break;case 2:a.day={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"},a.night={name:"Partly Cloudy",url:"https://ossimg.ormwx.com/asset/weather/02n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg2.png"};break;case 3:a.day={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"},a.night={name:"Overcast",url:"https://ossimg.ormwx.com/asset/weather/04n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg3.png"};break;case 45:a.day={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Foggy",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 48:a.day={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"},a.night={name:"Rime Fog",url:"https://ossimg.ormwx.com/asset/weather/50n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg4.png"};break;case 51:a.day={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 53:a.day={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 55:a.day={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Drizzle",url:"https://ossimg.ormwx.com/asset/weather/15n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 56:a.day={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 57:a.day={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/14d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Drizzle",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 61:a.day={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 63:a.day={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 65:a.day={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 66:a.day={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 67:a.day={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/16d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Freezing Rain",url:"https://ossimg.ormwx.com/asset/weather/10n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 71:a.day={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 73:a.day={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 75:a.day={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Heavy Snow",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 77:a.day={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/17d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Grains",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 80:a.day={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 81:a.day={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 82:a.day={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Heavy Showers",url:"https://ossimg.ormwx.com/asset/weather/09n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 85:a.day={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Light Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 86:a.day={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"},a.night={name:"Snow Showers",url:"https://ossimg.ormwx.com/asset/weather/13n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg6.png"};break;case 95:a.day={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorm",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 96:a.day={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Light Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break;case 99:a.day={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11d.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"},a.night={name:"Thunderstorms With Hail",url:"https://ossimg.ormwx.com/asset/weather/11n.svg",bg:"https://ossimg.ormwx.com/asset/weather/bg5.png"};break}return a}static kts2ms(e){return isNaN(e)||e===null?e:Math.round(e*1852/3600*1e4)/1e4}static kts2kmh(e){return isNaN(e)||e===null?e:e*1.852}static m2nm(e){return isNaN(e)||e===null?e:Math.round(e/1e3/1.852*1e4)/1e4}static kmh2kts(e){return isNaN(e)||e===null?e:this.ms2kts(e*1e3/3600)}static ms2kts(e){return isNaN(e)||e===null?e:Math.round(e*3600/1852*1e4)/1e4}static degree2Radian(e){if(isNaN(e)||e===null)return e;let a=e%360/360*2*Math.PI;return a=a<0?a+2*Math.PI:a,a}static degree2Direction(e){const a=this.degree2Radian(e);if(isNaN(a)||a===null)return null;let r="N/A";const i=Math.PI/16;return a<i?r="N":a>=i&&a<3*i?r="NNE":a>=3*i&&a<5*i?r="NE":a>=5*i&&a<7*i?r="ENE":a>=7*i&&a<9*i?r="E":a>=9*i&&a<11*i?r="ESE":a>=11*i&&a<13*i?r="SE":a>=13*i&&a<15*i?r="SSE":a>=15*i&&a<17*i?r="S":a>=17*i&&a<19*i?r="SSW":a>=19*i&&a<21*i?r="SW":a>=21*i&&a<23*i?r="WSW":a>=23*i&&a<25*i?r="W":a>=25*i&&a<27*i?r="WNW":a>=27*i&&a<29*i?r="NW":a>=29*i&&a<31*i?r="NNW":a>=31*i&&a<32*i&&(r="N"),r}static beaufort(e){let a=0;return isNaN(e)||(e=Math.round(e*10)/10,e<=.2?a=0:e<=1.5?a=1:e<=3.3?a=2:e<=5.4?a=3:e<=7.9?a=4:e<=10.7?a=5:e<=13.8?a=6:e<=17.1?a=7:e<=20.7?a=8:e<=22.4?a=9:e<=28.4?a=10:e<=32.6?a=11:e<=36.9?a=12:e<=41.4?a=13:e<=46.1?a=14:e<=50.9?a=15:e<=55.9?a=16:e<=61.2?a=17:e>61.2&&(a=18)),a}static douglas(e){let a="Calm";return isNaN(e)||e<=.1?a="Calm":e<=.5?a="Smooth":e<=1.25?a="Slight":e<=2.5?a="Moderate":e<=4?a="Rough":e<=6?a="VeryRough":e<=9?a="High":e<=14?a="VeryHigh":a="Precipitous",a}};const Wb="",Fd={name:"IdmTropicals",props:{simple:{type:Boolean,default:!1},permission:{type:Number},locale:{type:String},map:{type:Object},top:{type:Number,default:60},paddingTop:{type:Number,default:48},menuToggle:{type:Object,default:{}},timeZone:{type:Number},token:{type:String},defaultMeteoToken:{type:String},gateway:{type:String,default:"aa"},assistGateway:{type:Array,default:[]},forecastModel:{type:String},realTime:{type:String},beforeLayer:{type:String},platform:{type:String}},emits:["tropical","tropicalCenterPoints","tropicalReport"],setup(){return{Theme:be.useTheme()}},data(){return{right:10,toggle:!1,helper:ho.CompanyHelper,tropicals:void 0,tropicalCacheKey:"tropicalCacheGL4",source:"tropicals-source",clusterSource:"tropicals-cluster-source",historyLayer:"tropicals-history-layer",forecastLayer:"tropicals-forecast-layer",forecastModelLayer:"tropicals-forecast-model-layer",forecastNameLayer:"tropicals-forecast-name-layer",pointCircleLayer:"tropicals-point-circle-layer",pointLabelLayer:"tropicals-point-label-layer",historyPointCircleLayer:"history-tropicals-point-circle-layer",historyPointLabelLayer:"history-tropicals-point-label-layer",interpolateData:[],interpolateMarkers:[],interpolateSource:"tropicals-interpolate-source",interpolateLineLayer:"tropicals-interpolate-line-layer",showTropicalsInfo:!1,activeTropicals:void 0,activeTropicalsMarker:void 0,empty:E.featureCollection([]),showLegend:!1,showHoverPoint:!1,hoverPoint:void 0,hoverMarker:void 0}},computed:{hoverLayers(){return[this.forecastNameLayer,this.forecastLayer,this.historyLayer,this.pointCircleLayer,this.pointCircleLayer+"-border",this.historyPointCircleLayer,this.historyPointCircleLayer+"-border",this.historyPointCircleLayer+"-inner"]},clickLayers(){return[this.forecastNameLayer,this.historyLayer]},computeTime(){return(t,e)=>{if(t){const a=_(t).utcOffset(e),r=e<0?e:"+"+e;return`${a==null?void 0:a.format("MMM-DD/HHmm")} (UTC${r}) ${a==null?void 0:a.fromNow()} `}return"-"}},computeTzTime(){return(t,e,a="MM-DD HH:mm")=>{var r,i;if(t){const l=e||0,n=(i=(r=_(t))==null?void 0:r.utcOffset(l))==null?void 0:i.format(a),s=`(UTC ${l>=0?"+":""}${l})`;return n+" "+s}return"-"}},computeTimezone(){return this.timeZone<0?this.timeZone:"+"+this.timeZone},computeBF(){return function(t){const e=va.kts2ms(t);return va.beaufort(e)}},computeMovement(){return function(t){var e,a;return(a=(e=t==null?void 0:t.forecasts)==null?void 0:e.find(r=>!r.disabled))==null?void 0:a.movement}},computePosition(){return t=>!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}},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},map:{handler(t,e){e==null||e.off("render",this.handleUpdateMarkerVisibility),this.map?(this.map.on("render",this.handleUpdateMarkerVisibility),this.toggle=localStorage.getItem(this.tropicalCacheKey)==="true"||!1,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle&&this.fetchTropicals()):this.handleClear()}},showTropicalsInfo:{handler(){this.$emit("tropical",this.showTropicalsInfo),this.simple&&this.showTropicalsInfo?this.$nextTick(()=>{var t,e;this.$parent.playerBottom=((e=(t=this.$refs.tropicalsInfo)==null?void 0:t.$el)==null?void 0:e.clientHeight)+10}):this.simple&&(this.$parent.playerBottom=30)},immediate:!0},"tropicals.version":{handler(){this.handleRefresh()}},timeZone:{handler(t,e){t!==e&&this.handleRefresh()}},realTime:{handler(t){this.map&&t&&this.toggle&&this.handleRender()}},locale:{handler(t){this.map&&this.toggle&&this.handleRefresh()}}},methods:{handleMenuToggle(){var t,e,a;this.toggle=!this.toggle,localStorage.setItem(this.tropicalCacheKey,this.toggle),this.toggle?this.fetchTropicals():(this.handleClear(),(a=(e=(t=this.$parent)==null?void 0:t.$refs)==null?void 0:e.idmBottomBar)==null||a.handleToggle("tropical",!1))},async fetchTropicals(){var i,l,n;const t=new Date().valueOf();let e=0,a=0,r=(i=ho.LayerHelper.WEATHER_LAYERS.find(s=>s.key==="tropicals"))==null?void 0:i.weight;if(r>0){const s=this.assistGateway[Math.round(Math.random()*(this.assistGateway.length-1))],c=await de.get(`${s}/api/arc/weather/layers2/links?l=${r}&v=${this.forecastModel}&t=${this.realTime}`,{headers:{Authorization:this.token||this.defaultMeteoToken}});if(a=new Date().valueOf()-(t+e),console.log("weather links elapsed: ",a,", total: ",e+=a),((l=c==null?void 0:c.data)==null?void 0:l.code)===0){const m=(n=c==null?void 0:c.data)==null?void 0:n.data;await de.get(m.tropicals,{headers:{Authorization:this.token||this.defaultMeteoToken,key:"tropicals"},responseType:/\.(jpg|png)$/.test(m.tropicals)?"blob":"json"}).then(d=>{var y,p,h,f;const g=P.TropicalHelper.convert2Geojson(((y=d==null?void 0:d.data)==null?void 0:y.data)||(d==null?void 0:d.data));((h=(p=d==null?void 0:d.config)==null?void 0:p.headers)==null?void 0:h.key)&&g&&(this.tropicals={data:g,list:(f=d.data)==null?void 0:f.data,active:!0,cached:!0,type:"json",etime:c.data.etime,version:Math.random()+1})}).catch(d=>{console.log(`tropicals fetch layer error: ${d}`)})}a=new Date().valueOf()-(t+e),console.log("tropicals elapsed: ",a,", total: ",e+=a)}},handleRefresh(){var e,a;(((a=(e=this.tropicals)==null?void 0:e.data)==null?void 0:a.features)||[]).forEach(r=>{var l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C;let i="";switch(!0){case(((l=r.properties.wind)==null?void 0:l.kts)<32||((n=r.properties)==null?void 0:n.kts)<32):i="td";break;case(((s=r.properties.wind)==null?void 0:s.kts)<47||((c=r.properties)==null?void 0:c.kts)<47):i="ts";break;case(((m=r.properties.wind)==null?void 0:m.kts)<63||((d=r.properties)==null?void 0:d.kts)<63):i="sts";break;case(((g=r.properties.wind)==null?void 0:g.kts)<79||((u=r.properties)==null?void 0:u.kts)<79):i="ty";break;case(((y=r.properties.wind)==null?void 0:y.kts)<94||((p=r.properties)==null?void 0:p.kts)<94):i="sty";break;case(((h=r.properties.wind)==null?void 0:h.kts)>=94||((f=r.properties)==null?void 0:f.kts)>=94):i="superTy";break;default:i="superTy";break}r.properties.levelI18n=i,((x=r.geometry)==null?void 0:x.type)==="Point"&&((v=r.properties)!=null&&v.important)&&(r.properties.format=(k=(b=_(r.properties.date))==null?void 0:b.utcOffset(this.timeZone))==null?void 0:k.format(`MMM-DD/HHmm [(utc${this.computeTimezone})]`)),((A=r.geometry)==null?void 0:A.type)==="Point"&&(r.properties.Name=((C=(L=r.properties.name)==null?void 0:L.trim())==null?void 0:C.replace(/^./,z=>z.toUpperCase()))||r.properties.nameCn,r.properties.nameCn=r.properties.nameCn||r.properties.Name||"-")}),this.handleInit()},handleInit(){var t,e,a,r,i,l,n,s,c,m,d,g;this.handleClear(),this.tropicals&&this.map&&(this.handleRender(),(t=this.map)==null||t.on("click",this.clickLayers,this.handleClick),(e=this.map)==null||e.on("mousemove",this.hoverLayers,this.handleHover),(a=this.map)==null||a.on("mouseleave",this.hoverLayers,this.handleLeave)),((l=(i=(r=this.tropicals)==null?void 0:r.data)==null?void 0:i.features)==null?void 0:l.length)>0?(c=(s=(n=this.$parent)==null?void 0:n.$refs)==null?void 0:s.idmBottomBar)==null||c.handleToggle("tropical",!0):(g=(d=(m=this.$parent)==null?void 0:m.$refs)==null?void 0:d.idmBottomBar)==null||g.handleToggle("tropical",!1)},handleRender(){var t,e,a,r,i,l,n,s,c,m;if(this.tropicals&&this.map){const d=new Date().valueOf();let g=0,u=0;(t=this.map)!=null&&t.getSource(this.source)?((a=this.map)==null||a.getSource(this.source).setData((e=this.tropicals)!=null&&e.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g)):(this.map.addSource(this.source,{type:"geojson",data:(r=this.tropicals)!=null&&r.active?(i=this.tropicals)==null?void 0:i.data:this.empty}),this.map.addLayer({id:this.historyLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","history"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["on-surface"],"line-width":3,"line-opacity":.7}},this.beforeLayer),this.map.addLayer({id:this.forecastLayer,type:"line",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"line-width":2,"line-opacity":1,"line-dasharray":[1,2]}},this.beforeLayer),this.map.addLayer({id:this.forecastModelLayer,type:"symbol",source:this.source,filter:["all",["==","$type","LineString"],["==","type","forecast"],["!=","disabled",!0]],layout:{"symbol-placement":"line","text-field":"{model}","text-rotation-alignment":"viewport","text-size":12},paint:{"text-color":this.Theme.current.value.dark?"#333":"#fff","text-opacity":1,"text-halo-color":["match",["get","model"],"cma",this.Theme.current.value.colors["tropicals-cma"],"jma",this.Theme.current.value.colors["tropicals-jma"],"ecmwf",this.Theme.current.value.colors["tropicals-ecmwf"],"ukm",this.Theme.current.value.colors["tropicals-ukm"],"noaa-at",this.Theme.current.value.colors["tropicals-noaa-at"],"noaa-ep",this.Theme.current.value.colors["tropicals-noaa-ep"],this.Theme.current.value.colors["tropicals-noaa-other"]],"text-halo-width":4}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u)),(l=this.map)!=null&&l.getSource(this.clusterSource)?((s=this.map)==null||s.getSource(this.clusterSource).setData((n=this.tropicals)!=null&&n.active?this.tropicals.data:this.empty),u=new Date().valueOf()-(d+g),console.log("[tropical] update elapsed: ",u,", total: ",g+=u)):(this.map.addSource(this.clusterSource,{type:"geojson",data:(c=this.tropicals)!=null&&c.active?(m=this.tropicals)==null?void 0:m.data:this.empty}),this.map.addLayer({id:this.pointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.pointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],paint:{"circle-radius":4,"circle-color":["case",["boolean",["==",["get","kts",["get","wind"]],null]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],32]],this.Theme.current.value.colors["tropicals-td"],["boolean",["<",["get","kts",["get","wind"]],47]],this.Theme.current.value.colors["tropicals-ts"],["boolean",["<",["get","kts",["get","wind"]],63]],this.Theme.current.value.colors["tropicals-sts"],["boolean",["<",["get","kts",["get","wind"]],79]],this.Theme.current.value.colors["tropicals-ty"],["boolean",["<",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-sty"],["boolean",[">=",["get","kts",["get","wind"]],94]],this.Theme.current.value.colors["tropicals-super-ty"],"#fff"]}},this.beforeLayer),this.map.addLayer({id:this.pointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","forecast"],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-border",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":6,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer,type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":5,"circle-color":"rgba(0,0,0,0.7)"}},this.beforeLayer),this.map.addLayer({id:this.historyPointCircleLayer+"-inner",type:"circle",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],paint:{"circle-radius":3,"circle-color":"#fff"}},this.beforeLayer),this.map.addLayer({id:this.historyPointLabelLayer,type:"symbol",source:this.clusterSource,minzoom:5,filter:["all",["==","$type","Point"],["==","type","history"],["==","important",!0],["!=","disabled",!0]],layout:{"text-field":["get","format"],"text-offset":[1,0],"text-anchor":"left","text-size":10},paint:{"text-color":this.Theme.current.value.colors["on-surface"]}},this.beforeLayer),this.map.addLayer({id:this.forecastNameLayer,type:"symbol",source:this.clusterSource,filter:["all",["==","$type","Point"],["==","type","forecast"],["==","important",!0]],layout:{"text-field":["get",this.locale==="en"?"Name":"nameCn"],"text-anchor":"bottom","text-size":16,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-font":["DIN Pro Regular","Arial Unicode MS Regular"],"text-offset":[0,2]},paint:{"text-color":this.Theme.current.value.colors["map-blue"],"text-halo-color":"#ffffff","text-halo-width":2}},this.beforeLayer),u=new Date().valueOf()-(d+g),console.log("[tropical] add elapsed: ",u,", total: ",g+=u));const y=P.TropicalHelper.interpolate(this.tropicals,1);this.interpolateData=JSON.parse(JSON.stringify(y)),this.handleDateChange()}},handleClear(){var t,e,a,r,i;this.map&&(this.map.getLayer(this.historyLayer)&&this.map.removeLayer(this.historyLayer),this.map.getLayer(this.forecastLayer)&&this.map.removeLayer(this.forecastLayer),this.map.getLayer(this.forecastModelLayer)&&this.map.removeLayer(this.forecastModelLayer),this.map.getLayer(this.forecastNameLayer)&&this.map.removeLayer(this.forecastNameLayer),this.map.getLayer(this.pointCircleLayer)&&this.map.removeLayer(this.pointCircleLayer),this.map.getLayer(this.pointCircleLayer+"-border")&&this.map.removeLayer(this.pointCircleLayer+"-border"),this.map.getLayer(this.pointLabelLayer)&&this.map.removeLayer(this.pointLabelLayer),this.map.getLayer(this.historyPointCircleLayer)&&this.map.removeLayer(this.historyPointCircleLayer),this.map.getLayer(this.historyPointCircleLayer+"-border")&&this.map.removeLayer(this.historyPointCircleLayer+"-border"),this.map.getLayer(this.historyPointCircleLayer+"-inner")&&this.map.removeLayer(this.historyPointCircleLayer+"-inner"),this.map.getLayer(this.historyPointLabelLayer)&&this.map.removeLayer(this.historyPointLabelLayer),this.map.getLayer(this.interpolateLineLayer)&&this.map.removeLayer(this.interpolateLineLayer),(t=this.interpolateMarkers)==null||t.forEach(l=>l==null?void 0:l.remove()),this.map.getSource(this.source)&&this.map.removeSource(this.source),this.map.getSource(this.clusterSource)&&this.map.removeSource(this.clusterSource),this.map.getSource(this.interpolateSource)&&this.map.removeSource(this.interpolateSource)),(e=this.map)==null||e.off("click",this.clickLayers,this.handleClick),(a=this.map)==null||a.off("mousemove",this.hoverLayers,this.handleHover),(r=this.map)==null||r.off("mouseleave",this.hoverLayers,this.handleLeave),(i=this.map)==null||i.off("render",this.handleUpdateMarkerVisibility),this.handleCloseInfoMarker()},handleUpdateMarkerVisibility(){const t=this.map;if(!t)return;const e=t.getCenter();for(const a of this.interpolateMarkers||[]){const r=a==null?void 0:a.getElement();if(!r)continue;const i=a.getLngLat(),n=E.distance(e.toArray(),[i.lng,i.lat],{units:"radians"})>=Math.PI/2?"hidden":"visible";r.style.visibility!==n&&(r.style.visibility=n)}},handleDateChange(){var t,e,a,r,i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z;if((t=this.interpolateMarkers)==null||t.forEach(H=>H==null?void 0:H.remove()),(e=this.interpolateData)!=null&&e.length&&this.tropicals.active){const H=_(this.realTime).utc().set({minute:0,second:0,millisecond:0}),te=this.interpolateData.filter(V=>V.properties.date===(H==null?void 0:H.format())&&!V.properties.disabled),W=this.handleComputePolygons(te),I=E.featureCollection([...te]);W.forEach(V=>{I.features.push(V)}),(a=this.map)!=null&&a.getSource(this.interpolateSource)?(r=this.map)==null||r.getSource(this.interpolateSource).setData(I):((i=this.map)==null||i.addSource(this.interpolateSource,{type:"geojson",data:I}),(l=this.map)==null||l.addLayer({id:this.interpolateLineLayer,type:"line",source:this.interpolateSource,filter:["all",["==","$type","Polygon"],["!=","disabled",!0]],paint:{"line-opacity":1,"line-color":["match",["get","level"],7,this.Theme.current.value.colors["tropicals-r7"],10,this.Theme.current.value.colors["tropicals-r10"],this.Theme.current.value.colors["tropicals-r10"]],"line-width":1}},"empty-layer-3")),this.interpolateMarkers=[];const K=[];for(const V of te)if(!V.properties.disabled){if(!K.some(re=>{var ue;return re.properties.name===((ue=V.properties)==null?void 0:ue.name)})){const re=((s=(n=this.tropicals.data.features.find(ue=>{var ye;return ue.properties.name===((ye=V.properties)==null?void 0:ye.name)}))==null?void 0:n.properties)==null?void 0:s.nameCn)||((c=V.properties)==null?void 0:c.Name)||"-";V.properties.nameCn=re,V.properties.Name=((d=(m=V.properties.name)==null?void 0:m.trim())==null?void 0:d.replace(/^./,ue=>ue.toUpperCase()))||V.properties.nameCn,K.push(V)}let Y=this.Theme.current.value.colors["tropicals-ty"];((u=(g=V.properties)==null?void 0:g.wind)==null?void 0:u.kts)<32||!((p=(y=V.properties)==null?void 0:y.wind)!=null&&p.kts)?Y=this.Theme.current.value.colors["tropicals-td"]:((f=(h=V.properties)==null?void 0:h.wind)==null?void 0:f.kts)>=32&&((v=(x=V.properties)==null?void 0:x.wind)==null?void 0:v.kts)<47?Y=this.Theme.current.value.colors["tropicals-ts"]:((k=(b=V.properties)==null?void 0:b.wind)==null?void 0:k.kts)>=47&&((L=(A=V.properties)==null?void 0:A.wind)==null?void 0:L.kts)<63?Y=this.Theme.current.value.colors["tropicals-sts"]:((z=(C=V.properties)==null?void 0:C.wind)==null?void 0:z.kts)>=63&&((T=(M=V.properties)==null?void 0:M.wind)==null?void 0:T.kts)<79?Y=this.Theme.current.value.colors["tropicals-ty"]:((F=(N=V.properties)==null?void 0:N.wind)==null?void 0:F.kts)>=79&&((q=(O=V.properties)==null?void 0:O.wind)==null?void 0:q.kts)<94?Y=this.Theme.current.value.colors["tropicals-sty"]:((le=($=V.properties)==null?void 0:$.wind)==null?void 0:le.kts)>=94?Y=this.Theme.current.value.colors["tropicals-super-ty"]:Y=this.Theme.current.value.colors["tropicals-ty"];const ee=`<svg t="1719918955501"
624
624
  class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" p-id="18382"
625
625
  xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
626
626
  <path
@@ -634,7 +634,7 @@ ${a==="fragment"?`out vec4 fragColor;
634
634
  <path
635
635
  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"
636
636
  fill="#ffffff" p-id="18386"></path>
637
- </svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${V.geometry.coordinates[1]>=0?"center north":"center south"}">${ee}</div>`;const ge=new pe.Marker(he).setLngLat(V.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ge)}this.$emit("tropicalCenterPoints",K)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((Z=this.map)==null||Z.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k;const e=t.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(A=>{var L;return A.geometry.type==="LineString"&&A.properties.type==="forecast"&&A.properties.name===((L=e==null?void 0:e.properties)==null?void 0:L.name)}),r=(s=(n=this.tropicals)==null?void 0:n.data)==null?void 0:s.features.filter(A=>{var L;return A.geometry.type==="LineString"&&A.properties.type==="history"&&A.properties.name===((L=e==null?void 0:e.properties)==null?void 0:L.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(A=>A.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle,checked:(x=(f=(h=this.tropicals)==null?void 0:h.list)==null?void 0:f.find(A=>{var L;return A.name===((L=e==null?void 0:e.properties)==null?void 0:L.name)}))==null?void 0:x.checked,tropicalId:(k=(b=(v=this.tropicals)==null?void 0:v.list)==null?void 0:b.find(A=>{var L;return A.name===((L=e==null?void 0:e.properties)==null?void 0:L.name)}))==null?void 0:k.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(E.featureCollection(a)),(c=(s=this.map)==null?void 0:s.getSource(this.clusterSource))==null||c.setData(E.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=E.lineArc(t,s,0,90,{steps:s>0?32:1,units:"nauticalmiles"});break;case"se":c=E.lineArc(t,s,90,180,{steps:s>0?32:1,units:"nauticalmiles"});break;case"sw":c=E.lineArc(t,s,180,270,{steps:s>0?32:1,units:"nauticalmiles"});break;case"nw":c=E.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=E.lineString(r);return E.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)})}}},Gd={class:"idm-tropical-gl4"},jd={class:"pb-1"},Wd={class:"text-h5 font-weight-600"},Zd={key:0,class:"text-h5 font-weight-600"},Hd={class:"text-body-1"},Xd={class:"text-label"},Od={class:"d-flex justify-space-between align-center"},Yd={class:"w-60"},Ud={class:"text-label pr-1"},Jd={class:"flex-1-1-0"},Kd={class:"text-label pr-1"},Qd={class:"py-2 d-flex justify-space-between align-center"},qd={class:"w-60"},$d={class:"text-label pr-1"},eh={class:"flex-1-1-0"},th={class:"text-label pr-1"},oh={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},ah={class:"text-label pr-1",style:{width:"70px"}},ih={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},rh={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},lh={class:"pa-1"},nh={class:"legend d-flex justify-start align-center py-2"},sh={class:"label"},ch={class:"legend d-flex justify-start align-center py-2"},mh={class:"label"},dh={class:"legend d-flex justify-start align-center py-2"},hh={class:"label"},ph={class:"pa-1"},uh={class:"legend d-flex justify-start align-center py-2"},gh={class:"label"},fh={class:"legend d-flex justify-start align-center py-2"},yh={class:"label"},bh={class:"legend d-flex justify-start align-center py-2"},wh={class:"label"},xh={class:"pa-1"},kh={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Ah={class:"label"},Lh={class:"label"},vh={class:"w-100 legend d-flex justify-start align-center py-2"},Ch={class:"label"},_h={class:"w-100 legend d-flex justify-start align-center py-2"},zh={class:"label"},Sh={key:1,class:"my-3 w-100",style:{height:"80px"}},Ph={class:"w-100 d-flex justify-space-between align-center"},Mh={class:"legend d-flex justify-start align-center"},Th={class:"label"},Nh={class:"legend d-flex justify-start align-center"},Eh={class:"label"},Vh={class:"legend d-flex justify-start align-center"},Rh={class:"label"},Dh={class:"legend d-flex justify-start align-center"},Bh={class:"label"},Ih={class:"legend d-flex justify-start align-center"},Fh={class:"label"},Gh={class:"legend d-flex justify-start align-center"},jh={class:"label"},Wh={class:"w-100 d-flex justify-space-between align-center"},Zh={class:"legend d-flex justify-start align-center"},Hh={class:"label"},Xh={class:"legend d-flex justify-start align-center"},Oh={class:"label"},Yh={class:"legend d-flex justify-start align-center"},Uh={class:"label"},Jh={class:"legend d-flex justify-start align-center"},Kh={class:"label"},Qh={class:"d-flex justify-star align-center"},qh={class:"font-weight-600 mr-1"},$h={class:""},ep={class:"d-flex flex-column justify-center align-start ga-2"},tp={key:0,class:"d-flex justify-start align-center"},op={class:"text-label pr-1"},ap={key:1,class:"d-flex justify-start align-center"},ip={class:"text-label pr-1"},rp={key:2,class:"d-flex justify-start align-center"},lp={class:"text-label pr-1"},np={key:3,class:"d-flex justify-start align-center"},sp={class:"text-label pr-1"},cp={key:4,class:"d-flex justify-start align-center"},mp={class:"text-label pr-1"},dp={key:5,class:"d-flex justify-start align-center"},hp={class:"text-label pr-1"},pp={class:"d-flex justify-start align-center"},up={class:"text-label pr-1"},gp={key:6,class:"d-flex justify-start align-center"},fp={class:"text-label pr-1"},yp={key:7,class:"d-flex justify-start align-center"},bp={class:"text-label pr-1"},wp={class:"d-flex justify-start align-center"},xp={class:"text-label pr-1"};function kp(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"),y=o.resolveComponent("VCardTitle");return o.openBlock(),o.createElementBlock("div",Gd,[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,f,x,v,b,k,A,L,C,z,M;return[o.createElementVNode("div",jd,[o.createElementVNode("span",Wd,o.toDisplayString(a.locale==="en"?(p=i.activeTropicals)==null?void 0:p.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((f=i.activeTropicals)==null?void 0:f.Name)||"-"),1),(v=(x=i.activeTropicals)==null?void 0:x.history)!=null&&v.levelI18n?(o.openBlock(),o.createElementBlock("span",Zd," , "+o.toDisplayString(t.$t("tropical."+((k=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:k.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",Hd,[o.createElementVNode("span",Xd,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((L=(A=i.activeTropicals)==null?void 0:A.history)==null?void 0:L.updated)||((M=(z=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:z.filter(T=>!T.disabled)[0])==null?void 0:M.date),a.timeZone)),1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var p,h,f,x,v,b,k,A,L;return[o.createElementVNode("div",Od,[o.createElementVNode("div",Yd,[o.createElementVNode("label",Ud,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(((x=(f=i.activeTropicals)==null?void 0:f.history)==null?void 0:x.kts)||"-")),1)]),o.createElementVNode("div",Jd,[o.createElementVNode("label",Kd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(v=i.activeTropicals)==null?void 0:v.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",Qd,[o.createElementVNode("div",qd,[o.createElementVNode("label",$d,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((k=l.computeMovement(i.activeTropicals))==null?void 0:k.kts)||"-")+" kts",1)]),o.createElementVNode("div",eh,[o.createElementVNode("label",th,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.deg)||"-")+"°",1)])]),o.createElementVNode("div",oh,[o.createElementVNode("label",ah,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",ih,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((L=i.activeTropicals)==null?void 0:L.forecasts,(C,z)=>(o.openBlock(),o.createBlock(n,{key:z,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(M=>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",rh,[o.createElementVNode("div",lh,[o.createElementVNode("div",nh,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",sh,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",ch,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",mh,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",dh,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",hh,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",ph,[o.createElementVNode("div",uh,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",gh,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",fh,[e[12]||(e[12]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",yh,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",bh,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",wh,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",xh,[o.createElementVNode("div",kh,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",Ah,o.toDisplayString(t.$t("tropical.history")),1),e[15]||(e[15]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",Lh,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",vh,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Ch,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",_h,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",zh,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",Sh,[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(["w-100 d-flex flex-column justify-space-between align-center",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",Ph,[o.createElementVNode("div",Mh,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Th,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",Eh,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",Vh,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Rh,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",Bh,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",Ih,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",Fh,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",Gh,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",jh,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",Wh,[o.createElementVNode("div",Zh,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",Hh,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",Oh,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Yh,[e[26]||(e[26]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Uh,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",Jh,[e[27]||(e[27]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Kh,"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(y,null,{default:o.withCtx(()=>{var p,h,f,x;return[o.createElementVNode("div",Qh,[o.createElementVNode("span",qh,o.toDisplayString(a.locale==="en"?(p=i.hoverPoint)==null?void 0:p.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((f=i.hoverPoint)==null?void 0:f.Name)),1),o.createElementVNode("span",$h," ["+o.toDisplayString(t.$t("tropical."+((x=i.hoverPoint)==null?void 0:x.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1"},{default:o.withCtx(()=>{var p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S;return[o.createElementVNode("div",ep,[((p=i.hoverPoint)==null?void 0:p.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",tp,[o.createElementVNode("label",op,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),((f=i.hoverPoint)==null?void 0:f.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",ap,[o.createElementVNode("label",ip,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((x=i.hoverPoint)==null?void 0:x.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((v=i.hoverPoint)==null?void 0:v.type)==="history"?(o.openBlock(),o.createElementBlock("div",rp,[o.createElementVNode("label",lp,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),((k=i.hoverPoint)==null?void 0:k.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",np,[o.createElementVNode("label",sp,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((A=i.hoverPoint)==null?void 0:A.model)??"-"),1)])):o.createCommentVNode("",!0),((L=i.hoverPoint)==null?void 0:L.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",cp,[o.createElementVNode("label",mp,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((z=JSON.parse(((C=i.hoverPoint)==null?void 0:C.wind)||"{}"))==null?void 0:z.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((M=i.hoverPoint)==null?void 0:M.type)==="history"?(o.openBlock(),o.createElementBlock("div",dp,[o.createElementVNode("label",hp,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",pp,[o.createElementVNode("label",up,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((N=i.hoverPoint)==null?void 0:N.pressure)??"-")+" hPa",1)]),((F=i.hoverPoint)==null?void 0:F.type)==="history"?(o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("label",fp,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((q=JSON.parse(((O=i.hoverPoint)==null?void 0:O.movement)||"{}"))==null?void 0:q.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),(($=i.hoverPoint)==null?void 0:$.type)==="history"?(o.openBlock(),o.createElementBlock("div",yp,[o.createElementVNode("label",bp,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",wp,[o.createElementVNode("label",xp,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 ta=Q(Fd,[["render",kp]]),Zb="",Ap={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 _.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>_.tz(_(),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=_(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${_.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=`${_.tz(_().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=_(t).utc().date(),a=Math.ceil(_(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=_(t))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=_.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${_.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${_.tz(_().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=_().utc().date(),e=Math.ceil(_().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=_())==null?void 0:i.utc().set({date:t,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=_.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=_())==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=_())==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||_.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?_.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):_.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=_(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${e}`,r=_.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=_.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)}}},Lp={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},vp={class:"pa-0",style:{width:"320px"}},Cp={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},_p={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function zp(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"),y=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",Lp,[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",vp,[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",Cp,[o.createElementVNode("div",_p,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,f)=>(o.openBlock(),o.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:o.withCtx(()=>[o.createVNode(c,{class:"text-body-2 font-weight-600 text-center",onClick:x=>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(y,{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 bo=Q(Ap,[["render",zp]]),Hb="",Sp={name:"IdmPoint",components:{DateTimePicker:bo},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 _.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>_.tz(_(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>_.tz(_(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=>_.tz(_(),n).utcOffset()===e*60))==null?void 0:l[0];return t?_.tz(_(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=_();((a=_(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}=$t.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:_(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}=$t.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:_(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,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z,H,te,W,I,K,V,Y,ee,he,ge;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=$t.Meteo2Assist.pickHourly(t,_(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=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((v=(x=e==null?void 0:e.weather)==null?void 0:x.wind)==null?void 0:v.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((k=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:k.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((L=(A=e==null?void 0:e.wave)==null?void 0:A.sig)==null?void 0:L.height,1)??"-",this.currentHourData.sigwaveDir=(z=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(M=e==null?void 0:e.wave)==null?void 0:M.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((F=(N=e==null?void 0:e.wave)==null?void 0:N.wd)==null?void 0:F.height,1)??"-",this.currentHourData.windwaveDir=(q=(O=e==null?void 0:e.wave)==null?void 0:O.wd)==null?void 0:q.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((le=($=e==null?void 0:e.wave)==null?void 0:$.wd)==null?void 0:le.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((Z=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:Z.height,1)??"-",this.currentHourData.swellDir=(te=(H=e==null?void 0:e.wave)==null?void 0:H.swell)==null?void 0:te.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((I=(W=e==null?void 0:e.wave)==null?void 0:W.swell)==null?void 0:I.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((K=e==null?void 0:e.current)==null?void 0:K.speed,1)??"-",this.currentHourData.currentDir=(V=e==null?void 0:e.current)==null?void 0:V.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((Y=e==null?void 0:e.current)==null?void 0:Y.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=(ee=e==null?void 0:e.weather)==null?void 0:ee.url,this.currentHourData.sit=(he=e==null?void 0:e.ice)==null?void 0:he.sit,this.currentHourData.sic=this.computeRoundPrecision(((ge=e==null?void 0:e.ice)==null?void 0:ge.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)}}},Pp={class:"idm-gl4-spot"},Mp={class:"d-flex justify-start align-center"},Tp={class:"text-h6 font-weight-600"},Np={class:"d-flex justify-start align-center ga-1 mb-2"},Ep={class:"text-label"},Vp={class:"w-100 d-flex ma-0"},Rp={class:"w-30 pa-0 d-flex"},Dp={class:"flex-1-1-0 pa-0 d-flex"},Bp={class:"pa-0"},Ip={class:"d-flex justify-start align-center ga-1 mb-2"},Fp={class:"text-label"},Gp={class:"w-100 d-flex ma-0"},jp={class:"w-30 pa-0 d-flex"},Wp={class:"flex-1-1-0 pa-0 d-flex"},Zp={class:"pa-0"},Hp={class:"d-flex justify-start align-center ga-1 mb-2"},Xp={class:"text-label"},Op={class:"d-flex justify-start align-center ga-1 mb-2"},Yp={class:"text-label"},Up={class:"d-flex justify-start align-center"},Jp={class:"mx-2"},Kp={class:"mx-0 py-2 d-flex align-center justify-start"},Qp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},qp={class:"pa-0 px-0"},$p={class:"mx-0 py-2 d-flex align-center justify-start"},eu={cols:"9",class:"pa-0 px-0"},tu={class:"mx-0 py-2 d-flex align-center justify-start"},ou={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},au={style:{width:"150px"},class:"pa-0 text-left"},iu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},ru={cols:"3",class:"pa-0 px-0 text-left"},lu={class:"mx-0 py-2 d-flex align-center justify-start"},nu={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},su={style:{width:"150px"},class:"pa-0 text-left"},cu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},mu={cols:"3",class:"pa-0 text-left"},du={class:"mx-0 py-2 d-flex align-center justify-start"},hu={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},pu={style:{width:"150px"},class:"pa-0 text-left"},uu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},gu={class:"pa-0 text-left"},fu={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},yu={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},bu={style:{width:"150px"},class:"pa-0 text-left"},wu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},xu={class:"pa-0 text-left"},ku={class:"d-flex justify-space-between align-center"},Au={class:"d-flex justify-start align-center"},Lu={class:"mx-1"},vu={class:"d-flex justify-end align-center"},Cu={class:"mx-0 py-1 d-flex align-center justify-start"},_u={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},zu={class:"pa-0 px-0"},Su={class:"mx-0 py-1 d-flex align-center justify-start"},Pu={class:"pa-0 px-0"},Mu={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},Tu={class:"d-flex flex-column align-start justify-center ga-3"},Nu={class:"text-label pr-2"},Eu={class:"text-label pr-2"},Vu={class:"text-label pr-2"},Ru={key:0},Du={class:"text-label pr-2"},Bu={class:"d-flex flex-column align-start justify-center ga-3"},Iu={class:"text-label pr-2"},Fu={class:"text-label pr-2"},Gu={class:"text-label pr-2"},ju={key:0},Wu={class:"text-label pr-2"},Zu={id:"idm-position-icon"},Hu={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},Xu=["xlink:href"];function Ou(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"),y=o.resolveComponent("VRow"),p=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),f=o.resolveComponent("VCardActions"),x=o.resolveComponent("VForm"),v=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",Pp,[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(v,{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",Mp,[o.createElementVNode("div",Tp,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(x,{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",Ep,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",Vp,[o.createElementVNode("div",Rp,[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",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[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",Ip,[o.createElementVNode("div",Fp,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",Gp,[o.createElementVNode("div",jp,[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",Wp,[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",Zp,[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",Hp,[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(y,{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",Op,[o.createElementVNode("div",Yp,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(y,{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(f,{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(v,{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",Up,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Jp,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,k;return[o.createElementVNode("div",Kp,[o.createElementVNode("div",Qp,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",qp,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",$p,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",eu,o.toDisplayString(l.computedLocalTime((k=i.currentHourData)==null?void 0:k.utc)),1)]),o.createElementVNode("div",tu,[o.createElementVNode("div",ou,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",au,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",iu,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",ru,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),o.createElementVNode("div",lu,[o.createElementVNode("div",nu,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",su,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),o.createElementVNode("div",cu,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",mu,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),o.createElementVNode("div",du,[o.createElementVNode("div",hu,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",pu,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",uu,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",gu,o.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",fu,[o.createElementVNode("div",yu,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("div",bu,o.toDisplayString(i.currentHourData.sit??"-")+"m",1),o.createElementVNode("div",wu,o.toDisplayString(t.$t("weather.sic")),1),o.createElementVNode("div",xu,o.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):o.createCommentVNode("",!0)]}),_:1}),o.createVNode(m),o.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(k=>{var A,L;return(k==null?void 0:k.id)===i.form.followId||((A=k==null?void 0:k.coordinate)==null?void 0:A.lng)===i.form.lng&&((L=k==null?void 0:k.coordinate)==null?void 0:L.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(v,{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",ku,[o.createElementVNode("div",Au,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Lu,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",vu,[(b=a.followList)!=null&&b.some(k=>{var A,L;return(k==null?void 0:k.id)===i.form.followId||((A=k==null?void 0:k.coordinate)==null?void 0:A.lng)===i.form.lng&&((L=k==null?void 0:k.coordinate)==null?void 0:L.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,k;return[o.createElementVNode("div",Cu,[o.createElementVNode("div",_u,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",zu,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Su,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Pu,o.toDisplayString(l.computedLocalTime((k=i.currentHourData)==null?void 0:k.utc)),1)]),o.createElementVNode("div",Mu,[o.createElementVNode("div",Tu,[o.createElementVNode("div",null,[o.createElementVNode("span",Nu,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",Eu,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",Vu,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",Ru,[o.createElementVNode("span",Du,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",Bu,[o.createElementVNode("div",null,[o.createElementVNode("span",Iu,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",Fu,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",Gu,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",ju,[o.createElementVNode("span",Wu,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",Zu,[(o.openBlock(),o.createElementBlock("svg",Hu,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,Xu)]))],512),[[o.vShow,i.showMeteo]])])}const Yu=Q(Sp,[["render",Ou]]),Xb="",Uu={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&&(this.map.getCanvas().style.cursor="grab");let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var 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(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var x;return((x=f._element)==null?void 0:x.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((f,x)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=x;return}});const h=u.features.filter(f=>f.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 f;return((f=h._element)==null?void 0:f.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=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(c)),c.features=c.features.filter(d=>d.geometry.type==="Point");const m=E.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 y=E.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=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=E.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=E.lineString(g.map(y=>[y.lng,y.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=E.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let 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=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(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,y,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(f=>{f==null||f.remove()}),this.pointMarkers[t.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},Ju={class:"idm-gl4-measure"};function Ku(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",Ju,[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 Qu=Q(Uu,[["render",Ku]]),Ob="",qu={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=E.featureCollection([t,...this.drawCoords.map(r=>E.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new 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(E.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=E.point([a,r]),l=E.lineString(this.drawCoords),n=E.nearestPointOnLine(l,i);if(n){const s=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(s+1,0,[a,r]),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",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=E.point([i,l]),s=E.lineString([...this.drawCoords,this.drawCoords[0]]),c=E.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=E.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(t,e){const a=P.GeoJsonHelper.drawLine([t,e]),r=E.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng: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=`
637
+ </svg>`,he=document.createElement("div");he.className="idm-tropical-gl4-hourly-marker",he.innerHTML=`<div class="${V.geometry.coordinates[1]>=0?"center north":"center south"}">${ee}</div>`;const ge=new pe.Marker(he).setLngLat(V.geometry.coordinates).addTo(this.map);this.interpolateMarkers.push(ge)}this.handleUpdateMarkerVisibility(),this.$emit("tropicalCenterPoints",K)}else(S=this.map)!=null&&S.getSource(this.interpolateSource)&&((Z=this.map)==null||Z.getSource(this.interpolateSource).setData(this.empty))},handleClick(t){var i,l,n,s,c,m,d,g,u,y,p,h,f,x,v,b,k;const e=t.features[0],a=(l=(i=this.tropicals)==null?void 0:i.data)==null?void 0:l.features.filter(A=>{var L;return A.geometry.type==="LineString"&&A.properties.type==="forecast"&&A.properties.name===((L=e==null?void 0:e.properties)==null?void 0:L.name)}),r=(s=(n=this.tropicals)==null?void 0:n.data)==null?void 0:s.features.filter(A=>{var L;return A.geometry.type==="LineString"&&A.properties.type==="history"&&A.properties.name===((L=e==null?void 0:e.properties)==null?void 0:L.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(A=>A.properties),history:(u=r[0])==null?void 0:u.properties,showCircle:(p=(y=a[0])==null?void 0:y.properties)==null?void 0:p.showCircle,checked:(x=(f=(h=this.tropicals)==null?void 0:h.list)==null?void 0:f.find(A=>{var L;return A.name===((L=e==null?void 0:e.properties)==null?void 0:L.name)}))==null?void 0:x.checked,tropicalId:(k=(b=(v=this.tropicals)==null?void 0:v.list)==null?void 0:b.find(A=>{var L;return A.name===((L=e==null?void 0:e.properties)==null?void 0:L.name)}))==null?void 0:k.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(E.featureCollection(a)),(c=(s=this.map)==null?void 0:s.getSource(this.clusterSource))==null||c.setData(E.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=E.lineArc(t,s,0,90,{steps:s>0?32:1,units:"nauticalmiles"});break;case"se":c=E.lineArc(t,s,90,180,{steps:s>0?32:1,units:"nauticalmiles"});break;case"sw":c=E.lineArc(t,s,180,270,{steps:s>0?32:1,units:"nauticalmiles"});break;case"nw":c=E.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=E.lineString(r);return E.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)})}}},Gd={class:"idm-tropical-gl4"},jd={class:"pb-1"},Wd={class:"text-h5 font-weight-600"},Zd={key:0,class:"text-h5 font-weight-600"},Hd={class:"text-body-1"},Xd={class:"text-label"},Od={class:"d-flex justify-space-between align-center"},Yd={class:"w-60"},Ud={class:"text-label pr-1"},Jd={class:"flex-1-1-0"},Kd={class:"text-label pr-1"},Qd={class:"py-2 d-flex justify-space-between align-center"},qd={class:"w-60"},$d={class:"text-label pr-1"},eh={class:"flex-1-1-0"},th={class:"text-label pr-1"},oh={class:"d-flex align-center flex-1-1-100 justify-start mt-n1"},ah={class:"text-label pr-1",style:{width:"70px"}},ih={class:"model-box d-flex justify-end align-center flex-wrap ga-1 pa-1"},rh={key:0,class:"w-100 d-flex justify-space-between align-center px-2"},lh={class:"pa-1"},nh={class:"legend d-flex justify-start align-center py-2"},sh={class:"label"},ch={class:"legend d-flex justify-start align-center py-2"},mh={class:"label"},dh={class:"legend d-flex justify-start align-center py-2"},hh={class:"label"},ph={class:"pa-1"},uh={class:"legend d-flex justify-start align-center py-2"},gh={class:"label"},fh={class:"legend d-flex justify-start align-center py-2"},yh={class:"label"},bh={class:"legend d-flex justify-start align-center py-2"},wh={class:"label"},xh={class:"pa-1"},kh={class:"w-100 legend d-flex justify-start align-center py-2 ga-2"},Ah={class:"label"},Lh={class:"label"},vh={class:"w-100 legend d-flex justify-start align-center py-2"},Ch={class:"label"},_h={class:"w-100 legend d-flex justify-start align-center py-2"},zh={class:"label"},Sh={key:1,class:"my-3 w-100",style:{height:"80px"}},Ph={class:"w-100 d-flex justify-space-between align-center"},Mh={class:"legend d-flex justify-start align-center"},Th={class:"label"},Nh={class:"legend d-flex justify-start align-center"},Eh={class:"label"},Vh={class:"legend d-flex justify-start align-center"},Rh={class:"label"},Dh={class:"legend d-flex justify-start align-center"},Bh={class:"label"},Ih={class:"legend d-flex justify-start align-center"},Fh={class:"label"},Gh={class:"legend d-flex justify-start align-center"},jh={class:"label"},Wh={class:"w-100 d-flex justify-space-between align-center"},Zh={class:"legend d-flex justify-start align-center"},Hh={class:"label"},Xh={class:"legend d-flex justify-start align-center"},Oh={class:"label"},Yh={class:"legend d-flex justify-start align-center"},Uh={class:"label"},Jh={class:"legend d-flex justify-start align-center"},Kh={class:"label"},Qh={class:"d-flex justify-star align-center"},qh={class:"font-weight-600 mr-1"},$h={class:""},ep={class:"d-flex flex-column justify-center align-start ga-2"},tp={key:0,class:"d-flex justify-start align-center"},op={class:"text-label pr-1"},ap={key:1,class:"d-flex justify-start align-center"},ip={class:"text-label pr-1"},rp={key:2,class:"d-flex justify-start align-center"},lp={class:"text-label pr-1"},np={key:3,class:"d-flex justify-start align-center"},sp={class:"text-label pr-1"},cp={key:4,class:"d-flex justify-start align-center"},mp={class:"text-label pr-1"},dp={key:5,class:"d-flex justify-start align-center"},hp={class:"text-label pr-1"},pp={class:"d-flex justify-start align-center"},up={class:"text-label pr-1"},gp={key:6,class:"d-flex justify-start align-center"},fp={class:"text-label pr-1"},yp={key:7,class:"d-flex justify-start align-center"},bp={class:"text-label pr-1"},wp={class:"d-flex justify-start align-center"},xp={class:"text-label pr-1"};function kp(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"),y=o.resolveComponent("VCardTitle");return o.openBlock(),o.createElementBlock("div",Gd,[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,f,x,v,b,k,A,L,C,z,M;return[o.createElementVNode("div",jd,[o.createElementVNode("span",Wd,o.toDisplayString(a.locale==="en"?(p=i.activeTropicals)==null?void 0:p.Name:((h=i.activeTropicals)==null?void 0:h.nameCn)||((f=i.activeTropicals)==null?void 0:f.Name)||"-"),1),(v=(x=i.activeTropicals)==null?void 0:x.history)!=null&&v.levelI18n?(o.openBlock(),o.createElementBlock("span",Zd," , "+o.toDisplayString(t.$t("tropical."+((k=(b=i.activeTropicals)==null?void 0:b.history)==null?void 0:k.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",Hd,[o.createElementVNode("span",Xd,o.toDisplayString(t.$t("actions.lastUpdate"))+": ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTime(((L=(A=i.activeTropicals)==null?void 0:A.history)==null?void 0:L.updated)||((M=(z=(C=i.activeTropicals)==null?void 0:C.forecasts)==null?void 0:z.filter(T=>!T.disabled)[0])==null?void 0:M.date),a.timeZone)),1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1 py-3"},{default:o.withCtx(()=>{var p,h,f,x,v,b,k,A,L;return[o.createElementVNode("div",Od,[o.createElementVNode("div",Yd,[o.createElementVNode("label",Ud,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(((x=(f=i.activeTropicals)==null?void 0:f.history)==null?void 0:x.kts)||"-")),1)]),o.createElementVNode("div",Jd,[o.createElementVNode("label",Kd,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((b=(v=i.activeTropicals)==null?void 0:v.history)==null?void 0:b.pressure)||"-")+" hPa",1)])]),o.createElementVNode("div",Qd,[o.createElementVNode("div",qd,[o.createElementVNode("label",$d,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((k=l.computeMovement(i.activeTropicals))==null?void 0:k.kts)||"-")+" kts",1)]),o.createElementVNode("div",eh,[o.createElementVNode("label",th,o.toDisplayString(t.$t("tropical.moveDir"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((A=l.computeMovement(i.activeTropicals))==null?void 0:A.deg)||"-")+"°",1)])]),o.createElementVNode("div",oh,[o.createElementVNode("label",ah,o.toDisplayString(t.$t("tropical.models"))+" : ",1),o.createElementVNode("div",ih,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList((L=i.activeTropicals)==null?void 0:L.forecasts,(C,z)=>(o.openBlock(),o.createBlock(n,{key:z,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(M=>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",rh,[o.createElementVNode("div",lh,[o.createElementVNode("div",nh,[e[8]||(e[8]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",sh,o.toDisplayString(t.$t("tropical.td")),1)]),o.createElementVNode("div",ch,[e[9]||(e[9]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",mh,o.toDisplayString(t.$t("tropical.sts")),1)]),o.createElementVNode("div",dh,[e[10]||(e[10]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",hh,o.toDisplayString(t.$t("tropical.sty")),1)])]),o.createElementVNode("div",ph,[o.createElementVNode("div",uh,[e[11]||(e[11]=o.createElementVNode("div",{class:"icon ts"},null,-1)),o.createElementVNode("div",gh,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",fh,[e[12]||(e[12]=o.createElementVNode("div",{class:"icon ty"},null,-1)),o.createElementVNode("div",yh,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",bh,[e[13]||(e[13]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",wh,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",xh,[o.createElementVNode("div",kh,[e[14]||(e[14]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",Ah,o.toDisplayString(t.$t("tropical.history")),1),e[15]||(e[15]=o.createElementVNode("div",{class:"icon forecast"},null,-1)),o.createElementVNode("div",Lh,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",vh,[e[16]||(e[16]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Ch,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",_h,[e[17]||(e[17]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",zh,"50kts "+o.toDisplayString(t.$t("tropical.radii")),1)])])])):(o.openBlock(),o.createElementBlock("div",Sh,[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(["w-100 d-flex flex-column justify-space-between align-center",a.locale==="zhHans"?" ga-2":" ga-3"])},[o.createElementVNode("div",Ph,[o.createElementVNode("div",Mh,[e[18]||(e[18]=o.createElementVNode("div",{class:"icon td"},null,-1)),o.createElementVNode("div",Th,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",Eh,o.toDisplayString(t.$t("tropical.ts")),1)]),o.createElementVNode("div",Vh,[e[20]||(e[20]=o.createElementVNode("div",{class:"icon sts"},null,-1)),o.createElementVNode("div",Rh,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",Bh,o.toDisplayString(t.$t("tropical.ty")),1)]),o.createElementVNode("div",Ih,[e[22]||(e[22]=o.createElementVNode("div",{class:"icon sty"},null,-1)),o.createElementVNode("div",Fh,o.toDisplayString(t.$t("tropical.sty")),1)]),o.createElementVNode("div",Gh,[e[23]||(e[23]=o.createElementVNode("div",{class:"icon supper-ty"},null,-1)),o.createElementVNode("div",jh,o.toDisplayString(t.$t("tropical.superTy")),1)])]),o.createElementVNode("div",Wh,[o.createElementVNode("div",Zh,[e[24]||(e[24]=o.createElementVNode("div",{class:"icon history"},null,-1)),o.createElementVNode("div",Hh,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",Oh,o.toDisplayString(t.$t("tropical.forecast")),1)]),o.createElementVNode("div",Yh,[e[26]||(e[26]=o.createElementVNode("div",{class:"icon r7"},null,-1)),o.createElementVNode("div",Uh,"35kts "+o.toDisplayString(t.$t("tropical.radii")),1)]),o.createElementVNode("div",Jh,[e[27]||(e[27]=o.createElementVNode("div",{class:"icon r10"},null,-1)),o.createElementVNode("div",Kh,"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(y,null,{default:o.withCtx(()=>{var p,h,f,x;return[o.createElementVNode("div",Qh,[o.createElementVNode("span",qh,o.toDisplayString(a.locale==="en"?(p=i.hoverPoint)==null?void 0:p.Name:((h=i.hoverPoint)==null?void 0:h.nameCn)||((f=i.hoverPoint)==null?void 0:f.Name)),1),o.createElementVNode("span",$h," ["+o.toDisplayString(t.$t("tropical."+((x=i.hoverPoint)==null?void 0:x.levelI18n)))+"]",1)])]}),_:1}),o.createVNode(m),o.createVNode(c,{class:"text-body-1"},{default:o.withCtx(()=>{var p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S;return[o.createElementVNode("div",ep,[((p=i.hoverPoint)==null?void 0:p.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",tp,[o.createElementVNode("label",op,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),((f=i.hoverPoint)==null?void 0:f.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",ap,[o.createElementVNode("label",ip,o.toDisplayString(t.$t("tropical.forecast"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(l.computeTzTime((x=i.hoverPoint)==null?void 0:x.date,a.timeZone)),1)])):o.createCommentVNode("",!0),((v=i.hoverPoint)==null?void 0:v.type)==="history"?(o.openBlock(),o.createElementBlock("div",rp,[o.createElementVNode("label",lp,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),((k=i.hoverPoint)==null?void 0:k.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",np,[o.createElementVNode("label",sp,o.toDisplayString(t.$t("tropical.model"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((A=i.hoverPoint)==null?void 0:A.model)??"-"),1)])):o.createCommentVNode("",!0),((L=i.hoverPoint)==null?void 0:L.type)==="forecast"?(o.openBlock(),o.createElementBlock("div",cp,[o.createElementVNode("label",mp,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((z=JSON.parse(((C=i.hoverPoint)==null?void 0:C.wind)||"{}"))==null?void 0:z.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),((M=i.hoverPoint)==null?void 0:M.type)==="history"?(o.openBlock(),o.createElementBlock("div",dp,[o.createElementVNode("label",hp,o.toDisplayString(t.$t("weather.wind"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((T=i.hoverPoint)==null?void 0:T.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),o.createElementVNode("div",pp,[o.createElementVNode("label",up,o.toDisplayString(t.$t("weather.pressure"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((N=i.hoverPoint)==null?void 0:N.pressure)??"-")+" hPa",1)]),((F=i.hoverPoint)==null?void 0:F.type)==="history"?(o.openBlock(),o.createElementBlock("div",gp,[o.createElementVNode("label",fp,o.toDisplayString(t.$t("tropical.moveSpeed"))+" : ",1),o.createElementVNode("span",null,o.toDisplayString(((q=JSON.parse(((O=i.hoverPoint)==null?void 0:O.movement)||"{}"))==null?void 0:q.kts)??"-")+" kts",1)])):o.createCommentVNode("",!0),(($=i.hoverPoint)==null?void 0:$.type)==="history"?(o.openBlock(),o.createElementBlock("div",yp,[o.createElementVNode("label",bp,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",wp,[o.createElementVNode("label",xp,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 ta=Q(Fd,[["render",kp]]),Zb="",Ap={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 _.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>_.tz(_(),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=_(this.currentTimestamp).utc().format("yyyy-MM-DD HH:00[Z]"),this.$emit("dateTime",this.currentDateTimeZ),this.$emit("currentTimestamp",this.currentTimestamp),this.currentDateTime=`${_.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=`${_.tz(_().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=_(t).utc().date(),a=Math.ceil(_(t).utc().hour()/this.intervalHour)*this.intervalHour;this.currentTimestamp=((i=_(t))==null?void 0:i.utc().set({date:e,hour:a,minute:0,second:0,millisecond:0}).unix())*1e3;const r=_.tz(this.currentTimestamp,this.timeZoneName).clone();this.currentDate=r.clone().format("YYYY-MM-DD"),this.currentTime=r.clone().format("HH:00"),this.currentDateTime=`${_.tz(this.currentTimestamp,this.timeZoneName).clone().format("yyyy-MM-DD : HH:00")}`,this.currentRealTime=`${_.tz(_().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=_().utc().date(),e=Math.ceil(_().utc().hour()/this.intervalHour)*this.intervalHour,a=((i=_())==null?void 0:i.utc().set({date:t,hour:e,minute:0,second:0,millisecond:0}).unix())*1e3,r=_.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=_())==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=_())==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||_.tz(this.currentTimestamp,this.timeZoneName).clone().month(),a=this.locale==="en"?_.tz(this.currentTimestamp,this.timeZoneName).set({month:e}).clone().format("MMM"):_.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=_(this.currentDate).format("yyyy-MM-DD"),e=this.currentTime,a=`${t} ${e}`,r=_.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=_.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)}}},Lp={ref:"idmGl4Timepicker",class:"idm-gl4-time-picker"},vp={class:"pa-0",style:{width:"320px"}},Cp={class:"h-100 pa-0 d-flex flex-column justify-start align-center",style:{width:"100px"}},_p={class:"d-flex justify-center align-center text-body-2",style:{height:"44px"}};function zp(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"),y=o.resolveComponent("VCardActions"),p=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",Lp,[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",vp,[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",Cp,[o.createElementVNode("div",_p,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,f)=>(o.openBlock(),o.createBlock(m,{key:f,value:h,color:"primary",active:i.currentTime===h,rounded:"",height:"26","min-height":"26",class:"rounded-xl",variant:i.currentTime===h?"flat":"text"},{default:o.withCtx(()=>[o.createVNode(c,{class:"text-body-2 font-weight-600 text-center",onClick:x=>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(y,{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 bo=Q(Ap,[["render",zp]]),Hb="",Sp={name:"IdmPoint",components:{DateTimePicker:bo},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 _.tz.names()},timeZoneName(){var t;return(t=this.timeZoneNames.filter(e=>_.tz(_(),e).utcOffset()===this.timeZone*60))==null?void 0:t[0]},computedTzTime(){return t=>_.tz(_(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=>_.tz(_(),n).utcOffset()===e*60))==null?void 0:l[0];return t?_.tz(_(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=_();((a=_(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}=$t.Meteo2Assist.autoPickMeteoModel(t.forecastModel);let r={lat:t.lat,lng:t.lng,datetime:_(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}=$t.Meteo2Assist.autoPickMeteoModel(t.forecastModel),r={lat:t.lat,lng:t.lng,datetime:_(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,y,p,h,f,x,v,b,k,A,L,C,z,M,T,N,F,O,q,$,le,S,Z,H,te,W,I,K,V,Y,ee,he,ge;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=$t.Meteo2Assist.pickHourly(t,_(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=(y=e==null?void 0:e.weather)==null?void 0:y.wind)==null?void 0:p.kts,1)??"-",this.currentHourData.windDir=((f=(h=e==null?void 0:e.weather)==null?void 0:h.wind)==null?void 0:f.direction)??"-",this.currentHourData.windLevel=this.computeRoundPrecision((v=(x=e==null?void 0:e.weather)==null?void 0:x.wind)==null?void 0:v.scale,0)??"-",this.currentHourData.windGust=this.computeRoundPrecision((k=(b=e==null?void 0:e.weather)==null?void 0:b.wind)==null?void 0:k.gusts,1)??"-",this.currentHourData.sigwaveHeight=this.computeRoundPrecision((L=(A=e==null?void 0:e.wave)==null?void 0:A.sig)==null?void 0:L.height,1)??"-",this.currentHourData.sigwaveDir=(z=(C=e==null?void 0:e.wave)==null?void 0:C.sig)==null?void 0:z.direction,this.currentHourData.sigwavePeriod=this.computeRoundPrecision((T=(M=e==null?void 0:e.wave)==null?void 0:M.sig)==null?void 0:T.period,1)??"-",this.currentHourData.windwaveHeight=this.computeRoundPrecision((F=(N=e==null?void 0:e.wave)==null?void 0:N.wd)==null?void 0:F.height,1)??"-",this.currentHourData.windwaveDir=(q=(O=e==null?void 0:e.wave)==null?void 0:O.wd)==null?void 0:q.direction,this.currentHourData.windwavePeriod=this.computeRoundPrecision((le=($=e==null?void 0:e.wave)==null?void 0:$.wd)==null?void 0:le.period,1)??"-",this.currentHourData.swellHeight=this.computeRoundPrecision((Z=(S=e==null?void 0:e.wave)==null?void 0:S.swell)==null?void 0:Z.height,1)??"-",this.currentHourData.swellDir=(te=(H=e==null?void 0:e.wave)==null?void 0:H.swell)==null?void 0:te.direction,this.currentHourData.swellPeriod=this.computeRoundPrecision((I=(W=e==null?void 0:e.wave)==null?void 0:W.swell)==null?void 0:I.period,1)??"-",this.currentHourData.currentSpeed=this.computeRoundPrecision((K=e==null?void 0:e.current)==null?void 0:K.speed,1)??"-",this.currentHourData.currentDir=(V=e==null?void 0:e.current)==null?void 0:V.direction,this.currentHourData.currentSpeed=this.computeRoundPrecision((Y=e==null?void 0:e.current)==null?void 0:Y.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=(ee=e==null?void 0:e.weather)==null?void 0:ee.url,this.currentHourData.sit=(he=e==null?void 0:e.ice)==null?void 0:he.sit,this.currentHourData.sic=this.computeRoundPrecision(((ge=e==null?void 0:e.ice)==null?void 0:ge.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)}}},Pp={class:"idm-gl4-spot"},Mp={class:"d-flex justify-start align-center"},Tp={class:"text-h6 font-weight-600"},Np={class:"d-flex justify-start align-center ga-1 mb-2"},Ep={class:"text-label"},Vp={class:"w-100 d-flex ma-0"},Rp={class:"w-30 pa-0 d-flex"},Dp={class:"flex-1-1-0 pa-0 d-flex"},Bp={class:"pa-0"},Ip={class:"d-flex justify-start align-center ga-1 mb-2"},Fp={class:"text-label"},Gp={class:"w-100 d-flex ma-0"},jp={class:"w-30 pa-0 d-flex"},Wp={class:"flex-1-1-0 pa-0 d-flex"},Zp={class:"pa-0"},Hp={class:"d-flex justify-start align-center ga-1 mb-2"},Xp={class:"text-label"},Op={class:"d-flex justify-start align-center ga-1 mb-2"},Yp={class:"text-label"},Up={class:"d-flex justify-start align-center"},Jp={class:"mx-2"},Kp={class:"mx-0 py-2 d-flex align-center justify-start"},Qp={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},qp={class:"pa-0 px-0"},$p={class:"mx-0 py-2 d-flex align-center justify-start"},eu={cols:"9",class:"pa-0 px-0"},tu={class:"mx-0 py-2 d-flex align-center justify-start"},ou={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},au={style:{width:"150px"},class:"pa-0 text-left"},iu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},ru={cols:"3",class:"pa-0 px-0 text-left"},lu={class:"mx-0 py-2 d-flex align-center justify-start"},nu={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},su={style:{width:"150px"},class:"pa-0 text-left"},cu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},mu={cols:"3",class:"pa-0 text-left"},du={class:"mx-0 py-2 d-flex align-center justify-start"},hu={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},pu={style:{width:"150px"},class:"pa-0 text-left"},uu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},gu={class:"pa-0 text-left"},fu={key:0,class:"mx-0 py-2 d-flex align-center justify-start"},yu={style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},bu={style:{width:"150px"},class:"pa-0 text-left"},wu={style:{width:"80px"},class:"pa-0 pr-2 text-right opacity-50"},xu={class:"pa-0 text-left"},ku={class:"d-flex justify-space-between align-center"},Au={class:"d-flex justify-start align-center"},Lu={class:"mx-1"},vu={class:"d-flex justify-end align-center"},Cu={class:"mx-0 py-1 d-flex align-center justify-start"},_u={style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},zu={class:"pa-0 px-0"},Su={class:"mx-0 py-1 d-flex align-center justify-start"},Pu={class:"pa-0 px-0"},Mu={class:"gray-bg-2 mx-4 my-2 py-3 px-2 rounded text-font-13 d-flex align-center justify-space-between"},Tu={class:"d-flex flex-column align-start justify-center ga-3"},Nu={class:"text-label pr-2"},Eu={class:"text-label pr-2"},Vu={class:"text-label pr-2"},Ru={key:0},Du={class:"text-label pr-2"},Bu={class:"d-flex flex-column align-start justify-center ga-3"},Iu={class:"text-label pr-2"},Fu={class:"text-label pr-2"},Gu={class:"text-label pr-2"},ju={key:0},Wu={class:"text-label pr-2"},Zu={id:"idm-position-icon"},Hu={class:"multi-color-icon",style:{height:"30px",width:"30px"},"aria-hidden":"true"},Xu=["xlink:href"];function Ou(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"),y=o.resolveComponent("VRow"),p=o.resolveComponent("VBtnToggle"),h=o.resolveComponent("VCardText"),f=o.resolveComponent("VCardActions"),x=o.resolveComponent("VForm"),v=o.resolveComponent("VCard");return o.openBlock(),o.createElementBlock("div",Pp,[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(v,{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",Mp,[o.createElementVNode("div",Tp,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(x,{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",Ep,[o.createTextVNode(o.toDisplayString(t.$t("spot.lat")),1),e[10]||(e[10]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",Vp,[o.createElementVNode("div",Rp,[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",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[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",Ip,[o.createElementVNode("div",Fp,[o.createTextVNode(o.toDisplayString(t.$t("spot.lng")),1),e[13]||(e[13]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createElementVNode("div",Gp,[o.createElementVNode("div",jp,[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",Wp,[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",Zp,[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",Hp,[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(y,{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",Op,[o.createElementVNode("div",Yp,[o.createTextVNode(o.toDisplayString(t.$t("weather.forecastModel")),1),e[17]||(e[17]=o.createElementVNode("span",{class:"text-danger"},"*",-1))])]),o.createVNode(y,{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(f,{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(v,{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",Up,[e[20]||(e[20]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Jp,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,k;return[o.createElementVNode("div",Kp,[o.createElementVNode("div",Qp,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",qp,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",$p,[e[22]||(e[22]=o.createElementVNode("div",{style:{width:"100px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",eu,o.toDisplayString(l.computedLocalTime((k=i.currentHourData)==null?void 0:k.utc)),1)]),o.createElementVNode("div",tu,[o.createElementVNode("div",ou,o.toDisplayString(t.$t("weather.wind")),1),o.createElementVNode("div",au,o.toDisplayString(i.currentHourData.windDir??"-")+"/"+o.toDisplayString(i.currentHourData.windSpeed??"-")+"kts/BF"+o.toDisplayString(i.currentHourData.windLevel??"-"),1),o.createElementVNode("div",iu,o.toDisplayString(t.$t("weather.sigWave")),1),o.createElementVNode("div",ru,o.toDisplayString(i.currentHourData.sigwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.sigwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.sigwavePeriod??"-")+"s ",1)]),o.createElementVNode("div",lu,[o.createElementVNode("div",nu,o.toDisplayString(t.$t("weather.windWave")),1),o.createElementVNode("div",su,o.toDisplayString(i.currentHourData.windwaveDir??"-")+"/"+o.toDisplayString(i.currentHourData.windwaveHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.windwavePeriod??"-")+"s ",1),o.createElementVNode("div",cu,o.toDisplayString(t.$t("weather.swell")),1),o.createElementVNode("div",mu,o.toDisplayString(i.currentHourData.swellDir??"-")+"/"+o.toDisplayString(i.currentHourData.swellHeight??"-")+"m/"+o.toDisplayString(i.currentHourData.swellPeriod??"-")+"s ",1)]),o.createElementVNode("div",du,[o.createElementVNode("div",hu,o.toDisplayString(t.$t("weather.current")),1),o.createElementVNode("div",pu,o.toDisplayString(i.currentHourData.currentDir??"-")+"/"+o.toDisplayString(i.currentHourData.currentSpeed??"-")+"kts",1),o.createElementVNode("div",uu,o.toDisplayString(t.$t("weather.visibility")),1),o.createElementVNode("div",gu,o.toDisplayString(i.currentHourData.visibility??"-")+"nm",1)]),i.currentHourData.showIce?(o.openBlock(),o.createElementBlock("div",fu,[o.createElementVNode("div",yu,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("div",bu,o.toDisplayString(i.currentHourData.sit??"-")+"m",1),o.createElementVNode("div",wu,o.toDisplayString(t.$t("weather.sic")),1),o.createElementVNode("div",xu,o.toDisplayString(i.currentHourData.sic??"-")+"%",1)])):o.createCommentVNode("",!0)]}),_:1}),o.createVNode(m),o.createVNode(f,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var b;return[(b=a.followList)!=null&&b.some(k=>{var A,L;return(k==null?void 0:k.id)===i.form.followId||((A=k==null?void 0:k.coordinate)==null?void 0:A.lng)===i.form.lng&&((L=k==null?void 0:k.coordinate)==null?void 0:L.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(v,{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",ku,[o.createElementVNode("div",Au,[e[25]||(e[25]=o.createElementVNode("i",{class:"iconfont icon-a-Spotweather text-h5 map-icon-aqua"},null,-1)),o.createElementVNode("div",Lu,o.toDisplayString(l.computePosition(i.form||i.currentHourData)),1)]),o.createElementVNode("div",vu,[(b=a.followList)!=null&&b.some(k=>{var A,L;return(k==null?void 0:k.id)===i.form.followId||((A=k==null?void 0:k.coordinate)==null?void 0:A.lng)===i.form.lng&&((L=k==null?void 0:k.coordinate)==null?void 0:L.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,k;return[o.createElementVNode("div",Cu,[o.createElementVNode("div",_u,o.toDisplayString(t.$t("time.time")),1),o.createElementVNode("div",zu,o.toDisplayString(l.computedTzTime((b=i.currentHourData)==null?void 0:b.utc)),1)]),o.createElementVNode("div",Su,[e[30]||(e[30]=o.createElementVNode("div",{style:{width:"60px"},class:"pa-0 pr-2 text-right opacity-50"},"LT",-1)),o.createElementVNode("div",Pu,o.toDisplayString(l.computedLocalTime((k=i.currentHourData)==null?void 0:k.utc)),1)]),o.createElementVNode("div",Mu,[o.createElementVNode("div",Tu,[o.createElementVNode("div",null,[o.createElementVNode("span",Nu,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",Eu,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",Vu,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",Ru,[o.createElementVNode("span",Du,o.toDisplayString(t.$t("weather.sit")),1),o.createElementVNode("span",null,o.toDisplayString(i.currentHourData.sit??"-")+"m",1)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",Bu,[o.createElementVNode("div",null,[o.createElementVNode("span",Iu,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",Fu,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",Gu,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",ju,[o.createElementVNode("span",Wu,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",Zu,[(o.openBlock(),o.createElementBlock("svg",Hu,[o.createElementVNode("use",{"xlink:href":`#icon-spot-${a.theme}`},null,8,Xu)]))],512),[[o.vShow,i.showMeteo]])])}const Yu=Q(Sp,[["render",Ou]]),Xb="",Uu={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&&(this.map.getCanvas().style.cursor="grab");let r=this.geojson.find(i=>!i.closed);r&&this.handleClear(r,!0),this.geojson=this.geojson.filter(i=>!!i.closed),r=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(r)}},immediate:!0},map:{handler(){this.map&&(this.toggle?this.handleBind():this.handleUnbind())}}},methods:{handleMenuToggle(){this.toggle=!this.toggle},handleBind(){var 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(f=>f.id===e.split("-")[0])[0];this.pointMarkers[u.id].filter(f=>{var x;return((x=f._element)==null?void 0:x.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((f,x)=>{if(f.geometry.type==="Point"&&f.properties.id===e.split("-")[1]){p=x;return}});const h=u.features.filter(f=>f.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 f;return((f=h._element)==null?void 0:f.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=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(c)),c.features=c.features.filter(d=>d.geometry.type==="Point");const m=E.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 y=E.lineString(u.map(h=>[h.lng,h.lat]));y.properties.dist=d,y.properties.bearing=g,y.properties.total=a,y.properties.name="Line "+this.currentLineIndex,r.push(y);const p=e[i];p.properties.totalDist=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=E.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=E.lineString(g.map(y=>[y.lng,y.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=E.lineString(g.map(y=>[y.lng,y.lat]));u.properties.dist=l,u.properties.bearing=n,i.features.push(u)}this.map.getSource(this.tmpSource)?this.map.getSource(this.tmpSource).setData(i):this.map.addSource(this.tmpSource,{type:"geojson",data:i}),this.map.getLayer(this.tmpLayer)||this.map.addLayer({id:this.tmpLayer,type:"line",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.Theme.current.value.colors["map-orange"],"line-width":2,"line-opacity":1,"line-dasharray":[3,2]}}),this.map.getLayer(this.tmpLabelLayer)||this.map.addLayer({id:this.tmpLabelLayer,type:"symbol",source:this.tmpSource,filter:["==","$type","LineString"],layout:{"symbol-placement":"line-center","text-field":"{dist}nm / {bearing}°","text-rotation-alignment":"map","text-size":11,"text-offset":[0,-1]},paint:{"text-opacity":1,"text-color":this.Theme.current.value.colors["on-surface"]}});let 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=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e));const a=e.features.filter(r=>r.geometry.type==="Point");a!=null&&a.length&&this.handleTmpPointUpdate(e,a.at(-1),{lng:t.lngLat.lng,lat:t.lngLat.lat})},handleDblClick(t){t.preventDefault();let e=this.geojson.at(-1);e.closed=!0,this.handleRender(e),e=E.featureCollection([],{id:new Date().getTime().toString()}),this.geojson.push(e),this.currentLineIndex++},handleRender(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,y,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(f=>{f==null||f.remove()}),this.pointMarkers[t.id]=[],(y=this.tipMarker)==null||y.remove(),this.tipMarker=void 0,e&&((p=this.map)!=null&&p.getSource(a))&&this.map.removeSource(a),e&&((h=this.map)!=null&&h.getSource(this.tmpSource))&&this.map.removeSource(this.tmpSource)}}},Ju={class:"idm-gl4-measure"};function Ku(t,e,a,r,i,l){const n=o.resolveComponent("VBtn"),s=o.resolveComponent("VTooltip");return o.openBlock(),o.createElementBlock("div",Ju,[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 Qu=Q(Uu,[["render",Ku]]),Ob="",qu={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=E.featureCollection([t,...this.drawCoords.map(r=>E.point(r))]);this.handleSetDrawSource(e);const a=3;this.map.getLayer(this.drawLineLayer)||this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}})},setupLineEdit(){this.clearEditMarkers(),this.drawCoords.forEach((e,a)=>{const r=document.createElement("div");r.className="idm-gl4-edit-vertex",r.style.backgroundColor=this.form.color;const i=new 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(E.lineString(this.drawCoords,{type:"Line",color:this.form.color}))}),i.on("dragend",()=>{this.map.getCanvas().style.cursor="grab";const{lng:l,lat:n}=i.getLngLat();this.drawCoords[a]=[l,n],this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.handleClearVertexLabels()}),r.addEventListener("contextmenu",l=>{l.preventDefault(),l.stopPropagation(),this.drawCoords.length>2&&this.showDeleteButton(e,()=>{this.drawCoords.splice(a,1),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()})}),this.editMarkers.push(i)});const t=e=>{e.preventDefault();const{lng:a,lat:r}=e.lngLat,i=E.point([a,r]),l=E.lineString(this.drawCoords),n=E.nearestPointOnLine(l,i);if(n){const s=n.properties.index;this.showDeleteButton([a,r],()=>{this.drawCoords.splice(s+1,0,[a,r]),this.handlerRenderEditLine(E.lineString(this.drawCoords,{type:"Line",color:this.form.color})),this.setupLineEdit()},this.$t("actions.add")||"新增","add")}};this.map.on("contextmenu",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=E.point([i,l]),s=E.lineString([...this.drawCoords,this.drawCoords[0]]),c=E.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=E.featureCollection(e);this.handleSetDrawSource(r),this.map.getLayer(this.drawLineLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-color",this.form.color),this.map.setPaintProperty(this.drawLineLayer,"line-width",a),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","LineString"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":a}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderTmpLine(t,e){const a=P.GeoJsonHelper.drawLine([t,e]),r=E.featureCollection([a]);this.map.getSource(this.drawTmpSource)?this.map.getSource(this.drawTmpSource).setData(r):this.map.addSource(this.drawTmpSource,{type:"geojson",data:r}),this.map.getLayer(this.drawTmpLayer)||this.map.addLayer({id:this.drawTmpLayer,type:"line",source:this.drawTmpSource,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":2,"line-dasharray":[3,2]}});const i={lng: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=`
638
638
  <div class="marker-label">${this.$t("measure.totalDistance")}: <b>${c}</b>nm, ${this.$t("measure.bearing")}: <b>${s}</b>°</div>
639
639
  <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(E.point(l))}),(t==null?void 0:t.length)>2){const l=[...t,t[0]];e.push(P.GeoJsonHelper.drawPolygon(l,{...this.originalProperties}))}const a=E.featureCollection(e);this.handleSetDrawSource(a);const r=(i=this.editLayer)!=null&&i.id?3:2;this.map.getLayer(this.drawFillLayer)?(this.map.setPaintProperty(this.drawLineLayer,"line-width",r),this.map.getLayer(this.drawPointLayer)&&this.map.setPaintProperty(this.drawPointLayer,"circle-color",this.form.color)):(this.map.addLayer({id:this.drawFillLayer,type:"fill",source:this.drawSource,filter:["==","$type","Polygon"],paint:{"fill-color":this.form.color,"fill-opacity":.35}}),this.map.addLayer({id:this.drawLineLayer,type:"line",source:this.drawSource,filter:["==","$type","Polygon"],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":this.form.color,"line-width":r}}),this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}))},handleRenderVertexLabel(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=E.featureCollection([E.point([e,a])]);this.handleSetDrawSource(r),this.map.getLayer(this.drawPointLayer)||this.map.addLayer({id:this.drawPointLayer,type:"circle",source:this.drawSource,filter:["==","$type","Point"],paint:{"circle-radius":3,"circle-color":this.form.color,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),this.handleRenderCircleCenterLabel([e,a])}else{const r=this.drawCoords[0],i=[e,a],l=E.distance(E.point(r),E.point(i),{units:"nauticalmiles"}),n=P.GeoJsonHelper.drawCircle(r[0],r[1],l),s=E.featureCollection([E.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=E.distance(E.point(e),E.point(a),{units:"nauticalmiles"}),i=P.GeoJsonHelper.drawCircle(e[0],e[1],r),l=E.featureCollection([E.point(e),i]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderAreaLayers(),this.handleRenderRadiusLine(e,a,r)},handleRenderCircleCenterLabel(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=E.featureCollection([E.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,y=Math.round(Math.cos(u)*g),p=Math.round(Math.sin(u)*g);this.circleMarkers.length>1&&(this.circleMarkers[1].remove(),this.circleMarkers.splice(1,1));const h=document.createElement("div"),f=document.createElement("span");f.className="idm-gl4-draw-radius-label",f.style.transform=`rotate(${d}deg)`,f.style.transformOrigin="center",f.style.display="inline-block",f.textContent=`${r} nm`,h.appendChild(f);const x=new pe.Marker(h,{anchor:"center",offset:[y,p]}).setLngLat(l).addTo(this.map);this.circleMarkers.push(x)},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=E.featureCollection([l,...n.map(c=>E.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=E.featureCollection([r,...i.map(n=>E.point(n))]);this.handleSetDrawSource(l),this.map.getLayer(this.drawFillLayer)||this.handleRenderRectLayers(),this.handleRenderRectCorners(e,a)},handleRenderRectLayers(){var e;const 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=E.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=E.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=E.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}}):de.post(`${this.gateway}/api/arc/lygroups/${(i=this.group)==null?void 0:i.id}/layers`,e,{headers:{Authorization:this.token||this.defaultMeteoToken}})).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})}}},$u={class:"text-h6 font-weight-600"},eg={class:"text-label mb-1"},tg={class:"text-label mb-1"},og={class:"mb-1"},ag={class:"text-label mb-1"},ig={class:"w-100 d-flex ma-0"},rg={class:"w-30 pa-0 d-flex"},lg={class:"flex-1-1-0 pa-0 d-flex"},ng={cols:"2",class:"pa-0"},sg={class:"mb-1"},cg={class:"text-label mb-1"},mg={class:"w-100 d-flex ma-0"},dg={class:"w-30 pa-0 d-flex"},hg={class:"flex-1-1-0 pa-0 d-flex"},pg={class:"pa-0"},ug={class:"mb-1"},gg={class:"text-label mb-1"},fg={class:"color-picker-row d-flex align-start ga-2"},yg=["value"],bg={class:"mb-n2"},wg={class:"text-label mb-1"},xg={class:"mb-1"},kg={class:"text-label mb-1"},Ag={class:"color-picker-row d-flex align-start ga-2"},Lg=["value"],vg={class:"mb-n2"},Cg={class:"text-label mb-1"},_g={key:0,class:"mb-3"},zg={class:"text-label mb-1"},Sg={class:"mb-1"},Pg={class:"text-label mb-1"},Mg={class:"color-picker-row d-flex align-start ga-2"},Tg=["value"],Ng={class:"mb-n2"},Eg={class:"text-label mb-1"};function Vg(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("VCardActions"),y=o.resolveComponent("VForm"),p=o.resolveComponent("VCard");return o.openBlock(),o.createBlock(p,{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 h;return[o.createVNode(s,{class:"d-flex justify-space-between align-center"},{default:o.withCtx(()=>{var f;return[o.createElementVNode("span",$u,o.toDisplayString((f=a.editLayer)!=null&&f.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 f;return[o.createElementVNode("div",eg,o.toDisplayString(t.$t("marker.group")),1),o.createVNode(m,{"model-value":(f=a.group)==null?void 0:f.name,density:"compact",variant:"outlined","hide-details":"",disabled:"",class:"input-btn-bg-1"},null,8,["model-value"])]}),_:1}),(h=a.editLayer)!=null&&h.id?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(d,{key:0,class:"text-body-1 px-4 pb-0"},{default:o.withCtx(()=>{var f;return[o.createElementVNode("div",tg,[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]=x=>i.markerType=x),mandatory:"",group:"",density:"compact",variant:"flat",class:"w-100",disabled:!!((f=a.editLayer)!=null&&f.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(y,{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",og,[o.createElementVNode("div",ag,[o.createTextVNode(o.toDisplayString(t.$t("marker.lat")),1),e[23]||(e[23]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",ig,[o.createElementVNode("div",rg,[o.createVNode(m,{modelValue:i.form.latDegree,"onUpdate:modelValue":[e[1]||(e[1]=f=>i.form.latDegree=f),e[2]||(e[2]=f=>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))]),o.createElementVNode("div",lg,[o.createVNode(m,{modelValue:i.form.latMinute,"onUpdate:modelValue":[e[3]||(e[3]=f=>i.form.latMinute=f),e[4]||(e[4]=f=>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))]),o.createElementVNode("div",ng,[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]=f=>{i.form.latDir=i.form.latDir==="N"?"S":"N",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.latDir),1)]),_:1})])])]),o.createElementVNode("div",sg,[o.createElementVNode("div",cg,[o.createTextVNode(o.toDisplayString(t.$t("marker.lng")),1),e[26]||(e[26]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",mg,[o.createElementVNode("div",dg,[o.createVNode(m,{modelValue:i.form.lngDegree,"onUpdate:modelValue":[e[6]||(e[6]=f=>i.form.lngDegree=f),e[7]||(e[7]=f=>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))]),o.createElementVNode("div",hg,[o.createVNode(m,{modelValue:i.form.lngMinute,"onUpdate:modelValue":[e[8]||(e[8]=f=>i.form.lngMinute=f),e[9]||(e[9]=f=>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))]),o.createElementVNode("div",pg,[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]=f=>{i.form.lngDir=i.form.lngDir==="E"?"W":"E",l.handleChangePoint()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.form.lngDir),1)]),_:1})])])]),o.createElementVNode("div",ug,[o.createElementVNode("div",gg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[29]||(e[29]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",fg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[11]||(e[11]=f=>i.form.color=f.target.value)},null,40,yg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[12]||(e[12]=f=>i.form.color=f),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",bg,[o.createElementVNode("div",wg,[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]=f=>i.form.name=f),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(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.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(y,{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",xg,[o.createElementVNode("div",kg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[31]||(e[31]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Ag,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[14]||(e[14]=f=>i.form.color=f.target.value)},null,40,Lg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[15]||(e[15]=f=>i.form.color=f),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",vg,[o.createElementVNode("div",Cg,[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]=f=>i.form.name=f),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(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.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(y,{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 f,x;return[(f=a.editLayer)!=null&&f.id?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",_g,[o.createElementVNode("div",zg,[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]=v=>i.form.areaType=v),mandatory:"",group:"",density:"compact",variant:"flat",color:"primary",class:"w-100",disabled:!!((x=a.editLayer)!=null&&x.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",Sg,[o.createElementVNode("div",Pg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[34]||(e[34]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Mg,[o.createElementVNode("input",{type:"color",value:i.form.color,class:"native-color-picker cursor-pointer",onInput:e[18]||(e[18]=v=>i.form.color=v.target.value)},null,40,Tg),o.createVNode(m,{modelValue:i.form.color,"onUpdate:modelValue":e[19]||(e[19]=v=>i.form.color=v),rules:i.formRules.color,density:"compact",variant:"outlined",class:"flex-1-1-0 input-btn-bg-1"},null,8,["modelValue","rules"])])]),o.createElementVNode("div",Ng,[o.createElementVNode("div",Eg,[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]=v=>i.form.name=v),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(u,{class:"w-100 d-flex justify-end align-center ga-4 pa-4"},{default:o.withCtx(()=>{var f;return[(f=a.editLayer)!=null&&f.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 Rg=Q(qu,[["render",Vg]]),Yb="",Dg={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}}).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}}).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)}}},Bg={class:"text-h6 font-weight-600"},Ig={class:"mb-4"},Fg={class:"text-label mb-1"},Gg={class:"mb-1"},jg={class:"text-label mb-1"},Wg={class:"color-picker-row d-flex align-start ga-2"},Zg=["value"],Hg={class:"text-body-2 text-center text-label"},Xg={class:"text-body-1 text-primary mt-2 cursor-pointer"},Og={class:"text-body-2 text-left text-label mt-1"},Yg={key:0,class:"text-body-2 text-left text-danger mt-1"},Ug={key:1,class:"file-item d-flex align-center justify-space-between mt-2 gray-bg-1 pa-1"},Jg={class:"text-body-2 text-truncate"};function Kg(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"),y=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",Bg,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(y,{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",Ig,[o.createElementVNode("div",Fg,[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",Gg,[o.createElementVNode("div",jg,[o.createTextVNode(o.toDisplayString(t.$t("marker.color")),1),e[11]||(e[11]=o.createElementVNode("span",{class:"text-danger"},"*",-1))]),o.createElementVNode("div",Wg,[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,Zg),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",Hg,o.toDisplayString(t.$t("marker.uploadHint")),1),o.createElementVNode("div",Xg,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",Og,o.toDisplayString(t.$t("marker.uploadLimit")),1),i.fileError?(o.openBlock(),o.createElementBlock("div",Yg,o.toDisplayString(i.fileError),1)):o.createCommentVNode("",!0),i.form.file?(o.openBlock(),o.createElementBlock("div",Ug,[o.createElementVNode("span",Jg,[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 Qg=Q(Dg,[["render",Kg]]),Ub="",qg={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}}).then(e=>{var a;((a=e.data)==null?void 0:a.code)===0&&this.$emit("saved")}).finally(()=>{this.saving=!1}))}}},$g={class:"text-h6 font-weight-600"},ef={class:"text-label mb-2"};function tf(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"),y=o.resolveComponent("VDialog");return o.openBlock(),o.createBlock(y,{"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",$g,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",ef,[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 of=Q(qg,[["render",tf]]),af={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}}},rf={class:"text-body-1 pb-1"},lf={class:"text-body-1"};function nf(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]=y=>i.showDialog=y),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",rf,o.toDisplayString(a.tips),1),o.createElementVNode("p",lf,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 sf=Q(af,[["render",nf]]),Jb="",Kb="",cf={name:"IdmMarker",components:{IdmDrawMarker:Rg,IdmImportMarker:Qg,IdmGroupDialog:of,DeleteDialog:sf},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,deleteType:void 0,layerGroup:[],layers:[],groupIndex:0,currentLayer:void 0,drawnLayerIds:[],layerMarkers:{},groupDialog:!1,currentGroup:void 0}},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){this.deleteType=t,this.currentLayer=void 0,this.currentGroup=void 0,t==="group"?this.currentGroup=e:t==="layer"&&(this.currentLayer=e),this.$refs.deleteDialog.open()},confirmDelete(){this.$nextTick(()=>{var t,e,a,r;this.deleteType==="group"&&((t=this.currentGroup)!=null&&t.id)?this.handleDeleteGroup((e=this.currentGroup)==null?void 0:e.id):this.deleteType==="layer"&&((a=this.currentLayer)!=null&&a.id)&&this.handleDeleteLayer((r=this.currentLayer)==null?void 0:r.id)})},async handleDeleteGroup(t){t&&(this.deleteLoading=!0,await de.delete(`${this.gateway}/api/arc/lygroups/${t}`,{headers:{Authorization:this.token||this.defaultMeteoToken}}).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},handleLayerClick(t,e){var m,d,g,u;if(!this.autoActive||(this.currentLayer=e,this.currentGroup=t,!this.map||!(e!=null&&e.extend)||!((m=e.extend)!=null&&m.geometry)))return;const a=typeof e.extend=="string"?JSON.parse(e.extend):e.extend;if(((d=a==null?void 0:a.geometry)==null?void 0:d.type)==="Point"){this.map.flyTo({center:a.geometry.coordinates,zoom:Math.max(this.map.getZoom(),4),duration:800});return}if(((g=a==null?void 0:a.geometry)==null?void 0:g.type)==="LineString"){const y=Math.floor(((u=a.geometry.coordinates)==null?void 0:u.length)/2);this.map.flyTo({center:a.geometry.coordinates[y],zoom:Math.max(this.map.getZoom(),4),duration:800});return}let r=[];if((a==null?void 0:a.type)==="Feature"?r=[a]:(a==null?void 0:a.type)==="FeatureCollection"&&(r=[...a.features]),!r)return;let i=1/0,l=-1/0,n=1/0,s=-1/0;const c=y=>{const[p,h]=y;p<i&&(i=p),p>l&&(l=p),h<n&&(n=h),h>s&&(s=h)};for(const y of r){const p=y.geometry;p&&(p.type==="MultiPoint"?p.coordinates.forEach(c):p.type==="MultiLineString"?p.coordinates.forEach(f=>f.forEach(c)):(p.type==="Polygon"||p.type==="MultiPolygon")&&(p.type==="MultiPolygon"?p.coordinates:[p.coordinates]).forEach(f=>f.forEach(x=>x.forEach(c))))}isFinite(i)&&(i===l&&n===s?this.map.flyTo({center:[i,n],zoom:Math.max(this.map.getZoom(),4),duration:800}):this.map.fitBounds([[i,n],[l,s]],{padding:80,duration:800}))},async fetchAllLayers(){this.loading=!0,this.layerGroup=[],await de.get(`${this.gateway}/api/arc/lygroups/my`,{headers:{Authorization:this.token||this.defaultMeteoToken}}).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(y=>{y.properties.lgId=c.id,y.properties.layerId=d.id,y.properties.name||(y.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}`,{headers:{Authorization:this.token||this.defaultMeteoToken}}).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,y,p,h;const m=(u=c.geometry)==null?void 0:u.type,d=((y=c.properties)==null?void 0:y.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[f,x]=c.geometry.coordinates,v=`<div style="font-size:12px;line-height:1.5;">
640
640
  <div style="font-weight:600;">${d}</div>