@plannco-ppe/ppe-core 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.iife.js +1 -1
- package/dist/index.js +3 -4
- package/dist/index.umd.js +1 -1
- package/dist/lib/core/plan-editor.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -8,4 +8,4 @@ var g_=Object.defineProperty;var __=(It,re,et)=>re in It?g_(It,re,{enumerable:!0
|
|
|
8
8
|
<div style="height: 1rem; width: 1rem; background-color: ${n.color}"></div>
|
|
9
9
|
<div>${n.name}</div>
|
|
10
10
|
</div>
|
|
11
|
-
`}const xg={a0:[1189,841],a1:[841,594],a2:[594,420],a3:[420,297],a4:[297,210],a5:[210,148]},oh={name:"ppe-pdf-export",getInitialState:n=>({...n}),createPlanEditor:n=>{n.exportToPdf=t=>Cg(n,t)}};async function Cg(n,t){const e=(t==null?void 0:t.format)||"a4",i=(t==null?void 0:t.orientation)||"landscape",s=xg[e],r=i==="landscape"?s[0]:s[1],o=i==="landscape"?s[1]:s[0],a=n.getSize();if(!a){console.error("Unable to get map size");return}if(!n.getView().getResolution()){console.error("Unable to get view resolution");return}const h=new re.jsPDF(i,void 0,e);await new Promise(c=>{n.once("rendercomplete",function(){const u=document.createElement("canvas");u.width=a[0],u.height=a[1];const d=u.getContext("2d");if(!d){console.error("Unable to get canvas context"),c();return}const f=n.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer");Array.from(f).forEach(x=>{var S,T;if(x instanceof HTMLCanvasElement&&x.width>0){const I=((S=x.parentNode)==null?void 0:S.style.opacity)||"1";d.globalAlpha=parseFloat(I);const P=(T=x.style.transform.match(/^matrix\(([^\(]*)\)$/))==null?void 0:T[1].split(",").map(Number);P&&d.setTransform(...P),d.drawImage(x,0,0),d.setTransform(1,0,0,1,0,0),d.globalAlpha=1}});const g=u.toDataURL("image/jpeg"),m=u.width/u.height,_=r/o;let y=r,p=o;m>_?p=r/m:y=o*m;const C=(r-y)/2,E=(o-p)/2;h.addImage(g,"JPEG",C,E,y,p),h.save("map.pdf"),c()}),n.renderSync()})}let Io;const xn=[];function ah(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Ro(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-191.25)>2}function wg(){if(Io===void 0){const n=ut(6,6,xn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",ah(n,4,5,4,0),ah(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Io=Ro(t,0)||Ro(t,4)||Ro(t,8),Ys(n),xn.push(n.canvas)}return Io}function Sg(n,t,e,i){const s=fa(e,t,n);let r=ua(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Di(l,s)){const h=ua(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Ig(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ut(Math.round(e*n),Math.round(e*t),xn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=bt();l.forEach(function(x,S,T){zo(_,x.extent)});let y;const p=e/i,C=(u?1:1+Math.pow(2,-24))/p;(l.length!==1||h!==0)&&(y=ut(Math.round(U(_)*p),Math.round(ct(_)*p),xn),u||(y.imageSmoothingEnabled=!1),l.forEach(function(x,S,T){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){y.save();const N=(x.clipExtent[0]-_[0])*p,j=-(x.clipExtent[3]-_[3])*p,F=U(x.clipExtent)*p,q=ct(x.clipExtent)*p;y.rect(u?N:Math.round(N),u?j:Math.round(j),u?F:Math.round(N+F)-Math.round(N),u?q:Math.round(j+q)-Math.round(j)),y.clip()}const I=(x.extent[0]-_[0])*p,R=-(x.extent[3]-_[3])*p,P=U(x.extent)*p,k=ct(x.extent)*p;y.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?I:Math.round(I),u?R:Math.round(R),u?P:Math.round(I+P)-Math.round(I),u?k:Math.round(R+k)-Math.round(R)),x.clipExtent&&y.restore()}}));const E=Mn(o);return a.getTriangles().forEach(function(x,S,T){const I=x.source,R=x.target;let P=I[0][0],k=I[0][1],N=I[1][0],j=I[1][1],F=I[2][0],q=I[2][1];const b=m((R[0][0]-E[0])/r),W=m(-(R[0][1]-E[1])/r),X=m((R[1][0]-E[0])/r),Q=m(-(R[1][1]-E[1])/r),J=m((R[2][0]-E[0])/r),tt=m(-(R[2][1]-E[1])/r),v=P,Ce=k;P=0,k=0,N-=v,j-=Ce,F-=v,q-=Ce;const ei=[[N,j,0,0,X-b],[F,q,0,0,J-b],[0,0,N,j,Q-W],[0,0,F,q,tt-W]],Et=Fh(ei);if(!Et)return;if(g.save(),g.beginPath(),wg()||!u){g.moveTo(X,Q);const Zt=4,Ne=b-X,wn=W-Q;for(let ne=0;ne<Zt;ne++)g.lineTo(X+m((ne+1)*Ne/Zt),Q+m(ne*wn/(Zt-1))),ne!=Zt-1&&g.lineTo(X+m((ne+1)*Ne/Zt),Q+m((ne+1)*wn/(Zt-1)));g.lineTo(J,tt)}else g.moveTo(X,Q),g.lineTo(b,W),g.lineTo(J,tt);g.clip(),g.transform(Et[0],Et[2],Et[1],Et[3],b,W),g.translate(_[0]-v,_[3]-Ce);let ie;if(y)ie=y.canvas,g.scale(C,-C);else{const Zt=l[0],Ne=Zt.extent;ie=Zt.image,g.scale(U(Ne)/ie.width,-ct(Ne)/ie.height)}g.drawImage(ie,0,0),g.restore()}),y&&(Ys(y),xn.push(y.canvas)),g.canvas}function vo(n){return Array.isArray(n)?Math.min(...n):n}const Rg=10,lh=.25;class vg{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?yc(C=>ft(a,fa(C,this.targetProj_,this.sourceProj_))):ji(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const E=C[0]+"/"+C[1];return l[E]||(l[E]=h(C)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&U(s)>=U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const c=Mn(i),u=Gs(i),d=ks(i),f=Os(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),y=this.transformInv_(f),p=Rg+(o?Math.max(0,Math.ceil(Math.log2(vh(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,y,p),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(E,x,S){C=Math.min(C,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-C>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-C>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-C>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-C>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const S=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-S<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=ht([r,o,a,l]),u=this.sourceWorldWidth_?U(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=ht([t,e,i,s]);g=U(_)/this.targetWorldWidth_>lh||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>lh||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!dt(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(_);let p;f?p=(si(r[0],d)+si(a[0],d))/2-si(y[0],d):p=(r[0]+a[0])/2-y[0];const C=(r[1]+a[1])/2-y[1];g=p*p+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(_),p=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(p);this.addQuad_(t,e,_,p,r,o,y,C,h-1),this.addQuad_(p,_,i,s,C,y,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),p=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(p);this.addQuad_(t,_,p,s,r,y,C,l,h-1),this.addQuad_(_,e,i,p,y,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=bt();return this.triangles_.forEach(function(e,i,s){const r=e.source;Gi(t,r[0]),Gi(t,r[1]),Gi(t,r[2])}),t}getTriangles(){return this.triangles_}}const Tg=.5;class Pg extends fr{constructor(t,e,i,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Ns(i,h):i,u=Ht(c),d=Sg(t,e,u,s),f=Tg,g=new vg(t,e,c,l,d*f,s),m=g.calculateSourceExtent(),_=ni(m)?null:o(m,d,r),y=_?M.IDLE:M.EMPTY,p=_?_.getPixelRatio():1;super(i,s,p,y),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=p,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==M.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==M.LOADED){const e=U(this.targetExtent_)/this.targetResolution_,i=ct(this.targetExtent_)/this.targetResolution_;this.canvas_=Ig(e,i,this.sourcePixelRatio_,vo(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();const t=this.sourceImage_.getState();t==M.LOADED||t==M.ERROR?this.reproject_():(this.sourceListenerKey_=z(this.sourceImage_,D.CHANGE,e=>{const i=this.sourceImage_.getState();(i==M.LOADED||i==M.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){$(this.sourceListenerKey_),this.sourceListenerKey_=null}}const vs=4,To={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Mg extends Rt{constructor(t,e){super(t),this.image=e}}class Lg extends Gl{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=As(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const r=this.getProjection();if(!r||!s||tr(r,s))return r&&(s=r),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&tr(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Ni(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Pg(r,s,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const r=Fg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&ae(this.wantedExtent_,r)||ae(this.image.getExtent(),r))&&(this.wantedResolution_&&vo(this.wantedResolution_)===o||vo(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new fr(r,o,i,this.loader),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case M.LOADING:this.loading=!0,i=To.IMAGELOADSTART;break;case M.LOADED:this.loading=!1,i=To.IMAGELOADEND;break;case M.ERROR:this.loading=!1,i=To.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Mg(i,e))}}function Ag(n,t){n.getImage().src=t}function Fg(n,t,e,i){const s=t/e,r=Ht(n),o=An(U(n)/s,vs),a=An(ct(n)/s,vs),l=An((i-1)*o/2,vs),h=o+2*l,c=An((i-1)*a/2,vs),u=a+2*c;return Pn(r,s,0,[h,u])}function bg(n){const t=n.load||xa,e=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,t(s,n.url).then(r=>{const o=U(e)/r.width,a=ct(e)/r.height;return{image:r,extent:e,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class Dg extends Lg{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,i=t.imageLoadFunction!==void 0?t.imageLoadFunction:Ag;super({attributions:t.attributions,interpolate:t.interpolate,projection:ot(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new fr(this.imageExtent_,void 0,1,bg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(s,r)=>(this.image.setImage(s),i(this.image,r),xa(s))})),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){return dt(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}class Og extends Qa{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Ns(l,Te(e.extent,s.projection))),!a[et.ANIMATING]&&!a[et.INTERACTING]&&!ni(l))if(o){const h=s.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image=c:c.getState()===M.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ft(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Di(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=U(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ct(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image,s=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(t,e);const _=this.context.canvas.width,y=this.context.canvas.height,p=this.getRenderContext(t);let C=!1,E=!0;if(h.extent){const R=Te(h.extent,u.projection);E=dt(R,t.extent),C=E&&!ae(R,t.extent),C&&this.clipUnrotated(p,t,R)}const x=i.getImage(),S=de(this.tempTransform,_/2,y/2,g,m,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const T=x.width*S[0],I=x.height*S[3];if(this.getLayer().getSource().getInterpolate()||(p.imageSmoothingEnabled=!1),this.preRender(p,t),E&&T>=.5&&I>=.5){const R=S[4],P=S[5],k=h.opacity;k!==1&&(p.save(),p.globalAlpha=k),p.drawImage(x,0,0,+x.width,+x.height,R,P,T,I),k!==1&&p.restore()}return this.postRender(this.context,t),C&&p.restore(),p.imageSmoothingEnabled=!0,this.container}}class kg extends cs{constructor(t){t=t||{},super(t)}}class Ng extends kg{constructor(t){super(t)}createRenderer(){return new Og(this)}getData(t){return super.getData(t)}}const Cn={IDLE:0,LOADED:2,ERROR:3,EMPTY:4},Po={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Gg extends Xn{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=z(i,Po.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=z(i,Po.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_,Uo?{passive:!1}:!1)}emulateClick_(t){let e=new pe(B.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new pe(B.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new pe(B.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==B.POINTERUP||e.type==B.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==B.POINTERDOWN||e.type==B.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new pe(B.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new pe(B.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(z(i,B.POINTERMOVE,this.handlePointerMove_,this),z(i,B.POINTERUP,this.handlePointerUp_,this),z(this.element_,B.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(z(this.element_.getRootNode(),B.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new pe(B.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new pe(B.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&($(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&($(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const yt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Ts=1/0;class zg{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ai(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){it(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Ts?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Ts?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class Wg extends zg{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(D.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Cn.LOADED||i===Cn.ERROR||i===Cn.EMPTY){i!==Cn.ERROR&&e.removeEventListener(D.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===Cn.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function jg(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Ts;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Mo extends jt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let i=0,s=this.listenerKeys.length;i<s;++i)$(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=t,t){const i=this.target_??t.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Bi&&this.listenerKeys.push(z(t,Ee.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Xg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Bn+" "+yr+(this.collapsed_&&this.collapsible_?" "+Ia:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ya(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!oe(e,this.renderedAttributions_)){Ho(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ia),this.collapsed_?Zo(this.collapseLabel_,this.label_):Zo(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Vg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Bn+" "+yr,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Vn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:wi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Vn);!r&&i===0?this.element.classList.add(Vn):r&&i!==0&&this.element.classList.remove(Vn)}this.label_.style.transform=s}this.rotation_=i}}class Bg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(D.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(D.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Bn+" "+yr,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:wi})):i.setZoom(r)}}}function Yg(n){n=n||{};const t=new _t;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Bg(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Vg(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Xg(n.attributionOptions)),t}class ke extends Rt{constructor(t,e){super(t),this.layer=e}}const Lo={LAYERS:"layers"};class Fi extends Al{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Lo.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new _t(i.slice(),{unique:!0}):it(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new _t(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach($),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(z(t,nt.ADD,this.handleLayersAdd_,this),z(t,nt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach($);ai(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new ke("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[z(t,ui.PROPERTYCHANGE,this.handleLayerChange_,this),z(t,D.CHANGE,this.handleLayerChange_,this)];t instanceof Fi&&e.push(z(t,"addlayer",this.handleLayerGroupAdd_,this),z(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ke("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ke("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ke("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach($),delete this.listenerKeys_[i],this.dispatchEvent(new ke("removelayer",e)),this.changed()}getLayers(){return this.get(Lo.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new ke("removelayer",i[s]))}this.set(Lo.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Ns(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Kg extends dr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;de(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Da(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,S,T){return r.call(o,x,E?S:null,T)}const d=c.projection,f=Bo(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=U(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,y=[],p=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const S=m[x],T=S.layer;if(T.hasRenderer()&&qr(S,c)&&a.call(l,T)){const I=T.getRenderer(),R=T.getSource();if(I&&R){const P=R.getWrapX()?f:t,k=u.bind(null,S.managed);p[0]=P[0]+g[E][0],p[1]=P[1]+g[E][1],h=I.forEachFeatureAtCoordinate(p,e,i,k,y)}if(h)return h}}if(y.length===0)return;const C=1/y.length;return y.forEach((E,x)=>E.distanceSq+=x*C),y.sort((E,x)=>E.distanceSq-x.distanceSq),y.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Wt,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){kt.canExpireCache()&&t.postRenderFunctions.push(Ug)}}function Ug(n,t){kt.expire()}class Zg extends Kg{constructor(t){super(t),this.fontChangeListenerKey_=z(gi,ui.PROPERTYCHANGE,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Bn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new $a(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){$(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Ot.PRECOMPOSE,t);const e=t.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);e.some(a=>a.layer instanceof bl&&a.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=e.length;a<l;++a){const h=e[a];t.layerIndex=a;const c=h.layer,u=c.getSourceState();if(!qr(h,s)||u!="ready"&&u!="undefined"){c.unrender();continue}const d=c.render(t,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(h))}this.declutter(t,r),Xh(this.element_,this.children_),this.dispatchRenderEvent(Ot.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function hh(n){if(n instanceof cs){n.setMapInternal(null);return}n instanceof Fi&&n.getLayers().forEach(hh)}function ch(n,t){if(n instanceof cs){n.setMapInternal(t);return}if(n instanceof Fi){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)ch(e[i],t)}}class Hg extends jt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=qg(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:zh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Xt(),this.pixelToCoordinateTransform_=Xt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||Yg(),this.interactions=e.interactions||Of({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Wg(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(yt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(yt.VIEW,this.handleViewChanged_),this.addChangeListener(yt.SIZE,this.handleSizeChanged_),this.addChangeListener(yt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof te)&&t.view.then(function(s){i.setView(new te(s))}),this.controls.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(nt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(nt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){ch(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Wt,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Fi?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Wt,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(yt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ve(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ft(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(yt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof _t){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Z(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?ft(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(yt.SIZE)}getView(){return this.get(yt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return jg(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new pe(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Po.POINTERDOWN||i===D.WHEEL||i===D.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[et.ANIMATING]||o[et.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Ot.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ot.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ti(Ee.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ti(Ee.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)$(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(D.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Zg(this)),this.mapBrowserEventHandler_=new Gg(this,this.moveTolerance_);for(const r in B)this.mapBrowserEventHandler_.addEventListener(B[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(D.WHEEL,this.boundHandleBrowserEvent_,Uo?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}this.targetChangeHandlerKeys_=[z(i,D.KEYDOWN,this.handleBrowserEvent,this),z(i,D.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&($(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&($(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=z(t,ui.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=z(t,D.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach($),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ke("addlayer",t)),this.layerGroupPropertyListenerKeys_=[z(t,ui.PROPERTYCHANGE,this.render,this),z(t,D.CHANGE,this.render,this),z(t,"addlayer",this.handleLayerAdd_,this),z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){hh(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Wa(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Pn(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Pn(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!ni(this.previousExtent_)&&!Ni(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ti(Ee.MOVESTART,this,s)),this.previousExtent_=Oi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[et.ANIMATING]&&!r.viewHints[et.INTERACTING]&&!Ni(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ti(Ee.MOVEEND,this,r)),Go(r.extent,this.previousExtent_))),this.dispatchEvent(new Ti(Ee.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ee.LOADSTART)||this.hasListener(Ee.LOADEND)||this.hasListener(Ot.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ke("removelayer",e)),this.set(yt.LAYERGROUP,t)}setSize(t){this.set(yt.SIZE,t)}setTarget(t){this.set(yt.TARGET,t)}setView(t){if(!t||t instanceof te){this.set(yt.VIEW,t);return}this.set(yt.VIEW,new te);const e=this;t.then(function(i){e.setView(new te(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!Wa(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&qo("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!oe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function qg(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Fi({layers:n.layers});e[yt.LAYERGROUP]=i,e[yt.TARGET]=n.target,e[yt.VIEW]=n.view instanceof te?n.view:new te;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new _t(n.controls.slice()):(it(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new _t(n.interactions.slice()):(it(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new _t(n.overlays.slice()):(it(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new _t,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const pt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class $g extends jt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+bc,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(pt.ELEMENT,this.handleElementChanged),this.addChangeListener(pt.MAP,this.handleMapChanged),this.addChangeListener(pt.OFFSET,this.handleOffsetChanged),this.addChangeListener(pt.POSITION,this.handlePositionChanged),this.addChangeListener(pt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(pt.ELEMENT)}getId(){return this.id}getMap(){return this.get(pt.MAP)||null}getOffset(){return this.get(pt.OFFSET)}getPosition(){return this.get(pt.POSITION)}getPositioning(){return this.get(pt.POSITIONING)}handleElementChanged(){Ho(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),$(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=z(t,Ee.POSTRENDER,this.render,this),this.updatePixelPosition();const i=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?i.insertBefore(this.element,i.childNodes[0]||null):i.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(pt.ELEMENT,t)}setMap(t){this.set(pt.MAP,t)}setOffset(t){this.set(pt.OFFSET,t)}setPosition(t){this.set(pt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(pt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Wh(s),jh(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!ae(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(pt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}function Jg(n,t){return typeof n=="function"?n(t):n}const Qg={name:"ppe-popup",getInitialState:n=>({...n}),createPlanEditor:n=>{const{overlay:t,closerElement:e,popupElement:i}=e_();n.addOverlay(t),e.addEventListener("click",()=>(t.setPosition(void 0),e.blur(),!1)),n._showPopup=(s,r)=>{t.setPosition(s.event.coordinate),i.innerHTML=s.content,r!=null&&r.offset&&t.setOffset(r.offset),t.setPositioning(t_(n,s.event,r==null?void 0:r.positioning))},n._hidePopup=()=>{t.setPosition(void 0)}}};function t_(n,t,e){if(e&&e!="auto")return e;const i=n.getSize();if(!i)return"top-right";const[s,r]=n.getPixelFromCoordinate(t.coordinate),[o,a]=i,l=s<o/2?"left":"right";return`${r<a/2?"top":"bottom"}-${l}`}function e_(){const n=document.createElement("div");n.id="ppe-popup",n.className="ppe-popup";const t=document.createElement("button");t.className="ppe-popup-closer";const e=document.createElement("div");return e.className="ppe-popup-content",n.insertAdjacentElement("beforeend",t),n.insertAdjacentElement("beforeend",e),{overlay:new $g({element:n,stopEvent:!1}),popupElement:n,closerElement:t}}const uh=[eh,{name:"ppe-layer",getInitialState:n=>({...n}),createPlanEditor:n=>{n.addVectorLayer=()=>{const t=new _s({wrapX:!1}),e=new gn({source:t});return n.initialState._extent&&e.setExtent(n.initialState._extent),e}}},Qg,oh];function i_(n){var m;const t=[...uh,...n._plugins??[]],{plan:e}=n,i=[0,0,e.file.width,e.file.height],s=new Dn({code:"",units:"pixels",extent:i}),r=new Dg({imageExtent:i,projection:s,url:e.file.original_url,crossOrigin:"anonymous"}),o=new Ng({source:r}),a=new te({projection:s,center:Ht(i),zoom:0,minZoom:-10,maxZoom:10,extent:i}),l=new Hg({target:n.target??"map",layers:[o],view:a}),h={_extent:i,_projection:s},c=l;c._plugins=t;const u=c._plugins.reduce((_,y)=>{var p;return Object.assign(_,(p=y.getDefaultOptions)==null?void 0:p.call(y,c))},{});let d={...h,...n.initialState??{}};c._plugins.forEach(_=>{var y;d=((y=_.getInitialState)==null?void 0:y.call(_,d))??d});const f=_=>c.options.mergeOptions?c.options.mergeOptions(u,_):{...u,..._},g={_plugins:t,options:{...u,...n},initialState:d,reset:()=>{c.setState(c.initialState)},getState:()=>c.options.state,setState:_=>{var y,p;(p=(y=c.options).onStateChange)==null||p.call(y,_)},setOptions:_=>{const y=Jg(_,c.options),p=c.getTarget(),C=f(y);c.options=C,C.target&&C.target!==p&&c.setTarget(C.target)},fitToContent:()=>{const _=c.getView(),y=c.getSize();y&&i&&_.fit(i,{size:y,padding:[0,0,0,0],duration:500})}};Object.assign(c,g);for(const _ of c._plugins)(m=_==null?void 0:_.createPlanEditor)==null||m.call(_,c);return c}return It.PdfExportPlugin=oh,It.ZoningPlugin=eh,It.convertToZoneGeometry=Is,It.convertZoneToGeometryFeatures=th,It.createPlanEditor=i_,It.defaultPlugins=uh,Object.defineProperty(It,Symbol.toStringTag,{value:"Module"}),It})({},jspdf);
|
|
11
|
+
`}const xg={a0:[1189,841],a1:[841,594],a2:[594,420],a3:[420,297],a4:[297,210],a5:[210,148]},oh={name:"ppe-pdf-export",getInitialState:n=>({...n}),createPlanEditor:n=>{n.exportToPdf=t=>Cg(n,t)}};async function Cg(n,t){const e=(t==null?void 0:t.format)||"a4",i=(t==null?void 0:t.orientation)||"landscape",s=xg[e],r=i==="landscape"?s[0]:s[1],o=i==="landscape"?s[1]:s[0],a=n.getSize();if(!a){console.error("Unable to get map size");return}if(!n.getView().getResolution()){console.error("Unable to get view resolution");return}const h=new re.jsPDF(i,void 0,e);await new Promise(c=>{n.once("rendercomplete",function(){const u=document.createElement("canvas");u.width=a[0],u.height=a[1];const d=u.getContext("2d");if(!d){console.error("Unable to get canvas context"),c();return}const f=n.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer");Array.from(f).forEach(x=>{var S,T;if(x instanceof HTMLCanvasElement&&x.width>0){const I=((S=x.parentNode)==null?void 0:S.style.opacity)||"1";d.globalAlpha=parseFloat(I);const P=(T=x.style.transform.match(/^matrix\(([^\(]*)\)$/))==null?void 0:T[1].split(",").map(Number);P&&d.setTransform(...P),d.drawImage(x,0,0),d.setTransform(1,0,0,1,0,0),d.globalAlpha=1}});const g=u.toDataURL("image/jpeg"),m=u.width/u.height,_=r/o;let y=r,p=o;m>_?p=r/m:y=o*m;const C=(r-y)/2,E=(o-p)/2;h.addImage(g,"JPEG",C,E,y,p),h.save("map.pdf"),c()}),n.renderSync()})}let Io;const xn=[];function ah(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Ro(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-191.25)>2}function wg(){if(Io===void 0){const n=ut(6,6,xn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",ah(n,4,5,4,0),ah(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Io=Ro(t,0)||Ro(t,4)||Ro(t,8),Ys(n),xn.push(n.canvas)}return Io}function Sg(n,t,e,i){const s=fa(e,t,n);let r=ua(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Di(l,s)){const h=ua(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Ig(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=ut(Math.round(e*n),Math.round(e*t),xn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=bt();l.forEach(function(x,S,T){zo(_,x.extent)});let y;const p=e/i,C=(u?1:1+Math.pow(2,-24))/p;(l.length!==1||h!==0)&&(y=ut(Math.round(U(_)*p),Math.round(ct(_)*p),xn),u||(y.imageSmoothingEnabled=!1),l.forEach(function(x,S,T){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){y.save();const N=(x.clipExtent[0]-_[0])*p,j=-(x.clipExtent[3]-_[3])*p,F=U(x.clipExtent)*p,q=ct(x.clipExtent)*p;y.rect(u?N:Math.round(N),u?j:Math.round(j),u?F:Math.round(N+F)-Math.round(N),u?q:Math.round(j+q)-Math.round(j)),y.clip()}const I=(x.extent[0]-_[0])*p,R=-(x.extent[3]-_[3])*p,P=U(x.extent)*p,k=ct(x.extent)*p;y.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?I:Math.round(I),u?R:Math.round(R),u?P:Math.round(I+P)-Math.round(I),u?k:Math.round(R+k)-Math.round(R)),x.clipExtent&&y.restore()}}));const E=Mn(o);return a.getTriangles().forEach(function(x,S,T){const I=x.source,R=x.target;let P=I[0][0],k=I[0][1],N=I[1][0],j=I[1][1],F=I[2][0],q=I[2][1];const b=m((R[0][0]-E[0])/r),W=m(-(R[0][1]-E[1])/r),X=m((R[1][0]-E[0])/r),Q=m(-(R[1][1]-E[1])/r),J=m((R[2][0]-E[0])/r),tt=m(-(R[2][1]-E[1])/r),v=P,Ce=k;P=0,k=0,N-=v,j-=Ce,F-=v,q-=Ce;const ei=[[N,j,0,0,X-b],[F,q,0,0,J-b],[0,0,N,j,Q-W],[0,0,F,q,tt-W]],Et=Fh(ei);if(!Et)return;if(g.save(),g.beginPath(),wg()||!u){g.moveTo(X,Q);const Zt=4,Ne=b-X,wn=W-Q;for(let ne=0;ne<Zt;ne++)g.lineTo(X+m((ne+1)*Ne/Zt),Q+m(ne*wn/(Zt-1))),ne!=Zt-1&&g.lineTo(X+m((ne+1)*Ne/Zt),Q+m((ne+1)*wn/(Zt-1)));g.lineTo(J,tt)}else g.moveTo(X,Q),g.lineTo(b,W),g.lineTo(J,tt);g.clip(),g.transform(Et[0],Et[2],Et[1],Et[3],b,W),g.translate(_[0]-v,_[3]-Ce);let ie;if(y)ie=y.canvas,g.scale(C,-C);else{const Zt=l[0],Ne=Zt.extent;ie=Zt.image,g.scale(U(Ne)/ie.width,-ct(Ne)/ie.height)}g.drawImage(ie,0,0),g.restore()}),y&&(Ys(y),xn.push(y.canvas)),g.canvas}function vo(n){return Array.isArray(n)?Math.min(...n):n}const Rg=10,lh=.25;class vg{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?yc(C=>ft(a,fa(C,this.targetProj_,this.sourceProj_))):ji(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const E=C[0]+"/"+C[1];return l[E]||(l[E]=h(C)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&U(s)>=U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const c=Mn(i),u=Gs(i),d=ks(i),f=Os(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),y=this.transformInv_(f),p=Rg+(o?Math.max(0,Math.ceil(Math.log2(vh(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,y,p),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(E,x,S){C=Math.min(C,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-C>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-C>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-C>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-C>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const S=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-S<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=ht([r,o,a,l]),u=this.sourceWorldWidth_?U(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=ht([t,e,i,s]);g=U(_)/this.targetWorldWidth_>lh||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>lh||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!dt(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(_);let p;f?p=(si(r[0],d)+si(a[0],d))/2-si(y[0],d):p=(r[0]+a[0])/2-y[0];const C=(r[1]+a[1])/2-y[1];g=p*p+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(_),p=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(p);this.addQuad_(t,e,_,p,r,o,y,C,h-1),this.addQuad_(p,_,i,s,C,y,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),p=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(p);this.addQuad_(t,_,p,s,r,y,C,l,h-1),this.addQuad_(_,e,i,p,y,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=bt();return this.triangles_.forEach(function(e,i,s){const r=e.source;Gi(t,r[0]),Gi(t,r[1]),Gi(t,r[2])}),t}getTriangles(){return this.triangles_}}const Tg=.5;class Pg extends fr{constructor(t,e,i,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Ns(i,h):i,u=Ht(c),d=Sg(t,e,u,s),f=Tg,g=new vg(t,e,c,l,d*f,s),m=g.calculateSourceExtent(),_=ni(m)?null:o(m,d,r),y=_?M.IDLE:M.EMPTY,p=_?_.getPixelRatio():1;super(i,s,p,y),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=p,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==M.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==M.LOADED){const e=U(this.targetExtent_)/this.targetResolution_,i=ct(this.targetExtent_)/this.targetResolution_;this.canvas_=Ig(e,i,this.sourcePixelRatio_,vo(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();const t=this.sourceImage_.getState();t==M.LOADED||t==M.ERROR?this.reproject_():(this.sourceListenerKey_=z(this.sourceImage_,D.CHANGE,e=>{const i=this.sourceImage_.getState();(i==M.LOADED||i==M.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){$(this.sourceListenerKey_),this.sourceListenerKey_=null}}const vs=4,To={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Mg extends Rt{constructor(t,e){super(t),this.image=e}}class Lg extends Gl{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=As(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const r=this.getProjection();if(!r||!s||tr(r,s))return r&&(s=r),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&tr(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Ni(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Pg(r,s,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const r=Fg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&ae(this.wantedExtent_,r)||ae(this.image.getExtent(),r))&&(this.wantedResolution_&&vo(this.wantedResolution_)===o||vo(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new fr(r,o,i,this.loader),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case M.LOADING:this.loading=!0,i=To.IMAGELOADSTART;break;case M.LOADED:this.loading=!1,i=To.IMAGELOADEND;break;case M.ERROR:this.loading=!1,i=To.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Mg(i,e))}}function Ag(n,t){n.getImage().src=t}function Fg(n,t,e,i){const s=t/e,r=Ht(n),o=An(U(n)/s,vs),a=An(ct(n)/s,vs),l=An((i-1)*o/2,vs),h=o+2*l,c=An((i-1)*a/2,vs),u=a+2*c;return Pn(r,s,0,[h,u])}function bg(n){const t=n.load||xa,e=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,t(s,n.url).then(r=>{const o=U(e)/r.width,a=ct(e)/r.height;return{image:r,extent:e,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class Dg extends Lg{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,i=t.imageLoadFunction!==void 0?t.imageLoadFunction:Ag;super({attributions:t.attributions,interpolate:t.interpolate,projection:ot(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new fr(this.imageExtent_,void 0,1,bg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(s,r)=>(this.image.setImage(s),i(this.image,r),xa(s))})),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){return dt(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}class Og extends Qa{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Ns(l,Te(e.extent,s.projection))),!a[et.ANIMATING]&&!a[et.INTERACTING]&&!ni(l))if(o){const h=s.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image=c:c.getState()===M.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=ft(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Di(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=U(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ct(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image,s=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(t,e);const _=this.context.canvas.width,y=this.context.canvas.height,p=this.getRenderContext(t);let C=!1,E=!0;if(h.extent){const R=Te(h.extent,u.projection);E=dt(R,t.extent),C=E&&!ae(R,t.extent),C&&this.clipUnrotated(p,t,R)}const x=i.getImage(),S=de(this.tempTransform,_/2,y/2,g,m,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const T=x.width*S[0],I=x.height*S[3];if(this.getLayer().getSource().getInterpolate()||(p.imageSmoothingEnabled=!1),this.preRender(p,t),E&&T>=.5&&I>=.5){const R=S[4],P=S[5],k=h.opacity;k!==1&&(p.save(),p.globalAlpha=k),p.drawImage(x,0,0,+x.width,+x.height,R,P,T,I),k!==1&&p.restore()}return this.postRender(this.context,t),C&&p.restore(),p.imageSmoothingEnabled=!0,this.container}}class kg extends cs{constructor(t){t=t||{},super(t)}}class Ng extends kg{constructor(t){super(t)}createRenderer(){return new Og(this)}getData(t){return super.getData(t)}}const Cn={IDLE:0,LOADED:2,ERROR:3,EMPTY:4},Po={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Gg extends Xn{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=z(i,Po.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=z(i,Po.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_,Uo?{passive:!1}:!1)}emulateClick_(t){let e=new pe(B.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new pe(B.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new pe(B.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==B.POINTERUP||e.type==B.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==B.POINTERDOWN||e.type==B.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new pe(B.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new pe(B.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(z(i,B.POINTERMOVE,this.handlePointerMove_,this),z(i,B.POINTERUP,this.handlePointerUp_,this),z(this.element_,B.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(z(this.element_.getRootNode(),B.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new pe(B.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new pe(B.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&($(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&($(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const yt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Ts=1/0;class zg{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ai(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){it(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Ts?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Ts?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class Wg extends zg{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(D.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Cn.LOADED||i===Cn.ERROR||i===Cn.EMPTY){i!==Cn.ERROR&&e.removeEventListener(D.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===Cn.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function jg(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Ts;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Mo extends jt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let i=0,s=this.listenerKeys.length;i<s;++i)$(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=t,t){const i=this.target_??t.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Bi&&this.listenerKeys.push(z(t,Ee.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Xg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Bn+" "+yr+(this.collapsed_&&this.collapsible_?" "+Ia:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ya(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!oe(e,this.renderedAttributions_)){Ho(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ia),this.collapsed_?Zo(this.collapseLabel_,this.label_):Zo(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Vg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Bn+" "+yr,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Vn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:wi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Vn);!r&&i===0?this.element.classList.add(Vn):r&&i!==0&&this.element.classList.remove(Vn)}this.label_.style.transform=s}this.rotation_=i}}class Bg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(D.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(D.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Bn+" "+yr,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:wi})):i.setZoom(r)}}}function Yg(n){n=n||{};const t=new _t;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Bg(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Vg(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Xg(n.attributionOptions)),t}class ke extends Rt{constructor(t,e){super(t),this.layer=e}}const Lo={LAYERS:"layers"};class Fi extends Al{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Lo.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new _t(i.slice(),{unique:!0}):it(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new _t(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach($),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(z(t,nt.ADD,this.handleLayersAdd_,this),z(t,nt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach($);ai(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new ke("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[z(t,ui.PROPERTYCHANGE,this.handleLayerChange_,this),z(t,D.CHANGE,this.handleLayerChange_,this)];t instanceof Fi&&e.push(z(t,"addlayer",this.handleLayerGroupAdd_,this),z(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ke("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ke("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ke("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach($),delete this.listenerKeys_[i],this.dispatchEvent(new ke("removelayer",e)),this.changed()}getLayers(){return this.get(Lo.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new ke("removelayer",i[s]))}this.set(Lo.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Ns(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Kg extends dr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;de(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Da(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,S,T){return r.call(o,x,E?S:null,T)}const d=c.projection,f=Bo(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=U(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,y=[],p=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const S=m[x],T=S.layer;if(T.hasRenderer()&&qr(S,c)&&a.call(l,T)){const I=T.getRenderer(),R=T.getSource();if(I&&R){const P=R.getWrapX()?f:t,k=u.bind(null,S.managed);p[0]=P[0]+g[E][0],p[1]=P[1]+g[E][1],h=I.forEachFeatureAtCoordinate(p,e,i,k,y)}if(h)return h}}if(y.length===0)return;const C=1/y.length;return y.forEach((E,x)=>E.distanceSq+=x*C),y.sort((E,x)=>E.distanceSq-x.distanceSq),y.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,Wt,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){kt.canExpireCache()&&t.postRenderFunctions.push(Ug)}}function Ug(n,t){kt.expire()}class Zg extends Kg{constructor(t){super(t),this.fontChangeListenerKey_=z(gi,ui.PROPERTYCHANGE,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Bn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new $a(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){$(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(Ot.PRECOMPOSE,t);const e=t.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);e.some(a=>a.layer instanceof bl&&a.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=e.length;a<l;++a){const h=e[a];t.layerIndex=a;const c=h.layer,u=c.getSourceState();if(!qr(h,s)||u!="ready"&&u!="undefined"){c.unrender();continue}const d=c.render(t,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(h))}this.declutter(t,r),Xh(this.element_,this.children_),this.dispatchRenderEvent(Ot.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function hh(n){if(n instanceof cs){n.setMapInternal(null);return}n instanceof Fi&&n.getLayers().forEach(hh)}function ch(n,t){if(n instanceof cs){n.setMapInternal(t);return}if(n instanceof Fi){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)ch(e[i],t)}}class Hg extends jt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=qg(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:zh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Xt(),this.pixelToCoordinateTransform_=Xt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||Yg(),this.interactions=e.interactions||Of({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Wg(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(yt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(yt.VIEW,this.handleViewChanged_),this.addChangeListener(yt.SIZE,this.handleSizeChanged_),this.addChangeListener(yt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof te)&&t.view.then(function(s){i.setView(new te(s))}),this.controls.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(nt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(nt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){ch(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:Wt,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Fi?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:Wt,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(yt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ve(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?ft(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(yt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof _t){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Z(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?ft(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(yt.SIZE)}getView(){return this.get(yt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return jg(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new pe(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Po.POINTERDOWN||i===D.WHEEL||i===D.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[et.ANIMATING]||o[et.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Ot.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Ot.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ti(Ee.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ti(Ee.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)$(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(D.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Zg(this)),this.mapBrowserEventHandler_=new Gg(this,this.moveTolerance_);for(const r in B)this.mapBrowserEventHandler_.addEventListener(B[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(D.WHEEL,this.boundHandleBrowserEvent_,Uo?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}this.targetChangeHandlerKeys_=[z(i,D.KEYDOWN,this.handleBrowserEvent,this),z(i,D.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&($(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&($(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=z(t,ui.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=z(t,D.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach($),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ke("addlayer",t)),this.layerGroupPropertyListenerKeys_=[z(t,ui.PROPERTYCHANGE,this.render,this),z(t,D.CHANGE,this.render,this),z(t,"addlayer",this.handleLayerAdd_,this),z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){hh(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Wa(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Pn(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Pn(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!ni(this.previousExtent_)&&!Ni(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ti(Ee.MOVESTART,this,s)),this.previousExtent_=Oi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[et.ANIMATING]&&!r.viewHints[et.INTERACTING]&&!Ni(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ti(Ee.MOVEEND,this,r)),Go(r.extent,this.previousExtent_))),this.dispatchEvent(new Ti(Ee.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ee.LOADSTART)||this.hasListener(Ee.LOADEND)||this.hasListener(Ot.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ke("removelayer",e)),this.set(yt.LAYERGROUP,t)}setSize(t){this.set(yt.SIZE,t)}setTarget(t){this.set(yt.TARGET,t)}setView(t){if(!t||t instanceof te){this.set(yt.VIEW,t);return}this.set(yt.VIEW,new te);const e=this;t.then(function(i){e.setView(new te(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!Wa(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&qo("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!oe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function qg(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Fi({layers:n.layers});e[yt.LAYERGROUP]=i,e[yt.TARGET]=n.target,e[yt.VIEW]=n.view instanceof te?n.view:new te;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new _t(n.controls.slice()):(it(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new _t(n.interactions.slice()):(it(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new _t(n.overlays.slice()):(it(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new _t,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const pt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class $g extends jt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+bc,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(pt.ELEMENT,this.handleElementChanged),this.addChangeListener(pt.MAP,this.handleMapChanged),this.addChangeListener(pt.OFFSET,this.handleOffsetChanged),this.addChangeListener(pt.POSITION,this.handlePositionChanged),this.addChangeListener(pt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(pt.ELEMENT)}getId(){return this.id}getMap(){return this.get(pt.MAP)||null}getOffset(){return this.get(pt.OFFSET)}getPosition(){return this.get(pt.POSITION)}getPositioning(){return this.get(pt.POSITIONING)}handleElementChanged(){Ho(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),$(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=z(t,Ee.POSTRENDER,this.render,this),this.updatePixelPosition();const i=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?i.insertBefore(this.element,i.childNodes[0]||null):i.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(pt.ELEMENT,t)}setMap(t){this.set(pt.MAP,t)}setOffset(t){this.set(pt.OFFSET,t)}setPosition(t){this.set(pt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(pt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Wh(s),jh(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!ae(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(pt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}function Jg(n,t){return typeof n=="function"?n(t):n}const Qg={name:"ppe-popup",getInitialState:n=>({...n}),createPlanEditor:n=>{const{overlay:t,closerElement:e,popupElement:i}=e_();n.addOverlay(t),e.addEventListener("click",()=>(t.setPosition(void 0),e.blur(),!1)),n._showPopup=(s,r)=>{t.setPosition(s.event.coordinate),i.innerHTML=s.content,r!=null&&r.offset&&t.setOffset(r.offset),t.setPositioning(t_(n,s.event,r==null?void 0:r.positioning))},n._hidePopup=()=>{t.setPosition(void 0)}}};function t_(n,t,e){if(e&&e!="auto")return e;const i=n.getSize();if(!i)return"top-right";const[s,r]=n.getPixelFromCoordinate(t.coordinate),[o,a]=i,l=s<o/2?"left":"right";return`${r<a/2?"top":"bottom"}-${l}`}function e_(){const n=document.createElement("div");n.id="ppe-popup",n.className="ppe-popup";const t=document.createElement("button");t.className="ppe-popup-closer";const e=document.createElement("div");return e.className="ppe-popup-content",n.insertAdjacentElement("beforeend",t),n.insertAdjacentElement("beforeend",e),{overlay:new $g({element:n,stopEvent:!1}),popupElement:n,closerElement:t}}const uh=[eh,{name:"ppe-layer",getInitialState:n=>({...n}),createPlanEditor:n=>{n.addVectorLayer=()=>{const t=new _s({wrapX:!1}),e=new gn({source:t});return n.initialState._extent&&e.setExtent(n.initialState._extent),e}}},Qg,oh];function i_(n){var m;const t=[...uh,...n._plugins??[]],{plan:e}=n,i=[0,0,e.file.width,e.file.height],s=new Dn({code:"",units:"pixels",extent:i}),r=new Dg({imageExtent:i,projection:s,url:e.file.original_url,crossOrigin:"anonymous"}),o=new Ng({source:r}),a=new te({projection:s,center:Ht(i),zoom:2,minZoom:0,maxZoom:10}),l=new Hg({target:n.target??"map",layers:[o],view:a}),h={_extent:i,_projection:s},c=l;c._plugins=t;const u=c._plugins.reduce((_,y)=>{var p;return Object.assign(_,(p=y.getDefaultOptions)==null?void 0:p.call(y,c))},{});let d={...h,...n.initialState??{}};c._plugins.forEach(_=>{var y;d=((y=_.getInitialState)==null?void 0:y.call(_,d))??d});const f=_=>c.options.mergeOptions?c.options.mergeOptions(u,_):{...u,..._},g={_plugins:t,options:{...u,...n},initialState:d,reset:()=>{c.setState(c.initialState)},getState:()=>c.options.state,setState:_=>{var y,p;(p=(y=c.options).onStateChange)==null||p.call(y,_)},setOptions:_=>{const y=Jg(_,c.options),p=c.getTarget(),C=f(y);c.options=C,C.target&&C.target!==p&&c.setTarget(C.target)},fitToContent:()=>{const _=c.getView(),y=c.getSize();y&&i&&_.fit(i,{size:y,padding:[0,0,0,0],duration:500})}};Object.assign(c,g);for(const _ of c._plugins)(m=_==null?void 0:_.createPlanEditor)==null||m.call(_,c);return c}return It.PdfExportPlugin=oh,It.ZoningPlugin=eh,It.convertToZoneGeometry=Is,It.convertZoneToGeometryFeatures=th,It.createPlanEditor=i_,It.defaultPlugins=uh,Object.defineProperty(It,Symbol.toStringTag,{value:"Module"}),It})({},jspdf);
|
package/dist/index.js
CHANGED
|
@@ -24805,10 +24805,9 @@ function E_(n) {
|
|
|
24805
24805
|
}), o = new Hg({ source: r }), a = new Jt({
|
|
24806
24806
|
projection: s,
|
|
24807
24807
|
center: ie(i),
|
|
24808
|
-
zoom:
|
|
24809
|
-
minZoom:
|
|
24810
|
-
maxZoom: 10
|
|
24811
|
-
extent: i
|
|
24808
|
+
zoom: 2,
|
|
24809
|
+
minZoom: 0,
|
|
24810
|
+
maxZoom: 10
|
|
24812
24811
|
}), l = new a_({
|
|
24813
24812
|
target: n.target ?? "map",
|
|
24814
24813
|
layers: [o],
|
package/dist/index.umd.js
CHANGED
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
<div style="height: 1rem; width: 1rem; background-color: ${n.color}"></div>
|
|
9
9
|
<div>${n.name}</div>
|
|
10
10
|
</div>
|
|
11
|
-
`}const xg={a0:[1189,841],a1:[841,594],a2:[594,420],a3:[420,297],a4:[297,210],a5:[210,148]},oh={name:"ppe-pdf-export",getInitialState:n=>({...n}),createPlanEditor:n=>{n.exportToPdf=t=>Cg(n,t)}};async function Cg(n,t){const e=(t==null?void 0:t.format)||"a4",i=(t==null?void 0:t.orientation)||"landscape",s=xg[e],r=i==="landscape"?s[0]:s[1],o=i==="landscape"?s[1]:s[0],a=n.getSize();if(!a){console.error("Unable to get map size");return}if(!n.getView().getResolution()){console.error("Unable to get view resolution");return}const h=new Lt.jsPDF(i,void 0,e);await new Promise(c=>{n.once("rendercomplete",function(){const u=document.createElement("canvas");u.width=a[0],u.height=a[1];const d=u.getContext("2d");if(!d){console.error("Unable to get canvas context"),c();return}const f=n.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer");Array.from(f).forEach(x=>{var S,T;if(x instanceof HTMLCanvasElement&&x.width>0){const I=((S=x.parentNode)==null?void 0:S.style.opacity)||"1";d.globalAlpha=parseFloat(I);const P=(T=x.style.transform.match(/^matrix\(([^\(]*)\)$/))==null?void 0:T[1].split(",").map(Number);P&&d.setTransform(...P),d.drawImage(x,0,0),d.setTransform(1,0,0,1,0,0),d.globalAlpha=1}});const g=u.toDataURL("image/jpeg"),m=u.width/u.height,_=r/o;let y=r,p=o;m>_?p=r/m:y=o*m;const C=(r-y)/2,E=(o-p)/2;h.addImage(g,"JPEG",C,E,y,p),h.save("map.pdf"),c()}),n.renderSync()})}let Io;const xn=[];function ah(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Ro(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function wg(){if(Io===void 0){const n=dt(6,6,xn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",ah(n,4,5,4,0),ah(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Io=Ro(t,0)||Ro(t,4)||Ro(t,8),Ys(n),xn.push(n.canvas)}return Io}function Sg(n,t,e,i){const s=fa(e,t,n);let r=ua(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Di(l,s)){const h=ua(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Ig(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=dt(Math.round(e*n),Math.round(e*t),xn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=Dt();l.forEach(function(x,S,T){zo(_,x.extent)});let y;const p=e/i,C=(u?1:1+Math.pow(2,-24))/p;(l.length!==1||h!==0)&&(y=dt(Math.round(U(_)*p),Math.round(ut(_)*p),xn),u||(y.imageSmoothingEnabled=!1),l.forEach(function(x,S,T){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){y.save();const N=(x.clipExtent[0]-_[0])*p,j=-(x.clipExtent[3]-_[3])*p,F=U(x.clipExtent)*p,q=ut(x.clipExtent)*p;y.rect(u?N:Math.round(N),u?j:Math.round(j),u?F:Math.round(N+F)-Math.round(N),u?q:Math.round(j+q)-Math.round(j)),y.clip()}const I=(x.extent[0]-_[0])*p,R=-(x.extent[3]-_[3])*p,P=U(x.extent)*p,k=ut(x.extent)*p;y.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?I:Math.round(I),u?R:Math.round(R),u?P:Math.round(I+P)-Math.round(I),u?k:Math.round(R+k)-Math.round(R)),x.clipExtent&&y.restore()}}));const E=Mn(o);return a.getTriangles().forEach(function(x,S,T){const I=x.source,R=x.target;let P=I[0][0],k=I[0][1],N=I[1][0],j=I[1][1],F=I[2][0],q=I[2][1];const b=m((R[0][0]-E[0])/r),W=m(-(R[0][1]-E[1])/r),X=m((R[1][0]-E[0])/r),Q=m(-(R[1][1]-E[1])/r),J=m((R[2][0]-E[0])/r),tt=m(-(R[2][1]-E[1])/r),v=P,Ce=k;P=0,k=0,N-=v,j-=Ce,F-=v,q-=Ce;const ei=[[N,j,0,0,X-b],[F,q,0,0,J-b],[0,0,N,j,Q-W],[0,0,F,q,tt-W]],xt=Fh(ei);if(!xt)return;if(g.save(),g.beginPath(),wg()||!u){g.moveTo(X,Q);const Ht=4,Ne=b-X,wn=W-Q;for(let se=0;se<Ht;se++)g.lineTo(X+m((se+1)*Ne/Ht),Q+m(se*wn/(Ht-1))),se!=Ht-1&&g.lineTo(X+m((se+1)*Ne/Ht),Q+m((se+1)*wn/(Ht-1)));g.lineTo(J,tt)}else g.moveTo(X,Q),g.lineTo(b,W),g.lineTo(J,tt);g.clip(),g.transform(xt[0],xt[2],xt[1],xt[3],b,W),g.translate(_[0]-v,_[3]-Ce);let ne;if(y)ne=y.canvas,g.scale(C,-C);else{const Ht=l[0],Ne=Ht.extent;ne=Ht.image,g.scale(U(Ne)/ne.width,-ut(Ne)/ne.height)}g.drawImage(ne,0,0),g.restore()}),y&&(Ys(y),xn.push(y.canvas)),g.canvas}function vo(n){return Array.isArray(n)?Math.min(...n):n}const Rg=10,lh=.25;class vg{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?yc(C=>gt(a,fa(C,this.targetProj_,this.sourceProj_))):ji(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const E=C[0]+"/"+C[1];return l[E]||(l[E]=h(C)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&U(s)>=U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const c=Mn(i),u=Gs(i),d=ks(i),f=Os(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),y=this.transformInv_(f),p=Rg+(o?Math.max(0,Math.ceil(Math.log2(vh(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,y,p),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(E,x,S){C=Math.min(C,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-C>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-C>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-C>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-C>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const S=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-S<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=ct([r,o,a,l]),u=this.sourceWorldWidth_?U(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=ct([t,e,i,s]);g=U(_)/this.targetWorldWidth_>lh||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>lh||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ft(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(_);let p;f?p=(si(r[0],d)+si(a[0],d))/2-si(y[0],d):p=(r[0]+a[0])/2-y[0];const C=(r[1]+a[1])/2-y[1];g=p*p+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(_),p=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(p);this.addQuad_(t,e,_,p,r,o,y,C,h-1),this.addQuad_(p,_,i,s,C,y,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),p=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(p);this.addQuad_(t,_,p,s,r,y,C,l,h-1),this.addQuad_(_,e,i,p,y,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Dt();return this.triangles_.forEach(function(e,i,s){const r=e.source;Gi(t,r[0]),Gi(t,r[1]),Gi(t,r[2])}),t}getTriangles(){return this.triangles_}}const Tg=.5;class Pg extends fr{constructor(t,e,i,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Ns(i,h):i,u=qt(c),d=Sg(t,e,u,s),f=Tg,g=new vg(t,e,c,l,d*f,s),m=g.calculateSourceExtent(),_=ni(m)?null:o(m,d,r),y=_?M.IDLE:M.EMPTY,p=_?_.getPixelRatio():1;super(i,s,p,y),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=p,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==M.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==M.LOADED){const e=U(this.targetExtent_)/this.targetResolution_,i=ut(this.targetExtent_)/this.targetResolution_;this.canvas_=Ig(e,i,this.sourcePixelRatio_,vo(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();const t=this.sourceImage_.getState();t==M.LOADED||t==M.ERROR?this.reproject_():(this.sourceListenerKey_=z(this.sourceImage_,D.CHANGE,e=>{const i=this.sourceImage_.getState();(i==M.LOADED||i==M.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){$(this.sourceListenerKey_),this.sourceListenerKey_=null}}const vs=4,To={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Mg extends Rt{constructor(t,e){super(t),this.image=e}}class Lg extends Gl{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=As(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const r=this.getProjection();if(!r||!s||tr(r,s))return r&&(s=r),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&tr(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Ni(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Pg(r,s,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const r=Fg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&ae(this.wantedExtent_,r)||ae(this.image.getExtent(),r))&&(this.wantedResolution_&&vo(this.wantedResolution_)===o||vo(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new fr(r,o,i,this.loader),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case M.LOADING:this.loading=!0,i=To.IMAGELOADSTART;break;case M.LOADED:this.loading=!1,i=To.IMAGELOADEND;break;case M.ERROR:this.loading=!1,i=To.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Mg(i,e))}}function Ag(n,t){n.getImage().src=t}function Fg(n,t,e,i){const s=t/e,r=qt(n),o=An(U(n)/s,vs),a=An(ut(n)/s,vs),l=An((i-1)*o/2,vs),h=o+2*l,c=An((i-1)*a/2,vs),u=a+2*c;return Pn(r,s,0,[h,u])}function bg(n){const t=n.load||xa,e=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,t(s,n.url).then(r=>{const o=U(e)/r.width,a=ut(e)/r.height;return{image:r,extent:e,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class Dg extends Lg{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,i=t.imageLoadFunction!==void 0?t.imageLoadFunction:Ag;super({attributions:t.attributions,interpolate:t.interpolate,projection:ot(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new fr(this.imageExtent_,void 0,1,bg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(s,r)=>(this.image.setImage(s),i(this.image,r),xa(s))})),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){return ft(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}class Og extends Qa{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Ns(l,Te(e.extent,s.projection))),!a[et.ANIMATING]&&!a[et.INTERACTING]&&!ni(l))if(o){const h=s.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image=c:c.getState()===M.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=gt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Di(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=U(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ut(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image,s=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(t,e);const _=this.context.canvas.width,y=this.context.canvas.height,p=this.getRenderContext(t);let C=!1,E=!0;if(h.extent){const R=Te(h.extent,u.projection);E=ft(R,t.extent),C=E&&!ae(R,t.extent),C&&this.clipUnrotated(p,t,R)}const x=i.getImage(),S=de(this.tempTransform,_/2,y/2,g,m,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const T=x.width*S[0],I=x.height*S[3];if(this.getLayer().getSource().getInterpolate()||(p.imageSmoothingEnabled=!1),this.preRender(p,t),E&&T>=.5&&I>=.5){const R=S[4],P=S[5],k=h.opacity;k!==1&&(p.save(),p.globalAlpha=k),p.drawImage(x,0,0,+x.width,+x.height,R,P,T,I),k!==1&&p.restore()}return this.postRender(this.context,t),C&&p.restore(),p.imageSmoothingEnabled=!0,this.container}}class kg extends cs{constructor(t){t=t||{},super(t)}}class Ng extends kg{constructor(t){super(t)}createRenderer(){return new Og(this)}getData(t){return super.getData(t)}}const Cn={IDLE:0,LOADED:2,ERROR:3,EMPTY:4},Po={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Gg extends Xn{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=z(i,Po.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=z(i,Po.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_,Uo?{passive:!1}:!1)}emulateClick_(t){let e=new pe(B.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new pe(B.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new pe(B.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==B.POINTERUP||e.type==B.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==B.POINTERDOWN||e.type==B.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new pe(B.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new pe(B.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(z(i,B.POINTERMOVE,this.handlePointerMove_,this),z(i,B.POINTERUP,this.handlePointerUp_,this),z(this.element_,B.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(z(this.element_.getRootNode(),B.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new pe(B.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new pe(B.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&($(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&($(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const pt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Ts=1/0;class zg{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ai(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){it(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Ts?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Ts?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class Wg extends zg{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(D.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Cn.LOADED||i===Cn.ERROR||i===Cn.EMPTY){i!==Cn.ERROR&&e.removeEventListener(D.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===Cn.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function jg(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Ts;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Mo extends Xt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let i=0,s=this.listenerKeys.length;i<s;++i)$(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=t,t){const i=this.target_??t.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Bi&&this.listenerKeys.push(z(t,Ee.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Xg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Bn+" "+yr+(this.collapsed_&&this.collapsible_?" "+Ia:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ya(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!oe(e,this.renderedAttributions_)){Ho(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ia),this.collapsed_?Zo(this.collapseLabel_,this.label_):Zo(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Vg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Bn+" "+yr,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Vn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:wi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Vn);!r&&i===0?this.element.classList.add(Vn):r&&i!==0&&this.element.classList.remove(Vn)}this.label_.style.transform=s}this.rotation_=i}}class Bg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(D.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(D.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Bn+" "+yr,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:wi})):i.setZoom(r)}}}function Yg(n){n=n||{};const t=new mt;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Bg(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Vg(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Xg(n.attributionOptions)),t}class ke extends Rt{constructor(t,e){super(t),this.layer=e}}const Lo={LAYERS:"layers"};class Fi extends Al{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Lo.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new mt(i.slice(),{unique:!0}):it(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new mt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach($),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(z(t,nt.ADD,this.handleLayersAdd_,this),z(t,nt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach($);ai(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new ke("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[z(t,ui.PROPERTYCHANGE,this.handleLayerChange_,this),z(t,D.CHANGE,this.handleLayerChange_,this)];t instanceof Fi&&e.push(z(t,"addlayer",this.handleLayerGroupAdd_,this),z(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ke("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ke("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ke("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach($),delete this.listenerKeys_[i],this.dispatchEvent(new ke("removelayer",e)),this.changed()}getLayers(){return this.get(Lo.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new ke("removelayer",i[s]))}this.set(Lo.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Ns(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Kg extends dr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;de(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Da(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,S,T){return r.call(o,x,E?S:null,T)}const d=c.projection,f=Bo(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=U(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,y=[],p=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const S=m[x],T=S.layer;if(T.hasRenderer()&&qr(S,c)&&a.call(l,T)){const I=T.getRenderer(),R=T.getSource();if(I&&R){const P=R.getWrapX()?f:t,k=u.bind(null,S.managed);p[0]=P[0]+g[E][0],p[1]=P[1]+g[E][1],h=I.forEachFeatureAtCoordinate(p,e,i,k,y)}if(h)return h}}if(y.length===0)return;const C=1/y.length;return y.forEach((E,x)=>E.distanceSq+=x*C),y.sort((E,x)=>E.distanceSq-x.distanceSq),y.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,jt,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){Nt.canExpireCache()&&t.postRenderFunctions.push(Ug)}}function Ug(n,t){Nt.expire()}class Zg extends Kg{constructor(t){super(t),this.fontChangeListenerKey_=z(gi,ui.PROPERTYCHANGE,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Bn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new $a(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){$(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(kt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);e.some(a=>a.layer instanceof bl&&a.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=e.length;a<l;++a){const h=e[a];t.layerIndex=a;const c=h.layer,u=c.getSourceState();if(!qr(h,s)||u!="ready"&&u!="undefined"){c.unrender();continue}const d=c.render(t,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(h))}this.declutter(t,r),Xh(this.element_,this.children_),this.dispatchRenderEvent(kt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function hh(n){if(n instanceof cs){n.setMapInternal(null);return}n instanceof Fi&&n.getLayers().forEach(hh)}function ch(n,t){if(n instanceof cs){n.setMapInternal(t);return}if(n instanceof Fi){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)ch(e[i],t)}}class Hg extends Xt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=qg(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:zh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Vt(),this.pixelToCoordinateTransform_=Vt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||Yg(),this.interactions=e.interactions||Of({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Wg(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(pt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(pt.VIEW,this.handleViewChanged_),this.addChangeListener(pt.SIZE,this.handleSizeChanged_),this.addChangeListener(pt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof ee)&&t.view.then(function(s){i.setView(new ee(s))}),this.controls.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(nt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(nt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){ch(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:jt,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Fi?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:jt,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(pt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ve(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(pt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof mt){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Z(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(pt.SIZE)}getView(){return this.get(pt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return jg(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new pe(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Po.POINTERDOWN||i===D.WHEEL||i===D.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[et.ANIMATING]||o[et.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(kt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(kt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ti(Ee.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ti(Ee.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)$(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(D.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Zg(this)),this.mapBrowserEventHandler_=new Gg(this,this.moveTolerance_);for(const r in B)this.mapBrowserEventHandler_.addEventListener(B[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(D.WHEEL,this.boundHandleBrowserEvent_,Uo?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}this.targetChangeHandlerKeys_=[z(i,D.KEYDOWN,this.handleBrowserEvent,this),z(i,D.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&($(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&($(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=z(t,ui.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=z(t,D.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach($),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ke("addlayer",t)),this.layerGroupPropertyListenerKeys_=[z(t,ui.PROPERTYCHANGE,this.render,this),z(t,D.CHANGE,this.render,this),z(t,"addlayer",this.handleLayerAdd_,this),z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){hh(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Wa(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Pn(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Pn(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!ni(this.previousExtent_)&&!Ni(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ti(Ee.MOVESTART,this,s)),this.previousExtent_=Oi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[et.ANIMATING]&&!r.viewHints[et.INTERACTING]&&!Ni(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ti(Ee.MOVEEND,this,r)),Go(r.extent,this.previousExtent_))),this.dispatchEvent(new Ti(Ee.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ee.LOADSTART)||this.hasListener(Ee.LOADEND)||this.hasListener(kt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ke("removelayer",e)),this.set(pt.LAYERGROUP,t)}setSize(t){this.set(pt.SIZE,t)}setTarget(t){this.set(pt.TARGET,t)}setView(t){if(!t||t instanceof ee){this.set(pt.VIEW,t);return}this.set(pt.VIEW,new ee);const e=this;t.then(function(i){e.setView(new ee(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!Wa(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&qo("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!oe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function qg(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Fi({layers:n.layers});e[pt.LAYERGROUP]=i,e[pt.TARGET]=n.target,e[pt.VIEW]=n.view instanceof ee?n.view:new ee;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new mt(n.controls.slice()):(it(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new mt(n.interactions.slice()):(it(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new mt(n.overlays.slice()):(it(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new mt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Et={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class $g extends Xt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+bc,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Et.ELEMENT,this.handleElementChanged),this.addChangeListener(Et.MAP,this.handleMapChanged),this.addChangeListener(Et.OFFSET,this.handleOffsetChanged),this.addChangeListener(Et.POSITION,this.handlePositionChanged),this.addChangeListener(Et.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(Et.ELEMENT)}getId(){return this.id}getMap(){return this.get(Et.MAP)||null}getOffset(){return this.get(Et.OFFSET)}getPosition(){return this.get(Et.POSITION)}getPositioning(){return this.get(Et.POSITIONING)}handleElementChanged(){Ho(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),$(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=z(t,Ee.POSTRENDER,this.render,this),this.updatePixelPosition();const i=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?i.insertBefore(this.element,i.childNodes[0]||null):i.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Et.ELEMENT,t)}setMap(t){this.set(Et.MAP,t)}setOffset(t){this.set(Et.OFFSET,t)}setPosition(t){this.set(Et.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Et.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Wh(s),jh(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!ae(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Et.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}function Jg(n,t){return typeof n=="function"?n(t):n}const Qg={name:"ppe-popup",getInitialState:n=>({...n}),createPlanEditor:n=>{const{overlay:t,closerElement:e,popupElement:i}=e_();n.addOverlay(t),e.addEventListener("click",()=>(t.setPosition(void 0),e.blur(),!1)),n._showPopup=(s,r)=>{t.setPosition(s.event.coordinate),i.innerHTML=s.content,r!=null&&r.offset&&t.setOffset(r.offset),t.setPositioning(t_(n,s.event,r==null?void 0:r.positioning))},n._hidePopup=()=>{t.setPosition(void 0)}}};function t_(n,t,e){if(e&&e!="auto")return e;const i=n.getSize();if(!i)return"top-right";const[s,r]=n.getPixelFromCoordinate(t.coordinate),[o,a]=i,l=s<o/2?"left":"right";return`${r<a/2?"top":"bottom"}-${l}`}function e_(){const n=document.createElement("div");n.id="ppe-popup",n.className="ppe-popup";const t=document.createElement("button");t.className="ppe-popup-closer";const e=document.createElement("div");return e.className="ppe-popup-content",n.insertAdjacentElement("beforeend",t),n.insertAdjacentElement("beforeend",e),{overlay:new $g({element:n,stopEvent:!1}),popupElement:n,closerElement:t}}const uh=[eh,{name:"ppe-layer",getInitialState:n=>({...n}),createPlanEditor:n=>{n.addVectorLayer=()=>{const t=new _s({wrapX:!1}),e=new gn({source:t});return n.initialState._extent&&e.setExtent(n.initialState._extent),e}}},Qg,oh];function i_(n){var m;const t=[...uh,...n._plugins??[]],{plan:e}=n,i=[0,0,e.file.width,e.file.height],s=new Dn({code:"",units:"pixels",extent:i}),r=new Dg({imageExtent:i,projection:s,url:e.file.original_url,crossOrigin:"anonymous"}),o=new Ng({source:r}),a=new ee({projection:s,center:qt(i),zoom:0,minZoom:-10,maxZoom:10,extent:i}),l=new Hg({target:n.target??"map",layers:[o],view:a}),h={_extent:i,_projection:s},c=l;c._plugins=t;const u=c._plugins.reduce((_,y)=>{var p;return Object.assign(_,(p=y.getDefaultOptions)==null?void 0:p.call(y,c))},{});let d={...h,...n.initialState??{}};c._plugins.forEach(_=>{var y;d=((y=_.getInitialState)==null?void 0:y.call(_,d))??d});const f=_=>c.options.mergeOptions?c.options.mergeOptions(u,_):{...u,..._},g={_plugins:t,options:{...u,...n},initialState:d,reset:()=>{c.setState(c.initialState)},getState:()=>c.options.state,setState:_=>{var y,p;(p=(y=c.options).onStateChange)==null||p.call(y,_)},setOptions:_=>{const y=Jg(_,c.options),p=c.getTarget(),C=f(y);c.options=C,C.target&&C.target!==p&&c.setTarget(C.target)},fitToContent:()=>{const _=c.getView(),y=c.getSize();y&&i&&_.fit(i,{size:y,padding:[0,0,0,0],duration:500})}};Object.assign(c,g);for(const _ of c._plugins)(m=_==null?void 0:_.createPlanEditor)==null||m.call(_,c);return c}lt.PdfExportPlugin=oh,lt.ZoningPlugin=eh,lt.convertToZoneGeometry=Is,lt.convertZoneToGeometryFeatures=th,lt.createPlanEditor=i_,lt.defaultPlugins=uh,Object.defineProperty(lt,Symbol.toStringTag,{value:"Module"})}));
|
|
11
|
+
`}const xg={a0:[1189,841],a1:[841,594],a2:[594,420],a3:[420,297],a4:[297,210],a5:[210,148]},oh={name:"ppe-pdf-export",getInitialState:n=>({...n}),createPlanEditor:n=>{n.exportToPdf=t=>Cg(n,t)}};async function Cg(n,t){const e=(t==null?void 0:t.format)||"a4",i=(t==null?void 0:t.orientation)||"landscape",s=xg[e],r=i==="landscape"?s[0]:s[1],o=i==="landscape"?s[1]:s[0],a=n.getSize();if(!a){console.error("Unable to get map size");return}if(!n.getView().getResolution()){console.error("Unable to get view resolution");return}const h=new Lt.jsPDF(i,void 0,e);await new Promise(c=>{n.once("rendercomplete",function(){const u=document.createElement("canvas");u.width=a[0],u.height=a[1];const d=u.getContext("2d");if(!d){console.error("Unable to get canvas context"),c();return}const f=n.getViewport().querySelectorAll(".ol-layer canvas, canvas.ol-layer");Array.from(f).forEach(x=>{var S,T;if(x instanceof HTMLCanvasElement&&x.width>0){const I=((S=x.parentNode)==null?void 0:S.style.opacity)||"1";d.globalAlpha=parseFloat(I);const P=(T=x.style.transform.match(/^matrix\(([^\(]*)\)$/))==null?void 0:T[1].split(",").map(Number);P&&d.setTransform(...P),d.drawImage(x,0,0),d.setTransform(1,0,0,1,0,0),d.globalAlpha=1}});const g=u.toDataURL("image/jpeg"),m=u.width/u.height,_=r/o;let y=r,p=o;m>_?p=r/m:y=o*m;const C=(r-y)/2,E=(o-p)/2;h.addImage(g,"JPEG",C,E,y,p),h.save("map.pdf"),c()}),n.renderSync()})}let Io;const xn=[];function ah(n,t,e,i,s){n.beginPath(),n.moveTo(0,0),n.lineTo(t,e),n.lineTo(i,s),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(t,i)+1,Math.max(e,s)),n.restore()}function Ro(n,t){return Math.abs(n[t*4]-210)>2||Math.abs(n[t*4+3]-.75*255)>2}function wg(){if(Io===void 0){const n=dt(6,6,xn);n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",ah(n,4,5,4,0),ah(n,4,5,0,5);const t=n.getImageData(0,0,3,3).data;Io=Ro(t,0)||Ro(t,4)||Ro(t,8),Ys(n),xn.push(n.canvas)}return Io}function Sg(n,t,e,i){const s=fa(e,t,n);let r=ua(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=n.getMetersPerUnit();a!==void 0&&(r/=a);const l=n.getExtent();if(!l||Di(l,s)){const h=ua(n,r,s)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Ig(n,t,e,i,s,r,o,a,l,h,c,u,d,f){const g=dt(Math.round(e*n),Math.round(e*t),xn);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function m(x){return Math.round(x*e)/e}g.globalCompositeOperation="lighter";const _=Dt();l.forEach(function(x,S,T){zo(_,x.extent)});let y;const p=e/i,C=(u?1:1+Math.pow(2,-24))/p;(l.length!==1||h!==0)&&(y=dt(Math.round(U(_)*p),Math.round(ut(_)*p),xn),u||(y.imageSmoothingEnabled=!1),l.forEach(function(x,S,T){if(x.image.width>0&&x.image.height>0){if(x.clipExtent){y.save();const N=(x.clipExtent[0]-_[0])*p,j=-(x.clipExtent[3]-_[3])*p,F=U(x.clipExtent)*p,q=ut(x.clipExtent)*p;y.rect(u?N:Math.round(N),u?j:Math.round(j),u?F:Math.round(N+F)-Math.round(N),u?q:Math.round(j+q)-Math.round(j)),y.clip()}const I=(x.extent[0]-_[0])*p,R=-(x.extent[3]-_[3])*p,P=U(x.extent)*p,k=ut(x.extent)*p;y.drawImage(x.image,h,h,x.image.width-2*h,x.image.height-2*h,u?I:Math.round(I),u?R:Math.round(R),u?P:Math.round(I+P)-Math.round(I),u?k:Math.round(R+k)-Math.round(R)),x.clipExtent&&y.restore()}}));const E=Mn(o);return a.getTriangles().forEach(function(x,S,T){const I=x.source,R=x.target;let P=I[0][0],k=I[0][1],N=I[1][0],j=I[1][1],F=I[2][0],q=I[2][1];const b=m((R[0][0]-E[0])/r),W=m(-(R[0][1]-E[1])/r),X=m((R[1][0]-E[0])/r),Q=m(-(R[1][1]-E[1])/r),J=m((R[2][0]-E[0])/r),tt=m(-(R[2][1]-E[1])/r),v=P,Ce=k;P=0,k=0,N-=v,j-=Ce,F-=v,q-=Ce;const ei=[[N,j,0,0,X-b],[F,q,0,0,J-b],[0,0,N,j,Q-W],[0,0,F,q,tt-W]],xt=Fh(ei);if(!xt)return;if(g.save(),g.beginPath(),wg()||!u){g.moveTo(X,Q);const Ht=4,Ne=b-X,wn=W-Q;for(let se=0;se<Ht;se++)g.lineTo(X+m((se+1)*Ne/Ht),Q+m(se*wn/(Ht-1))),se!=Ht-1&&g.lineTo(X+m((se+1)*Ne/Ht),Q+m((se+1)*wn/(Ht-1)));g.lineTo(J,tt)}else g.moveTo(X,Q),g.lineTo(b,W),g.lineTo(J,tt);g.clip(),g.transform(xt[0],xt[2],xt[1],xt[3],b,W),g.translate(_[0]-v,_[3]-Ce);let ne;if(y)ne=y.canvas,g.scale(C,-C);else{const Ht=l[0],Ne=Ht.extent;ne=Ht.image,g.scale(U(Ne)/ne.width,-ut(Ne)/ne.height)}g.drawImage(ne,0,0),g.restore()}),y&&(Ys(y),xn.push(y.canvas)),g.canvas}function vo(n){return Array.isArray(n)?Math.min(...n):n}const Rg=10,lh=.25;class vg{constructor(t,e,i,s,r,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=a?yc(C=>gt(a,fa(C,this.targetProj_,this.sourceProj_))):ji(this.targetProj_,this.sourceProj_);this.transformInv_=function(C){const E=C[0]+"/"+C[1];return l[E]||(l[E]=h(C)),l[E]},this.maxSourceExtent_=s,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&U(s)>=U(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?U(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?U(this.targetProj_.getExtent()):null;const c=Mn(i),u=Gs(i),d=ks(i),f=Os(i),g=this.transformInv_(c),m=this.transformInv_(u),_=this.transformInv_(d),y=this.transformInv_(f),p=Rg+(o?Math.max(0,Math.ceil(Math.log2(vh(i)/(o*o*256*256)))):0);if(this.addQuad_(c,u,d,f,g,m,_,y,p),this.wrapsXInSource_){let C=1/0;this.triangles_.forEach(function(E,x,S){C=Math.min(C,E.source[0][0],E.source[1][0],E.source[2][0])}),this.triangles_.forEach(E=>{if(Math.max(E.source[0][0],E.source[1][0],E.source[2][0])-C>this.sourceWorldWidth_/2){const x=[[E.source[0][0],E.source[0][1]],[E.source[1][0],E.source[1][1]],[E.source[2][0],E.source[2][1]]];x[0][0]-C>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-C>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-C>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const S=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-S<this.sourceWorldWidth_/2&&(E.source=x)}})}l={}}addTriangle_(t,e,i,s,r,o){this.triangles_.push({source:[s,r,o],target:[t,e,i]})}addQuad_(t,e,i,s,r,o,a,l,h){const c=ct([r,o,a,l]),u=this.sourceWorldWidth_?U(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=ct([t,e,i,s]);g=U(_)/this.targetWorldWidth_>lh||g}!f&&this.sourceProj_.isGlobal()&&u&&(g=u>lh||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ft(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)g=!0;else if(m=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),m!=1&&m!=2&&m!=4&&m!=8)return}if(h>0){if(!g){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],y=this.transformInv_(_);let p;f?p=(si(r[0],d)+si(a[0],d))/2-si(y[0],d):p=(r[0]+a[0])/2-y[0];const C=(r[1]+a[1])/2-y[1];g=p*p+C*C>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],y=this.transformInv_(_),p=[(s[0]+t[0])/2,(s[1]+t[1])/2],C=this.transformInv_(p);this.addQuad_(t,e,_,p,r,o,y,C,h-1),this.addQuad_(p,_,i,s,C,y,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],y=this.transformInv_(_),p=[(i[0]+s[0])/2,(i[1]+s[1])/2],C=this.transformInv_(p);this.addQuad_(t,_,p,s,r,y,C,l,h-1),this.addQuad_(_,e,i,p,y,o,a,C,h-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(t,i,s,r,a,l),(m&14)==0&&this.addTriangle_(t,i,e,r,a,o),m&&((m&13)==0&&this.addTriangle_(e,s,t,o,l,r),(m&7)==0&&this.addTriangle_(e,s,i,o,l,a))}calculateSourceExtent(){const t=Dt();return this.triangles_.forEach(function(e,i,s){const r=e.source;Gi(t,r[0]),Gi(t,r[1]),Gi(t,r[2])}),t}getTriangles(){return this.triangles_}}const Tg=.5;class Pg extends fr{constructor(t,e,i,s,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Ns(i,h):i,u=qt(c),d=Sg(t,e,u,s),f=Tg,g=new vg(t,e,c,l,d*f,s),m=g.calculateSourceExtent(),_=ni(m)?null:o(m,d,r),y=_?M.IDLE:M.EMPTY,p=_?_.getPixelRatio():1;super(i,s,p,y),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=p,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==M.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==M.LOADED){const e=U(this.targetExtent_)/this.targetResolution_,i=ut(this.targetExtent_)/this.targetResolution_;this.canvas_=Ig(e,i,this.sourcePixelRatio_,vo(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_)}this.state=t,this.changed()}load(){if(this.state==M.IDLE){this.state=M.LOADING,this.changed();const t=this.sourceImage_.getState();t==M.LOADED||t==M.ERROR?this.reproject_():(this.sourceListenerKey_=z(this.sourceImage_,D.CHANGE,e=>{const i=this.sourceImage_.getState();(i==M.LOADED||i==M.ERROR)&&(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){$(this.sourceListenerKey_),this.sourceListenerKey_=null}}const vs=4,To={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Mg extends Rt{constructor(t,e){super(t),this.image=e}}class Lg extends Gl{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=As(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const r=this.getProjection();if(!r||!s||tr(r,s))return r&&(s=r),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&tr(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Ni(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Pg(r,s,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const r=Fg(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&ae(this.wantedExtent_,r)||ae(this.image.getExtent(),r))&&(this.wantedResolution_&&vo(this.wantedResolution_)===o||vo(this.image.getResolution())===o)))return this.image;this.wantedProjection_=s,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new fr(r,o,i,this.loader),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case M.LOADING:this.loading=!0,i=To.IMAGELOADSTART;break;case M.LOADED:this.loading=!1,i=To.IMAGELOADEND;break;case M.ERROR:this.loading=!1,i=To.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Mg(i,e))}}function Ag(n,t){n.getImage().src=t}function Fg(n,t,e,i){const s=t/e,r=qt(n),o=An(U(n)/s,vs),a=An(ut(n)/s,vs),l=An((i-1)*o/2,vs),h=o+2*l,c=An((i-1)*a/2,vs),u=a+2*c;return Pn(r,s,0,[h,u])}function bg(n){const t=n.load||xa,e=n.imageExtent,i=n.crossOrigin??null;return()=>{const s=new Image;return s.crossOrigin=i,t(s,n.url).then(r=>{const o=U(e)/r.width,a=ut(e)/r.height;return{image:r,extent:e,resolution:o!==a?[o,a]:a,pixelRatio:1}})}}class Dg extends Lg{constructor(t){const e=t.crossOrigin!==void 0?t.crossOrigin:null,i=t.imageLoadFunction!==void 0?t.imageLoadFunction:Ag;super({attributions:t.attributions,interpolate:t.interpolate,projection:ot(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new fr(this.imageExtent_,void 0,1,bg({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(s,r)=>(this.image.setImage(s),i(this.image,r),xa(s))})),this.image.addEventListener(D.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){return ft(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}class Og extends Qa{constructor(t){super(t),this.image=null}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,r=s.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Ns(l,Te(e.extent,s.projection))),!a[et.ANIMATING]&&!a[et.INTERACTING]&&!ni(l))if(o){const h=s.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image=c:c.getState()===M.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=gt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!Di(r,s))return null;const o=this.image.getExtent(),a=this.image.getImage(),l=U(o),h=Math.floor(a.width*((s[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=ut(o),u=Math.floor(a.height*((o[3]-s[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image,s=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,f=u.resolution,g=c*o/(f*l),m=c*a/(f*l);this.prepareContainer(t,e);const _=this.context.canvas.width,y=this.context.canvas.height,p=this.getRenderContext(t);let C=!1,E=!0;if(h.extent){const R=Te(h.extent,u.projection);E=ft(R,t.extent),C=E&&!ae(R,t.extent),C&&this.clipUnrotated(p,t,R)}const x=i.getImage(),S=de(this.tempTransform,_/2,y/2,g,m,0,l*(s[0]-d[0])/o,l*(d[1]-s[3])/a);this.renderedResolution=a*c/l;const T=x.width*S[0],I=x.height*S[3];if(this.getLayer().getSource().getInterpolate()||(p.imageSmoothingEnabled=!1),this.preRender(p,t),E&&T>=.5&&I>=.5){const R=S[4],P=S[5],k=h.opacity;k!==1&&(p.save(),p.globalAlpha=k),p.drawImage(x,0,0,+x.width,+x.height,R,P,T,I),k!==1&&p.restore()}return this.postRender(this.context,t),C&&p.restore(),p.imageSmoothingEnabled=!0,this.container}}class kg extends cs{constructor(t){t=t||{},super(t)}}class Ng extends kg{constructor(t){super(t)}createRenderer(){return new Og(this)}getData(t){return super.getData(t)}}const Cn={IDLE:0,LOADED:2,ERROR:3,EMPTY:4},Po={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown"};class Gg extends Xn{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=z(i,Po.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=z(i,Po.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_,Uo?{passive:!1}:!1)}emulateClick_(t){let e=new pe(B.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new pe(B.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new pe(B.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==B.POINTERUP||e.type==B.POINTERCANCEL){delete this.trackedTouches_[i];for(const s in this.trackedTouches_)if(this.trackedTouches_[s].target!==e.target){delete this.trackedTouches_[s];break}}else(e.type==B.POINTERDOWN||e.type==B.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new pe(B.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new pe(B.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(z(i,B.POINTERMOVE,this.handlePointerMove_,this),z(i,B.POINTERUP,this.handlePointerUp_,this),z(this.element_,B.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(z(this.element_.getRootNode(),B.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new pe(B.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new pe(B.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&($(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(D.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&($(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach($),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const pt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Ts=1/0;class zg{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ai(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){it(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Ts?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,r=e[t],o=i[t],a=t;for(;t<s>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<s&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,r=i[e],o=s[e];for(;e>t;){const a=this.getParentIndex_(e);if(s[a]>o)i[e]=i[a],s[e]=s[a],e=a;else break}i[e]=r,s[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Ts?delete this.queuedElements_[this.keyFunction_(o)]:(i[s]=l,e[s++]=o);e.length=s,i.length=s,this.heapify_()}}class Wg extends zg{constructor(t,e){super(i=>t.apply(null,i),i=>i[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(D.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===Cn.LOADED||i===Cn.ERROR||i===Cn.EMPTY){i!==Cn.ERROR&&e.removeEventListener(D.CHANGE,this.boundHandleTileChange_);const s=e.getKey();s in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[s],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;){const s=this.dequeue()[0],r=s.getKey();s.getState()===Cn.IDLE&&!(r in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++i,s.load())}}}function jg(n,t,e,i,s){if(!n||!(e in n.wantedTiles)||!n.wantedTiles[e][t.getKey()])return Ts;const r=n.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+a*a)/s}class Mo extends Xt{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){var t;(t=this.element)==null||t.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){var e;this.map_&&((e=this.element)==null||e.remove());for(let i=0,s=this.listenerKeys.length;i<s;++i)$(this.listenerKeys[i]);if(this.listenerKeys.length=0,this.map_=t,t){const i=this.target_??t.getOverlayContainerStopEvent();this.element&&i.appendChild(this.element),this.render!==Bi&&this.listenerKeys.push(z(t,Ee.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}class Xg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",s=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=s):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+Bn+" "+yr+(this.collapsed_&&this.collapsible_?" "+Ia:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap().getAllLayers(),i=new Set(e.flatMap(s=>s.getAttributions(t)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(s=>i.add(s)):i.add(this.attributions_)),!this.overrideCollapsible_){const s=!e.some(r=>{var o;return((o=r.getSource())==null?void 0:o.getAttributionsCollapsible())===!1});this.setCollapsible(s)}return Array.from(i)}async updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=await Promise.all(this.collectSourceAttributions_(t).map(s=>ya(()=>s))),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!oe(e,this.renderedAttributions_)){Ho(this.ulElement_);for(let s=0,r=e.length;s<r;++s){const o=document.createElement("li");o.innerHTML=e[s],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Ia),this.collapsed_?Zo(this.collapseLabel_,this.label_):Zo(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}class Vg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",s=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(D.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+Bn+" "+yr,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Vn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const i=e.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:wi}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const s="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Vn);!r&&i===0?this.element.classList.add(Vn):r&&i!==0&&this.element.classList.remove(Vn)}this.label_.style.transform=s}this.rotation_=i}}class Bg extends Mo{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,s=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=s,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(D.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(D.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+Bn+" "+yr,f=this.element;f.className=d,f.appendChild(c),f.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const i=this.getMap().getView();if(!i)return;const s=i.getZoom();if(s!==void 0){const r=i.getConstrainedZoom(s+t);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:r,duration:this.duration_,easing:wi})):i.setZoom(r)}}}function Yg(n){n=n||{};const t=new mt;return(n.zoom!==void 0?n.zoom:!0)&&t.push(new Bg(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&t.push(new Vg(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&t.push(new Xg(n.attributionOptions)),t}class ke extends Rt{constructor(t,e){super(t),this.layer=e}}const Lo={LAYERS:"layers"};class Fi extends Al{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Lo.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new mt(i.slice(),{unique:!0}):it(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new mt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach($),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(z(t,nt.ADD,this.handleLayersAdd_,this),z(t,nt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach($);ai(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new ke("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[z(t,ui.PROPERTYCHANGE,this.handleLayerChange_,this),z(t,D.CHANGE,this.handleLayerChange_,this)];t instanceof Fi&&e.push(z(t,"addlayer",this.handleLayerGroupAdd_,this),z(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new ke("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new ke("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new ke("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=V(e);this.listenerKeys_[i].forEach($),delete this.listenerKeys_[i],this.dispatchEvent(new ke("removelayer",e)),this.changed()}getLayers(){return this.get(Lo.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let s=0,r=i.length;s<r;++s)this.dispatchEvent(new ke("removelayer",i[s]))}this.set(Lo.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const s=this.getLayerState();let r=s.zIndex;!t&&s.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=s.opacity,l.visible=l.visible&&s.visible,l.maxResolution=Math.min(l.maxResolution,s.maxResolution),l.minResolution=Math.max(l.minResolution,s.minResolution),l.minZoom=Math.max(l.minZoom,s.minZoom),l.maxZoom=Math.min(l.maxZoom,s.maxZoom),s.extent!==void 0&&(l.extent!==void 0?l.extent=Ns(l.extent,s.extent):l.extent=s.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}class Kg extends dr{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){O()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;de(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Da(s,i)}forEachFeatureAtCoordinate(t,e,i,s,r,o,a,l){let h;const c=e.viewState;function u(E,x,S,T){return r.call(o,x,E?S:null,T)}const d=c.projection,f=Bo(t.slice(),d),g=[[0,0]];if(d.canWrapX()&&s){const E=d.getExtent(),x=U(E);g.push([-x,0],[x,0])}const m=e.layerStatesArray,_=m.length,y=[],p=[];for(let E=0;E<g.length;E++)for(let x=_-1;x>=0;--x){const S=m[x],T=S.layer;if(T.hasRenderer()&&qr(S,c)&&a.call(l,T)){const I=T.getRenderer(),R=T.getSource();if(I&&R){const P=R.getWrapX()?f:t,k=u.bind(null,S.managed);p[0]=P[0]+g[E][0],p[1]=P[1]+g[E][1],h=I.forEachFeatureAtCoordinate(p,e,i,k,y)}if(h)return h}}if(y.length===0)return;const C=1/y.length;return y.forEach((E,x)=>E.distanceSq+=x*C),y.sort((E,x)=>E.distanceSq-x.distanceSq),y.some(E=>h=E.callback(E.feature,E.layer,E.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,r,o){return this.forEachFeatureAtCoordinate(t,e,i,s,jt,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){O()}scheduleExpireIconCache(t){Nt.canExpireCache()&&t.postRenderFunctions.push(Ug)}}function Ug(n,t){Nt.expire()}class Zg extends Kg{constructor(t){super(t),this.fontChangeListenerKey_=z(gi,ui.PROPERTYCHANGE,t.redrawText,t),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=Bn+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new $a(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){$(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(kt.PRECOMPOSE,t);const e=t.layerStatesArray.sort((a,l)=>a.zIndex-l.zIndex);e.some(a=>a.layer instanceof bl&&a.layer.getDeclutter())&&(t.declutter={});const s=t.viewState;this.children_.length=0;const r=[];let o=null;for(let a=0,l=e.length;a<l;++a){const h=e[a];t.layerIndex=a;const c=h.layer,u=c.getSourceState();if(!qr(h,s)||u!="ready"&&u!="undefined"){c.unrender();continue}const d=c.render(t,o);d&&(d!==o&&(this.children_.push(d),o=d),r.push(h))}this.declutter(t,r),Xh(this.element_,this.children_),this.dispatchRenderEvent(kt.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],r=s.layer;r.getDeclutter()&&r.renderDeclutter(t,s)}e.forEach(i=>i.layer.renderDeferred(t))}}}function hh(n){if(n instanceof cs){n.setMapInternal(null);return}n instanceof Fi&&n.getLayers().forEach(hh)}function ch(n,t){if(n instanceof cs){n.setMapInternal(t);return}if(n instanceof Fi){const e=n.getLayers().getArray();for(let i=0,s=e.length;i<s;++i)ch(e[i],t)}}class Hg extends Xt{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=qg(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading!==void 0?t.maxTilesLoading:16,this.pixelRatio_=t.pixelRatio!==void 0?t.pixelRatio:zh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Vt(),this.pixelToCoordinateTransform_=Vt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=e.controls||Yg(),this.interactions=e.interactions||Of({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Wg(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(pt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(pt.VIEW,this.handleViewChanged_),this.addChangeListener(pt.SIZE,this.handleSizeChanged_),this.addChangeListener(pt.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;t.view&&!(t.view instanceof ee)&&t.view.then(function(s){i.setView(new ee(s))}),this.controls.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.controls.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.interactions.addEventListener(nt.ADD,s=>{s.element.setMap(this)}),this.interactions.addEventListener(nt.REMOVE,s=>{s.element.setMap(null)}),this.overlays_.addEventListener(nt.ADD,s=>{this.addOverlayInternal_(s.element)}),this.overlays_.addEventListener(nt.REMOVE,s=>{const r=s.element.getId();r!==void 0&&delete this.overlayIdIndex_[r.toString()],s.element.setMap(null)}),this.controls.forEach(s=>{s.setMap(this)}),this.interactions.forEach(s=>{s.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){ch(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();e!==void 0&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=i!==void 0?i:{};const r=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:jt,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,r,a,e,null,o,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(s){i.push(s)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(s){s instanceof Fi?e(s.getLayers()):t.push(s)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=e!==void 0?e:{};const s=e.layerFilter!==void 0?e.layerFilter:jt,r=e.hitTolerance!==void 0?e.hitTolerance:0,o=e.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,o,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const i=this.viewport_.getBoundingClientRect(),s=this.getSize(),r=i.width/s[0],o=i.height/s[1],a="changedTouches"in t?t.changedTouches[0]:t;return[(a.clientX-i.left)/r,(a.clientY-i.top)/o]}getTarget(){return this.get(pt.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return ve(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?gt(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return e!==void 0?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(pt.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof mt){e.setLayers(t);return}const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const s=t[e];if(!s.visible)continue;const r=s.layer.getRenderer();if(r&&!r.ready)return!0;const o=s.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(t){const e=Z(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?gt(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(pt.SIZE)}getView(){return this.get(pt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return jg(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new pe(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===Po.POINTERDOWN||i===D.WHEEL||i===D.KEYDOWN){const s=this.getOwnerDocument(),r=this.viewport_.getRootNode?this.viewport_.getRootNode():s,o=e.target,a=r instanceof ShadowRoot?r.host===o?r.host.ownerDocument:r:r===s?s.documentElement:r;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(t.frameState=this.frameState_,this.dispatchEvent(t)!==!1){const s=this.getInteractions().getArray().slice();for(let r=s.length-1;r>=0;r--){const o=s[r];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let s=this.maxTilesLoading_,r=s;if(t){const o=t.viewHints;if(o[et.ANIMATING]||o[et.INTERACTING]){const a=Date.now()-t.time>8;s=a?0:8,r=a?0:2}}e.getTilesLoading()<s&&(e.reprioritize(),e.loadMoreTiles(s,r))}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(kt.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(kt.RENDERCOMPLETE,t),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ti(Ee.LOADEND,this,t)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ti(Ee.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,r=i.length;s<r;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let i=0,s=this.targetChangeHandlerKeys_.length;i<s;++i)$(this.targetChangeHandlerKeys_[i]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(D.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const i=this.targetElement_.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.unobserve(i.host),this.setSize(void 0)}const t=this.getTarget(),e=typeof t=="string"?document.getElementById(t):t;if(this.targetElement_=e,!e)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Zg(this)),this.mapBrowserEventHandler_=new Gg(this,this.moveTolerance_);for(const r in B)this.mapBrowserEventHandler_.addEventListener(B[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(D.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(D.WHEEL,this.boundHandleBrowserEvent_,Uo?{passive:!1}:!1);let i;if(this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const r=e.getRootNode();i=r instanceof ShadowRoot?r.host:e}this.targetChangeHandlerKeys_=[z(i,D.KEYDOWN,this.handleBrowserEvent,this),z(i,D.KEYPRESS,this.handleBrowserEvent,this)];const s=e.getRootNode();s instanceof ShadowRoot&&this.resizeObserver_.observe(s.host),this.resizeObserver_.observe(e)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&($(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&($(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=z(t,ui.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=z(t,D.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach($),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new ke("addlayer",t)),this.layerGroupPropertyListenerKeys_=[z(t,ui.PROPERTYCHANGE,this.render,this),z(t,D.CHANGE,this.render,this),z(t,"addlayer",this.handleLayerAdd_,this),z(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const s=t[e].layer;s.hasRenderer()&&s.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}handleLayerRemove_(t){hh(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let r=null;if(e!==void 0&&Wa(e)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:Pn(a.center,a.resolution,a.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;r.nextExtent=Pn(a.nextCenter,a.nextResolution,l,e)}}this.frameState_=r,this.renderer_.renderFrame(r),r&&(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),s&&(!this.previousExtent_||!ni(this.previousExtent_)&&!Ni(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Ti(Ee.MOVESTART,this,s)),this.previousExtent_=Oi(this.previousExtent_)),this.previousExtent_&&!r.viewHints[et.ANIMATING]&&!r.viewHints[et.INTERACTING]&&!Ni(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Ti(Ee.MOVEEND,this,r)),Go(r.extent,this.previousExtent_))),this.dispatchEvent(new Ti(Ee.POSTRENDER,this,r)),this.renderComplete_=(this.hasListener(Ee.LOADSTART)||this.hasListener(Ee.LOADEND)||this.hasListener(kt.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new ke("removelayer",e)),this.set(pt.LAYERGROUP,t)}setSize(t){this.set(pt.SIZE,t)}setTarget(t){this.set(pt.TARGET,t)}setView(t){if(!t||t instanceof ee){this.set(pt.VIEW,t);return}this.set(pt.VIEW,new ee);const e=this;t.then(function(i){e.setView(new ee(i))})}updateSize(){const t=this.getTargetElement();let e;if(t){const s=getComputedStyle(t),r=t.offsetWidth-parseFloat(s.borderLeftWidth)-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)-parseFloat(s.borderRightWidth),o=t.offsetHeight-parseFloat(s.borderTopWidth)-parseFloat(s.paddingTop)-parseFloat(s.paddingBottom)-parseFloat(s.borderBottomWidth);!isNaN(r)&&!isNaN(o)&&(e=[Math.max(0,r),Math.max(0,o)],!Wa(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&qo("No map visible because the map container's width or height are 0."))}const i=this.getSize();e&&(!i||!oe(e,i))&&(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function qg(n){let t=null;n.keyboardEventTarget!==void 0&&(t=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const e={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Fi({layers:n.layers});e[pt.LAYERGROUP]=i,e[pt.TARGET]=n.target,e[pt.VIEW]=n.view instanceof ee?n.view:new ee;let s;n.controls!==void 0&&(Array.isArray(n.controls)?s=new mt(n.controls.slice()):(it(typeof n.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),s=n.controls));let r;n.interactions!==void 0&&(Array.isArray(n.interactions)?r=new mt(n.interactions.slice()):(it(typeof n.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new mt(n.overlays.slice()):(it(typeof n.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=n.overlays):o=new mt,{controls:s,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Et={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class $g extends Xt{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+bc,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(Et.ELEMENT,this.handleElementChanged),this.addChangeListener(Et.MAP,this.handleMapChanged),this.addChangeListener(Et.OFFSET,this.handleOffsetChanged),this.addChangeListener(Et.POSITION,this.handlePositionChanged),this.addChangeListener(Et.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(Et.ELEMENT)}getId(){return this.id}getMap(){return this.get(Et.MAP)||null}getOffset(){return this.get(Et.OFFSET)}getPosition(){return this.get(Et.POSITION)}getPositioning(){return this.get(Et.POSITIONING)}handleElementChanged(){Ho(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)==null||e.remove(),$(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=z(t,Ee.POSTRENDER,this.render,this),this.updatePixelPosition();const i=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?i.insertBefore(this.element,i.childNodes[0]||null):i.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(Et.ELEMENT,t)}setMap(t){this.set(Et.MAP,t)}setOffset(t){this.set(Et.OFFSET,t)}setPosition(t){this.set(Et.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(Et.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),s=this.getElement(),r=this.getRect(s,[Wh(s),jh(s)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!ae(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),f=e.getPixelFromCoordinateInternal(d);if(!f)return;const g=[f[0]+u[0],f[1]+u[1]],m=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),s=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[s,r,s+e[0],r+e[1]]}setPositioning(t){this.set(Et.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),s=t.getSize();this.updateRenderedPosition(i,s)}updateRenderedPosition(t,e){const i=this.element.style,s=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=`${t[0]+s[0]}px`,a=`${t[1]+s[1]}px`;let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}function Jg(n,t){return typeof n=="function"?n(t):n}const Qg={name:"ppe-popup",getInitialState:n=>({...n}),createPlanEditor:n=>{const{overlay:t,closerElement:e,popupElement:i}=e_();n.addOverlay(t),e.addEventListener("click",()=>(t.setPosition(void 0),e.blur(),!1)),n._showPopup=(s,r)=>{t.setPosition(s.event.coordinate),i.innerHTML=s.content,r!=null&&r.offset&&t.setOffset(r.offset),t.setPositioning(t_(n,s.event,r==null?void 0:r.positioning))},n._hidePopup=()=>{t.setPosition(void 0)}}};function t_(n,t,e){if(e&&e!="auto")return e;const i=n.getSize();if(!i)return"top-right";const[s,r]=n.getPixelFromCoordinate(t.coordinate),[o,a]=i,l=s<o/2?"left":"right";return`${r<a/2?"top":"bottom"}-${l}`}function e_(){const n=document.createElement("div");n.id="ppe-popup",n.className="ppe-popup";const t=document.createElement("button");t.className="ppe-popup-closer";const e=document.createElement("div");return e.className="ppe-popup-content",n.insertAdjacentElement("beforeend",t),n.insertAdjacentElement("beforeend",e),{overlay:new $g({element:n,stopEvent:!1}),popupElement:n,closerElement:t}}const uh=[eh,{name:"ppe-layer",getInitialState:n=>({...n}),createPlanEditor:n=>{n.addVectorLayer=()=>{const t=new _s({wrapX:!1}),e=new gn({source:t});return n.initialState._extent&&e.setExtent(n.initialState._extent),e}}},Qg,oh];function i_(n){var m;const t=[...uh,...n._plugins??[]],{plan:e}=n,i=[0,0,e.file.width,e.file.height],s=new Dn({code:"",units:"pixels",extent:i}),r=new Dg({imageExtent:i,projection:s,url:e.file.original_url,crossOrigin:"anonymous"}),o=new Ng({source:r}),a=new ee({projection:s,center:qt(i),zoom:2,minZoom:0,maxZoom:10}),l=new Hg({target:n.target??"map",layers:[o],view:a}),h={_extent:i,_projection:s},c=l;c._plugins=t;const u=c._plugins.reduce((_,y)=>{var p;return Object.assign(_,(p=y.getDefaultOptions)==null?void 0:p.call(y,c))},{});let d={...h,...n.initialState??{}};c._plugins.forEach(_=>{var y;d=((y=_.getInitialState)==null?void 0:y.call(_,d))??d});const f=_=>c.options.mergeOptions?c.options.mergeOptions(u,_):{...u,..._},g={_plugins:t,options:{...u,...n},initialState:d,reset:()=>{c.setState(c.initialState)},getState:()=>c.options.state,setState:_=>{var y,p;(p=(y=c.options).onStateChange)==null||p.call(y,_)},setOptions:_=>{const y=Jg(_,c.options),p=c.getTarget(),C=f(y);c.options=C,C.target&&C.target!==p&&c.setTarget(C.target)},fitToContent:()=>{const _=c.getView(),y=c.getSize();y&&i&&_.fit(i,{size:y,padding:[0,0,0,0],duration:500})}};Object.assign(c,g);for(const _ of c._plugins)(m=_==null?void 0:_.createPlanEditor)==null||m.call(_,c);return c}lt.PdfExportPlugin=oh,lt.ZoningPlugin=eh,lt.convertToZoneGeometry=Is,lt.convertZoneToGeometryFeatures=th,lt.createPlanEditor=i_,lt.defaultPlugins=uh,Object.defineProperty(lt,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-editor.d.ts","sourceRoot":"","sources":["../../../src/lib/core/plan-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,iBAAiB,EAEjB,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AAYrB,eAAO,MAAM,cAAc,mFAKjB,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"plan-editor.d.ts","sourceRoot":"","sources":["../../../src/lib/core/plan-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,iBAAiB,EAEjB,gBAAgB,EAIjB,MAAM,aAAa,CAAC;AAYrB,eAAO,MAAM,cAAc,mFAKjB,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAsHvE"}
|