UNPKG

@idmwx/idmui-mapbox3

Version:

idm mapbox 3

1 lines 195 kB
(function(B,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("mapbox-gl"),require("@idmwx/idmui-gl3"),require("vue"),require("element-plus"),require("moment"),require("@idm-plugin/tag"),require("@element-plus/icons-vue"),require("axios"),require("@idm-plugin/geo"),require("echarts"),require("@turf/turf")):typeof define=="function"&&define.amd?define(["exports","mapbox-gl","@idmwx/idmui-gl3","vue","element-plus","moment","@idm-plugin/tag","@element-plus/icons-vue","axios","@idm-plugin/geo","echarts","@turf/turf"],I):(B=typeof globalThis<"u"?globalThis:B||self,I(B["idmui-report"]={},B["mapbox-gl"],B["@idmwx/idmui-gl3"],B.Vue,B["element-plus"],B.moment,B["@idm-plugin/tag"],B["@element-plus/icons-vue"],B.axios,B["@idm-plugin/geo"],B.echarts,B["@turf/turf"]))})(this,function(B,I,q,e,re,x,F,j,W,C,ul,Vl){"use strict";var Fr=Object.defineProperty;var Pr=(B,I,q)=>I in B?Fr(B,I,{enumerable:!0,configurable:!0,writable:!0,value:q}):B[I]=q;var ae=(B,I,q)=>(Pr(B,typeof I!="symbol"?I+"":I,q),q);function Ke(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const o in l)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(l,o);Object.defineProperty(t,o,a.get?a:{enumerable:!0,get:()=>l[o]})}}return t.default=l,Object.freeze(t)}const J=Ke(ul),A=Ke(Vl),Wr="",Gr="",Ur="",G=(l,t)=>{const o=l.__vccOpts||l;for(const[a,s]of t)o[a]=s;return o},Nl={name:"MapInitial",props:{center:{type:Object,default:()=>({})},token:{type:String,default:""}},emits:["initialized"],data(){return{helper:void 0,map:void 0,lngLat:void 0,marker:void 0}},watch:{center:{handler(){this.$nextTick(()=>{var t,o,a,s,n;((o=(t=this.center)==null?void 0:t.position)==null?void 0:o.length)===2&&((a=this.center)!=null&&a.flyTo)&&((n=this.map)==null||n.flyTo({center:(s=this.center)==null?void 0:s.position}));const l=document.getElementById("center-marker");this.marker=new I.Marker(l).setLngLat([this.center.position[0],this.center.position[1]]).addTo(this.map),this.marker._element.style.display="block"})},deep:!0}},mounted(){this.initMap()},methods:{initMap(){this.helper=new q.MapboxHelper(this.token),I.accessToken="pk.eyJ1IjoibmVhdGNoZW5oZW5nIiwiYSI6ImNsdXM3cnBmODBsemgycW1vaXc1bjV6bXMifQ.w6fqHGRbhNhLvm0LnX4ZVw";const l=new I.Map({container:"map",style:{version:8,name:"idm-mapbox-gl3",lights:[],fog:{color:"#ffffff",range:[.5,10],"high-color":"#245cdf","space-color":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"horizon-blend":["interpolate",["linear"],["zoom"],4,.2,7,.1],"star-intensity":["interpolate",["linear"],["zoom"],5,.35,6,0]},bearing:0,pitch:1,sprite:"https://fontnik.idmwx.com/sprite/sprite",glyphs:"https://fontnik.idmwx.com/{fontstack}/{range}.pbf",projection:{name:"equirectangular"},sources:{composite:this.helper.mapboxCustomer.source,i4:this.helper.i4.source,hi:this.helper.hi.source},layers:[this.helper.mapboxCustomer.layers.water,this.helper.mapboxCustomer.layers.waterDeplth,this.helper.i4.layer,this.helper.hi.layer,this.helper.mapboxCustomer.layers.countryBoundary,this.helper.mapboxCustomer.layers.countryAdmin0Boundary,this.helper.mapboxCustomer.layers.countryAdmin0BoundaryDisputed,this.helper.mapboxCustomer.layers.countryLabel,this.helper.mapboxCustomer.layers.world12nm,this.helper.mapboxCustomer.layers.worldMarineLine,this.helper.mapboxCustomer.layers.worldMarineLabel,this.helper.mapboxCustomer.layers.chinaRouteLine,this.helper.mapboxCustomer.layers.chinaRouteFill,this.helper.mapboxCustomer.layers.chinaRouteLabel]},zoom:2,minZoom:0,maxZoom:16,center:[120,30],maxBounds:[[-720,-85],[720,85]],preserveDrawingBuffer:!0,projection:"mercator",attributionControl:!1});l.on("load",()=>{this.map=l,this.$emit("initialized",this.map),this.initControl()})},initControl(){var t;const l=new I.ScaleControl({maxWidth:80,unit:"imperial"});(t=this.map)==null||t.addControl(l),l.setUnit("metric")},handleAddMarker(l){l.addTo(this.map)}}},bl={class:"initial-map-box"};function xl(l,t,o,a,s,n){return e.openBlock(),e.createElementBlock("div",bl,t[0]||(t[0]=[e.createElementVNode("div",{id:"map"},null,-1),e.createElementVNode("div",{id:"center-marker"},null,-1)]))}const Pe=G(Nl,[["render",xl],["__scopeId","data-v-62e37626"]]),Cl=function(l){typeof l=="string"&&(l=Number(l));let t;switch(l){case 7:t="Sun";break;case 1:t="Mon";break;case 2:t="Tue";break;case 3:t="Wed";break;case 4:t="Thu";break;case 5:t="Fri";break;case 6:t="Sat";break;default:t="-"}return t};class Ll{constructor(){ae(this,"mediaRecorder",null);ae(this,"recordedChunks",[]);ae(this,"stream",null);ae(this,"_isRecording",!1);ae(this,"_isStreamReady",!1);ae(this,"_frameRate",15);ae(this,"_onStreamEnd",null)}async initStream(t=15,o){if(this._isStreamReady||this.stream)return console.warn("[MapRecorder] 流已初始化"),!0;this._frameRate=t,this._onStreamEnd=o||null;try{return this.stream=await navigator.mediaDevices.getDisplayMedia({video:{width:{ideal:1440,max:1440},height:{ideal:810,max:810},frameRate:{ideal:t,max:30},displaySurface:"window"},audio:!1}),this.stream.getVideoTracks()[0].onended=()=>{var a;this._isStreamReady=!1,(a=this._onStreamEnd)==null||a.call(this)},this._isStreamReady=!0,await this.enterFullscreen(),!0}catch(a){return console.error("[MapRecorder] 初始化屏幕共享失败:",a),!1}}async startRecording(){if(!this._isStreamReady||!this.stream){console.warn("[MapRecorder] 流未初始化,请先调用 initStream");return}if(this._isRecording){console.warn("[MapRecorder] 已在录制中");return}this.recordedChunks=[];try{const t=this.getSupportedMimeType();this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:t,videoBitsPerSecond:4e6}),this.mediaRecorder.ondataavailable=o=>{o.data.size>0&&this.recordedChunks.push(o.data)},this.mediaRecorder.start(100),this._isRecording=!0}catch(t){throw console.error("[MapRecorder] 录制启动失败:",t),t}}async enterFullscreen(){try{const t=document.documentElement;t.requestFullscreen?await t.requestFullscreen():t.webkitRequestFullscreen&&await t.webkitRequestFullscreen()}catch(t){console.warn("[MapRecorder] 无法进入全屏:",t)}}async exitFullscreen(){try{(document.fullscreenElement||document.webkitFullscreenElement)&&(document.exitFullscreen?await document.exitFullscreen():document.webkitExitFullscreen&&await document.webkitExitFullscreen())}catch(t){console.warn("[MapRecorder] 无法退出全屏:",t)}}async stopSharing(){this._isRecording&&this.mediaRecorder&&(this._isRecording=!1,this.mediaRecorder.stop(),this.mediaRecorder=null,this.recordedChunks=[]),this.stream&&(this.stream.getTracks().forEach(t=>t.stop()),this.stream=null),this._isStreamReady=!1,await this.exitFullscreen()}get isStreamReady(){return this._isStreamReady}getSupportedMimeType(){const t=["video/mp4;codecs=h264","video/mp4","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];for(const o of t)if(MediaRecorder.isTypeSupported(o))return o;return"video/webm"}async stop(){return!this._isRecording||!this.mediaRecorder?null:(this._isRecording=!1,new Promise(t=>{if(!this.mediaRecorder){t(null);return}this.mediaRecorder.onstop=()=>{var s;const o=((s=this.mediaRecorder)==null?void 0:s.mimeType)||"video/webm",a=new Blob(this.recordedChunks,{type:o});this.recordedChunks=[],this.mediaRecorder=null,t(a)},this.mediaRecorder.stop()}))}download(t){const o=t.type.includes("mp4")?"mp4":"webm",s=`ORM-Record-${x().format("yyyyMMDD-HHmm")}.${o}`,n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=s,r.style.display="none",document.body.appendChild(r),r.click(),setTimeout(()=>{document.body.removeChild(r),URL.revokeObjectURL(n)},100)}get isRecording(){return this._isRecording}}const Zr="",Sl={name:"MapTimeline",components:{ElScrollbar:re.ElScrollbar},props:{realTime:{type:Object},startDate:{type:Object,default:()=>x().add(-14,"day")},endDate:{type:Object,default:()=>x().add(13,"day")},reset:{type:Number,default:0},interval:{type:Number,default:3},bottom:{type:Number,default:0},top:{type:Number,default:void 0}},emits:["realTime","dateChange","timeZone","startTs"],data(){return{hours:0,paused:!0,animation:void 0,resetTime:!1,startTime:0,progress:0,step:0,frequency:1e3,showTimezone:!1,timeZone:0,hourOptions:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],offsets:[-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12],recordEnabled:!1,isRecording:!1,recorder:null}},computed:{dates(){const l=[];if(this.startDate&&this.endDate){const t=this.startDate.clone().utc().set({hour:0,minute:0,second:0,millisecond:0});for(;t.isSameOrBefore(this.endDate);)l.push(t.clone()),t.add(1,"day")}return l},computeTotalHours(){var t;return((t=this.computeOffsetEndDate)==null?void 0:t.diff(this.computeOffsetStartDate,"h",!0))+24||1},computeOffsetStartDate(){return this.$emit("startTs",x(this.dates[0]).format()),this.dates[0]},computeOffsetEndDate(){return this.dates[this.dates.length-1]},computeDate(){return function(l){return`${l==null?void 0:l.utc().format("MMM-DD")} ${Cl(l==null?void 0:l.utc().format("E"))}`}},totalDays(){return Math.ceil(this.computeTotalHours/24)},defaultDays(){return this.totalDays<7?this.totalDays:7},computedHourWidth(){return Math.ceil((document.body.clientWidth-220)/(this.defaultDays*24))},computedLocalTime(){return x(this.realTime).utc().add(this.timeZone,"h").format("yyyy-MM-DD/HHmm")},computedUTCTime(){return l=>x(l).utc().format("yyyy-MM-DD HH:mm[Z]")},computedStep(){return function(l){return l%this.interval===(this.timeZone+12)%this.interval}}},watch:{hours:{handler(){var s,n,r,c,i;const l=(s=this.computeOffsetStartDate)==null?void 0:s.clone().add(this.hours-this.timeZone,"h");this.$emit("realTime",l);const t=document.documentElement.clientWidth-((n=document.getElementsByClassName("buttons")[0])==null?void 0:n.clientWidth),o=(i=(c=(r=this.$refs.scrollBar)==null?void 0:r.$el)==null?void 0:c.firstChild)==null?void 0:i.scrollLeft,a=this.hours*this.computedHourWidth;a<(t-220)/2?this.$refs.scrollBar.setScrollLeft(0):a>=(t-220)/2+o&&this.$refs.scrollBar.setScrollLeft(o+this.computedHourWidth*this.interval)}},step:{handler(){this.hours>=this.computeTotalHours?this.pause():this.step>=0&&(this.hours+=this.interval)}},reset:{handler(){this.reset&&this.handleReset()}},recordEnabled:{async handler(l,t){l!==t&&(l?await this.initRecordStream():await this.stopSharing())}}},mounted(){this.timeZone=Number(localStorage.getItem("timeZone"))||0,this.$emit("timeZone",this.timeZone),this.handleReset()},methods:{async pause(){this.animation&&cancelAnimationFrame(this.animation),this.paused=!0,this.isRecording&&await this.stopRecording()},async resume(){var l;this.resetTime=!0,this.paused=!1,this.recordEnabled&&((l=this.recorder)!=null&&l.isStreamReady)&&await this.startRecording(),this.animateSpeeds()},animateSpeeds(l){this.resetTime?(this.startTime=performance.now()-this.progress,this.resetTime=!1):this.progress=l-this.startTime,this.step=Math.floor(this.progress/this.frequency),this.animation=requestAnimationFrame(this.animateSpeeds)},handleJump(l,t){if(l>this.computeTotalHours)return!1;l=l<0?0:l,t?this.hours=l:this.hours=Math.ceil((l-(this.timeZone+12)%this.interval)/this.interval)*this.interval+(this.timeZone+12)%this.interval},handleClickHourText(l){},handleReset(){this.pause(),this.resetTime=!0,this.startTime=0,this.progress=0,this.realTime?this.hours=Math.ceil(this.realTime.diff(this.computeOffsetStartDate,"hour",!0)+this.timeZone):this.hours=Math.ceil(x().diff(this.computeOffsetStartDate,"hour",!0)+this.timeZone),setTimeout(()=>{var t;const l=Math.ceil(this.hours/24)-Math.floor(this.defaultDays/2);(t=this.$refs.scrollBar)==null||t.setScrollLeft(this.computedHourWidth*24*l-this.computedHourWidth*(this.hours%24))},500)},setTimezone(l){this.timeZone=l,this.$emit("timeZone",this.timeZone),localStorage.setItem("timeZone",this.timeZone),this.showTimezone=!1,this.handleReset()},async initRecordStream(){try{this.recorder=new Ll,await this.recorder.initStream(30,()=>{this.recordEnabled=!1,this.isRecording=!1})||(this.recordEnabled=!1,this.recorder=null)}catch(l){console.error("[TimePlayer] 初始化共享流失败:",l),this.recordEnabled=!1,this.recorder=null}},async startRecording(){try{this.recorder&&(await this.recorder.startRecording(),this.isRecording=!0)}catch(l){console.error("[TimePlayer] 录制启动失败:",l),this.isRecording=!1}},async stopRecording(){try{if(this.recorder){const l=await this.recorder.stop();l&&this.recorder.download(l)}}catch(l){console.error("[TimePlayer] 录制停止失败:",l)}finally{this.isRecording=!1}},async stopSharing(){try{this.recorder&&await this.recorder.stopSharing()}catch(l){console.error("[TimePlayer] 停止共享失败:",l)}finally{this.isRecording=!1,this.recorder=null}}}},wl={key:0,class:"record-logo"},_l={style:{padding:"6px 16px",margin:"auto",background:"linear-gradient(90deg, #3468F5 0%, #5AC1F9 100%)",color:"var(--idm-white)","border-radius":"16px","font-size":"16px"}},Rl={class:"timezone"},Tl={key:0,class:"list"},Dl=["onClick"],Ml={class:"flex-start",style:{"box-shadow":"0px 2px 12px 0px rgba(0, 0, 0, 0.5)"}},Bl={class:"flex-col-between-center"},Ol={class:"buttons flex-row-end-center"},Al={class:"timeline"},Hl={key:0,class:"day"},Il={class:"date flex-row-center-end"},zl={class:"hours flex-row-start-center"},Fl=["onClick"];function Pl(l,t,o,a,s,n){const r=e.resolveComponent("ElScrollbar");return e.openBlock(),e.createElementBlock("div",{ref:"mapTimeline",class:"map-timeline-container",style:e.normalizeStyle({bottom:o.bottom+"px"})},[s.recordEnabled?(e.openBlock(),e.createElementBlock("div",wl,[t[7]||(t[7]=e.createElementVNode("div",{class:"flex-center"},[e.createElementVNode("img",{src:"https://osshz.idmwx.com/asset/logo/logo_984x984.png",style:{height:"64px",width:"auto"}}),e.createElementVNode("div",{style:{"margin-left":"8px","font-size":"20px","font-style":"italic","font-weight":"600",width:"auto"}},"Weather Routing")],-1)),e.createElementVNode("div",_l,e.toDisplayString(n.computedUTCTime(o.realTime)),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Rl,[s.showTimezone?(e.openBlock(),e.createElementBlock("div",Tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.offsets,c=>(e.openBlock(),e.createElementBlock("div",{key:c,class:"item",onClick:i=>n.setTimezone(c)},e.toDisplayString(c<0?c:"+"+c),9,Dl))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"btn",onClick:t[0]||(t[0]=c=>s.showTimezone=!s.showTimezone)},"UTC "+e.toDisplayString(s.timeZone<0?s.timeZone:"+"+s.timeZone),1)]),e.createElementVNode("div",Ml,[e.createElementVNode("div",Bl,[e.createElementVNode("div",Ol,[e.createElementVNode("div",{class:e.normalizeClass(["btn-block",s.recordEnabled?"active":""]),onClick:t[1]||(t[1]=c=>s.recordEnabled=!s.recordEnabled)},e.toDisplayString(s.recordEnabled?"录制中":"录制"),3),e.createElementVNode("div",{class:e.normalizeClass(s.hours-o.interval<0?"iconfont button disable":"iconfont button"),style:{transform:"rotate(180deg)"},onClick:t[2]||(t[2]=c=>n.handleJump(s.hours-o.interval,!0))},"  ",2),s.paused?(e.openBlock(),e.createElementBlock("div",{key:0,class:"iconfont button play",onClick:t[3]||(t[3]=(...c)=>n.resume&&n.resume(...c))},"")):(e.openBlock(),e.createElementBlock("div",{key:1,class:"iconfont button play",onClick:t[4]||(t[4]=(...c)=>n.pause&&n.pause(...c))},"")),e.createElementVNode("div",{class:e.normalizeClass(s.hours+o.interval>n.computeTotalHours?"iconfont button disable":"iconfont button"),onClick:t[5]||(t[5]=c=>n.handleJump(s.hours+o.interval,!0))},"  ",2)])]),e.createVNode(r,{ref:"scrollBar",class:"progress-box"},{default:e.withCtx(()=>[e.createElementVNode("div",Al,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.computeTotalHours,(c,i)=>{var h;return e.openBlock(),e.createElementBlock(e.Fragment,{key:c},[i%24===0?(e.openBlock(),e.createElementBlock("div",Hl,[e.createElementVNode("div",Il,e.toDisplayString(n.computeDate((h=n.computeOffsetStartDate)==null?void 0:h.clone().add(c,"h"))),1),t[8]||(t[8]=e.createElementVNode("div",{style:{width:"2px",height:"50px","background-color":"var(--idm-black-1)",position:"relative","margin-top":"-50px",left:"-1px","z-index":"3"}},null,-1)),e.createElementVNode("div",zl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.hourOptions,p=>(e.openBlock(),e.createElementBlock("div",{key:c+"-"+p,class:e.normalizeClass(c+p<=s.hours?"hour-bg active":"hour-bg"),style:e.normalizeStyle({width:n.computedHourWidth+"px"}),onClick:d=>n.handleJump(c+p)},[e.createElementVNode("div",{class:e.normalizeClass(["hour",c+p<=s.hours?"active":"",n.computedStep(p+1)?"step":""])},[n.computedStep(p)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text",style:e.normalizeStyle({marginLeft:n.computedHourWidth*-1+"px"}),onClick:t[6]||(t[6]=(...d)=>n.handleClickHourText&&n.handleClickHourText(...d))},e.toDisplayString(p<10?"0"+p:p),5)):e.createCommentVNode("",!0)],2)],14,Fl))),128))])])):e.createCommentVNode("",!0)],64)}),128))])]),_:1},512)])],4)}const We=G(Sl,[["render",Pl],["__scopeId","data-v-7d6ca345"]]),$r="",Wl={name:"MapMeteo",components:{MapboxGL:q.MapboxGL},props:{token:{type:String,default:""},permission:{type:Number,default:0},map:{type:Object,default:void 0},forecastModel:{type:String}},emits:["measurable"],data(){return{showPointRpt:!1,pointQuery:{}}},methods:{handleMore(l){this.pointQuery={...l,d:7,st:6}},handleMeasurableChange(l){this.$emit("measurable",l)}}},Gl={class:"meteo-gl"};function Ul(l,t,o,a,s,n){const r=e.resolveComponent("MapboxGL");return e.openBlock(),e.createElementBlock("div",Gl,[o.map?(e.openBlock(),e.createBlock(r,e.mergeProps({key:0,ref:"mapboxGl3",map:o.map,token:o.token,permission:o.permission,forecastModel:o.forecastModel},l.$attrs),null,16,["map","token","permission","forecastModel"])):e.createCommentVNode("",!0)])}const Ge=G(Wl,[["render",Ul]]),qr="",Zl={name:"VoyageFleet",components:{ElScrollbar:re.ElScrollbar,CaretBottom:j.CaretBottom,CaretRight:j.CaretRight,Delete:j.Delete,ViewFilter:j.Filter},props:{permission:{type:Number,default:void 0},token:{type:String},voyageId:{type:String,default:void 0},voyageVersion:{type:Number,default:0},route:{type:Object,default:void 0},weights:{type:Object,default:void 0},voyageToggle:{type:Boolean,default:!1},toggleVersion:{type:Number,default:0},isLogin:{type:Boolean,default:void 0}},emits:["login","update","select","voyageToggle","hide","toggleVersion","handlePort","handleCoord","handleOtherVessel","handleCloseAll"],data(){return{right:10,listQuery:{vid:void 0,id:void 0,smp:!0,pid:void 0,pn:1,ps:500},model:"inService",activeStatus:"Underway",filterVersion:0,voyageList:[],followList:[],filterList:[],total:0,voyage:void 0,hide:!1,items:[],placeholder:"Name/IMO",keyword:void 0,gateway:"https://cbe.idmwx.com",CompanyHelper:F.CompanyHelper,showAlertCheckbox:!1,alertTagList:[],alertOption:{weather:F.VoyageHelper.WEATHER_TAG,sailing:F.VoyageHelper.SAILING_TAG},checkParams:{weather:{checkAll:!1,isIndeterminate:!1},sailing:{checkAll:!1,isIndeterminate:!1}}}},computed:{computePosition(){return function(l){return l?C.LngLatHelper.lat2pretty(l==null?void 0:l.lat,2).pretty+" / "+C.LngLatHelper.lng2pretty(l==null?void 0:l.lng,2).pretty:"-"}}},watch:{"route.query.vid":{handler(){var l,t;(t=(l=this.route)==null?void 0:l.query)!=null&&t.vid?this.handleVoyageIdChange():(this.fetchMyActiveVoyage(),this.fetchMyFollows())},immediate:!0},voyageToggle:{handler(){this.voyageToggle&&(this.model="inService",this.fetchMyFollows())}},filterVersion:{handler(){var l,t;if(this.model==="inService"){let o=[];((l=this.alertTagList)==null?void 0:l.length)>0?o=this.voyageList.filter((a,s)=>this.alertTagList.some(n=>a.tag&n)):o=this.voyageList,this.keyword?this.filterList=o.filter((a,s)=>{var d,y,u,V,L,f,b,T,m,k,_,N,R,S,D,g,O;const n=(d=this.keyword)==null?void 0:d.toLowerCase().replace(/\s/g,""),r=(V=(u=(y=a==null?void 0:a.vessel)==null?void 0:y.name)==null?void 0:u.toLowerCase())==null?void 0:V.replace(/\s/g,""),c=(b=(f=(L=a.company)==null?void 0:L.name)==null?void 0:f.toLowerCase())==null?void 0:b.replace(/\s/g,""),i=(_=(k=(m=(T=a==null?void 0:a.vessel)==null?void 0:T.imo)==null?void 0:m.toString())==null?void 0:k.toLowerCase())==null?void 0:_.replace(/\s/g,""),h=(S=(R=(N=a==null?void 0:a.pic)==null?void 0:N.email)==null?void 0:R.toLowerCase())==null?void 0:S.replace(/\s/g,""),p=(O=(g=(D=a==null?void 0:a.pic2)==null?void 0:D.email)==null?void 0:g.toLowerCase())==null?void 0:O.replace(/\s/g,"");return this.permission&this.CompanyHelper.LEVEL.Prime?(r==null?void 0:r.indexOf(n))>-1||(c==null?void 0:c.indexOf(n))>-1||(i==null?void 0:i.indexOf(n))>-1||(h==null?void 0:h.indexOf(n))>-1||(p==null?void 0:p.indexOf(n))>-1:(r==null?void 0:r.indexOf(n))>-1||(i==null?void 0:i.indexOf(n))>-1}):this.filterList=o,this.total=(t=this.voyageList)==null?void 0:t.length,this.$nextTick(()=>{this.filterList.some(a=>a.status==="Underway")?this.activeStatus="Underway":this.filterList.some(a=>a.status==="Reached")?this.activeStatus="Reached":this.filterList.some(a=>a.status==="Ready")?this.activeStatus="Ready":this.activeStatus=""}),this.$emit("update",this.filterList)}else this.keyword?this.filterList=this.followList.filter((o,a)=>{var d,y,u,V,L,f,b,T,m,k,_,N,R,S,D,g,O;const s=(d=this.keyword)==null?void 0:d.toLowerCase().replace(/\s/g,""),n=(V=(u=(y=o==null?void 0:o.vessel)==null?void 0:y.name)==null?void 0:u.toLowerCase())==null?void 0:V.replace(/\s/g,""),r=(T=(b=(f=(L=o==null?void 0:o.vessel)==null?void 0:L.imo)==null?void 0:f.toString())==null?void 0:b.toLowerCase())==null?void 0:T.replace(/\s/g,""),c=this.voyageList.find(H=>{var w;return H.id===((w=o.voyage)==null?void 0:w.id)}),i=(_=(k=(m=c==null?void 0:c.company)==null?void 0:m.name)==null?void 0:k.toLowerCase())==null?void 0:_.replace(/\s/g,""),h=(S=(R=(N=c==null?void 0:c.pic)==null?void 0:N.email)==null?void 0:R.toLowerCase())==null?void 0:S.replace(/\s/g,""),p=(O=(g=(D=c==null?void 0:c.pic2)==null?void 0:D.email)==null?void 0:g.toLowerCase())==null?void 0:O.replace(/\s/g,"");return this.permission&this.CompanyHelper.LEVEL.Prime?(n==null?void 0:n.indexOf(s))>-1||(i==null?void 0:i.indexOf(s))>-1||(r==null?void 0:r.indexOf(s))>-1||(h==null?void 0:h.indexOf(s))>-1||(p==null?void 0:p.indexOf(s))>-1:(n==null?void 0:n.indexOf(s))>-1||(r==null?void 0:r.indexOf(s))>-1}):this.filterList=this.followList,this.total=this.followList.length,this.$emit("update",this.filterList)},immediate:!0},model:{handler(){this.filterVersion=Math.random(),this.model==="myFollows"&&this.fetchMyFollows(),this.voyage={},this.$emit("select",this.voyage)}},keyword:{handler(){this.filterVersion=Math.random()},immediate:!0},voyageVersion:{handler(){if(this.voyageId){let l=0;this.filterList.forEach((o,a)=>{o.id===this.voyageId&&(this.voyage=o,l=a)});const t=document.getElementsByClassName("el-scrollbar")[0].firstChild;t.scrollTop=(l-10)*42}},immediate:!0},toggleVersion:{handler(){this.$nextTick(()=>{var l;this.right=(((l=document.getElementsByClassName("right-bar")[0])==null?void 0:l.clientWidth)||0)+10})},deep:!0,immediate:!0},hide:{handler(){this.hide||this.$emit("update",this.voyageList)}}},mounted(){this.permission&this.CompanyHelper.LEVEL.Prime?this.placeholder="Name/IMO/Company/PIC":this.placeholder="Name/IMO"},methods:{async handleVoyageIdChange(){var o;await this.fetchMyActiveVoyage(),this.$emit("voyageToggle",!1);const l=this.voyageList.filter(a=>{var s,n;return a.id===((n=(s=this.route)==null?void 0:s.query)==null?void 0:n.vid)})[0];this.$emit("select",l);const t=(o=l==null?void 0:l.vessel)==null?void 0:o.imo;this.keyword=t+""},async fetchMyActiveVoyage(){var t,o,a,s;const l=await W.get(`${this.gateway}/api/rsv/voyages/my/active`,{headers:{Authorization:this.token},params:this.listQuery});if(((t=l==null?void 0:l.data)==null?void 0:t.code)===0){const n=F.VoyageHelper.WEATHER_TAG,r=F.VoyageHelper.SAILING_TAG;this.voyageList=(s=(a=(o=l.data)==null?void 0:o.data)==null?void 0:a.rows)==null?void 0:s.map(c=>(c.weatherTag=n.some(i=>c.tag&i.weight),c.sailingTag=r.some(i=>c.tag&i.weight),c)),this.hide||this.$emit("update",this.voyageList),this.filterVersion=Math.random()}},async fetchMyFollows(){var t,o,a,s;const l=await W.get(`${this.gateway}/api/rsv/follows`,{headers:{Authorization:this.token},params:{pn:1,ps:1e4,b:1}});if(((t=l==null?void 0:l.data)==null?void 0:t.code)===0){const n=F.VoyageHelper.WEATHER_TAG,r=F.VoyageHelper.SAILING_TAG;let c=0;this.followList=(s=(a=(o=l.data)==null?void 0:o.data)==null?void 0:a.rows)==null?void 0:s.map(i=>(i.weatherTag=n.some(h=>i.tag&h.weight),i.sailingTag=r.some(h=>i.tag&h.weight),i.watchedIndex=i.voyage?void 0:++c,i.followed=!0,i)),this.filterVersion=Math.random()}},handleFleetHide(l){this.hide=l,this.$emit("hide",l)},handleVoyageClick(l){this.$emit("handleCloseAll"),this.voyage=l,this.$emit("select",this.voyage)},handleRowClick(l){this.$emit("handleCloseAll"),l.voyage?(this.voyage=this.voyageList.find(t=>{var o;return t.id===((o=l.voyage)==null?void 0:o.id)}),this.$emit("select",this.voyage)):l.coordinate?this.$emit("handleCoord",l.coordinate):l.port?this.$emit("handlePort",l.port):l.vessel&&this.$emit("handleOtherVessel",l.vessel)},handleToggleFollow(l){var t,o;l.follow?this.handleCancelFollow((o=l==null?void 0:l.follow)==null?void 0:o.id):this.handleFollow((t=l==null?void 0:l.vessel)==null?void 0:t.id)},async handleFollow(l){await W.post(`${this.gateway}/api/rsv/follows`,{vesselId:l},{headers:{Authorization:this.token}}).then(t=>{var o,a,s,n,r;((o=t.data)==null?void 0:o.code)===0&&(this.fetchMyFollows(),this.voyageList.find(c=>{var i;return((i=c==null?void 0:c.vessel)==null?void 0:i.id)===l}).follow={id:(a=t.data.data)==null?void 0:a.id,voyageId:(s=t.data.data)==null?void 0:s.voyageId,ownerId:(r=(n=t.data.data)==null?void 0:n.owner)==null?void 0:r.id})}),this.filterVersion=Math.random()},handleCancelFollow(l){W.delete(`${this.gateway}/api/rsv/follows/${l}`,{headers:{Authorization:this.token}}).then(t=>{var o;((o=t.data)==null?void 0:o.code)===0&&(this.model==="inService"?this.voyageList.find(a=>{var s;return((s=a.follow)==null?void 0:s.id)===l}).follow=void 0:(this.fetchMyActiveVoyage(),this.followList=this.followList.filter(a=>(a==null?void 0:a.id)!==l)),this.filterVersion=Math.random())})},handleToggle(){this.isLogin?(this.$emit("voyageToggle",!this.voyageToggle),this.$emit("toggleVersion")):this.$emit("login")},handleClose(){this.$emit("voyageToggle",!1)},handleCheckAllChange(l,t){var o,a,s;l?((a=(o=this.alertOption)==null?void 0:o[t])==null||a.forEach(n=>{this.alertTagList.push(n.weight)}),this.alertTagList=[...new Set(this.alertTagList)]):this.alertTagList=(s=this.alertTagList)==null?void 0:s.filter(n=>{var r,c;return!((c=(r=this.alertOption)==null?void 0:r[t])!=null&&c.some(i=>n===i.weight))}),this.checkParams[t].isIndeterminate=!1,this.filterVersion=Math.random()},handleCheckItemChange(l,t){var a,s,n;const o=(a=l==null?void 0:l.filter(r=>this.alertOption[t].some(c=>r===c.weight)))==null?void 0:a.length;this.checkParams[t].checkAll=o===((s=this.alertOption[t])==null?void 0:s.length),this.checkParams[t].isIndeterminate=o>0&&o<((n=this.alertOption[t])==null?void 0:n.length),this.filterVersion=Math.random()}}},$l={class:"voyage-fleet-container"},ql={class:"header-box flex-space"},jl={style:{"font-size":"14px"}},Jl={class:"switch-box flex-space"},Kl={class:"search-box flex-between"},Xl={class:"status-label flex-between"},Ql={class:"flex-start"},Yl=["onClick"],vl={style:{"font-size":"14px","font-weight":"400"}},es={key:0,class:"voyage-list"},ts=["onClick"],ls={class:"flex-start"},ss={class:"vessel-name"},ns={key:0,class:"iconfont alert-icon"},os={key:1,class:"iconfont alert-icon"},as=["onClick"],is={key:0,class:"iconfont"},rs={key:1,class:"iconfont"},cs={key:1,class:"voyage-list followed"},ds=["onClick"],hs={key:0,class:"flex-space",style:{height:"100%"}},ms={class:"flex-col-space-start"},ps={class:"vessel-name"},gs={class:"flex-start"},fs={key:0,class:"iconfont alert-icon"},ys={key:1,class:"iconfont alert-icon"},Es=["onClick"],ks={key:1,class:"flex-space",style:{height:"100%"}},us={class:"flex-col-space-start"},Vs={class:"vessel-name"},Ns=["onClick"],bs={class:"display-box"},xs={style:{"pointer-events":"none"}},Cs={class:"content-box"};function Ls(l,t,o,a,s,n){var T;const r=e.resolveComponent("ElTooltip"),c=e.resolveComponent("ElInput"),i=e.resolveComponent("ViewFilter"),h=e.resolveComponent("el-icon"),p=e.resolveComponent("CaretBottom"),d=e.resolveComponent("CaretRight"),y=e.resolveComponent("ElScrollbar"),u=e.resolveComponent("Delete"),V=e.resolveComponent("el-checkbox"),L=e.resolveComponent("el-checkbox-group"),f=e.resolveComponent("ElDivider"),b=e.resolveComponent("ElDialog");return e.openBlock(),e.createElementBlock("div",$l,[e.createElementVNode("div",{class:"menu-bar-box",style:e.normalizeStyle({right:s.right+"px"})},[e.createVNode(r,{placement:"left",effect:"light",content:"Fleet","show-after":1e3},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["toggle",o.voyageToggle?"active":""]),onClick:t[0]||(t[0]=m=>n.handleToggle())},t[21]||(t[21]=[e.createElementVNode("i",{class:"iconfont"},"",-1)]),2)]),_:1})],4),e.createElementVNode("div",{class:"main-box flex-start",style:e.normalizeStyle({right:o.voyageToggle?"0px":"-290px"})},[e.createElementVNode("div",{class:e.normalizeClass(["active-voyages",o.voyageToggle?"right-bar":""])},[e.createElementVNode("div",ql,[e.createElementVNode("label",null,[t[22]||(t[22]=e.createTextVNode("Fleets ")),e.createElementVNode("span",jl," ( "+e.toDisplayString(s.total)+" )",1)]),e.createElementVNode("div",{class:"iconfont close-btn",onClick:t[1]||(t[1]=(...m)=>n.handleClose&&n.handleClose(...m))},"")]),e.createElementVNode("div",Jl,[e.createElementVNode("div",{class:e.normalizeClass(s.model==="inService"?"item active":"item"),onClick:t[2]||(t[2]=m=>s.model="inService")},"In Service",2),e.createElementVNode("div",{class:e.normalizeClass(s.model==="myFollows"?"item active":"item"),onClick:t[3]||(t[3]=m=>s.model="myFollows")},"My Follows",2)]),e.createElementVNode("div",Kl,[e.createVNode(c,{placeholder:s.placeholder,modelValue:s.keyword,"onUpdate:modelValue":t[4]||(t[4]=m=>s.keyword=m),class:"input",style:{flex:"1"},clearable:"",onFocus:t[5]||(t[5]=m=>s.placeholder=""),onBlur:t[6]||(t[6]=m=>s.placeholder="Name/IMO")},null,8,["placeholder","modelValue"]),s.model==="inService"?(e.openBlock(),e.createBlock(h,{key:0,onClick:t[7]||(t[7]=m=>s.showAlertCheckbox=!0),style:{width:"30px"},color:(T=s.alertTagList)!=null&&T.length?"var(--idm-primary-color)":""},{default:e.withCtx(()=>[e.createVNode(i)]),_:1},8,["color"])):e.createCommentVNode("",!0)]),s.model==="inService"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},e.renderList(["Underway","Reached","Ready"],m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m},[e.createElementVNode("div",Xl,[e.createElementVNode("div",Ql,[e.createVNode(h,{class:"caret-btn"},{default:e.withCtx(()=>[s.activeStatus===m?(e.openBlock(),e.createBlock(p,{key:0,onClick:t[8]||(t[8]=k=>s.activeStatus="")})):(e.openBlock(),e.createBlock(d,{key:1,onClick:k=>s.activeStatus=m},null,8,["onClick"]))]),_:2},1024),e.createElementVNode("label",{onClick:k=>s.activeStatus=s.activeStatus===""?m:""},[e.createTextVNode(e.toDisplayString(m)+" ",1),e.createElementVNode("span",vl," ( "+e.toDisplayString(s.filterList.filter(k=>k.status===m).length)+" )",1)],8,Yl)]),m==="Underway"?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(`iconfont icon ${m}`)},"",2)):e.createCommentVNode("",!0),m==="Reached"?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(`iconfont icon ${m}`)},"",2)):e.createCommentVNode("",!0),m==="Ready"?(e.openBlock(),e.createElementBlock("i",{key:2,class:e.normalizeClass(`iconfont icon ${m}`)},"",2)):e.createCommentVNode("",!0)]),s.activeStatus===m?(e.openBlock(),e.createElementBlock("div",es,[e.createVNode(y,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.filterList.filter(k=>k.status===m),k=>{var _,N;return e.openBlock(),e.createElementBlock("div",{key:k.id,class:e.normalizeClass(((_=s.voyage)==null?void 0:_.id)===k.id?"flex-space voyage-item active":"flex-space voyage-item"),onClick:R=>n.handleVoyageClick(k)},[e.createElementVNode("div",ls,[e.createElementVNode("span",ss,e.toDisplayString((N=k.vessel)==null?void 0:N.name),1),k.weatherTag?(e.openBlock(),e.createElementBlock("span",ns,"")):e.createCommentVNode("",!0),k.sailingTag?(e.openBlock(),e.createElementBlock("span",os,"")):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["follow-icons",k.follow?"active":""]),onClick:e.withModifiers(R=>n.handleToggleFollow(k),["stop"])},[k.follow?(e.openBlock(),e.createElementBlock("span",is,"")):(e.openBlock(),e.createElementBlock("span",rs,""))],10,as)],10,ts)}),128))]),_:2},1024)])):e.createCommentVNode("",!0)],64))),64)):(e.openBlock(),e.createElementBlock("div",cs,[e.createVNode(y,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.filterList,m=>{var k,_,N,R,S,D,g;return e.openBlock(),e.createElementBlock("div",{key:m.id||Math.random(),class:e.normalizeClass((k=s.voyage)!=null&&k.id&&((_=s.voyage)==null?void 0:_.id)===((N=m==null?void 0:m.voyage)==null?void 0:N.id)?"voyage-item active":"voyage-item"),onClick:O=>n.handleRowClick(m)},[m.voyage?(e.openBlock(),e.createElementBlock("div",hs,[e.createElementVNode("div",ms,[e.createElementVNode("div",ps,e.toDisplayString((R=m==null?void 0:m.vessel)==null?void 0:R.name),1),e.createElementVNode("div",gs,[e.createElementVNode("span",{class:e.normalizeClass(`status-tag ${(S=m==null?void 0:m.voyage)==null?void 0:S.status}`)},e.toDisplayString((D=m==null?void 0:m.voyage)==null?void 0:D.status),3),m.weatherTag?(e.openBlock(),e.createElementBlock("span",fs,"")):e.createCommentVNode("",!0),m.sailingTag?(e.openBlock(),e.createElementBlock("span",ys,"")):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:"follow-icons active",onClick:e.withModifiers(O=>n.handleCancelFollow(m.id),["stop"])},t[23]||(t[23]=[e.createElementVNode("span",{class:"iconfont"},"",-1)]),8,Es)])):m!=null&&m.vessel?(e.openBlock(),e.createElementBlock("div",ks,[e.createElementVNode("div",us,[e.createElementVNode("div",Vs,e.toDisplayString((g=m==null?void 0:m.vessel)==null?void 0:g.name),1),t[24]||(t[24]=e.createElementVNode("div",{class:"flex-start"},[e.createElementVNode("span",{class:"status-tag vessel-tag"},"Followed")],-1))]),e.createElementVNode("div",{class:"delete-icons active",onClick:e.withModifiers(O=>n.handleCancelFollow(m.id),["stop"])},[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(u)]),_:1})],8,Ns)])):e.createCommentVNode("",!0)],10,ds)}),128))]),_:1})])),e.createElementVNode("view",bs,[t[25]||(t[25]=e.createElementVNode("span",{class:"text"},"Display on the map",-1)),s.hide?(e.openBlock(),e.createElementBlock("span",{key:1,class:"iconfont switch-off",onClick:t[10]||(t[10]=m=>n.handleFleetHide(!1))},"")):(e.openBlock(),e.createElementBlock("span",{key:0,class:"iconfont switch-on",onClick:t[9]||(t[9]=m=>n.handleFleetHide(!0))},""))])],2)],4),e.createElementVNode("div",xs,[e.createVNode(b,{modelValue:s.showAlertCheckbox,"onUpdate:modelValue":t[20]||(t[20]=m=>s.showAlertCheckbox=m),title:"Vessel Under Alert",width:"400",class:"alert-checkbox-dialog",draggable:!0,"show-close":!1,modal:!1,"close-on-click-modal":!1},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"iconfont close-btn",onClick:t[11]||(t[11]=m=>s.showAlertCheckbox=!1)},""),e.createElementVNode("div",Cs,[e.createVNode(V,{modelValue:s.checkParams.weather.checkAll,"onUpdate:modelValue":t[12]||(t[12]=m=>s.checkParams.weather.checkAll=m),indeterminate:s.checkParams.weather.isIndeterminate,onChange:t[13]||(t[13]=m=>n.handleCheckAllChange(m,"weather"))},{default:e.withCtx(()=>t[26]||(t[26]=[e.createElementVNode("span",{class:"title"},"Adverse Weather Alert",-1),e.createElementVNode("span",{class:"iconfont alert-icon"},"",-1)])),_:1,__:[26]},8,["modelValue","indeterminate"]),e.createVNode(L,{modelValue:s.alertTagList,"onUpdate:modelValue":t[14]||(t[14]=m=>s.alertTagList=m),onChange:t[15]||(t[15]=m=>n.handleCheckItemChange(m,"weather"))},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.alertOption.weather,m=>{var k,_;return e.openBlock(),e.createBlock(V,{label:(_=(k=m.name)==null?void 0:k.split(" "))==null?void 0:_[2],value:m.weight},null,8,["label","value"])}),256))]),_:1},8,["modelValue"]),e.createVNode(f,{style:{margin:"5px 0","border-top":"none"}}),e.createVNode(V,{modelValue:s.checkParams.sailing.checkAll,"onUpdate:modelValue":t[16]||(t[16]=m=>s.checkParams.sailing.checkAll=m),indeterminate:s.checkParams.sailing.isIndeterminate,onChange:t[17]||(t[17]=m=>n.handleCheckAllChange(m,"sailing"))},{default:e.withCtx(()=>t[27]||(t[27]=[e.createElementVNode("span",{class:"title"},"Sailing Alert",-1),e.createElementVNode("span",{class:"iconfont alert-icon"},"",-1)])),_:1,__:[27]},8,["modelValue","indeterminate"]),e.createVNode(L,{modelValue:s.alertTagList,"onUpdate:modelValue":t[18]||(t[18]=m=>s.alertTagList=m),onChange:t[19]||(t[19]=m=>n.handleCheckItemChange(m,"sailing"))},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.alertOption.sailing,m=>(e.openBlock(),e.createBlock(V,{label:m.name,value:m.weight},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"])])])}const Ue=G(Zl,[["render",Ls],["__scopeId","data-v-4b59a018"]]),jr="",Ss={name:"VoyageSummary",components:{ElProgress:re.ElProgress,ElScrollbar:re.ElScrollbar,AlarmClock:j.AlarmClock},props:{voyage:{type:Object,default:void 0},leg:{type:Object,default:void 0},bps:{type:Object,default:void 0},permission:{type:Number},cpList:{type:Array,default:void 0}},emits:["center"],data(){return{rank:1}},computed:{currentLeg(){var l,t;return(t=(l=this.voyage)==null?void 0:l.legs)==null?void 0:t.find(o=>o.rank===this.rank)},computeLat(){return function(l){return`${C.LngLatHelper.lat2pretty(l,2).pretty}`}},computeLng(){return function(l){return`${C.LngLatHelper.lng2pretty(l,2).pretty}`}},computeWayport(){return function(l){return l!=null&&l.name?`[${l.rank}] ${l==null?void 0:l.name}`:`[${l.rank}] ${C.LngLatHelper.lat2pretty(l==null?void 0:l.lat,2).pretty},${C.LngLatHelper.lng2pretty(l==null?void 0:l.lng,2).pretty}`}},computeLegProgress(){return function(l){return l?(l==null?void 0:l.sailingDistance)/((l==null?void 0:l.sailingDistance)+(l==null?void 0:l.remainDistance))*100:0}},computeLocalTime(){return function(l,t,o="MMM-DD,HHmm[LT]"){if(l){const a=t!=null&&t.lng&&(t!=null&&t.lat)?C.LngLatHelper.guessTimeZoneOffset(t==null?void 0:t.lng,t==null?void 0:t.lat):0;return x(l).utcOffset(a).format(o)}return"-"}},computeUTCTime(){return function(l,t="MMM-DD,HHmm[Z]"){return l?x(l).utc().format(t):"-"}},computeUpdateTime(){return function(l){return x.unix(l).fromNow()}},computeDiffHours(){return function(l){var t;return l?((t=x(l))==null?void 0:t.diff(x()))/(3600*1e3):"-"}},computeTimeOffset(){return function(l){const t=l!=null&&l.lng&&(l!=null&&l.lat)?C.LngLatHelper.guessTimeZoneOffset(l==null?void 0:l.lng,l==null?void 0:l.lat):0;return C.LngLatHelper.prettyTimeZoneOffset(t)}},computeCiiDiscountZ(){return function(l){return C.LngLatHelper.roundPrecision(((l==null?void 0:l.ciiRef)-(l==null?void 0:l.discountCii))/(l==null?void 0:l.ciiRef)*100,0)}},computeRoundPrecision(){return function(l,t=4){return C.LngLatHelper.roundPrecision(l,t)||0}}},mounted(){var l,t,o;this.rank=((o=(t=(l=this.voyage)==null?void 0:l.legs)==null?void 0:t[0])==null?void 0:o.rank)||1},methods:{handleCenter(l){this.$emit("center",l)},toggleLegRight(){var l,t,o,a;this.rank=this.rank+1>((t=(l=this.voyage)==null?void 0:l.legs)==null?void 0:t.length)?(a=(o=this.voyage)==null?void 0:o.legs)==null?void 0:a.length:this.rank+1},toggleLegLeft(){this.rank=this.rank-1<1?1:this.rank-1}}},ws={class:"summary-container"},_s={class:"info-box-item"},Rs={class:"title-box flex-space"},Ts={key:0,style:{"margin-left":"2px"}},Ds={class:"card-box"},Ms={class:"flex-space row-item"},Bs={class:"flex-space row-item"},Os={class:"flex-space"},As={class:"info-box-item"},Hs={class:"title-box flex-space"},Is={key:0,class:"info flex-end"},zs={key:0,class:"card-box active-leg"},Fs={class:"flex-space"},Ps={class:"port-name"},Ws={class:"port-name"},Gs={class:"flex-center line-grogress"},Us={class:"flex-space"},Zs={class:"wayport sailing"},$s={class:"time flex-start"},qs={key:0,style:{"margin-right":"0"}},js={key:1,style:{"margin-right":"0"}},Js={style:{"margin-right":"0"}},Ks={class:"time flex-start"},Xs={key:0},Qs={key:1},Ys={key:0,class:"distance flex-start info"},vs={class:"wayport sailing"},en={class:"time flex-end"},tn={key:0,style:{"margin-right":"0"}},ln={key:1,style:{"margin-right":"0"}},sn={style:{"margin-right":"0"}},nn={class:"time flex-end"},on={key:0},an={key:1},rn={key:0,class:"distance flex-end info"},cn={key:0,class:"flex-center info",style:{"font-size":"14px"}},dn={key:1,class:"card-box active-leg"},hn={class:"info-box-item"},mn={class:"card-box realtime-ais"},pn={class:"flex-space row-item"},gn={class:"flex-space row-item"},fn={class:"flex-space row-item"},yn={class:"cp"},En={style:{flex:"1"}},kn={style:{flex:"1"}},un={style:{flex:"1.4"}},Vn={style:{flex:"1.2"}},Nn={style:{flex:"1"}},bn={class:"info-box-item segs"},xn={key:0,class:"title-box"},Cn={key:1},Ln={class:"flex-space"},Sn={style:{"font-weight":"bold","font-size":"14px"}},wn={class:"cp"},_n={class:"flex-space"},Rn={class:"cp"},Tn={class:"flex-space"},Dn={class:"cii flex-center"},Mn={class:"summary"},Bn={class:"flex-space row"},On={class:"flex"},An={class:"flex"},Hn={class:"flex"},In={class:"flex-space row"},zn={class:"flex"},Fn={class:"flex"},Pn={class:"flex"},Wn={class:"flex-space row"},Gn={class:"flex"},Un={class:"flex"},Zn={class:"flex"},$n={class:"flex-space row"},qn={class:"flex-space row bold"},jn={class:"summary"},Jn={class:"flex-space row"},Kn={class:"flex"},Xn={class:"flex"},Qn={class:"flex"},Yn={class:"flex-space row bold"},vn={class:"flex-space row"},eo={class:"flex"},to={class:"flex"},lo={class:"flex"},so={class:"flex-space row bold"},no={key:2,style:{color:"var(--idm-white-7)","margin-top":"20px"}};function oo(l,t,o,a,s,n){const r=e.resolveComponent("ElDivider"),c=e.resolveComponent("ElProgress"),i=e.resolveComponent("AlarmClock"),h=e.resolveComponent("ElIcon"),p=e.resolveComponent("ElScrollbar");return e.openBlock(),e.createElementBlock("div",ws,[e.createVNode(p,{style:{padding:"10px"}},{default:e.withCtx(()=>{var d,y,u,V,L,f,b,T,m,k,_,N,R,S,D,g,O,H,w,P,z,M,Z,K,X,$,Q,Y,ce,de,he,me,pe,ge,fe,ye,Ee,ke,ue,Ve,Ne,be,xe,Ce,Le,Se,we,_e,Re,Te,De,Me,Be,Oe,Ae,He,Ie,ze,Fe,v,ee,te,le,Qe,Ye,ve,et,tt,lt,st,nt,ot,at,it,rt,ct,dt,ht,mt;return[e.createElementVNode("div",_s,[e.createElementVNode("div",Rs,[t[4]||(t[4]=e.createElementVNode("div",{class:"card-title"},"AIS Info",-1)),e.createElementVNode("div",{class:"info",style:e.normalizeStyle({color:n.computeDiffHours(((u=(y=(d=o.voyage)==null?void 0:d.vessel)==null?void 0:y.ais)==null?void 0:u.positionTime)*1e3)>=-1?"var(--idm-success-color)":"var(--idm-danger-color)"})},[e.createElementVNode("span",null,"Updated at "+e.toDisplayString(n.computeUpdateTime((f=(L=(V=o.voyage)==null?void 0:V.vessel)==null?void 0:L.ais)==null?void 0:f.positionTime)),1),(m=(T=(b=o.voyage)==null?void 0:b.vessel)==null?void 0:T.ais)!=null&&m.mock?(e.openBlock(),e.createElementBlock("span",Ts,"*")):e.createCommentVNode("",!0)],4)]),e.createElementVNode("div",Ds,[e.createElementVNode("div",Ms,[e.createElementVNode("div",null,[t[5]||(t[5]=e.createElementVNode("label",null,"Status",-1)),e.createElementVNode("span",null,e.toDisplayString((N=(_=(k=o.voyage)==null?void 0:k.vessel)==null?void 0:_.ais)==null?void 0:N.labelEn),1)]),e.createElementVNode("div",null,[t[6]||(t[6]=e.createElementVNode("label",null,"Call Sign",-1)),e.createElementVNode("span",null,e.toDisplayString(((S=(R=o.voyage)==null?void 0:R.vessel)==null?void 0:S.callSign)||"-"),1)])]),e.createElementVNode("div",Bs,[e.createElementVNode("div",null,[t[7]||(t[7]=e.createElementVNode("label",null,"Latitude",-1)),e.createElementVNode("span",null,e.toDisplayString(n.computeLat((O=(g=(D=o.voyage)==null?void 0:D.vessel)==null?void 0:g.ais)==null?void 0:O.lat)||"-"),1)]),e.createElementVNode("div",null,[t[8]||(t[8]=e.createElementVNode("label",null,"Longitude",-1)),e.createElementVNode("span",null,e.toDisplayString(n.computeLng((P=(w=(H=o.voyage)==null?void 0:H.vessel)==null?void 0:w.ais)==null?void 0:P.lng)||"-"),1)])]),e.createVNode(r,{style:{margin:"5px 0"}}),e.createElementVNode("div",Os,[e.createElementVNode("div",null,[t[9]||(t[9]=e.createElementVNode("label",null,"SOG",-1)),e.createElementVNode("div",null,e.toDisplayString(n.computeRoundPrecision((Z=(M=(z=o.voyage)==null?void 0:z.vessel)==null?void 0:M.ais)==null?void 0:Z.sog,1))+" kts",1)]),e.createElementVNode("div",null,[t[10]||(t[10]=e.createElementVNode("label",null,"COG",-1)),e.createElementVNode("div",null,e.toDisplayString(n.computeRoundPrecision(($=(X=(K=o.voyage)==null?void 0:K.vessel)==null?void 0:X.ais)==null?void 0:$.cog,0))+" deg",1)]),e.createElementVNode("div",null,[t[11]||(t[11]=e.createElementVNode("label",null,"HDG",-1)),e.createElementVNode("div",null,e.toDisplayString(n.computeRoundPrecision((ce=(Y=(Q=o.voyage)==null?void 0:Q.vessel)==null?void 0:Y.ais)==null?void 0:ce.hdg,0))+" deg",1)]),e.createElementVNode("div",null,[t[12]||(t[12]=e.createElementVNode("label",{style:{"margin-right":"0"}},"Draught",-1)),e.createElementVNode("div",null,e.toDisplayString(n.computeRoundPrecision((me=(he=(de=o.voyage)==null?void 0:de.vessel)==null?void 0:he.ais)==null?void 0:me.draught,1))+" m",1)])])])]),e.createElementVNode("div",As,[e.createElementVNode("div",Hs,[t[15]||(t[15]=e.createElementVNode("div",{class:"card-title"},"Leg Info",-1)),((ge=(pe=o.voyage)==null?void 0:pe.legs)==null?void 0:ge.length)>1?(e.openBlock(),e.createElementBlock("div",Is,[e.createElementVNode("div",{class:e.normalizeClass(s.rank===((ye=(fe=o.voyage)==null?void 0:fe.legs)==null?void 0:ye.length)?"disabled":"active"),onClick:t[0]||(t[0]=(...E)=>n.toggleLegRight&&n.toggleLegRight(...E))},t[13]||(t[13]=[e.createElementVNode("i",{class:"iconfont"},"",-1)]),2),e.createElementVNode("div",{class:e.normalizeClass(s.rank===1?"disabled":"active"),onClick:t[1]||(t[1]=(...E)=>n.toggleLegLeft&&n.toggleLegLeft(...E))},t[14]||(t[14]=[e.createElementVNode("i",{class:"iconfont"},"",-1)]),2)])):e.createCommentVNode("",!0)]),((ke=(Ee=o.voyage)==null?void 0:Ee.legs)==null?void 0:ke.length)>0?(e.openBlock(),e.createElementBlock("div",zs,[e.createElementVNode("div",Fs,[e.createElementVNode("div",{class:"wayport text-ellipsis",onClick:t[2]||(t[2]=E=>{var ie,se,ne,oe;return n.handleCenter({position:[(se=(ie=n.currentLeg)==null?void 0:ie.departure)==null?void 0:se.lng,(oe=(ne=n.currentLeg)==null?void 0:ne.departure)==null?void 0:oe.lat],flyTo:!0})})},[e.createElementVNode("span",Ps,e.toDisplayString(n.computeWayport((ue=n.currentLeg)==null?void 0:ue.departure)),1)]),t[16]||(t[16]=e.createElementVNode("div",{style:{padding:"0 10px"}},"~",-1)),e.createElementVNode("div",{class:"wayport text-ellipsis",style:{"text-align":"right"},onClick:t[3]||(t[3]=E=>{var ie,se,ne,oe;return n.handleCenter({position:[(se=(ie=n.currentLeg)==null?void 0:ie.destination)==null?void 0:se.lng,(oe=(ne=n.currentLeg)==null?void 0:ne.destination)==null?void 0:oe.lat],flyTo:!0})})},[e.createElementVNode("span",Ws,e.toDisplayString(n.computeWayport((Ve=n.currentLeg)==null?void 0:Ve.destination)),1)])]),e.createElementVNode("div",Gs,[e.createVNode(c,{percentage:n.computeLegProgress((Ne=n.currentLeg)==null?void 0:Ne.line),"show-text":!1,style:{width:"100%"},color:"var(--idm-success-color)"},null,8,["percentage"])]),e.createElementVNode("div",Us,[e.createElementVNode("div",Zs,[e.createElementVNode("div",$s,[(be=n.currentLeg)!=null&&be.atd?(e.openBlock(),e.createElementBlock("label",qs,"ATD")):(e.openBlock(),e.createElementBlock("label",js,"ETD")),e.createElementVNode("label",Js,"( UTC "+e.toDisplayString(n.computeTimeOffset((xe=n.currentLeg)==null?void 0:xe.departure))+" )",1)]),e.createElementVNode("div",Ks,[(Ce=n.currentLeg)!=null&&Ce.atd?(e.openBlock(),e.createElementBlock("span",Xs,e.toDisplayString(n.computeLocalTime((Le=n.currentLeg)==null?void 0:Le.atd,(Se=n.currentLeg)==null?void 0:Se.departure)),1)):(e.openBlock(),e.createElementBlock("span",Qs,e.toDisplayString(n.computeLocalTime((we=n.currentLeg)==null?void 0:we.etd,(_e=n.currentLeg)==null?void 0:_e.departure)),1))]),(Re=n.currentLeg)!=null&&Re.line?(e.openBlock(),e.createElementBlock("div",Ys,[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(i)]),_:1}),e.createElementVNode("span",null,e.toDisplayString(n.computeRoundPrecision((De=(Te=n.currentLeg)==null?void 0:Te.line)==null?void 0:De.sailingTime,0))+"hrs",1),t[17]||(t[17]=e.createElementVNode("label",null,"|",-1)),t[18]||(t[18]=e.createElementVNode("i",{class:"iconfont"},"",-1)),e.createElementVNode("span",null,e.toDisplayString(n.computeRoundPrecision((Be=(Me=n.currentLeg)==null?void 0:Me.line)==null?void 0:Be.sailingDistance,0))+"nm",1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",vs,[e.createElementVNode("div",en,[(Oe=n.currentLeg)!=null&&Oe.ata?(e.openBlock(),e.createElementBlock("label",tn,"ATA")):(e.openBlock(),e.createElementBlock("label",ln,"ETA")),e.createElementVNode("label",sn,"( UTC "+e.toDisplayString(n.computeTimeOffset((Ae=n.currentLeg)==null?void 0:Ae.destination))+" )",1)]),e.createElementVNode("div",nn,[(He=n.currentLeg)!=null&&He.ata?(e.openBlock(),e.createElementBlock("span",on,e.toDisplayString(n.computeLocalTime((Ie=n.currentLeg)==null?void 0:Ie.ata,(ze=n.currentLeg)==null?void 0:ze.destination)),1)):(e.openBlock(),e.createElementBlock("span",an,e.toDisplayString(n.computeLocalTime((Fe=n.currentLeg)==null?void 0:Fe.eta,(v=n.currentLeg)==null?void 0:v.destination)),1))]),(ee=n.currentLeg)!=null&&ee.line?(e.openBlock(),e.createElementBlock("div",rn,[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(i)]),_:1}),e.createElementVNode("span",null,e.toDisplayString(n.computeRou