=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(e.slice()),this.geometryFunction_(r,t,i)):n==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(e.slice()),s&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,t,i)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),s?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),s=this.mode_;for(let r=0;r=2){this.finishCoordinate_=n[n.length-2].slice();const o=this.finishCoordinate_.slice();n[n.length-1]=o,this.createOrUpdateSketchPoint_(o)}this.geometryFunction_(n,t,i),t.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(t)}else if(s==="Polygon"){n=this.sketchCoords_[0],n.splice(-2,1);const o=this.sketchLine_.getGeometry();if(n.length>=2){const h=n[n.length-2].slice();n[n.length-1]=h,this.createOrUpdateSketchPoint_(h)}o.setCoordinates(n),this.geometryFunction_(this.sketchCoords_,t,i)}if(n.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let t=this.sketchCoords_;const i=e.getGeometry(),s=this.getMap().getView().getProjection();return this.mode_==="LineString"?(t.pop(),this.geometryFunction_(t,i,s)):this.mode_==="Polygon"&&(t[0].pop(),this.geometryFunction_(t,i,s),t=i.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Be([t])):this.type_==="MultiLineString"?e.setGeometry(new ae([t])):this.type_==="MultiPolygon"&&e.setGeometry(new he([t])),this.dispatchEvent(new O(N.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new O(N.DRAWABORT,e))}appendCoordinates(e){const t=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(e[0]);let s;if(t==="LineString"||t==="Circle")s=this.sketchCoords_;else if(t==="Polygon")s=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&s.shift(),s.pop();for(let n=0;n component has likely been used twice in your application.`),{destroy(){}};v(this,C,e);const t=w(this,D);if(v(this,D,void 0),t)for(const[s,...r]of t)e[s](...r);let i=!1;return{destroy:()=>{i||(i=!0,w(this,C)===e&&v(this,C,void 0))}}}}C=new WeakMap,D=new WeakMap,F=new WeakMap,y=new WeakSet,I=function(e,t){typeof t=="string"&&(t={message:t}),this.notify({...t,level:e})},z=function(e,...t){if(w(this,C))w(this,C)[e](...t);else{const i=w(this,D)??v(this,D,[]);if(i.length>=1024){$.error(`Internal notification buffer overflow: this event will be dropped to prevent a memory leak.
-Make sure that the UI is configured to display notifications (use ).`,{method:e,args:t});return}i.push([e,...t])}},Ze=function(){w(this,C)||$.warn(`No notification handler has been registered: notifications will not be visible.
-Make sure that your app contains the component.`)};const X="units",et=[1,2,5],M=25.4/.28;class tt extends je{constructor(e){e=e||{};const t=document.createElement("div");t.style.pointerEvents="none",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;const i=e.className!==void 0?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+We,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth!==void 0?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(X,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(X)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(X,e)}setDpi(e){this.dpi_=e}updateElement_(){const e=this.viewState_;if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=e.center,i=e.projection,s=this.getUnits(),r=s=="degrees"?"degrees":"m";let n=ie(i,e.resolution,t,r);const o=this.minWidth_*(this.dpi_||M)/M,h=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||M)/M:void 0;let l=o*n,c="";if(s=="degrees"){const p=Ve.degrees;l*=p,l=h){u=_,f=m,g=P;break}else if(f>=o)break;_=u,m=f,P=g,++d}const T=this.scaleBar_?this.createScaleBar(f,u,c):u.toFixed(g<0?-g:0)+" "+c;this.renderedHTML_!=T&&(this.innerElement_.innerHTML=T,this.renderedHTML_=T),this.renderedWidth_!=f&&(this.innerElement_.style.width=f+"px",this.renderedWidth_=f),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){const s=this.getScaleForResolution(),r=s<1?Math.round(1/s).toLocaleString()+" : 1":"1 : "+Math.round(s).toLocaleString(),n=this.scaleBarSteps_,o=e/n,h=[this.createMarker("absolute")];for(let c=0;c`+this.createMarker("relative")+(c%2===0||n===2?this.createStepText(c,e,!1,t,i):"")+"")}return h.push(this.createStepText(n,e,!0,t,i)),(this.scaleBarText_?``+r+"
":"")+h.join("")}createMarker(e){return``}createStepText(e,t,i,s,r){const o=(e===0?0:Math.round(s/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+r),h=e===0?-3:t/this.scaleBarSteps_*-1,l=e===0?0:t/this.scaleBarSteps_*2;return``+o+"
"}getScaleForResolution(){const e=ie(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||M,i=1e3/25.4;return e*i*t}render(e){const t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}}const it=.8,de="printing-hide";function st(a,e){return a.toDataURL("image/png",e??it)}function nt(a,e){const t=document.createElement("div");t.classList.add("printing-overlay",de),a.appendChild(t);const i=document.createElement("div");return i.classList.add("printing-overlay-status"),i.textContent=e,t.appendChild(i),{destroy(){t.remove()}}}class gt{defaultOverlayText;constructor(e){this.defaultOverlayText=e.intl.formatMessage({id:"printingMap"})}async printMap(e,t){return await new rt(e,{blockUserInteraction:!0,overlayText:this.defaultOverlayText,viewPadding:"auto",...t}).printMap()}}class rt{olMap;blockUserInteraction=!1;overlayText;viewPadding;running=!1;drawInformation=[];scaleLine=void 0;overlay=void 0;constructor(e,t){this.olMap=e,this.blockUserInteraction=t.blockUserInteraction,this.overlayText=t.overlayText,this.viewPadding=t.viewPadding}async printMap(){if(this.running)throw new Error("Printing already running.");try{await this.beginExport();let e=await this.printToCanvas(this.olMap.getViewport());if(!e)throw new Error("Canvas export failed");return this.viewPadding==="auto"&&(e=this.removePadding(e,this.getViewPadding())),new ot(e)}finally{this.reset()}}async beginExport(){this.running=!0;const e=this.olMap.getInteractions().getArray().filter(t=>t.getActive()&&t instanceof ze);if(this.drawInformation=[],e?.forEach(t=>{const i=t,s=i.getOverlay().getStyle();i.getOverlay().setStyle(null),this.drawInformation?.push({draw:i,style:s})}),this.blockUserInteraction){const t=this.olMap?.getTargetElement();t&&(this.overlay=nt(t,this.overlayText))}await this.addScaleLine()}async addScaleLine(){const t=(this.scaleLine=new tt({className:"printing-scale-bar ol-scale-bar",bar:!0,text:!0,minWidth:125})).element;if(!t)throw new Error("Scale line does not have an element");let i=50,s=8;if(this.viewPadding==="auto"){const{bottom:h,left:l}=this.getViewPadding();i=Math.max(h+8,i),s+=l}t.style.setProperty("--printing-scale-bar-bottom",`${i}px`),t.style.setProperty("--printing-scale-bar-left",`${s}px`);const r=_e(),n=setTimeout(()=>{r.reject(new Error("Scale line did not render"))},3e3),o=this.scaleLine.render;this.scaleLine.render=(...h)=>{o.apply(this.scaleLine,h),r.resolve()},this.olMap?.addControl(this.scaleLine);try{await r.promise,await new Promise(h=>{requestAnimationFrame(h)})}finally{clearTimeout(n)}}async printToCanvas(e){const t={useCORS:!0,ignoreElements:function(r){if(r.classList&&typeof r.classList=="object"){const n=r.classList;return n.contains("map-anchors")||n.contains(de)}return!1}},i=(await me(async()=>{const{default:r}=await import("./BfxBtG_Oxhhm.js");return{default:r}},[],import.meta.url)).default;return await i(e,t)}reset(){this.scaleLine&&(this.olMap?.removeControl(this.scaleLine),this.scaleLine=void 0),this.overlay&&(this.overlay.destroy(),this.overlay=void 0),this.running=!1,this.drawInformation?.length&&this.drawInformation.forEach(e=>{e.draw.getOverlay().setStyle(e.style)})}removePadding(e,t){const i=window.devicePixelRatio||1,s={top:t.top*i,right:t.right*i,bottom:t.bottom*i,left:t.left*i};if(s.left===0&&s.right===0&&s.top===0&&s.bottom===0)return e;const{width:r,height:n}=e,o=document.createElement("canvas");o.width=r-s.left-s.right,o.height=n-s.top-s.bottom;const h=o.getContext("2d");if(!h)throw new Error("Failed to get a canvas context");return h.drawImage(e,s.left,s.top,o.width,o.height,0,0,o.width,o.height),o}getViewPadding(){const t=this.olMap.getView().padding??[0,0,0,0];return{top:t[0]??0,right:t[1]??0,bottom:t[2]??0,left:t[3]??0}}}class ot{canvas;constructor(e){this.canvas=e}getCanvas(){return this.canvas}getPNGDataURL(e){return st(this.canvas,e)}}export{ze as D,Xe as I,ft as N,gt as P,tt as S,st as a,nt as c};
diff --git a/openlayers-base-packages/assets/DiOrj1F0r-Jt.js b/openlayers-base-packages/assets/Dx9locigDKA2.js
similarity index 78%
rename from openlayers-base-packages/assets/DiOrj1F0r-Jt.js
rename to openlayers-base-packages/assets/Dx9locigDKA2.js
index 4a7461a4b..4c0730bcb 100644
--- a/openlayers-base-packages/assets/DiOrj1F0r-Jt.js
+++ b/openlayers-base-packages/assets/Dx9locigDKA2.js
@@ -1,2 +1,2 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DyTV57ff4rkW.js","./CmsKOCeNyeyo.js","./Cxncs0atKtOb.js","./Mxtq6FG0Aq1_.js","./5C5XmiCGgLmB.js","./_eg2EQ1Gs0ak.js","./CRkdw9XP0Imr.js","./BbT9q31oQhIX.js","./IfrtfJ9Ep93o.js"])))=>i.map(i=>d[i]);
-var Qt=Object.defineProperty;var Ye=r=>{throw TypeError(r)};var es=(r,e,t)=>e in r?Qt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var y=(r,e,t)=>es(r,typeof e!="symbol"?e+"":e,t),Ae=(r,e,t)=>e.has(r)||Ye("Cannot "+t);var _=(r,e,t)=>(Ae(r,e,"read from private field"),t?t.call(r):e.get(r)),x=(r,e,t)=>e.has(r)?Ye("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),b=(r,e,t,s)=>(Ae(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t),te=(r,e,t)=>(Ae(r,e,"access private method"),t);import{aE as ts,b7 as ss,b8 as ns,b9 as is,aP as rs,aX as os,ba as as,bb as ls,J as cs,bc as ds,bd as us,be as hs,bf as gs,bg as St,bh as fs,bi as ms,a as ee,b as Fe,aL as ve,bj as Je,bk as K,a9 as Xe,G as T,bl as Ne,a_ as Z,an as Ze,bm as pe,p as P,bn as A,bo as Qe,bp as F,bq as Se,br as ps,bs as ys,z as _s,bt as De,bu as vs,bv as Ss,bw as xt,ao as wt,bx as xs,by as ws,bz as et,bA as bs,bB as tt,bC as Ms,bD as st,j as R,r as Be,a$ as $e,bE as bt,bF as Es,b0 as Cs,f as Ue,u as z,aZ as B,i as $,b4 as Ps,b3 as Le,bG as Fs,am as xe,bH as Ls,bI as Is,c as we,ax as ie,F as Re,C as Ts,bJ as nt,bK as As,bL as it,k as rt}from"./5C5XmiCGgLmB.js";import{h as We,u as Mt,o as Et,l as Ct,j as u,g as G,s as Ns,t as Os,r as p,v as se,w as ot,x as js,y as ks,z as Ds,c as fe,d as Pt,B as L,C as at,b as Ft,D as Rs,G as Gs,i as Lt,H as It,V as Vs,q as Hs,I as Bs}from"./Mxtq6FG0Aq1_.js";import{G as Tt,i as $s}from"./CXqamDLCwhxM.js";import{a as Us}from"./DWkb3PmnrxhS.js";import{D as At,S as Ws,I as zs,c as Ks,a as qs}from"./DW8DcLzWV1Z-.js";import{u as H}from"./_eg2EQ1Gs0ak.js";import{u as U,c as k,s as Nt}from"./Cxncs0atKtOb.js";import{T as Q,L as Ys}from"./BOwySe0UXVY3.js";import{c as Ot}from"./DUaeWVZO0JNZ.js";import{L as Ge}from"./D69t4K7RmA6W.js";import{u as jt,F as be}from"./CRkdw9XP0Imr.js";import{F as Me}from"./CYrCIuevaD6U.js";import{H as Ve}from"./BXf6RRVNKbev.js";import{F as Js}from"./IfrtfJ9Ep93o.js";import{_ as Xs}from"./CmsKOCeNyeyo.js";import{s as Zs}from"./DgabVoUpizSB.js";const ze=We(function(e,t){const{htmlSize:s,...n}=e,i=Mt("Input",n),a=Et(n),o=jt(a),l=Ct("chakra-input",e.className);return u.jsx(G.input,{size:s,...o,__css:i.field,ref:t,className:l})});ze.displayName="Input";ze.id="Input";const kt=We(function(e,t){const{children:s,placeholder:n,className:i,...a}=e;return u.jsxs(G.select,{...a,ref:t,className:Ct("chakra-select",i),children:[n&&u.jsx("option",{value:"",children:n}),s]})});kt.displayName="SelectField";const Ke=We((r,e)=>{const t=Mt("Select",r),{rootProps:s,placeholder:n,icon:i,color:a,height:o,h:l,minH:d,minHeight:c,iconColor:g,iconSize:h,...f}=Et(r),[m,v]=Zs(f,Ns),S=jt(v),I={width:"100%",height:"fit-content",position:"relative",color:a},N={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...t.field?._focus}};return u.jsxs(G.div,{className:"chakra-select__wrapper",__css:I,...m,...s,children:[u.jsx(kt,{ref:e,height:l??o,minH:d??c,placeholder:n,...S,__css:N,children:r.children}),u.jsx(Dt,{"data-disabled":Os(S.disabled),...(g||a)&&{color:g||a},__css:t.icon,...h&&{fontSize:h},children:i})]})});Ke.displayName="Select";const Qs=r=>u.jsx("svg",{viewBox:"0 0 24 24",...r,children:u.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),en=G("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Dt=r=>{const{children:e=u.jsx(Qs,{}),...t}=r,s=p.cloneElement(e,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return u.jsx(en,{...t,className:"chakra-select__icon-wrapper",children:p.isValidElement(e)?s:null})};Dt.displayName="SelectIcon";function tn(r,e){const t=r??"bottom";return{"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[t]?.[e]??t}function sn(r,e){const t=n=>({...e,...n,position:tn(n?.position??e?.position,r)}),s=n=>{const i=t(n),a=js(i);return se.notify(a,i)};return s.update=(n,i)=>{se.update(n,t(i))},s.promise=(n,i)=>{const a=s({...i.loading,status:"loading",duration:null});n.then(o=>s.update(a,{status:"success",duration:5e3,...ot(i.success,o)})).catch(o=>s.update(a,{status:"error",duration:5e3,...ot(i.error,o)}))},s.closeAll=se.closeAll,s.close=se.close,s.isActive=se.isActive,s}function nn(r){const{theme:e}=ks(),t=Ds();return p.useMemo(()=>sn(e.direction,{...t,...r}),[r,e.direction,t])}const M={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Ie extends ts{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst!==void 0?e.insertFirst:!0,this.stopEvent=e.stopEvent!==void 0?e.stopEvent:!0,this.element=document.createElement("div"),this.element.className=e.className!==void 0?e.className:"ol-overlay-container "+ss,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(M.ELEMENT,this.handleElementChanged),this.addChangeListener(M.MAP,this.handleMapChanged),this.addChangeListener(M.OFFSET,this.handleOffsetChanged),this.addChangeListener(M.POSITION,this.handlePositionChanged),this.addChangeListener(M.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset!==void 0?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(M.ELEMENT)}getId(){return this.id}getMap(){return this.get(M.MAP)||null}getOffset(){return this.get(M.OFFSET)}getPosition(){return this.get(M.POSITION)}getPositioning(){return this.get(M.POSITIONING)}handleElementChanged(){ns(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),is(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=rs(e,os.POSTRENDER,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(M.ELEMENT,e)}setMap(e){this.set(M.MAP,e)}setOffset(e){this.set(M.OFFSET,e)}setPosition(e){this.set(M.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(M.POSITION))return;const s=this.getRect(t.getTargetElement(),t.getSize()),n=this.getElement(),i=this.getRect(n,[as(n),ls(n)]);e=e||{};const a=e.margin===void 0?20:e.margin;if(!cs(s,i)){const o=i[0]-s[0],l=s[2]-i[2],d=i[1]-s[1],c=s[3]-i[3],g=[0,0];if(o<0?g[0]=o-a:l<0&&(g[0]=Math.abs(l)+a),d<0?g[1]=d-a:c<0&&(g[1]=Math.abs(c)+a),g[0]!==0||g[1]!==0){const h=t.getView().getCenterInternal(),f=t.getPixelFromCoordinateInternal(h);if(!f)return;const m=[f[0]+g[0],f[1]+g[1]],v=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(m),duration:v.duration,easing:v.easing})}}}getRect(e,t){const s=e.getBoundingClientRect(),n=s.left+window.pageXOffset,i=s.top+window.pageYOffset;return[n,i,n+t[0],i+t[1]]}setPositioning(e){this.set(M.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}const s=e.getPixelFromCoordinate(t),n=e.getSize();this.updateRenderedPosition(s,n)}updateRenderedPosition(e,t){const s=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);const a=Math.round(e[0]+n[0])+"px",o=Math.round(e[1]+n[1])+"px";let l="0%",d="0%";i=="bottom-right"||i=="center-right"||i=="top-right"?l="-100%":(i=="bottom-center"||i=="center-center"||i=="top-center")&&(l="-50%"),i=="bottom-left"||i=="bottom-center"||i=="bottom-right"?d="-100%":(i=="center-left"||i=="center-center"||i=="center-right")&&(d="-50%");const c=`translate(${l}, ${d}) translate(${a}, ${o})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,s.transform=c)}getOptions(){return this.options}}const Zi=ds,lt=0,re=1,ct=[0,0,0,0],q=[],Oe={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class je extends wt{constructor(e,t,s){super(e),this.features=t,this.mapBrowserEvent=s}}class rn extends us{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:hs,this.defaultDeleteCondition_=function(s){return gs(s)&&St(s)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:fs,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new ms,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new ee({source:new Fe({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:an(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new ve(this.source_.getFeatures()),this.source_.addEventListener(Je.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Je.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(K.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(K.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){const t=e.getGeometry();if(t){const n=this.SEGMENT_WRITERS_[t.getType()];n&&n(e,t)}const s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(s.getCoordinateFromPixel(this.lastPixel_)),e.addEventListener(Xe.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ve;const s=this.featuresBeingModified_.getArray();for(let n=0,i=t.length;n=0;--n){const i=s[n];for(let a=this.dragSegments_.length-1;a>=0;--a)this.dragSegments_[a][0]===i&&this.dragSegments_.splice(a,1);t.remove(i)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const s=t.getCoordinates(),n={feature:e,geometry:t,segment:[s,s]};this.rBush_.insert(t.getExtent(),n)}writeMultiPointGeometry_(e,t){const s=t.getCoordinates();for(let n=0,i=s.length;ni));const t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],s=[],n=[];for(let i=0,a=this.dragSegments_.length;i=0;--i)this.insertVertex_(s[i],n);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const s=this.dragSegments_[t][0],n=s.geometry;if(n.getType()==="Circle"){const i=n,a=i.getCenter(),o=s.featureSegments[0],l=s.featureSegments[1];o.segment[0]=a,o.segment[1]=a,l.segment[0]=a,l.segment[1]=a,this.rBush_.update(Ne(a),o);let d=i;this.rBush_.update(d.getExtent(),l)}else this.rBush_.update(T(s.segment),s)}return this.featuresBeingModified_&&(this.dispatchEvent(new je(Oe.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.coordinate)}handlePointerAtPixel_(e){const t=this.getMap(),s=t.getPixelFromCoordinate(e);t.getView().getProjection();const n=function(o,l){return dt(e,o)-dt(e,l)};let i,a;if(this.hitDetection_){const o=typeof this.hitDetection_=="object"?l=>l===this.hitDetection_:void 0;t.forEachFeatureAtPixel(s,(l,d,c)=>{c&&c.getType()==="Point"&&(c=new Ze(Se(c.getCoordinates())));const g=c||l.getGeometry();if(g&&g.getType()==="Point"&&l instanceof Z&&this.features_.getArray().includes(l)){a=g;const h=l.getGeometry().getFlatCoordinates().slice(0,2);i=[{feature:l,geometry:a,segment:[h,h]}]}return!0},{layerFilter:o})}if(!i){const o=ps(Ne(e,ct)),l=t.getView().getResolution()*this.pixelTolerance_,d=ys(_s(o,l,ct));i=this.rBush_.getInExtent(d)}if(i&&i.length>0){const o=i.sort(n)[0],l=o.segment;let d=ut(e,o);const c=t.getPixelFromCoordinate(d);let g=Qe(s,c);if(a||g<=this.pixelTolerance_){const h={};if(h[P(l)]=!0,this.snapToPointer_||(this.delta_[0]=d[0]-e[0],this.delta_[1]=d[1]-e[1]),o.geometry.getType()==="Circle"&&o.index===re)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(d,[o.feature],[o.geometry],this.snappedToVertex_);else{const f=t.getPixelFromCoordinate(l[0]),m=t.getPixelFromCoordinate(l[1]),v=De(c,f),S=De(c,m);g=Math.sqrt(Math.min(v,S)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(d=v>S?l[1]:l[0]),this.createOrUpdateVertexFeature_(d,[o.feature],[o.geometry],this.snappedToVertex_);const I={};I[P(o.geometry)]=!0;for(let N=1,w=i.length;Ns.getType()==="Circle"||s.getType().endsWith("Point")))return!1;const e=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(T([e])).some(({segment:s})=>A(s[0],e)||A(s[1],e))}removePoint(e){if(e&&(e=F(e,this.getMap().getView().getProjection()),this.updatePointer_(e)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=pe.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_.map(([n])=>n));const s=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new je(Oe.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,s}return!1}removeVertex_(){const e=this.dragSegments_,t={};let s=!1,n,i,a,o,l,d,c,g,h,f,m;for(l=e.length-1;l>=0;--l)a=e[l],f=a[0],m=P(f.feature),f.depth&&(m+="-"+f.depth.join("-")),m in t||(t[m]={}),a[1]===0?(t[m].right=f,t[m].index=f.index):a[1]==1&&(t[m].left=f,t[m].index=f.index+1);for(m in t){switch(h=t[m].right,c=t[m].left,d=t[m].index,g=d-1,c!==void 0?f=c:f=h,g<0&&(g=0),o=f.geometry,i=o.getCoordinates(),n=i,s=!1,o.getType()){case"MultiLineString":i[f.depth[0]].length>2&&(i[f.depth[0]].splice(d,1),s=!0);break;case"LineString":i.length>2&&(i.splice(d,1),s=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.depth[0]],n.length>4&&(d==n.length-1&&(d=0),n.splice(d,1),s=!0,d===0&&(n.pop(),n.push(n[0]),g=n.length-1));break}if(s){this.setGeometryCoordinates_(o,i);const v=[];if(c!==void 0&&(this.rBush_.remove(c),v.push(c.segment[0])),h!==void 0&&(this.rBush_.remove(h),v.push(h.segment[1])),c!==void 0&&h!==void 0){const S={depth:f.depth,feature:f.feature,geometry:f.geometry,index:g,segment:v};this.rBush_.insert(T(S.segment),S)}this.updateSegmentIndices_(o,d,f.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return s}canInsertPoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(s=>s.getType()==="Circle"||s.getType().endsWith("Point")))return!1;const e=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(T([e])).some(({segment:s})=>!(A(s[0],e)||A(s[1],e)))}insertPoint(e){const t=e?F(e,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();return t?this.findInsertVerticesAndUpdateDragSegments_(t).reduce((n,i)=>n||this.insertVertex_(i,t),!1):!1}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,s,n){this.rBush_.forEachInExtent(e.getExtent(),function(i){i.geometry===e&&(s===void 0||i.depth===void 0||vs(i.depth,s))&&i.index>t&&(i.index+=n)})}}function on(r,e){return r.index-e.index}function dt(r,e,t){const s=e.geometry;if(s.getType()==="Circle"){let i=s;if(e.index===re){const a=De(i.getCenter(),F(r)),o=Math.sqrt(a)-i.getRadius();return o*o}}const n=F(r);return q[0]=F(e.segment[0]),q[1]=F(e.segment[1]),xs(n,q)}function ut(r,e,t){const s=e.geometry;if(s.getType()==="Circle"&&e.index===re)return Se(s.getClosestPoint(F(r)));const n=F(r);return q[0]=F(e.segment[0]),q[1]=F(e.segment[1]),Se(Ss(n,q))}function an(){const r=xt();return function(e,t){return r.Point}}const ln={SELECT:"select"};class cn extends wt{constructor(e,t,s,n){super(e),this.selected=t,this.deselected=s,this.mapBrowserEvent=n}}const ye={};class Rt extends ws{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=e.condition?e.condition:St,this.addCondition_=e.addCondition?e.addCondition:et,this.removeCondition_=e.removeCondition?e.removeCondition:et,this.toggleCondition_=e.toggleCondition?e.toggleCondition:bs,this.multi_=e.multi?e.multi:!1,this.filter_=e.filter?e.filter:tt,this.hitTolerance_=e.hitTolerance?e.hitTolerance:0,this.style_=e.style!==void 0?e.style:dn(),this.features_=e.features||new ve;let t;if(e.layers)if(typeof e.layers=="function")t=e.layers;else{const s=e.layers;t=function(n){return s.includes(n)}}else t=tt;this.layerFilter_=t,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(e,t){this.featureLayerAssociation_[P(e)]=t}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(e){return this.featureLayerAssociation_[P(e)]}setHitTolerance(e){this.hitTolerance_=e}setMap(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(e),e?(this.features_.addEventListener(K.ADD,this.boundAddFeature_),this.features_.addEventListener(K.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(K.ADD,this.boundAddFeature_),this.features_.removeEventListener(K.REMOVE,this.boundRemoveFeature_))}addFeature_(e){const t=e.element;if(this.style_&&this.applySelectedStyle_(t),!this.getLayer(t)){const s=this.getMap().getAllLayers().find(function(n){if(n instanceof ee&&n.getSource()&&n.getSource().hasFeature(t))return n});s&&this.addFeatureLayerAssociation_(t,s)}}removeFeature_(e){this.style_&&this.restorePreviousStyle_(e.element)}getStyle(){return this.style_}applySelectedStyle_(e){const t=P(e);t in ye||(ye[t]=e.getStyle()),e.setStyle(this.style_)}restorePreviousStyle_(e){const t=this.getMap().getInteractions().getArray();for(let n=t.length-1;n>=0;--n){const i=t[n];if(i!==this&&i instanceof Rt&&i.getStyle()&&i.getFeatures().getArray().lastIndexOf(e)!==-1){e.setStyle(i.getStyle());return}}const s=P(e);e.setStyle(ye[s]),delete ye[s]}removeFeatureLayerAssociation_(e){delete this.featureLayerAssociation_[P(e)]}handleEvent(e){if(!this.condition_(e))return!0;const t=this.addCondition_(e),s=this.removeCondition_(e),n=this.toggleCondition_(e),i=!t&&!s&&!n,a=e.map,o=this.getFeatures(),l=[],d=[];if(i){Ms(this.featureLayerAssociation_),a.forEachFeatureAtPixel(e.pixel,(c,g)=>{if(!(!(c instanceof Z)||!this.filter_(c,g)))return this.addFeatureLayerAssociation_(c,g),d.push(c),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=o.getLength()-1;c>=0;--c){const g=o.item(c),h=d.indexOf(g);h>-1?d.splice(h,1):(o.remove(g),l.push(g))}d.length!==0&&o.extend(d)}else{a.forEachFeatureAtPixel(e.pixel,(c,g)=>{if(!(!(c instanceof Z)||!this.filter_(c,g)))return(t||n)&&!o.getArray().includes(c)?(this.addFeatureLayerAssociation_(c,g),d.push(c)):(s||n)&&o.getArray().includes(c)&&(l.push(c),this.removeFeatureLayerAssociation_(c)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=l.length-1;c>=0;--c)o.remove(l[c]);o.extend(d)}return(d.length>0||l.length>0)&&this.dispatchEvent(new cn(ln.SELECT,d,l,e)),!0}}function dn(){const r=xt();return st(r.Polygon,r.LineString),st(r.GeometryCollection,r.LineString),function(e){return e.getGeometry()?r[e.getGeometry().getType()]:null}}async function un(r,e,t,s){const i=s.getCode().replace("EPSG:","http://www.opengis.net/def/crs/EPSG/0/"),a=await r.fetch(e,{method:"POST",body:JSON.stringify({type:"Feature",properties:{},geometry:t}),headers:{"Content-Type":"application/geo+json; charset=utf-8","Content-Crs":`<${i}>`}});if(!a||!a.ok||a.status!==201)throw new Error("Request failed: "+a.status);const o=a.headers.get("location");if(!o)throw new Error("Request failed: no Location response header");const l=o.substring(o.lastIndexOf("/")+1);return Promise.resolve(l)}async function hn(r,e,t,s,n){const a=n.getCode().replace("EPSG:","http://www.opengis.net/def/crs/EPSG/0/"),o=new URL(`${e.toString()}/${t}`),l=await r.fetch(o,{method:"PATCH",body:JSON.stringify({type:"Feature",properties:{},geometry:s}),headers:{"Content-Type":"application/geo+json; charset=utf-8","Content-Crs":`<${a}>`}});if(!l||!l.ok||l.status!==204)throw new Error("Request failed: "+l.status);return Promise.resolve(t)}function Gt(r,e){const t=document.createElement("div");t.className="editing-tooltip editing-tooltip-hidden",t.role="tooltip";const s=document.createElement("span");s.textContent=e,t.appendChild(s);const n=new Ie({element:t,offset:[15,0],positioning:"center-left"}),i=r.on("pointermove",a=>{a.dragging||n.setPosition(a.coordinate)});return r.addOverlay(n),{destroy(){R(i),r.removeOverlay(n)},setVisible(a){t.classList.toggle("editing-tooltip-hidden",!a)},setText(a){s.textContent=a}}}function Vt(r){let e=ht(r.polygon);Array.isArray(e)&&(e=e[0]);let t=ht(r.vertex);Array.isArray(t)&&(t=t[0]);const s=[];return e&&s.push(e),t&&(t.setGeometry(gn),s.push(t)),s}const gn=r=>{if(r){const e=r.getGeometry();if(e&&e.getType()==="Polygon"){const t=e.getCoordinates()[0];if(t)return new Us(t)}}},ht=r=>{const e=new Z,s=new ee({style:r}).getStyleFunction();if(!s)throw new Error("can't retrieve style function");const n=s(e,1);if(!n)throw new Error("can't retrieve styles from feature style function");return Array.isArray(n)&&n.length?n.length>1?n:n[0]:n},fn=fe("editing:EditingCreateWorkflowImpl");var D;class mn{constructor(e){x(this,D);y(this,"_httpService");y(this,"_intl");y(this,"_map");y(this,"_polygonStyle");y(this,"_vertexStyle");y(this,"_state");y(this,"_editLayerURL");y(this,"_featureId");y(this,"_editingSource");y(this,"_editingLayer");y(this,"_drawInteraction");y(this,"_olMap");y(this,"_tooltip");y(this,"_enterHandler");y(this,"_escapeHandler");y(this,"_error");y(this,"_interactionListener");y(this,"_mapListener");this._httpService=e.httpService,this._intl=e.intl,this._polygonStyle=e.polygonStyle,this._vertexStyle=e.vertexStyle,this._map=e.map,this._olMap=e.map.olMap,this._state=Be("active:initialized"),this._editLayerURL=e.ogcApiFeatureLayerUrl,this._editingSource=new Fe,this._editingLayer=new ee({source:this._editingSource,zIndex:$e,properties:{name:"editing-layer"}}),this._drawInteraction=new At({source:this._editingSource,type:"Polygon",style:Vt({polygon:this._polygonStyle,vertex:this._vertexStyle})}),this._tooltip=Gt(this._olMap,this._intl.formatMessage({id:"create.tooltip.begin"})),this._enterHandler=t=>{if((t.code==="Enter"||t.code==="NumpadEnter")&&t.target===this._olMap.getTargetElement()){const s=this._drawInteraction.getOverlay().getSource()?.getFeatures()??[];s[0]&&s[0].getGeometry().getCoordinates()[0].length>4&&this.triggerSave()}},this._escapeHandler=t=>{t.code==="Escape"&&t.target===this._olMap.getTargetElement()&&this.reset()},this._interactionListener=[],this._mapListener=[],this._start()}getDrawInteraction(){return this._drawInteraction}getState(){return this._state.value}_setState(e){this._state.value=e}_save(e){this._setState("active:saving");const t=this._editLayerURL,s=e.getGeometry();if(!s){this._destroy(),this._error=new Error("no geometry available"),_(this,D)?.reject(this._error);return}const n=this._olMap.getView().getProjection(),a=new Tt({dataProjection:n}).writeGeometryObject(s,{rightHanded:!0,decimals:10});this._olMap.removeInteraction(this._drawInteraction),this._tooltip.destroy(),un(this._httpService,t,a,n).then(o=>{this._featureId=o,this._destroy(),_(this,D)?.resolve({featureId:this._featureId})}).catch(o=>{fn.error(o),this._destroy(),this._error=new Error("Failed to save feature",{cause:o}),_(this,D)?.reject(this._error)})}_start(){this._olMap.addLayer(this._editingLayer),this._olMap.addInteraction(this._drawInteraction);const e=bt(()=>{const n=this._map.container;if(n)return n.addEventListener("keydown",this._enterHandler,!1),n.addEventListener("keydown",this._escapeHandler,!1),()=>{n.removeEventListener("keydown",this._enterHandler),n.removeEventListener("keydown",this._escapeHandler)}});this._tooltip.setVisible(!0);const t=this._drawInteraction.on("drawstart",()=>{this._setState("active:drawing"),this._tooltip.setText(this._intl.formatMessage({id:"create.tooltip.continue"}))}),s=this._drawInteraction.on("drawend",n=>{const i=n.feature;if(!i){this._destroy(),this._error=new Error("no feature available"),_(this,D)?.reject(this._error);return}this._save(i)});this._interactionListener.push(t,s),this._mapListener.push(e)}reset(){this._drawInteraction.abortDrawing(),this._tooltip.setText(this._intl.formatMessage({id:"create.tooltip.begin"})),this._setState("active:initialized")}stop(){this._destroy(),_(this,D)?.resolve(void 0)}_destroy(){this._olMap.removeLayer(this._editingLayer),this._olMap.removeInteraction(this._drawInteraction),this._tooltip.destroy(),this._interactionListener.forEach(e=>{R(e)}),this._mapListener.forEach(e=>{e.destroy()}),this._setState("destroyed")}triggerSave(){this._drawInteraction.finishDrawing()}whenComplete(){return this._state.value==="destroyed"?this._error?Promise.reject(this._error):this._featureId?Promise.resolve({featureId:this._featureId}):Promise.resolve(void 0):(_(this,D)??b(this,D,Pt())).promise}}D=new WeakMap;var O;class pn{constructor(e){x(this,O);y(this,"_httpService");y(this,"_intl");y(this,"_map");y(this,"_polygonStyle");y(this,"_vertexStyle");y(this,"_state");y(this,"_editLayerURL");y(this,"_featureId");y(this,"_initialFeature");y(this,"_editFeature");y(this,"_editingSource");y(this,"_editingLayer");y(this,"_modifyInteraction");y(this,"_olMap");y(this,"_tooltip");y(this,"_enterHandler");y(this,"_escapeHandler");y(this,"_error");y(this,"_interactionListener");y(this,"_mapListener");this._httpService=e.httpService,this._intl=e.intl,this._polygonStyle=e.polygonStyle,this._vertexStyle=e.vertexStyle,this._map=e.map,this._olMap=e.map.olMap,this._state=Be("active:initialized"),this._editLayerURL=e.ogcApiFeatureLayerUrl,this._initialFeature=e.feature.clone(),this._initialFeature.setId(e.feature.getId()),this._editFeature=e.feature.clone(),this._editFeature.setId(e.feature.getId()),this._editFeature.setStyle(Vt({polygon:this._polygonStyle,vertex:this._vertexStyle})),this._editingSource=new Fe({features:new ve([this._editFeature])}),this._editingLayer=new ee({source:this._editingSource,zIndex:$e,properties:{name:"editing-layer"}}),this._modifyInteraction=new rn({source:this._editingSource}),this._tooltip=Gt(this._olMap,this._intl.formatMessage({id:"create.tooltip.deselect"})),this._enterHandler=t=>{if((t.code==="Enter"||t.code==="NumpadEnter")&&t.target===this._olMap.getTargetElement()){const s=this._editingSource.getFeatures()[0];if(!s)throw Error("no updated feature found");this._save(s)}},this._escapeHandler=t=>{t.code==="Escape"&&t.target===this._olMap.getTargetElement()&&this.reset()},this._interactionListener=[],this._mapListener=[],this._start()}getModifyInteraction(){return this._modifyInteraction}getState(){return this._state.value}_setState(e){this._state.value=e}_save(e){this._setState("active:saving");const t=this._editLayerURL;if(this._featureId=e.getId()?.toString(),!this._featureId){this._destroy(),this._error=new Error("no feature id available"),_(this,O)?.reject(this._error);return}const s=e?.getGeometry();if(!s){this._destroy(),this._error=new Error("no geometry available"),_(this,O)?.reject(this._error);return}const n=this._olMap.getView().getProjection(),a=new Tt({dataProjection:n}).writeGeometryObject(s,{rightHanded:!0,decimals:10});this._olMap.removeInteraction(this._modifyInteraction),this._tooltip.destroy(),hn(this._httpService,t,this._featureId,a,n).then(o=>{this._destroy(),_(this,O)?.resolve({featureId:o})}).catch(o=>{this._destroy(),this._error=new Error("Failed to save feature",{cause:o}),_(this,O)?.reject(this._error)})}_start(){this._olMap.addLayer(this._editingLayer),this._olMap.addInteraction(this._modifyInteraction);const e=this._editingSource.getFeatures()[0];if(e&&!e.getId()?.toString()){this._destroy(),this._error=new Error("no feature id available"),_(this,O)?.reject(this._error);return}const t=bt(()=>{const i=this._map.container;if(i)return i.addEventListener("keydown",this._enterHandler,!1),i.addEventListener("keydown",this._escapeHandler,!1),()=>{i.removeEventListener("keydown",this._enterHandler),i.removeEventListener("keydown",this._escapeHandler)}});this._tooltip.setVisible(!0);const s=this._map.olMap.on("click",i=>{const a=i.coordinate,o=i.originalEvent.altKey,l=this._editingSource.getFeaturesAtCoordinate(a);o||l.length===0&&this.triggerSave()}),n=this._modifyInteraction.on("modifystart",()=>{this._setState("active:drawing")});this._interactionListener.push(s,n),this._mapListener.push(t)}reset(){const e=this._initialFeature.getGeometry()?.clone(),t=this._editingSource.getFeatures()[0];if(!t)throw Error("no updated feature found");t.setGeometry(e),this._setState("active:initialized")}stop(){this._destroy(),_(this,O)?.resolve(void 0)}_destroy(){this._editingSource.clear(),this._olMap.removeLayer(this._editingLayer),this._olMap.removeInteraction(this._modifyInteraction),this._tooltip.destroy(),this._interactionListener.forEach(e=>{R(e)}),this._mapListener.forEach(e=>{e.destroy()}),this._setState("destroyed")}triggerSave(){const e=this._editingSource.getFeatures()[0];if(!e)throw Error("no updated feature found");this._save(e)}whenComplete(){return this._state.value==="destroyed"?this._error?Promise.reject(this._error):this._featureId?Promise.resolve({featureId:this._featureId}):Promise.resolve(void 0):(_(this,O)??b(this,O,Pt())).promise}}O=new WeakMap;class Qi{_serviceOptions;_workflows;constructor(e){this._serviceOptions=e,this._workflows=new Map}createFeature(e,t){if(!t||!e||!e.id)throw new Error("Map, mapId or url is undefined.");const s=e.id;let n=this._workflows.get(s);if(n)throw new Error("EditingWorkflow could not be started. EditingWorkflow already in progress for this map.");return n=new mn({map:e,ogcApiFeatureLayerUrl:t,polygonStyle:this._serviceOptions.properties.polygonStyle,vertexStyle:this._serviceOptions.properties.vertexStyle,httpService:this._serviceOptions.references.httpService,intl:this._serviceOptions.intl}),this._workflows.set(s,n),this._connectToWorkflowDestroyEvent(n,s),n}updateFeature(e,t,s){if(!t||!e||!e.id)throw new Error("Map, mapId or url is undefined.");const n=e.id;let i=this._workflows.get(n);if(i)throw new Error("EditingWorkflow could not be started. EditingWorkflow already in progress for this map.");return i=new pn({map:e,ogcApiFeatureLayerUrl:t,feature:s,polygonStyle:this._serviceOptions.properties.polygonStyle,vertexStyle:this._serviceOptions.properties.vertexStyle,httpService:this._serviceOptions.references.httpService,intl:this._serviceOptions.intl}),this._workflows.set(n,i),this._connectToWorkflowDestroyEvent(i,n),i}stop(e){const t=this._workflows.get(e);t&&t.stop()}reset(e){const t=this._workflows.get(e);if(t)t.reset();else throw new Error("No workflow found for mapId: "+e)}_connectToWorkflowDestroyEvent(e,t){const s=Es(()=>[e.getState()],([n])=>{n==="destroyed"&&(this._workflows.get(t)===e&&this._workflows.delete(t),s.destroy())})}}var W,V,oe,ae,le,He;class yn{constructor(e,t,s){x(this,le);y(this,"label");x(this,W,Be({kind:"available"}));x(this,V);x(this,oe);x(this,ae);this.label=t,b(this,V,e),b(this,ae,s),te(this,le,He).call(this),b(this,oe,_(this,V).on("change:visible",()=>{te(this,le,He).call(this)}))}destroy(){R(_(this,oe))}get status(){return _(this,W).value}async select(e,t){if(e.type!=="extent")throw new Error(`Unsupported selection kind: ${e.type}`);if(_(this,W).value.kind!=="available"||_(this,V).getSource()===null)return[];const s=[];_(this,V).getSource().forEachFeatureIntersectingExtent(e.extent,a=>{if(!a.getGeometry())return;const o={...a.getProperties()};delete o.geometries;const l={id:a.getId()?.toString()||Cs(),geometry:a.getGeometry(),properties:o};s.push(l)});const n=s.filter(a=>a!=null);return n.length>t.maxResults?n.slice(0,t.maxResults):n}}W=new WeakMap,V=new WeakMap,oe=new WeakMap,ae=new WeakMap,le=new WeakSet,He=function(){const t=_(this,V).getVisible()?{kind:"available"}:{kind:"unavailable",reason:_(this,ae)};t.kind!==_(this,W).value.kind&&(_(this,W).value=t)};var ce;class er{constructor({intl:e}){x(this,ce);b(this,ce,e)}createSelectionSource(e){return new yn(e.vectorLayer,e.label,_(this,ce).formatMessage({id:"layerNotVisibleReason"}))}}ce=new WeakMap;const _n="@open-pioneer/notifier",vn=Ue.bind(void 0,_n),Sn=Ot({d:"M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z",displayName:"SearchIcon"}),Ht=Ot({displayName:"WarningTwoIcon",d:"M23.119,20,13.772,2.15h0a2,2,0,0,0-3.543,0L.881,20a2,2,0,0,0,1.772,2.928H21.347A2,2,0,0,0,23.119,20ZM11,8.423a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Zm1.05,11.51h-.028a1.528,1.528,0,0,1-1.522-1.47,1.476,1.476,0,0,1,1.448-1.53h.028A1.527,1.527,0,0,1,13.5,18.4,1.475,1.475,0,0,1,12.05,19.933Z"}),xn=!1;function tr(r){const{position:e="top-right"}=r,t=nn(),s=vn("notifier.NotificationService"),[n,i]=p.useState(!xn),a=H(l=>{const d=l.level==="error"?u.jsx(Ht,{h:"100%",w:"100%"}):void 0;t({position:e,title:l.title,description:l.message||null,status:l.level,isClosable:!0,duration:l.displayDuration??null,icon:d})}),o=H(()=>{t.closeAll()});return p.useEffect(()=>{const l=s.registerHandler({showNotification:a,closeAll:o});return()=>l.destroy()},[n,s,a,o]),u.jsx(u.Fragment,{})}const wn="@open-pioneer/coordinate-viewer",bn=z.bind(void 0,wn),Mn=4,En="decimal",sr=r=>{const{precision:e,displayProjectionCode:t,format:s}=r,{containerProps:n}=B("coordinate-viewer",r),{map:i}=$(r),a=i?.olMap,o=U(()=>i?.projection.getCode()??"",[i]);let{coordinates:l}=Pn(a);l=l&&t?Ln(l,o,t):l;const d=Cn(l,e,s),c=t||o,g=d?d+" "+c:"";return u.jsx(L,{...n,children:u.jsx(Q,{className:"coordinate-viewer-text",children:g})})};function Cn(r,e,t){const s=bn();return r?Fn(r,e,s,t):""}function Pn(r){const[e,t]=p.useState();return p.useEffect(()=>{if(!r)return;const s=r.on("pointermove",n=>{t(n.coordinate)});return()=>R(s)},[r]),{coordinates:e}}function Fn(r,e,t,s){if(r[0]==null||r[1]==null)return"";const n=e??Mn,i=s??En,[a,o]=r;let l;if(i==="degree"&&isFinite(a)&&isFinite(o)){const[d,c,g]=gt(a,t,n),[h,f,m]=gt(o,t,n),v=`${Math.abs(d)}°${c}'${g}"${0<=d?"(E)":"(W)"}`,S=`${Math.abs(h)}°${f}'${m}"${0<=h?"(N)":"(S)"}`;l=v+" "+S}else{const d=t.formatNumber(a,{maximumFractionDigits:n,minimumFractionDigits:n}),c=t.formatNumber(o,{maximumFractionDigits:n,minimumFractionDigits:n});l=d+" "+c}return l}function gt(r,e,t){const s=Math.floor(r),n=r-s,i=Math.floor(60*n),o=60*(60*n-i),l=e.formatNumber(o,{maximumFractionDigits:t,minimumFractionDigits:t});return[s,i,l]}function Ln(r,e,t){return Ps(r,e,t)}const nr=r=>{const{displayMode:e="line"}=r,{containerProps:t}=B("scale-bar",r),{map:s}=$(r),n=p.useRef(null);return p.useEffect(()=>{if(n.current&&s){const i=s.olMap,a=new Ws({units:"metric",target:n.current,bar:e==="bar"});return i.addControl(a),()=>{i.removeControl(a)}}},[e,s]),u.jsx(L,{...t,ref:n})},In="@open-pioneer/scale-viewer",Tn=z.bind(void 0,In),ir=r=>{const{containerProps:e}=B("scale-viewer",r),{map:t}=$(r),s=Tn(),n=U(()=>t?.scale??1,[t]),i=n?s.formatNumber(n):void 0;return u.jsx(L,{...e,children:i&&u.jsxs(Q,{children:["1:",i]})})},An="@open-pioneer/legend",Bt=z.bind(void 0,An),rr=r=>{const{showBaseLayers:e=!1}=r,{containerProps:t}=B("legend",r),{map:s}=$(r);return u.jsx(L,{...t,children:s?u.jsx(Nn,{map:s,showBaseLayers:e}):null})};function Nn(r){const{map:e,showBaseLayers:t}=r,n=jn(e).map(i=>u.jsx($t,{layer:i,showBaseLayers:t},i.id));return u.jsx(Ys,{as:"ul",className:"legend-layer-list",listStyleType:"none",spacing:2,children:n})}function $t(r){const{layer:e,showBaseLayers:t}=r,s=U(()=>e.visible,[e]),n=kn(e);if(!s||!t&&$s(e)&&Ut(e))return;const i=[];return n?.length&&n.forEach(a=>{i.push(u.jsx($t,{layer:a,showBaseLayers:t},a.id))}),u.jsxs(u.Fragment,{children:[u.jsx(On,{layer:e,showBaseLayers:t}),i]})}function On(r){const e=Bt(),{layer:t,showBaseLayers:s}=r,n=Ut(t),i=Dn(t),a=U(()=>t.legend,[t]);let o;return i?.Component?o=u.jsx(i.Component,{layer:t}):i?.imageUrl?o=u.jsx(ft,{layer:t,imageUrl:i.imageUrl}):a&&(o=u.jsx(ft,{layer:t,imageUrl:a})),o?u.jsxs(L,{as:"li",className:Le("legend-item",`layer-${Rn(t.id)}`),children:[s&&n?u.jsx(Q,{as:"b",children:e.formatMessage({id:"basemapLabel"})}):null,o]}):void 0}function ft(r){const e=Bt(),{layer:t,imageUrl:s}=r;return u.jsxs(L,{children:[u.jsx(Q,{children:t.title}),u.jsx(zs,{maxW:"none",maxH:"none",src:s,alt:e.formatMessage({id:"altLabel"},{layerName:t.title}),className:"legend-item__image",fallbackStrategy:"onError",fallback:u.jsx(L,{children:u.jsxs(Q,{children:[u.jsx(Ht,{me:2}),e.formatMessage({id:"fallbackLabel"})]})})})]})}function jn(r){return U(()=>{const e=r.layers.getAllLayers({sortByDisplayOrder:!0})??[];return e.reverse(),e},[r])}function kn(r){return U(()=>{const e=r.sublayers?.getSublayers({sortByDisplayOrder:!0});if(e)return e.reverse(),e},[r])}function Dn(r){return U(()=>r.attributes.legend,[r])}function Ut(r){return!("parentLayer"in r)&&r.isBaseLayer}function Rn(r){return r.toLowerCase().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}const Gn="@open-pioneer/measurement",Vn=z.bind(void 0,Gn);class Hn{olMap;messages;activeFeatureStyle;layer;source;draw=void 0;activeMeasurement;predefinedMeasurements=new Map;finishedMeasurements=new Set;helpTooltip;resources=[];measurementChangedHandler;constructor(e,t){this.olMap=e,this.messages=t;const s=this.source=new Fe;this.layer=new ee({source:s,zIndex:$e,properties:{name:"measurement-layer"}}),e.addLayer(this.layer);const n=e.on("pointermove",this.handlePointerMove.bind(this));this.resources.push({destroy(){R(n)}});const i=()=>{this.helpTooltip.element.classList.add("hidden")};e.getViewport().addEventListener("mouseout",i),this.resources.push({destroy(){e.getViewport().removeEventListener("mouseout",i)}}),this.helpTooltip=$n(this.olMap)}destroy(){this.stopMeasurement();for(const e of this.resources)e.destroy();this.resources=[],this.activeMeasurement=at(this.activeMeasurement);for(const e of this.finishedMeasurements)e.destroy();this.finishedMeasurements.clear(),this.helpTooltip.destroy(),this.olMap.removeLayer(this.layer),this.layer.dispose(),this.source.dispose(),this.measurementChangedHandler=void 0,this.predefinedMeasurements.clear()}getVectorLayer(){return this.layer}setFinishedFeatureStyle(e){this.layer.setStyle(e)}setMeasurementSourceChangedHandler(e){this.measurementChangedHandler=e}setPredefinedMeasurements(e){this.updatePredefinedMeasurements(e)}setActiveFeatureStyle(e){const t=Fs(e);this.activeFeatureStyle=(s,...n)=>{const i=s?.getGeometry()?.getType();if(i==="Polygon"||i==="LineString"||i==="Point")return t(s,...n)},this.draw?.getOverlay().setStyle(this.activeFeatureStyle)}clearMeasurements(){const e=this.source.getFeatures();this.source.clear(),e.forEach(t=>{this.raiseMeasurementsChangeEvent("remove-measurement",t)}),this.predefinedMeasurements.clear();for(const t of this.finishedMeasurements)t.destroy();this.finishedMeasurements.clear()}startMeasurement(e){if(this.draw)throw new Error("Internal error: another measurement interaction is still active.");const t=e==="area"?"Polygon":"LineString",s=this.draw=new At({source:this.source,type:t,style:this.activeFeatureStyle});this.olMap.addInteraction(s);let n,i;s.on("drawstart",a=>{const o=a.feature;o&&(n=this.activeMeasurement=new mt("active",o,this),i=o.getGeometry()?.on("change",()=>{n?.updateTooltipContent(),n?.updateTooltipPosition()}))}),s.on("drawend",()=>{if(n&&n===this.activeMeasurement){const a=n;a.updateState("finished"),this.finishedMeasurements.add(a),this.raiseMeasurementsChangeEvent("add-measurement",a.feature),this.activeMeasurement=n=void 0}n=void 0,i&&R(i)}),s.on("drawabort",()=>{n&&(n.destroy(),n===this.activeMeasurement&&(this.activeMeasurement=void 0),n=void 0),i&&R(i)})}stopMeasurement(){this.draw&&(this.olMap.removeInteraction(this.draw),this.draw.abortDrawing(),this.draw.dispose(),this.draw=void 0),this.activeMeasurement=at(this.activeMeasurement)}handlePointerMove(e){if(e.dragging)return;const t=this.helpTooltip,s=Wn(this.messages,this.activeMeasurement);t.setText(s),t.overlay.setPosition(e.coordinate),t.element.classList.remove("hidden")}updatePredefinedMeasurements(e){const t=e.filter(n=>!this.predefinedMeasurements.has(n)),s=[];for(const n of this.predefinedMeasurements.keys())e.includes(n)||s.push(n);t.forEach(n=>{const i=new Z(n);this.source.addFeature(i);const a=new mt("finished",i,this);this.finishedMeasurements.add(a),this.predefinedMeasurements.set(n,a),this.raiseMeasurementsChangeEvent("add-measurement",i)}),s.forEach(n=>{const i=this.predefinedMeasurements.get(n);i&&(this.source.removeFeature(i.feature),this.finishedMeasurements.delete(i),i.destroy(),this.raiseMeasurementsChangeEvent("remove-measurement",i.feature)),this.predefinedMeasurements.delete(n)})}raiseMeasurementsChangeEvent(e,t){const s=t.getGeometry();this.measurementChangedHandler&&s&&this.measurementChangedHandler({kind:e,geometry:(s instanceof xe,s)})}}class mt{controller;feature;_state;tooltip;constructor(e,t,s){this.controller=s,this._state=e,this.feature=t,this.tooltip=Un(this.olMap),this.updateTooltipContent(),this.updateTooltipPosition(),this.tooltip.setActive(e==="active")}destroy(){this.tooltip.destroy()}get state(){return this._state}updateState(e){this._state!==e&&(this._state=e,this.tooltip.setActive(e==="active"))}updateTooltipContent(){const e=this.feature.getGeometry();if(!e)return;const t=this.olMap.getView().getProjection();let s;e instanceof xe?s=zn(e,t,this.messages):e instanceof Ge&&(s=Kn(e,t,this.messages)),s&&this.tooltip.setHtml(s)}updateTooltipPosition(){const e=this.feature.getGeometry();if(!e)return;let t;if(e instanceof xe)t=e.getInteriorPoint().getCoordinates()||null;else if(e instanceof Ge)t=e.getLastCoordinate()||null;else return;this.tooltip.overlay.setPosition(t)}get olMap(){return this.controller.olMap}get messages(){return this.controller.messages}}const pt=[0,-15],Bn=[0,-7];function $n(r){const e=document.createElement("div");e.className="measurement-tooltip printing-hide hidden",e.role="tooltip";const t=document.createElement("span");e.appendChild(t);const s=new Ie({element:e,offset:[15,0],positioning:"center-left"});return r.addOverlay(s),{overlay:s,element:e,destroy(){r.removeOverlay(s)},setText(n){t.textContent=n},setHtml(n){t.innerHTML=n}}}function Un(r){const e=document.createElement("div");e.role="tooltip",e.className="measurement-tooltip measurement-active-tooltip printing-hide";const t=document.createElement("span");e.appendChild(t);const s=new Ie({element:e,offset:pt,positioning:"bottom-center",stopEvent:!1,insertFirst:!1});return r.addOverlay(s),{overlay:s,element:e,destroy(){r.removeOverlay(s)},setActive(n){n?(e.className="measurement-tooltip measurement-active-tooltip printing-hide",s.setOffset(pt)):(e.className="measurement-tooltip measurement-finished-tooltip",s.setOffset(Bn))},setText(n){t.textContent=n},setHtml(n){t.innerHTML=n}}}function Wn(r,e){if(e){const t=e.feature.getGeometry();if(t instanceof xe||t instanceof Ge)return r.getContinueMessage()}return r.getHelpMessage()}function zn(r,e,t){const s=Ls(r,{projection:e});let n;return s>=1e6?n=`${t.formatNumber(s/1e6)} km2`:n=`${t.formatNumber(s)} m2`,n}function Kn(r,e,t){const s=Is(r,{projection:e});let n;return s>=1e3?n=`${t.formatNumber(s/1e3)} km`:n=`${t.formatNumber(s)} m`,n}const or=r=>{const e=Vn(),{containerProps:t}=B("measurement",r),[s,n]=p.useState("distance"),i=c=>e.formatMessage({id:c}),a=$(r),o=qn(a.map,r,e);p.useEffect(()=>{if(o)return o.startMeasurement(s),()=>{o.stopMeasurement()}},[o,s]);function l(c){if(c==="distance"||c==="area")n(c);else throw new Error(`Unexpected measurement type: '${c}'.`)}function d(){o?.clearMeasurements()}return u.jsxs(L,{...t,children:[u.jsx(Q,{mb:3,children:e.formatMessage({id:"measurementInfoText"})}),u.jsx(be,{mb:4,alignItems:"center",children:u.jsxs(Ve,{mb:2,children:[u.jsx(Me,{mb:1,children:i("measurementLabel")}),u.jsxs(Ke,{value:s,onChange:c=>l(c.target.value),className:"measurement-select",children:[u.jsx("option",{value:"distance",children:i("distance")}),u.jsx("option",{value:"area",children:i("area")})]})]})}),u.jsx(Ft,{padding:2,className:"measurement-delete-button",onClick:d,width:"100%",children:i("deleteMeasurementLabel")})]})};function qn(r,e,t){const{activeFeatureStyle:s,finishedFeatureStyle:n,onMeasurementsChange:i,predefinedMeasurements:a}=e,[o,l]=p.useState(void 0);return p.useEffect(()=>{if(!r)return;const d=new Hn(r.olMap,{getContinueMessage(){return t.formatMessage({id:"tooltips.continue"})},getHelpMessage(){return t.formatMessage({id:"tooltips.help"})},formatNumber(c){return t.formatNumber(c,{maximumFractionDigits:2})}});return l(d),()=>{d.destroy(),l(void 0)}},[r,t]),p.useEffect(()=>{o?.setActiveFeatureStyle(s??Yn())},[o,s]),p.useEffect(()=>{o?.setFinishedFeatureStyle(n??Jn())},[o,n]),p.useEffect(()=>{o?.setMeasurementSourceChangedHandler(i)},[o,i]),p.useEffect(()=>{o?.setPredefinedMeasurements(a??[])},[o,a]),o}function Yn(){return[new we({stroke:new ie({color:"#fff",lineDash:[10,10],width:5})}),new we({fill:new Re({color:"rgba(0,0,0,0.15)"}),stroke:new ie({color:"rgba(0, 0, 0, 0.7)",lineDash:[10,10],width:3}),image:new Ts({radius:5,stroke:new ie({color:"rgba(0, 0, 0, 0.7)",width:2}),fill:new Re({color:"rgba(255, 255, 255, 0.2)"})})})]}function Jn(){return[new we({stroke:new ie({color:"#fff",width:5})}),new we({stroke:new ie({color:"#0b96fc",width:3}),fill:new Re({color:"rgba(11,150,252,0.15)"})})]}const Xn="@open-pioneer/search",Te=z.bind(void 0,Xn);function Zn(r){const e=r.selectProps.inputValue.length>0,t={...r,className:Le(r.className,{"search-invisible":!e})};return u.jsx(k.Menu,{...t,children:r.children})}function Qn(r){const e=r.data.label,t={...r.innerProps,"aria-label":e,role:"group"};return u.jsx(k.Group,{...r,innerProps:t})}function ei(r){const t=Te().formatMessage({id:"noOptionsText"});return u.jsx(k.NoOptionsMessage,{...r,children:u.jsx(G.span,{className:"search-no-match",children:t})})}function ti(r){const t=Te().formatMessage({id:"loadingText"});return u.jsx(k.LoadingMessage,{...r,children:u.jsx(G.span,{className:"search-loading-text",children:t})})}function si({children:r,...e}){const t={...e,className:Le(e.className,"search-value-container")};return u.jsxs(k.ValueContainer,{...t,children:[!!r&&u.jsx(Sn,{style:{position:"absolute",left:8}}),r]})}function ni(r){const e={...r,isHidden:!1};return u.jsx(k.Input,{...e})}function ii(r){return null}function ri(r){return u.jsxs(k.IndicatorsContainer,{...r,children:[r.children,!r.selectProps.isLoading&&r.selectProps.inputValue&&u.jsx(oi,{selectProps:r.selectProps,clearValue:r.clearValue})]})}function oi(r){const t=Te().formatMessage({id:"ariaLabel.clearButton"}),s=n=>{n.preventDefault(),n.stopPropagation(),r.clearValue()};return u.jsx(Rs,{role:"button",size:"md",mr:1,"aria-label":t,onClick:s,onTouchEnd:s,onMouseDown:n=>n.preventDefault()})}function ai(r){return null}function li(r){const e=r.selectProps.inputValue,t=r.data.label,s={...r,className:Le(r.className,"search-option")};return u.jsx(k.Option,{...s,children:u.jsx(G.div,{className:"search-option-label",children:e.trim().length>0?ci(t,e):t})})}function ci(r,e){const t=r.toLowerCase().indexOf(e.toLowerCase());return t>=0?u.jsxs(u.Fragment,{children:[r.substring(0,t),u.jsx(G.span,{className:"search-highlighted-match",children:r.substring(t,t+e.length)},"highlighted"),r.substring(t+e.length)]}):r}const yt=fe("search:SearchController"),_t=200,vt=5;var de,Y,J,X,j,Ce,Wt;class di{constructor(e,t){x(this,Ce);x(this,de);x(this,Y,[]);x(this,J,vt);x(this,X,_t);x(this,j);b(this,de,e),b(this,Y,t)}destroy(){_(this,j)?.abort(),b(this,j,void 0)}async search(e){if(_(this,j)?.abort(),b(this,j,void 0),!e)return[];const t=b(this,j,new AbortController);try{return await ui(t.signal,_(this,X)),t.signal.aborted&&(yt.debug(`search canceled with ${e}`),Gs()),(await Promise.all(_(this,Y).map(n=>te(this,Ce,Wt).call(this,n,e,t.signal)))).filter(n=>n!=null)}finally{_(this,j)===t&&b(this,j,void 0)}}get searchTypingDelay(){return _(this,X)}set searchTypingDelay(e){b(this,X,e??_t)}get maxResultsPerSource(){return _(this,J)}set maxResultsPerSource(e){b(this,J,e??vt)}get sources(){return _(this,Y)}}de=new WeakMap,Y=new WeakMap,J=new WeakMap,X=new WeakMap,j=new WeakMap,Ce=new WeakSet,Wt=async function(e,t,s){const n=e.label,i=_(this,de).olMap.getView().getProjection();try{const a=_(this,J);let o=await e.search(t,{maxResults:a,signal:s,mapProjection:i});return o.length>a&&(o=o.slice(0,a)),{label:n,source:e,results:o}}catch(a){Lt(a)||yt.error(`search for source ${n} failed`,a);return}};async function ui(r,e){r.aborted||await new Promise(t=>{const s=()=>{r.removeEventListener("abort",s),clearTimeout(n),t()};r.addEventListener("abort",s);const n=setTimeout(s,e)})}const Ee=fe("search:Search"),ar=r=>{const{sources:e,searchTypingDelay:t,maxResultsPerGroup:s,onSelect:n,onClear:i}=r,{containerProps:a}=B("search",r),{map:o}=$(r),l=Te(),d=mi(e,t,s,o),{input:c,search:g,selectedOption:h,onInputChanged:f,onResultConfirmed:m}=pi(d),v=fi(),S=hi(l),I=gi(),N=H((C,me)=>{me.action==="input-change"&&f(C)}),w=H((C,me)=>{switch(me.action){case"select-option":C&&(m(C),n?.({source:C.source,result:C.result}));break;case"clear":f(""),E.current?.blur(),E.current?.focus(),i?.();break;default:Ee.debug(`Unhandled action type '${me.action}'.`);break}}),E=p.useRef(null);return u.jsx(L,{...a,children:u.jsx(Nt,{className:"search-component",classNamePrefix:"react-select",ref:E,inputValue:c,onInputChange:N,"aria-label":l.formatMessage({id:"ariaLabel.search"}),ariaLiveMessages:S,tagColorScheme:"trails",selectedOptionStyle:"color",selectedOptionColorScheme:"trails",chakraStyles:v,isClearable:!0,placeholder:r.placeholder??l.formatMessage({id:"searchPlaceholder"}),closeMenuOnSelect:!0,isLoading:g.kind==="loading",options:g.kind==="ready"?g.results:void 0,filterOption:()=>!0,tabSelectsValue:!1,components:I,onChange:w,value:h,menuPosition:"fixed"})})};function hi(r){return p.useMemo(()=>({onFocus:()=>"",onChange:()=>"",guidance:()=>`${r.formatMessage({id:"ariaLabel.instructions"})}`,onFilter:()=>""}),[r])}function gi(){return p.useMemo(()=>({Menu:Zn,Input:ni,SingleValue:ii,Option:li,NoOptionsMessage:ei,LoadingMessage:ti,ValueContainer:si,IndicatorsContainer:ri,ClearIndicator:ai,Group:Qn}),[])}function fi(){const[r,e]=It("colors",["trails.100","trails.50"],["#d5e5ec","#eaf2f5"]);return p.useMemo(()=>({groupHeading:s=>({...s,backgroundColor:r,padding:"8px 12px",fontSize:"inherit",fontWeight:"inherit"}),option:s=>({...s,backgroundColor:"inherit",_focus:{backgroundColor:e}}),dropdownIndicator:s=>({...s,display:"none"})}),[r,e])}function mi(r,e,t,s){const[n,i]=p.useState(void 0);return p.useEffect(()=>{if(!s)return;const a=new di(s,r);return i(a),()=>{a.destroy(),i(void 0)}},[s,r]),p.useEffect(()=>{n&&(n.searchTypingDelay=e)},[n,e]),p.useEffect(()=>{n&&(n.maxResultsPerSource=t)},[n,t]),n}function pi(r){const[e,t]=p.useReducer((o,l)=>{switch(l.kind){case"input":return{...o,query:l.query,selectedOption:null};case"select-option":return{...o,selectedOption:l.option,query:l.option.label};case"load-results":return{...o,search:{kind:"loading"}};case"accept-results":return{...o,search:{kind:"ready",results:l.results}}}},void 0,()=>({query:"",selectedOption:null,search:{kind:"ready",results:[]}})),s=p.useRef(),n=H(o=>{if(!r){s.current=void 0,t({kind:"accept-results",results:[]});return}Ee.isDebug()&&Ee.debug(`Starting new search for query ${JSON.stringify(o)}.`),t({kind:"load-results"});const l=s.current=yi(r,o).then(d=>{s.current===l&&t({kind:"accept-results",results:d})})}),i=p.useCallback(o=>{t({kind:"select-option",option:o})},[]),a=p.useCallback(o=>{t({kind:"input",query:o}),n(o)},[n]);return{input:e.query,search:e.search,selectedOption:e.selectedOption,onResultConfirmed:i,onInputChanged:a}}async function yi(r,e){let t;try{t=await r.search(e)}catch(s){Lt(s)||Ee.error("Search failed",s),t=[]}return _i(t)}function _i(r){return r.map((t,s)=>({label:t.label,options:t.results.map(n=>({value:`${s}-${n.id}`,label:n.label,source:t.source,result:n}))}))}const zt="@open-pioneer/selection",vi=Ue.bind(void 0,zt),qe=z.bind(void 0,zt),ne="selection-active",_e="selection-inactive";class Si{tooltip;interactionResources=[];olMap;isActive=!0;tooltipMessage;tooltipDisabledMessage;constructor(e,t,s,n){const i=this.initViewport(e);this.interactionResources.push(this.createDragBox(e,n,i,this.interactionResources)),this.interactionResources.push(this.createDrag(e,i,this.interactionResources)),this.tooltip=this.createHelpTooltip(e,t),this.olMap=e,this.tooltipMessage=t,this.tooltipDisabledMessage=s}initViewport(e){const t=e.getViewport();return t.classList.add(ne),t.oncontextmenu=s=>(s.preventDefault(),!1),t}destroy(){this.tooltip.destroy(),this.interactionResources.forEach(e=>{e.destroy()})}setActive(e){if(this.isActive===e)return;const t=this.olMap.getViewport();e?(this.interactionResources.forEach(s=>this.olMap.addInteraction(s.interaction)),this.tooltip.setText(this.tooltipMessage),t.classList.remove(_e),t.classList.add(ne),this.isActive=!0):(this.interactionResources.forEach(s=>this.olMap.removeInteraction(s.interaction)),this.tooltip.setText(this.tooltipDisabledMessage),t.classList.remove(ne),t.classList.add(_e),this.isActive=!1)}createDragBox(e,t,s,n){const i=new nt({className:"selection-drag-box",condition:As});return e.addInteraction(i),i.on("boxend",function(){t(i.getGeometry())}),{interaction:i,destroy(){e.removeInteraction(i),n.splice(n.indexOf(this)),i.dispose(),s.classList.remove(ne),s.classList.remove(_e),s.oncontextmenu=null}}}createDrag(e,t,s){const n=function(o){return o.originalEvent.button==2},i=new it({condition:n});return e.addInteraction(i),{interaction:i,destroy(){e.removeInteraction(i),s.splice(s.indexOf(this)),i.dispose(),t.classList.remove(ne),t.classList.remove(_e),t.oncontextmenu=null}}}createHelpTooltip(e,t){const s=document.createElement("div");s.className="selection-tooltip printing-hide",s.role="tooltip";const n=document.createElement("span");n.textContent=t,s.appendChild(n);const i=new Ie({element:s,offset:[15,0],positioning:"center-left"}),a=e.on("pointermove",o=>{i.setPosition(o.coordinate)});return e.addOverlay(i),{overlay:i,element:s,destroy(){e.removeOverlay(i),i.dispose(),R(a)},setText(o){n.textContent=o}}}getDragboxInteraction(){return this.interactionResources.find(e=>e.interaction instanceof nt)}getDragPanInteraction(){return this.interactionResources.find(e=>e.interaction instanceof it)}}const ke=fe("selection:SelectionController"),xi=1e4;var ue,he,ge,Pe,Kt;class wi{constructor(e){x(this,Pe);x(this,ue);x(this,he);x(this,ge);const{mapModel:t,onError:s,maxResults:n=xi}=e;b(this,ue,t),b(this,he,n),b(this,ge,s)}destroy(){}async select(e,t){if(t)return await te(this,Pe,Kt).call(this,e,t)}}ue=new WeakMap,he=new WeakMap,ge=new WeakMap,Pe=new WeakSet,Kt=async function(e,t){const s=_(this,ue).olMap.getView().getProjection();try{ke.debug(`Starting selection on source '${e.label}'`);const n=_(this,he);let i=await e.select({type:"extent",extent:t},{maxResults:n,mapProjection:s,signal:new AbortController().signal});return i.length>n&&(i=i.slice(0,n)),ke.debug(`Found ${i.length} results on source '${e.label}'`),{source:e,results:i}}catch(n){ke.error(`selection from source ${e.label} failed`,n),_(this,ge).call(this);return}};const bi={classNamePrefix:"react-select",menuPosition:"fixed",isSearchable:!1,isClearable:!1},lr=r=>{const e=qe(),{sources:t,onSelectionComplete:s,onSelectionSourceChanged:n}=r,{containerProps:i}=B("selection",r),a=e.formatMessage({id:"sourceNotAvailable"}),[o,l]=Ci(t,n),d=Jt(o,a),c=$(r),{onExtentSelected:g}=Pi(c.map,t,o,s),h=Li(),[f,m]=p.useState(!1);Fi(c.map,e,g,d.kind==="available",!!o);const v=p.useMemo(()=>t.map(w=>({label:w.label,value:w})),[t]),S=p.useMemo(()=>v.find(E=>E.value===o)||null,[v,o]),I=H(w=>{l(w?.value)}),N=H(w=>{!f&&w.key==="Enter"&&m(!0)});return u.jsx(Vs,{...i,spacing:2,children:u.jsxs(be,{children:[u.jsx(Me,{children:e.formatMessage({id:"selectSource"})}),u.jsx(Nt,{className:"selection-source react-select",...bi,options:v,placeholder:e.formatMessage({id:"selectionPlaceholder"}),value:S,onChange:I,components:{Option:Mi,SingleValue:Ei},isOptionDisabled:()=>!1,getOptionLabel:w=>{const E=w.label,C=Yt(w.value,a);return C.kind=="available"?E:E+" "+C.reason},ariaLiveMessages:{guidance:()=>"",onChange:w=>w.action=="select-option"||w.action=="initial-input-focus"?w.label+" "+e.formatMessage({id:"selected"}):"",onFilter:()=>"",onFocus:()=>""},chakraStyles:h,onKeyDown:N,menuIsOpen:f,onMenuOpen:()=>m(!0),onMenuClose:()=>m(!1)})]})})};function Mi(r){const{value:e}=r.data,{isAvailable:t,content:s}=qt(e,!1);return u.jsx(k.Option,{...r,isDisabled:!t,className:"selection-source-option",children:s})}function Ei(r){const{value:e}=r.data,{isAvailable:t,content:s}=qt(e,!0),n=t?"selection-source-value":"selection-source-value selection-source-value--disabled";return u.jsx(k.SingleValue,{...r,isDisabled:!t,className:n,children:s})}function Ci(r,e){const[t,s]=p.useState(()=>r[0]);p.useEffect(()=>{t&&!r.includes(t)&&s(void 0)},[r,t]);const n=p.useRef(void 0);return p.useEffect(()=>{t!==n.current&&(n.current=t,e?.({source:t}))},[t,e]),[t,s]}function qt(r,e){const t=qe(),s=r?.label,n=t.formatMessage({id:"sourceNotAvailable"}),i=Jt(r,n);return{isAvailable:i.kind==="available",content:u.jsxs(rt,{direction:"row",alignItems:"center",grow:1,children:[!e&&u.jsx(rt,{grow:1,children:s}),i.kind==="unavailable"&&u.jsx(L,{ml:2,children:u.jsx(Hs,{label:i.reason,placement:"right",openDelay:500,children:u.jsx(G.span,{children:u.jsx(Bs,{as:Js,color:"red",className:"warning-icon","aria-label":i.reason})})})}),e&&s]})}}function Pi(r,e,t,s){const n=vi("notifier.NotificationService"),i=qe(),[a,o]=p.useState(void 0);p.useEffect(()=>{if(!r)return;const d=new wi({mapModel:r,onError(){n.notify({level:"error",message:i.formatMessage({id:"selectionFailed"})})}});return o(d),()=>{d.destroy()}},[r,n,e,i]);const l=H(async d=>{if(!a||!t)return;const c=await a.select(t,d.getExtent());c&&s?.(c)});return{controller:a,onExtentSelected:l}}function Yt(r,e){const t=r.status??"available",s=typeof t=="string"?{kind:t}:t;return s.kind==="available"?s:{kind:"unavailable",reason:s.reason??e}}function Jt(r,e){return U(()=>r?Yt(r,e):{kind:"unavailable",reason:e},[r,e])}function Fi(r,e,t,s,n){p.useEffect(()=>{if(!r)return;const i=n?e.formatMessage({id:"disabledTooltip"}):e.formatMessage({id:"noSourceTooltip"}),a=new Si(r.olMap,e.formatMessage({id:"tooltip"}),i,t);return a.setActive(s),()=>{a?.destroy()}},[r,e,t,s,n])}function Li(){const[r,e]=It("colors",["background_body","border"],["#ffffff","#ffffff"]);return p.useMemo(()=>({control:s=>({...s,cursor:"pointer"}),indicatorSeparator:s=>({...s,borderColor:e}),dropdownIndicator:s=>({...s,backgroundColor:r})}),[r,e])}const Xt="@open-pioneer/printing",Zt=Ue.bind(void 0,Xt),Ii=z.bind(void 0,Xt),Ti="map";class Ai{olMap;i18n;printingService;viewPadding;printMap=void 0;overlay=void 0;constructor(e,t,s){this.olMap=e,this.printingService=t,this.i18n=s}destroy(){this.reset()}setViewPadding(e){this.viewPadding=e}async handleMapExport(e){if(this.olMap)try{this.begin(),this.printMap=await this.printingService.printMap(this.olMap,{blockUserInteraction:!1,viewPadding:this.viewPadding});const t=this.printMap.getCanvas();if(t)e.fileFormat=="png"?await this.exportMapInPNG(t,e):await this.exportMapInPDF(t,e);else throw new Error("Canvas export failed")}finally{this.reset()}}begin(){const e=this.olMap.getTargetElement();e&&(this.overlay=Ks(e,this.i18n.overlayText))}reset(){this.overlay?.destroy(),this.overlay=void 0}getTitleAndFileName(e){const t=e.title||"",s=e.title||Ti;return{title:t,fileName:s}}async exportMapInPNG(e,t){const s=document.createElement("canvas");s.width=e.width,s.height=e.height+50,s.style.backgroundColor="#fff";const n=s.getContext("2d");if(!n)throw new Error("2d canvas rendering context not available");const{title:i,fileName:a}=this.getTitleAndFileName(t);n.fillStyle="#fff",n.fillRect(0,0,s.width,s.height),n.font="20px bold sans-serif",n.textAlign="center",n.fillStyle="#000";const o=s.width/2;n.fillText(i,o,20),n.drawImage(e,0,50);const l=document.createElement("a");l.setAttribute("download",a+".png");const d=qs(s);if(!d)throw new Error("Failed to get image data URL");l.href=d,l.click()}async exportMapInPDF(e,t){const{jsPDF:s}=await Xs(async()=>{const{jsPDF:I}=await import("./DyTV57ff4rkW.js");return{jsPDF:I}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),n=new s({orientation:"landscape",unit:"mm",format:"a4"}),i=n.internal.pageSize.getWidth(),a=n.internal.pageSize.getHeight(),o=15,l=20,d=a-l;n.setFontSize(20);const{title:c,fileName:g}=this.getTitleAndFileName(t);n.text(c,i/2,o,{align:"center"});const h=e.width/e.height;let f=d,m=f*h;m>=i&&(m=i,f=m/h);const v=(i-m)/2,S=l+(d-f)/2;n.addImage(e,"",v,S,m,f),n.save(g+".pdf")}}const Ni=fe("printing"),cr=r=>{const e=Ii(),{viewPadding:t="auto"}=r,{containerProps:s}=B("printing",r),[n,i]=p.useState("pdf"),[a,o]=p.useState(""),[l,d]=p.useState(!1),c=Zt("notifier.NotificationService"),{map:g}=$(r),h=Oi(g,e,t);function f(v){(v==="png"||v==="pdf")&&i(v)}function m(){l||!h||(d(!0),h.handleMapExport({title:a,fileFormat:n}).catch(v=>{const S=e.formatMessage({id:"printingFailed"});c.notify({level:"error",message:S}),Ni.error("Failed to print the map",v)}).finally(()=>{d(!1)}))}return u.jsx(L,{...s,children:u.jsxs(L,{as:"form",m:2,alignItems:"center",onSubmit:v=>{v.preventDefault(),m()},children:[u.jsxs(be,{as:Ve,mb:2,children:[u.jsx(Me,{minWidth:"82",mb:1,children:e.formatMessage({id:"title"})}),u.jsx(ze,{placeholder:e.formatMessage({id:"input.placeholder"}),value:a,onChange:v=>{o(v.target.value)},autoFocus:!0})]}),u.jsxs(be,{as:Ve,mb:2,children:[u.jsx(Me,{minWidth:"82",mb:1,children:e.formatMessage({id:"fileFormat"})}),u.jsxs(Ke,{value:n,onChange:v=>f(v.target.value),className:"printing-select",children:[u.jsx("option",{value:"png",children:"PNG"}),u.jsx("option",{value:"pdf",children:"PDF"})]})]}),u.jsx(Ft,{isLoading:l,loadingText:e.formatMessage({id:"printingMap"}),disabled:l,mt:2,p:2,className:"printing-export-button",type:"submit",width:"100%",children:e.formatMessage({id:"export"})})]})})};function Oi(r,e,t){const s=Zt("printing.PrintingService"),[n,i]=p.useState(void 0);return p.useEffect(()=>{if(!r)return;const a=new Ai(r.olMap,s,{overlayText:e.formatMessage({id:"printingMap"})});return i(a),()=>{a.destroy(),i(void 0)}},[r,e,s]),p.useEffect(()=>{n?.setViewPadding(t)},[n,t]),n}export{sr as C,Qi as E,ze as I,rr as L,or as M,tr as N,Ie as O,cr as P,Rt as S,er as V,Zi as W,nr as a,ir as b,ar as c,lr as d,Ke as e};
+var Qt=Object.defineProperty;var Ye=r=>{throw TypeError(r)};var es=(r,e,t)=>e in r?Qt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var y=(r,e,t)=>es(r,typeof e!="symbol"?e+"":e,t),Ae=(r,e,t)=>e.has(r)||Ye("Cannot "+t);var _=(r,e,t)=>(Ae(r,e,"read from private field"),t?t.call(r):e.get(r)),x=(r,e,t)=>e.has(r)?Ye("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),b=(r,e,t,s)=>(Ae(r,e,"write to private field"),s?s.call(r,t):e.set(r,t),t),te=(r,e,t)=>(Ae(r,e,"access private method"),t);import{aE as ts,b7 as ss,b8 as ns,b9 as is,aP as rs,aX as os,ba as as,bb as ls,J as cs,bc as ds,bd as us,be as hs,bf as gs,bg as St,bh as fs,bi as ms,a as ee,b as Fe,aL as ve,bj as Je,bk as K,a9 as Xe,G as T,bl as Ne,a_ as Z,an as Ze,bm as pe,p as P,bn as A,bo as Qe,bp as F,bq as Se,br as ps,bs as ys,z as _s,bt as De,bu as vs,bv as Ss,bw as xt,ao as wt,bx as xs,by as ws,bz as et,bA as bs,bB as tt,bC as Ms,bD as st,j as R,r as Be,a$ as $e,bE as bt,bF as Es,b0 as Cs,f as Ue,u as z,aZ as B,i as $,b4 as Ps,b3 as Le,bG as Fs,am as xe,bH as Ls,bI as Is,c as we,ax as ie,F as Re,C as Ts,bJ as nt,bK as As,bL as it,k as rt}from"./5C5XmiCGgLmB.js";import{h as We,u as Mt,o as Et,l as Ct,j as u,g as G,s as Ns,t as ks,r as p,v as se,w as ot,x as Os,y as js,z as Ds,c as fe,d as Pt,B as L,C as at,b as Ft,D as Rs,G as Gs,i as Lt,H as It,V as Vs,q as Hs,I as Bs}from"./Mxtq6FG0Aq1_.js";import{G as Tt,i as $s}from"./CXqamDLCwhxM.js";import{a as Us}from"./DWkb3PmnrxhS.js";import{D as At,S as Ws,I as zs,c as Ks,a as qs}from"./OM1YzF7yjem8.js";import{u as H}from"./_eg2EQ1Gs0ak.js";import{u as U,c as j,s as Nt}from"./Cxncs0atKtOb.js";import{T as Q,L as Ys}from"./BOwySe0UXVY3.js";import{c as kt}from"./DUaeWVZO0JNZ.js";import{L as Ge}from"./D69t4K7RmA6W.js";import{u as Ot,F as be}from"./CRkdw9XP0Imr.js";import{F as Me}from"./CYrCIuevaD6U.js";import{H as Ve}from"./BXf6RRVNKbev.js";import{F as Js}from"./IfrtfJ9Ep93o.js";import{_ as Xs}from"./CmsKOCeNyeyo.js";import{s as Zs}from"./DgabVoUpizSB.js";const ze=We(function(e,t){const{htmlSize:s,...n}=e,i=Mt("Input",n),a=Et(n),o=Ot(a),l=Ct("chakra-input",e.className);return u.jsx(G.input,{size:s,...o,__css:i.field,ref:t,className:l})});ze.displayName="Input";ze.id="Input";const jt=We(function(e,t){const{children:s,placeholder:n,className:i,...a}=e;return u.jsxs(G.select,{...a,ref:t,className:Ct("chakra-select",i),children:[n&&u.jsx("option",{value:"",children:n}),s]})});jt.displayName="SelectField";const Ke=We((r,e)=>{const t=Mt("Select",r),{rootProps:s,placeholder:n,icon:i,color:a,height:o,h:l,minH:d,minHeight:c,iconColor:g,iconSize:h,...f}=Et(r),[m,v]=Zs(f,Ns),S=Ot(v),I={width:"100%",height:"fit-content",position:"relative",color:a},N={paddingEnd:"2rem",...t.field,_focus:{zIndex:"unset",...t.field?._focus}};return u.jsxs(G.div,{className:"chakra-select__wrapper",__css:I,...m,...s,children:[u.jsx(jt,{ref:e,height:l??o,minH:d??c,placeholder:n,...S,__css:N,children:r.children}),u.jsx(Dt,{"data-disabled":ks(S.disabled),...(g||a)&&{color:g||a},__css:t.icon,...h&&{fontSize:h},children:i})]})});Ke.displayName="Select";const Qs=r=>u.jsx("svg",{viewBox:"0 0 24 24",...r,children:u.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),en=G("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),Dt=r=>{const{children:e=u.jsx(Qs,{}),...t}=r,s=p.cloneElement(e,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return u.jsx(en,{...t,className:"chakra-select__icon-wrapper",children:p.isValidElement(e)?s:null})};Dt.displayName="SelectIcon";function tn(r,e){const t=r??"bottom";return{"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[t]?.[e]??t}function sn(r,e){const t=n=>({...e,...n,position:tn(n?.position??e?.position,r)}),s=n=>{const i=t(n),a=Os(i);return se.notify(a,i)};return s.update=(n,i)=>{se.update(n,t(i))},s.promise=(n,i)=>{const a=s({...i.loading,status:"loading",duration:null});n.then(o=>s.update(a,{status:"success",duration:5e3,...ot(i.success,o)})).catch(o=>s.update(a,{status:"error",duration:5e3,...ot(i.error,o)}))},s.closeAll=se.closeAll,s.close=se.close,s.isActive=se.isActive,s}function nn(r){const{theme:e}=js(),t=Ds();return p.useMemo(()=>sn(e.direction,{...t,...r}),[r,e.direction,t])}const M={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class Ie extends ts{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst!==void 0?e.insertFirst:!0,this.stopEvent=e.stopEvent!==void 0?e.stopEvent:!0,this.element=document.createElement("div"),this.element.className=e.className!==void 0?e.className:"ol-overlay-container "+ss,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(M.ELEMENT,this.handleElementChanged),this.addChangeListener(M.MAP,this.handleMapChanged),this.addChangeListener(M.OFFSET,this.handleOffsetChanged),this.addChangeListener(M.POSITION,this.handlePositionChanged),this.addChangeListener(M.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset!==void 0?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(M.ELEMENT)}getId(){return this.id}getMap(){return this.get(M.MAP)||null}getOffset(){return this.get(M.OFFSET)}getPosition(){return this.get(M.POSITION)}getPositioning(){return this.get(M.POSITIONING)}handleElementChanged(){ns(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),is(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=rs(e,os.POSTRENDER,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(M.ELEMENT,e)}setMap(e){this.set(M.MAP,e)}setOffset(e){this.set(M.OFFSET,e)}setPosition(e){this.set(M.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(M.POSITION))return;const s=this.getRect(t.getTargetElement(),t.getSize()),n=this.getElement(),i=this.getRect(n,[as(n),ls(n)]);e=e||{};const a=e.margin===void 0?20:e.margin;if(!cs(s,i)){const o=i[0]-s[0],l=s[2]-i[2],d=i[1]-s[1],c=s[3]-i[3],g=[0,0];if(o<0?g[0]=o-a:l<0&&(g[0]=Math.abs(l)+a),d<0?g[1]=d-a:c<0&&(g[1]=Math.abs(c)+a),g[0]!==0||g[1]!==0){const h=t.getView().getCenterInternal(),f=t.getPixelFromCoordinateInternal(h);if(!f)return;const m=[f[0]+g[0],f[1]+g[1]],v=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(m),duration:v.duration,easing:v.easing})}}}getRect(e,t){const s=e.getBoundingClientRect(),n=s.left+window.pageXOffset,i=s.top+window.pageYOffset;return[n,i,n+t[0],i+t[1]]}setPositioning(e){this.set(M.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}const s=e.getPixelFromCoordinate(t),n=e.getSize();this.updateRenderedPosition(s,n)}updateRenderedPosition(e,t){const s=this.element.style,n=this.getOffset(),i=this.getPositioning();this.setVisible(!0);const a=Math.round(e[0]+n[0])+"px",o=Math.round(e[1]+n[1])+"px";let l="0%",d="0%";i=="bottom-right"||i=="center-right"||i=="top-right"?l="-100%":(i=="bottom-center"||i=="center-center"||i=="top-center")&&(l="-50%"),i=="bottom-left"||i=="bottom-center"||i=="bottom-right"?d="-100%":(i=="center-left"||i=="center-center"||i=="center-right")&&(d="-50%");const c=`translate(${l}, ${d}) translate(${a}, ${o})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,s.transform=c)}getOptions(){return this.options}}const Zi=ds,lt=0,re=1,ct=[0,0,0,0],q=[],ke={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class Oe extends wt{constructor(e,t,s){super(e),this.features=t,this.mapBrowserEvent=s}}class rn extends us{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:hs,this.defaultDeleteCondition_=function(s){return gs(s)&&St(s)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:fs,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new ms,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new ee({source:new Fe({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:an(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new ve(this.source_.getFeatures()),this.source_.addEventListener(Je.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Je.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(K.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(K.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){const t=e.getGeometry();if(t){const n=this.SEGMENT_WRITERS_[t.getType()];n&&n(e,t)}const s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(s.getCoordinateFromPixel(this.lastPixel_)),e.addEventListener(Xe.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new ve;const s=this.featuresBeingModified_.getArray();for(let n=0,i=t.length;n=0;--n){const i=s[n];for(let a=this.dragSegments_.length-1;a>=0;--a)this.dragSegments_[a][0]===i&&this.dragSegments_.splice(a,1);t.remove(i)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const s=t.getCoordinates(),n={feature:e,geometry:t,segment:[s,s]};this.rBush_.insert(t.getExtent(),n)}writeMultiPointGeometry_(e,t){const s=t.getCoordinates();for(let n=0,i=s.length;ni));const t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],s=[],n=[];for(let i=0,a=this.dragSegments_.length;i=0;--i)this.insertVertex_(s[i],n);this.ignoreNextSingleClick_=!0}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const s=this.dragSegments_[t][0],n=s.geometry;if(n.getType()==="Circle"){const i=n,a=i.getCenter(),o=s.featureSegments[0],l=s.featureSegments[1];o.segment[0]=a,o.segment[1]=a,l.segment[0]=a,l.segment[1]=a,this.rBush_.update(Ne(a),o);let d=i;this.rBush_.update(d.getExtent(),l)}else this.rBush_.update(T(s.segment),s)}return this.featuresBeingModified_&&(this.dispatchEvent(new Oe(ke.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.coordinate)}handlePointerAtPixel_(e){const t=this.getMap(),s=t.getPixelFromCoordinate(e);t.getView().getProjection();const n=function(o,l){return dt(e,o)-dt(e,l)};let i,a;if(this.hitDetection_){const o=typeof this.hitDetection_=="object"?l=>l===this.hitDetection_:void 0;t.forEachFeatureAtPixel(s,(l,d,c)=>{c&&c.getType()==="Point"&&(c=new Ze(Se(c.getCoordinates())));const g=c||l.getGeometry();if(g&&g.getType()==="Point"&&l instanceof Z&&this.features_.getArray().includes(l)){a=g;const h=l.getGeometry().getFlatCoordinates().slice(0,2);i=[{feature:l,geometry:a,segment:[h,h]}]}return!0},{layerFilter:o})}if(!i){const o=ps(Ne(e,ct)),l=t.getView().getResolution()*this.pixelTolerance_,d=ys(_s(o,l,ct));i=this.rBush_.getInExtent(d)}if(i&&i.length>0){const o=i.sort(n)[0],l=o.segment;let d=ut(e,o);const c=t.getPixelFromCoordinate(d);let g=Qe(s,c);if(a||g<=this.pixelTolerance_){const h={};if(h[P(l)]=!0,this.snapToPointer_||(this.delta_[0]=d[0]-e[0],this.delta_[1]=d[1]-e[1]),o.geometry.getType()==="Circle"&&o.index===re)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(d,[o.feature],[o.geometry],this.snappedToVertex_);else{const f=t.getPixelFromCoordinate(l[0]),m=t.getPixelFromCoordinate(l[1]),v=De(c,f),S=De(c,m);g=Math.sqrt(Math.min(v,S)),this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(d=v>S?l[1]:l[0]),this.createOrUpdateVertexFeature_(d,[o.feature],[o.geometry],this.snappedToVertex_);const I={};I[P(o.geometry)]=!0;for(let N=1,w=i.length;Ns.getType()==="Circle"||s.getType().endsWith("Point")))return!1;const e=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(T([e])).some(({segment:s})=>A(s[0],e)||A(s[1],e))}removePoint(e){if(e&&(e=F(e,this.getMap().getView().getProjection()),this.updatePointer_(e)),!this.lastPointerEvent_||this.lastPointerEvent_&&this.lastPointerEvent_.type!=pe.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_.map(([n])=>n));const s=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new Oe(ke.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,s}return!1}removeVertex_(){const e=this.dragSegments_,t={};let s=!1,n,i,a,o,l,d,c,g,h,f,m;for(l=e.length-1;l>=0;--l)a=e[l],f=a[0],m=P(f.feature),f.depth&&(m+="-"+f.depth.join("-")),m in t||(t[m]={}),a[1]===0?(t[m].right=f,t[m].index=f.index):a[1]==1&&(t[m].left=f,t[m].index=f.index+1);for(m in t){switch(h=t[m].right,c=t[m].left,d=t[m].index,g=d-1,c!==void 0?f=c:f=h,g<0&&(g=0),o=f.geometry,i=o.getCoordinates(),n=i,s=!1,o.getType()){case"MultiLineString":i[f.depth[0]].length>2&&(i[f.depth[0]].splice(d,1),s=!0);break;case"LineString":i.length>2&&(i.splice(d,1),s=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.depth[0]],n.length>4&&(d==n.length-1&&(d=0),n.splice(d,1),s=!0,d===0&&(n.pop(),n.push(n[0]),g=n.length-1));break}if(s){this.setGeometryCoordinates_(o,i);const v=[];if(c!==void 0&&(this.rBush_.remove(c),v.push(c.segment[0])),h!==void 0&&(this.rBush_.remove(h),v.push(h.segment[1])),c!==void 0&&h!==void 0){const S={depth:f.depth,feature:f.feature,geometry:f.geometry,index:g,segment:v};this.rBush_.insert(T(S.segment),S)}this.updateSegmentIndices_(o,d,f.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return s}canInsertPoint(){if(!this.vertexFeature_||this.vertexFeature_.get("geometries").every(s=>s.getType()==="Circle"||s.getType().endsWith("Point")))return!1;const e=this.vertexFeature_.getGeometry().getCoordinates();return this.rBush_.getInExtent(T([e])).some(({segment:s})=>!(A(s[0],e)||A(s[1],e)))}insertPoint(e){const t=e?F(e,this.getMap().getView().getProjection()):this.vertexFeature_?.getGeometry().getCoordinates();return t?this.findInsertVerticesAndUpdateDragSegments_(t).reduce((n,i)=>n||this.insertVertex_(i,t),!1):!1}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,s,n){this.rBush_.forEachInExtent(e.getExtent(),function(i){i.geometry===e&&(s===void 0||i.depth===void 0||vs(i.depth,s))&&i.index>t&&(i.index+=n)})}}function on(r,e){return r.index-e.index}function dt(r,e,t){const s=e.geometry;if(s.getType()==="Circle"){let i=s;if(e.index===re){const a=De(i.getCenter(),F(r)),o=Math.sqrt(a)-i.getRadius();return o*o}}const n=F(r);return q[0]=F(e.segment[0]),q[1]=F(e.segment[1]),xs(n,q)}function ut(r,e,t){const s=e.geometry;if(s.getType()==="Circle"&&e.index===re)return Se(s.getClosestPoint(F(r)));const n=F(r);return q[0]=F(e.segment[0]),q[1]=F(e.segment[1]),Se(Ss(n,q))}function an(){const r=xt();return function(e,t){return r.Point}}const ln={SELECT:"select"};class cn extends wt{constructor(e,t,s,n){super(e),this.selected=t,this.deselected=s,this.mapBrowserEvent=n}}const ye={};class Rt extends ws{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=e.condition?e.condition:St,this.addCondition_=e.addCondition?e.addCondition:et,this.removeCondition_=e.removeCondition?e.removeCondition:et,this.toggleCondition_=e.toggleCondition?e.toggleCondition:bs,this.multi_=e.multi?e.multi:!1,this.filter_=e.filter?e.filter:tt,this.hitTolerance_=e.hitTolerance?e.hitTolerance:0,this.style_=e.style!==void 0?e.style:dn(),this.features_=e.features||new ve;let t;if(e.layers)if(typeof e.layers=="function")t=e.layers;else{const s=e.layers;t=function(n){return s.includes(n)}}else t=tt;this.layerFilter_=t,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(e,t){this.featureLayerAssociation_[P(e)]=t}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(e){return this.featureLayerAssociation_[P(e)]}setHitTolerance(e){this.hitTolerance_=e}setMap(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(e),e?(this.features_.addEventListener(K.ADD,this.boundAddFeature_),this.features_.addEventListener(K.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(K.ADD,this.boundAddFeature_),this.features_.removeEventListener(K.REMOVE,this.boundRemoveFeature_))}addFeature_(e){const t=e.element;if(this.style_&&this.applySelectedStyle_(t),!this.getLayer(t)){const s=this.getMap().getAllLayers().find(function(n){if(n instanceof ee&&n.getSource()&&n.getSource().hasFeature(t))return n});s&&this.addFeatureLayerAssociation_(t,s)}}removeFeature_(e){this.style_&&this.restorePreviousStyle_(e.element)}getStyle(){return this.style_}applySelectedStyle_(e){const t=P(e);t in ye||(ye[t]=e.getStyle()),e.setStyle(this.style_)}restorePreviousStyle_(e){const t=this.getMap().getInteractions().getArray();for(let n=t.length-1;n>=0;--n){const i=t[n];if(i!==this&&i instanceof Rt&&i.getStyle()&&i.getFeatures().getArray().lastIndexOf(e)!==-1){e.setStyle(i.getStyle());return}}const s=P(e);e.setStyle(ye[s]),delete ye[s]}removeFeatureLayerAssociation_(e){delete this.featureLayerAssociation_[P(e)]}handleEvent(e){if(!this.condition_(e))return!0;const t=this.addCondition_(e),s=this.removeCondition_(e),n=this.toggleCondition_(e),i=!t&&!s&&!n,a=e.map,o=this.getFeatures(),l=[],d=[];if(i){Ms(this.featureLayerAssociation_),a.forEachFeatureAtPixel(e.pixel,(c,g)=>{if(!(!(c instanceof Z)||!this.filter_(c,g)))return this.addFeatureLayerAssociation_(c,g),d.push(c),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=o.getLength()-1;c>=0;--c){const g=o.item(c),h=d.indexOf(g);h>-1?d.splice(h,1):(o.remove(g),l.push(g))}d.length!==0&&o.extend(d)}else{a.forEachFeatureAtPixel(e.pixel,(c,g)=>{if(!(!(c instanceof Z)||!this.filter_(c,g)))return(t||n)&&!o.getArray().includes(c)?(this.addFeatureLayerAssociation_(c,g),d.push(c)):(s||n)&&o.getArray().includes(c)&&(l.push(c),this.removeFeatureLayerAssociation_(c)),!this.multi_},{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=l.length-1;c>=0;--c)o.remove(l[c]);o.extend(d)}return(d.length>0||l.length>0)&&this.dispatchEvent(new cn(ln.SELECT,d,l,e)),!0}}function dn(){const r=xt();return st(r.Polygon,r.LineString),st(r.GeometryCollection,r.LineString),function(e){return e.getGeometry()?r[e.getGeometry().getType()]:null}}async function un(r,e,t,s){const i=s.getCode().replace("EPSG:","http://www.opengis.net/def/crs/EPSG/0/"),a=await r.fetch(e,{method:"POST",body:JSON.stringify({type:"Feature",properties:{},geometry:t}),headers:{"Content-Type":"application/geo+json; charset=utf-8","Content-Crs":`<${i}>`}});if(!a||!a.ok||a.status!==201)throw new Error("Request failed: "+a.status);const o=a.headers.get("location");if(!o)throw new Error("Request failed: no Location response header");const l=o.substring(o.lastIndexOf("/")+1);return Promise.resolve(l)}async function hn(r,e,t,s,n){const a=n.getCode().replace("EPSG:","http://www.opengis.net/def/crs/EPSG/0/"),o=new URL(`${e.toString()}/${t}`),l=await r.fetch(o,{method:"PATCH",body:JSON.stringify({type:"Feature",properties:{},geometry:s}),headers:{"Content-Type":"application/geo+json; charset=utf-8","Content-Crs":`<${a}>`}});if(!l||!l.ok||l.status!==204)throw new Error("Request failed: "+l.status);return Promise.resolve(t)}function Gt(r,e){const t=document.createElement("div");t.className="editing-tooltip editing-tooltip-hidden",t.role="tooltip";const s=document.createElement("span");s.textContent=e,t.appendChild(s);const n=new Ie({element:t,offset:[15,0],positioning:"center-left"}),i=r.on("pointermove",a=>{a.dragging||n.setPosition(a.coordinate)});return r.addOverlay(n),{destroy(){R(i),r.removeOverlay(n)},setVisible(a){t.classList.toggle("editing-tooltip-hidden",!a)},setText(a){s.textContent=a}}}function Vt(r){let e=ht(r.polygon);Array.isArray(e)&&(e=e[0]);let t=ht(r.vertex);Array.isArray(t)&&(t=t[0]);const s=[];return e&&s.push(e),t&&(t.setGeometry(gn),s.push(t)),s}const gn=r=>{if(r){const e=r.getGeometry();if(e&&e.getType()==="Polygon"){const t=e.getCoordinates()[0];if(t)return new Us(t)}}},ht=r=>{const e=new Z,s=new ee({style:r}).getStyleFunction();if(!s)throw new Error("can't retrieve style function");const n=s(e,1);if(!n)throw new Error("can't retrieve styles from feature style function");return Array.isArray(n)&&n.length?n.length>1?n:n[0]:n},fn=fe("editing:EditingCreateWorkflowImpl");var D;class mn{constructor(e){x(this,D);y(this,"_httpService");y(this,"_intl");y(this,"_map");y(this,"_polygonStyle");y(this,"_vertexStyle");y(this,"_state");y(this,"_editLayerURL");y(this,"_featureId");y(this,"_editingSource");y(this,"_editingLayer");y(this,"_drawInteraction");y(this,"_olMap");y(this,"_tooltip");y(this,"_enterHandler");y(this,"_escapeHandler");y(this,"_error");y(this,"_interactionListener");y(this,"_mapListener");this._httpService=e.httpService,this._intl=e.intl,this._polygonStyle=e.polygonStyle,this._vertexStyle=e.vertexStyle,this._map=e.map,this._olMap=e.map.olMap,this._state=Be("active:initialized"),this._editLayerURL=e.ogcApiFeatureLayerUrl,this._editingSource=new Fe,this._editingLayer=new ee({source:this._editingSource,zIndex:$e,properties:{name:"editing-layer"}}),this._drawInteraction=new At({source:this._editingSource,type:"Polygon",style:Vt({polygon:this._polygonStyle,vertex:this._vertexStyle})}),this._tooltip=Gt(this._olMap,this._intl.formatMessage({id:"create.tooltip.begin"})),this._enterHandler=t=>{if((t.code==="Enter"||t.code==="NumpadEnter")&&t.target===this._olMap.getTargetElement()){const s=this._drawInteraction.getOverlay().getSource()?.getFeatures()??[];s[0]&&s[0].getGeometry().getCoordinates()[0].length>4&&this.triggerSave()}},this._escapeHandler=t=>{t.code==="Escape"&&t.target===this._olMap.getTargetElement()&&this.reset()},this._interactionListener=[],this._mapListener=[],this._start()}getDrawInteraction(){return this._drawInteraction}getState(){return this._state.value}_setState(e){this._state.value=e}_save(e){this._setState("active:saving");const t=this._editLayerURL,s=e.getGeometry();if(!s){this._destroy(),this._error=new Error("no geometry available"),_(this,D)?.reject(this._error);return}const n=this._olMap.getView().getProjection(),a=new Tt({dataProjection:n}).writeGeometryObject(s,{rightHanded:!0,decimals:10});this._olMap.removeInteraction(this._drawInteraction),this._tooltip.destroy(),un(this._httpService,t,a,n).then(o=>{this._featureId=o,this._destroy(),_(this,D)?.resolve({featureId:this._featureId})}).catch(o=>{fn.error(o),this._destroy(),this._error=new Error("Failed to save feature",{cause:o}),_(this,D)?.reject(this._error)})}_start(){this._olMap.addLayer(this._editingLayer),this._olMap.addInteraction(this._drawInteraction);const e=bt(()=>{const n=this._map.container;if(n)return n.addEventListener("keydown",this._enterHandler,!1),n.addEventListener("keydown",this._escapeHandler,!1),()=>{n.removeEventListener("keydown",this._enterHandler),n.removeEventListener("keydown",this._escapeHandler)}});this._tooltip.setVisible(!0);const t=this._drawInteraction.on("drawstart",()=>{this._setState("active:drawing"),this._tooltip.setText(this._intl.formatMessage({id:"create.tooltip.continue"}))}),s=this._drawInteraction.on("drawend",n=>{const i=n.feature;if(!i){this._destroy(),this._error=new Error("no feature available"),_(this,D)?.reject(this._error);return}this._save(i)});this._interactionListener.push(t,s),this._mapListener.push(e)}reset(){this._drawInteraction.abortDrawing(),this._tooltip.setText(this._intl.formatMessage({id:"create.tooltip.begin"})),this._setState("active:initialized")}stop(){this._destroy(),_(this,D)?.resolve(void 0)}_destroy(){this._olMap.removeLayer(this._editingLayer),this._olMap.removeInteraction(this._drawInteraction),this._tooltip.destroy(),this._interactionListener.forEach(e=>{R(e)}),this._mapListener.forEach(e=>{e.destroy()}),this._setState("destroyed")}triggerSave(){this._drawInteraction.finishDrawing()}whenComplete(){return this._state.value==="destroyed"?this._error?Promise.reject(this._error):this._featureId?Promise.resolve({featureId:this._featureId}):Promise.resolve(void 0):(_(this,D)??b(this,D,Pt())).promise}}D=new WeakMap;var k;class pn{constructor(e){x(this,k);y(this,"_httpService");y(this,"_intl");y(this,"_map");y(this,"_polygonStyle");y(this,"_vertexStyle");y(this,"_state");y(this,"_editLayerURL");y(this,"_featureId");y(this,"_initialFeature");y(this,"_editFeature");y(this,"_editingSource");y(this,"_editingLayer");y(this,"_modifyInteraction");y(this,"_olMap");y(this,"_tooltip");y(this,"_enterHandler");y(this,"_escapeHandler");y(this,"_error");y(this,"_interactionListener");y(this,"_mapListener");this._httpService=e.httpService,this._intl=e.intl,this._polygonStyle=e.polygonStyle,this._vertexStyle=e.vertexStyle,this._map=e.map,this._olMap=e.map.olMap,this._state=Be("active:initialized"),this._editLayerURL=e.ogcApiFeatureLayerUrl,this._initialFeature=e.feature.clone(),this._initialFeature.setId(e.feature.getId()),this._editFeature=e.feature.clone(),this._editFeature.setId(e.feature.getId()),this._editFeature.setStyle(Vt({polygon:this._polygonStyle,vertex:this._vertexStyle})),this._editingSource=new Fe({features:new ve([this._editFeature])}),this._editingLayer=new ee({source:this._editingSource,zIndex:$e,properties:{name:"editing-layer"}}),this._modifyInteraction=new rn({source:this._editingSource}),this._tooltip=Gt(this._olMap,this._intl.formatMessage({id:"create.tooltip.deselect"})),this._enterHandler=t=>{if((t.code==="Enter"||t.code==="NumpadEnter")&&t.target===this._olMap.getTargetElement()){const s=this._editingSource.getFeatures()[0];if(!s)throw Error("no updated feature found");this._save(s)}},this._escapeHandler=t=>{t.code==="Escape"&&t.target===this._olMap.getTargetElement()&&this.reset()},this._interactionListener=[],this._mapListener=[],this._start()}getModifyInteraction(){return this._modifyInteraction}getState(){return this._state.value}_setState(e){this._state.value=e}_save(e){this._setState("active:saving");const t=this._editLayerURL;if(this._featureId=e.getId()?.toString(),!this._featureId){this._destroy(),this._error=new Error("no feature id available"),_(this,k)?.reject(this._error);return}const s=e?.getGeometry();if(!s){this._destroy(),this._error=new Error("no geometry available"),_(this,k)?.reject(this._error);return}const n=this._olMap.getView().getProjection(),a=new Tt({dataProjection:n}).writeGeometryObject(s,{rightHanded:!0,decimals:10});this._olMap.removeInteraction(this._modifyInteraction),this._tooltip.destroy(),hn(this._httpService,t,this._featureId,a,n).then(o=>{this._destroy(),_(this,k)?.resolve({featureId:o})}).catch(o=>{this._destroy(),this._error=new Error("Failed to save feature",{cause:o}),_(this,k)?.reject(this._error)})}_start(){this._olMap.addLayer(this._editingLayer),this._olMap.addInteraction(this._modifyInteraction);const e=this._editingSource.getFeatures()[0];if(e&&!e.getId()?.toString()){this._destroy(),this._error=new Error("no feature id available"),_(this,k)?.reject(this._error);return}const t=bt(()=>{const i=this._map.container;if(i)return i.addEventListener("keydown",this._enterHandler,!1),i.addEventListener("keydown",this._escapeHandler,!1),()=>{i.removeEventListener("keydown",this._enterHandler),i.removeEventListener("keydown",this._escapeHandler)}});this._tooltip.setVisible(!0);const s=this._map.olMap.on("click",i=>{const a=i.coordinate,o=i.originalEvent.altKey,l=this._editingSource.getFeaturesAtCoordinate(a);o||l.length===0&&this.triggerSave()}),n=this._modifyInteraction.on("modifystart",()=>{this._setState("active:drawing")});this._interactionListener.push(s,n),this._mapListener.push(t)}reset(){const e=this._initialFeature.getGeometry()?.clone(),t=this._editingSource.getFeatures()[0];if(!t)throw Error("no updated feature found");t.setGeometry(e),this._setState("active:initialized")}stop(){this._destroy(),_(this,k)?.resolve(void 0)}_destroy(){this._editingSource.clear(),this._olMap.removeLayer(this._editingLayer),this._olMap.removeInteraction(this._modifyInteraction),this._tooltip.destroy(),this._interactionListener.forEach(e=>{R(e)}),this._mapListener.forEach(e=>{e.destroy()}),this._setState("destroyed")}triggerSave(){const e=this._editingSource.getFeatures()[0];if(!e)throw Error("no updated feature found");this._save(e)}whenComplete(){return this._state.value==="destroyed"?this._error?Promise.reject(this._error):this._featureId?Promise.resolve({featureId:this._featureId}):Promise.resolve(void 0):(_(this,k)??b(this,k,Pt())).promise}}k=new WeakMap;class Qi{_serviceOptions;_workflows;constructor(e){this._serviceOptions=e,this._workflows=new Map}createFeature(e,t){if(!t||!e||!e.id)throw new Error("Map, mapId or url is undefined.");const s=e.id;let n=this._workflows.get(s);if(n)throw new Error("EditingWorkflow could not be started. EditingWorkflow already in progress for this map.");return n=new mn({map:e,ogcApiFeatureLayerUrl:t,polygonStyle:this._serviceOptions.properties.polygonStyle,vertexStyle:this._serviceOptions.properties.vertexStyle,httpService:this._serviceOptions.references.httpService,intl:this._serviceOptions.intl}),this._workflows.set(s,n),this._connectToWorkflowDestroyEvent(n,s),n}updateFeature(e,t,s){if(!t||!e||!e.id)throw new Error("Map, mapId or url is undefined.");const n=e.id;let i=this._workflows.get(n);if(i)throw new Error("EditingWorkflow could not be started. EditingWorkflow already in progress for this map.");return i=new pn({map:e,ogcApiFeatureLayerUrl:t,feature:s,polygonStyle:this._serviceOptions.properties.polygonStyle,vertexStyle:this._serviceOptions.properties.vertexStyle,httpService:this._serviceOptions.references.httpService,intl:this._serviceOptions.intl}),this._workflows.set(n,i),this._connectToWorkflowDestroyEvent(i,n),i}stop(e){const t=this._workflows.get(e);t&&t.stop()}reset(e){const t=this._workflows.get(e);if(t)t.reset();else throw new Error("No workflow found for mapId: "+e)}_connectToWorkflowDestroyEvent(e,t){const s=Es(()=>[e.getState()],([n])=>{n==="destroyed"&&(this._workflows.get(t)===e&&this._workflows.delete(t),s.destroy())})}}var W,V,oe,ae,le,He;class yn{constructor(e,t,s){x(this,le);y(this,"label");x(this,W,Be({kind:"available"}));x(this,V);x(this,oe);x(this,ae);this.label=t,b(this,V,e),b(this,ae,s),te(this,le,He).call(this),b(this,oe,_(this,V).on("change:visible",()=>{te(this,le,He).call(this)}))}destroy(){R(_(this,oe))}get status(){return _(this,W).value}async select(e,t){if(e.type!=="extent")throw new Error(`Unsupported selection kind: ${e.type}`);if(_(this,W).value.kind!=="available"||_(this,V).getSource()===null)return[];const s=[];_(this,V).getSource().forEachFeatureIntersectingExtent(e.extent,a=>{if(!a.getGeometry())return;const o={...a.getProperties()};delete o.geometries;const l={id:a.getId()?.toString()||Cs(),geometry:a.getGeometry(),properties:o};s.push(l)});const n=s.filter(a=>a!=null);return n.length>t.maxResults?n.slice(0,t.maxResults):n}}W=new WeakMap,V=new WeakMap,oe=new WeakMap,ae=new WeakMap,le=new WeakSet,He=function(){const t=_(this,V).getVisible()?{kind:"available"}:{kind:"unavailable",reason:_(this,ae)};t.kind!==_(this,W).value.kind&&(_(this,W).value=t)};var ce;class er{constructor({intl:e}){x(this,ce);b(this,ce,e)}createSelectionSource(e){return new yn(e.vectorLayer,e.label,_(this,ce).formatMessage({id:"layerNotVisibleReason"}))}}ce=new WeakMap;const _n="@open-pioneer/notifier",vn=Ue.bind(void 0,_n),Sn=kt({d:"M23.384,21.619,16.855,15.09a9.284,9.284,0,1,0-1.768,1.768l6.529,6.529a1.266,1.266,0,0,0,1.768,0A1.251,1.251,0,0,0,23.384,21.619ZM2.75,9.5a6.75,6.75,0,1,1,6.75,6.75A6.758,6.758,0,0,1,2.75,9.5Z",displayName:"SearchIcon"}),Ht=kt({displayName:"WarningTwoIcon",d:"M23.119,20,13.772,2.15h0a2,2,0,0,0-3.543,0L.881,20a2,2,0,0,0,1.772,2.928H21.347A2,2,0,0,0,23.119,20ZM11,8.423a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Zm1.05,11.51h-.028a1.528,1.528,0,0,1-1.522-1.47,1.476,1.476,0,0,1,1.448-1.53h.028A1.527,1.527,0,0,1,13.5,18.4,1.475,1.475,0,0,1,12.05,19.933Z"}),xn=!1;function tr(r){const{position:e="top-right"}=r,t=nn(),s=vn("notifier.NotificationService"),[n,i]=p.useState(!xn),a=H(l=>{const d=l.level==="error"?u.jsx(Ht,{h:"100%",w:"100%"}):void 0;t({position:e,title:l.title,description:l.message||null,status:l.level,isClosable:!0,duration:l.displayDuration??null,icon:d})}),o=H(()=>{t.closeAll()});return p.useEffect(()=>{const l=s.registerHandler({showNotification:a,closeAll:o});return()=>l.destroy()},[n,s,a,o]),u.jsx(u.Fragment,{})}const wn="@open-pioneer/coordinate-viewer",bn=z.bind(void 0,wn),Mn=4,En="decimal",sr=r=>{const{precision:e,displayProjectionCode:t,format:s}=r,{containerProps:n}=B("coordinate-viewer",r),{map:i}=$(r),a=i?.olMap,o=U(()=>i?.projection.getCode()??"",[i]);let{coordinates:l}=Pn(a);l=l&&t?Ln(l,o,t):l;const d=Cn(l,e,s),c=t||o,g=d?d+" "+c:"";return u.jsx(L,{...n,children:u.jsx(Q,{className:"coordinate-viewer-text",children:g})})};function Cn(r,e,t){const s=bn();return r?Fn(r,e,s,t):""}function Pn(r){const[e,t]=p.useState();return p.useEffect(()=>{if(!r)return;const s=r.on("pointermove",n=>{t(n.coordinate)});return()=>R(s)},[r]),{coordinates:e}}function Fn(r,e,t,s){if(r[0]==null||r[1]==null)return"";const n=e??Mn,i=s??En,[a,o]=r;let l;if(i==="degree"&&isFinite(a)&&isFinite(o)){const[d,c,g]=gt(a,t,n),[h,f,m]=gt(o,t,n),v=`${Math.abs(d)}°${c}'${g}"${0<=d?"(E)":"(W)"}`,S=`${Math.abs(h)}°${f}'${m}"${0<=h?"(N)":"(S)"}`;l=v+" "+S}else{const d=t.formatNumber(a,{maximumFractionDigits:n,minimumFractionDigits:n}),c=t.formatNumber(o,{maximumFractionDigits:n,minimumFractionDigits:n});l=d+" "+c}return l}function gt(r,e,t){const s=Math.floor(r),n=r-s,i=Math.floor(60*n),o=60*(60*n-i),l=e.formatNumber(o,{maximumFractionDigits:t,minimumFractionDigits:t});return[s,i,l]}function Ln(r,e,t){return Ps(r,e,t)}const nr=r=>{const{displayMode:e="line"}=r,{containerProps:t}=B("scale-bar",r),{map:s}=$(r),n=p.useRef(null);return p.useEffect(()=>{if(n.current&&s){const i=s.olMap,a=new Ws({units:"metric",target:n.current,bar:e==="bar"});return i.addControl(a),()=>{i.removeControl(a)}}},[e,s]),u.jsx(L,{...t,ref:n})},In="@open-pioneer/scale-viewer",Tn=z.bind(void 0,In),ir=r=>{const{containerProps:e}=B("scale-viewer",r),{map:t}=$(r),s=Tn(),n=U(()=>t?.scale??1,[t]),i=n?s.formatNumber(n):void 0;return u.jsx(L,{...e,children:i&&u.jsxs(Q,{children:["1:",i]})})},An="@open-pioneer/legend",Bt=z.bind(void 0,An),rr=r=>{const{showBaseLayers:e=!1}=r,{containerProps:t}=B("legend",r),{map:s}=$(r);return u.jsx(L,{...t,children:s?u.jsx(Nn,{map:s,showBaseLayers:e}):null})};function Nn(r){const{map:e,showBaseLayers:t}=r,n=On(e).map(i=>u.jsx($t,{layer:i,showBaseLayers:t},i.id));return u.jsx(Ys,{as:"ul",className:"legend-layer-list",listStyleType:"none",spacing:2,children:n})}function $t(r){const{layer:e,showBaseLayers:t}=r,s=U(()=>e.visible,[e]),n=jn(e);if(!s||!t&&$s(e)&&Ut(e))return;const i=[];return n?.length&&n.forEach(a=>{i.push(u.jsx($t,{layer:a,showBaseLayers:t},a.id))}),u.jsxs(u.Fragment,{children:[u.jsx(kn,{layer:e,showBaseLayers:t}),i]})}function kn(r){const e=Bt(),{layer:t,showBaseLayers:s}=r,n=Ut(t),i=Dn(t),a=U(()=>t.legend,[t]);let o;return i?.Component?o=u.jsx(i.Component,{layer:t}):i?.imageUrl?o=u.jsx(ft,{layer:t,imageUrl:i.imageUrl}):a&&(o=u.jsx(ft,{layer:t,imageUrl:a})),o?u.jsxs(L,{as:"li",className:Le("legend-item",`layer-${Rn(t.id)}`),children:[s&&n?u.jsx(Q,{as:"b",children:e.formatMessage({id:"basemapLabel"})}):null,o]}):void 0}function ft(r){const e=Bt(),{layer:t,imageUrl:s}=r;return u.jsxs(L,{children:[u.jsx(Q,{children:t.title}),u.jsx(zs,{maxW:"none",maxH:"none",src:s,alt:e.formatMessage({id:"altLabel"},{layerName:t.title}),className:"legend-item__image",fallbackStrategy:"onError",fallback:u.jsx(L,{children:u.jsxs(Q,{children:[u.jsx(Ht,{me:2}),e.formatMessage({id:"fallbackLabel"})]})})})]})}function On(r){return U(()=>{const e=r.layers.getAllLayers({sortByDisplayOrder:!0})??[];return e.reverse(),e},[r])}function jn(r){return U(()=>{const e=r.sublayers?.getSublayers({sortByDisplayOrder:!0});if(e)return e.reverse(),e},[r])}function Dn(r){return U(()=>r.attributes.legend,[r])}function Ut(r){return!("parentLayer"in r)&&r.isBaseLayer}function Rn(r){return r.toLowerCase().replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}const Gn="@open-pioneer/measurement",Vn=z.bind(void 0,Gn);class Hn{olMap;messages;activeFeatureStyle;layer;source;draw=void 0;activeMeasurement;predefinedMeasurements=new Map;finishedMeasurements=new Set;helpTooltip;resources=[];measurementChangedHandler;constructor(e,t){this.olMap=e,this.messages=t;const s=this.source=new Fe;this.layer=new ee({source:s,zIndex:$e,properties:{name:"measurement-layer"}}),e.addLayer(this.layer);const n=e.on("pointermove",this.handlePointerMove.bind(this));this.resources.push({destroy(){R(n)}});const i=()=>{this.helpTooltip.element.classList.add("hidden")};e.getViewport().addEventListener("mouseout",i),this.resources.push({destroy(){e.getViewport().removeEventListener("mouseout",i)}}),this.helpTooltip=$n(this.olMap)}destroy(){this.stopMeasurement();for(const e of this.resources)e.destroy();this.resources=[],this.activeMeasurement=at(this.activeMeasurement);for(const e of this.finishedMeasurements)e.destroy();this.finishedMeasurements.clear(),this.helpTooltip.destroy(),this.olMap.removeLayer(this.layer),this.layer.dispose(),this.source.dispose(),this.measurementChangedHandler=void 0,this.predefinedMeasurements.clear()}getVectorLayer(){return this.layer}setFinishedFeatureStyle(e){this.layer.setStyle(e)}setMeasurementSourceChangedHandler(e){this.measurementChangedHandler=e}setPredefinedMeasurements(e){this.updatePredefinedMeasurements(e)}setActiveFeatureStyle(e){const t=Fs(e);this.activeFeatureStyle=(s,...n)=>{const i=s?.getGeometry()?.getType();if(i==="Polygon"||i==="LineString"||i==="Point")return t(s,...n)},this.draw?.getOverlay().setStyle(this.activeFeatureStyle)}clearMeasurements(){const e=this.source.getFeatures();this.source.clear(),e.forEach(t=>{this.raiseMeasurementsChangeEvent("remove-measurement",t)}),this.predefinedMeasurements.clear();for(const t of this.finishedMeasurements)t.destroy();this.finishedMeasurements.clear()}startMeasurement(e){if(this.draw)throw new Error("Internal error: another measurement interaction is still active.");const t=e==="area"?"Polygon":"LineString",s=this.draw=new At({source:this.source,type:t,style:this.activeFeatureStyle});this.olMap.addInteraction(s);let n,i;s.on("drawstart",a=>{const o=a.feature;o&&(n=this.activeMeasurement=new mt("active",o,this),i=o.getGeometry()?.on("change",()=>{n?.updateTooltipContent(),n?.updateTooltipPosition()}))}),s.on("drawend",()=>{if(n&&n===this.activeMeasurement){const a=n;a.updateState("finished"),this.finishedMeasurements.add(a),this.raiseMeasurementsChangeEvent("add-measurement",a.feature),this.activeMeasurement=n=void 0}n=void 0,i&&R(i)}),s.on("drawabort",()=>{n&&(n.destroy(),n===this.activeMeasurement&&(this.activeMeasurement=void 0),n=void 0),i&&R(i)})}stopMeasurement(){this.draw&&(this.olMap.removeInteraction(this.draw),this.draw.abortDrawing(),this.draw.dispose(),this.draw=void 0),this.activeMeasurement=at(this.activeMeasurement)}handlePointerMove(e){if(e.dragging)return;const t=this.helpTooltip,s=Wn(this.messages,this.activeMeasurement);t.setText(s),t.overlay.setPosition(e.coordinate),t.element.classList.remove("hidden")}updatePredefinedMeasurements(e){const t=e.filter(n=>!this.predefinedMeasurements.has(n)),s=[];for(const n of this.predefinedMeasurements.keys())e.includes(n)||s.push(n);t.forEach(n=>{const i=new Z(n);this.source.addFeature(i);const a=new mt("finished",i,this);this.finishedMeasurements.add(a),this.predefinedMeasurements.set(n,a),this.raiseMeasurementsChangeEvent("add-measurement",i)}),s.forEach(n=>{const i=this.predefinedMeasurements.get(n);i&&(this.source.removeFeature(i.feature),this.finishedMeasurements.delete(i),i.destroy(),this.raiseMeasurementsChangeEvent("remove-measurement",i.feature)),this.predefinedMeasurements.delete(n)})}raiseMeasurementsChangeEvent(e,t){const s=t.getGeometry();this.measurementChangedHandler&&s&&this.measurementChangedHandler({kind:e,geometry:(s instanceof xe,s)})}}class mt{controller;feature;_state;tooltip;constructor(e,t,s){this.controller=s,this._state=e,this.feature=t,this.tooltip=Un(this.olMap),this.updateTooltipContent(),this.updateTooltipPosition(),this.tooltip.setActive(e==="active")}destroy(){this.tooltip.destroy()}get state(){return this._state}updateState(e){this._state!==e&&(this._state=e,this.tooltip.setActive(e==="active"))}updateTooltipContent(){const e=this.feature.getGeometry();if(!e)return;const t=this.olMap.getView().getProjection();let s;e instanceof xe?s=zn(e,t,this.messages):e instanceof Ge&&(s=Kn(e,t,this.messages)),s&&this.tooltip.setHtml(s)}updateTooltipPosition(){const e=this.feature.getGeometry();if(!e)return;let t;if(e instanceof xe)t=e.getInteriorPoint().getCoordinates()||null;else if(e instanceof Ge)t=e.getLastCoordinate()||null;else return;this.tooltip.overlay.setPosition(t)}get olMap(){return this.controller.olMap}get messages(){return this.controller.messages}}const pt=[0,-15],Bn=[0,-7];function $n(r){const e=document.createElement("div");e.className="measurement-tooltip printing-hide hidden",e.role="tooltip";const t=document.createElement("span");e.appendChild(t);const s=new Ie({element:e,offset:[15,0],positioning:"center-left"});return r.addOverlay(s),{overlay:s,element:e,destroy(){r.removeOverlay(s)},setText(n){t.textContent=n},setHtml(n){t.innerHTML=n}}}function Un(r){const e=document.createElement("div");e.role="tooltip",e.className="measurement-tooltip measurement-active-tooltip printing-hide";const t=document.createElement("span");e.appendChild(t);const s=new Ie({element:e,offset:pt,positioning:"bottom-center",stopEvent:!1,insertFirst:!1});return r.addOverlay(s),{overlay:s,element:e,destroy(){r.removeOverlay(s)},setActive(n){n?(e.className="measurement-tooltip measurement-active-tooltip printing-hide",s.setOffset(pt)):(e.className="measurement-tooltip measurement-finished-tooltip",s.setOffset(Bn))},setText(n){t.textContent=n},setHtml(n){t.innerHTML=n}}}function Wn(r,e){if(e){const t=e.feature.getGeometry();if(t instanceof xe||t instanceof Ge)return r.getContinueMessage()}return r.getHelpMessage()}function zn(r,e,t){const s=Ls(r,{projection:e});let n;return s>=1e6?n=`${t.formatNumber(s/1e6)} km2`:n=`${t.formatNumber(s)} m2`,n}function Kn(r,e,t){const s=Is(r,{projection:e});let n;return s>=1e3?n=`${t.formatNumber(s/1e3)} km`:n=`${t.formatNumber(s)} m`,n}const or=r=>{const e=Vn(),{containerProps:t}=B("measurement",r),[s,n]=p.useState("distance"),i=c=>e.formatMessage({id:c}),a=$(r),o=qn(a.map,r,e);p.useEffect(()=>{if(o)return o.startMeasurement(s),()=>{o.stopMeasurement()}},[o,s]);function l(c){if(c==="distance"||c==="area")n(c);else throw new Error(`Unexpected measurement type: '${c}'.`)}function d(){o?.clearMeasurements()}return u.jsxs(L,{...t,children:[u.jsx(Q,{mb:3,children:e.formatMessage({id:"measurementInfoText"})}),u.jsx(be,{mb:4,alignItems:"center",children:u.jsxs(Ve,{mb:2,children:[u.jsx(Me,{mb:1,children:i("measurementLabel")}),u.jsxs(Ke,{value:s,onChange:c=>l(c.target.value),className:"measurement-select",children:[u.jsx("option",{value:"distance",children:i("distance")}),u.jsx("option",{value:"area",children:i("area")})]})]})}),u.jsx(Ft,{padding:2,className:"measurement-delete-button",onClick:d,width:"100%",children:i("deleteMeasurementLabel")})]})};function qn(r,e,t){const{activeFeatureStyle:s,finishedFeatureStyle:n,onMeasurementsChange:i,predefinedMeasurements:a}=e,[o,l]=p.useState(void 0);return p.useEffect(()=>{if(!r)return;const d=new Hn(r.olMap,{getContinueMessage(){return t.formatMessage({id:"tooltips.continue"})},getHelpMessage(){return t.formatMessage({id:"tooltips.help"})},formatNumber(c){return t.formatNumber(c,{maximumFractionDigits:2})}});return l(d),()=>{d.destroy(),l(void 0)}},[r,t]),p.useEffect(()=>{o?.setActiveFeatureStyle(s??Yn())},[o,s]),p.useEffect(()=>{o?.setFinishedFeatureStyle(n??Jn())},[o,n]),p.useEffect(()=>{o?.setMeasurementSourceChangedHandler(i)},[o,i]),p.useEffect(()=>{o?.setPredefinedMeasurements(a??[])},[o,a]),o}function Yn(){return[new we({stroke:new ie({color:"#fff",lineDash:[10,10],width:5})}),new we({fill:new Re({color:"rgba(0,0,0,0.15)"}),stroke:new ie({color:"rgba(0, 0, 0, 0.7)",lineDash:[10,10],width:3}),image:new Ts({radius:5,stroke:new ie({color:"rgba(0, 0, 0, 0.7)",width:2}),fill:new Re({color:"rgba(255, 255, 255, 0.2)"})})})]}function Jn(){return[new we({stroke:new ie({color:"#fff",width:5})}),new we({stroke:new ie({color:"#0b96fc",width:3}),fill:new Re({color:"rgba(11,150,252,0.15)"})})]}const Xn="@open-pioneer/search",Te=z.bind(void 0,Xn);function Zn(r){const e=r.selectProps.inputValue.length>0,t={...r,className:Le(r.className,{"search-invisible":!e})};return u.jsx(j.Menu,{...t,children:r.children})}function Qn(r){const e=r.data.label,t={...r.innerProps,"aria-label":e,role:"group"};return u.jsx(j.Group,{...r,innerProps:t})}function ei(r){const t=Te().formatMessage({id:"noOptionsText"});return u.jsx(j.NoOptionsMessage,{...r,children:u.jsx(G.span,{className:"search-no-match",children:t})})}function ti(r){const t=Te().formatMessage({id:"loadingText"});return u.jsx(j.LoadingMessage,{...r,children:u.jsx(G.span,{className:"search-loading-text",children:t})})}function si({children:r,...e}){const t={...e,className:Le(e.className,"search-value-container")};return u.jsxs(j.ValueContainer,{...t,children:[!!r&&u.jsx(Sn,{style:{position:"absolute",left:8}}),r]})}function ni(r){const e={...r,isHidden:!1};return u.jsx(j.Input,{...e})}function ii(r){return null}function ri(r){return u.jsxs(j.IndicatorsContainer,{...r,children:[r.children,!r.selectProps.isLoading&&r.selectProps.inputValue&&u.jsx(oi,{selectProps:r.selectProps,clearValue:r.clearValue})]})}function oi(r){const t=Te().formatMessage({id:"ariaLabel.clearButton"}),s=n=>{n.preventDefault(),n.stopPropagation(),r.clearValue()};return u.jsx(Rs,{role:"button",size:"md",mr:1,"aria-label":t,onClick:s,onTouchEnd:s,onMouseDown:n=>n.preventDefault()})}function ai(r){return null}function li(r){const e=r.selectProps.inputValue,t=r.data.label,s={...r,className:Le(r.className,"search-option")};return u.jsx(j.Option,{...s,children:u.jsx(G.div,{className:"search-option-label",children:e.trim().length>0?ci(t,e):t})})}function ci(r,e){const t=r.toLowerCase().indexOf(e.toLowerCase());return t>=0?u.jsxs(u.Fragment,{children:[r.substring(0,t),u.jsx(G.span,{className:"search-highlighted-match",children:r.substring(t,t+e.length)},"highlighted"),r.substring(t+e.length)]}):r}const yt=fe("search:SearchController"),_t=200,vt=5;var de,Y,J,X,O,Ce,Wt;class di{constructor(e,t){x(this,Ce);x(this,de);x(this,Y,[]);x(this,J,vt);x(this,X,_t);x(this,O);b(this,de,e),b(this,Y,t)}destroy(){_(this,O)?.abort(),b(this,O,void 0)}async search(e){if(_(this,O)?.abort(),b(this,O,void 0),!e)return[];const t=b(this,O,new AbortController);try{return await ui(t.signal,_(this,X)),t.signal.aborted&&(yt.debug(`search canceled with ${e}`),Gs()),(await Promise.all(_(this,Y).map(n=>te(this,Ce,Wt).call(this,n,e,t.signal)))).filter(n=>n!=null)}finally{_(this,O)===t&&b(this,O,void 0)}}get searchTypingDelay(){return _(this,X)}set searchTypingDelay(e){b(this,X,e??_t)}get maxResultsPerSource(){return _(this,J)}set maxResultsPerSource(e){b(this,J,e??vt)}get sources(){return _(this,Y)}}de=new WeakMap,Y=new WeakMap,J=new WeakMap,X=new WeakMap,O=new WeakMap,Ce=new WeakSet,Wt=async function(e,t,s){const n=e.label,i=_(this,de).olMap.getView().getProjection();try{const a=_(this,J);let o=await e.search(t,{maxResults:a,signal:s,mapProjection:i});return o.length>a&&(o=o.slice(0,a)),{label:n,source:e,results:o}}catch(a){Lt(a)||yt.error(`search for source ${n} failed`,a);return}};async function ui(r,e){r.aborted||await new Promise(t=>{const s=()=>{r.removeEventListener("abort",s),clearTimeout(n),t()};r.addEventListener("abort",s);const n=setTimeout(s,e)})}const Ee=fe("search:Search"),ar=r=>{const{sources:e,searchTypingDelay:t,maxResultsPerGroup:s,onSelect:n,onClear:i}=r,{containerProps:a}=B("search",r),{map:o}=$(r),l=Te(),d=mi(e,t,s,o),{input:c,search:g,selectedOption:h,onInputChanged:f,onResultConfirmed:m}=pi(d),v=fi(),S=hi(l),I=gi(),N=H((C,me)=>{me.action==="input-change"&&f(C)}),w=H((C,me)=>{switch(me.action){case"select-option":C&&(m(C),n?.({source:C.source,result:C.result}));break;case"clear":f(""),E.current?.blur(),E.current?.focus(),i?.();break;default:Ee.debug(`Unhandled action type '${me.action}'.`);break}}),E=p.useRef(null);return u.jsx(L,{...a,children:u.jsx(Nt,{className:"search-component",classNamePrefix:"react-select",ref:E,inputValue:c,onInputChange:N,"aria-label":l.formatMessage({id:"ariaLabel.search"}),ariaLiveMessages:S,tagColorScheme:"trails",selectedOptionStyle:"color",selectedOptionColorScheme:"trails",chakraStyles:v,isClearable:!0,placeholder:r.placeholder??l.formatMessage({id:"searchPlaceholder"}),closeMenuOnSelect:!0,isLoading:g.kind==="loading",options:g.kind==="ready"?g.results:void 0,filterOption:()=>!0,tabSelectsValue:!1,components:I,onChange:w,value:h,menuPosition:"fixed"})})};function hi(r){return p.useMemo(()=>({onFocus:()=>"",onChange:()=>"",guidance:()=>`${r.formatMessage({id:"ariaLabel.instructions"})}`,onFilter:()=>""}),[r])}function gi(){return p.useMemo(()=>({Menu:Zn,Input:ni,SingleValue:ii,Option:li,NoOptionsMessage:ei,LoadingMessage:ti,ValueContainer:si,IndicatorsContainer:ri,ClearIndicator:ai,Group:Qn}),[])}function fi(){const[r,e,t]=It("colors",["trails.100","trails.50","chakra-body-text"],["#d5e5ec","#eaf2f5","#1A202C"]);return p.useMemo(()=>({groupHeading:n=>({...n,backgroundColor:r,padding:"8px 12px",fontSize:"inherit",fontWeight:"inherit"}),option:n=>({...n,backgroundColor:"inherit",_focus:{backgroundColor:e},_selected:{color:t}}),dropdownIndicator:n=>({...n,display:"none"})}),[r,e,t])}function mi(r,e,t,s){const[n,i]=p.useState(void 0);return p.useEffect(()=>{if(!s)return;const a=new di(s,r);return i(a),()=>{a.destroy(),i(void 0)}},[s,r]),p.useEffect(()=>{n&&(n.searchTypingDelay=e)},[n,e]),p.useEffect(()=>{n&&(n.maxResultsPerSource=t)},[n,t]),n}function pi(r){const[e,t]=p.useReducer((o,l)=>{switch(l.kind){case"input":return{...o,query:l.query,selectedOption:null};case"select-option":return{...o,selectedOption:l.option,query:l.option.label};case"load-results":return{...o,search:{kind:"loading"}};case"accept-results":return{...o,search:{kind:"ready",results:l.results}}}},void 0,()=>({query:"",selectedOption:null,search:{kind:"ready",results:[]}})),s=p.useRef(),n=H(o=>{if(!r){s.current=void 0,t({kind:"accept-results",results:[]});return}Ee.isDebug()&&Ee.debug(`Starting new search for query ${JSON.stringify(o)}.`),t({kind:"load-results"});const l=s.current=yi(r,o).then(d=>{s.current===l&&t({kind:"accept-results",results:d})})}),i=p.useCallback(o=>{t({kind:"select-option",option:o})},[]),a=p.useCallback(o=>{t({kind:"input",query:o}),n(o)},[n]);return{input:e.query,search:e.search,selectedOption:e.selectedOption,onResultConfirmed:i,onInputChanged:a}}async function yi(r,e){let t;try{t=await r.search(e)}catch(s){Lt(s)||Ee.error("Search failed",s),t=[]}return _i(t)}function _i(r){return r.map((t,s)=>({label:t.label,options:t.results.map(n=>({value:`${s}-${n.id}`,label:n.label,source:t.source,result:n}))}))}const zt="@open-pioneer/selection",vi=Ue.bind(void 0,zt),qe=z.bind(void 0,zt),ne="selection-active",_e="selection-inactive";class Si{tooltip;interactionResources=[];olMap;isActive=!0;tooltipMessage;tooltipDisabledMessage;constructor(e,t,s,n){const i=this.initViewport(e);this.interactionResources.push(this.createDragBox(e,n,i,this.interactionResources)),this.interactionResources.push(this.createDrag(e,i,this.interactionResources)),this.tooltip=this.createHelpTooltip(e,t),this.olMap=e,this.tooltipMessage=t,this.tooltipDisabledMessage=s}initViewport(e){const t=e.getViewport();return t.classList.add(ne),t.oncontextmenu=s=>(s.preventDefault(),!1),t}destroy(){this.tooltip.destroy(),this.interactionResources.forEach(e=>{e.destroy()})}setActive(e){if(this.isActive===e)return;const t=this.olMap.getViewport();e?(this.interactionResources.forEach(s=>this.olMap.addInteraction(s.interaction)),this.tooltip.setText(this.tooltipMessage),t.classList.remove(_e),t.classList.add(ne),this.isActive=!0):(this.interactionResources.forEach(s=>this.olMap.removeInteraction(s.interaction)),this.tooltip.setText(this.tooltipDisabledMessage),t.classList.remove(ne),t.classList.add(_e),this.isActive=!1)}createDragBox(e,t,s,n){const i=new nt({className:"selection-drag-box",condition:As});return e.addInteraction(i),i.on("boxend",function(){t(i.getGeometry())}),{interaction:i,destroy(){e.removeInteraction(i),n.splice(n.indexOf(this)),i.dispose(),s.classList.remove(ne),s.classList.remove(_e),s.oncontextmenu=null}}}createDrag(e,t,s){const n=function(o){return o.originalEvent.button==2},i=new it({condition:n});return e.addInteraction(i),{interaction:i,destroy(){e.removeInteraction(i),s.splice(s.indexOf(this)),i.dispose(),t.classList.remove(ne),t.classList.remove(_e),t.oncontextmenu=null}}}createHelpTooltip(e,t){const s=document.createElement("div");s.className="selection-tooltip printing-hide",s.role="tooltip";const n=document.createElement("span");n.textContent=t,s.appendChild(n);const i=new Ie({element:s,offset:[15,0],positioning:"center-left"}),a=e.on("pointermove",o=>{i.setPosition(o.coordinate)});return e.addOverlay(i),{overlay:i,element:s,destroy(){e.removeOverlay(i),i.dispose(),R(a)},setText(o){n.textContent=o}}}getDragboxInteraction(){return this.interactionResources.find(e=>e.interaction instanceof nt)}getDragPanInteraction(){return this.interactionResources.find(e=>e.interaction instanceof it)}}const je=fe("selection:SelectionController"),xi=1e4;var ue,he,ge,Pe,Kt;class wi{constructor(e){x(this,Pe);x(this,ue);x(this,he);x(this,ge);const{mapModel:t,onError:s,maxResults:n=xi}=e;b(this,ue,t),b(this,he,n),b(this,ge,s)}destroy(){}async select(e,t){if(t)return await te(this,Pe,Kt).call(this,e,t)}}ue=new WeakMap,he=new WeakMap,ge=new WeakMap,Pe=new WeakSet,Kt=async function(e,t){const s=_(this,ue).olMap.getView().getProjection();try{je.debug(`Starting selection on source '${e.label}'`);const n=_(this,he);let i=await e.select({type:"extent",extent:t},{maxResults:n,mapProjection:s,signal:new AbortController().signal});return i.length>n&&(i=i.slice(0,n)),je.debug(`Found ${i.length} results on source '${e.label}'`),{source:e,results:i}}catch(n){je.error(`selection from source ${e.label} failed`,n),_(this,ge).call(this);return}};const bi={classNamePrefix:"react-select",menuPosition:"fixed",isSearchable:!1,isClearable:!1},lr=r=>{const e=qe(),{sources:t,onSelectionComplete:s,onSelectionSourceChanged:n}=r,{containerProps:i}=B("selection",r),a=e.formatMessage({id:"sourceNotAvailable"}),[o,l]=Ci(t,n),d=Jt(o,a),c=$(r),{onExtentSelected:g}=Pi(c.map,t,o,s),h=Li(),[f,m]=p.useState(!1);Fi(c.map,e,g,d.kind==="available",!!o);const v=p.useMemo(()=>t.map(w=>({label:w.label,value:w})),[t]),S=p.useMemo(()=>v.find(E=>E.value===o)||null,[v,o]),I=H(w=>{l(w?.value)}),N=H(w=>{!f&&w.key==="Enter"&&m(!0)});return u.jsx(Vs,{...i,spacing:2,children:u.jsxs(be,{children:[u.jsx(Me,{children:e.formatMessage({id:"selectSource"})}),u.jsx(Nt,{className:"selection-source react-select",...bi,options:v,placeholder:e.formatMessage({id:"selectionPlaceholder"}),value:S,onChange:I,components:{Option:Mi,SingleValue:Ei},isOptionDisabled:()=>!1,getOptionLabel:w=>{const E=w.label,C=Yt(w.value,a);return C.kind=="available"?E:E+" "+C.reason},ariaLiveMessages:{guidance:()=>"",onChange:w=>w.action=="select-option"||w.action=="initial-input-focus"?w.label+" "+e.formatMessage({id:"selected"}):"",onFilter:()=>"",onFocus:()=>""},chakraStyles:h,onKeyDown:N,menuIsOpen:f,onMenuOpen:()=>m(!0),onMenuClose:()=>m(!1)})]})})};function Mi(r){const{value:e}=r.data,{isAvailable:t,content:s}=qt(e,!1);return u.jsx(j.Option,{...r,isDisabled:!t,className:"selection-source-option",children:s})}function Ei(r){const{value:e}=r.data,{isAvailable:t,content:s}=qt(e,!0),n=t?"selection-source-value":"selection-source-value selection-source-value--disabled";return u.jsx(j.SingleValue,{...r,isDisabled:!t,className:n,children:s})}function Ci(r,e){const[t,s]=p.useState(()=>r[0]);p.useEffect(()=>{t&&!r.includes(t)&&s(void 0)},[r,t]);const n=p.useRef(void 0);return p.useEffect(()=>{t!==n.current&&(n.current=t,e?.({source:t}))},[t,e]),[t,s]}function qt(r,e){const t=qe(),s=r?.label,n=t.formatMessage({id:"sourceNotAvailable"}),i=Jt(r,n);return{isAvailable:i.kind==="available",content:u.jsxs(rt,{direction:"row",alignItems:"center",grow:1,children:[!e&&u.jsx(rt,{grow:1,children:s}),i.kind==="unavailable"&&u.jsx(L,{ml:2,children:u.jsx(Hs,{label:i.reason,placement:"right",openDelay:500,children:u.jsx(G.span,{children:u.jsx(Bs,{as:Js,color:"red",className:"warning-icon","aria-label":i.reason})})})}),e&&s]})}}function Pi(r,e,t,s){const n=vi("notifier.NotificationService"),i=qe(),[a,o]=p.useState(void 0);p.useEffect(()=>{if(!r)return;const d=new wi({mapModel:r,onError(){n.notify({level:"error",message:i.formatMessage({id:"selectionFailed"})})}});return o(d),()=>{d.destroy()}},[r,n,e,i]);const l=H(async d=>{if(!a||!t)return;const c=await a.select(t,d.getExtent());c&&s?.(c)});return{controller:a,onExtentSelected:l}}function Yt(r,e){const t=r.status??"available",s=typeof t=="string"?{kind:t}:t;return s.kind==="available"?s:{kind:"unavailable",reason:s.reason??e}}function Jt(r,e){return U(()=>r?Yt(r,e):{kind:"unavailable",reason:e},[r,e])}function Fi(r,e,t,s,n){p.useEffect(()=>{if(!r)return;const i=n?e.formatMessage({id:"disabledTooltip"}):e.formatMessage({id:"noSourceTooltip"}),a=new Si(r.olMap,e.formatMessage({id:"tooltip"}),i,t);return a.setActive(s),()=>{a?.destroy()}},[r,e,t,s,n])}function Li(){const[r,e]=It("colors",["background_body","border"],["#ffffff","#ffffff"]);return p.useMemo(()=>({control:s=>({...s,cursor:"pointer"}),indicatorSeparator:s=>({...s,borderColor:e}),dropdownIndicator:s=>({...s,backgroundColor:r})}),[r,e])}const Xt="@open-pioneer/printing",Zt=Ue.bind(void 0,Xt),Ii=z.bind(void 0,Xt),Ti="map";class Ai{olMap;i18n;printingService;viewPadding;printMap=void 0;overlay=void 0;constructor(e,t,s){this.olMap=e,this.printingService=t,this.i18n=s}destroy(){this.reset()}setViewPadding(e){this.viewPadding=e}async handleMapExport(e){if(this.olMap)try{this.begin(),this.printMap=await this.printingService.printMap(this.olMap,{blockUserInteraction:!1,viewPadding:this.viewPadding});const t=this.printMap.getCanvas();if(t)e.fileFormat=="png"?await this.exportMapInPNG(t,e):await this.exportMapInPDF(t,e);else throw new Error("Canvas export failed")}finally{this.reset()}}begin(){const e=this.olMap.getTargetElement();e&&(this.overlay=Ks(e,this.i18n.overlayText))}reset(){this.overlay?.destroy(),this.overlay=void 0}getTitleAndFileName(e){const t=e.title||"",s=e.title||Ti;return{title:t,fileName:s}}async exportMapInPNG(e,t){const s=document.createElement("canvas");s.width=e.width,s.height=e.height+50,s.style.backgroundColor="#fff";const n=s.getContext("2d");if(!n)throw new Error("2d canvas rendering context not available");const{title:i,fileName:a}=this.getTitleAndFileName(t);n.fillStyle="#fff",n.fillRect(0,0,s.width,s.height),n.font="20px bold sans-serif",n.textAlign="center",n.fillStyle="#000";const o=s.width/2;n.fillText(i,o,20),n.drawImage(e,0,50);const l=document.createElement("a");l.setAttribute("download",a+".png");const d=qs(s);if(!d)throw new Error("Failed to get image data URL");l.href=d,l.click()}async exportMapInPDF(e,t){const{jsPDF:s}=await Xs(async()=>{const{jsPDF:I}=await import("./DyTV57ff4rkW.js");return{jsPDF:I}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),n=new s({orientation:"landscape",unit:"mm",format:"a4"}),i=n.internal.pageSize.getWidth(),a=n.internal.pageSize.getHeight(),o=15,l=20,d=a-l;n.setFontSize(20);const{title:c,fileName:g}=this.getTitleAndFileName(t);n.text(c,i/2,o,{align:"center"});const h=e.width/e.height;let f=d,m=f*h;m>=i&&(m=i,f=m/h);const v=(i-m)/2,S=l+(d-f)/2;n.addImage(e,"",v,S,m,f),n.save(g+".pdf")}}const Ni=fe("printing"),cr=r=>{const e=Ii(),{viewPadding:t="auto"}=r,{containerProps:s}=B("printing",r),[n,i]=p.useState("pdf"),[a,o]=p.useState(""),[l,d]=p.useState(!1),c=Zt("notifier.NotificationService"),{map:g}=$(r),h=ki(g,e,t);function f(v){(v==="png"||v==="pdf")&&i(v)}function m(){l||!h||(d(!0),h.handleMapExport({title:a,fileFormat:n}).catch(v=>{const S=e.formatMessage({id:"printingFailed"});c.notify({level:"error",message:S}),Ni.error("Failed to print the map",v)}).finally(()=>{d(!1)}))}return u.jsx(L,{...s,children:u.jsxs(L,{as:"form",m:2,alignItems:"center",onSubmit:v=>{v.preventDefault(),m()},children:[u.jsxs(be,{as:Ve,mb:2,children:[u.jsx(Me,{minWidth:"82",mb:1,children:e.formatMessage({id:"title"})}),u.jsx(ze,{placeholder:e.formatMessage({id:"input.placeholder"}),value:a,onChange:v=>{o(v.target.value)},autoFocus:!0})]}),u.jsxs(be,{as:Ve,mb:2,children:[u.jsx(Me,{minWidth:"82",mb:1,children:e.formatMessage({id:"fileFormat"})}),u.jsxs(Ke,{value:n,onChange:v=>f(v.target.value),className:"printing-select",children:[u.jsx("option",{value:"png",children:"PNG"}),u.jsx("option",{value:"pdf",children:"PDF"})]})]}),u.jsx(Ft,{isLoading:l,loadingText:e.formatMessage({id:"printingMap"}),disabled:l,mt:2,p:2,className:"printing-export-button",type:"submit",width:"100%",children:e.formatMessage({id:"export"})})]})})};function ki(r,e,t){const s=Zt("printing.PrintingService"),[n,i]=p.useState(void 0);return p.useEffect(()=>{if(!r)return;const a=new Ai(r.olMap,s,{overlayText:e.formatMessage({id:"printingMap"})});return i(a),()=>{a.destroy(),i(void 0)}},[r,e,s]),p.useEffect(()=>{n?.setViewPadding(t)},[n,t]),n}export{sr as C,Qi as E,ze as I,rr as L,or as M,tr as N,Ie as O,cr as P,Rt as S,er as V,Zi as W,nr as a,ir as b,ar as c,lr as d,Ke as e};
diff --git a/openlayers-base-packages/assets/OM1YzF7yjem8.js b/openlayers-base-packages/assets/OM1YzF7yjem8.js
new file mode 100644
index 000000000..f8bc1a6a9
--- /dev/null
+++ b/openlayers-base-packages/assets/OM1YzF7yjem8.js
@@ -0,0 +1,4 @@
+var J=a=>{throw TypeError(a)};var V=(a,e,t)=>e.has(a)||J("Cannot "+t);var w=(a,e,t)=>(V(a,e,"read from private field"),t?t.call(a):e.get(a)),E=(a,e,t)=>e.has(a)?J("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t),v=(a,e,t,i)=>(V(a,e,"write to private field"),i?i.call(a,t):e.set(a,t),t),x=(a,e,t)=>(V(a,e,"access private method"),t);import{r as R,a9 as ue,h as se,j as K,a7 as fe,g as Q,c as ge,d as _e}from"./Mxtq6FG0Aq1_.js";import{_ as me}from"./CmsKOCeNyeyo.js";import{b_ as pe,b$ as ye,B as Ce,c0 as we,c1 as ke,c2 as Te,bd as xe,c3 as Pe,bB as ve,bp as Z,bt as Se,a as Le,b as De,c4 as Ee,bh as ee,bA as be,c5 as Me,a9 as Ie,bm as k,c6 as Fe,G as Re,bo as ne,a_ as b,an as B,c7 as te,bw as Ne,ao as Oe,am as re,bz as Ge,c8 as Ue,c9 as oe,ca as Ae,aK as je,aM as We,cb as ie,aq as Ve}from"./5C5XmiCGgLmB.js";import{a as Be,b as ae,M as he,G as qe}from"./DWkb3PmnrxhS.js";import{L as j}from"./D69t4K7RmA6W.js";function He(a){const{loading:e,src:t,srcSet:i,onLoad:s,onError:r,crossOrigin:n,sizes:o,ignoreFallback:h}=a,[l,c]=R.useState("pending");R.useEffect(()=>{c(t?"loading":"pending")},[t]);const d=R.useRef(),u=R.useCallback(()=>{if(!t)return;f();const g=new Image;g.src=t,n&&(g.crossOrigin=n),i&&(g.srcset=i),o&&(g.sizes=o),e&&(g.loading=e),g.onload=_=>{f(),c("loaded"),s?.(_)},g.onerror=_=>{f(),c("failed"),r?.(_)},d.current=g},[t,n,i,o,s,r,e]),f=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return ue(()=>{if(!h)return l==="loading"&&u(),()=>{f()}},[l,u,h]),h?"loaded":l}const $e=(a,e)=>a!=="loaded"&&e==="beforeLoadOrError"||a==="failed"&&e==="onError",Y=se(function(e,t){const{htmlWidth:i,htmlHeight:s,alt:r,...n}=e;return K.jsx("img",{width:i,height:s,ref:t,alt:r,...n})});Y.displayName="NativeImage";const Xe=se(function(e,t){const{fallbackSrc:i,fallback:s,src:r,srcSet:n,align:o,fit:h,loading:l,ignoreFallback:c,crossOrigin:d,fallbackStrategy:u="beforeLoadOrError",referrerPolicy:f,...g}=e,_=i!==void 0||s!==void 0,m=l!=null||c||!_,P=He({...e,crossOrigin:d,ignoreFallback:m}),T=$e(P,u),p={ref:t,objectFit:h,objectPosition:o,...m?g:fe(g,["onError","onLoad"])};return T?s||K.jsx(Q.img,{as:Y,className:"chakra-image__placeholder",src:i,...p}):K.jsx(Q.img,{as:Y,src:r,srcSet:n,crossOrigin:d,loading:l,referrerPolicy:f,className:"chakra-image",...p})});Xe.displayName="Image";class W extends pe{constructor(e,t,i){super(),i!==void 0&&t===void 0?this.setFlatCoordinates(i,e):(t=t||0,this.setCenterAndRadius(e,t,i))}clone(){const e=new W(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,s){const r=this.flatCoordinates,n=e-r[0],o=t-r[1],h=n*n+o*o;if(h=i[0]||e[1]<=i[1]&&e[3]>=i[1]?!0:we(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){const t=this.stride,i=this.flatCoordinates[t]-this.flatCoordinates[0],s=e.slice();s[t]=s[0]+i;for(let r=1;r component has likely been used twice in your application.`),{destroy(){}};v(this,C,e);const t=w(this,D);if(v(this,D,void 0),t)for(const[s,...r]of t)e[s](...r);let i=!1;return{destroy:()=>{i||(i=!0,w(this,C)===e&&v(this,C,void 0))}}}}C=new WeakMap,D=new WeakMap,F=new WeakMap,y=new WeakSet,I=function(e,t){typeof t=="string"&&(t={message:t}),this.notify({...t,level:e})},z=function(e,...t){if(w(this,C))w(this,C)[e](...t);else{const i=w(this,D)??v(this,D,[]);if(i.length>=1024){q.error(`Internal notification buffer overflow: this event will be dropped to prevent a memory leak.
+Make sure that the UI is configured to display notifications (use ).`,{method:e,args:t});return}i.push([e,...t])}},Ke=function(){w(this,C)||q.warn(`No notification handler has been registered: notifications will not be visible.
+Make sure that your app contains the component.`)};const N={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class O extends Oe{constructor(e,t){super(e),this.feature=t}}function Ye(a,e){const t=[];for(let i=0;i=t?a[e-t]:a[e]}function U(a,e,t){let i,s;en){const h=L(a,i),l=L(a,s);return G(h,l)}let o=0;if(iu.startIndex?_u.startIndex&&(_-=f.length)),h=_,o=d)}const l=e.targets[o];let c=l.ring;if(e.targetIndex===o&&c){const d=L(l.coordinates,h),u=t.getPixelFromCoordinate(d);ne(u,e.startPx)>i&&(c=!1)}if(c){const d=l.coordinates,u=d.length,f=l.startIndex,g=h;if(f=t?i-=t:i<0&&(i+=t);let r=i+1;r>=t&&(r-=t);const n=a[i],o=n[0],h=n[1],l=a[r],c=l[0]-o,d=l[1]-h;return[o+c*s,h+d*s]}class Je extends xe{constructor(e){const t=e;t.stopDown||(t.stopDown=Pe),super(t),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=Ze(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:ve,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let i=e.geometryFunction;if(!i){const s=this.mode_;if(s==="Circle")i=(r,n,o)=>{const h=n||new W([NaN,NaN]),l=Z(r[0]),c=Se(l,Z(r[r.length-1]));return h.setCenterAndRadius(l,Math.sqrt(c),this.geometryLayout_),h};else{let r;s==="Point"?r=B:s==="LineString"?r=j:s==="Polygon"&&(r=re),i=(n,o,h)=>(o?s==="Polygon"?n[0].length?o.setCoordinates([n[0].concat([n[0][0]])],this.geometryLayout_):o.setCoordinates([],this.geometryLayout_):o.setCoordinates(n,this.geometryLayout_):o=new r(n,this.geometryLayout_),o)}}this.geometryFunction_=i,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new Le({source:new De({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:Qe(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:Ee,this.freehandCondition_,e.freehand?this.freehandCondition_=ee:this.freehandCondition_=e.freehandCondition?e.freehandCondition:be,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(Me.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=ee:t=e:t=Ge,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===Ie.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===k.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===k.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,t=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===k.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===k.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===k.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===k.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===k.DBLCLICK&&(i=!1),super.handleEvent(e)&&i}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new Fe(k.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))},this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const t=this.getMap(),i=t.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),s=t.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),r=Re([i,s]),n=this.traceSource_.getFeaturesInExtent(r);if(n.length===0)return;const o=Ye(e.coordinate,n);o.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:o,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,t){const i=e.startIndex<=e.endIndex,s=e.startIndex<=t;i===s?i&&t>e.endIndex||!i&&te.endIndex)&&this.removeTracedCoordinates_(t,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,t))}removeTracedCoordinates_(e,t){if(e===t)return;let i=0;if(e0&&this.removeLastPoints_(i)}addTracedCoordinates_(e,t,i){if(t===i)return;const s=[];if(t=n;--o)s.push(S(e.coordinates,o))}s.length&&this.appendCoordinates(s)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&ne(t.startPx,e.pixel)this.squaredClickTolerance_:n<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,t){let i=!1;if(this.sketchFeature_){let s=!1,r=[this.finishCoordinate_];const n=this.mode_;if(n==="Point")i=!0;else if(n==="Circle")i=this.sketchCoords_.length===2;else if(n==="LineString")s=!t&&this.sketchCoords_.length>this.minPoints_;else if(n==="Polygon"){const o=this.sketchCoords_;s=o[0].length>this.minPoints_,r=[o[0][0],o[0][o[0].length-2]],t?r=[o[0][0]]:r=[o[0][0],o[0][o[0].length-2]]}if(s){const o=this.getMap();for(let h=0,l=r.length;h=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(e.slice()),this.geometryFunction_(r,t,i)):n==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():s=!0),r.push(e.slice()),s&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,t,i)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),s?this.finishDrawing():this.sketchFeature_}removeLastPoints_(e){if(!this.sketchFeature_)return;const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),s=this.mode_;for(let r=0;r=2){this.finishCoordinate_=n[n.length-2].slice();const o=this.finishCoordinate_.slice();n[n.length-1]=o,this.createOrUpdateSketchPoint_(o)}this.geometryFunction_(n,t,i),t.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(t)}else if(s==="Polygon"){n=this.sketchCoords_[0],n.splice(-2,1);const o=this.sketchLine_.getGeometry();if(n.length>=2){const h=n[n.length-2].slice();n[n.length-1]=h,this.createOrUpdateSketchPoint_(h)}o.setCoordinates(n),this.geometryFunction_(this.sketchCoords_,t,i)}if(n.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return null;let t=this.sketchCoords_;const i=e.getGeometry(),s=this.getMap().getView().getProjection();return this.mode_==="LineString"?(t.pop(),this.geometryFunction_(t,i,s)):this.mode_==="Polygon"&&(t[0].pop(),this.geometryFunction_(t,i,s),t=i.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new Be([t])):this.type_==="MultiLineString"?e.setGeometry(new ae([t])):this.type_==="MultiPolygon"&&e.setGeometry(new he([t])),this.dispatchEvent(new O(N.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e),e}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new O(N.DRAWABORT,e))}appendCoordinates(e){const t=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(e[0]);let s;if(t==="LineString"||t==="Circle")s=this.sketchCoords_;else if(t==="Polygon")s=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&s.shift(),s.pop();for(let n=0;n=h){u=_,f=m,g=P;break}else if(f>=o)break;_=u,m=f,P=g,++d}const T=this.scaleBar_?this.createScaleBar(f,u,c):u.toFixed(g<0?-g:0)+" "+c;this.renderedHTML_!=T&&(this.innerElement_.innerHTML=T,this.renderedHTML_=T),this.renderedWidth_!=f&&(this.innerElement_.style.width=f+"px",this.renderedWidth_=f),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){const s=this.getScaleForResolution(),r=s<1?Math.round(1/s).toLocaleString()+" : 1":"1 : "+Math.round(s).toLocaleString(),n=this.scaleBarSteps_,o=e/n,h=[this.createMarker("absolute")];for(let c=0;c`+this.createMarker("relative")+(c%2===0||n===2?this.createStepText(c,e,!1,t,i):"")+"")}return h.push(this.createStepText(n,e,!0,t,i)),(this.scaleBarText_?``+r+"
":"")+h.join("")}createMarker(e){return``}createStepText(e,t,i,s,r){const o=(e===0?0:Math.round(s/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+r),h=e===0?-3:t/this.scaleBarSteps_*-1,l=e===0?0:t/this.scaleBarSteps_*2;return``+o+"
"}getScaleForResolution(){const e=ie(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||M,i=1e3/25.4;return e*i*t}render(e){const t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}}const it=.8,de="printing-hide";function st(a,e){return a.toDataURL("image/png",e??it)}function nt(a,e){const t=document.createElement("div");t.classList.add("printing-overlay",de),a.appendChild(t);const i=document.createElement("div");return i.classList.add("printing-overlay-status"),i.textContent=e,t.appendChild(i),{destroy(){t.remove()}}}class gt{defaultOverlayText;constructor(e){this.defaultOverlayText=e.intl.formatMessage({id:"printingMap"})}async printMap(e,t){return await new rt(e,{blockUserInteraction:!0,overlayText:this.defaultOverlayText,viewPadding:"auto",...t}).printMap()}}class rt{olMap;blockUserInteraction=!1;overlayText;viewPadding;running=!1;drawInformation=[];scaleLine=void 0;overlay=void 0;constructor(e,t){this.olMap=e,this.blockUserInteraction=t.blockUserInteraction,this.overlayText=t.overlayText,this.viewPadding=t.viewPadding}async printMap(){if(this.running)throw new Error("Printing already running.");try{await this.beginExport();let e=await this.printToCanvas(this.olMap.getViewport());if(!e)throw new Error("Canvas export failed");return this.viewPadding==="auto"&&(e=this.removePadding(e,this.getViewPadding())),new ot(e)}finally{this.reset()}}async beginExport(){this.running=!0;const e=this.olMap.getInteractions().getArray().filter(t=>t.getActive()&&t instanceof Je);if(this.drawInformation=[],e?.forEach(t=>{const i=t,s=i.getOverlay().getStyle();i.getOverlay().setStyle(null),this.drawInformation?.push({draw:i,style:s})}),this.blockUserInteraction){const t=this.olMap?.getTargetElement();t&&(this.overlay=nt(t,this.overlayText))}await this.addScaleLine()}async addScaleLine(){const t=(this.scaleLine=new tt({className:"printing-scale-bar ol-scale-bar",bar:!0,text:!0,minWidth:125})).element;if(!t)throw new Error("Scale line does not have an element");let i=50,s=8;if(this.viewPadding==="auto"){const{bottom:h,left:l}=this.getViewPadding();i=Math.max(h+8,i),s+=l}t.style.setProperty("--printing-scale-bar-bottom",`${i}px`),t.style.setProperty("--printing-scale-bar-left",`${s}px`);const r=_e(),n=setTimeout(()=>{r.reject(new Error("Scale line did not render"))},3e3),o=this.scaleLine.render;this.scaleLine.render=(...h)=>{o.apply(this.scaleLine,h),r.resolve()},this.olMap?.addControl(this.scaleLine);try{await r.promise,await new Promise(h=>{requestAnimationFrame(h)})}finally{clearTimeout(n)}}async printToCanvas(e){const t={useCORS:!0,ignoreElements:function(r){if(r.classList&&typeof r.classList=="object"){const n=r.classList;return n.contains("map-anchors")||n.contains(de)}return!1}},i=(await me(async()=>{const{default:r}=await import("./BfxBtG_Oxhhm.js");return{default:r}},[],import.meta.url)).default;return await i(e,t)}reset(){this.scaleLine&&(this.olMap?.removeControl(this.scaleLine),this.scaleLine=void 0),this.overlay&&(this.overlay.destroy(),this.overlay=void 0),this.running=!1,this.drawInformation?.length&&this.drawInformation.forEach(e=>{e.draw.getOverlay().setStyle(e.style)})}removePadding(e,t){const i=window.devicePixelRatio||1,s={top:t.top*i,right:t.right*i,bottom:t.bottom*i,left:t.left*i};if(s.left===0&&s.right===0&&s.top===0&&s.bottom===0)return e;const{width:r,height:n}=e,o=document.createElement("canvas");o.width=r-s.left-s.right,o.height=n-s.top-s.bottom;const h=o.getContext("2d");if(!h)throw new Error("Failed to get a canvas context");return h.drawImage(e,s.left,s.top,o.width,o.height,0,0,o.width,o.height),o}getViewPadding(){const t=this.olMap.getView().padding??[0,0,0,0];return{top:t[0]??0,right:t[1]??0,bottom:t[2]??0,left:t[3]??0}}}class ot{canvas;constructor(e){this.canvas=e}getCanvas(){return this.canvas}getPNGDataURL(e){return st(this.canvas,e)}}export{Je as D,Xe as I,ft as N,gt as P,tt as S,st as a,nt as c};
diff --git a/openlayers-base-packages/assets/Crpk8JACbf_-.js b/openlayers-base-packages/assets/htduZY73xN9H.js
similarity index 82%
rename from openlayers-base-packages/assets/Crpk8JACbf_-.js
rename to openlayers-base-packages/assets/htduZY73xN9H.js
index c820ebc4a..41714114d 100644
--- a/openlayers-base-packages/assets/Crpk8JACbf_-.js
+++ b/openlayers-base-packages/assets/htduZY73xN9H.js
@@ -1 +1 @@
-import{a as k,c as y,r as p,j as e,B as c,S as z,b as m,V as g,f as S}from"./Mxtq6FG0Aq1_.js";import{t as j}from"./hZvUQIaW6FE0.js";import{S as I,T as C,O as M,M as P,H as L,f as R,i as _,k as b,g as E,h as A,l as T,m as s}from"./5C5XmiCGgLmB.js";import{P as H,N as q,I as N}from"./DW8DcLzWV1Z-.js";import{_ as v}from"./CmsKOCeNyeyo.js";import{T as i,U,a as h}from"./BOwySe0UXVY3.js";import"./DWkb3PmnrxhS.js";import"./D69t4K7RmA6W.js";const d="main";class O{mapId=d;async getMapConfig(){return{initialView:{kind:"position",center:{x:404747,y:5757920},zoom:14},layers:[new I({title:"OSM",isBaseLayer:!0,olLayer:new C({source:new M})})]}}}const F={"printing-api-app":{name:"printing-api-app",services:{MapConfigProviderImpl:{name:"MapConfigProviderImpl",clazz:O,provides:[{name:"map.MapConfigProvider",qualifier:void 0}],references:{}}},ui:{references:[{name:"printing.PrintingService",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/chakra-integration":{name:"@open-pioneer/chakra-integration",services:{},ui:{references:[]},properties:{}},"@open-pioneer/runtime":{name:"@open-pioneer/runtime",services:{},ui:{references:[]},properties:{}},"@open-pioneer/react-utils":{name:"@open-pioneer/react-utils",services:{},ui:{references:[]},properties:{}},"@open-pioneer/map":{name:"@open-pioneer/map",services:{MapRegistryImpl:{name:"MapRegistryImpl",clazz:P,provides:[{name:"map.MapRegistry",qualifier:void 0}],references:{providers:{name:"map.MapConfigProvider",qualifier:void 0,all:!0},httpService:{name:"http.HttpService",qualifier:void 0,all:!1}}}},ui:{references:[{name:"map.MapRegistry",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/theme":{name:"@open-pioneer/theme",services:{},ui:{references:[]},properties:{}},"@open-pioneer/http":{name:"@open-pioneer/http",services:{HttpServiceImpl:{name:"HttpServiceImpl",clazz:L,provides:[{name:"http.HttpService",qualifier:"http.HttpService"}],references:{interceptors:{name:"http.Interceptor",qualifier:void 0,all:!0}}}},ui:{references:[]},properties:{}},"@open-pioneer/printing":{name:"@open-pioneer/printing",services:{PrintingServiceImpl:{name:"PrintingServiceImpl",clazz:H,provides:[{name:"printing.PrintingService",qualifier:void 0}],references:{}}},ui:{references:[{name:"notifier.NotificationService",qualifier:void 0,all:!1},{name:"printing.PrintingService",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/base-theme":{name:"@open-pioneer/base-theme",services:{},ui:{references:[]},properties:{}},"@open-pioneer/core":{name:"@open-pioneer/core",services:{},ui:{references:[]},properties:{}},"@open-pioneer/runtime-react-support":{name:"@open-pioneer/runtime-react-support",services:{},ui:{references:[]},properties:{}},"@open-pioneer/notifier":{name:"@open-pioneer/notifier",services:{NotificationServiceImpl:{name:"NotificationServiceImpl",clazz:q,provides:[{name:"notifier.NotificationService",qualifier:"notifier.NotificationService"}],references:{}}},ui:{references:[{name:"notifier.NotificationService",qualifier:void 0,all:!1}]},properties:{}}},G=':root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-overviewmap .ol-viewport:hover{cursor:pointer}.map-container .ol-viewport .ol-attribution{bottom:var(--map-padding-bottom);right:var(--map-padding-right)}.printing-overlay{position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;-webkit-user-select:none;user-select:none;pointer-events:all;cursor:wait;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:#b4b4b4cc}.printing-overlay-status{flex:1 1 auto;font-size:1.5em;text-align:center}.printing-scale-bar.ol-scale-bar{left:var(--printing-scale-bar-left);bottom:var(--printing-scale-bar-bottom)}',D=["en","de"];function B(o){switch(o){case"en":return v(()=>import("./-jAncdI_g-d4.js"),[],import.meta.url).then(r=>r.default);case"de":return v(()=>import("./1YhbJ59n8_2l.js"),[],import.meta.url).then(r=>r.default)}throw new Error(`Unsupported locale: '${o}'`)}const V=k(G),W=Object.freeze(Object.defineProperty({__proto__:null,loadMessages:B,locales:D,packages:F,styles:V},Symbol.toStringTag,{value:"Module"})),K="printing-api-app",$=R.bind(void 0,K),J=y("printing");function Q(){const{map:o}=_(d),r=$("printing.PrintingService"),[t,n]=p.useState(void 0),f=async()=>{u("canvas")},x=async()=>{u("png")},u=async w=>{o&&await r.printMap(o.olMap).then(a=>{const l=a.getCanvas();w==="canvas"?(l.style.width="100%",l.style.height="100%",n(l)):n(a.getPNGDataURL(.6))},a=>{J.error(a)})};return e.jsx(b,{height:"100%",direction:"column",overflow:"hidden",children:e.jsx(E,{title:e.jsx(c,{textAlign:"center",py:1,children:e.jsx(A,{size:"md",children:"OpenLayers Base Packages - Printing API"})}),children:e.jsx(b,{flex:"1",direction:"column",position:"relative",children:e.jsxs(T,{mapId:d,children:[e.jsx(s,{position:"top-left",horizontalGap:10,verticalGap:10,children:e.jsx(c,{backgroundColor:"whiteAlpha.900",borderWidth:"1px",borderRadius:"lg",padding:2,boxShadow:"lg",children:e.jsxs(z,{pt:5,children:[e.jsx(i,{align:"center",children:"Test Controls:"}),e.jsx(m,{onClick:()=>f(),children:"Canvas"}),e.jsx(m,{onClick:()=>x(),children:"Image data URL"})]})})}),e.jsx(s,{position:"top-right",horizontalGap:10,verticalGap:10,children:e.jsxs(g,{backgroundColor:"whiteAlpha.900",borderWidth:"1px",borderRadius:"lg",padding:2,boxShadow:"lg",maxWidth:"400px",maxHeight:"300px",overflow:"auto",children:[e.jsx(i,{as:"b",children:"Description"}),e.jsx(i,{children:"This application can be used to test the printing service. The service provides the screenshot of the given map view in a form of HTMLCanvasElement or a data url."}),e.jsxs(U,{children:[e.jsxs(h,{children:["Clicking on the ","'Canvas'"," button shows the HTMLCanvasElement of the map view embedded in another HTMLElement."]}),e.jsxs(h,{children:["Clicking on the ","'Image data URL'"," button shows the data url of the map view image used as source for HTMLImageElement."]})]})]})}),e.jsx(s,{position:"top-right",horizontalGap:450,verticalGap:10,children:t&&e.jsx(g,{backgroundColor:"whiteAlpha.900",borderWidth:"1px",borderRadius:"lg",padding:2,boxShadow:"lg",className:"result-display",maxWidth:"600",maxHeight:"500",children:e.jsx(X,{input:t})})})]})})})})}function X(o){const r=typeof o.input=="string"?o.input:void 0,t=r&&e.jsxs(e.Fragment,{children:[e.jsx(i,{as:"b",children:"Image from data URL"}),e.jsx(N,{src:r})]}),n=typeof o.input!="string"?e.jsx(Y,{canvas:o.input}):void 0;return t||n}function Y(o){const r=p.useRef(null);return p.useEffect(()=>{if(!r.current)return;const t=r.current;return t.appendChild(o.canvas),()=>{t.removeChild(o.canvas)}},[o.canvas]),e.jsxs(e.Fragment,{children:[e.jsx(i,{as:"b",children:"Image from canvas"}),e.jsx(c,{ref:r})]})}const Z=new URLSearchParams(window.location.search),ee=Z.get("lang"),oe=S({component:Q,config:{locale:ee??void 0},theme:j,appMetadata:W});customElements.define("printing-api-app",oe);
+import{a as k,c as y,r as p,j as e,B as c,S as z,b as m,V as g,f as S}from"./Mxtq6FG0Aq1_.js";import{t as j}from"./hZvUQIaW6FE0.js";import{S as I,T as C,O as M,M as P,H as L,f as R,i as _,k as b,g as E,h as A,l as T,m as s}from"./5C5XmiCGgLmB.js";import{P as H,N as q,I as N}from"./OM1YzF7yjem8.js";import{_ as v}from"./CmsKOCeNyeyo.js";import{T as i,U,a as h}from"./BOwySe0UXVY3.js";import"./DWkb3PmnrxhS.js";import"./D69t4K7RmA6W.js";const d="main";class O{mapId=d;async getMapConfig(){return{initialView:{kind:"position",center:{x:404747,y:5757920},zoom:14},layers:[new I({title:"OSM",isBaseLayer:!0,olLayer:new C({source:new M})})]}}}const F={"printing-api-app":{name:"printing-api-app",services:{MapConfigProviderImpl:{name:"MapConfigProviderImpl",clazz:O,provides:[{name:"map.MapConfigProvider",qualifier:void 0}],references:{}}},ui:{references:[{name:"printing.PrintingService",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/chakra-integration":{name:"@open-pioneer/chakra-integration",services:{},ui:{references:[]},properties:{}},"@open-pioneer/map":{name:"@open-pioneer/map",services:{MapRegistryImpl:{name:"MapRegistryImpl",clazz:P,provides:[{name:"map.MapRegistry",qualifier:void 0}],references:{providers:{name:"map.MapConfigProvider",qualifier:void 0,all:!0},httpService:{name:"http.HttpService",qualifier:void 0,all:!1}}}},ui:{references:[{name:"map.MapRegistry",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/printing":{name:"@open-pioneer/printing",services:{PrintingServiceImpl:{name:"PrintingServiceImpl",clazz:H,provides:[{name:"printing.PrintingService",qualifier:void 0}],references:{}}},ui:{references:[{name:"notifier.NotificationService",qualifier:void 0,all:!1},{name:"printing.PrintingService",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/react-utils":{name:"@open-pioneer/react-utils",services:{},ui:{references:[]},properties:{}},"@open-pioneer/runtime":{name:"@open-pioneer/runtime",services:{},ui:{references:[]},properties:{}},"@open-pioneer/theme":{name:"@open-pioneer/theme",services:{},ui:{references:[]},properties:{}},"@open-pioneer/core":{name:"@open-pioneer/core",services:{},ui:{references:[]},properties:{}},"@open-pioneer/http":{name:"@open-pioneer/http",services:{HttpServiceImpl:{name:"HttpServiceImpl",clazz:L,provides:[{name:"http.HttpService",qualifier:"http.HttpService"}],references:{interceptors:{name:"http.Interceptor",qualifier:void 0,all:!0}}}},ui:{references:[]},properties:{}},"@open-pioneer/notifier":{name:"@open-pioneer/notifier",services:{NotificationServiceImpl:{name:"NotificationServiceImpl",clazz:q,provides:[{name:"notifier.NotificationService",qualifier:"notifier.NotificationService"}],references:{}}},ui:{references:[{name:"notifier.NotificationService",qualifier:void 0,all:!1}]},properties:{}},"@open-pioneer/base-theme":{name:"@open-pioneer/base-theme",services:{},ui:{references:[]},properties:{}},"@open-pioneer/runtime-react-support":{name:"@open-pioneer/runtime-react-support",services:{},ui:{references:[]},properties:{}}},G=':root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}.ol-overviewmap .ol-viewport:hover{cursor:pointer}.map-container .ol-viewport .ol-attribution{bottom:var(--map-padding-bottom);right:var(--map-padding-right)}.printing-overlay{position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;-webkit-user-select:none;user-select:none;pointer-events:all;cursor:wait;display:flex;flex-direction:row;align-items:center;justify-content:center;background-color:#b4b4b4cc}.printing-overlay-status{flex:1 1 auto;font-size:1.5em;text-align:center}.printing-scale-bar.ol-scale-bar{left:var(--printing-scale-bar-left);bottom:var(--printing-scale-bar-bottom)}',D=["en","de"];function B(o){switch(o){case"en":return v(()=>import("./-jAncdI_g-d4.js"),[],import.meta.url).then(r=>r.default);case"de":return v(()=>import("./1YhbJ59n8_2l.js"),[],import.meta.url).then(r=>r.default)}throw new Error(`Unsupported locale: '${o}'`)}const V=k(G),W=Object.freeze(Object.defineProperty({__proto__:null,loadMessages:B,locales:D,packages:F,styles:V},Symbol.toStringTag,{value:"Module"})),K="printing-api-app",$=R.bind(void 0,K),J=y("printing");function Q(){const{map:o}=_(d),r=$("printing.PrintingService"),[t,n]=p.useState(void 0),f=async()=>{u("canvas")},x=async()=>{u("png")},u=async w=>{o&&await r.printMap(o.olMap).then(a=>{const l=a.getCanvas();w==="canvas"?(l.style.width="100%",l.style.height="100%",n(l)):n(a.getPNGDataURL(.6))},a=>{J.error(a)})};return e.jsx(b,{height:"100%",direction:"column",overflow:"hidden",children:e.jsx(E,{title:e.jsx(c,{textAlign:"center",py:1,children:e.jsx(A,{size:"md",children:"OpenLayers Base Packages - Printing API"})}),children:e.jsx(b,{flex:"1",direction:"column",position:"relative",children:e.jsxs(T,{mapId:d,children:[e.jsx(s,{position:"top-left",horizontalGap:10,verticalGap:10,children:e.jsx(c,{backgroundColor:"whiteAlpha.900",borderWidth:"1px",borderRadius:"lg",padding:2,boxShadow:"lg",children:e.jsxs(z,{pt:5,children:[e.jsx(i,{align:"center",children:"Test Controls:"}),e.jsx(m,{onClick:()=>f(),children:"Canvas"}),e.jsx(m,{onClick:()=>x(),children:"Image data URL"})]})})}),e.jsx(s,{position:"top-right",horizontalGap:10,verticalGap:10,children:e.jsxs(g,{backgroundColor:"whiteAlpha.900",borderWidth:"1px",borderRadius:"lg",padding:2,boxShadow:"lg",maxWidth:"400px",maxHeight:"300px",overflow:"auto",children:[e.jsx(i,{as:"b",children:"Description"}),e.jsx(i,{children:"This application can be used to test the printing service. The service provides the screenshot of the given map view in a form of HTMLCanvasElement or a data url."}),e.jsxs(U,{children:[e.jsxs(h,{children:["Clicking on the ","'Canvas'"," button shows the HTMLCanvasElement of the map view embedded in another HTMLElement."]}),e.jsxs(h,{children:["Clicking on the ","'Image data URL'"," button shows the data url of the map view image used as source for HTMLImageElement."]})]})]})}),e.jsx(s,{position:"top-right",horizontalGap:450,verticalGap:10,children:t&&e.jsx(g,{backgroundColor:"whiteAlpha.900",borderWidth:"1px",borderRadius:"lg",padding:2,boxShadow:"lg",className:"result-display",maxWidth:"600",maxHeight:"500",children:e.jsx(X,{input:t})})})]})})})})}function X(o){const r=typeof o.input=="string"?o.input:void 0,t=r&&e.jsxs(e.Fragment,{children:[e.jsx(i,{as:"b",children:"Image from data URL"}),e.jsx(N,{src:r})]}),n=typeof o.input!="string"?e.jsx(Y,{canvas:o.input}):void 0;return t||n}function Y(o){const r=p.useRef(null);return p.useEffect(()=>{if(!r.current)return;const t=r.current;return t.appendChild(o.canvas),()=>{t.removeChild(o.canvas)}},[o.canvas]),e.jsxs(e.Fragment,{children:[e.jsx(i,{as:"b",children:"Image from canvas"}),e.jsx(c,{ref:r})]})}const Z=new URLSearchParams(window.location.search),ee=Z.get("lang"),oe=S({component:Q,config:{locale:ee??void 0},theme:j,appMetadata:W});customElements.define("printing-api-app",oe);
diff --git a/openlayers-base-packages/docs/functions/_open_pioneer_basemap_switcher.BasemapSwitcher.html b/openlayers-base-packages/docs/functions/_open_pioneer_basemap_switcher.BasemapSwitcher.html
index cba3bfea5..5489fb98b 100644
--- a/openlayers-base-packages/docs/functions/_open_pioneer_basemap_switcher.BasemapSwitcher.html
+++ b/openlayers-base-packages/docs/functions/_open_pioneer_basemap_switcher.BasemapSwitcher.html
@@ -1,3 +1,3 @@
BasemapSwitcher | Open Pioneer Trails Packages- BasemapSwitcher(props, deprecatedLegacyContext?): ReactNode
Returns ReactNode
+Returns ReactNode
The
BasemapSwitcher
component can be used in an app to switch between the different basemaps.