zhihao-ui 1.3.58-alpha.2 → 1.3.58-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -17,7 +17,7 @@ import { Z as x } from "./BaseInfo-CD2tAAod.js";
17
17
  import { Z as b } from "./DetailHeader-DoaD0eKO.js";
18
18
  import { Z as P } from "./DiyDataTable-Bwk_tQDp.js";
19
19
  import { D as $ } from "./DiyDataTable-Bwk_tQDp.js";
20
- import { Z as T } from "./Map-CxCxmeGO.js";
20
+ import { Z as T } from "./Map-DRTbu87h.js";
21
21
  import { Z as c } from "./Table-NT97DzT0.js";
22
22
  import { Z as ro } from "./BaseItem-DcezA7sa.js";
23
23
  import { Z as B } from "./CascaderLoadMore-Bt031LmH.js";
@@ -209,7 +209,7 @@ be.version="2.30.1",d6(It),be.fn=le,be.min=JV,be.max=QV,be.now=e8,be.utc=vi,be.u
209
209
  <path d="M1.99982 46.9998L1.99982 1.99982L46.9998 1.99982L46.9998 46.9998L1.99982 46.9998Z" fill="#FF2424" fill-opacity="0.2"/>
210
210
  <path fill-rule="evenodd" clip-rule="evenodd" d="M19.9998 0.5V3.5L3.49976 3.5V20H0.499756V0.500002L19.9998 0.5ZM45.4998 3.5H28.9998V0.5H48.4998V20H45.4998V3.5ZM48.4998 29L48.4998 48.5H28.9998V45.5H45.4998L45.4998 29H48.4998ZM3.49976 45.5L3.49976 29H0.499756L0.499758 48.5L19.9998 48.5V45.5L3.49976 45.5Z" fill="#FF2424"/>
211
211
  </svg>
