@earthview/core 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -8
- package/dist/index.mjs +31 -25
- package/package.json +1 -1
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 escapeHtml;
|
|
668
669
|
private hidePopup;
|
|
669
670
|
clearAllMarkers(): void;
|
|
670
671
|
getAllMarkers(): MarkerLayerData[];
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
bottom: 0;
|
|
12
12
|
background: transparent;
|
|
13
13
|
z-index: 10000;
|
|
14
|
-
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
`,t.onclick=e=>{e.stopPropagation(),this.options.onCancel(),this.destroy()},t}createElement(){const t=this.options.theme==="dark",e=document.createElement("div");e.style.userSelect="none",e.className="text-input-modal-container",e.style.cssText=`
|
|
15
16
|
position: fixed;
|
|
16
17
|
z-index: 10001;
|
|
17
18
|
width: 280px;
|
|
@@ -136,7 +137,7 @@
|
|
|
136
137
|
color: ${e?"#ccc":"#666"};
|
|
137
138
|
border: 1px solid ${e?"#555":"#ddd"};
|
|
138
139
|
`}
|
|
139
|
-
`,n?(r.onmouseenter=()=>{r.style.background="#d32f2f"},r.onmouseleave=()=>{r.style.background="#f44336"}):i?(r.onmouseenter=()=>{r.style.background="#0088cc"},r.onmouseleave=()=>{r.style.background="#00aaff"}):(r.onmouseenter=()=>{r.style.background=e?"#4a4a4a":"#e0e0e0"},r.onmouseleave=()=>{r.style.background=e?"#3d3d3d":"#e8e8e8"}),r}rgbaToHex(t){const e=Math.round(t[0]),i=Math.round(t[1]),n=Math.round(t[2]);return`#${((1<<24)+(e<<16)+(i<<8)+n).toString(16).slice(1)}`}hexToRgba(t){const e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return[e,i,n,1]}updateColorPreview(){this.colorPreview.style.backgroundColor=`rgba(${this.currentColor[0]}, ${this.currentColor[1]}, ${this.currentColor[2]}, ${this.currentColor[3]||1})`}updateStyleButtons(){const t=this.options.theme==="dark";this.boldBtn.style.background=this.isBold?"#00aaff":t?"#3d3d3d":"#e8e8e8",this.boldBtn.style.color=this.isBold?"#fff":t?"#ccc":"#666",this.italicBtn.style.background=this.isItalic?"#00aaff":t?"#3d3d3d":"#e8e8e8",this.italicBtn.style.color=this.isItalic?"#fff":t?"#ccc":"#666"}updateTextareaStyle(){const t=parseInt(this.fontSizeSelect.value);this.textarea.style.fontSize=`${t}px`,this.textarea.style.fontWeight=this.isBold?"bold":"normal",this.textarea.style.fontStyle=this.isItalic?"italic":"normal",this.textarea.style.color=`rgba(${this.currentColor[0]}, ${this.currentColor[1]}, ${this.currentColor[2]}, ${this.currentColor[3]||1})`}focusTextarea(){setTimeout(()=>{this.textarea.focus(),this.textarea.select()},50)}centerModal(){const t=(window.innerWidth-280)/2,e=(window.innerHeight-240)/2;this.element.style.left=`${Math.max(10,t)}px`,this.element.style.top=`${Math.max(10,e)}px`}setPosition(t){let e=t.x-140,i=t.y-130;e=Math.max(10,Math.min(e,window.innerWidth-290)),i=Math.max(10,Math.min(i,window.innerHeight-270)),this.element.style.left=`${e}px`,this.element.style.top=`${i}px`}bindEvents(){if(!this.fontSizeSelect||!this.colorPreview||!this.colorPicker||!this.boldBtn||!this.italicBtn||!this.confirmBtn||!this.cancelBtn||!this.textarea){console.error("TextInputModalBox: Required elements not found");return}this.fontSizeSelect.addEventListener("change",()=>{this.updateTextareaStyle()}),this.colorPreview.addEventListener("click",t=>{t.stopPropagation(),this.colorPicker.click()}),this.colorPicker.addEventListener("change",t=>{t.stopPropagation();const e=t.target;this.currentColor=this.hexToRgba(e.value),this.updateColorPreview(),this.updateTextareaStyle()}),this.boldBtn.addEventListener("click",t=>{t.stopPropagation(),this.isBold=!this.isBold,this.updateStyleButtons(),this.updateTextareaStyle()}),this.italicBtn.addEventListener("click",t=>{t.stopPropagation(),this.isItalic=!this.isItalic,this.updateStyleButtons(),this.updateTextareaStyle()}),this.deleteBtn&&this.deleteBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onDelete&&this.options.onDelete(),this.destroy()}),this.confirmBtn.addEventListener("click",t=>{t.stopPropagation();const e=this.textarea.value.trim();e?this.options.onConfirm({text:e,fontSize:parseInt(this.fontSizeSelect.value),color:this.currentColor,fontWeight:this.isBold?"bold":"normal",fontStyle:this.isItalic?"italic":"normal"}):this.options.onCancel(),this.destroy()}),this.cancelBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onCancel(),this.destroy()}),this.textarea.addEventListener("keydown",t=>{t.key==="Enter"&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),t.stopPropagation(),this.confirmBtn.click()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.cancelBtn.click())}),this.element.addEventListener("click",t=>{t.stopPropagation()})}updateTheme(t){this.options.theme=t;const e=t==="dark";if(this.element.style.background=e?"#2d2d2d":"#ffffff",this.element.style.borderColor=e?"#444":"#e0e0e0",this.header){this.header.style.background=e?"#252525":"#f5f5f5",this.header.style.borderBottomColor=e?"#3d3d3d":"#eee";const n=this.header.querySelector("span");n&&(n.style.color=e?"#fff":"#333")}this.textarea&&(this.textarea.style.background=e?"#1e1e1e":"#fafafa",this.textarea.style.color=e?"#fff":"#333"),this.toolbar&&(this.toolbar.style.background=e?"#252525":"#fafafa",this.toolbar.style.borderTopColor=e?"#3d3d3d":"#eee",this.toolbar.style.borderBottomColor=e?"#3d3d3d":"#eee"),this.footer&&(this.footer.style.background=e?"#252525":"#fafafa"),this.updateStyleButtons(),this.colorPreview&&(this.colorPreview.style.borderColor=e?"#555":"#ddd"),this.fontSizeSelect&&(this.fontSizeSelect.style.background=e?"#3d3d3d":"#ffffff",this.fontSizeSelect.style.borderColor=e?"#555":"#ddd",this.fontSizeSelect.style.color=e?"#fff":"#333"),this.element.querySelectorAll(".text-input-modal-divider").forEach(n=>{n.style.background=e?"#444":"#ddd"})}destroy(){this.overlay.remove(),this.element.remove()}getElement(){return this.element}}class wm extends It{constructor(t,e,i,n){super(t,e,Z.TEXT_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.editingHelperFeature=null,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.textInputModal=null,this.isInputActive=!1,this.currentTheme="dark",this.currentTranslations=null,this.defaultFontSize=i?.defaultFontSize||16,this.defaultFontFamily=i?.defaultFontFamily||"sans-serif",this.defaultColor=i?.defaultColor||[255,255,255,1],this.defaultBackgroundColor=i?.defaultBackgroundColor||[0,0,0,.7],this.defaultOutlineColor=i?.defaultOutlineColor||[0,0,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,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.TEXT_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setTranslations(t){this.t=t,this.currentTranslations&&(this.currentTranslations=t)}getStyleForFeature(t){if(t?.get("isHelper"))return this.getHelperStyle();const e=t?.get("content")||"",i=t?.get("fontSize")||this.defaultFontSize,n=t?.get("fontFamily")||this.defaultFontFamily,r=t?.get("color")||this.defaultColor,o=t?.get("backgroundColor")||this.defaultBackgroundColor,a=t?.get("outlineColor")||this.defaultOutlineColor,l=t?.get("outlineWidth")||this.defaultOutlineWidth,h=t?.get("fontWeight")||"normal",c=t?.get("fontStyle")||"normal";let d="";return c!=="normal"&&(d+=`${c} `),h!=="normal"&&(d+=`${h} `),d+=`${i}px ${n}`,new A({text:new te({text:e,font:d,fill:new j({color:M(r)}),stroke:new G({color:M(a),width:l}),backgroundFill:new j({color:M(o)}),padding:[4,8,4,8],textAlign:"center",textBaseline:"middle"})})}getHelperStyle(){return this.currentTheme,new A({fill:new j({color:"rgba(0, 170, 255, 0.05)"}),stroke:new G({color:"#ffaa00",width:2,lineDash:[8,6]})})}createHelperGeometry(t,e,i){const n=i*.6,r=e.length*n,o=i*1.2,a=r/2,l=o/2,[h,c]=t;return new it([[[h-a,c-l],[h+a,c-l],[h+a,c+l],[h-a,c+l],[h-a,c-l]]])}setTheme(t,e){this.currentTheme=t,this.currentTranslations=e,this.t=e}showTextInputModal(t,e,i,n){this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),this.isInputActive=!0;const r=this.mapView;if(!r||typeof r.getTargetElement!="function"){console.error(this.t.cannotGetMapTarget),this.isInputActive=!1,i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"});return}if(!r.getTargetElement()){console.error(this.t.cannotGetMapTarget),this.isInputActive=!1,i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"});return}const a=r.getPixelFromCoordinate(t);if(!a||a.length<2){console.error(this.t.cannotGetPixelFromCoordinate,t),this.isInputActive=!1,i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"});return}let l=a[0]-140,h=a[1]-130;l=Math.max(10,Math.min(l,window.innerWidth-290)),h=Math.max(10,Math.min(h,window.innerHeight-270));const c={addText:this.t.editText,enterText:this.t.pleaseEnterText,bold:this.t.bold,italic:this.t.italic,fontSize:this.t.fontSize,color:this.t.color,confirm:this.t.confirm,cancel:this.t.cancel,delete:this.t.delete};this.textInputModal=new _m({initialText:e?.text||"",initialFontSize:e?.fontSize||this.defaultFontSize,initialColor:e?.color||this.defaultColor,initialFontWeight:e?.fontWeight||"normal",initialFontStyle:e?.fontStyle||"normal",onConfirm:d=>{i&&i(d),this.hideTextInputModal()},onCancel:()=>{i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"}),this.hideTextInputModal()},onDelete:n,theme:this.currentTheme,t:c},{x:l,y:h})}hideTextInputModal(){this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),this.isInputActive=!1}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:"Point"}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry();if(n instanceof rt){const[r,o]=n.getCoordinates(),[a,l]=U([r,o]);this.showTextInputModal([r,o],void 0,h=>{if(e&&e.clear(),this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),h.text&&h.text.trim()){const c=Vt("text_"),d=new V({geometry:new rt([r,o]),id:c,position:[a,l],content:h.text});d.set("fontSize",h.fontSize),d.set("fontFamily",this.defaultFontFamily),d.set("color",h.color),d.set("fontWeight",h.fontWeight),d.set("fontStyle",h.fontStyle),d.set("backgroundColor",this.defaultBackgroundColor),d.set("outlineColor",this.defaultOutlineColor),d.set("outlineWidth",this.defaultOutlineWidth),d.set("scale",1),this.source?.addFeature(d),this.features.set(c,d),this.layer?.setZIndex(999),d.changed(),this.mapView&&this.mapView.renderSync(),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:c,position:[a,l],content:h.text,fontSize:h.fontSize,fontFamily:this.defaultFontFamily,color:h.color,fontWeight:h.fontWeight,fontStyle:h.fontStyle,backgroundColor:this.defaultBackgroundColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth})}else this.onDrawCompleteCallback&&this.onDrawCompleteCallback(null);this.onDrawCompleteCallback=null,this.mapView?.render()})}else 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.getGeometry();if(!(n instanceof rt))return;const[r,o]=n.getCoordinates(),a=i.get("content")||"",l=i.get("fontSize")||this.defaultFontSize,h=this.createHelperGeometry([r,o],a,l);this.editingHelperFeature=new V({geometry:h,isHelper:!0}),this.editingHelperFeature.setStyle(this.getHelperStyle()),this.source?.addFeature(this.editingHelperFeature);const c=new Y;c.addFeature(this.editingHelperFeature);const d=c.getFeaturesCollection();this.transformInteraction=new _e({features:d,translate:!0,scale:!0,rotate:!1,keepAspectRatio:u=>u.shiftKey}),this.transformInteraction.setActive(!0),this.transformInteraction.on("scaleend",()=>{if(!this.editingHelperFeature||!i)return;const u=this.editingHelperFeature.getGeometry();if(u instanceof it){const f=u.getExtent(),g=(f[0]+f[2])/2,p=(f[1]+f[3])/2,m=f[2]-f[0],y=this.createHelperGeometry([r,o],a,l).getExtent()[2]-f[0],x=m/y,E=Math.max(8,l*x),w=i.getGeometry();w&&w.setCoordinates([g,p]),i.set("fontSize",E);const[C,v]=U([g,p]);i.set("position",[C,v]),i.changed();const _=this.createHelperGeometry([g,p],a,E);this.editingHelperFeature?.setGeometry(_);const b=i.get("id");this.onEditCompleteCallback&&b&&this.onEditCompleteCallback({id:b,position:[C,v],content:i.get("content"),fontSize:E,fontFamily:i.get("fontFamily"),color:i.get("color"),fontWeight:i.get("fontWeight"),fontStyle:i.get("fontStyle"),backgroundColor:i.get("backgroundColor"),outlineColor:i.get("outlineColor"),outlineWidth:i.get("outlineWidth")}),this.mapView?.render()}}),this.transformInteraction.on("translateend",()=>{if(!this.editingHelperFeature||!i)return;const u=this.editingHelperFeature.getGeometry();if(u instanceof it){const f=u.getExtent(),g=(f[0]+f[2])/2,p=(f[1]+f[3])/2,m=i.getGeometry();m&&m.setCoordinates([g,p]);const[y,x]=U([g,p]);i.set("position",[y,x]),i.changed();const E=i.get("content")||"",w=i.get("fontSize")||this.defaultFontSize,C=this.createHelperGeometry([g,p],E,w);this.editingHelperFeature?.setGeometry(C);const v=i.get("id");this.onEditCompleteCallback&&v&&this.onEditCompleteCallback({id:v,position:[y,x],content:i.get("content"),fontSize:w,fontFamily:i.get("fontFamily"),color:i.get("color"),fontWeight:i.get("fontWeight"),fontStyle:i.get("fontStyle"),backgroundColor:i.get("backgroundColor"),outlineColor:i.get("outlineColor"),outlineWidth:i.get("outlineWidth")}),this.mapView?.render()}}),this.mapView?.addInteraction(this.transformInteraction),this.mapView?.render()}editProperties(t,e,i){const n=this.features.get(t);if(!n)return;const r=n.getGeometry();if(r instanceof rt){const[o,a]=r.getCoordinates(),l=n.get("content")||"",h=n.get("fontSize")||this.defaultFontSize,c=n.get("color")||this.defaultColor,d=n.get("fontWeight")||"normal",u=n.get("fontStyle")||"normal",f=()=>{this.removeText(t),i&&i(),e&&e(null)};this.showTextInputModal([o,a],{text:l,fontSize:h,color:c,fontWeight:d,fontStyle:u},g=>{if(g.text&&g.text.trim()){n.set("content",g.text),n.set("fontSize",g.fontSize),n.set("color",g.color),n.set("fontWeight",g.fontWeight),n.set("fontStyle",g.fontStyle),n.changed(),this.mapView?.render();const p=n.get("position");e&&e({id:t,position:p,content:g.text,fontSize:g.fontSize,fontFamily:n.get("fontFamily"),color:g.color,fontWeight:g.fontWeight,fontStyle:g.fontStyle,backgroundColor:n.get("backgroundColor"),outlineColor:n.get("outlineColor"),outlineWidth:n.get("outlineWidth")})}},f)}}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingHelperFeature&&(this.source?.removeFeature(this.editingHelperFeature),this.editingHelperFeature=null),this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),this.isInputActive=!1,this.editingFeature=null,this.onEditCompleteCallback=null}addText(t){const e=ut(t.position),i=new V({geometry:new rt(e),id:t.id,position:t.position,content:t.content});i.set("fontSize",t.fontSize||this.defaultFontSize),i.set("fontFamily",t.fontFamily||this.defaultFontFamily),i.set("color",t.color||this.defaultColor),i.set("fontWeight",t.fontWeight||"normal"),i.set("fontStyle",t.fontStyle||"normal"),i.set("backgroundColor",t.backgroundColor||this.defaultBackgroundColor),i.set("outlineColor",t.outlineColor||this.defaultOutlineColor),i.set("outlineWidth",t.outlineWidth||this.defaultOutlineWidth),i.set("scale",1),this.source?.addFeature(i),this.features.set(t.id,i)}removeText(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllTexts(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i,position:e.get("position"),content:e.get("content"),fontSize:e.get("fontSize"),fontFamily:e.get("fontFamily"),color:e.get("color"),fontWeight:e.get("fontWeight"),fontStyle:e.get("fontStyle"),backgroundColor:e.get("backgroundColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth")})}),t}getText(t){const e=this.features.get(t);if(e)return{id:t,position:e.get("position"),content:e.get("content"),fontSize:e.get("fontSize"),fontFamily:e.get("fontFamily"),color:e.get("color"),fontWeight:e.get("fontWeight"),fontStyle:e.get("fontStyle"),backgroundColor:e.get("backgroundColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth")}}updateTextStyle(t,e,i,n,r,o,a,l,h){const c=this.features.get(t);c&&(c.set("fontSize",e),c.set("fontFamily",i),c.set("color",n),c.set("backgroundColor",r),c.set("outlineColor",o),c.set("outlineWidth",a),l&&c.set("fontWeight",l),h&&c.set("fontStyle",h),c.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.texts&&(this.clearAll(),t.texts.forEach(e=>this.addText(e)))}destroy(){this.stopDraw(),this.stopEdit(),this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),super.destroy()}}class xm extends It{constructor(t,e,i){super(t,e,Z.ARROW_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,87,34,1],this.defaultWidth=i?.defaultWidth||3,this.defaultStyle=i?.defaultStyle||"solid",this.defaultHeadSize=i?.defaultHeadSize||50,this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.ARROW_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("type");if(e==="line"){const i=t?.get("startPoint"),n=t?.get("endPoint"),r=t?.get("color")||this.defaultColor,o=t?.get("width")||this.defaultWidth,l=(t?.get("style")||this.defaultStyle)==="dashed"?[10,10]:void 0;if(!i||!n)return[new A({})];const h=ut(i),c=ut(n);return[new A({geometry:new pt([h,c]),stroke:new G({color:M(r),width:o,lineDash:l})})]}if(e==="arrowHead"){const i=t?.get("angle")||0,n=t?.get("color")||this.defaultColor,r=t?.get("headSize")||this.defaultHeadSize,o=t?.getGeometry()?.getCoordinates();if(!o)return[new A({})];const a=o[0],l=o[1],h=i+Math.PI*.85,c=i-Math.PI*.85,d=a+Math.cos(h)*r,u=l+Math.sin(h)*r,f=a+Math.cos(c)*r,g=l+Math.sin(c)*r,p=new it([[[a,l],[d,u],[f,g],[a,l]]]);return[new A({geometry:p,fill:new j({color:M(n)}),stroke:new G({color:M(n),width:1})})]}return[new A({})]}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;let i=null,n=null;this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:2,geometryFunction:(r,o)=>r.length===0?(i=null,n=null,o):r.length===1?(i=r[0],n=null,o?o.setCoordinates([i,i]):o=new pt([i,i]),o):(r.length>=2&&(i=r[0],n=r[1],o?o.setCoordinates([i,n]):o=new pt([i,n])),o),style:new A({stroke:new G({color:M(this.defaultColor),width:this.defaultWidth,lineDash:this.defaultStyle==="dashed"?[10,10]:void 0})})}),this.drawInteraction.on("drawend",r=>{const o=Vt("arrow_");if(i&&n){const[a,l]=U(i),[h,c]=U(n),d=Math.atan2(n[1]-i[1],n[0]-i[0]),u=new pt([i,n]),f=new V({geometry:u,id:o,startPoint:[a,l],endPoint:[h,c],type:"line"});f.set("color",this.defaultColor),f.set("width",this.defaultWidth),f.set("style",this.defaultStyle),f.set("headSize",this.defaultHeadSize);const g=new rt(n),p=new V({geometry:g,id:o+"_head",parentId:o,type:"arrowHead",angle:d,color:this.defaultColor,headSize:this.defaultHeadSize});this.source?.addFeature(f),this.source?.addFeature(p),this.features.set(o,f),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:o,startPoint:[a,l],endPoint:[h,c],color:this.defaultColor,width:this.defaultWidth,style:this.defaultStyle,headSize:this.defaultHeadSize})}i=null,n=null,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}),this.transformInteraction.setActive(!0);const o=()=>{const a=i.getGeometry();if(a instanceof pt){const l=a.getCoordinates();if(l&&l.length>=2){const[h,c]=U(l[0]),[d,u]=U(l[1]),f=i.get("id");this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,startPoint:[h,c],endPoint:[d,u]}),i.set("startPoint",[h,c]),i.set("endPoint",[d,u]),i.changed();const g=this.features.get(f+"_head");if(g){const p=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]);g.setGeometry(new rt(l[1])),g.set("angle",p),g.changed()}}}};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=null),this.editingFeature=null,this.onEditCompleteCallback=null}addArrow(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,type:"line"});r.set("color",t.color||this.defaultColor),r.set("width",t.width||this.defaultWidth),r.set("style",t.style||this.defaultStyle);const o=Math.atan2(i[1]-e[1],i[0]-e[0]),a=new rt(i),l=new V({geometry:a,id:t.id+"_head",parentId:t.id,type:"arrowHead",angle:o,color:t.color||this.defaultColor,headSize:t.headSize||this.defaultHeadSize});this.source?.addFeature(r),this.source?.addFeature(l),this.features.set(t.id,r),this.features.set(t.id+"_head",l)}removeArrow(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t));const i=this.features.get(t+"_head");i&&(this.source?.removeFeature(i),this.features.delete(t+"_head")),this.editingFeature===e&&this.stopEdit()}getAllArrows(){const t=[];return this.features.forEach((e,i)=>{!i.toString().endsWith("_head")&&e.get("startPoint")&&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"),headSize:e.get("headSize")})}),t}getArrow(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"),headSize:e.get("headSize")}}updateArrowStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;o.set("color",e),o.set("width",i),o.set("style",n),o.set("headSize",r),o.changed();const a=this.features.get(t+"_head");a&&(a.set("color",e),a.set("headSize",r),a.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.arrows&&(this.clearAll(),t.arrows.forEach(e=>this.addArrow(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class Qn extends It{constructor(t,e,i){super(t,e,Z.POLYGON,{...i,zIndex:i?.zIndex??10}),this.features=new Map,this.defaultFillColor=i?.defaultFillColor||[255,0,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[255,0,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POLYGON},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createLayer(t){return t.addLayer(this.layer),this.layer}addPolygon(t){const e=[t.points.map(([r,o])=>ut([r,o]))],i=new it(e),n=new V({geometry:i,id:t.id,title:t.title});n.setStyle(new A({fill:new j({color:M(t.fillColor||this.defaultFillColor)}),stroke:new G({color:M(t.outlineColor||this.defaultOutlineColor),width:t.outlineWidth||this.defaultOutlineWidth})})),this.source?.addFeature(n),this.features.set(t.id,n)}removePolygon(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t))}updateData(t){t.polygons&&(this.clear(),t.polygons.forEach(e=>this.addPolygon(e)))}getAllPolygons(){const t=[];return this.features.forEach((e,i)=>{t.push(e.getProperties())}),t}getPolygon(t){const e=this.features.get(t);if(e)return e.getProperties()}}class ts extends It{constructor(t,e,i){super(t,e,Z.POLYLINE,{...i,zIndex:i?.zIndex??10}),this.features=new Map,this.defaultColor=i?.defaultColor||[0,0,255,1],this.defaultWidth=i?.defaultWidth||3,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POLYLINE},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createLayer(t){return t.addLayer(this.layer),this.layer}addPolyline(t){const e=t.points.map(([r,o])=>ut([r,o])),i=new pt(e),n=new V({geometry:i,id:t.id,title:t.title});n.setStyle(new A({stroke:new G({color:M(t.color||this.defaultColor),width:t.width||this.defaultWidth})})),this.source?.addFeature(n),this.features.set(t.id,n)}removePolyline(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t))}updateData(t){t.polylines&&(this.clear(),t.polylines.forEach(e=>this.addPolyline(e)))}getAllPolylines(){const t=[];return this.features.forEach((e,i)=>{t.push(e.getProperties())}),t}getPolyline(t){const e=this.features.get(t);if(e)return e.getProperties()}}class es extends It{constructor(t,e,i){super(t,e,Z.CIRCLE,{...i,zIndex:i?.zIndex??15}),this.features=new Map,this.defaultFillColor=i?.defaultFillColor||[0,255,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[0,255,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.CIRCLE},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createLayer(t){return t.addLayer(this.layer),this.layer}addCircle(t){const e=ut(t.center),i=new Me(e,t.radius),n=new V({geometry:i,id:t.id,title:t.title});n.setStyle(new A({fill:new j({color:M(t.fillColor||this.defaultFillColor)}),stroke:new G({color:M(t.outlineColor||this.defaultOutlineColor),width:t.outlineWidth||this.defaultOutlineWidth})})),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))}updateData(t){t.circles&&(this.clear(),t.circles.forEach(e=>this.addCircle(e)))}getAllCircles(){const t=[];return this.features.forEach((e,i)=>{t.push(e.getProperties())}),t}getCircle(t){const e=this.features.get(t);if(e)return e.getProperties()}}function ud(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function fa(s,t){return s[0]=t[0],s[1]=t[1],s[4]=t[2],s[5]=t[3],s[12]=t[4],s[13]=t[5],s}const Lr=34962,ll=34963,Cm=35044,ko=35048,Em=5121,vm=5123,Tm=5125,fd=5126,Sh=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function bm(s,t){t=Object.assign({preserveDrawingBuffer:!0,antialias:!df},t);const e=Sh.length;for(let i=0;i<e;++i)try{const n=s.getContext(Sh[i],t);if(n)return n}catch{}return null}const Sm={STATIC_DRAW:Cm};class Ro{constructor(t,e){this.array_=null,this.type_=t,gt(t===Lr||t===ll,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=e!==void 0?e:Sm.STATIC_DRAW}ofSize(t){return this.array_=new(rr(this.type_))(t),this}fromArray(t){return this.array_=rr(this.type_).from(t),this}fromArrayBuffer(t){return this.array_=new(rr(this.type_))(t),this}getType(){return this.type_}getArray(){return this.array_}setArray(t){const e=rr(this.type_);if(!(t instanceof e))throw new Error(`Expected ${e}`);this.array_=t}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}function rr(s){switch(s){case Lr:return Float32Array;case ll:return Uint32Array;default:return Float32Array}}const or={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"},Pm=`
|
|
140
|
+
`,n?(r.onmouseenter=()=>{r.style.background="#d32f2f"},r.onmouseleave=()=>{r.style.background="#f44336"}):i?(r.onmouseenter=()=>{r.style.background="#0088cc"},r.onmouseleave=()=>{r.style.background="#00aaff"}):(r.onmouseenter=()=>{r.style.background=e?"#4a4a4a":"#e0e0e0"},r.onmouseleave=()=>{r.style.background=e?"#3d3d3d":"#e8e8e8"}),r}rgbaToHex(t){const e=Math.round(t[0]),i=Math.round(t[1]),n=Math.round(t[2]);return`#${((1<<24)+(e<<16)+(i<<8)+n).toString(16).slice(1)}`}hexToRgba(t){const e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return[e,i,n,1]}updateColorPreview(){this.colorPreview.style.backgroundColor=`rgba(${this.currentColor[0]}, ${this.currentColor[1]}, ${this.currentColor[2]}, ${this.currentColor[3]||1})`}updateStyleButtons(){const t=this.options.theme==="dark";this.boldBtn.style.background=this.isBold?"#00aaff":t?"#3d3d3d":"#e8e8e8",this.boldBtn.style.color=this.isBold?"#fff":t?"#ccc":"#666",this.italicBtn.style.background=this.isItalic?"#00aaff":t?"#3d3d3d":"#e8e8e8",this.italicBtn.style.color=this.isItalic?"#fff":t?"#ccc":"#666"}updateTextareaStyle(){const t=parseInt(this.fontSizeSelect.value);this.textarea.style.fontSize=`${t}px`,this.textarea.style.fontWeight=this.isBold?"bold":"normal",this.textarea.style.fontStyle=this.isItalic?"italic":"normal",this.textarea.style.color=`rgba(${this.currentColor[0]}, ${this.currentColor[1]}, ${this.currentColor[2]}, ${this.currentColor[3]||1})`}focusTextarea(){setTimeout(()=>{this.textarea.focus(),this.textarea.select()},50)}centerModal(){const t=(window.innerWidth-280)/2,e=(window.innerHeight-240)/2;this.element.style.left=`${Math.max(10,t)}px`,this.element.style.top=`${Math.max(10,e)}px`}setPosition(t){let e=t.x-140,i=t.y-130;e=Math.max(10,Math.min(e,window.innerWidth-290)),i=Math.max(10,Math.min(i,window.innerHeight-270)),this.element.style.left=`${e}px`,this.element.style.top=`${i}px`}bindEvents(){if(!this.fontSizeSelect||!this.colorPreview||!this.colorPicker||!this.boldBtn||!this.italicBtn||!this.confirmBtn||!this.cancelBtn||!this.textarea){console.error("TextInputModalBox: Required elements not found");return}this.fontSizeSelect.addEventListener("change",()=>{this.updateTextareaStyle()}),this.colorPreview.addEventListener("click",t=>{t.stopPropagation(),this.colorPicker.click()}),this.colorPicker.addEventListener("change",t=>{t.stopPropagation();const e=t.target;this.currentColor=this.hexToRgba(e.value),this.updateColorPreview(),this.updateTextareaStyle()}),this.boldBtn.addEventListener("click",t=>{t.stopPropagation(),this.isBold=!this.isBold,this.updateStyleButtons(),this.updateTextareaStyle()}),this.italicBtn.addEventListener("click",t=>{t.stopPropagation(),this.isItalic=!this.isItalic,this.updateStyleButtons(),this.updateTextareaStyle()}),this.deleteBtn&&this.deleteBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onDelete&&this.options.onDelete(),this.destroy()}),this.confirmBtn.addEventListener("click",t=>{t.stopPropagation();const e=this.textarea.value.trim();e?this.options.onConfirm({text:e,fontSize:parseInt(this.fontSizeSelect.value),color:this.currentColor,fontWeight:this.isBold?"bold":"normal",fontStyle:this.isItalic?"italic":"normal"}):this.options.onCancel(),this.destroy()}),this.cancelBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onCancel(),this.destroy()}),this.textarea.addEventListener("keydown",t=>{t.key==="Enter"&&(t.ctrlKey||t.metaKey)?(t.preventDefault(),t.stopPropagation(),this.confirmBtn.click()):t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this.cancelBtn.click())}),this.element.addEventListener("click",t=>{t.stopPropagation()})}updateTheme(t){this.options.theme=t;const e=t==="dark";if(this.element.style.background=e?"#2d2d2d":"#ffffff",this.element.style.borderColor=e?"#444":"#e0e0e0",this.header){this.header.style.background=e?"#252525":"#f5f5f5",this.header.style.borderBottomColor=e?"#3d3d3d":"#eee";const n=this.header.querySelector("span");n&&(n.style.color=e?"#fff":"#333")}this.textarea&&(this.textarea.style.background=e?"#1e1e1e":"#fafafa",this.textarea.style.color=e?"#fff":"#333"),this.toolbar&&(this.toolbar.style.background=e?"#252525":"#fafafa",this.toolbar.style.borderTopColor=e?"#3d3d3d":"#eee",this.toolbar.style.borderBottomColor=e?"#3d3d3d":"#eee"),this.footer&&(this.footer.style.background=e?"#252525":"#fafafa"),this.updateStyleButtons(),this.colorPreview&&(this.colorPreview.style.borderColor=e?"#555":"#ddd"),this.fontSizeSelect&&(this.fontSizeSelect.style.background=e?"#3d3d3d":"#ffffff",this.fontSizeSelect.style.borderColor=e?"#555":"#ddd",this.fontSizeSelect.style.color=e?"#fff":"#333"),this.element.querySelectorAll(".text-input-modal-divider").forEach(n=>{n.style.background=e?"#444":"#ddd"})}destroy(){this.overlay.remove(),this.element.remove()}getElement(){return this.element}}class wm extends It{constructor(t,e,i,n){super(t,e,Z.TEXT_DRAW,{...i,zIndex:i?.zIndex??100}),this.drawInteraction=null,this.transformInteraction=null,this.features=new Map,this.editingHelperFeature=null,this.onDrawCompleteCallback=null,this.onEditCompleteCallback=null,this.editingFeature=null,this.mapView=null,this.textInputModal=null,this.isInputActive=!1,this.currentTheme="dark",this.currentTranslations=null,this.defaultFontSize=i?.defaultFontSize||16,this.defaultFontFamily=i?.defaultFontFamily||"sans-serif",this.defaultColor=i?.defaultColor||[255,255,255,1],this.defaultBackgroundColor=i?.defaultBackgroundColor||[0,0,0,.7],this.defaultOutlineColor=i?.defaultOutlineColor||[0,0,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,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.TEXT_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}setTranslations(t){this.t=t,this.currentTranslations&&(this.currentTranslations=t)}getStyleForFeature(t){if(t?.get("isHelper"))return this.getHelperStyle();const e=t?.get("content")||"",i=t?.get("fontSize")||this.defaultFontSize,n=t?.get("fontFamily")||this.defaultFontFamily,r=t?.get("color")||this.defaultColor,o=t?.get("backgroundColor")||this.defaultBackgroundColor,a=t?.get("outlineColor")||this.defaultOutlineColor,l=t?.get("outlineWidth")||this.defaultOutlineWidth,h=t?.get("fontWeight")||"normal",c=t?.get("fontStyle")||"normal";let d="";return c!=="normal"&&(d+=`${c} `),h!=="normal"&&(d+=`${h} `),d+=`${i}px ${n}`,new A({text:new te({text:e,font:d,fill:new j({color:M(r)}),stroke:new G({color:M(a),width:l}),backgroundFill:new j({color:M(o)}),padding:[4,8,4,8],textAlign:"center",textBaseline:"middle"})})}getHelperStyle(){return this.currentTheme,new A({fill:new j({color:"rgba(0, 170, 255, 0.05)"}),stroke:new G({color:"#ffaa00",width:2,lineDash:[8,6]})})}createHelperGeometry(t,e,i){const n=i*.6,r=e.length*n,o=i*1.2,a=r/2,l=o/2,[h,c]=t;return new it([[[h-a,c-l],[h+a,c-l],[h+a,c+l],[h-a,c+l],[h-a,c-l]]])}setTheme(t,e){this.currentTheme=t,this.currentTranslations=e,this.t=e}showTextInputModal(t,e,i,n){this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),this.isInputActive=!0;const r=this.mapView;if(!r||typeof r.getTargetElement!="function"){console.error(this.t.cannotGetMapTarget),this.isInputActive=!1,i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"});return}if(!r.getTargetElement()){console.error(this.t.cannotGetMapTarget),this.isInputActive=!1,i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"});return}const a=r.getPixelFromCoordinate(t);if(!a||a.length<2){console.error(this.t.cannotGetPixelFromCoordinate,t),this.isInputActive=!1,i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"});return}let l=a[0]-140,h=a[1]-130;l=Math.max(10,Math.min(l,window.innerWidth-290)),h=Math.max(10,Math.min(h,window.innerHeight-270));const c={addText:this.t.editText,enterText:this.t.pleaseEnterText,bold:this.t.bold,italic:this.t.italic,fontSize:this.t.fontSize,color:this.t.color,confirm:this.t.confirm,cancel:this.t.cancel,delete:this.t.delete};this.textInputModal=new _m({initialText:e?.text||"",initialFontSize:e?.fontSize||this.defaultFontSize,initialColor:e?.color||this.defaultColor,initialFontWeight:e?.fontWeight||"normal",initialFontStyle:e?.fontStyle||"normal",onConfirm:d=>{i&&i(d),this.hideTextInputModal()},onCancel:()=>{i&&i({text:"",fontSize:this.defaultFontSize,color:this.defaultColor,fontWeight:"normal",fontStyle:"normal"}),this.hideTextInputModal()},onDelete:n,theme:this.currentTheme,t:c,container:this.mapView?.getTargetElement()},{x:l,y:h}),this.textInputModal.getElement().style.userSelect="none"}hideTextInputModal(){this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),this.isInputActive=!1}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:"Point"}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry();if(n instanceof rt){const[r,o]=n.getCoordinates(),[a,l]=U([r,o]);this.showTextInputModal([r,o],void 0,h=>{if(e&&e.clear(),this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),h.text&&h.text.trim()){const c=Vt("text_"),d=new V({geometry:new rt([r,o]),id:c,position:[a,l],content:h.text});d.set("fontSize",h.fontSize),d.set("fontFamily",this.defaultFontFamily),d.set("color",h.color),d.set("fontWeight",h.fontWeight),d.set("fontStyle",h.fontStyle),d.set("backgroundColor",this.defaultBackgroundColor),d.set("outlineColor",this.defaultOutlineColor),d.set("outlineWidth",this.defaultOutlineWidth),d.set("scale",1),this.source?.addFeature(d),this.features.set(c,d),this.layer?.setZIndex(999),d.changed(),this.mapView&&this.mapView.renderSync(),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:c,position:[a,l],content:h.text,fontSize:h.fontSize,fontFamily:this.defaultFontFamily,color:h.color,fontWeight:h.fontWeight,fontStyle:h.fontStyle,backgroundColor:this.defaultBackgroundColor,outlineColor:this.defaultOutlineColor,outlineWidth:this.defaultOutlineWidth})}else this.onDrawCompleteCallback&&this.onDrawCompleteCallback(null);this.onDrawCompleteCallback=null,this.mapView?.render()})}else 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.getGeometry();if(!(n instanceof rt))return;const[r,o]=n.getCoordinates(),a=i.get("content")||"",l=i.get("fontSize")||this.defaultFontSize,h=this.createHelperGeometry([r,o],a,l);this.editingHelperFeature=new V({geometry:h,isHelper:!0}),this.editingHelperFeature.setStyle(this.getHelperStyle()),this.source?.addFeature(this.editingHelperFeature);const c=new Y;c.addFeature(this.editingHelperFeature);const d=c.getFeaturesCollection();this.transformInteraction=new _e({features:d,translate:!0,scale:!0,rotate:!1,keepAspectRatio:u=>u.shiftKey}),this.transformInteraction.setActive(!0),this.transformInteraction.on("scaleend",()=>{if(!this.editingHelperFeature||!i)return;const u=this.editingHelperFeature.getGeometry();if(u instanceof it){const f=u.getExtent(),g=(f[0]+f[2])/2,p=(f[1]+f[3])/2,m=f[2]-f[0],y=this.createHelperGeometry([r,o],a,l).getExtent()[2]-f[0],x=m/y,E=Math.max(8,l*x),w=i.getGeometry();w&&w.setCoordinates([g,p]),i.set("fontSize",E);const[C,v]=U([g,p]);i.set("position",[C,v]),i.changed();const _=this.createHelperGeometry([g,p],a,E);this.editingHelperFeature?.setGeometry(_);const b=i.get("id");this.onEditCompleteCallback&&b&&this.onEditCompleteCallback({id:b,position:[C,v],content:i.get("content"),fontSize:E,fontFamily:i.get("fontFamily"),color:i.get("color"),fontWeight:i.get("fontWeight"),fontStyle:i.get("fontStyle"),backgroundColor:i.get("backgroundColor"),outlineColor:i.get("outlineColor"),outlineWidth:i.get("outlineWidth")}),this.mapView?.render()}}),this.transformInteraction.on("translateend",()=>{if(!this.editingHelperFeature||!i)return;const u=this.editingHelperFeature.getGeometry();if(u instanceof it){const f=u.getExtent(),g=(f[0]+f[2])/2,p=(f[1]+f[3])/2,m=i.getGeometry();m&&m.setCoordinates([g,p]);const[y,x]=U([g,p]);i.set("position",[y,x]),i.changed();const E=i.get("content")||"",w=i.get("fontSize")||this.defaultFontSize,C=this.createHelperGeometry([g,p],E,w);this.editingHelperFeature?.setGeometry(C);const v=i.get("id");this.onEditCompleteCallback&&v&&this.onEditCompleteCallback({id:v,position:[y,x],content:i.get("content"),fontSize:w,fontFamily:i.get("fontFamily"),color:i.get("color"),fontWeight:i.get("fontWeight"),fontStyle:i.get("fontStyle"),backgroundColor:i.get("backgroundColor"),outlineColor:i.get("outlineColor"),outlineWidth:i.get("outlineWidth")}),this.mapView?.render()}}),this.mapView?.addInteraction(this.transformInteraction),this.mapView?.render()}editProperties(t,e,i){const n=this.features.get(t);if(!n)return;const r=n.getGeometry();if(r instanceof rt){const[o,a]=r.getCoordinates(),l=n.get("content")||"",h=n.get("fontSize")||this.defaultFontSize,c=n.get("color")||this.defaultColor,d=n.get("fontWeight")||"normal",u=n.get("fontStyle")||"normal",f=()=>{this.removeText(t),i&&i(),e&&e(null)};this.showTextInputModal([o,a],{text:l,fontSize:h,color:c,fontWeight:d,fontStyle:u},g=>{if(g.text&&g.text.trim()){n.set("content",g.text),n.set("fontSize",g.fontSize),n.set("color",g.color),n.set("fontWeight",g.fontWeight),n.set("fontStyle",g.fontStyle),n.changed(),this.mapView?.render();const p=n.get("position");e&&e({id:t,position:p,content:g.text,fontSize:g.fontSize,fontFamily:n.get("fontFamily"),color:g.color,fontWeight:g.fontWeight,fontStyle:g.fontStyle,backgroundColor:n.get("backgroundColor"),outlineColor:n.get("outlineColor"),outlineWidth:n.get("outlineWidth")})}},f)}}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.editingHelperFeature&&(this.source?.removeFeature(this.editingHelperFeature),this.editingHelperFeature=null),this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),this.isInputActive=!1,this.editingFeature=null,this.onEditCompleteCallback=null}addText(t){const e=ut(t.position),i=new V({geometry:new rt(e),id:t.id,position:t.position,content:t.content});i.set("fontSize",t.fontSize||this.defaultFontSize),i.set("fontFamily",t.fontFamily||this.defaultFontFamily),i.set("color",t.color||this.defaultColor),i.set("fontWeight",t.fontWeight||"normal"),i.set("fontStyle",t.fontStyle||"normal"),i.set("backgroundColor",t.backgroundColor||this.defaultBackgroundColor),i.set("outlineColor",t.outlineColor||this.defaultOutlineColor),i.set("outlineWidth",t.outlineWidth||this.defaultOutlineWidth),i.set("scale",1),this.source?.addFeature(i),this.features.set(t.id,i)}removeText(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllTexts(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i,position:e.get("position"),content:e.get("content"),fontSize:e.get("fontSize"),fontFamily:e.get("fontFamily"),color:e.get("color"),fontWeight:e.get("fontWeight"),fontStyle:e.get("fontStyle"),backgroundColor:e.get("backgroundColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth")})}),t}getText(t){const e=this.features.get(t);if(e)return{id:t,position:e.get("position"),content:e.get("content"),fontSize:e.get("fontSize"),fontFamily:e.get("fontFamily"),color:e.get("color"),fontWeight:e.get("fontWeight"),fontStyle:e.get("fontStyle"),backgroundColor:e.get("backgroundColor"),outlineColor:e.get("outlineColor"),outlineWidth:e.get("outlineWidth")}}updateTextStyle(t,e,i,n,r,o,a,l,h){const c=this.features.get(t);c&&(c.set("fontSize",e),c.set("fontFamily",i),c.set("color",n),c.set("backgroundColor",r),c.set("outlineColor",o),c.set("outlineWidth",a),l&&c.set("fontWeight",l),h&&c.set("fontStyle",h),c.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.texts&&(this.clearAll(),t.texts.forEach(e=>this.addText(e)))}destroy(){this.stopDraw(),this.stopEdit(),this.textInputModal&&(this.textInputModal.destroy(),this.textInputModal=null),super.destroy()}}class xm extends It{constructor(t,e,i){super(t,e,Z.ARROW_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,87,34,1],this.defaultWidth=i?.defaultWidth||3,this.defaultStyle=i?.defaultStyle||"solid",this.defaultHeadSize=i?.defaultHeadSize||50,this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.ARROW_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("type");if(e==="line"){const i=t?.get("startPoint"),n=t?.get("endPoint"),r=t?.get("color")||this.defaultColor,o=t?.get("width")||this.defaultWidth,l=(t?.get("style")||this.defaultStyle)==="dashed"?[10,10]:void 0;if(!i||!n)return[new A({})];const h=ut(i),c=ut(n);return[new A({geometry:new pt([h,c]),stroke:new G({color:M(r),width:o,lineDash:l})})]}if(e==="arrowHead"){const i=t?.get("angle")||0,n=t?.get("color")||this.defaultColor,r=t?.get("headSize")||this.defaultHeadSize,o=t?.getGeometry()?.getCoordinates();if(!o)return[new A({})];const a=o[0],l=o[1],h=i+Math.PI*.85,c=i-Math.PI*.85,d=a+Math.cos(h)*r,u=l+Math.sin(h)*r,f=a+Math.cos(c)*r,g=l+Math.sin(c)*r,p=new it([[[a,l],[d,u],[f,g],[a,l]]]);return[new A({geometry:p,fill:new j({color:M(n)}),stroke:new G({color:M(n),width:1})})]}return[new A({})]}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;let i=null,n=null;this.drawInteraction=new ee({source:e,type:"LineString",maxPoints:2,geometryFunction:(r,o)=>r.length===0?(i=null,n=null,o):r.length===1?(i=r[0],n=null,o?o.setCoordinates([i,i]):o=new pt([i,i]),o):(r.length>=2&&(i=r[0],n=r[1],o?o.setCoordinates([i,n]):o=new pt([i,n])),o),style:new A({stroke:new G({color:M(this.defaultColor),width:this.defaultWidth,lineDash:this.defaultStyle==="dashed"?[10,10]:void 0})})}),this.drawInteraction.on("drawend",r=>{const o=Vt("arrow_");if(i&&n){const[a,l]=U(i),[h,c]=U(n),d=Math.atan2(n[1]-i[1],n[0]-i[0]),u=new pt([i,n]),f=new V({geometry:u,id:o,startPoint:[a,l],endPoint:[h,c],type:"line"});f.set("color",this.defaultColor),f.set("width",this.defaultWidth),f.set("style",this.defaultStyle),f.set("headSize",this.defaultHeadSize);const g=new rt(n),p=new V({geometry:g,id:o+"_head",parentId:o,type:"arrowHead",angle:d,color:this.defaultColor,headSize:this.defaultHeadSize});this.source?.addFeature(f),this.source?.addFeature(p),this.features.set(o,f),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:o,startPoint:[a,l],endPoint:[h,c],color:this.defaultColor,width:this.defaultWidth,style:this.defaultStyle,headSize:this.defaultHeadSize})}i=null,n=null,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}),this.transformInteraction.setActive(!0);const o=()=>{const a=i.getGeometry();if(a instanceof pt){const l=a.getCoordinates();if(l&&l.length>=2){const[h,c]=U(l[0]),[d,u]=U(l[1]),f=i.get("id");this.onEditCompleteCallback&&f&&this.onEditCompleteCallback({id:f,startPoint:[h,c],endPoint:[d,u]}),i.set("startPoint",[h,c]),i.set("endPoint",[d,u]),i.changed();const g=this.features.get(f+"_head");if(g){const p=Math.atan2(l[1][1]-l[0][1],l[1][0]-l[0][0]);g.setGeometry(new rt(l[1])),g.set("angle",p),g.changed()}}}};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=null),this.editingFeature=null,this.onEditCompleteCallback=null}addArrow(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,type:"line"});r.set("color",t.color||this.defaultColor),r.set("width",t.width||this.defaultWidth),r.set("style",t.style||this.defaultStyle);const o=Math.atan2(i[1]-e[1],i[0]-e[0]),a=new rt(i),l=new V({geometry:a,id:t.id+"_head",parentId:t.id,type:"arrowHead",angle:o,color:t.color||this.defaultColor,headSize:t.headSize||this.defaultHeadSize});this.source?.addFeature(r),this.source?.addFeature(l),this.features.set(t.id,r),this.features.set(t.id+"_head",l)}removeArrow(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t));const i=this.features.get(t+"_head");i&&(this.source?.removeFeature(i),this.features.delete(t+"_head")),this.editingFeature===e&&this.stopEdit()}getAllArrows(){const t=[];return this.features.forEach((e,i)=>{!i.toString().endsWith("_head")&&e.get("startPoint")&&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"),headSize:e.get("headSize")})}),t}getArrow(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"),headSize:e.get("headSize")}}updateArrowStyle(t,e,i,n,r){const o=this.features.get(t);if(!o)return;o.set("color",e),o.set("width",i),o.set("style",n),o.set("headSize",r),o.changed();const a=this.features.get(t+"_head");a&&(a.set("color",e),a.set("headSize",r),a.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.arrows&&(this.clearAll(),t.arrows.forEach(e=>this.addArrow(e)))}destroy(){this.stopDraw(),this.stopEdit(),super.destroy()}}class Qn extends It{constructor(t,e,i){super(t,e,Z.POLYGON,{...i,zIndex:i?.zIndex??10}),this.features=new Map,this.defaultFillColor=i?.defaultFillColor||[255,0,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[255,0,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POLYGON},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createLayer(t){return t.addLayer(this.layer),this.layer}addPolygon(t){const e=[t.points.map(([r,o])=>ut([r,o]))],i=new it(e),n=new V({geometry:i,id:t.id,title:t.title});n.setStyle(new A({fill:new j({color:M(t.fillColor||this.defaultFillColor)}),stroke:new G({color:M(t.outlineColor||this.defaultOutlineColor),width:t.outlineWidth||this.defaultOutlineWidth})})),this.source?.addFeature(n),this.features.set(t.id,n)}removePolygon(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t))}updateData(t){t.polygons&&(this.clear(),t.polygons.forEach(e=>this.addPolygon(e)))}getAllPolygons(){const t=[];return this.features.forEach((e,i)=>{t.push(e.getProperties())}),t}getPolygon(t){const e=this.features.get(t);if(e)return e.getProperties()}}class ts extends It{constructor(t,e,i){super(t,e,Z.POLYLINE,{...i,zIndex:i?.zIndex??10}),this.features=new Map,this.defaultColor=i?.defaultColor||[0,0,255,1],this.defaultWidth=i?.defaultWidth||3,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POLYLINE},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createLayer(t){return t.addLayer(this.layer),this.layer}addPolyline(t){const e=t.points.map(([r,o])=>ut([r,o])),i=new pt(e),n=new V({geometry:i,id:t.id,title:t.title});n.setStyle(new A({stroke:new G({color:M(t.color||this.defaultColor),width:t.width||this.defaultWidth})})),this.source?.addFeature(n),this.features.set(t.id,n)}removePolyline(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t))}updateData(t){t.polylines&&(this.clear(),t.polylines.forEach(e=>this.addPolyline(e)))}getAllPolylines(){const t=[];return this.features.forEach((e,i)=>{t.push(e.getProperties())}),t}getPolyline(t){const e=this.features.get(t);if(e)return e.getProperties()}}class es extends It{constructor(t,e,i){super(t,e,Z.CIRCLE,{...i,zIndex:i?.zIndex??15}),this.features=new Map,this.defaultFillColor=i?.defaultFillColor||[0,255,0,.3],this.defaultOutlineColor=i?.defaultOutlineColor||[0,255,0,1],this.defaultOutlineWidth=i?.defaultOutlineWidth||2,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.CIRCLE},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}createLayer(t){return t.addLayer(this.layer),this.layer}addCircle(t){const e=ut(t.center),i=new Me(e,t.radius),n=new V({geometry:i,id:t.id,title:t.title});n.setStyle(new A({fill:new j({color:M(t.fillColor||this.defaultFillColor)}),stroke:new G({color:M(t.outlineColor||this.defaultOutlineColor),width:t.outlineWidth||this.defaultOutlineWidth})})),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))}updateData(t){t.circles&&(this.clear(),t.circles.forEach(e=>this.addCircle(e)))}getAllCircles(){const t=[];return this.features.forEach((e,i)=>{t.push(e.getProperties())}),t}getCircle(t){const e=this.features.get(t);if(e)return e.getProperties()}}function ud(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function fa(s,t){return s[0]=t[0],s[1]=t[1],s[4]=t[2],s[5]=t[3],s[12]=t[4],s[13]=t[5],s}const Lr=34962,ll=34963,Cm=35044,ko=35048,Em=5121,vm=5123,Tm=5125,fd=5126,Sh=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function bm(s,t){t=Object.assign({preserveDrawingBuffer:!0,antialias:!df},t);const e=Sh.length;for(let i=0;i<e;++i)try{const n=s.getContext(Sh[i],t);if(n)return n}catch{}return null}const Sm={STATIC_DRAW:Cm};class Ro{constructor(t,e){this.array_=null,this.type_=t,gt(t===Lr||t===ll,"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`"),this.usage_=e!==void 0?e:Sm.STATIC_DRAW}ofSize(t){return this.array_=new(rr(this.type_))(t),this}fromArray(t){return this.array_=rr(this.type_).from(t),this}fromArrayBuffer(t){return this.array_=new(rr(this.type_))(t),this}getType(){return this.type_}getArray(){return this.array_}setArray(t){const e=rr(this.type_);if(!(t instanceof e))throw new Error(`Expected ${e}`);this.array_=t}getUsage(){return this.usage_}getSize(){return this.array_?this.array_.length:0}}function rr(s){switch(s){case Lr:return Float32Array;case ll:return Uint32Array;default:return Float32Array}}const or={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"},Pm=`
|
|
140
141
|
precision mediump float;
|
|
141
142
|
|
|
142
143
|
attribute vec2 a_position;
|
|
@@ -845,9 +846,9 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
845
846
|
</div>
|
|
846
847
|
</foreignObject>
|
|
847
848
|
</svg>
|
|
848
|
-
`;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="
|
|
849
|
-
|
|
850
|
-
</div>`),x+='<div style="padding: 12px;">',h&&(x+=`<div style="font-size: 14px; font-weight: 600; color: ${p}; margin-bottom: 8px;">${a.bubbleBoxTitle}</div>`),c&&(x+=`<div style="font-size: 12px; color: ${m}; line-height: 1.5;">${a.bubbleBoxDescription}</div>`),x+="</div>",y.innerHTML=x;const E=this.view.getTargetElement();getComputedStyle(E).position==="static"&&(E.style.position="relative"),E.appendChild(y);const w=t.getGeometry(),C=this.view.getPixelFromCoordinate(w.getCoordinates()),v=E.getBoundingClientRect(),_=y.offsetWidth,b=y.offsetHeight;if(!(C[0]>=0&&C[0]<=v.width&&C[1]>=0&&C[1]<=v.height)){y.style.display="none",this.currentPopup=y;return}let P=C[0]-v.left-_/2,L=C[1]-v.top-b-15;L<5&&(L=C[1]-v.top+15),P=Math.max(5,Math.min(P,v.width-_-5)),L=Math.max(5,Math.min(L,v.height-b-5)),y.style.left=`${P}px`,y.style.top=`${L}px`,y.style.display="block",this.currentPopup=y}hidePopup(){this.currentPopup&&(this.currentPopup.remove(),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()),n=this.view.getTargetElement().getBoundingClientRect(),r=this.currentPopup.offsetWidth,o=this.currentPopup.offsetHeight;if(!(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";let l=e[0]-n.left-r/2,h=e[1]-n.top-o-15;l=Math.max(5,Math.min(l,n.width-r-5)),h=Math.max(5,Math.min(h,n.height-o-5)),this.currentPopup.style.left=`${l}px`,this.currentPopup.style.top=`${h}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=`
|
|
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=`
|
|
851
852
|
position: absolute;
|
|
852
853
|
top: 10px;
|
|
853
854
|
right: 10px;
|
|
@@ -860,6 +861,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
860
861
|
border-radius: 8px;
|
|
861
862
|
padding: 4px;
|
|
862
863
|
backdrop-filter: blur(4px);
|
|
864
|
+
user-select: none;
|
|
863
865
|
`,this.scrollUpBtn=this.createScrollButton("▲",this.options.t.topScroll||"Top Scroll"),e.appendChild(this.scrollUpBtn),this.scrollUpBtn.style.display="none";const i=document.createElement("div");i.className="toolbar-scroll-container",i.style.cssText=`
|
|
864
866
|
overflow-y: auto;
|
|
865
867
|
overflow-x: hidden;
|
|
@@ -972,6 +974,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
972
974
|
overflow: hidden;
|
|
973
975
|
display: flex;
|
|
974
976
|
flex-direction: column;
|
|
977
|
+
user-select: none;
|
|
975
978
|
`;let n=328;if(this.element?.parentElement){const l=this.element.parentElement.getBoundingClientRect();n=Math.min(328,l.height-80)}e.style.cssText=`
|
|
976
979
|
position: absolute;
|
|
977
980
|
top: 10px;
|
|
@@ -1379,6 +1382,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1379
1382
|
backdrop-filter: blur(8px);
|
|
1380
1383
|
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
1381
1384
|
cursor: default;
|
|
1385
|
+
user-select: none;
|
|
1382
1386
|
`;const i=`
|
|
1383
1387
|
width: 28px;
|
|
1384
1388
|
height: 28px;
|
|
@@ -1490,6 +1494,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1490
1494
|
backdrop-filter: blur(8px);
|
|
1491
1495
|
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
1492
1496
|
cursor: default;
|
|
1497
|
+
user-select: none;
|
|
1493
1498
|
`;const i=`
|
|
1494
1499
|
width: 28px;
|
|
1495
1500
|
height: 28px;
|
|
@@ -1522,6 +1527,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1522
1527
|
color: ${t?"#fff":"#333"};
|
|
1523
1528
|
pointer-events: none;
|
|
1524
1529
|
border: 1px solid ${t?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"};
|
|
1530
|
+
user-select: none;
|
|
1525
1531
|
`,e.textContent="",e}updateScale(t){this.element.textContent=t}updateTheme(t){this.theme=t;const e=t==="dark";this.element.style.background=e?"rgba(0,0,0,0.7)":"rgba(255,255,255,0.9)",this.element.style.color=e?"#fff":"#333",this.element.style.borderColor=e?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)"}destroy(){this.element.remove()}}class h_{constructor(t,e){this.theme=e,this.element=this.createElement(),t.appendChild(this.element),this.messageSpan=this.element.querySelector(".loading-message"),this.spinner=this.element.querySelector(".loading-spinner")}createElement(){const t=this.theme==="dark",e=document.createElement("div");e.className="earthview-loading-overlay",e.style.cssText=`
|
|
1526
1532
|
position: absolute;
|
|
1527
1533
|
top: 0;
|
|
@@ -1569,6 +1575,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1569
1575
|
overflow: hidden;
|
|
1570
1576
|
display: flex;
|
|
1571
1577
|
flex-direction: column;
|
|
1578
|
+
user-select: none;
|
|
1572
1579
|
`,e}getPointData(){return this.options.getPointData?this.options.getPointData():[]}getLineData(){return this.options.getLineData?this.options.getLineData():[]}getPolygonData(){return this.options.getPolygonData?this.options.getPolygonData():[]}render(){this.element.innerHTML="";const t=this.options.theme==="dark",e=this.createHeader(t);this.element.appendChild(e);const i=document.createElement("div");i.style.cssText=`
|
|
1573
1580
|
flex: 1;
|
|
1574
1581
|
overflow-y: auto;
|
|
@@ -1770,7 +1777,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1770
1777
|
pointer-events: none;
|
|
1771
1778
|
white-space: nowrap;
|
|
1772
1779
|
`,e.textContent=t,document.body.appendChild(e),setTimeout(()=>e.remove(),2e3)}refresh(){this.render()}setActiveCategory(t){this.activeCategory=t,this.render()}updateTheme(t){this.options.theme=t,this.render()}getElement(){return this.element}destroy(){this.hideDetailPanel(),this.element.remove()}}class Rd{constructor(t,e){this.id="circle-draw",this.name="Circle Draw",this.icon="⭕",this.circleDrawLayer=t,this.name=e.drawCircle||"Circle Draw"}activate(){this.circleDrawLayer.setEditable(!0)}deactivate(){this.circleDrawLayer.stopDraw(),this.circleDrawLayer.stopEdit()}isActive(){return this.circleDrawLayer.isDrawActive()||this.circleDrawLayer.isEditActive()}startDraw(){this.circleDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.circleDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getCircleLayer(){return this.circleDrawLayer}destroy(){this.circleDrawLayer.destroy()}}class Ad{constructor(t,e){this.id="rectangle-draw",this.name="Rectangle Draw",this.icon="◻️",this.rectangleDrawLayer=t,this.name=e.drawRectangle||"Rectangle Draw"}activate(){this.rectangleDrawLayer.setEditable(!0)}deactivate(){this.rectangleDrawLayer.stopDraw(),this.rectangleDrawLayer.stopEdit()}isActive(){return this.rectangleDrawLayer.isDrawActive()||this.rectangleDrawLayer.isEditActive()}startDraw(){this.rectangleDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.rectangleDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getRectangleLayer(){return this.rectangleDrawLayer}destroy(){this.rectangleDrawLayer.destroy()}}class Md{constructor(t,e){this.id="triangle-draw",this.name="Triangle Draw",this.icon="▲",this.triangleDrawLayer=t,this.name=e.drawTriangle||"Triangle Draw"}activate(){this.triangleDrawLayer.setEditable(!0)}deactivate(){this.triangleDrawLayer.stopDraw(),this.triangleDrawLayer.stopEdit()}isActive(){return this.triangleDrawLayer.isDrawActive()||this.triangleDrawLayer.isEditActive()}startDraw(){this.triangleDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.triangleDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getTriangleLayer(){return this.triangleDrawLayer}destroy(){this.triangleDrawLayer.destroy()}}class Fd{constructor(t,e,i=!1){this.id="freehand-draw",this.name="Freehand Line",this.icon="✏️",this.isPolygonMode=!1,this.freehandDrawLayer=t,this.isPolygonMode=i,this.name=i?e.drawFreehandPolygon||"Freehand Polygon":e.drawFreehandLine||"Freehand Line"}activate(){this.freehandDrawLayer.setEditable(!0)}deactivate(){this.freehandDrawLayer.stopDraw(),this.freehandDrawLayer.stopEdit()}isActive(){return this.freehandDrawLayer.isDrawActive()||this.freehandDrawLayer.isEditActive()}startDraw(t=!1){this.name=t?"Freehand Polygon":"Freehand Line",this.freehandDrawLayer.startDraw(t,e=>{this.onDrawComplete&&this.onDrawComplete(e)})}startEdit(t){this.freehandDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getFreehandLayer(){return this.freehandDrawLayer}destroy(){this.freehandDrawLayer.destroy()}}class Od{constructor(t,e){this.id="ellipse-draw",this.name="Ellipse Draw",this.icon="⚪",this.ellipseDrawLayer=t,this.name=e.drawEllipse||"Ellipse Draw"}activate(){this.ellipseDrawLayer.setEditable(!0)}deactivate(){this.ellipseDrawLayer.stopDraw(),this.ellipseDrawLayer.stopEdit()}isActive(){return this.ellipseDrawLayer.isDrawActive()||this.ellipseDrawLayer.isEditActive()}startDraw(){this.ellipseDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.ellipseDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getEllipseLayer(){return this.ellipseDrawLayer}destroy(){this.ellipseDrawLayer.destroy()}}class zd{constructor(t,e){this.id="marker-draw",this.name="Marker Draw",this.icon="📍",this.markerDrawLayer=t,this.name=e.drawMarker||"Marker Draw"}activate(){this.markerDrawLayer.setEditable(!0)}deactivate(){this.markerDrawLayer.stopDraw(),this.markerDrawLayer.stopEdit()}isActive(){return this.markerDrawLayer.isDrawActive()||this.markerDrawLayer.isEditActive()}startDraw(){this.markerDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.markerDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getMarkerLayer(){return this.markerDrawLayer}destroy(){this.markerDrawLayer.destroy()}}class $d{constructor(t,e){this.id="text-draw",this.name="Text Annotation",this.icon="📝",this.textDrawLayer=t,this.name=e.drawText||"Text Annotation"}activate(){this.textDrawLayer.setEditable(!0)}deactivate(){this.textDrawLayer.stopDraw(),this.textDrawLayer.stopEdit()}isActive(){return this.textDrawLayer.isDrawActive()||this.textDrawLayer.isEditActive()}startDraw(){this.textDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.textDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}editProperties(t,e,i){this.textDrawLayer.editProperties(t,e,i)}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getTextLayer(){return this.textDrawLayer}destroy(){this.textDrawLayer.destroy()}}class Nd{constructor(t,e){this.id="arrow-draw",this.name="Arrow Draw",this.icon="➡️",this.arrowDrawLayer=t,this.name=e.drawArrow||"Arrow Draw"}activate(){this.arrowDrawLayer.setEditable(!0)}deactivate(){this.arrowDrawLayer.stopDraw(),this.arrowDrawLayer.stopEdit()}isActive(){return this.arrowDrawLayer.isDrawActive()||this.arrowDrawLayer.isEditActive()}startDraw(){this.arrowDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.arrowDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getArrowLayer(){return this.arrowDrawLayer}destroy(){this.arrowDrawLayer.destroy()}}class d_{constructor(){this.tools=new Map,this.activeTool=null,this.eventHandlers=new Map}registerCircleTool(t,e){const i=new Rd(t,e);return this.registerTool(i),i}registerRectangleTool(t,e){const i=new Ad(t,e);return this.registerTool(i),i}registerTriangleTool(t,e){const i=new Md(t,e);return this.registerTool(i),i}registerFreehandTool(t,e){const i=new Fd(t,e);return this.registerTool(i),i}registerEllipseTool(t,e){const i=new Od(t,e);return this.registerTool(i),i}registerMarkerTool(t,e){const i=new zd(t,e);return this.registerTool(i),i}registerTextTool(t,e){const i=new $d(t,e);return this.registerTool(i),i}registerArrowTool(t,e){const i=new Nd(t,e);return this.registerTool(i),i}registerTool(t){if(this.tools.has(t.id)){console.warn(`Tool with id ${t.id} already registered`);return}this.tools.set(t.id,t)}unregisterTool(t){const e=this.tools.get(t);e&&this.activeTool===e&&this.deactivateCurrent(),this.tools.delete(t)}getTool(t){return this.tools.get(t)}activateTool(t){this.activeTool&&this.activeTool.deactivate();const e=this.tools.get(t);e&&(this.activeTool=e,e.activate(),this.emit("tool-activated",{toolId:t,name:e.name}))}deactivateCurrent(){this.activeTool&&(this.activeTool.deactivate(),this.activeTool=null,this.emit("tool-deactivated",null))}getActiveTool(){return this.activeTool}getActiveToolId(){return this.activeTool?.id||null}isToolActive(t){return this.activeTool?.id===t}on(t,e){this.eventHandlers.has(t)||this.eventHandlers.set(t,[]),this.eventHandlers.get(t).push(e)}off(t,e){const i=this.eventHandlers.get(t);if(i){const n=i.indexOf(e);n!==-1&&i.splice(n,1)}}emit(t,e){const i=this.eventHandlers.get(t);i&&i.forEach(n=>n(e))}getAllTools(){return Array.from(this.tools.values())}destroy(){this.tools.forEach(t=>t.destroy()),this.tools.clear(),this.eventHandlers.clear(),this.activeTool=null}}function Wo(s,t,e){if(!(e in s))return s[e]=new Set([t]),!0;const i=s[e],n=i.has(t);return n||i.add(t),!n}function u_(s,t,e){const i=s[e];return i?i.delete(t):!1}function $h(s,t){const e=s.layerStatesArray[s.layerIndex];e.extent&&(t=Ni(t,Fi(e.extent,s.viewState.projection)));const i=e.layer.getRenderSource();if(!i.getWrapX()){const n=i.getTileGridForProjection(s.viewState.projection).getExtent();n&&(t=Ni(t,n))}return t}class f_ extends Uc{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=oe(),this.tempTileRange_=new cl(0,0,0,0),this.tempTileCoord_=kr(0,0,0);const i=e.cacheSize!==void 0?e.cacheSize:512;this.tileCache_=new Mh(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=i*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Mh(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,n){const r=this.tileCache_,a=this.getLayer().getSource(),l=dr(a,a.getKey(),t,e,i);let h;if(r.containsKey(l))h=r.get(l);else{const c=n.viewState.projection,d=a.getProjection();if(h=a.getTile(t,e,i,n.pixelRatio,c,!d||os(d,c)?void 0:this.getSourceTileCache()),!h)return null;r.set(l,h)}return h}getTile(t,e,i,n){const r=this.getOrCreateTile(t,e,i,n);return r||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=zt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Tn(r,n))return null;const o=e.viewState,a=i.getRenderSource(),l=a.getTileGridForProjection(o.projection),h=a.getTilePixelRatio(e.pixelRatio);for(let c=l.getZForResolution(o.resolution);c>=l.getMinZoom();--c){const d=l.getTileCoordForCoordAndZ(n,c),u=this.getTile(c,d[1],d[2],e);if(!u||u.getState()!==X.LOADED)continue;const f=l.getOrigin(c),g=ce(l.getTileSize(c)),p=l.getResolution(c);let m;if(u instanceof pd||u instanceof md)m=u.getImage();else if(u instanceof Dh){if(m=ga(u.getData()),!m)continue}else continue;const y=Math.floor(h*((n[0]-f[0])/p-d[1]*g[0])),x=Math.floor(h*((f[1]-n[1])/p-d[2]*g[1])),E=Math.round(h*a.getGutterForProjection(o.projection));return this.getImageData(m,y+E,x+E)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,n,r){const o=t.viewState,a=this.getLayer(),l=a.getRenderSource(),h=l.getTileGridForProjection(o.projection),c=K(l);c in t.wantedTiles||(t.wantedTiles[c]={});const d=t.wantedTiles[c],u=a.getMapInternal(),f=Math.max(i-r,h.getMinZoom(),h.getZForResolution(Math.min(a.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):h.getResolution(0)),l.zDirection)),g=o.rotation,p=g?Hh(o.center,o.resolution,g,t.size):void 0;for(let m=i;m>=f;--m){const y=h.getTileRangeForExtentAndZ(e,m,this.tempTileRange_),x=h.getResolution(m);for(let E=y.minX;E<=y.maxX;++E)for(let w=y.minY;w<=y.maxY;++w){if(g&&!h.tileCoordIntersectsViewport([m,E,w],p))continue;const C=this.getTile(m,E,w,t);if(!C||!Wo(n,C,m))continue;const _=C.getKey();if(d[_]=!0,C.getState()===X.IDLE&&!t.tileQueue.isKeyQueued(_)){const b=kr(m,E,w,this.tempTileCoord_);t.tileQueue.enqueue([C,c,h.getTileCoordCenter(b),x])}}}}findStaleTile_(t,e){const i=this.tileCache_,n=t[0],r=t[1],o=t[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){const h=dr(this.getLayer().getSource(),a[l],n,r,o);if(i.containsKey(h)){const c=i.peek(h);if(c.getState()===X.LOADED)return c.endTransition(K(this)),Wo(e,c,n),!0}}return!1}findAltTiles_(t,e,i,n){const r=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!r)return!1;let o=!0;const a=this.tileCache_,l=this.getLayer().getRenderSource(),h=l.getKey();for(let c=r.minX;c<=r.maxX;++c)for(let d=r.minY;d<=r.maxY;++d){const u=dr(l,h,i,c,d);let f=!1;if(a.containsKey(u)){const g=a.peek(u);g.getState()===X.LOADED&&(Wo(n,g,i),f=!0)}f||(o=!1)}return o}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,a=n.center,l=t.pixelRatio,h=this.getLayer(),c=h.getSource(),d=c.getTileGridForProjection(r),u=d.getZForResolution(o,c.zDirection),f=d.getResolution(u),g=c.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==g&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=g):this.renderedSourceKey_=g;let p=t.extent;const m=c.getTilePixelRatio(l);this.prepareContainer(t,e);const y=this.context.canvas.width,x=this.context.canvas.height;this.layerExtent=i.extent?Fi(i.extent):null,this.layerExtent&&(p=Ni(p,this.layerExtent));const E=f*y/2/m,w=f*x/2/m,C=[a[0]-E,a[1]-w,a[0]+E,a[1]+w],v={};this.renderedTiles.length=0;const _=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const D=d.getZForResolution(n.nextResolution,c.zDirection),z=$h(t,t.nextExtent);this.enqueueTiles(t,z,D,v,_)}const b=$h(t,p);if(this.enqueueTiles(t,b,u,v,0),_>0&&setTimeout(()=>{this.enqueueTiles(t,b,u-1,v,_-1)},0),!(u in v))return this.container;const S=K(this),P=t.time;for(const D of v[u]){const z=D.getState();if(z===X.EMPTY)continue;const N=D.tileCoord;if(z===X.LOADED&&D.getAlpha(S,P)===1){D.endTransition(S);continue}if(z!==X.ERROR&&(this.renderComplete=!1),this.findStaleTile_(N,v)){u_(v,D,u),t.animate=!0;continue}if(this.findAltTiles_(d,N,u+1,v))continue;const ht=d.getMinZoom();for(let ot=u-1;ot>=ht&&!this.findAltTiles_(d,N,ot,v);--ot);}const L=f/o*l/m,k=this.getRenderContext(t);Pe(this.tempTransform,y/2,x/2,L,L,0,-y/2,-x/2),this.layerExtent&&this.clipUnrotated(k,t,this.layerExtent),c.getInterpolate()||(k.imageSmoothingEnabled=!1),this.preRender(k,t);const F=Object.keys(v).map(Number);F.sort(ai);let O;const R=[],B=[];for(let D=F.length-1;D>=0;--D){const z=F[D],N=c.getTilePixelSize(z,l,r),et=d.getResolution(z)/f,ht=N[0]*et*L,ot=N[1]*et*L,I=d.getTileCoordForCoordAndZ(ji(C),z),xt=d.getTileCoordExtent(I),yt=zt(this.tempTransform,[m*(xt[0]-C[0])/f,m*(C[3]-xt[3])/f]),Ot=m*c.getGutterForProjection(r);for(const ie of v[z]){if(ie.getState()!==X.LOADED)continue;const Ne=ie.tileCoord,St=I[1]-Ne[1],vt=Math.round(yt[0]-(St-1)*ht),Dt=I[2]-Ne[2],Kt=Math.round(yt[1]-(Dt-1)*ot),kt=Math.round(yt[0]-St*ht),Ht=Math.round(yt[1]-Dt*ot),de=vt-kt,gi=Kt-Ht,Fs=F.length===1;let On=!1;O=[kt,Ht,kt+de,Ht,kt+de,Ht+gi,kt,Ht+gi];for(let qi=0,Os=R.length;qi<Os;++qi)if(!Fs&&z<B[qi]){const ne=R[qi];le([kt,Ht,kt+de,Ht+gi],[ne[0],ne[3],ne[4],ne[7]])&&(On||(k.save(),On=!0),k.beginPath(),k.moveTo(O[0],O[1]),k.lineTo(O[2],O[3]),k.lineTo(O[4],O[5]),k.lineTo(O[6],O[7]),k.moveTo(ne[6],ne[7]),k.lineTo(ne[4],ne[5]),k.lineTo(ne[2],ne[3]),k.lineTo(ne[0],ne[1]),k.clip())}R.push(O),B.push(z),this.drawTile(ie,t,kt,Ht,de,gi,Ot,Fs),On&&k.restore(),this.renderedTiles.unshift(ie),this.updateUsedTiles(t.usedTiles,c,ie)}}if(this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!bn(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,t),this.layerExtent&&k.restore(),k.imageSmoothingEnabled=!0,this.renderComplete){const D=(z,N)=>{const tt=K(c),et=N.wantedTiles[tt],ht=et?Object.keys(et).length:0;this.updateCacheSize(ht),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(D)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,t*2)}drawTile(t,e,i,n,r,o,a,l){let h;if(t instanceof Dh){if(h=ga(t.getData()),!h)throw new Error("Rendering array data is not yet supported")}else h=this.getTileImage(t);if(!h)return;const c=this.getRenderContext(e),d=K(this),u=e.layerStatesArray[e.layerIndex],f=u.opacity*(l?t.getAlpha(d,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f),c.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,r,o),g&&c.restore(),f!==u.opacity?e.animate=!0:l&&t.endTransition(d)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const n=K(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}}const hr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class g_ extends Qr{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(hr.PRELOAD)}setPreload(t){this.set(hr.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(hr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(hr.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}class jn extends g_{constructor(t){super(t)}createRenderer(){return new f_(this,{cacheSize:this.getCacheSize()})}}const ln=[0,0,0],xi=5;class Gd{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,gt(eu(this.resolutions_,(n,r)=>r-n),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let n=0,r=this.resolutions_.length-1;n<r;++n)if(!e)e=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,gt(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=ji(i)),gt(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,gt(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:el,gt(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((n,r)=>{const o=new cl(Math.min(0,n[0]),Math.max(n[0]-1,-1),Math.min(0,n[1]),Math.max(n[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let r=n.minX,o=n.maxX;r<=o;++r)for(let a=n.minY,l=n.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,n){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,n);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=sn(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return sn(r,r+1,o,o+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],o=t[2];if(e===n)return sn(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-n),h=Math.floor(r*l),c=Math.floor(o*l);if(e<n)return sn(h,h,c,c,i);const d=Math.floor(l*(r+1))-1,u=Math.floor(l*(o+1))-1;return sn(h,d,c,u,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,ln);const n=ln[1],r=ln[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,ln);const o=ln[1],a=ln[2];return sn(n,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=ce(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=ce(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*n,a=i[1]-(t[2]+1)*r[1]*n,l=o+r[0]*n,h=a+r[1]*n;return di(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=ce(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],d=a*(l[1]-e)/i/h[1];return n?(c=Ws(c,xi)-1,d=Ws(d,xi)-1):(c=Bs(c,xi),d=Bs(d,xi)),kr(o,c,d,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const o=this.getOrigin(i),a=this.getResolution(i),l=ce(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return n?(h=Ws(h,xi)-1,c=Ws(c,xi)-1):(h=Bs(h,xi),c=Bs(c,xi)),kr(i,h,c,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=xa(this.resolutions_,t,e||0);return Pt(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return pc(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}}function Bd(s){let t=s.getDefaultTileGrid();return t||(t=__(s),s.setDefaultTileGrid(t)),t}function p_(s,t,e){const i=t[0],n=s.getTileCoordCenter(t),r=vl(e);if(!Tn(r,n)){const o=Et(r),a=Math.ceil((r[0]-n[0])/o);return n[0]+=o*a,s.getTileCoordForCoordAndZ(n,i)}return t}function m_(s,t,e,i){i=i!==void 0?i:"top-left";const n=Wd(s,t,e);return new Gd({extent:s,origin:ou(s,i),resolutions:n,tileSize:e})}function y_(s){const t=s||{},e=t.extent||Ft("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Wd(e,t.maxZoom,t.tileSize,t.maxResolution)};return new Gd(i)}function Wd(s,t,e,i){t=t!==void 0?t:_p,e=ce(e!==void 0?e:el);const n=he(s),r=Et(s);i=i>0?i:Math.max(r/e[0],n/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function __(s,t,e,i){const n=vl(s);return m_(n,t,e,i)}function vl(s){s=Ft(s);let t=s.getExtent();if(!t){const e=180*Sa.degrees/s.getMetersPerUnit();t=di(-e,-e,e,e)}return t}const w_=/\{z\}/g,x_=/\{x\}/g,C_=/\{y\}/g,E_=/\{-y\}/g;function v_(s,t,e,i,n){return s.replace(w_,t.toString()).replace(x_,e.toString()).replace(C_,i.toString()).replace(E_,function(){if(n===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(n-i).toString()})}function T_(s){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(s);if(e){const i=e[1].charCodeAt(0),n=e[2].charCodeAt(0);let r;for(r=i;r<=n;++r)t.push(s.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(s),e){const i=parseInt(e[2],10);for(let n=parseInt(e[1],10);n<=i;n++)t.push(s.replace(e[0],n.toString()));return t}return t.push(s),t}function b_(s,t){return(function(e,i,n){if(!e)return;let r;const o=e[0];if(t){const a=t.getFullTileRange(o);a&&(r=a.getHeight()-1)}return v_(s,o,e[1],e[2],r)})}function S_(s,t){const e=s.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=b_(s[n],t);return P_(i)}function P_(s){return s.length===1?s[0]:(function(t,e,i){if(!t)return;const n=Vm(t),r=Gi(n,s.length);return s[r](t,e,i)})}class I_ extends id{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&ce(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||K(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r,o){return Q()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Bd(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=ce(n.getTileSize(t),this.tmpSize);return r==1?o:eg(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=e!==void 0?e:this.getProjection(),n=e!==void 0?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=p_(n,t,i)),Xm(t,n)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class L_ extends qe{constructor(t,e){super(t),this.tile=e}}const Uo={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class Tl extends I_{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Tl.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=K(e),n=e.getState();let r;n==X.LOADING?(this.tileLoadingKeys_[i]=!0,r=Uo.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==X.ERROR?Uo.TILELOADERROR:n==X.LOADED?Uo.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new L_(r,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=T_(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
|
|
1773
|
-
`);this.generateTileUrlFunction_?this.setTileUrlFunction(S_(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class D_ extends Tl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:k_,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:pd,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!os(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||os(e,t)))return this.tileGrid;const i=K(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Bd(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,n,r):void 0,c=new this.tileClass(a,h!==void 0?X.IDLE:X.EMPTY,h!==void 0?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(nt.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r,o){const a=this.getProjection();if(!a||!r||os(a,r))return this.getTileInternal(t,e,i,n,a||r);const l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),d=this.getTileGridForProjection(r),u=this.getTileCoordForTileUrlFunction(l,r),f=new md(a,c,r,d,l,u,this.getTilePixelRatio(n),this.getGutter(),(g,p,m,y)=>this.getTileInternal(g,p,m,y,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,i,n,r,o){const a=this.getKey(),l=dr(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,i,n,r,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Ft(t);if(i){const n=K(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}}}function k_(s,t){if(Ee){const e=s.getCrossOrigin();let i="same-origin",n="same-origin";e==="anonymous"||e===""?(i="cors",n="omit"):e==="use-credentials"&&(i="cors",n="include");const r={mode:i,credentials:n,referrerPolicy:s.getReferrerPolicy()};fetch(t,r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{const a=s.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{s.getImage().dispatchEvent(new Event("error"))});return}s.getImage().src=t}class ns extends D_{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:y_({extent:vl(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const R_='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class A_ extends ns{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[R_];const i=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin!==void 0?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}}const Mt=Math.PI,Mr=6378245,Fr=.006693421622965943;function bl(s,t){return s<72.004||s>137.8347||t<.8293||t>55.8271}function Ud(s,t){let e=-100+2*s+3*t+.2*t*t+.1*s*t+.2*Math.sqrt(Math.abs(s));return e+=(20*Math.sin(6*s*Mt)+20*Math.sin(2*s*Mt))*(2/3),e+=(20*Math.sin(t*Mt)+40*Math.sin(t/3*Mt))*(2/3),e+=(160*Math.sin(t/12*Mt)+320*Math.sin(t*Mt/30))*(2/3),e}function Vd(s,t){let e=300+s+2*t+.1*s*s+.1*s*t+.1*Math.sqrt(Math.abs(s));return e+=(20*Math.sin(6*s*Mt)+20*Math.sin(2*s*Mt))*(2/3),e+=(20*Math.sin(s*Mt)+40*Math.sin(s/3*Mt))*(2/3),e+=(150*Math.sin(s/12*Mt)+300*Math.sin(s*Mt/30))*(2/3),e}function Sl(s,t){if(bl(s,t))return[s,t];let e=Ud(s-105,t-35),i=Vd(s-105,t-35);const n=t/180*Mt;let r=Math.sin(n);r=1-Fr*r*r;const o=Math.sqrt(r);return e=e*180/(Mr*(1-Fr)/(r*o)*Mt),i=i*180/(Mr/o*Math.cos(n)*Mt),[s-i,t-e]}function Nh(s,t){if(bl(s,t))return[s,t];let e=Ud(s-105,t-35),i=Vd(s-105,t-35);const n=t/180*Mt;let r=Math.sin(n);r=1-Fr*r*r;const o=Math.sqrt(r);return e=e*180/(Mr*(1-Fr)/(r*o)*Mt),i=i*180/(Mr/o*Math.cos(n)*Mt),[s+i,t+e]}function M_(s,t){const e=s,i=t,n=Math.sqrt(e*e+i*i)+2e-5*Math.sin(i*Mt),r=Math.atan2(i,e)+3e-6*Math.cos(e*Mt),o=n*Math.cos(r)+.0065,a=n*Math.sin(r)+.006;return[o,a]}function F_(s,t){const e=s-.0065,i=t-.006,n=Math.sqrt(e*e+i*i)-2e-5*Math.sin(i*Mt),r=Math.atan2(i,e)-3e-6*Math.cos(e*Mt),o=n*Math.cos(r),a=n*Math.sin(r);return[o,a]}function Hd(s,t){const[e,i]=F_(s,t);return Sl(e,i)}function _a(s,t,e){switch(e){case Oe.WGS84:return[s,t];case Oe.GCJ02:return Sl(s,t);case Oe.BD09:return Hd(s,t);default:return[s,t]}}function O_(s,t,e){switch(e){case Oe.WGS84:return[s,t];case Oe.GCJ02:return Nh(s,t);case Oe.BD09:return M_(...Nh(s,t));default:return[s,t]}}function z_(s,t){return!bl(s,t)}const Vo={[dt.SATELLITE]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.STREETS]:{url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"OpenStreetMap"},[dt.TOPO]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.OCEANS]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.GRAY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.DARK_GRAY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.NATIONAL_GEOGRAPHIC]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.TERRAIN]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.HYBRID]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.LIGHT_GRAY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.IMAGERY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.PHYSICAL]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.AMAP_STREETS]:{url:"https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",attribution:"高德地图"},[dt.AMAP_SATELLITE]:{url:"https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",attribution:"高德地图"},[dt.GOOGLE_STREETS]:{url:"http://www.google.cn/maps/vt?lyrs=m&x={x}&y={y}&z={z}",attribution:"Google"},[dt.GOOGLE_SATELLITE]:{url:"http://www.google.cn/maps/vt?lyrs=s&x={x}&y={y}&z={z}",attribution:"Google"}};class $_{constructor(t,e,i,n,r,o){getComputedStyle(t).position==="static"&&(t.style.position="relative");let a=i;r!==Oe.WGS84&&(a=_a(i[0],i[1],r)),e===dt.CUSTOMIZE&&o?(this.basemapLayer=this.createBasemapLayerFromUrl(o),this.currentBasemap=null):(this.basemapLayer=this.createBasemapLayer(e),this.currentBasemap=e),this.view=new He({center:ut(a),zoom:n,minZoom:1,maxZoom:19}),this.map=new dd({target:t,layers:[this.basemapLayer],view:this.view,controls:[],interactions:ld({doubleClickZoom:!1})})}createBasemapLayerFromUrl(t){const e=new ns({url:t});return new jn({source:e})}createBasemapLayer(t){const e=Vo[t];if(t===dt.STREETS){const n=new A_;return new jn({source:n})}if(e){const n=new ns({url:e.url,attributions:e.attribution});return new jn({source:n})}const i=new ns({url:Vo[dt.SATELLITE]?.url,attributions:Vo[dt.SATELLITE]?.attribution});return new jn({source:i})}setBasemapByUrl(t){const e=new ns({url:t}),i=new jn({source:e});this.map.removeLayer(this.basemapLayer),this.basemapLayer=i,this.map.addLayer(this.basemapLayer),this.currentBasemap=null}setBasemap(t){this.map.removeLayer(this.basemapLayer),this.basemapLayer=this.createBasemapLayer(t),this.map.addLayer(this.basemapLayer),this.currentBasemap=t}getCurrentBasemap(){return this.currentBasemap}getMap(){return this.map}getView(){return this.view}getCenter(){const t=U(this.view.getCenter()||[0,0]);return[t[0],t[1]]}getZoom(){return this.view.getZoom()||0}setCenter(t,e){let i=t;e&&e!==Oe.WGS84&&(i=_a(t[0],t[1],e)),this.view.setCenter(ut(i))}setZoom(t){this.view.setZoom(t)}setRotation(t){this.view.setRotation(t)}destroy(){this.map.setTarget(void 0),this.map.dispose()}}class N_{constructor(t,e){this.id="line-draw",this.name="Line",this.icon="━━",this.lineDrawLayer=t,this.name=e.drawLine||"Line"}activate(){this.lineDrawLayer.setEditable(!0)}deactivate(){this.lineDrawLayer.stopDraw(),this.lineDrawLayer.stopEdit()}isActive(){return this.lineDrawLayer.isDrawActive()||this.lineDrawLayer.isEditActive()}startDraw(){this.lineDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.lineDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getLineLayer(){return this.lineDrawLayer}destroy(){this.lineDrawLayer.destroy()}}class G_{constructor(t,e){this.id="bezier-draw",this.name="Bezier Curve",this.icon="〰️",this.bezierDrawLayer=t,this.name=e.drawBezier||"Bezier Curve"}activate(){this.bezierDrawLayer.setEditable(!0)}deactivate(){this.bezierDrawLayer.stopDraw(),this.bezierDrawLayer.stopEdit()}isActive(){return this.bezierDrawLayer.isDrawActive()||this.bezierDrawLayer.isEditActive()}startDraw(){this.bezierDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.bezierDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getBezierLayer(){return this.bezierDrawLayer}destroy(){this.bezierDrawLayer.destroy()}}class B_{constructor(t,e){this.id="sector-draw",this.name="Sector",this.icon="🥧",this.sectorDrawLayer=t,this.name=e.drawSector||"Sector"}activate(){this.sectorDrawLayer.setEditable(!0)}deactivate(){this.sectorDrawLayer.stopDraw(),this.sectorDrawLayer.stopEdit()}isActive(){return this.sectorDrawLayer.isDrawActive()||this.sectorDrawLayer.isEditActive()}startDraw(){this.sectorDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.sectorDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getSectorLayer(){return this.sectorDrawLayer}destroy(){this.sectorDrawLayer.destroy()}}var ct=(s=>(s.CIRCLE="circle-draw",s.RECTANGLE="rectangle-draw",s.TRIANGLE="triangle-draw",s.FREEHAND="freehand-draw",s.FREEHAND_POLYGON="freehand-polygon-draw",s.ELLIPSE="ellipse-draw",s.SECTOR="sector-draw",s.MARKER="marker-draw",s.TEXT="text-draw",s.ARROW="arrow-draw",s.BEZIER="bezier-draw",s.LINE="line-draw",s.IMAGE="image",s))(ct||{});class W_{constructor(t,e,i,n,r,o){this.toolbar=null,this.scaleBar=null,this.loadingOverlay=null,this.activePopupPanel=null,this.activePopupType=null,this.basemapOptionsInstance=null,this.layersPanelInstance=null,this.coordinatePickingDataPanel=null,this.container=t,this.theme=e,this.t=i,this.callbacks=n,this.getLayerListFn=r,this.getCurrentBasemapFn=o,this.currentBasemap=o()||dt.SATELLITE,this.init()}init(){this.toolbar=new i_({container:this.container,t:this.t,theme:this.theme,activePopup:this.activePopupType,onTogglePopup:this.handleTogglePopup.bind(this),onZoomIn:()=>this.callbacks.onZoomIn(),onZoomOut:()=>this.callbacks.onZoomOut(),onLocate:()=>this.callbacks.onLocate(),onShowCoordinatePickingDataPanel:()=>this.showCoordinatePickingDataPanel()}),this.scaleBar=new l_(this.container,this.theme),this.loadingOverlay=new h_(this.container,this.theme)}getBasemapOptions(){return[{value:dt.SATELLITE,label:this.t.satellite,icon:"🛰️"},{value:dt.STREETS,label:this.t.streets,icon:"🗺️"},{value:dt.TOPO,label:this.t.topographic,icon:"⛰️"},{value:dt.HYBRID,label:this.t.hybrid,icon:"🔄"},{value:dt.TERRAIN,label:this.t.terrain,icon:"🗻"},{value:dt.OCEANS,label:this.t.oceans,icon:"🌊"},{value:dt.DARK_GRAY,label:this.t.darkGray,icon:"🌙"},{value:dt.LIGHT_GRAY,label:this.t.lightGray,icon:"☀️"},{value:dt.NATIONAL_GEOGRAPHIC,label:this.t.nationalGeographic,icon:"📰"},{value:dt.IMAGERY,label:this.t.imagery,icon:"📷"},{value:dt.PHYSICAL,label:this.t.physical,icon:"🌎"},{value:dt.AMAP_STREETS,label:this.t.amapStreets,icon:"🗺️"},{value:dt.AMAP_SATELLITE,label:this.t.amapSatellite,icon:"🛰️"},{value:dt.GOOGLE_STREETS,label:this.t.googleStreets,icon:"🗺️"},{value:dt.GOOGLE_SATELLITE,label:this.t.googleSatellite,icon:"🛰️"}]}handleTogglePopup(t){if(this.coordinatePickingDataPanel&&(this.coordinatePickingDataPanel.destroy(),this.coordinatePickingDataPanel=null),this.activePopupPanel&&(this.activePopupPanel.destroy(),this.activePopupPanel=null),this.activePopupType=t,this.toolbar?.updateActivePopup(t),t===null)return;let e;switch(t){case"layers":e=new lr({title:this.t.layers,theme:this.theme,t:this.t,onClose:()=>{this.layersPanelInstance=null,this.handleTogglePopup(null)}}),this.layersPanelInstance=new n_({layerList:this.getLayerListFn(),onToggleVisibility:r=>this.callbacks.onToggleLayerVisibility(r),onRemoveLayer:r=>this.callbacks.onRemoveLayer(r),onGetLayerFeatures:r=>this.callbacks.onGetLayerFeatures?this.callbacks.onGetLayerFeatures(r):[],onLocateFeature:(r,o)=>{this.callbacks.onLocateFeature&&this.callbacks.onLocateFeature(r,o)},onCopyFeatureCoordinates:(r,o)=>{this.callbacks.onCopyFeatureCoordinates&&this.callbacks.onCopyFeatureCoordinates(r,o)},theme:this.theme,t:this.t}),e.appendChild(this.layersPanelInstance.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break;case"basemap":e=new lr({title:this.t.basemap,theme:this.theme,t:this.t,onClose:()=>{this.basemapOptionsInstance=null,this.handleTogglePopup(null)}}),this.basemapOptionsInstance=new s_({currentBasemap:this.currentBasemap,onSelect:r=>{this.callbacks.onSetBasemap(r)},theme:this.theme,t:this.t,options:this.getBasemapOptions()}),e.appendChild(this.basemapOptionsInstance.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break;case"draw":e=new lr({title:this.t.drawTools,theme:this.theme,t:this.t,onClose:()=>this.handleTogglePopup(null)});const i=new r_({onDrawCircle:()=>this.callbacks.onDrawCircle(),onDrawRectangle:()=>this.callbacks.onDrawRectangle(),onDrawTriangle:()=>this.callbacks.onDrawTriangle(),onDrawFreehand:()=>this.callbacks.onDrawFreehand(),onDrawFreehandPolygon:()=>this.callbacks.onDrawFreehandPolygon(),onDrawEllipse:()=>this.callbacks.onDrawEllipse(),onDrawMarker:()=>this.callbacks.onDrawMarker(),onDrawText:()=>this.callbacks.onDrawText(),onDrawArrow:()=>this.callbacks.onDrawArrow(),onDrawLine:()=>this.callbacks.onDrawLine(),onDrawBezier:()=>this.callbacks.onDrawBezier(),onDrawSector:()=>this.callbacks.onDrawSector(),onDrawImage:this.callbacks.onDrawImage,onEditShape:()=>this.callbacks.onEditShape(),theme:this.theme,t:this.t});e.appendChild(i.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break;case"tools":e=new lr({title:this.t.tools,theme:this.theme,t:this.t,onClose:()=>{this.handleTogglePopup(null),this.callbacks.onClearMeasurements()}});const n=new o_({onDistanceMeasure:()=>this.callbacks.onDistanceMeasure(),onAreaMeasure:()=>this.callbacks.onAreaMeasure(),onClearMeasurements:()=>this.callbacks.onClearMeasurements(),onPointCoordinatePick:()=>this.callbacks.onPointCoordinatePick(),onLineCoordinatePick:()=>this.callbacks.onLineCoordinatePick(),onPolygonCoordinatePick:()=>this.callbacks.onPolygonCoordinatePick(),onShowCoordinateList:()=>this.callbacks.onShowCoordinateList(),isMeasuring:!1,currentMeasureType:null,currentPickType:null,measurePreview:null,theme:this.theme,t:this.t});e.appendChild(n.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break}}adjustPopupPosition(t){setTimeout(()=>{const e=t.getElement();if(!e)return;const i=this.container.getBoundingClientRect(),n=e.getBoundingClientRect(),r=n.bottom,o=i.bottom;if(r>o){const a=o-n.top-10;a>100?e.style.maxHeight=`${a}px`:e.style.maxHeight="100px"}},10)}updateCurrentBasemap(t){t!==null&&(this.currentBasemap=t,this.basemapOptionsInstance&&this.basemapOptionsInstance.updateCurrentBasemap(t))}refreshBasemapOptions(){this.basemapOptionsInstance&&this.activePopupType==="basemap"&&this.basemapOptionsInstance.updateProps({options:this.getBasemapOptions(),t:this.t,theme:this.theme,currentBasemap:this.currentBasemap})}updateLayerList(){this.activePopupType==="layers"&&this.layersPanelInstance&&this.layersPanelInstance.updateData(this.getLayerListFn())}showLoading(t){this.loadingOverlay?.show(t)}hideLoading(){this.loadingOverlay?.hide()}updateScale(t){this.scaleBar?.updateScale(t)}updateTheme(t){if(this.theme=t,this.toolbar?.updateTheme(t),this.scaleBar?.updateTheme(t),this.basemapOptionsInstance&&this.basemapOptionsInstance.updateTheme(t),this.layersPanelInstance&&this.layersPanelInstance.updateTheme(t),this.activePopupType){const e=this.activePopupType;this.handleTogglePopup(null),this.handleTogglePopup(e)}}updateLocale(t){this.t=t,this.toolbar?.destroy(),this.activePopupPanel&&(this.activePopupPanel.destroy(),this.activePopupPanel=null),this.init(),this.refreshBasemapOptions(),this.activePopupType&&this.handleTogglePopup(this.activePopupType)}showCoordinatePickingDataPanel(){if(this.coordinatePickingDataPanel){this.coordinatePickingDataPanel.destroy(),this.coordinatePickingDataPanel=null;return}this.activePopupPanel&&(this.activePopupPanel.destroy(),this.activePopupPanel=null),this.activePopupType=null,this.toolbar?.updateActivePopup(null);const t=new c_({onClose:()=>{this.coordinatePickingDataPanel&&(this.coordinatePickingDataPanel.destroy(),this.coordinatePickingDataPanel=null)},onSelectCategory:e=>{},onLocatePoint:(e,i)=>{this.callbacks.onLocateCoordinate&&this.callbacks.onLocateCoordinate(e,i)},onLocateLine:e=>{this.callbacks.onLocateLine&&this.callbacks.onLocateLine(e)},onLocatePolygon:e=>{this.callbacks.onLocatePolygon&&this.callbacks.onLocatePolygon(e)},getPointData:()=>this.callbacks.getPointData?this.callbacks.getPointData():[],getLineData:()=>this.callbacks.getLineData?this.callbacks.getLineData():[],getPolygonData:()=>this.callbacks.getPolygonData?this.callbacks.getPolygonData():[],theme:this.theme,t:this.t});this.container.appendChild(t.getElement()),this.coordinatePickingDataPanel=t}destroy(){this.toolbar?.destroy(),this.scaleBar?.destroy(),this.loadingOverlay?.destroy(),this.activePopupPanel&&this.activePopupPanel.destroy(),this.coordinatePickingDataPanel&&this.coordinatePickingDataPanel.destroy(),this.basemapOptionsInstance=null,this.layersPanelInstance=null}getContainer(){return this.container}}class U_{constructor(){this.activeToolType=null,this.circleTool=null,this.rectangleTool=null,this.triangleTool=null,this.freehandTool=null,this.ellipseTool=null,this.markerTool=null,this.textTool=null,this.arrowTool=null,this.imageTool=null,this.lineTool=null,this.bezierTool=null,this.sectorTool=null}registerTools(t,e,i,n,r,o,a,l,h,c,d,u){this.circleTool=t,this.rectangleTool=e,this.triangleTool=i,this.freehandTool=n,this.ellipseTool=r,this.markerTool=o,this.textTool=a,this.arrowTool=l,this.lineTool=h,this.bezierTool=c,this.sectorTool=d,this.imageTool=u,this.circleTool?.setOnDrawComplete(()=>this.endDrawing()),this.rectangleTool?.setOnDrawComplete(()=>this.endDrawing()),this.triangleTool?.setOnDrawComplete(()=>this.endDrawing()),this.freehandTool?.setOnDrawComplete(()=>this.endDrawing()),this.ellipseTool?.setOnDrawComplete(()=>this.endDrawing()),this.markerTool?.setOnDrawComplete(()=>this.endDrawing()),this.textTool?.setOnDrawComplete(()=>this.endDrawing()),this.arrowTool?.setOnDrawComplete(()=>this.endDrawing()),this.imageTool?.setOnDrawComplete(()=>this.endDrawing()),this.circleTool?.setOnEditComplete(()=>this.endDrawing()),this.rectangleTool?.setOnEditComplete(()=>this.endDrawing()),this.triangleTool?.setOnEditComplete(()=>this.endDrawing()),this.freehandTool?.setOnEditComplete(()=>this.endDrawing()),this.ellipseTool?.setOnEditComplete(()=>this.endDrawing()),this.markerTool?.setOnEditComplete(()=>this.endDrawing()),this.textTool?.setOnEditComplete(()=>this.endDrawing()),this.arrowTool?.setOnEditComplete(()=>this.endDrawing()),this.imageTool?.setOnEditComplete(()=>this.endDrawing()),this.lineTool?.setOnDrawComplete(()=>this.endDrawing()),this.bezierTool?.setOnDrawComplete(()=>this.endDrawing()),this.sectorTool?.setOnDrawComplete(()=>this.endDrawing()),this.lineTool?.setOnEditComplete(()=>this.endDrawing()),this.bezierTool?.setOnEditComplete(()=>this.endDrawing()),this.sectorTool?.setOnEditComplete(()=>this.endDrawing())}startDrawingLine(){this.deactivateAll(),this.activeToolType=ct.LINE,this.lineTool?.startDraw(),this.onDrawingStartCallback?.(ct.LINE)}startDrawingBezier(){this.deactivateAll(),this.activeToolType=ct.BEZIER,this.bezierTool?.startDraw(),this.onDrawingStartCallback?.(ct.BEZIER)}startDrawingSector(){this.deactivateAll(),this.activeToolType=ct.SECTOR,this.sectorTool?.startDraw(),this.onDrawingStartCallback?.(ct.SECTOR)}setCallbacks(t,e){this.onDrawingStartCallback=t,this.onDrawingEndCallback=e}startDrawingCircle(){this.deactivateAll(),this.activeToolType=ct.CIRCLE,this.circleTool?.startDraw(),this.onDrawingStartCallback?.(ct.CIRCLE)}startDrawingRectangle(){this.deactivateAll(),this.activeToolType=ct.RECTANGLE,this.rectangleTool?.startDraw(),this.onDrawingStartCallback?.(ct.RECTANGLE)}startDrawingTriangle(){this.deactivateAll(),this.activeToolType=ct.TRIANGLE,this.triangleTool?.startDraw(),this.onDrawingStartCallback?.(ct.TRIANGLE)}startDrawingFreehand(){this.deactivateAll(),this.activeToolType=ct.FREEHAND,this.freehandTool?.startDraw(!1),this.onDrawingStartCallback?.(ct.FREEHAND)}startDrawingFreehandPolygon(){this.deactivateAll(),this.activeToolType=ct.FREEHAND_POLYGON,this.freehandTool?.startDraw(!0),this.onDrawingStartCallback?.(ct.FREEHAND_POLYGON)}startDrawingEllipse(){this.deactivateAll(),this.activeToolType=ct.ELLIPSE,this.ellipseTool?.startDraw(),this.onDrawingStartCallback?.(ct.ELLIPSE)}startDrawingMarker(){this.deactivateAll(),this.activeToolType=ct.MARKER,this.markerTool?.startDraw(),this.onDrawingStartCallback?.(ct.MARKER)}startDrawingText(){this.deactivateAll(),this.activeToolType=ct.TEXT,this.textTool?.startDraw(),this.onDrawingStartCallback?.(ct.TEXT)}startDrawingArrow(){this.deactivateAll(),this.activeToolType=ct.ARROW,this.arrowTool?.startDraw(),this.onDrawingStartCallback?.(ct.ARROW)}startDrawingImage(){this.deactivateAll(),this.activeToolType=ct.IMAGE,this.imageTool?.startDraw(),this.onDrawingStartCallback?.(ct.IMAGE)}cancelDrawing(){this.deactivateAll()}deactivateAll(){const t=this.activeToolType!==null;this.circleTool?.deactivate(),this.rectangleTool?.deactivate(),this.triangleTool?.deactivate(),this.freehandTool?.deactivate(),this.ellipseTool?.deactivate(),this.markerTool?.deactivate(),this.textTool?.deactivate(),this.arrowTool?.deactivate(),this.imageTool?.deactivate(),this.lineTool?.deactivate(),this.bezierTool?.deactivate(),this.sectorTool?.deactivate(),this.activeToolType=null,t&&this.onDrawingEndCallback?.()}endDrawing(){this.activeToolType!==null&&(this.activeToolType=null,this.onDrawingEndCallback?.())}getActiveTool(){return this.activeToolType}isDrawing(){return this.activeToolType!==null}destroy(){this.deactivateAll(),this.circleTool=null,this.rectangleTool=null,this.triangleTool=null,this.freehandTool=null,this.ellipseTool=null,this.markerTool=null,this.textTool=null,this.arrowTool=null,this.imageTool=null,this.lineTool=null,this.bezierTool=null,this.sectorTool=null}}class V_{constructor(){this.drawingManager=null,this.mapView=null,this.keydownHandler=null,this.container=null}setDrawingManager(t){this.drawingManager=t}setMapView(t){this.mapView=t}bindEvents(t){t&&(this.container=t),this.keydownHandler&&(this.container?this.container.removeEventListener("keydown",this.keydownHandler):document.removeEventListener("keydown",this.keydownHandler)),this.keydownHandler=e=>{e.key==="Escape"&&this.handleEscCancel()},this.container?this.container.addEventListener("keydown",this.keydownHandler):document.addEventListener("keydown",this.keydownHandler)}handleEscCancel(){this.drawingManager?.isDrawing()&&this.drawingManager.cancelDrawing()}unbindEvents(){this.keydownHandler&&(this.container?this.container.removeEventListener("keydown",this.keydownHandler):document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}destroy(){this.unbindEvents(),this.drawingManager=null,this.mapView=null,this.container=null}}class H_ extends It{constructor(t,e,i){super(t,e,Z.LINE_COORDINATE_PICK,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.lines=new Map,this.onCompleteCallback=null,this.mapView=null,this.features=new Map,this.labelFeatures=new Map,this.lineColor=i?.lineColor||[0,200,255,1],this.lineWidth=i?.lineWidth||3,this.textColor=i?.textColor||[255,200,0,1],this.textSize=i?.textSize||12,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.LINE_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:"LineString"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates(),o=r.map(f=>{const[g,p]=U(f);return{longitude:g,latitude:p}}),a=Vt("LineCoordinatePick_"),l=Date.now(),h=Math.floor(o.length/2),c=r[h],d={id:a,points:o,timestamp:l,name:`${this.t?.linePick.default_name||"Line Pick"} ${new Date(l).toLocaleTimeString()}`};this.lines.set(a,d),this.features.set(a,i),i.setStyle(new A({stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})})),i.set("id",a),i.set("type","line_pick");const u=new V({geometry:new rt(c),id:a});u.set("type","line_pick"),u.setStyle(new A({text:new te({text:`${this.t?.linePick.label_prefix||"Line"} ${this.lines.size}`,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.labelFeatures.set(a,u),this.source?.addFeature(u),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}removeLine(t){const e=this.features.get(t),i=this.labelFeatures.get(t);return e&&(this.source?.removeFeature(e),this.features.delete(t)),i&&(this.source?.removeFeature(i),this.labelFeatures.delete(t)),this.lines.delete(t),!0}clearAllLines(){this.clear(),this.features.clear(),this.labelFeatures.clear(),this.lines.clear(),this.stopPick()}getAllLines(){return Array.from(this.lines.values())}getLine(t){return this.lines.get(t)}highlightLine(t){this.features.forEach((e,i)=>{const n=i===t;e.setStyle(new A({stroke:new G({color:M(n?[255,170,0,1]:this.lineColor),width:this.lineWidth+(n?2:0),lineDash:n?[]:[10,10]})}))}),this.labelFeatures.forEach((e,i)=>{const n=i===t;e.setStyle(new A({text:new te({text:n?this.t?.linePick.highlight_text||"● Line Pick ●":`${this.t?.linePick.label_prefix||"Line"} ${this.lines.size}`,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({stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})}))}),this.labelFeatures.forEach(t=>{t.setStyle(new A({text:new te({text:`${this.t?.linePick.label_prefix||"Line"} ${this.lines.size}`,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()}}class X_ extends It{constructor(t,e,i){super(t,e,Z.POLYGON_COORDINATE_PICK,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.polygons=new Map,this.onCompleteCallback=null,this.mapView=null,this.features=new Map,this.labelFeatures=new Map,this.fillColor=i?.fillColor||[0,200,255,.2],this.lineColor=i?.lineColor||[0,200,255,1],this.lineWidth=i?.lineWidth||2,this.textColor=i?.textColor||[255,200,0,1],this.textSize=i?.textSize||12,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POLYGON_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:"Polygon"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates()[0],o=r.map(f=>{const[g,p]=U(f);return{longitude:g,latitude:p}}).slice(0,-1),a=Vt("PolygonCoordinatePick_"),l=Date.now();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={id:a,points:o,timestamp:l,name:`${this.t?.polygonPick.default_name||"Polygon Pick"} ${new Date(l).toLocaleTimeString()}`};this.polygons.set(a,d),this.features.set(a,i),i.setStyle(new A({fill:new j({color:M(this.fillColor)}),stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})})),i.set("id",a),i.set("type","polygon_pick");const u=new V({geometry:new rt([h,c]),id:a});u.set("type","polygon_pick"),u.setStyle(new A({text:new te({text:`${this.t?.polygonPick.label_prefix||"Polygon"} ${this.polygons.size}`,font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"middle"})})),this.labelFeatures.set(a,u),this.source?.addFeature(u),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}removePolygon(t){const e=this.features.get(t),i=this.labelFeatures.get(t);return e&&(this.source?.removeFeature(e),this.features.delete(t)),i&&(this.source?.removeFeature(i),this.labelFeatures.delete(t)),this.polygons.delete(t),!0}clearAllPolygons(){this.clear(),this.features.clear(),this.labelFeatures.clear(),this.polygons.clear(),this.stopPick()}getAllPolygons(){return Array.from(this.polygons.values())}getPolygon(t){return this.polygons.get(t)}highlightPolygon(t){this.features.forEach((e,i)=>{const n=i===t;e.setStyle(new A({fill:new j({color:M(n?[255,170,0,.3]:this.fillColor)}),stroke:new G({color:M(n?[255,170,0,1]:this.lineColor),width:this.lineWidth+(n?2:0),lineDash:n?[]:[10,10]})}))}),this.labelFeatures.forEach((e,i)=>{const n=i===t;e.setStyle(new A({text:new te({text:n?this.t?.polygonPick.highlight_text||"● Polygon Pick ●":`${this.t?.polygonPick.label_prefix||"Polygon"} ${this.polygons.size}`,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:"middle"})}))}),this.mapView?.render()}clearHighlight(){this.features.forEach(t=>{t.setStyle(new A({fill:new j({color:M(this.fillColor)}),stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})}))}),this.labelFeatures.forEach(t=>{t.setStyle(new A({text:new te({text:`${this.t?.polygonPick.label_prefix||"Polygon"} ${this.polygons.size}`,font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"middle"})}))}),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()}}class j_{constructor(t,e){this.id="image-draw",this.name="Image Annotation",this.icon="🖼️",this.imageDrawLayer=t,this.name=e.drawImage||"Image Annotation"}activate(){this.imageDrawLayer.setEditable(!0)}deactivate(){this.imageDrawLayer.stopDraw(),this.imageDrawLayer.stopEdit()}isActive(){return this.imageDrawLayer.isDrawActive()||this.imageDrawLayer.isEditActive()}startDraw(){this.imageDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.imageDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}editProperties(t,e,i){this.imageDrawLayer.editProperties(t,e,i)}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getImageLayer(){return this.imageDrawLayer}destroy(){this.imageDrawLayer.destroy()}}class Y_{constructor(t,e){this.options=t,this.currentImageUrl=t.initialImageUrl||"",this.currentImageData=t.initialImageData,this.containerEl=t.container||document.body,this.overlay=this.createOverlay(),this.element=this.createElement(),this.containerEl.appendChild(this.overlay),this.containerEl.appendChild(this.element),e?this.setPosition(e):this.centerModal(),this.urlInput=this.element.querySelector(".image-input-modal-url"),this.widthInput=this.element.querySelector(".image-input-modal-width"),this.heightInput=this.element.querySelector(".image-input-modal-height"),this.opacityInput=this.element.querySelector(".image-input-modal-opacity"),this.opacityValue=this.element.querySelector(".image-input-modal-opacity-value"),this.imagePreview=this.element.querySelector(".image-input-modal-preview"),this.previewImg=this.element.querySelector(".image-input-modal-preview-img"),this.uploadBtn=this.element.querySelector(".image-input-modal-upload"),this.fileInput=this.element.querySelector(".image-input-modal-file-input"),this.confirmBtn=this.element.querySelector(".image-input-modal-confirm"),this.cancelBtn=this.element.querySelector(".image-input-modal-cancel"),this.deleteBtn=this.element.querySelector(".image-input-modal-delete"),this.bindEvents(),this.updatePreview()}createOverlay(){const t=document.createElement("div");return t.className="image-input-modal-overlay",t.style.cssText=`
|
|
1780
|
+
`);this.generateTileUrlFunction_?this.setTileUrlFunction(S_(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class D_ extends Tl{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:k_,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.referrerPolicy=t.referrerPolicy,this.tileClass=t.tileClass!==void 0?t.tileClass:pd,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){return this.getProjection()&&t&&!os(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||os(e,t)))return this.tileGrid;const i=K(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Bd(t)),this.tileGridForProjection[i]}createTile_(t,e,i,n,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,n,r):void 0,c=new this.tileClass(a,h!==void 0?X.IDLE:X.EMPTY,h!==void 0?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(nt.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r,o){const a=this.getProjection();if(!a||!r||os(a,r))return this.getTileInternal(t,e,i,n,a||r);const l=[t,e,i],h=this.getKey(),c=this.getTileGridForProjection(a),d=this.getTileGridForProjection(r),u=this.getTileCoordForTileUrlFunction(l,r),f=new md(a,c,r,d,l,u,this.getTilePixelRatio(n),this.getGutter(),(g,p,m,y)=>this.getTileInternal(g,p,m,y,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=h,f}getTileInternal(t,e,i,n,r,o){const a=this.getKey(),l=dr(this,a,t,e,i);if(o&&o.containsKey(l))return o.get(l);const h=this.createTile_(t,e,i,n,r,a);return o?.set(l,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Ft(t);if(i){const n=K(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}}}function k_(s,t){if(Ee){const e=s.getCrossOrigin();let i="same-origin",n="same-origin";e==="anonymous"||e===""?(i="cors",n="omit"):e==="use-credentials"&&(i="cors",n="include");const r={mode:i,credentials:n,referrerPolicy:s.getReferrerPolicy()};fetch(t,r).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.blob()}).then(o=>createImageBitmap(o)).then(o=>{const a=s.getImage();a.width=o.width,a.height=o.height,a.getContext("2d").drawImage(o,0,0),o.close?.(),a.dispatchEvent(new Event("load"))}).catch(()=>{s.getImage().dispatchEvent(new Event("error"))});return}s.getImage().src=t}class ns extends D_{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:y_({extent:vl(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const R_='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class A_ extends ns{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[R_];const i=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin!==void 0?t.crossOrigin:"anonymous",referrerPolicy:t.referrerPolicy||"origin-when-cross-origin",interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:i,wrapX:t.wrapX,zDirection:t.zDirection})}}const Mt=Math.PI,Mr=6378245,Fr=.006693421622965943;function bl(s,t){return s<72.004||s>137.8347||t<.8293||t>55.8271}function Ud(s,t){let e=-100+2*s+3*t+.2*t*t+.1*s*t+.2*Math.sqrt(Math.abs(s));return e+=(20*Math.sin(6*s*Mt)+20*Math.sin(2*s*Mt))*(2/3),e+=(20*Math.sin(t*Mt)+40*Math.sin(t/3*Mt))*(2/3),e+=(160*Math.sin(t/12*Mt)+320*Math.sin(t*Mt/30))*(2/3),e}function Vd(s,t){let e=300+s+2*t+.1*s*s+.1*s*t+.1*Math.sqrt(Math.abs(s));return e+=(20*Math.sin(6*s*Mt)+20*Math.sin(2*s*Mt))*(2/3),e+=(20*Math.sin(s*Mt)+40*Math.sin(s/3*Mt))*(2/3),e+=(150*Math.sin(s/12*Mt)+300*Math.sin(s*Mt/30))*(2/3),e}function Sl(s,t){if(bl(s,t))return[s,t];let e=Ud(s-105,t-35),i=Vd(s-105,t-35);const n=t/180*Mt;let r=Math.sin(n);r=1-Fr*r*r;const o=Math.sqrt(r);return e=e*180/(Mr*(1-Fr)/(r*o)*Mt),i=i*180/(Mr/o*Math.cos(n)*Mt),[s-i,t-e]}function Nh(s,t){if(bl(s,t))return[s,t];let e=Ud(s-105,t-35),i=Vd(s-105,t-35);const n=t/180*Mt;let r=Math.sin(n);r=1-Fr*r*r;const o=Math.sqrt(r);return e=e*180/(Mr*(1-Fr)/(r*o)*Mt),i=i*180/(Mr/o*Math.cos(n)*Mt),[s+i,t+e]}function M_(s,t){const e=s,i=t,n=Math.sqrt(e*e+i*i)+2e-5*Math.sin(i*Mt),r=Math.atan2(i,e)+3e-6*Math.cos(e*Mt),o=n*Math.cos(r)+.0065,a=n*Math.sin(r)+.006;return[o,a]}function F_(s,t){const e=s-.0065,i=t-.006,n=Math.sqrt(e*e+i*i)-2e-5*Math.sin(i*Mt),r=Math.atan2(i,e)-3e-6*Math.cos(e*Mt),o=n*Math.cos(r),a=n*Math.sin(r);return[o,a]}function Hd(s,t){const[e,i]=F_(s,t);return Sl(e,i)}function _a(s,t,e){switch(e){case Oe.WGS84:return[s,t];case Oe.GCJ02:return Sl(s,t);case Oe.BD09:return Hd(s,t);default:return[s,t]}}function O_(s,t,e){switch(e){case Oe.WGS84:return[s,t];case Oe.GCJ02:return Nh(s,t);case Oe.BD09:return M_(...Nh(s,t));default:return[s,t]}}function z_(s,t){return!bl(s,t)}const Vo={[dt.SATELLITE]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.STREETS]:{url:"https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"OpenStreetMap"},[dt.TOPO]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.OCEANS]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.GRAY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.DARK_GRAY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.NATIONAL_GEOGRAPHIC]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.TERRAIN]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.HYBRID]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.LIGHT_GRAY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.IMAGERY]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.PHYSICAL]:{url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Physical_Map/MapServer/tile/{z}/{y}/{x}",attribution:"Esri"},[dt.AMAP_STREETS]:{url:"https://webrd01.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}",attribution:"高德地图"},[dt.AMAP_SATELLITE]:{url:"https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",attribution:"高德地图"},[dt.GOOGLE_STREETS]:{url:"http://www.google.cn/maps/vt?lyrs=m&x={x}&y={y}&z={z}",attribution:"Google"},[dt.GOOGLE_SATELLITE]:{url:"http://www.google.cn/maps/vt?lyrs=s&x={x}&y={y}&z={z}",attribution:"Google"}};class $_{constructor(t,e,i,n,r,o){getComputedStyle(t).position==="static"&&(t.style.position="relative");let a=i;r!==Oe.WGS84&&(a=_a(i[0],i[1],r)),e===dt.CUSTOMIZE&&o?(this.basemapLayer=this.createBasemapLayerFromUrl(o),this.currentBasemap=null):(this.basemapLayer=this.createBasemapLayer(e),this.currentBasemap=e),this.view=new He({center:ut(a),zoom:n,minZoom:1,maxZoom:19}),this.map=new dd({target:t,layers:[this.basemapLayer],view:this.view,controls:[],interactions:ld({doubleClickZoom:!1})})}createBasemapLayerFromUrl(t){const e=new ns({url:t});return new jn({source:e})}createBasemapLayer(t){const e=Vo[t];if(t===dt.STREETS){const n=new A_;return new jn({source:n})}if(e){const n=new ns({url:e.url,attributions:e.attribution});return new jn({source:n})}const i=new ns({url:Vo[dt.SATELLITE]?.url,attributions:Vo[dt.SATELLITE]?.attribution});return new jn({source:i})}setBasemapByUrl(t){const e=new ns({url:t}),i=new jn({source:e});this.map.removeLayer(this.basemapLayer),this.basemapLayer=i,this.map.addLayer(this.basemapLayer),this.currentBasemap=null}setBasemap(t){this.map.removeLayer(this.basemapLayer),this.basemapLayer=this.createBasemapLayer(t),this.map.addLayer(this.basemapLayer),this.currentBasemap=t}getCurrentBasemap(){return this.currentBasemap}getMap(){return this.map}getView(){return this.view}getCenter(){const t=U(this.view.getCenter()||[0,0]);return[t[0],t[1]]}getZoom(){return this.view.getZoom()||0}setCenter(t,e){let i=t;e&&e!==Oe.WGS84&&(i=_a(t[0],t[1],e)),this.view.setCenter(ut(i))}setZoom(t){this.view.setZoom(t)}setRotation(t){this.view.setRotation(t)}destroy(){this.map.setTarget(void 0),this.map.dispose()}}class N_{constructor(t,e){this.id="line-draw",this.name="Line",this.icon="━━",this.lineDrawLayer=t,this.name=e.drawLine||"Line"}activate(){this.lineDrawLayer.setEditable(!0)}deactivate(){this.lineDrawLayer.stopDraw(),this.lineDrawLayer.stopEdit()}isActive(){return this.lineDrawLayer.isDrawActive()||this.lineDrawLayer.isEditActive()}startDraw(){this.lineDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.lineDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getLineLayer(){return this.lineDrawLayer}destroy(){this.lineDrawLayer.destroy()}}class G_{constructor(t,e){this.id="bezier-draw",this.name="Bezier Curve",this.icon="〰️",this.bezierDrawLayer=t,this.name=e.drawBezier||"Bezier Curve"}activate(){this.bezierDrawLayer.setEditable(!0)}deactivate(){this.bezierDrawLayer.stopDraw(),this.bezierDrawLayer.stopEdit()}isActive(){return this.bezierDrawLayer.isDrawActive()||this.bezierDrawLayer.isEditActive()}startDraw(){this.bezierDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.bezierDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getBezierLayer(){return this.bezierDrawLayer}destroy(){this.bezierDrawLayer.destroy()}}class B_{constructor(t,e){this.id="sector-draw",this.name="Sector",this.icon="🥧",this.sectorDrawLayer=t,this.name=e.drawSector||"Sector"}activate(){this.sectorDrawLayer.setEditable(!0)}deactivate(){this.sectorDrawLayer.stopDraw(),this.sectorDrawLayer.stopEdit()}isActive(){return this.sectorDrawLayer.isDrawActive()||this.sectorDrawLayer.isEditActive()}startDraw(){this.sectorDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.sectorDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getSectorLayer(){return this.sectorDrawLayer}destroy(){this.sectorDrawLayer.destroy()}}var ct=(s=>(s.CIRCLE="circle-draw",s.RECTANGLE="rectangle-draw",s.TRIANGLE="triangle-draw",s.FREEHAND="freehand-draw",s.FREEHAND_POLYGON="freehand-polygon-draw",s.ELLIPSE="ellipse-draw",s.SECTOR="sector-draw",s.MARKER="marker-draw",s.TEXT="text-draw",s.ARROW="arrow-draw",s.BEZIER="bezier-draw",s.LINE="line-draw",s.IMAGE="image",s))(ct||{});class W_{constructor(t,e,i,n,r,o){this.toolbar=null,this.scaleBar=null,this.loadingOverlay=null,this.activePopupPanel=null,this.activePopupType=null,this.basemapOptionsInstance=null,this.layersPanelInstance=null,this.coordinatePickingDataPanel=null,this.container=t,this.theme=e,this.t=i,this.callbacks=n,this.getLayerListFn=r,this.getCurrentBasemapFn=o,this.currentBasemap=o()||dt.SATELLITE,this.init()}init(){this.toolbar=new i_({container:this.container,t:this.t,theme:this.theme,activePopup:this.activePopupType,onTogglePopup:this.handleTogglePopup.bind(this),onZoomIn:()=>this.callbacks.onZoomIn(),onZoomOut:()=>this.callbacks.onZoomOut(),onLocate:()=>this.callbacks.onLocate(),onShowCoordinatePickingDataPanel:()=>this.showCoordinatePickingDataPanel()}),this.scaleBar=new l_(this.container,this.theme),this.loadingOverlay=new h_(this.container,this.theme)}getBasemapOptions(){return[{value:dt.SATELLITE,label:this.t.satellite,icon:"🛰️"},{value:dt.STREETS,label:this.t.streets,icon:"🗺️"},{value:dt.TOPO,label:this.t.topographic,icon:"⛰️"},{value:dt.HYBRID,label:this.t.hybrid,icon:"🔄"},{value:dt.TERRAIN,label:this.t.terrain,icon:"🗻"},{value:dt.OCEANS,label:this.t.oceans,icon:"🌊"},{value:dt.DARK_GRAY,label:this.t.darkGray,icon:"🌙"},{value:dt.LIGHT_GRAY,label:this.t.lightGray,icon:"☀️"},{value:dt.NATIONAL_GEOGRAPHIC,label:this.t.nationalGeographic,icon:"📰"},{value:dt.IMAGERY,label:this.t.imagery,icon:"📷"},{value:dt.PHYSICAL,label:this.t.physical,icon:"🌎"},{value:dt.AMAP_STREETS,label:this.t.amapStreets,icon:"🗺️"},{value:dt.AMAP_SATELLITE,label:this.t.amapSatellite,icon:"🛰️"},{value:dt.GOOGLE_STREETS,label:this.t.googleStreets,icon:"🗺️"},{value:dt.GOOGLE_SATELLITE,label:this.t.googleSatellite,icon:"🛰️"}]}handleTogglePopup(t){if(this.coordinatePickingDataPanel&&(this.coordinatePickingDataPanel.destroy(),this.coordinatePickingDataPanel=null),this.activePopupPanel&&(this.activePopupPanel.destroy(),this.activePopupPanel=null),this.activePopupType=t,this.toolbar?.updateActivePopup(t),t===null)return;let e;switch(t){case"layers":e=new lr({title:this.t.layers,theme:this.theme,t:this.t,onClose:()=>{this.layersPanelInstance=null,this.handleTogglePopup(null)}}),this.layersPanelInstance=new n_({layerList:this.getLayerListFn(),onToggleVisibility:r=>this.callbacks.onToggleLayerVisibility(r),onRemoveLayer:r=>this.callbacks.onRemoveLayer(r),onGetLayerFeatures:r=>this.callbacks.onGetLayerFeatures?this.callbacks.onGetLayerFeatures(r):[],onLocateFeature:(r,o)=>{this.callbacks.onLocateFeature&&this.callbacks.onLocateFeature(r,o)},onCopyFeatureCoordinates:(r,o)=>{this.callbacks.onCopyFeatureCoordinates&&this.callbacks.onCopyFeatureCoordinates(r,o)},theme:this.theme,t:this.t}),e.appendChild(this.layersPanelInstance.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break;case"basemap":e=new lr({title:this.t.basemap,theme:this.theme,t:this.t,onClose:()=>{this.basemapOptionsInstance=null,this.handleTogglePopup(null)}}),this.basemapOptionsInstance=new s_({currentBasemap:this.currentBasemap,onSelect:r=>{this.callbacks.onSetBasemap(r)},theme:this.theme,t:this.t,options:this.getBasemapOptions()}),e.appendChild(this.basemapOptionsInstance.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break;case"draw":e=new lr({title:this.t.drawTools,theme:this.theme,t:this.t,onClose:()=>this.handleTogglePopup(null)});const i=new r_({onDrawCircle:()=>this.callbacks.onDrawCircle(),onDrawRectangle:()=>this.callbacks.onDrawRectangle(),onDrawTriangle:()=>this.callbacks.onDrawTriangle(),onDrawFreehand:()=>this.callbacks.onDrawFreehand(),onDrawFreehandPolygon:()=>this.callbacks.onDrawFreehandPolygon(),onDrawEllipse:()=>this.callbacks.onDrawEllipse(),onDrawMarker:()=>this.callbacks.onDrawMarker(),onDrawText:()=>this.callbacks.onDrawText(),onDrawArrow:()=>this.callbacks.onDrawArrow(),onDrawLine:()=>this.callbacks.onDrawLine(),onDrawBezier:()=>this.callbacks.onDrawBezier(),onDrawSector:()=>this.callbacks.onDrawSector(),onDrawImage:this.callbacks.onDrawImage,onEditShape:()=>this.callbacks.onEditShape(),theme:this.theme,t:this.t});e.appendChild(i.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break;case"tools":e=new lr({title:this.t.tools,theme:this.theme,t:this.t,onClose:()=>{this.handleTogglePopup(null)}});const n=new o_({onDistanceMeasure:()=>this.callbacks.onDistanceMeasure(),onAreaMeasure:()=>this.callbacks.onAreaMeasure(),onClearMeasurements:()=>this.callbacks.onClearMeasurements(),onPointCoordinatePick:()=>this.callbacks.onPointCoordinatePick(),onLineCoordinatePick:()=>this.callbacks.onLineCoordinatePick(),onPolygonCoordinatePick:()=>this.callbacks.onPolygonCoordinatePick(),onShowCoordinateList:()=>this.callbacks.onShowCoordinateList(),isMeasuring:!1,currentMeasureType:null,currentPickType:null,measurePreview:null,theme:this.theme,t:this.t});e.appendChild(n.getElement()),this.activePopupPanel=e,this.container.appendChild(e.getElement()),e.onAttached(),this.adjustPopupPosition(e);break}}adjustPopupPosition(t){setTimeout(()=>{const e=t.getElement();if(!e)return;const i=this.container.getBoundingClientRect(),n=e.getBoundingClientRect(),r=n.bottom,o=i.bottom;if(r>o){const a=o-n.top-10;a>100?e.style.maxHeight=`${a}px`:e.style.maxHeight="100px"}},10)}updateCurrentBasemap(t){t!==null&&(this.currentBasemap=t,this.basemapOptionsInstance&&this.basemapOptionsInstance.updateCurrentBasemap(t))}refreshBasemapOptions(){this.basemapOptionsInstance&&this.activePopupType==="basemap"&&this.basemapOptionsInstance.updateProps({options:this.getBasemapOptions(),t:this.t,theme:this.theme,currentBasemap:this.currentBasemap})}updateLayerList(){this.activePopupType==="layers"&&this.layersPanelInstance&&this.layersPanelInstance.updateData(this.getLayerListFn())}showLoading(t){this.loadingOverlay?.show(t)}hideLoading(){this.loadingOverlay?.hide()}updateScale(t){this.scaleBar?.updateScale(t)}updateTheme(t){if(this.theme=t,this.toolbar?.updateTheme(t),this.scaleBar?.updateTheme(t),this.basemapOptionsInstance&&this.basemapOptionsInstance.updateTheme(t),this.layersPanelInstance&&this.layersPanelInstance.updateTheme(t),this.activePopupType){const e=this.activePopupType;this.handleTogglePopup(null),this.handleTogglePopup(e)}}updateLocale(t){this.t=t,this.toolbar?.destroy(),this.activePopupPanel&&(this.activePopupPanel.destroy(),this.activePopupPanel=null),this.init(),this.refreshBasemapOptions(),this.activePopupType&&this.handleTogglePopup(this.activePopupType)}showCoordinatePickingDataPanel(){if(this.coordinatePickingDataPanel){this.coordinatePickingDataPanel.destroy(),this.coordinatePickingDataPanel=null;return}this.activePopupPanel&&(this.activePopupPanel.destroy(),this.activePopupPanel=null),this.activePopupType=null,this.toolbar?.updateActivePopup(null);const t=new c_({onClose:()=>{this.coordinatePickingDataPanel&&(this.coordinatePickingDataPanel.destroy(),this.coordinatePickingDataPanel=null)},onSelectCategory:e=>{},onLocatePoint:(e,i)=>{this.callbacks.onLocateCoordinate&&this.callbacks.onLocateCoordinate(e,i)},onLocateLine:e=>{this.callbacks.onLocateLine&&this.callbacks.onLocateLine(e)},onLocatePolygon:e=>{this.callbacks.onLocatePolygon&&this.callbacks.onLocatePolygon(e)},getPointData:()=>this.callbacks.getPointData?this.callbacks.getPointData():[],getLineData:()=>this.callbacks.getLineData?this.callbacks.getLineData():[],getPolygonData:()=>this.callbacks.getPolygonData?this.callbacks.getPolygonData():[],theme:this.theme,t:this.t});this.container.appendChild(t.getElement()),this.coordinatePickingDataPanel=t}destroy(){this.toolbar?.destroy(),this.scaleBar?.destroy(),this.loadingOverlay?.destroy(),this.activePopupPanel&&this.activePopupPanel.destroy(),this.coordinatePickingDataPanel&&this.coordinatePickingDataPanel.destroy(),this.basemapOptionsInstance=null,this.layersPanelInstance=null}getContainer(){return this.container}}class U_{constructor(){this.activeToolType=null,this.circleTool=null,this.rectangleTool=null,this.triangleTool=null,this.freehandTool=null,this.ellipseTool=null,this.markerTool=null,this.textTool=null,this.arrowTool=null,this.imageTool=null,this.lineTool=null,this.bezierTool=null,this.sectorTool=null}registerTools(t,e,i,n,r,o,a,l,h,c,d,u){this.circleTool=t,this.rectangleTool=e,this.triangleTool=i,this.freehandTool=n,this.ellipseTool=r,this.markerTool=o,this.textTool=a,this.arrowTool=l,this.lineTool=h,this.bezierTool=c,this.sectorTool=d,this.imageTool=u,this.circleTool?.setOnDrawComplete(()=>this.endDrawing()),this.rectangleTool?.setOnDrawComplete(()=>this.endDrawing()),this.triangleTool?.setOnDrawComplete(()=>this.endDrawing()),this.freehandTool?.setOnDrawComplete(()=>this.endDrawing()),this.ellipseTool?.setOnDrawComplete(()=>this.endDrawing()),this.markerTool?.setOnDrawComplete(()=>this.endDrawing()),this.textTool?.setOnDrawComplete(()=>this.endDrawing()),this.arrowTool?.setOnDrawComplete(()=>this.endDrawing()),this.imageTool?.setOnDrawComplete(()=>this.endDrawing()),this.circleTool?.setOnEditComplete(()=>this.endDrawing()),this.rectangleTool?.setOnEditComplete(()=>this.endDrawing()),this.triangleTool?.setOnEditComplete(()=>this.endDrawing()),this.freehandTool?.setOnEditComplete(()=>this.endDrawing()),this.ellipseTool?.setOnEditComplete(()=>this.endDrawing()),this.markerTool?.setOnEditComplete(()=>this.endDrawing()),this.textTool?.setOnEditComplete(()=>this.endDrawing()),this.arrowTool?.setOnEditComplete(()=>this.endDrawing()),this.imageTool?.setOnEditComplete(()=>this.endDrawing()),this.lineTool?.setOnDrawComplete(()=>this.endDrawing()),this.bezierTool?.setOnDrawComplete(()=>this.endDrawing()),this.sectorTool?.setOnDrawComplete(()=>this.endDrawing()),this.lineTool?.setOnEditComplete(()=>this.endDrawing()),this.bezierTool?.setOnEditComplete(()=>this.endDrawing()),this.sectorTool?.setOnEditComplete(()=>this.endDrawing())}startDrawingLine(){this.deactivateAll(),this.activeToolType=ct.LINE,this.lineTool?.startDraw(),this.onDrawingStartCallback?.(ct.LINE)}startDrawingBezier(){this.deactivateAll(),this.activeToolType=ct.BEZIER,this.bezierTool?.startDraw(),this.onDrawingStartCallback?.(ct.BEZIER)}startDrawingSector(){this.deactivateAll(),this.activeToolType=ct.SECTOR,this.sectorTool?.startDraw(),this.onDrawingStartCallback?.(ct.SECTOR)}setCallbacks(t,e){this.onDrawingStartCallback=t,this.onDrawingEndCallback=e}startDrawingCircle(){this.deactivateAll(),this.activeToolType=ct.CIRCLE,this.circleTool?.startDraw(),this.onDrawingStartCallback?.(ct.CIRCLE)}startDrawingRectangle(){this.deactivateAll(),this.activeToolType=ct.RECTANGLE,this.rectangleTool?.startDraw(),this.onDrawingStartCallback?.(ct.RECTANGLE)}startDrawingTriangle(){this.deactivateAll(),this.activeToolType=ct.TRIANGLE,this.triangleTool?.startDraw(),this.onDrawingStartCallback?.(ct.TRIANGLE)}startDrawingFreehand(){this.deactivateAll(),this.activeToolType=ct.FREEHAND,this.freehandTool?.startDraw(!1),this.onDrawingStartCallback?.(ct.FREEHAND)}startDrawingFreehandPolygon(){this.deactivateAll(),this.activeToolType=ct.FREEHAND_POLYGON,this.freehandTool?.startDraw(!0),this.onDrawingStartCallback?.(ct.FREEHAND_POLYGON)}startDrawingEllipse(){this.deactivateAll(),this.activeToolType=ct.ELLIPSE,this.ellipseTool?.startDraw(),this.onDrawingStartCallback?.(ct.ELLIPSE)}startDrawingMarker(){this.deactivateAll(),this.activeToolType=ct.MARKER,this.markerTool?.startDraw(),this.onDrawingStartCallback?.(ct.MARKER)}startDrawingText(){this.deactivateAll(),this.activeToolType=ct.TEXT,this.textTool?.startDraw(),this.onDrawingStartCallback?.(ct.TEXT)}startDrawingArrow(){this.deactivateAll(),this.activeToolType=ct.ARROW,this.arrowTool?.startDraw(),this.onDrawingStartCallback?.(ct.ARROW)}startDrawingImage(){this.deactivateAll(),this.activeToolType=ct.IMAGE,this.imageTool?.startDraw(),this.onDrawingStartCallback?.(ct.IMAGE)}cancelDrawing(){this.deactivateAll()}deactivateAll(){const t=this.activeToolType!==null;this.circleTool?.deactivate(),this.rectangleTool?.deactivate(),this.triangleTool?.deactivate(),this.freehandTool?.deactivate(),this.ellipseTool?.deactivate(),this.markerTool?.deactivate(),this.textTool?.deactivate(),this.arrowTool?.deactivate(),this.imageTool?.deactivate(),this.lineTool?.deactivate(),this.bezierTool?.deactivate(),this.sectorTool?.deactivate(),this.activeToolType=null,t&&this.onDrawingEndCallback?.()}endDrawing(){this.activeToolType!==null&&(this.activeToolType=null,this.onDrawingEndCallback?.())}getActiveTool(){return this.activeToolType}isDrawing(){return this.activeToolType!==null}destroy(){this.deactivateAll(),this.circleTool=null,this.rectangleTool=null,this.triangleTool=null,this.freehandTool=null,this.ellipseTool=null,this.markerTool=null,this.textTool=null,this.arrowTool=null,this.imageTool=null,this.lineTool=null,this.bezierTool=null,this.sectorTool=null}}class V_{constructor(){this.drawingManager=null,this.mapView=null,this.keydownHandler=null,this.container=null}setDrawingManager(t){this.drawingManager=t}setMapView(t){this.mapView=t}bindEvents(t){t&&(this.container=t),this.keydownHandler&&(this.container?this.container.removeEventListener("keydown",this.keydownHandler):document.removeEventListener("keydown",this.keydownHandler)),this.keydownHandler=e=>{e.key==="Escape"&&this.handleEscCancel()},this.container?this.container.addEventListener("keydown",this.keydownHandler):document.addEventListener("keydown",this.keydownHandler)}handleEscCancel(){this.drawingManager?.isDrawing()&&this.drawingManager.cancelDrawing()}unbindEvents(){this.keydownHandler&&(this.container?this.container.removeEventListener("keydown",this.keydownHandler):document.removeEventListener("keydown",this.keydownHandler),this.keydownHandler=null)}destroy(){this.unbindEvents(),this.drawingManager=null,this.mapView=null,this.container=null}}class H_ extends It{constructor(t,e,i){super(t,e,Z.LINE_COORDINATE_PICK,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.lines=new Map,this.onCompleteCallback=null,this.mapView=null,this.features=new Map,this.labelFeatures=new Map,this.lineColor=i?.lineColor||[0,200,255,1],this.lineWidth=i?.lineWidth||3,this.textColor=i?.textColor||[255,200,0,1],this.textSize=i?.textSize||12,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.LINE_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:"LineString"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates(),o=r.map(f=>{const[g,p]=U(f);return{longitude:g,latitude:p}}),a=Vt("LineCoordinatePick_"),l=Date.now(),h=Math.floor(o.length/2),c=r[h],d={id:a,points:o,timestamp:l,name:`${this.t?.linePick.default_name||"Line Pick"} ${new Date(l).toLocaleTimeString()}`};this.lines.set(a,d),this.features.set(a,i),i.setStyle(new A({stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})})),i.set("id",a),i.set("type","line_pick");const u=new V({geometry:new rt(c),id:a});u.set("type","line_pick"),u.setStyle(new A({text:new te({text:`${this.t?.linePick.label_prefix||"Line"} ${this.lines.size}`,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.labelFeatures.set(a,u),this.source?.addFeature(u),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}removeLine(t){const e=this.features.get(t),i=this.labelFeatures.get(t);return e&&(this.source?.removeFeature(e),this.features.delete(t)),i&&(this.source?.removeFeature(i),this.labelFeatures.delete(t)),this.lines.delete(t),!0}clearAllLines(){this.clear(),this.features.clear(),this.labelFeatures.clear(),this.lines.clear(),this.stopPick()}getAllLines(){return Array.from(this.lines.values())}getLine(t){return this.lines.get(t)}highlightLine(t){this.features.forEach((e,i)=>{const n=i===t;e.setStyle(new A({stroke:new G({color:M(n?[255,170,0,1]:this.lineColor),width:this.lineWidth+(n?2:0),lineDash:n?[]:[10,10]})}))}),this.labelFeatures.forEach((e,i)=>{const n=i===t;e.setStyle(new A({text:new te({text:n?this.t?.linePick.highlight_text||"● Line Pick ●":`${this.t?.linePick.label_prefix||"Line"} ${this.lines.size}`,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({stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})}))}),this.labelFeatures.forEach(t=>{t.setStyle(new A({text:new te({text:`${this.t?.linePick.label_prefix||"Line"} ${this.lines.size}`,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()}}class X_ extends It{constructor(t,e,i){super(t,e,Z.POLYGON_COORDINATE_PICK,{...i,zIndex:i?.zIndex??50}),this.drawInteraction=null,this.polygons=new Map,this.onCompleteCallback=null,this.mapView=null,this.features=new Map,this.labelFeatures=new Map,this.fillColor=i?.fillColor||[0,200,255,.2],this.lineColor=i?.lineColor||[0,200,255,1],this.lineWidth=i?.lineWidth||2,this.textColor=i?.textColor||[255,200,0,1],this.textSize=i?.textSize||12,this.source=new Y,this.layer=new bt({source:this.source,properties:{id:t,name:e,type:Z.POLYGON_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:"Polygon"}),this.drawInteraction.on("drawend",e=>{const i=e.feature,r=i.getGeometry().getCoordinates()[0],o=r.map(f=>{const[g,p]=U(f);return{longitude:g,latitude:p}}).slice(0,-1),a=Vt("PolygonCoordinatePick_"),l=Date.now();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={id:a,points:o,timestamp:l,name:`${this.t?.polygonPick.default_name||"Polygon Pick"} ${new Date(l).toLocaleTimeString()}`};this.polygons.set(a,d),this.features.set(a,i),i.setStyle(new A({fill:new j({color:M(this.fillColor)}),stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})})),i.set("id",a),i.set("type","polygon_pick");const u=new V({geometry:new rt([h,c]),id:a});u.set("type","polygon_pick"),u.setStyle(new A({text:new te({text:`${this.t?.polygonPick.label_prefix||"Polygon"} ${this.polygons.size}`,font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"middle"})})),this.labelFeatures.set(a,u),this.source?.addFeature(u),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}removePolygon(t){const e=this.features.get(t),i=this.labelFeatures.get(t);return e&&(this.source?.removeFeature(e),this.features.delete(t)),i&&(this.source?.removeFeature(i),this.labelFeatures.delete(t)),this.polygons.delete(t),!0}clearAllPolygons(){this.clear(),this.features.clear(),this.labelFeatures.clear(),this.polygons.clear(),this.stopPick()}getAllPolygons(){return Array.from(this.polygons.values())}getPolygon(t){return this.polygons.get(t)}highlightPolygon(t){this.features.forEach((e,i)=>{const n=i===t;e.setStyle(new A({fill:new j({color:M(n?[255,170,0,.3]:this.fillColor)}),stroke:new G({color:M(n?[255,170,0,1]:this.lineColor),width:this.lineWidth+(n?2:0),lineDash:n?[]:[10,10]})}))}),this.labelFeatures.forEach((e,i)=>{const n=i===t;e.setStyle(new A({text:new te({text:n?this.t?.polygonPick.highlight_text||"● Polygon Pick ●":`${this.t?.polygonPick.label_prefix||"Polygon"} ${this.polygons.size}`,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:"middle"})}))}),this.mapView?.render()}clearHighlight(){this.features.forEach(t=>{t.setStyle(new A({fill:new j({color:M(this.fillColor)}),stroke:new G({color:M(this.lineColor),width:this.lineWidth,lineDash:[10,10]})}))}),this.labelFeatures.forEach(t=>{t.setStyle(new A({text:new te({text:`${this.t?.polygonPick.label_prefix||"Polygon"} ${this.polygons.size}`,font:`${this.textSize}px sans-serif`,fill:new j({color:M(this.textColor)}),stroke:new G({color:"#000000",width:2}),textAlign:"center",textBaseline:"middle"})}))}),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()}}class j_{constructor(t,e){this.id="image-draw",this.name="Image Annotation",this.icon="🖼️",this.imageDrawLayer=t,this.name=e.drawImage||"Image Annotation"}activate(){this.imageDrawLayer.setEditable(!0)}deactivate(){this.imageDrawLayer.stopDraw(),this.imageDrawLayer.stopEdit()}isActive(){return this.imageDrawLayer.isDrawActive()||this.imageDrawLayer.isEditActive()}startDraw(){this.imageDrawLayer.startDraw(t=>{this.onDrawComplete&&this.onDrawComplete(t)})}startEdit(t){this.imageDrawLayer.startEdit(t,e=>{this.onEditComplete&&this.onEditComplete(e)})}editProperties(t,e,i){this.imageDrawLayer.editProperties(t,e,i)}setOnDrawComplete(t){this.onDrawComplete=t}setOnEditComplete(t){this.onEditComplete=t}getImageLayer(){return this.imageDrawLayer}destroy(){this.imageDrawLayer.destroy()}}class Y_{constructor(t,e){this.options=t,this.currentImageUrl=t.initialImageUrl||"",this.currentImageData=t.initialImageData,this.containerEl=t.container||document.body,this.overlay=this.createOverlay(),this.element=this.createElement(),this.containerEl.appendChild(this.overlay),this.containerEl.appendChild(this.element),e?this.setPosition(e):this.centerModal(),this.urlInput=this.element.querySelector(".image-input-modal-url"),this.widthInput=this.element.querySelector(".image-input-modal-width"),this.heightInput=this.element.querySelector(".image-input-modal-height"),this.opacityInput=this.element.querySelector(".image-input-modal-opacity"),this.opacityValue=this.element.querySelector(".image-input-modal-opacity-value"),this.imagePreview=this.element.querySelector(".image-input-modal-preview"),this.previewImg=this.element.querySelector(".image-input-modal-preview-img"),this.uploadBtn=this.element.querySelector(".image-input-modal-upload"),this.fileInput=this.element.querySelector(".image-input-modal-file-input"),this.confirmBtn=this.element.querySelector(".image-input-modal-confirm"),this.cancelBtn=this.element.querySelector(".image-input-modal-cancel"),this.deleteBtn=this.element.querySelector(".image-input-modal-delete"),this.bindEvents(),this.updatePreview()}createOverlay(){const t=document.createElement("div");return t.className="image-input-modal-overlay",t.style.cssText=`
|
|
1774
1781
|
position: fixed;
|
|
1775
1782
|
top: 0;
|
|
1776
1783
|
left: 0;
|
|
@@ -1778,7 +1785,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1778
1785
|
bottom: 0;
|
|
1779
1786
|
background: transparent;
|
|
1780
1787
|
z-index: 10000;
|
|
1781
|
-
`,t.onclick=e=>{e.stopPropagation(),this.options.onCancel(),this.destroy()},t}createElement(){const t=this.options.theme==="dark",e=document.createElement("div");e.className="image-input-modal-container",e.style.cssText=`
|
|
1788
|
+
`,t.onclick=e=>{e.stopPropagation(),this.options.onCancel(),this.destroy()},t}createElement(){const t=this.options.theme==="dark",e=document.createElement("div");e.className="image-input-modal-container",e.style.userSelect="none",e.style.cssText=`
|
|
1782
1789
|
position: fixed;
|
|
1783
1790
|
z-index: 10001;
|
|
1784
1791
|
width: 300px;
|
|
@@ -1916,7 +1923,7 @@ ${this.fragmentDiscardExpression_?` if (${this.fragmentDiscardExpression_}) { d
|
|
|
1916
1923
|
color: ${e?"#ccc":"#666"};
|
|
1917
1924
|
border: 1px solid ${e?"#555":"#ddd"};
|
|
1918
1925
|
`}
|
|
1919
|
-
`,n?(r.onmouseenter=()=>{r.style.background="#d32f2f"},r.onmouseleave=()=>{r.style.background="#f44336"}):i?(r.onmouseenter=()=>{r.style.background="#0088cc"},r.onmouseleave=()=>{r.style.background="#00aaff"}):(r.onmouseenter=()=>{r.style.background=e?"#4a4a4a":"#e0e0e0"},r.onmouseleave=()=>{r.style.background=e?"#3d3d3d":"#e8e8e8"}),r}updatePreview(){if(!this.imagePreview||!this.previewImg||!this.urlInput){console.warn("updatePreview: required elements not ready");return}const t=this.urlInput.value||this.currentImageUrl,e=this.imagePreview.querySelector("#no-image-text");t&&t.trim()?(this.previewImg.src=t,this.previewImg.style.display="block",e&&(e.style.display="none"),this.previewImg.onload=()=>{this.widthInput&&(!this.options.initialWidth||this.options.initialWidth===32)&&(this.widthInput.value=Math.min(this.previewImg.naturalWidth,200).toString()),this.heightInput&&(!this.options.initialHeight||this.options.initialHeight===32)&&(this.heightInput.value=Math.min(this.previewImg.naturalHeight,200).toString())},this.previewImg.onerror=()=>{this.previewImg.style.display="none",e&&(e.style.display="flex",e.textContent=this.options.t.imageLoadFailed)}):(this.previewImg.style.display="none",e&&(e.style.display="flex",e.textContent=this.options.t.noImage))}uploadImage(t){const e=new FileReader;e.onload=i=>{const n=i.target?.result;this.currentImageData=n,this.currentImageUrl=n,this.urlInput&&(this.urlInput.value=n),this.updatePreview()},e.readAsDataURL(t)}centerModal(){const t=(window.innerWidth-300)/2,e=(window.innerHeight-420)/2;this.element.style.left=`${Math.max(10,t)}px`,this.element.style.top=`${Math.max(10,e)}px`}setPosition(t){let e=t.x-150,i=t.y-200;e=Math.max(10,Math.min(e,window.innerWidth-310)),i=Math.max(10,Math.min(i,window.innerHeight-420)),this.element.style.left=`${e}px`,this.element.style.top=`${i}px`}bindEvents(){if(!this.urlInput||!this.confirmBtn||!this.cancelBtn){console.error("ImageInputModalBox: Required elements not found");return}this.urlInput.addEventListener("input",()=>{this.currentImageUrl=this.urlInput.value,this.currentImageData=void 0,this.updatePreview()}),this.deleteBtn&&this.deleteBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onDelete&&this.options.onDelete(),this.destroy()}),this.confirmBtn.addEventListener("click",t=>{t.stopPropagation();const e=this.urlInput.value.trim();e?this.options.onConfirm({imageUrl:e,imageData:this.currentImageData,width:this.widthInput&&parseInt(this.widthInput.value)||32,height:this.heightInput&&parseInt(this.heightInput.value)||32,opacity:this.opacityInput?parseInt(this.opacityInput.value)/100:1}):this.options.onCancel(),this.destroy()}),this.cancelBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onCancel(),this.destroy()}),this.widthInput&&this.widthInput.addEventListener("input",()=>{this.updatePreviewSize()}),this.heightInput&&this.heightInput.addEventListener("input",()=>{this.updatePreviewSize()}),this.opacityInput&&this.opacityValue&&this.opacityInput.addEventListener("input",()=>{this.opacityValue.textContent=`${this.opacityInput.value}%`,this.updatePreviewOpacity()}),this.element.addEventListener("click",t=>{t.stopPropagation()}),document.addEventListener("keydown",t=>{t.key==="Escape"&&document.body.contains(this.element)&&(this.options.onCancel(),this.destroy())})}updatePreviewSize(){const t=parseInt(this.widthInput.value)||32,e=parseInt(this.heightInput.value)||32;this.previewImg.style.maxWidth=`${Math.min(t,200)}px`,this.previewImg.style.maxHeight=`${Math.min(e,200)}px`}updatePreviewOpacity(){const t=parseInt(this.opacityInput.value)/100;this.previewImg.style.opacity=t.toString()}updateTheme(t){this.options.theme=t;const e=t==="dark";this.element.style.background=e?"#2d2d2d":"#ffffff",this.element.style.borderColor=e?"#444":"#e0e0e0"}destroy(){this.overlay.remove(),this.element.remove()}getElement(){return this.element}}class Z_ extends It{constructor(t,e,i){super(t,e,Z.IMAGE_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.imageInputModal=null,this.isInputActive=!1,this.currentTheme="dark",this.currentTranslations=null,this.defaultWidth=i?.defaultWidth||32,this.defaultHeight=i?.defaultHeight||32,this.defaultOpacity=i?.defaultOpacity||1,this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.IMAGE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("imageUrl")||"",i=t?.get("width")||this.defaultWidth,n=t?.get("height")||this.defaultHeight,r=t?.get("opacity")||this.defaultOpacity,o=t?.get("rotation")||0;return e?new A({image:new Vi({src:e,width:i,height:n,opacity:r,rotation:o,crossOrigin:"anonymous"})}):new A({})}setTheme(t,e){this.currentTheme=t,this.currentTranslations=e}showImageInputModal(t,e,i,n){this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),this.isInputActive=!0;const r=this.mapView;if(!r||typeof r.getTargetElement!="function"){console.error("ImageDrawLayer: mapView is not a valid map object"),this.isInputActive=!1,i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity});return}if(!r.getTargetElement()){console.error("ImageDrawLayer: cannot get map target element"),this.isInputActive=!1,i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity});return}const a=r.getPixelFromCoordinate(t);if(!a||a.length<2){console.error("ImageDrawLayer: cannot get pixel from coordinate",t),this.isInputActive=!1,i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity});return}let l=a[0]-150,h=a[1]-200;l=Math.max(10,Math.min(l,window.innerWidth-310)),h=Math.max(10,Math.min(h,window.innerHeight-400));const c={addImage:"添加图片",enterImageUrl:"请输入图片URL或点击上传...",imageUrl:"图片URL",uploadImage:"上传图片",width:"宽度",height:"高度",opacity:"透明度",confirm:"确定",cancel:"取消",delete:"删除"};this.imageInputModal=new Y_({initialImageUrl:e?.imageUrl||"",initialImageData:e?.imageData,initialWidth:e?.width||this.defaultWidth,initialHeight:e?.height||this.defaultHeight,initialOpacity:e?.opacity||this.defaultOpacity,onConfirm:d=>{console.log("onConfirm called in ImageDrawLayer",d),i&&i(d),this.hideImageInputModal()},onCancel:()=>{console.log("onCancel called in ImageDrawLayer"),i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity}),this.hideImageInputModal()},onDelete:n,theme:this.currentTheme,t:c},{x:l,y:h})}hideImageInputModal(){this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),this.isInputActive=!1}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:"Point"}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry();if(n instanceof rt){const[r,o]=n.getCoordinates(),[a,l]=U([r,o]);this.showImageInputModal([r,o],void 0,h=>{if(e&&e.clear(),this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),h.imageUrl&&h.imageUrl.trim()){const c=Vt("image_"),d=new V({geometry:new rt([r,o]),id:c,position:[a,l],imageUrl:h.imageUrl,imageData:h.imageData});d.set("width",h.width),d.set("height",h.height),d.set("opacity",h.opacity),d.set("rotation",0),this.source?.addFeature(d),this.features.set(c,d),this.layer?.setZIndex(999),d.changed(),this.mapView&&this.mapView.renderSync(),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:c,position:[a,l],imageUrl:h.imageUrl,imageData:h.imageData,width:h.width,height:h.height,opacity:h.opacity,rotation:0})}else this.onDrawCompleteCallback&&this.onDrawCompleteCallback(null);this.onDrawCompleteCallback=null,this.mapView?.render()})}else 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:!1,keepAspectRatio:o=>o.shiftKey}),this.transformInteraction.setActive(!0),this.transformInteraction.on("scaleend",()=>{const o=i.get("scale")||1,a=i.get("width")||this.defaultWidth,l=i.get("height")||this.defaultHeight,h=Math.max(10,a*o),c=Math.max(10,l*o);i.set("width",h),i.set("height",c),i.set("scale",1),i.changed();const d=i.get("position"),u=i.get("id");this.onEditCompleteCallback&&u&&this.onEditCompleteCallback({id:u,position:d,imageUrl:i.get("imageUrl"),imageData:i.get("imageData"),width:h,height:c,opacity:i.get("opacity"),rotation:i.get("rotation")||0}),this.mapView?.render()}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof rt){const[a,l]=o.getCoordinates(),[h,c]=U([a,l]);i.set("position",[h,c]),i.changed();const d=i.get("id");this.onEditCompleteCallback&&d&&this.onEditCompleteCallback({id:d,position:[h,c],imageUrl:i.get("imageUrl"),imageData:i.get("imageData"),width:i.get("width"),height:i.get("height"),opacity:i.get("opacity"),rotation:i.get("rotation")||0})}}),this.mapView?.addInteraction(this.transformInteraction),this.mapView?.render()}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),this.isInputActive=!1,this.editingFeature=null,this.onEditCompleteCallback=null}editProperties(t,e,i){const n=this.features.get(t);if(!n)return;const r=n.getGeometry();if(r instanceof rt){const[o,a]=r.getCoordinates(),l=n.get("imageUrl")||"",h=n.get("imageData"),c=n.get("width")||this.defaultWidth,d=n.get("height")||this.defaultHeight,u=n.get("opacity")||this.defaultOpacity,f=()=>{this.removeImage(t),i&&i(),e&&e(null)};this.showImageInputModal([o,a],{imageUrl:l,imageData:h,width:c,height:d,opacity:u},g=>{if(g.imageUrl&&g.imageUrl.trim()){n.set("imageUrl",g.imageUrl),g.imageData&&n.set("imageData",g.imageData),n.set("width",g.width),n.set("height",g.height),n.set("opacity",g.opacity),n.changed(),this.mapView?.render();const p=n.get("position");e&&e({id:t,position:p,imageUrl:g.imageUrl,imageData:g.imageData,width:g.width,height:g.height,opacity:g.opacity,rotation:n.get("rotation")||0})}},f)}}addImage(t){const e=ut(t.position),i=new V({geometry:new rt(e),id:t.id,position:t.position,imageUrl:t.imageUrl,imageData:t.imageData});i.set("width",t.width||this.defaultWidth),i.set("height",t.height||this.defaultHeight),i.set("opacity",t.opacity||this.defaultOpacity),i.set("rotation",t.rotation||0),i.set("scale",1),this.source?.addFeature(i),this.features.set(t.id,i)}removeImage(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllImages(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i,position:e.get("position"),imageUrl:e.get("imageUrl"),imageData:e.get("imageData"),width:e.get("width"),height:e.get("height"),opacity:e.get("opacity"),rotation:e.get("rotation")})}),t}getImage(t){const e=this.features.get(t);if(e)return{id:t,position:e.get("position"),imageUrl:e.get("imageUrl"),imageData:e.get("imageData"),width:e.get("width"),height:e.get("height"),opacity:e.get("opacity"),rotation:e.get("rotation")}}updateImageStyle(t,e,i,n,r){const o=this.features.get(t);o&&(o.set("width",e),o.set("height",i),o.set("opacity",n),r!==void 0&&o.set("rotation",r),o.changed(),this.mapView&&(this.mapView.renderSync(),this.layer&&this.layer.changed()))}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.images&&(this.clearAll(),t.images.forEach(e=>this.addImage(e)))}destroy(){this.stopDraw(),this.stopEdit(),this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),super.destroy()}}const cs=class cs{constructor(t){this.circleDrawLayer=null,this.rectangleDrawLayer=null,this.triangleDrawLayer=null,this.distanceMeasureLayer=null,this.areaMeasureLayer=null,this.circleDrawTool=null,this.rectangleDrawTool=null,this.triangleDrawTool=null,this.floatingToolbar=null,this.measurementFloatingToolbar=null,this.drawingStatusDiv=null,this.measureStatusDiv=null,this.isOwnContainer=!1,this.theme="dark",this.locale="zh",this.isDestroyed=!1,this.enableDrawing=!0,this.showFloatingToolbar=!1,this.floatingToolbarPosition={x:100,y:100},this.showMeasurementToolbar=!1,this.measurementToolbarPosition={x:100,y:100},this.selectedCircleId=null,this.selectedRectangleId=null,this.selectedTriangleId=null,this.selectedMeasurementId=null,this.currentColor=[255,0,0,1],this.currentStrokeWidth=3,this.currentStrokeStyle="solid",this.currentSize=10,this.currentScale="",this.isLoading=!0,this.isChangingBasemap=!1,this.drawingStatusText=null,this.measureStatusText=null,this.freehandDrawLayer=null,this.ellipseDrawLayer=null,this.markerDrawLayer=null,this.textDrawLayer=null,this.arrowDrawLayer=null,this.freehandDrawTool=null,this.ellipseDrawTool=null,this.markerDrawTool=null,this.textDrawTool=null,this.arrowDrawTool=null,this.selectedFreehandId=null,this.selectedEllipseId=null,this.selectedMarkerId=null,this.selectedTextId=null,this.selectedArrowId=null,this.lineDrawLayer=null,this.bezierDrawLayer=null,this.sectorDrawLayer=null,this.lineDrawTool=null,this.bezierDrawTool=null,this.sectorDrawTool=null,this.selectedLineId=null,this.selectedBezierId=null,this.selectedSectorId=null,this.pointCoordinatePickLayer=null,this.lineCoordinatePickLayer=null,this.polygonCoordinatePickLayer=null,this.pointCoordinateListPanel=null,this.currentPointCoordinates=[],this.currentLineCoordinates=[],this.currentPolygonCoordinates=[],this.imageDrawLayer=null,this.imageDrawTool=null,this.selectedImageId=null,this.selectedPointPickId=null,this.selectedLinePickId=null,this.selectedPolygonPickId=null;const{container:e,containerSelector:i,id:n,parent:r,parentSelector:o,basemap:a=dt.SATELLITE,baseMapUrl:l,center:h=[0,0],zoom:c=12,coordinateSystem:d=Oe.WGS84,onLoad:u,onMoveEnd:f,onMapClick:g,onCircleDrawn:p,theme:m="dark",i18n:y="zh",enableDrawing:x=!0}=t,{container:E,isOwn:w}=this.resolveContainer({container:e,containerSelector:i,id:n,parent:r,parentSelector:o});this.container=E,this.isOwnContainer=w,this.theme=m,this.locale=y,this.t=Hi(this.locale),this.onLoadCallback=u,this.onMoveEndCallback=f,this.onMapClickCallback=g,this.onCircleDrawnCallback=p,this.enableDrawing=x,this.container.setAttribute("data-theme",m),this.container.style.cssText="position:relative;width:100%;height:100%;margin:0;padding:0;overflow:hidden;box-sizing:border-box;",this.injectGlobalStyles(),this.mapManager=new $_(this.container,a,h,c,d,l),this.layerManager=new Gh(this.mapManager.getMap()),this.drawToolManager=new d_,this.drawingManager=new U_,this.eventManager=new V_,this.initUI(),this.initLayers(),this.initEventManager(),this.initDrawingManager(),this.bindEvents(),this.initRightClickMenu(),this.onLoadCallback&&setTimeout(()=>this.onLoadCallback?.(this),100),setTimeout(()=>this.hideLoading(),500)}injectGlobalStyles(){if(cs.globalStylesInjected)return;cs.globalStylesInjected=!0;const t="earthview-global-styles";if(!document.getElementById(t)){const e=document.createElement("style");e.id=t,e.textContent=`
|
|
1926
|
+
`,n?(r.onmouseenter=()=>{r.style.background="#d32f2f"},r.onmouseleave=()=>{r.style.background="#f44336"}):i?(r.onmouseenter=()=>{r.style.background="#0088cc"},r.onmouseleave=()=>{r.style.background="#00aaff"}):(r.onmouseenter=()=>{r.style.background=e?"#4a4a4a":"#e0e0e0"},r.onmouseleave=()=>{r.style.background=e?"#3d3d3d":"#e8e8e8"}),r}updatePreview(){if(!this.imagePreview||!this.previewImg||!this.urlInput){console.warn("updatePreview: required elements not ready");return}const t=this.urlInput.value||this.currentImageUrl,e=this.imagePreview.querySelector("#no-image-text");t&&t.trim()?(this.previewImg.src=t,this.previewImg.style.display="block",e&&(e.style.display="none"),this.previewImg.onload=()=>{this.widthInput&&(!this.options.initialWidth||this.options.initialWidth===32)&&(this.widthInput.value=Math.min(this.previewImg.naturalWidth,200).toString()),this.heightInput&&(!this.options.initialHeight||this.options.initialHeight===32)&&(this.heightInput.value=Math.min(this.previewImg.naturalHeight,200).toString())},this.previewImg.onerror=()=>{this.previewImg.style.display="none",e&&(e.style.display="flex",e.textContent=this.options.t.imageLoadFailed)}):(this.previewImg.style.display="none",e&&(e.style.display="flex",e.textContent=this.options.t.noImage))}uploadImage(t){const e=new FileReader;e.onload=i=>{const n=i.target?.result;this.currentImageData=n,this.currentImageUrl=n,this.urlInput&&(this.urlInput.value=n),this.updatePreview()},e.readAsDataURL(t)}centerModal(){const t=(window.innerWidth-300)/2,e=(window.innerHeight-420)/2;this.element.style.left=`${Math.max(10,t)}px`,this.element.style.top=`${Math.max(10,e)}px`}setPosition(t){let e=t.x-150,i=t.y-200;e=Math.max(10,Math.min(e,window.innerWidth-310)),i=Math.max(10,Math.min(i,window.innerHeight-420)),this.element.style.left=`${e}px`,this.element.style.top=`${i}px`}bindEvents(){if(!this.urlInput||!this.confirmBtn||!this.cancelBtn){console.error("ImageInputModalBox: Required elements not found");return}this.urlInput.addEventListener("input",()=>{this.currentImageUrl=this.urlInput.value,this.currentImageData=void 0,this.updatePreview()}),this.deleteBtn&&this.deleteBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onDelete&&this.options.onDelete(),this.destroy()}),this.confirmBtn.addEventListener("click",t=>{t.stopPropagation();const e=this.urlInput.value.trim();e?this.options.onConfirm({imageUrl:e,imageData:this.currentImageData,width:this.widthInput&&parseInt(this.widthInput.value)||32,height:this.heightInput&&parseInt(this.heightInput.value)||32,opacity:this.opacityInput?parseInt(this.opacityInput.value)/100:1}):this.options.onCancel(),this.destroy()}),this.cancelBtn.addEventListener("click",t=>{t.stopPropagation(),this.options.onCancel(),this.destroy()}),this.widthInput&&this.widthInput.addEventListener("input",()=>{this.updatePreviewSize()}),this.heightInput&&this.heightInput.addEventListener("input",()=>{this.updatePreviewSize()}),this.opacityInput&&this.opacityValue&&this.opacityInput.addEventListener("input",()=>{this.opacityValue.textContent=`${this.opacityInput.value}%`,this.updatePreviewOpacity()}),this.element.addEventListener("click",t=>{t.stopPropagation()}),document.addEventListener("keydown",t=>{t.key==="Escape"&&document.body.contains(this.element)&&(this.options.onCancel(),this.destroy())})}updatePreviewSize(){const t=parseInt(this.widthInput.value)||32,e=parseInt(this.heightInput.value)||32;this.previewImg.style.maxWidth=`${Math.min(t,200)}px`,this.previewImg.style.maxHeight=`${Math.min(e,200)}px`}updatePreviewOpacity(){const t=parseInt(this.opacityInput.value)/100;this.previewImg.style.opacity=t.toString()}updateTheme(t){this.options.theme=t;const e=t==="dark";this.element.style.background=e?"#2d2d2d":"#ffffff",this.element.style.borderColor=e?"#444":"#e0e0e0"}destroy(){this.overlay.remove(),this.element.remove()}getElement(){return this.element}}class Z_ extends It{constructor(t,e,i){super(t,e,Z.IMAGE_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.imageInputModal=null,this.isInputActive=!1,this.currentTheme="dark",this.currentTranslations=null,this.defaultWidth=i?.defaultWidth||32,this.defaultHeight=i?.defaultHeight||32,this.defaultOpacity=i?.defaultOpacity||1,this.source=new Y,this.layer=new bt({source:this.source,style:n=>this.getStyleForFeature(n),properties:{id:t,name:e,type:Z.IMAGE_DRAW},visible:this.visible,opacity:this.opacity,zIndex:this.zIndex})}getStyleForFeature(t){const e=t?.get("imageUrl")||"",i=t?.get("width")||this.defaultWidth,n=t?.get("height")||this.defaultHeight,r=t?.get("opacity")||this.defaultOpacity,o=t?.get("rotation")||0;return e?new A({image:new Vi({src:e,width:i,height:n,opacity:r,rotation:o,crossOrigin:"anonymous"})}):new A({})}setTheme(t,e){this.currentTheme=t,this.currentTranslations=e}showImageInputModal(t,e,i,n){this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),this.isInputActive=!0;const r=this.mapView;if(!r||typeof r.getTargetElement!="function"){console.error("ImageDrawLayer: mapView is not a valid map object"),this.isInputActive=!1,i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity});return}if(!r.getTargetElement()){console.error("ImageDrawLayer: cannot get map target element"),this.isInputActive=!1,i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity});return}const a=r.getPixelFromCoordinate(t);if(!a||a.length<2){console.error("ImageDrawLayer: cannot get pixel from coordinate",t),this.isInputActive=!1,i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity});return}let l=a[0]-150,h=a[1]-200;l=Math.max(10,Math.min(l,window.innerWidth-310)),h=Math.max(10,Math.min(h,window.innerHeight-400));const c={addImage:"添加图片",enterImageUrl:"请输入图片URL或点击上传...",imageUrl:"图片URL",uploadImage:"上传图片",width:"宽度",height:"高度",opacity:"透明度",confirm:"确定",cancel:"取消",delete:"删除"};this.imageInputModal=new Y_({initialImageUrl:e?.imageUrl||"",initialImageData:e?.imageData,initialWidth:e?.width||this.defaultWidth,initialHeight:e?.height||this.defaultHeight,initialOpacity:e?.opacity||this.defaultOpacity,onConfirm:d=>{console.log("onConfirm called in ImageDrawLayer",d),i&&i(d),this.hideImageInputModal()},onCancel:()=>{console.log("onCancel called in ImageDrawLayer"),i&&i({imageUrl:"",width:this.defaultWidth,height:this.defaultHeight,opacity:this.defaultOpacity}),this.hideImageInputModal()},onDelete:n,theme:this.currentTheme,t:c,container:this.mapView?.getTargetElement()},{x:l,y:h}),this.imageInputModal.getElement().style.userSelect="none"}hideImageInputModal(){this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),this.isInputActive=!1}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:"Point"}),this.drawInteraction.on("drawend",i=>{const n=i.feature.getGeometry();if(n instanceof rt){const[r,o]=n.getCoordinates(),[a,l]=U([r,o]);this.showImageInputModal([r,o],void 0,h=>{if(e&&e.clear(),this.drawInteraction&&(this.mapView?.removeInteraction(this.drawInteraction),this.drawInteraction=null),h.imageUrl&&h.imageUrl.trim()){const c=Vt("image_"),d=new V({geometry:new rt([r,o]),id:c,position:[a,l],imageUrl:h.imageUrl,imageData:h.imageData});d.set("width",h.width),d.set("height",h.height),d.set("opacity",h.opacity),d.set("rotation",0),this.source?.addFeature(d),this.features.set(c,d),this.layer?.setZIndex(999),d.changed(),this.mapView&&this.mapView.renderSync(),this.onDrawCompleteCallback&&this.onDrawCompleteCallback({id:c,position:[a,l],imageUrl:h.imageUrl,imageData:h.imageData,width:h.width,height:h.height,opacity:h.opacity,rotation:0})}else this.onDrawCompleteCallback&&this.onDrawCompleteCallback(null);this.onDrawCompleteCallback=null,this.mapView?.render()})}else 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:!1,keepAspectRatio:o=>o.shiftKey}),this.transformInteraction.setActive(!0),this.transformInteraction.on("scaleend",()=>{const o=i.get("scale")||1,a=i.get("width")||this.defaultWidth,l=i.get("height")||this.defaultHeight,h=Math.max(10,a*o),c=Math.max(10,l*o);i.set("width",h),i.set("height",c),i.set("scale",1),i.changed();const d=i.get("position"),u=i.get("id");this.onEditCompleteCallback&&u&&this.onEditCompleteCallback({id:u,position:d,imageUrl:i.get("imageUrl"),imageData:i.get("imageData"),width:h,height:c,opacity:i.get("opacity"),rotation:i.get("rotation")||0}),this.mapView?.render()}),this.transformInteraction.on("translateend",()=>{const o=i.getGeometry();if(o instanceof rt){const[a,l]=o.getCoordinates(),[h,c]=U([a,l]);i.set("position",[h,c]),i.changed();const d=i.get("id");this.onEditCompleteCallback&&d&&this.onEditCompleteCallback({id:d,position:[h,c],imageUrl:i.get("imageUrl"),imageData:i.get("imageData"),width:i.get("width"),height:i.get("height"),opacity:i.get("opacity"),rotation:i.get("rotation")||0})}}),this.mapView?.addInteraction(this.transformInteraction),this.mapView?.render()}stopEdit(){this.transformInteraction&&(this.mapView?.removeInteraction(this.transformInteraction),this.transformInteraction=null),this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),this.isInputActive=!1,this.editingFeature=null,this.onEditCompleteCallback=null}editProperties(t,e,i){const n=this.features.get(t);if(!n)return;const r=n.getGeometry();if(r instanceof rt){const[o,a]=r.getCoordinates(),l=n.get("imageUrl")||"",h=n.get("imageData"),c=n.get("width")||this.defaultWidth,d=n.get("height")||this.defaultHeight,u=n.get("opacity")||this.defaultOpacity,f=()=>{this.removeImage(t),i&&i(),e&&e(null)};this.showImageInputModal([o,a],{imageUrl:l,imageData:h,width:c,height:d,opacity:u},g=>{if(g.imageUrl&&g.imageUrl.trim()){n.set("imageUrl",g.imageUrl),g.imageData&&n.set("imageData",g.imageData),n.set("width",g.width),n.set("height",g.height),n.set("opacity",g.opacity),n.changed(),this.mapView?.render();const p=n.get("position");e&&e({id:t,position:p,imageUrl:g.imageUrl,imageData:g.imageData,width:g.width,height:g.height,opacity:g.opacity,rotation:n.get("rotation")||0})}},f)}}addImage(t){const e=ut(t.position),i=new V({geometry:new rt(e),id:t.id,position:t.position,imageUrl:t.imageUrl,imageData:t.imageData});i.set("width",t.width||this.defaultWidth),i.set("height",t.height||this.defaultHeight),i.set("opacity",t.opacity||this.defaultOpacity),i.set("rotation",t.rotation||0),i.set("scale",1),this.source?.addFeature(i),this.features.set(t.id,i)}removeImage(t){const e=this.features.get(t);e&&(this.source?.removeFeature(e),this.features.delete(t),this.editingFeature===e&&this.stopEdit())}getAllImages(){const t=[];return this.features.forEach((e,i)=>{t.push({id:i,position:e.get("position"),imageUrl:e.get("imageUrl"),imageData:e.get("imageData"),width:e.get("width"),height:e.get("height"),opacity:e.get("opacity"),rotation:e.get("rotation")})}),t}getImage(t){const e=this.features.get(t);if(e)return{id:t,position:e.get("position"),imageUrl:e.get("imageUrl"),imageData:e.get("imageData"),width:e.get("width"),height:e.get("height"),opacity:e.get("opacity"),rotation:e.get("rotation")}}updateImageStyle(t,e,i,n,r){const o=this.features.get(t);o&&(o.set("width",e),o.set("height",i),o.set("opacity",n),r!==void 0&&o.set("rotation",r),o.changed(),this.mapView&&(this.mapView.renderSync(),this.layer&&this.layer.changed()))}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.images&&(this.clearAll(),t.images.forEach(e=>this.addImage(e)))}destroy(){this.stopDraw(),this.stopEdit(),this.imageInputModal&&(this.imageInputModal.destroy(),this.imageInputModal=null),super.destroy()}}const cs=class cs{constructor(t){this.circleDrawLayer=null,this.rectangleDrawLayer=null,this.triangleDrawLayer=null,this.distanceMeasureLayer=null,this.areaMeasureLayer=null,this.circleDrawTool=null,this.rectangleDrawTool=null,this.triangleDrawTool=null,this.floatingToolbar=null,this.measurementFloatingToolbar=null,this.drawingStatusDiv=null,this.measureStatusDiv=null,this.isOwnContainer=!1,this.theme="dark",this.locale="zh",this.isDestroyed=!1,this.enableDrawing=!0,this.showFloatingToolbar=!1,this.floatingToolbarPosition={x:100,y:100},this.showMeasurementToolbar=!1,this.measurementToolbarPosition={x:100,y:100},this.selectedCircleId=null,this.selectedRectangleId=null,this.selectedTriangleId=null,this.selectedMeasurementId=null,this.currentColor=[255,0,0,1],this.currentStrokeWidth=3,this.currentStrokeStyle="solid",this.currentSize=10,this.currentScale="",this.isLoading=!0,this.isChangingBasemap=!1,this.drawingStatusText=null,this.measureStatusText=null,this.freehandDrawLayer=null,this.ellipseDrawLayer=null,this.markerDrawLayer=null,this.textDrawLayer=null,this.arrowDrawLayer=null,this.freehandDrawTool=null,this.ellipseDrawTool=null,this.markerDrawTool=null,this.textDrawTool=null,this.arrowDrawTool=null,this.selectedFreehandId=null,this.selectedEllipseId=null,this.selectedMarkerId=null,this.selectedTextId=null,this.selectedArrowId=null,this.lineDrawLayer=null,this.bezierDrawLayer=null,this.sectorDrawLayer=null,this.lineDrawTool=null,this.bezierDrawTool=null,this.sectorDrawTool=null,this.selectedLineId=null,this.selectedBezierId=null,this.selectedSectorId=null,this.pointCoordinatePickLayer=null,this.lineCoordinatePickLayer=null,this.polygonCoordinatePickLayer=null,this.pointCoordinateListPanel=null,this.currentPointCoordinates=[],this.currentLineCoordinates=[],this.currentPolygonCoordinates=[],this.imageDrawLayer=null,this.imageDrawTool=null,this.selectedImageId=null,this.selectedPointPickId=null,this.selectedLinePickId=null,this.selectedPolygonPickId=null;const{container:e,containerSelector:i,id:n,parent:r,parentSelector:o,basemap:a=dt.SATELLITE,baseMapUrl:l,center:h=[0,0],zoom:c=12,coordinateSystem:d=Oe.WGS84,onLoad:u,onMoveEnd:f,onMapClick:g,onCircleDrawn:p,theme:m="dark",i18n:y="zh",enableDrawing:x=!0}=t,{container:E,isOwn:w}=this.resolveContainer({container:e,containerSelector:i,id:n,parent:r,parentSelector:o});this.container=E,this.isOwnContainer=w,this.theme=m,this.locale=y,this.t=Hi(this.locale),this.onLoadCallback=u,this.onMoveEndCallback=f,this.onMapClickCallback=g,this.onCircleDrawnCallback=p,this.enableDrawing=x,this.container.setAttribute("data-theme",m),this.container.style.cssText="position:relative;width:100%;height:100%;margin:0;padding:0;overflow:hidden;box-sizing:border-box;",this.injectGlobalStyles(),this.mapManager=new $_(this.container,a,h,c,d,l),this.layerManager=new Gh(this.mapManager.getMap()),this.drawToolManager=new d_,this.drawingManager=new U_,this.eventManager=new V_,this.initUI(),this.initLayers(),this.initEventManager(),this.initDrawingManager(),this.bindEvents(),this.initRightClickMenu(),this.onLoadCallback&&setTimeout(()=>this.onLoadCallback?.(this),100),setTimeout(()=>this.hideLoading(),500)}injectGlobalStyles(){if(cs.globalStylesInjected)return;cs.globalStylesInjected=!0;const t="earthview-global-styles";if(!document.getElementById(t)){const e=document.createElement("style");e.id=t,e.textContent=`
|
|
1920
1927
|
@keyframes earthview-spin {
|
|
1921
1928
|
0% { transform: rotate(0deg); }
|
|
1922
1929
|
100% { transform: rotate(360deg); }
|
package/dist/index.mjs
CHANGED
|
@@ -23134,13 +23134,14 @@ class dm {
|
|
|
23134
23134
|
bottom: 0;
|
|
23135
23135
|
background: transparent;
|
|
23136
23136
|
z-index: 10000;
|
|
23137
|
+
pointer-events: auto;
|
|
23137
23138
|
`, t.onclick = (e) => {
|
|
23138
23139
|
e.stopPropagation(), this.options.onCancel(), this.destroy();
|
|
23139
23140
|
}, t;
|
|
23140
23141
|
}
|
|
23141
23142
|
createElement() {
|
|
23142
23143
|
const t = this.options.theme === "dark", e = document.createElement("div");
|
|
23143
|
-
e.className = "text-input-modal-container", e.style.cssText = `
|
|
23144
|
+
e.style.userSelect = "none", e.className = "text-input-modal-container", e.style.cssText = `
|
|
23144
23145
|
position: fixed;
|
|
23145
23146
|
z-index: 10001;
|
|
23146
23147
|
width: 280px;
|
|
@@ -23562,10 +23563,11 @@ class um extends Lt {
|
|
|
23562
23563
|
},
|
|
23563
23564
|
onDelete: n,
|
|
23564
23565
|
theme: this.currentTheme,
|
|
23565
|
-
t: c
|
|
23566
|
+
t: c,
|
|
23567
|
+
container: this.mapView?.getTargetElement()
|
|
23566
23568
|
},
|
|
23567
23569
|
{ x: l, y: h }
|
|
23568
|
-
);
|
|
23570
|
+
), this.textInputModal.getElement().style.userSelect = "none";
|
|
23569
23571
|
}
|
|
23570
23572
|
hideTextInputModal() {
|
|
23571
23573
|
this.textInputModal && (this.textInputModal.destroy(), this.textInputModal = null), this.isInputActive = !1;
|
|
@@ -31384,23 +31386,21 @@ class ar extends Lt {
|
|
|
31384
31386
|
duration: 300
|
|
31385
31387
|
}), n && n.onClick && n.onClick(n, e);
|
|
31386
31388
|
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");
|
|
31387
|
-
y.style.position = "
|
|
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";
|
|
31388
31390
|
let x = "";
|
|
31389
31391
|
l && (x += `<div style="height: ${this.coverImageHeight}px; overflow: hidden;">
|
|
31390
|
-
|
|
31391
|
-
|
|
31392
|
-
const E = this.view.getTargetElement();
|
|
31393
|
-
|
|
31394
|
-
|
|
31395
|
-
|
|
31396
|
-
|
|
31397
|
-
|
|
31398
|
-
|
|
31399
|
-
let P = C[0] - v.left - _ / 2, L = C[1] - v.top - b - 15;
|
|
31400
|
-
L < 5 && (L = C[1] - v.top + 15), P = Math.max(5, Math.min(P, v.width - _ - 5)), L = Math.max(5, Math.min(L, v.height - b - 5)), y.style.left = `${P}px`, y.style.top = `${L}px`, y.style.display = "block", this.currentPopup = y;
|
|
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;
|
|
31397
|
+
}
|
|
31398
|
+
escapeHtml(t) {
|
|
31399
|
+
const e = document.createElement("div");
|
|
31400
|
+
return e.textContent = t, e.innerHTML;
|
|
31401
31401
|
}
|
|
31402
31402
|
hidePopup() {
|
|
31403
|
-
this.currentPopup && (this.currentPopup.
|
|
31403
|
+
this.currentPopup && (this.currentPopup.parentNode && this.currentPopup.parentNode.removeChild(this.currentPopup), this.currentPopup = null), this.currentFeature = null;
|
|
31404
31404
|
}
|
|
31405
31405
|
clearAllMarkers() {
|
|
31406
31406
|
this.animationFrames.forEach((t, e) => {
|
|
@@ -31422,14 +31422,13 @@ class ar extends Lt {
|
|
|
31422
31422
|
updatePopupPosition() {
|
|
31423
31423
|
!this.currentPopup || !this.currentFeature || (this.updateFrame && cancelAnimationFrame(this.updateFrame), this.updateFrame = requestAnimationFrame(() => {
|
|
31424
31424
|
if (!this.currentPopup || !this.currentFeature) return;
|
|
31425
|
-
const t = this.currentFeature.getGeometry(), e = this.view.getPixelFromCoordinate(t.getCoordinates()),
|
|
31426
|
-
|
|
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)) {
|
|
31427
31428
|
this.currentPopup.style.display = "none";
|
|
31428
31429
|
return;
|
|
31429
31430
|
}
|
|
31430
|
-
this.currentPopup.style.display = "block"
|
|
31431
|
-
let l = e[0] - n.left - r / 2, h = e[1] - n.top - o - 15;
|
|
31432
|
-
l = Math.max(5, Math.min(l, n.width - r - 5)), h = Math.max(5, Math.min(h, n.height - o - 5)), this.currentPopup.style.left = `${l}px`, this.currentPopup.style.top = `${h}px`;
|
|
31431
|
+
this.currentPopup.style.display = "block", this.currentPopup.style.left = `${r}px`, this.currentPopup.style.top = `${o}px`;
|
|
31433
31432
|
}));
|
|
31434
31433
|
}
|
|
31435
31434
|
destroy() {
|
|
@@ -33095,6 +33094,7 @@ class e_ {
|
|
|
33095
33094
|
border-radius: 8px;
|
|
33096
33095
|
padding: 4px;
|
|
33097
33096
|
backdrop-filter: blur(4px);
|
|
33097
|
+
user-select: none;
|
|
33098
33098
|
`, this.scrollUpBtn = this.createScrollButton("▲", this.options.t.topScroll || "Top Scroll"), e.appendChild(this.scrollUpBtn), this.scrollUpBtn.style.display = "none";
|
|
33099
33099
|
const i = document.createElement("div");
|
|
33100
33100
|
i.className = "toolbar-scroll-container", i.style.cssText = `
|
|
@@ -33306,6 +33306,7 @@ class lr {
|
|
|
33306
33306
|
overflow: hidden;
|
|
33307
33307
|
display: flex;
|
|
33308
33308
|
flex-direction: column;
|
|
33309
|
+
user-select: none;
|
|
33309
33310
|
`;
|
|
33310
33311
|
let n = 328;
|
|
33311
33312
|
if (this.element?.parentElement) {
|
|
@@ -34361,6 +34362,7 @@ class ke {
|
|
|
34361
34362
|
backdrop-filter: blur(8px);
|
|
34362
34363
|
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
34363
34364
|
cursor: default;
|
|
34365
|
+
user-select: none;
|
|
34364
34366
|
`;
|
|
34365
34367
|
const i = `
|
|
34366
34368
|
width: 28px;
|
|
@@ -34697,6 +34699,7 @@ class o_ {
|
|
|
34697
34699
|
backdrop-filter: blur(8px);
|
|
34698
34700
|
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
34699
34701
|
cursor: default;
|
|
34702
|
+
user-select: none;
|
|
34700
34703
|
`;
|
|
34701
34704
|
const i = `
|
|
34702
34705
|
width: 28px;
|
|
@@ -34792,6 +34795,7 @@ class a_ {
|
|
|
34792
34795
|
color: ${t ? "#fff" : "#333"};
|
|
34793
34796
|
pointer-events: none;
|
|
34794
34797
|
border: 1px solid ${t ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)"};
|
|
34798
|
+
user-select: none;
|
|
34795
34799
|
`, e.textContent = "", e;
|
|
34796
34800
|
}
|
|
34797
34801
|
updateScale(t) {
|
|
@@ -34884,6 +34888,7 @@ class h_ {
|
|
|
34884
34888
|
overflow: hidden;
|
|
34885
34889
|
display: flex;
|
|
34886
34890
|
flex-direction: column;
|
|
34891
|
+
user-select: none;
|
|
34887
34892
|
`, e;
|
|
34888
34893
|
}
|
|
34889
34894
|
getPointData() {
|
|
@@ -37719,7 +37724,7 @@ class G_ {
|
|
|
37719
37724
|
theme: this.theme,
|
|
37720
37725
|
t: this.t,
|
|
37721
37726
|
onClose: () => {
|
|
37722
|
-
this.handleTogglePopup(null)
|
|
37727
|
+
this.handleTogglePopup(null);
|
|
37723
37728
|
}
|
|
37724
37729
|
});
|
|
37725
37730
|
const n = new r_({
|
|
@@ -38280,7 +38285,7 @@ class X_ {
|
|
|
38280
38285
|
}
|
|
38281
38286
|
createElement() {
|
|
38282
38287
|
const t = this.options.theme === "dark", e = document.createElement("div");
|
|
38283
|
-
e.className = "image-input-modal-container", e.style.cssText = `
|
|
38288
|
+
e.className = "image-input-modal-container", e.style.userSelect = "none", e.style.cssText = `
|
|
38284
38289
|
position: fixed;
|
|
38285
38290
|
z-index: 10001;
|
|
38286
38291
|
width: 300px;
|
|
@@ -38688,10 +38693,11 @@ class j_ extends Lt {
|
|
|
38688
38693
|
},
|
|
38689
38694
|
onDelete: n,
|
|
38690
38695
|
theme: this.currentTheme,
|
|
38691
|
-
t: c
|
|
38696
|
+
t: c,
|
|
38697
|
+
container: this.mapView?.getTargetElement()
|
|
38692
38698
|
},
|
|
38693
38699
|
{ x: l, y: h }
|
|
38694
|
-
);
|
|
38700
|
+
), this.imageInputModal.getElement().style.userSelect = "none";
|
|
38695
38701
|
}
|
|
38696
38702
|
hideImageInputModal() {
|
|
38697
38703
|
this.imageInputModal && (this.imageInputModal.destroy(), this.imageInputModal = null), this.isInputActive = !1;
|