@earthview/core 0.2.6 → 0.2.7

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/index.d.ts CHANGED
@@ -665,6 +665,7 @@ export declare class MarkerLayer extends BaseLayer {
665
665
  removeMarker(id: string): void;
666
666
  updateMarker(id: string, data: Partial<MarkerLayerData>): Promise<void>;
667
667
  private showPopup;
668
+ private updatePopupPosition;
668
669
  private escapeHtml;
669
670
  private hidePopup;
670
671
  clearAllMarkers(): void;
@@ -673,7 +674,6 @@ export declare class MarkerLayer extends BaseLayer {
673
674
  updateData(data: {
674
675
  markers: MarkerLayerData[];
675
676
  }): void;
676
- private updatePopupPosition;
677
677
  destroy(): void;
678
678
  }
679
679
 
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@
29
29
  padding: 8px 12px;
30
30
  border-bottom: 1px solid ${t?"#3d3d3d":"#eee"};
31
31
  background: ${t?"#252525":"#f5f5f5"};
32
+ user-select: none;
32
33
  `;const i=document.createElement("span");return i.style.cssText=`
33
34
  color: ${t?"#fff":"#333"};
34
35
  font-size: 12px;
@@ -846,9 +847,9 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
846
847
  </div>
847
848
  </foreignObject>
848
849
  </svg>
849
- `;return new Promise(f=>{const g=new Image;g.onload=()=>{d.getContext("2d")?.drawImage(g,0,0),f(new A({image:new Vi({img:d,size:[h,c]})})),URL.revokeObjectURL(g.src)},g.src=URL.createObjectURL(new Blob([u],{type:"image/svg+xml"}))})}async addMarker(t){const e=new V({geometry:new rt(ut([t.longitude,t.latitude])),id:t.id,name:t.name||"Marker",bubbleBoxTitle:t.bubbleBoxTitle,bubbleBoxDescription:t.bubbleBoxDescription,bubbleBoxCoverImage:t.bubbleBoxCoverImage,timestamp:t.timestamp||Date.now(),_popupLayer:this.id});if(t.pointHtml){const i=await this.createHtmlStyle(t);e.setStyle(i)}else e.setStyle(this.createPointStyle(t));this.source?.addFeature(e),this.features.set(t.id,e),this.markersData.set(t.id,t),t.pointAnimationType&&this.startAnimation(e,t.pointAnimationType)}removeMarker(t){const e=this.features.get(t);e&&(this.stopAnimation(t),this.source?.removeFeature(e),this.features.delete(t),this.markersData.delete(t),this.currentFeature===e&&this.hidePopup())}async updateMarker(t,e){const i=this.features.get(t),n=this.markersData.get(t);if(!i||!n)return;const r=n.pointAnimationType,o=e.pointAnimationType;e.longitude!==void 0&&e.latitude!==void 0&&i.setGeometry(new rt(ut([e.longitude,e.latitude]))),e.bubbleBoxTitle!==void 0&&i.set("bubbleBoxTitle",e.bubbleBoxTitle),e.bubbleBoxDescription!==void 0&&i.set("bubbleBoxDescription",e.bubbleBoxDescription),e.bubbleBoxCoverImage!==void 0&&i.set("bubbleBoxCoverImage",e.bubbleBoxCoverImage);const a={...n,...e};if(e.pointColor!==void 0||e.pointSize!==void 0||e.pointType!==void 0||e.pointText!==void 0||e.pointHtml!==void 0)if(a.pointHtml){const l=await this.createHtmlStyle(a);i.setStyle(l)}else i.setStyle(this.createPointStyle(a));this.markersData.set(t,a),i.changed(),r!==o?(r&&this.stopAnimation(t),o&&this.startAnimation(i,o)):o&&(e.pointColor!==void 0||e.pointSize!==void 0)&&(this.stopAnimation(t),this.startAnimation(i,o))}showPopup(t,e){this.hidePopup(),this.currentFeature=t;const i=t.get("id"),n=this.markersData.get(i),o=t.getGeometry().getCoordinates();this.view&&o&&this.view.getView().animate({center:o,duration:300}),n&&n.onClick&&n.onClick(n,e);const a=t.getProperties(),l=a.bubbleBoxCoverImage&&a.bubbleBoxCoverImage.trim()!=="",h=a.bubbleBoxTitle&&a.bubbleBoxTitle.trim()!=="",c=a.bubbleBoxDescription&&a.bubbleBoxDescription.trim()!=="",u=(document.body.getAttribute("data-theme")||"dark")==="dark",f=u?"#1e1e1e":"#ffffff",g=u?"#333":"#e0e0e0",p=u?"#fff":"#333",m=u?"#aaa":"#666",y=document.createElement("div");y.style.position="fixed",y.style.zIndex="10000",y.style.background=f,y.style.border=`1px solid ${g}`,y.style.borderRadius="8px",y.style.boxShadow="0 4px 12px rgba(0,0,0,0.3)",y.style.width=`${this.popupWidth}px`,y.style.maxWidth=`${this.popupWidth}px`,y.style.overflow="hidden";let x="";l&&(x+=`<div style="height: ${this.coverImageHeight}px; overflow: hidden;">
850
- <img src="${a.bubbleBoxCoverImage}" style="width: 100%; height: 100%; object-fit: cover;" />
851
- </div>`),x+='<div style="padding: 12px;">',h&&(x+=`<div style="font-size: 14px; font-weight: 600; color: ${p}; margin-bottom: 8px;">${this.escapeHtml(a.bubbleBoxTitle)}</div>`),c&&(x+=`<div style="font-size: 12px; color: ${m}; line-height: 1.5;">${this.escapeHtml(a.bubbleBoxDescription)}</div>`),x+="</div>",y.innerHTML=x;const E=t.getGeometry(),w=this.view.getPixelFromCoordinate(E.getCoordinates()),C=this.view.getTargetElement(),v=y.offsetWidth,_=y.offsetHeight;let b=w[0]-v/2,S=w[1]-_-15;b=Math.max(10,Math.min(b,window.innerWidth-v-10)),S=Math.max(10,Math.min(S,window.innerHeight-_-10)),y.style.left=`${b}px`,y.style.top=`${S}px`,C.appendChild(y),this.currentPopup=y}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}hidePopup(){this.currentPopup&&(this.currentPopup.parentNode&&this.currentPopup.parentNode.removeChild(this.currentPopup),this.currentPopup=null),this.currentFeature=null}clearAllMarkers(){this.animationFrames.forEach((t,e)=>{this.stopAnimation(e)}),this.clear(),this.features.clear(),this.markersData.clear(),this.hidePopup()}getAllMarkers(){const t=[];return this.markersData.forEach((e,i)=>{t.push({...e})}),t}getMarker(t){return this.markersData.get(t)}updateData(t){t.markers&&(this.clearAllMarkers(),t.markers.forEach(e=>this.addMarker(e)))}updatePopupPosition(){!this.currentPopup||!this.currentFeature||(this.updateFrame&&cancelAnimationFrame(this.updateFrame),this.updateFrame=requestAnimationFrame(()=>{if(!this.currentPopup||!this.currentFeature)return;const t=this.currentFeature.getGeometry(),e=this.view.getPixelFromCoordinate(t.getCoordinates()),i=this.currentPopup.offsetWidth,n=this.currentPopup.offsetHeight;let r=e[0]-i/2,o=e[1]-n-15;if(r=Math.max(10,Math.min(r,window.innerWidth-i-10)),o=Math.max(10,Math.min(o,window.innerHeight-n-10)),!(e[0]>=0&&e[0]<=window.innerWidth&&e[1]>=0&&e[1]<=window.innerHeight)){this.currentPopup.style.display="none";return}this.currentPopup.style.display="block",this.currentPopup.style.left=`${r}px`,this.currentPopup.style.top=`${o}px`}))}destroy(){this.animationFrames.forEach((t,e)=>{this.stopAnimation(e)}),this.updateFrame&&cancelAnimationFrame(this.updateFrame),this.currentHoverTimeout&&(clearTimeout(this.currentHoverTimeout),this.currentHoverTimeout=null),this.view&&this.postRenderHandler&&(this.view.un("postrender",this.postRenderHandler),this.postRenderHandler=null),super.destroy()}}class Ld extends It{constructor(t,e,i,n){super(t,e,Z.CIRCLE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultFillColor=i?.defaultFillColor||[255,0,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[255,0,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||1,this.defaultOutlineStyle=i?.defaultOutlineStyle||"solid",this.t=n||Hi("zh"),this.source=new Y,this.layer=new bt({source:this.source,style:this.createStyle.bind(this),properties:{id:t,name:e,type:Z.CIRCLE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setTranslations(t){this.t=t}createStyle(){return new A({fill:new j({color:M(this.defaultFillColor)}),stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;const e=new Y;this.drawInteraction=new ee({source:e,type:"Circle",style:this.createStyle()}),this.drawInteraction.on("drawend",i=>{const n=i.feature.clone(),r=n.getGeometry(),o=Vt("circle_");if(r instanceof Me){const a=U(r.getCenter());n.set("id",o),n.setStyle(this.createStyle()),this.source?.addFeature(n),this.features.set(o,n),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:o,center:[a[0],a[1]],radius:r.getRadius(),fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i){console.warn(this.t.featureNotFound,t);return}this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!1,keepAspectRatio:()=>!0}),this.transformInteraction.setActive(!0),this.transformInteraction.on("select",()=>{this.transformInteraction?.setActive(!0)}),this.transformInteraction.on("scaleend",()=>{const o=i.getGeometry();if(o instanceof Me){const a=U(o.getCenter()),l=i.get("id");this.onEditCompleteCallback&&l&&this.onEditCompleteCallback({id:l,center:[a[0],a[1]],radius:o.getRadius()})}}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof Me){const a=U(o.getCenter()),l=i.get("id");this.onEditCompleteCallback&&l&&this.onEditCompleteCallback({id:l,center:[a[0],a[1]],radius:o.getRadius()})}}),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addCircle(t){const e=ut(t.center),i=new Me(e,t.radius),n=new V({geometry:i,id:t.id});n.setStyle(this.createStyle()),this.source?.addFeature(n),this.features.set(t.id,n)}removeCircle(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllCircles(){const t=[];return this.features.forEach((e,i)=>{const n=e.getGeometry();if(n instanceof Me){const r=U(n.getCenter());t.push({id:i,center:[r[0],r[1]],radius:n.getRadius()})}}),t}getCircle(t){const e=this.features.get(t);if(!e)return;const i=e.getGeometry();if(i instanceof Me){const n=U(i.getCenter());return{id:t,center:[n[0],n[1]],radius:i.getRadius(),fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")||"solid"}}}updateCircleStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;o.set("fillColor",e),o.set("outlineColor",i),o.set("outlineWidth",n),o.set("outlineStyle",r);const a=r==="dashed"?[10,10]:void 0;o.setStyle(new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:a})})),o.changed(),this.mapView?.render()}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAllCircles(){this.clear(),this.features.clear(),this.stopEdit()}updateData(t){t.circles&&(this.clearAllCircles(),t.circles.forEach(e=>this.addCircle(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}}class Ky extends It{constructor(t,e,i){super(t,e,Z.RECTANGLE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultFillColor=i?.defaultFillColor||[0,0,255,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[0,0,255,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||1,this.source=new Y,this.layer=new bt({source:this.source,style:this.createStyle.bind(this),properties:{id:t,name:e,type:Z.RECTANGLE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createStyle(){return new A({fill:new j({color:M(this.defaultFillColor)}),stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"Circle",geometryFunction:(e,i)=>{if(i||(i=new it([[[0,0],[0,0],[0,0],[0,0]]])),e&&e.length>=2){const n=e[0],r=e[1],o=Math.min(n[0],r[0]),a=Math.max(n[0],r[0]),l=Math.min(n[1],r[1]),h=Math.max(n[1],r[1]),c=[[o,l],[a,l],[a,h],[o,h],[o,l]];i.setCoordinates([c])}return i},style:this.createStyle()}),this.drawInteraction.on("drawend",e=>{const i=e.feature,n=i.getGeometry(),r=Vt("rectangle_");if(n instanceof it){const o=n.getExtent(),a=(o[0]+o[2])/2,l=(o[1]+o[3])/2,h=o[2]-o[0],c=o[3]-o[1],[d,u]=U([a,l]);i.set("id",r),i.set("center",[d,u]),i.set("width",h),i.set("height",c),i.setStyle(this.createStyle()),this.features.set(r,i),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:r,center:[d,u],width:h,height:c,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth})}this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!1,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0),this.transformInteraction.on("select",()=>{this.transformInteraction?.setActive(!0)}),this.transformInteraction.on("scaleend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=a[2]-a[0],d=a[3]-a[1],[u,f]=U([l,h]),g=i.get("id");this.onEditCompleteCallback&&g&&this.onEditCompleteCallback({id:g,center:[u,f],width:c,height:d})}}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=a[2]-a[0],d=a[3]-a[1],[u,f]=U([l,h]),g=i.get("id");this.onEditCompleteCallback&&g&&this.onEditCompleteCallback({id:g,center:[u,f],width:c,height:d})}}),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addRectangle(t){const e=ut(t.center),i=t.width/2,n=t.height/2,r=[[[e[0]-i,e[1]-n],[e[0]+i,e[1]-n],[e[0]+i,e[1]+n],[e[0]-i,e[1]+n],[e[0]-i,e[1]-n]]],o=new it(r),a=new V({geometry:o,id:t.id,center:t.center,width:t.width,height:t.height});a.setStyle(this.createStyle()),this.source?.addFeature(a),this.features.set(t.id,a)}removeRectangle(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllRectangles(){const t=[];return this.features.forEach((e,i)=>{const n=e.getGeometry();if(n instanceof it){const r=n.getExtent(),o=(r[0]+r[2])/2,a=(r[1]+r[3])/2,l=r[2]-r[0],h=r[3]-r[1],[c,d]=U([o,a]);t.push({id:i,center:[c,d],width:l,height:h})}}),t}getRectangle(t){const e=this.features.get(t);if(!e)return;const i=e.getGeometry();if(i instanceof it){const n=i.getExtent(),r=(n[0]+n[2])/2,o=(n[1]+n[3])/2,a=n[2]-n[0],l=n[3]-n[1],[h,c]=U([r,o]);return{id:t,center:[h,c],width:a,height:l}}}updateRectangleStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;const a=r==="dashed"?[10,10]:void 0;o.setStyle(new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:a})})),o.changed(),this.mapView?.render()}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAllRectangles(){this.clear(),this.features.clear(),this.stopEdit()}updateData(t){t.rectangles&&(this.clearAllRectangles(),t.rectangles.forEach(e=>this.addRectangle(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}}class qy extends It{constructor(t,e,i){super(t,e,Z.TRIANGLE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultFillColor=i?.defaultFillColor||[255,255,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[255,255,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||1,this.defaultOutlineStyle=i?.defaultOutlineStyle||"solid",this.source=new Y,this.layer=new bt({source:this.source,style:this.createStyle.bind(this),properties:{id:t,name:e,type:Z.TRIANGLE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createStyle(){return new A({fill:new j({color:M(this.defaultFillColor)}),stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}createEquilateralTriangle(t,e){const i=e*Math.sqrt(3)/2;return[[t[0],t[1]+i/2],[t[0]-e/2,t[1]-i/2],[t[0]+e/2,t[1]-i/2],[t[0],t[1]+i/2]]}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;let e=[];this.drawInteraction=new ee({source:this.source,type:"LineString",maxPoints:2,geometryFunction:(i,n)=>{if(e=i,e.length<2)return n||(n=new it([[[0,0],[0,0],[0,0],[0,0]]])),n;const r=e[0],o=e[1],a=o[0]-r[0],l=o[1]-r[1],h=Math.sqrt(a*a+l*l);if(h<.001)return n||(n=new it([[[0,0],[0,0],[0,0],[0,0]]])),n;const c=(r[0]+o[0])/2,d=(r[1]+o[1])/2,u=h*Math.sqrt(3)/2;let f=-l,g=a;const p=Math.sqrt(f*f+g*g);p>0&&(f/=p,g/=p);const m=c+f*u,y=d+g*u,x=[[m,y],[r[0],r[1]],[o[0],o[1]],[m,y]];return n?n.setCoordinates([x]):n=new it([x]),n},style:this.createStyle()}),this.drawInteraction.on("drawend",i=>{const n=i.feature,r=n.getGeometry(),o=Vt("triangle_");if(r instanceof it){const a=r.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=Math.max(a[2]-a[0],a[3]-a[1]),[d,u]=U([l,h]);n.set("id",o),n.set("center",[d,u]),n.set("size",c),n.setStyle(this.createStyle()),this.features.set(o,n),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:o,center:[d,u],size:c,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!1,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0),this.transformInteraction.on("select",()=>{this.transformInteraction?.setActive(!0)}),this.transformInteraction.on("scaleend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=Math.max(a[2]-a[0],a[3]-a[1]),[d,u]=U([l,h]),f=i.get("id"),g=this.createEquilateralTriangle([l,h],c),p=new it([g]);i.setGeometry(p),this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,center:[d,u],size:c})}}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=Math.max(a[2]-a[0],a[3]-a[1]),[d,u]=U([l,h]),f=i.get("id");this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,center:[d,u],size:c})}}),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addTriangle(t){const e=ut(t.center),i=this.createEquilateralTriangle(e,t.size),n=new it([i]),r=new V({geometry:n,id:t.id,center:t.center,size:t.size});r.setStyle(this.createStyle()),this.source?.addFeature(r),this.features.set(t.id,r)}removeTriangle(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllTriangles(){const t=[];return this.features.forEach((e,i)=>{const n=e.getGeometry();if(n instanceof it){const r=n.getExtent(),o=(r[0]+r[2])/2,a=(r[1]+r[3])/2,l=Math.max(r[2]-r[0],r[3]-r[1]),[h,c]=U([o,a]);t.push({id:i,center:[h,c],size:l})}}),t}getTriangle(t){const e=this.features.get(t);if(!e)return;const i=e.getGeometry();if(i instanceof it){const n=i.getExtent(),r=(n[0]+n[2])/2,o=(n[1]+n[3])/2,a=Math.max(n[2]-n[0],n[3]-n[1]),[l,h]=U([r,o]);return{id:t,center:[l,h],size:a,fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")||"solid"}}}updateTriangleStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;o.set("fillColor",e),o.set("outlineColor",i),o.set("outlineWidth",n),o.set("outlineStyle",r);const a=r==="dashed"?[10,10]:void 0;o.setStyle(new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:a})})),o.changed(),this.mapView?.render()}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAllTriangles(){this.clear(),this.features.clear(),this.stopEdit()}updateData(t){t.triangles&&(this.clearAllTriangles(),t.triangles.forEach(e=>this.addTriangle(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}}class Jy extends It{constructor(t,e,i){super(t,e,Z.LINE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultColor=i?.defaultColor||[255,193,7,1],this.defaultWidth=i?.defaultWidth||3,this.defaultStyle=i?.defaultStyle||"solid",this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.LINE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("color")||this.defaultColor,i=t?.get("width")||this.defaultWidth,r=(t?.get("style")||this.defaultStyle)==="dashed"?[10,10]:void 0;return new A({stroke:new G({color:M(e),width:i,lineDash:r})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;const e=new Y;this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:2,geometryFunction:(i,n)=>{if(i&&i.length>=2){const r=i[0],o=i[1];n?n.setCoordinates([r,o]):n=new pt([r,o])}return n},style:this.getStyleForFeature()}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry(),r=Vt("line_");if(n instanceof pt){const o=n.getCoordinates();if(o&&o.length>=2){const[a,l]=o[0],[h,c]=o[1],[d,u]=U([a,l]),[f,g]=U([h,c]),p=new V({geometry:n.clone(),id:r,startPoint:[d,u],endPoint:[f,g]});p.set("color",this.defaultColor),p.set("width",this.defaultWidth),p.set("style",this.defaultStyle),this.source?.addFeature(p),this.features.set(r,p),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:r,startPoint:[d,u],endPoint:[f,g],color:this.defaultColor,width:this.defaultWidth,style:this.defaultStyle})}}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!0,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0);const o=()=>{const a=i.getGeometry();if(a instanceof pt){const l=a.getCoordinates();if(l.length>=2){const[h,c]=U(l[0]),[d,u]=U(l[1]),f=i.get("id");i.set("startPoint",[h,c]),i.set("endPoint",[d,u]),i.changed(),this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,startPoint:[h,c],endPoint:[d,u],color:i.get("color"),width:i.get("width"),style:i.get("style")})}}this.mapView?.render()};this.transformInteraction.on("scaleend",o),this.transformInteraction.on("translateend",o),this.transformInteraction.on("rotateend",o),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction.dispose?.(),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addLine(t){const e=ut(t.startPoint),i=ut(t.endPoint),n=new pt([e,i]),r=new V({geometry:n,id:t.id,startPoint:t.startPoint,endPoint:t.endPoint});r.set("color",t.color||this.defaultColor),r.set("width",t.width||this.defaultWidth),r.set("style",t.style||this.defaultStyle),this.source?.addFeature(r),this.features.set(t.id,r)}removeLine(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllLines(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i.toString(),startPoint:e.get("startPoint"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")})}),t}getLine(t){const e=this.features.get(t);if(e)return{id:t,startPoint:e.get("startPoint"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")}}updateLineStyle(t,e,i,n){const r=this.features.get(t);r&&(r.set("color",e),r.set("width",i),r.set("style",n),r.changed(),this.mapView?.render())}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAll(){this.clear(),this.features.clear(),this.stopEdit()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}updateData(t){t.lines&&(this.clearAll(),t.lines.forEach(e=>this.addLine(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class Qy extends It{constructor(t,e,i,n){super(t,e,Z.BEZIER_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.tempPoints=[],this.defaultColor=i?.defaultColor||[156,39,176,1],this.defaultWidth=i?.defaultWidth||3,this.defaultStyle=i?.defaultStyle||"solid",this.t=n||Hi("zh"),this.source=new Y,this.layer=new bt({source:this.source,style:r=>this.getStyleForFeature(r),properties:{id:t,name:e,type:Z.BEZIER_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setTranslations(t){this.t=t}getStyleForFeature(t){const e=t?.get("color")||this.defaultColor,i=t?.get("width")||this.defaultWidth,r=(t?.get("style")||this.defaultStyle)==="dashed"?[10,10]:void 0;return new A({stroke:new G({color:M(e),width:i,lineDash:r})})}computeBezierPoints(t,e,i,n,r=100){const o=[];for(let a=0;a<=r;a++){const l=a/r,h=1-l,c=h*h*h*t[0]+3*h*h*l*e[0]+3*h*l*l*i[0]+l*l*l*n[0],d=h*h*h*t[1]+3*h*h*l*e[1]+3*h*l*l*i[1]+l*l*l*n[1];o.push([c,d])}return o}createBezierGeometry(t,e,i,n){const r=this.computeBezierPoints(t,e,i,n);return new pt(r)}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.stopEdit(),this.onDrawCompleteCallback=t||null,this.tempPoints=[];const e=new Y;let i=[];const n=new Y,r=new bt({source:n,style:a=>a.get("type")==="control-line"?new A({stroke:new G({color:"rgba(255,0,0,0.4)",width:1,lineDash:[5,5]})}):new A({stroke:new G({color:M(this.defaultColor),width:this.defaultWidth,lineDash:this.defaultStyle==="dashed"?[10,10]:void 0})})});this.mapView?.addLayer(r);const o=a=>{if(n.clear(),a.length>=2)for(let l=0;l<a.length-1;l++){const h=new V({geometry:new pt([a[l],a[l+1]]),type:"control-line"});n.addFeature(h)}};this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:4,freehand:!1,style:new A({stroke:new G({color:M(this.defaultColor),width:this.defaultWidth,lineDash:this.defaultStyle==="dashed"?[10,10]:void 0})}),geometryFunction:(a,l)=>{if(i=a,o(i),i.length===0)return l;if(i.length===1)return l?l.setCoordinates([i[0],i[0]]):l=new pt([i[0],i[0]]),l;if(i.length===2)return l?l.setCoordinates([i[0],i[1]]):l=new pt([i[0],i[1]]),l;if(i.length===3){const h=new pt([i[0],i[1],i[2]]);return l?l.setCoordinates([i[0],i[1],i[2]]):l=h,l}if(i.length===4){const[h,c,d,u]=i,f=this.computeBezierPoints(h,c,d,u,100);return l?l.setCoordinates(f):l=new pt(f),l}return l}}),this.drawInteraction.on("drawstart",()=>{i=[],e.clear(),n.clear()}),this.drawInteraction.on("drawend",a=>{if(this.mapView?.removeLayer(r),i.length===4){const[l,h,c,d]=i,u=this.createBezierGeometry(l,h,c,d),f=Vt("bezier_"),[g,p]=U(l),[m,y]=U(h),[x,E]=U(c),[w,C]=U(d),v=new V({geometry:u,id:f,startPoint:[g,p],controlPoint1:[m,y],controlPoint2:[x,E],endPoint:[w,C]});v.set("color",this.defaultColor),v.set("width",this.defaultWidth),v.set("style",this.defaultStyle),this.source?.addFeature(v),this.features.set(f,v),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:f,startPoint:[g,p],controlPoint1:[m,y],controlPoint2:[x,E],endPoint:[w,C],color:this.defaultColor,width:this.defaultWidth,style:this.defaultStyle})}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit(),this.stopDraw();const i=this.features.get(t);if(!i){console.warn(this.t.bezierFeatureNotFound,t);return}this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!0,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0);const o=()=>{const a=i.getGeometry();if(a instanceof pt){const l=a.getCoordinates();if(l.length>0){const[h,c]=U(l[0]),[d,u]=U(l[l.length-1]),f=i.get("startPoint"),g=i.get("controlPoint1"),p=i.get("controlPoint2"),m=i.get("endPoint");if(f&&m){const y=ut(f),x=ut(m),E=ut([h,c]),w=ut([d,u]),C=E[0]-y[0],v=E[1]-y[1],_=x[0]-y[0],b=x[1]-y[1],S=w[0]-E[0],P=w[1]-E[1],L=Math.sqrt(_*_+b*b),k=Math.sqrt(S*S+P*P),F=L>0?k/L:1;if(g){const N=ut(g),tt=y[0]+(N[0]-y[0])*F+C,et=y[1]+(N[1]-y[1])*F+v,[ht,ot]=U([tt,et]);i.set("controlPoint1",[ht,ot])}if(p){const N=ut(p),tt=y[0]+(N[0]-y[0])*F+C,et=y[1]+(N[1]-y[1])*F+v,[ht,ot]=U([tt,et]);i.set("controlPoint2",[ht,ot])}i.set("startPoint",[h,c]),i.set("endPoint",[d,u]);const O=ut([h,c]),R=i.get("controlPoint1"),B=i.get("controlPoint2"),D=ut([d,u]);if(R&&B){const N=ut(R),tt=ut(B),et=this.createBezierGeometry([O[0],O[1]],[N[0],N[1]],[tt[0],tt[1]],[D[0],D[1]]);i.setGeometry(et)}i.changed();const z=i.get("id");this.onEditCompleteCallback&&z&&this.onEditCompleteCallback({id:z,startPoint:[h,c],controlPoint1:i.get("controlPoint1"),controlPoint2:i.get("controlPoint2"),endPoint:[d,u],color:i.get("color"),width:i.get("width"),style:i.get("style")})}}}this.mapView?.render()};this.transformInteraction.on("scaleend",o),this.transformInteraction.on("translateend",o),this.transformInteraction.on("rotateend",o),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction.dispose?.(),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addBezier(t){const e=ut(t.startPoint),i=ut(t.controlPoint1),n=ut(t.controlPoint2),r=ut(t.endPoint),o=this.createBezierGeometry([e[0],e[1]],[i[0],i[1]],[n[0],n[1]],[r[0],r[1]]),a=new V({geometry:o,id:t.id,startPoint:t.startPoint,controlPoint1:t.controlPoint1,controlPoint2:t.controlPoint2,endPoint:t.endPoint});a.set("color",t.color||this.defaultColor),a.set("width",t.width||this.defaultWidth),a.set("style",t.style||this.defaultStyle),this.source?.addFeature(a),this.features.set(t.id,a)}removeBezier(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllBeziers(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i.toString(),startPoint:e.get("startPoint"),controlPoint1:e.get("controlPoint1"),controlPoint2:e.get("controlPoint2"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")})}),t}getBezier(t){const e=this.features.get(t);if(e)return{id:t,startPoint:e.get("startPoint"),controlPoint1:e.get("controlPoint1"),controlPoint2:e.get("controlPoint2"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")}}updateBezierStyle(t,e,i,n){const r=this.features.get(t);r&&(r.set("color",e),r.set("width",i),r.set("style",n),r.changed(),this.mapView?.render())}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.tempPoints=[],this.onDrawCompleteCallback=null}clearAll(){this.clear(),this.features.clear(),this.stopEdit()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}updateData(t){t.beziers&&(this.clearAll(),t.beziers.forEach(e=>this.addBezier(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class t_ extends It{constructor(t,e,i){super(t,e,Z.SECTOR_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.tempPoints=[],this.defaultFillColor=i?.defaultFillColor||[33,150,243,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[33,150,243,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,this.defaultOutlineStyle=i?.defaultOutlineStyle||"solid",this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.SECTOR_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("fillColor")||this.defaultFillColor,i=t?.get("outlineColor")||this.defaultOutlineColor,n=t?.get("outlineWidth")||this.defaultOutlineWidth,o=(t?.get("outlineStyle")||this.defaultOutlineStyle)==="dashed"?[10,10]:void 0;return new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:o})})}createSectorGeometry(t,e,i,n,r=64){const o=[[t[0],t[1]]];let a=i,l=n;a>l&&(l+=2*Math.PI);const h=(l-a)/r;for(let c=0;c<=r;c++){const d=a+c*h,u=t[0]+e*Math.cos(d),f=t[1]+e*Math.sin(d);o.push([u,f])}return o.push([t[0],t[1]]),new it([o])}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;const e=new Y;this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:3,freehand:!1,style:new A({stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth,lineDash:this.defaultOutlineStyle==="dashed"?[10,10]:void 0})})}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry();if(n instanceof pt){const r=n.getCoordinates();if(r.length===3){const o=r[0],a=r[1],l=r[2],h=o[0]-a[0],c=o[1]-a[1],d=Math.sqrt(h*h+c*c),u=Math.atan2(c,h),f=l[0]-a[0],g=l[1]-a[1];let p=Math.atan2(g,f),m=p-u;if(m<0&&(m+=2*Math.PI),m>Math.PI){m=2*Math.PI-m;const y=p,x=p+m,E=Vt("sector_"),[w,C]=U(a),v=this.createSectorGeometry([a[0],a[1]],d,y,x),_=new V({geometry:v,id:E,center:[w,C],radius:d,startAngle:y,endAngle:x});_.set("fillColor",this.defaultFillColor),_.set("outlineColor",this.defaultOutlineColor),_.set("outlineWidth",this.defaultOutlineWidth),_.set("outlineStyle",this.defaultOutlineStyle),this.source?.addFeature(_),this.features.set(E,_),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:E,center:[w,C],radius:d,startAngle:y,endAngle:x,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}else{const y=u,x=u+m,E=Vt("sector_"),[w,C]=U(a),v=this.createSectorGeometry([a[0],a[1]],d,y,x),_=new V({geometry:v,id:E,center:[w,C],radius:d,startAngle:y,endAngle:x});_.set("fillColor",this.defaultFillColor),_.set("outlineColor",this.defaultOutlineColor),_.set("outlineWidth",this.defaultOutlineWidth),_.set("outlineStyle",this.defaultOutlineStyle),this.source?.addFeature(_),this.features.set(E,_),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:E,center:[w,C],radius:d,startAngle:y,endAngle:x,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}}}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=i.get("startAngle")||0,r=i.get("endAngle")||Math.PI*2,o=new Y;o.addFeature(i);const a=o.getFeaturesCollection();this.transformInteraction=new _e({features:a,translate:!0,scale:!0,rotate:!0,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0);const l=()=>{const h=i.getGeometry();if(h instanceof it){const c=h.getExtent(),d=(c[0]+c[2])/2,u=(c[1]+c[3])/2,f=Math.max(c[2]-c[0],c[3]-c[1])/2,[g,p]=U([d,u]);i.set("center",[g,p]),i.set("radius",f),i.set("startAngle",n),i.set("endAngle",r),i.changed();const m=i.get("id");this.onEditCompleteCallback&&m&&this.onEditCompleteCallback({id:m,center:[g,p],radius:f,startAngle:n,endAngle:r,fillColor:i.get("fillColor"),outlineColor:i.get("outlineColor"),outlineWidth:i.get("outlineWidth"),outlineStyle:i.get("outlineStyle")})}this.mapView?.render()};this.transformInteraction.on("scaleend",l),this.transformInteraction.on("translateend",l),this.transformInteraction.on("rotateend",l),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction.dispose?.(),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addSector(t){const e=ut(t.center),i=this.createSectorGeometry([e[0],e[1]],t.radius,t.startAngle,t.endAngle),n=new V({geometry:i,id:t.id,center:t.center,radius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle});n.set("fillColor",t.fillColor||this.defaultFillColor),n.set("outlineColor",t.outlineColor||this.defaultOutlineColor),n.set("outlineWidth",t.outlineWidth||this.defaultOutlineWidth),n.set("outlineStyle",t.outlineStyle||this.defaultOutlineStyle),this.source?.addFeature(n),this.features.set(t.id,n)}removeSector(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllSectors(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i.toString(),center:e.get("center"),radius:e.get("radius"),startAngle:e.get("startAngle")||0,endAngle:e.get("endAngle")||Math.PI*2,fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")})}),t}getSector(t){const e=this.features.get(t);if(e)return{id:t,center:e.get("center"),radius:e.get("radius"),startAngle:e.get("startAngle")||0,endAngle:e.get("endAngle")||Math.PI*2,fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")}}updateSectorStyle(t,e,i,n,r){const o=this.features.get(t);o&&(o.set("fillColor",e),o.set("outlineColor",i),o.set("outlineWidth",n),o.set("outlineStyle",r),o.setStyle(this.getStyleForFeature(o)),o.changed(),this.mapView?.render())}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.tempPoints=[],this.onDrawCompleteCallback=null}clearAll(){this.clear(),this.features.clear(),this.stopEdit()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}updateData(t){t.sectors&&(this.clearAll(),t.sectors.forEach(e=>this.addSector(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class Dd extends It{constructor(t,e,i){super(t,e,Z.DISTANCE_MEASUREMENT,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.measurements=new Map,this.onCompleteCallback=null,this.mapView=null,this.lineColor=i?.lineColor||[0,170,255,1],this.lineWidth=i?.lineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.DISTANCE_MEASUREMENT},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startMeasure(t){this.stopMeasure(),this.onCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"LineString"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates(),o=r.map(u=>{const[f,g]=U(u);return{longitude:f,latitude:g}});let a=0;for(let u=0;u<o.length-1;u++)a+=this.calculateDistance(o[u],o[u+1]);const l=Vt("dist_"),h=Math.floor(o.length/2),c=a>=1e3?`${(a/1e3).toFixed(2)} km`:`${a.toFixed(0)} m`,d=new V({geometry:new rt([r[h][0],r[h][1]]),measurementId:l});d.setStyle(new A({text:new te({text:c,font:"14px sans-serif",fill:new j({color:"#ffffff"}),stroke:new G({color:"#000000",width:2}),offsetY:-10,textAlign:"center"})})),this.measurements.set(l,{id:l,points:o,distance:a}),i.set("measurementId",l),i.set("type","distance"),i.setStyle(new A({stroke:new G({color:M(this.lineColor),width:this.lineWidth})})),this.source?.addFeature(d),this.onCompleteCallback&&this.onCompleteCallback({points:o,distance:a,id:l,isDrawing:!1}),this.stopMeasure()}),this.mapView?.addInteraction(this.drawInteraction)}calculateDistance(t,e){const i=new pt([[t.longitude,t.latitude],[e.longitude,e.latitude]]);return rc(i,{projection:"EPSG:4326"})}stopMeasure(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onCompleteCallback=null}deleteMeasurement(t){if(this.measurements.get(t)){let i=[];return this.source?.forEachFeature(n=>{n.get("measurementId")===t&&i.push(n)}),i.forEach(n=>this.source?.removeFeature(n)),this.measurements.delete(t),!0}return!1}findMeasurementIdByGraphic(t){return t.get("measurementId")||null}clearAllMeasurements(){this.clear(),this.measurements.clear(),this.stopMeasure()}getAllMeasurements(){return Array.from(this.measurements.values())}isCurrentlyMeasuring(){return this.drawInteraction!==null}updateData(t){}}class kd extends It{constructor(t,e,i){super(t,e,Z.AREA_MEASUREMENT,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.measurements=new Map,this.onCompleteCallback=null,this.mapView=null,this.fillColor=i?.fillColor||[0,170,255,.2],this.lineColor=i?.lineColor||[0,170,255,1],this.lineWidth=i?.lineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.AREA_MEASUREMENT},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startMeasure(t){this.stopMeasure(),this.onCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"Polygon"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,n=i.getGeometry(),r=n.getCoordinates()[0],o=r.map(f=>{const[g,p]=U(f);return{longitude:g,latitude:p}}).slice(0,-1),a=oc(n),l=Vt("area_");let h=0,c=0;for(const f of r.slice(0,-1))h+=f[0],c+=f[1];h/=r.length-1,c/=r.length-1;const d=a>=1e6?`${(a/1e6).toFixed(2)} km²`:`${a.toFixed(0)} m²`,u=new V({geometry:new rt([h,c]),measurementId:l});u.setStyle(new A({text:new te({text:d,font:"14px sans-serif",fill:new j({color:"#ffffff"}),stroke:new G({color:"#000000",width:2}),textAlign:"center"})})),this.measurements.set(l,{id:l,points:o,area:a}),i.set("measurementId",l),i.set("type","area"),i.setStyle(new A({fill:new j({color:M(this.fillColor)}),stroke:new G({color:M(this.lineColor),width:this.lineWidth})})),this.source?.addFeature(u),this.onCompleteCallback&&this.onCompleteCallback({id:l,points:o,area:a}),this.stopMeasure()}),this.mapView?.addInteraction(this.drawInteraction)}stopMeasure(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onCompleteCallback=null}deleteMeasurement(t){if(this.measurements.get(t)){let i=[];return this.source?.forEachFeature(n=>{n.get("measurementId")===t&&i.push(n)}),i.forEach(n=>this.source?.removeFeature(n)),this.measurements.delete(t),!0}return!1}findMeasurementIdByGraphic(t){return t.get("measurementId")||null}clearAllMeasurements(){this.clear(),this.measurements.clear(),this.stopMeasure()}getAllMeasurements(){return Array.from(this.measurements.values())}isCurrentlyMeasuring(){return this.drawInteraction!==null}updateData(t){}}class e_ extends It{constructor(t,e,i){super(t,e,Z.POINT_COORDINATE_PICK,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.picks=new Map,this.onCompleteCallback=null,this.mapView=null,this.features=new Map,this.textColor=i?.textColor||[0,200,255,1],this.textSize=i?.textSize||12,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POINT_COORDINATE_PICK},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex}),this.t=i?.t||null}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startPick(t){this.stopPick(),this.onCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"Point"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates(),[o,a]=U(r),l=Vt("coord_"),h=Date.now();i.setStyle(new A({image:new Le({radius:6,fill:new j({color:"#00aaff"}),stroke:new G({color:"#ffffff",width:2})})})),i.set("id",l),i.set("type","point_pick"),this.features.set(l,i);const c=new V({geometry:new rt(r),id:l+"_label",longitude:o,latitude:a,timestamp:h});c.set("type","point_pick"),c.setStyle(new A({text:new te({text:this.t?.pointPick.label_text||"Point Pick",font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"bottom",offsetY:-10})})),this.source?.addFeature(c),this.features.set(l+"_label",c);const d={id:l,longitude:o,latitude:a,timestamp:h};this.picks.set(l,d),this.onCompleteCallback&&this.onCompleteCallback(d),this.stopPick()}),this.mapView?.addInteraction(this.drawInteraction)}stopPick(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onCompleteCallback=null}removeCoordinate(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t));const i=this.features.get(t+"_label");return i&&(this.source?.removeFeature(i),this.features.delete(t+"_label")),this.picks.delete(t),!0}clearAllCoordinates(){this.clear(),this.features.clear(),this.picks.clear(),this.stopPick()}getAllCoordinates(){return Array.from(this.picks.values())}getCoordinate(t){return this.picks.get(t)}highlightCoordinate(t){this.features.forEach((e,i)=>{const n=i===t;e.setStyle(new A({text:new te({text:this.t?.pointPick.label_text||"Point Pick",font:`${this.textSize}px sans-serif`,fill:new j({color:M(n?[255,170,0,1]:this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"bottom",offsetY:-10})}))}),this.mapView?.render()}clearHighlight(){this.features.forEach(t=>{t.setStyle(new A({text:new te({text:this.t?.pointPick.label_text||"Point Pick",font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"bottom",offsetY:-10})}))}),this.mapView?.render()}stopDraw(){this.stopPick()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return!1}setEditable(t){t||this.stopPick()}stopEdit(){this.stopPick()}getEditingId(){return null}cancelDraw(){this.stopPick()}cancelEdit(){this.stopPick()}updateData(t){}destroy(){this.stopPick(),super.destroy()}}const Lt={Layers:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg>',Basemap:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',Draw:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/><circle cx="11" cy="11" r="2"/></svg>',Tools:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>',ZoomIn:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>',ZoomOut:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>',Locate:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2v4M12 22v-4M2 12h4M22 12h-4"/><circle cx="12" cy="12" r="3"/></svg>',Eye:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>',EyeOff:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>',Delete:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>',Close:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',Check:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',Circle:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/></svg>',Ruler:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 2v20M8 2v20M12 2v20M16 2v20M20 2v20"/><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>',Area:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="3 3 21 3 21 21 3 21 3 3"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>',DragHandle:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="12" r="1"/><circle cx="9" cy="8" r="1"/><circle cx="9" cy="16" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="8" r="1"/><circle cx="15" cy="16" r="1"/></svg>',StrokeWidth:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12" stroke-width="3"/><line x1="3" y1="18" x2="21" y2="18" stroke-width="4"/></svg>',StrokeStyle:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="12" x2="21" y2="12" stroke-dasharray="4 4"/></svg>',Point:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/></svg>',Line2:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="12" x2="22" y2="12"/></svg>',Polygon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>'};class i_{constructor(t){this.buttons=new Map,this.scrollUpBtn=null,this.scrollDownBtn=null,this.isScrolling=!1,this.scrollTimer=null,this.options=t,this.element=this.createElement(),t.container.appendChild(this.element),this.scrollContainer=this.element.querySelector(".toolbar-scroll-container"),this.attachScrollEvents(),this.checkScrollPosition()}createElement(){const t=this.options.theme==="dark",e=document.createElement("div");e.style.cssText=`
850
+ `;return new Promise(f=>{const g=new Image;g.onload=()=>{d.getContext("2d")?.drawImage(g,0,0),f(new A({image:new Vi({img:d,size:[h,c]})})),URL.revokeObjectURL(g.src)},g.src=URL.createObjectURL(new Blob([u],{type:"image/svg+xml"}))})}async addMarker(t){const e=new V({geometry:new rt(ut([t.longitude,t.latitude])),id:t.id,name:t.name||"Marker",bubbleBoxTitle:t.bubbleBoxTitle,bubbleBoxDescription:t.bubbleBoxDescription,bubbleBoxCoverImage:t.bubbleBoxCoverImage,timestamp:t.timestamp||Date.now(),_popupLayer:this.id});if(t.pointHtml){const i=await this.createHtmlStyle(t);e.setStyle(i)}else e.setStyle(this.createPointStyle(t));this.source?.addFeature(e),this.features.set(t.id,e),this.markersData.set(t.id,t),t.pointAnimationType&&this.startAnimation(e,t.pointAnimationType)}removeMarker(t){const e=this.features.get(t);e&&(this.stopAnimation(t),this.source?.removeFeature(e),this.features.delete(t),this.markersData.delete(t),this.currentFeature===e&&this.hidePopup())}async updateMarker(t,e){const i=this.features.get(t),n=this.markersData.get(t);if(!i||!n)return;const r=n.pointAnimationType,o=e.pointAnimationType;e.longitude!==void 0&&e.latitude!==void 0&&i.setGeometry(new rt(ut([e.longitude,e.latitude]))),e.bubbleBoxTitle!==void 0&&i.set("bubbleBoxTitle",e.bubbleBoxTitle),e.bubbleBoxDescription!==void 0&&i.set("bubbleBoxDescription",e.bubbleBoxDescription),e.bubbleBoxCoverImage!==void 0&&i.set("bubbleBoxCoverImage",e.bubbleBoxCoverImage);const a={...n,...e};if(e.pointColor!==void 0||e.pointSize!==void 0||e.pointType!==void 0||e.pointText!==void 0||e.pointHtml!==void 0)if(a.pointHtml){const l=await this.createHtmlStyle(a);i.setStyle(l)}else i.setStyle(this.createPointStyle(a));this.markersData.set(t,a),i.changed(),r!==o?(r&&this.stopAnimation(t),o&&this.startAnimation(i,o)):o&&(e.pointColor!==void 0||e.pointSize!==void 0)&&(this.stopAnimation(t),this.startAnimation(i,o))}showPopup(t,e){this.hidePopup(),this.currentFeature=t;const i=t.get("id"),n=this.markersData.get(i),o=t.getGeometry().getCoordinates();this.view&&o&&this.view.getView().animate({center:o,duration:300}),n&&n.onClick&&n.onClick(n,e);const a=t.getProperties(),l=a.bubbleBoxCoverImage&&a.bubbleBoxCoverImage.trim()!=="",h=a.bubbleBoxTitle&&a.bubbleBoxTitle.trim()!=="",c=a.bubbleBoxDescription&&a.bubbleBoxDescription.trim()!=="",u=(document.body.getAttribute("data-theme")||"dark")==="dark",f=u?"#1e1e1e":"#ffffff",g=u?"#333":"#e0e0e0",p=u?"#fff":"#333",m=u?"#aaa":"#666",y=document.createElement("div");y.style.position="absolute",y.style.zIndex="10000",y.style.background=f,y.style.border=`1px solid ${g}`,y.style.borderRadius="8px",y.style.boxShadow="0 4px 12px rgba(0,0,0,0.3)",y.style.width=`${this.popupWidth}px`,y.style.maxWidth=`${this.popupWidth}px`,y.style.overflow="hidden",y.style.userSelect="none";let x="";l&&(x+=`<div style="height: ${this.coverImageHeight}px; overflow: hidden;">
851
+ <img src="${a.bubbleBoxCoverImage}" style="width: 100%; height: 100%; object-fit: cover;" />
852
+ </div>`),x+='<div style="padding: 12px;">',h&&(x+=`<div style="font-size: 14px; font-weight: 600; color: ${p}; margin-bottom: 8px;">${this.escapeHtml(a.bubbleBoxTitle)}</div>`),c&&(x+=`<div style="font-size: 12px; color: ${m}; line-height: 1.5;">${this.escapeHtml(a.bubbleBoxDescription)}</div>`),x+="</div>",y.innerHTML=x;const E=t.getGeometry(),w=this.view.getPixelFromCoordinate(E.getCoordinates()),C=this.view.getTargetElement(),v=C.getBoundingClientRect(),_=y.offsetWidth,b=y.offsetHeight;let S=w[0]-v.left-_/2,P=w[1]-v.top-b-15+45;S=Math.max(10,Math.min(S,v.width-_-10)),P=Math.max(10,Math.min(P,v.height-b-10)),y.style.left=`${S}px`,y.style.top=`${P}px`,getComputedStyle(C).position==="static"&&(C.style.position="relative"),C.appendChild(y),this.currentPopup=y}updatePopupPosition(){!this.currentPopup||!this.currentFeature||(this.updateFrame&&cancelAnimationFrame(this.updateFrame),this.updateFrame=requestAnimationFrame(()=>{if(!this.currentPopup||!this.currentFeature)return;const t=this.currentFeature.getGeometry(),e=this.view.getPixelFromCoordinate(t.getCoordinates()),n=this.view.getTargetElement().getBoundingClientRect(),r=this.currentPopup.offsetWidth,o=this.currentPopup.offsetHeight;let a=e[0]-n.left-r/2,l=e[1]-n.top-o-15+45;if(a=Math.max(10,Math.min(a,n.width-r-10)),l=Math.max(10,Math.min(l,n.height-o-10)),!(e[0]>=0&&e[0]<=n.width&&e[1]>=0&&e[1]<=n.height)){this.currentPopup.style.display="none";return}this.currentPopup.style.display="block",this.currentPopup.style.left=`${a}px`,this.currentPopup.style.top=`${l}px`}))}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}hidePopup(){this.currentPopup&&(this.currentPopup.parentNode&&this.currentPopup.parentNode.removeChild(this.currentPopup),this.currentPopup=null),this.currentFeature=null}clearAllMarkers(){this.animationFrames.forEach((t,e)=>{this.stopAnimation(e)}),this.clear(),this.features.clear(),this.markersData.clear(),this.hidePopup()}getAllMarkers(){const t=[];return this.markersData.forEach((e,i)=>{t.push({...e})}),t}getMarker(t){return this.markersData.get(t)}updateData(t){t.markers&&(this.clearAllMarkers(),t.markers.forEach(e=>this.addMarker(e)))}destroy(){this.animationFrames.forEach((t,e)=>{this.stopAnimation(e)}),this.updateFrame&&cancelAnimationFrame(this.updateFrame),this.currentHoverTimeout&&(clearTimeout(this.currentHoverTimeout),this.currentHoverTimeout=null),this.view&&this.postRenderHandler&&(this.view.un("postrender",this.postRenderHandler),this.postRenderHandler=null),super.destroy()}}class Ld extends It{constructor(t,e,i,n){super(t,e,Z.CIRCLE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultFillColor=i?.defaultFillColor||[255,0,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[255,0,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||1,this.defaultOutlineStyle=i?.defaultOutlineStyle||"solid",this.t=n||Hi("zh"),this.source=new Y,this.layer=new bt({source:this.source,style:this.createStyle.bind(this),properties:{id:t,name:e,type:Z.CIRCLE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setTranslations(t){this.t=t}createStyle(){return new A({fill:new j({color:M(this.defaultFillColor)}),stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;const e=new Y;this.drawInteraction=new ee({source:e,type:"Circle",style:this.createStyle()}),this.drawInteraction.on("drawend",i=>{const n=i.feature.clone(),r=n.getGeometry(),o=Vt("circle_");if(r instanceof Me){const a=U(r.getCenter());n.set("id",o),n.setStyle(this.createStyle()),this.source?.addFeature(n),this.features.set(o,n),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:o,center:[a[0],a[1]],radius:r.getRadius(),fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i){console.warn(this.t.featureNotFound,t);return}this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!1,keepAspectRatio:()=>!0}),this.transformInteraction.setActive(!0),this.transformInteraction.on("select",()=>{this.transformInteraction?.setActive(!0)}),this.transformInteraction.on("scaleend",()=>{const o=i.getGeometry();if(o instanceof Me){const a=U(o.getCenter()),l=i.get("id");this.onEditCompleteCallback&&l&&this.onEditCompleteCallback({id:l,center:[a[0],a[1]],radius:o.getRadius()})}}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof Me){const a=U(o.getCenter()),l=i.get("id");this.onEditCompleteCallback&&l&&this.onEditCompleteCallback({id:l,center:[a[0],a[1]],radius:o.getRadius()})}}),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addCircle(t){const e=ut(t.center),i=new Me(e,t.radius),n=new V({geometry:i,id:t.id});n.setStyle(this.createStyle()),this.source?.addFeature(n),this.features.set(t.id,n)}removeCircle(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllCircles(){const t=[];return this.features.forEach((e,i)=>{const n=e.getGeometry();if(n instanceof Me){const r=U(n.getCenter());t.push({id:i,center:[r[0],r[1]],radius:n.getRadius()})}}),t}getCircle(t){const e=this.features.get(t);if(!e)return;const i=e.getGeometry();if(i instanceof Me){const n=U(i.getCenter());return{id:t,center:[n[0],n[1]],radius:i.getRadius(),fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")||"solid"}}}updateCircleStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;o.set("fillColor",e),o.set("outlineColor",i),o.set("outlineWidth",n),o.set("outlineStyle",r);const a=r==="dashed"?[10,10]:void 0;o.setStyle(new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:a})})),o.changed(),this.mapView?.render()}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAllCircles(){this.clear(),this.features.clear(),this.stopEdit()}updateData(t){t.circles&&(this.clearAllCircles(),t.circles.forEach(e=>this.addCircle(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}}class Ky extends It{constructor(t,e,i){super(t,e,Z.RECTANGLE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultFillColor=i?.defaultFillColor||[0,0,255,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[0,0,255,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||1,this.source=new Y,this.layer=new bt({source:this.source,style:this.createStyle.bind(this),properties:{id:t,name:e,type:Z.RECTANGLE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createStyle(){return new A({fill:new j({color:M(this.defaultFillColor)}),stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"Circle",geometryFunction:(e,i)=>{if(i||(i=new it([[[0,0],[0,0],[0,0],[0,0]]])),e&&e.length>=2){const n=e[0],r=e[1],o=Math.min(n[0],r[0]),a=Math.max(n[0],r[0]),l=Math.min(n[1],r[1]),h=Math.max(n[1],r[1]),c=[[o,l],[a,l],[a,h],[o,h],[o,l]];i.setCoordinates([c])}return i},style:this.createStyle()}),this.drawInteraction.on("drawend",e=>{const i=e.feature,n=i.getGeometry(),r=Vt("rectangle_");if(n instanceof it){const o=n.getExtent(),a=(o[0]+o[2])/2,l=(o[1]+o[3])/2,h=o[2]-o[0],c=o[3]-o[1],[d,u]=U([a,l]);i.set("id",r),i.set("center",[d,u]),i.set("width",h),i.set("height",c),i.setStyle(this.createStyle()),this.features.set(r,i),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:r,center:[d,u],width:h,height:c,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth})}this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!1,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0),this.transformInteraction.on("select",()=>{this.transformInteraction?.setActive(!0)}),this.transformInteraction.on("scaleend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=a[2]-a[0],d=a[3]-a[1],[u,f]=U([l,h]),g=i.get("id");this.onEditCompleteCallback&&g&&this.onEditCompleteCallback({id:g,center:[u,f],width:c,height:d})}}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=a[2]-a[0],d=a[3]-a[1],[u,f]=U([l,h]),g=i.get("id");this.onEditCompleteCallback&&g&&this.onEditCompleteCallback({id:g,center:[u,f],width:c,height:d})}}),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addRectangle(t){const e=ut(t.center),i=t.width/2,n=t.height/2,r=[[[e[0]-i,e[1]-n],[e[0]+i,e[1]-n],[e[0]+i,e[1]+n],[e[0]-i,e[1]+n],[e[0]-i,e[1]-n]]],o=new it(r),a=new V({geometry:o,id:t.id,center:t.center,width:t.width,height:t.height});a.setStyle(this.createStyle()),this.source?.addFeature(a),this.features.set(t.id,a)}removeRectangle(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllRectangles(){const t=[];return this.features.forEach((e,i)=>{const n=e.getGeometry();if(n instanceof it){const r=n.getExtent(),o=(r[0]+r[2])/2,a=(r[1]+r[3])/2,l=r[2]-r[0],h=r[3]-r[1],[c,d]=U([o,a]);t.push({id:i,center:[c,d],width:l,height:h})}}),t}getRectangle(t){const e=this.features.get(t);if(!e)return;const i=e.getGeometry();if(i instanceof it){const n=i.getExtent(),r=(n[0]+n[2])/2,o=(n[1]+n[3])/2,a=n[2]-n[0],l=n[3]-n[1],[h,c]=U([r,o]);return{id:t,center:[h,c],width:a,height:l}}}updateRectangleStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;const a=r==="dashed"?[10,10]:void 0;o.setStyle(new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:a})})),o.changed(),this.mapView?.render()}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAllRectangles(){this.clear(),this.features.clear(),this.stopEdit()}updateData(t){t.rectangles&&(this.clearAllRectangles(),t.rectangles.forEach(e=>this.addRectangle(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}}class qy extends It{constructor(t,e,i){super(t,e,Z.TRIANGLE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultFillColor=i?.defaultFillColor||[255,255,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[255,255,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||1,this.defaultOutlineStyle=i?.defaultOutlineStyle||"solid",this.source=new Y,this.layer=new bt({source:this.source,style:this.createStyle.bind(this),properties:{id:t,name:e,type:Z.TRIANGLE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createStyle(){return new A({fill:new j({color:M(this.defaultFillColor)}),stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}createEquilateralTriangle(t,e){const i=e*Math.sqrt(3)/2;return[[t[0],t[1]+i/2],[t[0]-e/2,t[1]-i/2],[t[0]+e/2,t[1]-i/2],[t[0],t[1]+i/2]]}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;let e=[];this.drawInteraction=new ee({source:this.source,type:"LineString",maxPoints:2,geometryFunction:(i,n)=>{if(e=i,e.length<2)return n||(n=new it([[[0,0],[0,0],[0,0],[0,0]]])),n;const r=e[0],o=e[1],a=o[0]-r[0],l=o[1]-r[1],h=Math.sqrt(a*a+l*l);if(h<.001)return n||(n=new it([[[0,0],[0,0],[0,0],[0,0]]])),n;const c=(r[0]+o[0])/2,d=(r[1]+o[1])/2,u=h*Math.sqrt(3)/2;let f=-l,g=a;const p=Math.sqrt(f*f+g*g);p>0&&(f/=p,g/=p);const m=c+f*u,y=d+g*u,x=[[m,y],[r[0],r[1]],[o[0],o[1]],[m,y]];return n?n.setCoordinates([x]):n=new it([x]),n},style:this.createStyle()}),this.drawInteraction.on("drawend",i=>{const n=i.feature,r=n.getGeometry(),o=Vt("triangle_");if(r instanceof it){const a=r.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=Math.max(a[2]-a[0],a[3]-a[1]),[d,u]=U([l,h]);n.set("id",o),n.set("center",[d,u]),n.set("size",c),n.setStyle(this.createStyle()),this.features.set(o,n),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:o,center:[d,u],size:c,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!1,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0),this.transformInteraction.on("select",()=>{this.transformInteraction?.setActive(!0)}),this.transformInteraction.on("scaleend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=Math.max(a[2]-a[0],a[3]-a[1]),[d,u]=U([l,h]),f=i.get("id"),g=this.createEquilateralTriangle([l,h],c),p=new it([g]);i.setGeometry(p),this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,center:[d,u],size:c})}}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof it){const a=o.getExtent(),l=(a[0]+a[2])/2,h=(a[1]+a[3])/2,c=Math.max(a[2]-a[0],a[3]-a[1]),[d,u]=U([l,h]),f=i.get("id");this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,center:[d,u],size:c})}}),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addTriangle(t){const e=ut(t.center),i=this.createEquilateralTriangle(e,t.size),n=new it([i]),r=new V({geometry:n,id:t.id,center:t.center,size:t.size});r.setStyle(this.createStyle()),this.source?.addFeature(r),this.features.set(t.id,r)}removeTriangle(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllTriangles(){const t=[];return this.features.forEach((e,i)=>{const n=e.getGeometry();if(n instanceof it){const r=n.getExtent(),o=(r[0]+r[2])/2,a=(r[1]+r[3])/2,l=Math.max(r[2]-r[0],r[3]-r[1]),[h,c]=U([o,a]);t.push({id:i,center:[h,c],size:l})}}),t}getTriangle(t){const e=this.features.get(t);if(!e)return;const i=e.getGeometry();if(i instanceof it){const n=i.getExtent(),r=(n[0]+n[2])/2,o=(n[1]+n[3])/2,a=Math.max(n[2]-n[0],n[3]-n[1]),[l,h]=U([r,o]);return{id:t,center:[l,h],size:a,fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")||"solid"}}}updateTriangleStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;o.set("fillColor",e),o.set("outlineColor",i),o.set("outlineWidth",n),o.set("outlineStyle",r);const a=r==="dashed"?[10,10]:void 0;o.setStyle(new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:a})})),o.changed(),this.mapView?.render()}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAllTriangles(){this.clear(),this.features.clear(),this.stopEdit()}updateData(t){t.triangles&&(this.clearAllTriangles(),t.triangles.forEach(e=>this.addTriangle(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}}class Jy extends It{constructor(t,e,i){super(t,e,Z.LINE_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.defaultColor=i?.defaultColor||[255,193,7,1],this.defaultWidth=i?.defaultWidth||3,this.defaultStyle=i?.defaultStyle||"solid",this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.LINE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("color")||this.defaultColor,i=t?.get("width")||this.defaultWidth,r=(t?.get("style")||this.defaultStyle)==="dashed"?[10,10]:void 0;return new A({stroke:new G({color:M(e),width:i,lineDash:r})})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;const e=new Y;this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:2,geometryFunction:(i,n)=>{if(i&&i.length>=2){const r=i[0],o=i[1];n?n.setCoordinates([r,o]):n=new pt([r,o])}return n},style:this.getStyleForFeature()}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry(),r=Vt("line_");if(n instanceof pt){const o=n.getCoordinates();if(o&&o.length>=2){const[a,l]=o[0],[h,c]=o[1],[d,u]=U([a,l]),[f,g]=U([h,c]),p=new V({geometry:n.clone(),id:r,startPoint:[d,u],endPoint:[f,g]});p.set("color",this.defaultColor),p.set("width",this.defaultWidth),p.set("style",this.defaultStyle),this.source?.addFeature(p),this.features.set(r,p),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:r,startPoint:[d,u],endPoint:[f,g],color:this.defaultColor,width:this.defaultWidth,style:this.defaultStyle})}}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!0,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0);const o=()=>{const a=i.getGeometry();if(a instanceof pt){const l=a.getCoordinates();if(l.length>=2){const[h,c]=U(l[0]),[d,u]=U(l[1]),f=i.get("id");i.set("startPoint",[h,c]),i.set("endPoint",[d,u]),i.changed(),this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,startPoint:[h,c],endPoint:[d,u],color:i.get("color"),width:i.get("width"),style:i.get("style")})}}this.mapView?.render()};this.transformInteraction.on("scaleend",o),this.transformInteraction.on("translateend",o),this.transformInteraction.on("rotateend",o),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction.dispose?.(),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addLine(t){const e=ut(t.startPoint),i=ut(t.endPoint),n=new pt([e,i]),r=new V({geometry:n,id:t.id,startPoint:t.startPoint,endPoint:t.endPoint});r.set("color",t.color||this.defaultColor),r.set("width",t.width||this.defaultWidth),r.set("style",t.style||this.defaultStyle),this.source?.addFeature(r),this.features.set(t.id,r)}removeLine(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllLines(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i.toString(),startPoint:e.get("startPoint"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")})}),t}getLine(t){const e=this.features.get(t);if(e)return{id:t,startPoint:e.get("startPoint"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")}}updateLineStyle(t,e,i,n){const r=this.features.get(t);r&&(r.set("color",e),r.set("width",i),r.set("style",n),r.changed(),this.mapView?.render())}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=null}clearAll(){this.clear(),this.features.clear(),this.stopEdit()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}updateData(t){t.lines&&(this.clearAll(),t.lines.forEach(e=>this.addLine(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class Qy extends It{constructor(t,e,i,n){super(t,e,Z.BEZIER_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.tempPoints=[],this.defaultColor=i?.defaultColor||[156,39,176,1],this.defaultWidth=i?.defaultWidth||3,this.defaultStyle=i?.defaultStyle||"solid",this.t=n||Hi("zh"),this.source=new Y,this.layer=new bt({source:this.source,style:r=>this.getStyleForFeature(r),properties:{id:t,name:e,type:Z.BEZIER_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setTranslations(t){this.t=t}getStyleForFeature(t){const e=t?.get("color")||this.defaultColor,i=t?.get("width")||this.defaultWidth,r=(t?.get("style")||this.defaultStyle)==="dashed"?[10,10]:void 0;return new A({stroke:new G({color:M(e),width:i,lineDash:r})})}computeBezierPoints(t,e,i,n,r=100){const o=[];for(let a=0;a<=r;a++){const l=a/r,h=1-l,c=h*h*h*t[0]+3*h*h*l*e[0]+3*h*l*l*i[0]+l*l*l*n[0],d=h*h*h*t[1]+3*h*h*l*e[1]+3*h*l*l*i[1]+l*l*l*n[1];o.push([c,d])}return o}createBezierGeometry(t,e,i,n){const r=this.computeBezierPoints(t,e,i,n);return new pt(r)}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.stopEdit(),this.onDrawCompleteCallback=t||null,this.tempPoints=[];const e=new Y;let i=[];const n=new Y,r=new bt({source:n,style:a=>a.get("type")==="control-line"?new A({stroke:new G({color:"rgba(255,0,0,0.4)",width:1,lineDash:[5,5]})}):new A({stroke:new G({color:M(this.defaultColor),width:this.defaultWidth,lineDash:this.defaultStyle==="dashed"?[10,10]:void 0})})});this.mapView?.addLayer(r);const o=a=>{if(n.clear(),a.length>=2)for(let l=0;l<a.length-1;l++){const h=new V({geometry:new pt([a[l],a[l+1]]),type:"control-line"});n.addFeature(h)}};this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:4,freehand:!1,style:new A({stroke:new G({color:M(this.defaultColor),width:this.defaultWidth,lineDash:this.defaultStyle==="dashed"?[10,10]:void 0})}),geometryFunction:(a,l)=>{if(i=a,o(i),i.length===0)return l;if(i.length===1)return l?l.setCoordinates([i[0],i[0]]):l=new pt([i[0],i[0]]),l;if(i.length===2)return l?l.setCoordinates([i[0],i[1]]):l=new pt([i[0],i[1]]),l;if(i.length===3){const h=new pt([i[0],i[1],i[2]]);return l?l.setCoordinates([i[0],i[1],i[2]]):l=h,l}if(i.length===4){const[h,c,d,u]=i,f=this.computeBezierPoints(h,c,d,u,100);return l?l.setCoordinates(f):l=new pt(f),l}return l}}),this.drawInteraction.on("drawstart",()=>{i=[],e.clear(),n.clear()}),this.drawInteraction.on("drawend",a=>{if(this.mapView?.removeLayer(r),i.length===4){const[l,h,c,d]=i,u=this.createBezierGeometry(l,h,c,d),f=Vt("bezier_"),[g,p]=U(l),[m,y]=U(h),[x,E]=U(c),[w,C]=U(d),v=new V({geometry:u,id:f,startPoint:[g,p],controlPoint1:[m,y],controlPoint2:[x,E],endPoint:[w,C]});v.set("color",this.defaultColor),v.set("width",this.defaultWidth),v.set("style",this.defaultStyle),this.source?.addFeature(v),this.features.set(f,v),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:f,startPoint:[g,p],controlPoint1:[m,y],controlPoint2:[x,E],endPoint:[w,C],color:this.defaultColor,width:this.defaultWidth,style:this.defaultStyle})}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit(),this.stopDraw();const i=this.features.get(t);if(!i){console.warn(this.t.bezierFeatureNotFound,t);return}this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=new Y;n.addFeature(i);const r=n.getFeaturesCollection();this.transformInteraction=new _e({features:r,translate:!0,scale:!0,rotate:!0,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0);const o=()=>{const a=i.getGeometry();if(a instanceof pt){const l=a.getCoordinates();if(l.length>0){const[h,c]=U(l[0]),[d,u]=U(l[l.length-1]),f=i.get("startPoint"),g=i.get("controlPoint1"),p=i.get("controlPoint2"),m=i.get("endPoint");if(f&&m){const y=ut(f),x=ut(m),E=ut([h,c]),w=ut([d,u]),C=E[0]-y[0],v=E[1]-y[1],_=x[0]-y[0],b=x[1]-y[1],S=w[0]-E[0],P=w[1]-E[1],L=Math.sqrt(_*_+b*b),k=Math.sqrt(S*S+P*P),F=L>0?k/L:1;if(g){const N=ut(g),tt=y[0]+(N[0]-y[0])*F+C,et=y[1]+(N[1]-y[1])*F+v,[ht,ot]=U([tt,et]);i.set("controlPoint1",[ht,ot])}if(p){const N=ut(p),tt=y[0]+(N[0]-y[0])*F+C,et=y[1]+(N[1]-y[1])*F+v,[ht,ot]=U([tt,et]);i.set("controlPoint2",[ht,ot])}i.set("startPoint",[h,c]),i.set("endPoint",[d,u]);const O=ut([h,c]),R=i.get("controlPoint1"),B=i.get("controlPoint2"),D=ut([d,u]);if(R&&B){const N=ut(R),tt=ut(B),et=this.createBezierGeometry([O[0],O[1]],[N[0],N[1]],[tt[0],tt[1]],[D[0],D[1]]);i.setGeometry(et)}i.changed();const z=i.get("id");this.onEditCompleteCallback&&z&&this.onEditCompleteCallback({id:z,startPoint:[h,c],controlPoint1:i.get("controlPoint1"),controlPoint2:i.get("controlPoint2"),endPoint:[d,u],color:i.get("color"),width:i.get("width"),style:i.get("style")})}}}this.mapView?.render()};this.transformInteraction.on("scaleend",o),this.transformInteraction.on("translateend",o),this.transformInteraction.on("rotateend",o),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction.dispose?.(),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addBezier(t){const e=ut(t.startPoint),i=ut(t.controlPoint1),n=ut(t.controlPoint2),r=ut(t.endPoint),o=this.createBezierGeometry([e[0],e[1]],[i[0],i[1]],[n[0],n[1]],[r[0],r[1]]),a=new V({geometry:o,id:t.id,startPoint:t.startPoint,controlPoint1:t.controlPoint1,controlPoint2:t.controlPoint2,endPoint:t.endPoint});a.set("color",t.color||this.defaultColor),a.set("width",t.width||this.defaultWidth),a.set("style",t.style||this.defaultStyle),this.source?.addFeature(a),this.features.set(t.id,a)}removeBezier(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllBeziers(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i.toString(),startPoint:e.get("startPoint"),controlPoint1:e.get("controlPoint1"),controlPoint2:e.get("controlPoint2"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")})}),t}getBezier(t){const e=this.features.get(t);if(e)return{id:t,startPoint:e.get("startPoint"),controlPoint1:e.get("controlPoint1"),controlPoint2:e.get("controlPoint2"),endPoint:e.get("endPoint"),color:e.get("color"),width:e.get("width"),style:e.get("style")}}updateBezierStyle(t,e,i,n){const r=this.features.get(t);r&&(r.set("color",e),r.set("width",i),r.set("style",n),r.changed(),this.mapView?.render())}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.tempPoints=[],this.onDrawCompleteCallback=null}clearAll(){this.clear(),this.features.clear(),this.stopEdit()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}updateData(t){t.beziers&&(this.clearAll(),t.beziers.forEach(e=>this.addBezier(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class t_ extends It{constructor(t,e,i){super(t,e,Z.SECTOR_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.tempPoints=[],this.defaultFillColor=i?.defaultFillColor||[33,150,243,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[33,150,243,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,this.defaultOutlineStyle=i?.defaultOutlineStyle||"solid",this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.SECTOR_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("fillColor")||this.defaultFillColor,i=t?.get("outlineColor")||this.defaultOutlineColor,n=t?.get("outlineWidth")||this.defaultOutlineWidth,o=(t?.get("outlineStyle")||this.defaultOutlineStyle)==="dashed"?[10,10]:void 0;return new A({fill:new j({color:M(e)}),stroke:new G({color:M(i),width:n,lineDash:o})})}createSectorGeometry(t,e,i,n,r=64){const o=[[t[0],t[1]]];let a=i,l=n;a>l&&(l+=2*Math.PI);const h=(l-a)/r;for(let c=0;c<=r;c++){const d=a+c*h,u=t[0]+e*Math.cos(d),f=t[1]+e*Math.sin(d);o.push([u,f])}return o.push([t[0],t[1]]),new it([o])}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startDraw(t){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onDrawCompleteCallback=t||null;const e=new Y;this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:3,freehand:!1,style:new A({stroke:new G({color:M(this.defaultOutlineColor),width:this.defaultOutlineWidth,lineDash:this.defaultOutlineStyle==="dashed"?[10,10]:void 0})})}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry();if(n instanceof pt){const r=n.getCoordinates();if(r.length===3){const o=r[0],a=r[1],l=r[2],h=o[0]-a[0],c=o[1]-a[1],d=Math.sqrt(h*h+c*c),u=Math.atan2(c,h),f=l[0]-a[0],g=l[1]-a[1];let p=Math.atan2(g,f),m=p-u;if(m<0&&(m+=2*Math.PI),m>Math.PI){m=2*Math.PI-m;const y=p,x=p+m,E=Vt("sector_"),[w,C]=U(a),v=this.createSectorGeometry([a[0],a[1]],d,y,x),_=new V({geometry:v,id:E,center:[w,C],radius:d,startAngle:y,endAngle:x});_.set("fillColor",this.defaultFillColor),_.set("outlineColor",this.defaultOutlineColor),_.set("outlineWidth",this.defaultOutlineWidth),_.set("outlineStyle",this.defaultOutlineStyle),this.source?.addFeature(_),this.features.set(E,_),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:E,center:[w,C],radius:d,startAngle:y,endAngle:x,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}else{const y=u,x=u+m,E=Vt("sector_"),[w,C]=U(a),v=this.createSectorGeometry([a[0],a[1]],d,y,x),_=new V({geometry:v,id:E,center:[w,C],radius:d,startAngle:y,endAngle:x});_.set("fillColor",this.defaultFillColor),_.set("outlineColor",this.defaultOutlineColor),_.set("outlineWidth",this.defaultOutlineWidth),_.set("outlineStyle",this.defaultOutlineStyle),this.source?.addFeature(_),this.features.set(E,_),this.layer?.setZIndex(999),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:E,center:[w,C],radius:d,startAngle:y,endAngle:x,fillColor:this.defaultFillColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth,outlineStyle:this.defaultOutlineStyle})}}}e.clear(),this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null,this.onDrawCompleteCallback=null,this.mapView?.render()}),this.mapView?.addInteraction(this.drawInteraction)}startEdit(t,e){this.stopEdit();const i=this.features.get(t);if(!i)return;this.editingFeature=i,this.onEditCompleteCallback=e||null;const n=i.get("startAngle")||0,r=i.get("endAngle")||Math.PI*2,o=new Y;o.addFeature(i);const a=o.getFeaturesCollection();this.transformInteraction=new _e({features:a,translate:!0,scale:!0,rotate:!0,keepAspectRatio:()=>!1}),this.transformInteraction.setActive(!0);const l=()=>{const h=i.getGeometry();if(h instanceof it){const c=h.getExtent(),d=(c[0]+c[2])/2,u=(c[1]+c[3])/2,f=Math.max(c[2]-c[0],c[3]-c[1])/2,[g,p]=U([d,u]);i.set("center",[g,p]),i.set("radius",f),i.set("startAngle",n),i.set("endAngle",r),i.changed();const m=i.get("id");this.onEditCompleteCallback&&m&&this.onEditCompleteCallback({id:m,center:[g,p],radius:f,startAngle:n,endAngle:r,fillColor:i.get("fillColor"),outlineColor:i.get("outlineColor"),outlineWidth:i.get("outlineWidth"),outlineStyle:i.get("outlineStyle")})}this.mapView?.render()};this.transformInteraction.on("scaleend",l),this.transformInteraction.on("translateend",l),this.transformInteraction.on("rotateend",l),this.mapView?.addInteraction(this.transformInteraction)}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction.dispose?.(),this.transformInteraction=null),this.editingFeature=null,this.onEditCompleteCallback=null}addSector(t){const e=ut(t.center),i=this.createSectorGeometry([e[0],e[1]],t.radius,t.startAngle,t.endAngle),n=new V({geometry:i,id:t.id,center:t.center,radius:t.radius,startAngle:t.startAngle,endAngle:t.endAngle});n.set("fillColor",t.fillColor||this.defaultFillColor),n.set("outlineColor",t.outlineColor||this.defaultOutlineColor),n.set("outlineWidth",t.outlineWidth||this.defaultOutlineWidth),n.set("outlineStyle",t.outlineStyle||this.defaultOutlineStyle),this.source?.addFeature(n),this.features.set(t.id,n)}removeSector(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllSectors(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i.toString(),center:e.get("center"),radius:e.get("radius"),startAngle:e.get("startAngle")||0,endAngle:e.get("endAngle")||Math.PI*2,fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")})}),t}getSector(t){const e=this.features.get(t);if(e)return{id:t,center:e.get("center"),radius:e.get("radius"),startAngle:e.get("startAngle")||0,endAngle:e.get("endAngle")||Math.PI*2,fillColor:e.get("fillColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth"),outlineStyle:e.get("outlineStyle")}}updateSectorStyle(t,e,i,n,r){const o=this.features.get(t);o&&(o.set("fillColor",e),o.set("outlineColor",i),o.set("outlineWidth",n),o.set("outlineStyle",r),o.setStyle(this.getStyleForFeature(o)),o.changed(),this.mapView?.render())}stopDraw(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.tempPoints=[],this.onDrawCompleteCallback=null}clearAll(){this.clear(),this.features.clear(),this.stopEdit()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return this.transformInteraction!==null}setEditable(t){t?this.layer.set("pointer-events",!0):(this.stopEdit(),this.stopDraw())}getEditingId(){return this.editingFeature?.get("id")||null}cancelDraw(){this.stopDraw()}cancelEdit(){this.stopEdit()}updateData(t){t.sectors&&(this.clearAll(),t.sectors.forEach(e=>this.addSector(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class Dd extends It{constructor(t,e,i){super(t,e,Z.DISTANCE_MEASUREMENT,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.measurements=new Map,this.onCompleteCallback=null,this.mapView=null,this.lineColor=i?.lineColor||[0,170,255,1],this.lineWidth=i?.lineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.DISTANCE_MEASUREMENT},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startMeasure(t){this.stopMeasure(),this.onCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"LineString"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates(),o=r.map(u=>{const[f,g]=U(u);return{longitude:f,latitude:g}});let a=0;for(let u=0;u<o.length-1;u++)a+=this.calculateDistance(o[u],o[u+1]);const l=Vt("dist_"),h=Math.floor(o.length/2),c=a>=1e3?`${(a/1e3).toFixed(2)} km`:`${a.toFixed(0)} m`,d=new V({geometry:new rt([r[h][0],r[h][1]]),measurementId:l});d.setStyle(new A({text:new te({text:c,font:"14px sans-serif",fill:new j({color:"#ffffff"}),stroke:new G({color:"#000000",width:2}),offsetY:-10,textAlign:"center"})})),this.measurements.set(l,{id:l,points:o,distance:a}),i.set("measurementId",l),i.set("type","distance"),i.setStyle(new A({stroke:new G({color:M(this.lineColor),width:this.lineWidth})})),this.source?.addFeature(d),this.onCompleteCallback&&this.onCompleteCallback({points:o,distance:a,id:l,isDrawing:!1}),this.stopMeasure()}),this.mapView?.addInteraction(this.drawInteraction)}calculateDistance(t,e){const i=new pt([[t.longitude,t.latitude],[e.longitude,e.latitude]]);return rc(i,{projection:"EPSG:4326"})}stopMeasure(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onCompleteCallback=null}deleteMeasurement(t){if(this.measurements.get(t)){let i=[];return this.source?.forEachFeature(n=>{n.get("measurementId")===t&&i.push(n)}),i.forEach(n=>this.source?.removeFeature(n)),this.measurements.delete(t),!0}return!1}findMeasurementIdByGraphic(t){return t.get("measurementId")||null}clearAllMeasurements(){this.clear(),this.measurements.clear(),this.stopMeasure()}getAllMeasurements(){return Array.from(this.measurements.values())}isCurrentlyMeasuring(){return this.drawInteraction!==null}updateData(t){}}class kd extends It{constructor(t,e,i){super(t,e,Z.AREA_MEASUREMENT,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.measurements=new Map,this.onCompleteCallback=null,this.mapView=null,this.fillColor=i?.fillColor||[0,170,255,.2],this.lineColor=i?.lineColor||[0,170,255,1],this.lineWidth=i?.lineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.AREA_MEASUREMENT},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startMeasure(t){this.stopMeasure(),this.onCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"Polygon"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,n=i.getGeometry(),r=n.getCoordinates()[0],o=r.map(f=>{const[g,p]=U(f);return{longitude:g,latitude:p}}).slice(0,-1),a=oc(n),l=Vt("area_");let h=0,c=0;for(const f of r.slice(0,-1))h+=f[0],c+=f[1];h/=r.length-1,c/=r.length-1;const d=a>=1e6?`${(a/1e6).toFixed(2)} km²`:`${a.toFixed(0)} m²`,u=new V({geometry:new rt([h,c]),measurementId:l});u.setStyle(new A({text:new te({text:d,font:"14px sans-serif",fill:new j({color:"#ffffff"}),stroke:new G({color:"#000000",width:2}),textAlign:"center"})})),this.measurements.set(l,{id:l,points:o,area:a}),i.set("measurementId",l),i.set("type","area"),i.setStyle(new A({fill:new j({color:M(this.fillColor)}),stroke:new G({color:M(this.lineColor),width:this.lineWidth})})),this.source?.addFeature(u),this.onCompleteCallback&&this.onCompleteCallback({id:l,points:o,area:a}),this.stopMeasure()}),this.mapView?.addInteraction(this.drawInteraction)}stopMeasure(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onCompleteCallback=null}deleteMeasurement(t){if(this.measurements.get(t)){let i=[];return this.source?.forEachFeature(n=>{n.get("measurementId")===t&&i.push(n)}),i.forEach(n=>this.source?.removeFeature(n)),this.measurements.delete(t),!0}return!1}findMeasurementIdByGraphic(t){return t.get("measurementId")||null}clearAllMeasurements(){this.clear(),this.measurements.clear(),this.stopMeasure()}getAllMeasurements(){return Array.from(this.measurements.values())}isCurrentlyMeasuring(){return this.drawInteraction!==null}updateData(t){}}class e_ extends It{constructor(t,e,i){super(t,e,Z.POINT_COORDINATE_PICK,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.picks=new Map,this.onCompleteCallback=null,this.mapView=null,this.features=new Map,this.textColor=i?.textColor||[0,200,255,1],this.textSize=i?.textSize||12,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POINT_COORDINATE_PICK},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex}),this.t=i?.t||null}setView(t){this.mapView=t}createLayer(t){return t.addLayer(this.layer),this.layer}startPick(t){this.stopPick(),this.onCompleteCallback=t||null,this.drawInteraction=new ee({source:this.source,type:"Point"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates(),[o,a]=U(r),l=Vt("coord_"),h=Date.now();i.setStyle(new A({image:new Le({radius:6,fill:new j({color:"#00aaff"}),stroke:new G({color:"#ffffff",width:2})})})),i.set("id",l),i.set("type","point_pick"),this.features.set(l,i);const c=new V({geometry:new rt(r),id:l+"_label",longitude:o,latitude:a,timestamp:h});c.set("type","point_pick"),c.setStyle(new A({text:new te({text:this.t?.pointPick.label_text||"Point Pick",font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"bottom",offsetY:-10})})),this.source?.addFeature(c),this.features.set(l+"_label",c);const d={id:l,longitude:o,latitude:a,timestamp:h};this.picks.set(l,d),this.onCompleteCallback&&this.onCompleteCallback(d),this.stopPick()}),this.mapView?.addInteraction(this.drawInteraction)}stopPick(){this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),this.onCompleteCallback=null}removeCoordinate(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t));const i=this.features.get(t+"_label");return i&&(this.source?.removeFeature(i),this.features.delete(t+"_label")),this.picks.delete(t),!0}clearAllCoordinates(){this.clear(),this.features.clear(),this.picks.clear(),this.stopPick()}getAllCoordinates(){return Array.from(this.picks.values())}getCoordinate(t){return this.picks.get(t)}highlightCoordinate(t){this.features.forEach((e,i)=>{const n=i===t;e.setStyle(new A({text:new te({text:this.t?.pointPick.label_text||"Point Pick",font:`${this.textSize}px sans-serif`,fill:new j({color:M(n?[255,170,0,1]:this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"bottom",offsetY:-10})}))}),this.mapView?.render()}clearHighlight(){this.features.forEach(t=>{t.setStyle(new A({text:new te({text:this.t?.pointPick.label_text||"Point Pick",font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"bottom",offsetY:-10})}))}),this.mapView?.render()}stopDraw(){this.stopPick()}isDrawActive(){return this.drawInteraction!==null}isEditActive(){return!1}setEditable(t){t||this.stopPick()}stopEdit(){this.stopPick()}getEditingId(){return null}cancelDraw(){this.stopPick()}cancelEdit(){this.stopPick()}updateData(t){}destroy(){this.stopPick(),super.destroy()}}const Lt={Layers:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg>',Basemap:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',Draw:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/><circle cx="11" cy="11" r="2"/></svg>',Tools:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"/></svg>',ZoomIn:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>',ZoomOut:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>',Locate:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 2v4M12 22v-4M2 12h4M22 12h-4"/><circle cx="12" cy="12" r="3"/></svg>',Eye:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>',EyeOff:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>',Delete:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/><line x1="10" y1="11" x2="10" y2="17"/><line x1="14" y1="11" x2="14" y2="17"/></svg>',Close:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',Check:'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>',Circle:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/></svg>',Ruler:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 2v20M8 2v20M12 2v20M16 2v20M20 2v20"/><line x1="4" y1="6" x2="20" y2="6"/><line x1="4" y1="12" x2="20" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>',Area:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="3 3 21 3 21 21 3 21 3 3"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>',DragHandle:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="12" r="1"/><circle cx="9" cy="8" r="1"/><circle cx="9" cy="16" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="8" r="1"/><circle cx="15" cy="16" r="1"/></svg>',StrokeWidth:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12" stroke-width="3"/><line x1="3" y1="18" x2="21" y2="18" stroke-width="4"/></svg>',StrokeStyle:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="12" x2="21" y2="12" stroke-dasharray="4 4"/></svg>',Point:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/></svg>',Line2:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="2" y1="12" x2="22" y2="12"/></svg>',Polygon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>'};class i_{constructor(t){this.buttons=new Map,this.scrollUpBtn=null,this.scrollDownBtn=null,this.isScrolling=!1,this.scrollTimer=null,this.options=t,this.element=this.createElement(),t.container.appendChild(this.element),this.scrollContainer=this.element.querySelector(".toolbar-scroll-container"),this.attachScrollEvents(),this.checkScrollPosition()}createElement(){const t=this.options.theme==="dark",e=document.createElement("div");e.style.cssText=`
852
853
  position: absolute;
853
854
  top: 10px;
854
855
  right: 10px;
@@ -996,6 +997,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
996
997
  padding: 2px 10px;
997
998
  border-bottom: 1px solid ${t?"#333":"#e0e0e0"};
998
999
  background: ${t?"#2d2d2d":"#f5f5f5"};
1000
+ user-select: none;
999
1001
  `;const o=document.createElement("span");o.style.cssText=`color: ${t?"#fff":"#333"}; font-size: 12px; font-weight: 500;`,o.textContent=this.options.title,r.appendChild(o);const a=document.createElement("button");return a.style.cssText=`
1000
1002
  background: none;
1001
1003
  border: none;
@@ -1030,6 +1032,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1030
1032
  `,l=document.createElement("style");l.id=i,l.textContent=a,e.appendChild(l)}getContentContainer(){return this.contentContainer}appendChild(t){this.contentContainer.appendChild(t)}onAttached(){const t=this.options.theme==="dark";this.injectScrollbarStyles(t)}updateTheme(t){const e=t==="dark";this.element.style.background=e?"#1e1e1e":"#ffffff",this.element.style.borderColor=e?"#333":"#e0e0e0";const i=this.element.querySelector("div:first-child");if(i){i.style.borderBottomColor=e?"#333":"#e0e0e0",i.style.background=e?"#2d2d2d":"#f5f5f5";const r=i.querySelector("span");r&&(r.style.color=e?"#fff":"#333");const o=i.querySelector("button");o&&(o.style.color=e?"#ccc":"#666")}const n=this.element.parentElement;if(n){const r=n.querySelector("#earthview-popup-scroll-styles");r&&r.remove(),this.injectScrollbarStyles(e)}}destroy(){this.element.remove()}getElement(){return this.element}}class n_{constructor(t){this.activeCategory=qt.DATA_LAYER,this.featureListPanel=null,this.featureDetailPanel=null,this.currentFeatureListLayerId=null,this.currentFeatureId=null,this.SYSTEM_LAYER_IDS=["circle-draw","rectangle-draw","triangle-draw","distance-measurement","area-measurement"],this.options=t,this.element=this.createElement(),this.render()}createElement(){const t=document.createElement("div");return t.style.cssText=`
1031
1033
  width: 100%;
1032
1034
  height: 100%;
1035
+ user-select: none;
1033
1036
  `,t}isSystemLayer(t){return this.SYSTEM_LAYER_IDS.includes(t)}getLayerDisplayName(t){switch(t.id){case"circle-draw":return this.options.t.circleDrawLayer;case"rectangle-draw":return this.options.t.rectangleDrawLayer;case"triangle-draw":return this.options.t.triangleDrawLayer;case"distance-measurement":return this.options.t.distanceMeasurementLayer;case"area-measurement":return this.options.t.areaMeasurementLayer;case"freehand-draw":return this.options.t.freehandDrawLayer;case"ellipse-draw":return this.options.t.ellipseDrawLayer;case"marker-draw":return this.options.t.markerDrawLayer;case"text-draw":return this.options.t.textDrawLayer;case"image-draw":return this.options.t.imageDrawLayer;case"arrow-draw":return this.options.t.arrowDrawLayer;case"line-draw":return this.options.t.lineDrawLayer;case"bezier-draw":return this.options.t.bezierDrawLayer;case"sector-draw":return this.options.t.sectorDrawLayer;case"point-coordinate-pick":return this.options.t.pointPickLayer;case"line-coordinate-pick":return this.options.t.linePickLayer;case"polygon-coordinate-pick":return this.options.t.polygonPickLayer;default:return t.name}}getLayerClassification(t){const e=["circle-draw","rectangle-draw","triangle-draw","freehand-draw","ellipse-draw","marker-draw","text-draw","image-draw","arrow-draw","line-draw","bezier-draw","sector-draw"],i=["distance-measurement","area-measurement","point-coordinate-pick","line-coordinate-pick","polygon-coordinate-pick"];return e.includes(t)?qt.DRAW_LAYER:i.includes(t)?qt.TOOL_LAYER:qt.DATA_LAYER}getClassificationIcon(t){switch(t){case qt.DATA_LAYER:return"📊";case qt.DRAW_LAYER:return"✏️";case qt.TOOL_LAYER:return"🛠️";default:return"📁"}}getClassificationLabel(t){switch(t){case qt.DATA_LAYER:return this.options.t.dataLayers||"Data Layers";case qt.DRAW_LAYER:return this.options.t.drawLayers||"Draw Layers";case qt.TOOL_LAYER:return this.options.t.toolLayers||"Tool Layers";default:return""}}getClassificationOrder(){return[qt.DATA_LAYER,qt.DRAW_LAYER,qt.TOOL_LAYER]}render(){if(this.element.innerHTML="",this.options.layerList.length===0){const n=document.createElement("div");n.style.cssText=`
1034
1037
  padding: 16px;
1035
1038
  text-align: center;
@@ -1045,6 +1048,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1045
1048
  border-left: ${n?"3px solid #00aaff":"3px solid transparent"};
1046
1049
  transition: all 0.2s;
1047
1050
  border-bottom: 1px solid ${r?"#333":"#eee"};
1051
+ user-select: none;
1048
1052
  `,a.onmouseenter=()=>{n||(a.style.background=r?"#2a2a2a":"#f5f5f5")},a.onmouseleave=()=>{n||(a.style.background="transparent")},a.onclick=()=>{this.activeCategory===t?this.activeCategory=null:this.activeCategory=t,this.hideFeatureListPanel(),this.hideFeatureDetailPanel(),this.render()};const l=document.createElement("span");l.style.cssText="font-size: 14px;",l.textContent=i,a.appendChild(l);const h=document.createElement("span");h.style.cssText=`color: ${r?"#fff":"#333"}; font-size: 12px; flex: 1;`,h.textContent=`${e} (${o})`,a.appendChild(h);const c=document.createElement("span");return c.style.cssText=`color: ${r?"#888":"#999"}; font-size: 10px;`,c.textContent=n?"▼":"▶",a.appendChild(c),a}createSubMenu(t,e,i){const n=document.createElement("div");n.style.cssText=`
1049
1053
  background: ${e?"#252525":"#fafafa"};
1050
1054
  border-bottom: 1px solid ${e?"#333":"#eee"};
@@ -1102,6 +1106,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1102
1106
  background: ${i?"#2d2d2d":"#f5f5f5"};
1103
1107
  border-bottom: 1px solid ${i?"#333":"#e0e0e0"};
1104
1108
  flex-shrink: 0;
1109
+ user-select: none;
1105
1110
  `;const d=document.createElement("span");d.style.cssText=`color: ${i?"#fff":"#333"}; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;`,d.textContent=`${e} - ${this.options.t.coordinateData||"coordinateData"}`,c.appendChild(d);const u=document.createElement("button");u.style.cssText=`
1106
1111
  background: none;
1107
1112
  border: none;
@@ -1172,6 +1177,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1172
1177
  background: ${i?"#2d2d2d":"#f5f5f5"};
1173
1178
  border-bottom: 1px solid ${i?"#444":"#ddd"};
1174
1179
  flex-shrink: 0;
1180
+ user-select: none;
1175
1181
  `;const g=document.createElement("span");g.style.cssText=`color: ${i?"#fff":"#333"}; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;`,g.textContent=this.options.t.details||"details",f.appendChild(g);const p=document.createElement("button");p.style.cssText=`
1176
1182
  background: none;
1177
1183
  border: none;
@@ -1269,6 +1275,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1269
1275
  `,e.textContent=t,document.body.appendChild(e),setTimeout(()=>e.remove(),2e3)}updateData(t){this.options.layerList=t,this.render()}updateTheme(t){this.options.theme=t,this.render()}setActiveCategory(t){this.activeCategory=t,this.render()}getElement(){return this.element}destroy(){this.hideFeatureListPanel(),this.hideFeatureDetailPanel(),this.element.remove()}}class s_{constructor(t){this.props=t,this.element=this.createElement(),this.render()}createElement(){const t=document.createElement("div");return t.style.cssText=`
1270
1276
  width: 100%;
1271
1277
  height: 100%;
1278
+ user-select: none;
1272
1279
  `,t}render(){this.element.innerHTML="";const t=this.props.theme==="dark";for(const e of this.props.options){const i=document.createElement("div"),n=this.props.currentBasemap===e.value;i.style.cssText=`
1273
1280
  display: flex;
1274
1281
  align-items: center;
@@ -1281,6 +1288,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1281
1288
  `,i.onmouseenter=()=>{n||(i.style.background=t?"#2a2a2a":"#f5f5f5")},i.onmouseleave=()=>{n||(i.style.background="transparent")},i.onclick=()=>{this.props.currentBasemap!==e.value&&this.props.onSelect(e.value)};const r=document.createElement("span");r.style.cssText="font-size: 14px;",r.textContent=e.icon,i.appendChild(r);const o=document.createElement("span");if(o.style.cssText=`color: ${t?"#fff":"#333"}; font-size: 12px; flex: 1;`,o.textContent=e.label,i.appendChild(o),n){const a=document.createElement("span");a.innerHTML=Lt.Check,a.style.cssText="color: #00aaff;",i.appendChild(a)}this.element.appendChild(i)}}updateCurrentBasemap(t){this.props.currentBasemap!==t&&(this.props.currentBasemap=t,this.render())}updateTheme(t){this.props.theme=t,this.render()}updateProps(t){Object.assign(this.props,t),this.render()}getElement(){return this.element}}class r_{constructor(t){this.props=t,this.element=this.createElement(),this.render()}createElement(){const t=document.createElement("div");return t.style.cssText=`
1282
1289
  width: 100%;
1283
1290
  height: 100%;
1291
+ user-select: none;
1284
1292
  `,t}render(){this.element.innerHTML="",this.addSectionTitle(this.props.t.lineTool),this.element.appendChild(this.createToolRow(this.createLineIcon(),this.props.t.lineTool,this.props.onDrawLine)),this.element.appendChild(this.createToolRow(this.createArrowIcon(),this.props.t.arrowTool,this.props.onDrawArrow)),this.element.appendChild(this.createToolRow(this.createBezierIcon(),this.props.t.bezierTool,this.props.onDrawBezier)),this.addSectionTitle(this.props.t.drawTools),this.element.appendChild(this.createToolRow(Lt.Circle,this.props.t.drawCircle,this.props.onDrawCircle)),this.element.appendChild(this.createToolRow(this.createEllipseIcon(),this.props.t.ellipseTool,this.props.onDrawEllipse)),this.element.appendChild(this.createToolRow(this.createRectangleIcon(),this.props.t.rectangleTool,this.props.onDrawRectangle)),this.element.appendChild(this.createToolRow(this.createTriangleIcon(),this.props.t.triangleTool,this.props.onDrawTriangle)),this.element.appendChild(this.createToolRow(this.createSectorIcon(),this.props.t.sectorTool,this.props.onDrawSector)),this.addSectionTitle(this.props.t.drawFreehandLine),this.element.appendChild(this.createToolRow(this.createFreehandIcon(),this.props.t.drawFreehandLine,this.props.onDrawFreehand)),this.element.appendChild(this.createToolRow(this.createFreehandPolygonIcon(),this.props.t.drawFreehandPolygon,this.props.onDrawFreehandPolygon)),this.addSectionTitle(this.props.t.drawMarker),this.element.appendChild(this.createToolRow(this.createMarkerIcon(),this.props.t.drawMarker,this.props.onDrawMarker)),this.element.appendChild(this.createToolRow(this.createTextIcon(),this.props.t.drawText,this.props.onDrawText)),this.element.appendChild(this.createToolRow(this.createImageIcon(),this.props.t.drawImage,this.props.onDrawImage))}addSectionTitle(t){const e=this.props.theme==="dark",i=document.createElement("div");i.style.cssText=`
1285
1293
  padding: 8px 12px 4px 12px;
1286
1294
  color: ${e?"#888":"#999"};
@@ -1341,6 +1349,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1341
1349
  </svg>`}updateTheme(t){this.props.theme=t,this.render()}getElement(){return this.element}}class o_{constructor(t){this.props=t,this.element=this.createElement(),this.render()}createElement(){const t=document.createElement("div");return t.style.cssText=`
1342
1350
  width: 100%;
1343
1351
  height: 100%;
1352
+ user-select: none;
1344
1353
  `,t}render(){this.element.innerHTML="";const t=this.props.theme==="dark",e=this.createTitle(this.props.t.distanceMeasure,t);this.element.appendChild(e);const i=this.createMeasureRow(Lt.Ruler,this.props.t.distanceMeasure,"distance",this.props.onDistanceMeasure);this.element.appendChild(i);const n=this.createMeasureRow(Lt.Area,this.props.t.areaMeasure,"area",this.props.onAreaMeasure);this.element.appendChild(n);const r=this.createTitle(this.props.t.coordinatePick,t);this.element.appendChild(r);const o=this.createPickRow(Lt.Point,this.props.t.pointPick.default_name,"point",this.props.onPointCoordinatePick);this.element.appendChild(o);const a=this.createPickRow(Lt.Line2,this.props.t.linePick.default_name,"line",this.props.onLineCoordinatePick);this.element.appendChild(a);const l=this.createPickRow(Lt.Polygon,this.props.t.polygonPick.default_name,"polygon",this.props.onPolygonCoordinatePick);this.element.appendChild(l)}createTitle(t,e){const i=document.createElement("div");return i.style.cssText=`
1345
1354
  padding: 8px 12px;
1346
1355
  font-size: 11px;
@@ -1543,6 +1552,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1543
1552
  flex-direction: column;
1544
1553
  gap: 12px;
1545
1554
  display: none;
1555
+ user-select: none;
1546
1556
  `,this.spinner=document.createElement("div"),this.spinner.className="loading-spinner",this.spinner.style.cssText=`
1547
1557
  width: 40px;
1548
1558
  height: 40px;
@@ -1587,6 +1597,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1587
1597
  border-bottom: 1px solid ${t?"#333":"#e0e0e0"};
1588
1598
  background: ${t?"#2d2d2d":"#f5f5f5"};
1589
1599
  flex-shrink: 0;
1600
+ user-select: none;
1590
1601
  `;const i=document.createElement("span");i.style.cssText=`color: ${t?"#fff":"#333"}; font-size: 12px; font-weight: 500;`,i.textContent=this.options.t.coordinateData,e.appendChild(i);const n=document.createElement("button");return n.style.cssText=`
1591
1602
  background: none;
1592
1603
  border: none;
@@ -1671,6 +1682,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1671
1682
  background: ${i?"#2d2d2d":"#f5f5f5"};
1672
1683
  border-bottom: 1px solid ${i?"#444":"#ddd"};
1673
1684
  flex-shrink: 0;
1685
+ user-select: none;
1674
1686
  `;const g=document.createElement("span");g.style.cssText=`color: ${i?"#fff":"#333"}; font-size: 13px; font-weight: 600;`,g.textContent=this.options.t.details,f.appendChild(g);const p=document.createElement("button");p.style.cssText=`
1675
1687
  background: none;
1676
1688
  border: none;
@@ -1802,6 +1814,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
1802
1814
  padding: 8px 12px;
1803
1815
  border-bottom: 1px solid ${t?"#3d3d3d":"#eee"};
1804
1816
  background: ${t?"#252525":"#f5f5f5"};
1817
+ user-select: none;
1805
1818
  `;const i=document.createElement("span");return i.style.cssText=`
1806
1819
  color: ${t?"#fff":"#333"};
1807
1820
  font-size: 12px;
package/dist/index.mjs CHANGED
@@ -23164,6 +23164,7 @@ class dm {
23164
23164
  padding: 8px 12px;
23165
23165
  border-bottom: 1px solid ${t ? "#3d3d3d" : "#eee"};
23166
23166
  background: ${t ? "#252525" : "#f5f5f5"};
23167
+ user-select: none;
23167
23168
  `;
23168
23169
  const i = document.createElement("span");
23169
23170
  return i.style.cssText = `
@@ -31386,14 +31387,26 @@ class ar extends Lt {
31386
31387
  duration: 300
31387
31388
  }), n && n.onClick && n.onClick(n, e);
31388
31389
  const a = t.getProperties(), l = a.bubbleBoxCoverImage && a.bubbleBoxCoverImage.trim() !== "", h = a.bubbleBoxTitle && a.bubbleBoxTitle.trim() !== "", c = a.bubbleBoxDescription && a.bubbleBoxDescription.trim() !== "", u = (document.body.getAttribute("data-theme") || "dark") === "dark", f = u ? "#1e1e1e" : "#ffffff", g = u ? "#333" : "#e0e0e0", p = u ? "#fff" : "#333", m = u ? "#aaa" : "#666", y = document.createElement("div");
31389
- y.style.position = "fixed", y.style.zIndex = "10000", y.style.background = f, y.style.border = `1px solid ${g}`, y.style.borderRadius = "8px", y.style.boxShadow = "0 4px 12px rgba(0,0,0,0.3)", y.style.width = `${this.popupWidth}px`, y.style.maxWidth = `${this.popupWidth}px`, y.style.overflow = "hidden";
31390
+ y.style.position = "absolute", y.style.zIndex = "10000", y.style.background = f, y.style.border = `1px solid ${g}`, y.style.borderRadius = "8px", y.style.boxShadow = "0 4px 12px rgba(0,0,0,0.3)", y.style.width = `${this.popupWidth}px`, y.style.maxWidth = `${this.popupWidth}px`, y.style.overflow = "hidden", y.style.userSelect = "none";
31390
31391
  let x = "";
31391
31392
  l && (x += `<div style="height: ${this.coverImageHeight}px; overflow: hidden;">
31392
- <img src="${a.bubbleBoxCoverImage}" style="width: 100%; height: 100%; object-fit: cover;" />
31393
- </div>`), x += '<div style="padding: 12px;">', h && (x += `<div style="font-size: 14px; font-weight: 600; color: ${p}; margin-bottom: 8px;">${this.escapeHtml(a.bubbleBoxTitle)}</div>`), c && (x += `<div style="font-size: 12px; color: ${m}; line-height: 1.5;">${this.escapeHtml(a.bubbleBoxDescription)}</div>`), x += "</div>", y.innerHTML = x;
31394
- const E = t.getGeometry(), w = this.view.getPixelFromCoordinate(E.getCoordinates()), C = this.view.getTargetElement(), v = y.offsetWidth, _ = y.offsetHeight;
31395
- let b = w[0] - v / 2, S = w[1] - _ - 15;
31396
- b = Math.max(10, Math.min(b, window.innerWidth - v - 10)), S = Math.max(10, Math.min(S, window.innerHeight - _ - 10)), y.style.left = `${b}px`, y.style.top = `${S}px`, C.appendChild(y), this.currentPopup = y;
31393
+ <img src="${a.bubbleBoxCoverImage}" style="width: 100%; height: 100%; object-fit: cover;" />
31394
+ </div>`), x += '<div style="padding: 12px;">', h && (x += `<div style="font-size: 14px; font-weight: 600; color: ${p}; margin-bottom: 8px;">${this.escapeHtml(a.bubbleBoxTitle)}</div>`), c && (x += `<div style="font-size: 12px; color: ${m}; line-height: 1.5;">${this.escapeHtml(a.bubbleBoxDescription)}</div>`), x += "</div>", y.innerHTML = x;
31395
+ const E = t.getGeometry(), w = this.view.getPixelFromCoordinate(E.getCoordinates()), C = this.view.getTargetElement(), v = C.getBoundingClientRect(), _ = y.offsetWidth, b = y.offsetHeight;
31396
+ let S = w[0] - v.left - _ / 2, P = w[1] - v.top - b - 15 + 45;
31397
+ S = Math.max(10, Math.min(S, v.width - _ - 10)), P = Math.max(10, Math.min(P, v.height - b - 10)), y.style.left = `${S}px`, y.style.top = `${P}px`, getComputedStyle(C).position === "static" && (C.style.position = "relative"), C.appendChild(y), this.currentPopup = y;
31398
+ }
31399
+ updatePopupPosition() {
31400
+ !this.currentPopup || !this.currentFeature || (this.updateFrame && cancelAnimationFrame(this.updateFrame), this.updateFrame = requestAnimationFrame(() => {
31401
+ if (!this.currentPopup || !this.currentFeature) return;
31402
+ const t = this.currentFeature.getGeometry(), e = this.view.getPixelFromCoordinate(t.getCoordinates()), n = this.view.getTargetElement().getBoundingClientRect(), r = this.currentPopup.offsetWidth, o = this.currentPopup.offsetHeight;
31403
+ let a = e[0] - n.left - r / 2, l = e[1] - n.top - o - 15 + 45;
31404
+ if (a = Math.max(10, Math.min(a, n.width - r - 10)), l = Math.max(10, Math.min(l, n.height - o - 10)), !(e[0] >= 0 && e[0] <= n.width && e[1] >= 0 && e[1] <= n.height)) {
31405
+ this.currentPopup.style.display = "none";
31406
+ return;
31407
+ }
31408
+ this.currentPopup.style.display = "block", this.currentPopup.style.left = `${a}px`, this.currentPopup.style.top = `${l}px`;
31409
+ }));
31397
31410
  }
31398
31411
  escapeHtml(t) {
31399
31412
  const e = document.createElement("div");
@@ -31419,18 +31432,6 @@ class ar extends Lt {
31419
31432
  updateData(t) {
31420
31433
  t.markers && (this.clearAllMarkers(), t.markers.forEach((e) => this.addMarker(e)));
31421
31434
  }
31422
- updatePopupPosition() {
31423
- !this.currentPopup || !this.currentFeature || (this.updateFrame && cancelAnimationFrame(this.updateFrame), this.updateFrame = requestAnimationFrame(() => {
31424
- if (!this.currentPopup || !this.currentFeature) return;
31425
- const t = this.currentFeature.getGeometry(), e = this.view.getPixelFromCoordinate(t.getCoordinates()), i = this.currentPopup.offsetWidth, n = this.currentPopup.offsetHeight;
31426
- let r = e[0] - i / 2, o = e[1] - n - 15;
31427
- if (r = Math.max(10, Math.min(r, window.innerWidth - i - 10)), o = Math.max(10, Math.min(o, window.innerHeight - n - 10)), !(e[0] >= 0 && e[0] <= window.innerWidth && e[1] >= 0 && e[1] <= window.innerHeight)) {
31428
- this.currentPopup.style.display = "none";
31429
- return;
31430
- }
31431
- this.currentPopup.style.display = "block", this.currentPopup.style.left = `${r}px`, this.currentPopup.style.top = `${o}px`;
31432
- }));
31433
- }
31434
31435
  destroy() {
31435
31436
  this.animationFrames.forEach((t, e) => {
31436
31437
  this.stopAnimation(e);
@@ -33336,6 +33337,7 @@ class lr {
33336
33337
  padding: 2px 10px;
33337
33338
  border-bottom: 1px solid ${t ? "#333" : "#e0e0e0"};
33338
33339
  background: ${t ? "#2d2d2d" : "#f5f5f5"};
33340
+ user-select: none;
33339
33341
  `;
33340
33342
  const o = document.createElement("span");
33341
33343
  o.style.cssText = `color: ${t ? "#fff" : "#333"}; font-size: 12px; font-weight: 500;`, o.textContent = this.options.title, r.appendChild(o);
@@ -33430,6 +33432,7 @@ class i_ {
33430
33432
  return t.style.cssText = `
33431
33433
  width: 100%;
33432
33434
  height: 100%;
33435
+ user-select: none;
33433
33436
  `, t;
33434
33437
  }
33435
33438
  isSystemLayer(t) {
@@ -33569,6 +33572,7 @@ class i_ {
33569
33572
  border-left: ${n ? "3px solid #00aaff" : "3px solid transparent"};
33570
33573
  transition: all 0.2s;
33571
33574
  border-bottom: 1px solid ${r ? "#333" : "#eee"};
33575
+ user-select: none;
33572
33576
  `, a.onmouseenter = () => {
33573
33577
  n || (a.style.background = r ? "#2a2a2a" : "#f5f5f5");
33574
33578
  }, a.onmouseleave = () => {
@@ -33687,6 +33691,7 @@ class i_ {
33687
33691
  background: ${i ? "#2d2d2d" : "#f5f5f5"};
33688
33692
  border-bottom: 1px solid ${i ? "#333" : "#e0e0e0"};
33689
33693
  flex-shrink: 0;
33694
+ user-select: none;
33690
33695
  `;
33691
33696
  const d = document.createElement("span");
33692
33697
  d.style.cssText = `color: ${i ? "#fff" : "#333"}; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;`, d.textContent = `${e} - ${this.options.t.coordinateData || "coordinateData"}`, c.appendChild(d);
@@ -33851,6 +33856,7 @@ class i_ {
33851
33856
  background: ${i ? "#2d2d2d" : "#f5f5f5"};
33852
33857
  border-bottom: 1px solid ${i ? "#444" : "#ddd"};
33853
33858
  flex-shrink: 0;
33859
+ user-select: none;
33854
33860
  `;
33855
33861
  const g = document.createElement("span");
33856
33862
  g.style.cssText = `color: ${i ? "#fff" : "#333"}; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;`, g.textContent = this.options.t.details || "details", f.appendChild(g);
@@ -34032,6 +34038,7 @@ class n_ {
34032
34038
  return t.style.cssText = `
34033
34039
  width: 100%;
34034
34040
  height: 100%;
34041
+ user-select: none;
34035
34042
  `, t;
34036
34043
  }
34037
34044
  render() {
@@ -34087,6 +34094,7 @@ class s_ {
34087
34094
  return t.style.cssText = `
34088
34095
  width: 100%;
34089
34096
  height: 100%;
34097
+ user-select: none;
34090
34098
  `, t;
34091
34099
  }
34092
34100
  render() {
@@ -34217,6 +34225,7 @@ class r_ {
34217
34225
  return t.style.cssText = `
34218
34226
  width: 100%;
34219
34227
  height: 100%;
34228
+ user-select: none;
34220
34229
  `, t;
34221
34230
  }
34222
34231
  render() {
@@ -34831,6 +34840,7 @@ class l_ {
34831
34840
  flex-direction: column;
34832
34841
  gap: 12px;
34833
34842
  display: none;
34843
+ user-select: none;
34834
34844
  `, this.spinner = document.createElement("div"), this.spinner.className = "loading-spinner", this.spinner.style.cssText = `
34835
34845
  width: 40px;
34836
34846
  height: 40px;
@@ -34935,6 +34945,7 @@ class h_ {
34935
34945
  border-bottom: 1px solid ${t ? "#333" : "#e0e0e0"};
34936
34946
  background: ${t ? "#2d2d2d" : "#f5f5f5"};
34937
34947
  flex-shrink: 0;
34948
+ user-select: none;
34938
34949
  `;
34939
34950
  const i = document.createElement("span");
34940
34951
  i.style.cssText = `color: ${t ? "#fff" : "#333"}; font-size: 12px; font-weight: 500;`, i.textContent = this.options.t.coordinateData, e.appendChild(i);
@@ -35096,6 +35107,7 @@ class h_ {
35096
35107
  background: ${i ? "#2d2d2d" : "#f5f5f5"};
35097
35108
  border-bottom: 1px solid ${i ? "#444" : "#ddd"};
35098
35109
  flex-shrink: 0;
35110
+ user-select: none;
35099
35111
  `;
35100
35112
  const g = document.createElement("span");
35101
35113
  g.style.cssText = `color: ${i ? "#fff" : "#333"}; font-size: 13px; font-weight: 600;`, g.textContent = this.options.t.details, f.appendChild(g);
@@ -38314,6 +38326,7 @@ class X_ {
38314
38326
  padding: 8px 12px;
38315
38327
  border-bottom: 1px solid ${t ? "#3d3d3d" : "#eee"};
38316
38328
  background: ${t ? "#252525" : "#f5f5f5"};
38329
+ user-select: none;
38317
38330
  `;
38318
38331
  const i = document.createElement("span");
38319
38332
  return i.style.cssText = `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earthview/core",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "A reliable geographic information graphics system developed based on OpenLayers.",
5
5
  "author": "happyboy",
6
6
  "license": "AGPL-3.0-only",