import{Q as t}from"./index.e5c8b0d6.js";import{R as e}from"./index.030fe210.js";const i={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection",69:"`width` or `height` cannot be provided together with `scale`"};class n extends Error{constructor(t){const e=i[t];super(e),this.code=t,this.name="AssertionError",this.message=e}}const s=n;function o(t,e){if(!t)throw new s(e)}const r=0,a=1,h=2,l=4,c=8,u=16;function d(t){const e=y();for(let i=0,n=t.length;is&&(f|=l),go&&(f|=h),f===r&&(f=a),f}function y(){return[1/0,1/0,-1/0,-1/0]}function v(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function S(t){return v(1/0,1/0,-1/0,-1/0,t)}function C(t,e){const i=t[0],n=t[1];return v(i,n,i,n,e)}function w(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function R(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function I(t,e,i,n,s){for(;i=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function O(t){return t[2]=i[2])){const e=L(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}const W="change",B="error",z="load";const N=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};const Y=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};function X(t,e){return t>e?1:t0?s-1:s}return n-1}if(i>0){for(let i=1;i0)}removeEventListener(t,e){const i=this.listeners_&&this.listeners_[t];if(i){const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=K,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}};function $(){throw new Error("Unimplemented abstract method.")}let tt=0;function et(t){return t.ol_uid||(t.ol_uid=String(++tt))}function it(t){return 1-function(t){return Math.pow(t,3)}(1-t)}function nt(t){return 3*t*t-2*t*t*t}const st="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";st.includes("firefox");st.includes("safari")&&!st.includes("chrom")&&(st.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(st)),st.includes("webkit")&&st.includes("edge"),st.includes("macintosh");const ot="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,rt="undefined"!=typeof Image&&Image.prototype.decode;function at(t,e,i,n){let s;return s=i&&i.length?i.shift():ot?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(e){}}();const ht=0,lt=1,ct=2,ut=3;function dt(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const o={target:t,type:e,listener:i};return t.addEventListener(e,i),o}function gt(t,e,i,n){return dt(t,e,i,n,!0)}function ft(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),H(t))}const _t={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};const mt=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||_t[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}},pt=6378137,xt=Math.PI*pt,yt=[-xt,-xt,xt,xt],vt=[-180,-85,180,85],St=pt*Math.log(Math.tan(Math.PI/2));class Ct extends mt{constructor(t){super({code:t,units:"m",extent:yt,global:!0,worldExtent:vt,getPointResolution:function(t,e){return t/Math.cosh(e[1]/pt)}})}}const wt=[new Ct("EPSG:3857"),new Ct("EPSG:102100"),new Ct("EPSG:102113"),new Ct("EPSG:900913"),new Ct("http://www.opengis.net/def/crs/EPSG/0/3857"),new Ct("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Rt(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;sSt?i=St:i<-St&&(i=-St),e[s+1]=i}return e}function It(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let s=0;s1?(i=s,n=o):h>0&&(i+=r*h,n+=a*h)}return Dt(t,e,i,n)}function Dt(t,e,i,n){const s=i-t,o=n-e;return s*s+o*o}function Ot(t){return t*Math.PI/180}function Gt(t,e){const i=t%e;return i*e<0?i+e:i}function Wt(t,e,i){return t+i*(e-t)}function Bt(t,e){const i=t[0],n=t[1],s=e[0],o=e[1],r=s[0],a=s[1],h=o[0],l=o[1],c=h-r,u=l-a,d=0===c&&0===u?0:(c*(i-r)+u*(n-a))/(c*c+u*u||0);let g,f;return d<=0?(g=r,f=a):d>=1?(g=h,f=l):(g=r+d*c,f=a+d*u),[g,f]}function zt(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Nt(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Yt(t,e){return Math.sqrt(Nt(t,e))}function Xt(t,e){if(e.canWrapX()){const i=L(e.getExtent()),n=function(t,e,i){const n=e.getExtent();let s=0;e.canWrapX()&&(t[0]n[2])&&(i=i||L(n),s=Math.floor((t[0]-n[0])/i));return s}(t,e,i);n&&(t[0]-=n*i)}return t}const Vt=6371008.8;function Zt(t,e,i){i=i||Vt;const n=Ot(t[1]),s=Ot(e[1]),o=(s-n)/2,r=Ot(e[0]-t[0])/2,a=Math.sin(o)*Math.sin(o)+Math.sin(r)*Math.sin(r)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function jt(t,e){let i=0;for(let n=0,s=t.length;n=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Ht=!1),t}function ae(t,e){return t}function he(t,e){return t}var le,ce,ue;ee(wt),ee(bt),le=wt,ce=Rt,ue=It,bt.forEach((function(t){le.forEach((function(e){At(t,e,ce),At(e,t,ue)}))}));const de="propertychange";class ge extends Q{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(W)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;so&&(i-a)*(o-h)-(s-a)*(n-h)>0&&r++:n<=o&&(i-a)*(o-h)-(s-a)*(n-h)<0&&r--,a=i,h=n}return 0!==r}function Ce(t,e,i,n,s,o){if(0===i.length)return!1;if(!Se(t,e,i[0],n,s,o))return!1;for(let r=1,a=i.length;r=s[0]&&o[2]<=s[2]||(o[1]>=s[1]&&o[3]<=s[3]||ye(t,e,i,n,(function(t,e){return function(t,e,i){let n=!1;const s=x(t,e),o=x(t,i);if(s===a||o===a)n=!0;else{const r=t[0],a=t[1],d=t[2],g=t[3],f=e[0],_=e[1],m=i[0],p=i[1],x=(p-_)/(m-f);let y,v;o&h&&!(s&h)&&(y=m-(p-g)/x,n=y>=r&&y<=d),n||!(o&l)||s&l||(v=p-(m-d)*x,n=v>=a&&v<=g),n||!(o&c)||s&c||(y=m-(p-a)/x,n=y>=r&&y<=d),n||!(o&u)||s&u||(v=p-(m-r)*x,n=v>=a&&v<=g)}return n}(s,t,e)})))))}function Re(t,e,i,n,s){if(!function(t,e,i,n,s){return!!(we(t,e,i,n,s)||Se(t,e,i,n,s[0],s[1])||Se(t,e,i,n,s[0],s[3])||Se(t,e,i,n,s[2],s[1])||Se(t,e,i,n,s[2],s[3]))}(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let o=1,r=i.length;o0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Xe(ze,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Xe(Ne,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Xe(Ne,i,t)),this.dispatchEvent(new Xe(ze,e,t))}updateLength_(){this.set(Ye,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i=200&&a.status<300){const t=e.getType();let n;"json"==t||"text"==t?n=a.responseText:"xml"==t?(n=a.responseXML,n||(n=(new DOMParser).parseFromString(a.responseText,"application/xml"))):"arraybuffer"==t&&(n=a.response),n?o(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):r()}else r()},a.onerror=r,a.send()}(t,e,i,n,s,(function(t,e){a.addFeatures(t),void 0!==o&&o(t)}),r||K)}}class ei extends Y{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const ii=class extends xe{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=K,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(o(this.format_,7),this.loader_=ti(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:$e;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.featuresRtree_=e?new Ze:null,this.loadedExtentsRtree_=new Ze,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Ve(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=et(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new ei(je,t))}setupChangeEvents_(t,e){this.featureChangeKeys_[t]=[dt(e,W,this.handleFeatureChange_,this),dt(e,de,this.handleFeatureChange_,this)]}addToIndex_(t,e){let i=!0;const n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&(o(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let s=0,o=t.length;s{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(Ne,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(ft)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new ei(qe);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){if(i.getGeometry().intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){if(i.getGeometry().intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),J(this.nullGeometryFeatures_)||j(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=function(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];G(t,e);const n=L(i);if(L(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const o=[NaN,NaN];let r=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||q,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),h=r;if(r=e.closestPointXY(i,n,o,r),r{--this.loadingExtentsCount_,this.dispatchEvent(new ei(Je,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new ei(Qe))})),n.insert(t,{extent:t.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if(w(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=et(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=et(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(ft),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new ei(Ke,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}return e}setLoader(t){this.loader_=t}setUrl(t){o(this.format_,7),this.url_=t,this.setLoader(ti(t,this.format_))}},ni="opacity",si="visible",oi="extent",ri="zIndex",ai="maxResolution",hi="minResolution",li="maxZoom",ci="minZoom",ui="source",di="map";const gi=class extends me{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[ni]=void 0!==t.opacity?t.opacity:1,o("number"==typeof e[ni],64),e[si]=void 0===t.visible||t.visible,e[ri]=t.zIndex,e[ai]=void 0!==t.maxResolution?t.maxResolution:1/0,e[hi]=void 0!==t.minResolution?t.minResolution:0,e[ci]=void 0!==t.minZoom?t.minZoom:-1/0,e[li]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=Pt(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return $()}getLayerStatesArray(t){return $()}getExtent(){return this.get(oi)}getMaxResolution(){return this.get(ai)}getMinResolution(){return this.get(hi)}getMinZoom(){return this.get(ci)}getMaxZoom(){return this.get(li)}getOpacity(){return this.get(ni)}getSourceState(){return $()}getVisible(){return this.get(si)}getZIndex(){return this.get(ri)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(oi,t)}setMaxResolution(t){this.set(ai,t)}setMinResolution(t){this.set(hi,t)}setMaxZoom(t){this.set(li,t)}setMinZoom(t){this.set(ci,t)}setOpacity(t){o("number"==typeof t,64),this.set(ni,t)}setVisible(t){this.set(si,t)}setZIndex(t){this.set(ri,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},fi="prerender",_i="postrender",mi="precompose",pi=0,xi=1,yi={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function vi(t,e,i){return function(n,s,o,r,a){if(!n)return;if(!s&&!e)return n;const h=e?0:o[0]*s,l=e?0:o[1]*s,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,f=t[1]+l/2+u,_=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let m=Pt(n[0],d,g),p=Pt(n[1],f,_);if(r&&i&&s){const t=30*s;m+=-t*Math.log(1+Math.max(0,d-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),p+=-t*Math.log(1+Math.max(0,f-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-_)/t)}return[m,p]}}function Si(t){return t}function Ci(t,e,i,n){const s=L(e)/i[0],o=k(e)/i[1];return n?Math.min(t,Math.max(s,o)):Math.min(t,Math.min(s,o))}function wi(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),Pt(n,i/2,2*e)}function Ri(t,e,i,n,s){return i=void 0===i||i,function(o,r,a,h){if(void 0!==o){const r=n?Ci(t,n,a,s):t;return i&&h?wi(o,r,e):Pt(o,e,r)}}}function Ii(t){if(void 0!==t)return 0}function Mi(t){if(void 0!==t)return t}function Ei(t,e,i,n,s,o,r){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((s-a)*l+(o-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let s=0;ss&&(s=a),o=i,r=n}return s}function bi(t,e,i,n,s,o,r,a,h,l,c){if(e==i)return l;let u,d;if(0===s){if(d=Dt(r,a,t[e],t[e+1]),d0;){const i=l.pop(),o=l.pop();let r=0;const a=t[o],u=t[o+1],d=t[i],g=t[i+1];for(let e=o+n;er&&(c=e,r=i)}r>s&&(h[(c-e)/n]=1,o+n0&&f>d)&&(g<0&&_0&&_>g)?(a=i,h=u):(o[r++]=a,o[r++]=h,l=a,c=h,a=i,h=u)}return o[r++]=a,o[r++]=h,r}function Pi(t,e,i,n,s){s=void 0!==s?s:[];let o=0;for(let r=e;r0}function Ni(t,e,i,n,s){s=void 0!==s&&s;for(let o=0,r=i.length;op&&(l=(c+u)/2,Ce(t,e,i,n,l,f)&&(m=l,p=s)),c=u}return isNaN(m)&&(m=s[o]),r?(r.push(m,f,p),r):[m,f,p]}(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Be(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Wi(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let s=0;for(let o=0,r=i.length;oc&&d1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[xi]>0}cancelAnimations(){let t;this.setHint(pi,-this.hints_[pi]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,o=n.length;i0?r/o.duration:1;a>=1?(o.complete=!0,a=1):s=!1;const h=o.easing(a);if(o.sourceCenter){const t=o.sourceCenter[0],e=o.sourceCenter[1],i=o.targetCenter[0],n=o.targetCenter[1];this.nextCenter_=o.targetCenter;const s=t+h*(i-t),r=e+h*(n-e);this.targetCenter_=[s,r]}if(o.sourceResolution&&o.targetResolution){const t=1===h?o.targetResolution:o.sourceResolution+h*(o.targetResolution-o.sourceResolution);if(o.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,o.anchor)}this.nextResolution_=o.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==o.sourceRotation&&void 0!==o.targetRotation){const t=1===h?Gt(o.targetRotation+Math.PI,2*Math.PI)-Math.PI:o.sourceRotation+h*(o.targetRotation-o.sourceRotation);if(o.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,o.anchor)}this.nextRotation_=o.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!o.complete)break}if(s){this.animations_[i]=null,this.setHint(pi,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&Vi(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();var s,o;return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],function(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,o=t[1]*i+t[0]*n;t[0]=s,t[1]=o}(i,t-this.getRotation()),o=e,(s=i)[0]+=+o[0],s[1]+=+o[1]),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?oe(t,this.getProjection()):t}getCenterInternal(){return this.get(yi.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return ae(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();o(e,1);const i=this.getResolution();o(void 0!==i,2);const n=this.getRotation();return o(void 0!==n,3),F(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(yi.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(he(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=L(t)/e[0],n=k(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(yi.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const s=this.padding_;if(s){const t=this.getViewportSizeMinusPadding_();n=ji(n,this.getViewportSize_(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const s=V(this.resolutions_,t,1);n=s,e=this.resolutions_[s],i=s==this.resolutions_.length-1?2:e/this.resolutions_[s+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=Pt(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,Pt(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(o(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)){o(!O(t),25);i=Xi(he(t,this.getProjection()))}else if("Circle"===t.getType()){const e=he(t.getExtent(),this.getProjection());i=Xi(e),i.rotate(this.getRotation(),b(e))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),s=t.getFlatCoordinates(),o=t.getStride();let r=1/0,a=1/0,h=-1/0,l=-1/0;for(let c=0,u=s.length;c{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof Ui?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const s=this.getExtent();return function(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}(n,e.viewState)&&(!s||D(s,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof Ui?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(di,t)}getMapInternal(){return this.get(di)}setMap(t){this.mapPrecomposeKey_&&(ft(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(ft(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=dt(t,mi,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);o(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=dt(this,W,t.render,t),this.changed())}setSource(t){this.set(ui,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}};const Ki=class extends fe{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return $()}getData(t){return null}prepareFrame(t){return $()}renderFrame(t,e){return $()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,s)=>{const o=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,o)}}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==ct&&e.getState()!==ut||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=ct&&e!=ut&&t.addEventListener(W,this.boundHandleImageChange_),e==ht&&(t.load(),e=t.getState()),e==ct}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}};const Hi=class extends Y{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}},Ji=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Qi=/^([a-z]*)$|^hsla?\(.*\)$/i;function $i(t){return"string"==typeof t?t:sn(t)}const tn=function(){const t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){let i=0;for(const n in t)3&i++||(delete t[n],--e)}n=function(t){let e,i,n,s,r;Qi.exec(t)&&(t=function(t){const e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}(t));if(Ji.exec(t)){const o=t.length-1;let a;a=o<=4?1:2;const h=4===o||8===o;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),s=h?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,h&&(s=(s<<4)+s)),r=[e,i,n,s/255]}else t.startsWith("rgba(")?(r=t.slice(5,-1).split(",").map(Number),nn(r)):t.startsWith("rgb(")?(r=t.slice(4,-1).split(",").map(Number),r.push(1),nn(r)):o(!1,14);return r}(i),t[i]=n,++e}return n}}();function en(t){return Array.isArray(t)?t:tn(t)}function nn(t){return t[0]=Pt(t[0]+.5|0,0,255),t[1]=Pt(t[1]+.5|0,0,255),t[2]=Pt(t[2]+.5|0,0,255),t[3]=Pt(t[3],0,1),t}function sn(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(100*t[3])/100)+")"}const on=[];let rn=null;const an=class extends Ki{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;rn||(rn=at(1,1,void 0,{willReadFrequently:!0})),rn.clearRect(0,0,1,1);try{rn.drawImage(t,e,i,1,1,0,0,1,1),n=rn.getImageData(0,0,1,1).data}catch(s){return rn=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let s,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&U(en(t.style.backgroundColor),en(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(o=e.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",o=at();const e=o.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=o}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=A(i),s=P(i),o=T(i),r=E(i);Te(e.coordinateToPixelTransform,n),Te(e.coordinateToPixelTransform,s),Te(e.coordinateToPixelTransform,o),Te(e.coordinateToPixelTransform,r);const a=this.inversePixelTransform;Te(a,n),Te(a,s),Te(a,o),Te(a,r),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Hi(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(fi,t,e)}postRender(t,e){this.dispatchRenderEvent_(_i,t,e)}getRenderTransform(t,e,i,n,s,o,r){const a=s/2,h=o/2,l=n/e,c=-l,u=-t[0]+r,d=-t[1];return be(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},hn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAeCAYAAADQBxWhAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAJBSURBVEiJ7ZfPa9NgHMaf933j27jazTqRLq02tc0q6E4DZYfCEPwFuwzmwYPiQTz4H3gQ/wBRPHhxetB58CKIbKcNRKig11EGdutoHW6dP7aqXS2NTeKhjQSNW96tKyg+EEieNzyf9/3mG/KGwFY8kmCGmbJA+gD40TpVCKyMwWga8+9yAEAAgB0Ij1gUJ1oIchUxMWUsLD5hiEcSBDi/3cAGFXGru+sNZYaZaguwKWaYKdp8hm2TBdInQbBpYpMPhrimKr/62djgqMcIPxUBhm5c7eeaquhzhSXnYU/Ga47kZgYvDEfBdzAA4L2xoO13jZzqBwD9/cqa836uqeCaqoQf3RysFz+UAUCfzZcAAPp3ozT29K3zfkLV8F2n4TucCKgT9895nbUXFYYuPa7N5Mr29W8rrc3kyl/Gnr1GB5d2HR9Isj27A/pso4RsbzCwXrjxqVQGAN6rKsbq5/La81dZfNPrTiDgslKn7KYRaBIAQDL/4rI+V1jKn7w44TYu1EitkjC05/a1o9Hx0dMAQHycRsfvnem5c/2YSIZr964nfujgPjkZU6RISKYdMpOPaPupfycXyfg7yvsf+u9BrWpVBwDKGCFNz6w0PK8SfmUWhq9MSqFuX315pQYA8wNnH9aXP9ZEMjZVXhvYOBcDbhq6VXkqr8gHesvQ6nS2yDVVcduebKTqdLb4pzFC1fAttHZzvZEqlMDKtBEIAitDDUbT7YQajKYZSl9XaWenDIL4dgOJiSmrsPiS/HTa+AP1A194w/sdsoQRAAAAAElFTkSuQmCC";function ln(e){return t({url:"equipment/contractors",method:"get",params:e})}function cn(e){return t({url:"equipment/districtsBlocks",method:"get",params:e})}function un(e){return t({url:"equipment/cityAndCount",method:"get",params:e})}class dn{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Ie(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new dn({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return $()}getImage(t){return $()}getHitDetectionImage(){return $()}getPixelRatio(t){return 1}getImageState(){return $()}getImageSize(){return $()}getOrigin(){return $()}getSize(){return $()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ie(t)}listenImageChange(t){$()}load(){$()}unlistenImageChange(t){$()}}const gn=dn;function fn(t){return Array.isArray(t)?sn(t):t}const _n=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),mn=["style","variant","weight","size","lineHeight","family"],pn=function(t){const e=t.match(_n);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let n=0,s=mn.length;nMath.max(e,Ln(t,i))),0);return i[e]=n,n}function On(t,e,i,n,s,o,r,a,h,l,c){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let n=0,s=i.length;nthis.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Xn(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const s=Xn(t,e,i);this.cache_[s]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Zn=null;class jn extends Q{constructor(t,e,i,n,s,o){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=n,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=s,this.size_=i,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===ct){Zn||(Zn=at(1,1,void 0,{willReadFrequently:!0})),Zn.drawImage(this.image_,0,0);try{Zn.getImageData(0,0,1,1),this.tainted_=!1}catch(t){Zn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(W)}handleImageError_(){this.imageState_=ut,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ct,this.size_?(this.image_.width=this.size_[0],this.image_.height=this.size_[1]):this.size_=[this.image_.width,this.image_.height],this.unlistenImage_(),this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=at(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ht){this.image_||this.initializeImage_(),this.imageState_=lt;try{this.image_.src=this.src_}catch(t){this.handleImageError_()}this.unlisten_=function(t,e,i){const n=t;let s=!0,o=!1,r=!1;const a=[gt(n,z,(function(){r=!0,o||e()}))];return n.src&&rt?(o=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(r?e():i())}))):a.push(gt(n,B,i)),function(){s=!1,a.forEach(ft)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==ct)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=$i(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Un(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class qn extends gn{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const r=void 0!==t.img?t.img:null;this.imgSize_=t.imgSize;let a=t.src;o(!(void 0!==a&&r),4),o(!r||r&&this.imgSize_,5),void 0!==a&&0!==a.length||!r||(a=r.src||et(r)),o(void 0!==a&&a.length>0,6),o(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),69);const h=void 0!==t.src?ht:ct;if(this.color_=void 0!==t.color?en(t.color):null,this.iconImage_=function(t,e,i,n,s,o){let r=Vn.get(e,n,o);return r||(r=new jn(t,e,i,n,s,o),Vn.set(e,n,o,r)),r}(r,a,void 0!==this.imgSize_?this.imgSize_:null,this.crossOrigin_,h,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(!(n instanceof HTMLCanvasElement||n.src&&n.complete)){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Un(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}e=n.width,i=n.height}void 0!==e&&this.setScale(Un(e,i,t.width,t.height))}}clone(){let t,e,i;this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t);return new qn({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,imgSize:this.imgSize_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==ct?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==ct?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(W,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(W,t)}}const Kn=qn;class Hn{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new Hn({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const Jn=Hn;class Qn{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=es,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new Qn({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=es,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let $n=null;function ts(t,e){if(!$n){const t=new Yn({color:"rgba(255,255,255,0.4)"}),e=new Jn({color:"#3399CC",width:1.25});$n=[new Qn({image:new zn({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return $n}function es(t){return t.getGeometry()}const is=Qn;class ns{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=Ie(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new Yn({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding}clone(){const t=this.getScale();return new ns({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Ie(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const ss=ns;function os(t,e,i,n,s,o,r){let a,h;const l=(i-e)/n;if(1===l)a=e;else if(2===l)a=e,h=s;else if(0!==l){let o=t[e],r=t[e+1],l=0;const c=[0];for(let s=e+n;s>1),s=+i(t[n],e),s<0?o=n+1:(r=n,a=!s);return a?o:~o}(c,u);d<0?(h=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*n):a=e+d*n}r=r>1?r:2,o=o||new Array(r);for(let c=0;c>1;sr&&(this.instructions.push([Ss.CUSTOM,r,h,t,i,Pi]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,h,t,n||i,Pi]));break;case"Point":a=t.getFlatCoordinates(),this.coordinates.push(a[0],a[1]),h=this.coordinates.length,this.instructions.push([Ss.CUSTOM,r,h,t,i]),this.hitDetectionInstructions.push([Ss.CUSTOM,r,h,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[Ss.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Ss.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let n,s,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[Ss.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Ss.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,s=t.lineDash,o=t.lineDashOffset,r=t.lineJoin,a=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!U(t.currentLineDash,s)||t.currentLineDashOffset!=o||t.currentLineJoin!=r||t.currentLineWidth!=a||t.currentMiterLimit!=h)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=o,t.currentLineJoin=r,t.currentLineWidth=a,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Ss.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(t=this.maxExtent,e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;g(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}var t,e;return this.bufferedMaxExtent_}};const Rs=class extends ws{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Ss.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ss.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([Ss.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([Ss.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}};const Is=class extends ws{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),r=[Ss.MOVE_TO_LINE_TO,s,o];return this.instructions.push(r),this.hitDetectionInstructions.push(r),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0],ys);const o=t.getFlatCoordinates(),r=t.getStride();this.drawFlatCoordinates_(o,0,o.length,r),this.hitDetectionInstructions.push(xs),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Ss.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Sn,0],ys);const o=t.getEnds(),r=t.getFlatCoordinates(),a=t.getStride();let h=0;for(let l=0,c=o.length;l=t){const e=(t-a+u)/u,d=Wt(i,l,e),g=Wt(n,c,e);h.push(d,g),o.push(h),h=[d,g],a==t&&(r+=s),a=0}else if(a0&&o.push(h),o}function Ts(t,e,i,n,s){let o,r,a,h,l,c,u,d,g,f,_=i,m=i,p=0,x=0,y=i;for(r=i;rt&&(x>p&&(p=x,_=y,m=r),x=0,y=r-s)),a=h,u=g,d=f),l=i,c=n}return x+=h,x>p?[y,r]:[_,m]}const bs={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const Fs={Circle:Ms,Default:ws,Image:Rs,LineString:Is,Polygon:Ms,Text:class extends ws{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[yn]={fillStyle:yn},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!i&&!n)return;const o=this.coordinates;let r=o.length;const a=t.getType();let h=null,l=t.getStride();if("line"!==s.placement||"LineString"!=a&&"MultiLineString"!=a&&"Polygon"!=a&&"MultiPolygon"!=a){let i=s.overflow?null:[];switch(a){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),l=2;break;case"Polygon":h=t.getFlatInteriorPoint(),s.overflow||i.push(h[2]/this.resolution),l=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();h=[];for(let t=0,n=e.length;t{const n=o[2*(t+i)]===h[i*l]&&o[2*(t+i)+1]===h[i*l+1];return n||--t,n}))}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let c=s.padding;if(c!=Mn&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),c=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([Ss.DRAW_IMAGE,r,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,c==Mn?Mn:c.map((function(t){return t*u})),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const d=1/u,g=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=yn,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([Ss.DRAW_IMAGE,r,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[d,d],NaN,void 0,this.declutterImageWithText_,c,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?yn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),s.backgroundFill&&(this.state.fillStyle=g,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!D(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(h=t.getFlatCoordinates(),"LineString"==a)i=[h.length];else if("MultiLineString"==a)i=t.getEnds();else if("Polygon"==a)i=t.getEnds().slice(0,1);else if("MultiPolygon"==a){const e=t.getEndss();i=[];for(let t=0,n=e.length;tt[2]}else E=v>I;const T=Math.PI,b=[],F=C+n===e;let k;if(m=0,p=w,d=t[e=C],g=t[e+1],F){x(),k=Math.atan2(g-_,d-f),E&&(k+=k>0?-T:T);const t=(I+v)/2,e=(M+S)/2;return b[0]=[t,e,(R-o)/2,k,s],b}for(let A=0,P=(s=s.replace(/\n/g," ")).length;A0?-T:T),void 0!==k){let e=t-k;if(e+=e>T?-2*T:e<-T?2*T:0,Math.abs(e)>r)return null}k=t;const u=A;let v=0;for(;A0&&t.push("\n",""),t.push(e,""),t}const Ys=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const o=n?this.strokeStates[n]:null,r=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=Array.isArray(t),u=a.justify?bs[a.justify]:zs(Array.isArray(t)?t[0]:t,a.textAlign||Rn),d=n&&o.lineWidth?o.lineWidth:0,g=c?t:t.split("\n").reduce(Ns,[]),{width:f,height:_,widths:m,heights:p,lineWidths:x}=function(t,e){const i=[],n=[],s=[];let o=0,r=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){o=Math.max(o,r),s.push(r),r=0,a+=h;continue}const d=e[l+1]||t.font,g=Ln(d,u);i.push(g),r+=g;const f=An(d);n.push(f),h=Math.max(h,f)}return{width:o,height:a,widths:i,heights:n,lineWidths:s}}(a,g),y=f+d,v=[],S=(y+2)*l[0],C=(_+d)*l[1],w={width:S<0?Math.floor(S):Math.ceil(S),height:C<0?Math.floor(C):Math.ceil(C),contextInstructions:v};1==l[0]&&1==l[1]||v.push("scale",l),n&&(v.push("strokeStyle",o.strokeStyle),v.push("lineWidth",d),v.push("lineCap",o.lineCap),v.push("lineJoin",o.lineJoin),v.push("miterLimit",o.miterLimit),v.push("setLineDash",[o.lineDash]),v.push("lineDashOffset",o.lineDashOffset)),i&&v.push("fillStyle",r.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const R=.5-u;let I=u*y+R*d;const M=[],E=[];let T,b=0,F=0,k=0,A=0;for(let P=0,L=g.length;Pt?t-h:s,y=o+l>e?e-l:o,S=g[3]+x*u[0]+g[1],C=g[0]+y*u[1]+g[2],w=m-g[3],R=p-g[0];let I;return(f||0!==c)&&(Ls[0]=w,Gs[0]=w,Ls[1]=R,Ds[1]=R,Ds[0]=w+S,Os[0]=Ds[0],Os[1]=R+C,Gs[1]=Os[1]),0!==c?(I=be([1,0,0,1,0,0],i,n,1,1,c,-i,-n),Te(I,Ls),Te(I,Ds),Te(I,Os),Te(I,Gs),v(Math.min(Ls[0],Ds[0],Os[0],Gs[0]),Math.min(Ls[1],Ds[1],Os[1],Gs[1]),Math.max(Ls[0],Ds[0],Os[0],Gs[0]),Math.max(Ls[1],Ds[1],Os[1],Gs[1]),Ps)):v(Math.min(w,w+S),Math.min(R,R+C),Math.max(w,w+S),Math.max(R,R+C),Ps),d&&(m=Math.round(m),p=Math.round(p)),{drawImageX:m,drawImageY:p,drawImageW:x,drawImageH:y,originX:h,originY:l,declutterBox:{minX:Ps[0],minY:Ps[1],maxX:Ps[2],maxY:Ps[3],value:_},canvasTransform:I,scale:u}}replayImageOrLabel_(t,e,i,n,s,o,r){const a=!(!o&&!r),h=n.declutterBox,l=t.canvas,c=r?r[2]*n.scale[0]/2:0;return h.minX-c<=l.width/e&&h.maxX+c>=0&&h.minY-c<=l.height/e&&h.maxY+c>=0&&(a&&this.replayTextBackground_(t,Ls,Ds,Os,Gs,o,r),On(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=Te(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],o=this.createLabel(t,e,n,i),r=this.strokeStates[i],a=this.pixelRatio,h=zs(Array.isArray(t)?t[0]:t,s.textAlign||Rn),l=bs[s.textBaseline||In],c=r&&r.lineWidth?r.lineWidth:0;return{label:o,anchorX:h*(o.width/a-2*s.scale[0])+2*(.5-h)*c,anchorY:l*o.height/a+2*(.5-l)*c}}execute_(t,e,i,n,s,o,r,a){let h;var l,c;this.pixelCoordinates_&&U(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=ke(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),l=this.renderedTransform_,c=i,l[0]=c[0],l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5]);let u=0;const d=n.length;let g,f,_,m,p,x,y,v,S,C,w,R,I=0,M=0,E=0,T=null,b=null;const F=this.coordinateCache_,k=this.viewRotation_,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,P={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},L=this.instructions!=n||this.overlaps?0:200;let O,G,W,B;for(;uL&&(this.fill_(t),M=0),E>L&&(t.stroke(),E=0),M||E||(t.beginPath(),m=NaN,p=NaN),++u;break;case Ss.CIRCLE:I=i[1];const n=h[I],l=h[I+1],c=h[I+2]-n,d=h[I+3]-l,z=Math.sqrt(c*c+d*d);t.moveTo(n+z,l),t.arc(n,l,z,0,2*Math.PI,!0),++u;break;case Ss.CLOSE_PATH:t.closePath(),++u;break;case Ss.CUSTOM:I=i[1],g=i[2];const N=i[3],Y=i[4],X=6==i.length?i[5]:void 0;P.geometry=N,P.feature=O,u in F||(F[u]=[]);const V=F[u];X?X(h,I,g,2,V):(V[0]=h[I],V[1]=h[I+1],V.length=2),Y(V,P),++u;break;case Ss.DRAW_IMAGE:I=i[1],g=i[2],v=i[3],f=i[4],_=i[5];let Z=i[6];const j=i[7],U=i[8],q=i[9],K=i[10];let H=i[11];const J=i[12];let Q=i[13];const $=i[14],tt=i[15];if(!v&&i.length>=20){S=i[19],C=i[20],w=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(S,C,w,R);v=t.label,i[3]=v;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];_=(t.anchorY-n)*this.pixelRatio,i[5]=_,Z=v.height,i[6]=Z,Q=v.width,i[13]=Q}let et,it,nt,st;i.length>25&&(et=i[25]),i.length>17?(it=i[16],nt=i[17],st=i[18]):(it=Mn,nt=!1,st=!1),K&&A?H+=k:K||A||(H-=k);let ot=0;for(;Ii)break;let a=n[r];a||(a=[],n[r]=a),a.push(4*((t+o)*e+(t+s))+3),o>0&&a.push(4*((t-o)*e+(t+s))+3),s>0&&(a.push(4*((t+o)*e+(t-s))+3),o>0&&a.push(4*((t-o)*e+(t-s))+3))}const s=[];for(let o=0,r=n.length;o0){if(!o||"Image"!==d&&"Text"!==d||o.includes(t)){const i=(u[a]-3)/4,o=n-i%r,h=n-(i/r|0),l=s(t,e,o*o+h*h);if(l)return l}l.clearRect(0,0,r,r);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let m,p,x,y,v;for(_.sort(X),m=_.length-1;m>=0;--m){const t=_[m].toString();for(x=this.executorsByZIndex_[t],p=Xs.length-1;p>=0;--p)if(d=Xs[p],y=x[d],void 0!==y&&(v=y.executeHitDetection(l,a,i,f,c),v))return v}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],s=e[2],o=e[3],r=[i,n,i,o,s,o,s,n];return ke(r,0,8,2,t,r),r}isEmpty(){return J(this.executorsByZIndex_)}execute(t,e,i,n,s,o,r){const a=Object.keys(this.executorsByZIndex_).map(Number);let h,l,c,u,d,g;for(a.sort(X),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||Xs,r&&a.reverse(),h=0,l=a.length;ht*this.pixelRatio_)),lineDashOffset:(s||0)*this.pixelRatio_,lineJoin:void 0!==o?o:Cn,lineWidth:(void 0!==r?r:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:fn(t||wn)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),s=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:fn(t||yn)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),o=i.getLineJoin(),r=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:vn,lineDash:n||Sn,lineDashOffset:s||0,lineJoin:void 0!==o?o:Cn,lineWidth:void 0!==r?r:1,miterLimit:void 0!==a?a:10,strokeStyle:fn(t||wn)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),o=t.getOffsetY(),r=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==n?n:xn,textAlign:void 0!==c?c:Rn,textBaseline:void 0!==u?u:In},this.text_=void 0!==l?Array.isArray(l)?l.reduce(((t,e,i)=>t+(i%2?" ":e)),""):l:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==o?this.pixelRatio_*o:0,this.textRotateWithView_=void 0!==r&&r,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}},Us=.5;const qs={Point:function(t,e,i,n,s){const o=i.getImage(),r=i.getText();let a;if(o){if(o.getImageState()!=ct)return;let h=t;if(s){const l=o.getDeclutterMode();if("none"!==l)if(h=s,"obstacle"===l){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,a),s.drawPoint(e,n)}else r&&r.getText()&&(a={})}const l=h.getBuilder(i.getZIndex(),"Image");l.setImageStyle(o,a),l.drawPoint(e,n)}if(r&&r.getText()){let o=t;s&&(o=s);const h=o.getBuilder(i.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(e,n)}},LineString:function(t,e,i,n,s){const o=i.getStroke();if(o){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,o),s.drawLineString(e,n)}const r=i.getText();if(r&&r.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(r),o.drawText(e,n)}},Polygon:function(t,e,i,n,s){const o=i.getFill(),r=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(o,r),s.drawPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(a),o.drawText(e,n)}},MultiPoint:function(t,e,i,n,s){const o=i.getImage(),r=i.getText();let a;if(o){if(o.getImageState()!=ct)return;let h=t;if(s){const l=o.getDeclutterMode();if("none"!==l)if(h=s,"obstacle"===l){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(o,a),s.drawMultiPoint(e,n)}else r&&r.getText()&&(a={})}const l=h.getBuilder(i.getZIndex(),"Image");l.setImageStyle(o,a),l.drawMultiPoint(e,n)}if(r&&r.getText()){let o=t;s&&(o=s);const h=o.getBuilder(i.getZIndex(),"Text");h.setTextStyle(r,a),h.drawText(e,n)}},MultiLineString:function(t,e,i,n,s){const o=i.getStroke();if(o){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,o),s.drawMultiLineString(e,n)}const r=i.getText();if(r&&r.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(r),o.drawText(e,n)}},MultiPolygon:function(t,e,i,n,s){const o=i.getFill(),r=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(o,r),s.drawMultiPolygon(e,n)}const a=i.getText();if(a&&a.getText()){const o=(s||t).getBuilder(i.getZIndex(),"Text");o.setTextStyle(a),o.drawText(e,n)}},GeometryCollection:function(t,e,i,n,s){const o=e.getGeometriesArray();let r,a;for(r=0,a=o.length;r{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];Te(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,s=this.renderedProjection_,o=this.wrappedRenderedExtent_,r=this.getLayer(),a=[],h=t[0]*Us,l=t[1]*Us;a.push(this.getRenderTransform(e,i,n,Us,h,l,0).slice());const c=r.getSource(),u=s.getExtent();if(c.getWrapX()&&s.canWrapX()&&!m(u,o)){let t=o[0];const s=L(u);let r,c=0;for(;tu[2];)++c,r=s*c,a.push(this.getRenderTransform(e,i,n,Us,h,l,r).slice()),t-=s}this.hitDetectionImageData_=function(t,e,i,n,s,o,r){const a=at(t[0]*Us,t[1]*Us);a.imageSmoothingEnabled=!1;const h=a.canvas,l=new js(a,Us,s,null,r),c=i.length,u=Math.floor(16777215/c),d={};for(let f=1;f<=c;++f){const t=i[f-1],e=t.getStyleFunction()||n;if(!e)continue;let r=e(t,o);if(!r)continue;Array.isArray(r)||(r=[r]);const a=(f*u).toString(16).padStart(7,"#00000");for(let i=0,n=r.length;ic=n.forEachFeatureAtCoordinate(t,o,r,i,l,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[pi],s=t.viewHints[xi],o=e.getUpdateWhileAnimating(),r=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!r&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let _=e.getRenderOrder();void 0===_&&(_=Ks);const p=h.center.slice(),x=g(a,f*c),y=x.slice(),v=[x.slice()],S=l.getExtent();if(i.getWrapX()&&l.canWrapX()&&!m(S,t.extent)){const t=L(S),e=Math.max(L(x)/2,t);x[0]=S[0]-e,x[2]=S[2]+e,Xt(p,l);const i=G(v[0],l);i[0]S[0]&&i[2]>S[2]&&v.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&m(this.wrappedRenderedExtent_,x))return U(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const C=new ks(Hs(c,u),x,c,u);let w;this.getLayer().getDeclutter()&&(w=new ks(Hs(c,u),x,c,u));for(let g=0,m=v.length;g{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,c)),i){const e=this.renderFeature(t,R,i,C,undefined,w);I=I&&!e}},E=ae(x),T=i.getFeaturesInExtent(E);_&&T.sort(_);for(let g=0,m=T.length;g0}}else if(t.type==so){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==no&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}},lo=q,co=function(t){const e=t.originalEvent;return o(void 0!==e,56),e.isPrimary&&0===e.button},uo=[0,0,0,0],go=[],fo="modifystart",_o="modifyend";class mo extends Y{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}function po(t,e){return t.index-e.index}function xo(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let i=n;if(1===e.index){const e=Nt(i.getCenter(),re(t)),n=Math.sqrt(e)-i.getRadius();return n*n}}const s=re(t);return go[0]=re(e.segment[0]),go[1]=re(e.segment[1]),function(t,e){return Nt(t,Bt(t,e))}(s,go)}function yo(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){return oe(n.getClosestPoint(re(t)))}const s=re(t);return go[0]=re(e.segment[0]),go[1]=re(e.segment[1]),oe(Bt(s,go))}function vo(){const t=function(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new Qn({fill:new Yn({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new Qn({stroke:new Jn({color:e,width:5})}),new Qn({stroke:new Jn({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new Qn({image:new zn({radius:6,fill:new Yn({color:i}),stroke:new Jn({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}();return function(e,i){return t.Point}}const So=class extends ho{constructor(t){let e;if(super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:co,this.defaultDeleteCondition_=function(t){return function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&function(t){return t.type==eo}(t)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:lo,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new Ze,this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new to({source:new ii({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:vo(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null,t.features?e=t.features:t.source&&(this.source_=t.source,e=new Ve(this.source_.getFeatures()),this.source_.addEventListener(je,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Ke,this.handleSourceRemove_.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=e,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(ze,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(Ne,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=void 0===t.snapToPointer?!this.hitDetection_:t.snapToPointer}addFeature_(t){const e=t.getGeometry();if(e){const i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),t.addEventListener(W,this.boundHandleFeatureChange_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Ve;const i=this.featuresBeingModified_.getArray();for(let t=0,n=e.length;t=0;--n){const t=i[n];for(let e=this.dragSegments_.length-1;e>=0;--e)this.dragSegments_[e][0]===t&&this.dragSegments_.splice(e,1);e.remove(t)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n=0;--t)this.insertVertex_(n[t],s)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const t=this.dragSegments_[e][0],i=t.geometry;if("Circle"===i.getType()){const e=i.getCenter(),n=t.featureSegments[0],s=t.featureSegments[1];n.segment[0]=e,n.segment[1]=e,s.segment[0]=e,s.segment[1]=e,this.rBush_.update(C(e),n);let o=i;this.rBush_.update(o.getExtent(),s)}else this.rBush_.update(d(t.segment),t)}return this.featuresBeingModified_&&(this.dispatchEvent(new mo(_o,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t);e.getView().getProjection();const s=function(t,e){return xo(n,t)-xo(n,e)};let o,r;if(this.hitDetection_){const i="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{i&&(i=new Be(oe(i.getCoordinates())));const n=i||t.getGeometry();if("Point"===n.getType()&&t instanceof Ee&&this.features_.getArray().includes(t)){r=n;const e=t.getGeometry().getFlatCoordinates().slice(0,2);o=[{feature:t,geometry:r,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!o){const t=ae(g(he(C(n,uo)),e.getView().getResolution()*this.pixelTolerance_,uo));o=this.rBush_.getInExtent(t)}if(o&&o.length>0){const i=o.sort(s)[0],a=i.segment;let h=yo(n,i);const l=e.getPixelFromCoordinate(h);let c=Yt(t,l);if(r||c<=this.pixelTolerance_){const t={};if(t[et(a)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-n[0],this.delta_[1]=h[1]-n[1]),"Circle"===i.geometry.getType()&&1===i.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);else{const n=e.getPixelFromCoordinate(a[0]),s=e.getPixelFromCoordinate(a[1]),r=Nt(l,n),u=Nt(l,s);c=Math.sqrt(Math.min(r,u)),this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(h=r>u?a[1]:a[0]),this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);const d={};d[et(i.geometry)]=!0;for(let e=1,i=o.length;e=0;--r)s=t[r],u=s[0],g=et(u.feature),u.depth&&(g+="-"+u.depth.join("-")),g in e||(e[g]={}),0===s[1]?(e[g].right=u,e[g].index=u.index):1==s[1]&&(e[g].left=u,e[g].index=u.index+1);for(g in e){switch(c=e[g].right,h=e[g].left,a=e[g].index,l=a-1,u=void 0!==h?h:c,l<0&&(l=0),o=u.geometry,n=o.getCoordinates(),i=n,f=!1,o.getType()){case"MultiLineString":n[u.depth[0]].length>2&&(n[u.depth[0]].splice(a,1),f=!0);break;case"LineString":n.length>2&&(n.splice(a,1),f=!0);break;case"MultiPolygon":i=i[u.depth[1]];case"Polygon":i=i[u.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),f=!0,0===a&&(i.pop(),i.push(i[0]),l=i.length-1))}if(f){this.setGeometryCoordinates_(o,n);const e=[];if(void 0!==h&&(this.rBush_.remove(h),e.push(h.segment[0])),void 0!==c&&(this.rBush_.remove(c),e.push(c.segment[1])),void 0!==h&&void 0!==c){const t={depth:u.depth,feature:u.feature,geometry:u.geometry,index:l,segment:e};this.rBush_.insert(d(t.segment),t)}this.updateSegmentIndices_(o,a,u.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return f}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(s){s.geometry===t&&(void 0===i||void 0===s.depth||U(s.depth,i))&&s.index>e&&(s.index+=n)}))}};export{zn as C,Yn as F,hs as L,So as M,Be as P,Wn as R,is as S,ss as T,ii as V,hn as _,un as a,cn as b,Jn as c,to as d,Ut as e,Kt as f,ln as g};