212
- `,l=new yt({image:new Lr({src:`data:image/svg+xml;utf8,${encodeURIComponent(a)}`,scale:o,anchorXUnits:"fraction",anchorYUnits:"fraction"})});return Uc.set(n,l),l};function jj(t,e,n,r){if(e){const o=new Qo({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[20,-20],autoPan:!1,position:e,className:r!=null&&r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});o.set("class","zh-map-ship-overlay"),t.addOverlay(o)}}const Hj=(t,e)=>{const{lon:n,lat:r,blinking:o}=e,s=fv(e);n&&r&&jj(t,Nn([n,r]),s,{...e,blinking:o})},fv=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const{lon:n,lat:r,blinking:o,blinkingColors:s,name:a}=t,l=i.createVNode({setup(){return $j({position:[n+.002,r+.002],selected:o,name:a,colors:s||[],existDevice:t==null?void 0:t.existDevice,existMobile:t==null?void 0:t.existMobile,existWaterGauge:t==null?void 0:t.existWaterGauge})}});return i.render(l,e),e},hv=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};function Uj(){const t=["left-top","left-middle","left-bottom","right-top","right-middle","right-bottom"];return t[Math.floor(Math.random()*t.length)]}const Kj=window.devicePixelRatio||1,I0=new Map;let Kc=null,N0=null;function Xj(t,e,n="left-bottom",r=10){const o=`${t}-${e.join(",")}-${n}-${r}`;if(I0.has(o))return I0.get(o);if(!Kc){Kc=document.createElement("canvas");try{N0=Kc.getContext("2d",{willReadFrequently:!0})}catch(D){console.log("e",D),N0=Kc.getContext("2d")}}const s=Kc,a=N0;if(!a)return"";s.width=0,s.height=0;const l=2,c=4,d=16,u=window.devicePixelRatio||1,f="500 12px Arial",h="12px map-iconfont";a.font=f;const p=a.measureText(t).width;a.font=h;const m=e.map(D=>({width:a.measureText(zs(D)).width,height:14})),g=m.reduce((D,L)=>D+L.width,0),b=e.length*r,C=c+p+g+b+c,E=l+14+l*2;let _,w,S=0,v=0,k=0,M=0,R=0,O=0;switch(_=d+C,n){case"right-top":w=d+E,S=0,v=d+E,k=d,M=0,R=d,O=0;break;case"right-middle":w=E,S=0,v=E/2,k=d,M=E/2,R=d,O=0;break;case"right-bottom":w=d+E,S=0,v=0,k=d,M=d,R=d,O=d;break;case"left-top":w=d+E,S=C,v=d,k=C+d,M=E+d,R=0,O=0;break;case"left-middle":w=E,S=C,v=E/2,k=C+d,M=E/2,R=0,O=0;break;case"left-bottom":w=d+E,S=C,v=E,k=C+d,M=0,R=0,O=d;break}w=w+l,s.width=Math.round(_*u),s.height=Math.round(w*u),a.scale(u,u),a.clearRect(0,0,_,w),a.beginPath(),a.moveTo(S,v),a.lineTo(k,M),a.strokeStyle="#FFF",a.lineWidth=1,a.stroke(),a.fillStyle="#FFF",a.fillRect(R,O,C,E),a.font=f,a.textBaseline="middle";const I=O+l/2+E/2;a.strokeStyle="#ffffff",a.lineWidth=1,a.strokeText(t,R+c,I),a.fillStyle="#000000",a.fillText(t,R+c,I),a.font=h,a.fillStyle="#3370ff";let A=R+c+p+r;const B=O+E/2;e.length>0&&e.forEach((D,L)=>{a.fillText(zs(D),A,B),A+=m[L].width+r});const P=s.toDataURL("image/png");return I0.set(o,P),P}const pv=(t,e)=>{const{name:n,rightIcons:r,selected:o}=t.getProperties(),s=e!==1?Uj():"right-top",a=Xj(n,r,s);let l=[0,0];switch(s){case"right-top":l=[0,1];break;case"right-middle":l=[0,.5];break;case"right-bottom":l=[0,0];break;case"left-top":l=[1,1];break;case"left-middle":l=[1,.5];break;case"left-bottom":l=[1,0];break}return new yt({image:new Lr({src:a,anchor:l,displacement:[0,0],scale:1/Kj,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:o?100:10})},Zj=t=>{let e=null,n=null;const r=new Fr,o=new Vj({source:r,className:"zh-map--ship-layer",renderBuffer:300,zIndex:101,properties:{layerType:kn.SHIP}}),s=new Fr,a=new fi({source:s,className:"zh-map--ship-label-layer",zIndex:102,updateWhileInteracting:!1,updateWhileAnimating:!1,properties:{layerType:kn.SHIP},declutter:!0}),l=new Fr,c=new fi({source:l,className:"zh-map--ship-selected-layer",zIndex:999});t==null||t.addLayer(o),t==null||t.addLayer(a),t==null||t.addLayer(c);let d=null,u=null,f=null,h="",y={},p={};const m=T=>{if(!T||!t)return;const x=(n==null?void 0:n.id)||(e==null?void 0:e.get("id"));if(n){const F=T.filter(N=>N.id===x);F.length===0?T.push(n):n=F[0]}w(),P(T),E(),g(T)},g=T=>{Array.from(Hc.keys()).forEach(x=>{const F=x.split("_")[0];T.find(W=>W.id===F)||Hc.delete(x)})},b=()=>{Array.from(Uc.keys()).forEach(T=>{Uc.delete(T)})},C=T=>{var X;const x=(n==null?void 0:n.id)||(e==null?void 0:e.get("id")),F=Nn([T==null?void 0:T.lon,T==null?void 0:T.lat]),N=((X=p[T.id])==null?void 0:X.blinkColors)||[],V=N[N.length-1]||T.fill||"#04C900",$=cv(T),j=new Ft({geometry:new Ht(F),shipData:T,id:T.id,name:T.cnname||T.enname||T.name||T.id||"未命名船舶",selected:T.id===x,rightIcons:hv(T),color:V,direct:$,isHighlight:!1});return j.set("clickGeometry",new Xa(F)),j},E=()=>{if(n&&t&&n){l.getFeatures().length>0&&l.clear();const T=Nn([n==null?void 0:n.lon,n==null?void 0:n.lat]),x=new Ft({geometry:new Ht(T),id:n.id});x.setStyle(uv(t,n)),l.addFeature(x)}},_=()=>{const T=r.getFeatures(),x=100;let F=0;const N=()=>{const $=Math.min(F+x,T.length);for(;F<$;F++){const j=T[F],X=al(t,j);j.setStyle(X)}F<T.length&&requestAnimationFrame(N)};N();const V=l.getFeatures()[0];if(V&&n){const $=uv(t,n);V.setStyle($)}},w=()=>{t&&r&&(S(),r.clear(),s.clear(),l.clear())},S=()=>{const T=t.getOverlays().getArray().filter(x=>x.get("class")=="zh-map-ship-overlay");if(T&&T.length>0)for(let x=0;x<T.length;x++){const F=T[x];F.setPosition(void 0),t.removeOverlay(F),F.dispose()}},v=(T,x)=>{y=T,p=x;const F=t.getOverlays().getArray(),N=r.getFeatures();for(const W in y){const V=y[W],$=F.find(X=>(X==null?void 0:X.getId())==="label-"+W),j=N.find(X=>W===X.get("id"));if($&&j){const X=x[W].blinkColors||[],{shipData:K,name:J,color:se}=j.getProperties();j.set("blinking",V),X[(X==null?void 0:X.length)-1]&&se!==X[(X==null?void 0:X.length)-1]&&(j.set("color",X[(X==null?void 0:X.length)-1]||""),j.setStyle(al(t,j)));const fe={...K,blinking:V,blinkingColors:X||[],name:J+"("+x[W].shipState+")"},_e=$.getElement(),Pe=fv(fe);_e&&_e!==Pe&&$.setElement(Pe)}}},k=T=>{if(!t)return;const x=r.getFeatures(),F=s.getFeatures(),N=e?e.get("id"):"",W=x.filter(X=>X.get("id")!==N),V=F==null?void 0:F.filter(X=>X.get("id")!==N),$=new Map;T.forEach(X=>{$.set(X.id,!0)});const j=t.getOverlays().getArray();W.forEach(X=>{const K=X.get("id");if(!$.has(K))X.setStyle([]);else{const se=X.getStyle();(se==null?void 0:se.length)==0&&X.setStyle(al(t,X))}const J=j.find(se=>se.getId()==="label-"+K);J&&J.setPosition(void 0)}),V.forEach(X=>{const K=X.get("id");if(!$.has(K))X.setStyle([]);else{const J=X.getStyle();(J==null?void 0:J.length)==0&&X.setStyle(pv(X,T.length))}})},M=T=>{if(T){console.log("选中",T);const x=r.getFeatures().find(N=>N.get("id")===T.id),F=s.getFeatures().find(N=>N.get("id")===T.id);x&&(e=x),F&&F.set("selected",!0),n=T,E()}else console.log("取消选中"),n=null,e=null,A(),b()},R=(T,x,F)=>{u=T,f=x,d=F},O=zi((T,x,F)=>{try{if(T){const N=T.get("shipData"),W=T.get("id");if(x==="click"&&(M(N),F&&F(W)),x==="hover"){h&&h!==W&&I(),h=W;const V=r.getFeatures().find($=>$.get("id")===h);V==null||V.set("isHighlight",!0),V==null||V.setStyle(al(t,V))}}else I()}catch(N){console.log("handleShipMapEvent",N)}},10),I=()=>{const T=h?r.getFeatures().find(x=>x.get("id")===h):null;h=null,T==null||T.set("isHighlight",!1),T==null||T.setStyle(al(t,T))},A=()=>{try{l.clear()}catch(T){console.log(T)}},B=(T,x)=>{const F=Nn([T==null?void 0:T.lon,T==null?void 0:T.lat]),N=new Ft({geometry:new Ht(F),name:T.cnname||T.enname||T.name||T.id||"未命名船舶",rightIcons:hv(T),selected:(T==null?void 0:T.id)===(n==null?void 0:n.id),shipData:T});N.set("id",T.id);const W=pv(N,x);return N.setStyle(W),N},P=T=>{const x=t.getView().getZoom(),F=[],N=[];T.forEach(j=>{const X=C(j);X.setStyle(al(t,X)),r.addFeature(X),y[j.id]&&F.push(j),(n==null?void 0:n.id)==j.id&&(n=j),!y[j.id]&&(n==null?void 0:n.id)!==j.id&&N.push(j)}),(f!==null?f:(n==null?void 0:n.id)&&y[n==null?void 0:n.id]||x&&x>=Qn.shipModelMin)&&F.map(j=>{L(j)}),n&&(d!==null?d:!0)&&!y[n==null?void 0:n.id]&&D(n,T),(u!==null?u:x&&x>=Qn.shipModelMin)&&N.map(j=>{D(j,T)})},D=(T,x)=>{const F=B(T,x.length);s.addFeature(F)},L=T=>{if(T.id&&p[T==null?void 0:T.id]){const x=p[T==null?void 0:T.id]||{},F=(x==null?void 0:x.blinkColors)||[],N=(x==null?void 0:x.shipState)||"",W=(T.cnname||T.enname||T.name||T.id||"未命名船舶")+"("+N+")",V={...T,name:W,blinking:y[T.id],blinkingColors:F||[]};Hj(t,V)}};return{render:m,selected:M,filter:k,blinking:v,clear:w,setLableStatus:R,handleShipMapEvent:O,changeShipScale:_}},qj=t=>{const e=()=>t==null?void 0:t.getLayers(),n=i.ref("vector"),r=()=>n.value,o=c=>{n.value=c;const d=e();d&&(d==null||d.getArray().forEach(u=>{(u.className_==="vector"||u.className_==="satellite")&&u.setVisible(u.className_===c)}))},s=i.ref(!1);return{getLayers:e,getGreenTileVisible:()=>s.value,setGreenTileVisible:c=>{if(c!==s.value){if(c){const d=e();if(!d.getArray().find(f=>f.className_==="greenTile")){const f=new rl({source:new sl({url:$s.greenTile}),visible:c,zIndex:2,className:"greenTile"});d.push(f)}}else{const d=e(),u=d.getArray().find(f=>f.className_==="greenTile");u&&d.remove(u)}s.value=c}},getShowLayerType:r,setShowLayerType:o}},Jj=()=>{const t=i.ref();return{setProps:r=>{t.value=r},getProps:()=>t.value}},Qj=t=>{const e="zh-map-location-layer";let n;const r=new Fr;let o=null,s=null;const a=g=>{if(!(!g||g.length===0)){if(r.clear(),s){const b=g.find(C=>C.id===(s==null?void 0:s.id));b?s=b:g.push(s)}g.forEach(b=>{l(b)}),n||(n=new fi({className:e,source:r,zIndex:100}),t==null||t.addLayer(n))}},l=g=>{const b=t==null?void 0:t.getView().getZoom(),[C,E]=g.latLon.split(","),_=new Ft({geometry:new Ht(Nn([Number(C),Number(E)]))});_.setStyle(c(g,b,g.id===(s==null?void 0:s.id))),_.set("loactionData",g),r.addFeature(_)},c=(g,b,C)=>{let E={src:C&&g.selectedPath||g.defaultPath};g!=null&&g.width&&(g!=null&&g.height)?E={...E,width:g.width,height:g.height}:E={...E,scale:.5*b/10};let _={image:new Lr(E)};return g.name&&(_={..._,text:new yo({text:g.name,font:"12px sans-serif",fill:new Jt({color:"#000000"}),backgroundFill:new Jt({color:"#FFFFFF"}),offsetY:30})}),new yt(_)},d=()=>{if(o){const g=o.get("loactionData").id;r.getFeatures().forEach(b=>{b.get("loactionData").id!==g&&r.removeFeature(b)})}else r.clear()},u=()=>{var E;const g=o==null?void 0:o.get("loactionData"),b=(E=t==null?void 0:t.getView())==null?void 0:E.getZoom();r.getFeatures().forEach(_=>{_.get("loactionData").id===g.id&&(_==null||_.setStyle(c(g,b,!1)))}),s=null,o=null},f=g=>{g?(h(),y(g)):u()},h=()=>{var g;if(o){const b=o.get("loactionData"),C=(g=t==null?void 0:t.getView())==null?void 0:g.getZoom();o.setStyle(c(b,C,!1))}},y=g=>{const b=r.getFeatures();s=g,o=b.find(C=>C.get("loactionData").id===g.id)};return{render:a,renderHtml:(g,b,C,E)=>{const _=document.createElement("div");_.innerHTML=C;let w={element:_,positioning:"top-center",stopEvent:!1,offset:[0,-20],id:"position-"+g};E&&(w={...w,...E});const S=new Qo(w);S.setPosition(Nn(b)),t.addOverlay(S)},removeHtml:g=>{const b=t.getOverlays().getArray().find(C=>C.getId()==="position-"+g);b&&(b.setPosition(void 0),t.removeOverlay(b))},selected:f,clearSelected:u,clear:d}},Nf={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Of extends Ri{constructor(e,n){super(e),this.feature=n}}function eH(t,e){const n=[];for(let r=0;r<e.length;++r){const s=e[r].getGeometry();mv(t,s,n)}return n}function Lf(t,e){return co(t[0],t[1],e[0],e[1])}function ll(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function Af(t,e,n){let r,o;e<n?(r=e,o=n):(r=n,o=e);const s=Math.ceil(r),a=Math.floor(o);if(s>a){const c=cl(t,r),d=cl(t,o);return Lf(c,d)}let l=0;if(r<s){const c=cl(t,r),d=ll(t,s);l+=Lf(c,d)}if(a<o){const c=ll(t,a),d=cl(t,o);l+=Lf(c,d)}for(let c=s;c<a-1;++c){const d=ll(t,c),u=ll(t,c+1);l+=Lf(d,u)}return l}function mv(t,e,n){if(e instanceof Kn){Ff(t,e.getCoordinates(),!1,n);return}if(e instanceof zc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)Ff(t,r[o],!1,n);return}if(e instanceof li){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)Ff(t,r[o],!0,n);return}if(e instanceof Yc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o){const a=r[o];for(let l=0,c=a.length;l<c;++l)Ff(t,a[l],!0,n)}return}if(e instanceof Cf){const r=e.getGeometries();for(let o=0;o<r.length;++o)mv(t,r[o],n);return}}const O0={index:-1,endIndex:NaN};function tH(t,e,n,r){const o=t[0],s=t[1];let a=1/0,l=-1,c=NaN;for(let f=0;f<e.targets.length;++f){const h=e.targets[f],y=h.coordinates;let p=1/0,m;for(let g=0;g<y.length-1;++g){const b=y[g],C=y[g+1],E=gv(o,s,b,C);E.squaredDistance<p&&(p=E.squaredDistance,m=g+E.along)}p<a&&(a=p,h.ring&&e.targetIndex===f&&(h.endIndex>h.startIndex?m<h.startIndex&&(m+=y.length):h.endIndex<h.startIndex&&m>h.startIndex&&(m-=y.length)),c=m,l=f)}const d=e.targets[l];let u=d.ring;if(e.targetIndex===l&&u){const f=cl(d.coordinates,c),h=n.getPixelFromCoordinate(f);jE(h,e.startPx)>r&&(u=!1)}if(u){const f=d.coordinates,h=f.length,y=d.startIndex,p=c;if(y<p){const m=Af(f,y,p);Af(f,y,p-h)<m&&(c-=h)}else{const m=Af(f,y,p);Af(f,y,p+h)<m&&(c+=h)}}return O0.index=l,O0.endIndex=c,O0}function Ff(t,e,n,r){const o=t[0],s=t[1];for(let a=0,l=e.length-1;a<l;++a){const c=e[a],d=e[a+1],u=gv(o,s,c,d);if(u.squaredDistance===0){const f=a+u.along;r.push({coordinates:e,ring:n,startIndex:f,endIndex:f});return}}}const L0={along:0,squaredDistance:0};function gv(t,e,n,r){const o=n[0],s=n[1],a=r[0],l=r[1],c=a-o,d=l-s;let u=0,f=o,h=s;return(c!==0||d!==0)&&(u=At(((t-o)*c+(e-s)*d)/(c*c+d*d),0,1),f+=c*u,h+=d*u),L0.along=u,L0.squaredDistance=$u(co(t,e,f,h),10),L0}function cl(t,e){const n=t.length;let r=Math.floor(e);const o=e-r;r>=n?r-=n:r<0&&(r+=n);let s=r+1;s>=n&&(s-=n);const a=t[r],l=a[0],c=a[1],d=t[s],u=d[0]-l,f=d[1]-c;return[l+u*o,c+f*o]}class Bf extends Ja{constructor(e){const n=e;n.stopDown||(n.stopDown=Ta),super(n),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=rH(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:xa,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const o=this.mode_;if(o==="Circle")r=(s,a,l)=>{const c=a||new Xa([NaN,NaN]),d=si(s[0]),u=GE(d,si(s[s.length-1]));return c.setCenterAndRadius(d,Math.sqrt(u),this.geometryLayout_),c};else{let s;o==="Point"?s=Ht:o==="LineString"?s=Kn:o==="Polygon"&&(s=li),r=(a,l,c)=>(l?o==="Polygon"?a[0].length?l.setCoordinates([a[0].concat([a[0][0]])],this.geometryLayout_):l.setCoordinates([],this.geometryLayout_):l.setCoordinates(a,this.geometryLayout_):l=new s(a,this.geometryLayout_),l)}}this.geometryFunction_=r,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new fi({source:new Fr({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:nH(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:y0,this.freehandCondition_,e.freehand?this.freehandCondition_=g0:this.freehandCondition_=e.freehandCondition?e.freehandCondition:B2,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(f0.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=g0:n=e:n=aG,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===$e.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===wt.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===wt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===wt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===wt.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===wt.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===wt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===wt.DBLCLICK&&(r=!1),super.handleEvent(e)&&r}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Eo(wt.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const n=this.getMap(),r=n.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),o=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Km([r,o]),a=this.traceSource_.getFeaturesInExtent(s);if(a.length===0)return;const l=eH(e.coordinate,a);l.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:l,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,o=e.startIndex<=n;r===o?r&&n>e.endIndex||!r&&n<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,n):(r&&n<e.endIndex||!r&&n>e.endIndex)&&this.removeTracedCoordinates_(n,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,n))}removeTracedCoordinates_(e,n){if(e===n)return;let r=0;if(e<n){const o=Math.ceil(e);let s=Math.floor(n);s===n&&(s-=1),r=s-o+1}else{const o=Math.floor(e);let s=Math.ceil(n);s===n&&(s+=1),r=o-s+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const o=[];if(n<r){const s=Math.ceil(n);let a=Math.floor(r);a===r&&(a-=1);for(let l=s;l<=a;++l)o.push(ll(e.coordinates,l))}else{const s=Math.floor(n);let a=Math.ceil(r);a===r&&(a+=1);for(let l=s;l>=a;--l)o.push(ll(e.coordinates,l))}o.length&&this.appendCoordinates(o)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&jE(n.startPx,e.pixel)<this.snapTolerance_)return;const r=tH(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const c=n.targets[n.targetIndex];this.removeTracedCoordinates_(c.startIndex,c.endIndex)}const l=n.targets[r.index];this.addTracedCoordinates_(l,l.startIndex,r.endIndex)}else{const l=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(l,r.endIndex)}n.targetIndex=r.index;const o=n.targets[n.targetIndex];o.endIndex=r.endIndex;const s=cl(o.coordinates,o.endIndex),a=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(a[0]),Math.round(a[1])]}handleUpEvent(e){let n=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const r=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const o=!this.finishCoordinate_;o&&this.startDrawing_(e.coordinate),!o&&this.freehand_?this.finishDrawing():!this.freehand_&&(!o||this.mode_==="Point")&&(this.atFinish_(e.pixel,r)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),n=!1}else this.freehand_&&this.abortDrawing()}return!n&&this.stopClick_&&e.preventDefault(),n}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const n=this.downPx_,r=e.pixel,o=n[0]-r[0],s=n[1]-r[1],a=o*o+s*s;if(this.shouldHandle_=this.freehand_?a>this.squaredClickTolerance_:a<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,n){let r=!1;if(this.sketchFeature_){let o=!1,s=[this.finishCoordinate_];const a=this.mode_;if(a==="Point")r=!0;else if(a==="Circle")r=this.sketchCoords_.length===2;else if(a==="LineString")o=!n&&this.sketchCoords_.length>this.minPoints_;else if(a==="Polygon"){const l=this.sketchCoords_;o=l[0].length>this.minPoints_,s=[l[0][0],l[0][l[0].length-2]],n?s=[l[0][0]]:s=[l[0][0],l[0][l[0].length-2]]}if(o){const l=this.getMap();for(let c=0,d=s.length;c<d;c++){const u=s[c],f=l.getPixelFromCoordinate(u),h=e[0]-f[0],y=e[1]-f[1],p=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(h*h+y*y)<=p,r){this.finishCoordinate_=u;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Ft(new Ht(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Ft);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new Kn(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=wc(this.geometryLayout_);for(;e.length<r;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Ft(new Kn(this.sketchLineCoords_)));const o=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Ft,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(o),this.updateSketchFeatures_(),this.dispatchEvent(new Of(Nf.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),o=n.getView().getProjection(),s=wc(this.geometryLayout_);let a,l;for(;e.length<s;)e.push(0);this.mode_==="Point"?l=this.sketchCoords_:this.mode_==="Polygon"?(a=this.sketchCoords_[0],l=a[a.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(a=this.sketchCoords_,l=a[a.length-1]),l[0]=e[0],l[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,o),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),r.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(r):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();let o,s;const a=this.mode_;return a==="LineString"||a==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),this.geometryFunction_(s,n,r)):a==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),o&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),o?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),o=this.mode_;for(let s=0;s<e;++s){let a;if(o==="LineString"||o==="Circle"){if(a=this.sketchCoords_,a.splice(-2,1),a.length>=2){this.finishCoordinate_=a[a.length-2].slice();const l=this.finishCoordinate_.slice();a[a.length-1]=l,this.createOrUpdateSketchPoint_(l)}this.geometryFunction_(a,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(o==="Polygon"){a=this.sketchCoords_[0],a.splice(-2,1);const l=this.sketchLine_.getGeometry();if(a.length>=2){const c=a[a.length-2].slice();a[a.length-1]=c,this.createOrUpdateSketchPoint_(c)}l.setCoordinates(a),this.geometryFunction_(this.sketchCoords_,n,r)}if(a.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let n=this.sketchCoords_;const r=e.getGeometry(),o=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,o)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,o),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Wc([n])):this.type_==="MultiLineString"?e.setGeometry(new zc([n])):this.type_==="MultiPolygon"&&e.setGeometry(new Yc([n])),this.dispatchEvent(new Of(Nf.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Of(Nf.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let o;if(n==="LineString"||n==="Circle")o=this.sketchCoords_;else if(n==="Polygon")o=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&o.shift(),o.pop();for(let a=0;a<e.length;a++)this.addToDrawing_(e[a]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const o=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=o.slice(),this.sketchCoords_.push(o.slice()),this.sketchPoint_=new Ft(new Ht(o)),this.updateSketchFeatures_(),this.dispatchEvent(new Of(Nf.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const n=this.overlay_.getSource();n.clear(!0),n.addFeatures(e)}updateState_(){const e=this.getMap(),n=this.getActive();(!e||!n)&&this.abortDrawing(),this.overlay_.setMap(n?e:null)}}function nH(){const t=aY();return function(e,n){return t[e.getGeometry().getType()]}}function rH(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}const iH=t=>{t.getInteractions().forEach(e=>{e instanceof Sf&&e.setActive(!1)})},oH=t=>{t.getInteractions().forEach(e=>{e instanceof Sf&&e.setActive(!0)})},ts=(t,e)=>{const n=t.getViewport();n&&(n.style.cursor=e)},sH=(t,e)=>{const n=i.ref([]),r=i.ref("km"),o=M=>{r.value=M};let s,a="close";const l=()=>{ts(t,"crosshair"),u(),iH(t),t.on("pointermove",y),t.getViewport().addEventListener("mouseout",()=>{s&&s.classList.add("hidden")}),m(),a="open"};let c,d;const u=()=>{c=new Fr,d=new fi({source:c,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),t==null||t.addLayer(d)};let f,h;const y=M=>{if(M.dragging)return;let R="点击选择起点";f&&(R="单击继续,双击结束"),s&&(s.innerHTML=R,h.setPosition(M.coordinate),s.classList.remove("hidden"))};let p;const m=()=>{p=new Bf({source:c,type:"LineString",style:new yt({fill:new Jt({color:"rgba(255, 255, 255, 0.2)"}),stroke:new On({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new go({radius:5,stroke:new On({color:"rgba(0, 0, 0, 0.7)"}),fill:new Jt({color:"rgba(255, 255, 255, 0.2)"})})}),condition:R=>R.originalEvent.target.tagName!=="DIV"}),t==null||t.addInteraction(p),E(),_();let M;p.on("drawstart",function(R){var I;f=R.feature,f.set("randomId",g());let O;M=(I=f.getGeometry())==null?void 0:I.on("change",function(A){const B=A.target,P=yv(B,r.value);O=B.getLastCoordinate(),b&&P&&(b.innerHTML=P),C.setPosition(O)})}),p.on("drawend",function(){var R,O,I;if(b&&(b.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),b!=null&&b.innerHTML){const A=(f==null?void 0:f.get("randomId"))||g();n.value.push({id:A,value:b==null?void 0:b.innerHTML}),b.innerHTML=`${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${A}"><i class="map-iconfont icon-delete"></i></div>`}(R=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||R.addEventListener("click",A=>{var P;A.preventDefault(),A.stopPropagation();const B=(P=A.target)==null?void 0:P.getAttribute("data-id");B&&S(B)}),C.setOffset([0,-7]),f=null,b=null,E(),M&&Iu(M),(I=(O=e.getProps())==null?void 0:O.lineDrawEnd)==null||I.call(O,n.value)})},g=()=>Math.random().toString(36).substring(2,9);let b,C;const E=()=>{b!=null&&b.parentNode&&b.parentNode.removeChild(b),b=document.createElement("div"),b.className="ol-tooltip ol-tooltip-measure",C=new Qo({element:b,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(C)},_=()=>{s!=null&&s.parentNode&&(s.parentNode.removeChild(s),s.parentNode.addEventListener("click",M=>{M.preventDefault(),M.stopPropagation()})),s=document.createElement("div"),s.className="ol-tooltip hidden pointer-none",h=new Qo({element:s,offset:[15,0],positioning:"center-left",stopEvent:!0}),t==null||t.addOverlay(h)},w=()=>{n.value.forEach((M,R)=>{var A,B;const O=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");O[R]&&((B=(A=O[R])==null?void 0:A.parentNode)==null||B.removeChild(O[R]));const I=c.getFeatures();I[R]&&c.removeFeature(I[R])}),v(),oH(t),a="close",ts(t,"grab")},S=M=>{var O,I,A,B;const R=n.value.findIndex(P=>P.id===M);if(R!==-1){n.value.splice(R,1);const P=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");P[R]&&((I=(O=P[R])==null?void 0:O.parentNode)==null||I.removeChild(P[R]));const D=c.getFeatures();D[R]&&c.removeFeature(D[R])}(B=(A=e.getProps())==null?void 0:A.lineDrawEnd)==null||B.call(A,n.value)},v=()=>{if(n.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(M=>{var R;(R=M==null?void 0:M.parentNode)==null||R.removeChild(M)}),c==null||c.clear(),p){const M=t.getInteractions().getArray().find(R=>ut(R)===ut(p));M&&t.removeInteraction(M)}t.removeLayer(d),s!=null&&s.parentNode&&s.parentNode.removeChild(s),b!=null&&b.parentNode&&b.parentNode.removeChild(b)};return{open:l,close:w,deleteLine:S,setUnit:o,getState:()=>a}},yv=(t,e)=>{const r=Gu(t);let o="";switch(e){case"m":o=`${Math.round(r*100)/100} m`;break;case"km":o=`${Math.round(r/1e3*100)/100} km`;break;case"nm":o=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return o},aH=(t,e)=>{let n,r,o="close",s="area",a;const l=(O,I)=>{s=O,a=I,M(),o="open",c(),ts(t,"crosshair")},c=()=>{f(),_(),v(),g()};let d=null,u=null;const f=()=>{if(d&&u)return;const O=new Fr,I=new fi({source:O,style:new yt({stroke:new On({color:"#fbcc33",width:2})}),zIndex:1e3});d=I,u=O,t.on("pointermove",y),t.addLayer(I),t.on(["dblclick"],function(A){p&&(A.stopPropagation(),A.preventDefault())})};let h;const y=O=>{if(O.dragging)return;const I=h?"单击继续,双击结束":"点击选择起点";w&&(w.innerHTML=I,S.setPosition(O.coordinate))};let p,m=!1;const g=()=>{if(n){w!=null&&w.parentNode&&w.parentNode.removeChild(w);const I=n.getGeometry();if(!I)return;const A=b(I,"nm");C&&(C.innerHTML=`
212
+ `,l=new yt({image:new Lr({src:`data:image/svg+xml;utf8,${encodeURIComponent(a)}`,scale:o,anchorXUnits:"fraction",anchorYUnits:"fraction"})});return Uc.set(n,l),l};function jj(t,e,n,r){if(e){const o=new Qo({element:n,positioning:"top-left",id:"label-"+(r==null?void 0:r.id),offset:[20,-20],autoPan:!1,position:e,className:r!=null&&r.blinking?"ship-label-overlay-blinking":"ship-label-overlay"});o.set("class","zh-map-ship-overlay"),t.addOverlay(o)}}const Hj=(t,e)=>{const{lon:n,lat:r,blinking:o}=e,s=fv(e);n&&r&&jj(t,Nn([n,r]),s,{...e,blinking:o})},fv=t=>{const e=document.createElement("div");e.className="ship-overlay-box",e.style.position="relative";const{lon:n,lat:r,blinking:o,blinkingColors:s,name:a}=t,l=i.createVNode({setup(){return $j({position:[n+.002,r+.002],selected:o,name:a,colors:s||[],existDevice:t==null?void 0:t.existDevice,existMobile:t==null?void 0:t.existMobile,existWaterGauge:t==null?void 0:t.existWaterGauge})}});return i.render(l,e),e},hv=t=>{const e=[];return t.existDevice&&e.push("&#xe687;"),t.existMobile&&e.push("&#xe688;"),t.existWaterGauge&&e.push("&#xe686;"),e};function Uj(){const t=["left-top","left-middle","left-bottom","right-top","right-middle","right-bottom"];return t[Math.floor(Math.random()*t.length)]}const Kj=window.devicePixelRatio||1,I0=new Map;let Kc=null,N0=null;function Xj(t,e,n="left-bottom",r=10){const o=`${t}-${e.join(",")}-${n}-${r}`;if(I0.has(o))return I0.get(o);if(!Kc){Kc=document.createElement("canvas");try{N0=Kc.getContext("2d",{willReadFrequently:!0})}catch(D){console.log("e",D),N0=Kc.getContext("2d")}}const s=Kc,a=N0;if(!a)return"";s.width=0,s.height=0;const l=2,c=4,d=16,u=window.devicePixelRatio||1,f="500 12px Arial",h="12px map-iconfont";a.font=f;const p=a.measureText(t).width;a.font=h;const m=e.map(D=>({width:a.measureText(zs(D)).width,height:14})),g=m.reduce((D,L)=>D+L.width,0),b=e.length*r,C=c+p+g+b+c,E=l+14+l*2;let _,w,S=0,v=0,k=0,M=0,R=0,O=0;switch(_=d+C,n){case"right-top":w=d+E,S=0,v=d+E,k=d,M=0,R=d,O=0;break;case"right-middle":w=E,S=0,v=E/2,k=d,M=E/2,R=d,O=0;break;case"right-bottom":w=d+E,S=0,v=0,k=d,M=d,R=d,O=d;break;case"left-top":w=d+E,S=C,v=d,k=C+d,M=E+d,R=0,O=0;break;case"left-middle":w=E,S=C,v=E/2,k=C+d,M=E/2,R=0,O=0;break;case"left-bottom":w=d+E,S=C,v=E,k=C+d,M=0,R=0,O=d;break}w=w+l,s.width=Math.round(_*u),s.height=Math.round(w*u),a.scale(u,u),a.clearRect(0,0,_,w),a.beginPath(),a.moveTo(S,v),a.lineTo(k,M),a.strokeStyle="#FFF",a.lineWidth=1,a.stroke(),a.fillStyle="#FFF",a.fillRect(R,O,C,E),a.font=f,a.textBaseline="middle";const I=O+l/2+E/2;a.strokeStyle="#ffffff",a.lineWidth=1,a.strokeText(t,R+c,I),a.fillStyle="#000000",a.fillText(t,R+c,I),a.font=h,a.fillStyle="#3370ff";let A=R+c+p+r;const B=O+E/2;e.length>0&&e.forEach((D,L)=>{a.fillText(zs(D),A,B),A+=m[L].width+r});const P=s.toDataURL("image/png");return I0.set(o,P),P}const pv=(t,e)=>{const{name:n,rightIcons:r,selected:o}=t.getProperties(),s=e!==1?Uj():"right-top",a=Xj(n,r,s);let l=[0,0];switch(s){case"right-top":l=[0,1];break;case"right-middle":l=[0,.5];break;case"right-bottom":l=[0,0];break;case"left-top":l=[1,1];break;case"left-middle":l=[1,.5];break;case"left-bottom":l=[1,0];break}return new yt({image:new Lr({src:a,anchor:l,displacement:[0,0],scale:1/Kj,anchorXUnits:"fraction",anchorYUnits:"fraction"}),zIndex:o?100:10})},Zj=t=>{let e=null,n=null;const r=new Fr,o=new Vj({source:r,className:"zh-map--ship-layer",renderBuffer:300,zIndex:101,properties:{layerType:kn.SHIP}}),s=new Fr,a=new fi({source:s,className:"zh-map--ship-label-layer",zIndex:102,updateWhileInteracting:!1,updateWhileAnimating:!1,properties:{layerType:kn.SHIP},declutter:!0}),l=new Fr,c=new fi({source:l,className:"zh-map--ship-selected-layer",zIndex:999});t==null||t.addLayer(o),t==null||t.addLayer(a),t==null||t.addLayer(c);let d=null,u=null,f=null,h="",y={},p={};const m=T=>{if(!T||!t)return;const x=(n==null?void 0:n.id)||(e==null?void 0:e.get("id"));if(n){const F=T.filter(N=>N.id===x);F.length===0?T.push(n):n=F[0]}w(),P(T),E(),g(T)},g=T=>{Array.from(Hc.keys()).forEach(x=>{const F=x.split("_")[0];T.find(W=>W.id===F)||Hc.delete(x)})},b=()=>{Array.from(Uc.keys()).forEach(T=>{Uc.delete(T)})},C=T=>{var X;const x=(n==null?void 0:n.id)||(e==null?void 0:e.get("id")),F=Nn([T==null?void 0:T.lon,T==null?void 0:T.lat]),N=((X=p[T.id])==null?void 0:X.blinkColors)||[],V=N[N.length-1]||T.fill||"#04C900",$=cv(T),j=new Ft({geometry:new Ht(F),shipData:T,id:T.id,name:T.cnname||T.enname||T.name||T.id||"未命名船舶",selected:T.id===x,rightIcons:hv(T),color:V,direct:$,isHighlight:!1});return j.set("clickGeometry",new Xa(F)),j},E=()=>{if(n&&t&&n){l.getFeatures().length>0&&l.clear();const T=Nn([n==null?void 0:n.lon,n==null?void 0:n.lat]),x=new Ft({geometry:new Ht(T),id:n.id});x.setStyle(uv(t,n)),l.addFeature(x)}},_=()=>{const T=r.getFeatures(),x=100;let F=0;const N=()=>{const $=Math.min(F+x,T.length);for(;F<$;F++){const j=T[F],X=al(t,j);j.setStyle(X)}F<T.length&&requestAnimationFrame(N)};N();const V=l.getFeatures()[0];if(V&&n){const $=uv(t,n);V.setStyle($)}},w=()=>{t&&r&&(S(),r.clear(),s.clear(),l.clear())},S=()=>{const T=t.getOverlays().getArray().filter(x=>x.get("class")=="zh-map-ship-overlay");if(T&&T.length>0)for(let x=0;x<T.length;x++){const F=T[x];F.setPosition(void 0),t.removeOverlay(F),F.dispose()}},v=(T,x)=>{y=T,p=x;const F=t.getOverlays().getArray(),N=r.getFeatures();for(const W in y){const V=y[W],$=F.find(X=>(X==null?void 0:X.getId())==="label-"+W),j=N.find(X=>W===X.get("id"));if($&&j){const X=x[W].blinkColors||[],{shipData:K,name:J,color:se}=j.getProperties();j.set("blinking",V),X[(X==null?void 0:X.length)-1]&&se!==X[(X==null?void 0:X.length)-1]&&(j.set("color",X[(X==null?void 0:X.length)-1]||""),j.setStyle(al(t,j)));const fe={...K,blinking:V,blinkingColors:X||[],name:J+"("+x[W].shipState+")"},_e=$.getElement(),Pe=fv(fe);_e&&_e!==Pe&&$.setElement(Pe)}}},k=T=>{if(!t)return;const x=r.getFeatures(),F=s.getFeatures(),N=e?e.get("id"):"",W=x.filter(X=>X.get("id")!==N),V=F==null?void 0:F.filter(X=>X.get("id")!==N),$=new Map;T.forEach(X=>{$.set(X.id,!0)});const j=t.getOverlays().getArray();W.forEach(X=>{const K=X.get("id");if(!$.has(K))X.setStyle([]);else{const se=X.getStyle();(se==null?void 0:se.length)==0&&X.setStyle(al(t,X))}const J=j.find(se=>se.getId()==="label-"+K);J&&J.setPosition(void 0)}),V.forEach(X=>{const K=X.get("id");if(!$.has(K))X.setStyle([]);else{const J=X.getStyle();(J==null?void 0:J.length)==0&&X.setStyle(pv(X,T.length))}})},M=T=>{if(T){console.log("选中",T);const x=r.getFeatures().find(N=>N.get("id")===T.id),F=s.getFeatures().find(N=>N.get("id")===T.id);x&&(e=x),F&&F.set("selected",!0),n=T,E()}else console.log("取消选中"),n=null,e=null,A(),b()},R=(T,x,F)=>{u=T,f=x,d=F},O=zi((T,x,F)=>{try{if(T){const N=T.get("shipData"),W=T.get("id");if(x==="click"&&(M(N),F&&F(W)),x==="hover"){h&&h!==W&&I(),h=W;const V=r.getFeatures().find($=>$.get("id")===h);V==null||V.set("isHighlight",!0),V==null||V.setStyle(al(t,V))}}else I()}catch(N){console.log("handleShipMapEvent",N)}},10),I=()=>{const T=h?r.getFeatures().find(x=>x.get("id")===h):null;h=null,T==null||T.set("isHighlight",!1),T==null||T.setStyle(al(t,T))},A=()=>{try{l.clear()}catch(T){console.log(T)}},B=(T,x)=>{const F=Nn([T==null?void 0:T.lon,T==null?void 0:T.lat]),N=new Ft({geometry:new Ht(F),name:T.cnname||T.enname||T.name||T.id||"未命名船舶",rightIcons:hv(T),selected:(T==null?void 0:T.id)===(n==null?void 0:n.id),shipData:T});N.set("id",T.id);const W=pv(N,x);return N.setStyle(W),N},P=T=>{const x=t.getView().getZoom(),F=[],N=[];T.forEach(j=>{const X=C(j);X.setStyle(al(t,X)),r.addFeature(X),y[j.id]&&F.push(j),(n==null?void 0:n.id)==j.id&&(n=j),!y[j.id]&&(n==null?void 0:n.id)!==j.id&&N.push(j)}),(f!==null?f:(n==null?void 0:n.id)&&y[n==null?void 0:n.id]||x&&x>=Qn.shipModelMin)&&F.map(j=>{L(j)}),n&&(d!==null?d:!0)&&!y[n==null?void 0:n.id]&&D(n,T),(u!==null?u:x&&x>=Qn.shipModelMin)&&N.map(j=>{D(j,T)})},D=(T,x)=>{const F=B(T,x.length);s.addFeature(F)},L=T=>{if(T.id&&p[T==null?void 0:T.id]){const x=p[T==null?void 0:T.id]||{},F=(x==null?void 0:x.blinkColors)||[],N=(x==null?void 0:x.shipState)||"",W=(T.cnname||T.enname||T.name||T.id||"未命名船舶")+"("+N+")",V={...T,name:W,blinking:y[T.id],blinkingColors:F||[]};Hj(t,V)}};return{render:m,selected:M,filter:k,blinking:v,clear:w,setLableStatus:R,handleShipMapEvent:O,changeShipScale:_}},qj=t=>{const e=()=>t==null?void 0:t.getLayers(),n=i.ref("vector"),r=()=>n.value,o=c=>{n.value=c;const d=e();d&&(d==null||d.getArray().forEach(u=>{(u.className_==="vector"||u.className_==="satellite")&&u.setVisible(u.className_===c)}))},s=i.ref(!1);return{getLayers:e,getGreenTileVisible:()=>s.value,setGreenTileVisible:c=>{if(c!==s.value){if(c){const d=e();if(!d.getArray().find(f=>f.className_==="greenTile")){const f=new rl({source:new sl({url:$s.greenTile}),visible:c,zIndex:2,className:"greenTile"});d.push(f)}}else{const d=e(),u=d.getArray().find(f=>f.className_==="greenTile");u&&d.remove(u)}s.value=c}},getShowLayerType:r,setShowLayerType:o}},Jj=()=>{const t=i.ref();return{setProps:r=>{t.value=r},getProps:()=>t.value}},Qj=t=>{const e="zh-map-location-layer";let n;const r=new Fr;let o=null,s=null;const a=g=>{if(!(!g||g.length===0)){if(r.clear(),s){const b=g.find(C=>C.id===(s==null?void 0:s.id));b?s=b:g.push(s)}g.forEach(b=>{l(b)}),n||(n=new fi({className:e,source:r,zIndex:100}),t==null||t.addLayer(n))}},l=g=>{const b=t==null?void 0:t.getView().getZoom(),[C,E]=g.latLon.split(","),_=new Ft({geometry:new Ht(Nn([Number(C),Number(E)]))});_.setStyle(c(g,b,g.id===(s==null?void 0:s.id))),_.set("loactionData",g),r.addFeature(_)},c=(g,b,C)=>{let E={src:C&&g.selectedPath||g.defaultPath};g!=null&&g.width&&(g!=null&&g.height)?E={...E,width:g.width,height:g.height}:E={...E,scale:.5*b/10};let _={image:new Lr(E)};return g.name&&(_={..._,text:new yo({text:g.name,font:"12px sans-serif",fill:new Jt({color:"#000000"}),backgroundFill:new Jt({color:"#FFFFFF"}),offsetY:30})}),new yt(_)},d=()=>{if(o){const g=o.get("loactionData").id;r.getFeatures().forEach(b=>{b.get("loactionData").id!==g&&r.removeFeature(b)})}else r.clear()},u=()=>{var E;const g=o==null?void 0:o.get("loactionData"),b=(E=t==null?void 0:t.getView())==null?void 0:E.getZoom();r.getFeatures().forEach(_=>{_.get("loactionData").id===g.id&&(_==null||_.setStyle(c(g,b,!1)))}),s=null,o=null},f=g=>{g?(h(),y(g)):u()},h=()=>{var g;if(o){const b=o.get("loactionData"),C=(g=t==null?void 0:t.getView())==null?void 0:g.getZoom();o.setStyle(c(b,C,!1))}},y=g=>{const b=r.getFeatures();s=g,o=b.find(C=>C.get("loactionData").id===g.id)};return{render:a,renderHtml:(g,b,C,E)=>{const _=document.createElement("div");_.innerHTML=C;let w={element:_,positioning:"top-center",stopEvent:!1,offset:[0,-20],id:"position-"+g};E&&(w={...w,...E});const S=new Qo(w);S.setPosition(Nn(b)),t.addOverlay(S)},removeHtml:g=>{const b=t.getOverlays().getArray().find(C=>C.getId()==="position-"+g);b&&(b.setPosition(void 0),t.removeOverlay(b))},selected:f,clearSelected:u,clear:d}},Nf={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Of extends Ri{constructor(e,n){super(e),this.feature=n}}function eH(t,e){const n=[];for(let r=0;r<e.length;++r){const s=e[r].getGeometry();mv(t,s,n)}return n}function Lf(t,e){return co(t[0],t[1],e[0],e[1])}function ll(t,e){const n=t.length;return e<0?t[e+n]:e>=n?t[e-n]:t[e]}function Af(t,e,n){let r,o;e<n?(r=e,o=n):(r=n,o=e);const s=Math.ceil(r),a=Math.floor(o);if(s>a){const c=cl(t,r),d=cl(t,o);return Lf(c,d)}let l=0;if(r<s){const c=cl(t,r),d=ll(t,s);l+=Lf(c,d)}if(a<o){const c=ll(t,a),d=cl(t,o);l+=Lf(c,d)}for(let c=s;c<a-1;++c){const d=ll(t,c),u=ll(t,c+1);l+=Lf(d,u)}return l}function mv(t,e,n){if(e instanceof Kn){Ff(t,e.getCoordinates(),!1,n);return}if(e instanceof zc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)Ff(t,r[o],!1,n);return}if(e instanceof li){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o)Ff(t,r[o],!0,n);return}if(e instanceof Yc){const r=e.getCoordinates();for(let o=0,s=r.length;o<s;++o){const a=r[o];for(let l=0,c=a.length;l<c;++l)Ff(t,a[l],!0,n)}return}if(e instanceof Cf){const r=e.getGeometries();for(let o=0;o<r.length;++o)mv(t,r[o],n);return}}const O0={index:-1,endIndex:NaN};function tH(t,e,n,r){const o=t[0],s=t[1];let a=1/0,l=-1,c=NaN;for(let f=0;f<e.targets.length;++f){const h=e.targets[f],y=h.coordinates;let p=1/0,m;for(let g=0;g<y.length-1;++g){const b=y[g],C=y[g+1],E=gv(o,s,b,C);E.squaredDistance<p&&(p=E.squaredDistance,m=g+E.along)}p<a&&(a=p,h.ring&&e.targetIndex===f&&(h.endIndex>h.startIndex?m<h.startIndex&&(m+=y.length):h.endIndex<h.startIndex&&m>h.startIndex&&(m-=y.length)),c=m,l=f)}const d=e.targets[l];let u=d.ring;if(e.targetIndex===l&&u){const f=cl(d.coordinates,c),h=n.getPixelFromCoordinate(f);jE(h,e.startPx)>r&&(u=!1)}if(u){const f=d.coordinates,h=f.length,y=d.startIndex,p=c;if(y<p){const m=Af(f,y,p);Af(f,y,p-h)<m&&(c-=h)}else{const m=Af(f,y,p);Af(f,y,p+h)<m&&(c+=h)}}return O0.index=l,O0.endIndex=c,O0}function Ff(t,e,n,r){const o=t[0],s=t[1];for(let a=0,l=e.length-1;a<l;++a){const c=e[a],d=e[a+1],u=gv(o,s,c,d);if(u.squaredDistance===0){const f=a+u.along;r.push({coordinates:e,ring:n,startIndex:f,endIndex:f});return}}}const L0={along:0,squaredDistance:0};function gv(t,e,n,r){const o=n[0],s=n[1],a=r[0],l=r[1],c=a-o,d=l-s;let u=0,f=o,h=s;return(c!==0||d!==0)&&(u=At(((t-o)*c+(e-s)*d)/(c*c+d*d),0,1),f+=c*u,h+=d*u),L0.along=u,L0.squaredDistance=$u(co(t,e,f,h),10),L0}function cl(t,e){const n=t.length;let r=Math.floor(e);const o=e-r;r>=n?r-=n:r<0&&(r+=n);let s=r+1;s>=n&&(s-=n);const a=t[r],l=a[0],c=a[1],d=t[s],u=d[0]-l,f=d[1]-c;return[l+u*o,c+f*o]}class Bf extends Ja{constructor(e){const n=e;n.stopDown||(n.stopDown=Ta),super(n),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=rH(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:xa,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let r=e.geometryFunction;if(!r){const o=this.mode_;if(o==="Circle")r=(s,a,l)=>{const c=a||new Xa([NaN,NaN]),d=si(s[0]),u=GE(d,si(s[s.length-1]));return c.setCenterAndRadius(d,Math.sqrt(u),this.geometryLayout_),c};else{let s;o==="Point"?s=Ht:o==="LineString"?s=Kn:o==="Polygon"&&(s=li),r=(a,l,c)=>(l?o==="Polygon"?a[0].length?l.setCoordinates([a[0].concat([a[0][0]])],this.geometryLayout_):l.setCoordinates([],this.geometryLayout_):l.setCoordinates(a,this.geometryLayout_):l=new s(a,this.geometryLayout_),l)}}this.geometryFunction_=r,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new fi({source:new Fr({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:nH(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:y0,this.freehandCondition_,e.freehand?this.freehandCondition_=g0:this.freehandCondition_=e.freehandCondition?e.freehandCondition:B2,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(f0.ACTIVE,this.updateState_)}setTrace(e){let n;e?e===!0?n=g0:n=e:n=aG,this.traceCondition_=n}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===$e.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let n=e.type===wt.POINTERMOVE,r=!0;return!this.freehand_&&this.lastDragTime_&&e.type===wt.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,n=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===wt.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),r=!1):this.freehand_&&e.type===wt.POINTERDOWN?r=!1:n&&this.getPointerCount()<2?(r=e.type===wt.POINTERMOVE,r&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===wt.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===wt.DBLCLICK&&(r=!1),super.handleEvent(e)&&r}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Eo(wt.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const n=this.getMap(),r=n.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),o=n.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=Km([r,o]),a=this.traceSource_.getFeaturesInExtent(s);if(a.length===0)return;const l=eH(e.coordinate,a);l.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:l,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,n){const r=e.startIndex<=e.endIndex,o=e.startIndex<=n;r===o?r&&n>e.endIndex||!r&&n<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,n):(r&&n<e.endIndex||!r&&n>e.endIndex)&&this.removeTracedCoordinates_(n,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,n))}removeTracedCoordinates_(e,n){if(e===n)return;let r=0;if(e<n){const o=Math.ceil(e);let s=Math.floor(n);s===n&&(s-=1),r=s-o+1}else{const o=Math.floor(e);let s=Math.ceil(n);s===n&&(s+=1),r=o-s+1}r>0&&this.removeLastPoints_(r)}addTracedCoordinates_(e,n,r){if(n===r)return;const o=[];if(n<r){const s=Math.ceil(n);let a=Math.floor(r);a===r&&(a-=1);for(let l=s;l<=a;++l)o.push(ll(e.coordinates,l))}else{const s=Math.floor(n);let a=Math.ceil(r);a===r&&(a+=1);for(let l=s;l>=a;--l)o.push(ll(e.coordinates,l))}o.length&&this.appendCoordinates(o)}updateTrace_(e){const n=this.traceState_;if(!n.active||n.targetIndex===-1&&jE(n.startPx,e.pixel)<this.snapTolerance_)return;const r=tH(e.coordinate,n,this.getMap(),this.snapTolerance_);if(n.targetIndex!==r.index){if(n.targetIndex!==-1){const c=n.targets[n.targetIndex];this.removeTracedCoordinates_(c.startIndex,c.endIndex)}const l=n.targets[r.index];this.addTracedCoordinates_(l,l.startIndex,r.endIndex)}else{const l=n.targets[n.targetIndex];this.addOrRemoveTracedCoordinates_(l,r.endIndex)}n.targetIndex=r.index;const o=n.targets[n.targetIndex];o.endIndex=r.endIndex;const s=cl(o.coordinates,o.endIndex),a=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(a[0]),Math.round(a[1])]}handleUpEvent(e){let n=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const r=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const o=!this.finishCoordinate_;o&&this.startDrawing_(e.coordinate),!o&&this.freehand_?this.finishDrawing():!this.freehand_&&(!o||this.mode_==="Point")&&(this.atFinish_(e.pixel,r)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),n=!1}else this.freehand_&&this.abortDrawing()}return!n&&this.stopClick_&&e.preventDefault(),n}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const n=this.downPx_,r=e.pixel,o=n[0]-r[0],s=n[1]-r[1],a=o*o+s*s;if(this.shouldHandle_=this.freehand_?a>this.squaredClickTolerance_:a<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,n){let r=!1;if(this.sketchFeature_){let o=!1,s=[this.finishCoordinate_];const a=this.mode_;if(a==="Point")r=!0;else if(a==="Circle")r=this.sketchCoords_.length===2;else if(a==="LineString")o=!n&&this.sketchCoords_.length>this.minPoints_;else if(a==="Polygon"){const l=this.sketchCoords_;o=l[0].length>this.minPoints_,s=[l[0][0],l[0][l[0].length-2]],n?s=[l[0][0]]:s=[l[0][0],l[0][l[0].length-2]]}if(o){const l=this.getMap();for(let c=0,d=s.length;c<d;c++){const u=s[c],f=l.getPixelFromCoordinate(u),h=e[0]-f[0],y=e[1]-f[1],p=this.freehand_?1:this.snapTolerance_;if(r=Math.sqrt(h*h+y*y)<=p,r){this.finishCoordinate_=u;break}}}}return r}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Ft(new Ht(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Ft);const n=e.getLinearRing(0);let r=this.sketchLine_.getGeometry();r?(r.setFlatCoordinates(n.getLayout(),n.getFlatCoordinates()),r.changed()):(r=new Kn(n.getFlatCoordinates(),n.getLayout()),this.sketchLine_.setGeometry(r))}startDrawing_(e){const n=this.getMap().getView().getProjection(),r=wc(this.geometryLayout_);for(;e.length<r;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Ft(new Kn(this.sketchLineCoords_)));const o=this.geometryFunction_(this.sketchCoords_,void 0,n);this.sketchFeature_=new Ft,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(o),this.updateSketchFeatures_(),this.dispatchEvent(new Of(Nf.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const n=this.getMap(),r=this.sketchFeature_.getGeometry(),o=n.getView().getProjection(),s=wc(this.geometryLayout_);let a,l;for(;e.length<s;)e.push(0);this.mode_==="Point"?l=this.sketchCoords_:this.mode_==="Polygon"?(a=this.sketchCoords_[0],l=a[a.length-1],this.atFinish_(n.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(a=this.sketchCoords_,l=a[a.length-1]),l[0]=e[0],l[1]=e[1],this.geometryFunction_(this.sketchCoords_,r,o),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),r.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(r):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection();let o,s;const a=this.mode_;return a==="LineString"||a==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),this.geometryFunction_(s,n,r)):a==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():o=!0),s.push(e.slice()),o&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),o?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const n=this.sketchFeature_.getGeometry(),r=this.getMap().getView().getProjection(),o=this.mode_;for(let s=0;s<e;++s){let a;if(o==="LineString"||o==="Circle"){if(a=this.sketchCoords_,a.splice(-2,1),a.length>=2){this.finishCoordinate_=a[a.length-2].slice();const l=this.finishCoordinate_.slice();a[a.length-1]=l,this.createOrUpdateSketchPoint_(l)}this.geometryFunction_(a,n,r),n.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(n)}else if(o==="Polygon"){a=this.sketchCoords_[0],a.splice(-2,1);const l=this.sketchLine_.getGeometry();if(a.length>=2){const c=a[a.length-2].slice();a[a.length-1]=c,this.createOrUpdateSketchPoint_(c)}l.setCoordinates(a),this.geometryFunction_(this.sketchCoords_,n,r)}if(a.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let n=this.sketchCoords_;const r=e.getGeometry(),o=this.getMap().getView().getProjection();return this.mode_==="LineString"?(n.pop(),this.geometryFunction_(n,r,o)):this.mode_==="Polygon"&&(n[0].pop(),this.geometryFunction_(n,r,o),n=r.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Wc([n])):this.type_==="MultiLineString"?e.setGeometry(new zc([n])):this.type_==="MultiPolygon"&&e.setGeometry(new Yc([n])),this.dispatchEvent(new Of(Nf.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Of(Nf.DRAWABORT,e))}appendCoordinates(e){const n=this.mode_,r=!this.sketchFeature_;r&&this.startDrawing_(e[0]);let o;if(n==="LineString"||n==="Circle")o=this.sketchCoords_;else if(n==="Polygon")o=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;r&&o.shift(),o.pop();for(let a=0;a<e.length;a++)this.addToDrawing_(e[a]);const s=e[e.length-1];this.sketchFeature_=this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const r=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=r.getCoordinates();const o=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=o.slice(),this.sketchCoords_.push(o.slice()),this.sketchPoint_=new Ft(new Ht(o)),this.updateSketchFeatures_(),this.dispatchEvent(new Of(Nf.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const n=this.overlay_.getSource();n.clear(!0),n.addFeatures(e)}updateState_(){const e=this.getMap(),n=this.getActive();(!e||!n)&&this.abortDrawing(),this.overlay_.setMap(n?e:null)}}function nH(){const t=aY();return function(e,n){return t[e.getGeometry().getType()]}}function rH(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}const iH=t=>{t.getInteractions().forEach(e=>{e instanceof Sf&&e.setActive(!1)})},oH=t=>{t.getInteractions().forEach(e=>{e instanceof Sf&&e.setActive(!0)})},ts=(t,e)=>{const n=t.getViewport();n&&(n.style.cursor=e)},sH=(t,e)=>{const n=i.ref([]),r=i.ref("km"),o=M=>{r.value=M};let s,a="close";const l=()=>{ts(t,"crosshair"),u(),iH(t),t.on("pointermove",y),t.getViewport().addEventListener("mouseout",()=>{s&&s.classList.add("hidden")}),m(),a="open"};let c,d;const u=()=>{c=new Fr,d=new fi({source:c,zIndex:1e3,style:{"fill-color":"rgba(255, 255, 255, 0.2)","stroke-color":"#ffcc33","stroke-width":2,"circle-radius":7,"circle-fill-color":"#ffcc33"}}),t==null||t.addLayer(d)};let f,h;const y=M=>{if(M.dragging)return;let R="点击选择起点";f&&(R="单击继续,双击结束"),s&&(s.innerHTML=R,h.setPosition(M.coordinate),s.classList.remove("hidden"))};let p;const m=()=>{p=new Bf({source:c,type:"LineString",style:new yt({fill:new Jt({color:"rgba(255, 255, 255, 0.2)"}),stroke:new On({color:"rgba(255,204,51)",lineDash:[10,10],width:2}),image:new go({radius:5,stroke:new On({color:"rgba(0, 0, 0, 0.7)"}),fill:new Jt({color:"rgba(255, 255, 255, 0.2)"})})}),condition:R=>R.originalEvent.target.className!=="ol-tooltip-measure"}),t==null||t.addInteraction(p),E(),_();let M;p.on("drawstart",function(R){var I;f=R.feature,f.set("randomId",g());let O;M=(I=f.getGeometry())==null?void 0:I.on("change",function(A){const B=A.target,P=yv(B,r.value);O=B.getLastCoordinate(),b&&P&&(b.innerHTML=P),C.setPosition(O)})}),p.on("drawend",function(){var R,O,I;if(b&&(b.className="ol-tooltip ol-tooltip-static ol-tooltip-measure"),b!=null&&b.innerHTML){const A=(f==null?void 0:f.get("randomId"))||g();n.value.push({id:A,value:b==null?void 0:b.innerHTML}),b.innerHTML=`${b.innerHTML}<div class="ol-tooltip-delete-button" data-id="${A}"><i class="map-iconfont icon-delete"></i></div>`}(R=document.querySelector(".ol-selectable:has(.ol-tooltip-delete-button):last-child .ol-tooltip-delete-button"))==null||R.addEventListener("click",A=>{var P;A.preventDefault(),A.stopPropagation();const B=(P=A.target)==null?void 0:P.getAttribute("data-id");B&&S(B)}),C.setOffset([0,-7]),f=null,b=null,E(),M&&Iu(M),(I=(O=e.getProps())==null?void 0:O.lineDrawEnd)==null||I.call(O,n.value)})},g=()=>Math.random().toString(36).substring(2,9);let b,C;const E=()=>{b!=null&&b.parentNode&&b.parentNode.removeChild(b),b=document.createElement("div"),b.className="ol-tooltip ol-tooltip-measure",C=new Qo({element:b,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(C)},_=()=>{s!=null&&s.parentNode&&s.parentNode.removeChild(s),s=document.createElement("div"),s.className="ol-tooltip hidden",h=new Qo({element:s,offset:[15,0],positioning:"center-left",stopEvent:!1}),t==null||t.addOverlay(h)},w=()=>{n.value.forEach((M,R)=>{var A,B;const O=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");O[R]&&((B=(A=O[R])==null?void 0:A.parentNode)==null||B.removeChild(O[R]));const I=c.getFeatures();I[R]&&c.removeFeature(I[R])}),v(),oH(t),a="close",ts(t,"grab")},S=M=>{var O,I,A,B;const R=n.value.findIndex(P=>P.id===M);if(R!==-1){n.value.splice(R,1);const P=document.querySelectorAll(".ol-tooltip.ol-tooltip-static.ol-tooltip-measure");P[R]&&((I=(O=P[R])==null?void 0:O.parentNode)==null||I.removeChild(P[R]));const D=c.getFeatures();D[R]&&c.removeFeature(D[R])}(B=(A=e.getProps())==null?void 0:A.lineDrawEnd)==null||B.call(A,n.value)},v=()=>{if(n.value=[],document.querySelectorAll(".ol-tooltip.ol-tooltip-static").forEach(M=>{var R;(R=M==null?void 0:M.parentNode)==null||R.removeChild(M)}),c==null||c.clear(),p){const M=t.getInteractions().getArray().find(R=>ut(R)===ut(p));M&&t.removeInteraction(M)}t.removeLayer(d),s!=null&&s.parentNode&&s.parentNode.removeChild(s),b!=null&&b.parentNode&&b.parentNode.removeChild(b)};return{open:l,close:w,deleteLine:S,setUnit:o,getState:()=>a}},yv=(t,e)=>{const r=Gu(t);let o="";switch(e){case"m":o=`${Math.round(r*100)/100} m`;break;case"km":o=`${Math.round(r/1e3*100)/100} km`;break;case"nm":o=(Math.round(r/1e3*100)/100/1.852).toFixed(2)+" nm";break}return o},aH=(t,e)=>{let n,r,o="close",s="area",a;const l=(O,I)=>{s=O,a=I,M(),o="open",c(),ts(t,"crosshair")},c=()=>{f(),_(),v(),g()};let d=null,u=null;const f=()=>{if(d&&u)return;const O=new Fr,I=new fi({source:O,style:new yt({stroke:new On({color:"#fbcc33",width:2})}),zIndex:1e3});d=I,u=O,t.on("pointermove",y),t.addLayer(I),t.on(["dblclick"],function(A){p&&(A.stopPropagation(),A.preventDefault())})};let h;const y=O=>{if(O.dragging)return;const I=h?"单击继续,双击结束":"点击选择起点";w&&(w.innerHTML=I,S.setPosition(O.coordinate))};let p,m=!1;const g=()=>{if(n){w!=null&&w.parentNode&&w.parentNode.removeChild(w);const I=n.getGeometry();if(!I)return;const A=b(I,"nm");C&&(C.innerHTML=`
213
213
  <span class="text">面积:${A}${m?'<span class="error pl-12">超出可以绘画的距离</span>':""}</span>
214
214
  `),C&&(C.innerHTML+='<span class="delete-icon" ><i class="map-iconfont icon-delete" /></div>');const B=I.getCoordinates(),P=B[0][B[0].length-2];if(E.setPosition(P),d){const L=d.getSource();L&&n&&(L.clear(),L.addFeature(n))}setTimeout(()=>{var L;(L=document.querySelector(".delete-icon"))==null||L.addEventListener("click",()=>{var T,x;k(),(x=(T=e.getProps())==null?void 0:T.areaDrawEnd)==null||x.call(T,[])})},0);const D=ao(n.getGeometry().getExtent());t==null||t.getView().setCenter(D);return}const O={type:"Polygon",trace:!0,style:[new yt({stroke:new On({color:"rgba(255, 255, 255, 1)",width:1.5,lineDash:[10,10]}),fill:new Jt({color:"rgba(255, 255, 255, 0.25)"})}),new yt({image:new go({radius:5,fill:new Jt({color:"rgb(51,112,255, 1)"})}),geometry:function(I){const A=I.getGeometry().getCoordinates();return new Wc(A)}})]};s!=="fence"&&(O.source=u),p=new Bf(O),t==null||t.addInteraction(p),p.on("drawstart",I=>{var A;h=I.feature,r=(A=h.getGeometry())==null?void 0:A.on("change",B=>{const P=B.target,D=b(P,"nm"),T=P.getCoordinates()[0],x=new Kn([T[T.length-2],T[T.length-1]]),F=yv(x,"nm");if(m=Number(Gu(x)/1e3)>150,!D)return;const N='<span class="error pl-4">超出可以绘画的距离</span>';C&&(C.innerHTML=`
215
215
  <div class="text">
@@ -227,7 +227,7 @@ be.version="2.30.1",d6(It),be.fn=le,be.min=JV,be.max=QV,be.now=e8,be.utc=vi,be.u
227
227
  <div>
228
228
  <span class="text">单击继续,双击结束</span>
229
229
  </div>
230
- `)})}),p.on("drawend",I=>{var F,N,W,V;const A=I.feature.getGeometry();if(!A)return;const D=A.getCoordinates()[0].map($=>sS($)).map($=>({lng:$[0],lat:$[1]}));if(s==="fence")return console.log("polygonPoints--------------",D),a&&a(D),D;C&&!n&&(C.innerHTML+='<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'),n=I.feature,E.setOffset([10,0]);const T=I.feature.getGeometry().getCoordinates(),x=T[0][T[0].length-2];if(E.setPosition(x),w!=null&&w.parentNode&&w.parentNode.removeChild(w),(F=e.getProps())!=null&&F.areaDrawEnd){const $=T[0].map(j=>uo(j,er.mercator,er.data));(W=(N=e.getProps())==null?void 0:N.areaDrawEnd)==null||W.call(N,$)}p&&(p.setActive(!1),t==null||t.removeInteraction(p),(t==null?void 0:t.getInteractions()).forEach(j=>{j instanceof Bf&&(j.setActive(!1),t==null||t.removeInteraction(j))})),r&&Iu(r),(V=document.querySelector(".delete-icon"))==null||V.addEventListener("click",()=>{var $,j;k(),(j=($=e.getProps())==null?void 0:$.areaDrawEnd)==null||j.call($,[])})})},b=(O,I)=>{const A=UE(O);switch(I){case"km":return A>1e4?Math.round(A/1e6*100)/100+" km<sup>2</sup>":Math.round(A*100)/100+" m<sup>2</sup>";case"nm":{if(A<.01)return"0 nm<sup>2</sup>";const B=A/(1852*1852);return B>=.01?Math.round(B*100,2)/100+" nm<sup>2</sup>":A>=1?Math.round(A*100,2)/100+" m<sup>2</sup>":Math.round(A*1e4,2)/100+" cm<sup>2</sup>"}}};let C,E;const _=()=>{C!=null&&C.parentNode&&C.parentNode.removeChild(C),C=document.createElement("div"),C.style.display="flex",C.className="ol-tooltip ol-tooltip-draw-polygon",E=new Qo({element:C,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(E)};let w,S;const v=()=>{w!=null&&w.parentNode&&(w.parentNode.removeChild(w),w.parentNode.addEventListener("click",O=>{O.preventDefault(),O.stopPropagation()})),w=document.createElement("div"),w.className="ol-tooltip ol-help-tooltip pointer-none",S=new Qo({element:w,offset:[15,0],positioning:"center-left",stopEvent:!0}),t==null||t.addOverlay(S)},k=()=>{n=null,l()},M=()=>{o="close",t.un("pointermove",y),h=null,p&&(p.abortDrawing(),console.log("abortDrawing"),p.setActive(!1),(t==null?void 0:t.getInteractions()).forEach(I=>{I instanceof Bf&&(I.setActive(!1),t==null||t.removeInteraction(I))}),p=null),r&&Iu(r),r=void 0,u==null||u.clear(),u=null,d&&t.getAllLayers().includes(d)&&(t.removeLayer(d),d=null),w!=null&&w.parentElement&&(w.innerHTML="",w.parentElement.removeChild(w),w=null),C!=null&&C.parentElement&&(C.innerHTML="",C.parentElement.removeChild(C),C=null),S&&t.removeOverlay(S),E&&t.removeOverlay(E),ts(t,"grab")};return{open:l,close:M,reset:k,getState:()=>o}},lH="zh-map-port-layer",cH=t=>{const e=new Fr,n=new fi({className:lH,source:e,zIndex:100,updateWhileInteracting:!0,updateWhileAnimating:!0,properties:{layerType:kn.PORT}});t==null||t.addLayer(n);let r=null,o=null;const s=(g,b=!0)=>{if(!g||g.length===0)return;if(e.clear(),o){const E=g.find(_=>_.id===(o==null?void 0:o.id));E?o=E:g.push(o)}const C=[];g.forEach(E=>{const[_,w]=E.latLon.split(","),S=new Ft({geometry:new Ht(Nn([Number(_),Number(w)])),portData:E,id:E.id,select:E.id===(o==null?void 0:o.id),showTitle:E.id===(o==null?void 0:o.id)||b}),v=u(S);S.setStyle(v),C.push(S)}),e.addFeatures(C)};let a=null,l=null;const c=new Map,d=(g,b)=>{a||(a=document.createElement("canvas"),l=a.getContext("2d",{willReadFrequently:!0}));const C=`${g}-${b}`;if(c.has(C))return c.get(C);const E=a,_=l;if(!_)return"";E.width=0,E.height=0;const w=2,S=8,v=window.devicePixelRatio||1,k="12px sans-serif";_.font=k;const R=_.measureText(g).width,O=S+R+S,I=w+12+w*2;E.width=Math.round(O*v),E.height=Math.round(I*v),_.scale(v,v),_.clearRect(0,0,O,I),_.fillStyle=b?"#F32D2D":"#FFF",_.beginPath(),_.roundRect(0,0,O,I,4),_.fill(),_.font=k,_.textBaseline="middle";const A=I/2;_.strokeStyle=b?"#000":"#ffffff",_.lineWidth=1,_.strokeText(g,S,A),_.fillStyle=b?"#FFF":"#000000",_.fillText(g,S,A);const B=E.toDataURL("image/png");return c.set(C,B),B},u=g=>{const{select:b,showTitle:C}=g.getProperties(),E=R=>`<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
230
+ `)})}),p.on("drawend",I=>{var F,N,W,V;const A=I.feature.getGeometry();if(!A)return;const D=A.getCoordinates()[0].map($=>sS($)).map($=>({lng:$[0],lat:$[1]}));if(s==="fence")return console.log("polygonPoints--------------",D),a&&a(D),D;C&&!n&&(C.innerHTML+='<span class="delete-icon"><i class="map-iconfont icon-delete" /></div>'),n=I.feature,E.setOffset([10,0]);const T=I.feature.getGeometry().getCoordinates(),x=T[0][T[0].length-2];if(E.setPosition(x),w!=null&&w.parentNode&&w.parentNode.removeChild(w),(F=e.getProps())!=null&&F.areaDrawEnd){const $=T[0].map(j=>uo(j,er.mercator,er.data));(W=(N=e.getProps())==null?void 0:N.areaDrawEnd)==null||W.call(N,$)}p&&(p.setActive(!1),t==null||t.removeInteraction(p),(t==null?void 0:t.getInteractions()).forEach(j=>{j instanceof Bf&&(j.setActive(!1),t==null||t.removeInteraction(j))})),r&&Iu(r),(V=document.querySelector(".delete-icon"))==null||V.addEventListener("click",()=>{var $,j;k(),(j=($=e.getProps())==null?void 0:$.areaDrawEnd)==null||j.call($,[])})})},b=(O,I)=>{const A=UE(O);switch(I){case"km":return A>1e4?Math.round(A/1e6*100)/100+" km<sup>2</sup>":Math.round(A*100)/100+" m<sup>2</sup>";case"nm":{if(A<.01)return"0 nm<sup>2</sup>";const B=A/(1852*1852);return B>=.01?Math.round(B*100,2)/100+" nm<sup>2</sup>":A>=1?Math.round(A*100,2)/100+" m<sup>2</sup>":Math.round(A*1e4,2)/100+" cm<sup>2</sup>"}}};let C,E;const _=()=>{C!=null&&C.parentNode&&C.parentNode.removeChild(C),C=document.createElement("div"),C.style.display="flex",C.className="ol-tooltip ol-tooltip-draw-polygon",E=new Qo({element:C,offset:[0,-15],positioning:"bottom-center",stopEvent:!1,insertFirst:!1}),t==null||t.addOverlay(E)};let w,S;const v=()=>{w!=null&&w.parentNode&&(w.parentNode.removeChild(w),w.parentNode.addEventListener("click",O=>{O.preventDefault(),O.stopPropagation()})),w=document.createElement("div"),w.className="ol-tooltip ol-help-tooltip pointer-none",S=new Qo({element:w,offset:[15,0],positioning:"center-left",stopEvent:!1}),t==null||t.addOverlay(S)},k=()=>{n=null,l()},M=()=>{o="close",t.un("pointermove",y),h=null,p&&(p.abortDrawing(),console.log("abortDrawing"),p.setActive(!1),(t==null?void 0:t.getInteractions()).forEach(I=>{I instanceof Bf&&(I.setActive(!1),t==null||t.removeInteraction(I))}),p=null),r&&Iu(r),r=void 0,u==null||u.clear(),u=null,d&&t.getAllLayers().includes(d)&&(t.removeLayer(d),d=null),w!=null&&w.parentElement&&(w.innerHTML="",w.parentElement.removeChild(w),w=null),C!=null&&C.parentElement&&(C.innerHTML="",C.parentElement.removeChild(C),C=null),S&&t.removeOverlay(S),E&&t.removeOverlay(E),ts(t,"grab")};return{open:l,close:M,reset:k,getState:()=>o}},lH="zh-map-port-layer",cH=t=>{const e=new Fr,n=new fi({className:lH,source:e,zIndex:100,updateWhileInteracting:!0,updateWhileAnimating:!0,properties:{layerType:kn.PORT}});t==null||t.addLayer(n);let r=null,o=null;const s=(g,b=!0)=>{if(!g||g.length===0)return;if(e.clear(),o){const E=g.find(_=>_.id===(o==null?void 0:o.id));E?o=E:g.push(o)}const C=[];g.forEach(E=>{const[_,w]=E.latLon.split(","),S=new Ft({geometry:new Ht(Nn([Number(_),Number(w)])),portData:E,id:E.id,select:E.id===(o==null?void 0:o.id),showTitle:E.id===(o==null?void 0:o.id)||b}),v=u(S);S.setStyle(v),C.push(S)}),e.addFeatures(C)};let a=null,l=null;const c=new Map,d=(g,b)=>{a||(a=document.createElement("canvas"),l=a.getContext("2d",{willReadFrequently:!0}));const C=`${g}-${b}`;if(c.has(C))return c.get(C);const E=a,_=l;if(!_)return"";E.width=0,E.height=0;const w=2,S=8,v=window.devicePixelRatio||1,k="12px sans-serif";_.font=k;const R=_.measureText(g).width,O=S+R+S,I=w+12+w*2;E.width=Math.round(O*v),E.height=Math.round(I*v),_.scale(v,v),_.clearRect(0,0,O,I),_.fillStyle=b?"#F32D2D":"#FFF",_.beginPath(),_.roundRect(0,0,O,I,4),_.fill(),_.font=k,_.textBaseline="middle";const A=I/2;_.strokeStyle=b?"#000":"#ffffff",_.lineWidth=1,_.strokeText(g,S,A),_.fillStyle=b?"#FFF":"#000000",_.fillText(g,S,A);const B=E.toDataURL("image/png");return c.set(C,B),B},u=g=>{const{select:b,showTitle:C}=g.getProperties(),E=R=>`<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
231
231
  <path fill-rule="evenodd" clip-rule="evenodd" d="M22.6563 44.9304C22.5453 44.8844 22.4445 44.817 22.3595 44.7321C22.3595 44.7321 9.36986 31.7424 9.32952 31.6913C7.09059 29.0791 5.64794 25.8802 5.17255 22.4736C4.69716 19.0671 5.20896 15.5957 6.64728 12.471C8.08561 9.34625 10.3902 6.69909 13.2878 4.84325C16.1855 2.98741 19.5548 2.00068 22.9965 2C26.4381 1.99932 29.8078 2.98473 32.7062 4.83943C35.6046 6.69414 37.9102 9.34039 39.3498 12.4646C40.7893 15.5888 41.3025 19.0599 40.8284 22.4666C40.3544 25.8734 38.913 29.0729 36.6751 31.686C36.6401 31.737 23.6531 44.7321 23.6531 44.7321C23.5682 44.817 23.4674 44.8844 23.3564 44.9304C23.2454 44.9763 23.1265 45 23.0063 45C22.8862 45 22.7673 44.9763 22.6563 44.9304Z" fill="${R}"/>
232
232
  <g clip-path="url(#clip0_10059_122082)">
233
233
  <path d="M34.8624 22.8687L32.5874 25.6313L33.4812 25.7125C33.4812 25.7125 30.5562 28.0687 27.9562 28.2312C25.3562 28.3937 24.1374 24.9 24.1374 24.9V19.1312H27.6312V17.425H24.2999V15.15C25.7624 14.6625 26.7374 13.2812 26.7374 11.6562C26.7374 9.625 25.1124 8 23.0812 8H22.9999C20.9687 8 19.3437 9.625 19.3437 11.6562C19.3437 13.2812 20.3999 14.6625 21.7812 15.15V17.425H18.4499V19.1312H21.9437V24.9C21.9437 24.9 20.6437 28.3125 18.0437 28.2312C15.4437 28.0687 12.5187 25.7125 12.5187 25.7125L13.4124 25.6313L11.0562 22.8687L10.2437 26.2812L11.2187 26.0375C11.2187 26.0375 13.1687 29.5313 16.1749 30.8313C19.1812 32.2125 22.1874 33.9187 22.8374 34C23.4874 33.9187 26.4937 32.2125 29.4187 30.8313C32.3437 29.45 34.3749 26.0375 34.3749 26.0375L35.3499 26.2812L34.8624 22.8687ZM23.0812 13.6875C21.9437 13.6875 21.0499 12.7937 21.0499 11.6562C21.0499 10.6 21.9437 9.70625 22.9999 9.70625H23.0812C24.1374 9.70625 25.0312 10.6 25.0312 11.6562C25.1124 12.7937 24.1374 13.6875 23.0812 13.6875Z" fill="white"/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zhihao-ui",
3
- "version": "1.3.58-alpha.2",
3
+ "version": "1.3.58-alpha.3",
4
4
  "description": "components",
5
5
  "type": "module",
6
6
  "main": "./dist/umd/index.umd.cjs",