@vcmap/ui 5.0.0-rc.14 → 5.0.0-rc.16
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/README.md +33 -31
- package/build/build.js +9 -0
- package/build/buildHelpers.js +12 -10
- package/build/commonViteConfig.js +3 -10
- package/config/base.config.json +30 -24
- package/config/dev.config.json +13 -1
- package/config/www.config.json +104 -17
- package/dist/assets/cesium.430460.js +137226 -0
- package/dist/assets/cesium.js +1 -1
- package/dist/assets/core.5089ba.js +16024 -0
- package/dist/assets/core.js +1 -1
- package/dist/assets/index.854f8e2b.js +1 -0
- package/dist/assets/ol.9be53a.js +44279 -0
- package/dist/assets/ol.js +1 -1
- package/dist/assets/{ui.15ef6a.css → ui.49010a.css} +1 -1
- package/dist/assets/ui.49010a.js +16776 -0
- package/dist/assets/ui.js +1 -1
- package/dist/assets/vue.247c1c.js +4675 -0
- package/dist/assets/vue.js +5 -2
- package/dist/assets/{vuetify.202322.css → vuetify.735e58.css} +1 -1
- package/dist/assets/vuetify.735e58.js +21019 -0
- package/dist/assets/vuetify.js +5 -2
- package/dist/index.html +1 -1
- package/index.html +77 -0
- package/index.js +8 -1
- package/package.json +12 -10
- package/plugins/@vcmap/create-link/fallbackCreateLink.vue +4 -1
- package/plugins/@vcmap/create-link/index.js +4 -1
- package/plugins/@vcmap/pluginExample/exampleActions.js +45 -0
- package/plugins/@vcmap/pluginExample/index.js +38 -1
- package/plugins/@vcmap/pluginExample/pluginExampleComponent.vue +152 -98
- package/plugins/@vcmap/project-selector/ContextsListComponent.vue +8 -1
- package/plugins/@vcmap/project-selector/ProjectSelectorComponent.vue +27 -1
- package/plugins/@vcmap/search-nominatim/LICENSE.md +14 -0
- package/plugins/@vcmap/search-nominatim/README.md +2 -0
- package/plugins/@vcmap/search-nominatim/config.json +4 -0
- package/plugins/@vcmap/search-nominatim/index.js +26 -0
- package/plugins/@vcmap/search-nominatim/nominatim.js +170 -0
- package/plugins/@vcmap/search-nominatim/package.json +43 -0
- package/plugins/@vcmap/theme-changer/ThemeChangerComponent.vue +26 -0
- package/plugins/buttonExamples/ButtonExamples.vue +28 -1
- package/plugins/categoryTest/Categories.vue +16 -0
- package/plugins/categoryTest/Category.vue +30 -4
- package/plugins/example/mySuperComponent.vue +12 -1
- package/plugins/notifier/index.js +31 -0
- package/plugins/notifier/notifierTester.vue +88 -0
- package/plugins/package.json +2 -1
- package/plugins/simple-graph/SimpleGraphComponent.vue +5 -11
- package/plugins/test/allIconsComponent.vue +16 -0
- package/plugins/test/editor.vue +3 -0
- package/plugins/test/emptyComponent.vue +3 -0
- package/plugins/test/index.js +22 -0
- package/plugins/test/myCustomHeader.vue +9 -1
- package/plugins/test/testList.vue +287 -0
- package/plugins/test/vcsContent.vue +3 -0
- package/plugins/test/windowManagerExample.vue +3 -0
- package/plugins/wizardExample/index.js +41 -0
- package/plugins/wizardExample/wizardExample.vue +77 -0
- package/src/actions/actionHelper.js +103 -2
- package/src/actions/styleSelector.vue +9 -0
- package/src/application/VcsApp.vue +95 -17
- package/src/application/VcsAttributions.vue +63 -0
- package/src/application/VcsAttributionsFooter.vue +87 -0
- package/src/application/{Navbar.vue → VcsNavbar.vue} +35 -2
- package/src/application/VcsSettings.vue +4 -0
- package/src/application/attributionsHelper.js +150 -0
- package/src/application/vcsAppWrapper.vue +5 -1
- package/src/components/buttons/VcsActionButtonList.vue +8 -1
- package/src/components/buttons/VcsButton.vue +7 -1
- package/src/components/form-inputs-controls/VcsCheckbox.vue +7 -2
- package/src/components/form-inputs-controls/VcsColorPicker.vue +4 -0
- package/src/components/form-inputs-controls/VcsFormSection.vue +55 -9
- package/src/components/form-inputs-controls/VcsRadio.vue +7 -1
- package/src/components/form-inputs-controls/VcsSelect.vue +38 -2
- package/src/components/form-inputs-controls/VcsTextArea.vue +2 -0
- package/src/components/form-inputs-controls/VcsTextField.vue +16 -4
- package/src/components/form-inputs-controls/VcsWizard.vue +133 -0
- package/src/components/imageElementInjector.vue +22 -0
- package/src/components/lists/VcsActionList.vue +12 -1
- package/src/components/lists/VcsList.vue +466 -0
- package/src/components/lists/VcsTreeview.vue +7 -3
- package/src/components/lists/VcsTreeviewLeaf.vue +23 -51
- package/src/components/lists/VcsTreeviewSearchbar.vue +6 -23
- package/src/components/notification/VcsTooltip.vue +14 -9
- package/src/components/tables/VcsTable.vue +129 -38
- package/src/contentTree/LayerTree.vue +1 -1
- package/src/contentTree/contentTreeItem.js +13 -13
- package/src/contentTree/subContentTreeItem.js +1 -1
- package/src/contentTree/vcsObjectContentTreeItem.js +1 -1
- package/src/featureInfo/AddressBalloonComponent.vue +17 -1
- package/src/featureInfo/BalloonComponent.vue +63 -27
- package/src/featureInfo/balloonFeatureInfoView.js +14 -14
- package/src/featureInfo/balloonHelper.js +4 -0
- package/src/featureInfo/featureInfo.js +23 -2
- package/src/featureInfo/featureInfoInteraction.js +1 -1
- package/src/i18n/de.js +22 -0
- package/src/i18n/en.js +22 -0
- package/src/icons/+all.js +4 -0
- package/src/icons/WandIcon.vue +63 -0
- package/src/legend/legendHelper.js +18 -12
- package/src/legend/styleLegendItem.vue +20 -1
- package/src/legend/vcsLegend.vue +29 -3
- package/src/manager/toolbox/GroupToolboxComponent.vue +13 -1
- package/src/manager/toolbox/SelectToolboxComponent.vue +13 -1
- package/src/manager/toolbox/ToolboxManager.vue +3 -0
- package/src/manager/window/WindowComponent.vue +15 -2
- package/src/manager/window/WindowComponentHeader.vue +38 -7
- package/src/manager/window/WindowManager.vue +1 -0
- package/src/manager/window/windowManager.js +11 -1
- package/src/navigation/mapNavigation.vue +15 -36
- package/src/navigation/orientationToolsButton.vue +6 -1
- package/src/navigation/overviewMap.js +19 -47
- package/src/navigation/tiltSlider.vue +3 -0
- package/src/navigation/vcsCompass.vue +2 -0
- package/src/notifier/notifier.js +121 -0
- package/src/notifier/notifierComponent.vue +84 -0
- package/src/search/resultItem.vue +89 -0
- package/src/search/resultsComponent.vue +98 -0
- package/src/search/search.js +326 -0
- package/src/search/searchComponent.vue +90 -0
- package/src/styles/_typography.scss +3 -0
- package/src/styles/utils/_cursor.scss +4 -0
- package/src/styles/variables.scss +23 -4
- package/src/vcsUiApp.js +35 -1
- package/src/vuePlugins/vuetify.js +2 -0
- package/dist/assets/cesium.9489f8.js +0 -8699
- package/dist/assets/core.aa346a.js +0 -4
- package/dist/assets/index.3cd4fffa.js +0 -1
- package/dist/assets/ol.39651b.js +0 -439
- package/dist/assets/ui.15ef6a.js +0 -71
- package/dist/assets/vue.cbe9d8.js +0 -9
- package/dist/assets/vuetify.202322.js +0 -148
package/dist/assets/ol.39651b.js
DELETED
@@ -1,439 +0,0 @@
|
|
1
|
-
var hC=Object.defineProperty,fC=Object.defineProperties;var dC=Object.getOwnPropertyDescriptors;var Ac=Object.getOwnPropertySymbols;var Cy=Object.prototype.hasOwnProperty,Iy=Object.prototype.propertyIsEnumerable;var Ry=(n,e,t)=>e in n?hC(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Pr=(n,e)=>{for(var t in e||(e={}))Cy.call(e,t)&&Ry(n,t,e[t]);if(Ac)for(var t of Ac(e))Iy.call(e,t)&&Ry(n,t,e[t]);return n},Tl=(n,e)=>fC(n,dC(e));var Sl=(n,e)=>{var t={};for(var i in n)Cy.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&Ac)for(var i of Ac(n))e.indexOf(i)<0&&Iy.call(n,i)&&(t[i]=n[i]);return t};const gC={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"};class pC extends Error{constructor(e){const t=gC[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}var Lc=pC;class mC{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}function Ay(n){n.stopPropagation()}function _C(n){n.preventDefault()}var Ct=mC,Mr={PROPERTYCHANGE:"propertychange"};class yC{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var ks=yC;function Ly(n,e,t){let i,r;t=t||ir;let s=0,o=n.length,a=!1;for(;s<o;)i=s+(o-s>>1),r=+t(n[i],e),r<0?s=i+1:(o=i,a=!r);return a?s:~s}function ir(n,e){return n>e?1:n<e?-1:0}function bl(n,e,t){const i=n.length;if(n[0]<=e)return 0;if(e<=n[i-1])return i-1;{let r;if(t>0){for(r=1;r<i;++r)if(n[r]<e)return r-1}else if(t<0){for(r=1;r<i;++r)if(n[r]<=e)return r}else for(r=1;r<i;++r){if(n[r]==e)return r;if(n[r]<e)return typeof t=="function"?t(e,n[r-1],n[r])>0?r-1:r:n[r-1]-e<e-n[r]?r-1:r}return i-1}}function Py(n,e,t){for(;e<t;){const i=n[e];n[e]=n[t],n[t]=i,++e,--t}}function Oe(n,e){const t=Array.isArray(e)?e:[e],i=t.length;for(let r=0;r<i;r++)n[n.length]=t[r]}function vC(n,e){const t=n.indexOf(e),i=t>-1;return i&&n.splice(t,1),i}function Ai(n,e){const t=n.length;if(t!==e.length)return!1;for(let i=0;i<t;i++)if(n[i]!==e[i])return!1;return!0}function xC(n,e){const t=n.length,i=Array(n.length);let r;for(r=0;r<t;r++)i[r]={index:r,value:n[r]};for(i.sort(function(s,o){return e(s.value,o.value)||s.index-o.index}),r=0;r<n.length;r++)n[r]=i[r].value}function My(n,e,t){const i=e||ir;return n.every(function(r,s){if(s===0)return!0;const o=i(n[s-1],r);return!(o>0||t&&o===0)})}function kn(){return!0}function Fr(){return!1}function Or(){}function Fy(n){let e=!1,t,i,r;return function(){const s=Array.prototype.slice.call(arguments);return(!e||this!==r||!Ai(s,i))&&(e=!0,r=this,i=s,t=n.apply(this,arguments)),t}}function Oy(n){function e(){let t;try{t=n()}catch(i){return Promise.reject(i)}return t instanceof Promise?t:Promise.resolve(t)}return e()}function $r(n){for(const e in n)delete n[e]}function oi(n){let e;for(e in n)return!1;return!e}class EC extends ks{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const i=this.listeners_||(this.listeners_={}),r=i[e]||(i[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t=typeof e=="string",i=t?e:e.type,r=this.listeners_&&this.listeners_[i];if(!r)return;const s=t?new Ct(e):e;s.target||(s.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let u=0,c=r.length;u<c;++u)if("handleEvent"in r[u]?l=r[u].handleEvent(s):l=r[u].call(this,s),l===!1||s.propagationStopped){l=!1;break}if(--o[i]===0){let u=a[i];for(delete a[i];u--;)this.removeEventListener(i,Or);delete o[i]}return l}disposeInternal(){this.listeners_&&$r(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){const i=this.listeners_&&this.listeners_[e];if(i){const r=i.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(i[r]=Or,++this.pendingRemovals_[e]):(i.splice(r,1),i.length===0&&delete this.listeners_[e]))}}}var Gs=EC,K={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function re(n,e,t,i,r){if(i&&i!==n&&(t=t.bind(i)),r){const o=t;t=function(){n.removeEventListener(e,t),o.apply(this,arguments)}}const s={target:n,type:e,listener:t};return n.addEventListener(e,t),s}function Us(n,e,t,i){return re(n,e,t,i,!0)}function Pe(n){n&&n.target&&(n.target.removeEventListener(n.type,n.listener),$r(n))}class Pc extends Gs{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(K.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const i=e.length,r=new Array(i);for(let s=0;s<i;++s)r[s]=re(this,e[s],t);return r}else return re(this,e,t)}onceInternal(e,t){let i;if(Array.isArray(e)){const r=e.length;i=new Array(r);for(let s=0;s<r;++s)i[s]=Us(this,e[s],t)}else i=Us(this,e,t);return t.ol_key=i,i}unInternal(e,t){const i=t.ol_key;if(i)$y(i);else if(Array.isArray(e))for(let r=0,s=e.length;r<s;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}}Pc.prototype.on,Pc.prototype.once,Pc.prototype.un;function $y(n){if(Array.isArray(n))for(let e=0,t=n.length;e<t;++e)Pe(n[e]);else Pe(n)}var Mc=Pc;function ae(){throw new Error("Unimplemented abstract method.")}let wC=0;function H(n){return n.ol_uid||(n.ol_uid=String(++wC))}const Yd="7.1.0";class Zd extends Ct{constructor(e,t,i){super(e),this.key=t,this.oldValue=i}}class TC extends Mc{constructor(e){super(),this.on,this.once,this.un,H(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let i;i=`change:${e}`,this.hasListener(i)&&this.dispatchEvent(new Zd(i,e,t)),i=Mr.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Zd(i,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,i){const r=this.values_||(this.values_={});if(i)r[e]=t;else{const s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(const i in e)this.set(i,e[i],t)}applyProperties(e){!e.values_||Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const i=this.values_[e];delete this.values_[e],oi(this.values_)&&(this.values_=null),t||this.notify(e,i)}}}var Rn=TC,gt={ADD:"add",REMOVE:"remove"};const Dy={LENGTH:"length"};class Rl extends Ct{constructor(e,t,i){super(e),this.element=t,this.index=i}}class SC extends Rn{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let i=0,r=this.array_.length;i<r;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,i=e.length;t<i;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let i=0,r=t.length;i<r;++i)e(t[i],i,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Dy.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Rl(gt.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let i=0,r=t.length;i<r;++i)if(t[i]===e)return this.removeAt(i)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Rl(gt.REMOVE,t,e)),t}setAt(e,t){const i=this.getLength();if(e>=i){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Rl(gt.REMOVE,r,e)),this.dispatchEvent(new Rl(gt.ADD,t,e))}updateLength_(){this.set(Dy.LENGTH,this.array_.length)}assertUnique_(e,t){for(let i=0,r=this.array_.length;i<r;++i)if(this.array_[i]===e&&i!==t)throw new Lc(58)}}var St=SC,V={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Wd(n){return Math.pow(n,3)}function Dr(n){return 1-Wd(1-n)}function Fc(n){return 3*n*n-2*n*n*n}function Ny(n){return n}function bC(n){return n<.5?Fc(2*n):1-Fc(2*(n-.5))}class RC extends Gs{constructor(e,t,i){super(),i=i||{},this.tileCoord=e,this.state=t,this.interimTile=null,this.key="",this.transition_=i.transition===void 0?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(K.CHANGE)}release(){this.state===V.ERROR&&this.setState(V.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let e=this.interimTile;do{if(e.getState()==V.LOADED)return this.transition_=0,e;e=e.interimTile}while(e);return this}refreshInterimChain(){if(!this.interimTile)return;let e=this.interimTile,t=this;do{if(e.getState()==V.LOADED){e.interimTile=null;break}else e.getState()==V.LOADING?t=e:e.getState()==V.IDLE?t.interimTile=e.interimTile:t=e;e=t.interimTile}while(e)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==V.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}load(){ae()}getAlpha(e,t){if(!this.transition_)return 1;let i=this.transitionStarts_[e];if(!i)i=t,this.transitionStarts_[e]=i;else if(i===-1)return 1;const r=t-i+1e3/60;return r>=this.transition_?1:Wd(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}}var Nr=RC;class CC extends Nr{constructor(e){const t=V.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||[256,256]}getSize(){return this.size_}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==V.IDLE&&this.state!==V.ERROR)return;this.state=V.LOADING,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=V.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=V.ERROR,e.changed()})}}var Hd=CC;function ne(n,e){if(!n)throw new Lc(e)}class ny extends Rn{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new ny(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const i=this.getStyle();return i&&e.setStyle(i),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(Pe(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=re(e,K.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?ky(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function ky(n){if(typeof n=="function")return n;{let e;return Array.isArray(n)?e=n:(ne(typeof n.getZIndex=="function",41),e=[n]),function(){return e}}}var Ne=ny;const kr=typeof navigator!="undefined"&&typeof navigator.userAgent!="undefined"?navigator.userAgent.toLowerCase():"",Gy=kr.includes("firefox"),Uy=kr.includes("safari")&&!kr.includes("chrom"),By=Uy&&(kr.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(kr)),zy=kr.includes("webkit")&&!kr.includes("edge"),Kd=kr.includes("macintosh"),Oc=typeof devicePixelRatio!="undefined"?devicePixelRatio:1,$c=typeof WorkerGlobalScope!="undefined"&&typeof OffscreenCanvas!="undefined"&&self instanceof WorkerGlobalScope,Vy=typeof Image!="undefined"&&Image.prototype.decode,qd=function(){let n=!1;try{const e=Object.defineProperty({},"passive",{get:function(){n=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return n}(),Jd=new Array(6);function Le(){return[1,0,0,1,0,0]}function Bs(n){return Ko(n,1,0,0,1,0,0)}function rr(n,e){const t=n[0],i=n[1],r=n[2],s=n[3],o=n[4],a=n[5],l=e[0],u=e[1],c=e[2],h=e[3],f=e[4],d=e[5];return n[0]=t*l+r*u,n[1]=i*l+s*u,n[2]=t*c+r*h,n[3]=i*c+s*h,n[4]=t*f+r*d+o,n[5]=i*f+s*d+a,n}function Ko(n,e,t,i,r,s,o){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n[4]=s,n[5]=o,n}function jy(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n}function ke(n,e){const t=e[0],i=e[1];return e[0]=n[0]*t+n[2]*i+n[4],e[1]=n[1]*t+n[3]*i+n[5],e}function Qd(n,e){const t=Math.cos(e),i=Math.sin(e);return rr(n,Ko(Jd,t,i,-i,t,0,0))}function Gr(n,e,t){return rr(n,Ko(Jd,e,0,0,t,0,0))}function Xy(n,e,t){return Ko(n,e,0,0,t,0,0)}function qo(n,e,t){return rr(n,Ko(Jd,1,0,0,1,e,t))}function tn(n,e,t,i,r,s,o,a){const l=Math.sin(s),u=Math.cos(s);return n[0]=i*u,n[1]=r*l,n[2]=-i*l,n[3]=r*u,n[4]=o*i*u-a*i*l+e,n[5]=o*r*l+a*r*u+t,n}function IC(n,e,t,i,r,s,o){return Cl(tn(Le(),n,e,t,i,r,s,o))}function AC(n){return Ur(n,n)}function Ur(n,e){const t=Yy(e);ne(t!==0,32);const i=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return n[0]=o/t,n[1]=-r/t,n[2]=-s/t,n[3]=i/t,n[4]=(s*l-o*a)/t,n[5]=-(i*l-r*a)/t,n}function Yy(n){return n[0]*n[3]-n[1]*n[2]}let Zy;function Cl(n){const e="matrix("+n.join(", ")+")";if($c)return e;const t=Zy||(Zy=document.createElement("div"));return t.style.transform=e,t.style.transform}var Pt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function pt(n){const e=Ft();for(let t=0,i=n.length;t<i;++t)Vs(e,n[t]);return e}function LC(n,e,t){const i=Math.min.apply(null,n),r=Math.min.apply(null,e),s=Math.max.apply(null,n),o=Math.max.apply(null,e);return Cn(i,r,s,o,t)}function hn(n,e,t){return t?(t[0]=n[0]-e,t[1]=n[1]-e,t[2]=n[2]+e,t[3]=n[3]+e,t):[n[0]-e,n[1]-e,n[2]+e,n[3]+e]}function eg(n,e){return e?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e):n.slice()}function Br(n,e,t){let i,r;return e<n[0]?i=n[0]-e:n[2]<e?i=e-n[2]:i=0,t<n[1]?r=n[1]-t:n[3]<t?r=t-n[3]:r=0,i*i+r*r}function jn(n,e){return Dc(n,e[0],e[1])}function Mt(n,e){return n[0]<=e[0]&&e[2]<=n[2]&&n[1]<=e[1]&&e[3]<=n[3]}function Dc(n,e,t){return n[0]<=e&&e<=n[2]&&n[1]<=t&&t<=n[3]}function Nc(n,e){const t=n[0],i=n[1],r=n[2],s=n[3],o=e[0],a=e[1];let l=Pt.UNKNOWN;return o<t?l=l|Pt.LEFT:o>r&&(l=l|Pt.RIGHT),a<i?l=l|Pt.BELOW:a>s&&(l=l|Pt.ABOVE),l===Pt.UNKNOWN&&(l=Pt.INTERSECTING),l}function Ft(){return[1/0,1/0,-1/0,-1/0]}function Cn(n,e,t,i,r){return r?(r[0]=n,r[1]=e,r[2]=t,r[3]=i,r):[n,e,t,i]}function zr(n){return Cn(1/0,1/0,-1/0,-1/0,n)}function zs(n,e){const t=n[0],i=n[1];return Cn(t,i,t,i,e)}function PC(n,e){const t=zr(e);return ng(t,n)}function kc(n,e,t,i,r){const s=zr(r);return ig(s,n,e,t,i)}function MC(n,e){const t=zr(e);return Hy(t,n)}function In(n,e){return n[0]==e[0]&&n[2]==e[2]&&n[1]==e[1]&&n[3]==e[3]}function Wy(n,e,t){return Math.abs(n[0]-e[0])<t&&Math.abs(n[2]-e[2])<t&&Math.abs(n[1]-e[1])<t&&Math.abs(n[3]-e[3])<t}function tg(n,e){return e[0]<n[0]&&(n[0]=e[0]),e[2]>n[2]&&(n[2]=e[2]),e[1]<n[1]&&(n[1]=e[1]),e[3]>n[3]&&(n[3]=e[3]),n}function Vs(n,e){e[0]<n[0]&&(n[0]=e[0]),e[0]>n[2]&&(n[2]=e[0]),e[1]<n[1]&&(n[1]=e[1]),e[1]>n[3]&&(n[3]=e[1])}function ng(n,e){for(let t=0,i=e.length;t<i;++t)Vs(n,e[t]);return n}function ig(n,e,t,i,r){for(;t<i;t+=r)Ky(n,e[t],e[t+1]);return n}function Hy(n,e){for(let t=0,i=e.length;t<i;++t)ng(n,e[t]);return n}function Ky(n,e,t){n[0]=Math.min(n[0],e),n[1]=Math.min(n[1],t),n[2]=Math.max(n[2],e),n[3]=Math.max(n[3],t)}function Gc(n,e){let t;return t=e(js(n)),t||(t=e(Xs(n)),t)||(t=e(Qo(n)),t)||(t=e(Xn(n)),t)?t:!1}function Jo(n){let e=0;return Vr(n)||(e=_e(n)*Xe(n)),e}function js(n){return[n[0],n[1]]}function Xs(n){return[n[2],n[1]]}function Ot(n){return[(n[0]+n[2])/2,(n[1]+n[3])/2]}function qy(n,e){let t;return e==="bottom-left"?t=js(n):e==="bottom-right"?t=Xs(n):e==="top-left"?t=Xn(n):e==="top-right"?t=Qo(n):ne(!1,13),t}function FC(n,e){const t=Math.min(n[0],e[0]),i=Math.min(n[1],e[1]),r=Math.max(n[2],e[2]),s=Math.max(n[3],e[3]);return(r-t)*(s-i)}function Ys(n,e,t,i,r){const[s,o,a,l,u,c,h,f]=Uc(n,e,t,i);return Cn(Math.min(s,a,u,h),Math.min(o,l,c,f),Math.max(s,a,u,h),Math.max(o,l,c,f),r)}function Uc(n,e,t,i){const r=e*i[0]/2,s=e*i[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,u=r*a,c=s*o,h=s*a,f=n[0],d=n[1];return[f-l+h,d-u-c,f-l-h,d-u+c,f+l-h,d+u+c,f+l+h,d+u-c,f-l+h,d-u-c]}function Xe(n){return n[3]-n[1]}function OC(n,e){const t=zt(n,e);return Jo(t)}function zt(n,e,t){const i=t||Ft();return Je(n,e)?(n[0]>e[0]?i[0]=n[0]:i[0]=e[0],n[1]>e[1]?i[1]=n[1]:i[1]=e[1],n[2]<e[2]?i[2]=n[2]:i[2]=e[2],n[3]<e[3]?i[3]=n[3]:i[3]=e[3]):zr(i),i}function $C(n){return _e(n)+Xe(n)}function DC(n){return[n[2]-n[0],n[3]-n[1]]}function Xn(n){return[n[0],n[3]]}function Qo(n){return[n[2],n[3]]}function _e(n){return n[2]-n[0]}function Je(n,e){return n[0]<=e[2]&&n[2]>=e[0]&&n[1]<=e[3]&&n[3]>=e[1]}function Vr(n){return n[2]<n[0]||n[3]<n[1]}function Jy(n,e){return e?(e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e):n}function Il(n,e){const t=(n[2]-n[0])/2*(e-1),i=(n[3]-n[1])/2*(e-1);n[0]-=t,n[2]+=t,n[1]-=i,n[3]+=i}function Qy(n,e,t){let i=!1;const r=Nc(n,e),s=Nc(n,t);if(r===Pt.INTERSECTING||s===Pt.INTERSECTING)i=!0;else{const o=n[0],a=n[1],l=n[2],u=n[3],c=e[0],h=e[1],f=t[0],d=t[1],g=(d-h)/(f-c);let m,p;!!(s&Pt.ABOVE)&&!(r&Pt.ABOVE)&&(m=f-(d-u)/g,i=m>=o&&m<=l),!i&&!!(s&Pt.RIGHT)&&!(r&Pt.RIGHT)&&(p=d-(f-l)*g,i=p>=a&&p<=u),!i&&!!(s&Pt.BELOW)&&!(r&Pt.BELOW)&&(m=f-(d-a)/g,i=m>=o&&m<=l),!i&&!!(s&Pt.LEFT)&&!(r&Pt.LEFT)&&(p=d-(f-o)*g,i=p>=a&&p<=u)}return i}function Zs(n,e,t,i){let r=[];if(i>1){const a=n[2]-n[0],l=n[3]-n[1];for(let u=0;u<i;++u)r.push(n[0]+a*u/i,n[1],n[2],n[1]+l*u/i,n[2]-a*u/i,n[3],n[0],n[3]-l*u/i)}else r=[n[0],n[1],n[2],n[1],n[2],n[3],n[0],n[3]];e(r,r,2);const s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return LC(s,o,t)}function Bc(n,e){const t=e.getExtent(),i=Ot(n);if(e.canWrapX()&&(i[0]<t[0]||i[0]>=t[2])){const r=_e(t),o=Math.floor((i[0]-t[0])/r)*r;n[0]-=o,n[2]-=o}return n}function ev(n,e){if(e.canWrapX()){const t=e.getExtent();if(!isFinite(n[0])||!isFinite(n[2]))return[[t[0],n[1],t[2],n[3]]];Bc(n,e);const i=_e(t);if(_e(n)>i)return[[t[0],n[1],t[2],n[3]]];if(n[0]<t[0])return[[n[0]+i,n[1],t[2],n[3]],[t[0],n[1],n[2],n[3]]];if(n[2]>t[2])return[[n[0],n[1],t[2],n[3]],[t[0],n[1],n[2]-i,n[3]]]}return[n]}const NC={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function rg(n){return NC[n]}const Yn={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class kC{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent!==void 0?e.extent:null,this.worldExtent_=e.worldExtent!==void 0?e.worldExtent:null,this.axisOrientation_=e.axisOrientation!==void 0?e.axisOrientation:"enu",this.global_=e.global!==void 0?e.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Yn[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}var Ws=kC;const ea=6378137,Hs=Math.PI*ea,tv=[-Hs,-Hs,Hs,Hs],nv=[-180,-85,180,85],Al=ea*Math.log(Math.tan(Math.PI/2));class ta extends Ws{constructor(e){super({code:e,units:"m",extent:tv,global:!0,worldExtent:nv,getPointResolution:function(t,i){return t/Math.cosh(i[1]/ea)}})}}const sg=[new ta("EPSG:3857"),new ta("EPSG:102100"),new ta("EPSG:102113"),new ta("EPSG:900913"),new ta("http://www.opengis.net/def/crs/EPSG/0/3857"),new ta("http://www.opengis.net/gml/srs/epsg.xml#3857")];function iv(n,e,t){const i=n.length;t=t>1?t:2,e===void 0&&(t>2?e=n.slice():e=new Array(i));for(let r=0;r<i;r+=t){e[r]=Hs*n[r]/180;let s=ea*Math.log(Math.tan(Math.PI*(+n[r+1]+90)/360));s>Al?s=Al:s<-Al&&(s=-Al),e[r+1]=s}return e}function rv(n,e,t){const i=n.length;t=t>1?t:2,e===void 0&&(t>2?e=n.slice():e=new Array(i));for(let r=0;r<i;r+=t)e[r]=180*n[r]/Hs,e[r+1]=360*Math.atan(Math.exp(n[r+1]/ea))/Math.PI-90;return e}const sv=6378137,og=[-180,-90,180,90],ov=Math.PI*sv/180;class Ks extends Ws{constructor(e,t){super({code:e,units:"degrees",extent:og,axisOrientation:t,global:!0,metersPerUnit:ov,worldExtent:og})}}const ag=[new Ks("CRS:84"),new Ks("EPSG:4326","neu"),new Ks("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ks("urn:ogc:def:crs:OGC:2:84"),new Ks("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ks("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ks("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let zc={};function av(){zc={}}function lv(n){return zc[n]||zc[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function uv(n,e){zc[n]=e}let ai={};function cv(){ai={}}function qs(n,e,t){const i=n.getCode(),r=e.getCode();i in ai||(ai[i]={}),ai[i][r]=t}function GC(n,e){const t=n.getCode(),i=e.getCode(),r=ai[t][i];return delete ai[t][i],oi(ai[t])&&delete ai[t],r}function lg(n,e){let t;return n in ai&&e in ai[n]&&(t=ai[n][e]),t}function ye(n,e,t){return Math.min(Math.max(n,e),t)}function ug(n,e,t,i,r,s){const o=r-t,a=s-i;if(o!==0||a!==0){const l=((n-t)*o+(e-i)*a)/(o*o+a*a);l>1?(t=r,i=s):l>0&&(t+=o*l,i+=a*l)}return li(n,e,t,i)}function li(n,e,t,i){const r=t-n,s=i-e;return r*r+s*s}function hv(n){const e=n.length;for(let i=0;i<e;i++){let r=i,s=Math.abs(n[i][i]);for(let a=i+1;a<e;a++){const l=Math.abs(n[a][i]);l>s&&(s=l,r=a)}if(s===0)return null;const o=n[r];n[r]=n[i],n[i]=o;for(let a=i+1;a<e;a++){const l=-n[a][i]/n[i][i];for(let u=i;u<e+1;u++)i==u?n[a][u]=0:n[a][u]+=l*n[i][u]}}const t=new Array(e);for(let i=e-1;i>=0;i--){t[i]=n[i][e]/n[i][i];for(let r=i-1;r>=0;r--)n[r][e]-=n[r][i]*t[i]}return t}function Ll(n){return n*180/Math.PI}function $t(n){return n*Math.PI/180}function Zn(n,e){const t=n%e;return t*e<0?t+e:t}function Li(n,e,t){return n+t*(e-n)}function Js(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}function cg(n,e){return Math.round(Js(n,e))}function Qs(n,e){return Math.floor(Js(n,e))}function sr(n,e){return Math.ceil(Js(n,e))}function jr(n,e,t){const i=t!==void 0?n.toFixed(t):""+n;let r=i.indexOf(".");return r=r===-1?i.length:r,r>e?i:new Array(1+e-r).join("0")+i}function hg(n,e){const t=(""+n).split("."),i=(""+e).split(".");for(let r=0;r<Math.max(t.length,i.length);r++){const s=parseInt(t[r]||"0",10),o=parseInt(i[r]||"0",10);if(s>o)return 1;if(o>s)return-1}return 0}function fg(n,e){return n[0]+=+e[0],n[1]+=+e[1],n}function fv(n,e){const t=e.getRadius(),i=e.getCenter(),r=i[0],s=i[1],o=n[0],a=n[1];let l=o-r;const u=a-s;l===0&&u===0&&(l=1);const c=Math.sqrt(l*l+u*u),h=r+t*l/c,f=s+t*u/c;return[h,f]}function Pl(n,e){const t=n[0],i=n[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],u=s[1],c=l-o,h=u-a,f=c===0&&h===0?0:(c*(t-o)+h*(i-a))/(c*c+h*h||0);let d,g;return f<=0?(d=o,g=a):f>=1?(d=l,g=u):(d=o+f*c,g=a+f*h),[d,g]}function UC(n){return function(e){return gv(e,n)}}function Ml(n,e,t){const i=Zn(e+180,360)-180,r=Math.abs(3600*i),s=t||0;let o=Math.floor(r/3600),a=Math.floor((r-o*3600)/60),l=Js(r-o*3600-a*60,s);l>=60&&(l=0,a+=1),a>=60&&(a=0,o+=1);let u=o+"\xB0";return(a!==0||l!==0)&&(u+=" "+jr(a,2)+"\u2032"),l!==0&&(u+=" "+jr(l,2,s)+"\u2033"),i!==0&&(u+=" "+n.charAt(i<0?1:0)),u}function dv(n,e,t){return n?e.replace("{x}",n[0].toFixed(t)).replace("{y}",n[1].toFixed(t)):""}function Wn(n,e){let t=!0;for(let i=n.length-1;i>=0;--i)if(n[i]!=e[i]){t=!1;break}return t}function Vc(n,e){const t=Math.cos(e),i=Math.sin(e),r=n[0]*t-n[1]*i,s=n[1]*t+n[0]*i;return n[0]=r,n[1]=s,n}function dg(n,e){return n[0]*=e,n[1]*=e,n}function Gn(n,e){const t=n[0]-e[0],i=n[1]-e[1];return t*t+i*i}function na(n,e){return Math.sqrt(Gn(n,e))}function jc(n,e){return Gn(n,Pl(n,e))}function BC(n,e){return n?Ml("NS",n[1],e)+" "+Ml("EW",n[0],e):""}function gv(n,e){return dv(n,"{x}, {y}",e)}function Xc(n,e){if(e.canWrapX()){const t=_e(e.getExtent()),i=gg(n,e,t);i&&(n[0]-=i*t)}return n}function gg(n,e,t){const i=e.getExtent();let r=0;return e.canWrapX()&&(n[0]<i[0]||n[0]>i[2])&&(t=t||_e(i),r=Math.floor((n[0]-i[0])/t)),r}const Fl=63710088e-1;function Yc(n,e,t){t=t||Fl;const i=$t(n[1]),r=$t(e[1]),s=(r-i)/2,o=$t(e[0]-n[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function pg(n,e){let t=0;for(let i=0,r=n.length;i<r-1;++i)t+=Yc(n[i],n[i+1],e);return t}function pv(n,e){e=e||{};const t=e.radius||Fl,i=e.projection||"EPSG:3857",r=n.getType();r!=="GeometryCollection"&&(n=n.clone().transform(i,"EPSG:4326"));let s=0,o,a,l,u,c,h;switch(r){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{o=n.getCoordinates(),s=pg(o,t);break}case"MultiLineString":case"Polygon":{for(o=n.getCoordinates(),l=0,u=o.length;l<u;++l)s+=pg(o[l],t);break}case"MultiPolygon":{for(o=n.getCoordinates(),l=0,u=o.length;l<u;++l)for(a=o[l],c=0,h=a.length;c<h;++c)s+=pg(a[c],t);break}case"GeometryCollection":{const f=n.getGeometries();for(l=0,u=f.length;l<u;++l)s+=pv(f[l],e);break}default:throw new Error("Unsupported geometry type: "+r)}return s}function Zc(n,e){let t=0;const i=n.length;let r=n[i-1][0],s=n[i-1][1];for(let o=0;o<i;o++){const a=n[o][0],l=n[o][1];t+=$t(a-r)*(2+Math.sin($t(s))+Math.sin($t(l))),r=a,s=l}return t*e*e/2}function mv(n,e){e=e||{};const t=e.radius||Fl,i=e.projection||"EPSG:3857",r=n.getType();r!=="GeometryCollection"&&(n=n.clone().transform(i,"EPSG:4326"));let s=0,o,a,l,u,c,h;switch(r){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":{for(o=n.getCoordinates(),s=Math.abs(Zc(o[0],t)),l=1,u=o.length;l<u;++l)s-=Math.abs(Zc(o[l],t));break}case"MultiPolygon":{for(o=n.getCoordinates(),l=0,u=o.length;l<u;++l)for(a=o[l],s+=Math.abs(Zc(a[0],t)),c=1,h=a.length;c<h;++c)s-=Math.abs(Zc(a[c],t));break}case"GeometryCollection":{const f=n.getGeometries();for(l=0,u=f.length;l<u;++l)s+=mv(f[l],e);break}default:throw new Error("Unsupported geometry type: "+r)}return s}function _v(n,e,t,i){i=i||Fl;const r=$t(n[1]),s=$t(n[0]),o=e/i,a=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(t)),l=s+Math.atan2(Math.sin(t)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(a));return[Ll(l),Ll(a)]}let mg=!0;function _g(n){mg=!(n===void 0?!0:n)}function Wc(n,e,t){if(e!==void 0){for(let i=0,r=n.length;i<r;++i)e[i]=n[i];e=e}else e=n.slice();return e}function Ol(n,e,t){if(e!==void 0&&n!==e){for(let i=0,r=n.length;i<r;++i)e[i]=n[i];n=e}return n}function yg(n){uv(n.getCode(),n),qs(n,n,Wc)}function yv(n){n.forEach(yg)}function J(n){return typeof n=="string"?lv(n):n||null}function $l(n,e,t,i){n=J(n);let r;const s=n.getPointResolutionFunc();if(s){if(r=s(e,t),i&&i!==n.getUnits()){const o=n.getMetersPerUnit();o&&(r=r*o/Yn[i])}}else{const o=n.getUnits();if(o=="degrees"&&!i||i=="degrees")r=e;else{const a=Un(n,J("EPSG:4326"));if(a===Ol&&o!=="degrees")r=e*n.getMetersPerUnit();else{let u=[t[0]-e/2,t[1],t[0]+e/2,t[1],t[0],t[1]-e/2,t[0],t[1]+e/2];u=a(u,u,2);const c=Yc(u.slice(0,2),u.slice(2,4)),h=Yc(u.slice(4,6),u.slice(6,8));r=(c+h)/2}const l=i?Yn[i]:n.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function Hc(n){yv(n),n.forEach(function(e){n.forEach(function(t){e!==t&&qs(e,t,Wc)})})}function vv(n,e,t,i){n.forEach(function(r){e.forEach(function(s){qs(r,s,t),qs(s,r,i)})})}function zC(){av(),cv()}function Kc(n,e){return n?typeof n=="string"?J(n):n:J(e)}function vg(n){return function(e,t,i){const r=e.length;i=i!==void 0?i:2,t=t!==void 0?t:new Array(r);for(let s=0;s<r;s+=i){const o=n(e.slice(s,s+i)),a=o.length;for(let l=0,u=i;l<u;++l)t[s+l]=l>=a?e[s+l]:o[l]}return t}}function xv(n,e,t,i){const r=J(n),s=J(e);qs(r,s,vg(t)),qs(s,r,vg(i))}function xg(n,e){return _g(),Xr(n,"EPSG:4326",e!==void 0?e:"EPSG:3857")}function VC(n,e){const t=Xr(n,e!==void 0?e:"EPSG:3857","EPSG:4326"),i=t[0];return(i<-180||i>180)&&(t[0]=Zn(i+180,360)-180),t}function fn(n,e){if(n===e)return!0;const t=n.getUnits()===e.getUnits();return(n.getCode()===e.getCode()||Un(n,e)===Wc)&&t}function Un(n,e){const t=n.getCode(),i=e.getCode();let r=lg(t,i);return r||(r=Ol),r}function ui(n,e){const t=J(n),i=J(e);return Un(t,i)}function Xr(n,e,t){return ui(e,t)(n,void 0,n.length)}function ia(n,e,t,i){const r=ui(e,t);return Zs(n,r,void 0,i)}function jC(n,e,t){return Un(e,t)(n)}let dn=null;function Ev(n){dn=J(n)}function XC(){dn=null}function Ht(){return dn}function YC(){Ev("EPSG:4326")}function Yr(n,e){return dn?Xr(n,e,dn):n}function Qe(n,e){return dn?Xr(n,dn,e):(mg&&!Wn(n,[0,0])&&n[0]>=-180&&n[0]<=180&&n[1]>=-90&&n[1]<=90&&(mg=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),n)}function Zr(n,e){return dn?ia(n,e,dn):n}function An(n,e){return dn?ia(n,dn,e):n}function wv(n,e){if(!dn)return n;const t=J(e).getUnits(),i=dn.getUnits();return t&&i?n*Yn[t]/Yn[i]:n}function Tv(n,e){if(!dn)return n;const t=J(e).getUnits(),i=dn.getUnits();return t&&i?n*Yn[i]/Yn[t]:n}function Eg(n,e,t){return function(i){let r,s;if(n.canWrapX()){const o=n.getExtent(),a=_e(o);i=i.slice(0),s=gg(i,n,a),s&&(i[0]=i[0]-s*a),i[0]=ye(i[0],o[0],o[2]),i[1]=ye(i[1],o[1],o[3]),r=t(i)}else r=t(i);return s&&e.canWrapX()&&(r[0]+=s*_e(e.getExtent())),r}}function Sv(){Hc(sg),Hc(ag),vv(ag,sg,iv,rv)}Sv();function ci(n,e,t,i,r,s){s=s||[];let o=0;for(let a=e;a<t;a+=i){const l=n[a],u=n[a+1];s[o++]=r[0]*l+r[2]*u+r[4],s[o++]=r[1]*l+r[3]*u+r[5]}return s&&s.length!=o&&(s.length=o),s}function qc(n,e,t,i,r,s,o){o=o||[];const a=Math.cos(r),l=Math.sin(r),u=s[0],c=s[1];let h=0;for(let f=e;f<t;f+=i){const d=n[f]-u,g=n[f+1]-c;o[h++]=u+d*a-g*l,o[h++]=c+d*l+g*a;for(let m=f+2;m<f+i;++m)o[h++]=n[m]}return o&&o.length!=h&&(o.length=h),o}function bv(n,e,t,i,r,s,o,a){a=a||[];const l=o[0],u=o[1];let c=0;for(let h=e;h<t;h+=i){const f=n[h]-l,d=n[h+1]-u;a[c++]=l+r*f,a[c++]=u+s*d;for(let g=h+2;g<h+i;++g)a[c++]=n[g]}return a&&a.length!=c&&(a.length=c),a}function wg(n,e,t,i,r,s,o){o=o||[];let a=0;for(let l=e;l<t;l+=i){o[a++]=n[l]+r,o[a++]=n[l+1]+s;for(let u=l+2;u<l+i;++u)o[a++]=n[u]}return o&&o.length!=a&&(o.length=a),o}const Rv=Le();class ZC extends Rn{constructor(){super(),this.extent_=Ft(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Fy(function(e,t,i){if(!i)return this.getSimplifiedGeometry(t);const r=this.clone();return r.applyTransform(i),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return ae()}closestPointXY(e,t,i,r){return ae()}containsXY(e,t){const i=this.getClosestPoint([e,t]);return i[0]===e&&i[1]===t}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return ae()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&zr(t),this.extentRevision_=this.getRevision()}return Jy(this.extent_,e)}rotate(e,t){ae()}scale(e,t,i){ae()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return ae()}getType(){return ae()}applyTransform(e){ae()}intersectsExtent(e){return ae()}translate(e,t){ae()}transform(e,t){const i=J(e),r=i.getUnits()=="tile-pixels"?function(s,o,a){const l=i.getExtent(),u=i.getWorldExtent(),c=Xe(u)/Xe(l);return tn(Rv,u[0],u[3],c,-c,0,0,0),ci(s,0,s.length,a,Rv,o),ui(i,t)(s,o,a)}:ui(i,t);return this.applyTransform(r),this}}var Tg=ZC;class WC extends Tg{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(e){return kc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return ae()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=ra(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){ae()}setLayout(e,t,i){let r;if(e)r=ra(e);else{for(let s=0;s<i;++s)if(t.length===0){this.layout="XY",this.stride=2;return}else t=t[0];r=t.length,e=HC(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(e,t){const i=this.getFlatCoordinates();if(i){const r=this.getStride();qc(i,0,i.length,r,e,t,i),this.changed()}}scale(e,t,i){t===void 0&&(t=e),i||(i=Ot(this.getExtent()));const r=this.getFlatCoordinates();if(r){const s=this.getStride();bv(r,0,r.length,s,e,t,i,r),this.changed()}}translate(e,t){const i=this.getFlatCoordinates();if(i){const r=this.getStride();wg(i,0,i.length,r,e,t,i),this.changed()}}}function HC(n){let e;return n==2?e="XY":n==3?e="XYZ":n==4&&(e="XYZM"),e}function ra(n){let e;return n=="XY"?e=2:n=="XYZ"||n=="XYM"?e=3:n=="XYZM"&&(e=4),e}function Cv(n,e,t){const i=n.getFlatCoordinates();if(i){const r=n.getStride();return ci(i,0,i.length,r,e,t)}else return null}var hi=WC;function Iv(n,e,t,i,r,s,o){const a=n[e],l=n[e+1],u=n[t]-a,c=n[t+1]-l;let h;if(u===0&&c===0)h=e;else{const f=((r-a)*u+(s-l)*c)/(u*u+c*c);if(f>1)h=t;else if(f>0){for(let d=0;d<i;++d)o[d]=Li(n[e+d],n[t+d],f);o.length=i;return}else h=e}for(let f=0;f<i;++f)o[f]=n[h+f];o.length=i}function Jc(n,e,t,i,r){let s=n[e],o=n[e+1];for(e+=i;e<t;e+=i){const a=n[e],l=n[e+1],u=li(s,o,a,l);u>r&&(r=u),s=a,o=l}return r}function Qc(n,e,t,i,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];r=Jc(n,e,a,i,r),e=a}return r}function Av(n,e,t,i,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];r=Qc(n,e,a,i,r),e=a[a.length-1]}return r}function eh(n,e,t,i,r,s,o,a,l,u,c){if(e==t)return u;let h,f;if(r===0)if(f=li(o,a,n[e],n[e+1]),f<u){for(h=0;h<i;++h)l[h]=n[e+h];return l.length=i,f}else return u;c=c||[NaN,NaN];let d=e+i;for(;d<t;)if(Iv(n,d-i,d,i,o,a,c),f=li(o,a,c[0],c[1]),f<u){for(u=f,h=0;h<i;++h)l[h]=c[h];l.length=i,d+=i}else d+=i*Math.max((Math.sqrt(f)-Math.sqrt(u))/r|0,1);if(s&&(Iv(n,t-i,e,i,o,a,c),f=li(o,a,c[0],c[1]),f<u)){for(u=f,h=0;h<i;++h)l[h]=c[h];l.length=i}return u}function th(n,e,t,i,r,s,o,a,l,u,c){c=c||[NaN,NaN];for(let h=0,f=t.length;h<f;++h){const d=t[h];u=eh(n,e,d,i,r,s,o,a,l,u,c),e=d}return u}function Lv(n,e,t,i,r,s,o,a,l,u,c){c=c||[NaN,NaN];for(let h=0,f=t.length;h<f;++h){const d=t[h];u=th(n,e,d,i,r,s,o,a,l,u,c),e=d[d.length-1]}return u}function Sg(n,e,t,i){for(let r=0,s=t.length;r<s;++r)n[e++]=t[r];return e}function sa(n,e,t,i){for(let r=0,s=t.length;r<s;++r){const o=t[r];for(let a=0;a<i;++a)n[e++]=o[a]}return e}function nh(n,e,t,i,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=sa(n,e,t[o],i);r[s++]=l,e=l}return r.length=s,r}function Pv(n,e,t,i,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=nh(n,e,t[o],i,r[s]);l.length===0&&(l[0]=e),r[s++]=l,e=l[l.length-1]}return r.length=s,r}function KC(n,e,t,i,r,s,o){return o=o!==void 0?o:[],s||(t=Mv(n,e,t,i,r,o,0),n=o,e=0,i=2),o.length=Dl(n,e,t,i,r,o,0),o}function Dl(n,e,t,i,r,s,o){const a=(t-e)/i;if(a<3){for(;e<t;e+=i)s[o++]=n[e],s[o++]=n[e+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const u=[e,t-i];let c=0;for(;u.length>0;){const h=u.pop(),f=u.pop();let d=0;const g=n[f],m=n[f+1],p=n[h],_=n[h+1];for(let v=f+i;v<h;v+=i){const x=n[v],y=n[v+1],T=ug(x,y,g,m,p,_);T>d&&(c=v,d=T)}d>r&&(l[(c-e)/i]=1,f+i<c&&u.push(f,c),c+i<h&&u.push(c,h))}for(let h=0;h<a;++h)l[h]&&(s[o++]=n[e+h*i],s[o++]=n[e+h*i+1]);return o}function bg(n,e,t,i,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l];o=Dl(n,e,c,i,r,s,o),a.push(o),e=c}return o}function qC(n,e,t,i,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l],h=[];o=bg(n,e,c,i,r,s,o,h),a.push(h),e=c[c.length-1]}return o}function Mv(n,e,t,i,r,s,o){if(t<=e+i){for(;e<t;e+=i)s[o++]=n[e],s[o++]=n[e+1];return o}let a=n[e],l=n[e+1];s[o++]=a,s[o++]=l;let u=a,c=l;for(e+=i;e<t;e+=i)u=n[e],c=n[e+1],li(a,l,u,c)>r&&(s[o++]=u,s[o++]=c,a=u,l=c);return(u!=a||c!=l)&&(s[o++]=u,s[o++]=c),o}function Wr(n,e){return e*Math.round(n/e)}function Fv(n,e,t,i,r,s,o){if(e==t)return o;let a=Wr(n[e],r),l=Wr(n[e+1],r);e+=i,s[o++]=a,s[o++]=l;let u,c;do if(u=Wr(n[e],r),c=Wr(n[e+1],r),e+=i,e==t)return s[o++]=u,s[o++]=c,o;while(u==a&&c==l);for(;e<t;){const h=Wr(n[e],r),f=Wr(n[e+1],r);if(e+=i,h==u&&f==c)continue;const d=u-a,g=c-l,m=h-a,p=f-l;if(d*p==g*m&&(d<0&&m<d||d==m||d>0&&m>d)&&(g<0&&p<g||g==p||g>0&&p>g)){u=h,c=f;continue}s[o++]=u,s[o++]=c,a=u,l=c,u=h,c=f}return s[o++]=u,s[o++]=c,o}function Rg(n,e,t,i,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l];o=Fv(n,e,c,i,r,s,o),a.push(o),e=c}return o}function Ov(n,e,t,i,r,s,o,a){for(let l=0,u=t.length;l<u;++l){const c=t[l],h=[];o=Rg(n,e,c,i,r,s,o,h),a.push(h),e=c[c.length-1]}return o}function Pi(n,e,t,i,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=i)r[s++]=n.slice(o,o+i);return r.length=s,r}function oa(n,e,t,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];r[s++]=Pi(n,e,l,i,r[s]),e=l}return r.length=s,r}function ih(n,e,t,i,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o];r[s++]=l.length===1&&l[0]===e?[]:oa(n,e,l,i,r[s]),e=l[l.length-1]}return r.length=s,r}function rh(n,e,t,i){let r=0,s=n[t-i],o=n[t-i+1];for(;e<t;e+=i){const a=n[e],l=n[e+1];r+=o*a-s*l,s=a,o=l}return r/2}function Cg(n,e,t,i){let r=0;for(let s=0,o=t.length;s<o;++s){const a=t[s];r+=rh(n,e,a,i),e=a}return r}function $v(n,e,t,i){let r=0;for(let s=0,o=t.length;s<o;++s){const a=t[s];r+=Cg(n,e,a,i),e=a[a.length-1]}return r}class Id extends hi{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new Id(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,i,r){return r<Br(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),eh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,i,r))}getArea(){return rh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){const t=[];return t.length=Dl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Id(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sa(this.flatCoordinates,0,e,this.stride),this.changed()}}var aa=Id;class iy extends hi{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const e=new iy(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,r){const s=this.flatCoordinates,o=li(e,t,s[0],s[1]);if(o<r){const a=this.stride;for(let l=0;l<a;++l)i[l]=s[l];return i.length=a,o}else return r}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(e){return zs(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return Dc(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Sg(this.flatCoordinates,0,e,this.stride),this.changed()}}var st=iy;function Dv(n,e,t,i,r){return!Gc(r,function(o){return!Hr(n,e,t,i,o[0],o[1])})}function Hr(n,e,t,i,r,s){let o=0,a=n[t-i],l=n[t-i+1];for(;e<t;e+=i){const u=n[e],c=n[e+1];l<=s?c>s&&(u-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(u-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=u,l=c}return o!==0}function sh(n,e,t,i,r,s){if(t.length===0||!Hr(n,e,t[0],i,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Hr(n,t[o-1],t[o],i,r,s))return!1;return!0}function Nv(n,e,t,i,r,s){if(t.length===0)return!1;for(let o=0,a=t.length;o<a;++o){const l=t[o];if(sh(n,e,l,i,r,s))return!0;e=l[l.length-1]}return!1}function oh(n,e,t,i,r,s,o){let a,l,u,c,h,f,d;const g=r[s+1],m=[];for(let v=0,x=t.length;v<x;++v){const y=t[v];for(c=n[y-i],f=n[y-i+1],a=e;a<y;a+=i)h=n[a],d=n[a+1],(g<=f&&d<=g||f<=g&&g<=d)&&(u=(g-f)/(d-f)*(h-c)+c,m.push(u)),c=h,f=d}let p=NaN,_=-1/0;for(m.sort(ir),c=m[0],a=1,l=m.length;a<l;++a){h=m[a];const v=Math.abs(h-c);v>_&&(u=(c+h)/2,sh(n,e,t,i,u,g)&&(p=u,_=v)),c=h}return isNaN(p)&&(p=r[s]),o?(o.push(p,g,_),o):[p,g,_]}function Ig(n,e,t,i,r){let s=[];for(let o=0,a=t.length;o<a;++o){const l=t[o];s=oh(n,e,l,i,r,2*o,s),e=l[l.length-1]}return s}function Ag(n,e,t,i,r){let s;for(e+=i;e<t;e+=i)if(s=r(n.slice(e-i,e),n.slice(e,e+i)),s)return s;return!1}function Nl(n,e,t,i,r){const s=ig(Ft(),n,e,t,i);return Je(r,s)?Mt(r,s)||s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:Ag(n,e,t,i,function(o,a){return Qy(r,o,a)}):!1}function kv(n,e,t,i,r){for(let s=0,o=t.length;s<o;++s){if(Nl(n,e,t[s],i,r))return!0;e=t[s]}return!1}function Lg(n,e,t,i,r){return!!(Nl(n,e,t,i,r)||Hr(n,e,t,i,r[0],r[1])||Hr(n,e,t,i,r[0],r[3])||Hr(n,e,t,i,r[2],r[1])||Hr(n,e,t,i,r[2],r[3]))}function Pg(n,e,t,i,r){if(!Lg(n,e,t[0],i,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(Dv(n,t[s-1],t[s],i,r)&&!Nl(n,t[s-1],t[s],i,r))return!1;return!0}function Gv(n,e,t,i,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];if(Pg(n,e,a,i,r))return!0;e=a[a.length-1]}return!1}function Uv(n,e,t,i){for(;e<t-i;){for(let r=0;r<i;++r){const s=n[e+r];n[e+r]=n[t-i+r],n[t-i+r]=s}e+=i,t-=i}}function kl(n,e,t,i){let r=0,s=n[t-i],o=n[t-i+1];for(;e<t;e+=i){const a=n[e],l=n[e+1];r+=(a-s)*(l+o),s=a,o=l}return r===0?void 0:r>0}function Mg(n,e,t,i,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){const a=t[s],l=kl(n,e,a,i);if(s===0){if(r&&l||!r&&!l)return!1}else if(r&&!l||!r&&l)return!1;e=a}return!0}function Bv(n,e,t,i,r){for(let s=0,o=t.length;s<o;++s){const a=t[s];if(!Mg(n,e,a,i,r))return!1;a.length&&(e=a[a.length-1])}return!0}function ah(n,e,t,i,r){r=r!==void 0?r:!1;for(let s=0,o=t.length;s<o;++s){const a=t[s],l=kl(n,e,a,i);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Uv(n,e,a,i),e=a}return e}function Fg(n,e,t,i,r){for(let s=0,o=t.length;s<o;++s)e=ah(n,e,t[s],i,r);return e}function Og(n,e){const t=[];let i=0,r=0;for(let s=0,o=e.length;s<o;++s){const a=e[s];if(!kl(n,i,a,2))t.push(e.slice(r,s+1));else{if(t.length===0)continue;t[t.length-1].push(e[r])}r=s+1,i=a}return t}class jo extends hi{constructor(e,t,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&i?(this.setFlatCoordinates(t,e),this.ends_=i):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Oe(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new jo(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,i,r){return r<Br(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qc(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),th(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,i,r))}containsXY(e,t){return sh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Cg(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),ah(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,oa(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=Ot(this.getExtent());this.flatInteriorPoint_=oh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new st(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new aa(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,i=this.ends_,r=[];let s=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],u=new aa(t.slice(s,l),e);r.push(u),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;Mg(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=ah(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=Rg(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,i),new jo(t,"XY",i)}getType(){return"Polygon"}intersectsExtent(e){return Pg(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=nh(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}var Dt=jo;function zv(n,e,t,i){t=t||32;const r=[];for(let s=0;s<t;++s)Oe(r,_v(n,e,2*Math.PI*s/t,i));return r.push(r[0],r[1]),new jo(r,"XY",[r.length])}function eo(n){const e=n[0],t=n[1],i=n[2],r=n[3],s=[e,t,e,r,i,r,i,t,e,t];return new jo(s,"XY",[s.length])}function Gl(n,e,t){e=e||32;const i=n.getStride(),r=n.getLayout(),s=n.getCenter(),o=i*(e+1),a=new Array(o);for(let c=0;c<o;c+=i){a[c]=0,a[c+1]=0;for(let h=2;h<i;h++)a[c+h]=s[h]}const l=[a.length],u=new jo(a,r,l);return $g(u,s,n.getRadius(),t),u}function $g(n,e,t,i){const r=n.getFlatCoordinates(),s=n.getStride(),o=r.length/s-1,a=i||0;for(let l=0;l<=o;++l){const u=l*s,c=a+Zn(l,o)*2*Math.PI/o;r[u]=e[0]+t*Math.cos(c),r[u+1]=e[1]+t*Math.sin(c)}n.changed()}const mt={ACCURACY:"accuracy",ACCURACY_GEOMETRY:"accuracyGeometry",ALTITUDE:"altitude",ALTITUDE_ACCURACY:"altitudeAccuracy",HEADING:"heading",POSITION:"position",PROJECTION:"projection",SPEED:"speed",TRACKING:"tracking",TRACKING_OPTIONS:"trackingOptions"};class JC extends Ct{constructor(e){super(K.ERROR),this.code=e.code,this.message=e.message}}class QC extends Rn{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.position_=null,this.transform_=Ol,this.watchId_=void 0,this.addChangeListener(mt.PROJECTION,this.handleProjectionChanged_),this.addChangeListener(mt.TRACKING,this.handleTrackingChanged_),e.projection!==void 0&&this.setProjection(e.projection),e.trackingOptions!==void 0&&this.setTrackingOptions(e.trackingOptions),this.setTracking(e.tracking!==void 0?e.tracking:!1)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const e=this.getProjection();e&&(this.transform_=Un(J("EPSG:4326"),e),this.position_&&this.set(mt.POSITION,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const e=this.getTracking();e&&this.watchId_===void 0?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):!e&&this.watchId_!==void 0&&(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(e){const t=e.coords;this.set(mt.ACCURACY,t.accuracy),this.set(mt.ALTITUDE,t.altitude===null?void 0:t.altitude),this.set(mt.ALTITUDE_ACCURACY,t.altitudeAccuracy===null?void 0:t.altitudeAccuracy),this.set(mt.HEADING,t.heading===null?void 0:$t(t.heading)),this.position_?(this.position_[0]=t.longitude,this.position_[1]=t.latitude):this.position_=[t.longitude,t.latitude];const i=this.transform_(this.position_);this.set(mt.POSITION,i),this.set(mt.SPEED,t.speed===null?void 0:t.speed);const r=zv(this.position_,t.accuracy);r.applyTransform(this.transform_),this.set(mt.ACCURACY_GEOMETRY,r),this.changed()}positionError_(e){this.dispatchEvent(new JC(e))}getAccuracy(){return this.get(mt.ACCURACY)}getAccuracyGeometry(){return this.get(mt.ACCURACY_GEOMETRY)||null}getAltitude(){return this.get(mt.ALTITUDE)}getAltitudeAccuracy(){return this.get(mt.ALTITUDE_ACCURACY)}getHeading(){return this.get(mt.HEADING)}getPosition(){return this.get(mt.POSITION)}getProjection(){return this.get(mt.PROJECTION)}getSpeed(){return this.get(mt.SPEED)}getTracking(){return this.get(mt.TRACKING)}getTrackingOptions(){return this.get(mt.TRACKING_OPTIONS)}setProjection(e){this.set(mt.PROJECTION,J(e))}setTracking(e){this.set(mt.TRACKING,e)}setTrackingOptions(e){this.set(mt.TRACKING_OPTIONS,e)}}var Vv=QC;class eI extends Gs{constructor(e,t,i,r){super(),this.extent=e,this.pixelRatio_=i,this.resolution=t,this.state=r}changed(){this.dispatchEvent(K.CHANGE)}getExtent(){return this.extent}getImage(){return ae()}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){ae()}}var Ul=eI,ce={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class tI extends Ul{constructor(e,t,i,r,s,o){super(e,t,i,ce.IDLE),this.src_=r,this.image_=new Image,s!==null&&(this.image_.crossOrigin=s),this.unlisten_=null,this.state=ce.IDLE,this.imageLoadFunction_=o}getImage(){return this.image_}handleImageError_(){this.state=ce.ERROR,this.unlistenImage_(),this.changed()}handleImageLoad_(){this.resolution===void 0&&(this.resolution=Xe(this.extent)/this.image_.height),this.state=ce.LOADED,this.unlistenImage_(),this.changed()}load(){(this.state==ce.IDLE||this.state==ce.ERROR)&&(this.state=ce.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=lh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}setImage(e){this.image_=e,this.resolution=Xe(this.extent)/this.image_.height}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function lh(n,e,t){const i=n;let r=!0,s=!1,o=!1;const a=[Us(i,K.LOAD,function(){o=!0,s||e()})];return i.src&&Vy?(s=!0,i.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(Us(i,K.ERROR,t)),function(){r=!1,a.forEach(Pe)}}var la=tI;class nI extends Ul{constructor(e,t,i,r,s){const o=s!==void 0?ce.IDLE:ce.LOADED;super(e,t,i,o),this.loader_=s!==void 0?s:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=ce.ERROR):this.state=ce.LOADED,this.changed()}load(){this.state==ce.IDLE&&(this.state=ce.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}var Bl=nI;function yt(n,e,t,i){let r;return t&&t.length?r=t.shift():$c?r=new OffscreenCanvas(n||300,e||300):r=document.createElement("canvas"),n&&(r.width=n),e&&(r.height=e),r.getContext("2d",i)}function uh(n){const e=n.canvas;e.width=1,e.height=1,n.clearRect(0,0,1,1)}function jv(n){let e=n.offsetWidth;const t=getComputedStyle(n);return e+=parseInt(t.marginLeft,10)+parseInt(t.marginRight,10),e}function Xv(n){let e=n.offsetHeight;const t=getComputedStyle(n);return e+=parseInt(t.marginTop,10)+parseInt(t.marginBottom,10),e}function to(n,e){const t=e.parentNode;t&&t.replaceChild(n,e)}function zl(n){return n&&n.parentNode?n.parentNode.removeChild(n):null}function Dg(n){for(;n.lastChild;)n.removeChild(n.lastChild)}function Yv(n,e){const t=n.childNodes;for(let i=0;;++i){const r=t[i],s=e[i];if(!r&&!s)break;if(r!==s){if(!r){n.appendChild(s);continue}if(!s){n.removeChild(r),--i;continue}n.insertBefore(s,r)}}}class iI extends Nr{constructor(e,t,i,r,s,o){super(e,t,o),this.crossOrigin_=r,this.src_=i,this.key=i,this.image_=new Image,r!==null&&(this.image_.crossOrigin=r),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=V.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=V.ERROR,this.unlistenImage_(),this.image_=rI(),this.changed()}handleImageLoad_(){const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=V.LOADED:this.state=V.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==V.ERROR&&(this.state=V.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==V.IDLE&&(this.state=V.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=lh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function rI(){const n=yt(1,1);return n.fillStyle="rgba(0,0,0,0)",n.fillRect(0,0,1,1),n.canvas}var no=iI;class sI{constructor(e,t,i){this.decay_=e,this.minVelocity_=t,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let i=t-3;for(;i>0&&this.points_[i+2]>e;)i-=3;const r=this.points_[t+2]-this.points_[i+2];if(r<1e3/60)return!1;const s=this.points_[t]-this.points_[i],o=this.points_[t+1]-this.points_[i+1];return this.angle_=Math.atan2(o,s),this.initialVelocity_=Math.sqrt(s*s+o*o)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var Ng=sI;const Zv=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,Wv=/^([a-z]*)$|^hsla?\(.*\)$/i;function kg(n){return typeof n=="string"?n:Bg(n)}function Hv(n){const e=document.createElement("div");if(e.style.color=n,e.style.color!==""){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}else return""}const Gg=function(){const e={};let t=0;return function(i){let r;if(e.hasOwnProperty(i))r=e[i];else{if(t>=1024){let s=0;for(const o in e)(s++&3)===0&&(delete e[o],--t)}r=oI(i),e[i]=r,++t}return r}}();function Kr(n){return Array.isArray(n)?n:Gg(n)}function oI(n){let e,t,i,r,s;if(Wv.exec(n)&&(n=Hv(n)),Zv.exec(n)){const o=n.length-1;let a;o<=4?a=1:a=2;const l=o===4||o===8;e=parseInt(n.substr(1+0*a,a),16),t=parseInt(n.substr(1+1*a,a),16),i=parseInt(n.substr(1+2*a,a),16),l?r=parseInt(n.substr(1+3*a,a),16):r=255,a==1&&(e=(e<<4)+e,t=(t<<4)+t,i=(i<<4)+i,l&&(r=(r<<4)+r)),s=[e,t,i,r/255]}else n.startsWith("rgba(")?(s=n.slice(5,-1).split(",").map(Number),Ug(s)):n.startsWith("rgb(")?(s=n.slice(4,-1).split(",").map(Number),s.push(1),Ug(s)):ne(!1,14);return s}function Ug(n){return n[0]=ye(n[0]+.5|0,0,255),n[1]=ye(n[1]+.5|0,0,255),n[2]=ye(n[2]+.5|0,0,255),n[3]=ye(n[3],0,1),n}function Bg(n){let e=n[0];e!=(e|0)&&(e=e+.5|0);let t=n[1];t!=(t|0)&&(t=t+.5|0);let i=n[2];i!=(i|0)&&(i=i+.5|0);const r=n[3]===void 0?1:Math.round(n[3]*100)/100;return"rgba("+e+","+t+","+i+","+r+")"}function Kv(n){return Wv.test(n)&&(n=Hv(n)),Zv.test(n)||n.startsWith("rgba(")||n.startsWith("rgb(")}class qv{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const i=this.cache_[t];(e++&3)===0&&!i.hasListener()&&(delete this.cache_[t],--this.cacheSize_)}}}get(e,t,i){const r=Jv(e,t,i);return r in this.cache_?this.cache_[r]:null}set(e,t,i,r){const s=Jv(e,t,i);this.cache_[s]=r,++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}}function Jv(n,e,t){const i=t?kg(t):"null";return e+":"+n+":"+i}var aI=qv;const Vl=new qv;var Ge={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class lI extends Rn{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ge.OPACITY]=e.opacity!==void 0?e.opacity:1,ne(typeof t[Ge.OPACITY]=="number",64),t[Ge.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ge.Z_INDEX]=e.zIndex,t[Ge.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ge.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ge.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ge.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:e===void 0?!0:e},i=this.getZIndex();return t.opacity=ye(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=i===void 0&&!t.managed?1/0:i,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return ae()}getLayerStatesArray(e){return ae()}getExtent(){return this.get(Ge.EXTENT)}getMaxResolution(){return this.get(Ge.MAX_RESOLUTION)}getMinResolution(){return this.get(Ge.MIN_RESOLUTION)}getMinZoom(){return this.get(Ge.MIN_ZOOM)}getMaxZoom(){return this.get(Ge.MAX_ZOOM)}getOpacity(){return this.get(Ge.OPACITY)}getSourceState(){return ae()}getVisible(){return this.get(Ge.VISIBLE)}getZIndex(){return this.get(Ge.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ge.EXTENT,e)}setMaxResolution(e){this.set(Ge.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ge.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ge.MAX_ZOOM,e)}setMinZoom(e){this.set(Ge.MIN_ZOOM,e)}setOpacity(e){ne(typeof e=="number",64),this.set(Ge.OPACITY,e)}setVisible(e){this.set(Ge.VISIBLE,e)}setZIndex(e){this.set(Ge.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var zg=lI,nn={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class uI extends zg{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ge.SOURCE,this.handleSourcePropertyChange_);const i=e.source?e.source:null;this.setSource(i)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ge.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed()}handleSourcePropertyChange_(){this.sourceChangeKey_&&(Pe(this.sourceChangeKey_),this.sourceChangeKey_=null);const e=this.getSource();e&&(this.sourceChangeKey_=re(e,K.CHANGE,this.handleSourceChange_,this)),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):new Promise(t=>t([]))}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}render(e,t){const i=this.getRenderer();if(i.prepareFrame(e))return this.rendered=!0,i.renderFrame(e,t)}unrender(){this.rendered=!1}setMapInternal(e){e||this.unrender(),this.set(Ge.MAP,e)}getMapInternal(){return this.get(Ge.MAP)}setMap(e){this.mapPrecomposeKey_&&(Pe(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(Pe(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=re(e,nn.PRECOMPOSE,function(t){const r=t.frameState.layerStatesArray,s=this.getLayerState(!1);ne(!r.some(function(o){return o.layer===s.layer}),67),r.push(s)},this),this.mapRenderKey_=re(this,K.CHANGE,e.render,e),this.changed())}setSource(e){this.set(Ge.SOURCE,e)}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()}}function ch(n,e){if(!n.visible)return!1;const t=e.resolution;if(t<n.minResolution||t>=n.maxResolution)return!1;const i=e.zoom;return i>n.minZoom&&i<=n.maxZoom}var io=uI;class cI extends ks{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){ae()}calculateMatrices2D(e){const t=e.viewState,i=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;tn(i,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Ur(r,i)}forEachFeatureAtCoordinate(e,t,i,r,s,o,a,l){let u;const c=t.viewState;function h(y,T,w,E){return s.call(o,T,y?w:null,E)}const f=c.projection,d=Xc(e.slice(),f),g=[[0,0]];if(f.canWrapX()&&r){const y=f.getExtent(),T=_e(y);g.push([-T,0],[T,0])}const m=t.layerStatesArray,p=m.length,_=[],v=[];for(let y=0;y<g.length;y++)for(let T=p-1;T>=0;--T){const w=m[T],E=w.layer;if(E.hasRenderer()&&ch(w,c)&&a.call(l,E)){const S=E.getRenderer(),b=E.getSource();if(S&&b){const R=b.getWrapX()?d:e,C=h.bind(null,w.managed);v[0]=R[0]+g[y][0],v[1]=R[1]+g[y][1],u=S.forEachFeatureAtCoordinate(v,t,i,C,_)}if(u)return u}}if(_.length===0)return;const x=1/_.length;return _.forEach((y,T)=>y.distanceSq+=T*x),_.sort((y,T)=>y.distanceSq-T.distanceSq),_.some(y=>u=y.callback(y.feature,y.layer,y.geometry)),u}hasFeatureAtCoordinate(e,t,i,r,s,o){return this.forEachFeatureAtCoordinate(e,t,i,r,kn,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){ae()}scheduleExpireIconCache(e){Vl.canExpireCache()&&e.postRenderFunctions.push(hI)}}function hI(n,e){Vl.expire()}var Qv=cI;class fI extends Ct{constructor(e,t,i,r){super(e),this.inversePixelTransform=t,this.frameState=i,this.context=r}}var ua=fI;const jl="ol-hidden",ex="ol-selectable",fi="ol-unselectable",Vg="ol-unsupported",qr="ol-control",Xl="ol-collapsed",dI=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"),tx=["style","variant","weight","size","lineHeight","family"],jg=function(n){const e=n.match(dI);if(!e)return null;const t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,r=tx.length;i<r;++i){const s=e[i+1];s!==void 0&&(t[tx[i]]=s)}return t.families=t.family.split(/,\s?/),t},Xg="10px sans-serif",Mi="#000",Yl="round",ca=[],ha=0,ro="round",fa=10,da="#000",ga="center",Zl="middle",Jr=[0,0,0,0],pa=1,di=new Rn;let ma=null,Yg;const hh={},Zg=function(){const e="32px ",t=["monospace","serif"],i=t.length,r="wmytzilWMYTZIL@#/&?$%10\uF013";let s,o;function a(u,c,h){let f=!0;for(let d=0;d<i;++d){const g=t[d];if(o=Wl(u+" "+c+" "+e+g,r),h!=g){const m=Wl(u+" "+c+" "+e+h+","+g,r);f=f&&m!=o}}return!!f}function l(){let u=!0;const c=di.getKeys();for(let h=0,f=c.length;h<f;++h){const d=c[h];di.get(d)<100&&(a.apply(this,d.split(`
|
2
|
-
`))?($r(hh),ma=null,Yg=void 0,di.set(d,100)):(di.set(d,di.get(d)+1,!0),u=!1))}u&&(clearInterval(s),s=void 0)}return function(u){const c=jg(u);if(!c)return;const h=c.families;for(let f=0,d=h.length;f<d;++f){const g=h[f],m=c.style+`
|
3
|
-
`+c.weight+`
|
4
|
-
`+g;di.get(m)===void 0&&(di.set(m,100,!0),a(c.style,c.weight,g)||(di.set(m,0,!0),s===void 0&&(s=setInterval(l,32))))}}}(),nx=function(){let n;return function(e){let t=hh[e];if(t==null){if($c){const i=jg(e),r=ix(e,"\u017Dg");t=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else n||(n=document.createElement("div"),n.innerHTML="M",n.style.minHeight="0",n.style.maxHeight="none",n.style.height="auto",n.style.padding="0",n.style.border="none",n.style.position="absolute",n.style.display="block",n.style.left="-99999px"),n.style.font=e,document.body.appendChild(n),t=n.offsetHeight,document.body.removeChild(n);hh[e]=t}return t}}();function ix(n,e){return ma||(ma=yt(1,1)),n!=Yg&&(ma.font=n,Yg=ma.font),ma.measureText(e)}function Wl(n,e){return ix(n,e).width}function Wg(n,e,t){if(e in t)return t[e];const i=e.split(`
|
5
|
-
`).reduce((r,s)=>Math.max(r,Wl(n,s)),0);return t[e]=i,i}function rx(n,e){const t=[],i=[],r=[];let s=0,o=0,a=0,l=0;for(let u=0,c=e.length;u<=c;u+=2){const h=e[u];if(h===`
|
6
|
-
`||u===c){s=Math.max(s,o),r.push(o),o=0,a+=l;continue}const f=e[u+1]||n.font,d=Wl(f,h);t.push(d),o+=d;const g=nx(f);i.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:t,heights:i,lineWidths:r}}function gI(n,e,t,i){e!==0&&(n.translate(t,i),n.rotate(e),n.translate(-t,-i))}function sx(n,e,t,i,r,s,o,a,l,u,c){n.save(),t!==1&&(n.globalAlpha*=t),e&&n.setTransform.apply(n,e),i.contextInstructions?(n.translate(l,u),n.scale(c[0],c[1]),pI(i,n)):c[0]<0||c[1]<0?(n.translate(l,u),n.scale(c[0],c[1]),n.drawImage(i,r,s,o,a,0,0,o,a)):n.drawImage(i,r,s,o,a,l,u,o*c[0],a*c[1]),n.restore()}function pI(n,e){const t=n.contextInstructions;for(let i=0,r=t.length;i<r;i+=2)Array.isArray(t[i+1])?e[t[i]].apply(e,t[i+1]):e[t[i]]=t[i+1]}class mI extends Qv{constructor(e){super(e),this.fontChangeListenerKey_=re(di,Mr.PROPERTYCHANGE,e.redrawText.bind(e)),this.element_=document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=fi+" ol-layers";const i=e.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const i=this.getMap();if(i.hasListener(e)){const r=new ua(e,void 0,t);i.dispatchEvent(r)}}disposeInternal(){Pe(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(nn.PRECOMPOSE,e);const t=e.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=e.viewState;this.children_.length=0;const r=[];let s=null;for(let o=0,a=t.length;o<a;++o){const l=t[o];e.layerIndex=o;const u=l.layer,c=u.getSourceState();if(!ch(l,i)||c!="ready"&&c!="undefined"){u.unrender();continue}const h=u.render(e,s);!h||(h!==s&&(this.children_.push(h),s=h),"getDeclutter"in u&&r.push(u))}for(let o=r.length-1;o>=0;--o)r[o].renderDeclutter(e);Yv(this.element_,this.children_),this.dispatchRenderEvent(nn.POSTCOMPOSE,e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}}var ox=mI;class or extends Ct{constructor(e,t){super(e),this.layer=t}}const Hg={LAYERS:"layers"};class ry extends zg{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let i=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Hg.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new St(i.slice(),{unique:!0}):ne(typeof i.getArray=="function",43):i=new St(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(Pe),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(re(e,gt.ADD,this.handleLayersAdd_,this),re(e,gt.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(Pe);$r(this.listenerKeys_);const t=e.getArray();for(let i=0,r=t.length;i<r;i++){const s=t[i];this.registerLayerListeners_(s),this.dispatchEvent(new or("addlayer",s))}this.changed()}registerLayerListeners_(e){const t=[re(e,Mr.PROPERTYCHANGE,this.handleLayerChange_,this),re(e,K.CHANGE,this.handleLayerChange_,this)];e instanceof ry&&t.push(re(e,"addlayer",this.handleLayerGroupAdd_,this),re(e,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[H(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new or("addlayer",e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new or("removelayer",e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new or("addlayer",t)),this.changed()}handleLayersRemove_(e){const t=e.element,i=H(t);this.listenerKeys_[i].forEach(Pe),delete this.listenerKeys_[i],this.dispatchEvent(new or("removelayer",t)),this.changed()}getLayers(){return this.get(Hg.LAYERS)}setLayers(e){const t=this.getLayers();if(t){const i=t.getArray();for(let r=0,s=i.length;r<s;++r)this.dispatchEvent(new or("removelayer",i[r]))}this.set(Hg.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=e!==void 0?e:[],i=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});const r=this.getLayerState();let s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=i,a=t.length;o<a;o++){const l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=zt(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}}var Hl=ry;class _I extends Ct{constructor(e,t,i){super(e),this.map=t,this.frameState=i!==void 0?i:null}}var Qr=_I;class yI extends Qr{constructor(e,t,i,r,s,o){super(e,t,s),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var gi=yI,Ie={SINGLECLICK:"singleclick",CLICK:K.CLICK,DBLCLICK:K.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},pi={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class vI extends Gs{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=re(i,pi.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=re(i,pi.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(K.TOUCHMOVE,this.boundHandleTouchMove_,qd?{passive:!1}:!1)}emulateClick_(e){let t=new gi(Ie.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new gi(Ie.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(function(){this.clickTimeoutId_=void 0;const i=new gi(Ie.SINGLECLICK,this.map_,e);this.dispatchEvent(i)}.bind(this),250)}updateActivePointers_(e){const t=e,i=t.pointerId;if(t.type==Ie.POINTERUP||t.type==Ie.POINTERCANCEL){delete this.trackedTouches_[i];for(const r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==Ie.POINTERDOWN||t.type==Ie.POINTERMOVE)&&(this.trackedTouches_[i]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new gi(Ie.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(Pe),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);const t=new gi(Ie.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.down_={};for(const i in e){const r=e[i];this.down_[i]=typeof r=="function"?Or:r}if(this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(re(i,Ie.POINTERMOVE,this.handlePointerMove_,this),re(i,Ie.POINTERUP,this.handlePointerUp_,this),re(this.element_,Ie.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(re(this.element_.getRootNode(),Ie.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new gi(Ie.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new gi(Ie.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(Pe(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(K.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(Pe(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(Pe),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var Kg=vI,Hn={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},vt={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};const Kl=1/0;class xI{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,$r(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,i=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const r=this.keyFunction_(i);return delete this.queuedElements_[r],i}enqueue(e){ne(!(this.keyFunction_(e)in this.queuedElements_),31);const t=this.priorityFunction_(e);return t!=Kl?(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,i=this.priorities_,r=t.length,s=t[e],o=i[e],a=e;for(;e<r>>1;){const l=this.getLeftChildIndex_(e),u=this.getRightChildIndex_(e),c=u<r&&i[u]<i[l]?u:l;t[e]=t[c],i[e]=i[c],e=c}t[e]=s,i[e]=o,this.siftDown_(a,e)}siftDown_(e,t){const i=this.elements_,r=this.priorities_,s=i[t],o=r[t];for(;t>e;){const a=this.getParentIndex_(t);if(r[a]>o)i[t]=i[a],r[t]=r[a],t=a;else break}i[t]=s,r[t]=o}reprioritize(){const e=this.priorityFunction_,t=this.elements_,i=this.priorities_;let r=0;const s=t.length;let o,a,l;for(a=0;a<s;++a)o=t[a],l=e(o),l==Kl?delete this.queuedElements_[this.keyFunction_(o)]:(i[r]=l,t[r++]=o);t.length=r,i.length=r,this.heapify_()}}var ax=xI;class EI extends ax{constructor(e,t){super(function(i){return e.apply(null,i)},function(i){return i[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(K.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,i=t.getState();if(i===V.LOADED||i===V.ERROR||i===V.EMPTY){i!==V.ERROR&&t.removeEventListener(K.CHANGE,this.boundHandleTileChange_);const r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let i=0,r,s,o;for(;this.tilesLoading_<e&&i<t&&this.getCount()>0;)s=this.dequeue()[0],o=s.getKey(),r=s.getState(),r===V.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,s.load())}}var fh=EI;function lx(n,e,t,i,r){if(!n||!(t in n.wantedTiles)||!n.wantedTiles[t][e.getKey()])return Kl;const s=n.viewState.center,o=i[0]-s[0],a=i[1]-s[1];return 65536*Math.log(r)+Math.sqrt(o*o+a*a)/r}var Ye={ANIMATING:0,INTERACTING:1},Ln={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const qg=42,so=256;function Jg(n,e,t){return function(i,r,s,o,a){if(!i)return;if(!r&&!e)return i;const l=e?0:s[0]*r,u=e?0:s[1]*r,c=a?a[0]:0,h=a?a[1]:0;let f=n[0]+l/2+c,d=n[2]-l/2+c,g=n[1]+u/2+h,m=n[3]-u/2+h;f>d&&(f=(d+f)/2,d=f),g>m&&(g=(m+g)/2,m=g);let p=ye(i[0],f,d),_=ye(i[1],g,m);if(o&&t&&r){const v=30*r;p+=-v*Math.log(1+Math.max(0,f-i[0])/v)+v*Math.log(1+Math.max(0,i[0]-d)/v),_+=-v*Math.log(1+Math.max(0,g-i[1])/v)+v*Math.log(1+Math.max(0,i[1]-m)/v)}return[p,_]}}function ux(n){return n}function Qg(n,e,t,i){const r=_e(e)/t[0],s=Xe(e)/t[1];return i?Math.min(n,Math.max(r,s)):Math.min(n,Math.min(r,s))}function ep(n,e,t){let i=Math.min(n,e);const r=50;return i*=Math.log(1+r*Math.max(0,n/e-1))/r+1,t&&(i=Math.max(i,t),i/=Math.log(1+r*Math.max(0,t/n-1))/r+1),ye(i,t/2,e*2)}function cx(n,e,t,i){return e=e!==void 0?e:!0,function(r,s,o,a){if(r!==void 0){const l=n[0],u=n[n.length-1],c=t?Qg(l,t,o,i):l;if(a)return e?ep(r,c,u):ye(r,u,c);const h=Math.min(c,r),f=Math.floor(bl(n,h,s));return n[f]>c&&f<n.length-1?n[f+1]:n[f]}else return}}function hx(n,e,t,i,r,s){return i=i!==void 0?i:!0,t=t!==void 0?t:0,function(o,a,l,u){if(o!==void 0){const c=r?Qg(e,r,l,s):e;if(u)return i?ep(o,c,t):ye(o,t,c);const h=1e-9,f=Math.ceil(Math.log(e/c)/Math.log(n)-h),d=-a*(.5-h)+.5,g=Math.min(c,o),m=Math.floor(Math.log(e/g)/Math.log(n)+d),p=Math.max(f,m),_=e/Math.pow(n,p);return ye(_,t,c)}else return}}function tp(n,e,t,i,r){return t=t!==void 0?t:!0,function(s,o,a,l){if(s!==void 0){const u=i?Qg(n,i,a,r):n;return!t||!l?ye(s,e,u):ep(s,u,e)}else return}}function dh(n){if(n!==void 0)return 0}function np(n){if(n!==void 0)return n}function fx(n){const e=2*Math.PI/n;return function(t,i){if(i)return t;if(t!==void 0)return t=Math.floor(t/e+.5)*e,t}}function dx(n){return n=n||$t(5),function(e,t){if(t)return e;if(e!==void 0)return Math.abs(e)<=n?0:e}}const ip=0;class wI extends Rn{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Kc(e.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&_g(),e.center&&(e.center=Qe(e.center,this.projection_)),e.extent&&(e.extent=An(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const a in Ln)delete t[a];this.setProperties(t,!0);const i=px(e);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=i.minZoom;const r=gx(e),s=i.constraint,o=mx(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const i=this.getCenter();if(i){const r=e||[0,0,0,0];t=t||[0,0,0,0];const s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(e){const t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let i=0;i<t.length;++i){let r=arguments[i];r.center&&(r=Object.assign({},r),r.center=Qe(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Qe(r.anchor,this.getProjection())),t[i]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,i;t>1&&typeof arguments[t-1]=="function"&&(i=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){const c=arguments[r];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(r===t){i&&gh(i,!0);return}let s=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const u=[];for(;r<t;++r){const c=arguments[r],h={start:s,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||Fc,callback:i};if(c.center&&(h.sourceCenter=o,h.targetCenter=c.center.slice(),o=h.targetCenter),c.zoom!==void 0?(h.sourceResolution=a,h.targetResolution=this.getResolutionForZoom(c.zoom),a=h.targetResolution):c.resolution&&(h.sourceResolution=a,h.targetResolution=c.resolution,a=h.targetResolution),c.rotation!==void 0){h.sourceRotation=l;const f=Zn(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;h.targetRotation=l+f,l=h.targetRotation}_x(h)?h.complete=!0:s+=h.duration,u.push(h)}this.animations_.push(u),this.setHint(Ye.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Ye.ANIMATING]>0}getInteracting(){return this.hints_[Ye.INTERACTING]>0}cancelAnimations(){this.setHint(Ye.ANIMATING,-this.hints_[Ye.ANIMATING]);let e;for(let t=0,i=this.animations_.length;t<i;++t){const r=this.animations_[t];if(r[0].callback&&gh(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){const a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let i=this.animations_.length-1;i>=0;--i){const r=this.animations_[i];let s=!0;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l.complete)continue;const u=e-l.start;let c=l.duration>0?u/l.duration:1;c>=1?(l.complete=!0,c=1):s=!1;const h=l.easing(c);if(l.sourceCenter){const f=l.sourceCenter[0],d=l.sourceCenter[1],g=l.targetCenter[0],m=l.targetCenter[1];this.nextCenter_=l.targetCenter;const p=f+h*(g-f),_=d+h*(m-d);this.targetCenter_=[p,_]}if(l.sourceResolution&&l.targetResolution){const f=h===1?l.targetResolution:l.sourceResolution+h*(l.targetResolution-l.sourceResolution);if(l.anchor){const d=this.getViewportSize_(this.getRotation()),g=this.constraints_.resolution(f,0,d,!0);this.targetCenter_=this.calculateCenterZoom(g,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=f,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const f=h===1?Zn(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+h*(l.targetRotation-l.sourceRotation);if(l.anchor){const d=this.constraints_.rotation(f,!0);this.targetCenter_=this.calculateCenterRotate(d,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=f}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[i]=null,this.setHint(Ye.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=r[0].callback;o&&gh(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let i;const r=this.getCenterInternal();return r!==void 0&&(i=[r[0]-t[0],r[1]-t[1]],Vc(i,e-this.getRotation()),fg(i,t)),i}calculateCenterZoom(e,t){let i;const r=this.getCenterInternal(),s=this.getResolution();if(r!==void 0&&s!==void 0){const o=t[0]-e*(t[0]-r[0])/s,a=t[1]-e*(t[1]-r[1])/s;i=[o,a]}return i}getViewportSize_(e){const t=this.viewportSize_;if(e){const i=t[0],r=t[1];return[Math.abs(i*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(i*Math.sin(e))+Math.abs(r*Math.cos(e))]}else return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e&&Yr(e,this.getProjection())}getCenterInternal(){return this.get(Ln.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){const t=this.calculateExtentInternal(e);return Zr(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();ne(t,1);const i=this.getResolution();ne(i!==void 0,2);const r=this.getRotation();return ne(r!==void 0,3),Ys(t,i,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Ln.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(An(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const i=_e(e)/t[0],r=Xe(e)/t[1];return Math.max(i,r)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,r=Math.log(t/i)/Math.log(e);return function(s){return t/Math.pow(e,s*r)}}getRotation(){return this.get(Ln.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),i=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(i/r)/t;return function(o){return Math.log(i/o)/t/s}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const i=this.padding_;return i&&(t=[t[0]-i[1]-i[3],t[1]-i[0]-i[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),i=this.getRotation();let r=this.getCenterInternal();const s=this.padding_;if(s){const o=this.getViewportSizeMinusPadding_();r=rp(r,this.getViewportSize_(),[o[0]/2+s[3],o[1]/2+s[0]],t,i)}return{center:r.slice(0),projection:e!==void 0?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getZoom(){let e;const t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,i,r;if(this.resolutions_){const s=bl(this.resolutions_,e,1);t=s,i=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=i/this.resolutions_[s+1]}else i=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(i/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const t=ye(Math.floor(e),0,this.resolutions_.length-2),i=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(i,ye(e-t,0,1))}else return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let i;if(ne(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function",24),Array.isArray(e)){ne(!Vr(e),25);const r=An(e,this.getProjection());i=eo(r)}else if(e.getType()==="Circle"){const r=An(e.getExtent(),this.getProjection());i=eo(r),i.rotate(this.getRotation(),Ot(r))}else{const r=Ht();r?i=e.clone().transform(r,this.getProjection()):i=e}this.fitInternal(i,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),i=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride();let a=1/0,l=1/0,u=-1/0,c=-1/0;for(let h=0,f=s.length;h<f;h+=o){const d=s[h]*i-s[h+1]*r,g=s[h]*r+s[h+1]*i;a=Math.min(a,d),l=Math.min(l,g),u=Math.max(u,d),c=Math.max(c,g)}return[a,l,u,c]}fitInternal(e,t){t=t||{};let i=t.size;i||(i=this.getViewportSizeMinusPadding_());const r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1;let o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;const a=this.rotatedExtentForGeometry(e);let l=this.getResolutionForExtentInternal(a,[i[0]-r[1]-r[3],i[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);const u=this.getRotation(),c=Math.sin(u),h=Math.cos(u),f=Ot(a);f[0]+=(r[1]-r[3])/2*l,f[1]+=(r[0]-r[2])/2*l;const d=f[0]*h-f[1]*c,g=f[1]*h+f[0]*c,m=this.getConstrainedCenter([d,g],l),p=t.callback?t.callback:Or;t.duration!==void 0?this.animateInternal({resolution:l,center:m,duration:t.duration,easing:t.easing},p):(this.targetResolution_=l,this.targetCenter_=m,this.applyTargetState_(!1,!0),gh(p,!0))}centerOn(e,t,i){this.centerOnInternal(Qe(e,this.getProjection()),t,i)}centerOnInternal(e,t,i){this.setCenterInternal(rp(e,t,i,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,i,r){let s;const o=this.padding_;if(o&&e){const a=this.getViewportSizeMinusPadding_(-i),l=rp(e,r,[a[0]/2+o[3],a[1]/2+o[0]],t,i);s=[e[0]-l[0],e[1]-l[1]]}return s}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){const t=Yr(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&Qe(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const i=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,i);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=Qe(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const i=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,i);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Qe(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const i=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,i),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,i),a=this.constraints_.center(this.targetCenter_,o,s,i,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Ln.ROTATION)!==r&&this.set(Ln.ROTATION,r),this.get(Ln.RESOLUTION)!==o&&(this.set(Ln.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ln.CENTER)||!Wn(this.get(Ln.CENTER),a))&&this.set(Ln.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,i){e=e!==void 0?e:200;const r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}i=i||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!Wn(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Dr,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Ye.INTERACTING,1)}endInteraction(e,t,i){i=i&&Qe(i,this.getProjection()),this.endInteractionInternal(e,t,i)}endInteractionInternal(e,t,i){this.setHint(Ye.INTERACTING,-1),this.resolveConstraints(e,t,i)}getConstrainedCenter(e,t){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),i)}getConstrainedZoom(e,t){const i=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(i,t))}getConstrainedResolution(e,t){t=t||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,i)}}function gh(n,e){setTimeout(function(){n(e)},0)}function gx(n){if(n.extent!==void 0){const t=n.smoothExtentConstraint!==void 0?n.smoothExtentConstraint:!0;return Jg(n.extent,n.constrainOnlyCenter,t)}const e=Kc(n.projection,"EPSG:3857");if(n.multiWorld!==!0&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Jg(t,!1,!1)}return ux}function px(n){let e,t,i,o=n.minZoom!==void 0?n.minZoom:ip,a=n.maxZoom!==void 0?n.maxZoom:28;const l=n.zoomFactor!==void 0?n.zoomFactor:2,u=n.multiWorld!==void 0?n.multiWorld:!1,c=n.smoothResolutionConstraint!==void 0?n.smoothResolutionConstraint:!0,h=n.showFullExtent!==void 0?n.showFullExtent:!1,f=Kc(n.projection,"EPSG:3857"),d=f.getExtent();let g=n.constrainOnlyCenter,m=n.extent;if(!u&&!m&&f.isGlobal()&&(g=!1,m=d),n.resolutions!==void 0){const p=n.resolutions;t=p[o],i=p[a]!==void 0?p[a]:p[p.length-1],n.constrainResolution?e=cx(p,c,!g&&m,h):e=tp(t,i,c,!g&&m,h)}else{const _=(d?Math.max(_e(d),Xe(d)):360*Yn.degrees/f.getMetersPerUnit())/so/Math.pow(2,ip),v=_/Math.pow(2,28-ip);t=n.maxResolution,t!==void 0?o=0:t=_/Math.pow(l,o),i=n.minResolution,i===void 0&&(n.maxZoom!==void 0?n.maxResolution!==void 0?i=t/Math.pow(l,a):i=_/Math.pow(l,a):i=v),a=o+Math.floor(Math.log(t/i)/Math.log(l)),i=t/Math.pow(l,a-o),n.constrainResolution?e=hx(l,t,i,c,!g&&m,h):e=tp(t,i,c,!g&&m,h)}return{constraint:e,maxResolution:t,minResolution:i,minZoom:o,zoomFactor:l}}function mx(n){if(n.enableRotation!==void 0?n.enableRotation:!0){const t=n.constrainRotation;return t===void 0||t===!0?dx():t===!1?np:typeof t=="number"?fx(t):np}else return dh}function _x(n){return!(n.sourceCenter&&n.targetCenter&&!Wn(n.sourceCenter,n.targetCenter)||n.sourceResolution!==n.targetResolution||n.sourceRotation!==n.targetRotation)}function rp(n,e,t,i,r){const s=Math.cos(-r);let o=Math.sin(-r),a=n[0]*s-n[1]*o,l=n[1]*s+n[0]*o;a+=(e[0]/2-t[0])*i,l+=(t[1]-e[1]/2)*i,o=-o;const u=a*s-l*o,c=l*s+a*o;return[u,c]}var Fi=wI;class TI extends Rn{constructor(e){super();const t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){zl(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&zl(this.element);for(let t=0,i=this.listenerKeys.length;t<i;++t)Pe(this.listenerKeys[t]);this.listenerKeys.length=0,this.map_=e,e&&((this.target_?this.target_:e.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==Or&&this.listenerKeys.push(re(e,Hn.POSTRENDER,this.render,this)),e.render())}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}}var Oi=TI;class SI extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1);const t=e.className!==void 0?e.className:"ol-attribution",i=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;const a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):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(K.CLICK,this.handleClick_.bind(this),!1);const u=t+" "+fi+" "+qr+(this.collapsed_&&this.collapsible_?" "+Xl:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=u,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t={},i=[];let r=!0;const s=e.layerStatesArray;for(let o=0,a=s.length;o<a;++o){const l=s[o];if(!ch(l,e.viewState))continue;const u=l.layer.getSource();if(!u)continue;const c=u.getAttributions();if(!c)continue;const h=c(e);if(!!h)if(r=r&&u.getAttributionsCollapsible()!==!1,Array.isArray(h))for(let f=0,d=h.length;f<d;++f)h[f]in t||(i.push(h[f]),t[h[f]]=!0);else h in t||(i.push(h),t[h]=!0)}return this.overrideCollapsible_||this.setCollapsible(r),i}updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=this.collectSourceAttributions_(e),i=t.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Ai(t,this.renderedAttributions_)){Dg(this.ulElement_);for(let r=0,s=t.length;r<s;++r){const o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Xl),this.collapsed_?to(this.collapseLabel_,this.label_):to(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,!(!this.collapsible_||this.collapsed_===e)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}}var yx=SI;class bI extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=e.className!==void 0?e.className:"ol-rotate",i=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(r));const s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(K.CLICK,this.handleClick_.bind(this),!1);const a=t+" "+fi+" "+qr,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration!==void 0?e.duration:250,this.autoHide_=e.autoHide!==void 0?e.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(jl)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const i=t.getRotation();i!==void 0&&(this.duration_>0&&i%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Dr}):t.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const i=t.viewState.rotation;if(i!=this.rotation_){const r="rotate("+i+"rad)";if(this.autoHide_){const s=this.element.classList.contains(jl);!s&&i===0?this.element.classList.add(jl):s&&i!==0&&this.element.classList.remove(jl)}this.label_.style.transform=r}this.rotation_=i}}var vx=bI;class RI extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=e.className!==void 0?e.className:"ol-zoom",i=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",u=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(K.CLICK,this.handleClick_.bind(this,i),!1);const h=document.createElement("button");h.className=s,h.setAttribute("type","button"),h.title=u,h.appendChild(typeof a=="string"?document.createTextNode(a):a),h.addEventListener(K.CLICK,this.handleClick_.bind(this,-i),!1);const f=t+" "+fi+" "+qr,d=this.element;d.className=f,d.appendChild(c),d.appendChild(h),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const i=this.getMap().getView();if(!i)return;const r=i.getZoom();if(r!==void 0){const s=i.getConstrainedZoom(r+e);this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:s,duration:this.duration_,easing:Dr})):i.setZoom(s)}}}var xx=RI;function sp(n){n=n||{};const e=new St;return(n.zoom!==void 0?n.zoom:!0)&&e.push(new xx(n.zoomOptions)),(n.rotate!==void 0?n.rotate:!0)&&e.push(new vx(n.rotateOptions)),(n.attribution!==void 0?n.attribution:!0)&&e.push(new yx(n.attributionOptions)),e}var ql={ACTIVE:"active"};class CI extends Rn{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(ql.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(ql.ACTIVE,e)}setMap(e){this.map_=e}}function Ex(n,e,t){const i=n.getCenterInternal();if(i){const r=[i[0]+e[0],i[1]+e[1]];n.animateInternal({duration:t!==void 0?t:250,easing:Ny,center:n.getConstrainedCenter(r)})}}function ph(n,e,t,i){const r=n.getZoom();if(r===void 0)return;const s=n.getConstrainedZoom(r+e),o=n.getResolutionForZoom(s);n.getAnimating()&&n.cancelAnimations(),n.animate({resolution:o,anchor:t,duration:i!==void 0?i:250,easing:Dr})}var ar=CI;class II extends ar{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==Ie.DBLCLICK){const i=e.originalEvent,r=e.map,s=e.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=r.getView();ph(a,o,s,this.duration_),i.preventDefault(),t=!0}return!t}}var wx=II;class AI extends ar{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==Ie.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Ie.POINTERUP){const i=this.handleUpEvent(e);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(e.type==Ie.POINTERDOWN){const i=this.handleDownEvent(e);this.handlingDownUpSequence=i,t=this.stopDown(i)}else e.type==Ie.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}}function mh(n){const e=n.length;let t=0,i=0;for(let r=0;r<e;r++)t+=n[r].clientX,i+=n[r].clientY;return[t/e,i/e]}var Kn=AI;function _h(n){const e=arguments;return function(t){let i=!0;for(let r=0,s=e.length;r<s&&(i=i&&e[r](t),!!i);++r);return i}}const Tx=function(n){const e=n.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Sx=function(n){const e=n.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},bx=function(n){const e=n.map.getTargetElement(),t=n.map.getOwnerDocument().activeElement;return e.contains(t)},op=function(n){return n.map.getTargetElement().hasAttribute("tabindex")?bx(n):!0},oo=kn,LI=function(n){return n.type==Ie.CLICK},ap=function(n){const e=n.originalEvent;return e.button==0&&!(zy&&Kd&&e.ctrlKey)},yh=Fr,PI=function(n){return n.type=="pointermove"},lp=function(n){return n.type==Ie.SINGLECLICK},MI=function(n){return n.type==Ie.DBLCLICK},vh=function(n){const e=n.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},FI=function(n){const e=n.originalEvent;return!e.altKey&&(Kd?e.metaKey:e.ctrlKey)&&!e.shiftKey},Jl=function(n){const e=n.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},up=function(n){const e=n.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},ao=function(n){const e=n.originalEvent;return ne(e!==void 0,56),e.pointerType=="mouse"},OI=function(n){const e=n.originalEvent;return ne(e!==void 0,56),e.pointerType==="touch"},$I=function(n){const e=n.originalEvent;return ne(e!==void 0,56),e.pointerType==="pen"},cp=function(n){const e=n.originalEvent;return ne(e!==void 0,56),e.isPrimary&&e.button===0};class DI extends Kn{constructor(e){super({stopDown:Fr}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:_h(vh,cp);this.condition_=e.onFocusOnly?_h(op,t):t,this.noKinetic_=!1}handleDragEvent(e){this.panning_||(this.panning_=!0,this.getMap().getView().beginInteraction());const t=this.targetPointers,i=mh(t);if(t.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(i[0],i[1]),this.lastCentroid){const r=[this.lastCentroid[0]-i[0],i[1]-this.lastCentroid[1]],o=e.map.getView();dg(r,o.getResolution()),Vc(r,o.getRotation()),o.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=i,this.lastPointersCount_=t.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,i=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:Dr})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}else return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const i=e.map.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}else return!1}}var Rx=DI;class NI extends Kn{constructor(e){e=e||{},super({stopDown:Fr}),this.condition_=e.condition?e.condition:Sx,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!ao(e))return;const t=e.map,i=t.getView();if(i.getConstraints().rotation===dh)return;const r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return ao(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return ao(e)&&ap(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}var Cx=NI;class kI extends ks{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,i="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+i,r.top=Math.min(e[1],t[1])+i,r.width=Math.abs(t[0]-e[0])+i,r.height=Math.abs(t[1]-e[1])+i}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Dt([r])}getGeometry(){return this.geometry_}}var Ix=kI;const xh={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class Eh extends Ct{constructor(e,t,i){super(e),this.coordinate=t,this.mapBrowserEvent=i}}class GI extends Kn{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.box_=new Ix(e.className||"ol-dragbox"),this.minArea_=e.minArea!==void 0?e.minArea:64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition?e.condition:ap,this.boxEndCondition_=e.boxEndCondition?e.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,i){const r=i[0]-t[0],s=i[1]-t[1];return r*r+s*s>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Eh(xh.BOXDRAG,e.coordinate,e))}handleUpEvent(e){this.box_.setMap(null);const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Eh(t?xh.BOXEND:xh.BOXCANCEL,e.coordinate,e)),!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Eh(xh.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}}var Ax=GI;class UI extends Ax{constructor(e){e=e||{};const t=e.condition?e.condition:Jl;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){const i=this.getMap().getView();let r=this.getGeometry();if(this.out_){const s=i.rotatedExtentForGeometry(r),o=i.getResolutionForExtentInternal(s),a=i.getResolution()/o;r=r.clone(),r.scale(a*a)}i.fitInternal(r,{duration:this.duration_,easing:Dr})}}var Lx=UI,es={LEFT:37,UP:38,RIGHT:39,DOWN:40};class BI extends ar{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return vh(t)&&up(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==K.KEYDOWN){const i=e.originalEvent,r=i.keyCode;if(this.condition_(e)&&(r==es.DOWN||r==es.LEFT||r==es.RIGHT||r==es.UP)){const o=e.map.getView(),a=o.getResolution()*this.pixelDelta_;let l=0,u=0;r==es.DOWN?u=-a:r==es.LEFT?l=-a:r==es.RIGHT?l=a:u=a;const c=[l,u];Vc(c,o.getRotation()),Ex(o,c,this.duration_),i.preventDefault(),t=!0}}return!t}}var Px=BI;class zI extends ar{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:up,this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==K.KEYDOWN||e.type==K.KEYPRESS){const i=e.originalEvent,r=i.charCode;if(this.condition_(e)&&(r=="+".charCodeAt(0)||r=="-".charCodeAt(0))){const s=e.map,o=r=="+".charCodeAt(0)?this.delta_:-this.delta_,a=s.getView();ph(a,o,void 0,this.duration_),i.preventDefault(),t=!0}}return!t}}var Mx=zI;class VI extends ar{constructor(e){e=e||{},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta!==void 0?e.maxDelta:1,this.duration_=e.duration!==void 0?e.duration:250,this.timeout_=e.timeout!==void 0?e.timeout:80,this.useAnchor_=e.useAnchor!==void 0?e.useAnchor:!0,this.constrainResolution_=e.constrainResolution!==void 0?e.constrainResolution:!1;const t=e.condition?e.condition:oo;this.condition_=e.onFocusOnly?_h(op,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;e.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(e){if(!this.condition_(e)||e.type!==K.WHEEL)return!0;const i=e.map,r=e.originalEvent;r.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.coordinate);let s;if(e.type==K.WHEEL&&(s=r.deltaY,Gy&&r.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(s/=Oc),r.deltaMode===WheelEvent.DOM_DELTA_LINE&&(s*=40)),s===0)return!1;this.lastDelta_=s;const o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(s)<4?"trackpad":"wheel");const a=i.getView();if(this.mode_==="trackpad"&&!(a.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-s/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=s;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),l),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let i=-ye(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),ph(t,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}}var Fx=VI;class jI extends Kn{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=Fr),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold!==void 0?e.threshold:.3,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){let t=0;const i=this.targetPointers[0],r=this.targetPointers[1],s=Math.atan2(r.clientY-i.clientY,r.clientX-i.clientX);if(this.lastAngle_!==void 0){const c=s-this.lastAngle_;this.rotationDelta_+=c,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=c}this.lastAngle_=s;const o=e.map,a=o.getView();if(a.getConstraints().rotation===dh)return;const l=o.getViewport().getBoundingClientRect(),u=mh(this.targetPointers);u[0]-=l.left,u[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(u),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}else return!1}}var Ox=jI;class XI extends Kn{constructor(e){e=e||{};const t=e;t.stopDown||(t.stopDown=Fr),super(t),this.anchor_=null,this.duration_=e.duration!==void 0?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const i=this.targetPointers[0],r=this.targetPointers[1],s=i.clientX-r.clientX,o=i.clientY-r.clientY,a=Math.sqrt(s*s+o*o);this.lastDistance_!==void 0&&(t=this.lastDistance_/a),this.lastDistance_=a;const l=e.map,u=l.getView();t!=1&&(this.lastScaleDelta_=t);const c=l.getViewport().getBoundingClientRect(),h=mh(this.targetPointers);h[0]-=c.left,h[1]-=c.top,this.anchor_=l.getCoordinateFromPixelInternal(h),l.render(),u.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const i=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,r),!1}else return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}else return!1}}var $x=XI;function hp(n){n=n||{};const e=new St,t=new Ng(-.005,.05,100);return(n.altShiftDragRotate!==void 0?n.altShiftDragRotate:!0)&&e.push(new Cx),(n.doubleClickZoom!==void 0?n.doubleClickZoom:!0)&&e.push(new wx({delta:n.zoomDelta,duration:n.zoomDuration})),(n.dragPan!==void 0?n.dragPan:!0)&&e.push(new Rx({onFocusOnly:n.onFocusOnly,kinetic:t})),(n.pinchRotate!==void 0?n.pinchRotate:!0)&&e.push(new Ox),(n.pinchZoom!==void 0?n.pinchZoom:!0)&&e.push(new $x({duration:n.zoomDuration})),(n.keyboard!==void 0?n.keyboard:!0)&&(e.push(new Px),e.push(new Mx({delta:n.zoomDelta,duration:n.zoomDuration}))),(n.mouseWheelZoom!==void 0?n.mouseWheelZoom:!0)&&e.push(new Fx({onFocusOnly:n.onFocusOnly,duration:n.zoomDuration})),(n.shiftDragZoom!==void 0?n.shiftDragZoom:!0)&&e.push(new Lx({duration:n.zoomDuration})),e}function fp(n,e,t){return t===void 0&&(t=[0,0]),t[0]=n[0]+2*e,t[1]=n[1]+2*e,t}function dp(n){return n[0]>0&&n[1]>0}function wh(n,e,t){return t===void 0&&(t=[0,0]),t[0]=n[0]*e+.5|0,t[1]=n[1]*e+.5|0,t}function tt(n,e){return Array.isArray(n)?n:(e===void 0?e=[n,n]:(e[0]=n,e[1]=n),e)}function Dx(n){if(n instanceof io){n.setMapInternal(null);return}n instanceof Hl&&n.getLayers().forEach(Dx)}function Nx(n,e){if(n instanceof io){n.setMapInternal(e);return}if(n instanceof Hl){const t=n.getLayers().getArray();for(let i=0,r=t.length;i<r;++i)Nx(t[i],e)}}class YI extends Rn{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=ZI(e);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading!==void 0?e.maxTilesLoading:16,this.pixelRatio_=e.pixelRatio!==void 0?e.pixelRatio:Oc,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Le(),this.pixelToCoordinateTransform_=Le(),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_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.controls=t.controls||sp(),this.interactions=t.interactions||hp({onFocusOnly:!0}),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new fh(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(vt.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(vt.VIEW,this.handleViewChanged_),this.addChangeListener(vt.SIZE,this.handleSizeChanged_),this.addChangeListener(vt.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const i=this;e.view&&!(e.view instanceof Fi)&&e.view.then(function(r){i.setView(new Fi(r))}),this.controls.addEventListener(gt.ADD,function(r){r.element.setMap(this)}.bind(this)),this.controls.addEventListener(gt.REMOVE,function(r){r.element.setMap(null)}.bind(this)),this.interactions.addEventListener(gt.ADD,function(r){r.element.setMap(this)}.bind(this)),this.interactions.addEventListener(gt.REMOVE,function(r){r.element.setMap(null)}.bind(this)),this.overlays_.addEventListener(gt.ADD,function(r){this.addOverlayInternal_(r.element)}.bind(this)),this.overlays_.addEventListener(gt.REMOVE,function(r){const s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}.bind(this)),this.controls.forEach(function(r){r.setMap(this)}.bind(this)),this.interactions.forEach(function(r){r.setMap(this)}.bind(this)),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){Nx(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,i){if(!this.frameState_||!this.renderer_)return;const r=this.getCoordinateFromPixelInternal(e);i=i!==void 0?i:{};const s=i.hitTolerance!==void 0?i.hitTolerance:0,o=i.layerFilter!==void 0?i.layerFilter:kn,a=i.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){const i=[];return this.forEachFeatureAtPixel(e,function(r){i.push(r)},t),i}getAllLayers(){const e=[];function t(i){i.forEach(function(r){r instanceof Hl?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};const r=t.layerFilter!==void 0?t.layerFilter:kn,s=t.hitTolerance!==void 0?t.hitTolerance:0,o=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,s,o,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const t=this.viewport_.getBoundingClientRect(),i="changedTouches"in e?e.changedTouches[0]:e;return[i.clientX-t.left,i.clientY-t.top]}getTarget(){return this.get(vt.TARGET)}getTargetElement(){const e=this.getTarget();return e!==void 0?typeof e=="string"?document.getElementById(e):e:null}getCoordinateFromPixel(e){return Yr(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?ke(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(vt.LAYERGROUP)}setLayers(e){const t=this.getLayerGroup();if(e instanceof St){t.setLayers(e);return}const i=t.getLayers();i.clear(),i.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,i=e.length;t<i;++t){const r=e[t];if(!r.visible)continue;const s=r.layer.getRenderer();if(s&&!s.ready)return!0;const o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){const t=Qe(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?ke(t.coordinateToPixelTransform,e.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(vt.SIZE)}getView(){return this.get(vt.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,i,r){return lx(this.frameState_,e,t,i,r)}handleBrowserEvent(e,t){t=t||e.type;const i=new gi(t,this,e);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,i=t.type;if(i===pi.POINTERDOWN||i===K.WHEEL||i===K.KEYDOWN){const r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target;if(this.overlayContainerStopEvent_.contains(o)||!(s===r?r.documentElement:s).contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){const r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){const o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r;if(e){const o=e.viewHints;if(o[Ye.ANIMATING]||o[Ye.INTERACTING]){const a=Date.now()-e.time>8;r=a?0:8,s=a?0:2}}t.getTilesLoading()<r&&(t.reprioritize(),t.loadMoreTiles(r,s))}e&&this.renderer_&&!e.animate&&(this.renderComplete_===!0?(this.hasListener(nn.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(nn.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Qr(Hn.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Qr(Hn.LOADSTART,this,e))));const i=this.postRenderFunctions_;for(let r=0,s=i.length;r<s;++r)i[r](this,e);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let t=0,i=this.targetChangeHandlerKeys_.length;t<i;++t)Pe(this.targetChangeHandlerKeys_[t]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(K.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(K.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,zl(this.viewport_)}const e=this.getTargetElement();if(!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 ox(this)),this.mapBrowserEventHandler_=new Kg(this,this.moveTolerance_);for(const r in Ie)this.mapBrowserEventHandler_.addEventListener(Ie[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(K.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(K.WHEEL,this.boundHandleBrowserEvent_,qd?{passive:!1}:!1);const t=this.getOwnerDocument().defaultView,i=this.keyboardEventTarget_?this.keyboardEventTarget_:e;this.targetChangeHandlerKeys_=[re(i,K.KEYDOWN,this.handleBrowserEvent,this),re(i,K.KEYPRESS,this.handleBrowserEvent,this),re(t,K.RESIZE,this.updateSize,this)]}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(Pe(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(Pe(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(),this.viewPropertyListenerKey_=re(e,Mr.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=re(e,K.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(Pe),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new or("addlayer",e)),this.layerGroupPropertyListenerKeys_=[re(e,Mr.PROPERTYCHANGE,this.render,this),re(e,K.CHANGE,this.render,this),re(e,"addlayer",this.handleLayerAdd_,this),re(e,"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(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,i=e.length;t<i;++t){const r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){Dx(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),i=this.getView(),r=this.frameState_;let s=null;if(t!==void 0&&dp(t)&&i&&i.isDef()){const o=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=i.getState();if(s={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:Ys(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:H(this),renderTargets:{}},a.nextCenter&&a.nextResolution){const l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=Ys(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!Vr(this.previousExtent_)&&!In(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Qr(Hn.MOVESTART,this,r)),this.previousExtent_=zr(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Ye.ANIMATING]&&!s.viewHints[Ye.INTERACTING]&&!In(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Qr(Hn.MOVEEND,this,s)),eg(s.extent,this.previousExtent_))),this.dispatchEvent(new Qr(Hn.POSTRENDER,this,s)),this.renderComplete_=this.hasListener(Hn.LOADSTART)||this.hasListener(Hn.LOADEND)||this.hasListener(nn.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new or("removelayer",t)),this.set(vt.LAYERGROUP,e)}setSize(e){this.set(vt.SIZE,e)}setTarget(e){this.set(vt.TARGET,e)}setView(e){if(!e||e instanceof Fi){this.set(vt.VIEW,e);return}this.set(vt.VIEW,new Fi);const t=this;e.then(function(i){t.setView(new Fi(i))})}updateSize(){const e=this.getTargetElement();let t;if(e){const i=getComputedStyle(e),r=e.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),s=e.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);!isNaN(r)&&!isNaN(s)&&(t=[r,s],!dp(t)&&!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}this.setSize(t),this.updateViewportSize_()}updateViewportSize_(){const e=this.getView();if(e){let t;const i=getComputedStyle(this.viewport_);i.width&&i.height&&(t=[parseInt(i.width,10),parseInt(i.height,10)]),e.setViewportSize(t)}}}function ZI(n){let e=null;n.keyboardEventTarget!==void 0&&(e=typeof n.keyboardEventTarget=="string"?document.getElementById(n.keyboardEventTarget):n.keyboardEventTarget);const t={},i=n.layers&&typeof n.layers.getLayers=="function"?n.layers:new Hl({layers:n.layers});t[vt.LAYERGROUP]=i,t[vt.TARGET]=n.target,t[vt.VIEW]=n.view instanceof Fi?n.view:new Fi;let r;n.controls!==void 0&&(Array.isArray(n.controls)?r=new St(n.controls.slice()):(ne(typeof n.controls.getArray=="function",47),r=n.controls));let s;n.interactions!==void 0&&(Array.isArray(n.interactions)?s=new St(n.interactions.slice()):(ne(typeof n.interactions.getArray=="function",48),s=n.interactions));let o;return n.overlays!==void 0?Array.isArray(n.overlays)?o=new St(n.overlays.slice()):(ne(typeof n.overlays.getArray=="function",49),o=n.overlays):o=new St,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var gp=YI;const rn={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class WI extends Rn{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=e.insertFirst!==void 0?e.insertFirst:!0,this.stopEvent=e.stopEvent!==void 0?e.stopEvent:!0,this.element=document.createElement("div"),this.element.className=e.className!==void 0?e.className:"ol-overlay-container "+ex,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=e.autoPan===!0?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(rn.ELEMENT,this.handleElementChanged),this.addChangeListener(rn.MAP,this.handleMapChanged),this.addChangeListener(rn.OFFSET,this.handleOffsetChanged),this.addChangeListener(rn.POSITION,this.handlePositionChanged),this.addChangeListener(rn.POSITIONING,this.handlePositioningChanged),e.element!==void 0&&this.setElement(e.element),this.setOffset(e.offset!==void 0?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),e.position!==void 0&&this.setPosition(e.position)}getElement(){return this.get(rn.ELEMENT)}getId(){return this.id}getMap(){return this.get(rn.MAP)||null}getOffset(){return this.get(rn.OFFSET)}getPosition(){return this.get(rn.POSITION)}getPositioning(){return this.get(rn.POSITIONING)}handleElementChanged(){Dg(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(zl(this.element),Pe(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=re(e,Hn.POSTRENDER,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(rn.ELEMENT,e)}setMap(e){this.set(rn.MAP,e)}setOffset(e){this.set(rn.OFFSET,e)}setPosition(e){this.set(rn.POSITION,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(rn.POSITION))return;const i=this.getRect(t.getTargetElement(),t.getSize()),r=this.getElement(),s=this.getRect(r,[jv(r),Xv(r)]);e=e||{};const o=e.margin===void 0?20:e.margin;if(!Mt(i,s)){const a=s[0]-i[0],l=i[2]-s[2],u=s[1]-i[1],c=i[3]-s[3],h=[0,0];if(a<0?h[0]=a-o:l<0&&(h[0]=Math.abs(l)+o),u<0?h[1]=u-o:c<0&&(h[1]=Math.abs(c)+o),h[0]!==0||h[1]!==0){const f=t.getView().getCenterInternal(),d=t.getPixelFromCoordinateInternal(f);if(!d)return;const g=[d[0]+h[0],d[1]+h[1]],m=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(g),duration:m.duration,easing:m.easing})}}}getRect(e,t){const i=e.getBoundingClientRect(),r=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[r,s,r+t[0],s+t[1]]}setPositioning(e){this.set(rn.POSITIONING,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t){this.setVisible(!1);return}const i=e.getPixelFromCoordinate(t),r=e.getSize();this.updateRenderedPosition(i,r)}updateRenderedPosition(e,t){const i=this.element.style,r=this.getOffset(),s=this.getPositioning();this.setVisible(!0);const o=Math.round(e[0]+r[0])+"px",a=Math.round(e[1]+r[1])+"px";let l="0%",u="0%";s=="bottom-right"||s=="center-right"||s=="top-right"?l="-100%":(s=="bottom-center"||s=="center-center"||s=="top-center")&&(l="-50%"),s=="bottom-left"||s=="bottom-center"||s=="bottom-right"?u="-100%":(s=="center-left"||s=="center-center"||s=="center-right")&&(u="-50%");const c=`translate(${l}, ${u}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}var pp=WI;class HI{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const i=this.entries_[e];return ne(i!==void 0,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(e){const t=this.entries_[e];return ne(t!==void 0,15),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.key_;return e}getValues(){const e=new Array(this.count_);let t=0,i;for(i=this.newest_;i;i=i.older)e[t++]=i.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){if(!!this.containsKey(e))return this.entries_[e].value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){ne(!(e in this.entries_),16);const i={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[e]=i,++this.count_}setSize(e){this.highWaterMark=e}}var Th=HI;function _a(n,e,t,i){return i!==void 0?(i[0]=n,i[1]=e,i[2]=t,i):[n,e,t]}function $i(n,e,t){return n+"/"+e+"/"+t}function ya(n){return $i(n[0],n[1],n[2])}function kx(n){const[e,t,i]=n.substring(n.lastIndexOf("/")+1,n.length).split(",").map(Number);return $i(e,t,i)}function mp(n){return n.split("/").map(Number)}function Sh(n){return(n[1]<<n[0])+n[2]}function Gx(n,e){const t=n[0],i=n[1],r=n[2];if(e.getMinZoom()>t||t>e.getMaxZoom())return!1;const s=e.getFullTileRange(t);return s?s.containsXY(i,r):!0}class KI extends Th{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(e){for(;this.canExpireCache()&&!(this.peekLast().getKey()in e);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const e=this.peekFirstKey(),i=mp(e)[0];this.forEach(function(r){r.tileCoord[0]!==i&&(this.remove(ya(r.tileCoord)),r.release())}.bind(this))}}var Ql=KI;class Ux{constructor(e,t,i,r){this.minX=e,this.maxX=t,this.minY=i,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function lo(n,e,t,i,r){return r!==void 0?(r.minX=n,r.maxX=e,r.minY=t,r.maxY=i,r):new Ux(n,e,t,i)}var eu=Ux;const Bx=[];class qI extends Nr{constructor(e,t,i,r){super(e,t,{transition:0}),this.context_={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=r.bind(void 0,this),this.wrappedTileCoord=i}getContext(e){const t=H(e);return t in this.context_||(this.context_[t]=yt(1,1,Bx)),this.context_[t]}hasContext(e){return H(e)in this.context_}getImage(e){return this.hasContext(e)?this.getContext(e).canvas:null}getReplayState(e){const t=H(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){for(const e in this.context_){const t=this.context_[e];uh(t),Bx.push(t.canvas),delete this.context_[e]}super.release()}}var _p=qI;class JI extends Nr{constructor(e,t,i,r,s,o){super(e,t,o),this.extent=null,this.format_=r,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=s,this.url_=i,this.key=i}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==V.IDLE&&(this.setState(V.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(V.ERROR)}setFeatures(e){this.features_=e,this.setState(V.LOADED)}setLoader(e){this.loader_=e}}var yp=JI;function mi(n){return Array.isArray(n)?Bg(n):n}const zx=["fullscreenchange","webkitfullscreenchange","MSFullscreenChange"],Vx={ENTERFULLSCREEN:"enterfullscreen",LEAVEFULLSCREEN:"leavefullscreen"};class QI extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target}),this.on,this.once,this.un,this.keys_=e.keys!==void 0?e.keys:!1,this.source_=e.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=e.className!==void 0?e.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=e.activeClassName!==void 0?e.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=e.inactiveClassName!==void 0?e.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const t=e.label!==void 0?e.label:"\u2922";this.labelNode_=typeof t=="string"?document.createTextNode(t):t;const i=e.labelActive!==void 0?e.labelActive:"\xD7";this.labelActiveNode_=typeof i=="string"?document.createTextNode(i):i;const r=e.tipLabel?e.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=r,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(K.CLICK,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${fi} ${qr}`,this.element.appendChild(this.button_)}handleClick_(e){e.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const e=this.getMap();if(!e)return;const t=e.getOwnerDocument();if(!!jx(t))if(Xx(t))t2(t);else{let i;this.source_?i=typeof this.source_=="string"?t.getElementById(this.source_):this.source_:i=e.getTargetElement(),this.keys_?e2(i):Yx(i)}}handleFullScreenChange_(){const e=this.getMap();if(!e)return;const t=this.isInFullscreen_;this.isInFullscreen_=Xx(e.getOwnerDocument()),t!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(to(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(Vx.ENTERFULLSCREEN)):(to(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(Vx.LEAVEFULLSCREEN)),e.updateSize())}setClassName_(e,t){t?(e.classList.remove(...this.inactiveClassName_),e.classList.add(...this.activeClassName_)):(e.classList.remove(...this.activeClassName_),e.classList.add(...this.inactiveClassName_))}setMap(e){const t=this.getMap();t&&t.removeChangeListener(vt.TARGET,this.boundHandleMapTargetChange_),super.setMap(e),this.handleMapTargetChange_(),e&&e.addChangeListener(vt.TARGET,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const e=this.documentListeners_;for(let i=0,r=e.length;i<r;++i)Pe(e[i]);e.length=0;const t=this.getMap();if(t){const i=t.getOwnerDocument();jx(i)?this.element.classList.remove(Vg):this.element.classList.add(Vg);for(let r=0,s=zx.length;r<s;++r)e.push(re(i,zx[r],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}function jx(n){const e=n.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&n.fullscreenEnabled)}function Xx(n){return!!(n.webkitIsFullScreen||n.fullscreenElement)}function Yx(n){n.requestFullscreen?n.requestFullscreen():n.webkitRequestFullscreen&&n.webkitRequestFullscreen()}function e2(n){n.webkitRequestFullscreen?n.webkitRequestFullscreen():Yx(n)}function t2(n){n.exitFullscreen?n.exitFullscreen():n.webkitExitFullscreen&&n.webkitExitFullscreen()}var n2=QI;const vp="projection",Zx="coordinateFormat";class i2 extends Oi{constructor(e){e=e||{};const t=document.createElement("div");t.className=e.className!==void 0?e.className:"ol-mouse-position",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un,this.addChangeListener(vp,this.handleProjectionChanged_),e.coordinateFormat&&this.setCoordinateFormat(e.coordinateFormat),e.projection&&this.setProjection(e.projection),this.renderOnMouseOut_=e.placeholder!==void 0,this.placeholder_=this.renderOnMouseOut_?e.placeholder:" ",this.renderedHTML_=t.innerHTML,this.mapProjection_=null,this.transform_=null}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(Zx)}getProjection(){return this.get(vp)}handleMouseMove(e){const t=this.getMap();this.updateHTML_(t.getEventPixel(e))}handleMouseOut(e){this.updateHTML_(null)}setMap(e){if(super.setMap(e),e){const t=e.getViewport();this.listenerKeys.push(re(t,pi.POINTERMOVE,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(re(t,pi.POINTEROUT,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(e){this.set(Zx,e)}setProjection(e){this.set(vp,J(e))}updateHTML_(e){let t=this.placeholder_;if(e&&this.mapProjection_){if(!this.transform_){const s=this.getProjection();s?this.transform_=Un(this.mapProjection_,s):this.transform_=Ol}const r=this.getMap().getCoordinateFromPixelInternal(e);if(r){const s=Ht();s&&(this.transform_=Un(this.mapProjection_,s)),this.transform_(r,r);const o=this.getCoordinateFormat();o?t=o(r):t=r.toString()}}(!this.renderedHTML_||t!==this.renderedHTML_)&&(this.element.innerHTML=t,this.renderedHTML_=t)}render(e){const t=e.frameState;t?this.mapProjection_!=t.viewState.projection&&(this.mapProjection_=t.viewState.projection,this.transform_=null):this.mapProjection_=null}}var r2=i2;const xp=.75,bh=.1;class s2 extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.boundHandleRotationChanged_=this.handleRotationChanged_.bind(this),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.rotateWithView_=e.rotateWithView!==void 0?e.rotateWithView:!1,this.viewExtent_=void 0;const t=e.className!==void 0?e.className:"ol-overviewmap",i=e.tipLabel!==void 0?e.tipLabel:"Overview map",r=e.collapseLabel!==void 0?e.collapseLabel:"\u2039";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r):this.collapseLabel_=r;const s=e.label!==void 0?e.label:"\u203A";typeof s=="string"?(this.label_=document.createElement("span"),this.label_.textContent=s):this.label_=s;const o=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,a=document.createElement("button");a.setAttribute("type","button"),a.title=i,a.appendChild(o),a.addEventListener(K.CLICK,this.handleClick_.bind(this),!1),this.ovmapDiv_=document.createElement("div"),this.ovmapDiv_.className="ol-overviewmap-map",this.view_=e.view;const l=new gp({view:e.view,controls:new St,interactions:new St});this.ovmap_=l,e.layers&&e.layers.forEach(function(v){l.addLayer(v)});const u=document.createElement("div");u.className="ol-overviewmap-box",u.style.boxSizing="border-box",this.boxOverlay_=new pp({position:[0,0],positioning:"center-center",element:u}),this.ovmap_.addOverlay(this.boxOverlay_);const c=t+" "+fi+" "+qr+(this.collapsed_&&this.collapsible_?" "+Xl:"")+(this.collapsible_?"":" ol-uncollapsible"),h=this.element;h.className=c,h.appendChild(this.ovmapDiv_),h.appendChild(a);const f=this,d=this.boxOverlay_,g=this.boxOverlay_.getElement(),m=function(v){return{clientX:v.clientX,clientY:v.clientY}},p=function(v){const x=m(v),y=l.getEventCoordinateInternal(x);d.setPosition(y)},_=function(v){const x=l.getEventCoordinateInternal(v);f.getMap().getView().setCenterInternal(x),window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",_)};g.addEventListener("mousedown",function(){window.addEventListener("mousemove",p),window.addEventListener("mouseup",_)})}setMap(e){const t=this.getMap();if(e!==t){if(t){const i=t.getView();i&&this.unbindView_(i),this.ovmap_.setTarget(null)}if(super.setMap(e),e){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(re(e,Mr.PROPERTYCHANGE,this.handleMapPropertyChange_,this));const i=e.getView();i&&(this.bindView_(i),i.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_())),this.ovmap_.isRendered()||this.updateBoxAfterOvmapIsRendered_()}}}handleMapPropertyChange_(e){if(e.key===vt.VIEW){const t=e.oldValue;t&&this.unbindView_(t);const i=this.getMap().getView();this.bindView_(i)}else!this.ovmap_.isRendered()&&(e.key===vt.TARGET||e.key===vt.SIZE)&&this.ovmap_.updateSize()}bindView_(e){if(!this.view_){const t=new Fi({projection:e.getProjection()});this.ovmap_.setView(t)}e.addChangeListener(Ln.ROTATION,this.boundHandleRotationChanged_),this.handleRotationChanged_()}unbindView_(e){e.removeChangeListener(Ln.ROTATION,this.boundHandleRotationChanged_)}handleRotationChanged_(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())}validateExtent_(){const e=this.getMap(),t=this.ovmap_;if(!e.isRendered()||!t.isRendered())return;const i=e.getSize(),s=e.getView().calculateExtentInternal(i);if(this.viewExtent_&&In(s,this.viewExtent_))return;this.viewExtent_=s;const o=t.getSize(),l=t.getView().calculateExtentInternal(o),u=t.getPixelFromCoordinateInternal(Xn(s)),c=t.getPixelFromCoordinateInternal(Xs(s)),h=Math.abs(u[0]-c[0]),f=Math.abs(u[1]-c[1]),d=o[0],g=o[1];h<d*bh||f<g*bh||h>d*xp||f>g*xp?this.resetExtent_():Mt(l,s)||this.recenter_()}resetExtent_(){const e=this.getMap(),t=this.ovmap_,i=e.getSize(),s=e.getView().calculateExtentInternal(i),o=t.getView(),a=Math.log(xp/bh)/Math.LN2,l=1/(Math.pow(2,a/2)*bh);Il(s,l),o.fitInternal(eo(s))}recenter_(){const e=this.getMap(),t=this.ovmap_,i=e.getView();t.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const e=this.getMap(),t=this.ovmap_;if(!e.isRendered()||!t.isRendered())return;const i=e.getSize(),r=e.getView(),s=t.getView(),o=this.rotateWithView_?0:-r.getRotation(),a=this.boxOverlay_,l=this.boxOverlay_.getElement(),u=r.getCenterInternal(),c=r.getResolution(),h=s.getResolution(),f=i[0]*c/h,d=i[1]*c/h;if(a.setPosition(u),l){l.style.width=f+"px",l.style.height=d+"px";const g="rotate("+o+"rad)";l.style.transform=g}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=Us(this.ovmap_,Hn.POSTRENDER,function(e){delete this.ovmapPostrenderKey_,this.updateBox_()},this))}handleClick_(e){e.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(Xl),this.collapsed_?to(this.collapseLabel_,this.label_):to(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const e=this.ovmap_;if(!this.collapsed_){if(e.isRendered()){this.viewExtent_=void 0,e.render();return}e.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),!e&&this.collapsed_&&this.handleToggle_())}setCollapsed(e){!this.collapsible_||this.collapsed_===e||this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(e){this.rotateWithView_!==e&&(this.rotateWithView_=e,this.getMap().getView().getRotation()!==0&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(e){this.validateExtent_(),this.updateBox_()}}var o2=s2;const Ep="units",a2=[1,2,5],tu=25.4/.28;class l2 extends Oi{constructor(e){e=e||{};const t=document.createElement("div");t.style.pointerEvents="none",super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;const i=e.className!==void 0?e.className:e.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+fi,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth!==void 0?e.minWidth:64,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(Ep,this.handleUnitsChanged_),this.setUnits(e.units||"metric"),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(Ep)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(Ep,e)}setDpi(e){this.dpi_=e}updateElement_(){const e=this.viewState_;if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const t=e.center,i=e.projection,r=this.getUnits(),s=r=="degrees"?"degrees":"m";let o=$l(i,e.resolution,t,s);const a=this.minWidth_*(this.dpi_||tu)/tu,l=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||tu)/tu:void 0;let u=a*o,c="";if(r=="degrees"){const x=Yn.degrees;u*=x,u<x/60?(c="\u2033",o*=3600):u<x?(c="\u2032",o*=60):c="\xB0"}else r=="imperial"?u<.9144?(c="in",o/=.0254):u<1609.344?(c="ft",o/=.3048):(c="mi",o/=1609.344):r=="nautical"?(o/=1852,c="NM"):r=="metric"?u<.001?(c="\u03BCm",o*=1e6):u<1?(c="mm",o*=1e3):u<1e3?c="m":(c="km",o/=1e3):r=="us"?u<.9144?(c="in",o*=39.37):u<1609.344?(c="ft",o/=.30480061):(c="mi",o/=1609.3472):ne(!1,33);let h=3*Math.floor(Math.log(a*o)/Math.log(10)),f,d,g,m,p,_;for(;;){g=Math.floor(h/3);const x=Math.pow(10,g);if(f=a2[(h%3+3)%3]*x,d=Math.round(f/o),isNaN(d)){this.element.style.display="none",this.renderedVisible_=!1;return}if(l!==void 0&&d>=l){f=m,d=p,g=_;break}else if(d>=a)break;m=f,p=d,_=g,++h}const v=this.scaleBar_?this.createScaleBar(d,f,c):f.toFixed(g<0?-g:0)+" "+c;this.renderedHTML_!=v&&(this.innerElement_.innerHTML=v,this.renderedHTML_=v),this.renderedWidth_!=d&&(this.innerElement_.style.width=d+"px",this.renderedWidth_=d),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(e,t,i){const r=this.getScaleForResolution(),s=r<1?Math.round(1/r).toLocaleString()+" : 1":"1 : "+Math.round(r).toLocaleString(),o=this.scaleBarSteps_,a=e/o,l=[this.createMarker("absolute")];for(let c=0;c<o;++c){const h=c%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";l.push(`<div><div class="ol-scale-singlebar ${h}" style="width: ${a}px;"></div>`+this.createMarker("relative")+(c%2===0||o===2?this.createStepText(c,e,!1,t,i):"")+"</div>")}return l.push(this.createStepText(o,e,!0,t,i)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+s+"</div>":"")+l.join("")}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e==="absolute"?3:-10}px;"></div>`}createStepText(e,t,i,r,s){const a=(e===0?0:Math.round(r/this.scaleBarSteps_*e*100)/100)+(e===0?"":" "+s),l=e===0?-3:t/this.scaleBarSteps_*-1,u=e===0?0:t/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${l}px;text-align: ${e===0?"left":"center"};min-width: ${u}px;left: ${i?t+"px":"unset"};">`+a+"</div>"}getScaleForResolution(){const e=$l(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),t=this.dpi_||tu,i=1e3/25.4;return e*i*t}render(e){const t=e.frameState;t?this.viewState_=t.viewState:this.viewState_=null,this.updateElement_()}}var u2=l2;const nu={VERTICAL:0,HORIZONTAL:1};class c2 extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=nu.VERTICAL,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=e.duration!==void 0?e.duration:200;const t=e.className!==void 0?e.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=t+"-thumb "+fi;const r=this.element;r.className=t+" "+fi+" "+qr,r.appendChild(i),r.addEventListener(pi.POINTERDOWN,this.handleDraggerStart_.bind(this),!1),r.addEventListener(pi.POINTERMOVE,this.handleDraggerDrag_.bind(this),!1),r.addEventListener(pi.POINTERUP,this.handleDraggerEnd_.bind(this),!1),r.addEventListener(K.CLICK,this.handleContainerClick_.bind(this),!1),i.addEventListener(K.CLICK,Ay,!1)}setMap(e){super.setMap(e),e&&e.render()}initSlider_(){const e=this.element;let t=e.offsetWidth,i=e.offsetHeight;if(t===0&&i===0)return this.sliderInitialized_=!1;const r=getComputedStyle(e);t-=parseFloat(r.paddingRight)+parseFloat(r.paddingLeft),i-=parseFloat(r.paddingTop)+parseFloat(r.paddingBottom);const s=e.firstElementChild,o=getComputedStyle(s),a=s.offsetWidth+parseFloat(o.marginRight)+parseFloat(o.marginLeft),l=s.offsetHeight+parseFloat(o.marginTop)+parseFloat(o.marginBottom);return this.thumbSize_=[a,l],t>i?(this.direction_=nu.HORIZONTAL,this.widthLimit_=t-a):(this.direction_=nu.VERTICAL,this.heightLimit_=i-l),this.sliderInitialized_=!0}handleContainerClick_(e){const t=this.getMap().getView(),i=this.getRelativePosition_(e.offsetX-this.thumbSize_[0]/2,e.offsetY-this.thumbSize_[1]/2),r=this.getResolutionForPosition_(i),s=t.getConstrainedZoom(t.getZoomForResolution(r));t.animateInternal({zoom:s,duration:this.duration_,easing:Dr})}handleDraggerStart_(e){if(!this.dragging_&&e.target===this.element.firstElementChild){const t=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=e.clientX-parseFloat(t.style.left),this.startY_=e.clientY-parseFloat(t.style.top),this.dragging_=!0,this.dragListenerKeys_.length===0){const i=this.handleDraggerDrag_,r=this.handleDraggerEnd_,s=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(re(s,pi.POINTERMOVE,i,this),re(s,pi.POINTERUP,r,this))}}}handleDraggerDrag_(e){if(this.dragging_){const t=e.clientX-this.startX_,i=e.clientY-this.startY_,r=this.getRelativePosition_(t,i);this.currentResolution_=this.getResolutionForPosition_(r),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(e){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(Pe),this.dragListenerKeys_.length=0)}setThumbPosition_(e){const t=this.getPositionForResolution_(e),i=this.element.firstElementChild;this.direction_==nu.HORIZONTAL?i.style.left=this.widthLimit_*t+"px":i.style.top=this.heightLimit_*t+"px"}getRelativePosition_(e,t){let i;return this.direction_===nu.HORIZONTAL?i=e/this.widthLimit_:i=t/this.heightLimit_,ye(i,0,1)}getResolutionForPosition_(e){return this.getMap().getView().getResolutionForValueFunction()(1-e)}getPositionForResolution_(e){const t=this.getMap().getView().getValueForResolutionFunction();return ye(1-t(e),0,1)}render(e){if(!e.frameState||!this.sliderInitialized_&&!this.initSlider_())return;const t=e.frameState.viewState.resolution;this.currentResolution_=t,this.setThumbPosition_(t)}}var h2=c2;class f2 extends Oi{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target}),this.extent=e.extent?e.extent:null;const t=e.className!==void 0?e.className:"ol-zoom-extent",i=e.label!==void 0?e.label:"E",r=e.tipLabel!==void 0?e.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=r,s.appendChild(typeof i=="string"?document.createTextNode(i):i),s.addEventListener(K.CLICK,this.handleClick_.bind(this),!1);const o=t+" "+fi+" "+qr,a=this.element;a.className=o,a.appendChild(s)}handleClick_(e){e.preventDefault(),this.handleZoomToExtent()}handleZoomToExtent(){const t=this.getMap().getView(),i=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(eo(i))}}var d2=f2;let Wx=!1;function wp(n,e,t,i,r,s,o){const a=new XMLHttpRequest;a.open("GET",typeof n=="function"?n(t,i,r):n,!0),e.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Wx,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const u=e.getType();let c;u=="json"||u=="text"?c=a.responseText:u=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):u=="arraybuffer"&&(c=a.response),c?s(e.readFeatures(c,{extent:t,featureProjection:r}),e.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function Tp(n,e){return function(t,i,r,s,o){const a=this;wp(n,e,t,i,r,function(l,u){a.addFeatures(l),s!==void 0&&s(l)},o||Or)}}function g2(n){Wx=n}class p2{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let i=t.dataProjection?J(t.dataProjection):this.readProjection(e);t.extent&&i&&i.getUnits()==="tile-pixels"&&(i=J(i),i.setWorldExtent(t.extent)),t={dataProjection:i,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},e)}getType(){return ae()}readFeature(e,t){return ae()}readFeatures(e,t){return ae()}readGeometry(e,t){return ae()}readProjection(e){return ae()}writeFeature(e,t){return ae()}writeFeatures(e,t){return ae()}writeGeometry(e,t){return ae()}}var va=p2;function nt(n,e,t){const i=t?J(t.featureProjection):null,r=t?J(t.dataProjection):null;let s;if(i&&r&&!fn(i,r)?s=(e?n.clone():n).transform(e?i:r,e?r:i):s=n,e&&t&&t.decimals!==void 0){const o=Math.pow(10,t.decimals),a=function(l){for(let u=0,c=l.length;u<c;++u)l[u]=Math.round(l[u]*o)/o;return l};s===n&&(s=n.clone()),s.applyTransform(a)}return s}function Rh(n,e){const t=e?J(e.featureProjection):null,i=e?J(e.dataProjection):null;return t&&i&&!fn(t,i)?ia(n,i,t):n}class m2 extends va{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(Ch(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(Ch(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return ae()}readFeaturesFromObject(e,t){return ae()}readGeometry(e,t){return this.readGeometryFromObject(Ch(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return ae()}readProjection(e){return this.readProjectionFromObject(Ch(e))}readProjectionFromObject(e){return ae()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return ae()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return ae()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return ae()}}function Ch(n){if(typeof n=="string"){const e=JSON.parse(n);return e||null}else return n!==null?n:null}var Ih=m2;function iu(n,e,t,i,r,s,o){let a,l;const u=(t-e)/i;if(u===1)a=e;else if(u===2)a=e,l=r;else if(u!==0){let c=n[e],h=n[e+1],f=0;const d=[0];for(let p=e+i;p<t;p+=i){const _=n[p],v=n[p+1];f+=Math.sqrt((_-c)*(_-c)+(v-h)*(v-h)),d.push(f),c=_,h=v}const g=r*f,m=Ly(d,g);m<0?(l=(g-d[-m-2])/(d[-m-1]-d[-m-2]),a=e+(-m-2)*i):a=e+m*i}o=o>1?o:2,s=s||new Array(o);for(let c=0;c<o;++c)s[c]=a===void 0?NaN:l===void 0?n[a+c]:Li(n[a+c],n[a+i+c],l);return s}function Ah(n,e,t,i,r,s){if(t==e)return null;let o;if(r<n[e+i-1])return s?(o=n.slice(e,e+i),o[i-1]=r,o):null;if(n[t-1]<r)return s?(o=n.slice(t-i,t),o[i-1]=r,o):null;if(r==n[e+i-1])return n.slice(e,e+i);let a=e/i,l=t/i;for(;a<l;){const f=a+l>>1;r<n[(f+1)*i-1]?l=f:a=f+1}const u=n[a*i-1];if(r==u)return n.slice((a-1)*i,(a-1)*i+i);const c=n[(a+1)*i-1],h=(r-u)/(c-u);o=[];for(let f=0;f<i-1;++f)o.push(Li(n[(a-1)*i+f],n[a*i+f],h));return o.push(r),o}function Hx(n,e,t,i,r,s,o){if(o)return Ah(n,e,t[t.length-1],i,r,s);let a;if(r<n[i-1])return s?(a=n.slice(0,i),a[i-1]=r,a):null;if(n[n.length-1]<r)return s?(a=n.slice(n.length-i),a[i-1]=r,a):null;for(let l=0,u=t.length;l<u;++l){const c=t[l];if(e!=c){if(r<n[e+i-1])return null;if(r<=n[c-1])return Ah(n,e,c,i,r,!1);e=c}}return null}function Lh(n,e,t,i){let r=n[e],s=n[e+1],o=0;for(let a=e+i;a<t;a+=i){const l=n[a],u=n[a+1];o+=Math.sqrt((l-r)*(l-r)+(u-s)*(u-s)),r=l,s=u}return o}function _2(n,e,t,i){let r=Lh(n,e,t,i);const s=n[t-i]-n[e],o=n[t-i+1]-n[e+1];return r+=Math.sqrt(s*s+o*o),r}class Ad extends hi{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){this.flatCoordinates?Oe(this.flatCoordinates,e):this.flatCoordinates=e.slice(),this.changed()}clone(){const e=new Ad(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,r){return r<Br(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),eh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,i,r))}forEachSegment(e){return Ag(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!="XYM"&&this.layout!="XYZM"?null:(t=t!==void 0?t:!1,Ah(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return iu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Lh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(e){const t=[];return t.length=Dl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new Ad(t,"XY")}getType(){return"LineString"}intersectsExtent(e){return Nl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sa(this.flatCoordinates,0,e,this.stride),this.changed()}}var lt=Ad;class Ld extends hi{constructor(e,t,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&i)this.setFlatCoordinates(t,e),this.ends_=i;else{let r=this.getLayout();const s=e,o=[],a=[];for(let l=0,u=s.length;l<u;++l){const c=s[l];l===0&&(r=c.getLayout()),Oe(o,c.getFlatCoordinates()),a.push(o.length)}this.setFlatCoordinates(r,o),this.ends_=a}}appendLineString(e){this.flatCoordinates?Oe(this.flatCoordinates,e.getFlatCoordinates().slice()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const e=new Ld(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,i,r){return r<Br(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Qc(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),th(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,i,r))}getCoordinateAtM(e,t,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(t=t!==void 0?t:!1,i=i!==void 0?i:!1,Hx(this.flatCoordinates,0,this.ends_,this.stride,e,t,i))}getCoordinates(){return oa(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new lt(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,i=this.layout,r=[];let s=0;for(let o=0,a=t.length;o<a;++o){const l=t[o],u=new lt(e.slice(s,l),i);r.push(u),s=l}return r}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let i=0;const r=this.ends_,s=this.stride;for(let o=0,a=r.length;o<a;++o){const l=r[o],u=iu(t,i,l,s,.5);Oe(e,u),i=l}return e}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=bg(this.flatCoordinates,0,this.ends_,this.stride,e,t,0,i),new Ld(t,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(e){return kv(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=nh(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}var gn=Ld;class sy extends hi{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){this.flatCoordinates?Oe(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.changed()}clone(){const e=new sy(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,r){if(r<Br(this.getExtent(),e,t))return r;const s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){const u=li(e,t,s[a],s[a+1]);if(u<r){r=u;for(let c=0;c<o;++c)i[c]=s[a+c];i.length=o}}return r}getCoordinates(){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return e<0||t<=e?null:new st(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,i=this.stride,r=[];for(let s=0,o=e.length;s<o;s+=i){const a=new st(e.slice(s,s+i),t);r.push(a)}return r}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,i=this.stride;for(let r=0,s=t.length;r<s;r+=i){const o=t[r],a=t[r+1];if(Dc(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sa(this.flatCoordinates,0,e,this.stride),this.changed()}}var qn=sy;function Sp(n,e,t,i){const r=[];let s=Ft();for(let o=0,a=t.length;o<a;++o){const l=t[o];s=kc(n,e,l[0],i),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),e=l[l.length-1]}return r}class Pd extends hi{constructor(e,t,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(e[0])){let r=this.getLayout();const s=e,o=[],a=[];for(let l=0,u=s.length;l<u;++l){const c=s[l];l===0&&(r=c.getLayout());const h=o.length,f=c.getEnds();for(let d=0,g=f.length;d<g;++d)f[d]+=h;Oe(o,c.getFlatCoordinates()),a.push(f)}t=r,e=o,i=a}t!==void 0&&i?(this.setFlatCoordinates(t,e),this.endss_=i):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;Oe(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=i}this.endss_.push(t),this.changed()}clone(){const e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();const i=new Pd(this.flatCoordinates.slice(),this.layout,t);return i.applyProperties(this),i}closestPointXY(e,t,i,r){return r<Br(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Av(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Lv(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,i,r))}containsXY(e,t){return Nv(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return $v(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Fg(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,ih(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=Sp(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Ig(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new qn(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;Bv(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Fg(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){const t=[],i=[];return t.length=Ov(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,i),new Pd(t,"XY",i)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{const s=this.endss_[e-1];t=s[s.length-1]}const i=this.endss_[e].slice(),r=i[i.length-1];if(t!==0)for(let s=0,o=i.length;s<o;++s)i[s]-=t;return new Dt(this.flatCoordinates.slice(t,r),this.layout,i)}getPolygons(){const e=this.layout,t=this.flatCoordinates,i=this.endss_,r=[];let s=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),u=l[l.length-1];if(s!==0)for(let h=0,f=l.length;h<f;++h)l[h]-=s;const c=new Dt(t.slice(s,u),e,l);r.push(c),s=u}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return Gv(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=Pv(this.flatCoordinates,0,e,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const r=i[i.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}}var Bn=Pd;const y2={Point:w2,LineString:T2,Polygon:C2,MultiPoint:b2,MultiLineString:S2,MultiPolygon:R2},v2={Point:I2,LineString:A2,Polygon:L2,MultiPoint:M2,MultiLineString:P2,MultiPolygon:F2};class x2 extends Ih{constructor(e){e=e||{},super(),this.geometryName_=e.geometryName}readFeatureFromObject(e,t,i){const r=e,s=Kx(r.geometry,t),o=new Ne;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(s),r.attributes){o.setProperties(r.attributes,!0);const a=r.attributes[i];a!==void 0&&o.setId(a)}return o}readFeaturesFromObject(e,t){if(t=t||{},e.features){const i=e,r=[],s=i.features;for(let o=0,a=s.length;o<a;++o)r.push(this.readFeatureFromObject(s[o],t,e.objectIdFieldName));return r}else return[this.readFeatureFromObject(e,t)]}readGeometryFromObject(e,t){return Kx(e,t)}readProjectionFromObject(e){if(e.spatialReference&&e.spatialReference.wkid!==void 0){const i=e.spatialReference.wkid;return J("EPSG:"+i)}else return null}writeGeometryObject(e,t){return qx(e,this.adaptOptions(t))}writeFeatureObject(e,t){t=this.adaptOptions(t);const i={};if(!e.hasProperties())return i.attributes={},i;const r=e.getProperties(),s=e.getGeometry();if(s){i.geometry=qx(s,t);const o=t&&(t.dataProjection||t.featureProjection);o&&(i.geometry.spatialReference={wkid:Number(J(o).getCode().split(":").pop())}),delete r[e.getGeometryName()]}return oi(r)?i.attributes={}:i.attributes=r,i}writeFeaturesObject(e,t){t=this.adaptOptions(t);const i=[];for(let r=0,s=e.length;r<s;++r)i.push(this.writeFeatureObject(e[r],t));return{features:i}}}function Kx(n,e){if(!n)return null;let t;if(typeof n.x=="number"&&typeof n.y=="number")t="Point";else if(n.points)t="MultiPoint";else if(n.paths)n.paths.length===1?t="LineString":t="MultiLineString";else if(n.rings){const r=n,s=xa(r),o=E2(r.rings,s);o.length===1?(t="Polygon",n=Object.assign({},n,{rings:o[0]})):(t="MultiPolygon",n=Object.assign({},n,{rings:o}))}const i=y2[t];return nt(i(n),!1,e)}function E2(n,e){const t=[],i=[],r=[];let s,o;for(s=0,o=n.length;s<o;++s)t.length=0,sa(t,0,n[s],e.length),kl(t,0,t.length,e.length)?i.push([n[s]]):r.push(n[s]);for(;r.length;){const a=r.shift();let l=!1;for(s=i.length-1;s>=0;s--){const u=i[s][0];if(Mt(new aa(u).getExtent(),new aa(a).getExtent())){i[s].push(a),l=!0;break}}l||i.push([a.reverse()])}return i}function w2(n){let e;return n.m!==void 0&&n.z!==void 0?e=new st([n.x,n.y,n.z,n.m],"XYZM"):n.z!==void 0?e=new st([n.x,n.y,n.z],"XYZ"):n.m!==void 0?e=new st([n.x,n.y,n.m],"XYM"):e=new st([n.x,n.y]),e}function T2(n){const e=xa(n);return new lt(n.paths[0],e)}function S2(n){const e=xa(n);return new gn(n.paths,e)}function xa(n){let e="XY";return n.hasZ===!0&&n.hasM===!0?e="XYZM":n.hasZ===!0?e="XYZ":n.hasM===!0&&(e="XYM"),e}function b2(n){const e=xa(n);return new qn(n.points,e)}function R2(n){const e=xa(n);return new Bn(n.rings,e)}function C2(n){const e=xa(n);return new Dt(n.rings,e)}function I2(n,e){const t=n.getCoordinates();let i;const r=n.getLayout();return r==="XYZ"?i={x:t[0],y:t[1],z:t[2]}:r==="XYM"?i={x:t[0],y:t[1],m:t[2]}:r==="XYZM"?i={x:t[0],y:t[1],z:t[2],m:t[3]}:r==="XY"?i={x:t[0],y:t[1]}:ne(!1,34),i}function ru(n){const e=n.getLayout();return{hasZ:e==="XYZ"||e==="XYZM",hasM:e==="XYM"||e==="XYZM"}}function A2(n,e){const t=ru(n);return{hasZ:t.hasZ,hasM:t.hasM,paths:[n.getCoordinates()]}}function L2(n,e){const t=ru(n);return{hasZ:t.hasZ,hasM:t.hasM,rings:n.getCoordinates(!1)}}function P2(n,e){const t=ru(n);return{hasZ:t.hasZ,hasM:t.hasM,paths:n.getCoordinates()}}function M2(n,e){const t=ru(n);return{hasZ:t.hasZ,hasM:t.hasM,points:n.getCoordinates()}}function F2(n,e){const t=ru(n),i=n.getCoordinates(!1),r=[];for(let s=0;s<i.length;s++)for(let o=i[s].length-1;o>=0;o--)r.push(i[s][o]);return{hasZ:t.hasZ,hasM:t.hasM,rings:r}}function qx(n,e){return v2[n.getType()](nt(n,!0,e),e)}var O2=x2;const ts="http://www.w3.org/2001/XMLSchema-instance";function de(n,e){return uo().createElementNS(n,e)}function sn(n,e){return bp(n,e,[]).join("")}function bp(n,e,t){if(n.nodeType==Node.CDATA_SECTION_NODE||n.nodeType==Node.TEXT_NODE)e?t.push(String(n.nodeValue).replace(/(\r\n|\r|\n)/g,"")):t.push(n.nodeValue);else{let i;for(i=n.firstChild;i;i=i.nextSibling)bp(i,e,t)}return t}function _i(n){return"documentElement"in n}function Jx(n,e,t){return n.getAttributeNS(e,t)||""}function yi(n){return new DOMParser().parseFromString(n,"application/xml")}function su(n,e){return function(t,i){const r=n.call(e!==void 0?e:this,t,i);if(r!==void 0){const s=i[i.length-1];Oe(s,r)}}}function se(n,e){return function(t,i){const r=n.call(e!==void 0?e:this,t,i);r!==void 0&&i[i.length-1].push(r)}}function ue(n,e){return function(t,i){const r=n.call(e!==void 0?e:this,t,i);r!==void 0&&(i[i.length-1]=r)}}function it(n,e,t){return function(i,r){const s=n.call(t!==void 0?t:this,i,r);if(s!==void 0){const o=r[r.length-1],a=e!==void 0?e:i.localName;let l;a in o?l=o[a]:(l=[],o[a]=l),l.push(s)}}}function I(n,e,t){return function(i,r){const s=n.call(t!==void 0?t:this,i,r);if(s!==void 0){const o=r[r.length-1],a=e!==void 0?e:i.localName;o[a]=s}}}function A(n,e){return function(t,i,r){n.call(e!==void 0?e:this,t,i,r),r[r.length-1].node.appendChild(t)}}function Rp(n,e){let t,i;return function(r,s,o){if(t===void 0){t={};const a={};a[r.localName]=n,t[r.namespaceURI]=a,i=ut(r.localName)}Cp(t,i,s,o)}}function ut(n,e){return function(t,i,r){const o=i[i.length-1].node;let a=n;a===void 0&&(a=r);const l=e!==void 0?e:o.namespaceURI;return de(l,a)}}const Nt=ut();function pn(n,e){const t=e.length,i=new Array(t);for(let r=0;r<t;++r)i[r]=n[e[r]];return i}function G(n,e,t){t=t!==void 0?t:{};let i,r;for(i=0,r=n.length;i<r;++i)t[n[i]]=e;return t}function mn(n,e,t,i){let r;for(r=e.firstElementChild;r;r=r.nextElementSibling){const s=n[r.namespaceURI];if(s!==void 0){const o=s[r.localName];o!==void 0&&o.call(i,r,t)}}}function z(n,e,t,i,r){return i.push(n),mn(e,t,i,r),i.pop()}function Cp(n,e,t,i,r,s){const o=(r!==void 0?r:t).length;let a,l;for(let u=0;u<o;++u)a=t[u],a!==void 0&&(l=e.call(s!==void 0?s:this,a,i,r!==void 0?r[u]:void 0),l!==void 0&&n[l.namespaceURI][l.localName].call(s,l,a,i))}function ge(n,e,t,i,r,s,o){return r.push(n),Cp(e,t,i,r,s,o),r.pop()}let Ph;function $2(n){Ph=n}function Qx(){return Ph===void 0&&typeof XMLSerializer!="undefined"&&(Ph=new XMLSerializer),Ph}let Mh;function D2(n){Mh=n}function uo(){return Mh===void 0&&typeof document!="undefined"&&(Mh=document.implementation.createDocument("","",null)),Mh}class N2 extends va{constructor(){super(),this.xmlSerializer_=Qx()}getType(){return"xml"}readFeature(e,t){if(e)if(typeof e=="string"){const i=yi(e);return this.readFeatureFromDocument(i,t)}else return _i(e)?this.readFeatureFromDocument(e,t):this.readFeatureFromNode(e,t);else return null}readFeatureFromDocument(e,t){const i=this.readFeaturesFromDocument(e,t);return i.length>0?i[0]:null}readFeatureFromNode(e,t){return null}readFeatures(e,t){if(e)if(typeof e=="string"){const i=yi(e);return this.readFeaturesFromDocument(i,t)}else return _i(e)?this.readFeaturesFromDocument(e,t):this.readFeaturesFromNode(e,t);else return[]}readFeaturesFromDocument(e,t){const i=[];for(let r=e.firstChild;r;r=r.nextSibling)r.nodeType==Node.ELEMENT_NODE&&Oe(i,this.readFeaturesFromNode(r,t));return i}readFeaturesFromNode(e,t){return ae()}readGeometry(e,t){if(e)if(typeof e=="string"){const i=yi(e);return this.readGeometryFromDocument(i,t)}else return _i(e)?this.readGeometryFromDocument(e,t):this.readGeometryFromNode(e,t);else return null}readGeometryFromDocument(e,t){return null}readGeometryFromNode(e,t){return null}readProjection(e){if(e)if(typeof e=="string"){const t=yi(e);return this.readProjectionFromDocument(t)}else return _i(e)?this.readProjectionFromDocument(e):this.readProjectionFromNode(e);else return null}readProjectionFromDocument(e){return this.dataProjection}readProjectionFromNode(e){return this.dataProjection}writeFeature(e,t){const i=this.writeFeatureNode(e,t);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(e,t){return null}writeFeatures(e,t){const i=this.writeFeaturesNode(e,t);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(e,t){return null}writeGeometry(e,t){const i=this.writeGeometryNode(e,t);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(e,t){return null}}var co=N2;const Di="http://www.opengis.net/gml",k2=/^\s*$/;class xt extends co{constructor(e){super(),e=e||{},this.featureType=e.featureType,this.featureNS=e.featureNS,this.srsName=e.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:se(this.readFeaturesInternal),featureMembers:ue(this.readFeaturesInternal)},this.supportedMediaTypes=["application/gml+xml"]}readFeaturesInternal(e,t){const i=e.localName;let r=null;if(i=="FeatureCollection")r=z([],this.FEATURE_COLLECTION_PARSERS,e,t,this);else if(i=="featureMembers"||i=="featureMember"||i=="member"){const s=t[0];let o=s.featureType,a=s.featureNS;const l="p",u="p0";if(!o&&e.childNodes){o=[],a={};for(let f=0,d=e.childNodes.length;f<d;++f){const g=e.childNodes[f];if(g.nodeType===1){const m=g.nodeName.split(":").pop();if(!o.includes(m)){let p="",_=0;const v=g.namespaceURI;for(const x in a){if(a[x]===v){p=x;break}++_}p||(p=l+_,a[p]=v),o.push(p+":"+m)}}}i!="featureMember"&&(s.featureType=o,s.featureNS=a)}if(typeof a=="string"){const f=a;a={},a[u]=f}const c={},h=Array.isArray(o)?o:[o];for(const f in a){const d={};for(let g=0,m=h.length;g<m;++g)(h[g].includes(":")?h[g].split(":")[0]:u)===f&&(d[h[g].split(":").pop()]=i=="featureMembers"?se(this.readFeatureElement,this):ue(this.readFeatureElement,this));c[a[f]]=d}i=="featureMember"||i=="member"?r=z(void 0,c,e,t):r=z([],c,e,t)}return r===null&&(r=[]),r}readGeometryOrExtent(e,t){const i=t[0];return i.srsName=e.firstElementChild.getAttribute("srsName"),i.srsDimension=e.firstElementChild.getAttribute("srsDimension"),z(null,this.GEOMETRY_PARSERS,e,t,this)}readExtentElement(e,t){const i=t[0],r=this.readGeometryOrExtent(e,t);return r?Rh(r,i):void 0}readGeometryElement(e,t){const i=t[0],r=this.readGeometryOrExtent(e,t);return r?nt(r,!1,i):void 0}readFeatureElementInternal(e,t,i){let r;const s={};for(let o=e.firstElementChild;o;o=o.nextElementSibling){let a;const l=o.localName;o.childNodes.length===0||o.childNodes.length===1&&(o.firstChild.nodeType===3||o.firstChild.nodeType===4)?(a=sn(o,!1),k2.test(a)&&(a=void 0)):(i&&(a=l==="boundedBy"?this.readExtentElement(o,t):this.readGeometryElement(o,t)),a?l!=="boundedBy"&&(r=l):a=this.readFeatureElementInternal(o,t,!1));const u=o.attributes.length;if(u>0){a={_content_:a};for(let c=0;c<u;c++){const h=o.attributes[c].name;a[h]=o.attributes[c].value}}s[l]?(s[l]instanceof Array||(s[l]=[s[l]]),s[l].push(a)):s[l]=a}if(i){const o=new Ne(s);r&&o.setGeometryName(r);const a=e.getAttribute("fid")||Jx(e,this.namespace,"id");return a&&o.setId(a),o}else return s}readFeatureElement(e,t){return this.readFeatureElementInternal(e,t,!0)}readPoint(e,t){const i=this.readFlatCoordinatesFromNode(e,t);if(i)return new st(i,"XYZ")}readMultiPoint(e,t){const i=z([],this.MULTIPOINT_PARSERS,e,t,this);if(i)return new qn(i)}readMultiLineString(e,t){const i=z([],this.MULTILINESTRING_PARSERS,e,t,this);if(i)return new gn(i)}readMultiPolygon(e,t){const i=z([],this.MULTIPOLYGON_PARSERS,e,t,this);if(i)return new Bn(i)}pointMemberParser(e,t){mn(this.POINTMEMBER_PARSERS,e,t,this)}lineStringMemberParser(e,t){mn(this.LINESTRINGMEMBER_PARSERS,e,t,this)}polygonMemberParser(e,t){mn(this.POLYGONMEMBER_PARSERS,e,t,this)}readLineString(e,t){const i=this.readFlatCoordinatesFromNode(e,t);if(i)return new lt(i,"XYZ")}readFlatLinearRing(e,t){const i=z(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,e,t,this);if(i)return i}readLinearRing(e,t){const i=this.readFlatCoordinatesFromNode(e,t);if(i)return new aa(i,"XYZ")}readPolygon(e,t){const i=z([null],this.FLAT_LINEAR_RINGS_PARSERS,e,t,this);if(i&&i[0]){const r=i[0],s=[r.length];let o,a;for(o=1,a=i.length;o<a;++o)Oe(r,i[o]),s.push(r.length);return new Dt(r,"XYZ",s)}else return}readFlatCoordinatesFromNode(e,t){return z(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,e,t,this)}readGeometryFromNode(e,t){const i=this.readGeometryElement(e,[this.getReadOptions(e,t||{})]);return i||null}readFeaturesFromNode(e,t){const i={featureType:this.featureType,featureNS:this.featureNS};return i&&Object.assign(i,this.getReadOptions(e,t)),this.readFeaturesInternal(e,[i])||[]}readProjectionFromNode(e){return J(this.srsName?this.srsName:e.firstElementChild.getAttribute("srsName"))}}xt.prototype.namespace=Di,xt.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{}},xt.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},xt.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},xt.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml":{pointMember:se(xt.prototype.pointMemberParser),pointMembers:se(xt.prototype.pointMemberParser)}},xt.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml":{lineStringMember:se(xt.prototype.lineStringMemberParser),lineStringMembers:se(xt.prototype.lineStringMemberParser)}},xt.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml":{polygonMember:se(xt.prototype.polygonMemberParser),polygonMembers:se(xt.prototype.polygonMemberParser)}},xt.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml":{Point:se(xt.prototype.readFlatCoordinatesFromNode)}},xt.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:se(xt.prototype.readLineString)}},xt.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:se(xt.prototype.readPolygon)}},xt.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:ue(xt.prototype.readFlatLinearRing)}};var Ee=xt;function lr(n){const e=sn(n,!1);return ns(e)}function ns(n){const e=/^\s*(true|1)|(false|0)\s*$/.exec(n);if(e)return e[1]!==void 0||!1}function Fh(n){const e=sn(n,!1),t=Date.parse(e);return isNaN(t)?void 0:t/1e3}function $e(n){const e=sn(n,!1);return Ni(e)}function Ni(n){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(n);if(e)return parseFloat(e[1])}function Et(n){const e=sn(n,!1);return ki(e)}function ki(n){const e=/^\s*(\d+)\s*$/.exec(n);if(e)return parseInt(e[1],10)}function j(n){return sn(n,!1).trim()}function ho(n,e){fe(n,e?"1":"0")}function e1(n,e){n.appendChild(uo().createCDATASection(e))}function t1(n,e){const t=new Date(e*1e3),i=t.getUTCFullYear()+"-"+jr(t.getUTCMonth()+1,2)+"-"+jr(t.getUTCDate(),2)+"T"+jr(t.getUTCHours(),2)+":"+jr(t.getUTCMinutes(),2)+":"+jr(t.getUTCSeconds(),2)+"Z";n.appendChild(uo().createTextNode(i))}function _n(n,e){const t=e.toPrecision();n.appendChild(uo().createTextNode(t))}function ou(n,e){const t=e.toString();n.appendChild(uo().createTextNode(t))}function fe(n,e){n.appendChild(uo().createTextNode(e))}const G2=Di+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",U2={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class Me extends Ee{constructor(e){e=e||{},super(e),this.FEATURE_COLLECTION_PARSERS[Di].featureMember=se(this.readFeaturesInternal),this.schemaLocation=e.schemaLocation?e.schemaLocation:G2}readFlatCoordinates(e,t){const i=sn(e,!1).replace(/^\s*|\s*$/g,""),s=t[0].srsName;let o="enu";if(s){const u=J(s);u&&(o=u.getAxisOrientation())}const a=i.trim().split(/\s+/),l=[];for(let u=0,c=a.length;u<c;u++){const h=a[u].split(/,+/),f=parseFloat(h[0]),d=parseFloat(h[1]),g=h.length===3?parseFloat(h[2]):0;o.substr(0,2)==="en"?l.push(f,d,g):l.push(d,f,g)}return l}readBox(e,t){const i=z([null],this.BOX_PARSERS_,e,t,this);return Cn(i[1][0],i[1][1],i[1][3],i[1][4])}innerBoundaryIsParser(e,t){const i=z(void 0,this.RING_PARSERS,e,t,this);i&&t[t.length-1].push(i)}outerBoundaryIsParser(e,t){const i=z(void 0,this.RING_PARSERS,e,t,this);if(i){const r=t[t.length-1];r[0]=i}}GEOMETRY_NODE_FACTORY_(e,t,i){const r=t[t.length-1],s=r.multiSurface,o=r.surface,a=r.multiCurve;return Array.isArray(e)?i="Envelope":(i=e.getType(),i==="MultiPolygon"&&s===!0?i="MultiSurface":i==="Polygon"&&o===!0?i="Surface":i==="MultiLineString"&&a===!0&&(i="MultiCurve")),de("http://www.opengis.net/gml",i)}writeFeatureElement(e,t,i){const r=t.getId();r&&e.setAttribute("fid",r);const s=i[i.length-1],o=s.featureNS,a=t.getGeometryName();s.serializers||(s.serializers={},s.serializers[o]={});const l=[],u=[];if(t.hasProperties()){const h=t.getProperties();for(const f in h){const d=h[f];d!==null&&(l.push(f),u.push(d),f==a||typeof d.getSimplifiedGeometry=="function"?f in s.serializers[o]||(s.serializers[o][f]=A(this.writeGeometryElement,this)):f in s.serializers[o]||(s.serializers[o][f]=A(fe)))}}const c=Object.assign({},s);c.node=e,ge(c,s.serializers,ut(void 0,o),u,i,l)}writeCurveOrLineString(e,t,i){const s=i[i.length-1].srsName;if(e.nodeName!=="LineStringSegment"&&s&&e.setAttribute("srsName",s),e.nodeName==="LineString"||e.nodeName==="LineStringSegment"){const o=this.createCoordinatesNode_(e.namespaceURI);e.appendChild(o),this.writeCoordinates_(o,t,i)}else if(e.nodeName==="Curve"){const o=de(e.namespaceURI,"segments");e.appendChild(o),this.writeCurveSegments_(o,t,i)}}writeLineStringOrCurveMember(e,t,i){const r=this.GEOMETRY_NODE_FACTORY_(t,i);r&&(e.appendChild(r),this.writeCurveOrLineString(r,t,i))}writeMultiCurveOrLineString(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName,a=r.curve;o&&e.setAttribute("srsName",o);const l=t.getLineStrings();ge({node:e,hasZ:s,srsName:o,curve:a},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,l,i,void 0,this)}writeGeometryElement(e,t,i){const r=i[i.length-1],s=Object.assign({},r);s.node=e;let o;Array.isArray(t)?o=Rh(t,r):o=nt(t,!0,r),ge(s,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[o],i,void 0,this)}createCoordinatesNode_(e){const t=de(e,"coordinates");return t.setAttribute("decimal","."),t.setAttribute("cs",","),t.setAttribute("ts"," "),t}writeCoordinates_(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName,a=t.getCoordinates(),l=a.length,u=new Array(l);for(let c=0;c<l;++c){const h=a[c];u[c]=this.getCoords_(h,o,s)}fe(e,u.join(" "))}writeCurveSegments_(e,t,i){const r=de(e.namespaceURI,"LineStringSegment");e.appendChild(r),this.writeCurveOrLineString(r,t,i)}writeSurfaceOrPolygon(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName;if(e.nodeName!=="PolygonPatch"&&o&&e.setAttribute("srsName",o),e.nodeName==="Polygon"||e.nodeName==="PolygonPatch"){const a=t.getLinearRings();ge({node:e,hasZ:s,srsName:o},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,a,i,void 0,this)}else if(e.nodeName==="Surface"){const a=de(e.namespaceURI,"patches");e.appendChild(a),this.writeSurfacePatches_(a,t,i)}}RING_NODE_FACTORY_(e,t,i){const r=t[t.length-1],s=r.node,o=r.exteriorWritten;return o===void 0&&(r.exteriorWritten=!0),de(s.namespaceURI,o!==void 0?"innerBoundaryIs":"outerBoundaryIs")}writeSurfacePatches_(e,t,i){const r=de(e.namespaceURI,"PolygonPatch");e.appendChild(r),this.writeSurfaceOrPolygon(r,t,i)}writeRing(e,t,i){const r=de(e.namespaceURI,"LinearRing");e.appendChild(r),this.writeLinearRing(r,t,i)}getCoords_(e,t,i){let r="enu";t&&(r=J(t).getAxisOrientation());let s=r.substr(0,2)==="en"?e[0]+","+e[1]:e[1]+","+e[0];if(i){const o=e[2]||0;s+=","+o}return s}writePoint(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName;o&&e.setAttribute("srsName",o);const a=this.createCoordinatesNode_(e.namespaceURI);e.appendChild(a);const l=t.getCoordinates(),u=this.getCoords_(l,o,s);fe(a,u)}writeMultiPoint(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName;o&&e.setAttribute("srsName",o);const a=t.getPoints();ge({node:e,hasZ:s,srsName:o},this.POINTMEMBER_SERIALIZERS,ut("pointMember"),a,i,void 0,this)}writePointMember(e,t,i){const r=de(e.namespaceURI,"Point");e.appendChild(r),this.writePoint(r,t,i)}writeLinearRing(e,t,i){const s=i[i.length-1].srsName;s&&e.setAttribute("srsName",s);const o=this.createCoordinatesNode_(e.namespaceURI);e.appendChild(o),this.writeCoordinates_(o,t,i)}writeMultiSurfaceOrPolygon(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName,a=r.surface;o&&e.setAttribute("srsName",o);const l=t.getPolygons();ge({node:e,hasZ:s,srsName:o,surface:a},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,l,i,void 0,this)}writeSurfaceOrPolygonMember(e,t,i){const r=this.GEOMETRY_NODE_FACTORY_(t,i);r&&(e.appendChild(r),this.writeSurfaceOrPolygon(r,t,i))}writeEnvelope(e,t,i){const s=i[i.length-1].srsName;s&&e.setAttribute("srsName",s);const o=["lowerCorner","upperCorner"],a=[t[0]+" "+t[1],t[2]+" "+t[3]];ge({node:e},this.ENVELOPE_SERIALIZERS,Nt,a,i,o,this)}MULTIGEOMETRY_MEMBER_NODE_FACTORY_(e,t,i){const r=t[t.length-1].node;return de("http://www.opengis.net/gml",U2[r.nodeName])}}Me.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:ue(Me.prototype.readFlatCoordinates)}},Me.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:Me.prototype.innerBoundaryIsParser,outerBoundaryIs:Me.prototype.outerBoundaryIsParser}},Me.prototype.BOX_PARSERS_={"http://www.opengis.net/gml":{coordinates:se(Me.prototype.readFlatCoordinates)}},Me.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:ue(Ee.prototype.readPoint),MultiPoint:ue(Ee.prototype.readMultiPoint),LineString:ue(Ee.prototype.readLineString),MultiLineString:ue(Ee.prototype.readMultiLineString),LinearRing:ue(Ee.prototype.readLinearRing),Polygon:ue(Ee.prototype.readPolygon),MultiPolygon:ue(Ee.prototype.readMultiPolygon),Box:ue(Me.prototype.readBox)}},Me.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:A(Me.prototype.writeCurveOrLineString),MultiCurve:A(Me.prototype.writeMultiCurveOrLineString),Point:A(Me.prototype.writePoint),MultiPoint:A(Me.prototype.writeMultiPoint),LineString:A(Me.prototype.writeCurveOrLineString),MultiLineString:A(Me.prototype.writeMultiCurveOrLineString),LinearRing:A(Me.prototype.writeLinearRing),Polygon:A(Me.prototype.writeSurfaceOrPolygon),MultiPolygon:A(Me.prototype.writeMultiSurfaceOrPolygon),Surface:A(Me.prototype.writeSurfaceOrPolygon),MultiSurface:A(Me.prototype.writeMultiSurfaceOrPolygon),Envelope:A(Me.prototype.writeEnvelope)}},Me.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:A(Me.prototype.writeLineStringOrCurveMember),curveMember:A(Me.prototype.writeLineStringOrCurveMember)}},Me.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{outerBoundaryIs:A(Me.prototype.writeRing),innerBoundaryIs:A(Me.prototype.writeRing)}},Me.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:A(Me.prototype.writePointMember)}},Me.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:A(Me.prototype.writeSurfaceOrPolygonMember),polygonMember:A(Me.prototype.writeSurfaceOrPolygonMember)}},Me.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:A(fe),upperCorner:A(fe)}};var fo=Me;const B2=Di+" http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",z2={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class oe extends Ee{constructor(e){e=e||{},super(e),this.surface_=e.surface!==void 0?e.surface:!1,this.curve_=e.curve!==void 0?e.curve:!1,this.multiCurve_=e.multiCurve!==void 0?e.multiCurve:!0,this.multiSurface_=e.multiSurface!==void 0?e.multiSurface:!0,this.schemaLocation=e.schemaLocation?e.schemaLocation:B2,this.hasZ=e.hasZ!==void 0?e.hasZ:!1}readMultiCurve(e,t){const i=z([],this.MULTICURVE_PARSERS,e,t,this);if(i)return new gn(i)}readFlatCurveRing(e,t){const i=z([],this.MULTICURVE_PARSERS,e,t,this),r=[];for(let s=0,o=i.length;s<o;++s)Oe(r,i[s].getFlatCoordinates());return r}readMultiSurface(e,t){const i=z([],this.MULTISURFACE_PARSERS,e,t,this);if(i)return new Bn(i)}curveMemberParser(e,t){mn(this.CURVEMEMBER_PARSERS,e,t,this)}surfaceMemberParser(e,t){mn(this.SURFACEMEMBER_PARSERS,e,t,this)}readPatch(e,t){return z([null],this.PATCHES_PARSERS,e,t,this)}readSegment(e,t){return z([],this.SEGMENTS_PARSERS,e,t,this)}readPolygonPatch(e,t){return z([null],this.FLAT_LINEAR_RINGS_PARSERS,e,t,this)}readLineStringSegment(e,t){return z([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,e,t,this)}interiorParser(e,t){const i=z(void 0,this.RING_PARSERS,e,t,this);i&&t[t.length-1].push(i)}exteriorParser(e,t){const i=z(void 0,this.RING_PARSERS,e,t,this);if(i){const r=t[t.length-1];r[0]=i}}readSurface(e,t){const i=z([null],this.SURFACE_PARSERS,e,t,this);if(i&&i[0]){const r=i[0],s=[r.length];let o,a;for(o=1,a=i.length;o<a;++o)Oe(r,i[o]),s.push(r.length);return new Dt(r,"XYZ",s)}else return}readCurve(e,t){const i=z([null],this.CURVE_PARSERS,e,t,this);if(i)return new lt(i,"XYZ")}readEnvelope(e,t){const i=z([null],this.ENVELOPE_PARSERS,e,t,this);return Cn(i[1][0],i[1][1],i[2][0],i[2][1])}readFlatPos(e,t){let i=sn(e,!1);const r=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,s=[];let o;for(;o=r.exec(i);)s.push(parseFloat(o[1])),i=i.substr(o[0].length);if(i!=="")return;const l=t[0].srsName;let u="enu";if(l&&(u=J(l).getAxisOrientation()),u==="neu"){let h,f;for(h=0,f=s.length;h<f;h+=3){const d=s[h],g=s[h+1];s[h]=g,s[h+1]=d}}const c=s.length;if(c==2&&s.push(0),c!==0)return s}readFlatPosList(e,t){const i=sn(e,!1).replace(/^\s*|\s*$/g,""),r=t[0],s=r.srsName,o=r.srsDimension;let a="enu";s&&(a=J(s).getAxisOrientation());const l=i.split(/\s+/);let u=2;e.getAttribute("srsDimension")?u=ki(e.getAttribute("srsDimension")):e.getAttribute("dimension")?u=ki(e.getAttribute("dimension")):e.parentNode.getAttribute("srsDimension")?u=ki(e.parentNode.getAttribute("srsDimension")):o&&(u=ki(o));let c,h,f;const d=[];for(let g=0,m=l.length;g<m;g+=u)c=parseFloat(l[g]),h=parseFloat(l[g+1]),f=u===3?parseFloat(l[g+2]):0,a.substr(0,2)==="en"?d.push(c,h,f):d.push(h,c,f);return d}writePos_(e,t,i){const r=i[i.length-1],s=r.hasZ,o=s?"3":"2";e.setAttribute("srsDimension",o);const a=r.srsName;let l="enu";a&&(l=J(a).getAxisOrientation());const u=t.getCoordinates();let c;if(l.substr(0,2)==="en"?c=u[0]+" "+u[1]:c=u[1]+" "+u[0],s){const h=u[2]||0;c+=" "+h}fe(e,c)}getCoords_(e,t,i){let r="enu";t&&(r=J(t).getAxisOrientation());let s=r.substr(0,2)==="en"?e[0]+" "+e[1]:e[1]+" "+e[0];if(i){const o=e[2]||0;s+=" "+o}return s}writePosList_(e,t,i){const r=i[i.length-1],s=r.hasZ,o=s?"3":"2";e.setAttribute("srsDimension",o);const a=r.srsName,l=t.getCoordinates(),u=l.length,c=new Array(u);let h;for(let f=0;f<u;++f)h=l[f],c[f]=this.getCoords_(h,a,s);fe(e,c.join(" "))}writePoint(e,t,i){const s=i[i.length-1].srsName;s&&e.setAttribute("srsName",s);const o=de(e.namespaceURI,"pos");e.appendChild(o),this.writePos_(o,t,i)}writeEnvelope(e,t,i){const s=i[i.length-1].srsName;s&&e.setAttribute("srsName",s);const o=["lowerCorner","upperCorner"],a=[t[0]+" "+t[1],t[2]+" "+t[3]];ge({node:e},this.ENVELOPE_SERIALIZERS,Nt,a,i,o,this)}writeLinearRing(e,t,i){const s=i[i.length-1].srsName;s&&e.setAttribute("srsName",s);const o=de(e.namespaceURI,"posList");e.appendChild(o),this.writePosList_(o,t,i)}RING_NODE_FACTORY_(e,t,i){const r=t[t.length-1],s=r.node,o=r.exteriorWritten;return o===void 0&&(r.exteriorWritten=!0),de(s.namespaceURI,o!==void 0?"interior":"exterior")}writeSurfaceOrPolygon(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName;if(e.nodeName!=="PolygonPatch"&&o&&e.setAttribute("srsName",o),e.nodeName==="Polygon"||e.nodeName==="PolygonPatch"){const a=t.getLinearRings();ge({node:e,hasZ:s,srsName:o},this.RING_SERIALIZERS,this.RING_NODE_FACTORY_,a,i,void 0,this)}else if(e.nodeName==="Surface"){const a=de(e.namespaceURI,"patches");e.appendChild(a),this.writeSurfacePatches_(a,t,i)}}writeCurveOrLineString(e,t,i){const s=i[i.length-1].srsName;if(e.nodeName!=="LineStringSegment"&&s&&e.setAttribute("srsName",s),e.nodeName==="LineString"||e.nodeName==="LineStringSegment"){const o=de(e.namespaceURI,"posList");e.appendChild(o),this.writePosList_(o,t,i)}else if(e.nodeName==="Curve"){const o=de(e.namespaceURI,"segments");e.appendChild(o),this.writeCurveSegments_(o,t,i)}}writeMultiSurfaceOrPolygon(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName,a=r.surface;o&&e.setAttribute("srsName",o);const l=t.getPolygons();ge({node:e,hasZ:s,srsName:o,surface:a},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,l,i,void 0,this)}writeMultiPoint(e,t,i){const r=i[i.length-1],s=r.srsName,o=r.hasZ;s&&e.setAttribute("srsName",s);const a=t.getPoints();ge({node:e,hasZ:o,srsName:s},this.POINTMEMBER_SERIALIZERS,ut("pointMember"),a,i,void 0,this)}writeMultiCurveOrLineString(e,t,i){const r=i[i.length-1],s=r.hasZ,o=r.srsName,a=r.curve;o&&e.setAttribute("srsName",o);const l=t.getLineStrings();ge({node:e,hasZ:s,srsName:o,curve:a},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,l,i,void 0,this)}writeRing(e,t,i){const r=de(e.namespaceURI,"LinearRing");e.appendChild(r),this.writeLinearRing(r,t,i)}writeSurfaceOrPolygonMember(e,t,i){const r=this.GEOMETRY_NODE_FACTORY_(t,i);r&&(e.appendChild(r),this.writeSurfaceOrPolygon(r,t,i))}writePointMember(e,t,i){const r=de(e.namespaceURI,"Point");e.appendChild(r),this.writePoint(r,t,i)}writeLineStringOrCurveMember(e,t,i){const r=this.GEOMETRY_NODE_FACTORY_(t,i);r&&(e.appendChild(r),this.writeCurveOrLineString(r,t,i))}writeSurfacePatches_(e,t,i){const r=de(e.namespaceURI,"PolygonPatch");e.appendChild(r),this.writeSurfaceOrPolygon(r,t,i)}writeCurveSegments_(e,t,i){const r=de(e.namespaceURI,"LineStringSegment");e.appendChild(r),this.writeCurveOrLineString(r,t,i)}writeGeometryElement(e,t,i){const r=i[i.length-1],s=Object.assign({},r);s.node=e;let o;Array.isArray(t)?o=Rh(t,r):o=nt(t,!0,r),ge(s,this.GEOMETRY_SERIALIZERS,this.GEOMETRY_NODE_FACTORY_,[o],i,void 0,this)}writeFeatureElement(e,t,i){const r=t.getId();r&&e.setAttribute("fid",r);const s=i[i.length-1],o=s.featureNS,a=t.getGeometryName();s.serializers||(s.serializers={},s.serializers[o]={});const l=[],u=[];if(t.hasProperties()){const h=t.getProperties();for(const f in h){const d=h[f];d!==null&&(l.push(f),u.push(d),f==a||typeof d.getSimplifiedGeometry=="function"?f in s.serializers[o]||(s.serializers[o][f]=A(this.writeGeometryElement,this)):f in s.serializers[o]||(s.serializers[o][f]=A(fe)))}}const c=Object.assign({},s);c.node=e,ge(c,s.serializers,ut(void 0,o),u,i,l)}writeFeatureMembers_(e,t,i){const r=i[i.length-1],s=r.featureType,o=r.featureNS,a={};a[o]={},a[o][s]=A(this.writeFeatureElement,this);const l=Object.assign({},r);l.node=e,ge(l,a,ut(s,o),t,i)}MULTIGEOMETRY_MEMBER_NODE_FACTORY_(e,t,i){const r=t[t.length-1].node;return de(this.namespace,z2[r.nodeName])}GEOMETRY_NODE_FACTORY_(e,t,i){const r=t[t.length-1],s=r.multiSurface,o=r.surface,a=r.curve,l=r.multiCurve;return Array.isArray(e)?i="Envelope":(i=e.getType(),i==="MultiPolygon"&&s===!0?i="MultiSurface":i==="Polygon"&&o===!0?i="Surface":i==="LineString"&&a===!0?i="Curve":i==="MultiLineString"&&l===!0&&(i="MultiCurve")),de(this.namespace,i)}writeGeometryNode(e,t){t=this.adaptOptions(t);const i=de(this.namespace,"geom"),r={node:i,hasZ:this.hasZ,srsName:this.srsName,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_};return t&&Object.assign(r,t),this.writeGeometryElement(i,e,[r]),i}writeFeaturesNode(e,t){t=this.adaptOptions(t);const i=de(this.namespace,"featureMembers");i.setAttributeNS(ts,"xsi:schemaLocation",this.schemaLocation);const r={srsName:this.srsName,hasZ:this.hasZ,curve:this.curve_,surface:this.surface_,multiSurface:this.multiSurface_,multiCurve:this.multiCurve_,featureNS:this.featureNS,featureType:this.featureType};return t&&Object.assign(r,t),this.writeFeatureMembers_(i,e,[r]),i}}oe.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:ue(oe.prototype.readFlatPos),posList:ue(oe.prototype.readFlatPosList),coordinates:ue(fo.prototype.readFlatCoordinates)}},oe.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:oe.prototype.interiorParser,exterior:oe.prototype.exteriorParser}},oe.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:ue(Ee.prototype.readPoint),MultiPoint:ue(Ee.prototype.readMultiPoint),LineString:ue(Ee.prototype.readLineString),MultiLineString:ue(Ee.prototype.readMultiLineString),LinearRing:ue(Ee.prototype.readLinearRing),Polygon:ue(Ee.prototype.readPolygon),MultiPolygon:ue(Ee.prototype.readMultiPolygon),Surface:ue(oe.prototype.readSurface),MultiSurface:ue(oe.prototype.readMultiSurface),Curve:ue(oe.prototype.readCurve),MultiCurve:ue(oe.prototype.readMultiCurve),Envelope:ue(oe.prototype.readEnvelope)}},oe.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml":{curveMember:se(oe.prototype.curveMemberParser),curveMembers:se(oe.prototype.curveMemberParser)}},oe.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml":{surfaceMember:se(oe.prototype.surfaceMemberParser),surfaceMembers:se(oe.prototype.surfaceMemberParser)}},oe.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:se(Ee.prototype.readLineString),Curve:se(oe.prototype.readCurve)}},oe.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:se(Ee.prototype.readPolygon),Surface:se(oe.prototype.readSurface)}},oe.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml":{patches:ue(oe.prototype.readPatch)}},oe.prototype.CURVE_PARSERS={"http://www.opengis.net/gml":{segments:ue(oe.prototype.readSegment)}},oe.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml":{lowerCorner:se(oe.prototype.readFlatPosList),upperCorner:se(oe.prototype.readFlatPosList)}},oe.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml":{PolygonPatch:ue(oe.prototype.readPolygonPatch)}},oe.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml":{LineStringSegment:su(oe.prototype.readLineStringSegment)}},Ee.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:ue(Ee.prototype.readFlatLinearRing),Ring:ue(oe.prototype.readFlatCurveRing)}},oe.prototype.writeFeatures,oe.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{exterior:A(oe.prototype.writeRing),interior:A(oe.prototype.writeRing)}},oe.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:A(fe),upperCorner:A(fe)}},oe.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:A(oe.prototype.writeSurfaceOrPolygonMember),polygonMember:A(oe.prototype.writeSurfaceOrPolygonMember)}},oe.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:A(oe.prototype.writePointMember)}},oe.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:A(oe.prototype.writeLineStringOrCurveMember),curveMember:A(oe.prototype.writeLineStringOrCurveMember)}},oe.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:A(oe.prototype.writeCurveOrLineString),MultiCurve:A(oe.prototype.writeMultiCurveOrLineString),Point:A(oe.prototype.writePoint),MultiPoint:A(oe.prototype.writeMultiPoint),LineString:A(oe.prototype.writeCurveOrLineString),MultiLineString:A(oe.prototype.writeMultiCurveOrLineString),LinearRing:A(oe.prototype.writeLinearRing),Polygon:A(oe.prototype.writeSurfaceOrPolygon),MultiPolygon:A(oe.prototype.writeMultiSurfaceOrPolygon),Surface:A(oe.prototype.writeSurfaceOrPolygon),MultiSurface:A(oe.prototype.writeMultiSurfaceOrPolygon),Envelope:A(oe.prototype.writeEnvelope)}};var we=oe;const Ip=we;Ip.prototype.writeFeatures,Ip.prototype.writeFeaturesNode;var V2=Ip;class Ue extends we{constructor(e){e=e||{},super(e),this.schemaLocation=e.schemaLocation?e.schemaLocation:this.namespace+" http://schemas.opengis.net/gml/3.2.1/gml.xsd"}}Ue.prototype.namespace="http://www.opengis.net/gml/3.2",Ue.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml/3.2":{pos:ue(we.prototype.readFlatPos),posList:ue(we.prototype.readFlatPosList),coordinates:ue(fo.prototype.readFlatCoordinates)}},Ue.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml/3.2":{interior:we.prototype.interiorParser,exterior:we.prototype.exteriorParser}},Ue.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml/3.2":{Point:ue(Ee.prototype.readPoint),MultiPoint:ue(Ee.prototype.readMultiPoint),LineString:ue(Ee.prototype.readLineString),MultiLineString:ue(Ee.prototype.readMultiLineString),LinearRing:ue(Ee.prototype.readLinearRing),Polygon:ue(Ee.prototype.readPolygon),MultiPolygon:ue(Ee.prototype.readMultiPolygon),Surface:ue(Ue.prototype.readSurface),MultiSurface:ue(we.prototype.readMultiSurface),Curve:ue(Ue.prototype.readCurve),MultiCurve:ue(we.prototype.readMultiCurve),Envelope:ue(Ue.prototype.readEnvelope)}},Ue.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml/3.2":{curveMember:se(we.prototype.curveMemberParser),curveMembers:se(we.prototype.curveMemberParser)}},Ue.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{surfaceMember:se(we.prototype.surfaceMemberParser),surfaceMembers:se(we.prototype.surfaceMemberParser)}},Ue.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:se(Ee.prototype.readLineString),Curve:se(we.prototype.readCurve)}},Ue.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:se(Ee.prototype.readPolygon),Surface:se(we.prototype.readSurface)}},Ue.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{patches:ue(we.prototype.readPatch)}},Ue.prototype.CURVE_PARSERS={"http://www.opengis.net/gml/3.2":{segments:ue(we.prototype.readSegment)}},Ue.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml/3.2":{lowerCorner:se(we.prototype.readFlatPosList),upperCorner:se(we.prototype.readFlatPosList)}},Ue.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml/3.2":{PolygonPatch:ue(we.prototype.readPolygonPatch)}},Ue.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml/3.2":{LineStringSegment:su(we.prototype.readLineStringSegment)}},Ue.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml/3.2":{pointMember:se(Ee.prototype.pointMemberParser),pointMembers:se(Ee.prototype.pointMemberParser)}},Ue.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml/3.2":{lineStringMember:se(Ee.prototype.lineStringMemberParser),lineStringMembers:se(Ee.prototype.lineStringMemberParser)}},Ue.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml/3.2":{polygonMember:se(Ee.prototype.polygonMemberParser),polygonMembers:se(Ee.prototype.polygonMemberParser)}},Ue.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Point:se(Ee.prototype.readFlatCoordinatesFromNode)}},Ue.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:se(Ee.prototype.readLineString)}},Ue.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:se(Ee.prototype.readPolygon)}},Ue.prototype.RING_PARSERS={"http://www.opengis.net/gml/3.2":{LinearRing:ue(Ee.prototype.readFlatLinearRing),Ring:ue(Ue.prototype.readFlatCurveRing)}},Ue.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml/3.2":{exterior:A(we.prototype.writeRing),interior:A(we.prototype.writeRing)}},Ue.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lowerCorner:A(fe),upperCorner:A(fe)}},Ue.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{surfaceMember:A(we.prototype.writeSurfaceOrPolygonMember),polygonMember:A(we.prototype.writeSurfaceOrPolygonMember)}},Ue.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{pointMember:A(we.prototype.writePointMember)}},Ue.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lineStringMember:A(we.prototype.writeLineStringOrCurveMember),curveMember:A(we.prototype.writeLineStringOrCurveMember)}},Ue.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml/3.2":{Curve:A(we.prototype.writeCurveOrLineString),MultiCurve:A(we.prototype.writeMultiCurveOrLineString),Point:A(Ue.prototype.writePoint),MultiPoint:A(we.prototype.writeMultiPoint),LineString:A(we.prototype.writeCurveOrLineString),MultiLineString:A(we.prototype.writeMultiCurveOrLineString),LinearRing:A(we.prototype.writeLinearRing),Polygon:A(we.prototype.writeSurfaceOrPolygon),MultiPolygon:A(we.prototype.writeMultiSurfaceOrPolygon),Surface:A(we.prototype.writeSurfaceOrPolygon),MultiSurface:A(we.prototype.writeMultiSurfaceOrPolygon),Envelope:A(we.prototype.writeEnvelope)}};var Oh=Ue;const It=[null,"http://www.topografix.com/GPX/1/0","http://www.topografix.com/GPX/1/1"],j2="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd",X2={rte:n1,trk:i1,wpt:r1},Y2=G(It,{rte:se(n1),trk:se(i1),wpt:se(r1)}),Z2=G(It,{text:I(j,"linkText"),type:I(j,"linkType")}),W2=G(It,{rte:A(yA),trk:A(vA),wpt:A(EA)});class H2 extends co{constructor(e){super(),e=e||{},this.dataProjection=J("EPSG:4326"),this.readExtensions_=e.readExtensions}handleReadExtensions_(e){e||(e=[]);for(let t=0,i=e.length;t<i;++t){const r=e[t];if(this.readExtensions_){const s=r.get("extensionsNode_")||null;this.readExtensions_(r,s)}r.set("extensionsNode_",void 0)}}readFeatureFromNode(e,t){if(!It.includes(e.namespaceURI))return null;const i=X2[e.localName];if(!i)return null;const r=i(e,[this.getReadOptions(e,t)]);return r?(this.handleReadExtensions_([r]),r):null}readFeaturesFromNode(e,t){if(!It.includes(e.namespaceURI))return[];if(e.localName=="gpx"){const i=z([],Y2,e,[this.getReadOptions(e,t)]);return i?(this.handleReadExtensions_(i),i):[]}return[]}writeFeaturesNode(e,t){t=this.adaptOptions(t);const i=de("http://www.topografix.com/GPX/1/1","gpx"),r="http://www.w3.org/2000/xmlns/";return i.setAttributeNS(r,"xmlns:xsi",ts),i.setAttributeNS(ts,"xsi:schemaLocation",j2),i.setAttribute("version","1.1"),i.setAttribute("creator","OpenLayers"),ge({node:i},W2,gA,e,[t]),i}}const K2=G(It,{name:I(j),cmt:I(j),desc:I(j),src:I(j),link:Pp,number:I(Et),extensions:Mp,type:I(j),rtept:pA}),q2=G(It,{ele:I($e),time:I(Fh)}),J2=G(It,{name:I(j),cmt:I(j),desc:I(j),src:I(j),link:Pp,number:I(Et),type:I(j),extensions:Mp,trkseg:_A}),Q2=G(It,{trkpt:mA}),eA=G(It,{ele:I($e),time:I(Fh)}),tA=G(It,{ele:I($e),time:I(Fh),magvar:I($e),geoidheight:I($e),name:I(j),cmt:I(j),desc:I(j),src:I(j),link:Pp,sym:I(j),type:I(j),fix:I(j),sat:I(Et),hdop:I($e),vdop:I($e),pdop:I($e),ageofdgpsdata:I($e),dgpsid:I(Et),extensions:Mp}),nA=["text","type"],iA=G(It,{text:A(fe),type:A(fe)}),rA=G(It,["name","cmt","desc","src","link","number","type","rtept"]),sA=G(It,{name:A(fe),cmt:A(fe),desc:A(fe),src:A(fe),link:A(Fp),number:A(ou),type:A(fe),rtept:Rp(A(Op))}),oA=G(It,["ele","time"]),aA=G(It,["name","cmt","desc","src","link","number","type","trkseg"]),lA=G(It,{name:A(fe),cmt:A(fe),desc:A(fe),src:A(fe),link:A(Fp),number:A(ou),type:A(fe),trkseg:Rp(A(xA))}),uA=ut("trkpt"),cA=G(It,{trkpt:A(Op)}),hA=G(It,["ele","time","magvar","geoidheight","name","cmt","desc","src","link","sym","type","fix","sat","hdop","vdop","pdop","ageofdgpsdata","dgpsid"]),fA=G(It,{ele:A(_n),time:A(t1),magvar:A(_n),geoidheight:A(_n),name:A(fe),cmt:A(fe),desc:A(fe),src:A(fe),link:A(Fp),sym:A(fe),type:A(fe),fix:A(fe),sat:A(ou),hdop:A(_n),vdop:A(_n),pdop:A(_n),ageofdgpsdata:A(_n),dgpsid:A(ou)}),dA={Point:"wpt",LineString:"rte",MultiLineString:"trk"};function gA(n,e,t){const i=n.getGeometry();if(i){const r=dA[i.getType()];if(r){const s=e[e.length-1].node;return de(s.namespaceURI,r)}}}function Ap(n,e,t,i){return n.push(parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))),"ele"in i?(n.push(i.ele),delete i.ele,e.hasZ=!0):n.push(0),"time"in i?(n.push(i.time),delete i.time,e.hasM=!0):n.push(0),n}function Lp(n,e,t){let i="XY",r=2;if(n.hasZ&&n.hasM?(i="XYZM",r=4):n.hasZ?(i="XYZ",r=3):n.hasM&&(i="XYM",r=3),r!==4){for(let s=0,o=e.length/4;s<o;s++)e[s*r]=e[s*4],e[s*r+1]=e[s*4+1],n.hasZ&&(e[s*r+2]=e[s*4+2]),n.hasM&&(e[s*r+2]=e[s*4+3]);if(e.length=e.length/4*r,t)for(let s=0,o=t.length;s<o;s++)t[s]=t[s]/4*r}return i}function Pp(n,e){const t=e[e.length-1],i=n.getAttribute("href");i!==null&&(t.link=i),mn(Z2,n,e)}function Mp(n,e){const t=e[e.length-1];t.extensionsNode_=n}function pA(n,e){const t=z({},q2,n,e);if(t){const i=e[e.length-1],r=i.flatCoordinates,s=i.layoutOptions;Ap(r,s,n,t)}}function mA(n,e){const t=z({},eA,n,e);if(t){const i=e[e.length-1],r=i.flatCoordinates,s=i.layoutOptions;Ap(r,s,n,t)}}function _A(n,e){const t=e[e.length-1];mn(Q2,n,e);const i=t.flatCoordinates;t.ends.push(i.length)}function n1(n,e){const t=e[0],i=z({flatCoordinates:[],layoutOptions:{}},K2,n,e);if(!i)return;const r=i.flatCoordinates;delete i.flatCoordinates;const s=i.layoutOptions;delete i.layoutOptions;const o=Lp(s,r),a=new lt(r,o);nt(a,!1,t);const l=new Ne(a);return l.setProperties(i,!0),l}function i1(n,e){const t=e[0],i=z({flatCoordinates:[],ends:[],layoutOptions:{}},J2,n,e);if(!i)return;const r=i.flatCoordinates;delete i.flatCoordinates;const s=i.ends;delete i.ends;const o=i.layoutOptions;delete i.layoutOptions;const a=Lp(o,r,s),l=new gn(r,a,s);nt(l,!1,t);const u=new Ne(l);return u.setProperties(i,!0),u}function r1(n,e){const t=e[0],i=z({},tA,n,e);if(!i)return;const r={},s=Ap([],r,n,i),o=Lp(r,s),a=new st(s,o);nt(a,!1,t);const l=new Ne(a);return l.setProperties(i,!0),l}function Fp(n,e,t){n.setAttribute("href",e);const r=t[t.length-1].properties,s=[r.linkText,r.linkType];ge({node:n},iA,Nt,s,t,nA)}function Op(n,e,t){const i=t[t.length-1],s=i.node.namespaceURI,o=i.properties;switch(n.setAttributeNS(null,"lat",String(e[1])),n.setAttributeNS(null,"lon",String(e[0])),i.geometryLayout){case"XYZM":e[3]!==0&&(o.time=e[3]);case"XYZ":e[2]!==0&&(o.ele=e[2]);break;case"XYM":e[2]!==0&&(o.time=e[2]);break}const l=n.nodeName=="rtept"?oA[s]:hA[s],u=pn(o,l);ge({node:n,properties:o},fA,Nt,u,t,l)}function yA(n,e,t){const i=t[0],r=e.getProperties(),s={node:n};s.properties=r;const o=e.getGeometry();if(o.getType()=="LineString"){const c=nt(o,!0,i);s.geometryLayout=c.getLayout(),r.rtept=c.getCoordinates()}const a=t[t.length-1].node,l=rA[a.namespaceURI],u=pn(r,l);ge(s,sA,Nt,u,t,l)}function vA(n,e,t){const i=t[0],r=e.getProperties(),s={node:n};s.properties=r;const o=e.getGeometry();if(o.getType()=="MultiLineString"){const c=nt(o,!0,i);r.trkseg=c.getLineStrings()}const a=t[t.length-1].node,l=aA[a.namespaceURI],u=pn(r,l);ge(s,lA,Nt,u,t,l)}function xA(n,e,t){const i={node:n};i.geometryLayout=e.getLayout(),i.properties={},ge(i,cA,uA,e.getCoordinates(),t)}function EA(n,e,t){const i=t[0],r=t[t.length-1];r.properties=e.getProperties();const s=e.getGeometry();if(s.getType()=="Point"){const o=nt(s,!0,i);r.geometryLayout=o.getLayout(),Op(n,o.getCoordinates(),t)}}var wA=H2;class Md extends Tg{constructor(e){super(),this.geometries_=e||null,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(Pe),this.changeEventsKeys_.length=0}listenGeometriesChange_(){if(!!this.geometries_)for(let e=0,t=this.geometries_.length;e<t;++e)this.changeEventsKeys_.push(re(this.geometries_[e],K.CHANGE,this.changed,this))}clone(){const e=new Md(null);return e.setGeometries(this.geometries_),e.applyProperties(this),e}closestPointXY(e,t,i,r){if(r<Br(this.getExtent(),e,t))return r;const s=this.geometries_;for(let o=0,a=s.length;o<a;++o)r=s[o].closestPointXY(e,t,i,r);return r}containsXY(e,t){const i=this.geometries_;for(let r=0,s=i.length;r<s;++r)if(i[r].containsXY(e,t))return!0;return!1}computeExtent(e){zr(e);const t=this.geometries_;for(let i=0,r=t.length;i<r;++i)tg(e,t[i].getExtent());return e}getGeometries(){return s1(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let i=0,r=t.length;i<r;++i)t[i].getType()===this.getType()?e=e.concat(t[i].getGeometriesArrayRecursive()):e.push(t[i]);return e}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=[],i=this.geometries_;let r=!1;for(let s=0,o=i.length;s<o;++s){const a=i[s],l=a.getSimplifiedGeometry(e);t.push(l),l!==a&&(r=!0)}if(r){const s=new Md(null);return s.setGeometriesArray(t),s}else return this.simplifiedGeometryMaxMinSquaredTolerance=e,this}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let i=0,r=t.length;i<r;++i)if(t[i].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){const i=this.geometries_;for(let r=0,s=i.length;r<s;++r)i[r].rotate(e,t);this.changed()}scale(e,t,i){i||(i=Ot(this.getExtent()));const r=this.geometries_;for(let s=0,o=r.length;s<o;++s)r[s].scale(e,t,i);this.changed()}setGeometries(e){this.setGeometriesArray(s1(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let i=0,r=t.length;i<r;++i)t[i].applyTransform(e);this.changed()}translate(e,t){const i=this.geometries_;for(let r=0,s=i.length;r<s;++r)i[r].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function s1(n){const e=[];for(let t=0,i=n.length;t<i;++t)e.push(n[t].clone());return e}var Vt=Md;class TA extends Ih{constructor(e){e=e||{},super(),this.dataProjection=J(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=J(e.featureProjection)),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let i=null;e.type==="Feature"?i=e:i={type:"Feature",geometry:e,properties:null};const r=$p(i.geometry,t),s=new Ne;return this.geometryName_?s.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in i!==void 0&&s.setGeometryName(i.geometry_name),s.setGeometry(r),"id"in i&&s.setId(i.id),i.properties&&s.setProperties(i.properties,!0),s}readFeaturesFromObject(e,t){const i=e;let r=null;if(i.type==="FeatureCollection"){const s=e;r=[];const o=s.features;for(let a=0,l=o.length;a<l;++a)r.push(this.readFeatureFromObject(o[a],t))}else r=[this.readFeatureFromObject(e,t)];return r}readGeometryFromObject(e,t){return $p(e,t)}readProjectionFromObject(e){const t=e.crs;let i;return t?t.type=="name"?i=J(t.properties.name):t.type==="EPSG"?i=J("EPSG:"+t.properties.code):ne(!1,36):i=this.dataProjection,i}writeFeatureObject(e,t){t=this.adaptOptions(t);const i={type:"Feature",geometry:null,properties:null},r=e.getId();if(r!==void 0&&(i.id=r),!e.hasProperties())return i;const s=e.getProperties(),o=e.getGeometry();return o&&(i.geometry=Dp(o,t),delete s[e.getGeometryName()]),oi(s)||(i.properties=s),i}writeFeaturesObject(e,t){t=this.adaptOptions(t);const i=[];for(let r=0,s=e.length;r<s;++r)i.push(this.writeFeatureObject(e[r],t));return{type:"FeatureCollection",features:i}}writeGeometryObject(e,t){return Dp(e,this.adaptOptions(t))}}function $p(n,e){if(!n)return null;let t;switch(n.type){case"Point":{t=bA(n);break}case"LineString":{t=RA(n);break}case"Polygon":{t=LA(n);break}case"MultiPoint":{t=IA(n);break}case"MultiLineString":{t=CA(n);break}case"MultiPolygon":{t=AA(n);break}case"GeometryCollection":{t=SA(n);break}default:throw new Error("Unsupported GeoJSON type: "+n.type)}return nt(t,!1,e)}function SA(n,e){const t=n.geometries.map(function(i){return $p(i,e)});return new Vt(t)}function bA(n){return new st(n.coordinates)}function RA(n){return new lt(n.coordinates)}function CA(n){return new gn(n.coordinates)}function IA(n){return new qn(n.coordinates)}function AA(n){return new Bn(n.coordinates)}function LA(n){return new Dt(n.coordinates)}function Dp(n,e){n=nt(n,!0,e);const t=n.getType();let i;switch(t){case"Point":{i=DA(n);break}case"LineString":{i=MA(n);break}case"Polygon":{i=NA(n,e);break}case"MultiPoint":{i=OA(n);break}case"MultiLineString":{i=FA(n);break}case"MultiPolygon":{i=$A(n,e);break}case"GeometryCollection":{i=PA(n,e);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+t)}return i}function PA(n,e){e=Object.assign({},e),delete e.featureProjection;const t=n.getGeometriesArray().map(function(i){return Dp(i,e)});return{type:"GeometryCollection",geometries:t}}function MA(n,e){return{type:"LineString",coordinates:n.getCoordinates()}}function FA(n,e){return{type:"MultiLineString",coordinates:n.getCoordinates()}}function OA(n,e){return{type:"MultiPoint",coordinates:n.getCoordinates()}}function $A(n,e){let t;return e&&(t=e.rightHanded),{type:"MultiPolygon",coordinates:n.getCoordinates(t)}}function DA(n,e){return{type:"Point",coordinates:n.getCoordinates()}}function NA(n,e){let t;return e&&(t=e.rightHanded),{type:"Polygon",coordinates:n.getCoordinates(t)}}var o1=TA;class kA extends va{constructor(){super()}getType(){return"text"}readFeature(e,t){return this.readFeatureFromText($h(e),this.adaptOptions(t))}readFeatureFromText(e,t){return ae()}readFeatures(e,t){return this.readFeaturesFromText($h(e),this.adaptOptions(t))}readFeaturesFromText(e,t){return ae()}readGeometry(e,t){return this.readGeometryFromText($h(e),this.adaptOptions(t))}readGeometryFromText(e,t){return ae()}readProjection(e){return this.readProjectionFromText($h(e))}readProjectionFromText(e){return this.dataProjection}writeFeature(e,t){return this.writeFeatureText(e,this.adaptOptions(t))}writeFeatureText(e,t){return ae()}writeFeatures(e,t){return this.writeFeaturesText(e,this.adaptOptions(t))}writeFeaturesText(e,t){return ae()}writeGeometry(e,t){return this.writeGeometryText(e,this.adaptOptions(t))}writeGeometryText(e,t){return ae()}}function $h(n){return typeof n=="string"?n:""}var Dh=kA;const GA=/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/,UA=/^H.([A-Z]{3}).*?:(.*)/,BA=/^HFDTE(\d{2})(\d{2})(\d{2})/,zA=/\r\n|\r|\n/;class VA extends Dh{constructor(e){super(),e=e||{},this.dataProjection=J("EPSG:4326"),this.altitudeMode_=e.altitudeMode?e.altitudeMode:"none"}readFeatureFromText(e,t){const i=this.altitudeMode_,r=e.split(zA),s={},o=[];let a=2e3,l=0,u=1,c=-1,h,f;for(h=0,f=r.length;h<f;++h){const p=r[h];let _;if(p.charAt(0)=="B"){if(_=GA.exec(p),_){const v=parseInt(_[1],10),x=parseInt(_[2],10),y=parseInt(_[3],10);let T=parseInt(_[4],10)+parseInt(_[5],10)/6e4;_[6]=="S"&&(T=-T);let w=parseInt(_[7],10)+parseInt(_[8],10)/6e4;if(_[9]=="W"&&(w=-w),o.push(w,T),i!="none"){let S;i=="gps"?S=parseInt(_[11],10):i=="barometric"?S=parseInt(_[12],10):S=0,o.push(S)}let E=Date.UTC(a,l,u,v,x,y);E<c&&(E=Date.UTC(a,l,u+1,v,x,y)),o.push(E/1e3),c=E}}else p.charAt(0)=="H"&&(_=BA.exec(p),_?(u=parseInt(_[1],10),l=parseInt(_[2],10)-1,a=2e3+parseInt(_[3],10)):(_=UA.exec(p),_&&(s[_[1]]=_[2].trim())))}if(o.length===0)return null;const d=i=="none"?"XYM":"XYZM",g=new lt(o,d),m=new Ne(nt(g,!1,t));return m.setProperties(s,!0),m}readFeaturesFromText(e,t){const i=this.readFeatureFromText(e,t);return i?[i]:[]}}var jA=VA;const bt={VERSION1:"version1",VERSION2:"version2",VERSION3:"version3"},go={};go[bt.VERSION1]={level0:{supports:[],formats:[],qualities:["native"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["native"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["native","color","grey","bitonal"]}},go[bt.VERSION2]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByDistortedWh","sizeByWh"],formats:["jpg","png"],qualities:["default","bitonal"]}},go[bt.VERSION3]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","regionSquare","sizeByW","sizeByH","sizeByWh"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionSquare","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["default"]}},go.none={none:{supports:[],formats:[],qualities:[]}};const XA=/^https?:\/\/library\.stanford\.edu\/iiif\/image-api\/(?:1\.1\/)?compliance\.html#level[0-2]$/,a1=/^https?:\/\/iiif\.io\/api\/image\/2\/level[0-2](?:\.json)?$/,YA=/(^https?:\/\/iiif\.io\/api\/image\/3\/level[0-2](?:\.json)?$)|(^level[0-2]$)/;function ZA(n){let e=n.getComplianceLevelSupportedFeatures();return e===void 0&&(e=go[bt.VERSION1].level0),{url:n.imageInfo["@id"]===void 0?void 0:n.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),supports:e.supports,formats:[...e.formats,n.imageInfo.formats===void 0?[]:n.imageInfo.formats],qualities:[...e.qualities,n.imageInfo.qualities===void 0?[]:n.imageInfo.qualities],resolutions:n.imageInfo.scale_factors,tileSize:n.imageInfo.tile_width!==void 0?n.imageInfo.tile_height!==void 0?[n.imageInfo.tile_width,n.imageInfo.tile_height]:[n.imageInfo.tile_width,n.imageInfo.tile_width]:n.imageInfo.tile_height!=null?[n.imageInfo.tile_height,n.imageInfo.tile_height]:void 0}}function WA(n){const e=n.getComplianceLevelSupportedFeatures(),t=Array.isArray(n.imageInfo.profile)&&n.imageInfo.profile.length>1,i=t&&n.imageInfo.profile[1].supports?n.imageInfo.profile[1].supports:[],r=t&&n.imageInfo.profile[1].formats?n.imageInfo.profile[1].formats:[],s=t&&n.imageInfo.profile[1].qualities?n.imageInfo.profile[1].qualities:[];return{url:n.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:n.imageInfo.sizes===void 0?void 0:n.imageInfo.sizes.map(function(o){return[o.width,o.height]}),tileSize:n.imageInfo.tiles===void 0?void 0:[n.imageInfo.tiles.map(function(o){return o.width})[0],n.imageInfo.tiles.map(function(o){return o.height===void 0?o.width:o.height})[0]],resolutions:n.imageInfo.tiles===void 0?void 0:n.imageInfo.tiles.map(function(o){return o.scaleFactors})[0],supports:[...e.supports,...i],formats:[...e.formats,...r],qualities:[...e.qualities,...s]}}function HA(n){const e=n.getComplianceLevelSupportedFeatures(),t=n.imageInfo.extraFormats===void 0?e.formats:[...e.formats,...n.imageInfo.extraFormats],i=n.imageInfo.preferredFormats!==void 0&&Array.isArray(n.imageInfo.preferredFormats)&&n.imageInfo.preferredFormats.length>0?n.imageInfo.preferredFormats.filter(function(r){return["jpg","png","gif"].includes(r)}).reduce(function(r,s){return r===void 0&&t.includes(s)?s:r},void 0):void 0;return{url:n.imageInfo.id,sizes:n.imageInfo.sizes===void 0?void 0:n.imageInfo.sizes.map(function(r){return[r.width,r.height]}),tileSize:n.imageInfo.tiles===void 0?void 0:[n.imageInfo.tiles.map(function(r){return r.width})[0],n.imageInfo.tiles.map(function(r){return r.height})[0]],resolutions:n.imageInfo.tiles===void 0?void 0:n.imageInfo.tiles.map(function(r){return r.scaleFactors})[0],supports:n.imageInfo.extraFeatures===void 0?e.supports:[...e.supports,...n.imageInfo.extraFeatures],formats:t,qualities:n.imageInfo.extraQualities===void 0?e.qualities:[...e.qualities,...n.imageInfo.extraQualities],preferredFormat:i}}const Nh={};Nh[bt.VERSION1]=ZA,Nh[bt.VERSION2]=WA,Nh[bt.VERSION3]=HA;class KA{constructor(e){this.setImageInfo(e)}setImageInfo(e){typeof e=="string"?this.imageInfo=JSON.parse(e):this.imageInfo=e}getImageApiVersion(){if(this.imageInfo===void 0)return;let e=this.imageInfo["@context"]||"ol-no-context";typeof e=="string"&&(e=[e]);for(let t=0;t<e.length;t++)switch(e[t]){case"http://library.stanford.edu/iiif/image-api/1.1/context.json":case"http://iiif.io/api/image/1/context.json":return bt.VERSION1;case"http://iiif.io/api/image/2/context.json":return bt.VERSION2;case"http://iiif.io/api/image/3/context.json":return bt.VERSION3;case"ol-no-context":if(this.getComplianceLevelEntryFromProfile(bt.VERSION1)&&this.imageInfo.identifier)return bt.VERSION1;break}ne(!1,61)}getComplianceLevelEntryFromProfile(e){if(!(this.imageInfo===void 0||this.imageInfo.profile===void 0))switch(e===void 0&&(e=this.getImageApiVersion()),e){case bt.VERSION1:if(XA.test(this.imageInfo.profile))return this.imageInfo.profile;break;case bt.VERSION3:if(YA.test(this.imageInfo.profile))return this.imageInfo.profile;break;case bt.VERSION2:if(typeof this.imageInfo.profile=="string"&&a1.test(this.imageInfo.profile))return this.imageInfo.profile;if(Array.isArray(this.imageInfo.profile)&&this.imageInfo.profile.length>0&&typeof this.imageInfo.profile[0]=="string"&&a1.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0];break}}getComplianceLevelFromProfile(e){const t=this.getComplianceLevelEntryFromProfile(e);if(t===void 0)return;const i=t.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}getComplianceLevelSupportedFeatures(){if(this.imageInfo===void 0)return;const e=this.getImageApiVersion(),t=this.getComplianceLevelFromProfile(e);return t===void 0?go.none.none:go[e][t]}getTileSourceOptions(e){const t=e||{},i=this.getImageApiVersion();if(i===void 0)return;const r=i===void 0?void 0:Nh[i](this);if(r!==void 0)return{url:r.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:r.sizes,format:t.format!==void 0&&r.formats.includes(t.format)?t.format:r.preferredFormat!==void 0?r.preferredFormat:"jpg",supports:r.supports,quality:t.quality&&r.qualities.includes(t.quality)?t.quality:r.qualities.includes("native")?"native":"default",resolutions:Array.isArray(r.resolutions)?r.resolutions.sort(function(s,o){return o-s}):void 0,tileSize:r.tileSize}}}var qA=KA;class oy{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null}clone(){const e=this.getColor();return new oy({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){this.color_=e}}var yn=oy;class ay{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=tt(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const e=this.getScale();return new ay({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,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 ae()}getImage(e){return ae()}getHitDetectionImage(){return ae()}getPixelRatio(e){return 1}getImageState(){return ae()}getImageSize(){return ae()}getOrigin(){return ae()}getSize(){return ae()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=tt(e)}listenImageChange(e){ae()}load(){ae()}unlistenImageChange(e){ae()}}var Np=ay;let au=null;class l1 extends Gs{constructor(e,t,i,r,s,o){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=r,this.canvas_={},this.color_=o,this.unlisten_=null,this.imageState_=s,this.size_=i,this.src_=t,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===ce.LOADED){au||(au=yt(1,1)),au.drawImage(this.image_,0,0);try{au.getImageData(0,0,1,1),this.tainted_=!1}catch{au=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(K.CHANGE)}handleImageError_(){this.imageState_=ce.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=ce.LOADED,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(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],i=yt(e,t);i.fillRect(0,0,e,t),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===ce.IDLE){this.image_||this.initializeImage_(),this.imageState_=ce.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=lh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==ce.LOADED)return;const t=this.image_,i=document.createElement("canvas");i.width=Math.ceil(t.width*e),i.height=Math.ceil(t.height*e);const r=i.getContext("2d");r.scale(e,e),r.drawImage(t,0,0),r.globalCompositeOperation="multiply",r.fillStyle=kg(this.color_),r.fillRect(0,0,i.width/e,i.height/e),r.globalCompositeOperation="destination-in",r.drawImage(t,0,0),this.canvas_[e]=i}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function u1(n,e,t,i,r,s){let o=Vl.get(e,i,s);return o||(o=new l1(n,e,t,i,r,s),Vl.set(e,i,s,o)),o}var JA=l1;class ly extends Np{constructor(e){e=e||{};const t=e.opacity!==void 0?e.opacity:1,i=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:i,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null;const o=e.img!==void 0?e.img:null;this.imgSize_=e.imgSize;let a=e.src;ne(!(a!==void 0&&o),4),ne(!o||o&&this.imgSize_,5),(a===void 0||a.length===0)&&o&&(a=o.src||H(o)),ne(a!==void 0&&a.length>0,6);const l=e.src!==void 0?ce.IDLE:ce.LOADED;this.color_=e.color!==void 0?Kr(e.color):null,this.iconImage_=u1(o,a,this.imgSize_!==void 0?this.imgSize_:null,this.crossOrigin_,l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null}clone(){const e=this.getScale();return new ly({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:Array.isArray(e)?e.slice():e,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]-t[0]/i[0],e[1]+t[1]/i[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){const t=this.getSize(),i=this.iconImage_.getSize();if(!t||!i)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=i[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=i[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}listenImageChange(e){this.iconImage_.addEventListener(K.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(K.CHANGE,e)}}var Ea=ly;class uy{constructor(e){e=e||{},this.color_=e.color!==void 0?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash!==void 0?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}clone(){const e=this.getColor();return new uy({color:Array.isArray(e)?e.slice():e||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(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setWidth(e){this.width_=e}}var on=uy;class cy extends Np{constructor(e){const t=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:1,rotateWithView:t,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.canvas_=void 0,this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius_=e.radius!==void 0?e.radius:e.radius1,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_=null,this.renderOptions_=null,this.render()}clone(){const e=this.getScale(),t=new cy({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){const e=this.size_;if(!e)return null;const t=this.getDisplacement(),i=this.getScaleArray();return[e[0]/2-t[0]/i[0],e[1]/2+t[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.canvas_[e];if(!t){const i=this.renderOptions_,r=yt(i.size*e,i.size*e);this.draw_(i,r,e),t=r.canvas,this.canvas_[e]=t}return t}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return ce.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,i){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius_,s=this.radius2_===void 0?r:this.radius2_;if(r<s){const w=r;r=s,s=w}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),u=Math.sqrt(s*s-l*l),c=r-u,h=Math.sqrt(l*l+c*c),f=h/l;if(e==="miter"&&f<=i)return f*t;const d=t/2/f,g=t/2*(c/h),p=Math.sqrt((r+d)*(r+d)+g*g)-r;if(this.radius2_===void 0||e==="bevel")return p*2;const _=r*Math.sin(a),v=Math.sqrt(r*r-_*_),x=s-v,T=Math.sqrt(_*_+x*x)/_;if(T<=i){const w=T*t/2-s-r;return 2*Math.max(p,w)}return p*2}createRenderOptions(){let e=ro,t=0,i=null,r=0,s,o=0;this.stroke_&&(s=this.stroke_.getColor(),s===null&&(s=da),s=mi(s),o=this.stroke_.getWidth(),o===void 0&&(o=pa),i=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset(),e=this.stroke_.getLineJoin(),e===void 0&&(e=ro),t=this.stroke_.getMiterLimit(),t===void 0&&(t=fa));const a=this.calculateLineJoinSize_(e,o,t),l=Math.max(this.radius_,this.radius2_||0),u=Math.ceil(2*l+a);return{strokeStyle:s,strokeWidth:o,size:u,lineDash:i,lineDashOffset:r,lineJoin:e,miterLimit:t}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.canvas_={},this.size_=[e,e]}draw_(e,t,i){if(t.scale(i,i),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=Mi),t.fillStyle=mi(r),t.fill()}this.stroke_&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){if(this.fill_){let t=this.fill_.getColor(),i=0;if(typeof t=="string"&&(t=Kr(t)),t===null?i=1:Array.isArray(t)&&(i=t.length===4?t[3]:1),i===0){const r=yt(e.size,e.size);this.hitDetectionCanvas_=r.canvas,this.drawHitDetectionCanvas_(e,r)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))}createPath_(e){let t=this.points_;const i=this.radius_;if(t===1/0)e.arc(0,0,i,0,2*Math.PI);else{const r=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(t*=2);const s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){const l=s+a*o,u=a%2===0?i:r;e.lineTo(u*Math.cos(l),u*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Mi,t.fill(),this.stroke_&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}}var kp=cy;class hy extends kp{constructor(e){e=e||{radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale!==void 0?e.scale:1,rotation:e.rotation!==void 0?e.rotation:0,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const e=this.getScale(),t=new hy({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}setRadius(e){this.radius_=e,this.render()}}var lu=hy;class Os{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=f1,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill!==void 0?e.fill:null,this.image_=e.image!==void 0?e.image:null,this.renderer_=e.renderer!==void 0?e.renderer:null,this.hitDetectionRenderer_=e.hitDetectionRenderer!==void 0?e.hitDetectionRenderer:null,this.stroke_=e.stroke!==void 0?e.stroke:null,this.text_=e.text!==void 0?e.text:null,this.zIndex_=e.zIndex}clone(){let e=this.getGeometry();return e&&typeof e=="object"&&(e=e.clone()),new Os({geometry:e,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(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e=="function"?this.geometryFunction_=e:typeof e=="string"?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=f1,this.geometry_=e}setZIndex(e){this.zIndex_=e}}function c1(n){let e;if(typeof n=="function")e=n;else{let t;Array.isArray(n)?t=n:(ne(typeof n.getZIndex=="function",41),t=[n]),e=function(){return t}}return e}let Gp=null;function h1(n,e){if(!Gp){const t=new yn({color:"rgba(255,255,255,0.4)"}),i=new on({color:"#3399CC",width:1.25});Gp=[new Os({image:new lu({fill:t,stroke:i,radius:5}),fill:t,stroke:i})]}return Gp}function wa(){const n={},e=[255,255,255,1],t=[0,153,255,1],i=3;return n.Polygon=[new Os({fill:new yn({color:[255,255,255,.5]})})],n.MultiPolygon=n.Polygon,n.LineString=[new Os({stroke:new on({color:e,width:i+2})}),new Os({stroke:new on({color:t,width:i})})],n.MultiLineString=n.LineString,n.Circle=n.Polygon.concat(n.LineString),n.Point=[new Os({image:new lu({radius:i*2,fill:new yn({color:t}),stroke:new on({color:e,width:i/2})}),zIndex:1/0})],n.MultiPoint=n.Point,n.GeometryCollection=n.Polygon.concat(n.LineString,n.Point),n}function f1(n){return n.getGeometry()}var kt=Os;const QA="#333";class fy{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=tt(e.scale!==void 0?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.textBaseline_=e.textBaseline,this.fill_=e.fill!==void 0?e.fill:new yn({color:QA}),this.maxAngle_=e.maxAngle!==void 0?e.maxAngle:Math.PI/4,this.placement_=e.placement!==void 0?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=e.stroke!==void 0?e.stroke:null,this.offsetX_=e.offsetX!==void 0?e.offsetX:0,this.offsetY_=e.offsetY!==void 0?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding}clone(){const e=this.getScale();return new fy({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,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_}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(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRotateWithView(e){this.rotateWithView_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=tt(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}}var po=fy;const ur=["http://www.google.com/kml/ext/2.2"],le=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],eL="http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd",d1={fraction:"fraction",pixels:"pixels",insetPixels:"pixels"},tL=G(le,{ExtendedData:C1,Region:I1,MultiGeometry:I(S1,"geometry"),LineString:I(w1,"geometry"),LinearRing:I(T1,"geometry"),Point:I(b1,"geometry"),Polygon:I(R1,"geometry"),Style:I(Yp),StyleMap:VL,address:I(j),description:I(j),name:I(j),open:I(lr),phoneNumber:I(j),styleUrl:I(_1),visibility:I(lr)},G(ur,{MultiTrack:I(LL,"geometry"),Track:I(E1,"geometry")})),nL=G(le,{ExtendedData:C1,Region:I1,Link:tP,address:I(j),description:I(j),name:I(j),open:I(lr),phoneNumber:I(j),visibility:I(lr)}),iL=G(le,{href:I(m1)}),g1=G(le,{LatLonAltBox:WL,Lod:KL}),rL=G(le,["Document","Placemark"]),sL=G(le,{Document:A(uP),Placemark:A(O1)});let Ta,uu=null;function oL(){return uu}let Up,cu,hu,fu,kh,Gh=null;function aL(){return Gh}let Bp,Uh=null;function lL(){return Uh}let zp,is=null;function uL(){return is}let Vp=null;function cL(){return Vp}let Bh=null;function hL(){return Bh}function zh(n){return 32/Math.min(n[0],n[1])}function fL(){Ta=[255,255,255,1],uu=new yn({color:Ta}),Up=[20,2],cu="pixels",hu="pixels",fu=[64,64],kh="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",Gh=new Ea({anchor:Up,anchorOrigin:"bottom-left",anchorXUnits:cu,anchorYUnits:hu,crossOrigin:"anonymous",rotation:0,scale:zh(fu),size:fu,src:kh}),Bp="NO_IMAGE",Uh=new on({color:Ta,width:1}),zp=new on({color:[51,51,51,1],width:2}),is=new po({font:"bold 16px Helvetica",fill:uu,stroke:zp,scale:.8}),Vp=new kt({fill:uu,image:Gh,text:is,stroke:Uh,zIndex:0}),Bh=[Vp]}let Vh;function dL(n){return n}class gL extends co{constructor(e){super(),e=e||{},Bh||fL(),this.dataProjection=J("EPSG:4326"),this.defaultStyle_=e.defaultStyle?e.defaultStyle:Bh,this.extractStyles_=e.extractStyles!==void 0?e.extractStyles:!0,this.writeStyles_=e.writeStyles!==void 0?e.writeStyles:!0,this.sharedStyles_={},this.showPointNames_=e.showPointNames!==void 0?e.showPointNames:!0,this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:"anonymous",this.iconUrlFunction_=e.iconUrlFunction?e.iconUrlFunction:dL,this.supportedMediaTypes=["application/vnd.google-earth.kml+xml"]}readDocumentOrFolder_(e,t){const i=G(le,{Document:su(this.readDocumentOrFolder_,this),Folder:su(this.readDocumentOrFolder_,this),Placemark:se(this.readPlacemark_,this),Style:this.readSharedStyle_.bind(this),StyleMap:this.readSharedStyleMap_.bind(this)}),r=z([],i,e,t,this);if(r)return r}readPlacemark_(e,t){const i=z({geometry:null},tL,e,t,this);if(!i)return;const r=new Ne,s=e.getAttribute("id");s!==null&&r.setId(s);const o=t[0],a=i.geometry;if(a&&nt(a,!1,o),r.setGeometry(a),delete i.geometry,this.extractStyles_){const l=i.Style,u=i.styleUrl,c=mL(l,u,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);r.setStyle(c)}return delete i.Style,r.setProperties(i,!0),r}readSharedStyle_(e,t){const i=e.getAttribute("id");if(i!==null){const r=Yp.call(this,e,t);if(r){let s,o=e.baseURI;(!o||o=="about:blank")&&(o=window.location.href),o?s=new URL("#"+i,o).href:s="#"+i,this.sharedStyles_[s]=r}}}readSharedStyleMap_(e,t){const i=e.getAttribute("id");if(i===null)return;const r=v1.call(this,e,t);if(!r)return;let s,o=e.baseURI;(!o||o=="about:blank")&&(o=window.location.href),o?s=new URL("#"+i,o).href:s="#"+i,this.sharedStyles_[s]=r}readFeatureFromNode(e,t){if(!le.includes(e.namespaceURI))return null;const i=this.readPlacemark_(e,[this.getReadOptions(e,t)]);return i||null}readFeaturesFromNode(e,t){if(!le.includes(e.namespaceURI))return[];let i;const r=e.localName;if(r=="Document"||r=="Folder")return i=this.readDocumentOrFolder_(e,[this.getReadOptions(e,t)]),i||[];if(r=="Placemark"){const s=this.readPlacemark_(e,[this.getReadOptions(e,t)]);return s?[s]:[]}else if(r=="kml"){i=[];for(let s=e.firstElementChild;s;s=s.nextElementSibling){const o=this.readFeaturesFromNode(s,t);o&&Oe(i,o)}return i}else return[]}readName(e){if(e)if(typeof e=="string"){const t=yi(e);return this.readNameFromDocument(t)}else return _i(e)?this.readNameFromDocument(e):this.readNameFromNode(e);else return}readNameFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE){const i=this.readNameFromNode(t);if(i)return i}}readNameFromNode(e){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(le.includes(t.namespaceURI)&&t.localName=="name")return j(t);for(let t=e.firstElementChild;t;t=t.nextElementSibling){const i=t.localName;if(le.includes(t.namespaceURI)&&(i=="Document"||i=="Folder"||i=="Placemark"||i=="kml")){const r=this.readNameFromNode(t);if(r)return r}}}readNetworkLinks(e){const t=[];if(typeof e=="string"){const i=yi(e);Oe(t,this.readNetworkLinksFromDocument(i))}else _i(e)?Oe(t,this.readNetworkLinksFromDocument(e)):Oe(t,this.readNetworkLinksFromNode(e));return t}readNetworkLinksFromDocument(e){const t=[];for(let i=e.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&Oe(t,this.readNetworkLinksFromNode(i));return t}readNetworkLinksFromNode(e){const t=[];for(let i=e.firstElementChild;i;i=i.nextElementSibling)if(le.includes(i.namespaceURI)&&i.localName=="NetworkLink"){const r=z({},nL,i,[]);t.push(r)}for(let i=e.firstElementChild;i;i=i.nextElementSibling){const r=i.localName;le.includes(i.namespaceURI)&&(r=="Document"||r=="Folder"||r=="kml")&&Oe(t,this.readNetworkLinksFromNode(i))}return t}readRegion(e){const t=[];if(typeof e=="string"){const i=yi(e);Oe(t,this.readRegionFromDocument(i))}else _i(e)?Oe(t,this.readRegionFromDocument(e)):Oe(t,this.readRegionFromNode(e));return t}readRegionFromDocument(e){const t=[];for(let i=e.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&Oe(t,this.readRegionFromNode(i));return t}readRegionFromNode(e){const t=[];for(let i=e.firstElementChild;i;i=i.nextElementSibling)if(le.includes(i.namespaceURI)&&i.localName=="Region"){const r=z({},g1,i,[]);t.push(r)}for(let i=e.firstElementChild;i;i=i.nextElementSibling){const r=i.localName;le.includes(i.namespaceURI)&&(r=="Document"||r=="Folder"||r=="kml")&&Oe(t,this.readRegionFromNode(i))}return t}writeFeaturesNode(e,t){t=this.adaptOptions(t);const i=de(le[4],"kml"),r="http://www.w3.org/2000/xmlns/";i.setAttributeNS(r,"xmlns:gx",ur[0]),i.setAttributeNS(r,"xmlns:xsi",ts),i.setAttributeNS(ts,"xsi:schemaLocation",eL);const s={node:i},o={};e.length>1?o.Document=e:e.length==1&&(o.Placemark=e[0]);const a=rL[i.namespaceURI],l=pn(o,a);return ge(s,sL,Nt,l,[t],a,this),i}}function pL(n,e){const t=[0,0];let i="start";const r=n.getImage();if(r){const a=r.getSize();if(a&&a.length==2){const l=r.getScaleArray(),u=r.getAnchor();t[0]=l[0]*(a[0]-u[0]),t[1]=l[1]*(a[1]/2-u[1]),i="left"}}let s=n.getText();return s?(s=s.clone(),s.setFont(s.getFont()||is.getFont()),s.setScale(s.getScale()||is.getScale()),s.setFill(s.getFill()||is.getFill()),s.setStroke(s.getStroke()||zp)):s=is.clone(),s.setText(e),s.setOffsetX(t[0]),s.setOffsetY(t[1]),s.setTextAlign(i),new kt({image:r,text:s})}function mL(n,e,t,i,r){return function(s,o){let a=r,l="",u=[];if(a){const h=s.getGeometry();if(h)if(h instanceof Vt)u=h.getGeometriesArrayRecursive().filter(function(f){const d=f.getType();return d==="Point"||d==="MultiPoint"}),a=u.length>0;else{const f=h.getType();a=f==="Point"||f==="MultiPoint"}}a&&(l=s.get("name"),a=a&&!!l,a&&/&[^&]+;/.test(l)&&(Vh||(Vh=document.createElement("textarea")),Vh.innerHTML=l,l=Vh.value));let c=t;if(n?c=n:e&&(c=p1(e,t,i)),a){const h=pL(c[0],l);if(u.length>0){h.setGeometry(new Vt(u));const f=new kt({geometry:c[0].getGeometry(),image:null,fill:c[0].getFill(),stroke:c[0].getStroke(),text:null});return[h,f].concat(c.slice(1))}return h}return c}}function p1(n,e,t){return Array.isArray(n)?n:typeof n=="string"?p1(t[n],e,t):e}function jh(n){const e=sn(n,!1),t=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(t){const i=t[1];return[parseInt(i.substr(6,2),16),parseInt(i.substr(4,2),16),parseInt(i.substr(2,2),16),parseInt(i.substr(0,2),16)/255]}else return}function jp(n){let e=sn(n,!1);const t=[];e=e.replace(/\s*,\s*/g,",");const i=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;let r;for(;r=i.exec(e);){const s=parseFloat(r[1]),o=parseFloat(r[2]),a=r[3]?parseFloat(r[3]):0;t.push(s,o,a),e=e.substr(r[0].length)}if(e==="")return t}function m1(n){const e=sn(n,!1).trim();let t=n.baseURI;return(!t||t=="about:blank")&&(t=window.location.href),t?new URL(e,t).href:e}function _1(n){const e=sn(n,!1).trim().replace(/^(?!.*#)/,"#");let t=n.baseURI;return(!t||t=="about:blank")&&(t=window.location.href),t?new URL(e,t).href:e}function _L(n){const e=n.getAttribute("xunits"),t=n.getAttribute("yunits");let i;return e!=="insetPixels"?t!=="insetPixels"?i="bottom-left":i="top-left":t!=="insetPixels"?i="bottom-right":i="top-right",{x:parseFloat(n.getAttribute("x")),xunits:d1[e],y:parseFloat(n.getAttribute("y")),yunits:d1[t],origin:i}}function y1(n){return $e(n)}const yL=G(le,{Pair:zL});function v1(n,e){return z(void 0,yL,n,e,this)}const vL=G(le,{Icon:I(FL),color:I(jh),heading:I($e),hotSpot:I(_L),scale:I(y1)});function xL(n,e){const t=z({},vL,n,e);if(!t)return;const i=e[e.length-1],r="Icon"in t?t.Icon:{},s=!("Icon"in t)||Object.keys(r).length>0;let o;const a=r.href;a?o=a:s&&(o=kh);let l,u,c,h="bottom-left";const f=t.hotSpot;f?(l=[f.x,f.y],u=f.xunits,c=f.yunits,h=f.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o)&&(o.includes("pushpin")?(l=Up,u=cu,c=hu):o.includes("arrow-reverse")?(l=[54,42],u=cu,c=hu):o.includes("paddle")&&(l=[32,1],u=cu,c=hu));let d;const g=r.x,m=r.y;g!==void 0&&m!==void 0&&(d=[g,m]);let p;const _=r.w,v=r.h;_!==void 0&&v!==void 0&&(p=[_,v]);let x;const y=t.heading;y!==void 0&&(x=$t(y));const T=t.scale,w=t.color;if(s){o==kh&&(p=fu);const E=new Ea({anchor:l,anchorOrigin:h,anchorXUnits:u,anchorYUnits:c,crossOrigin:this.crossOrigin_,offset:d,offsetOrigin:"bottom-left",rotation:x,scale:T,size:p,src:this.iconUrlFunction_(o),color:w}),S=E.getScaleArray()[0],b=E.getSize();if(b===null){const R=E.getImageState();if(R===ce.IDLE||R===ce.LOADING){const C=function(){const M=E.getImageState();if(!(M===ce.IDLE||M===ce.LOADING)){const P=E.getSize();if(P&&P.length==2){const U=zh(P);E.setScale(S*U)}E.unlistenImageChange(C)}};E.listenImageChange(C),R===ce.IDLE&&E.load()}}else if(b.length==2){const R=zh(b);E.setScale(S*R)}i.imageStyle=E}else i.imageStyle=Bp}const EL=G(le,{color:I(jh),scale:I(y1)});function wL(n,e){const t=z({},EL,n,e);if(!t)return;const i=e[e.length-1],r=new po({fill:new yn({color:"color"in t?t.color:Ta}),scale:t.scale});i.textStyle=r}const TL=G(le,{color:I(jh),width:I($e)});function SL(n,e){const t=z({},TL,n,e);if(!t)return;const i=e[e.length-1],r=new on({color:"color"in t?t.color:Ta,width:"width"in t?t.width:1});i.strokeStyle=r}const bL=G(le,{color:I(jh),fill:I(lr),outline:I(lr)});function RL(n,e){const t=z({},bL,n,e);if(!t)return;const i=e[e.length-1],r=new yn({color:"color"in t?t.color:Ta});i.fillStyle=r;const s=t.fill;s!==void 0&&(i.fill=s);const o=t.outline;o!==void 0&&(i.outline=o)}const CL=G(le,{coordinates:ue(jp)});function x1(n,e){return z(null,CL,n,e)}function IL(n,e){const i=e[e.length-1].coordinates,r=sn(n,!1),o=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(r);if(o){const a=parseFloat(o[1]),l=parseFloat(o[2]),u=parseFloat(o[3]);i.push([a,l,u])}else i.push([])}const AL=G(ur,{Track:se(E1)});function LL(n,e){const t=z([],AL,n,e);if(!!t)return new gn(t)}const PL=G(le,{when:nP},G(ur,{coord:IL}));function E1(n,e){const t=z({coordinates:[],whens:[]},PL,n,e);if(!t)return;const i=[],r=t.coordinates,s=t.whens;for(let o=0,a=Math.min(r.length,s.length);o<a;++o)r[o].length==3&&i.push(r[o][0],r[o][1],r[o][2],s[o]);return new lt(i,"XYZM")}const ML=G(le,{href:I(m1)},G(ur,{x:I($e),y:I($e),w:I($e),h:I($e)}));function FL(n,e){const t=z({},ML,n,e);return t||null}const OL=G(le,{coordinates:ue(jp)});function Xp(n,e){return z(null,OL,n,e)}const Xh=G(le,{extrude:I(lr),tessellate:I(lr),altitudeMode:I(j)});function w1(n,e){const t=z({},Xh,n,e),i=Xp(n,e);if(i){const r=new lt(i,"XYZ");return r.setProperties(t,!0),r}else return}function T1(n,e){const t=z({},Xh,n,e),i=Xp(n,e);if(i){const r=new Dt(i,"XYZ",[i.length]);return r.setProperties(t,!0),r}else return}const $L=G(le,{LineString:se(w1),LinearRing:se(T1),MultiGeometry:se(S1),Point:se(b1),Polygon:se(R1)});function S1(n,e){const t=z([],$L,n,e);if(!t)return null;if(t.length===0)return new Vt(t);let i,r=!0;const s=t[0].getType();let o;for(let a=1,l=t.length;a<l;++a)if(o=t[a],o.getType()!=s){r=!1;break}if(r){let a,l;if(s=="Point"){const u=t[0];a=u.getLayout(),l=u.getFlatCoordinates();for(let c=1,h=t.length;c<h;++c)o=t[c],Oe(l,o.getFlatCoordinates());i=new qn(l,a),Zp(i,t)}else s=="LineString"?(i=new gn(t),Zp(i,t)):s=="Polygon"?(i=new Bn(t),Zp(i,t)):s=="GeometryCollection"?i=new Vt(t):ne(!1,37)}else i=new Vt(t);return i}function b1(n,e){const t=z({},Xh,n,e),i=Xp(n,e);if(i){const r=new st(i,"XYZ");return r.setProperties(t,!0),r}else return}const DL=G(le,{innerBoundaryIs:JL,outerBoundaryIs:eP});function R1(n,e){const t=z({},Xh,n,e),i=z([null],DL,n,e);if(i&&i[0]){const r=i[0],s=[r.length];for(let a=1,l=i.length;a<l;++a)Oe(r,i[a]),s.push(r.length);const o=new Dt(r,"XYZ",s);return o.setProperties(t,!0),o}else return}const NL=G(le,{IconStyle:xL,LabelStyle:wL,LineStyle:SL,PolyStyle:RL});function Yp(n,e){const t=z({},NL,n,e,this);if(!t)return null;let i="fillStyle"in t?t.fillStyle:uu;const r=t.fill;r!==void 0&&!r&&(i=null);let s;"imageStyle"in t?t.imageStyle!=Bp&&(s=t.imageStyle):s=Gh;const o="textStyle"in t?t.textStyle:is,a="strokeStyle"in t?t.strokeStyle:Uh,l=t.outline;return l!==void 0&&!l?[new kt({geometry:function(u){const c=u.getGeometry(),h=c.getType();if(h==="GeometryCollection"){const f=c;return new Vt(f.getGeometriesArrayRecursive().filter(function(d){const g=d.getType();return g!=="Polygon"&&g!=="MultiPolygon"}))}else if(h!=="Polygon"&&h!=="MultiPolygon")return c},fill:i,image:s,stroke:a,text:o,zIndex:void 0}),new kt({geometry:function(u){const c=u.getGeometry(),h=c.getType();if(h==="GeometryCollection"){const f=c;return new Vt(f.getGeometriesArrayRecursive().filter(function(d){const g=d.getType();return g==="Polygon"||g==="MultiPolygon"}))}else if(h==="Polygon"||h==="MultiPolygon")return c},fill:i,stroke:null,zIndex:void 0})]:[new kt({fill:i,image:s,stroke:a,text:o,zIndex:void 0})]}function Zp(n,e){const t=e.length,i=new Array(e.length),r=new Array(e.length),s=new Array(e.length);let o,a,l;o=!1,a=!1,l=!1;for(let u=0;u<t;++u){const c=e[u];i[u]=c.get("extrude"),r[u]=c.get("tessellate"),s[u]=c.get("altitudeMode"),o=o||i[u]!==void 0,a=a||r[u]!==void 0,l=l||s[u]}o&&n.set("extrude",i),a&&n.set("tessellate",r),l&&n.set("altitudeMode",s)}const kL=G(le,{displayName:I(j),value:I(j)});function GL(n,e){const t=n.getAttribute("name");mn(kL,n,e);const i=e[e.length-1];t&&i.displayName?i[t]={value:i.value,displayName:i.displayName,toString:function(){return i.value}}:t!==null?i[t]=i.value:i.displayName!==null&&(i[i.displayName]=i.value),delete i.value}const UL=G(le,{Data:GL,SchemaData:XL});function C1(n,e){mn(UL,n,e)}function I1(n,e){mn(g1,n,e)}const BL=G(le,{Style:I(Yp),key:I(j),styleUrl:I(_1)});function zL(n,e){const t=z({},BL,n,e,this);if(!t)return;const i=t.key;if(i&&i=="normal"){const r=t.styleUrl;r&&(e[e.length-1]=r);const s=t.Style;s&&(e[e.length-1]=s)}}function VL(n,e){const t=v1.call(this,n,e);if(!t)return;const i=e[e.length-1];Array.isArray(t)?i.Style=t:typeof t=="string"?i.styleUrl=t:ne(!1,38)}const jL=G(le,{SimpleData:YL});function XL(n,e){mn(jL,n,e)}function YL(n,e){const t=n.getAttribute("name");if(t!==null){const i=j(n),r=e[e.length-1];r[t]=i}}const ZL=G(le,{altitudeMode:I(j),minAltitude:I($e),maxAltitude:I($e),north:I($e),south:I($e),east:I($e),west:I($e)});function WL(n,e){const t=z({},ZL,n,e);if(!t)return;const i=e[e.length-1],r=[parseFloat(t.west),parseFloat(t.south),parseFloat(t.east),parseFloat(t.north)];i.extent=r,i.altitudeMode=t.altitudeMode,i.minAltitude=parseFloat(t.minAltitude),i.maxAltitude=parseFloat(t.maxAltitude)}const HL=G(le,{minLodPixels:I($e),maxLodPixels:I($e),minFadeExtent:I($e),maxFadeExtent:I($e)});function KL(n,e){const t=z({},HL,n,e);if(!t)return;const i=e[e.length-1];i.minLodPixels=parseFloat(t.minLodPixels),i.maxLodPixels=parseFloat(t.maxLodPixels),i.minFadeExtent=parseFloat(t.minFadeExtent),i.maxFadeExtent=parseFloat(t.maxFadeExtent)}const qL=G(le,{LinearRing:se(x1)});function JL(n,e){const t=z([],qL,n,e);t.length>0&&e[e.length-1].push(...t)}const QL=G(le,{LinearRing:ue(x1)});function eP(n,e){const t=z(void 0,QL,n,e);if(t){const i=e[e.length-1];i[0]=t}}function tP(n,e){mn(iL,n,e)}function nP(n,e){const i=e[e.length-1].whens,r=sn(n,!1),s=Date.parse(r);i.push(isNaN(s)?0:s)}function Yh(n,e){const t=Kr(e),r=[(t.length==4?t[3]:1)*255,t[2],t[1],t[0]];for(let s=0;s<4;++s){const o=Math.floor(r[s]).toString(16);r[s]=o.length==1?"0"+o:o}fe(n,r.join(""))}function iP(n,e,t){const i=t[t.length-1],r=i.layout,s=i.stride;let o;r=="XY"||r=="XYM"?o=2:r=="XYZ"||r=="XYZM"?o=3:ne(!1,34);const a=e.length;let l="";if(a>0){l+=e[0];for(let u=1;u<o;++u)l+=","+e[u];for(let u=s;u<a;u+=s){l+=" "+e[u];for(let c=1;c<o;++c)l+=","+e[u+c]}}fe(n,l)}const Zh=G(le,{Data:A(rP),value:A(oP),displayName:A(sP)});function rP(n,e,t){n.setAttribute("name",e.name);const i={node:n},r=e.value;typeof r=="object"?(r!==null&&r.displayName&&ge(i,Zh,Nt,[r.displayName],t,["displayName"]),r!==null&&r.value&&ge(i,Zh,Nt,[r.value],t,["value"])):ge(i,Zh,Nt,[r],t,["value"])}function sP(n,e){e1(n,e)}function oP(n,e){fe(n,e)}const aP=G(le,{Placemark:A(O1)}),lP=function(n,e,t){const i=e[e.length-1].node;return de(i.namespaceURI,"Placemark")};function uP(n,e,t){ge({node:n},aP,lP,e,t,void 0,this)}const cP=ut("Data");function hP(n,e,t){const i={node:n},r=e.names,s=e.values,o=r.length;for(let a=0;a<o;a++)ge(i,Zh,cP,[{name:r[a],value:s[a]}],t)}const A1=G(le,["href"],G(ur,["x","y","w","h"])),L1=G(le,{href:A(fe)},G(ur,{x:A(_n),y:A(_n),w:A(_n),h:A(_n)})),fP=function(n,e,t){return de(ur[0],"gx:"+t)};function dP(n,e,t){const i={node:n},r=t[t.length-1].node;let s=A1[r.namespaceURI],o=pn(e,s);ge(i,L1,Nt,o,t,s),s=A1[ur[0]],o=pn(e,s),ge(i,L1,fP,o,t,s)}const gP=G(le,["scale","heading","Icon","color","hotSpot"]),pP=G(le,{Icon:A(dP),color:A(Yh),heading:A(_n),hotSpot:A(zP),scale:A(N1)});function mP(n,e,t){const i={node:n},r={},s=e.getSrc(),o=e.getSize(),a=e.getImageSize(),l={href:s};if(o){l.w=o[0],l.h=o[1];const p=e.getAnchor(),_=e.getOrigin();if(_&&a&&_[0]!==0&&_[1]!==o[1]&&(l.x=_[0],l.y=a[1]-(_[1]+o[1])),p&&(p[0]!==o[0]/2||p[1]!==o[1]/2)){const v={x:p[0],xunits:"pixels",y:o[1]-p[1],yunits:"pixels"};r.hotSpot=v}}r.Icon=l;let u=e.getScaleArray()[0],c=o;if(c===null&&(c=fu),c.length==2){const p=zh(c);u=u/p}u!==1&&(r.scale=u);const h=e.getRotation();h!==0&&(r.heading=h);const f=e.getColor();f&&(r.color=f);const d=t[t.length-1].node,g=gP[d.namespaceURI],m=pn(r,g);ge(i,pP,Nt,m,t,g)}const _P=G(le,["color","scale"]),yP=G(le,{color:A(Yh),scale:A(N1)});function vP(n,e,t){const i={node:n},r={},s=e.getFill();s&&(r.color=s.getColor());const o=e.getScale();o&&o!==1&&(r.scale=o);const a=t[t.length-1].node,l=_P[a.namespaceURI],u=pn(r,l);ge(i,yP,Nt,u,t,l)}const xP=G(le,["color","width"]),EP=G(le,{color:A(Yh),width:A(_n)});function wP(n,e,t){const i={node:n},r={color:e.getColor(),width:Number(e.getWidth())||1},s=t[t.length-1].node,o=xP[s.namespaceURI],a=pn(r,o);ge(i,EP,Nt,a,t,o)}const TP={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},P1=function(n,e,t){if(n){const i=e[e.length-1].node;return de(i.namespaceURI,TP[n.getType()])}},SP=ut("Point"),bP=ut("LineString"),RP=ut("LinearRing"),CP=ut("Polygon"),IP=G(le,{LineString:A(Sa),Point:A(Sa),Polygon:A(D1),GeometryCollection:A(M1)});function M1(n,e,t){const i={node:n},r=e.getType();let s=[],o;r==="GeometryCollection"?(e.getGeometriesArrayRecursive().forEach(function(a){const l=a.getType();l==="MultiPoint"?s=s.concat(a.getPoints()):l==="MultiLineString"?s=s.concat(a.getLineStrings()):l==="MultiPolygon"?s=s.concat(a.getPolygons()):l==="Point"||l==="LineString"||l==="Polygon"?s.push(a):ne(!1,39)}),o=P1):r==="MultiPoint"?(s=e.getPoints(),o=SP):r==="MultiLineString"?(s=e.getLineStrings(),o=bP):r==="MultiPolygon"?(s=e.getPolygons(),o=CP):ne(!1,39),ge(i,IP,o,s,t)}const AP=G(le,{LinearRing:A(Sa)});function F1(n,e,t){ge({node:n},AP,RP,[e],t)}const Wp=G(le,{ExtendedData:A(hP),MultiGeometry:A(M1),LineString:A(Sa),LinearRing:A(Sa),Point:A(Sa),Polygon:A(D1),Style:A(BP),address:A(fe),description:A(fe),name:A(fe),open:A(ho),phoneNumber:A(fe),styleUrl:A(fe),visibility:A(ho)}),LP=G(le,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),PP=ut("ExtendedData");function O1(n,e,t){const i={node:n};e.getId()&&n.setAttribute("id",e.getId());const r=e.getProperties(),s={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};s[e.getGeometryName()]=1;const o=Object.keys(r||{}).sort().filter(function(d){return!s[d]}),a=e.getStyleFunction();if(a){const d=a(e,0);if(d){const g=Array.isArray(d)?d:[d];let m=g;if(e.getGeometry()&&(m=g.filter(function(p){const _=p.getGeometryFunction()(e);if(_){const v=_.getType();return v==="GeometryCollection"?_.getGeometriesArrayRecursive().filter(function(x){const y=x.getType();return y==="Point"||y==="MultiPoint"}).length:v==="Point"||v==="MultiPoint"}})),this.writeStyles_){let p=g,_=g;e.getGeometry()&&(p=g.filter(function(v){const x=v.getGeometryFunction()(e);if(x){const y=x.getType();return y==="GeometryCollection"?x.getGeometriesArrayRecursive().filter(function(T){const w=T.getType();return w==="LineString"||w==="MultiLineString"}).length:y==="LineString"||y==="MultiLineString"}}),_=g.filter(function(v){const x=v.getGeometryFunction()(e);if(x){const y=x.getType();return y==="GeometryCollection"?x.getGeometriesArrayRecursive().filter(function(T){const w=T.getType();return w==="Polygon"||w==="MultiPolygon"}).length:y==="Polygon"||y==="MultiPolygon"}})),r.Style={pointStyles:m,lineStyles:p,polyStyles:_}}if(m.length&&r.name===void 0){const p=m[0].getText();p&&(r.name=p.getText())}}}const l=t[t.length-1].node,u=LP[l.namespaceURI],c=pn(r,u);if(ge(i,Wp,Nt,c,t,u),o.length>0){const d=pn(r,o);ge(i,Wp,PP,[{names:o,values:d}],t)}const h=t[0];let f=e.getGeometry();f&&(f=nt(f,!0,h)),ge(i,Wp,P1,[f],t)}const MP=G(le,["extrude","tessellate","altitudeMode","coordinates"]),FP=G(le,{extrude:A(ho),tessellate:A(ho),altitudeMode:A(fe),coordinates:A(iP)});function Sa(n,e,t){const i=e.getFlatCoordinates(),r={node:n};r.layout=e.getLayout(),r.stride=e.getStride();const s=e.getProperties();s.coordinates=i;const o=t[t.length-1].node,a=MP[o.namespaceURI],l=pn(s,a);ge(r,FP,Nt,l,t,a)}const OP=G(le,["color","fill","outline"]),$1=G(le,{outerBoundaryIs:A(F1),innerBoundaryIs:A(F1)}),$P=ut("innerBoundaryIs"),DP=ut("outerBoundaryIs");function D1(n,e,t){const i=e.getLinearRings(),r=i.shift(),s={node:n};ge(s,$1,$P,i,t),ge(s,$1,DP,[r],t)}const NP=G(le,{color:A(Yh),fill:A(ho),outline:A(ho)});function kP(n,e,t){const i={node:n},r=e.getFill(),s=e.getStroke(),o={color:r?r.getColor():void 0,fill:r?void 0:!1,outline:s?void 0:!1},a=t[t.length-1].node,l=OP[a.namespaceURI],u=pn(o,l);ge(i,NP,Nt,u,t,l)}function N1(n,e){_n(n,Math.round(e*1e6)/1e6)}const GP=G(le,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),UP=G(le,{IconStyle:A(mP),LabelStyle:A(vP),LineStyle:A(wP),PolyStyle:A(kP)});function BP(n,e,t){const i={node:n},r={};if(e.pointStyles.length){const l=e.pointStyles[0].getText();l&&(r.LabelStyle=l);const u=e.pointStyles[0].getImage();u&&typeof u.getSrc=="function"&&(r.IconStyle=u)}if(e.lineStyles.length){const l=e.lineStyles[0].getStroke();l&&(r.LineStyle=l)}if(e.polyStyles.length){const l=e.polyStyles[0].getStroke();l&&!r.LineStyle&&(r.LineStyle=l),r.PolyStyle=e.polyStyles[0]}const s=t[t.length-1].node,o=GP[s.namespaceURI],a=pn(r,o);ge(i,UP,Nt,a,t,o)}function zP(n,e){n.setAttribute("x",String(e.x)),n.setAttribute("y",String(e.y)),n.setAttribute("xunits",e.xunits),n.setAttribute("yunits",e.yunits)}var VP=gL,Hp={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Hp.read=function(n,e,t,i,r){var s,o,a=r*8-i-1,l=(1<<a)-1,u=l>>1,c=-7,h=t?r-1:0,f=t?-1:1,d=n[e+h];for(h+=f,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+n[e+h],h+=f,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=o*256+n[e+h],h+=f,c-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(d?-1:1)*o*Math.pow(2,s-i)},Hp.write=function(n,e,t,i,r,s){var o,a,l,u=s*8-r-1,c=(1<<u)-1,h=c>>1,f=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,g=i?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+h>=1?e+=f/l:e+=f*Math.pow(2,1-h),e*l>=2&&(o++,l/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*l-1)*Math.pow(2,r),o=o+h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),o=0));r>=8;n[t+d]=a&255,d+=g,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;n[t+d]=o&255,d+=g,o/=256,u-=8);n[t+d-g]|=m*128};var jP=Ze,Wh=Hp;function Ze(n){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(n)?n:new Uint8Array(n||0),this.pos=0,this.type=0,this.length=this.buf.length}Ze.Varint=0,Ze.Fixed64=1,Ze.Bytes=2,Ze.Fixed32=5;var Kp=(1<<16)*(1<<16),k1=1/Kp,XP=12,G1=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");Ze.prototype={destroy:function(){this.buf=null},readFields:function(n,e,t){for(t=t||this.length;this.pos<t;){var i=this.readVarint(),r=i>>3,s=this.pos;this.type=i&7,n(r,e,this),this.pos===s&&this.skip(i)}return e},readMessage:function(n,e){return this.readFields(n,e,this.readVarint()+this.pos)},readFixed32:function(){var n=Hh(this.buf,this.pos);return this.pos+=4,n},readSFixed32:function(){var n=B1(this.buf,this.pos);return this.pos+=4,n},readFixed64:function(){var n=Hh(this.buf,this.pos)+Hh(this.buf,this.pos+4)*Kp;return this.pos+=8,n},readSFixed64:function(){var n=Hh(this.buf,this.pos)+B1(this.buf,this.pos+4)*Kp;return this.pos+=8,n},readFloat:function(){var n=Wh.read(this.buf,this.pos,!0,23,4);return this.pos+=4,n},readDouble:function(){var n=Wh.read(this.buf,this.pos,!0,52,8);return this.pos+=8,n},readVarint:function(n){var e=this.buf,t,i;return i=e[this.pos++],t=i&127,i<128||(i=e[this.pos++],t|=(i&127)<<7,i<128)||(i=e[this.pos++],t|=(i&127)<<14,i<128)||(i=e[this.pos++],t|=(i&127)<<21,i<128)?t:(i=e[this.pos],t|=(i&15)<<28,YP(t,n,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var n=this.readVarint();return n%2===1?(n+1)/-2:n/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var n=this.readVarint()+this.pos,e=this.pos;return this.pos=n,n-e>=XP&&G1?oM(this.buf,e,n):sM(this.buf,e,n)},readBytes:function(){var n=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,n);return this.pos=n,e},readPackedVarint:function(n,e){if(this.type!==Ze.Bytes)return n.push(this.readVarint(e));var t=cr(this);for(n=n||[];this.pos<t;)n.push(this.readVarint(e));return n},readPackedSVarint:function(n){if(this.type!==Ze.Bytes)return n.push(this.readSVarint());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readSVarint());return n},readPackedBoolean:function(n){if(this.type!==Ze.Bytes)return n.push(this.readBoolean());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readBoolean());return n},readPackedFloat:function(n){if(this.type!==Ze.Bytes)return n.push(this.readFloat());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readFloat());return n},readPackedDouble:function(n){if(this.type!==Ze.Bytes)return n.push(this.readDouble());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readDouble());return n},readPackedFixed32:function(n){if(this.type!==Ze.Bytes)return n.push(this.readFixed32());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readFixed32());return n},readPackedSFixed32:function(n){if(this.type!==Ze.Bytes)return n.push(this.readSFixed32());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readSFixed32());return n},readPackedFixed64:function(n){if(this.type!==Ze.Bytes)return n.push(this.readFixed64());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readFixed64());return n},readPackedSFixed64:function(n){if(this.type!==Ze.Bytes)return n.push(this.readSFixed64());var e=cr(this);for(n=n||[];this.pos<e;)n.push(this.readSFixed64());return n},skip:function(n){var e=n&7;if(e===Ze.Varint)for(;this.buf[this.pos++]>127;);else if(e===Ze.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Ze.Fixed32)this.pos+=4;else if(e===Ze.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(n,e){this.writeVarint(n<<3|e)},realloc:function(n){for(var e=this.length||16;e<this.pos+n;)e*=2;if(e!==this.length){var t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(n){this.realloc(4),Ra(this.buf,n,this.pos),this.pos+=4},writeSFixed32:function(n){this.realloc(4),Ra(this.buf,n,this.pos),this.pos+=4},writeFixed64:function(n){this.realloc(8),Ra(this.buf,n&-1,this.pos),Ra(this.buf,Math.floor(n*k1),this.pos+4),this.pos+=8},writeSFixed64:function(n){this.realloc(8),Ra(this.buf,n&-1,this.pos),Ra(this.buf,Math.floor(n*k1),this.pos+4),this.pos+=8},writeVarint:function(n){if(n=+n||0,n>268435455||n<0){ZP(n,this);return}this.realloc(4),this.buf[this.pos++]=n&127|(n>127?128:0),!(n<=127)&&(this.buf[this.pos++]=(n>>>=7)&127|(n>127?128:0),!(n<=127)&&(this.buf[this.pos++]=(n>>>=7)&127|(n>127?128:0),!(n<=127)&&(this.buf[this.pos++]=n>>>7&127)))},writeSVarint:function(n){this.writeVarint(n<0?-n*2-1:n*2)},writeBoolean:function(n){this.writeVarint(Boolean(n))},writeString:function(n){n=String(n),this.realloc(n.length*4),this.pos++;var e=this.pos;this.pos=aM(this.buf,n,this.pos);var t=this.pos-e;t>=128&&U1(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t},writeFloat:function(n){this.realloc(4),Wh.write(this.buf,n,this.pos,!0,23,4),this.pos+=4},writeDouble:function(n){this.realloc(8),Wh.write(this.buf,n,this.pos,!0,52,8),this.pos+=8},writeBytes:function(n){var e=n.length;this.writeVarint(e),this.realloc(e);for(var t=0;t<e;t++)this.buf[this.pos++]=n[t]},writeRawMessage:function(n,e){this.pos++;var t=this.pos;n(e,this);var i=this.pos-t;i>=128&&U1(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeMessage:function(n,e,t){this.writeTag(n,Ze.Bytes),this.writeRawMessage(e,t)},writePackedVarint:function(n,e){e.length&&this.writeMessage(n,KP,e)},writePackedSVarint:function(n,e){e.length&&this.writeMessage(n,qP,e)},writePackedBoolean:function(n,e){e.length&&this.writeMessage(n,eM,e)},writePackedFloat:function(n,e){e.length&&this.writeMessage(n,JP,e)},writePackedDouble:function(n,e){e.length&&this.writeMessage(n,QP,e)},writePackedFixed32:function(n,e){e.length&&this.writeMessage(n,tM,e)},writePackedSFixed32:function(n,e){e.length&&this.writeMessage(n,nM,e)},writePackedFixed64:function(n,e){e.length&&this.writeMessage(n,iM,e)},writePackedSFixed64:function(n,e){e.length&&this.writeMessage(n,rM,e)},writeBytesField:function(n,e){this.writeTag(n,Ze.Bytes),this.writeBytes(e)},writeFixed32Field:function(n,e){this.writeTag(n,Ze.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(n,e){this.writeTag(n,Ze.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(n,e){this.writeTag(n,Ze.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(n,e){this.writeTag(n,Ze.Fixed64),this.writeSFixed64(e)},writeVarintField:function(n,e){this.writeTag(n,Ze.Varint),this.writeVarint(e)},writeSVarintField:function(n,e){this.writeTag(n,Ze.Varint),this.writeSVarint(e)},writeStringField:function(n,e){this.writeTag(n,Ze.Bytes),this.writeString(e)},writeFloatField:function(n,e){this.writeTag(n,Ze.Fixed32),this.writeFloat(e)},writeDoubleField:function(n,e){this.writeTag(n,Ze.Fixed64),this.writeDouble(e)},writeBooleanField:function(n,e){this.writeVarintField(n,Boolean(e))}};function YP(n,e,t){var i=t.buf,r,s;if(s=i[t.pos++],r=(s&112)>>4,s<128||(s=i[t.pos++],r|=(s&127)<<3,s<128)||(s=i[t.pos++],r|=(s&127)<<10,s<128)||(s=i[t.pos++],r|=(s&127)<<17,s<128)||(s=i[t.pos++],r|=(s&127)<<24,s<128)||(s=i[t.pos++],r|=(s&1)<<31,s<128))return ba(n,r,e);throw new Error("Expected varint not more than 10 bytes")}function cr(n){return n.type===Ze.Bytes?n.readVarint()+n.pos:n.pos+1}function ba(n,e,t){return t?e*4294967296+(n>>>0):(e>>>0)*4294967296+(n>>>0)}function ZP(n,e){var t,i;if(n>=0?(t=n%4294967296|0,i=n/4294967296|0):(t=~(-n%4294967296),i=~(-n/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),WP(t,i,e),HP(i,e)}function WP(n,e,t){t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos++]=n&127|128,n>>>=7,t.buf[t.pos]=n&127}function HP(n,e){var t=(n&7)<<4;e.buf[e.pos++]|=t|((n>>>=3)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127|((n>>>=7)?128:0),n&&(e.buf[e.pos++]=n&127)))))}function U1(n,e,t){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(var r=t.pos-1;r>=n;r--)t.buf[r+i]=t.buf[r]}function KP(n,e){for(var t=0;t<n.length;t++)e.writeVarint(n[t])}function qP(n,e){for(var t=0;t<n.length;t++)e.writeSVarint(n[t])}function JP(n,e){for(var t=0;t<n.length;t++)e.writeFloat(n[t])}function QP(n,e){for(var t=0;t<n.length;t++)e.writeDouble(n[t])}function eM(n,e){for(var t=0;t<n.length;t++)e.writeBoolean(n[t])}function tM(n,e){for(var t=0;t<n.length;t++)e.writeFixed32(n[t])}function nM(n,e){for(var t=0;t<n.length;t++)e.writeSFixed32(n[t])}function iM(n,e){for(var t=0;t<n.length;t++)e.writeFixed64(n[t])}function rM(n,e){for(var t=0;t<n.length;t++)e.writeSFixed64(n[t])}function Hh(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16)+n[e+3]*16777216}function Ra(n,e,t){n[t]=e,n[t+1]=e>>>8,n[t+2]=e>>>16,n[t+3]=e>>>24}function B1(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16)+(n[e+3]<<24)}function sM(n,e,t){for(var i="",r=e;r<t;){var s=n[r],o=null,a=s>239?4:s>223?3:s>191?2:1;if(r+a>t)break;var l,u,c;a===1?s<128&&(o=s):a===2?(l=n[r+1],(l&192)===128&&(o=(s&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=n[r+1],u=n[r+2],(l&192)===128&&(u&192)===128&&(o=(s&15)<<12|(l&63)<<6|u&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=n[r+1],u=n[r+2],c=n[r+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(o=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,i+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),i+=String.fromCharCode(o),r+=a}return i}function oM(n,e,t){return G1.decode(n.subarray(e,t))}function aM(n,e,t){for(var i=0,r,s;i<e.length;i++){if(r=e.charCodeAt(i),r>55295&&r<57344)if(s)if(r<56320){n[t++]=239,n[t++]=191,n[t++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||i+1===e.length?(n[t++]=239,n[t++]=191,n[t++]=189):s=r;continue}else s&&(n[t++]=239,n[t++]=191,n[t++]=189,s=null);r<128?n[t++]=r:(r<2048?n[t++]=r>>6|192:(r<65536?n[t++]=r>>12|224:(n[t++]=r>>18|240,n[t++]=r>>12&63|128),n[t++]=r>>6&63|128),n[t++]=r&63|128)}return t}class Fd extends hi{constructor(e,t,i){super(),i!==void 0&&t===void 0?this.setFlatCoordinates(i,e):(t=t||0,this.setCenterAndRadius(e,t,i))}clone(){const e=new Fd(this.flatCoordinates.slice(),void 0,this.layout);return e.applyProperties(this),e}closestPointXY(e,t,i,r){const s=this.flatCoordinates,o=e-s[0],a=t-s[1],l=o*o+a*a;if(l<r){if(l===0)for(let u=0;u<this.stride;++u)i[u]=s[u];else{const u=this.getRadius()/Math.sqrt(l);i[0]=s[0]+u*o,i[1]=s[1]+u*a;for(let c=2;c<this.stride;++c)i[c]=s[c]}return i.length=this.stride,l}else return r}containsXY(e,t){const i=this.flatCoordinates,r=e-i[0],s=t-i[1];return r*r+s*s<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(e){const t=this.flatCoordinates,i=t[this.stride]-t[0];return Cn(t[0]-i,t[1]-i,t[0]+i,t[1]+i,e)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const e=this.flatCoordinates[this.stride]-this.flatCoordinates[0],t=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return e*e+t*t}getType(){return"Circle"}intersectsExtent(e){const t=this.getExtent();if(Je(e,t)){const i=this.getCenter();return e[0]<=i[0]&&e[2]>=i[0]||e[1]<=i[1]&&e[3]>=i[1]?!0:Gc(e,this.intersectsCoordinate.bind(this))}return!1}setCenter(e){const t=this.stride,i=this.flatCoordinates[t]-this.flatCoordinates[0],r=e.slice();r[t]=r[0]+i;for(let s=1;s<t;++s)r[t+s]=e[s];this.setFlatCoordinates(this.layout,r),this.changed()}setCenterAndRadius(e,t,i){this.setLayout(i,e,0),this.flatCoordinates||(this.flatCoordinates=[]);const r=this.flatCoordinates;let s=Sg(r,0,e,this.stride);r[s++]=r[0]+t;for(let o=1,a=this.stride;o<a;++o)r[s++]=r[o];r.length=s,this.changed()}getCoordinates(){return null}setCoordinates(e,t){}setRadius(e){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+e,this.changed()}rotate(e,t){const i=this.getCenter(),r=this.getStride();this.setCenter(qc(i,0,i.length,r,e,t,i)),this.changed()}translate(e,t){const i=this.getCenter(),r=this.getStride();this.setCenter(wg(i,0,i.length,r,e,t,i)),this.changed()}}Fd.prototype.transform;var qp=Fd;const z1=Le();class du{constructor(e,t,i,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=r}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?zs(this.flatCoordinates_):kc(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=Ot(this.getExtent());this.flatInteriorPoints_=oh(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=Sp(this.flatCoordinates_,0,this.ends_,2);this.flatInteriorPoints_=Ig(this.flatCoordinates_,0,this.ends_,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=iu(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const i=this.ends_;for(let r=0,s=i.length;r<s;++r){const o=i[r],a=iu(e,t,o,2,.5);Oe(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getStride(){return 2}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=J(e);const t=e.getExtent(),i=e.getWorldExtent();if(t&&i){const r=Xe(i)/Xe(t);tn(z1,i[0],i[3],r,-r,0,0,0),ci(this.flatCoordinates_,0,this.flatCoordinates_.length,2,z1,this.flatCoordinates_)}}getEnds(){return this.ends_}}du.prototype.getEndss=du.prototype.getEnds,du.prototype.getFlatCoordinates=du.prototype.getOrientedFlatCoordinates;function V1(n){const e=n.getType();switch(e){case"Point":return new st(n.getFlatCoordinates());case"MultiPoint":return new qn(n.getFlatCoordinates(),"XY");case"LineString":return new lt(n.getFlatCoordinates(),"XY");case"MultiLineString":return new gn(n.getFlatCoordinates(),"XY",n.getEnds());case"Polygon":const t=n.getFlatCoordinates(),i=n.getEnds(),r=Og(t,i);return r.length>1?new Bn(t,"XY",r):new Dt(t,"XY",i);default:throw new Error("Invalid geometry type:"+e)}}function lM(n,e){const t=n.getId(),i=V1(n),r=n.getProperties(),s=new Ne;return e!==void 0&&s.setGeometryName(e),s.setGeometry(i),t!==void 0&&s.setId(t),s.setProperties(r,!0),s}var Kh=du;class uM extends va{constructor(e){super(),e=e||{},this.dataProjection=new Ws({code:"",units:"tile-pixels"}),this.featureClass_=e.featureClass?e.featureClass:Kh,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,i,r){e.pos=t.geometry;const s=e.readVarint()+e.pos;let o=1,a=0,l=0,u=0,c=0,h=0;for(;e.pos<s;){if(!a){const f=e.readVarint();o=f&7,a=f>>3}a--,o===1||o===2?(l+=e.readSVarint(),u+=e.readSVarint(),o===1&&c>h&&(r.push(c),h=c),i.push(l,u),c+=2):o===7?c>h&&(i.push(i[h],i[h+1]),c+=2):ne(!1,59)}c>h&&(r.push(c),h=c)}createFeature_(e,t,i){const r=t.type;if(r===0)return null;let s;const o=t.properties;let a;this.idProperty_?(a=o[this.idProperty_],delete o[this.idProperty_]):a=t.id,o[this.layerName_]=t.layer.name;const l=[],u=[];this.readRawGeometry_(e,t,l,u);const c=gM(r,u.length);if(this.featureClass_===Kh)s=new this.featureClass_(c,l,u,o,a),s.transform(i.dataProjection);else{let h;if(c=="Polygon"){const g=Og(l,u);h=g.length>1?new Bn(l,"XY",g):new Dt(l,"XY",u)}else h=c==="Point"?new st(l,"XY"):c==="LineString"?new lt(l,"XY"):c==="MultiPoint"?new qn(l,"XY"):c==="MultiLineString"?new gn(l,"XY",u):null;const f=this.featureClass_;s=new f,this.geometryName_&&s.setGeometryName(this.geometryName_);const d=nt(h,!1,i);s.setGeometry(d),a!==void 0&&s.setId(a),s.setProperties(o,!0)}return s}getType(){return"arraybuffer"}readFeatures(e,t){const i=this.layers_;t=this.adaptOptions(t);const r=J(t.dataProjection);r.setWorldExtent(t.extent),t.dataProjection=r;const s=new jP(e),o=s.readFields(cM,{}),a=[];for(const l in o){if(i&&!i.includes(l))continue;const u=o[l],c=u?[0,0,u.extent,u.extent]:null;r.setExtent(c);for(let h=0,f=u.length;h<f;++h){const d=dM(s,u,h),g=this.createFeature_(s,d,t);g!==null&&a.push(g)}}return a}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}}function cM(n,e,t){if(n===3){const i={keys:[],values:[],features:[]},r=t.readVarint()+t.pos;t.readFields(hM,i,r),i.length=i.features.length,i.length&&(e[i.name]=i)}}function hM(n,e,t){if(n===15)e.version=t.readVarint();else if(n===1)e.name=t.readString();else if(n===5)e.extent=t.readVarint();else if(n===2)e.features.push(t.pos);else if(n===3)e.keys.push(t.readString());else if(n===4){let i=null;const r=t.readVarint()+t.pos;for(;t.pos<r;)n=t.readVarint()>>3,i=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null;e.values.push(i)}}function fM(n,e,t){if(n==1)e.id=t.readVarint();else if(n==2){const i=t.readVarint()+t.pos;for(;t.pos<i;){const r=e.layer.keys[t.readVarint()],s=e.layer.values[t.readVarint()];e.properties[r]=s}}else n==3?e.type=t.readVarint():n==4&&(e.geometry=t.pos)}function dM(n,e,t){n.pos=e.features[t];const i=n.readVarint()+n.pos,r={layer:e,type:0,properties:{}};return n.readFields(fM,r,i),r}function gM(n,e){let t;return n===1?t=e===1?"Point":"MultiPoint":n===2?t=e===1?"LineString":"MultiLineString":n===3&&(t="Polygon"),t}var Jp=uM;const Qp=[null],pM=G(Qp,{nd:EM,tag:j1}),mM=G(Qp,{node:vM,way:xM});class _M extends co{constructor(){super(),this.dataProjection=J("EPSG:4326")}readFeaturesFromNode(e,t){if(t=this.getReadOptions(e,t),e.localName=="osm"){const i=z({nodes:{},ways:[],features:[]},mM,e,[t]);for(let r=0;r<i.ways.length;r++){const s=i.ways[r],o=[];for(let u=0,c=s.ndrefs.length;u<c;u++){const h=i.nodes[s.ndrefs[u]];Oe(o,h)}let a;s.ndrefs[0]==s.ndrefs[s.ndrefs.length-1]?a=new Dt(o,"XY",[o.length]):a=new lt(o,"XY"),nt(a,!1,t);const l=new Ne(a);s.id!==void 0&&l.setId(s.id),l.setProperties(s.tags,!0),i.features.push(l)}if(i.features)return i.features}return[]}}const yM=G(Qp,{tag:j1});function vM(n,e){const t=e[0],i=e[e.length-1],r=n.getAttribute("id"),s=[parseFloat(n.getAttribute("lon")),parseFloat(n.getAttribute("lat"))];i.nodes[r]=s;const o=z({tags:{}},yM,n,e);if(!oi(o.tags)){const a=new st(s);nt(a,!1,t);const l=new Ne(a);r!==void 0&&l.setId(r),l.setProperties(o.tags,!0),i.features.push(l)}}function xM(n,e){const t=n.getAttribute("id"),i=z({id:t,ndrefs:[],tags:{}},pM,n,e);e[e.length-1].ways.push(i)}function EM(n,e){e[e.length-1].ndrefs.push(n.getAttribute("ref"))}function j1(n,e){const t=e[e.length-1];t.tags[n.getAttribute("k")]=n.getAttribute("v")}var wM=_M;class TM{read(e){if(e)if(typeof e=="string"){const t=yi(e);return this.readFromDocument(t)}else return _i(e)?this.readFromDocument(e):this.readFromNode(e);else return null}readFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE)return this.readFromNode(t);return null}readFromNode(e){}}var qh=TM;const SM="http://www.w3.org/1999/xlink";function mo(n){return n.getAttributeNS(SM,"href")}const Pn=[null,"http://www.opengis.net/ows/1.1"],bM=G(Pn,{ServiceIdentification:I(KM),ServiceProvider:I(JM),OperationsMetadata:I(WM)});class RM extends qh{constructor(){super()}readFromNode(e){const t=z({},bM,e,[]);return t||null}}const CM=G(Pn,{DeliveryPoint:I(j),City:I(j),AdministrativeArea:I(j),PostalCode:I(j),Country:I(j),ElectronicMailAddress:I(j)}),IM=G(Pn,{Value:it(QM)}),AM=G(Pn,{AllowedValues:I(BM)}),LM=G(Pn,{Phone:I(HM),Address:I(UM)}),PM=G(Pn,{HTTP:I(YM)}),MM=G(Pn,{Get:it(XM),Post:void 0}),FM=G(Pn,{DCP:I(jM)}),OM=G(Pn,{Operation:ZM}),$M=G(Pn,{Voice:I(j),Facsimile:I(j)}),DM=G(Pn,{Constraint:it(zM)}),NM=G(Pn,{IndividualName:I(j),PositionName:I(j),ContactInfo:I(VM)}),kM=G(Pn,{Abstract:I(j),AccessConstraints:I(j),Fees:I(j),Title:I(j),ServiceTypeVersion:I(j),ServiceType:I(j)}),GM=G(Pn,{ProviderName:I(j),ProviderSite:I(mo),ServiceContact:I(qM)});function UM(n,e){return z({},CM,n,e)}function BM(n,e){return z({},IM,n,e)}function zM(n,e){const t=n.getAttribute("name");if(!!t)return z({name:t},AM,n,e)}function VM(n,e){return z({},LM,n,e)}function jM(n,e){return z({},PM,n,e)}function XM(n,e){const t=mo(n);if(!!t)return z({href:t},DM,n,e)}function YM(n,e){return z({},MM,n,e)}function ZM(n,e){const t=n.getAttribute("name"),i=z({},FM,n,e);if(!i)return;const r=e[e.length-1];r[t]=i}function WM(n,e){return z({},OM,n,e)}function HM(n,e){return z({},$M,n,e)}function KM(n,e){return z({},kM,n,e)}function qM(n,e){return z({},NM,n,e)}function JM(n,e){return z({},GM,n,e)}function QM(n,e){return j(n)}var X1=RM;function em(n,e,t,i,r,s){r!==void 0?(r=r,s=s!==void 0?s:0):(r=[],s=0);let o=e;for(;o<t;){const a=n[o++];r[s++]=n[o++],r[s++]=a;for(let l=2;l<i;++l)r[s++]=n[o++]}return r.length=s,r}class eF extends Dh{constructor(e){super(),e=e||{},this.dataProjection=J("EPSG:4326"),this.factor_=e.factor?e.factor:1e5,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY"}readFeatureFromText(e,t){const i=this.readGeometryFromText(e,t);return new Ne(i)}readFeaturesFromText(e,t){return[this.readFeatureFromText(e,t)]}readGeometryFromText(e,t){const i=ra(this.geometryLayout_),r=Z1(e,i,this.factor_);em(r,0,r.length,i,r);const s=Pi(r,0,r.length,i),o=new lt(s,this.geometryLayout_);return nt(o,!1,this.adaptOptions(t))}writeFeatureText(e,t){const i=e.getGeometry();return i?this.writeGeometryText(i,t):(ne(!1,40),"")}writeFeaturesText(e,t){return this.writeFeatureText(e[0],t)}writeGeometryText(e,t){e=nt(e,!0,this.adaptOptions(t));const i=e.getFlatCoordinates(),r=e.getStride();return em(i,0,i.length,r,i),Y1(i,r,this.factor_)}}function Y1(n,e,t){t=t||1e5;let i;const r=new Array(e);for(i=0;i<e;++i)r[i]=0;for(let s=0,o=n.length;s<o;)for(i=0;i<e;++i,++s){const a=n[s],l=a-r[i];r[i]=a,n[s]=l}return W1(n,t)}function Z1(n,e,t){t=t||1e5;let i;const r=new Array(e);for(i=0;i<e;++i)r[i]=0;const s=H1(n,t);for(let o=0,a=s.length;o<a;)for(i=0;i<e;++i,++o)r[i]+=s[o],s[o]=r[i];return s}function W1(n,e){e=e||1e5;for(let t=0,i=n.length;t<i;++t)n[t]=Math.round(n[t]*e);return K1(n)}function H1(n,e){e=e||1e5;const t=q1(n);for(let i=0,r=t.length;i<r;++i)t[i]/=e;return t}function K1(n){for(let e=0,t=n.length;e<t;++e){const i=n[e];n[e]=i<0?~(i<<1):i<<1}return J1(n)}function q1(n){const e=Q1(n);for(let t=0,i=e.length;t<i;++t){const r=e[t];e[t]=r&1?~(r>>1):r>>1}return e}function J1(n){let e="";for(let t=0,i=n.length;t<i;++t)e+=eE(n[t]);return e}function Q1(n){const e=[];let t=0,i=0;for(let r=0,s=n.length;r<s;++r){const o=n.charCodeAt(r)-63;t|=(o&31)<<i,o<32?(e.push(t),t=0,i=0):i+=5}return e}function eE(n){let e,t="";for(;n>=32;)e=(32|n&31)+63,t+=String.fromCharCode(e),n>>=5;return e=n+63,t+=String.fromCharCode(e),t}var tF=eF;class nF extends Ih{constructor(e){super(),e=e||{},this.layerName_=e.layerName,this.layers_=e.layers?e.layers:null,this.dataProjection=J(e.dataProjection?e.dataProjection:"EPSG:4326")}readFeaturesFromObject(e,t){if(e.type=="Topology"){const i=e;let r,s=null,o=null;i.transform&&(r=i.transform,s=r.scale,o=r.translate);const a=i.arcs;r&&hF(a,s,o);const l=[],u=i.objects,c=this.layerName_;let h;for(const f in u)this.layers_&&!this.layers_.includes(f)||(u[f].type==="GeometryCollection"?(h=u[f],l.push.apply(l,cF(h,a,s,o,c,f,t))):(h=u[f],l.push(tE(h,a,s,o,c,f,t))));return l}else return[]}readProjectionFromObject(e){return this.dataProjection}}const iF={Point:rF,LineString:oF,Polygon:lF,MultiPoint:sF,MultiLineString:aF,MultiPolygon:uF};function Jh(n,e){const t=[];let i;for(let r=0,s=n.length;r<s;++r)if(i=n[r],r>0&&t.pop(),i>=0){const o=e[i];for(let a=0,l=o.length;a<l;++a)t.push(o[a].slice(0))}else{const o=e[~i];for(let a=o.length-1;a>=0;--a)t.push(o[a].slice(0))}return t}function rF(n,e,t){const i=n.coordinates;return e&&t&&tm(i,e,t),new st(i)}function sF(n,e,t){const i=n.coordinates;if(e&&t)for(let r=0,s=i.length;r<s;++r)tm(i[r],e,t);return new qn(i)}function oF(n,e){const t=Jh(n.arcs,e);return new lt(t)}function aF(n,e){const t=[];for(let i=0,r=n.arcs.length;i<r;++i)t[i]=Jh(n.arcs[i],e);return new gn(t)}function lF(n,e){const t=[];for(let i=0,r=n.arcs.length;i<r;++i)t[i]=Jh(n.arcs[i],e);return new Dt(t)}function uF(n,e){const t=[];for(let i=0,r=n.arcs.length;i<r;++i){const s=n.arcs[i],o=[];for(let a=0,l=s.length;a<l;++a)o[a]=Jh(s[a],e);t[i]=o}return new Bn(t)}function cF(n,e,t,i,r,s,o){const a=n.geometries,l=[];for(let u=0,c=a.length;u<c;++u)l[u]=tE(a[u],e,t,i,r,s,o);return l}function tE(n,e,t,i,r,s,o){let a=null;const l=n.type;if(l){const h=iF[l];l==="Point"||l==="MultiPoint"?a=h(n,t,i):a=h(n,e),a=nt(a,!1,o)}const u=new Ne({geometry:a});n.id!==void 0&&u.setId(n.id);let c=n.properties;return r&&(c||(c={}),c[r]=s),c&&u.setProperties(c,!0),u}function hF(n,e,t){for(let i=0,r=n.length;i<r;++i)fF(n[i],e,t)}function fF(n,e,t){let i=0,r=0;for(let s=0,o=n.length;s<o;++s){const a=n[s];i+=a[0],r+=a[1],a[0]=i,a[1]=r,tm(a,e,t)}}function tm(n,e,t){n[0]=n[0]*e[0]+t[0],n[1]=n[1]*e[1]+t[1]}var dF=nF;class gF{constructor(e){this.tagName_=e}getTagName(){return this.tagName_}}var _o=gF;class pF extends _o{constructor(e,t){super(e),this.conditions=t,ne(this.conditions.length>=2,57)}}var nm=pF;class mF extends nm{constructor(e){super("And",Array.prototype.slice.call(arguments))}}var nE=mF;class _F extends _o{constructor(e,t,i){if(super("BBOX"),this.geometryName=e,this.extent=t,t.length!==4)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");this.srsName=i}}var iE=_F;class yF extends _o{constructor(e,t,i,r){super(e),this.geometryName=t||"the_geom",this.geometry=i,this.srsName=r}}var Ca=yF;class vF extends Ca{constructor(e,t,i){super("Contains",e,t,i)}}var rE=vF;class xF extends Ca{constructor(e,t,i,r,s){super("DWithin",e,t,s),this.distance=i,this.unit=r}}var sE=xF;class EF extends Ca{constructor(e,t,i){super("Disjoint",e,t,i)}}var oE=EF;class wF extends _o{constructor(e,t){super(e),this.propertyName=t}}var Ia=wF;class TF extends Ia{constructor(e,t,i){super("During",e),this.begin=t,this.end=i}}var aE=TF;class SF extends Ia{constructor(e,t,i,r){super(e,t),this.expression=i,this.matchCase=r}}var yo=SF;class bF extends yo{constructor(e,t,i){super("PropertyIsEqualTo",e,t,i)}}var lE=bF;class RF extends yo{constructor(e,t){super("PropertyIsGreaterThan",e,t)}}var uE=RF;class CF extends yo{constructor(e,t){super("PropertyIsGreaterThanOrEqualTo",e,t)}}var cE=CF;class IF extends Ca{constructor(e,t,i){super("Intersects",e,t,i)}}var hE=IF;class AF extends Ia{constructor(e,t,i){super("PropertyIsBetween",e),this.lowerBoundary=t,this.upperBoundary=i}}var fE=AF;class LF extends Ia{constructor(e,t,i,r,s,o){super("PropertyIsLike",e),this.pattern=t,this.wildCard=i!==void 0?i:"*",this.singleChar=r!==void 0?r:".",this.escapeChar=s!==void 0?s:"!",this.matchCase=o}}var dE=LF;class PF extends Ia{constructor(e){super("PropertyIsNull",e)}}var gE=PF;class MF extends yo{constructor(e,t){super("PropertyIsLessThan",e,t)}}var pE=MF;class FF extends yo{constructor(e,t){super("PropertyIsLessThanOrEqualTo",e,t)}}var mE=FF;class OF extends _o{constructor(e){super("Not"),this.condition=e}}var _E=OF;class $F extends yo{constructor(e,t,i){super("PropertyIsNotEqualTo",e,t,i)}}var yE=$F;class DF extends nm{constructor(e){super("Or",Array.prototype.slice.call(arguments))}}var vE=DF;class NF extends _o{constructor(e){super("ResourceId"),this.rid=e}}var xE=NF;class kF extends Ca{constructor(e,t,i){super("Within",e,t,i)}}var EE=kF;function wE(n){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(nE,e))}function GF(n){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(vE,e))}function UF(n){return new _E(n)}function TE(n,e,t){return new iE(n,e,t)}function BF(n,e,t){return new rE(n,e,t)}function zF(n,e,t){return new hE(n,e,t)}function VF(n,e,t){return new oE(n,e,t)}function jF(n,e,t){return new EE(n,e,t)}function XF(n,e,t,i,r){return new sE(n,e,t,i,r)}function YF(n,e,t){return new lE(n,e,t)}function ZF(n,e,t){return new yE(n,e,t)}function WF(n,e){return new pE(n,e)}function HF(n,e){return new mE(n,e)}function KF(n,e){return new uE(n,e)}function qF(n,e){return new cE(n,e)}function JF(n){return new gE(n)}function QF(n,e,t){return new fE(n,e,t)}function eO(n,e,t,i,r,s){return new dE(n,e,t,i,r,s)}function tO(n,e,t){return new aE(n,e,t)}function nO(n){return new xE(n)}const SE={"http://www.opengis.net/gml":{boundedBy:I(Ee.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:se(Ee.prototype.readFeaturesInternal)}},iO={"http://www.opengis.net/wfs":{totalInserted:I(Et),totalUpdated:I(Et),totalDeleted:I(Et)},"http://www.opengis.net/wfs/2.0":{totalInserted:I(Et),totalUpdated:I(Et),totalDeleted:I(Et)}},rO={"http://www.opengis.net/wfs":{TransactionSummary:I(IE,"transactionSummary"),InsertResults:I(LE,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:I(IE,"transactionSummary"),InsertResults:I(LE,"insertIds")}},sO={"http://www.opengis.net/wfs":{PropertyName:A(fe)},"http://www.opengis.net/wfs/2.0":{PropertyName:A(fe)}},bE={"http://www.opengis.net/wfs":{Insert:A(PE),Update:A(OE),Delete:A(FE),Property:A($E),Native:A(DE)},"http://www.opengis.net/wfs/2.0":{Insert:A(PE),Update:A(OE),Delete:A(FE),Property:A($E),Native:A(DE)}},RE="feature",im="http://www.w3.org/2000/xmlns/",rm={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},sm={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},om={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},CE={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},am={"2.0.0":Oh,"1.1.0":we,"1.0.0":fo},oO="1.1.0";class aO extends co{constructor(e){super(),e=e||{},this.version_=e.version?e.version:oO,this.featureType_=e.featureType,this.featureNS_=e.featureNS,this.gmlFormat_=e.gmlFormat?e.gmlFormat:new am[this.version_],this.schemaLocation_=e.schemaLocation?e.schemaLocation:CE[this.version_]}getFeatureType(){return this.featureType_}setFeatureType(e){this.featureType_=e}readFeaturesFromNode(e,t){const i={node:e};Object.assign(i,{featureType:this.featureType_,featureNS:this.featureNS_}),Object.assign(i,this.getReadOptions(e,t||{}));const r=[i];let s;this.version_==="2.0.0"?s=SE:s=this.gmlFormat_.FEATURE_COLLECTION_PARSERS;let o=z([],s,e,r,this.gmlFormat_);return o||(o=[]),o}readTransactionResponse(e){if(e)if(typeof e=="string"){const t=yi(e);return this.readTransactionResponseFromDocument(t)}else return _i(e)?this.readTransactionResponseFromDocument(e):this.readTransactionResponseFromNode(e);else return}readFeatureCollectionMetadata(e){if(e)if(typeof e=="string"){const t=yi(e);return this.readFeatureCollectionMetadataFromDocument(t)}else return _i(e)?this.readFeatureCollectionMetadataFromDocument(e):this.readFeatureCollectionMetadataFromNode(e);else return}readFeatureCollectionMetadataFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(t)}readFeatureCollectionMetadataFromNode(e){const t={},i=ki(e.getAttribute("numberOfFeatures"));return t.numberOfFeatures=i,z(t,SE,e,[],this.gmlFormat_)}readTransactionResponseFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(t)}readTransactionResponseFromNode(e){return z({},rO,e,[])}writeGetFeature(e){const t=de(sm[this.version_],"GetFeature");t.setAttribute("service","WFS"),t.setAttribute("version",this.version_),e.handle&&t.setAttribute("handle",e.handle),e.outputFormat&&t.setAttribute("outputFormat",e.outputFormat),e.maxFeatures!==void 0&&t.setAttribute("maxFeatures",String(e.maxFeatures)),e.resultType&&t.setAttribute("resultType",e.resultType),e.startIndex!==void 0&&t.setAttribute("startIndex",String(e.startIndex)),e.count!==void 0&&t.setAttribute("count",String(e.count)),e.viewParams!==void 0&&t.setAttribute("viewParams",e.viewParams),t.setAttributeNS(ts,"xsi:schemaLocation",this.schemaLocation_);const i={node:t};if(Object.assign(i,{version:this.version_,srsName:e.srsName,featureNS:e.featureNS?e.featureNS:this.featureNS_,featurePrefix:e.featurePrefix,propertyNames:e.propertyNames?e.propertyNames:[]}),ne(Array.isArray(e.featureTypes),11),typeof e.featureTypes[0]=="string"){let r=e.filter;e.bbox&&(ne(e.geometryName,12),r=this.combineBboxAndFilter(e.geometryName,e.bbox,e.srsName,r)),Object.assign(i,{geometryName:e.geometryName,filter:r}),ZE(t,e.featureTypes,[i])}else e.featureTypes.forEach(r=>{const s=this.combineBboxAndFilter(r.geometryName,r.bbox,e.srsName,e.filter);Object.assign(i,{geometryName:r.geometryName,filter:s}),ZE(t,[r.name],[i])});return t}combineBboxAndFilter(e,t,i,r){const s=TE(e,t,i);return r?wE(r,s):s}writeTransaction(e,t,i,r){const s=[],o=r.version?r.version:this.version_,a=de(sm[o],"Transaction");a.setAttribute("service","WFS"),a.setAttribute("version",o);let l;r&&(l=r.gmlOptions?r.gmlOptions:{},r.handle&&a.setAttribute("handle",r.handle)),a.setAttributeNS(ts,"xsi:schemaLocation",CE[o]);const u=lO(a,l,o,r);return e&&Qh("Insert",e,s,u),t&&Qh("Update",t,s,u),i&&Qh("Delete",i,s,u),r.nativeElements&&Qh("Native",r.nativeElements,s,u),a}readProjectionFromDocument(e){for(let t=e.firstChild;t;t=t.nextSibling)if(t.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(t);return null}readProjectionFromNode(e){if(e.firstElementChild&&e.firstElementChild.firstElementChild){e=e.firstElementChild.firstElementChild;for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!(t.childNodes.length===0||t.childNodes.length===1&&t.firstChild.nodeType===3)){const i=[{}];return this.gmlFormat_.readGeometryElement(t,i),J(i.pop().srsName)}}return null}}function lO(n,e,t,i){const r=i.featurePrefix?i.featurePrefix:RE;let s;return t==="1.0.0"?s=2:t==="1.1.0"?s=3:t==="2.0.0"&&(s=3.2),Object.assign({node:n},{version:t,featureNS:i.featureNS,featureType:i.featureType,featurePrefix:r,gmlVersion:s,hasZ:i.hasZ,srsName:i.srsName},e)}function Qh(n,e,t,i){ge(i,bE,ut(n),e,t)}function IE(n,e){return z({},iO,n,e)}const uO={"http://www.opengis.net/ogc":{FeatureId:se(function(n,e){return n.getAttribute("fid")})},"http://www.opengis.net/ogc/1.1":{FeatureId:se(function(n,e){return n.getAttribute("fid")})}};function AE(n,e){mn(uO,n,e)}const cO={"http://www.opengis.net/wfs":{Feature:AE},"http://www.opengis.net/wfs/2.0":{Feature:AE}};function LE(n,e){return z([],cO,n,e)}function PE(n,e,t){const i=t[t.length-1],r=i.featureType,s=i.featureNS,o=i.gmlVersion,a=de(s,r);n.appendChild(a),o===2?fo.prototype.writeFeatureElement(a,e,t):o===3?we.prototype.writeFeatureElement(a,e,t):Oh.prototype.writeFeatureElement(a,e,t)}function ME(n,e,t){const r=t[t.length-1].version,s=rm[r],o=de(s,"Filter"),a=de(s,"FeatureId");o.appendChild(a),a.setAttribute("fid",e),n.appendChild(o)}function lm(n,e){n=n||RE;const t=n+":";return e.startsWith(t)?e:t+e}function FE(n,e,t){const i=t[t.length-1];ne(e.getId()!==void 0,26);const r=i.featureType,s=i.featurePrefix,o=i.featureNS,a=lm(s,r);n.setAttribute("typeName",a),n.setAttributeNS(im,"xmlns:"+s,o);const l=e.getId();l!==void 0&&ME(n,l,t)}function OE(n,e,t){const i=t[t.length-1];ne(e.getId()!==void 0,27);const r=i.version,s=i.featureType,o=i.featurePrefix,a=i.featureNS,l=lm(o,s),u=e.getGeometryName();n.setAttribute("typeName",l),n.setAttributeNS(im,"xmlns:"+o,a);const c=e.getId();if(c!==void 0){const h=e.getKeys(),f=[];for(let d=0,g=h.length;d<g;d++){const m=e.get(h[d]);if(m!==void 0){let p=h[d];m&&typeof m.getSimplifiedGeometry=="function"&&(p=u),f.push({name:p,value:m})}}ge({version:r,gmlVersion:i.gmlVersion,node:n,hasZ:i.hasZ,srsName:i.srsName},bE,ut("Property"),f,t),ME(n,c,t)}}function $E(n,e,t){const i=t[t.length-1],r=i.version,s=sm[r],o=de(s,"Name"),a=i.gmlVersion;if(n.appendChild(o),fe(o,e.name),e.value!==void 0&&e.value!==null){const l=de(s,"Value");n.appendChild(l),e.value&&typeof e.value.getSimplifiedGeometry=="function"?a===2?fo.prototype.writeGeometryElement(l,e.value,t):a===3?we.prototype.writeGeometryElement(l,e.value,t):Oh.prototype.writeGeometryElement(l,e.value,t):fe(l,e.value)}}function DE(n,e,t){e.vendorId&&n.setAttribute("vendorId",e.vendorId),e.safeToIgnore!==void 0&&n.setAttribute("safeToIgnore",String(e.safeToIgnore)),e.value!==void 0&&fe(n,e.value)}const ef={"http://www.opengis.net/wfs":{Query:A(NE)},"http://www.opengis.net/wfs/2.0":{Query:A(NE)},"http://www.opengis.net/ogc":{During:A(BE),And:A(tf),Or:A(tf),Not:A(zE),BBOX:A(GE),Contains:A(rs),Intersects:A(rs),Within:A(rs),DWithin:A(UE),PropertyIsEqualTo:A(Jn),PropertyIsNotEqualTo:A(Jn),PropertyIsLessThan:A(Jn),PropertyIsLessThanOrEqualTo:A(Jn),PropertyIsGreaterThan:A(Jn),PropertyIsGreaterThanOrEqualTo:A(Jn),PropertyIsNull:A(VE),PropertyIsBetween:A(jE),PropertyIsLike:A(XE)},"http://www.opengis.net/fes/2.0":{During:A(BE),And:A(tf),Or:A(tf),Not:A(zE),BBOX:A(GE),Contains:A(rs),Disjoint:A(rs),Intersects:A(rs),ResourceId:A(hO),Within:A(rs),DWithin:A(UE),PropertyIsEqualTo:A(Jn),PropertyIsNotEqualTo:A(Jn),PropertyIsLessThan:A(Jn),PropertyIsLessThanOrEqualTo:A(Jn),PropertyIsGreaterThan:A(Jn),PropertyIsGreaterThanOrEqualTo:A(Jn),PropertyIsNull:A(VE),PropertyIsBetween:A(jE),PropertyIsLike:A(XE)}};function NE(n,e,t){const i=t[t.length-1],r=i.version,s=i.featurePrefix,o=i.featureNS,a=i.propertyNames,l=i.srsName;let u;s?u=lm(s,e):u=e;let c;r==="2.0.0"?c="typeNames":c="typeName",n.setAttribute(c,u),l&&n.setAttribute("srsName",l),o&&n.setAttributeNS(im,"xmlns:"+s,o);const h=Object.assign({},i);h.node=n,ge(h,sO,ut("PropertyName"),a,t);const f=i.filter;if(f){const d=de(gu(r),"Filter");n.appendChild(d),kE(d,f,t)}}function kE(n,e,t){const i=t[t.length-1],r={node:n};Object.assign(r,{context:i}),ge(r,ef,ut(e.getTagName()),[e],t)}function GE(n,e,t){const i=t[t.length-1],s=i.context.version;i.srsName=e.srsName;const o=am[s];Aa(s,n,e.geometryName),o.prototype.writeGeometryElement(n,e.extent,t)}function hO(n,e,t){n.setAttribute("rid",e.rid)}function rs(n,e,t){const i=t[t.length-1],s=i.context.version;i.srsName=e.srsName;const o=am[s];Aa(s,n,e.geometryName),o.prototype.writeGeometryElement(n,e.geometry,t)}function UE(n,e,t){const s=t[t.length-1].context.version;rs(n,e,t);const o=de(gu(s),"Distance");fe(o,e.distance.toString()),s==="2.0.0"?o.setAttribute("uom",e.unit):o.setAttribute("units",e.unit),n.appendChild(o)}function BE(n,e,t){const s=t[t.length-1].context.version;nf(om[s],"ValueReference",n,e.propertyName);const o=de(Di,"TimePeriod");n.appendChild(o);const a=de(Di,"begin");o.appendChild(a),YE(a,e.begin);const l=de(Di,"end");o.appendChild(l),YE(l,e.end)}function tf(n,e,t){const r=t[t.length-1].context,s={node:n};Object.assign(s,{context:r});const o=e.conditions;for(let a=0,l=o.length;a<l;++a){const u=o[a];ge(s,ef,ut(u.getTagName()),[u],t)}}function zE(n,e,t){const r=t[t.length-1].context,s={node:n};Object.assign(s,{context:r});const o=e.condition;ge(s,ef,ut(o.getTagName()),[o],t)}function Jn(n,e,t){const s=t[t.length-1].context.version;e.matchCase!==void 0&&n.setAttribute("matchCase",e.matchCase.toString()),Aa(s,n,e.propertyName),rf(s,n,""+e.expression)}function VE(n,e,t){const s=t[t.length-1].context.version;Aa(s,n,e.propertyName)}function jE(n,e,t){const s=t[t.length-1].context.version,o=gu(s);Aa(s,n,e.propertyName);const a=de(o,"LowerBoundary");n.appendChild(a),rf(s,a,""+e.lowerBoundary);const l=de(o,"UpperBoundary");n.appendChild(l),rf(s,l,""+e.upperBoundary)}function XE(n,e,t){const s=t[t.length-1].context.version;n.setAttribute("wildCard",e.wildCard),n.setAttribute("singleChar",e.singleChar),n.setAttribute("escapeChar",e.escapeChar),e.matchCase!==void 0&&n.setAttribute("matchCase",e.matchCase.toString()),Aa(s,n,e.propertyName),rf(s,n,""+e.pattern)}function nf(n,e,t,i){const r=de(n,e);fe(r,i),t.appendChild(r)}function rf(n,e,t){nf(gu(n),"Literal",e,t)}function Aa(n,e,t){n==="2.0.0"?nf(om[n],"ValueReference",e,t):nf(rm[n],"PropertyName",e,t)}function YE(n,e){const t=de(Di,"TimeInstant");n.appendChild(t);const i=de(Di,"timePosition");t.appendChild(i),fe(i,e)}function fO(n,e){e=e||"1.1.0";const t=de(gu(e),"Filter"),i={node:t};return Object.assign(i,{version:e,filter:n}),kE(t,n,[i]),t}function ZE(n,e,t){const i=t[t.length-1],r=Object.assign({},i);r.node=n,ge(r,ef,ut("Query"),e,t)}function gu(n){let e;return n==="2.0.0"?e=om[n]:e=rm[n],e}var dO=aO;const Ke={POINT:1,LINE_STRING:2,POLYGON:3,MULTI_POINT:4,MULTI_LINE_STRING:5,MULTI_POLYGON:6,GEOMETRY_COLLECTION:7,POLYHEDRAL_SURFACE:15,TIN:16,TRIANGLE:17};class WE{constructor(e){this.view_=e,this.pos_=0,this.initialized_=!1,this.isLittleEndian_=!1,this.hasZ_=!1,this.hasM_=!1,this.srid_=null,this.layout_="XY"}readUint8(){return this.view_.getUint8(this.pos_++)}readUint32(e){return this.view_.getUint32((this.pos_+=4)-4,e!==void 0?e:this.isLittleEndian_)}readDouble(e){return this.view_.getFloat64((this.pos_+=8)-8,e!==void 0?e:this.isLittleEndian_)}readPoint(){const e=[];return e.push(this.readDouble()),e.push(this.readDouble()),this.hasZ_&&e.push(this.readDouble()),this.hasM_&&e.push(this.readDouble()),e}readLineString(){const e=this.readUint32(),t=[];for(let i=0;i<e;i++)t.push(this.readPoint());return t}readPolygon(){const e=this.readUint32(),t=[];for(let i=0;i<e;i++)t.push(this.readLineString());return t}readWkbHeader(e){const i=this.readUint8()>0,r=this.readUint32(i),s=Math.floor((r&268435455)/1e3),o=Boolean(r&2147483648)||s===1||s===3,a=Boolean(r&1073741824)||s===2||s===3,l=Boolean(r&536870912),u=(r&268435455)%1e3,c=["XY",o?"Z":"",a?"M":""].join(""),h=l?this.readUint32(i):null;if(e!==void 0&&e!==u)throw new Error("Unexpected WKB geometry type "+u);if(this.initialized_){if(this.isLittleEndian_!==i)throw new Error("Inconsistent endian");if(this.layout_!==c)throw new Error("Inconsistent geometry layout");if(h&&this.srid_!==h)throw new Error("Inconsistent coordinate system (SRID)")}else this.isLittleEndian_=i,this.hasZ_=o,this.hasM_=a,this.layout_=c,this.srid_=h,this.initialized_=!0;return u}readWkbPayload(e){switch(e){case Ke.POINT:return this.readPoint();case Ke.LINE_STRING:return this.readLineString();case Ke.POLYGON:case Ke.TRIANGLE:return this.readPolygon();case Ke.MULTI_POINT:return this.readMultiPoint();case Ke.MULTI_LINE_STRING:return this.readMultiLineString();case Ke.MULTI_POLYGON:case Ke.POLYHEDRAL_SURFACE:case Ke.TIN:return this.readMultiPolygon();case Ke.GEOMETRY_COLLECTION:return this.readGeometryCollection();default:throw new Error("Unsupported WKB geometry type "+e+" is found")}}readWkbBlock(e){return this.readWkbPayload(this.readWkbHeader(e))}readWkbCollection(e,t){const i=this.readUint32(),r=[];for(let s=0;s<i;s++){const o=e.call(this,t);o&&r.push(o)}return r}readMultiPoint(){return this.readWkbCollection(this.readWkbBlock,Ke.POINT)}readMultiLineString(){return this.readWkbCollection(this.readWkbBlock,Ke.LINE_STRING)}readMultiPolygon(){return this.readWkbCollection(this.readWkbBlock,Ke.POLYGON)}readGeometryCollection(){return this.readWkbCollection(this.readGeometry)}readGeometry(){const e=this.readWkbHeader(),t=this.readWkbPayload(e);switch(e){case Ke.POINT:return new st(t,this.layout_);case Ke.LINE_STRING:return new lt(t,this.layout_);case Ke.POLYGON:case Ke.TRIANGLE:return new Dt(t,this.layout_);case Ke.MULTI_POINT:return new qn(t,this.layout_);case Ke.MULTI_LINE_STRING:return new gn(t,this.layout_);case Ke.MULTI_POLYGON:case Ke.POLYHEDRAL_SURFACE:case Ke.TIN:return new Bn(t,this.layout_);case Ke.GEOMETRY_COLLECTION:return new Vt(t);default:return null}}getSrid(){return this.srid_}}class gO{constructor(e){e=e||{},this.layout_=e.layout,this.isLittleEndian_=e.littleEndian!==!1,this.isEWKB_=e.ewkb!==!1,this.writeQueue_=[],this.nodata_=Object.assign({X:0,Y:0,Z:0,M:0},e.nodata)}writeUint8(e){this.writeQueue_.push([1,e])}writeUint32(e){this.writeQueue_.push([4,e])}writeDouble(e){this.writeQueue_.push([8,e])}writePoint(e,t){const i=Object.assign.apply(null,t.split("").map((r,s)=>({[r]:e[s]})));for(const r of this.layout_)this.writeDouble(r in i?i[r]:this.nodata_[r])}writeLineString(e,t){this.writeUint32(e.length);for(let i=0;i<e.length;i++)this.writePoint(e[i],t)}writePolygon(e,t){this.writeUint32(e.length);for(let i=0;i<e.length;i++)this.writeLineString(e[i],t)}writeWkbHeader(e,t){e%=1e3,this.layout_.includes("Z")&&(e+=this.isEWKB_?2147483648:1e3),this.layout_.includes("M")&&(e+=this.isEWKB_?1073741824:2e3),this.isEWKB_&&Number.isInteger(t)&&(e|=536870912),this.writeUint8(this.isLittleEndian_?1:0),this.writeUint32(e),this.isEWKB_&&Number.isInteger(t)&&this.writeUint32(t)}writeMultiPoint(e,t){this.writeUint32(e.length);for(let i=0;i<e.length;i++)this.writeWkbHeader(1),this.writePoint(e[i],t)}writeMultiLineString(e,t){this.writeUint32(e.length);for(let i=0;i<e.length;i++)this.writeWkbHeader(2),this.writeLineString(e[i],t)}writeMultiPolygon(e,t){this.writeUint32(e.length);for(let i=0;i<e.length;i++)this.writeWkbHeader(3),this.writePolygon(e[i],t)}writeGeometryCollection(e){this.writeUint32(e.length);for(let t=0;t<e.length;t++)this.writeGeometry(e[t])}findMinimumLayout(e,t="XYZM"){const i=(r,s)=>r===s?r:r==="XYZM"?s:s==="XYZM"?r:"XY";if(e instanceof hi)return i(e.getLayout(),t);if(e instanceof Vt){const r=e.getGeometriesArray();for(let s=0;s<r.length&&t!=="XY";s++)t=this.findMinimumLayout(r[s],t)}return t}writeGeometry(e,t){const i={Point:Ke.POINT,LineString:Ke.LINE_STRING,Polygon:Ke.POLYGON,MultiPoint:Ke.MULTI_POINT,MultiLineString:Ke.MULTI_LINE_STRING,MultiPolygon:Ke.MULTI_POLYGON,GeometryCollection:Ke.GEOMETRY_COLLECTION},r=e.getType(),s=i[r];if(!s)throw new Error("GeometryType "+r+" is not supported");this.layout_||(this.layout_=this.findMinimumLayout(e)),this.writeWkbHeader(s,t),e instanceof hi?{Point:this.writePoint,LineString:this.writeLineString,Polygon:this.writePolygon,MultiPoint:this.writeMultiPoint,MultiLineString:this.writeMultiLineString,MultiPolygon:this.writeMultiPolygon}[r].call(this,e.getCoordinates(),e.getLayout()):e instanceof Vt&&this.writeGeometryCollection(e.getGeometriesArray())}getBuffer(){const e=this.writeQueue_.reduce((s,o)=>s+o[0],0),t=new ArrayBuffer(e),i=new DataView(t);let r=0;return this.writeQueue_.forEach(s=>{switch(s[0]){case 1:i.setUint8(r,s[1]);break;case 4:i.setUint32(r,s[1],this.isLittleEndian_);break;case 8:i.setFloat64(r,s[1],this.isLittleEndian_);break}r+=s[0]}),t}}class pO extends va{constructor(e){super(),e=e||{},this.splitCollection=Boolean(e.splitCollection),this.viewCache_=null,this.hex_=e.hex!==!1,this.littleEndian_=e.littleEndian!==!1,this.ewkb_=e.ewkb!==!1,this.layout_=e.geometryLayout,this.nodataZ_=e.nodataZ||0,this.nodataM_=e.nodataM||0,this.srid_=e.srid}getType(){return this.hex_?"text":"arraybuffer"}readFeature(e,t){return new Ne({geometry:this.readGeometry(e,t)})}readFeatures(e,t){let i=[];const r=this.readGeometry(e,t);return this.splitCollection&&r instanceof Vt?i=r.getGeometriesArray():i=[r],i.map(s=>new Ne({geometry:s}))}readGeometry(e,t){const i=HE(e);if(!i)return null;const s=new WE(i).readGeometry();return this.viewCache_=i,t=this.getReadOptions(e,t),this.viewCache_=null,nt(s,!1,t)}readProjection(e){const t=this.viewCache_||HE(e);if(!t)return;const i=new WE(t);return i.readWkbHeader(),i.getSrid()&&J("EPSG:"+i.getSrid())||void 0}writeFeature(e,t){return this.writeGeometry(e.getGeometry(),t)}writeFeatures(e,t){return this.writeGeometry(new Vt(e.map(i=>i.getGeometry())),t)}writeGeometry(e,t){t=this.adaptOptions(t);const i=new gO({layout:this.layout_,littleEndian:this.littleEndian_,ewkb:this.ewkb_,nodata:{Z:this.nodataZ_,M:this.nodataM_}});let r=Number.isInteger(this.srid_)?Number(this.srid_):null;if(this.srid_!==!1&&!Number.isInteger(this.srid_)){const o=t.dataProjection&&J(t.dataProjection);if(o){const a=o.getCode();a.startsWith("EPSG:")&&(r=Number(a.substring(5)))}}i.writeGeometry(nt(e,!0,t),r);const s=i.getBuffer();return this.hex_?mO(s):s}}function mO(n){const e=new Uint8Array(n);return Array.from(e.values()).map(t=>(t<16?"0":"")+Number(t).toString(16).toUpperCase()).join("")}function _O(n){const e=new Uint8Array(n.length/2);for(let t=0;t<n.length/2;t++)e[t]=parseInt(n.substr(t*2,2),16);return new DataView(e.buffer)}function HE(n){return typeof n=="string"?_O(n):ArrayBuffer.isView(n)?n instanceof DataView?n:new DataView(n.buffer,n.byteOffset,n.byteLength):n instanceof ArrayBuffer?new DataView(n):null}var yO=pO;const vO={POINT:st,LINESTRING:lt,POLYGON:Dt,MULTIPOINT:qn,MULTILINESTRING:gn,MULTIPOLYGON:Bn},KE="EMPTY",qE="Z",JE="M",xO="ZM",We={START:0,TEXT:1,LEFT_PAREN:2,RIGHT_PAREN:3,NUMBER:4,COMMA:5,EOF:6},EO={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class wO{constructor(e){this.wkt=e,this.index_=-1}isAlpha_(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}isNumeric_(e,t){return t=t!==void 0?t:!1,e>="0"&&e<="9"||e=="."&&!t}isWhiteSpace_(e){return e==" "||e==" "||e=="\r"||e==`
|
7
|
-
`}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const e=this.nextChar_(),t=this.index_;let i=e,r;if(e=="(")r=We.LEFT_PAREN;else if(e==",")r=We.COMMA;else if(e==")")r=We.RIGHT_PAREN;else if(this.isNumeric_(e)||e=="-")r=We.NUMBER,i=this.readNumber_();else if(this.isAlpha_(e))r=We.TEXT,i=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(e==="")r=We.EOF;else throw new Error("Unexpected character: "+e)}return{position:t,value:i,type:r}}readNumber_(){let e;const t=this.index_;let i=!1,r=!1;do e=="."?i=!0:(e=="e"||e=="E")&&(r=!0),e=this.nextChar_();while(this.isNumeric_(e,i)||!r&&(e=="e"||e=="E")||r&&(e=="-"||e=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}readText_(){let e;const t=this.index_;do e=this.nextChar_();while(this.isAlpha_(e));return this.wkt.substring(t,this.index_--).toUpperCase()}}class TO{constructor(e){this.lexer_=e,this.token_={position:0,type:We.START},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(e){return this.token_.type==e}match(e){const t=this.isTokenType(e);return t&&this.consume_(),t}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let e="XY";const t=this.token_;if(this.isTokenType(We.TEXT)){const i=t.value;i===qE?e="XYZ":i===JE?e="XYM":i===xO&&(e="XYZM"),e!=="XY"&&this.consume_()}return e}parseGeometryCollectionText_(){if(this.match(We.LEFT_PAREN)){const e=[];do e.push(this.parseGeometry_());while(this.match(We.COMMA));if(this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(We.LEFT_PAREN)){const e=this.parsePoint_();if(this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(We.LEFT_PAREN)){const e=this.parsePointList_();if(this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(We.LEFT_PAREN)){const e=this.parseLineStringTextList_();if(this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(We.LEFT_PAREN)){let e;if(this.token_.type==We.LEFT_PAREN?e=this.parsePointTextList_():e=this.parsePointList_(),this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(We.LEFT_PAREN)){const e=this.parseLineStringTextList_();if(this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(We.LEFT_PAREN)){const e=this.parsePolygonTextList_();if(this.match(We.RIGHT_PAREN))return e}throw new Error(this.formatErrorMessage_())}parsePoint_(){const e=[],t=this.layout_.length;for(let i=0;i<t;++i){const r=this.token_;if(this.match(We.NUMBER))e.push(r.value);else break}if(e.length==t)return e;throw new Error(this.formatErrorMessage_())}parsePointList_(){const e=[this.parsePoint_()];for(;this.match(We.COMMA);)e.push(this.parsePoint_());return e}parsePointTextList_(){const e=[this.parsePointText_()];for(;this.match(We.COMMA);)e.push(this.parsePointText_());return e}parseLineStringTextList_(){const e=[this.parseLineStringText_()];for(;this.match(We.COMMA);)e.push(this.parseLineStringText_());return e}parsePolygonTextList_(){const e=[this.parsePolygonText_()];for(;this.match(We.COMMA);)e.push(this.parsePolygonText_());return e}isEmptyGeometry_(){const e=this.isTokenType(We.TEXT)&&this.token_.value==KE;return e&&this.consume_(),e}formatErrorMessage_(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}parseGeometry_(){const e=this.token_;if(this.match(We.TEXT)){const t=e.value;this.layout_=this.parseGeometryLayout_();const i=this.isEmptyGeometry_();if(t=="GEOMETRYCOLLECTION"){if(i)return new Vt([]);const r=this.parseGeometryCollectionText_();return new Vt(r)}else{const r=vO[t];if(!r)throw new Error("Invalid geometry type: "+t);let s;if(i)t=="POINT"?s=[NaN,NaN]:s=[];else switch(t){case"POINT":{s=this.parsePointText_();break}case"LINESTRING":{s=this.parseLineStringText_();break}case"POLYGON":{s=this.parsePolygonText_();break}case"MULTIPOINT":{s=this.parseMultiPointText_();break}case"MULTILINESTRING":{s=this.parseMultiLineStringText_();break}case"MULTIPOLYGON":{s=this.parseMultiPolygonText_();break}}return new r(s,this.layout_)}}throw new Error(this.formatErrorMessage_())}}class SO extends Dh{constructor(e){super(),e=e||{},this.splitCollection_=e.splitCollection!==void 0?e.splitCollection:!1}parse_(e){const t=new wO(e);return new TO(t).parse()}readFeatureFromText(e,t){const i=this.readGeometryFromText(e,t),r=new Ne;return r.setGeometry(i),r}readFeaturesFromText(e,t){let i=[];const r=this.readGeometryFromText(e,t);this.splitCollection_&&r.getType()=="GeometryCollection"?i=r.getGeometriesArray():i=[r];const s=[];for(let o=0,a=i.length;o<a;++o){const l=new Ne;l.setGeometry(i[o]),s.push(l)}return s}readGeometryFromText(e,t){const i=this.parse_(e);return nt(i,!1,t)}writeFeatureText(e,t){const i=e.getGeometry();return i?this.writeGeometryText(i,t):""}writeFeaturesText(e,t){if(e.length==1)return this.writeFeatureText(e[0],t);const i=[];for(let s=0,o=e.length;s<o;++s)i.push(e[s].getGeometry());const r=new Vt(i);return this.writeGeometryText(r,t)}writeGeometryText(e,t){return tw(nt(e,!0,t))}}function QE(n){const e=n.getCoordinates();return e.length===0?"":e.join(" ")}function bO(n){const e=[],t=n.getPoints();for(let i=0,r=t.length;i<r;++i)e.push("("+QE(t[i])+")");return e.join(",")}function RO(n){const e=[],t=n.getGeometries();for(let i=0,r=t.length;i<r;++i)e.push(tw(t[i]));return e.join(",")}function um(n){const e=n.getCoordinates(),t=[];for(let i=0,r=e.length;i<r;++i)t.push(e[i].join(" "));return t.join(",")}function CO(n){const e=[],t=n.getLineStrings();for(let i=0,r=t.length;i<r;++i)e.push("("+um(t[i])+")");return e.join(",")}function ew(n){const e=[],t=n.getLinearRings();for(let i=0,r=t.length;i<r;++i)e.push("("+um(t[i])+")");return e.join(",")}function IO(n){const e=[],t=n.getPolygons();for(let i=0,r=t.length;i<r;++i)e.push("("+ew(t[i])+")");return e.join(",")}function AO(n){const e=n.getLayout();let t="";return(e==="XYZ"||e==="XYZM")&&(t+=qE),(e==="XYM"||e==="XYZM")&&(t+=JE),t}const LO={Point:QE,LineString:um,Polygon:ew,MultiPoint:bO,MultiLineString:CO,MultiPolygon:IO,GeometryCollection:RO};function tw(n){const e=n.getType(),i=LO[e](n);let r=EO[e];if(typeof n.getFlatCoordinates=="function"){const s=AO(n);s.length>0&&(r+=" "+s)}return i.length===0?r+" "+KE:r+"("+i+")"}var PO=SO;const Kt=[null,"http://www.opengis.net/wms"],MO=G(Kt,{Service:I(QO),Capability:I(JO)}),FO=G(Kt,{Request:I(o$),Exception:I(i$),Layer:I(r$)});class OO extends qh{constructor(){super(),this.version=void 0}readFromNode(e){this.version=e.getAttribute("version").trim();const t=z({version:this.version},MO,e,[]);return t||null}}const $O=G(Kt,{Name:I(j),Title:I(j),Abstract:I(j),KeywordList:I(sw),OnlineResource:I(mo),ContactInformation:I(e$),Fees:I(j),AccessConstraints:I(j),LayerLimit:I(Et),MaxWidth:I(Et),MaxHeight:I(Et)}),DO=G(Kt,{ContactPersonPrimary:I(t$),ContactPosition:I(j),ContactAddress:I(n$),ContactVoiceTelephone:I(j),ContactFacsimileTelephone:I(j),ContactElectronicMailAddress:I(j)}),NO=G(Kt,{ContactPerson:I(j),ContactOrganization:I(j)}),kO=G(Kt,{AddressType:I(j),Address:I(j),City:I(j),StateOrProvince:I(j),PostCode:I(j),Country:I(j)}),GO=G(Kt,{Format:se(j)}),nw=G(Kt,{Name:I(j),Title:I(j),Abstract:I(j),KeywordList:I(sw),CRS:it(j),EX_GeographicBoundingBox:I(qO),BoundingBox:it(KO),Dimension:it(s$),Attribution:I(HO),AuthorityURL:it(u$),Identifier:it(j),MetadataURL:it(c$),DataURL:it(hr),FeatureListURL:it(hr),Style:it(h$),MinScaleDenominator:I($e),MaxScaleDenominator:I($e),Layer:it(iw)}),UO=G(Kt,{Title:I(j),OnlineResource:I(mo),LogoURL:I(rw)}),BO=G(Kt,{westBoundLongitude:I($e),eastBoundLongitude:I($e),southBoundLatitude:I($e),northBoundLatitude:I($e)}),zO=G(Kt,{GetCapabilities:I(cm),GetMap:I(cm),GetFeatureInfo:I(cm)}),VO=G(Kt,{Format:it(j),DCPType:it(a$)}),jO=G(Kt,{HTTP:I(l$)}),XO=G(Kt,{Get:I(hr),Post:I(hr)}),YO=G(Kt,{Name:I(j),Title:I(j),Abstract:I(j),LegendURL:it(rw),StyleSheetURL:I(hr),StyleURL:I(hr)}),ZO=G(Kt,{Format:I(j),OnlineResource:I(mo)}),WO=G(Kt,{Keyword:se(j)});function HO(n,e){return z({},UO,n,e)}function KO(n,e){const t=[Ni(n.getAttribute("minx")),Ni(n.getAttribute("miny")),Ni(n.getAttribute("maxx")),Ni(n.getAttribute("maxy"))],i=[Ni(n.getAttribute("resx")),Ni(n.getAttribute("resy"))];return{crs:n.getAttribute("CRS"),extent:t,res:i}}function qO(n,e){const t=z({},BO,n,e);if(!t)return;const i=t.westBoundLongitude,r=t.southBoundLatitude,s=t.eastBoundLongitude,o=t.northBoundLatitude;if(!(i===void 0||r===void 0||s===void 0||o===void 0))return[i,r,s,o]}function JO(n,e){return z({},FO,n,e)}function QO(n,e){return z({},$O,n,e)}function e$(n,e){return z({},DO,n,e)}function t$(n,e){return z({},NO,n,e)}function n$(n,e){return z({},kO,n,e)}function i$(n,e){return z([],GO,n,e)}function r$(n,e){const t=z({},nw,n,e);return t.Layer===void 0?Object.assign(t,iw(n,e)):t}function iw(n,e){const t=e[e.length-1],i=z({},nw,n,e);if(!i)return;let r=ns(n.getAttribute("queryable"));r===void 0&&(r=t.queryable),i.queryable=r!==void 0?r:!1;let s=ki(n.getAttribute("cascaded"));s===void 0&&(s=t.cascaded),i.cascaded=s;let o=ns(n.getAttribute("opaque"));o===void 0&&(o=t.opaque),i.opaque=o!==void 0?o:!1;let a=ns(n.getAttribute("noSubsets"));a===void 0&&(a=t.noSubsets),i.noSubsets=a!==void 0?a:!1;let l=Ni(n.getAttribute("fixedWidth"));l||(l=t.fixedWidth),i.fixedWidth=l;let u=Ni(n.getAttribute("fixedHeight"));return u||(u=t.fixedHeight),i.fixedHeight=u,["Style","CRS","AuthorityURL"].forEach(function(f){if(f in t){const d=i[f]||[];i[f]=d.concat(t[f])}}),["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach(function(f){if(!(f in i)){const d=t[f];i[f]=d}}),i}function s$(n,e){return{name:n.getAttribute("name"),units:n.getAttribute("units"),unitSymbol:n.getAttribute("unitSymbol"),default:n.getAttribute("default"),multipleValues:ns(n.getAttribute("multipleValues")),nearestValue:ns(n.getAttribute("nearestValue")),current:ns(n.getAttribute("current")),values:j(n)}}function hr(n,e){return z({},ZO,n,e)}function o$(n,e){return z({},zO,n,e)}function a$(n,e){return z({},jO,n,e)}function l$(n,e){return z({},XO,n,e)}function cm(n,e){return z({},VO,n,e)}function rw(n,e){const t=hr(n,e);if(t){const i=[ki(n.getAttribute("width")),ki(n.getAttribute("height"))];return t.size=i,t}}function u$(n,e){const t=hr(n,e);if(t)return t.name=n.getAttribute("name"),t}function c$(n,e){const t=hr(n,e);if(t)return t.type=n.getAttribute("type"),t}function h$(n,e){return z({},YO,n,e)}function sw(n,e){return z([],WO,n,e)}var f$=OO;const d$="_feature",g$="_layer";class p$ extends co{constructor(e){super(),e=e||{},this.featureNS_="http://mapserver.gis.umn.edu/mapserver",this.gmlFormat_=new fo,this.layers_=e.layers?e.layers:null}getLayers(){return this.layers_}setLayers(e){this.layers_=e}readFeatures_(e,t){e.setAttribute("namespaceURI",this.featureNS_);const i=e.localName;let r=[];if(e.childNodes.length===0)return r;if(i=="msGMLOutput")for(let s=0,o=e.childNodes.length;s<o;s++){const a=e.childNodes[s];if(a.nodeType!==Node.ELEMENT_NODE)continue;const l=a,u=t[0],c=g$,h=l.localName.replace(c,"");if(this.layers_&&!this.layers_.includes(h))continue;const f=h+d$;u.featureType=f,u.featureNS=this.featureNS_;const d={};d[f]=se(this.gmlFormat_.readFeatureElement,this.gmlFormat_);const g=G([u.featureNS,null],d);l.setAttribute("namespaceURI",this.featureNS_);const m=z([],g,l,t,this.gmlFormat_);m&&Oe(r,m)}if(i=="FeatureCollection"){const s=z([],this.gmlFormat_.FEATURE_COLLECTION_PARSERS,e,[{}],this.gmlFormat_);s&&(r=s)}return r}readFeaturesFromNode(e,t){const i={};return t&&Object.assign(i,this.getReadOptions(e,t)),this.readFeatures_(e,[i])}}var m$=p$;const Gi=[null,"http://www.opengis.net/wmts/1.0"],La=[null,"http://www.opengis.net/ows/1.1"],_$=G(Gi,{Contents:I(A$)});class y$ extends qh{constructor(){super(),this.owsParser_=new X1}readFromNode(e){let t=e.getAttribute("version");t&&(t=t.trim());let i=this.owsParser_.readFromNode(e);return i?(i.version=t,i=z(i,_$,e,[]),i||null):null}}const v$=G(Gi,{Layer:it(L$),TileMatrixSet:it(P$)}),x$=G(Gi,{Style:it(M$),Format:it(j),TileMatrixSetLink:it(F$),Dimension:it(O$),ResourceURL:it($$)},G(La,{Title:I(j),Abstract:I(j),WGS84BoundingBox:I(ow),Identifier:I(j)})),E$=G(Gi,{LegendURL:it(D$)},G(La,{Title:I(j),Identifier:I(j)})),w$=G(Gi,{TileMatrixSet:I(j),TileMatrixSetLimits:I(k$)}),T$=G(Gi,{TileMatrixLimits:se(G$)}),S$=G(Gi,{TileMatrix:I(j),MinTileRow:I(Et),MaxTileRow:I(Et),MinTileCol:I(Et),MaxTileCol:I(Et)}),b$=G(Gi,{Default:I(j),Value:it(j)},G(La,{Identifier:I(j)})),R$=G(La,{LowerCorner:se(hm),UpperCorner:se(hm)}),C$=G(Gi,{WellKnownScaleSet:I(j),TileMatrix:it(N$)},G(La,{SupportedCRS:I(j),Identifier:I(j),BoundingBox:I(ow)})),I$=G(Gi,{TopLeftCorner:I(hm),ScaleDenominator:I($e),TileWidth:I(Et),TileHeight:I(Et),MatrixWidth:I(Et),MatrixHeight:I(Et)},G(La,{Identifier:I(j)}));function A$(n,e){return z({},v$,n,e)}function L$(n,e){return z({},x$,n,e)}function P$(n,e){return z({},C$,n,e)}function M$(n,e){const t=z({},E$,n,e);if(!t)return;const i=n.getAttribute("isDefault")==="true";return t.isDefault=i,t}function F$(n,e){return z({},w$,n,e)}function O$(n,e){return z({},b$,n,e)}function $$(n,e){const t=n.getAttribute("format"),i=n.getAttribute("template"),r=n.getAttribute("resourceType"),s={};return t&&(s.format=t),i&&(s.template=i),r&&(s.resourceType=r),s}function ow(n,e){const t=z([],R$,n,e);if(t.length==2)return pt(t)}function D$(n,e){const t={};return t.format=n.getAttribute("format"),t.href=mo(n),t}function hm(n,e){const t=j(n).split(/\s+/);if(!t||t.length!=2)return;const i=+t[0],r=+t[1];if(!(isNaN(i)||isNaN(r)))return[i,r]}function N$(n,e){return z({},I$,n,e)}function k$(n,e){return z([],T$,n,e)}function G$(n,e){return z({},S$,n,e)}var U$=y$;function fm(n,e,t){const i=[];let r=n(0),s=n(1),o=e(r),a=e(s);const l=[s,r],u=[a,o],c=[1,0],h={};let f=1e5,d,g,m,p,_,v;for(;--f>0&&c.length>0;)m=c.pop(),r=l.pop(),o=u.pop(),v=m.toString(),v in h||(i.push(o[0],o[1]),h[v]=!0),p=c.pop(),s=l.pop(),a=u.pop(),_=(m+p)/2,d=n(_),g=e(d),ug(g[0],g[1],o[0],o[1],a[0],a[1])<t?(i.push(a[0],a[1]),v=p.toString(),h[v]=!0):(c.push(p,_,_,m),u.push(a,g,g,o),l.push(s,d,d,r));return i}function B$(n,e,t,i,r,s){const o=J("EPSG:4326"),a=Math.cos($t(e)),l=Math.sin($t(e)),u=Math.cos($t(i)),c=Math.sin($t(i)),h=Math.cos($t(t-n)),f=Math.sin($t(t-n)),d=l*c+a*u*h;return fm(function(g){if(1<=d)return[t,i];const m=g*Math.acos(d),p=Math.cos(m),_=Math.sin(m),v=f*u,x=a*c-l*u*h,y=Math.atan2(v,x),T=Math.asin(l*p+a*_*Math.cos(y)),w=$t(n)+Math.atan2(Math.sin(y)*_*a,p-l*Math.sin(T));return[Ll(w),Ll(T)]},ui(o,r),s)}function aw(n,e,t,i,r){const s=J("EPSG:4326");return fm(function(o){return[n,e+(t-e)*o]},ui(s,i),r)}function lw(n,e,t,i,r){const s=J("EPSG:4326");return fm(function(o){return[e+(t-e)*o,n]},ui(s,i),r)}function uw(n,e,t,i,r){let s=t,o=t,a=0,l=0,u=t,c,h,f,d,g,m,p,_,v,x;for(h=t;h<i;h+=r){const y=e[h],T=e[h+1];g!==void 0&&(v=y-g,x=T-m,d=Math.sqrt(v*v+x*x),p!==void 0&&(l+=f,c=Math.acos((p*v+_*x)/(f*d)),c>n&&(l>a&&(a=l,s=u,o=h),l=0,u=h-r)),f=d,p=v,_=x),g=y,m=T}return l+=d,l>a?[u,h]:[s,o]}function cw(n,e,t,i,r,s,o,a,l,u,c,h){let f=n[e],d=n[e+1],g=0,m=0,p=0,_=0;function v(){g=f,m=d,e+=i,f=n[e],d=n[e+1],_+=p,p=Math.sqrt((f-g)*(f-g)+(d-m)*(d-m))}do v();while(e<t-i&&_+p<s);let x=p===0?0:(s-_)/p;const y=Li(g,f,x),T=Li(m,d,x),w=e-i,E=_,S=s+a*l(u,r,c);for(;e<t-i&&_+p<S;)v();x=p===0?0:(S-_)/p;const b=Li(g,f,x),R=Li(m,d,x);let C;if(h){const L=[y,T,b,R];qc(L,0,4,2,h,L,L),C=L[0]>L[2]}else C=y>b;const M=Math.PI,P=[],U=w+i===e;e=w,p=0,_=E,f=n[e],d=n[e+1];let O;if(U){v(),O=Math.atan2(d-m,f-g),C&&(O+=O>0?-M:M);const L=(b+y)/2,$=(R+T)/2;return P[0]=[L,$,(S-s)/2,O,r],P}r=r.replace(/\n/g," ");for(let L=0,$=r.length;L<$;){v();let N=Math.atan2(d-m,f-g);if(C&&(N+=N>0?-M:M),O!==void 0){let X=N-O;if(X+=X>M?-2*M:X<-M?2*M:0,Math.abs(X)>o)return null}O=N;const D=L;let Y=0;for(;L<$;++L){const X=C?$-L-1:L,Z=a*l(u,r[X],c);if(e+i<t&&_+p<s+Y+Z/2)break;Y+=Z}if(L===D)continue;const k=C?r.substring($-D,$-L):r.substring(D,L);x=p===0?0:(s+Y/2-_)/p;const F=Li(g,f,x),ee=Li(m,d,x);P.push([F,ee,Y/2,N,k]),s+=Y}return P}function z$(n,e,t,i){const r=t-i;return n[e]===n[r]&&n[e+1]===n[r+1]&&(t-e)/i>3?!!rh(n,e,t,i):!1}function V$(n,e,t,i,r){hw(n,e,t||0,i||n.length-1,r||j$)}function hw(n,e,t,i,r){for(;i>t;){if(i-t>600){var s=i-t+1,o=e-t+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1),c=Math.max(t,Math.floor(e-o*l/s+u)),h=Math.min(i,Math.floor(e+(s-o)*l/s+u));hw(n,e,c,h,r)}var f=n[e],d=t,g=i;for(pu(n,t,e),r(n[i],f)>0&&pu(n,t,i);d<g;){for(pu(n,d,g),d++,g--;r(n[d],f)<0;)d++;for(;r(n[g],f)>0;)g--}r(n[t],f)===0?pu(n,t,g):(g++,pu(n,g,i)),g<=e&&(t=g+1),e<=g&&(i=g-1)}}function pu(n,e,t){var i=n[e];n[e]=n[t],n[t]=i}function j$(n,e){return n<e?-1:n>e?1:0}class dm{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!of(e,t))return i;const r=this.toBBox,s=[];for(;t;){for(let o=0;o<t.children.length;o++){const a=t.children[o],l=t.leaf?r(a):a;of(e,l)&&(t.leaf?i.push(a):pm(e,l)?this._all(a,i):s.push(a))}t=s.pop()}return i}collides(e){let t=this.data;if(!of(e,t))return!1;const i=[];for(;t;){for(let r=0;r<t.children.length;r++){const s=t.children[r],o=t.leaf?this.toBBox(s):s;if(of(e,o)){if(t.leaf||pm(e,o))return!0;i.push(s)}}t=i.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let i=0;i<e.length;i++)this.insert(e[i]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const i=this.data;this.data=t,t=i}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Ma([]),this}remove(e,t){if(!e)return this;let i=this.data;const r=this.toBBox(e),s=[],o=[];let a,l,u;for(;i||s.length;){if(i||(i=s.pop(),l=s[s.length-1],a=o.pop(),u=!0),i.leaf){const c=X$(e,i.children,t);if(c!==-1)return i.children.splice(c,1),s.push(i),this._condense(s),this}!u&&!i.leaf&&pm(i,r)?(s.push(i),o.push(a),a=0,l=i,i=i.children[0]):l?(a++,i=l.children[a],u=!1):i=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,r){const s=i-t+1;let o=this._maxEntries,a;if(s<=o)return a=Ma(e.slice(t,i+1)),Pa(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Ma([]),a.leaf=!1,a.height=r;const l=Math.ceil(s/o),u=l*Math.ceil(Math.sqrt(o));fw(e,t,i,u,this.compareMinX);for(let c=t;c<=i;c+=u){const h=Math.min(c+u-1,i);fw(e,c,h,l,this.compareMinY);for(let f=c;f<=h;f+=l){const d=Math.min(f+l-1,h);a.children.push(this._build(e,f,d,r-1))}}return Pa(a,this.toBBox),a}_chooseSubtree(e,t,i,r){for(;r.push(t),!(t.leaf||r.length-1===i);){let s=1/0,o=1/0,a;for(let l=0;l<t.children.length;l++){const u=t.children[l],c=gm(u),h=W$(e,u)-c;h<o?(o=h,s=c<s?c:s,a=u):h===o&&c<s&&(s=c,a=u)}t=a||t.children[0]}return t}_insert(e,t,i){const r=i?e:this.toBBox(e),s=[],o=this._chooseSubtree(r,this.data,t,s);for(o.children.push(e),_u(o,r);t>=0&&s[t].children.length>this._maxEntries;)this._split(s,t),t--;this._adjustParentBBoxes(r,s,t)}_split(e,t){const i=e[t],r=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,r);const o=this._chooseSplitIndex(i,s,r),a=Ma(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,Pa(i,this.toBBox),Pa(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(i,a)}_splitRoot(e,t){this.data=Ma([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Pa(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let r,s=1/0,o=1/0;for(let a=t;a<=i-t;a++){const l=mu(e,0,a,this.toBBox),u=mu(e,a,i,this.toBBox),c=H$(l,u),h=gm(l)+gm(u);c<s?(s=c,r=a,o=h<o?h:o):c===s&&h<o&&(o=h,r=a)}return r||i-t}_chooseSplitAxis(e,t,i){const r=e.leaf?this.compareMinX:Y$,s=e.leaf?this.compareMinY:Z$,o=this._allDistMargin(e,t,i,r),a=this._allDistMargin(e,t,i,s);o<a&&e.children.sort(r)}_allDistMargin(e,t,i,r){e.children.sort(r);const s=this.toBBox,o=mu(e,0,t,s),a=mu(e,i-t,i,s);let l=sf(o)+sf(a);for(let u=t;u<i-t;u++){const c=e.children[u];_u(o,e.leaf?s(c):c),l+=sf(o)}for(let u=i-t-1;u>=t;u--){const c=e.children[u];_u(a,e.leaf?s(c):c),l+=sf(a)}return l}_adjustParentBBoxes(e,t,i){for(let r=i;r>=0;r--)_u(t[r],e)}_condense(e){for(let t=e.length-1,i;t>=0;t--)e[t].children.length===0?t>0?(i=e[t-1].children,i.splice(i.indexOf(e[t]),1)):this.clear():Pa(e[t],this.toBBox)}}function X$(n,e,t){if(!t)return e.indexOf(n);for(let i=0;i<e.length;i++)if(t(n,e[i]))return i;return-1}function Pa(n,e){mu(n,0,n.children.length,e,n)}function mu(n,e,t,i,r){r||(r=Ma(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(let s=e;s<t;s++){const o=n.children[s];_u(r,n.leaf?i(o):o)}return r}function _u(n,e){return n.minX=Math.min(n.minX,e.minX),n.minY=Math.min(n.minY,e.minY),n.maxX=Math.max(n.maxX,e.maxX),n.maxY=Math.max(n.maxY,e.maxY),n}function Y$(n,e){return n.minX-e.minX}function Z$(n,e){return n.minY-e.minY}function gm(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function sf(n){return n.maxX-n.minX+(n.maxY-n.minY)}function W$(n,e){return(Math.max(e.maxX,n.maxX)-Math.min(e.minX,n.minX))*(Math.max(e.maxY,n.maxY)-Math.min(e.minY,n.minY))}function H$(n,e){const t=Math.max(n.minX,e.minX),i=Math.max(n.minY,e.minY),r=Math.min(n.maxX,e.maxX),s=Math.min(n.maxY,e.maxY);return Math.max(0,r-t)*Math.max(0,s-i)}function pm(n,e){return n.minX<=e.minX&&n.minY<=e.minY&&e.maxX<=n.maxX&&e.maxY<=n.maxY}function of(n,e){return e.minX<=n.maxX&&e.minY<=n.maxY&&e.maxX>=n.minX&&e.maxY>=n.minY}function Ma(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function fw(n,e,t,i,r){const s=[e,t];for(;s.length;){if(t=s.pop(),e=s.pop(),t-e<=i)continue;const o=e+Math.ceil((t-e)/i/2)*i;V$(n,o,e,t,r),s.push(e,o,o,t)}}function mm(n){return new kt({fill:yu(n,""),stroke:vu(n,""),text:K$(n),image:q$(n)})}function yu(n,e){const t=n[e+"fill-color"];if(!!t)return new yn({color:t})}function vu(n,e){const t=n[e+"stroke-width"],i=n[e+"stroke-color"];if(!(!t&&!i))return new on({width:t,color:i,lineCap:n[e+"stroke-line-cap"],lineJoin:n[e+"stroke-line-join"],lineDash:n[e+"stroke-line-dash"],lineDashOffset:n[e+"stroke-line-dash-offset"],miterLimit:n[e+"stroke-miter-limit"]})}function K$(n){const e=n["text-value"];return e?new po({text:e,font:n["text-font"],maxAngle:n["text-max-angle"],offsetX:n["text-offset-x"],offsetY:n["text-offset-y"],overflow:n["text-overflow"],placement:n["text-placement"],scale:n["text-scale"],rotateWithView:n["text-rotate-with-view"],rotation:n["text-rotation"],textAlign:n["text-align"],justify:n["text-justify"],textBaseline:n["text-baseline"],padding:n["text-padding"],fill:yu(n,"text-"),backgroundFill:yu(n,"text-background-"),stroke:vu(n,"text-"),backgroundStroke:vu(n,"text-background-")}):void 0}function q$(n){const e=n["icon-src"],t=n["icon-img"];if(e||t)return new Ea({src:e,img:t,imgSize:n["icon-img-size"],anchor:n["icon-anchor"],anchorOrigin:n["icon-anchor-origin"],anchorXUnits:n["icon-anchor-x-units"],anchorYUnits:n["icon-anchor-y-units"],color:n["icon-color"],crossOrigin:n["icon-cross-origin"],offset:n["icon-offset"],displacement:n["icon-displacement"],opacity:n["icon-opacity"],scale:n["icon-scale"],rotation:n["icon-rotation"],rotateWithView:n["icon-rotate-with-view"],size:n["icon-size"],declutterMode:n["icon-declutter-mode"]});const i=n["shape-points"];if(i){const s="shape-";return new kp({points:i,fill:yu(n,s),stroke:vu(n,s),radius:n["shape-radius"],radius1:n["shape-radius1"],radius2:n["shape-radius2"],angle:n["shape-angle"],displacement:n["shape-displacement"],rotation:n["shape-rotation"],rotateWithView:n["shape-rotate-with-view"],scale:n["shape-scale"],declutterMode:n["shape-declutter-mode"]})}const r=n["circle-radius"];if(r){const s="circle-";return new lu({radius:r,fill:yu(n,s),stroke:vu(n,s),displacement:n["circle-displacement"],scale:n["circle-scale"],rotation:n["circle-rotation"],rotateWithView:n["circle-rotate-with-view"],declutterMode:n["circle-declutter-mode"]})}}const dw={RENDER_ORDER:"renderOrder"};class J$ extends io{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter!==void 0?e.declutter:!1,this.renderBuffer_=e.renderBuffer!==void 0?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0?e.updateWhileAnimating:!1,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0?e.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(dw.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e){e.declutterTree||(e.declutterTree=new dm(9)),this.getRenderer().renderDeclutter(e)}setRenderOrder(e){this.set(dw.RENDER_ORDER,e)}setStyle(e){let t;if(e===void 0)t=h1;else if(e===null)t=null;else if(typeof e=="function")t=e;else if(e instanceof kt)t=e;else if(Array.isArray(e)){const i=e.length,r=new Array(i);for(let s=0;s<i;++s){const o=e[s];o instanceof kt?r[s]=o:r[s]=mm(o)}t=r}else t=mm(e);this.style_=t,this.styleFunction_=e===null?void 0:c1(this.style_),this.changed()}}var vo=J$;const xu={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Eu=[xu.FILL],fr=[xu.STROKE],ss=[xu.BEGIN_PATH],_m=[xu.CLOSE_PATH];var pe=xu;class Q${drawCustom(e,t,i,r){}drawGeometry(e){}setStyle(e){}drawCircle(e,t){}drawFeature(e,t){}drawGeometryCollection(e,t){}drawLineString(e,t){}drawMultiLineString(e,t){}drawMultiPoint(e,t){}drawMultiPolygon(e,t){}drawPoint(e,t){}drawPolygon(e,t){}drawText(e,t){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}}var ym=Q$;class eD extends ym{constructor(e,t,i,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return t==1?e:e.map(function(i){return i*t})}appendFlatPointCoordinates(e,t){const i=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates;let o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],jn(i,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,i,r,s,o){const a=this.coordinates;let l=a.length;const u=this.getBufferedMaxExtent();o&&(t+=r);let c=e[t],h=e[t+1];const f=this.tmpCoordinate_;let d=!0,g,m,p;for(g=t+r;g<i;g+=r)f[0]=e[g],f[1]=e[g+1],p=Nc(u,f),p!==m?(d&&(a[l++]=c,a[l++]=h,d=!1),a[l++]=f[0],a[l++]=f[1]):p===Pt.INTERSECTING?(a[l++]=f[0],a[l++]=f[1],d=!1):d=!0,c=f[0],h=f[1],m=p;return(s&&d||g===t+r)&&(a[l++]=c,a[l++]=h),l}drawCustomCoordinates_(e,t,i,r,s){for(let o=0,a=i.length;o<a;++o){const l=i[o],u=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(u),t=l}return t}drawCustom(e,t,i,r){this.beginGeometry(e,t);const s=e.getType(),o=e.getStride(),a=this.coordinates.length;let l,u,c,h,f;switch(s){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),h=[];const d=e.getEndss();f=0;for(let g=0,m=d.length;g<m;++g){const p=[];f=this.drawCustomCoordinates_(l,f,d[g],o,p),h.push(p)}this.instructions.push([pe.CUSTOM,a,h,e,i,ih]),this.hitDetectionInstructions.push([pe.CUSTOM,a,h,e,r||i,ih]);break;case"Polygon":case"MultiLineString":c=[],l=s=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(l,0,e.getEnds(),o,c),this.instructions.push([pe.CUSTOM,a,c,e,i,oa]),this.hitDetectionInstructions.push([pe.CUSTOM,a,c,e,r||i,oa]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([pe.CUSTOM,a,u,e,i,Pi]),this.hitDetectionInstructions.push([pe.CUSTOM,a,u,e,r||i,Pi]);break;case"MultiPoint":l=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(l,o),u>a&&(this.instructions.push([pe.CUSTOM,a,u,e,i,Pi]),this.hitDetectionInstructions.push([pe.CUSTOM,a,u,e,r||i,Pi]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),u=this.coordinates.length,this.instructions.push([pe.CUSTOM,a,u,e,i]),this.hitDetectionInstructions.push([pe.CUSTOM,a,u,e,r||i]);break}this.endGeometry(t)}beginGeometry(e,t){this.beginGeometryInstruction1_=[pe.BEGIN_GEOMETRY,t,0,e],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[pe.BEGIN_GEOMETRY,t,0,e],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;e.reverse();let t;const i=e.length;let r,s,o=-1;for(t=0;t<i;++t)r=e[t],s=r[0],s==pe.END_GEOMETRY?o=t:s==pe.BEGIN_GEOMETRY&&(r[2]=t,Py(this.hitDetectionInstructions,o,t),o=-1)}setFillStrokeStyle(e,t){const i=this.state;if(e){const r=e.getColor();i.fillStyle=mi(r||Mi)}else i.fillStyle=void 0;if(t){const r=t.getColor();i.strokeStyle=mi(r||da);const s=t.getLineCap();i.lineCap=s!==void 0?s:Yl;const o=t.getLineDash();i.lineDash=o?o.slice():ca;const a=t.getLineDashOffset();i.lineDashOffset=a||ha;const l=t.getLineJoin();i.lineJoin=l!==void 0?l:ro;const u=t.getWidth();i.lineWidth=u!==void 0?u:pa;const c=t.getMiterLimit();i.miterLimit=c!==void 0?c:fa,i.lineWidth>this.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(e){const t=e.fillStyle,i=[pe.SET_FILL_STYLE,t];return typeof t!="string"&&i.push(!0),i}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[pe.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,this.applyPixelRatio(e.lineDash),e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const i=e.fillStyle;(typeof i!="string"||e.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(t.call(this,e)),e.currentFillStyle=i)}updateStrokeStyle(e,t){const i=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,u=e.miterLimit;(e.currentStrokeStyle!=i||e.currentLineCap!=r||s!=e.currentLineDash&&!Ai(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=u)&&(i!==void 0&&t.call(this,e),e.currentStrokeStyle=i,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[pe.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=eg(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;hn(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var Fa=eD;class tD extends Fa{constructor(e,t,i,r){super(e,t,i,r),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(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),r=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,r);this.instructions.push([pe.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([pe.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t){if(!this.image_)return;this.beginGeometry(e,t);const i=e.getFlatCoordinates(),r=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,r);this.instructions.push([pe.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([pe.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}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(e,t){const i=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}var gw=tD;class nD extends Fa{constructor(e,t,i,r){super(e,t,i,r)}drawFlatCoordinates_(e,t,i,r){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,i,r,!1,!1),a=[pe.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(e,t){const i=this.state,r=i.strokeStyle,s=i.lineWidth;if(r===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,ca,ha],ss);const o=e.getFlatCoordinates(),a=e.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(fr),this.endGeometry(t)}drawMultiLineString(e,t){const i=this.state,r=i.strokeStyle,s=i.lineWidth;if(r===void 0||s===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(e,t),this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],ss);const o=e.getEnds(),a=e.getFlatCoordinates(),l=e.getStride();let u=0;for(let c=0,h=o.length;c<h;++c)u=this.drawFlatCoordinates_(a,u,o[c],l);this.hitDetectionInstructions.push(fr),this.endGeometry(t)}finish(){const e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(fr),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(fr),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ss)}}var pw=nD;class iD extends Fa{constructor(e,t,i,r){super(e,t,i,r)}drawFlatCoordinatess_(e,t,i,r){const s=this.state,o=s.fillStyle!==void 0,a=s.strokeStyle!==void 0,l=i.length;this.instructions.push(ss),this.hitDetectionInstructions.push(ss);for(let u=0;u<l;++u){const c=i[u],h=this.coordinates.length,f=this.appendFlatLineCoordinates(e,t,c,r,!0,!a),d=[pe.MOVE_TO_LINE_TO,h,f];this.instructions.push(d),this.hitDetectionInstructions.push(d),a&&(this.instructions.push(_m),this.hitDetectionInstructions.push(_m)),t=c}return o&&(this.instructions.push(Eu),this.hitDetectionInstructions.push(Eu)),a&&(this.instructions.push(fr),this.hitDetectionInstructions.push(fr)),t}drawCircle(e,t){const i=this.state,r=i.fillStyle,s=i.strokeStyle;if(r===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_FILL_STYLE,Mi]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getFlatCoordinates(),a=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const u=[pe.CIRCLE,l];this.instructions.push(ss,u),this.hitDetectionInstructions.push(ss,u),i.fillStyle!==void 0&&(this.instructions.push(Eu),this.hitDetectionInstructions.push(Eu)),i.strokeStyle!==void 0&&(this.instructions.push(fr),this.hitDetectionInstructions.push(fr)),this.endGeometry(t)}drawPolygon(e,t){const i=this.state,r=i.fillStyle,s=i.strokeStyle;if(r===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_FILL_STYLE,Mi]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEnds(),a=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(t)}drawMultiPolygon(e,t){const i=this.state,r=i.fillStyle,s=i.strokeStyle;if(r===void 0&&s===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_FILL_STYLE,Mi]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([pe.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const o=e.getEndss(),a=e.getOrientedFlatCoordinates(),l=e.getStride();let u=0;for(let c=0,h=o.length;c<h;++c)u=this.drawFlatCoordinatess_(a,u,o[c],l);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(e!==0){const t=this.coordinates;for(let i=0,r=t.length;i<r;++i)t[i]=Wr(t[i],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;e.fillStyle!==void 0&&this.updateFillStyle(e,this.createFill),e.strokeStyle!==void 0&&this.updateStrokeStyle(e,this.applyStroke)}}var vm=iD;const Oa={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class rD extends Fa{constructor(e,t,i,r){super(e,t,i,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t){const i=this.textFillState_,r=this.textStrokeState_,s=this.textState_;if(this.text_===""||!s||!i&&!r)return;const o=this.coordinates;let a=o.length;const l=e.getType();let u=null,c=e.getStride();if(s.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!Je(this.getBufferedMaxExtent(),e.getExtent()))return;let h;if(u=e.getFlatCoordinates(),l=="LineString")h=[u.length];else if(l=="MultiLineString")h=e.getEnds();else if(l=="Polygon")h=e.getEnds().slice(0,1);else if(l=="MultiPolygon"){const m=e.getEndss();h=[];for(let p=0,_=m.length;p<_;++p)h.push(m[p][0])}this.beginGeometry(e,t);const f=s.textAlign;let d=0,g;for(let m=0,p=h.length;m<p;++m){if(f==null){const v=uw(s.maxAngle,u,d,h[m],c);d=v[0],g=v[1]}else g=h[m];for(let v=d;v<g;v+=c)o.push(u[v],u[v+1]);const _=o.length;d=h[m],this.drawChars_(a,_),a=_}this.endGeometry(t)}else{let h=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),c=2;break;case"Polygon":u=e.getFlatInteriorPoint(),s.overflow||h.push(u[2]/this.resolution),c=3;break;case"MultiPolygon":const p=e.getFlatInteriorPoints();u=[];for(let _=0,v=p.length;_<v;_+=3)s.overflow||h.push(p[_+2]/this.resolution),u.push(p[_],p[_+1]);if(u.length===0)return;c=2;break}const f=this.appendFlatPointCoordinates(u,c);if(f===a)return;if(h&&(f-a)/2!==u.length/c){let p=a/2;h=h.filter((_,v)=>{const x=o[(p+v)*2]===u[v*c]&&o[(p+v)*2+1]===u[v*c+1];return x||--p,x})}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(e,t);let d=s.padding;if(d!=Jr&&(s.scale[0]<0||s.scale[1]<0)){let p=s.padding[0],_=s.padding[1],v=s.padding[2],x=s.padding[3];s.scale[0]<0&&(_=-_,x=-x),s.scale[1]<0&&(p=-p,v=-v),d=[p,_,v,x]}const g=this.pixelRatio;this.instructions.push([pe.DRAW_IMAGE,a,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,d==Jr?Jr:d.map(function(p){return p*g}),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,h]);const m=1/g;this.hitDetectionInstructions.push([pe.DRAW_IMAGE,a,f,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[m,m],NaN,void 0,this.declutterImageWithText_,d,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,h]),this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,i=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||ga,justify:t.justify,textBaseline:t.textBaseline||Zl,scale:t.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(e,t){const i=this.textStrokeState_,r=this.textState_,s=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,u=Oa[r.textBaseline],c=this.textOffsetY_*l,h=this.text_,f=i?i.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([pe.DRAW_CHARS,e,t,u,r.overflow,a,r.maxAngle,l,c,s,f*l,h,o,1]),this.hitDetectionInstructions.push([pe.DRAW_CHARS,e,t,u,r.overflow,a,r.maxAngle,1,c,s,f,h,o,1/l])}setTextStyle(e,t){let i,r,s;if(!e)this.text_="";else{const o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=mi(o.getColor()||Mi)):(r=null,this.textFillState_=r);const a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);const g=a.getLineDash(),m=a.getLineDashOffset(),p=a.getWidth(),_=a.getMiterLimit();s.lineCap=a.getLineCap()||Yl,s.lineDash=g?g.slice():ca,s.lineDashOffset=m===void 0?ha:m,s.lineJoin=a.getLineJoin()||ro,s.lineWidth=p===void 0?pa:p,s.miterLimit=_===void 0?fa:_,s.strokeStyle=mi(a.getColor()||da)}i=this.textState_;const l=e.getFont()||Xg;Zg(l);const u=e.getScaleArray();i.overflow=e.getOverflow(),i.font=l,i.maxAngle=e.getMaxAngle(),i.placement=e.getPlacement(),i.textAlign=e.getTextAlign(),i.justify=e.getJustify(),i.textBaseline=e.getTextBaseline()||Zl,i.backgroundFill=e.getBackgroundFill(),i.backgroundStroke=e.getBackgroundStroke(),i.padding=e.getPadding()||Jr,i.scale=u===void 0?[1,1]:u;const c=e.getOffsetX(),h=e.getOffsetY(),f=e.getRotateWithView(),d=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=h===void 0?0:h,this.textRotateWithView_=f===void 0?!1:f,this.textRotation_=d===void 0?0:d,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:H(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=r?typeof r.fillStyle=="string"?r.fillStyle:"|"+H(r.fillStyle):""}this.declutterImageWithText_=t}}var mw=rD;const sD={Circle:vm,Default:Fa,Image:gw,LineString:pw,Polygon:vm,Text:mw};class oD{constructor(e,t,i,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=i,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const i=this.buildersByZIndex_[t];for(const r in i){const s=i[r].finish();e[t][r]=s}}return e}getBuilder(e,t){const i=e!==void 0?e.toString():"0";let r=this.buildersByZIndex_[i];r===void 0&&(r={},this.buildersByZIndex_[i]=r);let s=r[t];if(s===void 0){const o=sD[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}}var wu=oD;class aD extends Mc{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.declutterExecutorGroup=null}getFeatures(e){return ae()}getData(e){return null}prepareFrame(e){return ae()}renderFrame(e,t){return ae()}loadedTileCallback(e,t,i){e[t]||(e[t]={}),e[t][i.tileCoord.toString()]=i}createLoadedTileFinder(e,t,i){return function(r,s){const o=this.loadedTileCallback.bind(this,i,r);return e.forEachLoadedTile(t,r,s,o)}.bind(this)}forEachFeatureAtCoordinate(e,t,i,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){e.target.getState()===ce.LOADED&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=ce.LOADED&&t!=ce.ERROR&&e.addEventListener(K.CHANGE,this.boundHandleImageChange_),t==ce.IDLE&&(e.load(),t=e.getState()),t==ce.LOADED}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}var xm=aD;const Em=[];let $a=null;function lD(){const n=document.createElement("canvas");n.width=1,n.height=1,$a=n.getContext("2d")}class uD extends xm{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Le(),this.pixelTransform=Le(),this.inversePixelTransform=Le(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(e,t,i){$a||lD(),$a.clearRect(0,0,1,1);let r;try{$a.drawImage(e,t,i,1,1,0,0,1,1),r=$a.getImageData(0,0,1,1).data}catch{return $a=null,null}return r}getBackground(e){let i=this.getLayer().getBackground();return typeof i=="function"&&(i=i(e.viewState.resolution)),i||void 0}useContainer(e,t,i){const r=this.getLayer().getClassName();let s,o;if(e&&e.className===r&&(!i||e&&e.style.backgroundColor&&Ai(Kr(e.style.backgroundColor),Kr(i)))){const a=e.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===t?(this.container=e,this.context=o,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){s=document.createElement("div"),s.className=r;let a=s.style;a.position="absolute",a.width="100%",a.height="100%",o=yt();const l=o.canvas;s.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=s,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(e,t,i){const r=Xn(i),s=Qo(i),o=Xs(i),a=js(i);ke(t.coordinateToPixelTransform,r),ke(t.coordinateToPixelTransform,s),ke(t.coordinateToPixelTransform,o),ke(t.coordinateToPixelTransform,a);const l=this.inversePixelTransform;ke(l,r),ke(l,s),ke(l,o),ke(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}dispatchRenderEvent_(e,t,i){const r=this.getLayer();if(r.hasListener(e)){const s=new ua(e,this.inversePixelTransform,i,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,this.dispatchRenderEvent_(nn.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(nn.POSTRENDER,e,t)}getRenderTransform(e,t,i,r,s,o,a){const l=s/2,u=o/2,c=r/t,h=-c,f=-e[0]+a,d=-e[1];return tn(this.tempTransform,l,u,c,h,-i,f,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}var af=uD;const Da=Ft(),os=[],dr=[],gr=[],as=[];function _w(n){return n[3].declutterBox}const cD=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function yw(n,e){return(e==="start"||e==="end")&&!cD.test(n)&&(e=e==="start"?"left":"right"),Oa[e]}function hD(n,e,t){return t>0&&n.push(`
|
8
|
-
`,""),n.push(e,""),n}class fD{constructor(e,t,i,r){this.overlaps=i,this.pixelRatio=t,this.resolution=e,this.alignFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Le(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={}}createLabel(e,t,i,r){const s=e+t+i+r;if(this.labels_[s])return this.labels_[s];const o=r?this.strokeStates[r]:null,a=i?this.fillStates[i]:null,l=this.textStates[t],u=this.pixelRatio,c=[l.scale[0]*u,l.scale[1]*u],h=Array.isArray(e),f=l.justify?Oa[l.justify]:yw(Array.isArray(e)?e[0]:e,l.textAlign||ga),d=r&&o.lineWidth?o.lineWidth:0,g=h?e:e.split(`
|
9
|
-
`).reduce(hD,[]),{width:m,height:p,widths:_,heights:v,lineWidths:x}=rx(l,g),y=m+d,T=[],w=(y+2)*c[0],E=(p+d)*c[1],S={width:w<0?Math.floor(w):Math.ceil(w),height:E<0?Math.floor(E):Math.ceil(E),contextInstructions:T};(c[0]!=1||c[1]!=1)&&T.push("scale",c),r&&(T.push("strokeStyle",o.strokeStyle),T.push("lineWidth",d),T.push("lineCap",o.lineCap),T.push("lineJoin",o.lineJoin),T.push("miterLimit",o.miterLimit),T.push("setLineDash",[o.lineDash]),T.push("lineDashOffset",o.lineDashOffset)),i&&T.push("fillStyle",a.fillStyle),T.push("textBaseline","middle"),T.push("textAlign","center");const b=.5-f;let R=f*y+b*d;const C=[],M=[];let P=0,U=0,O=0,L=0,$;for(let N=0,D=g.length;N<D;N+=2){const Y=g[N];if(Y===`
|
10
|
-
`){U+=P,P=0,R=f*y+b*d,++L;continue}const k=g[N+1]||l.font;k!==$&&(r&&C.push("font",k),i&&M.push("font",k),$=k),P=Math.max(P,v[O]);const F=[Y,R+b*_[O]+f*(_[O]-x[L]),.5*(d+P)+U];R+=_[O],r&&C.push("strokeText",F),i&&M.push("fillText",F),++O}return Array.prototype.push.apply(T,C),Array.prototype.push.apply(T,M),this.labels_[s]=S,S}replayTextBackground_(e,t,i,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,i),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignFill_=o[2],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,i,r,s,o,a,l,u,c,h,f,d,g,m,p){a*=f[0],l*=f[1];let _=i-a,v=r-l;const x=s+u>e?e-u:s,y=o+c>t?t-c:o,T=g[3]+x*f[0]+g[1],w=g[0]+y*f[1]+g[2],E=_-g[3],S=v-g[0];(m||h!==0)&&(os[0]=E,as[0]=E,os[1]=S,dr[1]=S,dr[0]=E+T,gr[0]=dr[0],gr[1]=S+w,as[1]=gr[1]);let b;return h!==0?(b=tn(Le(),i,r,1,1,h,-i,-r),ke(b,os),ke(b,dr),ke(b,gr),ke(b,as),Cn(Math.min(os[0],dr[0],gr[0],as[0]),Math.min(os[1],dr[1],gr[1],as[1]),Math.max(os[0],dr[0],gr[0],as[0]),Math.max(os[1],dr[1],gr[1],as[1]),Da)):Cn(Math.min(E,E+T),Math.min(S,S+w),Math.max(E,E+T),Math.max(S,S+w),Da),d&&(_=Math.round(_),v=Math.round(v)),{drawImageX:_,drawImageY:v,drawImageW:x,drawImageH:y,originX:u,originY:c,declutterBox:{minX:Da[0],minY:Da[1],maxX:Da[2],maxY:Da[3],value:p},canvasTransform:b,scale:f}}replayImageOrLabel_(e,t,i,r,s,o,a){const l=!!(o||a),u=r.declutterBox,c=e.canvas,h=a?a[2]*r.scale[0]/2:0;return u.minX-h<=c.width/t&&u.maxX+h>=0&&u.minY-h<=c.height/t&&u.maxY+h>=0&&(l&&this.replayTextBackground_(e,os,dr,gr,as,o,a),sx(e,r.canvasTransform,s,i,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){if(this.alignFill_){const t=ke(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;e.save(),e.translate(t[0]%i,t[1]%i),e.rotate(this.viewRotation_)}e.fill(),this.alignFill_&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6])}drawLabelWithPointPlacement_(e,t,i,r){const s=this.textStates[t],o=this.createLabel(e,t,r,i),a=this.strokeStates[i],l=this.pixelRatio,u=yw(Array.isArray(e)?e[0]:e,s.textAlign||ga),c=Oa[s.textBaseline||Zl],h=a&&a.lineWidth?a.lineWidth:0,f=o.width/l-2*s.scale[0],d=u*f+2*(.5-u)*h,g=c*o.height/l+2*(.5-c)*h;return{label:o,anchorX:d,anchorY:g}}execute_(e,t,i,r,s,o,a,l){let u;this.pixelCoordinates_&&Ai(i,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ci(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),jy(this.renderedTransform_,i));let c=0;const h=r.length;let f=0,d,g,m,p,_,v,x,y,T,w,E,S,b=0,R=0,C=null,M=null;const P=this.coordinateCache_,U=this.viewRotation_,O=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,L={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:U},$=this.instructions!=r||this.overlaps?0:200;let N,D,Y,k;for(;c<h;){const F=r[c];switch(F[0]){case pe.BEGIN_GEOMETRY:N=F[1],k=F[3],N.getGeometry()?a!==void 0&&!Je(a,k.getExtent())?c=F[2]+1:++c:c=F[2];break;case pe.BEGIN_PATH:b>$&&(this.fill_(e),b=0),R>$&&(e.stroke(),R=0),!b&&!R&&(e.beginPath(),p=NaN,_=NaN),++c;break;case pe.CIRCLE:f=F[1];const X=u[f],Z=u[f+1],ie=u[f+2],B=u[f+3],he=ie-X,me=B-Z,De=Math.sqrt(he*he+me*me);e.moveTo(X+De,Z),e.arc(X,Z,De,0,2*Math.PI,!0),++c;break;case pe.CLOSE_PATH:e.closePath(),++c;break;case pe.CUSTOM:f=F[1],d=F[2];const rt=F[3],Ce=F[4],at=F.length==6?F[5]:void 0;L.geometry=rt,L.feature=N,c in P||(P[c]=[]);const dt=P[c];at?at(u,f,d,2,dt):(dt[0]=u[f],dt[1]=u[f+1],dt.length=2),Ce(dt,L),++c;break;case pe.DRAW_IMAGE:f=F[1],d=F[2],y=F[3],g=F[4],m=F[5];let et=F[6];const Ve=F[7],Q=F[8],wn=F[9],Bt=F[10];let Tn=F[11];const ln=F[12];let At=F[13];const Tt=F[14],Sn=F[15];if(!y&&F.length>=20){T=F[19],w=F[20],E=F[21],S=F[22];const Zt=this.drawLabelWithPointPlacement_(T,w,E,S);y=Zt.label,F[3]=y;const Ii=F[23];g=(Zt.anchorX-Ii)*this.pixelRatio,F[4]=g;const Qt=F[24];m=(Zt.anchorY-Qt)*this.pixelRatio,F[5]=m,et=y.height,F[6]=et,At=y.width,F[13]=At}let Dn;F.length>25&&(Dn=F[25]);let bi,Vn,je;F.length>17?(bi=F[16],Vn=F[17],je=F[18]):(bi=Jr,Vn=!1,je=!1),Bt&&O?Tn+=U:!Bt&&!O&&(Tn-=U);let er=0;for(;f<d;f+=2){if(Dn&&Dn[er++]<At/this.pixelRatio)continue;const Zt=this.calculateImageOrLabelDimensions_(y.width,y.height,u[f],u[f+1],At,et,g,m,Q,wn,Tn,ln,s,bi,Vn||je,N),Ii=[e,t,y,Zt,Ve,Vn?C:null,je?M:null];if(l){if(Tt==="none")continue;if(Tt==="obstacle"){l.insert(Zt.declutterBox);continue}else{let Qt,Nn;if(Sn){const un=d-f;if(!Sn[un]){Sn[un]=Ii;continue}if(Qt=Sn[un],delete Sn[un],Nn=_w(Qt),l.collides(Nn))continue}if(l.collides(Zt.declutterBox))continue;Qt&&(l.insert(Nn),this.replayImageOrLabel_.apply(this,Qt)),l.insert(Zt.declutterBox)}}this.replayImageOrLabel_.apply(this,Ii)}++c;break;case pe.DRAW_CHARS:const tr=F[1],He=F[2],$s=F[3],Xo=F[4];S=F[5];const gl=F[6],pl=F[7],ri=F[8];E=F[9];const Ir=F[10];T=F[11],w=F[12];const bc=[F[13],F[13]],Ri=this.textStates[w],Ds=Ri.font,Ci=[Ri.scale[0]*pl,Ri.scale[1]*pl];let si;Ds in this.widths_?si=this.widths_[Ds]:(si={},this.widths_[Ds]=si);const nr=Lh(u,tr,He,2),Rc=Math.abs(Ci[0])*Wg(Ds,T,si);if(Xo||Rc<=nr){const Zt=this.textStates[w].textAlign,Ii=(nr-Rc)*Oa[Zt],Qt=cw(u,tr,He,2,T,Ii,gl,Math.abs(Ci[0]),Wg,Ds,si,O?0:this.viewRotation_);e:if(Qt){const Nn=[];let un,Yo,Zo,en,cn;if(E)for(un=0,Yo=Qt.length;un<Yo;++un){cn=Qt[un],Zo=cn[4],en=this.createLabel(Zo,w,"",E),g=cn[2]+(Ci[0]<0?-Ir:Ir),m=$s*en.height+(.5-$s)*2*Ir*Ci[1]/Ci[0]-ri;const Lt=this.calculateImageOrLabelDimensions_(en.width,en.height,cn[0],cn[1],en.width,en.height,g,m,0,0,cn[3],bc,!1,Jr,!1,N);if(l&&l.collides(Lt.declutterBox))break e;Nn.push([e,t,en,Lt,1,null,null])}if(S)for(un=0,Yo=Qt.length;un<Yo;++un){cn=Qt[un],Zo=cn[4],en=this.createLabel(Zo,w,S,""),g=cn[2],m=$s*en.height-ri;const Lt=this.calculateImageOrLabelDimensions_(en.width,en.height,cn[0],cn[1],en.width,en.height,g,m,0,0,cn[3],bc,!1,Jr,!1,N);if(l&&l.collides(Lt.declutterBox))break e;Nn.push([e,t,en,Lt,1,null,null])}l&&l.load(Nn.map(_w));for(let Lt=0,ml=Nn.length;Lt<ml;++Lt)this.replayImageOrLabel_.apply(this,Nn[Lt])}}++c;break;case pe.END_GEOMETRY:if(o!==void 0){N=F[1];const Zt=o(N,k);if(Zt)return Zt}++c;break;case pe.FILL:$?b++:this.fill_(e),++c;break;case pe.MOVE_TO_LINE_TO:for(f=F[1],d=F[2],D=u[f],Y=u[f+1],v=D+.5|0,x=Y+.5|0,(v!==p||x!==_)&&(e.moveTo(D,Y),p=v,_=x),f+=2;f<d;f+=2)D=u[f],Y=u[f+1],v=D+.5|0,x=Y+.5|0,(f==d-2||v!==p||x!==_)&&(e.lineTo(D,Y),p=v,_=x);++c;break;case pe.SET_FILL_STYLE:C=F,this.alignFill_=F[2],b&&(this.fill_(e),b=0,R&&(e.stroke(),R=0)),e.fillStyle=F[1],++c;break;case pe.SET_STROKE_STYLE:M=F,R&&(e.stroke(),R=0),this.setStrokeStyle_(e,F),++c;break;case pe.STROKE:$?R++:e.stroke(),++c;break;default:++c;break}}b&&this.fill_(e),R&&e.stroke()}execute(e,t,i,r,s,o){this.viewRotation_=r,this.execute_(e,t,i,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,i,r,s){return this.viewRotation_=i,this.execute_(e,1,t,this.hitDetectionInstructions,!0,r,s)}}var vw=fD;const wm=["Polygon","Circle","LineString","Image","Text","Default"];class dD{constructor(e,t,i,r,s,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=i,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Le(),this.createExecutors_(s)}clip(e,t){const i=this.getClipCoords(t);e.beginPath(),e.moveTo(i[0],i[1]),e.lineTo(i[2],i[3]),e.lineTo(i[4],i[5]),e.lineTo(i[6],i[7]),e.clip()}createExecutors_(e){for(const t in e){let i=this.executorsByZIndex_[t];i===void 0&&(i={},this.executorsByZIndex_[t]=i);const r=e[t];for(const s in r){const o=r[s];i[s]=new vw(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const i=this.executorsByZIndex_[t];for(let r=0,s=e.length;r<s;++r)if(e[r]in i)return!0}return!1}forEachFeatureAtCoordinate(e,t,i,r,s,o){r=Math.round(r);const a=r*2+1,l=tn(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-i,-e[0],-e[1]),u=!this.hitDetectionContext_;u&&(this.hitDetectionContext_=yt(a,a));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):u||c.clearRect(0,0,a,a);let h;this.renderBuffer_!==void 0&&(h=Ft(),Vs(h,e),hn(h,t*(this.renderBuffer_+r),h));const f=xw(r);let d;function g(T,w){const E=c.getImageData(0,0,a,a).data;for(let S=0,b=f.length;S<b;S++)if(E[f[S]]>0){if(!o||d!=="Image"&&d!=="Text"||o.includes(T)){const R=(f[S]-3)/4,C=r-R%a,M=r-(R/a|0),P=s(T,w,C*C+M*M);if(P)return P}c.clearRect(0,0,a,a);break}}const m=Object.keys(this.executorsByZIndex_).map(Number);m.sort(ir);let p,_,v,x,y;for(p=m.length-1;p>=0;--p){const T=m[p].toString();for(v=this.executorsByZIndex_[T],_=wm.length-1;_>=0;--_)if(d=wm[_],x=v[d],x!==void 0&&(y=x.executeHitDetection(c,l,i,g,h),y))return y}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const i=t[0],r=t[1],s=t[2],o=t[3],a=[i,r,i,o,s,o,s,r];return ci(a,0,8,2,e,a),a}isEmpty(){return oi(this.executorsByZIndex_)}execute(e,t,i,r,s,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(ir),this.maxExtent_&&(e.save(),this.clip(e,i)),o=o||wm;let u,c,h,f,d,g;for(a&&l.reverse(),u=0,c=l.length;u<c;++u){const m=l[u].toString();for(d=this.executorsByZIndex_[m],h=0,f=o.length;h<f;++h){const p=o[h];g=d[p],g!==void 0&&g.execute(e,t,i,r,s,a)}}this.maxExtent_&&e.restore()}}const Tm={};function xw(n){if(Tm[n]!==void 0)return Tm[n];const e=n*2+1,t=n*n,i=new Array(t+1);for(let s=0;s<=n;++s)for(let o=0;o<=n;++o){const a=s*s+o*o;if(a>t)break;let l=i[a];l||(l=[],i[a]=l),l.push(((n+s)*e+(n+o))*4+3),s>0&&l.push(((n-s)*e+(n+o))*4+3),o>0&&(l.push(((n+s)*e+(n-o))*4+3),s>0&&l.push(((n-s)*e+(n-o))*4+3))}const r=[];for(let s=0,o=i.length;s<o;++s)i[s]&&r.push(...i[s]);return Tm[n]=r,r}var Tu=dD;class gD extends ym{constructor(e,t,i,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=i,this.transform_=r,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Le()}drawImages_(e,t,i,r){if(!this.image_)return;const s=ci(e,t,i,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let u=this.imageRotation_;this.imageRotateWithView_&&(u+=this.viewRotation_);for(let c=0,h=s.length;c<h;c+=2){const f=s[c]-this.imageAnchorX_,d=s[c+1]-this.imageAnchorY_;if(u!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const g=f+this.imageAnchorX_,m=d+this.imageAnchorY_;tn(a,g,m,1,1,u,-g,-m),o.setTransform.apply(o,a),o.translate(g,m),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.setTransform(1,0,0,1,0,0)}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,f,d,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,i,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const s=ci(e,t,i,r,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.textRotateWithView_&&(a+=this.viewRotation_);t<i;t+=r){const l=s[t]+this.textOffsetX_,u=s[t+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.translate(l-this.textOffsetX_,u-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.setTransform(1,0,0,1,0,0)):(this.textStrokeState_&&o.strokeText(this.text_,l,u),this.textFillState_&&o.fillText(this.text_,l,u))}}moveToLineTo_(e,t,i,r,s){const o=this.context_,a=ci(e,t,i,r,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;s&&(l-=2);for(let u=2;u<l;u+=2)o.lineTo(a[u],a[u+1]);return s&&o.closePath(),i}drawRings_(e,t,i,r){for(let s=0,o=i.length;s<o;++s)t=this.moveToLineTo_(e,t,i[s],r,!0);return t}drawCircle(e){if(!!Je(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=Cv(e,this.transform_,this.pixelCoordinates_),i=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(i*i+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break}}drawFeature(e,t){const i=t.getGeometryFunction()(e);!i||!Je(this.extent_,i.getExtent())||(this.setStyle(t),this.drawGeometry(i))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let i=0,r=t.length;i<r;++i)this.drawGeometry(t[i])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),i=e.getStride();this.image_&&this.drawImages_(t,0,t.length,i),this.text_!==""&&this.drawText_(t,0,t.length,i)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Je(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(i,0,i.length,e.getStride(),!1),t.stroke()}if(this.text_!==""){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(!!Je(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,r=e.getFlatCoordinates();let s=0;const o=e.getEnds(),a=e.getStride();i.beginPath();for(let l=0,u=o.length;l<u;++l)s=this.moveToLineTo_(r,s,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=e.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Je(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride()),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!Je(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,i=e.getOrientedFlatCoordinates();let r=0;const s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){const u=s[a];r=this.drawRings_(i,r,u,o)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,i=this.contextFillState_;i?i.fillStyle!=e.fillStyle&&(i.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=e.lineCap&&(i.lineCap=e.lineCap,t.lineCap=e.lineCap),Ai(i.lineDash,e.lineDash)||t.setLineDash(i.lineDash=e.lineDash),i.lineDashOffset!=e.lineDashOffset&&(i.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),i.lineJoin!=e.lineJoin&&(i.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),i.lineWidth!=e.lineWidth&&(i.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),i.miterLimit!=e.miterLimit&&(i.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),i.strokeStyle!=e.strokeStyle&&(i.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,i=this.contextTextState_,r=e.textAlign?e.textAlign:ga;i?(i.font!=e.font&&(i.font=e.font,t.font=e.font),i.textAlign!=r&&(i.textAlign=r,t.textAlign=r),i.textBaseline!=e.textBaseline&&(i.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{const i=e.getColor();this.fillState_={fillStyle:mi(i||Mi)}}if(!t)this.strokeState_=null;else{const i=t.getColor(),r=t.getLineCap(),s=t.getLineDash(),o=t.getLineDashOffset(),a=t.getLineJoin(),l=t.getWidth(),u=t.getMiterLimit(),c=s||ca;this.strokeState_={lineCap:r!==void 0?r:Yl,lineDash:this.pixelRatio_===1?c:c.map(h=>h*this.pixelRatio_),lineDashOffset:(o||ha)*this.pixelRatio_,lineJoin:a!==void 0?a:ro,lineWidth:(l!==void 0?l:pa)*this.pixelRatio_,miterLimit:u!==void 0?u:fa,strokeStyle:mi(i||da)}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}const i=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*i,this.imageAnchorY_=r[1]*i,this.imageHeight_=t[1]*i,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=t[0]*i}setTextStyle(e){if(!e)this.text_="";else{const t=e.getFill();if(!t)this.textFillState_=null;else{const d=t.getColor();this.textFillState_={fillStyle:mi(d||Mi)}}const i=e.getStroke();if(!i)this.textStrokeState_=null;else{const d=i.getColor(),g=i.getLineCap(),m=i.getLineDash(),p=i.getLineDashOffset(),_=i.getLineJoin(),v=i.getWidth(),x=i.getMiterLimit();this.textStrokeState_={lineCap:g!==void 0?g:Yl,lineDash:m||ca,lineDashOffset:p||ha,lineJoin:_!==void 0?_:ro,lineWidth:v!==void 0?v:pa,miterLimit:x!==void 0?x:fa,strokeStyle:mi(d||da)}}const r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),u=e.getScaleArray(),c=e.getText(),h=e.getTextAlign(),f=e.getTextBaseline();this.textState_={font:r!==void 0?r:Xg,textAlign:h!==void 0?h:ga,textBaseline:f!==void 0?f:Zl},this.text_=c!==void 0?Array.isArray(c)?c.reduce((d,g,m)=>d+=m%2?" ":g,""):c:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*u[0],this.pixelRatio_*u[1]]}}}var lf=gD;const Mn=.5;function Sm(n,e,t,i,r,s,o){const a=n[0]*Mn,l=n[1]*Mn,u=yt(a,l);u.imageSmoothingEnabled=!1;const c=u.canvas,h=new lf(u,Mn,r,null,o),f=t.length,d=Math.floor((256*256*256-1)/f),g={};for(let p=1;p<=f;++p){const _=t[p-1],v=_.getStyleFunction()||i;if(!i)continue;let x=v(_,s);if(!x)continue;Array.isArray(x)||(x=[x]);const y=p*d,T="#"+("000000"+y.toString(16)).slice(-6);for(let w=0,E=x.length;w<E;++w){const S=x[w],b=S.getGeometryFunction()(_);if(!b||!Je(r,b.getExtent()))continue;const R=S.clone(),C=R.getFill();C&&C.setColor(T);const M=R.getStroke();M&&(M.setColor(T),M.setLineDash(null)),R.setText(void 0);const P=S.getImage();if(P&&P.getOpacity()!==0){const L=P.getImageSize();if(!L)continue;const $=yt(L[0],L[1],void 0,{alpha:!1}),N=$.canvas;$.fillStyle=T,$.fillRect(0,0,N.width,N.height),R.setImage(new Ea({img:N,imgSize:L,anchor:P.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:P.getOrigin(),opacity:1,size:P.getSize(),scale:P.getScale(),rotation:P.getRotation(),rotateWithView:P.getRotateWithView()}))}const U=R.getZIndex()||0;let O=g[U];O||(O={},g[U]=O,O.Polygon=[],O.Circle=[],O.LineString=[],O.Point=[]),O[b.getType().replace("Multi","")].push(b,R)}}const m=Object.keys(g).map(Number).sort(ir);for(let p=0,_=m.length;p<_;++p){const v=g[m[p]];for(const x in v){const y=v[x];for(let T=0,w=y.length;T<w;T+=2){h.setStyle(y[T+1]);for(let E=0,S=e.length;E<S;++E)h.setTransform(e[E]),h.drawGeometry(y[T])}}}return u.getImageData(0,0,c.width,c.height)}function bm(n,e,t){const i=[];if(t){const r=Math.floor(Math.round(n[0])*Mn),s=Math.floor(Math.round(n[1])*Mn),o=(ye(r,0,t.width-1)+ye(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],c=t.data[o+2]+256*(l+256*a),h=Math.floor((256*256*256-1)/e.length);c&&c%h===0&&i.push(e[c/h-1])}return i}const pD=.5,Ew={Point:wD,LineString:vD,Polygon:SD,MultiPoint:TD,MultiLineString:xD,MultiPolygon:ED,GeometryCollection:yD,Circle:mD};function ww(n,e){return parseInt(H(n),10)-parseInt(H(e),10)}function uf(n,e){const t=cf(n,e);return t*t}function cf(n,e){return pD*n/e}function mD(n,e,t,i,r){const s=t.getFill(),o=t.getStroke();if(s||o){const l=n.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,i)}const a=t.getText();if(a&&a.getText()){const l=(r||n).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function Su(n,e,t,i,r,s,o){let a=!1;const l=t.getImage();if(l){const u=l.getImageState();u==ce.LOADED||u==ce.ERROR?l.unlistenImageChange(r):(u==ce.IDLE&&l.load(),l.listenImageChange(r),a=!0)}return _D(n,e,t,i,s,o),a}function _D(n,e,t,i,r,s){const o=t.getGeometryFunction()(e);if(!o)return;const a=o.simplifyTransformed(i,r);t.getRenderer()?Tw(n,a,t,e):Ew[a.getType()](n,a,t,e,s)}function Tw(n,e,t,i){if(e.getType()=="GeometryCollection"){const s=e.getGeometries();for(let o=0,a=s.length;o<a;++o)Tw(n,s[o],t,i);return}n.getBuilder(t.getZIndex(),"Default").drawCustom(e,i,t.getRenderer(),t.getHitDetectionRenderer())}function yD(n,e,t,i,r){const s=e.getGeometriesArray();let o,a;for(o=0,a=s.length;o<a;++o)Ew[s[o].getType()](n,s[o],t,i,r)}function vD(n,e,t,i,r){const s=t.getStroke();if(s){const a=n.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(r||n).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function xD(n,e,t,i,r){const s=t.getStroke();if(s){const a=n.getBuilder(t.getZIndex(),"LineString");a.setFillStrokeStyle(null,s),a.drawMultiLineString(e,i)}const o=t.getText();if(o&&o.getText()){const a=(r||n).getBuilder(t.getZIndex(),"Text");a.setTextStyle(o),a.drawText(e,i)}}function ED(n,e,t,i,r){const s=t.getFill(),o=t.getStroke();if(o||s){const l=n.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawMultiPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(r||n).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}function wD(n,e,t,i,r){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=ce.LOADED)return;let l=n;if(r){const c=s.getDeclutterMode();if(c!=="none")if(l=r,c==="obstacle"){const h=n.getBuilder(t.getZIndex(),"Image");h.setImageStyle(s,a),h.drawPoint(e,i)}else o&&o.getText()&&(a={})}const u=l.getBuilder(t.getZIndex(),"Image");u.setImageStyle(s,a),u.drawPoint(e,i)}if(o&&o.getText()){let l=n;r&&(l=r);const u=l.getBuilder(t.getZIndex(),"Text");u.setTextStyle(o,a),u.drawText(e,i)}}function TD(n,e,t,i,r){const s=t.getImage(),o=t.getText();let a;if(s){if(s.getImageState()!=ce.LOADED)return;let l=n;if(r){const c=s.getDeclutterMode();if(c!=="none")if(l=r,c==="obstacle"){const h=n.getBuilder(t.getZIndex(),"Image");h.setImageStyle(s,a),h.drawMultiPoint(e,i)}else o&&o.getText()&&(a={})}const u=l.getBuilder(t.getZIndex(),"Image");u.setImageStyle(s,a),u.drawMultiPoint(e,i)}if(o&&o.getText()){let l=n;r&&(l=r);const u=l.getBuilder(t.getZIndex(),"Text");u.setTextStyle(o,a),u.drawText(e,i)}}function SD(n,e,t,i,r){const s=t.getFill(),o=t.getStroke();if(s||o){const l=n.getBuilder(t.getZIndex(),"Polygon");l.setFillStrokeStyle(s,o),l.drawPolygon(e,i)}const a=t.getText();if(a&&a.getText()){const l=(r||n).getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,i)}}class bD extends af{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Ft(),this.wrappedRenderedExtent_=Ft(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(e,t,i){const r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,u=s.rotation,c=l.getExtent(),h=this.getLayer().getSource(),f=t.pixelRatio,d=t.viewHints,g=!(d[Ye.ANIMATING]||d[Ye.INTERACTING]),m=this.compositionContext_,p=Math.round(t.size[0]*f),_=Math.round(t.size[1]*f),v=h.getWrapX()&&l.canWrapX(),x=v?_e(c):null,y=v?Math.ceil((r[2]-c[2])/x)+1:1;let T=v?Math.floor((r[0]-c[0])/x):0;do{const w=this.getRenderTransform(o,a,u,f,p,_,T*x);e.execute(m,1,w,u,g,void 0,i)}while(++T<y)}setupCompositionContext_(){if(this.opacity_!==1){const e=yt(this.context.canvas.width,this.context.canvas.height,Em);this.compositionContext_=e}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const e=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=e,uh(this.compositionContext_),Em.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(e){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,e,e.declutterTree),this.releaseCompositionContext_())}renderFrame(e,t){const i=e.pixelRatio,r=e.layerStatesArray[e.layerIndex];Xy(this.pixelTransform,1/i,1/i),Ur(this.inversePixelTransform,this.pixelTransform);const s=Cl(this.pixelTransform);this.useContainer(t,s,this.getBackground(e));const o=this.context,a=o.canvas,l=this.replayGroup_,u=this.declutterExecutorGroup;if((!l||l.isEmpty())&&(!u||u.isEmpty()))return null;const c=Math.round(e.size[0]*i),h=Math.round(e.size[1]*i);a.width!=c||a.height!=h?(a.width=c,a.height=h,a.style.transform!==s&&(a.style.transform=s)):this.containerReused||o.clearRect(0,0,c,h),this.preRender(o,e);const f=e.viewState,d=f.projection;this.opacity_=r.opacity,this.setupCompositionContext_();let g=!1,m=!0;if(r.extent&&this.clipping){const p=An(r.extent,d);m=Je(p,e.extent),g=m&&!Mt(p,e.extent),g&&this.clipUnrotated(this.compositionContext_,e,p)}return m&&this.renderWorlds(l,e),g&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,e),this.renderedRotation_!==f.rotation&&(this.renderedRotation_=f.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(e){return new Promise(function(t){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];ke(this.pixelTransform,i);const r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,u=this.getLayer(),c=[],h=i[0]*Mn,f=i[1]*Mn;c.push(this.getRenderTransform(r,s,o,Mn,h,f,0).slice());const d=u.getSource(),g=a.getExtent();if(d.getWrapX()&&a.canWrapX()&&!Mt(g,l)){let m=l[0];const p=_e(g);let _=0,v;for(;m<g[0];)--_,v=p*_,c.push(this.getRenderTransform(r,s,o,Mn,h,f,v).slice()),m+=p;for(_=0,m=l[2];m>g[2];)++_,v=p*_,c.push(this.getRenderTransform(r,s,o,Mn,h,f,v).slice()),m-=p}this.hitDetectionImageData_=Sm(i,c,this.renderedFeatures_,u.getStyleFunction(),l,s,o)}t(bm(e,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))}forEachFeatureAtCoordinate(e,t,i,r,s){if(!this.replayGroup_)return;const o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),u={},c=function(d,g,m){const p=H(d),_=u[p];if(_){if(_!==!0&&m<_.distanceSq){if(m===0)return u[p]=!0,s.splice(s.lastIndexOf(_),1),r(d,l,g);_.geometry=g,_.distanceSq=m}}else{if(m===0)return u[p]=!0,r(d,l,g);s.push(u[p]={feature:d,layer:l,geometry:g,distanceSq:m,callback:r})}};let h;const f=[this.replayGroup_];return this.declutterExecutorGroup&&f.push(this.declutterExecutorGroup),f.some(d=>h=d.forEachFeatureAtCoordinate(e,o,a,i,c,d===this.declutterExecutorGroup&&t.declutterTree?t.declutterTree.all().map(g=>g.value):null)),h}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),i=t.getSource();if(!i)return!1;const r=e.viewHints[Ye.ANIMATING],s=e.viewHints[Ye.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=e.extent,u=e.viewState,c=u.projection,h=u.resolution,f=e.pixelRatio,d=t.getRevision(),g=t.getRenderBuffer();let m=t.getRenderOrder();m===void 0&&(m=ww);const p=u.center.slice(),_=hn(l,g*h),v=_.slice(),x=[_.slice()],y=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Mt(y,e.extent)){const L=_e(y),$=Math.max(_e(_)/2,L);_[0]=y[0]-$,_[2]=y[2]+$,Xc(p,c);const N=Bc(x[0],c);N[0]<y[0]&&N[2]<y[2]?x.push([N[0]+L,N[1],N[2]+L,N[3]]):N[0]>y[0]&&N[2]>y[2]&&x.push([N[0]-L,N[1],N[2]-L,N[3]])}if(this.ready&&this.renderedResolution_==h&&this.renderedRevision_==d&&this.renderedRenderOrder_==m&&Mt(this.wrappedRenderedExtent_,_))return Ai(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const T=new wu(cf(h,f),_,h,f);let w;this.getLayer().getDeclutter()&&(w=new wu(cf(h,f),_,h,f));const E=Ht();let S;if(E){for(let L=0,$=x.length;L<$;++L){const N=x[L],D=Zr(N,c);i.loadFeatures(D,wv(h,c),E)}S=Un(E,c)}else for(let L=0,$=x.length;L<$;++L)i.loadFeatures(x[L],h,c);const b=uf(h,f);let R=!0;const C=function(L){let $;const N=L.getStyleFunction()||t.getStyleFunction();if(N&&($=N(L,h)),$){const D=this.renderFeature(L,b,$,T,S,w);R=R&&!D}}.bind(this),M=Zr(_,c),P=i.getFeaturesInExtent(M);m&&P.sort(m);for(let L=0,$=P.length;L<$;++L)C(P[L]);this.renderedFeatures_=P,this.ready=R;const U=T.finish(),O=new Tu(_,h,f,i.getOverlaps(),U,t.getRenderBuffer());return w&&(this.declutterExecutorGroup=new Tu(_,h,f,i.getOverlaps(),w.finish(),t.getRenderBuffer())),this.renderedResolution_=h,this.renderedRevision_=d,this.renderedRenderOrder_=m,this.renderedExtent_=v,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=c,this.replayGroup_=O,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,i,r,s,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,u=i.length;l<u;++l)a=Su(r,e,i[l],t,this.boundHandleStyleImageChange_,s,o)||a;else a=Su(r,e,i,t,this.boundHandleStyleImageChange_,s,o);return a}}var Rm=bD;class RD extends vo{constructor(e){super(e)}createRenderer(){return new Rm(this)}}var ls=RD;class CD{constructor(e){this.rbush_=new dm(e),this.items_={}}insert(e,t){const i={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(i),this.items_[H(t)]=i}load(e,t){const i=new Array(t.length);for(let r=0,s=t.length;r<s;r++){const o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[r]=l,this.items_[H(a)]=l}this.rbush_.load(i)}remove(e){const t=H(e),i=this.items_[t];return delete this.items_[t],this.rbush_.remove(i)!==null}update(e,t){const i=this.items_[H(t)],r=[i.minX,i.minY,i.maxX,i.maxY];In(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let i;for(let r=0,s=e.length;r<s;r++)if(i=t(e[r]),i)return i;return i}isEmpty(){return oi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return Cn(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}}var bu=CD;class ID extends Rn{constructor(e){super(),this.projection=J(e.projection),this.attributions_=Sw(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible!==void 0?e.attributionsCollapsible:!0,this.loading=!1,this.state_=e.state!==void 0?e.state:"ready",this.wrapX_=e.wrapX!==void 0?e.wrapX:!1,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(i,r){t.viewResolver=i,t.viewRejector=r})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(){return ae()}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=Sw(e),this.changed()}setState(e){this.state_=e,this.changed()}}function Sw(n){return n?Array.isArray(n)?function(e){return n}:typeof n=="function"?n:function(e){return[n]}:null}var Na=ID,ct={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function bw(n,e){return[[-1/0,-1/0,1/0,1/0]]}function AD(n,e){return[n]}function LD(n){return function(e,t,i){const r=n.getZForResolution(Tv(t,i)),s=n.getTileRangeForExtentAndZ(An(e,i),r),o=[],a=[r,0,0];for(a[1]=s.minX;a[1]<=s.maxX;++a[1])for(a[2]=s.minY;a[2]<=s.maxY;++a[2])o.push(Zr(n.getTileCoordExtent(a),i));return o}}class pr extends Ct{constructor(e,t,i){super(e),this.feature=t,this.features=i}}class PD extends Na{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:e.wrapX!==void 0?e.wrapX:!0}),this.on,this.once,this.un,this.loader_=Or,this.format_=e.format,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(ne(this.format_,7),this.loader_=Tp(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:bw;const t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new bu:null,this.loadedExtentsRtree_=new bu,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,r;Array.isArray(e.features)?r=e.features:e.features&&(i=e.features,r=i.getArray()),!t&&i===void 0&&(i=new St(r)),r!==void 0&&this.addFeaturesInternal(r),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=H(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);const i=e.getGeometry();if(i){const r=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new pr(ct.ADDFEATURE,e))}setupChangeEvents_(e,t){this.featureChangeKeys_[e]=[re(t,K.CHANGE,this.handleFeatureChange_,this),re(t,Mr.PROPERTYCHANGE,this.handleFeatureChange_,this)]}addToIndex_(e,t){let i=!0;const r=t.getId();return r!==void 0&&(r.toString()in this.idIndex_?i=!1:this.idIndex_[r.toString()]=t),i&&(ne(!(e in this.uidIndex_),30),this.uidIndex_[e]=t),i}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],i=[],r=[];for(let s=0,o=e.length;s<o;s++){const a=e[s],l=H(a);this.addToIndex_(l,a)&&i.push(a)}for(let s=0,o=i.length;s<o;s++){const a=i[s],l=H(a);this.setupChangeEvents_(l,a);const u=a.getGeometry();if(u){const c=u.getExtent();t.push(c),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(ct.ADDFEATURE))for(let s=0,o=i.length;s<o;s++)this.dispatchEvent(new pr(ct.ADDFEATURE,i[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(ct.ADDFEATURE,function(i){t||(t=!0,e.push(i.feature),t=!1)}),this.addEventListener(ct.REMOVEFEATURE,function(i){t||(t=!0,e.remove(i.feature),t=!1)}),e.addEventListener(gt.ADD,function(i){t||(t=!0,this.addFeature(i.element),t=!1)}.bind(this)),e.addEventListener(gt.REMOVE,function(i){t||(t=!0,this.removeFeature(i.element),t=!1)}.bind(this)),this.featuresCollection_=e}clear(e){if(e){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(Pe);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=function(r){this.removeFeatureInternal(r)}.bind(this);this.featuresRtree_.forEach(i);for(const r in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[r])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new pr(ct.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const i=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(i,function(r){if(r.getGeometry().intersectsCoordinate(e))return t(r)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(i){if(i.getGeometry().intersectsExtent(e)){const s=t(i);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),oi(this.nullGeometryFeatures_)||Oe(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(i){t.push(i)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const r=ev(e,t);return[].concat(...r.map(s=>this.featuresRtree_.getInExtent(s)))}else return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const i=e[0],r=e[1];let s=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return t=t||kn,this.featuresRtree_.forEachInExtent(l,function(u){if(t(u)){const c=u.getGeometry(),h=a;if(a=c.closestPointXY(i,r,o,a),a<h){s=u;const f=Math.sqrt(a);l[0]=i-f,l[1]=r-f,l[2]=i+f,l[3]=r+f}}}),s}getExtent(e){return this.featuresRtree_.getExtent(e)}getFeatureById(e){const t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,i=H(t),r=t.getGeometry();if(!r)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[i]=t);else{const o=r.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}const s=t.getId();if(s!==void 0){const o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[i]=t;this.changed(),this.dispatchEvent(new pr(ct.CHANGEFEATURE,t))}hasFeature(e){const t=e.getId();return t!==void 0?t in this.idIndex_:H(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&oi(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,i){const r=this.loadedExtentsRtree_,s=this.strategy_(e,t,i);for(let o=0,a=s.length;o<a;++o){const l=s[o];r.forEachInExtent(l,function(c){return Mt(c.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new pr(ct.FEATURESLOADSTART)),this.loader_.call(this,l,t,i,function(c){--this.loadingExtentsCount_,this.dispatchEvent(new pr(ct.FEATURESLOADEND,void 0,c))}.bind(this),function(){--this.loadingExtentsCount_,this.dispatchEvent(new pr(ct.FEATURESLOADERROR))}.bind(this)),r.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_;let i;t.forEachInExtent(e,function(r){if(In(r.extent,e))return i=r,!0}),i&&t.remove(i)}removeFeature(e){if(!e)return;const t=H(e);t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=H(e),i=this.featureChangeKeys_[t];if(!i)return;i.forEach(Pe),delete this.featureChangeKeys_[t];const r=e.getId();return r!==void 0&&delete this.idIndex_[r.toString()],delete this.uidIndex_[t],this.dispatchEvent(new pr(ct.REMOVEFEATURE,e)),e}removeFromIdIndex_(e){let t=!1;for(const i in this.idIndex_)if(this.idIndex_[i]===e){delete this.idIndex_[i],t=!0;break}return t}setLoader(e){this.loader_=e}setUrl(e){ne(this.format_,7),this.url_=e,this.setLoader(Tp(e,this.format_))}}var us=PD;function MD(n,e){const t=n.canvas;e=e||{};const i=e.pixelRatio||Oc,r=e.size;r&&(t.width=r[0]*i,t.height=r[1]*i,t.style.width=r[0]+"px",t.style.height=r[1]+"px");const s=[0,0,t.width,t.height],o=Gr(Le(),i,i);return new lf(n,i,s,o,0)}function Rw(n){if(!(n.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=n.inversePixelTransform[0],t=n.frameState,i=rr(n.inversePixelTransform.slice(),t.coordinateToPixelTransform),r=uf(t.viewState.resolution,e);let s;const o=Ht();return o&&(s=Un(o,t.viewState.projection)),new lf(n.context,e,t.extent,i,t.viewState.rotation,r,s)}function FD(n,e){return ke(n.inversePixelTransform,e.slice(0))}const OD=new on({color:"rgba(0,0,0,0.2)"}),$D=[90,45,30,20,10,5,2,1,30/60,20/60,10/60,5/60,2/60,1/60,30/3600,20/3600,10/3600,5/3600,2/3600,1/3600];class DD extends ls{constructor(e){e=e||{};const t=Object.assign({updateWhileAnimating:!0,updateWhileInteracting:!0,renderBuffer:0},e);delete t.maxLines,delete t.strokeStyle,delete t.targetSize,delete t.showLabels,delete t.lonLabelFormatter,delete t.latLabelFormatter,delete t.lonLabelPosition,delete t.latLabelPosition,delete t.lonLabelStyle,delete t.latLabelStyle,delete t.intervals,super(t),this.projection_=null,this.maxLat_=1/0,this.maxLon_=1/0,this.minLat_=-1/0,this.minLon_=-1/0,this.maxX_=1/0,this.maxY_=1/0,this.minX_=-1/0,this.minY_=-1/0,this.targetSize_=e.targetSize!==void 0?e.targetSize:100,this.maxLines_=e.maxLines!==void 0?e.maxLines:100,this.meridians_=[],this.parallels_=[],this.strokeStyle_=e.strokeStyle!==void 0?e.strokeStyle:OD,this.fromLonLatTransform_=void 0,this.toLonLatTransform_=void 0,this.projectionCenterLonLat_=null,this.bottomLeft_=null,this.bottomRight_=null,this.topLeft_=null,this.topRight_=null,this.meridiansLabels_=null,this.parallelsLabels_=null,e.showLabels&&(this.lonLabelFormatter_=e.lonLabelFormatter==null?Ml.bind(this,"EW"):e.lonLabelFormatter,this.latLabelFormatter_=e.latLabelFormatter==null?Ml.bind(this,"NS"):e.latLabelFormatter,this.lonLabelPosition_=e.lonLabelPosition==null?0:e.lonLabelPosition,this.latLabelPosition_=e.latLabelPosition==null?1:e.latLabelPosition,this.lonLabelStyleBase_=new kt({text:e.lonLabelStyle!==void 0?e.lonLabelStyle.clone():new po({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new yn({color:"rgba(0,0,0,1)"}),stroke:new on({color:"rgba(255,255,255,1)",width:3})})}),this.lonLabelStyle_=function(i){const r=i.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(r),this.lonLabelStyleBase_}.bind(this),this.latLabelStyleBase_=new kt({text:e.latLabelStyle!==void 0?e.latLabelStyle.clone():new po({font:"12px Calibri,sans-serif",textAlign:"right",fill:new yn({color:"rgba(0,0,0,1)"}),stroke:new on({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=function(i){const r=i.get("graticule_label");return this.latLabelStyleBase_.getText().setText(r),this.latLabelStyleBase_}.bind(this),this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(nn.POSTRENDER,this.drawLabels_.bind(this))),this.intervals_=e.intervals!==void 0?e.intervals:$D,this.setSource(new us({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new St,overlaps:!1,useSpatialIndex:!1,wrapX:e.wrapX})),this.featurePool_=[],this.lineStyle_=new kt({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(e,t){let i=e.slice();return this.projection_&&this.getSource().getWrapX()&&Bc(i,this.projection_),this.loadedExtent_&&(Wy(this.loadedExtent_,i,t)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(e,t,i){this.loadedExtent_=e;const r=this.getSource(),s=this.getExtent()||[-1/0,-1/0,1/0,1/0],o=zt(s,e);if(this.renderedExtent_&&In(this.renderedExtent_,o)&&this.renderedResolution_===t||(this.renderedExtent_=o,this.renderedResolution_=t,Vr(o)))return;const a=Ot(o),l=t*t/4;(!this.projection_||!fn(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(o,a,t,l);let c=this.meridians_.length+this.parallels_.length;this.meridiansLabels_&&(c+=this.meridians_.length),this.parallelsLabels_&&(c+=this.parallels_.length);let h;for(;c>this.featurePool_.length;)h=new Ne,this.featurePool_.push(h);const f=r.getFeaturesCollection();f.clear();let d=0,g,m;for(g=0,m=this.meridians_.length;g<m;++g)h=this.featurePool_[d++],h.setGeometry(this.meridians_[g]),h.setStyle(this.lineStyle_),f.push(h);for(g=0,m=this.parallels_.length;g<m;++g)h=this.featurePool_[d++],h.setGeometry(this.parallels_[g]),h.setStyle(this.lineStyle_),f.push(h)}addMeridian_(e,t,i,r,s,o){const a=this.getMeridian_(e,t,i,r,o);if(Je(a.getExtent(),s)){if(this.meridiansLabels_){const l=this.lonLabelFormatter_(e);o in this.meridiansLabels_?this.meridiansLabels_[o].text=l:this.meridiansLabels_[o]={geom:new st([]),text:l}}this.meridians_[o++]=a}return o}addParallel_(e,t,i,r,s,o){const a=this.getParallel_(e,t,i,r,o);if(Je(a.getExtent(),s)){if(this.parallelsLabels_){const l=this.latLabelFormatter_(e);o in this.parallelsLabels_?this.parallelsLabels_[o].text=l:this.parallelsLabels_[o]={geom:new st([]),text:l}}this.parallels_[o++]=a}return o}drawLabels_(e){const t=e.frameState.viewState.rotation,i=e.frameState.viewState.resolution,r=e.frameState.size,s=e.frameState.extent,o=Ot(s);let a=s;if(t){const g=r[0]*i,m=r[1]*i;a=[o[0]-g/2,o[1]-m/2,o[0]+g/2,o[1]+m/2]}let l=0,u=0,c=this.latLabelPosition_<.5;const h=this.projection_.getExtent(),f=_e(h);if(this.getSource().getWrapX()&&this.projection_.canWrapX()&&!Mt(h,s)){l=Math.floor((s[0]-h[0])/f),u=Math.ceil((s[2]-h[2])/f);const g=Math.abs(t)>Math.PI/2;c=c!==g}const d=Rw(e);for(let g=l;g<=u;++g){let m=this.meridians_.length+this.parallels_.length,p,_,v,x;if(this.meridiansLabels_)for(_=0,v=this.meridiansLabels_.length;_<v;++_){const y=this.meridians_[_];if(!t&&g===0)x=this.getMeridianPoint_(y,s,_);else{const T=y.clone();T.translate(g*f,0),T.rotate(-t,o),x=this.getMeridianPoint_(T,a,_),x.rotate(t,o)}p=this.featurePool_[m++],p.setGeometry(x),p.set("graticule_label",this.meridiansLabels_[_].text),d.drawFeature(p,this.lonLabelStyle_(p))}if(this.parallelsLabels_&&(g===l&&c||g===u&&!c))for(_=0,v=this.parallels_.length;_<v;++_){const y=this.parallels_[_];if(!t&&g===0)x=this.getParallelPoint_(y,s,_);else{const T=y.clone();T.translate(g*f,0),T.rotate(-t,o),x=this.getParallelPoint_(T,a,_),x.rotate(t,o)}p=this.featurePool_[m++],p.setGeometry(x),p.set("graticule_label",this.parallelsLabels_[_].text),d.drawFeature(p,this.latLabelStyle_(p))}}}createGraticule_(e,t,i,r){const s=this.getInterval_(i);if(s==-1){this.meridians_.length=0,this.parallels_.length=0,this.meridiansLabels_&&(this.meridiansLabels_.length=0),this.parallelsLabels_&&(this.parallelsLabels_.length=0);return}let o=!1;const a=this.projection_.getExtent(),l=_e(a);this.getSource().getWrapX()&&this.projection_.canWrapX()&&!Mt(a,e)&&(_e(e)>=l?(e[0]=a[0],e[2]=a[2]):o=!0);const u=[ye(t[0],this.minX_,this.maxX_),ye(t[1],this.minY_,this.maxY_)],c=this.toLonLatTransform_(u);isNaN(c[1])&&(c[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let h=ye(c[0],this.minLon_,this.maxLon_),f=ye(c[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let g,m,p,_,v=e;o||(v=[ye(e[0],this.minX_,this.maxX_),ye(e[1],this.minY_,this.maxY_),ye(e[2],this.minX_,this.maxX_),ye(e[3],this.minY_,this.maxY_)]);const x=Zs(v,this.toLonLatTransform_,void 0,8);let y=x[3],T=x[2],w=x[1],E=x[0];if(o||(jn(v,this.bottomLeft_)&&(E=this.minLon_,w=this.minLat_),jn(v,this.bottomRight_)&&(T=this.maxLon_,w=this.minLat_),jn(v,this.topLeft_)&&(E=this.minLon_,y=this.maxLat_),jn(v,this.topRight_)&&(T=this.maxLon_,y=this.maxLat_),y=ye(y,f,this.maxLat_),T=ye(T,h,this.maxLon_),w=ye(w,this.minLat_,f),E=ye(E,this.minLon_,h)),h=Math.floor(h/s)*s,_=ye(h,this.minLon_,this.maxLon_),m=this.addMeridian_(_,w,y,r,e,0),g=0,o)for(;(_-=s)>=E&&g++<d;)m=this.addMeridian_(_,w,y,r,e,m);else for(;_!=this.minLon_&&g++<d;)_=Math.max(_-s,this.minLon_),m=this.addMeridian_(_,w,y,r,e,m);if(_=ye(h,this.minLon_,this.maxLon_),g=0,o)for(;(_+=s)<=T&&g++<d;)m=this.addMeridian_(_,w,y,r,e,m);else for(;_!=this.maxLon_&&g++<d;)_=Math.min(_+s,this.maxLon_),m=this.addMeridian_(_,w,y,r,e,m);for(this.meridians_.length=m,this.meridiansLabels_&&(this.meridiansLabels_.length=m),f=Math.floor(f/s)*s,p=ye(f,this.minLat_,this.maxLat_),m=this.addParallel_(p,E,T,r,e,0),g=0;p!=this.minLat_&&g++<d;)p=Math.max(p-s,this.minLat_),m=this.addParallel_(p,E,T,r,e,m);for(p=ye(f,this.minLat_,this.maxLat_),g=0;p!=this.maxLat_&&g++<d;)p=Math.min(p+s,this.maxLat_),m=this.addParallel_(p,E,T,r,e,m);this.parallels_.length=m,this.parallelsLabels_&&(this.parallelsLabels_.length=m)}getInterval_(e){const t=this.projectionCenterLonLat_[0],i=this.projectionCenterLonLat_[1];let r=-1;const s=Math.pow(this.targetSize_*e,2),o=[],a=[];for(let l=0,u=this.intervals_.length;l<u;++l){const c=ye(this.intervals_[l]/2,0,90),h=ye(i,-90+c,90-c);if(o[0]=t-c,o[1]=h-c,a[0]=t+c,a[1]=h+c,this.fromLonLatTransform_(o,o),this.fromLonLatTransform_(a,a),Math.pow(a[0]-o[0],2)+Math.pow(a[1]-o[1],2)<=s)break;r=this.intervals_[l]}return r}getMeridian_(e,t,i,r,s){const o=aw(e,t,i,this.projection_,r);let a=this.meridians_[s];return a?(a.setFlatCoordinates("XY",o),a.changed()):(a=new lt(o,"XY"),this.meridians_[s]=a),a}getMeridianPoint_(e,t,i){const r=e.getFlatCoordinates();let s=1,o=r.length-1;r[s]>r[o]&&(s=o,o=1);const a=Math.max(t[1],r[s]),l=Math.min(t[3],r[o]),u=ye(t[1]+Math.abs(t[1]-t[3])*this.lonLabelPosition_,a,l),h=[r[s-1]+(r[o-1]-r[s-1])*(u-r[s])/(r[o]-r[s]),u],f=this.meridiansLabels_[i].geom;return f.setCoordinates(h),f}getMeridians(){return this.meridians_}getParallel_(e,t,i,r,s){const o=lw(e,t,i,this.projection_,r);let a=this.parallels_[s];return a?(a.setFlatCoordinates("XY",o),a.changed()):a=new lt(o,"XY"),a}getParallelPoint_(e,t,i){const r=e.getFlatCoordinates();let s=0,o=r.length-2;r[s]>r[o]&&(s=o,o=0);const a=Math.max(t[0],r[s]),l=Math.min(t[2],r[o]),u=ye(t[0]+Math.abs(t[0]-t[2])*this.latLabelPosition_,a,l),c=r[s+1]+(r[o+1]-r[s+1])*(u-r[s])/(r[o]-r[s]),h=[u,c],f=this.parallelsLabels_[i].geom;return f.setCoordinates(h),f}getParallels(){return this.parallels_}updateProjectionInfo_(e){const t=J("EPSG:4326"),i=e.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const r=ui(e,t);if(this.minLon_<this.maxLon_)this.toLonLatTransform_=r;else{const o=this.minLon_+this.maxLon_/2;this.maxLon_+=360,this.toLonLatTransform_=function(a,l,u){u=u||2;const c=r(a,l,u);for(let h=0,f=c.length;h<f;h+=u)c[h]<o&&(c[h]+=360);return c}}this.fromLonLatTransform_=ui(t,e);const s=Zs([this.minLon_,this.minLat_,this.maxLon_,this.maxLat_],this.fromLonLatTransform_,void 0,8);this.minX_=s[0],this.maxX_=s[2],this.minY_=s[1],this.maxY_=s[3],this.bottomLeft_=this.fromLonLatTransform_([this.minLon_,this.minLat_]),this.bottomRight_=this.fromLonLatTransform_([this.maxLon_,this.minLat_]),this.topLeft_=this.fromLonLatTransform_([this.minLon_,this.maxLat_]),this.topRight_=this.fromLonLatTransform_([this.maxLon_,this.maxLat_]),this.projectionCenterLonLat_=this.toLonLatTransform_(Ot(e.getExtent())),isNaN(this.projectionCenterLonLat_[1])&&(this.projectionCenterLonLat_[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=e}}var Cm=DD;const ND={ADD_FEATURES:"addfeatures"};class Cw extends Ct{constructor(e,t,i,r){super(e),this.features=i,this.file=t,this.projection=r}}class kD extends ar{constructor(e){e=e||{},super({handleEvent:kn}),this.on,this.once,this.un,this.readAsBuffer_=!1,this.formats_=[];const t=e.formatConstructors?e.formatConstructors:[];for(let i=0,r=t.length;i<r;++i){let s=t[i];typeof s=="function"&&(s=new s),this.formats_.push(s),this.readAsBuffer_=this.readAsBuffer_||s.getType()==="arraybuffer"}this.projection_=e.projection?J(e.projection):null,this.dropListenKeys_=null,this.source_=e.source||null,this.target=e.target?e.target:null}handleResult_(e,t){const i=t.target.result,r=this.getMap();let s=this.projection_;s||(s=Ht(),s||(s=r.getView().getProjection()));let o;const a=this.formats_;for(let l=0,u=a.length;l<u;++l){const c=a[l];let h=i;this.readAsBuffer_&&c.getType()!=="arraybuffer"&&(o===void 0&&(o=new TextDecoder().decode(i)),h=o);const f=this.tryReadFeatures_(c,h,{featureProjection:s});if(f&&f.length>0){this.source_&&(this.source_.clear(),this.source_.addFeatures(f)),this.dispatchEvent(new Cw(ND.ADD_FEATURES,e,f,s));break}}}registerListeners_(){const e=this.getMap();if(e){const t=this.target?this.target:e.getViewport();this.dropListenKeys_=[re(t,K.DROP,this.handleDrop,this),re(t,K.DRAGENTER,this.handleStop,this),re(t,K.DRAGOVER,this.handleStop,this),re(t,K.DROP,this.handleStop,this)]}}setActive(e){!this.getActive()&&e&&this.registerListeners_(),this.getActive()&&!e&&this.unregisterListeners_(),super.setActive(e)}setMap(e){this.unregisterListeners_(),super.setMap(e),this.getActive()&&this.registerListeners_()}tryReadFeatures_(e,t,i){try{return e.readFeatures(t,i)}catch{return null}}unregisterListeners_(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(Pe),this.dropListenKeys_=null)}handleDrop(e){const t=e.dataTransfer.files;for(let i=0,r=t.length;i<r;++i){const s=t.item(i),o=new FileReader;o.addEventListener(K.LOAD,this.handleResult_.bind(this,s)),this.readAsBuffer_?o.readAsArrayBuffer(s):o.readAsText(s)}}handleStop(e){e.stopPropagation(),e.preventDefault(),e.dataTransfer.dropEffect="copy"}}var GD=kD;class UD extends Kn{constructor(e){e=e||{},super(e),this.condition_=e.condition?e.condition:Jl,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=e.duration!==void 0?e.duration:400}handleDragEvent(e){if(!ao(e))return;const t=e.map,i=t.getSize(),r=e.pixel,s=r[0]-i[0]/2,o=i[1]/2-r[1],a=Math.atan2(o,s),l=Math.sqrt(s*s+o*o),u=t.getView();if(this.lastAngle_!==void 0){const c=this.lastAngle_-a;u.adjustRotationInternal(c)}this.lastAngle_=a,this.lastMagnitude_!==void 0&&u.adjustResolutionInternal(this.lastMagnitude_/l),this.lastMagnitude_!==void 0&&(this.lastScaleDelta_=this.lastMagnitude_/l),this.lastMagnitude_=l}handleUpEvent(e){if(!ao(e))return!0;const i=e.map.getView(),r=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,r),this.lastScaleDelta_=0,!1}handleDownEvent(e){return ao(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0):!1}}var BD=UD;const hf={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Ru extends Ct{constructor(e,t){super(e),this.feature=t}}function zD(n,e){const t=[];for(let i=0;i<e.length;++i){const s=e[i].getGeometry();Iw(n,s,t)}return t}function ff(n,e){return li(n[0],n[1],e[0],e[1])}function ka(n,e){const t=n.length;return e<0?n[e+t]:e>=t?n[e-t]:n[e]}function df(n,e,t){let i,r;e<t?(i=e,r=t):(i=t,r=e);const s=Math.ceil(i),o=Math.floor(r);if(s>o){const l=Ga(n,i),u=Ga(n,r);return ff(l,u)}let a=0;if(i<s){const l=Ga(n,i),u=ka(n,s);a+=ff(l,u)}if(o<r){const l=ka(n,o),u=Ga(n,r);a+=ff(l,u)}for(let l=s;l<o-1;++l){const u=ka(n,l),c=ka(n,l+1);a+=ff(u,c)}return a}function Iw(n,e,t){if(e instanceof lt){gf(n,e.getCoordinates(),!1,t);return}if(e instanceof gn){const i=e.getCoordinates();for(let r=0,s=i.length;r<s;++r)gf(n,i[r],!1,t);return}if(e instanceof Dt){const i=e.getCoordinates();for(let r=0,s=i.length;r<s;++r)gf(n,i[r],!0,t);return}if(e instanceof Bn){const i=e.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length;a<l;++a)gf(n,o[a],!0,t)}return}if(e instanceof Vt){const i=e.getGeometries();for(let r=0;r<i.length;++r)Iw(n,i[r],t);return}}const Im={index:-1,endIndex:NaN};function VD(n,e,t,i){const r=n[0],s=n[1];let o=1/0,a=-1,l=NaN;for(let h=0;h<e.targets.length;++h){const f=e.targets[h],d=f.coordinates;let g=1/0,m;for(let p=0;p<d.length-1;++p){const _=d[p],v=d[p+1],x=Aw(r,s,_,v);x.squaredDistance<g&&(g=x.squaredDistance,m=p+x.along)}g<o&&(o=g,f.ring&&e.targetIndex===h&&(f.endIndex>f.startIndex?m<f.startIndex&&(m+=d.length):f.endIndex<f.startIndex&&m>f.startIndex&&(m-=d.length)),l=m,a=h)}const u=e.targets[a];let c=u.ring;if(e.targetIndex===a&&c){const h=Ga(u.coordinates,l),f=t.getPixelFromCoordinate(h);na(f,e.startPx)>i&&(c=!1)}if(c){const h=u.coordinates,f=h.length,d=u.startIndex,g=l;if(d<g){const m=df(h,d,g);df(h,d,g-f)<m&&(l-=f)}else{const m=df(h,d,g);df(h,d,g+f)<m&&(l+=f)}}return Im.index=a,Im.endIndex=l,Im}function gf(n,e,t,i){const r=n[0],s=n[1];for(let o=0,a=e.length-1;o<a;++o){const l=e[o],u=e[o+1],c=Aw(r,s,l,u);if(c.squaredDistance===0){const h=o+c.along;i.push({coordinates:e,ring:t,startIndex:h,endIndex:h});return}}}const Am={along:0,squaredDistance:0};function Aw(n,e,t,i){const r=t[0],s=t[1],o=i[0],a=i[1],l=o-r,u=a-s;let c=0,h=r,f=s;return(l!==0||u!==0)&&(c=ye(((n-r)*l+(e-s)*u)/(l*l+u*u),0,1),h+=l*c,f+=u*c),Am.along=c,Am.squaredDistance=Js(li(n,e,h,f),10),Am}function Ga(n,e){const t=n.length;let i=Math.floor(e);const r=e-i;i>=t?i-=t:i<0&&(i+=t);let s=i+1;s>=t&&(s-=t);const o=n[i],a=o[0],l=o[1],u=n[s],c=u[0]-a,h=u[1]-l;return[a+c*r,l+h*r]}class jD extends Kn{constructor(e){const t=e;t.stopDown||(t.stopDown=Fr),super(t),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=e.source?e.source:null,this.features_=e.features?e.features:null,this.snapTolerance_=e.snapTolerance?e.snapTolerance:12,this.type_=e.type,this.mode_=WD(this.type_),this.stopClick_=!!e.stopClick,this.minPoints_=e.minPoints?e.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:e.maxPoints?e.maxPoints:1/0,this.finishCondition_=e.finishCondition?e.finishCondition:kn,this.geometryLayout_=e.geometryLayout?e.geometryLayout:"XY";let i=e.geometryFunction;if(!i){const r=this.mode_;if(r==="Circle")i=function(s,o,a){const l=o||new qp([NaN,NaN]),u=Qe(s[0],a),c=Gn(u,Qe(s[s.length-1],a));l.setCenterAndRadius(u,Math.sqrt(c),this.geometryLayout_);const h=Ht();return h&&l.transform(a,h),l};else{let s;r==="Point"?s=st:r==="LineString"?s=lt:r==="Polygon"&&(s=Dt),i=function(o,a,l){return a?r==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new s(o,this.geometryLayout_),a}}}this.geometryFunction_=i,this.dragVertexDelay_=e.dragVertexDelay!==void 0?e.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=e.clickTolerance?e.clickTolerance*e.clickTolerance:36,this.overlay_=new ls({source:new us({useSpatialIndex:!1,wrapX:e.wrapX?e.wrapX:!1}),style:e.style?e.style:XD(),updateWhileInteracting:!0}),this.geometryName_=e.geometryName,this.condition_=e.condition?e.condition:vh,this.freehandCondition_,e.freehand?this.freehandCondition_=oo:this.freehandCondition_=e.freehandCondition?e.freehandCondition:Jl,this.traceCondition_,this.setTrace(e.trace||!1),this.traceState_={active:!1},this.traceSource_=e.traceSource||e.source||null,this.addChangeListener(ql.ACTIVE,this.updateState_)}setTrace(e){let t;e?e===!0?t=oo:t=e:t=yh,this.traceCondition_=t}setMap(e){super.setMap(e),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(e){e.originalEvent.type===K.CONTEXTMENU&&e.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(e);let t=e.type===Ie.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&e.type===Ie.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,t=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&e.type===Ie.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(e.coordinate),i=!1):this.freehand_&&e.type===Ie.POINTERDOWN?i=!1:t&&this.getPointerCount()<2?(i=e.type===Ie.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.originalEvent.preventDefault()):(e.originalEvent.pointerType==="mouse"||e.type===Ie.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(e)):e.type===Ie.DBLCLICK&&(i=!1),super.handleEvent(e)&&i}handleDownEvent(e){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=e.pixel,this.finishCoordinate_||this.startDrawing_(e.coordinate),!0):this.condition_(e)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new gi(Ie.POINTERMOVE,e.map,e.originalEvent,!1,e.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=e.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(e){if(!this.traceSource_||!this.traceCondition_(e))return;if(this.traceState_.active){this.deactivateTrace_();return}const t=this.getMap(),i=t.getCoordinateFromPixel([e.pixel[0]-this.snapTolerance_,e.pixel[1]+this.snapTolerance_]),r=t.getCoordinateFromPixel([e.pixel[0]+this.snapTolerance_,e.pixel[1]-this.snapTolerance_]),s=pt([i,r]),o=this.traceSource_.getFeaturesInExtent(s);if(o.length===0)return;const a=zD(e.coordinate,o);a.length&&(this.traceState_={active:!0,startPx:e.pixel.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(e,t){const i=e.startIndex<=e.endIndex,r=e.startIndex<=t;i===r?i&&t>e.endIndex||!i&&t<e.endIndex?this.addTracedCoordinates_(e,e.endIndex,t):(i&&t<e.endIndex||!i&&t>e.endIndex)&&this.removeTracedCoordinates_(t,e.endIndex):(this.removeTracedCoordinates_(e.startIndex,e.endIndex),this.addTracedCoordinates_(e,e.startIndex,t))}removeTracedCoordinates_(e,t){if(e===t)return;let i=0;if(e<t){const r=Math.ceil(e);let s=Math.floor(t);s===t&&(s-=1),i=s-r+1}else{const r=Math.floor(e);let s=Math.ceil(t);s===t&&(s+=1),i=r-s+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(e,t,i){if(t===i)return;const r=[];if(t<i){const s=Math.ceil(t);let o=Math.floor(i);o===i&&(o-=1);for(let a=s;a<=o;++a)r.push(ka(e.coordinates,a))}else{const s=Math.floor(t);let o=Math.ceil(i);o===i&&(o+=1);for(let a=s;a>=o;--a)r.push(ka(e.coordinates,a))}r.length&&this.appendCoordinates(r)}updateTrace_(e){const t=this.traceState_;if(!t.active||t.targetIndex===-1&&na(t.startPx,e.pixel)<this.snapTolerance_)return;const i=VD(e.coordinate,t,this.getMap(),this.snapTolerance_);if(t.targetIndex!==i.index){if(t.targetIndex!==-1){const l=t.targets[t.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=t.targets[i.index];this.addTracedCoordinates_(a,a.startIndex,i.endIndex)}else{const a=t.targets[t.targetIndex];this.addOrRemoveTracedCoordinates_(a,i.endIndex)}t.targetIndex=i.index;const r=t.targets[t.targetIndex];r.endIndex=i.endIndex;const s=Ga(r.coordinates,r.endIndex),o=this.getMap().getPixelFromCoordinate(s);e.coordinate=s,e.pixel=[Math.round(o[0]),Math.round(o[1])]}handleUpEvent(e){let t=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(e);const i=this.traceState_.active;if(this.toggleTraceState_(e),this.shouldHandle_){const r=!this.finishCoordinate_;r&&this.startDrawing_(e.coordinate),!r&&this.freehand_?this.finishDrawing():!this.freehand_&&(!r||this.mode_==="Point")&&(this.atFinish_(e.pixel,i)?this.finishCondition_(e)&&this.finishDrawing():this.addToDrawing_(e.coordinate)),t=!1}else this.freehand_&&this.abortDrawing()}return!t&&this.stopClick_&&e.preventDefault(),t}handlePointerMove_(e){if(this.pointerType_=e.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const t=this.downPx_,i=e.pixel,r=t[0]-i[0],s=t[1]-i[1],o=r*r+s*s;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(e.coordinate.slice());return}this.updateTrace_(e),this.modifyDrawing_(e.coordinate)}atFinish_(e,t){let i=!1;if(this.sketchFeature_){let r=!1,s=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")i=!0;else if(o==="Circle")i=this.sketchCoords_.length===2;else if(o==="LineString")r=!t&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;r=a[0].length>this.minPoints_,s=[a[0][0],a[0][a[0].length-2]],t?s=[a[0][0]]:s=[a[0][0],a[0][a[0].length-2]]}if(r){const a=this.getMap();for(let l=0,u=s.length;l<u;l++){const c=s[l],h=a.getPixelFromCoordinate(c),f=e[0]-h[0],d=e[1]-h[1],g=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(f*f+d*d)<=g,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(e){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(e):(this.sketchPoint_=new Ne(new st(e)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(e){this.sketchLine_||(this.sketchLine_=new Ne);const t=e.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(t.getLayout(),t.getFlatCoordinates()),i.changed()):(i=new lt(t.getFlatCoordinates(),t.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(e){const t=this.getMap().getView().getProjection(),i=ra(this.geometryLayout_);for(;e.length<i;)e.push(0);this.finishCoordinate_=e,this.mode_==="Point"?this.sketchCoords_=e.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[e.slice(),e.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[e.slice(),e.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Ne(new lt(this.sketchLineCoords_)));const r=this.geometryFunction_(this.sketchCoords_,void 0,t);this.sketchFeature_=new Ne,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(r),this.updateSketchFeatures_(),this.dispatchEvent(new Ru(hf.DRAWSTART,this.sketchFeature_))}modifyDrawing_(e){const t=this.getMap(),i=this.sketchFeature_.getGeometry(),r=t.getView().getProjection(),s=ra(this.geometryLayout_);let o,a;for(;e.length<s;)e.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(t.getPixelFromCoordinate(e))&&(e=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=e[0],a[1]=e[1],this.geometryFunction_(this.sketchCoords_,i,r),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(e),i.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(i):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(e){const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let r,s;const o=this.mode_;o==="LineString"||o==="Circle"?(this.finishCoordinate_=e.slice(),s=this.sketchCoords_,s.length>=this.maxPoints_&&(this.freehand_?s.pop():r=!0),s.push(e.slice()),this.geometryFunction_(s,t,i)):o==="Polygon"&&(s=this.sketchCoords_[0],s.length>=this.maxPoints_&&(this.freehand_?s.pop():r=!0),s.push(e.slice()),r&&(this.finishCoordinate_=s[0]),this.geometryFunction_(this.sketchCoords_,t,i)),this.createOrUpdateSketchPoint_(e.slice()),this.updateSketchFeatures_(),r&&this.finishDrawing()}removeLastPoints_(e){if(!this.sketchFeature_)return;const t=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),r=this.mode_;for(let s=0;s<e;++s){let o;if(r==="LineString"||r==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,t,i),t.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(t)}else if(r==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,t,i)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const e=this.abortDrawing_();if(!e)return;let t=this.sketchCoords_;const i=e.getGeometry(),r=this.getMap().getView().getProjection();this.mode_==="LineString"?(t.pop(),this.geometryFunction_(t,i,r)):this.mode_==="Polygon"&&(t[0].pop(),this.geometryFunction_(t,i,r),t=i.getCoordinates()),this.type_==="MultiPoint"?e.setGeometry(new qn([t])):this.type_==="MultiLineString"?e.setGeometry(new gn([t])):this.type_==="MultiPolygon"&&e.setGeometry(new Bn([t])),this.dispatchEvent(new Ru(hf.DRAWEND,e)),this.features_&&this.features_.push(e),this.source_&&this.source_.addFeature(e)}abortDrawing_(){this.finishCoordinate_=null;const e=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),e}abortDrawing(){const e=this.abortDrawing_();e&&this.dispatchEvent(new Ru(hf.DRAWABORT,e))}appendCoordinates(e){const t=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(e[0]);let r;if(t==="LineString"||t==="Circle")r=this.sketchCoords_;else if(t==="Polygon")r=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&r.shift(),r.pop();for(let o=0;o<e.length;o++)this.addToDrawing_(e[o]);const s=e[e.length-1];this.addToDrawing_(s),this.modifyDrawing_(s)}extend(e){const i=e.getGeometry();this.sketchFeature_=e,this.sketchCoords_=i.getCoordinates();const r=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=r.slice(),this.sketchCoords_.push(r.slice()),this.sketchPoint_=new Ne(new st(r)),this.updateSketchFeatures_(),this.dispatchEvent(new Ru(hf.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const e=[];this.sketchFeature_&&e.push(this.sketchFeature_),this.sketchLine_&&e.push(this.sketchLine_),this.sketchPoint_&&e.push(this.sketchPoint_);const t=this.overlay_.getSource();t.clear(!0),t.addFeatures(e)}updateState_(){const e=this.getMap(),t=this.getActive();(!e||!t)&&this.abortDrawing(),this.overlay_.setMap(t?e:null)}}function XD(){const n=wa();return function(e,t){return n[e.getGeometry().getType()]}}function YD(n,e){return function(t,i,r){const s=Qe(t[0],r),o=Qe(t[t.length-1],r),a=Math.sqrt(Gn(s,o));i=i||Gl(new qp(s),n);let l=e;if(!e&&e!==0){const c=o[0]-s[0],h=o[1]-s[1];l=Math.atan2(h,c)}$g(i,s,a,l);const u=Ht();return u&&i.transform(r,u),i}}function ZD(){return function(n,e,t){const i=pt([n[0],n[n.length-1]].map(function(o){return Qe(o,t)})),r=[[js(i),Xs(i),Qo(i),Xn(i),js(i)]];e?e.setCoordinates(r):e=new Dt(r);const s=Ht();return s&&e.transform(t,s),e}}function WD(n){switch(n){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+n)}}var HD=jD;const KD={EXTENTCHANGED:"extentchanged"};class Lw extends Ct{constructor(e){super(KD.EXTENTCHANGED),this.extent=e}}class qD extends Kn{constructor(e){e=e||{},super(e),this.on,this.once,this.un,this.condition_=e.condition?e.condition:oo,this.extent_=null,this.pointerHandler_=null,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.extentFeature_=null,this.vertexFeature_=null,e||(e={}),this.extentOverlay_=new ls({source:new us({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.boxStyle?e.boxStyle:JD(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.vertexOverlay_=new ls({source:new us({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.pointerStyle?e.pointerStyle:QD(),updateWhileAnimating:!0,updateWhileInteracting:!0}),e.extent&&this.setExtent(e.extent)}snapToVertex_(e,t){const i=t.getCoordinateFromPixelInternal(e),r=function(o,a){return jc(i,o)-jc(i,a)},s=this.getExtentInternal();if(s){const o=eN(s);o.sort(r);const a=o[0];let l=Pl(i,a);const u=t.getPixelFromCoordinateInternal(l);if(na(e,u)<=this.pixelTolerance_){const c=t.getPixelFromCoordinateInternal(a[0]),h=t.getPixelFromCoordinateInternal(a[1]),f=Gn(u,c),d=Gn(u,h),g=Math.sqrt(Math.min(f,d));return this.snappedToVertex_=g<=this.pixelTolerance_,this.snappedToVertex_&&(l=f>d?a[1]:a[0]),l}}return null}handlePointerMove_(e){const t=e.pixel,i=e.map;let r=this.snapToVertex_(t,i);r||(r=i.getCoordinateFromPixelInternal(t)),this.createOrUpdatePointerFeature_(r)}createOrUpdateExtentFeature_(e){let t=this.extentFeature_;return t?e?t.setGeometry(eo(e)):t.setGeometry(void 0):(e?t=new Ne(eo(e)):t=new Ne({}),this.extentFeature_=t,this.extentOverlay_.getSource().addFeature(t)),t}createOrUpdatePointerFeature_(e){let t=this.vertexFeature_;return t?t.getGeometry().setCoordinates(e):(t=new Ne(new st(e)),this.vertexFeature_=t,this.vertexOverlay_.getSource().addFeature(t)),t}handleEvent(e){return!e.originalEvent||!this.condition_(e)?!0:(e.type==Ie.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),super.handleEvent(e),!1)}handleDownEvent(e){const t=e.pixel,i=e.map,r=this.getExtentInternal();let s=this.snapToVertex_(t,i);const o=function(a){let l=null,u=null;return a[0]==r[0]?l=r[2]:a[0]==r[2]&&(l=r[0]),a[1]==r[1]?u=r[3]:a[1]==r[3]&&(u=r[1]),l!==null&&u!==null?[l,u]:null};if(s&&r){const a=s[0]==r[0]||s[0]==r[2]?s[0]:null,l=s[1]==r[1]||s[1]==r[3]?s[1]:null;a!==null&&l!==null?this.pointerHandler_=Pw(o(s)):a!==null?this.pointerHandler_=Mw(o([a,r[1]]),o([a,r[3]])):l!==null&&(this.pointerHandler_=Mw(o([r[0],l]),o([r[2],l])))}else s=i.getCoordinateFromPixelInternal(t),this.setExtent([s[0],s[1],s[0],s[1]]),this.pointerHandler_=Pw(s);return!0}handleDragEvent(e){if(this.pointerHandler_){const t=e.coordinate;this.setExtent(this.pointerHandler_(t)),this.createOrUpdatePointerFeature_(t)}}handleUpEvent(e){this.pointerHandler_=null;const t=this.getExtentInternal();return(!t||Jo(t)===0)&&this.setExtent(null),!1}setMap(e){this.extentOverlay_.setMap(e),this.vertexOverlay_.setMap(e),super.setMap(e)}getExtent(){return Zr(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.extent_}setExtent(e){this.extent_=e||null,this.createOrUpdateExtentFeature_(e),this.dispatchEvent(new Lw(this.extent_))}}function JD(){const n=wa();return function(e,t){return n.Polygon}}function QD(){const n=wa();return function(e,t){return n.Point}}function Pw(n){return function(e){return pt([n,e])}}function Mw(n,e){return n[0]==e[0]?function(t){return pt([n,[t[0],e[1]]])}:n[1]==e[1]?function(t){return pt([n,[e[0],t[1]]])}:null}function eN(n){return[[[n[0],n[1]],[n[0],n[3]]],[[n[0],n[3]],[n[2],n[3]]],[[n[2],n[3]],[n[2],n[1]]],[[n[2],n[1]],[n[0],n[1]]]]}var tN=qD;function nN(n){return Js(n,5)}function Cu(n){return parseFloat(n)}function Iu(n){return nN(n).toString()}function pf(n,e){return isNaN(n)?!1:n!==Cu(Iu(e))}function iN(n,e){return pf(n[0],e[0])||pf(n[1],e[1])}class rN extends ar{constructor(e){super(),e=Object.assign({animate:!0,replace:!1,prefix:""},e||{});let t;e.animate===!0?t={duration:250}:e.animate?t=e.animate:t=null,this.animationOptions_=t,this.replace_=e.replace,this.prefix_=e.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this)}getParamName_(e){return this.prefix_?this.prefix_+e:e}get_(e,t){return e.get(this.getParamName_(t))}set_(e,t,i){e.set(this.getParamName_(t),i)}delete_(e,t){e.delete(this.getParamName_(t))}setMap(e){const t=this.getMap();super.setMap(e),e!==t&&(t&&this.unregisterListeners_(t),e&&(this.initial_=!0,this.updateState_(),this.registerListeners_(e)))}registerListeners_(e){this.listenerKeys_.push(re(e,Hn.MOVEEND,this.updateUrl_,this),re(e.getLayerGroup(),K.CHANGE,this.updateUrl_,this),re(e,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(e){for(let r=0,s=this.listenerKeys_.length;r<s;++r)Pe(this.listenerKeys_[r]);this.listenerKeys_.length=0,this.replace_||removeEventListener("popstate",this.updateState_);const t=new URL(window.location.href),i=t.searchParams;this.delete_(i,"x"),this.delete_(i,"y"),this.delete_(i,"z"),this.delete_(i,"r"),this.delete_(i,"l"),window.history.replaceState(null,"",t)}handleChangeLayerGroup_(){const e=this.getMap();!e||(this.unregisterListeners_(e),this.registerListeners_(e),this.initial_=!0,this.updateUrl_())}updateState_(){const e=this.getMap();if(!e)return;const t=e.getView();if(!t)return;const r=new URL(window.location.href).searchParams;let s=!1;const o={},a=Cu(this.get_(r,"z"));pf(a,t.getZoom())&&(s=!0,o.zoom=a);const l=Cu(this.get_(r,"r"));pf(l,t.getRotation())&&(s=!0,o.rotation=l);const u=[Cu(this.get_(r,"x")),Cu(this.get_(r,"y"))];iN(u,t.getCenter())&&(s=!0,o.center=u),s&&(!this.initial_&&this.animationOptions_?t.animate(Object.assign(o,this.animationOptions_)):(o.center&&t.setCenter(o.center),"zoom"in o&&t.setZoom(o.zoom),"rotation"in o&&t.setRotation(o.rotation)));const c=e.getAllLayers(),h=this.get_(r,"l");if(h&&h.length===c.length)for(let f=0,d=c.length;f<d;++f){const g=parseInt(h[f]);if(!isNaN(g)){const m=Boolean(g),p=c[f];p.getVisible()!==m&&p.setVisible(m)}}}updateUrl_(){const e=this.getMap();if(!e)return;const t=e.getView();if(!t)return;const i=this.initial_;this.initial_=!1;const r=t.getCenter(),s=t.getZoom(),o=t.getRotation(),a=e.getAllLayers(),l=new Array(a.length);for(let h=0,f=a.length;h<f;++h)l[h]=a[h].getVisible()?"1":"0";const u=new URL(window.location.href),c=u.searchParams;this.set_(c,"x",Iu(r[0])),this.set_(c,"y",Iu(r[1])),this.set_(c,"z",Iu(s)),this.set_(c,"r",Iu(o)),this.set_(c,"l",l.join("")),u.href!==window.location.href&&(i||this.replace_?window.history.replaceState(null,"",u):window.history.pushState(null,"",u))}}var sN=rN;const Fw=0,Au=1,Ow=[0,0,0,0],Ua=[],Lm={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class mf extends Ct{constructor(e,t,i){super(e),this.features=t,this.mapBrowserEvent=i}}class oN extends Kn{constructor(e){super(e),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=e.condition?e.condition:cp,this.defaultDeleteCondition_=function(i){return Tx(i)&&lp(i)},this.deleteCondition_=e.deleteCondition?e.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:oo,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new bu,this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new ls({source:new us({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:lN(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let t;if(e.features?t=e.features:e.source&&(this.source_=e.source,t=new St(this.source_.getFeatures()),this.source_.addEventListener(ct.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(ct.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!t)throw new Error("The modify interaction requires features, a source or a layer");e.hitDetection&&(this.hitDetection_=e.hitDetection),this.features_=t,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(gt.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(gt.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=e.snapToPointer===void 0?!this.hitDetection_:e.snapToPointer}addFeature_(e){const t=e.getGeometry();if(t){const r=this.SEGMENT_WRITERS_[t.getType()];r&&r(e,t)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),e.addEventListener(K.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(e,t){if(!this.featuresBeingModified_){this.featuresBeingModified_=new St;const i=this.featuresBeingModified_.getArray();for(let r=0,s=t.length;r<s;++r){const o=t[r];for(let a=0,l=o.length;a<l;++a){const u=o[a].feature;u&&!i.includes(u)&&this.featuresBeingModified_.push(u)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new mf(Lm.MODIFYSTART,this.featuresBeingModified_,e))}}removeFeature_(e){this.removeFeatureSegmentData_(e),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.removeEventListener(K.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(e){const t=this.rBush_,i=[];t.forEach(function(r){e===r.feature&&i.push(r)});for(let r=i.length-1;r>=0;--r){const s=i[r];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===s&&this.dragSegments_.splice(o,1);t.remove(s)}}setActive(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(e)}setMap(e){this.overlay_.setMap(e),super.setMap(e)}getOverlay(){return this.overlay_}handleSourceAdd_(e){e.feature&&this.features_.push(e.feature)}handleSourceRemove_(e){e.feature&&this.features_.remove(e.feature)}handleFeatureAdd_(e){this.addFeature_(e.element)}handleFeatureChange_(e){if(!this.changingFeature_){const t=e.target;this.removeFeature_(t),this.addFeature_(t)}}handleFeatureRemove_(e){this.removeFeature_(e.element)}writePointGeometry_(e,t){const i=t.getCoordinates(),r={feature:e,geometry:t,segment:[i,i]};this.rBush_.insert(t.getExtent(),r)}writeMultiPointGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r],a={feature:e,geometry:t,depth:[r],index:r,segment:[o,o]};this.rBush_.insert(t.getExtent(),a)}}writeLineStringGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length-1;r<s;++r){const o=i.slice(r,r+2),a={feature:e,geometry:t,index:r,segment:o};this.rBush_.insert(pt(o),a)}}writeMultiLineStringGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length-1;a<l;++a){const u=o.slice(a,a+2),c={feature:e,geometry:t,depth:[r],index:a,segment:u};this.rBush_.insert(pt(u),c)}}}writePolygonGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length-1;a<l;++a){const u=o.slice(a,a+2),c={feature:e,geometry:t,depth:[r],index:a,segment:u};this.rBush_.insert(pt(u),c)}}}writeMultiPolygonGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length;a<l;++a){const u=o[a];for(let c=0,h=u.length-1;c<h;++c){const f=u.slice(c,c+2),d={feature:e,geometry:t,depth:[a,r],index:c,segment:f};this.rBush_.insert(pt(f),d)}}}}writeCircleGeometry_(e,t){const i=t.getCenter(),r={feature:e,geometry:t,index:Fw,segment:[i,i]},s={feature:e,geometry:t,index:Au,segment:[i,i]},o=[r,s];r.featureSegments=o,s.featureSegments=o,this.rBush_.insert(zs(i),r);let a=t;const l=Ht();if(l&&this.getMap()){const u=this.getMap().getView().getProjection();a=a.clone().transform(l,u),a=Gl(a).transform(u,l)}this.rBush_.insert(a.getExtent(),s)}writeGeometryCollectionGeometry_(e,t){const i=t.getGeometriesArray();for(let r=0;r<i.length;++r){const s=i[r];this.SEGMENT_WRITERS_[s.getType()](e,s)}}createOrUpdateVertexFeature_(e,t,i){let r=this.vertexFeature_;return r?r.getGeometry().setCoordinates(e):(r=new Ne(new st(e)),this.vertexFeature_=r,this.overlay_.getSource().addFeature(r)),r.set("features",t),r.set("geometries",i),r}handleEvent(e){if(!e.originalEvent)return!0;this.lastPointerEvent_=e;let t;return!e.map.getView().getInteracting()&&e.type==Ie.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(e),this.vertexFeature_&&this.deleteCondition_(e)&&(e.type!=Ie.SINGLECLICK||!this.ignoreNextSingleClick_?t=this.removePoint():t=!0),e.type==Ie.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(e)&&!t}handleDragEvent(e){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(e,this.dragSegments_);const t=[e.coordinate[0]+this.delta_[0],e.coordinate[1]+this.delta_[1]],i=[],r=[];for(let s=0,o=this.dragSegments_.length;s<o;++s){const a=this.dragSegments_[s],l=a[0],u=l.feature;i.includes(u)||i.push(u);const c=l.geometry;r.includes(c)||r.push(c);const h=l.depth;let f;const d=l.segment,g=a[1];for(;t.length<c.getStride();)t.push(d[g][t.length]);switch(c.getType()){case"Point":f=t,d[0]=t,d[1]=t;break;case"MultiPoint":f=c.getCoordinates(),f[l.index]=t,d[0]=t,d[1]=t;break;case"LineString":f=c.getCoordinates(),f[l.index+g]=t,d[g]=t;break;case"MultiLineString":f=c.getCoordinates(),f[h[0]][l.index+g]=t,d[g]=t;break;case"Polygon":f=c.getCoordinates(),f[h[0]][l.index+g]=t,d[g]=t;break;case"MultiPolygon":f=c.getCoordinates(),f[h[1]][h[0]][l.index+g]=t,d[g]=t;break;case"Circle":if(d[0]=t,d[1]=t,l.index===Fw)this.changingFeature_=!0,c.setCenter(t),this.changingFeature_=!1;else{this.changingFeature_=!0;const m=e.map.getView().getProjection();let p=na(Qe(c.getCenter(),m),Qe(t,m));const _=Ht();if(_){const v=c.clone().transform(_,m);v.setRadius(p),p=v.transform(m,_).getRadius()}c.setRadius(p),this.changingFeature_=!1}break}f&&this.setGeometryCoordinates_(c,f)}this.createOrUpdateVertexFeature_(t,i,r)}handleDownEvent(e){if(!this.condition_(e))return!1;const t=e.coordinate;this.handlePointerAtPixel_(e.pixel,e.map,t),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){const r=e.map.getView().getProjection(),s=[],o=i.getGeometry().getCoordinates(),a=pt([o]),l=this.rBush_.getInExtent(a),u={};l.sort(aN);for(let c=0,h=l.length;c<h;++c){const f=l[c],d=f.segment;let g=H(f.geometry);const m=f.depth;if(m&&(g+="-"+m.join("-")),u[g]||(u[g]=new Array(2)),f.geometry.getType()==="Circle"&&f.index===Au){const p=Dw(t,f,r);Wn(p,o)&&!u[g][0]&&(this.dragSegments_.push([f,0]),u[g][0]=f);continue}if(Wn(d[0],o)&&!u[g][0]){this.dragSegments_.push([f,0]),u[g][0]=f;continue}if(Wn(d[1],o)&&!u[g][1]){if(u[g][0]&&u[g][0].index===0){let p=f.geometry.getCoordinates();switch(f.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":p=p[m[1]];case"Polygon":if(f.index!==p[m[0]].length-2)continue;break}}this.dragSegments_.push([f,1]),u[g][1]=f;continue}H(d)in this.vertexSegments_&&!u[g][0]&&!u[g][1]&&this.insertVertexCondition_(e)&&s.push(f)}s.length&&this.willModifyFeatures_(e,[s]);for(let c=s.length-1;c>=0;--c)this.insertVertex_(s[c],o)}return!!this.vertexFeature_}handleUpEvent(e){for(let t=this.dragSegments_.length-1;t>=0;--t){const i=this.dragSegments_[t][0],r=i.geometry;if(r.getType()==="Circle"){const s=r.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=s,o.segment[1]=s,a.segment[0]=s,a.segment[1]=s,this.rBush_.update(zs(s),o);let l=r;const u=Ht();if(u){const c=e.map.getView().getProjection();l=l.clone().transform(u,c),l=Gl(l).transform(c,u)}this.rBush_.update(l.getExtent(),a)}else this.rBush_.update(pt(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new mf(Lm.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null),!1}handlePointerMove_(e){this.lastPixel_=e.pixel,this.handlePointerAtPixel_(e.pixel,e.map,e.coordinate)}handlePointerAtPixel_(e,t,i){const r=i||t.getCoordinateFromPixel(e),s=t.getView().getProjection(),o=function(u,c){return $w(r,u,s)-$w(r,c,s)};let a,l;if(this.hitDetection_){const u=typeof this.hitDetection_=="object"?c=>c===this.hitDetection_:void 0;t.forEachFeatureAtPixel(e,(c,h,f)=>{if(f=f||c.getGeometry(),f.getType()==="Point"&&this.features_.getArray().includes(c)){l=f;const d=f.getFlatCoordinates().slice(0,2);a=[{feature:c,geometry:f,segment:[d,d]}]}return!0},{layerFilter:u})}if(!a){const u=An(zs(r,Ow),s),c=t.getView().getResolution()*this.pixelTolerance_,h=Zr(hn(u,c,Ow),s);a=this.rBush_.getInExtent(h)}if(a&&a.length>0){const u=a.sort(o)[0],c=u.segment;let h=Dw(r,u,s);const f=t.getPixelFromCoordinate(h);let d=na(e,f);if(l||d<=this.pixelTolerance_){const g={};if(g[H(c)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-r[0],this.delta_[1]=h[1]-r[1]),u.geometry.getType()==="Circle"&&u.index===Au)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[u.feature],[u.geometry]);else{const m=t.getPixelFromCoordinate(c[0]),p=t.getPixelFromCoordinate(c[1]),_=Gn(f,m),v=Gn(f,p);d=Math.sqrt(Math.min(_,v)),this.snappedToVertex_=d<=this.pixelTolerance_,this.snappedToVertex_&&(h=_>v?c[1]:c[0]),this.createOrUpdateVertexFeature_(h,[u.feature],[u.geometry]);const x={};x[H(u.geometry)]=!0;for(let y=1,T=a.length;y<T;++y){const w=a[y].segment;if(Wn(c[0],w[0])&&Wn(c[1],w[1])||Wn(c[0],w[1])&&Wn(c[1],w[0])){const E=H(a[y].geometry);E in x||(x[E]=!0,g[H(w)]=!0)}else break}}this.vertexSegments_=g;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(e,t){const i=e.segment,r=e.feature,s=e.geometry,o=e.depth,a=e.index;let l;for(;t.length<s.getStride();)t.push(0);switch(s.getType()){case"MultiLineString":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"Polygon":l=s.getCoordinates(),l[o[0]].splice(a+1,0,t);break;case"MultiPolygon":l=s.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,t);break;case"LineString":l=s.getCoordinates(),l.splice(a+1,0,t);break;default:return}this.setGeometryCoordinates_(s,l);const u=this.rBush_;u.remove(e),this.updateSegmentIndices_(s,a,o,1);const c={segment:[i[0],t],feature:r,geometry:s,depth:o,index:a};u.insert(pt(c.segment),c),this.dragSegments_.push([c,1]);const h={segment:[t,i[1]],feature:r,geometry:s,depth:o,index:a+1};u.insert(pt(h.segment),h),this.dragSegments_.push([h,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Ie.POINTERDRAG){const e=this.lastPointerEvent_;this.willModifyFeatures_(e,this.dragSegments_);const t=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new mf(Lm.MODIFYEND,this.featuresBeingModified_,e)),this.featuresBeingModified_=null,t}return!1}removeVertex_(){const e=this.dragSegments_,t={};let i=!1,r,s,o,a,l,u,c,h,f,d,g;for(l=e.length-1;l>=0;--l)o=e[l],d=o[0],g=H(d.feature),d.depth&&(g+="-"+d.depth.join("-")),g in t||(t[g]={}),o[1]===0?(t[g].right=d,t[g].index=d.index):o[1]==1&&(t[g].left=d,t[g].index=d.index+1);for(g in t){switch(f=t[g].right,c=t[g].left,u=t[g].index,h=u-1,c!==void 0?d=c:d=f,h<0&&(h=0),a=d.geometry,s=a.getCoordinates(),r=s,i=!1,a.getType()){case"MultiLineString":s[d.depth[0]].length>2&&(s[d.depth[0]].splice(u,1),i=!0);break;case"LineString":s.length>2&&(s.splice(u,1),i=!0);break;case"MultiPolygon":r=r[d.depth[1]];case"Polygon":r=r[d.depth[0]],r.length>4&&(u==r.length-1&&(u=0),r.splice(u,1),i=!0,u===0&&(r.pop(),r.push(r[0]),h=r.length-1));break}if(i){this.setGeometryCoordinates_(a,s);const m=[];if(c!==void 0&&(this.rBush_.remove(c),m.push(c.segment[0])),f!==void 0&&(this.rBush_.remove(f),m.push(f.segment[1])),c!==void 0&&f!==void 0){const p={depth:d.depth,feature:d.feature,geometry:d.geometry,index:h,segment:m};this.rBush_.insert(pt(p.segment),p)}this.updateSegmentIndices_(a,u,d.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),e.length=0}}return i}setGeometryCoordinates_(e,t){this.changingFeature_=!0,e.setCoordinates(t),this.changingFeature_=!1}updateSegmentIndices_(e,t,i,r){this.rBush_.forEachInExtent(e.getExtent(),function(s){s.geometry===e&&(i===void 0||s.depth===void 0||Ai(s.depth,i))&&s.index>t&&(s.index+=r)})}}function aN(n,e){return n.index-e.index}function $w(n,e,t){const i=e.geometry;if(i.getType()==="Circle"){let s=i;if(e.index===Au){const o=Ht();o&&(s=s.clone().transform(o,t));const a=Gn(s.getCenter(),Qe(n,t)),l=Math.sqrt(a)-s.getRadius();return l*l}}const r=Qe(n,t);return Ua[0]=Qe(e.segment[0],t),Ua[1]=Qe(e.segment[1],t),jc(r,Ua)}function Dw(n,e,t){const i=e.geometry;if(i.getType()==="Circle"&&e.index===Au){let s=i;const o=Ht();return o&&(s=s.clone().transform(o,t)),Yr(s.getClosestPoint(Qe(n,t)),t)}const r=Qe(n,t);return Ua[0]=Qe(e.segment[0],t),Ua[1]=Qe(e.segment[1],t),Yr(Pl(r,Ua),t)}function lN(){const n=wa();return function(e,t){return n.Point}}var uN=oN;const cN={SELECT:"select"};class Nw extends Ct{constructor(e,t,i,r){super(e),this.selected=t,this.deselected=i,this.mapBrowserEvent=r}}const _f={};class dy extends ar{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.boundAddFeature_=this.addFeature_.bind(this),this.boundRemoveFeature_=this.removeFeature_.bind(this),this.condition_=e.condition?e.condition:lp,this.addCondition_=e.addCondition?e.addCondition:yh,this.removeCondition_=e.removeCondition?e.removeCondition:yh,this.toggleCondition_=e.toggleCondition?e.toggleCondition:Jl,this.multi_=e.multi?e.multi:!1,this.filter_=e.filter?e.filter:kn,this.hitTolerance_=e.hitTolerance?e.hitTolerance:0,this.style_=e.style!==void 0?e.style:hN(),this.features_=e.features||new St;let t;if(e.layers)if(typeof e.layers=="function")t=e.layers;else{const i=e.layers;t=function(r){return i.includes(r)}}else t=kn;this.layerFilter_=t,this.featureLayerAssociation_={}}addFeatureLayerAssociation_(e,t){this.featureLayerAssociation_[H(e)]=t}getFeatures(){return this.features_}getHitTolerance(){return this.hitTolerance_}getLayer(e){return this.featureLayerAssociation_[H(e)]}setHitTolerance(e){this.hitTolerance_=e}setMap(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),super.setMap(e),e?(this.features_.addEventListener(gt.ADD,this.boundAddFeature_),this.features_.addEventListener(gt.REMOVE,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(gt.ADD,this.boundAddFeature_),this.features_.removeEventListener(gt.REMOVE,this.boundRemoveFeature_))}addFeature_(e){const t=e.element;if(this.style_&&this.applySelectedStyle_(t),!this.getLayer(t)){const i=this.getMap().getAllLayers().find(function(r){if(r instanceof ls&&r.getSource()&&r.getSource().hasFeature(t))return r});i&&this.addFeatureLayerAssociation_(t,i)}}removeFeature_(e){this.style_&&this.restorePreviousStyle_(e.element)}getStyle(){return this.style_}applySelectedStyle_(e){const t=H(e);t in _f||(_f[t]=e.getStyle()),e.setStyle(this.style_)}restorePreviousStyle_(e){const t=this.getMap().getInteractions().getArray();for(let r=t.length-1;r>=0;--r){const s=t[r];if(s!==this&&s instanceof dy&&s.getStyle()&&s.getFeatures().getArray().lastIndexOf(e)!==-1){e.setStyle(s.getStyle());return}}const i=H(e);e.setStyle(_f[i]),delete _f[i]}removeFeatureLayerAssociation_(e){delete this.featureLayerAssociation_[H(e)]}handleEvent(e){if(!this.condition_(e))return!0;const t=this.addCondition_(e),i=this.removeCondition_(e),r=this.toggleCondition_(e),s=!t&&!i&&!r,o=e.map,a=this.getFeatures(),l=[],u=[];if(s){$r(this.featureLayerAssociation_),o.forEachFeatureAtPixel(e.pixel,function(c,h){if(!(!(c instanceof Ne)||!this.filter_(c,h)))return this.addFeatureLayerAssociation_(c,h),u.push(c),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=a.getLength()-1;c>=0;--c){const h=a.item(c),f=u.indexOf(h);f>-1?u.splice(f,1):(a.remove(h),l.push(h))}u.length!==0&&a.extend(u)}else{o.forEachFeatureAtPixel(e.pixel,function(c,h){if(!(!(c instanceof Ne)||!this.filter_(c,h)))return(t||r)&&!a.getArray().includes(c)?(this.addFeatureLayerAssociation_(c,h),u.push(c)):(i||r)&&a.getArray().includes(c)&&(l.push(c),this.removeFeatureLayerAssociation_(c)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let c=l.length-1;c>=0;--c)a.remove(l[c]);a.extend(u)}return(u.length>0||l.length>0)&&this.dispatchEvent(new Nw(cN.SELECT,u,l,e)),!0}}function hN(){const n=wa();return Oe(n.Polygon,n.LineString),Oe(n.GeometryCollection,n.LineString),function(e){return e.getGeometry()?n[e.getGeometry().getType()]:null}}var fN=dy;function kw(n){if(n.feature)return n.feature;if(n.element)return n.element}const Pm=[];class dN extends Kn{constructor(e){e=e||{};const t=e;t.handleDownEvent||(t.handleDownEvent=kn),t.stopDown||(t.stopDown=Fr),super(t),this.source_=e.source?e.source:null,this.vertex_=e.vertex!==void 0?e.vertex:!0,this.edge_=e.edge!==void 0?e.edge:!0,this.features_=e.features?e.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=e.pixelTolerance!==void 0?e.pixelTolerance:10,this.rBush_=new bu,this.GEOMETRY_SEGMENTERS_={Point:this.segmentPointGeometry_.bind(this),LineString:this.segmentLineStringGeometry_.bind(this),LinearRing:this.segmentLineStringGeometry_.bind(this),Polygon:this.segmentPolygonGeometry_.bind(this),MultiPoint:this.segmentMultiPointGeometry_.bind(this),MultiLineString:this.segmentMultiLineStringGeometry_.bind(this),MultiPolygon:this.segmentMultiPolygonGeometry_.bind(this),GeometryCollection:this.segmentGeometryCollectionGeometry_.bind(this),Circle:this.segmentCircleGeometry_.bind(this)}}addFeature(e,t){t=t!==void 0?t:!0;const i=H(e),r=e.getGeometry();if(r){const s=this.GEOMETRY_SEGMENTERS_[r.getType()];if(s){this.indexedFeaturesExtents_[i]=r.getExtent(Ft());const o=[];if(s(o,r),o.length===1)this.rBush_.insert(pt(o[0]),{feature:e,segment:o[0]});else if(o.length>1){const a=o.map(u=>pt(u)),l=o.map(u=>({feature:e,segment:u}));this.rBush_.load(a,l)}}}t&&(this.featureChangeListenerKeys_[i]=re(e,K.CHANGE,this.handleFeatureChange_,this))}forEachFeatureAdd_(e){this.addFeature(e)}forEachFeatureRemove_(e){this.removeFeature(e)}getFeatures_(){let e;return this.features_?e=this.features_:this.source_&&(e=this.source_.getFeatures()),e}handleEvent(e){const t=this.snapTo(e.pixel,e.coordinate,e.map);return t&&(e.coordinate=t.vertex.slice(0,2),e.pixel=t.vertexPixel),super.handleEvent(e)}handleFeatureAdd_(e){const t=kw(e);this.addFeature(t)}handleFeatureRemove_(e){const t=kw(e);this.removeFeature(t)}handleFeatureChange_(e){const t=e.target;if(this.handlingDownUpSequence){const i=H(t);i in this.pendingFeatures_||(this.pendingFeatures_[i]=t)}else this.updateFeature_(t)}handleUpEvent(e){const t=Object.values(this.pendingFeatures_);return t.length&&(t.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1}removeFeature(e,t){const i=t!==void 0?t:!0,r=H(e),s=this.indexedFeaturesExtents_[r];if(s){const o=this.rBush_,a=[];o.forEachInExtent(s,function(l){e===l.feature&&a.push(l)});for(let l=a.length-1;l>=0;--l)o.remove(a[l])}i&&(Pe(this.featureChangeListenerKeys_[r]),delete this.featureChangeListenerKeys_[r])}setMap(e){const t=this.getMap(),i=this.featuresListenerKeys_,r=this.getFeatures_();t&&(i.forEach(Pe),i.length=0,r.forEach(this.forEachFeatureRemove_.bind(this))),super.setMap(e),e&&(this.features_?i.push(re(this.features_,gt.ADD,this.handleFeatureAdd_,this),re(this.features_,gt.REMOVE,this.handleFeatureRemove_,this)):this.source_&&i.push(re(this.source_,ct.ADDFEATURE,this.handleFeatureAdd_,this),re(this.source_,ct.REMOVEFEATURE,this.handleFeatureRemove_,this)),r.forEach(this.forEachFeatureAdd_.bind(this)))}snapTo(e,t,i){const r=i.getCoordinateFromPixel([e[0]-this.pixelTolerance_,e[1]+this.pixelTolerance_]),s=i.getCoordinateFromPixel([e[0]+this.pixelTolerance_,e[1]-this.pixelTolerance_]),o=pt([r,s]),a=this.rBush_.getInExtent(o),l=a.length;if(l===0)return null;const u=i.getView().getProjection(),c=Qe(t,u);let h,f=1/0;const d=this.pixelTolerance_*this.pixelTolerance_,g=()=>{if(h){const m=i.getPixelFromCoordinate(h);if(Gn(e,m)<=d)return{vertex:h,vertexPixel:[Math.round(m[0]),Math.round(m[1])]}}return null};if(this.vertex_){for(let p=0;p<l;++p){const _=a[p];_.feature.getGeometry().getType()!=="Circle"&&_.segment.forEach(v=>{const x=Qe(v,u),y=Gn(c,x);y<f&&(h=v,f=y)})}const m=g();if(m)return m}if(this.edge_){for(let p=0;p<l;++p){let _=null;const v=a[p];if(v.feature.getGeometry().getType()==="Circle"){let x=v.feature.getGeometry();const y=Ht();y&&(x=x.clone().transform(y,u)),_=Yr(fv(c,x),u)}else{const[x,y]=v.segment;y&&(Pm[0]=Qe(x,u),Pm[1]=Qe(y,u),_=Pl(c,Pm))}if(_){const x=Gn(c,_);x<f&&(h=_,f=x)}}const m=g();if(m)return m}return null}updateFeature_(e){this.removeFeature(e,!1),this.addFeature(e,!1)}segmentCircleGeometry_(e,t){const i=this.getMap().getView().getProjection();let r=t;const s=Ht();s&&(r=r.clone().transform(s,i));const o=Gl(r);s&&o.transform(i,s);const a=o.getCoordinates()[0];for(let l=0,u=a.length-1;l<u;++l)e.push(a.slice(l,l+2))}segmentGeometryCollectionGeometry_(e,t){const i=t.getGeometriesArray();for(let r=0;r<i.length;++r){const s=this.GEOMETRY_SEGMENTERS_[i[r].getType()];s&&s(e,i[r])}}segmentLineStringGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length-1;r<s;++r)e.push(i.slice(r,r+2))}segmentMultiLineStringGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length-1;a<l;++a)e.push(o.slice(a,a+2))}}segmentMultiPointGeometry_(e,t){t.getCoordinates().forEach(i=>{e.push([i])})}segmentMultiPolygonGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length;a<l;++a){const u=o[a];for(let c=0,h=u.length-1;c<h;++c)e.push(u.slice(c,c+2))}}}segmentPointGeometry_(e,t){e.push([t.getCoordinates()])}segmentPolygonGeometry_(e,t){const i=t.getCoordinates();for(let r=0,s=i.length;r<s;++r){const o=i[r];for(let a=0,l=o.length-1;a<l;++a)e.push(o.slice(a,a+2))}}}var gN=dN;const Mm={TRANSLATESTART:"translatestart",TRANSLATING:"translating",TRANSLATEEND:"translateend"};class yf extends Ct{constructor(e,t,i,r,s){super(e),this.features=t,this.coordinate=i,this.startCoordinate=r,this.mapBrowserEvent=s}}class pN extends Kn{constructor(e){e=e||{},super(e),this.on,this.once,this.un,this.lastCoordinate_=null,this.startCoordinate_=null,this.features_=e.features!==void 0?e.features:null;let t;if(e.layers&&!this.features_)if(typeof e.layers=="function")t=e.layers;else{const i=e.layers;t=function(r){return i.includes(r)}}else t=kn;this.layerFilter_=t,this.filter_=e.filter&&!this.features_?e.filter:kn,this.hitTolerance_=e.hitTolerance?e.hitTolerance:0,this.condition_=e.condition?e.condition:oo,this.lastFeature_=null,this.addChangeListener(ql.ACTIVE,this.handleActiveChanged_)}handleDownEvent(e){if(!e.originalEvent||!this.condition_(e))return!1;if(this.lastFeature_=this.featuresAtPixel_(e.pixel,e.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=e.coordinate,this.lastCoordinate_=e.coordinate,this.handleMoveEvent(e);const t=this.features_||new St([this.lastFeature_]);return this.dispatchEvent(new yf(Mm.TRANSLATESTART,t,e.coordinate,this.startCoordinate_,e)),!0}return!1}handleUpEvent(e){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(e);const t=this.features_||new St([this.lastFeature_]);return this.dispatchEvent(new yf(Mm.TRANSLATEEND,t,e.coordinate,this.startCoordinate_,e)),this.startCoordinate_=null,!0}return!1}handleDragEvent(e){if(this.lastCoordinate_){const t=e.coordinate,i=t[0]-this.lastCoordinate_[0],r=t[1]-this.lastCoordinate_[1],s=this.features_||new St([this.lastFeature_]);s.forEach(function(o){const a=o.getGeometry();a.translate(i,r),o.setGeometry(a)}),this.lastCoordinate_=t,this.dispatchEvent(new yf(Mm.TRANSLATING,s,t,this.startCoordinate_,e))}}handleMoveEvent(e){const t=e.map.getViewport();this.featuresAtPixel_(e.pixel,e.map)?(t.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),t.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):t.classList.remove("ol-grab","ol-grabbing")}featuresAtPixel_(e,t){return t.forEachFeatureAtPixel(e,function(i,r){if(this.filter_(i,r)&&(!this.features_||this.features_.getArray().includes(i)))return i}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(e){this.hitTolerance_=e}setMap(e){const t=this.getMap();super.setMap(e),this.updateState_(t)}handleActiveChanged_(){this.updateState_(null)}updateState_(e){let t=this.getMap();const i=this.getActive();(!t||!i)&&(t=t||e,t&&t.getViewport().classList.remove("ol-grab","ol-grabbing"))}}var mN=pN;class _N extends io{constructor(e){e=e||{},super(e)}}var Gw=_N,mr={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class yN extends io{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.setPreload(e.preload!==void 0?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0)}getPreload(){return this.get(mr.PRELOAD)}setPreload(e){this.set(mr.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(mr.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(mr.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}}var Fm=yN;const _r=34962,cs=34963,Uw=35040,vf=35044,vi=35048,Bw=5121,zw=5123,Vw=5125,Om=5126,jw=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function xf(n,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!By},e);const t=jw.length;for(let i=0;i<t;++i)try{const r=n.getContext(jw[i],e);if(r)return r}catch{}return null}let $m;function vN(){if(!$m){const n=document.createElement("canvas"),e=xf(n);e&&($m=e.getSupportedExtensions())}return $m}const Xw={STATIC_DRAW:vf,STREAM_DRAW:Uw,DYNAMIC_DRAW:vi};class xN{constructor(e,t){this.array=null,this.type=e,ne(e===_r||e===cs,62),this.usage=t!==void 0?t:Xw.STATIC_DRAW}ofSize(e){this.array=new(Ef(this.type))(e)}fromArray(e){this.array=Ef(this.type).from(e)}fromArrayBuffer(e){this.array=new(Ef(this.type))(e)}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}}function Ef(n){switch(n){case _r:return Float32Array;case cs:return Uint32Array;default:return Float32Array}}var Qn=xN,Lu={LOST:"webglcontextlost",RESTORED:"webglcontextrestored"};const EN=`
|
11
|
-
precision mediump float;
|
12
|
-
|
13
|
-
attribute vec2 a_position;
|
14
|
-
varying vec2 v_texCoord;
|
15
|
-
varying vec2 v_screenCoord;
|
16
|
-
|
17
|
-
uniform vec2 u_screenSize;
|
18
|
-
|
19
|
-
void main() {
|
20
|
-
v_texCoord = a_position * 0.5 + 0.5;
|
21
|
-
v_screenCoord = v_texCoord * u_screenSize;
|
22
|
-
gl_Position = vec4(a_position, 0.0, 1.0);
|
23
|
-
}
|
24
|
-
`,wN=`
|
25
|
-
precision mediump float;
|
26
|
-
|
27
|
-
uniform sampler2D u_image;
|
28
|
-
uniform float u_opacity;
|
29
|
-
|
30
|
-
varying vec2 v_texCoord;
|
31
|
-
|
32
|
-
void main() {
|
33
|
-
gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;
|
34
|
-
}
|
35
|
-
`;class TN{constructor(e){this.gl_=e.webGlContext;const t=this.gl_;this.scaleRatio_=e.scaleRatio||1,this.renderTargetTexture_=t.createTexture(),this.renderTargetTextureSize_=null,this.frameBuffer_=t.createFramebuffer();const i=t.createShader(t.VERTEX_SHADER);t.shaderSource(i,e.vertexShader||EN),t.compileShader(i);const r=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(r,e.fragmentShader||wN),t.compileShader(r),this.renderTargetProgram_=t.createProgram(),t.attachShader(this.renderTargetProgram_,i),t.attachShader(this.renderTargetProgram_,r),t.linkProgram(this.renderTargetProgram_),this.renderTargetVerticesBuffer_=t.createBuffer();const s=[-1,-1,1,-1,-1,1,1,-1,1,1,-1,1];t.bindBuffer(t.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),t.bufferData(t.ARRAY_BUFFER,new Float32Array(s),t.STATIC_DRAW),this.renderTargetAttribLocation_=t.getAttribLocation(this.renderTargetProgram_,"a_position"),this.renderTargetUniformLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_screenSize"),this.renderTargetOpacityLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_opacity"),this.renderTargetTextureLocation_=t.getUniformLocation(this.renderTargetProgram_,"u_image"),this.uniforms_=[],e.uniforms&&Object.keys(e.uniforms).forEach(function(o){this.uniforms_.push({value:e.uniforms[o],location:t.getUniformLocation(this.renderTargetProgram_,o)})}.bind(this))}getGL(){return this.gl_}init(e){const t=this.getGL(),i=[t.drawingBufferWidth*this.scaleRatio_,t.drawingBufferHeight*this.scaleRatio_];if(t.bindFramebuffer(t.FRAMEBUFFER,this.getFrameBuffer()),t.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const r=0,s=t.RGBA,o=0,a=t.RGBA,l=t.UNSIGNED_BYTE,u=null;t.bindTexture(t.TEXTURE_2D,this.renderTargetTexture_),t.texImage2D(t.TEXTURE_2D,r,s,i[0],i[1],o,a,l,u),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.renderTargetTexture_,0)}}apply(e,t,i,r){const s=this.getGL(),o=e.size;if(s.bindFramebuffer(s.FRAMEBUFFER,t?t.getFrameBuffer():null),s.activeTexture(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,this.renderTargetTexture_),!t){const l=H(s.canvas);if(!e.renderTargets[l]){const u=s.getContextAttributes();u&&u.preserveDrawingBuffer&&(s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT)),e.renderTargets[l]=!0}}s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),s.viewport(0,0,s.drawingBufferWidth,s.drawingBufferHeight),s.bindBuffer(s.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),s.useProgram(this.renderTargetProgram_),s.enableVertexAttribArray(this.renderTargetAttribLocation_),s.vertexAttribPointer(this.renderTargetAttribLocation_,2,s.FLOAT,!1,0,0),s.uniform2f(this.renderTargetUniformLocation_,o[0],o[1]),s.uniform1i(this.renderTargetTextureLocation_,0);const a=e.layerStatesArray[e.layerIndex].opacity;s.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(e),i&&i(s,e),s.drawArrays(s.TRIANGLES,0,6),r&&r(s,e)}getFrameBuffer(){return this.frameBuffer_}applyUniforms(e){const t=this.getGL();let i,r=1;this.uniforms_.forEach(function(s){if(i=typeof s.value=="function"?s.value(e):s.value,i instanceof HTMLCanvasElement||i instanceof ImageData)s.texture||(s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${r}`]),t.bindTexture(t.TEXTURE_2D,s.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),i instanceof ImageData?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,i.width,i.height,0,t.UNSIGNED_BYTE,new Uint8Array(i.data)):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i),t.uniform1i(s.location,r++);else if(Array.isArray(i))switch(i.length){case 2:t.uniform2f(s.location,i[0],i[1]);return;case 3:t.uniform3f(s.location,i[0],i[1],i[2]);return;case 4:t.uniform4f(s.location,i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(s.location,i)})}}var Dm=TN;function Nm(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Pu(n,e){return n[0]=e[0],n[1]=e[1],n[4]=e[2],n[5]=e[3],n[12]=e[4],n[13]=e[5],n}const SN={FRAGMENT_SHADER:35632,VERTEX_SHADER:35633},Ui={PROJECTION_MATRIX:"u_projectionMatrix",OFFSET_SCALE_MATRIX:"u_offsetScaleMatrix",OFFSET_ROTATION_MATRIX:"u_offsetRotateMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",SIZE_PX:"u_sizePx",PIXEL_RATIO:"u_pixelRatio"},wt={UNSIGNED_BYTE:Bw,UNSIGNED_SHORT:zw,UNSIGNED_INT:Vw,FLOAT:Om},wf={};function Yw(n){return"shared/"+n}let Zw=0;function bN(){const n="unique/"+Zw;return Zw+=1,n}function RN(n){let e=wf[n];if(!e){const t=document.createElement("canvas");t.style.position="absolute",t.style.left="0",e={users:0,canvas:t},wf[n]=e}return e.users+=1,e.canvas}function CN(n){const e=wf[n];if(!e||(e.users-=1,e.users>0))return;const t=e.canvas,r=xf(t).getExtension("WEBGL_lose_context");r&&r.loseContext(),delete wf[n]}class IN extends ks{constructor(e){super(),e=e||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=e.canvasCacheKey?Yw(e.canvasCacheKey):bN(),this.canvas_=RN(this.canvasCacheKey_),this.gl_=xf(this.canvas_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.canvas_.addEventListener(Lu.LOST,this.boundHandleWebGLContextLost_),this.canvas_.addEventListener(Lu.RESTORED,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=Le(),this.offsetScaleMatrix_=Le(),this.tmpMat4_=Nm(),this.uniformLocations_={},this.attribLocations_={},this.uniforms_=[],e.uniforms&&this.setUniforms(e.uniforms);const t=this.getGL();this.postProcessPasses_=e.postProcesses?e.postProcesses.map(function(i){return new Dm({webGlContext:t,scaleRatio:i.scaleRatio,vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,uniforms:i.uniforms})}):[new Dm({webGlContext:t})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(e){this.uniforms_=[];for(const t in e)this.uniforms_.push({name:t,value:e[t]});this.uniformLocations_={}}canvasCacheKeyMatches(e){return this.canvasCacheKey_===Yw(e)}getExtension(e){if(e in this.extensionCache_)return this.extensionCache_[e];const t=this.gl_.getExtension(e);return this.extensionCache_[e]=t,t}bindBuffer(e){const t=this.getGL(),i=H(e);let r=this.bufferCache_[i];if(!r){const s=t.createBuffer();r={buffer:e,webGlBuffer:s},this.bufferCache_[i]=r}t.bindBuffer(e.getType(),r.webGlBuffer)}flushBufferData(e){const t=this.getGL();this.bindBuffer(e),t.bufferData(e.getType(),e.getArray(),e.getUsage())}deleteBuffer(e){const t=this.getGL(),i=H(e),r=this.bufferCache_[i];r&&!t.isContextLost()&&t.deleteBuffer(r.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){this.canvas_.removeEventListener(Lu.LOST,this.boundHandleWebGLContextLost_),this.canvas_.removeEventListener(Lu.RESTORED,this.boundHandleWebGLContextRestored_),CN(this.canvasCacheKey_),delete this.gl_,delete this.canvas_}prepareDraw(e,t){const i=this.getGL(),r=this.getCanvas(),s=e.size,o=e.pixelRatio;r.width=s[0]*o,r.height=s[1]*o,r.style.width=s[0]+"px",r.style.height=s[1]+"px";for(let a=this.postProcessPasses_.length-1;a>=0;a--)this.postProcessPasses_[a].init(e);i.bindTexture(i.TEXTURE_2D,null),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,t?i.ZERO:i.ONE_MINUS_SRC_ALPHA)}prepareDrawToRenderTarget(e,t,i){const r=this.getGL(),s=t.getSize();r.bindFramebuffer(r.FRAMEBUFFER,t.getFramebuffer()),r.viewport(0,0,s[0],s[1]),r.bindTexture(r.TEXTURE_2D,t.getTexture()),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,i?r.ZERO:r.ONE_MINUS_SRC_ALPHA)}drawElements(e,t){const i=this.getGL();this.getExtension("OES_element_index_uint");const r=i.UNSIGNED_INT,s=4,o=t-e,a=e*s;i.drawElements(i.TRIANGLES,o,r,a)}finalizeDraw(e,t,i){for(let r=0,s=this.postProcessPasses_.length;r<s;r++)r===s-1?this.postProcessPasses_[r].apply(e,null,t,i):this.postProcessPasses_[r].apply(e,this.postProcessPasses_[r+1])}getCanvas(){return this.canvas_}getGL(){return this.gl_}applyFrameState(e){const t=e.size,i=e.viewState.rotation,r=e.pixelRatio,s=Bs(this.offsetScaleMatrix_);Gr(s,2/t[0],2/t[1]);const o=Bs(this.offsetRotateMatrix_);i!==0&&Qd(o,-i),this.setUniformMatrixValue(Ui.OFFSET_SCALE_MATRIX,Pu(this.tmpMat4_,s)),this.setUniformMatrixValue(Ui.OFFSET_ROTATION_MATRIX,Pu(this.tmpMat4_,o)),this.setUniformFloatValue(Ui.TIME,(Date.now()-this.startTime_)*.001),this.setUniformFloatValue(Ui.ZOOM,e.viewState.zoom),this.setUniformFloatValue(Ui.RESOLUTION,e.viewState.resolution),this.setUniformFloatValue(Ui.PIXEL_RATIO,r),this.setUniformFloatVec2(Ui.SIZE_PX,[t[0],t[1]])}applyUniforms(e){const t=this.getGL();let i,r=0;this.uniforms_.forEach(function(s){if(i=typeof s.value=="function"?s.value(e):s.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData)s.texture||(s.prevValue=void 0,s.texture=t.createTexture()),t.activeTexture(t[`TEXTURE${r}`]),t.bindTexture(t.TEXTURE_2D,s.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(!(i instanceof HTMLImageElement)||i.complete)&&s.prevValue!==i&&(s.prevValue=i,t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)),t.uniform1i(this.getUniformLocation(s.name),r++);else if(Array.isArray(i)&&i.length===6)this.setUniformMatrixValue(s.name,Pu(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:t.uniform2f(this.getUniformLocation(s.name),i[0],i[1]);return;case 3:t.uniform3f(this.getUniformLocation(s.name),i[0],i[1],i[2]);return;case 4:t.uniform4f(this.getUniformLocation(s.name),i[0],i[1],i[2],i[3]);return;default:return}else typeof i=="number"&&t.uniform1f(this.getUniformLocation(s.name),i)}.bind(this))}useProgram(e,t){this.getGL().useProgram(e),this.currentProgram_=e,this.uniformLocations_={},this.attribLocations_={},this.applyFrameState(t),this.applyUniforms(t)}compileShader(e,t){const i=this.getGL(),r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}getProgram(e,t){const i=this.getGL(),r=this.compileShader(e,i.FRAGMENT_SHADER),s=this.compileShader(t,i.VERTEX_SHADER),o=i.createProgram();if(i.attachShader(o,r),i.attachShader(o,s),i.linkProgram(o),!i.getShaderParameter(r,i.COMPILE_STATUS)){const a=`Fragment shader compliation failed: ${i.getShaderInfoLog(r)}`;throw new Error(a)}if(i.deleteShader(r),!i.getShaderParameter(s,i.COMPILE_STATUS)){const a=`Vertex shader compilation failed: ${i.getShaderInfoLog(s)}`;throw new Error(a)}if(i.deleteShader(s),!i.getProgramParameter(o,i.LINK_STATUS)){const a=`GL program linking failed: ${i.getShaderInfoLog(s)}`;throw new Error(a)}return o}getUniformLocation(e){return this.uniformLocations_[e]===void 0&&(this.uniformLocations_[e]=this.getGL().getUniformLocation(this.currentProgram_,e)),this.uniformLocations_[e]}getAttributeLocation(e){return this.attribLocations_[e]===void 0&&(this.attribLocations_[e]=this.getGL().getAttribLocation(this.currentProgram_,e)),this.attribLocations_[e]}makeProjectionTransform(e,t){const i=e.size,r=e.viewState.rotation,s=e.viewState.resolution,o=e.viewState.center;return Bs(t),tn(t,0,0,2/(s*i[0]),2/(s*i[1]),-r,-o[0],-o[1]),t}setUniformFloatValue(e,t){this.getGL().uniform1f(this.getUniformLocation(e),t)}setUniformFloatVec2(e,t){this.getGL().uniform2fv(this.getUniformLocation(e),t)}setUniformFloatVec4(e,t){this.getGL().uniform4fv(this.getUniformLocation(e),t)}setUniformMatrixValue(e,t){this.getGL().uniformMatrix4fv(this.getUniformLocation(e),!1,t)}enableAttributeArray_(e,t,i,r,s){const o=this.getAttributeLocation(e);o<0||(this.getGL().enableVertexAttribArray(o),this.getGL().vertexAttribPointer(o,t,i,!1,r,s))}enableAttributes(e){const t=Ww(e);let i=0;for(let r=0;r<e.length;r++){const s=e[r];this.enableAttributeArray_(s.name,s.size,s.type||Om,t,i),i+=s.size*Hw(s.type)}}handleWebGLContextLost(){$r(this.bufferCache_),this.currentProgram_=null}handleWebGLContextRestored(){}createTexture(e,t,i){const r=this.getGL();i=i||r.createTexture();const s=0,o=r.RGBA,a=0,l=r.RGBA,u=r.UNSIGNED_BYTE;return r.bindTexture(r.TEXTURE_2D,i),t?r.texImage2D(r.TEXTURE_2D,s,o,l,u,t):r.texImage2D(r.TEXTURE_2D,s,o,e[0],e[1],a,l,u,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),i}}function Ww(n){let e=0;for(let t=0;t<n.length;t++){const i=n[t];e+=i.size*Hw(i.type)}return e}function Hw(n){switch(n){case wt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case wt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case wt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case wt.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}var Kw=IN;class gy extends xm{constructor(e,t){super(e),t=t||{},this.inversePixelTransform_=Le(),this.pixelContext_=null,this.postProcesses_=t.postProcesses,this.uniforms_=t.uniforms,this.helper,e.addChangeListener(Ge.MAP,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(nn.PRECOMPOSE)){const r=new ua(nn.PRECOMPOSE,void 0,t,e);i.dispatchEvent(r)}}dispatchPostComposeEvent(e,t){const i=this.getLayer();if(i.hasListener(nn.POSTCOMPOSE)){const r=new ua(nn.POSTCOMPOSE,void 0,t,e);i.dispatchEvent(r)}}reset(e){this.uniforms_=e.uniforms,this.helper&&this.helper.setUniforms(this.uniforms_)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(e){if(this.getLayer().getRenderSource()){let t=!0,i=-1,r;for(let o=0,a=e.layerStatesArray.length;o<a;o++){const l=e.layerStatesArray[o].layer,u=l.getRenderer();if(!(u instanceof gy)){t=!0;continue}const c=l.getClassName();if((t||c!==r)&&(i+=1,t=!1),r=c,u===this)break}const s="map/"+e.mapId+"/group/"+i;(!this.helper||!this.helper.canvasCacheKeyMatches(s))&&(this.removeHelper(),this.helper=new Kw({postProcesses:this.postProcesses_,uniforms:this.uniforms_,canvasCacheKey:s}),r&&(this.helper.getCanvas().className=r),this.afterHelperCreated())}return this.prepareFrameInternal(e)}afterHelperCreated(){}prepareFrameInternal(e){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}dispatchRenderEvent_(e,t,i){const r=this.getLayer();if(r.hasListener(e)){tn(this.inversePixelTransform_,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const s=new ua(e,this.inversePixelTransform_,i,t);r.dispatchEvent(s)}}preRender(e,t){this.dispatchRenderEvent_(nn.PRERENDER,e,t)}postRender(e,t){this.dispatchRenderEvent_(nn.POSTRENDER,e,t)}}var Tf=gy;const Bi=new Uint8Array(4);class AN{constructor(e,t){this.helper_=e;const i=e.getGL();this.texture_=i.createTexture(),this.framebuffer_=i.createFramebuffer(),this.size_=t||[1,1],this.data_=new Uint8Array(0),this.dataCacheDirty_=!0,this.updateSize_()}setSize(e){Ai(e,this.size_)||(this.size_[0]=e[0],this.size_[1]=e[1],this.updateSize_())}getSize(){return this.size_}clearCachedData(){this.dataCacheDirty_=!0}readAll(){if(this.dataCacheDirty_){const e=this.size_,t=this.helper_.getGL();t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.readPixels(0,0,e[0],e[1],t.RGBA,t.UNSIGNED_BYTE,this.data_),this.dataCacheDirty_=!1}return this.data_}readPixel(e,t){if(e<0||t<0||e>this.size_[0]||t>=this.size_[1])return Bi[0]=0,Bi[1]=0,Bi[2]=0,Bi[3]=0,Bi;this.readAll();const i=Math.floor(e)+(this.size_[1]-Math.floor(t)-1)*this.size_[0];return Bi[0]=this.data_[i*4],Bi[1]=this.data_[i*4+1],Bi[2]=this.data_[i*4+2],Bi[3]=this.data_[i*4+3],Bi}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}updateSize_(){const e=this.size_,t=this.helper_.getGL();this.texture_=this.helper_.createTexture(e,null,this.texture_),t.bindFramebuffer(t.FRAMEBUFFER,this.framebuffer_),t.viewport(0,0,e[0],e[1]),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this.texture_,0),this.data_=new Uint8Array(e[0]*e[1]*4)}}var qw=AN;const xo={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"};var km={exports:{}};km.exports=Sf,km.exports.default=Sf;function Sf(n,e,t){t=t||2;var i=e&&e.length,r=i?e[0]*t:n.length,s=Jw(n,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;var a,l,u,c,h,f,d;if(i&&(s=ON(n,e,s,t)),n.length>80*t){a=u=n[0],l=c=n[1];for(var g=t;g<r;g+=t)h=n[g],f=n[g+1],h<a&&(a=h),f<l&&(l=f),h>u&&(u=h),f>c&&(c=f);d=Math.max(u-a,c-l),d=d!==0?32767/d:0}return Mu(s,o,t,a,l,d,0),o}function Jw(n,e,t,i,r){var s,o;if(r===Bm(n,e,t,i)>0)for(s=e;s<t;s+=i)o=tT(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=tT(s,n[s],n[s+1],o);return o&&bf(o,o.next)&&(Ou(o),o=o.next),o}function Eo(n,e){if(!n)return n;e||(e=n);var t=n,i;do if(i=!1,!t.steiner&&(bf(t,t.next)||_t(t.prev,t,t.next)===0)){if(Ou(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Mu(n,e,t,i,r,s,o){if(!!n){!o&&s&&GN(n,i,r,s);for(var a=n,l,u;n.prev!==n.next;){if(l=n.prev,u=n.next,s?PN(n,i,r,s):LN(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(u.i/t|0),Ou(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=MN(Eo(n),e,t),Mu(n,e,t,i,r,s,2)):o===2&&FN(n,e,t,i,r,s):Mu(Eo(n),e,t,i,r,s,1);break}}}}function LN(n){var e=n.prev,t=n,i=n.next;if(_t(e,t,i)>=0)return!1;for(var r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,u=i.y,c=r<s?r<o?r:o:s<o?s:o,h=a<l?a<u?a:u:l<u?l:u,f=r>s?r>o?r:o:s>o?s:o,d=a>l?a>u?a:u:l>u?l:u,g=i.next;g!==e;){if(g.x>=c&&g.x<=f&&g.y>=h&&g.y<=d&&Ba(r,a,s,l,o,u,g.x,g.y)&&_t(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function PN(n,e,t,i){var r=n.prev,s=n,o=n.next;if(_t(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,u=o.x,c=r.y,h=s.y,f=o.y,d=a<l?a<u?a:u:l<u?l:u,g=c<h?c<f?c:f:h<f?h:f,m=a>l?a>u?a:u:l>u?l:u,p=c>h?c>f?c:f:h>f?h:f,_=Gm(d,g,e,t,i),v=Gm(m,p,e,t,i),x=n.prevZ,y=n.nextZ;x&&x.z>=_&&y&&y.z<=v;){if(x.x>=d&&x.x<=m&&x.y>=g&&x.y<=p&&x!==r&&x!==o&&Ba(a,c,l,h,u,f,x.x,x.y)&&_t(x.prev,x,x.next)>=0||(x=x.prevZ,y.x>=d&&y.x<=m&&y.y>=g&&y.y<=p&&y!==r&&y!==o&&Ba(a,c,l,h,u,f,y.x,y.y)&&_t(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;x&&x.z>=_;){if(x.x>=d&&x.x<=m&&x.y>=g&&x.y<=p&&x!==r&&x!==o&&Ba(a,c,l,h,u,f,x.x,x.y)&&_t(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=d&&y.x<=m&&y.y>=g&&y.y<=p&&y!==r&&y!==o&&Ba(a,c,l,h,u,f,y.x,y.y)&&_t(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function MN(n,e,t){var i=n;do{var r=i.prev,s=i.next.next;!bf(r,s)&&Qw(r,i,i.next,s)&&Fu(r,s)&&Fu(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Ou(i),Ou(i.next),i=n=s),i=i.next}while(i!==n);return Eo(i)}function FN(n,e,t,i,r,s){var o=n;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&zN(o,a)){var l=eT(o,a);o=Eo(o,o.next),l=Eo(l,l.next),Mu(o,e,t,i,r,s,0),Mu(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function ON(n,e,t,i){var r=[],s,o,a,l,u;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,u=Jw(n,a,l,i,!1),u===u.next&&(u.steiner=!0),r.push(BN(u));for(r.sort($N),s=0;s<r.length;s++)t=DN(r[s],t);return t}function $N(n,e){return n.x-e.x}function DN(n,e){var t=NN(n,e);if(!t)return e;var i=eT(t,n);return Eo(i,i.next),Eo(t,t.next)}function NN(n,e){var t=e,i=n.x,r=n.y,s=-1/0,o;do{if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){var a=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(a<=i&&a>s&&(s=a,o=t.x<t.next.x?t:t.next,a===i))return o}t=t.next}while(t!==e);if(!o)return null;var l=o,u=o.x,c=o.y,h=1/0,f;t=o;do i>=t.x&&t.x>=u&&i!==t.x&&Ba(r<c?i:s,r,u,c,r<c?s:i,r,t.x,t.y)&&(f=Math.abs(r-t.y)/(i-t.x),Fu(t,n)&&(f<h||f===h&&(t.x>o.x||t.x===o.x&&kN(o,t)))&&(o=t,h=f)),t=t.next;while(t!==l);return o}function kN(n,e){return _t(n.prev,n,e.prev)<0&&_t(e.next,n,n.next)<0}function GN(n,e,t,i){var r=n;do r.z===0&&(r.z=Gm(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,UN(r)}function UN(n){var e,t,i,r,s,o,a,l,u=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<u&&(a++,i=i.nextZ,!!i);e++);for(l=u;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,u*=2}while(o>1);return n}function Gm(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function BN(n){var e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Ba(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function zN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!VN(n,e)&&(Fu(n,e)&&Fu(e,n)&&jN(n,e)&&(_t(n.prev,n,e.prev)||_t(n,e.prev,e))||bf(n,e)&&_t(n.prev,n,n.next)>0&&_t(e.prev,e,e.next)>0)}function _t(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function bf(n,e){return n.x===e.x&&n.y===e.y}function Qw(n,e,t,i){var r=Cf(_t(n,e,t)),s=Cf(_t(n,e,i)),o=Cf(_t(t,i,n)),a=Cf(_t(t,i,e));return!!(r!==s&&o!==a||r===0&&Rf(n,t,e)||s===0&&Rf(n,i,e)||o===0&&Rf(t,n,i)||a===0&&Rf(t,e,i))}function Rf(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Cf(n){return n>0?1:n<0?-1:0}function VN(n,e){var t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Qw(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Fu(n,e){return _t(n.prev,n,n.next)<0?_t(n,e,n.next)>=0&&_t(n,n.prev,e)>=0:_t(n,e,n.prev)<0||_t(n,n.next,e)<0}function jN(n,e){var t=n,i=!1,r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function eT(n,e){var t=new Um(n.i,n.x,n.y),i=new Um(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function tT(n,e,t,i){var r=new Um(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ou(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Um(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Sf.deviation=function(n,e,t,i){var r=e&&e.length,s=r?e[0]*t:n.length,o=Math.abs(Bm(n,0,s,t));if(r)for(var a=0,l=e.length;a<l;a++){var u=e[a]*t,c=a<l-1?e[a+1]*t:n.length;o-=Math.abs(Bm(n,u,c,t))}var h=0;for(a=0;a<i.length;a+=3){var f=i[a]*t,d=i[a+1]*t,g=i[a+2]*t;h+=Math.abs((n[f]-n[g])*(n[d+1]-n[f+1])-(n[f]-n[d])*(n[g+1]-n[f+1]))}return o===0&&h===0?0:Math.abs((h-o)/o)};function Bm(n,e,t,i){for(var r=0,s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}Sf.flatten=function(n){for(var e=n[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,r=0;r<n.length;r++){for(var s=0;s<n[r].length;s++)for(var o=0;o<e;o++)t.vertices.push(n[r][s][o]);r>0&&(i+=n[r-1].length,t.holes.push(i))}return t};var XN=km.exports;const YN=[],zm={vertexPosition:0,indexPosition:0};function If(n,e,t,i,r){n[e+0]=t,n[e+1]=i,n[e+2]=r}function ZN(n,e,t,i,r,s){const l=3+r,u=n[e+0],c=n[e+1],h=YN;h.length=r;for(let m=0;m<h.length;m++)h[m]=n[e+2+m];let f=s?s.vertexPosition:0,d=s?s.indexPosition:0;const g=f/l;return If(t,f,u,c,0),h.length&&t.set(h,f+3),f+=l,If(t,f,u,c,1),h.length&&t.set(h,f+3),f+=l,If(t,f,u,c,2),h.length&&t.set(h,f+3),f+=l,If(t,f,u,c,3),h.length&&t.set(h,f+3),f+=l,i[d++]=g,i[d++]=g+1,i[d++]=g+3,i[d++]=g+1,i[d++]=g+2,i[d++]=g+3,zm.vertexPosition=f,zm.indexPosition=d,zm}function WN(n,e,t,i,r,s,o,a,l,u){const h=5+a.length,f=s.length/h,d=[n[e+0],n[e+1]],g=[n[t],n[t+1]],m=ke(u,[...d]),p=ke(u,[...g]);function _(E,S,b){return Math.round(S*1500)+Math.round(b*1500)*1e4+E*1e4*1e4}function v(E,S,b){const R=Math.sqrt((S[0]-E[0])*(S[0]-E[0])+(S[1]-E[1])*(S[1]-E[1])),C=[(S[0]-E[0])/R,(S[1]-E[1])/R],M=[-C[1],C[0]],P=Math.sqrt((b[0]-E[0])*(b[0]-E[0])+(b[1]-E[1])*(b[1]-E[1])),U=[(b[0]-E[0])/P,(b[1]-E[1])/P],O=R===0||P===0?0:Math.acos(ye(U[0]*C[0]+U[1]*C[1],-1,1));return U[0]*M[0]+U[1]*M[1]>0?O:Math.PI*2-O}const x=i!==null,y=r!==null;let T=0,w=0;if(x){const E=[n[i],n[i+1]],S=ke(u,[...E]);T=v(m,p,S)}if(y){const E=[n[r],n[r+1]],S=ke(u,[...E]);w=v(p,m,S)}s.push(d[0],d[1],g[0],g[1],_(0,T,w)),s.push(...a),s.push(d[0],d[1],g[0],g[1],_(1,T,w)),s.push(...a),s.push(d[0],d[1],g[0],g[1],_(2,T,w)),s.push(...a),s.push(d[0],d[1],g[0],g[1],_(3,T,w)),s.push(...a),o.push(f,f+1,f+2,f+1,f+3,f+2)}function HN(n,e,t,i,r){const o=2+r;let a=e;const l=n.slice(a,a+r);a+=r;const u=n[a++];let c=0;const h=new Array(u-1);for(let g=0;g<u;g++)c+=n[a++],g<u-1&&(h[g]=c);const f=n.slice(a,a+c*2),d=XN(f,h,2);for(let g=0;g<d.length;g++)i.push(d[g]+t.length/o);for(let g=0;g<f.length;g+=2)t.push(f[g],f[g+1],...l);return a+c*2}function KN(){const e=document.createElement("canvas").getContext("2d").createImageData(1,1);return e.data[0]=255,e.data[1]=255,e.data[2]=255,e.data[3]=255,e}function nT(n,e){e=e||[];const t=256,i=t-1;return e[0]=Math.floor(n/t/t/t)/i,e[1]=Math.floor(n/t/t)%t/i,e[2]=Math.floor(n/t)%t/i,e[3]=n%t/i,e}function iT(n){let e=0;const t=256,i=t-1;return e+=Math.round(n[0]*t*t*t*i),e+=Math.round(n[1]*t*t*i),e+=Math.round(n[2]*t*i),e+=Math.round(n[3]*i),e}function rT(){const n='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS",r="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";r.includes("firefox");r.includes("safari")&&!r.includes("chrom")&&(r.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(r)),r.includes("webkit")&&r.includes("edge"),r.includes("macintosh"),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&(self,WorkerGlobalScope),function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch(e){}}();const o={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"};class i extends Error{constructor(e){const t=o[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}function s(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function a(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new i(t)}(0!==n,32);const o=t[0],s=t[1],a=t[2],u=t[3],x=t[4],f=t[5];return e[0]=u/n,e[1]=-s/n,e[2]=-a/n,e[3]=o/n,e[4]=(a*f-u*x)/n,e[5]=-(o*f-s*x)/n,e}new Array(6);var u={exports:{}};function x(e,t,n){n=n||2;var r,o,i,s,a,u,x,y=t&&t.length,d=y?t[0]*n:e.length,h=f(e,0,d,n,!0),v=[];if(!h||h.next===h.prev)return v;if(y&&(h=function(e,t,n,r){var o,i,s,a=[];for(o=0,i=t.length;o<i;o++)(s=f(e,t[o]*r,o<i-1?t[o+1]*r:e.length,r,!1))===s.next&&(s.steiner=!0),a.push(w(s));for(a.sort(p),o=0;o<a.length;o++)n=l(n=g(a[o],n),n.next);return n}(e,t,h,n)),e.length>80*n){r=i=e[0],o=s=e[1];for(var b=n;b<d;b+=n)(a=e[b])<r&&(r=a),(u=e[b+1])<o&&(o=u),a>i&&(i=a),u>s&&(s=u);x=0!==(x=Math.max(i-r,s-o))?1/x:0}return c(h,v,n,r,o,x),v}function f(e,t,n,r,o){var i,s;if(o===B(e,t,n,r)>0)for(i=t;i<n;i+=r)s=U(i,e[i],e[i+1],s);else for(i=n-r;i>=t;i-=r)s=U(i,e[i],e[i+1],s);return s&&M(s,s.next)&&(z(s),s=s.next),s}function l(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!M(r,r.next)&&0!==Z(r.prev,r,r.next))r=r.next;else{if(z(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function c(e,t,n,r,o,i,s){if(e){!s&&i&&function(e,t,n,r){var o=e;do{null===o.z&&(o.z=m(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next}while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,function(e){var t,n,r,o,i,s,a,u,x=1;do{for(n=e,e=null,i=null,s=0;n;){for(s++,r=n,a=0,t=0;t<x&&(a++,r=r.nextZ);t++);for(u=x;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(o=n,n=n.nextZ,a--):(o=r,r=r.nextZ,u--),i?i.nextZ=o:e=o,o.prevZ=i,i=o;n=r}i.nextZ=null,x*=2}while(s>1)}(o)}(e,r,o,i);for(var a,u,x=e;e.prev!==e.next;)if(a=e.prev,u=e.next,i?d(e,r,o,i):y(e))t.push(a.i/n),t.push(e.i/n),t.push(u.i/n),z(e),e=u.next,x=u.next;else if((e=u)===x){s?1===s?c(e=h(l(e),t,n),t,n,r,o,i,2):2===s&&v(e,t,n,r,o,i):c(l(e),t,n,r,o,i,1);break}}}function y(e){var t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;for(var o=e.next.next;o!==e.prev;){if(A(t.x,t.y,n.x,n.y,r.x,r.y,o.x,o.y)&&Z(o.prev,o,o.next)>=0)return!1;o=o.next}return!0}function d(e,t,n,r){var o=e.prev,i=e,s=e.next;if(Z(o,i,s)>=0)return!1;for(var a=o.x<i.x?o.x<s.x?o.x:s.x:i.x<s.x?i.x:s.x,u=o.y<i.y?o.y<s.y?o.y:s.y:i.y<s.y?i.y:s.y,x=o.x>i.x?o.x>s.x?o.x:s.x:i.x>s.x?i.x:s.x,f=o.y>i.y?o.y>s.y?o.y:s.y:i.y>s.y?i.y:s.y,l=m(a,u,t,n,r),c=m(x,f,t,n,r),y=e.prevZ,d=e.nextZ;y&&y.z>=l&&d&&d.z<=c;){if(y!==e.prev&&y!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,d!==e.prev&&d!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&Z(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;y&&y.z>=l;){if(y!==e.prev&&y!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;d&&d.z<=c;){if(d!==e.prev&&d!==e.next&&A(o.x,o.y,i.x,i.y,s.x,s.y,d.x,d.y)&&Z(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function h(e,t,n){var r=e;do{var o=r.prev,i=r.next.next;!M(o,i)&&F(o,r,r.next,i)&&k(o,i)&&k(i,o)&&(t.push(o.i/n),t.push(r.i/n),t.push(i.i/n),z(r),z(r.next),r=e=i),r=r.next}while(r!==e);return l(r)}function v(e,t,n,r,o,i){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&E(s,a)){var u=S(s,a);return s=l(s,s.next),u=l(u,u.next),c(s,t,n,r,o,i),void c(u,t,n,r,o,i)}a=a.next}s=s.next}while(s!==e)}function p(e,t){return e.x-t.x}function g(e,t){var n=function(e,t){var n,r=t,o=e.x,i=e.y,s=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var a=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=o&&a>s){if(s=a,a===o){if(i===r.y)return r;if(i===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==t);if(!n)return null;if(o===s)return n;var u,x=n,f=n.x,l=n.y,c=1/0;r=n;do{o>=r.x&&r.x>=f&&o!==r.x&&A(i<l?o:s,i,f,l,i<l?s:o,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(o-r.x),k(r,e)&&(u<c||u===c&&(r.x>n.x||r.x===n.x&&b(n,r)))&&(n=r,c=u)),r=r.next}while(r!==x);return n}(e,t);if(!n)return t;var r=S(n,e),o=l(n,n.next);return l(r,r.next),t===n?o:t}function b(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function m(e,t,n,r,o){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*o)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*o)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function w(e){var t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function A(e,t,n,r,o,i,s,a){return(o-s)*(t-a)-(e-s)*(i-a)>=0&&(e-s)*(r-a)-(n-s)*(t-a)>=0&&(n-s)*(i-a)-(o-s)*(r-a)>=0}function E(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&F(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(k(e,t)&&k(t,e)&&function(e,t){var n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||M(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function M(e,t){return e.x===t.x&&e.y===t.y}function F(e,t,n,r){var o=I(Z(e,t,n)),i=I(Z(e,t,r)),s=I(Z(n,r,e)),a=I(Z(n,r,t));return o!==i&&s!==a||(!(0!==o||!T(e,n,t))||(!(0!==i||!T(e,r,t))||(!(0!==s||!T(n,e,r))||!(0!==a||!T(n,t,r)))))}function T(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function k(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function S(e,t){var n=new R(e.i,e.x,e.y),r=new R(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function U(e,t,n,r){var o=new R(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function R(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function B(e,t,n,r){for(var o=0,i=t,s=n-r;i<n;i+=r)o+=(e[s]-e[i])*(e[i+1]+e[s+1]),s=i;return o}u.exports=x,u.exports.default=x,x.deviation=function(e,t,n,r){var o=t&&t.length,i=o?t[0]*n:e.length,s=Math.abs(B(e,0,i,n));if(o)for(var a=0,u=t.length;a<u;a++){var x=t[a]*n,f=a<u-1?t[a+1]*n:e.length;s-=Math.abs(B(e,x,f,n))}var l=0;for(a=0;a<r.length;a+=3){var c=r[a]*n,y=r[a+1]*n,d=r[a+2]*n;l+=Math.abs((e[c]-e[d])*(e[y+1]-e[c+1])-(e[c]-e[y])*(e[d+1]-e[c+1]))}return 0===s&&0===l?0:Math.abs((l-s)/s)},x.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,o=0;o<e.length;o++){for(var i=0;i<e[o].length;i++)for(var s=0;s<t;s++)n.vertices.push(e[o][i][s]);o>0&&(r+=e[o-1].length,n.holes.push(r))}return n};const P=[],C={vertexPosition:0,indexPosition:0};function N(e,t,n,r,o){e[t+0]=n,e[t+1]=r,e[t+2]=o}function _(e,t,n,r,o,i){const s=3+o,a=e[t+0],u=e[t+1],x=P;x.length=o;for(let n=0;n<x.length;n++)x[n]=e[t+2+n];let f=i?i.vertexPosition:0,l=i?i.indexPosition:0;const c=f/s;return N(n,f,a,u,0),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,1),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,2),x.length&&n.set(x,f+3),f+=s,N(n,f,a,u,3),x.length&&n.set(x,f+3),f+=s,r[l++]=c,r[l++]=c+1,r[l++]=c+3,r[l++]=c+1,r[l++]=c+2,r[l++]=c+3,C.vertexPosition=f,C.indexPosition=l,C}function L(e,t,n,r,o,i,a,u,x,f){const l=5+u.length,c=i.length/l,y=[e[t+0],e[t+1]],d=[e[n],e[n+1]],h=s(f,[...y]),v=s(f,[...d]);function p(e,t,n){const r=1e4;return Math.round(1500*t)+Math.round(1500*n)*r+e*r*r}function g(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),o=[(t[0]-e[0])/r,(t[1]-e[1])/r],i=[-o[1],o[0]],s=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),a=[(n[0]-e[0])/s,(n[1]-e[1])/s],u=0===r||0===s?0:Math.acos((x=a[0]*o[0]+a[1]*o[1],f=-1,l=1,Math.min(Math.max(x,f),l)));var x,f,l;return a[0]*i[0]+a[1]*i[1]>0?u:2*Math.PI-u}const b=null!==o;let m=0,w=0;if(null!==r){m=g(h,v,s(f,[...[e[r],e[r+1]]]))}if(b){w=g(v,h,s(f,[...[e[o],e[o+1]]]))}i.push(y[0],y[1],d[0],d[1],p(0,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(1,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(2,m,w)),i.push(...u),i.push(y[0],y[1],d[0],d[1],p(3,m,w)),i.push(...u),a.push(c,c+1,c+2,c+1,c+3,c+2)}function G(e,t,n,r,o){const i=2+o;let s=t;const a=e.slice(s,s+o);s+=o;const x=e[s++];let f=0;const l=new Array(x-1);for(let t=0;t<x;t++)f+=e[s++],t<x-1&&(l[t]=f);const c=e.slice(s,s+2*f),y=u.exports(c,l,2);for(let e=0;e<y.length;e++)r.push(y[e]+n.length/i);for(let e=0;e<c.length;e+=2)n.push(c[e],c[e+1],...a);return s+2*f}const O=self;O.onmessage=r=>{const o=r.data;switch(o.type){case t:{const e=3,t=2,n=o.customAttributesCount,r=t+n,i=new Float32Array(o.renderInstructions),s=i.length/r,a=4*s*(n+e),u=new Uint32Array(6*s),x=new Float32Array(a);let f;for(let e=0;e<i.length;e+=r)f=_(i,e,x,u,n,f);const l=Object.assign({vertexBuffer:x.buffer,indexBuffer:u.buffer,renderInstructions:i.buffer},o);O.postMessage(l,[x.buffer,u.buffer,i.buffer]);break}case n:{const e=[],t=[],n=o.customAttributesCount,r=2,i=new Float32Array(o.renderInstructions);let s=0;const u=o.renderInstructionsTransform,x=[1,0,0,1,0,0];let f,l;for(a(x,u);s<i.length;){l=Array.from(i.slice(s,s+n)),s+=n,f=i[s++];for(let n=0;n<f-1;n++)L(i,s+n*r,s+(n+1)*r,n>0?s+(n-1)*r:null,n<f-2?s+(n+2)*r:null,e,t,l,0,x);s+=f*r}const c=Uint32Array.from(t),y=Float32Array.from(e),d=Object.assign({vertexBuffer:y.buffer,indexBuffer:c.buffer,renderInstructions:i.buffer},o);O.postMessage(d,[y.buffer,c.buffer,i.buffer]);break}case e:{const e=[],t=[],n=o.customAttributesCount,r=new Float32Array(o.renderInstructions);let i=0;for(;i<r.length;)i=G(r,i,e,t,n);const s=Uint32Array.from(t),a=Float32Array.from(e),u=Object.assign({vertexBuffer:a.buffer,indexBuffer:s.buffer,renderInstructions:r.buffer},o);O.postMessage(u,[a.buffer,s.buffer,r.buffer]);break}}};';return new Worker(typeof Blob=="undefined"?"data:application/javascript;base64,"+Buffer.from(n,"binary").toString("base64"):URL.createObjectURL(new Blob([n],{type:"application/javascript"})))}class qN extends Tf{constructor(e,t){const i=t.uniforms||{},r=Le();i[Ui.PROJECTION_MATRIX]=r,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.ready=!1,this.sourceRevision_=-1,this.verticesBuffer_=new Qn(_r,vi),this.hitVerticesBuffer_=new Qn(_r,vi),this.indicesBuffer_=new Qn(cs,vi),this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.program_,this.hitDetectionEnabled_=!!(t.hitFragmentShader&&t.hitVertexShader),this.hitVertexShader_=t.hitVertexShader,this.hitFragmentShader_=t.hitFragmentShader,this.hitProgram_;const s=t.attributes?t.attributes.map(function(a){return{name:"a_"+a.name,size:1,type:wt.FLOAT}}):[];this.attributes=[{name:"a_position",size:2,type:wt.FLOAT},{name:"a_index",size:1,type:wt.FLOAT}].concat(s),this.hitDetectionAttributes=[{name:"a_position",size:2,type:wt.FLOAT},{name:"a_index",size:1,type:wt.FLOAT},{name:"a_hitColor",size:4,type:wt.FLOAT},{name:"a_featureUid",size:1,type:wt.FLOAT}].concat(s),this.customAttributes=t.attributes?t.attributes:[],this.previousExtent_=Ft(),this.currentTransform_=r,this.renderTransform_=Le(),this.invertRenderTransform_=Le(),this.renderInstructions_=new Float32Array(0),this.hitRenderInstructions_=new Float32Array(0),this.hitRenderTarget_,this.generateBuffersRun_=0,this.worker_=rT(),this.worker_.addEventListener("message",function(a){const l=a.data;if(l.type===xo.GENERATE_POINT_BUFFERS){const u=l.projectionTransform;l.hitDetection?(this.hitVerticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.hitVerticesBuffer_)):(this.verticesBuffer_.fromArrayBuffer(l.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_)),this.indicesBuffer_.fromArrayBuffer(l.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=u,Ur(this.invertRenderTransform_,this.renderTransform_),l.hitDetection?this.hitRenderInstructions_=new Float32Array(a.data.renderInstructions):(this.renderInstructions_=new Float32Array(a.data.renderInstructions),l.generateBuffersRun===this.generateBuffersRun_&&(this.ready=!0)),this.getLayer().changed()}}.bind(this)),this.featureCache_={},this.featureCount_=0;const o=this.getLayer().getSource();this.sourceListenKeys_=[re(o,ct.ADDFEATURE,this.handleSourceFeatureAdded_,this),re(o,ct.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),re(o,ct.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),re(o,ct.CLEAR,this.handleSourceFeatureClear_,this)],o.forEachFeature(function(a){this.featureCache_[H(a)]={feature:a,properties:a.getProperties(),geometry:a.getGeometry()},this.featureCount_++}.bind(this))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitProgram_=this.helper.getProgram(this.hitFragmentShader_,this.hitVertexShader_),this.hitRenderTarget_=new qw(this.helper))}handleSourceFeatureAdded_(e){const t=e.feature;this.featureCache_[H(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(e){const t=e.feature;this.featureCache_[H(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()}}handleSourceFeatureDelete_(e){const t=e.feature;delete this.featureCache_[H(t)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(e){const t=this.helper.getGL();this.preRender(t,e);const i=e.viewState.projection,o=this.getLayer().getSource().getWrapX()&&i.canWrapX(),a=i.getExtent(),l=e.extent,u=o?_e(a):null,c=o?Math.ceil((l[2]-a[2])/u)+1:1,h=o?Math.floor((l[0]-a[0])/u):0;let f=h;const d=this.indicesBuffer_.getSize();do this.helper.makeProjectionTransform(e,this.currentTransform_),qo(this.currentTransform_,f*u,0),rr(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e),this.helper.drawElements(0,d);while(++f<c);this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const g=this.helper.getCanvas();return this.hitDetectionEnabled_&&(this.renderHitDetection(e,h,c,u),this.hitRenderTarget_.clearCachedData()),this.postRender(t,e),g}prepareFrameInternal(e){const t=this.getLayer(),i=t.getSource(),r=e.viewState,s=!e.viewHints[Ye.ANIMATING]&&!e.viewHints[Ye.INTERACTING],o=!In(this.previousExtent_,e.extent),a=this.sourceRevision_<i.getRevision();if(a&&(this.sourceRevision_=i.getRevision()),s&&(o||a)){const l=r.projection,u=r.resolution,c=t instanceof vo?t.getRenderBuffer():0,h=hn(e.extent,c*u);i.loadFeatures(h,u,l),this.rebuildBuffers_(e),this.previousExtent_=e.extent.slice()}return this.helper.useProgram(this.program_,e),this.helper.prepareDraw(e),this.helper.bindBuffer(this.verticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.attributes),!0}rebuildBuffers_(e){const t=Le();this.helper.makeProjectionTransform(e,t);const i=(2+this.customAttributes.length)*this.featureCount_;if((!this.renderInstructions_||this.renderInstructions_.length!==i)&&(this.renderInstructions_=new Float32Array(i)),this.hitDetectionEnabled_){const f=(7+this.customAttributes.length)*this.featureCount_;(!this.hitRenderInstructions_||this.hitRenderInstructions_.length!==f)&&(this.hitRenderInstructions_=new Float32Array(f))}let r,s;const o=[],a=[];let l=0,u=0,c;for(const f in this.featureCache_){if(r=this.featureCache_[f],s=r.geometry,!s||s.getType()!=="Point")continue;o[0]=s.getFlatCoordinates()[0],o[1]=s.getFlatCoordinates()[1],ke(t,o),c=nT(u+6,a),this.renderInstructions_[l++]=o[0],this.renderInstructions_[l++]=o[1],this.hitDetectionEnabled_&&(this.hitRenderInstructions_[u++]=o[0],this.hitRenderInstructions_[u++]=o[1],this.hitRenderInstructions_[u++]=c[0],this.hitRenderInstructions_[u++]=c[1],this.hitRenderInstructions_[u++]=c[2],this.hitRenderInstructions_[u++]=c[3],this.hitRenderInstructions_[u++]=Number(f));let d;for(let g=0;g<this.customAttributes.length;g++)d=this.customAttributes[g].callback(r.feature,r.properties),this.renderInstructions_[l++]=d,this.hitDetectionEnabled_&&(this.hitRenderInstructions_[u++]=d)}const h={id:0,type:xo.GENERATE_POINT_BUFFERS,renderInstructions:this.renderInstructions_.buffer,customAttributesCount:this.customAttributes.length};if(h.projectionTransform=t,h.generateBuffersRun=++this.generateBuffersRun_,this.ready=!1,this.worker_.postMessage(h,[this.renderInstructions_.buffer]),this.renderInstructions_=null,this.hitDetectionEnabled_){const f={id:0,type:xo.GENERATE_POINT_BUFFERS,renderInstructions:this.hitRenderInstructions_.buffer,customAttributesCount:5+this.customAttributes.length};f.projectionTransform=t,f.hitDetection=!0,this.worker_.postMessage(f,[this.hitRenderInstructions_.buffer]),this.hitRenderInstructions_=null}}forEachFeatureAtCoordinate(e,t,i,r,s){if(ne(this.hitDetectionEnabled_,66),!this.hitRenderInstructions_)return;const o=ke(t.coordinateToPixelTransform,e.slice()),a=this.hitRenderTarget_.readPixel(o[0]/2,o[1]/2),l=[a[0]/255,a[1]/255,a[2]/255,a[3]/255],u=iT(l),c=this.hitRenderInstructions_[u],h=Math.floor(c).toString(),d=this.getLayer().getSource().getFeatureByUid(h);if(d)return r(d,this.getLayer(),null)}renderHitDetection(e,t,i,r){if(!this.hitVerticesBuffer_.getSize())return;let s=t;this.hitRenderTarget_.setSize([Math.floor(e.size[0]/2),Math.floor(e.size[1]/2)]),this.helper.useProgram(this.hitProgram_,e),this.helper.prepareDrawToRenderTarget(e,this.hitRenderTarget_,!0),this.helper.bindBuffer(this.hitVerticesBuffer_),this.helper.bindBuffer(this.indicesBuffer_),this.helper.enableAttributes(this.hitDetectionAttributes);do{this.helper.makeProjectionTransform(e,this.currentTransform_),qo(this.currentTransform_,s*r,0),rr(this.currentTransform_,this.invertRenderTransform_),this.helper.applyUniforms(e);const o=this.indicesBuffer_.getSize();this.helper.drawElements(0,o)}while(++s<i)}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach(function(e){Pe(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}var Vm=qN;const xi={BLUR:"blur",GRADIENT:"gradient",RADIUS:"radius"},JN=["#00f","#0ff","#0f0","#ff0","#f00"];class QN extends vo{constructor(e){e=e||{};const t=Object.assign({},e);delete t.gradient,delete t.radius,delete t.blur,delete t.weight,super(t),this.gradient_=null,this.addChangeListener(xi.GRADIENT,this.handleGradientChanged_),this.setGradient(e.gradient?e.gradient:JN),this.setBlur(e.blur!==void 0?e.blur:15),this.setRadius(e.radius!==void 0?e.radius:8);const i=e.weight?e.weight:"weight";typeof i=="string"?this.weightFunction_=function(r){return r.get(i)}:this.weightFunction_=i,this.setRenderOrder(null)}getBlur(){return this.get(xi.BLUR)}getGradient(){return this.get(xi.GRADIENT)}getRadius(){return this.get(xi.RADIUS)}handleGradientChanged_(){this.gradient_=ek(this.getGradient())}setBlur(e){this.set(xi.BLUR,e)}setGradient(e){this.set(xi.GRADIENT,e)}setRadius(e){this.set(xi.RADIUS,e)}createRenderer(){return new Vm(this,{className:this.getClassName(),attributes:[{name:"weight",callback:function(e){const t=this.weightFunction_(e);return t!==void 0?ye(t,0,1):1}.bind(this)}],vertexShader:`
|
36
|
-
precision mediump float;
|
37
|
-
uniform mat4 u_projectionMatrix;
|
38
|
-
uniform mat4 u_offsetScaleMatrix;
|
39
|
-
uniform float u_size;
|
40
|
-
attribute vec2 a_position;
|
41
|
-
attribute float a_index;
|
42
|
-
attribute float a_weight;
|
43
|
-
|
44
|
-
varying vec2 v_texCoord;
|
45
|
-
varying float v_weight;
|
46
|
-
|
47
|
-
void main(void) {
|
48
|
-
mat4 offsetMatrix = u_offsetScaleMatrix;
|
49
|
-
float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
|
50
|
-
float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
|
51
|
-
vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
|
52
|
-
gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
|
53
|
-
float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
|
54
|
-
float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
|
55
|
-
v_texCoord = vec2(u, v);
|
56
|
-
v_weight = a_weight;
|
57
|
-
}`,fragmentShader:`
|
58
|
-
precision mediump float;
|
59
|
-
uniform float u_blurSlope;
|
60
|
-
|
61
|
-
varying vec2 v_texCoord;
|
62
|
-
varying float v_weight;
|
63
|
-
|
64
|
-
void main(void) {
|
65
|
-
vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
|
66
|
-
float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
|
67
|
-
float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
|
68
|
-
float alpha = smoothstep(0.0, 1.0, value) * v_weight;
|
69
|
-
gl_FragColor = vec4(alpha, alpha, alpha, alpha);
|
70
|
-
}`,hitVertexShader:`
|
71
|
-
precision mediump float;
|
72
|
-
uniform mat4 u_projectionMatrix;
|
73
|
-
uniform mat4 u_offsetScaleMatrix;
|
74
|
-
uniform float u_size;
|
75
|
-
attribute vec2 a_position;
|
76
|
-
attribute float a_index;
|
77
|
-
attribute float a_weight;
|
78
|
-
attribute vec4 a_hitColor;
|
79
|
-
|
80
|
-
varying vec2 v_texCoord;
|
81
|
-
varying float v_weight;
|
82
|
-
varying vec4 v_hitColor;
|
83
|
-
|
84
|
-
void main(void) {
|
85
|
-
mat4 offsetMatrix = u_offsetScaleMatrix;
|
86
|
-
float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;
|
87
|
-
float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;
|
88
|
-
vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
|
89
|
-
gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
|
90
|
-
float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
|
91
|
-
float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
|
92
|
-
v_texCoord = vec2(u, v);
|
93
|
-
v_hitColor = a_hitColor;
|
94
|
-
v_weight = a_weight;
|
95
|
-
}`,hitFragmentShader:`
|
96
|
-
precision mediump float;
|
97
|
-
uniform float u_blurSlope;
|
98
|
-
|
99
|
-
varying vec2 v_texCoord;
|
100
|
-
varying float v_weight;
|
101
|
-
varying vec4 v_hitColor;
|
102
|
-
|
103
|
-
void main(void) {
|
104
|
-
vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);
|
105
|
-
float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;
|
106
|
-
float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;
|
107
|
-
float alpha = smoothstep(0.0, 1.0, value) * v_weight;
|
108
|
-
if (alpha < 0.05) {
|
109
|
-
discard;
|
110
|
-
}
|
111
|
-
|
112
|
-
gl_FragColor = v_hitColor;
|
113
|
-
}`,uniforms:{u_size:function(){return(this.get(xi.RADIUS)+this.get(xi.BLUR))*2}.bind(this),u_blurSlope:function(){return this.get(xi.RADIUS)/Math.max(1,this.get(xi.BLUR))}.bind(this)},postProcesses:[{fragmentShader:`
|
114
|
-
precision mediump float;
|
115
|
-
|
116
|
-
uniform sampler2D u_image;
|
117
|
-
uniform sampler2D u_gradientTexture;
|
118
|
-
uniform float u_opacity;
|
119
|
-
|
120
|
-
varying vec2 v_texCoord;
|
121
|
-
|
122
|
-
void main() {
|
123
|
-
vec4 color = texture2D(u_image, v_texCoord);
|
124
|
-
gl_FragColor.a = color.a * u_opacity;
|
125
|
-
gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;
|
126
|
-
gl_FragColor.rgb *= gl_FragColor.a;
|
127
|
-
}`,uniforms:{u_gradientTexture:function(){return this.gradient_}.bind(this),u_opacity:function(){return this.getOpacity()}.bind(this)}}]})}renderDeclutter(){}}function ek(n){const i=yt(1,256),r=i.createLinearGradient(0,0,1,256),s=1/(n.length-1);for(let o=0,a=n.length;o<a;++o)r.addColorStop(o*s,n[o]);return i.fillStyle=r,i.fillRect(0,0,1,256),i.canvas}var tk=QN;class nk extends af{constructor(e){super(e),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],i=e.pixelRatio,r=e.viewState,s=r.resolution,o=this.getLayer().getSource(),a=e.viewHints;let l=e.extent;if(t.extent!==void 0&&(l=zt(l,An(t.extent,r.projection))),!a[Ye.ANIMATING]&&!a[Ye.INTERACTING]&&!Vr(l))if(o){const u=r.projection,c=o.getImage(l,s,i,u);c&&(this.loadImage(c)?this.image_=c:c.getState()===ce.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),r=ke(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!jn(s,r))return null;const o=this.image_.getExtent(),a=this.image_.getImage(),l=_e(o),u=Math.floor(a.width*((r[0]-o[0])/l));if(u<0||u>=a.width)return null;const c=Xe(o),h=Math.floor(a.height*((o[3]-r[1])/c));return h<0||h>=a.height?null:this.getImageData(a,u,h)}renderFrame(e,t){const i=this.image_,r=i.getExtent(),s=i.getResolution(),o=i.getPixelRatio(),a=e.layerStatesArray[e.layerIndex],l=e.pixelRatio,u=e.viewState,c=u.center,h=u.resolution,f=l*s/(h*o),d=e.extent,g=u.resolution,m=u.rotation,p=Math.round(_e(d)/g*l),_=Math.round(Xe(d)/g*l);tn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/l,1/l,m,-p/2,-_/2),Ur(this.inversePixelTransform,this.pixelTransform);const v=Cl(this.pixelTransform);this.useContainer(t,v,this.getBackground(e));const x=this.context,y=x.canvas;y.width!=p||y.height!=_?(y.width=p,y.height=_):this.containerReused||x.clearRect(0,0,p,_);let T=!1,w=!0;if(a.extent){const C=An(a.extent,u.projection);w=Je(C,e.extent),T=w&&!Mt(C,e.extent),T&&this.clipUnrotated(x,e,C)}const E=i.getImage(),S=tn(this.tempTransform,p/2,_/2,f,f,0,o*(r[0]-c[0])/s,o*(c[1]-r[3])/s);this.renderedResolution=s*l/o;const b=E.width*S[0],R=E.height*S[3];if(this.getLayer().getSource().getInterpolate()||(x.imageSmoothingEnabled=!1),this.preRender(x,e),w&&b>=.5&&R>=.5){const C=S[4],M=S[5],P=a.opacity;let U;P!==1&&(U=x.globalAlpha,x.globalAlpha=P),x.drawImage(E,0,0,+E.width,+E.height,C,M,b,R),P!==1&&(x.globalAlpha=U)}return this.postRender(x,e),T&&x.restore(),x.imageSmoothingEnabled=!0,v!==y.style.transform&&(y.style.transform=v),this.container}}var jm=nk;class ik extends Gw{constructor(e){super(e)}createRenderer(){return new jm(this)}getData(e){return super.getData(e)}}var sT=ik;const Xm=.5,rk=10,oT=.25;class sk{constructor(e,t,i,r,s,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=ui(this.targetProj_,this.sourceProj_);this.transformInv_=function(v){const x=v[0]+"/"+v[1];return a[x]||(a[x]=l(v)),a[x]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&_e(r)==_e(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?_e(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?_e(this.targetProj_.getExtent()):null;const u=Xn(i),c=Qo(i),h=Xs(i),f=js(i),d=this.transformInv_(u),g=this.transformInv_(c),m=this.transformInv_(h),p=this.transformInv_(f),_=rk+(o?Math.max(0,Math.ceil(Math.log2(Jo(i)/(o*o*256*256)))):0);if(this.addQuad_(u,c,h,f,d,g,m,p,_),this.wrapsXInSource_){let v=1/0;this.triangles_.forEach(function(x,y,T){v=Math.min(v,x.source[0][0],x.source[1][0],x.source[2][0])}),this.triangles_.forEach(function(x){if(Math.max(x.source[0][0],x.source[1][0],x.source[2][0])-v>this.sourceWorldWidth_/2){const y=[[x.source[0][0],x.source[0][1]],[x.source[1][0],x.source[1][1]],[x.source[2][0],x.source[2][1]]];y[0][0]-v>this.sourceWorldWidth_/2&&(y[0][0]-=this.sourceWorldWidth_),y[1][0]-v>this.sourceWorldWidth_/2&&(y[1][0]-=this.sourceWorldWidth_),y[2][0]-v>this.sourceWorldWidth_/2&&(y[2][0]-=this.sourceWorldWidth_);const T=Math.min(y[0][0],y[1][0],y[2][0]);Math.max(y[0][0],y[1][0],y[2][0])-T<this.sourceWorldWidth_/2&&(x.source=y)}}.bind(this))}a={}}addTriangle_(e,t,i,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,i]})}addQuad_(e,t,i,r,s,o,a,l,u){const c=pt([s,o,a,l]),h=this.sourceWorldWidth_?_e(c)/this.sourceWorldWidth_:null,f=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&h>.5&&h<1;let g=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const p=pt([e,t,i,r]);g=_e(p)/this.targetWorldWidth_>oT||g}!d&&this.sourceProj_.isGlobal()&&h&&(g=h>oT||g)}if(!g&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!Je(c,this.maxSourceExtent_))return;let m=0;if(!g&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(u>0)g=!0;else if(m=(!isFinite(s[0])||!isFinite(s[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(u>0){if(!g){const p=[(e[0]+i[0])/2,(e[1]+i[1])/2],_=this.transformInv_(p);let v;d?v=(Zn(s[0],f)+Zn(a[0],f))/2-Zn(_[0],f):v=(s[0]+a[0])/2-_[0];const x=(s[1]+a[1])/2-_[1];g=v*v+x*x>this.errorThresholdSquared_}if(g){if(Math.abs(e[0]-i[0])<=Math.abs(e[1]-i[1])){const p=[(t[0]+i[0])/2,(t[1]+i[1])/2],_=this.transformInv_(p),v=[(r[0]+e[0])/2,(r[1]+e[1])/2],x=this.transformInv_(v);this.addQuad_(e,t,p,v,s,o,_,x,u-1),this.addQuad_(v,p,i,r,x,_,a,l,u-1)}else{const p=[(e[0]+t[0])/2,(e[1]+t[1])/2],_=this.transformInv_(p),v=[(i[0]+r[0])/2,(i[1]+r[1])/2],x=this.transformInv_(v);this.addQuad_(e,p,v,r,s,_,x,l,u-1),this.addQuad_(p,t,i,v,_,o,a,x,u-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(m&11)==0&&this.addTriangle_(e,i,r,s,a,l),(m&14)==0&&this.addTriangle_(e,i,t,s,a,o),m&&((m&13)==0&&this.addTriangle_(t,r,e,o,l,s),(m&7)==0&&this.addTriangle_(t,r,i,o,l,a))}calculateSourceExtent(){const e=Ft();return this.triangles_.forEach(function(t,i,r){const s=t.source;Vs(e,s[0]),Vs(e,s[1]),Vs(e,s[2])}),e}getTriangles(){return this.triangles_}}var Ym=sk;let Zm;const Wm=[];function aT(n,e,t,i,r){n.beginPath(),n.moveTo(0,0),n.lineTo(e,t),n.lineTo(i,r),n.closePath(),n.save(),n.clip(),n.fillRect(0,0,Math.max(e,i)+1,Math.max(t,r)),n.restore()}function Hm(n,e){return Math.abs(n[e*4]-210)>2||Math.abs(n[e*4+3]-.75*255)>2}function ok(){if(Zm===void 0){const n=document.createElement("canvas").getContext("2d");n.globalCompositeOperation="lighter",n.fillStyle="rgba(210, 0, 0, 0.75)",aT(n,4,5,4,0),aT(n,4,5,0,5);const e=n.getImageData(0,0,3,3).data;Zm=Hm(e,0)||Hm(e,4)||Hm(e,8)}return Zm}function za(n,e,t,i){const r=Xr(t,e,n);let s=$l(e,i,t);const o=e.getMetersPerUnit();o!==void 0&&(s*=o);const a=n.getMetersPerUnit();a!==void 0&&(s/=a);const l=n.getExtent();if(!l||jn(l,r)){const u=$l(n,s,r)/s;isFinite(u)&&u>0&&(s/=u)}return s}function lT(n,e,t,i){const r=Ot(t);let s=za(n,e,r,i);return(!isFinite(s)||s<=0)&&Gc(t,function(o){return s=za(n,e,o,i),isFinite(s)&&s>0}),s}function Km(n,e,t,i,r,s,o,a,l,u,c,h){const f=yt(Math.round(t*n),Math.round(t*e),Wm);if(h||(f.imageSmoothingEnabled=!1),l.length===0)return f.canvas;f.scale(t,t);function d(y){return Math.round(y*t)/t}f.globalCompositeOperation="lighter";const g=Ft();l.forEach(function(y,T,w){tg(g,y.extent)});const m=_e(g),p=Xe(g),_=yt(Math.round(t*m/i),Math.round(t*p/i));h||(_.imageSmoothingEnabled=!1);const v=t/i;l.forEach(function(y,T,w){const E=y.extent[0]-g[0],S=-(y.extent[3]-g[3]),b=_e(y.extent),R=Xe(y.extent);y.image.width>0&&y.image.height>0&&_.drawImage(y.image,u,u,y.image.width-2*u,y.image.height-2*u,E*v,S*v,b*v,R*v)});const x=Xn(o);return a.getTriangles().forEach(function(y,T,w){const E=y.source,S=y.target;let b=E[0][0],R=E[0][1],C=E[1][0],M=E[1][1],P=E[2][0],U=E[2][1];const O=d((S[0][0]-x[0])/s),L=d(-(S[0][1]-x[1])/s),$=d((S[1][0]-x[0])/s),N=d(-(S[1][1]-x[1])/s),D=d((S[2][0]-x[0])/s),Y=d(-(S[2][1]-x[1])/s),k=b,F=R;b=0,R=0,C-=k,M-=F,P-=k,U-=F;const ee=[[C,M,0,0,$-O],[P,U,0,0,D-O],[0,0,C,M,N-L],[0,0,P,U,Y-L]],X=hv(ee);if(!!X){if(f.save(),f.beginPath(),ok()||!h){f.moveTo($,N);const Z=4,ie=O-$,B=L-N;for(let he=0;he<Z;he++)f.lineTo($+d((he+1)*ie/Z),N+d(he*B/(Z-1))),he!=Z-1&&f.lineTo($+d((he+1)*ie/Z),N+d((he+1)*B/(Z-1)));f.lineTo(D,Y)}else f.moveTo($,N),f.lineTo(O,L),f.lineTo(D,Y);f.clip(),f.transform(X[0],X[2],X[1],X[3],O,L),f.translate(g[0]-k,g[3]-F),f.scale(i/t,-i/t),f.drawImage(_.canvas,0,0),f.restore()}}),c&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(y,T,w){const E=y.target,S=(E[0][0]-x[0])/s,b=-(E[0][1]-x[1])/s,R=(E[1][0]-x[0])/s,C=-(E[1][1]-x[1])/s,M=(E[2][0]-x[0])/s,P=-(E[2][1]-x[1])/s;f.beginPath(),f.moveTo(R,C),f.lineTo(S,b),f.lineTo(M,P),f.closePath(),f.stroke()}),f.restore()),f.canvas}class ak extends Nr{constructor(e,t,i,r,s,o,a,l,u,c,h,f){super(s,V.IDLE,{interpolate:!!f}),this.renderEdges_=h!==void 0?h:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const d=r.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let m=this.sourceTileGrid_.getExtent();const p=g?zt(d,g):d;if(Jo(p)===0){this.state=V.EMPTY;return}const _=e.getExtent();_&&(m?m=zt(m,_):m=_);const v=r.getResolution(this.wrappedTileCoord_[0]),x=lT(e,i,p,v);if(!isFinite(x)||x<=0){this.state=V.EMPTY;return}const y=c!==void 0?c:Xm;if(this.triangulation_=new Ym(e,i,p,m,x*y,v),this.triangulation_.getTriangles().length===0){this.state=V.EMPTY;return}this.sourceZ_=t.getZForResolution(x);let T=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(T[1]=ye(T[1],m[1],m[3]),T[3]=ye(T[3],m[1],m[3])):T=zt(T,m)),!Jo(T))this.state=V.EMPTY;else{const w=t.getTileRangeForExtentAndZ(T,this.sourceZ_);for(let E=w.minX;E<=w.maxX;E++)for(let S=w.minY;S<=w.maxY;S++){const b=u(this.sourceZ_,E,S,a);b&&this.sourceTiles_.push(b)}this.sourceTiles_.length===0&&(this.state=V.EMPTY)}}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(function(t,i,r){t&&t.getState()==V.LOADED&&e.push({extent:this.sourceTileGrid_.getTileCoordExtent(t.tileCoord),image:t.getImage()})}.bind(this)),this.sourceTiles_.length=0,e.length===0)this.state=V.ERROR;else{const t=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(t),r=typeof i=="number"?i:i[0],s=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Km(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=V.LOADED}this.changed()}load(){if(this.state==V.IDLE){this.state=V.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(t,i,r){const s=t.getState();if(s==V.IDLE||s==V.LOADING){e++;const o=re(t,K.CHANGE,function(a){const l=t.getState();(l==V.LOADED||l==V.ERROR||l==V.EMPTY)&&(Pe(o),e--,e===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(o)}}.bind(this)),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t,i,r){t.getState()==V.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(Pe),this.sourcesListenerKeys_=null}release(){this.canvas_&&(uh(this.canvas_.getContext("2d")),Wm.push(this.canvas_),this.canvas_=null),super.release()}}var wo=ak;class lk extends af{constructor(e){super(e),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=Ft(),this.tmpTileRange_=new eu(0,0,0,0)}isDrawableTile(e){const t=this.getLayer(),i=e.getState(),r=t.getUseInterimTilesOnError();return i==V.LOADED||i==V.EMPTY||i==V.ERROR&&!r}getTile(e,t,i,r){const s=r.pixelRatio,o=r.viewState.projection,a=this.getLayer();let u=a.getSource().getTile(e,t,i,s,o);return u.getState()==V.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(u)||(u=u.getInterimTile()),u}getData(e){const t=this.frameState;if(!t)return null;const i=this.getLayer(),r=ke(t.pixelToCoordinateTransform,e.slice()),s=i.getExtent();if(s&&!jn(s,r))return null;const o=t.pixelRatio,a=t.viewState.projection,l=t.viewState,u=i.getRenderSource(),c=u.getTileGridForProjection(l.projection),h=u.getTilePixelRatio(t.pixelRatio);for(let f=c.getZForResolution(l.resolution);f>=c.getMinZoom();--f){const d=c.getTileCoordForCoordAndZ(r,f),g=u.getTile(f,d[1],d[2],o,a);if(!(g instanceof no||g instanceof wo)||g instanceof wo&&g.getState()===V.EMPTY)return null;if(g.getState()!==V.LOADED)continue;const m=c.getOrigin(f),p=tt(c.getTileSize(f)),_=c.getResolution(f),v=Math.floor(h*((r[0]-m[0])/_-d[1]*p[0])),x=Math.floor(h*((m[1]-r[1])/_-d[2]*p[1])),y=Math.round(h*u.getGutterForProjection(l.projection));return this.getImageData(g.getImage(),v+y,x+y)}return null}loadedTileCallback(e,t,i){return this.isDrawableTile(i)?super.loadedTileCallback(e,t,i):!1}prepareFrame(e){return!!this.getLayer().getSource()}renderFrame(e,t){const i=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=r.rotation,u=e.pixelRatio,c=this.getLayer(),h=c.getSource(),f=h.getRevision(),d=h.getTileGridForProjection(s),g=d.getZForResolution(o,h.zDirection),m=d.getResolution(g);let p=e.extent;const _=e.viewState.resolution,v=h.getTilePixelRatio(u),x=Math.round(_e(p)/_*u),y=Math.round(Xe(p)/_*u),T=i.extent&&An(i.extent,s);T&&(p=zt(p,An(i.extent,s)));const w=m*x/2/v,E=m*y/2/v,S=[a[0]-w,a[1]-E,a[0]+w,a[1]+E],b=d.getTileRangeForExtentAndZ(p,g),R={};R[g]={};const C=this.createLoadedTileFinder(h,s,R),M=this.tmpExtent,P=this.tmpTileRange_;this.newTiles_=!1;const U=l?Uc(r.center,_,l,e.size):void 0;for(let ee=b.minX;ee<=b.maxX;++ee)for(let X=b.minY;X<=b.maxY;++X){if(l&&!d.tileCoordIntersectsViewport([g,ee,X],U))continue;const Z=this.getTile(g,ee,X,e);if(this.isDrawableTile(Z)){const he=H(this);if(Z.getState()==V.LOADED){R[g][Z.tileCoord.toString()]=Z;let me=Z.inTransition(he);me&&i.opacity!==1&&(Z.endTransition(he),me=!1),!this.newTiles_&&(me||!this.renderedTiles.includes(Z))&&(this.newTiles_=!0)}if(Z.getAlpha(he,e.time)===1)continue}const ie=d.getTileCoordChildTileRange(Z.tileCoord,P,M);let B=!1;ie&&(B=C(g+1,ie)),B||d.forEachTileCoordParentTileRange(Z.tileCoord,C,P,M)}const O=m/o*u/v;tn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/u,1/u,l,-x/2,-y/2);const L=Cl(this.pixelTransform);this.useContainer(t,L,this.getBackground(e));const $=this.context,N=$.canvas;Ur(this.inversePixelTransform,this.pixelTransform),tn(this.tempTransform,x/2,y/2,O,O,0,-x/2,-y/2),N.width!=x||N.height!=y?(N.width=x,N.height=y):this.containerReused||$.clearRect(0,0,x,y),T&&this.clipUnrotated($,e,T),h.getInterpolate()||($.imageSmoothingEnabled=!1),this.preRender($,e),this.renderedTiles.length=0;let D=Object.keys(R).map(Number);D.sort(ir);let Y,k,F;i.opacity===1&&(!this.containerReused||h.getOpaque(e.viewState.projection))?D=D.reverse():(Y=[],k=[]);for(let ee=D.length-1;ee>=0;--ee){const X=D[ee],Z=h.getTilePixelSize(X,u,s),B=d.getResolution(X)/m,he=Z[0]*B*O,me=Z[1]*B*O,De=d.getTileCoordForCoordAndZ(Xn(S),X),rt=d.getTileCoordExtent(De),Ce=ke(this.tempTransform,[v*(rt[0]-S[0])/m,v*(S[3]-rt[3])/m]),at=v*h.getGutterForProjection(s),dt=R[X];for(const et in dt){const Ve=dt[et],Q=Ve.tileCoord,wn=De[1]-Q[1],Bt=Math.round(Ce[0]-(wn-1)*he),Tn=De[2]-Q[2],ln=Math.round(Ce[1]-(Tn-1)*me),At=Math.round(Ce[0]-wn*he),Tt=Math.round(Ce[1]-Tn*me),Sn=Bt-At,Dn=ln-Tt,bi=g===X,Vn=bi&&Ve.getAlpha(H(this),e.time)!==1;let je=!1;if(!Vn)if(Y){F=[At,Tt,At+Sn,Tt,At+Sn,Tt+Dn,At,Tt+Dn];for(let er=0,tr=Y.length;er<tr;++er)if(g!==X&&X<k[er]){const He=Y[er];Je([At,Tt,At+Sn,Tt+Dn],[He[0],He[3],He[4],He[7]])&&(je||($.save(),je=!0),$.beginPath(),$.moveTo(F[0],F[1]),$.lineTo(F[2],F[3]),$.lineTo(F[4],F[5]),$.lineTo(F[6],F[7]),$.moveTo(He[6],He[7]),$.lineTo(He[4],He[5]),$.lineTo(He[2],He[3]),$.lineTo(He[0],He[1]),$.clip())}Y.push(F),k.push(X)}else $.clearRect(At,Tt,Sn,Dn);this.drawTileImage(Ve,e,At,Tt,Sn,Dn,at,bi),Y&&!Vn?(je&&$.restore(),this.renderedTiles.unshift(Ve)):this.renderedTiles.push(Ve),this.updateUsedTiles(e.usedTiles,h,Ve)}}return this.renderedRevision=f,this.renderedResolution=m,this.extentChanged=!this.renderedExtent_||!In(this.renderedExtent_,S),this.renderedExtent_=S,this.renderedPixelRatio=u,this.renderedProjection=s,this.manageTilePyramid(e,h,d,u,s,p,g,c.getPreload()),this.scheduleExpireCache(e,h),this.postRender($,e),i.extent&&$.restore(),$.imageSmoothingEnabled=!0,L!==N.style.transform&&(N.style.transform=L),this.container}drawTileImage(e,t,i,r,s,o,a,l){const u=this.getTileImage(e);if(!u)return;const c=H(this),h=t.layerStatesArray[t.layerIndex],f=h.opacity*(l?e.getAlpha(c,t.time):1),d=f!==this.context.globalAlpha;d&&(this.context.save(),this.context.globalAlpha=f),this.context.drawImage(u,a,a,u.width-2*a,u.height-2*a,i,r,s,o),d&&this.context.restore(),f!==h.opacity?t.animate=!0:l&&e.endTransition(c)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}scheduleExpireCache(e,t){if(t.canExpireCache()){const i=function(r,s,o){const a=H(r);a in o.usedTiles&&r.expireCache(o.viewState.projection,o.usedTiles[a])}.bind(null,t);e.postRenderFunctions.push(i)}}updateUsedTiles(e,t,i){const r=H(t);r in e||(e[r]={}),e[r][i.getKey()]=!0}manageTilePyramid(e,t,i,r,s,o,a,l,u){const c=H(t);c in e.wantedTiles||(e.wantedTiles[c]={});const h=e.wantedTiles[c],f=e.tileQueue,d=i.getMinZoom(),g=e.viewState.rotation,m=g?Uc(e.viewState.center,e.viewState.resolution,g,e.size):void 0;let p=0,_,v,x,y,T,w;for(w=d;w<=a;++w)for(v=i.getTileRangeForExtentAndZ(o,w,v),x=i.getResolution(w),y=v.minX;y<=v.maxX;++y)for(T=v.minY;T<=v.maxY;++T)g&&!i.tileCoordIntersectsViewport([w,y,T],m)||(a-w<=l?(++p,_=t.getTile(w,y,T,r,s),_.getState()==V.IDLE&&(h[_.getKey()]=!0,f.isKeyQueued(_.getKey())||f.enqueue([_,c,i.getTileCoordCenter(_.tileCoord),x])),u!==void 0&&u(_)):t.useTile(w,y,T,s));t.updateCacheSize(p,s)}}var qm=lk;const uk={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},ck={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class hk extends qm{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.tmpTransform_=Le()}prepareTile(e,t,i){let r;const s=e.getState();return(s===V.LOADED||s===V.ERROR)&&(this.updateExecutorGroup_(e,t,i),this.tileImageNeedsRender_(e)&&(r=!0)),r}getTile(e,t,i,r){const s=r.pixelRatio,o=r.viewState,a=o.resolution,l=o.projection,u=this.getLayer(),c=u.getSource().getTile(e,t,i,s,l),h=r.viewHints,f=!(h[Ye.ANIMATING]||h[Ye.INTERACTING]);return(f||!c.wantedResolution)&&(c.wantedResolution=a),this.prepareTile(c,s,l)&&(f||Date.now()-r.time<8)&&u.getRenderMode()!=="vector"&&this.renderTileImage_(c,r),super.getTile(e,t,i,r)}isDrawableTile(e){const t=this.getLayer();return super.isDrawableTile(e)&&(t.getRenderMode()==="vector"?H(t)in e.executorGroups:e.hasContext(t))}getTileImage(e){return e.getImage(this.getLayer())}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,i){const r=this.getLayer(),s=r.getRevision(),o=r.getRenderOrder()||null,a=e.wantedResolution,l=e.getReplayState(r);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==s&&l.renderedRenderOrder==o)return;const u=r.getSource(),c=r.getDeclutter(),h=u.getTileGrid(),d=u.getTileGridForProjection(i).getTileCoordExtent(e.wrappedTileCoord),g=u.getSourceTiles(t,i,e),m=H(r);delete e.hitDetectionImageData[m],e.executorGroups[m]=[],c&&(e.declutterExecutorGroups[m]=[]),l.dirty=!1;for(let p=0,_=g.length;p<_;++p){const v=g[p];if(v.getState()!=V.LOADED)continue;const x=v.tileCoord,y=h.getTileCoordExtent(x),T=zt(d,y),w=hn(T,r.getRenderBuffer()*a,this.tmpExtent),E=In(y,T)?null:w,S=new wu(0,w,a,t),b=c?new wu(0,T,a,t):void 0,R=uf(a,t),C=function(L){let $;const N=L.getStyleFunction()||r.getStyleFunction();if(N&&($=N(L,a)),$){const D=this.renderFeature(L,R,$,S,b);l.dirty=l.dirty||D}},M=v.getFeatures();o&&o!==l.renderedRenderOrder&&M.sort(o);for(let L=0,$=M.length;L<$;++L){const N=M[L];(!E||Je(E,N.getGeometry().getExtent()))&&C.call(this,N)}const P=S.finish(),U=r.getRenderMode()!=="vector"&&c&&g.length===1?null:T,O=new Tu(U,a,t,u.getOverlaps(),P,r.getRenderBuffer());if(e.executorGroups[m].push(O),b){const L=new Tu(null,a,t,u.getOverlaps(),b.finish(),r.getRenderBuffer());e.declutterExecutorGroups[m].push(L)}}l.renderedRevision=s,l.renderedRenderOrder=o,l.renderedResolution=a}forEachFeatureAtCoordinate(e,t,i,r,s){const o=t.viewState.resolution,a=t.viewState.rotation;i=i==null?0:i;const l=this.getLayer(),c=l.getSource().getTileGridForProjection(t.viewState.projection),h=pt([e]);hn(h,o*i,h);const f={},d=function(p,_,v){let x=p.getId();x===void 0&&(x=H(p));const y=f[x];if(y){if(y!==!0&&v<y.distanceSq){if(v===0)return f[x]=!0,s.splice(s.lastIndexOf(y),1),r(p,l,_);y.geometry=_,y.distanceSq=v}}else{if(v===0)return f[x]=!0,r(p,l,_);s.push(f[x]={feature:p,layer:l,geometry:_,distanceSq:v,callback:r})}},g=this.renderedTiles;let m;for(let p=0,_=g.length;!m&&p<_;++p){const v=g[p],x=c.getTileCoordExtent(v.wrappedTileCoord);if(!Je(x,h))continue;const y=H(l),T=[v.executorGroups[y]],w=v.declutterExecutorGroups[y];w&&T.push(w),T.some(E=>{const S=E===w?t.declutterTree.all().map(b=>b.value):null;for(let b=0,R=E.length;b<R;++b)if(m=E[b].forEachFeatureAtCoordinate(e,o,a,i,d,S),m)return!0})}return m}getFeatures(e){return new Promise(function(t,i){const r=this.getLayer(),s=H(r),o=r.getSource(),a=this.renderedProjection,l=a.getExtent(),u=this.renderedResolution,c=o.getTileGridForProjection(a),h=ke(this.renderedPixelToCoordinateTransform_,e.slice()),f=c.getTileCoordForCoordAndResolution(h,u);let d;for(let x=0,y=this.renderedTiles.length;x<y;++x)if(f.toString()===this.renderedTiles[x].tileCoord.toString()){if(d=this.renderedTiles[x],d.getState()===V.LOADED){const T=c.getTileCoordExtent(d.tileCoord);o.getWrapX()&&a.canWrapX()&&!Mt(l,T)&&Xc(h,a);break}d=void 0}if(!d||d.loadingSourceTiles>0){t([]);return}const g=c.getTileCoordExtent(d.wrappedTileCoord),m=Xn(g),p=[(h[0]-m[0])/u,(m[1]-h[1])/u],_=d.getSourceTiles().reduce(function(x,y){return x.concat(y.getFeatures())},[]);let v=d.hitDetectionImageData[s];if(!v&&!this.animatingOrInteracting_){const x=tt(c.getTileSize(c.getZForResolution(u,o.zDirection))),y=this.renderedRotation_,T=[this.getRenderTransform(c.getTileCoordCenter(d.wrappedTileCoord),u,0,Mn,x[0]*Mn,x[1]*Mn,0)];v=Sm(x,T,_,r.getStyleFunction(),c.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(r).renderedResolution,y),d.hitDetectionImageData[s]=v}t(bm(p,_,v))}.bind(this))}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.renderedLayerRevision_!==void 0&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e){const t=this.context,i=t.globalAlpha;t.globalAlpha=this.getLayer().getOpacity();const r=e.viewHints,s=!(r[Ye.ANIMATING]||r[Ye.INTERACTING]),o=this.renderedTiles;for(let a=0,l=o.length;a<l;++a){const u=o[a],c=u.declutterExecutorGroups[H(this.getLayer())];if(c)for(let h=c.length-1;h>=0;--h)c[h].execute(this.context,1,this.getTileRenderTransform(u,e),e.viewState.rotation,s,void 0,e.declutterTree)}t.globalAlpha=i}getTileRenderTransform(e,t){const i=t.pixelRatio,r=t.viewState,s=r.center,o=r.resolution,a=r.rotation,l=t.size,u=Math.round(l[0]*i),c=Math.round(l[1]*i),f=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),d=e.tileCoord,g=f.getTileCoordExtent(e.wrappedTileCoord),m=f.getTileCoordExtent(d,this.tmpExtent)[0]-g[0];return rr(Gr(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(s,o,a,i,u,c,m))}postRender(e,t){const i=t.viewHints,r=!(i[Ye.ANIMATING]||i[Ye.INTERACTING]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation;const s=this.getLayer(),o=s.getRenderMode(),a=e.globalAlpha;e.globalAlpha=s.getOpacity();const l=ck[o],u=t.viewState,c=u.rotation,h=s.getSource(),d=h.getTileGridForProjection(u.projection).getZForResolution(u.resolution,h.zDirection),g=this.renderedTiles,m=[],p=[];let _=!0;for(let v=g.length-1;v>=0;--v){const x=g[v];_=_&&!x.getReplayState(s).dirty;const y=x.executorGroups[H(s)].filter(b=>b.hasExecutors(l));if(y.length===0)continue;const T=this.getTileRenderTransform(x,t),w=x.tileCoord[0];let E=!1;const S=y[0].getClipCoords(T);if(S){for(let b=0,R=m.length;b<R;++b)if(d!==w&&w<p[b]){const C=m[b];Je([S[0],S[3],S[4],S[7]],[C[0],C[3],C[4],C[7]])&&(E||(e.save(),E=!0),e.beginPath(),e.moveTo(S[0],S[1]),e.lineTo(S[2],S[3]),e.lineTo(S[4],S[5]),e.lineTo(S[6],S[7]),e.moveTo(C[6],C[7]),e.lineTo(C[4],C[5]),e.lineTo(C[2],C[3]),e.lineTo(C[0],C[1]),e.clip())}m.push(S),p.push(w)}for(let b=0,R=y.length;b<R;++b)y[b].execute(e,1,T,c,r,l);E&&e.restore()}e.globalAlpha=a,this.ready=_,super.postRender(e,t)}renderFeature(e,t,i,r,s){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Su(r,e,i[a],t,this.boundHandleStyleImageChange_,void 0,s)||o;else o=Su(r,e,i,t,this.boundHandleStyleImageChange_,void 0,s);return o}tileImageNeedsRender_(e){const t=this.getLayer();if(t.getRenderMode()==="vector")return!1;const i=e.getReplayState(t),r=t.getRevision(),s=e.wantedResolution;return i.renderedTileResolution!==s||i.renderedTileRevision!==r}renderTileImage_(e,t){const i=this.getLayer(),r=e.getReplayState(i),s=i.getRevision(),o=e.executorGroups[H(i)];r.renderedTileRevision=s;const a=e.wrappedTileCoord,l=a[0],u=i.getSource();let c=t.pixelRatio;const f=t.viewState.projection,d=u.getTileGridForProjection(f),g=d.getResolution(e.tileCoord[0]),m=t.pixelRatio/e.wantedResolution*g,p=d.getResolution(l),_=e.getContext(i);c=Math.round(Math.max(c,m/c));const v=u.getTilePixelSize(l,c,f);_.canvas.width=v[0],_.canvas.height=v[1];const x=c/m;if(x!==1){const E=Bs(this.tmpTransform_);Gr(E,x,x),_.setTransform.apply(_,E)}const y=d.getTileCoordExtent(a,this.tmpExtent),T=m/p,w=Bs(this.tmpTransform_);Gr(w,T,-T),qo(w,-y[0],-y[3]);for(let E=0,S=o.length;E<S;++E)o[E].execute(_,x,w,0,!0,uk[i.getRenderMode()]);r.renderedTileResolution=e.wantedResolution}}var uT=hk;class fk extends vo{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un;const i=e.renderMode||"hybrid";ne(i=="hybrid"||i=="vector",28),this.renderMode_=i,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(e.useInterimTilesOnError!==void 0?e.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new uT(this)}getFeatures(e){return super.getFeatures(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(mr.PRELOAD)}getUseInterimTilesOnError(){return this.get(mr.USE_INTERIM_TILES_ON_ERROR)}setPreload(e){this.set(mr.PRELOAD,e)}setUseInterimTilesOnError(e){this.set(mr.USE_INTERIM_TILES_ON_ERROR,e)}}var $u=fk;const dk=[0,0,0],hs=5;class gk{constructor(e){this.minZoom=e.minZoom!==void 0?e.minZoom:0,this.resolutions_=e.resolutions,ne(My(this.resolutions_,function(r,s){return s-r},!0),17);let t;if(!e.origins){for(let r=0,s=this.resolutions_.length-1;r<s;++r)if(!t)t=this.resolutions_[r]/this.resolutions_[r+1];else if(this.resolutions_[r]/this.resolutions_[r+1]!==t){t=void 0;break}}this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,ne(this.origins_.length==this.resolutions_.length,20));const i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Xn(i)),ne(!this.origin_&&this.origins_||this.origin_&&!this.origins_,18),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,ne(this.tileSizes_.length==this.resolutions_.length,19)),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:so,ne(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,22),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes!==void 0?this.fullTileRanges_=e.sizes.map(function(r,s){const o=new eu(Math.min(0,r[0]),Math.max(r[0]-1,-1),Math.min(0,r[1]),Math.max(r[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,s);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o},this):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,i){const r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)i([t,s,a])}forEachTileCoordParentTileRange(e,t,i,r){let s,o,a,l=null,u=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);u>=this.minZoom;){if(this.zoomFactor_===2?(o=Math.floor(o/2),a=Math.floor(a/2),s=lo(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,u,i),t(u,s))return!0;--u}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,i){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){const s=e[1]*2,o=e[2]*2;return lo(s,s+1,o,o+1,t)}const r=this.getTileCoordExtent(e,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,i){if(t>this.maxZoom||t<this.minZoom)return null;const r=e[0],s=e[1],o=e[2];if(t===r)return lo(s,o,s,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,t-r),u=Math.floor(s*l),c=Math.floor(o*l);if(t<r)return lo(u,u,c,c,i);const h=Math.floor(l*(s+1))-1,f=Math.floor(l*(o+1))-1;return lo(u,h,c,f,i)}const a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,i)}getTileRangeExtent(e,t,i){const r=this.getOrigin(e),s=this.getResolution(e),o=tt(this.getTileSize(e),this.tmpSize_),a=r[0]+t.minX*o[0]*s,l=r[0]+(t.maxX+1)*o[0]*s,u=r[1]+t.minY*o[1]*s,c=r[1]+(t.maxY+1)*o[1]*s;return Cn(a,u,l,c,i)}getTileRangeForExtentAndZ(e,t,i){const r=dk;this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,r);const s=r[1],o=r[2];return this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,r),lo(s,r[1],o,r[2],i)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),i=this.getResolution(e[0]),r=tt(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*i,t[1]-(e[2]+.5)*r[1]*i]}getTileCoordExtent(e,t){const i=this.getOrigin(e[0]),r=this.getResolution(e[0]),s=tt(this.getTileSize(e[0]),this.tmpSize_),o=i[0]+e[1]*s[0]*r,a=i[1]-(e[2]+1)*s[1]*r,l=o+s[0]*r,u=a+s[1]*r;return Cn(o,a,l,u,t)}getTileCoordForCoordAndResolution(e,t,i){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,i)}getTileCoordForXYAndResolution_(e,t,i,r,s){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),u=tt(this.getTileSize(o),this.tmpSize_);let c=a*(e-l[0])/i/u[0],h=a*(l[1]-t)/i/u[1];return r?(c=sr(c,hs)-1,h=sr(h,hs)-1):(c=Qs(c,hs),h=Qs(h,hs)),_a(o,c,h,s)}getTileCoordForXYAndZ_(e,t,i,r,s){const o=this.getOrigin(i),a=this.getResolution(i),l=tt(this.getTileSize(i),this.tmpSize_);let u=(e-o[0])/a/l[0],c=(o[1]-t)/a/l[1];return r?(u=sr(u,hs)-1,c=sr(c,hs)-1):(u=Qs(u,hs),c=Qs(c,hs)),_a(i,u,c,s)}getTileCoordForCoordAndZ(e,t,i){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,i)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){const i=bl(this.resolutions_,e,t||0);return ye(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Lg(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,i=new Array(t);for(let r=this.minZoom;r<t;++r)i[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=i}}var zi=gk,To={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};function Jm(n){let e=n.getDefaultTileGrid();return e||(e=dT(n),n.setDefaultTileGrid(e)),e}function cT(n,e,t){const i=e[0],r=n.getTileCoordCenter(e),s=yr(t);if(jn(s,r))return e;{const o=_e(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,n.getTileCoordForCoordAndZ(r,i)}}function hT(n,e,t,i){i=i!==void 0?i:"top-left";const r=fT(n,e,t);return new zi({extent:n,origin:qy(n,i),resolutions:r,tileSize:t})}function So(n){const e=n||{},t=e.extent||J("EPSG:3857").getExtent(),i={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:fT(t,e.maxZoom,e.tileSize,e.maxResolution)};return new zi(i)}function fT(n,e,t,i){e=e!==void 0?e:qg,t=tt(t!==void 0?t:so);const r=Xe(n),s=_e(n);i=i>0?i:Math.max(s/t[0],r/t[1]);const o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function dT(n,e,t,i){const r=yr(n);return hT(r,e,t,i)}function yr(n){n=J(n);let e=n.getExtent();if(!e){const t=180*Yn.degrees/n.getMetersPerUnit();e=Cn(-t,-t,t,t)}return e}class pk extends Na{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.opaque_=e.opaque!==void 0?e.opaque:!1,this.tilePixelRatio_=e.tilePixelRatio!==void 0?e.tilePixelRatio:1,this.tileGrid=e.tileGrid!==void 0?e.tileGrid:null;const t=[256,256];this.tileGrid&&tt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tileCache=new Ql(e.cacheSize||0),this.tmpSize=[0,0],this.key_=e.key||"",this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(e,t){const i=this.getTileCacheForProjection(e);i&&i.expireCache(t)}forEachLoadedTile(e,t,i,r){const s=this.getTileCacheForProjection(e);if(!s)return!1;let o=!0,a,l,u;for(let c=i.minX;c<=i.maxX;++c)for(let h=i.minY;h<=i.maxY;++h)l=$i(t,c,h),u=!1,s.containsKey(l)&&(a=s.get(l),u=a.getState()===V.LOADED,u&&(u=r(a)!==!1)),u||(o=!1);return o}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getOpaque(e){return this.opaque_}getResolutions(){return this.tileGrid?this.tileGrid.getResolutions():null}getTile(e,t,i,r,s){return ae()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Jm(e)}getTileCacheForProjection(e){const t=this.getProjection();return ne(t===null||fn(t,e),68),this.tileCache}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,i){const r=this.getTileGridForProjection(i),s=this.getTilePixelRatio(t),o=tt(r.getTileSize(e),this.tmpSize);return s==1?o:wh(o,s,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){t=t!==void 0?t:this.getProjection();const i=this.getTileGridForProjection(t);return this.getWrapX()&&t.isGlobal()&&(e=cT(i,e,t)),Gx(e,i)?e:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(e,t){const i=this.getTileCacheForProjection(t);e>i.highWaterMark&&(i.highWaterMark=e)}useTile(e,t,i,r){}}class Qm extends Ct{constructor(e,t){super(e),this.tile=t}}var Du=pk;function gT(n,e){const t=/\{z\}/g,i=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return n.replace(t,o[0].toString()).replace(i,o[1].toString()).replace(r,o[2].toString()).replace(s,function(){const u=o[0],c=e.getFullTileRange(u);return ne(c,55),(c.getHeight()-o[2]-1).toString()})}}function Af(n,e){const t=n.length,i=new Array(t);for(let r=0;r<t;++r)i[r]=gT(n[r],e);return Va(i)}function Va(n){return n.length===1?n[0]:function(e,t,i){if(e){const r=Sh(e),s=Zn(r,n.length);return n[s](e,t,i)}else return}}function pT(n,e,t){}function Lf(n){const e=[];let t=/\{([a-z])-([a-z])\}/.exec(n);if(t){const i=t[1].charCodeAt(0),r=t[2].charCodeAt(0);let s;for(s=i;s<=r;++s)e.push(n.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(n),t){const i=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=i;r++)e.push(n.replace(t[0],r.toString()));return e}return e.push(n),e}class py extends Du{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===py.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){const t=e.target,i=H(t),r=t.getState();let s;r==V.LOADING?(this.tileLoadingKeys_[i]=!0,s=To.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=r==V.ERROR?To.TILELOADERROR:r==V.LOADED?To.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Qm(s,t))}setTileLoadFunction(e){this.tileCache.clear(),this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,this.tileCache.pruneExceptNewestZ(),typeof t!="undefined"?this.setKey(t):this.changed()}setUrl(e){const t=Lf(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join(`
|
128
|
-
`);this.generateTileUrlFunction_?this.setTileUrlFunction(Af(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,i){}useTile(e,t,i){const r=$i(e,t,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)}}var e_=py;class mk extends e_{constructor(e){const t=e.projection||"EPSG:3857",i=e.extent||yr(t),r=e.tileGrid||So({extent:i,maxResolution:e.maxResolution,maxZoom:e.maxZoom!==void 0?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,opaque:!1,projection:t,state:e.state,tileGrid:r,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:t_,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0?!0:e.wrapX,transition:e.transition,zDirection:e.zDirection===void 0?1:e.zDirection}),this.format_=e.format?e.format:null,this.sourceTileCache=new Ql(this.tileCache.highWaterMark),this.overlaps_=e.overlaps==null?!0:e.overlaps,this.tileClass=e.tileClass?e.tileClass:yp,this.tileGrids_={}}getFeaturesInExtent(e){const t=[],i=this.tileCache;if(i.getCount()===0)return t;const r=mp(i.peekFirstKey())[0],s=this.tileGrid;return i.forEach(function(o){if(o.tileCoord[0]!==r||o.getState()!==V.LOADED)return;const a=o.getSourceTiles();for(let l=0,u=a.length;l<u;++l){const c=a[l],h=c.tileCoord;if(Je(e,s.getTileCoordExtent(h))){const f=c.getFeatures();if(f)for(let d=0,g=f.length;d<g;++d){const m=f[d],p=m.getGeometry();Je(e,p.getExtent())&&t.push(m)}}}}),t}getOverlaps(){return this.overlaps_}clear(){this.tileCache.clear(),this.sourceTileCache.clear()}expireCache(e,t){const i=this.getTileCacheForProjection(e),r=Object.keys(t).reduce((s,o)=>{const a=kx(o),l=i.peek(a);if(l){const u=l.sourceTiles;for(let c=0,h=u.length;c<h;++c)s[u[c].getKey()]=!0}return s},{});super.expireCache(e,t),this.sourceTileCache.expireCache(r)}getSourceTiles(e,t,i){if(i.getState()===V.IDLE){i.setState(V.LOADING);const r=i.wrappedTileCoord,s=this.getTileGridForProjection(t),o=s.getTileCoordExtent(r),a=r[0],l=s.getResolution(a);hn(o,-l,o);const u=this.tileGrid,c=u.getExtent();c&&zt(o,c,o);const h=u.getZForResolution(l,this.zDirection);u.forEachTileCoord(o,h,f=>{const d=this.tileUrlFunction(f,e,t),g=this.sourceTileCache.containsKey(d)?this.sourceTileCache.get(d):new this.tileClass(f,d?V.IDLE:V.EMPTY,d,this.format_,this.tileLoadFunction);i.sourceTiles.push(g);const m=g.getState();if(m<V.LOADED){const p=_=>{this.handleTileChange(_);const v=g.getState();if(v===V.LOADED||v===V.ERROR){const x=g.getKey();x in i.errorTileKeys?g.getState()===V.LOADED&&delete i.errorTileKeys[x]:i.loadingSourceTiles--,v===V.ERROR?i.errorTileKeys[x]=!0:g.removeEventListener(K.CHANGE,p),i.loadingSourceTiles===0&&i.setState(oi(i.errorTileKeys)?V.LOADED:V.ERROR)}};g.addEventListener(K.CHANGE,p),i.loadingSourceTiles++}m===V.IDLE&&(g.extent=u.getTileCoordExtent(f),g.projection=t,g.resolution=u.getResolution(f[0]),this.sourceTileCache.set(d,g),g.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(f=>f.getState()===V.ERROR)?V.ERROR:V.LOADED)}return i.sourceTiles}getTile(e,t,i,r,s){const o=$i(e,t,i),a=this.getKey();let l;if(this.tileCache.containsKey(o)&&(l=this.tileCache.get(o),l.key===a))return l;const u=[e,t,i];let c=this.getTileCoordForTileUrlFunction(u,s);const h=this.getTileGrid().getExtent(),f=this.getTileGridForProjection(s);if(c&&h){const m=f.getTileCoordExtent(c);hn(m,-f.getResolution(e),m),Je(h,m)||(c=null)}let d=!0;if(c!==null){const m=this.tileGrid,p=f.getResolution(e),_=m.getZForResolution(p,1),v=f.getTileCoordExtent(c);hn(v,-p,v),m.forEachTileCoord(v,_,function(x){d=d&&!this.tileUrlFunction(x,r,s)}.bind(this))}const g=new _p(u,d?V.EMPTY:V.IDLE,c,this.getSourceTiles.bind(this,r,s));return g.key=a,l?(g.interimTile=l,g.refreshInterimChain(),this.tileCache.replace(o,g)):this.tileCache.set(o,g),g}getTileGridForProjection(e){const t=e.getCode();let i=this.tileGrids_[t];if(!i){const r=this.tileGrid,s=r.getResolutions().slice(),o=s.map(function(u,c){return r.getOrigin(c)}),a=s.map(function(u,c){return r.getTileSize(c)}),l=qg+1;for(let u=s.length;u<l;++u)s.push(s[u-1]/2),o.push(o[u-1]),a.push(a[u-1]);i=new zi({extent:r.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[t]=i}return i}getTilePixelRatio(e){return e}getTilePixelSize(e,t,i){const r=this.getTileGridForProjection(i),s=tt(r.getTileSize(e),this.tmpSize);return[Math.round(s[0]*t),Math.round(s[1]*t)]}updateCacheSize(e,t){super.updateCacheSize(e*2,t),this.sourceTileCache.highWaterMark=this.getTileCacheForProjection(t).highWaterMark}}var Pf=mk;function t_(n,e){n.setLoader(function(t,i,r){wp(e,n.getFormat(),t,i,r,n.onLoad.bind(n),n.onError.bind(n))})}class _k extends e_{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,opaque:e.opaque,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:yk,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate!==void 0?e.interpolate:!0,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin!==void 0?e.crossOrigin:null,this.tileClass=e.tileClass!==void 0?e.tileClass:no,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const e in this.tileCacheForProjection)if(this.tileCacheForProjection[e].canExpireCache())return!0;return!1}expireCache(e,t){const i=this.getTileCacheForProjection(e);this.tileCache.expireCache(this.tileCache==i?t:{});for(const r in this.tileCacheForProjection){const s=this.tileCacheForProjection[r];s.expireCache(s==i?t:{})}}getGutterForProjection(e){return this.getProjection()&&e&&!fn(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getOpaque(e){return this.getProjection()&&e&&!fn(this.getProjection(),e)?!1:super.getOpaque(e)}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||fn(t,e)))return this.tileGrid;{const i=H(e);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Jm(e)),this.tileGridForProjection[i]}}getTileCacheForProjection(e){const t=this.getProjection();if(!t||fn(t,e))return this.tileCache;{const i=H(e);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Ql(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}}createTile_(e,t,i,r,s,o){const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,s),u=l?this.tileUrlFunction(l,r,s):void 0,c=new this.tileClass(a,u!==void 0?V.IDLE:V.EMPTY,u!==void 0?u:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(K.CHANGE,this.handleTileChange.bind(this)),c}getTile(e,t,i,r,s){const o=this.getProjection();if(!o||!s||fn(o,s))return this.getTileInternal(e,t,i,r,o||s);{const a=this.getTileCacheForProjection(s),l=[e,t,i];let u;const c=ya(l);a.containsKey(c)&&(u=a.get(c));const h=this.getKey();if(u&&u.key==h)return u;{const f=this.getTileGridForProjection(o),d=this.getTileGridForProjection(s),g=this.getTileCoordForTileUrlFunction(l,s),m=new wo(o,f,s,d,l,g,this.getTilePixelRatio(r),this.getGutter(),function(p,_,v,x){return this.getTileInternal(p,_,v,x,o)}.bind(this),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.getInterpolate());return m.key=h,u?(m.interimTile=u,m.refreshInterimChain(),a.replace(c,m)):a.set(c,m),m}}}getTileInternal(e,t,i,r,s){let o=null;const a=$i(e,t,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(e,t,i,r,s,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const u=o;o=this.createTile_(e,t,i,r,s,l),u.getState()==V.IDLE?o.interimTile=u.interimTile:o.interimTile=u,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(e){if(this.renderReprojectionEdges_!=e){this.renderReprojectionEdges_=e;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(e,t){const i=J(e);if(i){const r=H(i);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}clear(){super.clear();for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear()}}function yk(n,e){n.getImage().src=e}var Vi=_k;function Nu(n,e,t,i){const r=document.createElement("script"),s="olc_"+H(e);function o(){delete window[s],r.parentNode.removeChild(r)}r.async=!0,r.src=n+(n.includes("?")?"&":"?")+(i||"callback")+"="+s;const a=setTimeout(function(){o(),t&&t()},1e4);window[s]=function(l){clearTimeout(a),o(),e(l)},document.head.appendChild(r)}class mT extends Error{constructor(e){const t="Unexpected response status: "+e.status;super(t),this.name="ResponseError",this.response=e}}class _T extends Error{constructor(e){super("Failed to issue request"),this.name="ClientError",this.client=e}}function n_(n){return new Promise(function(e,t){function i(o){const a=o.target;if(!a.status||a.status>=200&&a.status<300){let l;try{l=JSON.parse(a.responseText)}catch(u){const c="Error parsing response text as JSON: "+u.message;t(new Error(c));return}e(l);return}t(new mT(a))}function r(o){t(new _T(o.target))}const s=new XMLHttpRequest;s.addEventListener("load",i),s.addEventListener("error",r),s.open("GET",n),s.setRequestHeader("Accept","application/json"),s.send()})}function i_(n,e){return e.includes("://")?e:new URL(e,n).href}let yT;function vk(n){typeof XMLHttpRequest!="undefined"&&(yT=XMLHttpRequest),global.XMLHttpRequest=n}function xk(){global.XMLHttpRequest=yT}class Ek extends Vi{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:J("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)Nu(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else e.tileJSON?this.handleTileJSONResponse(e.tileJSON):ne(!1,51)}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let i;try{i=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(i)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=J("EPSG:4326"),i=this.getProjection();let r;if(e.bounds!==void 0){const u=Un(t,i);r=Zs(e.bounds,u)}const s=yr(i),o=e.minzoom||0,a=e.maxzoom||22,l=So({extent:s,maxZoom:a,minZoom:o,tileSize:this.tileSize_});if(this.tileGrid=l,this.tileUrlFunction=Af(e.tiles,l),e.attribution&&!this.getAttributions()){const u=r!==void 0?r:s;this.setAttributions(function(c){return Je(u,c.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}}var vT=Ek;class wk extends Fm{constructor(e){super(e)}createRenderer(){return new qm(this)}}var xT=wk,Tk={},ET,wT={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function ku(n){return n=Math.round(n),n<0?0:n>255?255:n}function TT(n){return n<0?0:n>1?1:n}function r_(n){return n[n.length-1]==="%"?ku(parseFloat(n)/100*255):ku(parseInt(n))}function Mf(n){return n[n.length-1]==="%"?TT(parseFloat(n)/100):TT(parseFloat(n))}function s_(n,e,t){return t<0?t+=1:t>1&&(t-=1),t*6<1?n+(e-n)*t*6:t*2<1?e:t*3<2?n+(e-n)*(2/3-t)*6:n}function Sk(n){var e=n.replace(/ /g,"").toLowerCase();if(e in wT)return wT[e].slice();if(e[0]==="#"){if(e.length===4){var t=parseInt(e.substr(1),16);return t>=0&&t<=4095?[(t&3840)>>4|(t&3840)>>8,t&240|(t&240)>>4,t&15|(t&15)<<4,1]:null}else if(e.length===7){var t=parseInt(e.substr(1),16);return t>=0&&t<=16777215?[(t&16711680)>>16,(t&65280)>>8,t&255,1]:null}return null}var i=e.indexOf("("),r=e.indexOf(")");if(i!==-1&&r+1===e.length){var s=e.substr(0,i),o=e.substr(i+1,r-(i+1)).split(","),a=1;switch(s){case"rgba":if(o.length!==4)return null;a=Mf(o.pop());case"rgb":return o.length!==3?null:[r_(o[0]),r_(o[1]),r_(o[2]),a];case"hsla":if(o.length!==4)return null;a=Mf(o.pop());case"hsl":if(o.length!==3)return null;var l=(parseFloat(o[0])%360+360)%360/360,u=Mf(o[1]),c=Mf(o[2]),h=c<=.5?c*(u+1):c+u-c*u,f=c*2-h;return[ku(s_(f,h,l+1/3)*255),ku(s_(f,h,l)*255),ku(s_(f,h,l-1/3)*255),a];default:return null}}return null}try{ET=Tk.parseCSSColor=Sk}catch{}var qe=function(e,t,i,r){r===void 0&&(r=1),this.r=e,this.g=t,this.b=i,this.a=r};qe.parse=function(e){if(!!e){if(e instanceof qe)return e;if(typeof e=="string"){var t=ET(e);if(!!t)return new qe(t[0]/255*t[3],t[1]/255*t[3],t[2]/255*t[3],t[3])}}},qe.prototype.toString=function(){var e=this.toArray(),t=e[0],i=e[1],r=e[2],s=e[3];return"rgba("+Math.round(t)+","+Math.round(i)+","+Math.round(r)+","+s+")"},qe.prototype.toArray=function(){var e=this,t=e.r,i=e.g,r=e.b,s=e.a;return s===0?[0,0,0,0]:[t*255/s,i*255/s,r*255/s,s]},qe.prototype.toArray01=function(){var e=this,t=e.r,i=e.g,r=e.b,s=e.a;return s===0?[0,0,0,0]:[t/s,i/s,r/s,s]},qe.prototype.toArray01PremultipliedAlpha=function(){var e=this,t=e.r,i=e.g,r=e.b,s=e.a;return[t,i,r,s]},qe.black=new qe(0,0,0,1),qe.white=new qe(1,1,1,1),qe.transparent=new qe(0,0,0,0),qe.red=new qe(1,0,0,1),qe.blue=new qe(0,0,1,1);function Gu(n){return typeof n=="object"?["literal",n]:n}function bk(n,e){var t=n.stops;if(!t)return Rk(n,e);var i=t&&typeof t[0][0]=="object",r=i||n.property!==void 0,s=i||!r;return t=t.map(function(o){return!r&&e.tokens&&typeof o[1]=="string"?[o[0],Lk(o[1])]:[o[0],Gu(o[1])]}),i?Ck(n,e,t):s?Ak(n,e,t):a_(n,e,t)}function Rk(n,e){var t=["get",n.property];if(n.default===void 0)return e.type==="string"?["string",t]:t;if(e.type==="enum")return["match",t,Object.keys(e.values),t,n.default];var i=[e.type==="color"?"to-color":e.type,t,Gu(n.default)];return e.type==="array"&&i.splice(1,0,e.value,e.length||null),i}function o_(n){switch(n.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function Ck(n,e,t){for(var i={},r={},s=[],o=0;o<t.length;o++){var a=t[o],l=a[0].zoom;i[l]===void 0&&(i[l]={zoom:l,type:n.type,property:n.property,default:n.default},r[l]=[],s.push(l)),r[l].push([a[0].value,a[1]])}var u=u_({},e);if(u==="exponential"){for(var c=[o_(n),["linear"],["zoom"]],h=0,f=s;h<f.length;h+=1){var d=f[h],g=a_(i[d],e,r[d]);ja(c,d,g,!1)}return c}else{for(var m=["step",["zoom"]],p=0,_=s;p<_.length;p+=1){var v=_[p],x=a_(i[v],e,r[v]);ja(m,v,x,!0)}return l_(m),m}}function Ik(n,e){if(n!==void 0)return n;if(e!==void 0)return e}function ST(n,e){var t=Gu(Ik(n.default,e.default));return t===void 0&&e.type==="resolvedImage"?"":t}function a_(n,e,t){var i=u_(n,e),r=["get",n.property];if(i==="categorical"&&typeof t[0][0]=="boolean"){for(var s=["case"],o=0,a=t;o<a.length;o+=1){var l=a[o];s.push(["==",r,l[0]],l[1])}return s.push(ST(n,e)),s}else if(i==="categorical"){for(var u=["match",r],c=0,h=t;c<h.length;c+=1){var f=h[c];ja(u,f[0],f[1],!1)}return u.push(ST(n,e)),u}else if(i==="interval"){for(var d=["step",["number",r]],g=0,m=t;g<m.length;g+=1){var p=m[g];ja(d,p[0],p[1],!0)}return l_(d),n.default===void 0?d:["case",["==",["typeof",r],"number"],d,Gu(n.default)]}else if(i==="exponential"){for(var _=n.base!==void 0?n.base:1,v=[o_(n),_===1?["linear"]:["exponential",_],["number",r]],x=0,y=t;x<y.length;x+=1){var T=y[x];ja(v,T[0],T[1],!1)}return n.default===void 0?v:["case",["==",["typeof",r],"number"],v,Gu(n.default)]}else throw new Error("Unknown property function type "+i)}function Ak(n,e,t,i){i===void 0&&(i=["zoom"]);var r=u_(n,e),s,o=!1;if(r==="interval")s=["step",i],o=!0;else if(r==="exponential"){var a=n.base!==void 0?n.base:1;s=[o_(n),a===1?["linear"]:["exponential",a],i]}else throw new Error('Unknown zoom function type "'+r+'"');for(var l=0,u=t;l<u.length;l+=1){var c=u[l];ja(s,c[0],c[1],o)}return l_(s),s}function l_(n){n[0]==="step"&&n.length===3&&(n.push(0),n.push(n[3]))}function ja(n,e,t,i){n.length>3&&e===n[n.length-2]||(i&&n.length===2||n.push(e),n.push(t))}function u_(n,e){return n.type?n.type:e.expression.interpolated?"exponential":"interval"}function Lk(n){for(var e=["concat"],t=/{([^{}]+)}/g,i=0,r=t.exec(n);r!==null;r=t.exec(n)){var s=n.slice(i,t.lastIndex-r[0].length);i=t.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(e.length===1)return n;if(i<n.length)e.push(n.slice(i));else if(e.length===2)return["to-string",e[1]];return e}var ji=function(n){function e(t,i){n.call(this,i),this.message=i,this.key=t}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e}(Error),Uu=function(e,t){t===void 0&&(t=[]),this.parent=e,this.bindings={};for(var i=0,r=t;i<r.length;i+=1){var s=r[i],o=s[0],a=s[1];this.bindings[o]=a}};Uu.prototype.concat=function(e){return new Uu(this,e)},Uu.prototype.get=function(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(e+" not found in scope.")},Uu.prototype.has=function(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1};var Ff={kind:"null"},W={kind:"number"},Ae={kind:"string"},Te={kind:"boolean"},vr={kind:"color"},Xa={kind:"object"},Se={kind:"value"},Pk={kind:"error"},Of={kind:"collator"},$f={kind:"formatted"},Bu={kind:"resolvedImage"};function ei(n,e){return{kind:"array",itemType:n,N:e}}function ht(n){if(n.kind==="array"){var e=ht(n.itemType);return typeof n.N=="number"?"array<"+e+", "+n.N+">":n.itemType.kind==="value"?"array":"array<"+e+">"}else return n.kind}var Mk=[Ff,W,Ae,Te,vr,$f,Xa,ei(Se),Bu];function zu(n,e){if(e.kind==="error")return null;if(n.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!zu(n.itemType,e.itemType))&&(typeof n.N!="number"||n.N===e.N))return null}else{if(n.kind===e.kind)return null;if(n.kind==="value")for(var t=0,i=Mk;t<i.length;t+=1){var r=i[t];if(!zu(r,e))return null}}return"Expected "+ht(n)+" but found "+ht(e)+" instead."}function c_(n,e){return e.some(function(t){return t.kind===n.kind})}function Vu(n,e){return e.some(function(t){return t==="null"?n===null:t==="array"?Array.isArray(n):t==="object"?n&&!Array.isArray(n)&&typeof n=="object":t===typeof n})}var ju=function(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};ju.prototype.compare=function(e,t){return this.collator.compare(e,t)},ju.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var h_=function(e,t,i,r,s){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=s},Fn=function(e){this.sections=e};Fn.fromString=function(e){return new Fn([new h_(e,null,null,null,null)])},Fn.prototype.isEmpty=function(){return this.sections.length===0?!0:!this.sections.some(function(e){return e.text.length!==0||e.image&&e.image.name.length!==0})},Fn.factory=function(e){return e instanceof Fn?e:Fn.fromString(e)},Fn.prototype.toString=function(){return this.sections.length===0?"":this.sections.map(function(e){return e.text}).join("")},Fn.prototype.serialize=function(){for(var e=["format"],t=0,i=this.sections;t<i.length;t+=1){var r=i[t];if(r.image){e.push(["image",r.image.name]);continue}e.push(r.text);var s={};r.fontStack&&(s["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(s["font-scale"]=r.scale),r.textColor&&(s["text-color"]=["rgba"].concat(r.textColor.toArray())),e.push(s)}return e};var Xi=function(e){this.name=e.name,this.available=e.available};Xi.prototype.toString=function(){return this.name},Xi.fromString=function(e){return e?new Xi({name:e,available:!1}):null},Xi.prototype.serialize=function(){return["image",this.name]};function bT(n,e,t,i){if(!(typeof n=="number"&&n>=0&&n<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255)){var r=typeof i=="number"?[n,e,t,i]:[n,e,t];return"Invalid rgba value ["+r.join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}return typeof i=="undefined"||typeof i=="number"&&i>=0&&i<=1?null:"Invalid rgba value ["+[n,e,t,i].join(", ")+"]: 'a' must be between 0 and 1."}function Df(n){if(n===null)return!0;if(typeof n=="string")return!0;if(typeof n=="boolean")return!0;if(typeof n=="number")return!0;if(n instanceof qe)return!0;if(n instanceof ju)return!0;if(n instanceof Fn)return!0;if(n instanceof Xi)return!0;if(Array.isArray(n)){for(var e=0,t=n;e<t.length;e+=1){var i=t[e];if(!Df(i))return!1}return!0}else if(typeof n=="object"){for(var r in n)if(!Df(n[r]))return!1;return!0}else return!1}function Gt(n){if(n===null)return Ff;if(typeof n=="string")return Ae;if(typeof n=="boolean")return Te;if(typeof n=="number")return W;if(n instanceof qe)return vr;if(n instanceof ju)return Of;if(n instanceof Fn)return $f;if(n instanceof Xi)return Bu;if(Array.isArray(n)){for(var e=n.length,t,i=0,r=n;i<r.length;i+=1){var s=r[i],o=Gt(s);if(!t)t=o;else{if(t===o)continue;t=Se;break}}return ei(t||Se,e)}else return Xa}function Xu(n){var e=typeof n;return n===null?"":e==="string"||e==="number"||e==="boolean"?String(n):n instanceof qe||n instanceof Fn||n instanceof Xi?n.toString():JSON.stringify(n)}var Yi=function(e,t){this.type=e,this.value=t};Yi.parse=function(e,t){if(e.length!==2)return t.error("'literal' expression requires exactly one argument, but found "+(e.length-1)+" instead.");if(!Df(e[1]))return t.error("invalid value");var i=e[1],r=Gt(i),s=t.expectedType;return r.kind==="array"&&r.N===0&&s&&s.kind==="array"&&(typeof s.N!="number"||s.N===0)&&(r=s),new Yi(r,i)},Yi.prototype.evaluate=function(){return this.value},Yi.prototype.eachChild=function(){},Yi.prototype.outputDefined=function(){return!0},Yi.prototype.serialize=function(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof qe?["rgba"].concat(this.value.toArray()):this.value instanceof Fn?this.value.serialize():this.value};var jt=function(e){this.name="ExpressionEvaluationError",this.message=e};jt.prototype.toJSON=function(){return this.message};var f_={string:Ae,number:W,boolean:Te,object:Xa},vn=function(e,t){this.type=e,this.args=t};vn.parse=function(e,t){if(e.length<2)return t.error("Expected at least one argument.");var i=1,r,s=e[0];if(s==="array"){var o;if(e.length>2){var a=e[1];if(typeof a!="string"||!(a in f_)||a==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);o=f_[a],i++}else o=Se;var l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],i++}r=ei(o,l)}else r=f_[s];for(var u=[];i<e.length;i++){var c=t.parse(e[i],i,Se);if(!c)return null;u.push(c)}return new vn(r,u)},vn.prototype.evaluate=function(e){for(var t=0;t<this.args.length;t++){var i=this.args[t].evaluate(e),r=zu(this.type,Gt(i));if(r){if(t===this.args.length-1)throw new jt("Expected value to be of type "+ht(this.type)+", but found "+ht(Gt(i))+" instead.")}else return i}return null},vn.prototype.eachChild=function(e){this.args.forEach(e)},vn.prototype.outputDefined=function(){return this.args.every(function(e){return e.outputDefined()})},vn.prototype.serialize=function(){var e=this.type,t=[e.kind];if(e.kind==="array"){var i=e.itemType;if(i.kind==="string"||i.kind==="number"||i.kind==="boolean"){t.push(i.kind);var r=e.N;(typeof r=="number"||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map(function(s){return s.serialize()}))};var fs=function(e){this.type=$f,this.sections=e};fs.parse=function(e,t){if(e.length<2)return t.error("Expected at least one argument.");var i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");for(var r=[],s=!1,o=1;o<=e.length-1;++o){var a=e[o];if(s&&typeof a=="object"&&!Array.isArray(a)){s=!1;var l=null;if(a["font-scale"]&&(l=t.parse(a["font-scale"],1,W),!l))return null;var u=null;if(a["text-font"]&&(u=t.parse(a["text-font"],1,ei(Ae)),!u))return null;var c=null;if(a["text-color"]&&(c=t.parse(a["text-color"],1,vr),!c))return null;var h=r[r.length-1];h.scale=l,h.font=u,h.textColor=c}else{var f=t.parse(e[o],1,Se);if(!f)return null;var d=f.type.kind;if(d!=="string"&&d!=="value"&&d!=="null"&&d!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,r.push({content:f,scale:null,font:null,textColor:null})}}return new fs(r)},fs.prototype.evaluate=function(e){var t=function(i){var r=i.content.evaluate(e);return Gt(r)===Bu?new h_("",r,null,null,null):new h_(Xu(r),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)};return new Fn(this.sections.map(t))},fs.prototype.eachChild=function(e){for(var t=0,i=this.sections;t<i.length;t+=1){var r=i[t];e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}},fs.prototype.outputDefined=function(){return!1},fs.prototype.serialize=function(){for(var e=["format"],t=0,i=this.sections;t<i.length;t+=1){var r=i[t];e.push(r.content.serialize());var s={};r.scale&&(s["font-scale"]=r.scale.serialize()),r.font&&(s["text-font"]=r.font.serialize()),r.textColor&&(s["text-color"]=r.textColor.serialize()),e.push(s)}return e};var ds=function(e){this.type=Bu,this.input=e};ds.parse=function(e,t){if(e.length!==2)return t.error("Expected two arguments.");var i=t.parse(e[1],1,Ae);return i?new ds(i):t.error("No image name provided.")},ds.prototype.evaluate=function(e){var t=this.input.evaluate(e),i=Xi.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i},ds.prototype.eachChild=function(e){e(this.input)},ds.prototype.outputDefined=function(){return!1},ds.prototype.serialize=function(){return["image",this.input.serialize()]};var Fk={"to-boolean":Te,"to-color":vr,"to-number":W,"to-string":Ae},ti=function(e,t){this.type=e,this.args=t};ti.parse=function(e,t){if(e.length<2)return t.error("Expected at least one argument.");var i=e[0];if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");for(var r=Fk[i],s=[],o=1;o<e.length;o++){var a=t.parse(e[o],o,Se);if(!a)return null;s.push(a)}return new ti(r,s)},ti.prototype.evaluate=function(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){for(var t,i,r=0,s=this.args;r<s.length;r+=1){var o=s[r];if(t=o.evaluate(e),i=null,t instanceof qe)return t;if(typeof t=="string"){var a=e.parseColor(t);if(a)return a}else if(Array.isArray(t)&&(t.length<3||t.length>4?i="Invalid rbga value "+JSON.stringify(t)+": expected an array containing either three or four numeric values.":i=bT(t[0],t[1],t[2],t[3]),!i))return new qe(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new jt(i||"Could not parse color from value '"+(typeof t=="string"?t:String(JSON.stringify(t)))+"'")}else if(this.type.kind==="number"){for(var l=null,u=0,c=this.args;u<c.length;u+=1){var h=c[u];if(l=h.evaluate(e),l===null)return 0;var f=Number(l);if(!isNaN(f))return f}throw new jt("Could not convert "+JSON.stringify(l)+" to number.")}else return this.type.kind==="formatted"?Fn.fromString(Xu(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Xi.fromString(Xu(this.args[0].evaluate(e))):Xu(this.args[0].evaluate(e))},ti.prototype.eachChild=function(e){this.args.forEach(e)},ti.prototype.outputDefined=function(){return this.args.every(function(e){return e.outputDefined()})},ti.prototype.serialize=function(){if(this.type.kind==="formatted")return new fs([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new ds(this.args[0]).serialize();var e=["to-"+this.type.kind];return this.eachChild(function(t){e.push(t.serialize())}),e};var Ok=["Unknown","Point","LineString","Polygon"],xr=function(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null};xr.prototype.id=function(){return this.feature&&"id"in this.feature&&this.feature.id?this.feature.id:null},xr.prototype.geometryType=function(){return this.feature?typeof this.feature.type=="number"?Ok[this.feature.type]:this.feature.type:null},xr.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},xr.prototype.canonicalID=function(){return this.canonical},xr.prototype.properties=function(){return this.feature&&this.feature.properties||{}},xr.prototype.distanceFromCenter=function(){if(this.featureTileCoord&&this.featureDistanceData){var e=this.featureDistanceData.center,t=this.featureDistanceData.scale,i=this.featureTileCoord,r=i.x,s=i.y,o=r*t-e[0],a=s*t-e[1],l=this.featureDistanceData.bearing[0],u=this.featureDistanceData.bearing[1],c=l*o+u*a;return c}return 0},xr.prototype.parseColor=function(e){var t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=qe.parse(e)),t};var an=function(e,t,i,r){this.name=e,this.type=t,this._evaluate=i,this.args=r};an.prototype.evaluate=function(e){return this._evaluate(e,this.args)},an.prototype.eachChild=function(e){this.args.forEach(e)},an.prototype.outputDefined=function(){return!1},an.prototype.serialize=function(){return[this.name].concat(this.args.map(function(e){return e.serialize()}))},an.parse=function(e,t){var i,r=e[0],s=an.definitions[r];if(!s)return t.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(s)?s[0]:s.type,a=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,l=a.filter(function(P){var U=P[0];return!Array.isArray(U)||U.length===e.length-1}),u=null,c=0,h=l;c<h.length;c+=1){var f=h[c],d=f[0],g=f[1];u=new _s(t.registry,t.path,null,t.scope);for(var m=[],p=!1,_=1;_<e.length;_++){var v=e[_],x=Array.isArray(d)?d[_-1]:d.type,y=u.parse(v,1+m.length,x);if(!y){p=!0;break}m.push(y)}if(!p){if(Array.isArray(d)&&d.length!==m.length){u.error("Expected "+d.length+" arguments, but found "+m.length+" instead.");continue}for(var T=0;T<m.length;T++){var w=Array.isArray(d)?d[T]:d.type,E=m[T];u.concat(T+1).checkSubtype(w,E.type)}if(u.errors.length===0)return new an(r,o,g,m)}}if(l.length===1)(i=t.errors).push.apply(i,u.errors);else{for(var S=l.length?l:a,b=S.map(function(P){var U=P[0];return $k(U)}).join(" | "),R=[],C=1;C<e.length;C++){var M=t.parse(e[C],1+R.length);if(!M)return null;R.push(ht(M.type))}t.error("Expected arguments of type "+b+", but found ("+R.join(", ")+") instead.")}return null},an.register=function(e,t){an.definitions=t;for(var i in t)e[i]=an};function $k(n){return Array.isArray(n)?"("+n.map(ht).join(", ")+")":"("+ht(n.type)+"...)"}var gs=function(e,t,i){this.type=Of,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t};gs.parse=function(e,t){if(e.length!==2)return t.error("Expected one argument.");var i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");var r=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,Te);if(!r)return null;var s=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,Te);if(!s)return null;var o=null;return i.locale&&(o=t.parse(i.locale,1,Ae),!o)?null:new gs(r,s,o)},gs.prototype.evaluate=function(e){return new ju(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)},gs.prototype.eachChild=function(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)},gs.prototype.outputDefined=function(){return!1},gs.prototype.serialize=function(){var e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]};var ps=8192;function d_(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Dk(n){return(180+n)/360}function Nk(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Nf(n,e){return!(n[0]<=e[0]||n[2]>=e[2]||n[1]<=e[1]||n[3]>=e[3])}function kk(n,e){var t=Dk(n[0]),i=Nk(n[1]),r=Math.pow(2,e.z);return[Math.round(t*r*ps),Math.round(i*r*ps)]}function Gk(n,e,t){var i=n[0]-e[0],r=n[1]-e[1],s=n[0]-t[0],o=n[1]-t[1];return i*o-s*r===0&&i*s<=0&&r*o<=0}function Uk(n,e,t){return e[1]>n[1]!=t[1]>n[1]&&n[0]<(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1])+e[0]}function g_(n,e){for(var t=!1,i=0,r=e.length;i<r;i++)for(var s=e[i],o=0,a=s.length;o<a-1;o++){if(Gk(n,s[o],s[o+1]))return!1;Uk(n,s[o],s[o+1])&&(t=!t)}return t}function Bk(n,e){for(var t=0;t<e.length;t++)if(g_(n,e[t]))return!0;return!1}function zk(n,e){return n[0]*e[1]-n[1]*e[0]}function RT(n,e,t,i){var r=n[0]-t[0],s=n[1]-t[1],o=e[0]-t[0],a=e[1]-t[1],l=i[0]-t[0],u=i[1]-t[1],c=r*u-l*s,h=o*u-l*a;return c>0&&h<0||c<0&&h>0}function Vk(n,e,t,i){var r=[e[0]-n[0],e[1]-n[1]],s=[i[0]-t[0],i[1]-t[1]];return zk(s,r)===0?!1:!!(RT(n,e,t,i)&&RT(t,i,n,e))}function jk(n,e,t){for(var i=0,r=t;i<r.length;i+=1)for(var s=r[i],o=0;o<s.length-1;++o)if(Vk(n,e,s[o],s[o+1]))return!0;return!1}function CT(n,e){for(var t=0;t<n.length;++t)if(!g_(n[t],e))return!1;for(var i=0;i<n.length-1;++i)if(jk(n[i],n[i+1],e))return!1;return!0}function Xk(n,e){for(var t=0;t<e.length;t++)if(CT(n,e[t]))return!0;return!1}function p_(n,e,t){for(var i=[],r=0;r<n.length;r++){for(var s=[],o=0;o<n[r].length;o++){var a=kk(n[r][o],t);d_(e,a),s.push(a)}i.push(s)}return i}function IT(n,e,t){for(var i=[],r=0;r<n.length;r++){var s=p_(n[r],e,t);i.push(s)}return i}function AT(n,e,t,i){if(n[0]<t[0]||n[0]>t[2]){var r=i*.5,s=n[0]-t[0]>r?-i:t[0]-n[0]>r?i:0;s===0&&(s=n[0]-t[2]>r?-i:t[2]-n[0]>r?i:0),n[0]+=s}d_(e,n)}function Yk(n){n[0]=n[1]=1/0,n[2]=n[3]=-1/0}function LT(n,e,t,i){var r=Math.pow(2,i.z)*ps,s=[i.x*ps,i.y*ps],o=[];if(!n)return o;for(var a=0,l=n;a<l.length;a+=1)for(var u=l[a],c=0,h=u;c<h.length;c+=1){var f=h[c],d=[f.x+s[0],f.y+s[1]];AT(d,e,t,r),o.push(d)}return o}function PT(n,e,t,i){var r=Math.pow(2,i.z)*ps,s=[i.x*ps,i.y*ps],o=[];if(!n)return o;for(var a=0,l=n;a<l.length;a+=1){for(var u=l[a],c=[],h=0,f=u;h<f.length;h+=1){var d=f[h],g=[d.x+s[0],d.y+s[1]];d_(e,g),c.push(g)}o.push(c)}if(e[2]-e[0]<=r/2){Yk(e);for(var m=0,p=o;m<p.length;m+=1)for(var _=p[m],v=0,x=_;v<x.length;v+=1){var y=x[v];AT(y,e,t,r)}}return o}function Zk(n,e){var t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],r=n.canonicalID();if(!r)return!1;if(e.type==="Polygon"){var s=p_(e.coordinates,i,r),o=LT(n.geometry(),t,i,r);if(!Nf(t,i))return!1;for(var a=0,l=o;a<l.length;a+=1){var u=l[a];if(!g_(u,s))return!1}}if(e.type==="MultiPolygon"){var c=IT(e.coordinates,i,r),h=LT(n.geometry(),t,i,r);if(!Nf(t,i))return!1;for(var f=0,d=h;f<d.length;f+=1){var g=d[f];if(!Bk(g,c))return!1}}return!0}function Wk(n,e){var t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],r=n.canonicalID();if(!r)return!1;if(e.type==="Polygon"){var s=p_(e.coordinates,i,r),o=PT(n.geometry(),t,i,r);if(!Nf(t,i))return!1;for(var a=0,l=o;a<l.length;a+=1){var u=l[a];if(!CT(u,s))return!1}}if(e.type==="MultiPolygon"){var c=IT(e.coordinates,i,r),h=PT(n.geometry(),t,i,r);if(!Nf(t,i))return!1;for(var f=0,d=h;f<d.length;f+=1){var g=d[f];if(!Xk(g,c))return!1}}return!0}var Ei=function(e,t){this.type=Te,this.geojson=e,this.geometries=t};Ei.parse=function(e,t){if(e.length!==2)return t.error("'within' expression requires exactly one argument, but found "+(e.length-1)+" instead.");if(Df(e[1])){var i=e[1];if(i.type==="FeatureCollection")for(var r=0;r<i.features.length;++r){var s=i.features[r].geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Ei(i,i.features[r].geometry)}else if(i.type==="Feature"){var o=i.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new Ei(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new Ei(i,i)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Ei.prototype.evaluate=function(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Zk(e,this.geometries);if(e.geometryType()==="LineString")return Wk(e,this.geometries)}return!1},Ei.prototype.eachChild=function(){},Ei.prototype.outputDefined=function(){return!0},Ei.prototype.serialize=function(){return["within",this.geojson]};function kf(n){if(n instanceof an){if(n.name==="get"&&n.args.length===1)return!1;if(n.name==="feature-state")return!1;if(n.name==="has"&&n.args.length===1)return!1;if(n.name==="properties"||n.name==="geometry-type"||n.name==="id")return!1;if(/^filter-/.test(n.name))return!1}if(n instanceof Ei)return!1;var e=!0;return n.eachChild(function(t){e&&!kf(t)&&(e=!1)}),e}function m_(n){if(n instanceof an&&n.name==="feature-state")return!1;var e=!0;return n.eachChild(function(t){e&&!m_(t)&&(e=!1)}),e}function __(n,e){if(n instanceof an&&e.indexOf(n.name)>=0)return!1;var t=!0;return n.eachChild(function(i){t&&!__(i,e)&&(t=!1)}),t}var ms=function(e,t){this.type=t.type,this.name=e,this.boundExpression=t};ms.parse=function(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");var i=e[1];return t.scope.has(i)?new ms(i,t.scope.get(i)):t.error('Unknown variable "'+i+'". Make sure "'+i+'" has been bound in an enclosing "let" expression before using it.',1)},ms.prototype.evaluate=function(e){return this.boundExpression.evaluate(e)},ms.prototype.eachChild=function(){},ms.prototype.outputDefined=function(){return!1},ms.prototype.serialize=function(){return["var",this.name]};var _s=function(e,t,i,r,s){t===void 0&&(t=[]),r===void 0&&(r=new Uu),s===void 0&&(s=[]),this.registry=e,this.path=t,this.key=t.map(function(o){return"["+o+"]"}).join(""),this.scope=r,this.errors=s,this.expectedType=i};_s.prototype.parse=function(e,t,i,r,s){return s===void 0&&(s={}),t?this.concat(t,i,r)._parse(e,s):this._parse(e,s)},_s.prototype._parse=function(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(c,h,f){return f==="assert"?new vn(h,[c]):f==="coerce"?new ti(h,[c]):c}if(Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=e[0];if(typeof r!="string")return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var s=this.registry[r];if(s){var o=s.parse(e,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,l=o.type;if((a.kind==="string"||a.kind==="number"||a.kind==="boolean"||a.kind==="object"||a.kind==="array")&&l.kind==="value")o=i(o,a,t.typeAnnotation||"assert");else if((a.kind==="color"||a.kind==="formatted"||a.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))o=i(o,a,t.typeAnnotation||"coerce");else if(this.checkSubtype(a,l))return null}if(!(o instanceof Yi)&&o.type.kind!=="resolvedImage"&&y_(o)){var u=new xr;try{o=new Yi(o.type,o.evaluate(u))}catch(c){return this.error(c.message),null}}return o}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}else return typeof e=="undefined"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof e+" instead.")},_s.prototype.concat=function(e,t,i){var r=typeof e=="number"?this.path.concat(e):this.path,s=i?this.scope.concat(i):this.scope;return new _s(this.registry,r,t||null,s,this.errors)},_s.prototype.error=function(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];var r=""+this.key+t.map(function(s){return"["+s+"]"}).join("");this.errors.push(new ji(r,e))},_s.prototype.checkSubtype=function(e,t){var i=zu(e,t);return i&&this.error(i),i};function y_(n){if(n instanceof ms)return y_(n.boundExpression);if(n instanceof an&&n.name==="error")return!1;if(n instanceof gs)return!1;if(n instanceof Ei)return!1;var e=n instanceof ti||n instanceof vn,t=!0;return n.eachChild(function(i){e?t=t&&y_(i):t=t&&i instanceof Yi}),t?kf(n)&&__(n,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]):!1}function MT(n,e){for(var t=n.length-1,i=0,r=t,s=0,o,a;i<=r;)if(s=Math.floor((i+r)/2),o=n[s],a=n[s+1],o<=e){if(s===t||e<a)return s;i=s+1}else if(o>e)r=s-1;else throw new jt("Input is not a number.");return 0}var ys=function(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(var r=0,s=i;r<s.length;r+=1){var o=s[r],a=o[0],l=o[1];this.labels.push(a),this.outputs.push(l)}};ys.parse=function(e,t){if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only "+(e.length-1)+".");if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");var i=t.parse(e[1],1,W);if(!i)return null;var r=[],s=null;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);for(var o=1;o<e.length;o+=2){var a=o===1?-1/0:e[o],l=e[o+1],u=o,c=o+1;if(typeof a!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(r.length&&r[r.length-1][0]>=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var h=t.parse(l,c,s);if(!h)return null;s=s||h.type,r.push([a,h])}return new ys(s,i,r)},ys.prototype.evaluate=function(e){var t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);var r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);var s=t.length;if(r>=t[s-1])return i[s-1].evaluate(e);var o=MT(t,r);return i[o].evaluate(e)},ys.prototype.eachChild=function(e){e(this.input);for(var t=0,i=this.outputs;t<i.length;t+=1){var r=i[t];e(r)}},ys.prototype.outputDefined=function(){return this.outputs.every(function(e){return e.outputDefined()})},ys.prototype.serialize=function(){for(var e=["step",this.input.serialize()],t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e};var Hk=Ya;function Ya(n,e,t,i){this.cx=3*n,this.bx=3*(t-n)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=n,this.p1y=i,this.p2x=t,this.p2y=i}Ya.prototype.sampleCurveX=function(n){return((this.ax*n+this.bx)*n+this.cx)*n},Ya.prototype.sampleCurveY=function(n){return((this.ay*n+this.by)*n+this.cy)*n},Ya.prototype.sampleCurveDerivativeX=function(n){return(3*this.ax*n+2*this.bx)*n+this.cx},Ya.prototype.solveCurveX=function(n,e){typeof e=="undefined"&&(e=1e-6);var t,i,r,s,o;for(r=n,o=0;o<8;o++){if(s=this.sampleCurveX(r)-n,Math.abs(s)<e)return r;var a=this.sampleCurveDerivativeX(r);if(Math.abs(a)<1e-6)break;r=r-s/a}if(t=0,i=1,r=n,r<t)return t;if(r>i)return i;for(;t<i;){if(s=this.sampleCurveX(r),Math.abs(s-n)<e)return r;n>s?t=r:i=r,r=(i-t)*.5+t}return r},Ya.prototype.solve=function(n,e){return this.sampleCurveY(this.solveCurveX(n,e))};function zn(n,e,t){return n*(1-t)+e*t}function Kk(n,e,t){return new qe(zn(n.r,e.r,t),zn(n.g,e.g,t),zn(n.b,e.b,t),zn(n.a,e.a,t))}function qk(n,e,t){return n.map(function(i,r){return zn(i,e[r],t)})}var Jk=Object.freeze({__proto__:null,number:zn,color:Kk,array:qk}),FT=.95047,OT=1,$T=1.08883,DT=4/29,Za=6/29,NT=3*Za*Za,Qk=Za*Za*Za,e3=Math.PI/180,t3=180/Math.PI;function v_(n){return n>Qk?Math.pow(n,1/3):n/NT+DT}function x_(n){return n>Za?n*n*n:NT*(n-DT)}function E_(n){return 255*(n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055)}function w_(n){return n/=255,n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function kT(n){var e=w_(n.r),t=w_(n.g),i=w_(n.b),r=v_((.4124564*e+.3575761*t+.1804375*i)/FT),s=v_((.2126729*e+.7151522*t+.072175*i)/OT),o=v_((.0193339*e+.119192*t+.9503041*i)/$T);return{l:116*s-16,a:500*(r-s),b:200*(s-o),alpha:n.a}}function GT(n){var e=(n.l+16)/116,t=isNaN(n.a)?e:e+n.a/500,i=isNaN(n.b)?e:e-n.b/200;return e=OT*x_(e),t=FT*x_(t),i=$T*x_(i),new qe(E_(3.2404542*t-1.5371385*e-.4985314*i),E_(-.969266*t+1.8760108*e+.041556*i),E_(.0556434*t-.2040259*e+1.0572252*i),n.alpha)}function n3(n,e,t){return{l:zn(n.l,e.l,t),a:zn(n.a,e.a,t),b:zn(n.b,e.b,t),alpha:zn(n.alpha,e.alpha,t)}}function i3(n){var e=kT(n),t=e.l,i=e.a,r=e.b,s=Math.atan2(r,i)*t3;return{h:s<0?s+360:s,c:Math.sqrt(i*i+r*r),l:t,alpha:n.a}}function r3(n){var e=n.h*e3,t=n.c,i=n.l;return GT({l:i,a:Math.cos(e)*t,b:Math.sin(e)*t,alpha:n.alpha})}function s3(n,e,t){var i=e-n;return n+t*(i>180||i<-180?i-360*Math.round(i/360):i)}function o3(n,e,t){return{h:s3(n.h,e.h,t),c:zn(n.c,e.c,t),l:zn(n.l,e.l,t),alpha:zn(n.alpha,e.alpha,t)}}var Gf={forward:kT,reverse:GT,interpolate:n3},Uf={forward:i3,reverse:r3,interpolate:o3},xn=function(e,t,i,r,s){this.type=e,this.operator=t,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(var o=0,a=s;o<a.length;o+=1){var l=a[o],u=l[0],c=l[1];this.labels.push(u),this.outputs.push(c)}};xn.interpolationFactor=function(e,t,i,r){var s=0;if(e.name==="exponential")s=T_(t,e.base,i,r);else if(e.name==="linear")s=T_(t,1,i,r);else if(e.name==="cubic-bezier"){var o=e.controlPoints,a=new Hk(o[0],o[1],o[2],o[3]);s=a.solve(T_(t,1,i,r))}return s},xn.parse=function(e,t){var i=e[0],r=e[1],s=e[2],o=e.slice(3);if(!Array.isArray(r)||r.length===0)return t.error("Expected an interpolation type expression.",1);if(r[0]==="linear")r={name:"linear"};else if(r[0]==="exponential"){var a=r[1];if(typeof a!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:a}}else if(r[0]==="cubic-bezier"){var l=r.slice(1);if(l.length!==4||l.some(function(_){return typeof _!="number"||_<0||_>1}))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:l}}else return t.error("Unknown interpolation type "+String(r[0]),1,0);if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only "+(e.length-1)+".");if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(s=t.parse(s,2,W),!s)return null;var u=[],c=null;i==="interpolate-hcl"||i==="interpolate-lab"?c=vr:t.expectedType&&t.expectedType.kind!=="value"&&(c=t.expectedType);for(var h=0;h<o.length;h+=2){var f=o[h],d=o[h+1],g=h+3,m=h+4;if(typeof f!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(u.length&&u[u.length-1][0]>=f)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',g);var p=t.parse(d,m,c);if(!p)return null;c=c||p.type,u.push([f,p])}return c.kind!=="number"&&c.kind!=="color"&&!(c.kind==="array"&&c.itemType.kind==="number"&&typeof c.N=="number")?t.error("Type "+ht(c)+" is not interpolatable."):new xn(c,i,r,s,u)},xn.prototype.evaluate=function(e){var t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);var r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);var s=t.length;if(r>=t[s-1])return i[s-1].evaluate(e);var o=MT(t,r),a=t[o],l=t[o+1],u=xn.interpolationFactor(this.interpolation,r,a,l),c=i[o].evaluate(e),h=i[o+1].evaluate(e);return this.operator==="interpolate"?Jk[this.type.kind.toLowerCase()](c,h,u):this.operator==="interpolate-hcl"?Uf.reverse(Uf.interpolate(Uf.forward(c),Uf.forward(h),u)):Gf.reverse(Gf.interpolate(Gf.forward(c),Gf.forward(h),u))},xn.prototype.eachChild=function(e){e(this.input);for(var t=0,i=this.outputs;t<i.length;t+=1){var r=i[t];e(r)}},xn.prototype.outputDefined=function(){return this.outputs.every(function(e){return e.outputDefined()})},xn.prototype.serialize=function(){var e;this.interpolation.name==="linear"?e=["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?e=["linear"]:e=["exponential",this.interpolation.base]:e=["cubic-bezier"].concat(this.interpolation.controlPoints);for(var t=[this.operator,e,this.input.serialize()],i=0;i<this.labels.length;i++)t.push(this.labels[i],this.outputs[i].serialize());return t};function T_(n,e,t,i){var r=i-t,s=n-t;return r===0?0:e===1?s/r:(Math.pow(e,s)-1)/(Math.pow(e,r)-1)}var Er=function(e,t){this.type=e,this.args=t};Er.parse=function(e,t){if(e.length<2)return t.error("Expectected at least one argument.");var i=null,r=t.expectedType;r&&r.kind!=="value"&&(i=r);for(var s=[],o=0,a=e.slice(1);o<a.length;o+=1){var l=a[o],u=t.parse(l,1+s.length,i,void 0,{typeAnnotation:"omit"});if(!u)return null;i=i||u.type,s.push(u)}var c=r&&s.some(function(h){return zu(r,h.type)});return c?new Er(Se,s):new Er(i,s)},Er.prototype.evaluate=function(e){for(var t=null,i=0,r,s=0,o=this.args;s<o.length;s+=1){var a=o[s];if(i++,t=a.evaluate(e),t&&t instanceof Xi&&!t.available&&(r||(r=t),t=null,i===this.args.length))return r;if(t!==null)break}return t},Er.prototype.eachChild=function(e){this.args.forEach(e)},Er.prototype.outputDefined=function(){return this.args.every(function(e){return e.outputDefined()})},Er.prototype.serialize=function(){var e=["coalesce"];return this.eachChild(function(t){e.push(t.serialize())}),e};var vs=function(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t};vs.prototype.evaluate=function(e){return this.result.evaluate(e)},vs.prototype.eachChild=function(e){for(var t=0,i=this.bindings;t<i.length;t+=1){var r=i[t];e(r[1])}e(this.result)},vs.parse=function(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found "+(e.length-1)+" instead.");for(var i=[],r=1;r<e.length-1;r+=2){var s=e[r];if(typeof s!="string")return t.error("Expected string, but found "+typeof s+" instead.",r);if(/[^a-zA-Z0-9_]/.test(s))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);var o=t.parse(e[r+1],r+1);if(!o)return null;i.push([s,o])}var a=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return a?new vs(i,a):null},vs.prototype.outputDefined=function(){return this.result.outputDefined()},vs.prototype.serialize=function(){for(var e=["let"],t=0,i=this.bindings;t<i.length;t+=1){var r=i[t],s=r[0],o=r[1];e.push(s,o.serialize())}return e.push(this.result.serialize()),e};var bo=function(e,t,i){this.type=e,this.index=t,this.input=i};bo.parse=function(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found "+(e.length-1)+" instead.");var i=t.parse(e[1],1,W),r=t.parse(e[2],2,ei(t.expectedType||Se));if(!i||!r)return null;var s=r.type;return new bo(s.itemType,i,r)},bo.prototype.evaluate=function(e){var t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new jt("Array index out of bounds: "+t+" < 0.");if(t>=i.length)throw new jt("Array index out of bounds: "+t+" > "+(i.length-1)+".");if(t!==Math.floor(t))throw new jt("Array index must be an integer, but found "+t+" instead.");return i[t]},bo.prototype.eachChild=function(e){e(this.index),e(this.input)},bo.prototype.outputDefined=function(){return!1},bo.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ro=function(e,t){this.type=Te,this.needle=e,this.haystack=t};Ro.parse=function(e,t){if(e.length!==3)return t.error("Expected 2 arguments, but found "+(e.length-1)+" instead.");var i=t.parse(e[1],1,Se),r=t.parse(e[2],2,Se);return!i||!r?null:c_(i.type,[Te,Ae,W,Ff,Se])?new Ro(i,r):t.error("Expected first argument to be of type boolean, string, number or null, but found "+ht(i.type)+" instead")},Ro.prototype.evaluate=function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(i==null)return!1;if(!Vu(t,["boolean","string","number","null"]))throw new jt("Expected first argument to be of type boolean, string, number or null, but found "+ht(Gt(t))+" instead.");if(!Vu(i,["string","array"]))throw new jt("Expected second argument to be of type array or string, but found "+ht(Gt(i))+" instead.");return i.indexOf(t)>=0},Ro.prototype.eachChild=function(e){e(this.needle),e(this.haystack)},Ro.prototype.outputDefined=function(){return!0},Ro.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var xs=function(e,t,i){this.type=W,this.needle=e,this.haystack=t,this.fromIndex=i};xs.parse=function(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found "+(e.length-1)+" instead.");var i=t.parse(e[1],1,Se),r=t.parse(e[2],2,Se);if(!i||!r)return null;if(!c_(i.type,[Te,Ae,W,Ff,Se]))return t.error("Expected first argument to be of type boolean, string, number or null, but found "+ht(i.type)+" instead");if(e.length===4){var s=t.parse(e[3],3,W);return s?new xs(i,r,s):null}else return new xs(i,r)},xs.prototype.evaluate=function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Vu(t,["boolean","string","number","null"]))throw new jt("Expected first argument to be of type boolean, string, number or null, but found "+ht(Gt(t))+" instead.");if(!Vu(i,["string","array"]))throw new jt("Expected second argument to be of type array or string, but found "+ht(Gt(i))+" instead.");if(this.fromIndex){var r=this.fromIndex.evaluate(e);return i.indexOf(t,r)}return i.indexOf(t)},xs.prototype.eachChild=function(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)},xs.prototype.outputDefined=function(){return!1},xs.prototype.serialize=function(){if(this.fromIndex!=null&&this.fromIndex!==void 0){var e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Co=function(e,t,i,r,s,o){this.inputType=e,this.type=t,this.input=i,this.cases=r,this.outputs=s,this.otherwise=o};Co.parse=function(e,t){if(e.length<5)return t.error("Expected at least 4 arguments, but found only "+(e.length-1)+".");if(e.length%2!==1)return t.error("Expected an even number of arguments.");var i,r;t.expectedType&&t.expectedType.kind!=="value"&&(r=t.expectedType);for(var s={},o=[],a=2;a<e.length-1;a+=2){var l=e[a],u=e[a+1];Array.isArray(l)||(l=[l]);var c=t.concat(a);if(l.length===0)return c.error("Expected at least one branch label.");for(var h=0,f=l;h<f.length;h+=1){var d=f[h];if(typeof d!="number"&&typeof d!="string")return c.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if(typeof d=="number"&&Math.floor(d)!==d)return c.error("Numeric branch labels must be integer values.");if(!i)i=Gt(d);else if(c.checkSubtype(i,Gt(d)))return null;if(typeof s[String(d)]!="undefined")return c.error("Branch labels must be unique.");s[String(d)]=o.length}var g=t.parse(u,a,r);if(!g)return null;r=r||g.type,o.push(g)}var m=t.parse(e[1],1,Se);if(!m)return null;var p=t.parse(e[e.length-1],e.length-1,r);return!p||m.type.kind!=="value"&&t.concat(1).checkSubtype(i,m.type)?null:new Co(i,r,m,s,o,p)},Co.prototype.evaluate=function(e){var t=this.input.evaluate(e),i=Gt(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise;return i.evaluate(e)},Co.prototype.eachChild=function(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)},Co.prototype.outputDefined=function(){return this.outputs.every(function(e){return e.outputDefined()})&&this.otherwise.outputDefined()},Co.prototype.serialize=function(){for(var e=this,t=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),r=[],s={},o=0,a=i;o<a.length;o+=1){var l=a[o],u=s[this.cases[l]];u===void 0?(s[this.cases[l]]=r.length,r.push([this.cases[l],[l]])):r[u][1].push(l)}for(var c=function(m){return e.inputType.kind==="number"?Number(m):m},h=0,f=r;h<f.length;h+=1){var d=f[h],u=d[0],g=d[1];g.length===1?t.push(c(g[0])):t.push(g.map(c)),t.push(this.outputs[outputIndex$1].serialize())}return t.push(this.otherwise.serialize()),t};var Io=function(e,t,i){this.type=e,this.branches=t,this.otherwise=i};Io.parse=function(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found only "+(e.length-1)+".");if(e.length%2!==0)return t.error("Expected an odd number of arguments.");var i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);for(var r=[],s=1;s<e.length-1;s+=2){var o=t.parse(e[s],s,Te);if(!o)return null;var a=t.parse(e[s+1],s+1,i);if(!a)return null;r.push([o,a]),i=i||a.type}var l=t.parse(e[e.length-1],e.length-1,i);return l?new Io(i,r,l):null},Io.prototype.evaluate=function(e){for(var t=0,i=this.branches;t<i.length;t+=1){var r=i[t],s=r[0],o=r[1];if(s.evaluate(e))return o.evaluate(e)}return this.otherwise.evaluate(e)},Io.prototype.eachChild=function(e){for(var t=0,i=this.branches;t<i.length;t+=1){var r=i[t],s=r[0],o=r[1];e(s),e(o)}e(this.otherwise)},Io.prototype.outputDefined=function(){return this.branches.every(function(e){e[0];var t=e[1];return t.outputDefined()})&&this.otherwise.outputDefined()},Io.prototype.serialize=function(){var e=["case"];return this.eachChild(function(t){e.push(t.serialize())}),e};var Es=function(e,t,i,r){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=r};Es.parse=function(e,t){if(e.length<=2||e.length>=5)return t.error("Expected 3 or 4 arguments, but found "+(e.length-1)+" instead.");var i=t.parse(e[1],1,Se),r=t.parse(e[2],2,W);if(!i||!r)return null;if(!c_(i.type,[ei(Se),Ae,Se]))return t.error("Expected first argument to be of type array or string, but found "+ht(i.type)+" instead");if(e.length===4){var s=t.parse(e[3],3,W);return s?new Es(i.type,i,r,s):null}else return new Es(i.type,i,r)},Es.prototype.evaluate=function(e){var t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Vu(t,["string","array"]))throw new jt("Expected first argument to be of type array or string, but found "+ht(Gt(t))+" instead.");if(this.endIndex){var r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)},Es.prototype.eachChild=function(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)},Es.prototype.outputDefined=function(){return!1},Es.prototype.serialize=function(){if(this.endIndex!=null&&this.endIndex!==void 0){var e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};function UT(n,e){return n==="=="||n==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function a3(n,e,t){return e===t}function l3(n,e,t){return e!==t}function u3(n,e,t){return e<t}function c3(n,e,t){return e>t}function h3(n,e,t){return e<=t}function f3(n,e,t){return e>=t}function BT(n,e,t,i){return i.compare(e,t)===0}function d3(n,e,t,i){return!BT(n,e,t,i)}function g3(n,e,t,i){return i.compare(e,t)<0}function p3(n,e,t,i){return i.compare(e,t)>0}function m3(n,e,t,i){return i.compare(e,t)<=0}function _3(n,e,t,i){return i.compare(e,t)>=0}function Wa(n,e,t){var i=n!=="=="&&n!=="!=";return function(){function r(s,o,a){this.type=Te,this.lhs=s,this.rhs=o,this.collator=a,this.hasUntypedArgument=s.type.kind==="value"||o.type.kind==="value"}return r.parse=function(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");var l=o[0],u=a.parse(o[1],1,Se);if(!u)return null;if(!UT(l,u.type))return a.concat(1).error('"'+l+`" comparisons are not supported for type '`+ht(u.type)+"'.");var c=a.parse(o[2],2,Se);if(!c)return null;if(!UT(l,c.type))return a.concat(2).error('"'+l+`" comparisons are not supported for type '`+ht(c.type)+"'.");if(u.type.kind!==c.type.kind&&u.type.kind!=="value"&&c.type.kind!=="value")return a.error("Cannot compare types '"+ht(u.type)+"' and '"+ht(c.type)+"'.");i&&(u.type.kind==="value"&&c.type.kind!=="value"?u=new vn(c.type,[u]):u.type.kind!=="value"&&c.type.kind==="value"&&(c=new vn(u.type,[c])));var h=null;if(o.length===4){if(u.type.kind!=="string"&&c.type.kind!=="string"&&u.type.kind!=="value"&&c.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(h=a.parse(o[3],3,Of),!h)return null}return new r(u,c,h)},r.prototype.evaluate=function(o){var a=this.lhs.evaluate(o),l=this.rhs.evaluate(o);if(i&&this.hasUntypedArgument){var u=Gt(a),c=Gt(l);if(u.kind!==c.kind||!(u.kind==="string"||u.kind==="number"))throw new jt('Expected arguments for "'+n+'" to be (string, string) or (number, number), but found ('+u.kind+", "+c.kind+") instead.")}if(this.collator&&!i&&this.hasUntypedArgument){var h=Gt(a),f=Gt(l);if(h.kind!=="string"||f.kind!=="string")return e(o,a,l)}return this.collator?t(o,a,l,this.collator.evaluate(o)):e(o,a,l)},r.prototype.eachChild=function(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)},r.prototype.outputDefined=function(){return!0},r.prototype.serialize=function(){var o=[n];return this.eachChild(function(a){o.push(a.serialize())}),o},r}()}var y3=Wa("==",a3,BT),v3=Wa("!=",l3,d3),x3=Wa("<",u3,g3),E3=Wa(">",c3,p3),w3=Wa("<=",h3,m3),T3=Wa(">=",f3,_3),Ao=function(e,t,i,r,s){this.type=Ae,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=r,this.maxFractionDigits=s};Ao.parse=function(e,t){if(e.length!==3)return t.error("Expected two arguments.");var i=t.parse(e[1],1,W);if(!i)return null;var r=e[2];if(typeof r!="object"||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");var s=null;if(r.locale&&(s=t.parse(r.locale,1,Ae),!s))return null;var o=null;if(r.currency&&(o=t.parse(r.currency,1,Ae),!o))return null;var a=null;if(r["min-fraction-digits"]&&(a=t.parse(r["min-fraction-digits"],1,W),!a))return null;var l=null;return r["max-fraction-digits"]&&(l=t.parse(r["max-fraction-digits"],1,W),!l)?null:new Ao(i,s,o,a,l)},Ao.prototype.evaluate=function(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))},Ao.prototype.eachChild=function(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)},Ao.prototype.outputDefined=function(){return!1},Ao.prototype.serialize=function(){var e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]};var Lo=function(e){this.type=W,this.input=e};Lo.parse=function(e,t){if(e.length!==2)return t.error("Expected 1 argument, but found "+(e.length-1)+" instead.");var i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error("Expected argument of type string or array, but found "+ht(i.type)+" instead."):new Lo(i):null},Lo.prototype.evaluate=function(e){var t=this.input.evaluate(e);if(typeof t=="string")return t.length;if(Array.isArray(t))return t.length;throw new jt("Expected value to be of type string or array, but found "+ht(Gt(t))+" instead.")},Lo.prototype.eachChild=function(e){e(this.input)},Lo.prototype.outputDefined=function(){return!1},Lo.prototype.serialize=function(){var e=["length"];return this.eachChild(function(t){e.push(t.serialize())}),e};var S_={"==":y3,"!=":v3,">":E3,"<":x3,">=":T3,"<=":w3,array:vn,at:bo,boolean:vn,case:Io,coalesce:Er,collator:gs,format:fs,image:ds,in:Ro,"index-of":xs,interpolate:xn,"interpolate-hcl":xn,"interpolate-lab":xn,length:Lo,let:vs,literal:Yi,match:Co,number:vn,"number-format":Ao,object:vn,slice:Es,step:ys,string:vn,"to-boolean":ti,"to-color":ti,"to-number":ti,"to-string":ti,var:ms,within:Ei};function zT(n,e){var t=e[0],i=e[1],r=e[2],s=e[3];t=t.evaluate(n),i=i.evaluate(n),r=r.evaluate(n);var o=s?s.evaluate(n):1,a=bT(t,i,r,o);if(a)throw new jt(a);return new qe(t/255*o,i/255*o,r/255*o,o)}function VT(n,e){return n in e}function b_(n,e){var t=e[n];return typeof t=="undefined"?null:t}function S3(n,e,t,i){for(;t<=i;){var r=t+i>>1;if(e[r]===n)return!0;e[r]>n?i=r-1:t=r+1}return!1}function Po(n){return{type:n}}an.register(S_,{error:[Pk,[Ae],function(n,e){var t=e[0];throw new jt(t.evaluate(n))}],typeof:[Ae,[Se],function(n,e){var t=e[0];return ht(Gt(t.evaluate(n)))}],"to-rgba":[ei(W,4),[vr],function(n,e){var t=e[0];return t.evaluate(n).toArray()}],rgb:[vr,[W,W,W],zT],rgba:[vr,[W,W,W,W],zT],has:{type:Te,overloads:[[[Ae],function(n,e){var t=e[0];return VT(t.evaluate(n),n.properties())}],[[Ae,Xa],function(n,e){var t=e[0],i=e[1];return VT(t.evaluate(n),i.evaluate(n))}]]},get:{type:Se,overloads:[[[Ae],function(n,e){var t=e[0];return b_(t.evaluate(n),n.properties())}],[[Ae,Xa],function(n,e){var t=e[0],i=e[1];return b_(t.evaluate(n),i.evaluate(n))}]]},"feature-state":[Se,[Ae],function(n,e){var t=e[0];return b_(t.evaluate(n),n.featureState||{})}],properties:[Xa,[],function(n){return n.properties()}],"geometry-type":[Ae,[],function(n){return n.geometryType()}],id:[Se,[],function(n){return n.id()}],zoom:[W,[],function(n){return n.globals.zoom}],pitch:[W,[],function(n){return n.globals.pitch||0}],"distance-from-center":[W,[],function(n){return n.distanceFromCenter()}],"heatmap-density":[W,[],function(n){return n.globals.heatmapDensity||0}],"line-progress":[W,[],function(n){return n.globals.lineProgress||0}],"sky-radial-progress":[W,[],function(n){return n.globals.skyRadialProgress||0}],accumulated:[Se,[],function(n){return n.globals.accumulated===void 0?null:n.globals.accumulated}],"+":[W,Po(W),function(n,e){for(var t=0,i=0,r=e;i<r.length;i+=1){var s=r[i];t+=s.evaluate(n)}return t}],"*":[W,Po(W),function(n,e){for(var t=1,i=0,r=e;i<r.length;i+=1){var s=r[i];t*=s.evaluate(n)}return t}],"-":{type:W,overloads:[[[W,W],function(n,e){var t=e[0],i=e[1];return t.evaluate(n)-i.evaluate(n)}],[[W],function(n,e){var t=e[0];return-t.evaluate(n)}]]},"/":[W,[W,W],function(n,e){var t=e[0],i=e[1];return t.evaluate(n)/i.evaluate(n)}],"%":[W,[W,W],function(n,e){var t=e[0],i=e[1];return t.evaluate(n)%i.evaluate(n)}],ln2:[W,[],function(){return Math.LN2}],pi:[W,[],function(){return Math.PI}],e:[W,[],function(){return Math.E}],"^":[W,[W,W],function(n,e){var t=e[0],i=e[1];return Math.pow(t.evaluate(n),i.evaluate(n))}],sqrt:[W,[W],function(n,e){var t=e[0];return Math.sqrt(t.evaluate(n))}],log10:[W,[W],function(n,e){var t=e[0];return Math.log(t.evaluate(n))/Math.LN10}],ln:[W,[W],function(n,e){var t=e[0];return Math.log(t.evaluate(n))}],log2:[W,[W],function(n,e){var t=e[0];return Math.log(t.evaluate(n))/Math.LN2}],sin:[W,[W],function(n,e){var t=e[0];return Math.sin(t.evaluate(n))}],cos:[W,[W],function(n,e){var t=e[0];return Math.cos(t.evaluate(n))}],tan:[W,[W],function(n,e){var t=e[0];return Math.tan(t.evaluate(n))}],asin:[W,[W],function(n,e){var t=e[0];return Math.asin(t.evaluate(n))}],acos:[W,[W],function(n,e){var t=e[0];return Math.acos(t.evaluate(n))}],atan:[W,[W],function(n,e){var t=e[0];return Math.atan(t.evaluate(n))}],min:[W,Po(W),function(n,e){return Math.min.apply(Math,e.map(function(t){return t.evaluate(n)}))}],max:[W,Po(W),function(n,e){return Math.max.apply(Math,e.map(function(t){return t.evaluate(n)}))}],abs:[W,[W],function(n,e){var t=e[0];return Math.abs(t.evaluate(n))}],round:[W,[W],function(n,e){var t=e[0],i=t.evaluate(n);return i<0?-Math.round(-i):Math.round(i)}],floor:[W,[W],function(n,e){var t=e[0];return Math.floor(t.evaluate(n))}],ceil:[W,[W],function(n,e){var t=e[0];return Math.ceil(t.evaluate(n))}],"filter-==":[Te,[Ae,Se],function(n,e){var t=e[0],i=e[1];return n.properties()[t.value]===i.value}],"filter-id-==":[Te,[Se],function(n,e){var t=e[0];return n.id()===t.value}],"filter-type-==":[Te,[Ae],function(n,e){var t=e[0];return n.geometryType()===t.value}],"filter-<":[Te,[Ae,Se],function(n,e){var t=e[0],i=e[1],r=n.properties()[t.value],s=i.value;return typeof r==typeof s&&r<s}],"filter-id-<":[Te,[Se],function(n,e){var t=e[0],i=n.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[Te,[Ae,Se],function(n,e){var t=e[0],i=e[1],r=n.properties()[t.value],s=i.value;return typeof r==typeof s&&r>s}],"filter-id->":[Te,[Se],function(n,e){var t=e[0],i=n.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[Te,[Ae,Se],function(n,e){var t=e[0],i=e[1],r=n.properties()[t.value],s=i.value;return typeof r==typeof s&&r<=s}],"filter-id-<=":[Te,[Se],function(n,e){var t=e[0],i=n.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[Te,[Ae,Se],function(n,e){var t=e[0],i=e[1],r=n.properties()[t.value],s=i.value;return typeof r==typeof s&&r>=s}],"filter-id->=":[Te,[Se],function(n,e){var t=e[0],i=n.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[Te,[Se],function(n,e){var t=e[0];return t.value in n.properties()}],"filter-has-id":[Te,[],function(n){return n.id()!==null&&n.id()!==void 0}],"filter-type-in":[Te,[ei(Ae)],function(n,e){var t=e[0];return t.value.indexOf(n.geometryType())>=0}],"filter-id-in":[Te,[ei(Se)],function(n,e){var t=e[0];return t.value.indexOf(n.id())>=0}],"filter-in-small":[Te,[Ae,ei(Se)],function(n,e){var t=e[0],i=e[1];return i.value.indexOf(n.properties()[t.value])>=0}],"filter-in-large":[Te,[Ae,ei(Se)],function(n,e){var t=e[0],i=e[1];return S3(n.properties()[t.value],i.value,0,i.value.length-1)}],all:{type:Te,overloads:[[[Te,Te],function(n,e){var t=e[0],i=e[1];return t.evaluate(n)&&i.evaluate(n)}],[Po(Te),function(n,e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(!r.evaluate(n))return!1}return!0}]]},any:{type:Te,overloads:[[[Te,Te],function(n,e){var t=e[0],i=e[1];return t.evaluate(n)||i.evaluate(n)}],[Po(Te),function(n,e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.evaluate(n))return!0}return!1}]]},"!":[Te,[Te],function(n,e){var t=e[0];return!t.evaluate(n)}],"is-supported-script":[Te,[Ae],function(n,e){var t=e[0],i=n.globals&&n.globals.isSupportedScript;return i?i(t.evaluate(n)):!0}],upcase:[Ae,[Ae],function(n,e){var t=e[0];return t.evaluate(n).toUpperCase()}],downcase:[Ae,[Ae],function(n,e){var t=e[0];return t.evaluate(n).toLowerCase()}],concat:[Ae,Po(Se),function(n,e){return e.map(function(t){return Xu(t.evaluate(n))}).join("")}],"resolved-locale":[Ae,[Of],function(n,e){var t=e[0];return t.evaluate(n).resolvedLocale()}]});function R_(n){return{result:"success",value:n}}function Ha(n){return{result:"error",value:n}}function b3(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function R3(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function C3(n){return!!n.expression&&n.expression.interpolated}function jT(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}var C_=function(e,t){this.expression=e,this._warningHistory={},this._evaluator=new xr,this._defaultValue=t?P3(t):null,this._enumValues=t&&t.type==="enum"?t.values:null};C_.prototype.evaluateWithoutErrorHandling=function(e,t,i,r,s,o,a,l){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r||null,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=l||null,this.expression.evaluate(this._evaluator)},C_.prototype.evaluate=function(e,t,i,r,s,o,a,l){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=o||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=l||null;try{var u=this.expression.evaluate(this._evaluator);if(u==null||typeof u=="number"&&u!==u)return this._defaultValue;if(this._enumValues&&!(u in this._enumValues))throw new jt("Expected value to be one of "+Object.keys(this._enumValues).map(function(c){return JSON.stringify(c)}).join(", ")+", but found "+JSON.stringify(u)+" instead.");return u}catch(c){return this._warningHistory[c.message]||(this._warningHistory[c.message]=!0,typeof console!="undefined"&&console.warn(c.message)),this._defaultValue}};function I3(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in S_}function I_(n,e){var t=new _s(S_,[],e?L3(e):void 0),i=t.parse(n,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?R_(new C_(i,e)):Ha(t.errors)}var Bf=function(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!m_(t.expression)};Bf.prototype.evaluateWithoutErrorHandling=function(e,t,i,r,s,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,s,o)},Bf.prototype.evaluate=function(e,t,i,r,s,o){return this._styleExpression.evaluate(e,t,i,r,s,o)};var Yu=function(e,t,i,r){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!m_(t.expression),this.interpolationType=r};Yu.prototype.evaluateWithoutErrorHandling=function(e,t,i,r,s,o){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,s,o)},Yu.prototype.evaluate=function(e,t,i,r,s,o){return this._styleExpression.evaluate(e,t,i,r,s,o)},Yu.prototype.interpolationFactor=function(e,t,i){return this.interpolationType?xn.interpolationFactor(this.interpolationType,e,t,i):0};function A3(n,e){if(n=I_(n,e),n.result==="error")return n;var t=n.value.expression,i=kf(t);if(!i&&!b3(e))return Ha([new ji("","data expressions not supported")]);var r=__(t,["zoom","pitch","distance-from-center"]);if(!r&&!R3(e))return Ha([new ji("","zoom expressions not supported")]);var s=zf(t);if(!s&&!r)return Ha([new ji("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof ji)return Ha([s]);if(s instanceof xn&&!C3(e))return Ha([new ji("",'"interpolate" expressions cannot be used with this property')]);if(!s)return R_(i?new Bf("constant",n.value):new Bf("source",n.value));var o=s instanceof xn?s.interpolation:void 0;return R_(i?new Yu("camera",n.value,s.labels,o):new Yu("composite",n.value,s.labels,o))}function zf(n){var e=null;if(n instanceof vs)e=zf(n.result);else if(n instanceof Er)for(var t=0,i=n.args;t<i.length;t+=1){var r=i[t];if(e=zf(r),e)break}else(n instanceof ys||n instanceof xn)&&n.input instanceof an&&n.input.name==="zoom"&&(e=n);return e instanceof ji||n.eachChild(function(s){var o=zf(s);o instanceof ji?e=o:!e&&o?e=new ji("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new ji("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function L3(n){var e={color:vr,string:Ae,number:W,enum:Ae,boolean:Te,formatted:$f,resolvedImage:Bu};return n.type==="array"?ei(e[n.value]||Se,n.length):e[n.type]}function P3(n){return n.type==="color"&&(jT(n.default)||Array.isArray(n.default))?new qe(0,0,0,0):n.type==="color"?qe.parse(n.default)||null:n.default===void 0?null:n.default}function M3(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function A_(n){if(Array.isArray(n))return n.map(A_);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){var e={};for(var t in n)e[t]=A_(n[t]);return e}return M3(n)}var XT={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},projection:{type:"projection"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{},sky:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_symbol:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature","pitch","distance-from-center"]}},filter_fill:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_line:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_circle:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},"filter_fill-extrusion":{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_heatmap:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Camera"},pitch:{group:"Camera"},"distance-from-center":{group:"Camera"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},"sky-radial-progress":{group:"sky"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"high-color":{type:"color","property-type":"data-constant",default:"#245cdf",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"space-color":{type:"color","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,.2,7,.1],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"star-intensity":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],5,.35,6,0],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},projection:{name:{type:"enum",values:{albers:{},equalEarth:{},equirectangular:{},lambertConformalConic:{},mercator:{},naturalEarth:{},winkelTripel:{},globe:{}},default:"mercator",required:!0},center:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-180,-90],maximum:[180,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]},parallels:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-90,-90],maximum:[90,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["source"]}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{type:"array",value:"number",length:2,default:[0,0],minimum:[0,0],maximum:[1,1],transition:!1,requires:[{source:"geojson",has:{lineMetrics:!0}}],"property-type":"constant"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function YT(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(var e=0,t=n.slice(1);e<t.length;e+=1){var i=t[e];if(!YT(i)&&typeof i!="boolean")return!1}return!0;default:return!0}}function F3(n,e){if(e===void 0&&(e="fill"),n==null)return{filter:function(){return!0},needGeometry:!1,needFeature:!1};YT(n)||(n=Vf(n));var t=n,i=!0;try{i=O3(t)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
|
129
|
-
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
|
130
|
-
and paste the contents of this message in the report.
|
131
|
-
Thank you!
|
132
|
-
Filter Expression:
|
133
|
-
`+JSON.stringify(t,null,2)+`
|
134
|
-
`)}var r=XT["filter_"+e],s=I_(i,r),o=null;if(s.result==="error")throw new Error(s.value.map(function(h){return h.key+": "+h.message}).join(", "));o=function(h,f,d){return s.value.evaluate(h,f,{},d)};var a=null,l=null;if(i!==t){var u=I_(t,r);if(u.result==="error")throw new Error(u.value.map(function(h){return h.key+": "+h.message}).join(", "));a=function(h,f,d,g,m){return u.value.evaluate(h,f,{},d,void 0,void 0,g,m)},l=!kf(u.value.expression)}o=o;var c=HT(i);return{filter:o,dynamicFilter:a||void 0,needGeometry:c,needFeature:!!l}}function O3(n){if(!Ka(n))return n;var e=A_(n);return WT(e),e=ZT(e),e}function ZT(n){if(!Array.isArray(n))return n;var e=N3(n);return e===!0?e:e.map(function(t){return ZT(t)})}function WT(n){var e=!1,t=[];if(n[0]==="case"){for(var i=1;i<n.length-1;i+=2)e=e||Ka(n[i]),t.push(n[i+1]);t.push(n[n.length-1])}else if(n[0]==="match"){e=e||Ka(n[1]);for(var r=2;r<n.length-1;r+=2)t.push(n[r+1]);t.push(n[n.length-1])}else if(n[0]==="step"){e=e||Ka(n[1]);for(var s=1;s<n.length-1;s+=2)t.push(n[s+1])}e&&(n.length=0,n.push.apply(n,["any"].concat(t)));for(var o=1;o<n.length;o++)WT(n[o])}function Ka(n){if(!Array.isArray(n))return!1;if($3(n[0]))return!0;for(var e=1;e<n.length;e++){var t=n[e];if(Ka(t))return!0}return!1}function $3(n){return n==="pitch"||n==="distance-from-center"}var D3=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function N3(n){if(D3.has(n[0]))for(var e=1;e<n.length;e++){var t=n[e];if(Ka(t))return!0}return n}function k3(n,e){return n<e?-1:n>e?1:0}function HT(n){if(!Array.isArray(n))return!1;if(n[0]==="within")return!0;for(var e=1;e<n.length;e++)if(HT(n[e]))return!0;return!1}function Vf(n){if(!n)return!0;var e=n[0];if(n.length<=1)return e!=="any";var t=e==="=="?L_(n[1],n[2],"=="):e==="!="?jf(L_(n[1],n[2],"==")):e==="<"||e===">"||e==="<="||e===">="?L_(n[1],n[2],e):e==="any"?G3(n.slice(1)):e==="all"?["all"].concat(n.slice(1).map(Vf)):e==="none"?["all"].concat(n.slice(1).map(Vf).map(jf)):e==="in"?KT(n[1],n.slice(2)):e==="!in"?jf(KT(n[1],n.slice(2))):e==="has"?qT(n[1]):e==="!has"?jf(qT(n[1])):e==="within"?n:!0;return t}function L_(n,e,t){switch(n){case"$type":return["filter-type-"+t,e];case"$id":return["filter-id-"+t,e];default:return["filter-"+t,n,e]}}function G3(n){return["any"].concat(n.map(Vf))}function KT(n,e){if(e.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",n,["literal",e.sort(k3)]]:["filter-in-small",n,["literal",e]]}}function qT(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function jf(n){return["!",n]}var U3=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function B3(n,e){var t={};for(var i in n)i!=="ref"&&(t[i]=n[i]);return U3.forEach(function(r){r in e&&(t[r]=e[r])}),t}function z3(n){n=n.slice();for(var e=Object.create(null),t=0;t<n.length;t++)e[n[t].id]=n[t];for(var i=0;i<n.length;i++)"ref"in n[i]&&(n[i]=B3(n[i],e[n[i].ref]));return n}var JT={thin:100,hairline:100,"ultra-light":100,"extra-light":100,light:200,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,heavy:800,black:800,"extra-bold":800,"ultra-black":900,"extra-black":900,"ultra-bold":900,"heavy-black":900,fat:900,poster:900},Zu=" ",QT=/(italic|oblique)$/i,eS={},P_=function(n,e,t){var i=eS[n];if(!i){Array.isArray(n)||(n=[n]);for(var r=400,s="normal",o=[],a,l,u=0,c=n.length;u<c;++u){var h=n[u],f=h.split(" "),d=f[f.length-1].toLowerCase();d=="normal"||d=="italic"||d=="oblique"?(s=l?s:d,f.pop(),d=f[f.length-1].toLowerCase()):QT.test(d)&&(d=d.replace(QT,""),s=l?s:f[f.length-1].replace(d,""));for(var g in JT){var m=f.length>1?f[f.length-2].toLowerCase():"";if(d==g||d==g.replace("-","")||m+"-"+d==g){r=a?r:JT[g],f.pop(),m&&g.startsWith(m)&&f.pop();break}}!a&&typeof d=="number"&&(r=d);var p=f.join(Zu).replace("Klokantech Noto Sans","Noto Sans");p.indexOf(Zu)!==-1&&(p='"'+p+'"'),o.push(p)}i=eS[n]=[s,r,o]}return i[0]+Zu+i[1]+Zu+e+"px"+(t?"/"+t:"")+Zu+i[2]},tS="https://api.mapbox.com";function M_(n){var e="mapbox://";return n.indexOf(e)!==0?"":n.slice(e.length)}function V3(n,e,t){var i=M_(n);if(!i)return decodeURI(new URL(n,t).href);var r="sprites/";if(i.indexOf(r)!==0)throw new Error("unexpected sprites url: "+n);var s=i.slice(r.length);return tS+"/styles/v1/"+s+"/sprite?access_token="+e}function nS(n,e){var t=M_(n);if(!t)return decodeURI(new URL(n,location.href).href);var i="styles/";if(t.indexOf(i)!==0)throw new Error("unexpected style url: "+n);var r=t.slice(i.length);return tS+"/styles/v1/"+r+"?&access_token="+e}function Xf(n,e,t,i){var r=new URL(n,i),s=M_(n);return s?"https://{a-d}.tiles.mapbox.com/v4/"+s+"/{z}/{x}/{y}.vector.pbf?access_token="+e:(e&&r.searchParams.set(t,e),decodeURI(r.href))}function F_(n){return n*Math.PI/180}var O_=function(){for(var n=[],e=78271.51696402048;n.length<=24;e/=2)n.push(e);return n}();function iS(n,e){if(typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof OffscreenCanvas!="undefined")return new OffscreenCanvas(n,e);var t=document.createElement("canvas");return t.width=n,t.height=e,t}function rS(n,e){for(var t=0,i=e.length;t<i;++t){var r=e[t];if(r<n&&t+1<i){var s=e[t]/e[t+1];return t+Math.log(e[t]/n)/Math.log(s)}}return i-1}var Wu={};function Yf(n,e,t){if(t===void 0&&(t={}),e in Wu)return Wu[e];var i=t.transformRequest?t.transformRequest(e,n)||new Request(e):new Request(e);i.headers.get("Accept")||i.headers.set("Accept","application/json");var r=fetch(i).then(function(s){return delete Wu[e],s.ok?s.json():Promise.reject(new Error("Error fetching source "+e))}).catch(function(s){return delete Wu[e],Promise.reject(new Error("Error fetching source "+e))});return Wu[e]=r,r}function sS(n,e){if(typeof n=="string")if(n.trim().startsWith("{"))try{var t=JSON.parse(n);return Promise.resolve(t)}catch(i){return Promise.reject(i)}else return n=nS(n,e.accessToken),Yf("Style",n,e);else return Promise.resolve(n)}var oS={};function j3(n,e,t){t===void 0&&(t={});var i=[e,JSON.stringify(n)].toString(),r=oS[i];if(!r||t.transformRequest){var s=n.url;if(s&&!n.tiles){var o=Xf(s,t.accessToken,t.accessTokenParam||"access_token",e||location.href);s.startsWith("mapbox://")?r=Promise.resolve(Object.assign({},n,{url:void 0,tiles:o})):r=Yf("Source",o,t).then(function(a){for(var l=0,u=a.tiles.length;l<u;++l){var c=a.tiles[l];if(t.transformRequest){var h=t.transformRequest(o,"Source");h&&(o=h.url)}var f=Xf(c,t.accessToken,t.accessTokenParam||"access_token",o);if(t.transformRequest){var d=t.transformRequest(f,"Tiles");d instanceof Request&&(f=decodeURI(d.url))}a.tiles[l]=f}return Promise.resolve(a)})}else n=Object.assign({},n,{tiles:n.tiles.map(function(a){return Xf(a,t.accessToken,t.accessTokenParam||"access_token",e||location.href)})}),r=Promise.resolve(Object.assign({},n));oS[i]=r}return r}var X3=Array(256).join("\u200A");function $_(n,e){if(e>=.05){for(var t="",i=n.split(`
|
135
|
-
`),r=X3.slice(0,Math.round(e/.1)),s=0,o=i.length;s<o;++s)s>0&&(t+=`
|
136
|
-
`),t+=i[s].split("").join(r);return t}return n}var D_;function aS(){return D_||(D_=iS(1,1).getContext("2d")),D_}function Mo(n,e){return aS().measureText(n).width+(n.length-1)*e}var lS={};function N_(n,e,t,i){if(n.indexOf(`
|
137
|
-
`)!==-1){for(var r=n.split(`
|
138
|
-
`),s=[],o=0,a=r.length;o<a;++o)s.push(N_(r[o],e,t,i));return s.join(`
|
139
|
-
`)}var l=t+","+e+","+n+","+i,u=lS[l];if(!u){var c=n.split(" ");if(c.length>1){var h=aS();h.font=e;for(var f=h.measureText("M").width,d=f*t,g="",m=[],p=0,_=c.length;p<_;++p){var v=c[p],x=g+(g?" ":"")+v;Mo(x,i)<=d?g=x:(g&&m.push(g),g=v)}g&&m.push(g);for(var y=0,T=m.length;y<T&&T>1;++y){var w=m[y];if(Mo(w,i)<d*.35){var E=y>0?Mo(m[y-1],i):1/0,S=y<T-1?Mo(m[y+1],i):1/0;m.splice(y,1),T-=1,E<S?(m[y-1]+=" "+w,y-=1):m[y]=w+" "+m[y]}}for(var b=0,R=m.length-1;b<R;++b){var C=m[b],M=m[b+1];if(Mo(C,i)>d*.7&&Mo(M,i)<d*.6){var P=C.split(" "),U=P.pop();Mo(U,i)<d*.2&&(m[b]=P.join(" "),m[b+1]=U+" "+M),R-=1}}u=m.join(`
|
140
|
-
`)}else u=n;u=$_(u,i),lS[l]=u}return u}var Y3=/font-family: ?([^;]*);/,Z3=/("|')/g,Zf;function W3(n){if(!Zf){Zf={};for(var e=document.styleSheets,t=0,i=e.length;t<i;++t){var r=e[t];try{var s=r.rules||r.cssRules;if(s)for(var o=0,a=s.length;o<a;++o){var l=s[o];if(l.type==5){var u=l.cssText.match(Y3);Zf[u[1].replace(Z3,"")]=!0}}}catch{}}}return n in Zf}var k_={};function H3(n){var e=n.toString();if(e in k_)return k_[e];for(var t=[],i=0,r=n.length;i<r;++i){n[i]=n[i].replace("Arial Unicode MS","Arial");var s=n[i],o=P_(s,1);Zg(o);var a=o.split(" ");t.push([a.slice(3).join(" ").replace(/"/g,""),a[1],a[0]])}for(var l=0,u=t.length;l<u;++l){var c=t[l],h=c[0];if(!W3(h)&&di.get(c[2]+`
|
141
|
-
`+c[1]+`
|
142
|
-
`+h)!==100){var f="https://fonts.googleapis.com/css?family="+h.replace(/ /g,"+")+":"+c[1]+c[2];if(!document.querySelector('link[href="'+f+'"]')){var d=document.createElement("link");d.href=f,d.rel="stylesheet",document.head.appendChild(d)}}}return k_[e]=n,n}var K3={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},q3={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},J3=function(n,e){var t=A3(n,e);if(t.result==="error")throw new Error(t.value.map(function(i){return i.key+": "+i.message}).join(", "));return t.value},G_={},Wf={zoom:0},Hf,U_;function ve(n,e,t,i,r,s,o){var a=n.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[a]||(s[a]={});var l=s[a];if(!l[t]){var u=(n[e]||G_)[t],c=XT[e+"_"+n.type][t];u===void 0&&(u=c.default);var h=I3(u);if(!h&&jT(u)&&(u=bk(u,c),h=!0),h){var f=J3(u,c);l[t]=f.evaluate.bind(f)}else c.type=="color"&&(u=qe.parse(u)),l[t]=function(){return u}}return Wf.zoom=i,l[t](Wf,r,o)}function Q3(n,e,t,i){var r=ve(n,"layout","icon-allow-overlap",e,t,i);if(!r)return"declutter";var s=ve(n,"layout","icon-ignore-placement",e,t,i);return s?"none":"obstacle"}function eG(n,e,t,i,r){return r||console.warn("No filterCache provided to evaluateFilter()"),n in r||(r[n]=F3(e).filter),Wf.zoom=i,r[n](Wf,t)}function ws(n,e){if(n){if(n.a===0||e===0)return;var t=n.a;return e=e===void 0?1:e,t===0?"transparent":"rgba("+Math.round(n.r*255/t)+","+Math.round(n.g*255/t)+","+Math.round(n.b*255/t)+","+t*e+")"}return n}var tG=/\{[^{}}]*\}/g;function B_(n,e){return n.replace(tG,function(t){return e[t.slice(1,-1)]||""})}function nG(n,e,t,i,r,s,o){if(i===void 0&&(i=O_),r===void 0&&(r=void 0),s===void 0&&(s=void 0),o===void 0&&(o=void 0),typeof e=="string"&&(e=JSON.parse(e)),e.version!=8)throw new Error("glStyle version 8 required.");var a,l;if(s){if(typeof Image!="undefined"){var u=new Image;u.crossOrigin="anonymous",u.onload=function(){a=u,l=[u.width,u.height],n.changed(),u.onload=null},u.src=s}else if(typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope){var c=self;c.postMessage({action:"loadImage",src:s}),c.addEventListener("message",function(L){L.data.action==="imageLoaded"&&L.data.src===s&&(a=L.data.image,l=[a.width,a.height])})}}for(var h=z3(e.layers),f={},d=[],g={},m={},p={},_={},v,x=0,y=h.length;x<y;++x){var T=h[x],w=T.id;if(typeof t=="string"&&T.source==t||t.indexOf(w)!==-1){var E=T["source-layer"];if(v){if(T.source!==v)throw new Error('Layer "'+w+'" does not use source "'+v)}else{v=T.source;var S=e.sources[v];if(!S)throw new Error('Source "'+v+'" is not defined');var b=S.type;if(b!=="vector"&&b!=="geojson")throw new Error('Source "'+v+'" is not of type "vector" or "geojson", but "'+b+'"')}var R=f[E];R||(R=[],f[E]=R),R.push({layer:T,index:x}),d.push(w)}}var C=new on,M=new yn,P=[],U=function(O,L){var $=O.getProperties(),N=f[$.layer];if(!!N){var D=i.indexOf(L);D==-1&&(D=rS(L,i));for(var Y=K3[O.getGeometry().getType()],k={properties:$,type:Y},F=n.get("mapbox-featurestate")[O.getId()],ee=-1,X=0,Z=N.length;X<Z;++X){var ie=N[X],B=ie.layer,he=B.id,me=B.layout||G_,De=B.paint||G_;if(!(me.visibility==="none"||"minzoom"in B&&D<B.minzoom||"maxzoom"in B&&D>=B.maxzoom)){var rt=B.filter;if(!rt||eG(he,rt,k,D,_)){var Ce=void 0,at=void 0,dt=void 0,et=void 0,Ve=void 0,Q=void 0,wn=ie.index;if(Y==3&&(B.type=="fill"||B.type=="fill-extrusion"))if(at=ve(B,"paint",B.type+"-opacity",D,k,p,F),B.type+"-pattern"in De){var Bt=ve(B,"paint",B.type+"-pattern",D,k,p,F);if(Bt){var Tn=typeof Bt=="string"?B_(Bt,$):Bt.toString();if(a&&r&&r[Tn]){++ee,Q=P[ee],(!Q||!Q.getFill()||Q.getStroke()||Q.getText())&&(Q=new kt({fill:new yn}),P[ee]=Q),dt=Q.getFill(),Q.setZIndex(wn);var ln=Tn+"."+at,At=m[ln];if(!At){var Tt=r[Tn],Sn=iS(Tt.width,Tt.height),Dn=Sn.getContext("2d");Dn.globalAlpha=at,Dn.drawImage(a,Tt.x,Tt.y,Tt.width,Tt.height,0,0,Tt.width,Tt.height),At=Dn.createPattern(Sn,"repeat"),m[ln]=At}dt.setColor(At)}}}else Ce=ws(ve(B,"paint",B.type+"-color",D,k,p,F),at),B.type+"-outline-color"in De&&(Ve=ws(ve(B,"paint",B.type+"-outline-color",D,k,p,F),at)),Ve||(Ve=Ce),(Ce||Ve)&&(++ee,Q=P[ee],(!Q||Ce&&!Q.getFill()||!Ce&&Q.getFill()||Ve&&!Q.getStroke()||!Ve&&Q.getStroke()||Q.getText())&&(Q=new kt({fill:Ce?new yn:void 0,stroke:Ve?new on:void 0}),P[ee]=Q),Ce&&(dt=Q.getFill(),dt.setColor(Ce)),Ve&&(et=Q.getStroke(),et.setColor(Ve),et.setWidth(.5)),Q.setZIndex(wn));if(Y!=1&&B.type=="line"){Ce=!("line-pattern"in De)&&"line-color"in De?ws(ve(B,"paint","line-color",D,k,p,F),ve(B,"paint","line-opacity",D,k,p,F)):void 0;var bi=ve(B,"paint","line-width",D,k,p,F);Ce&&bi>0&&(++ee,Q=P[ee],(!Q||!Q.getStroke()||Q.getFill()||Q.getText())&&(Q=new kt({stroke:new on}),P[ee]=Q),et=Q.getStroke(),et.setLineCap(ve(B,"layout","line-cap",D,k,p,F)),et.setLineJoin(ve(B,"layout","line-join",D,k,p,F)),et.setMiterLimit(ve(B,"layout","line-miter-limit",D,k,p,F)),et.setColor(Ce),et.setWidth(bi),et.setLineDash(De["line-dasharray"]?ve(B,"paint","line-dasharray",D,k,p,F).map(function(bn){return bn*bi}):null),Q.setZIndex(wn))}var Vn=!1,je=null,er=0,tr=void 0,He=void 0,$s=void 0;if((Y==1||Y==2)&&"icon-image"in me){var Xo=ve(B,"layout","icon-image",D,k,p,F);if(Xo){tr=typeof Xo=="string"?B_(Xo,$):Xo.toString();var gl=void 0;if(a&&r&&r[tr]){var pl=ve(B,"layout","icon-rotation-alignment",D,k,p,F);if(Y==2){var ri=O.getGeometry();if(ri.getFlatMidpoint||ri.getFlatMidpoints){var Ir=ri.getExtent(),bc=Math.sqrt(Math.max(Math.pow((Ir[2]-Ir[0])/L,2),Math.pow((Ir[3]-Ir[1])/L,2)));if(bc>150){var Ri=ri.getType()==="MultiLineString"?ri.getFlatMidpoints():ri.getFlatMidpoint();U_||(Hf=[NaN,NaN],U_=new Kh("Point",Hf,[],{},null)),gl=U_,Hf[0]=Ri[0],Hf[1]=Ri[1];var Ds=ve(B,"layout","symbol-placement",D,k,p,F);if(Ds==="line"&&pl==="map")for(var Ci=ri.getStride(),si=ri.getFlatCoordinates(),nr=0,Rc=si.length-Ci;nr<Rc;nr+=Ci){var Zt=si[nr],Ii=si[nr+1],Qt=si[nr+Ci],Nn=si[nr+Ci+1],un=Math.min(Zt,Qt),Yo=Math.min(Ii,Nn),Zo=Math.max(Zt,Qt),en=Math.max(Ii,Nn);if(Ri[0]>=un&&Ri[0]<=Zo&&Ri[1]>=Yo&&Ri[1]<=en){er=Math.atan2(Ii-Nn,Qt-Zt);break}}}}}if(Y!==2||gl){var cn=ve(B,"layout","icon-size",D,k,p,F),Lt=De["icon-color"]!==void 0?ve(B,"paint","icon-color",D,k,p,F):null;if(!Lt||Lt.a!==0){var ml=tr+"."+cn;if(Lt!==null&&(ml+="."+Lt),He=g[ml],!He){var _l=r[tr],lC=Q3(B,D,k,p),Od=void 0;"icon-offset"in me&&(Od=ve(B,"layout","icon-offset",D,k,p,F),Od[1]*=-1),He=new Ea({color:Lt?[Lt.r*255,Lt.g*255,Lt.b*255,Lt.a]:void 0,img:a,imgSize:l,size:[_l.width,_l.height],offset:[_l.x,_l.y],rotateWithView:pl==="map",scale:cn/_l.pixelRatio,displacement:Od,declutterMode:lC}),g[ml]=He}}He&&(++ee,Q=P[ee],(!Q||!Q.getImage()||Q.getFill()||Q.getStroke())&&(Q=new kt,P[ee]=Q),Q.setGeometry(gl),He.setRotation(er+F_(ve(B,"layout","icon-rotate",D,k,p,F))),He.setOpacity(ve(B,"paint","icon-opacity",D,k,p,F)),He.setAnchor(q3[ve(B,"layout","icon-anchor",D,k,p,F)]),Q.setImage(He),je=Q.getText(),Q.setText(void 0),Q.setZIndex(wn),Vn=!0,$s=!1)}else $s=!0}}}if(Y==1&&B.type==="circle"){++ee,Q=P[ee],(!Q||!Q.getImage()||Q.getFill()||Q.getStroke())&&(Q=new kt,P[ee]=Q);var my="circle-radius"in De?ve(B,"paint","circle-radius",D,k,p,F):5,$d=ws(ve(B,"paint","circle-stroke-color",D,k,p,F),ve(B,"paint","circle-stroke-opacity",D,k,p,F)),Dd=ws(ve(B,"paint","circle-color",D,k,p,F),ve(B,"paint","circle-opacity",D,k,p,F)),Nd=ve(B,"paint","circle-stroke-width",D,k,p,F),_y=my+"."+$d+"."+Dd+"."+Nd;He=g[_y],He||(He=new lu({radius:my,stroke:$d&&Nd>0?new on({width:Nd,color:$d}):void 0,fill:Dd?new yn({color:Dd}):void 0,declutterMode:"none"}),g[_y]=He),Q.setImage(He),je=Q.getText(),Q.setText(void 0),Q.setGeometry(void 0),Q.setZIndex(wn),Vn=!0}var Wt=void 0,yl=void 0,vl=void 0,Ar=void 0,xl=void 0,kd=void 0;if("text-field"in me){Ar=Math.round(ve(B,"layout","text-size",D,k,p,F));var Gd=ve(B,"layout","text-font",D,k,p,F);vl=ve(B,"layout","text-line-height",D,k,p,F),yl=P_(o?o(Gd):Gd,Ar,vl),yl.includes("sans-serif")||(yl+=",sans-serif"),xl=ve(B,"layout","text-letter-spacing",D,k,p,F),kd=ve(B,"layout","text-max-width",D,k,p,F);var Wo=ve(B,"layout","text-field",D,k,p,F);typeof Wo=="object"&&Wo.sections?Wo.sections.length===1?Wt=Wo.toString():Wt=Wo.sections.reduce(function(bn,Lr,V8){var by=Lr.fontStack?Lr.fontStack.split(","):Gd,Xd=P_(o?o(by):by,Ar*(Lr.scale||1),vl),Ho=Lr.text;if(Ho===`
|
143
|
-
`)return bn.push(`
|
144
|
-
`,""),bn;if(Y==2){bn.push($_(Ho,xl),Xd);return}Ho=N_(Ho,Xd,kd,xl).split(`
|
145
|
-
`);for(var Ic=0,cC=Ho.length;Ic<cC;++Ic)Ic>0&&bn.push(`
|
146
|
-
`,""),bn.push(Ho[Ic],Xd);return bn},[]):Wt=B_(Wo,$).trim(),at=ve(B,"paint","text-opacity",D,k,p,F)}if(Wt&&at&&!$s){Vn||(++ee,Q=P[ee],(!Q||!Q.getText()||Q.getFill()||Q.getStroke())&&(Q=new kt,P[ee]=Q),Q.setImage(void 0),Q.setGeometry(void 0)),Q.getText()||Q.setText(je||new po({padding:[2,2,2,2]})),je=Q.getText();var yy=me["text-transform"];yy=="uppercase"?Wt=Array.isArray(Wt)?Wt.map(function(bn,Lr){return Lr%2?bn:bn.toUpperCase()}):Wt.toUpperCase():yy=="lowercase"&&(Wt=Array.isArray(Wt)?Wt.map(function(bn,Lr){return Lr%2?bn:bn.toLowerCase()}):Wt.toLowerCase());var vy=Array.isArray(Wt)?Wt:Y==2?$_(Wt,xl):N_(Wt,yl,kd,xl);je.setText(vy),je.setFont(yl),je.setRotation(F_(ve(B,"layout","text-rotate",D,k,p,F)));var Cc=ve(B,"layout","text-anchor",D,k,p,F),Ud=Vn||Y==1?"point":ve(B,"layout","symbol-placement",D,k,p,F);je.setPlacement(Ud),je.setOverflow(Ud==="point");var Ns=ve(B,"paint","text-halo-width",D,k,p,F),xy=ve(B,"layout","text-offset",D,k,p,F),Ey=ve(B,"paint","text-translate",D,k,p,F),Bd=0,zd=0;if(Ud=="point"){var Vd="center";Cc.indexOf("left")!==-1?(Vd="left",zd=Ns):Cc.indexOf("right")!==-1&&(Vd="right",zd=-Ns),je.setTextAlign(Vd);var uC=ve(B,"layout","text-rotation-alignment",D,k,p,F);je.setRotateWithView(uC=="map")}else je.setMaxAngle(F_(ve(B,"layout","text-max-angle",D,k,p,F))*Wt.length/vy.length),je.setTextAlign(),je.setRotateWithView(!1);var jd="middle";Cc.indexOf("bottom")==0?(jd="bottom",Bd=-Ns-.5*(vl-1)*Ar):Cc.indexOf("top")==0&&(jd="top",Bd=Ns+.5*(vl-1)*Ar),je.setTextBaseline(jd);var wy=ve(B,"layout","text-justify",D,k,p,F);je.setJustify(wy==="auto"?void 0:wy),je.setOffsetX(xy[0]*Ar+zd+Ey[0]),je.setOffsetY(xy[1]*Ar+Bd+Ey[1]),M.setColor(ws(ve(B,"paint","text-color",D,k,p,F),at)),je.setFill(M);var Ty=ws(ve(B,"paint","text-halo-color",D,k,p,F),at);if(Ty){C.setColor(Ty),Ns*=2;var Sy=.5*Ar;C.setWidth(Ns<=Sy?Ns:Sy),je.setStroke(C)}else je.setStroke(void 0);var El=ve(B,"layout","text-padding",D,k,p,F),wl=je.getPadding();El!==wl[0]&&(wl[0]=El,wl[1]=El,wl[2]=El,wl[3]=El),Q.setZIndex(wn)}}}}if(ee>-1)return P.length=ee+1,P}};return n.setStyle(U),n.set("mapbox-source",v),n.set("mapbox-layers",d),n.set("mapbox-featurestate",{}),U}function iG(n,e){if(!e.accessToken){e=Object.assign({},e);var t=new URL(n).searchParams;t.forEach(function(i,r){e.accessToken=i,e.accessTokenParam=r})}return e}function rG(n,e,t,i,r){t===void 0&&(t=""),i===void 0&&(i={}),r===void 0&&(r=void 0);var s,o,a;return typeof i=="string"?(s=i,a={}):(s=i.styleUrl,a=i),r||(r=a.resolutions),!s&&typeof e=="string"&&!e.trim().startsWith("{")&&(s=e),s&&(s=s.startsWith("data:")?location.href:nS(s,a.accessToken),a=iG(s,a)),new Promise(function(l,u){sS(e,a).then(function(c){if(c.version!=8)return u(new Error("glStyle version 8 required."));if(!(n instanceof ls||n instanceof $u))return u(new Error("Can only apply to VectorLayer or VectorTileLayer"));var h=n instanceof $u?"vector":"geojson";if(t?Array.isArray(t)?o=c.layers.find(function(T){return T.id===t[0]}).source:o=t:(o=Object.keys(c.sources).find(function(T){return c.sources[T].type===h}),t=o),!o)return u(new Error("No "+h+" source found in the glStyle."));function f(){if(n instanceof $u)return lG(c.sources[o],s,a).then(function(S){var b=n.getSource();if(b?S!==b&&(b.setTileUrlFunction(S.getTileUrlFunction()),b.format_||(b.format_=S.format_),b.getAttributions()||b.setAttributions(S.getAttributions()),b.getTileLoadFunction()===t_&&b.setTileLoadFunction(S.getTileLoadFunction()),fn(b.getProjection(),S.getProjection())&&(b.tileGrid=S.getTileGrid())):n.setSource(S),!isFinite(n.getMaxResolution())&&!isFinite(n.getMinZoom())){var R=n.getSource().getTileGrid();n.setMaxResolution(R.getResolution(R.getMinZoom()))}});var T=c.sources[o],w=n.getSource();(!w||w.get("mapbox-source")!==T)&&(w=uG(T,s,a));var E=n.getSource();return E?w!==E&&(E.getAttributions()||E.setAttributions(w.getAttributions()),E.format_||(E.format_=w.getFormat()),E.url_=w.getUrl()):n.setSource(w),Promise.resolve()}var d,g,m,p;function _(){!p&&(!c.sprite||g)?(p=nG(n,c,t,r,g,m,H3),n.getStyle()?f().then(l).catch(u):u(new Error("Nothing to show for source ["+o+"]"))):p?(n.setStyle(p),f().then(l).catch(u)):u(new Error("Something went wrong trying to apply style."))}if(c.sprite){var v=new URL(V3(c.sprite,a.accessToken,s||location.href));d=window.devicePixelRatio>=1.5?.5:1;var x=d==.5?"@2x":"",y=v.origin+v.pathname+x+".json"+v.search;new Promise(function(T,w){Yf("Sprite",y,a).then(T).catch(function(E){y=v.origin+v.pathname+".json"+v.search,Yf("Sprite",y,a).then(T).catch(w)})}).then(function(T){if(T===void 0&&u(new Error("No sprites found.")),g=T,m=v.origin+v.pathname+x+".png"+v.search,a.transformRequest){var w=a.transformRequest(m,"SpriteImage");w instanceof Request&&(m=encodeURI(w.url))}_()}).catch(function(T){u(new Error("Sprites cannot be loaded: "+y+": "+T.message))})}else _()}).catch(u)})}var uS={};function sG(n,e,t){var i={id:e.id,type:e.type},r={};function s(c){var h=e.layout||{},f=e.paint||{};i.paint=f;var d=rS(c,t.resolutions||O_),g,m;return f["background-color"]!==void 0&&(g=ve(i,"paint","background-color",d,uS,r)),f["background-opacity"]!==void 0&&(m=ve(i,"paint","background-opacity",d,uS,r)),h.visibility=="none"?void 0:ws(g,m)}var o=0,a=!1;function l(c){if(c.frameState.time!==o&&(o=c.frameState.time,a=!1),!a){if(!(c.context instanceof CanvasRenderingContext2D))throw new Error("Cannot apply background to WebGL context");var h=c.frameState.viewState.resolution,f=s(h);if(f){var d=c.context,g=d.globalAlpha;d.globalAlpha=1,d.fillStyle=f,d.fillRect(0,0,c.context.canvas.width,c.context.canvas.height),d.globalAlpha=g}a=!0}}if(typeof n.getLayers=="function"){var u=n.getLayers();u.forEach(function(c){c.on("prerender",l)}),u.on("add",function(c){c.element.on("prerender",l)}),u.on("remove",function(c){c.element.un("prerender",l)})}else n.on("prerender",l)}function cS(n,e,t){e.layers.some(function(i){if(i.type==="background")return sG(n,i,t),!0})}function oG(n,e,t){return t===void 0&&(t={}),typeof e=="object"?(cS(n,e,t),Promise.resolve()):sS(e,t).then(function(i){cS(n,i,t)})}function aG(n){var e=n.bounds;if(e){var t=xg([e[0],e[1]]),i=xg([e[2],e[3]]);return[t[0],t[1],i[0],i[1]]}}function lG(n,e,t){return new Promise(function(i,r){j3(n,e,t).then(function(s){var o=new vT({tileJSON:s}),a=o.getTileJSON(),l=o.getTileGrid(),u=aG(a),c=a.minzoom||0,h=a.maxzoom||22,f={attributions:o.getAttributions(),format:new Jp,tileGrid:new zi({origin:l.getOrigin(0),extent:u||l.getExtent(),minZoom:c,resolutions:O_.slice(0,h+1),tileSize:512})};Array.isArray(a.tiles)?f.urls=a.tiles:f.url=a.tiles,s.olSourceOptions&&Object.assign(f,s.olSourceOptions),i(new Pf(f))}).catch(r)})}var hS=new o1;function uG(n,e,t){var i=n.data,r={};if(typeof i=="string"){var s=Xf(i,t.accessToken,t.accessTokenParam||"access_token",e||location.href);if(t.transformRequest){var o=t.transformRequest(s,"GeoJSON");o instanceof Request&&(s=encodeURI(o.url))}r.url=s}else r.features=hS.readFeatures(i,{featureProjection:Ht()||"EPSG:3857"});var a=new us(Object.assign({attributions:n.attribution,format:hS},r));return a.set("mapbox-source",n),a}class cG extends Ct{constructor(e){super(K.ERROR),this.error=e}}class hG extends $u{constructor(e){const t="declutter"in e?e.declutter:!0,i=new Pf({state:"loading",format:new Jp});super({source:i,background:e.background,declutter:t,className:e.className,opacity:e.opacity,visible:e.visible,zIndex:e.zIndex,minResolution:e.minResolution,maxResolution:e.maxResolution,minZoom:e.minZoom,maxZoom:e.maxZoom,renderOrder:e.renderOrder,renderBuffer:e.renderBuffer,renderMode:e.renderMode,map:e.map,updateWhileAnimating:e.updateWhileAnimating,updateWhileInteracting:e.updateWhileInteracting,preload:e.preload,useInterimTilesOnError:e.useInterimTilesOnError,properties:e.properties}),e.accessToken&&(this.accessToken=e.accessToken);const r=e.styleUrl;rG(this,r,e.layers||e.source,{accessToken:this.accessToken}).then(()=>{i.setState("ready")}).catch(s=>{this.dispatchEvent(new cG(s)),this.getSource().setState("error")}),this.getBackground()===void 0&&oG(this,e.styleUrl,{accessToken:this.accessToken})}}var fG=hG;class dG extends jm{constructor(e){super(e),this.vectorRenderer_=new Rm(e),this.layerImageRatio_=e.getImageRatio(),this.coordinateToVectorPixelTransform_=Le(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(e){if(!this.vectorRenderer_)return new Promise(i=>i([]));const t=ke(this.coordinateToVectorPixelTransform_,ke(this.renderedPixelToCoordinateTransform_,e.slice()));return this.vectorRenderer_.getFeatures(t)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(e){const t=e.pixelRatio,i=e.viewState,r=i.resolution,s=e.viewHints,o=this.vectorRenderer_;let a=e.extent;this.layerImageRatio_!==1&&(a=a.slice(0),Il(a,this.layerImageRatio_));const l=_e(a)/r,u=Xe(a)/r;if(!s[Ye.ANIMATING]&&!s[Ye.INTERACTING]&&!Vr(a)){o.useContainer(null,null);const c=o.context,h=e.layerStatesArray[e.layerIndex];c.globalAlpha=h.opacity;const f=Object.assign({},h,{opacity:1}),d=Object.assign({},e,{declutterTree:new dm(9),extent:a,size:[l,u],viewState:Object.assign({},e.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0});let g=!0;const m=new Bl(a,r,t,c.canvas,function(p){o.prepareFrame(d)&&o.replayGroupChanged&&(o.clipping=!1,o.renderFrame(d,null)&&(o.renderDeclutter(d),g=!1),p())});m.addEventListener(K.CHANGE,function(){if(m.getState()!==ce.LOADED)return;this.image_=g?null:m;const p=m.getResolution(),_=m.getPixelRatio(),v=p*t/_;this.renderedResolution=v,this.coordinateToVectorPixelTransform_=tn(this.coordinateToVectorPixelTransform_,l/2,u/2,1/v,-1/v,0,-i.center[0],-i.center[1])}.bind(this)),m.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(e,t,i,r,s){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(e,t,i,r,s):super.forEachFeatureAtCoordinate(e,t,i,r,s)}}var fS=dG;class gG extends vo{constructor(e){e=e||{};const t=Object.assign({},e);delete t.imageRatio,super(t),this.imageRatio_=e.imageRatio!==void 0?e.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new fS(this)}}var pG=gG;class mG{constructor(e,t){this.name=e,this.data=t,this.texture_=null}getTexture(e){if(!this.texture_){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.data.length/4,1,0,e.RGBA,e.UNSIGNED_BYTE,this.data),this.texture_=t}return this.texture_}}var dS=mG;function gS(n,e,t){const i=t?n.LINEAR:n.NEAREST;n.bindTexture(n.TEXTURE_2D,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,i)}function _G(n,e,t,i){gS(n,e,i),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,t)}function pS(n,e,t,i,r,s){const o=n.getGL();let a,l;t instanceof Float32Array?(a=o.FLOAT,n.getExtension("OES_texture_float"),l=n.getExtension("OES_texture_float_linear")!==null):(a=o.UNSIGNED_BYTE,l=!0),gS(o,e,s&&l);const u=t.byteLength/i[1];let c=1;u%8===0?c=8:u%4===0?c=4:u%2===0&&(c=2);let h;switch(r){case 1:{h=o.LUMINANCE;break}case 2:{h=o.LUMINANCE_ALPHA;break}case 3:{h=o.RGB;break}case 4:{h=o.RGBA;break}default:throw new Error(`Unsupported number of bands: ${r}`)}const f=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,c),o.texImage2D(o.TEXTURE_2D,0,h,i[0],i[1],0,h,a,t),o.pixelStorei(o.UNPACK_ALIGNMENT,f)}let qa=null;function yG(){const n=document.createElement("canvas");n.width=1,n.height=1,qa=n.getContext("2d")}class vG extends Gs{constructor(e){super(),this.tile,this.textures=[],this.handleTileChange_=this.handleTileChange_.bind(this),this.renderSize_=tt(e.grid.getTileSize(e.tile.tileCoord[0])),this.gutter_=e.gutter||0,this.bandCount=NaN,this.helper_=e.helper;const t=new Qn(_r,vf);t.fromArray([0,1,1,1,1,0,0,0]),this.helper_.flushBufferData(t),this.coords=t,this.setTile(e.tile)}setTile(e){if(e!==this.tile)if(this.tile&&this.tile.removeEventListener(K.CHANGE,this.handleTileChange_),this.tile=e,this.textures.length=0,this.loaded=e.getState()===V.LOADED,this.loaded)this.uploadTile_();else{if(e instanceof no){const t=e.getImage();t instanceof Image&&!t.crossOrigin&&(t.crossOrigin="anonymous")}e.addEventListener(K.CHANGE,this.handleTileChange_)}}uploadTile_(){const e=this.helper_,t=e.getGL(),i=this.tile;if(i instanceof no||i instanceof wo){const _=t.createTexture();this.textures.push(_),this.bandCount=4,_G(t,_,i.getImage(),i.interpolate);return}const r=i.getSize(),s=[r[0]+2*this.gutter_,r[1]+2*this.gutter_],o=i.getData(),a=o instanceof Float32Array,l=s[0]*s[1],u=a?Float32Array:Uint8Array,c=u.BYTES_PER_ELEMENT,h=o.byteLength/s[1];this.bandCount=Math.floor(h/c/s[0]);const f=Math.ceil(this.bandCount/4);if(f===1){const _=t.createTexture();this.textures.push(_),pS(e,_,o,s,this.bandCount,i.interpolate);return}const d=new Array(f);for(let _=0;_<f;++_){const v=t.createTexture();this.textures.push(v);const x=_<f-1?4:(this.bandCount-1)%4+1;d[_]=new u(l*x)}let g=0,m=0;const p=s[0]*this.bandCount;for(let _=0;_<s[1];++_){for(let v=0;v<p;++v){const x=o[m+v],y=Math.floor(g/this.bandCount),T=v%this.bandCount,w=Math.floor(T/4),E=d[w],S=E.length/l,b=T%4;E[y*S+b]=x,++g}m+=h/c}for(let _=0;_<f;++_){const v=this.textures[_],x=d[_],y=x.length/l;pS(e,v,x,s,y,i.interpolate)}}handleTileChange_(){this.tile.getState()===V.LOADED&&(this.loaded=!0,this.uploadTile_(),this.dispatchEvent(K.CHANGE))}disposeInternal(){const e=this.helper_.getGL();this.helper_.deleteBuffer(this.coords);for(let t=0;t<this.textures.length;++t)e.deleteTexture(this.textures[t]);this.tile.removeEventListener(K.CHANGE,this.handleTileChange_)}getPixelData(e,t){if(!this.loaded)return null;const i=this.renderSize_[0],r=this.renderSize_[1],s=this.gutter_;if(this.tile instanceof Hd){const g=this.tile.getSize(),m=g[0],p=g[1],_=m+2*s,v=p+2*s,x=s+Math.floor(m*(e/i)),y=s+Math.floor(p*(t/r)),T=this.tile.getData();if(T instanceof DataView){const E=T.byteLength/(_*v),S=E*(y*_+x),b=T.buffer.slice(S,S+E);return new DataView(b)}const w=this.bandCount*(y*_+x);return T.slice(w,w+this.bandCount)}qa||yG(),qa.clearRect(0,0,1,1);const o=this.tile.getImage(),a=o.width,l=o.height,u=a-2*s,c=l-2*s,h=s+Math.floor(u*(e/i)),f=s+Math.floor(c*(t/r));let d;try{qa.drawImage(o,h,f,1,1,0,0,1,1),d=qa.getImageData(0,0,1,1).data}catch{return qa=null,null}return d}}var mS=vG;const xe={TILE_TEXTURE_ARRAY:"u_tileTextures",TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY",RENDER_EXTENT:"u_renderExtent",RESOLUTION:"u_resolution",ZOOM:"u_zoom"},Hu={TEXTURE_COORD:"a_textureCoord"},xG=[{name:Hu.TEXTURE_COORD,size:2,type:wt.FLOAT}],EG={};function wG(n){return 2*(1-1/(n+1))-1}function _S(n,e,t){t in n||(n[t]=[]),n[t].push(e)}function z_(n,e){const t=n.layerStatesArray[n.layerIndex];t.extent&&(e=zt(e,An(t.extent,n.viewState.projection)));const i=t.layer.getRenderSource();if(!i.getWrapX()){const r=i.getTileGridForProjection(n.viewState.projection).getExtent();r&&(e=zt(e,r))}return e}function V_(n,e){return`${n.getKey()},${ya(e)}`}class TG extends Tf{constructor(e,t){super(e,{uniforms:t.uniforms}),this.renderComplete=!1,this.tileTransform_=Le(),this.tempMat4_=Nm(),this.tempTileRange_=new eu(0,0,0,0),this.tempTileCoord_=_a(0,0,0),this.tempSize_=[0,0],this.program_,this.vertexShader_=t.vertexShader,this.fragmentShader_=t.fragmentShader,this.indices_=new Qn(cs,vf),this.indices_.fromArray([0,1,3,1,2,3]);const i=t.cacheSize!==void 0?t.cacheSize:512;this.tileTextureCache_=new Th(i),this.paletteTextures_=t.paletteTextures||[],this.frameState_=null,this.projection_=void 0}reset(e){super.reset({uniforms:e.uniforms}),this.vertexShader_=e.vertexShader,this.fragmentShader_=e.fragmentShader,this.paletteTextures_=e.paletteTextures||[],this.helper&&(this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.helper.flushBufferData(this.indices_)}isDrawableTile_(e){const t=this.getLayer(),i=e.getState(),r=t.getUseInterimTilesOnError();return i==V.LOADED||i==V.EMPTY||i==V.ERROR&&!r}prepareFrameInternal(e){this.projection_?e.viewState.projection!==this.projection_&&(this.clearCache(),this.projection_=e.viewState.projection):this.projection_=e.viewState.projection;const i=this.getLayer().getRenderSource();return!i||Vr(z_(e,e.extent))?!1:i.getState()==="ready"}enqueueTiles(e,t,i,r,s){const o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),u=l.getTileGridForProjection(o.projection),c=l.getGutterForProjection(o.projection),h=H(l);h in e.wantedTiles||(e.wantedTiles[h]={});const f=e.wantedTiles[h],d=this.tileTextureCache_,g=a.getMapInternal(),m=Math.max(i-s,u.getMinZoom(),u.getZForResolution(Math.min(a.getMaxResolution(),g?g.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):u.getResolution(0)),l.zDirection));for(let p=i;p>=m;--p){const _=u.getTileRangeForExtentAndZ(t,p,this.tempTileRange_),v=u.getResolution(p);for(let x=_.minX;x<=_.maxX;++x)for(let y=_.minY;y<=_.maxY;++y){const T=_a(p,x,y,this.tempTileCoord_),w=V_(l,T);let E,S;if(d.containsKey(w)&&(E=d.get(w),S=E.tile),!E||E.tile.key!==l.getKey())if(S=l.getTile(p,x,y,e.pixelRatio,o.projection),!E)E=new mS({tile:S,grid:u,helper:this.helper,gutter:c}),d.set(w,E);else if(this.isDrawableTile_(S))E.setTile(S);else{const R=S.getInterimTile();E.setTile(R)}_S(r,E,p);const b=S.getKey();f[b]=!0,S.getState()===V.IDLE&&(e.tileQueue.isKeyQueued(b)||e.tileQueue.enqueue([S,h,u.getTileCoordCenter(T),v]))}}}renderFrame(e){this.frameState_=e,this.renderComplete=!0;const t=this.helper.getGL();this.preRender(t,e);const i=e.viewState,r=this.getLayer(),s=r.getRenderSource(),o=s.getTileGridForProjection(i.projection),a=s.getGutterForProjection(i.projection),l=z_(e,e.extent),u=o.getZForResolution(i.resolution,s.zDirection),c={},h=r.getPreload();if(e.nextExtent){const E=o.getZForResolution(i.nextResolution,s.zDirection),S=z_(e,e.nextExtent);this.enqueueTiles(e,S,E,c,h)}this.enqueueTiles(e,l,u,c,0),h>0&&setTimeout(()=>{this.enqueueTiles(e,l,u-1,c,h-1)},0);const f={},d=H(this),g=e.time;let m=!1;const p=c[u];for(let E=0,S=p.length;E<S;++E){const b=p[E],R=b.tile;if(R instanceof wo&&R.getState()===V.EMPTY)continue;const C=R.tileCoord;if(b.loaded){const U=R.getAlpha(d,g);if(U===1){R.endTransition(d);continue}m=!0;const O=ya(C);f[O]=U}if(this.renderComplete=!1,this.findAltTiles_(o,C,u+1,c))continue;const P=o.getMinZoom();for(let U=u-1;U>=P&&!this.findAltTiles_(o,C,U,c);--U);}this.helper.useProgram(this.program_,e),this.helper.prepareDraw(e,!m);const _=Object.keys(c).map(Number).sort(ir),v=i.center[0],x=i.center[1];for(let E=0,S=_.length;E<S;++E){const b=_[E],R=o.getResolution(b),C=tt(o.getTileSize(b),this.tempSize_),M=o.getOrigin(b),P=C[0]+2*a,U=C[1]+2*a,O=P/U,L=(v-M[0])/(C[0]*R),$=(M[1]-x)/(C[1]*R),N=i.resolution/R,D=wG(b),Y=c[b];for(let k=0,F=Y.length;k<F;++k){const ee=Y[k];if(!ee.loaded)continue;const Z=ee.tile.tileCoord,ie=ya(Z),B=Z[1],he=Z[2];Bs(this.tileTransform_),Gr(this.tileTransform_,2/(e.size[0]*N/P),-2/(e.size[1]*N/P)),Qd(this.tileTransform_,i.rotation),Gr(this.tileTransform_,1,1/O),qo(this.tileTransform_,(C[0]*(B-L)-a)/P,(C[1]*(he-$)-a)/U),this.helper.setUniformMatrixValue(xe.TILE_TRANSFORM,Pu(this.tempMat4_,this.tileTransform_)),this.helper.bindBuffer(ee.coords),this.helper.bindBuffer(this.indices_),this.helper.enableAttributes(xG);let me=0;for(;me<ee.textures.length;){const Ce="TEXTURE"+me,at=`${xe.TILE_TEXTURE_ARRAY}[${me}]`;t.activeTexture(t[Ce]),t.bindTexture(t.TEXTURE_2D,ee.textures[me]),t.uniform1i(this.helper.getUniformLocation(at),me),++me}for(let Ce=0;Ce<this.paletteTextures_.length;++Ce){const at=this.paletteTextures_[Ce];t.activeTexture(t["TEXTURE"+me]);const dt=at.getTexture(t);t.bindTexture(t.TEXTURE_2D,dt),t.uniform1i(this.helper.getUniformLocation(at.name),me),++me}const De=ie in f?f[ie]:1;De<1&&(e.animate=!0),this.helper.setUniformFloatValue(xe.TRANSITION_ALPHA,De),this.helper.setUniformFloatValue(xe.DEPTH,D),this.helper.setUniformFloatValue(xe.TEXTURE_PIXEL_WIDTH,P),this.helper.setUniformFloatValue(xe.TEXTURE_PIXEL_HEIGHT,U),this.helper.setUniformFloatValue(xe.TEXTURE_RESOLUTION,R),this.helper.setUniformFloatValue(xe.TEXTURE_ORIGIN_X,M[0]+B*C[0]*R-a*R),this.helper.setUniformFloatValue(xe.TEXTURE_ORIGIN_Y,M[1]-he*C[1]*R+a*R);let rt=l;a>0&&(rt=o.getTileCoordExtent(Z),zt(rt,l,rt)),this.helper.setUniformFloatVec4(xe.RENDER_EXTENT,rt),this.helper.setUniformFloatValue(xe.RESOLUTION,i.resolution),this.helper.setUniformFloatValue(xe.ZOOM,i.zoom),this.helper.drawElements(0,this.indices_.getSize())}}this.helper.finalizeDraw(e,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const y=this.helper.getCanvas(),T=this.tileTextureCache_;for(;T.canExpireCache();)T.pop().dispose();const w=function(E,S){s.updateCacheSize(.1,S.viewState.projection),s.expireCache(S.viewState.projection,EG)};return e.postRenderFunctions.push(w),this.postRender(t,e),y}getData(e){if(!this.helper.getGL())return null;const i=this.frameState_;if(!i)return null;const r=this.getLayer(),s=ke(i.pixelToCoordinateTransform,e.slice()),o=i.viewState,a=r.getExtent();if(a&&!jn(An(a,o.projection),s))return null;const l=r.getSources(pt([s]),o.resolution);let u,c,h;for(u=l.length-1;u>=0;--u)if(c=l[u],c.getState()==="ready"){if(h=c.getTileGridForProjection(o.projection),c.getWrapX())break;const d=h.getExtent();if(!d||jn(d,s))break}if(u<0)return null;const f=this.tileTextureCache_;for(let d=h.getZForResolution(o.resolution);d>=h.getMinZoom();--d){const g=h.getTileCoordForCoordAndZ(s,d),m=V_(c,g);if(!f.containsKey(m))continue;const p=f.get(m),_=p.tile;if(_ instanceof wo&&_.getState()===V.EMPTY)return null;if(!p.loaded)continue;const v=h.getOrigin(d),x=tt(h.getTileSize(d)),y=h.getResolution(d),T=(s[0]-v[0])/y-g[1]*x[0],w=(v[1]-s[1])/y-g[2]*x[1];return p.getPixelData(T,w)}return null}findAltTiles_(e,t,i,r){const s=e.getTileRangeForTileCoordAndZ(t,i,this.tempTileRange_);if(!s)return!1;let o=!0;const a=this.tileTextureCache_,l=this.getLayer().getRenderSource();for(let u=s.minX;u<=s.maxX;++u)for(let c=s.minY;c<=s.maxY;++c){const h=V_(l,[i,u,c]);let f=!1;if(a.containsKey(h)){const d=a.get(h);d.loaded&&(_S(r,d,i),f=!0)}f||(o=!1)}return o}clearCache(){const e=this.tileTextureCache_;e.forEach(t=>t.dispose()),e.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){const e=this.helper;e&&(e.getGL().deleteProgram(this.program_),delete this.program_,e.deleteBuffer(this.indices_)),super.disposeInternal(),delete this.indices_,delete this.tileTextureCache_,delete this.frameState_}}var yS=TG;const q={NUMBER:1,STRING:2,COLOR:4,BOOLEAN:8,NUMBER_ARRAY:16,ANY:31,NONE:0},be={};function wi(n){if(typeof n=="number")return q.NUMBER;if(typeof n=="boolean")return q.BOOLEAN;if(typeof n=="string")return Kv(n)?q.COLOR|q.STRING:q.STRING;if(!Array.isArray(n))throw new Error(`Unhandled value type: ${JSON.stringify(n)}`);const e=n;if(e.every(function(r){return typeof r=="number"}))return e.length===3||e.length===4?q.COLOR|q.NUMBER_ARRAY:q.NUMBER_ARRAY;if(typeof e[0]!="string")throw new Error(`Expected an expression operator but received: ${JSON.stringify(e)}`);const i=be[e[0]];if(i===void 0)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return i.getReturnType(e.slice(1))}function vS(n){return Math.log2(n)%1===0}function Ku(n){const e=n.toString();return e.includes(".")?e:e+".0"}function j_(n){if(n.length<2||n.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${n.length}(${n.map(Ku).join(", ")})`}function xS(n){const e=Kr(n).slice();return e.length<4&&e.push(1),j_(e.map(function(t,i){return i<3?t/255:t}))}function qu(n,e){return n.stringLiteralsMap[e]===void 0&&(n.stringLiteralsMap[e]=Object.keys(n.stringLiteralsMap).length),n.stringLiteralsMap[e]}function ES(n,e){return Ku(qu(n,e))}function te(n,e,t){if(Array.isArray(e)&&typeof e[0]=="string"){const r=be[e[0]];if(r===void 0)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return r.toGlsl(n,e.slice(1),t)}const i=wi(e);if((i&q.NUMBER)>0)return Ku(e);if((i&q.BOOLEAN)>0)return e.toString();if((i&q.STRING)>0&&(t===void 0||t==q.STRING))return ES(n,e.toString());if((i&q.COLOR)>0&&(t===void 0||t==q.COLOR))return xS(e);if((i&q.NUMBER_ARRAY)>0)return j_(e);throw new Error(`Unexpected expression ${e} (expected type ${t})`)}function wS(n){if(!(wi(n)&q.NUMBER))throw new Error(`A numeric value was expected, got ${JSON.stringify(n)} instead`)}function Rt(n){for(let e=0;e<n.length;e++)wS(n[e])}function TS(n){if(!(wi(n)&q.STRING))throw new Error(`A string value was expected, got ${JSON.stringify(n)} instead`)}function X_(n){if(!(wi(n)&q.BOOLEAN))throw new Error(`A boolean value was expected, got ${JSON.stringify(n)} instead`)}function ot(n,e){if(n.length!==e)throw new Error(`Exactly ${e} arguments were expected, got ${n.length} instead`)}function Ts(n,e){if(n.length<e)throw new Error(`At least ${e} arguments were expected, got ${n.length} instead`)}function Kf(n,e){if(n.length>e)throw new Error(`At most ${e} arguments were expected, got ${n.length} instead`)}function SS(n){if(n.length%2!==0)throw new Error(`An even amount of arguments was expected, got ${n} instead`)}function SG(n){if(n.length%2===0)throw new Error(`An odd amount of arguments was expected, got ${n} instead`)}function Y_(n,e){if(!vS(e))throw new Error(`Could not infer only one type from the following expression: ${JSON.stringify(n)}`)}be.get={getReturnType:function(n){return q.ANY},toGlsl:function(n,e){ot(e,1),TS(e[0]);const t=e[0].toString();return n.attributes.includes(t)||n.attributes.push(t),(n.inFragmentShader?"v_":"a_")+t}};function qf(n){return"u_var_"+n}be.var={getReturnType:function(n){return q.ANY},toGlsl:function(n,e){ot(e,1),TS(e[0]);const t=e[0].toString();return n.variables.includes(t)||n.variables.push(t),qf(t)}};const Z_="u_paletteTextures";be.palette={getReturnType:function(n){return q.COLOR},toGlsl:function(n,e){ot(e,2),wS(e[0]);const t=te(n,e[0]),i=e[1];if(!Array.isArray(i))throw new Error("The second argument of palette must be an array");const r=i.length,s=new Uint8Array(r*4);for(let l=0;l<r;l++){const u=i[l];let c;if(typeof u=="string")c=Gg(u);else{if(!Array.isArray(u))throw new Error("The second argument of palette must be an array of strings or colors");const f=u.length;if(f===4)c=u;else{if(f!==3)throw new Error(`Expected palette color to have 3 or 4 values, got ${f}`);c=[u[0],u[1],u[2],1]}}const h=l*4;s[h]=c[0],s[h+1]=c[1],s[h+2]=c[2],s[h+3]=c[3]*255}n.paletteTextures||(n.paletteTextures=[]);const o=`${Z_}[${n.paletteTextures.length}]`,a=new dS(o,s);return n.paletteTextures.push(a),`texture2D(${o}, vec2((${t} + 0.5) / ${r}.0, 0.5))`}};const W_="getBandValue";be.band={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){Ts(e,1),Kf(e,3);const t=e[0];if(!(W_ in n.functions)){let o="";const a=n.bandCount||1;for(let l=0;l<a;l++){const u=Math.floor(l/4);let c=l%4;l===a-1&&c===1&&(c=3);const h=`${xe.TILE_TEXTURE_ARRAY}[${u}]`;o+=`
|
147
|
-
if (band == ${l+1}.0) {
|
148
|
-
return texture2D(${h}, v_textureCoord + vec2(dx, dy))[${c}];
|
149
|
-
}
|
150
|
-
`}n.functions[W_]=`
|
151
|
-
float getBandValue(float band, float xOffset, float yOffset) {
|
152
|
-
float dx = xOffset / ${xe.TEXTURE_PIXEL_WIDTH};
|
153
|
-
float dy = yOffset / ${xe.TEXTURE_PIXEL_HEIGHT};
|
154
|
-
${o}
|
155
|
-
}
|
156
|
-
`}const i=te(n,t),r=te(n,e[1]||0),s=te(n,e[2]||0);return`${W_}(${i}, ${r}, ${s})`}},be.time={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,0),"u_time"}},be.zoom={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,0),"u_zoom"}},be.resolution={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,0),"u_resolution"}},be["*"]={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} * ${te(n,e[1])})`}},be["/"]={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} / ${te(n,e[1])})`}},be["+"]={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} + ${te(n,e[1])})`}},be["-"]={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} - ${te(n,e[1])})`}},be.clamp={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){ot(e,3),Rt(e);const t=te(n,e[1]),i=te(n,e[2]);return`clamp(${te(n,e[0])}, ${t}, ${i})`}},be["%"]={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,2),Rt(e),`mod(${te(n,e[0])}, ${te(n,e[1])})`}},be["^"]={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,2),Rt(e),`pow(${te(n,e[0])}, ${te(n,e[1])})`}},be.abs={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,1),Rt(e),`abs(${te(n,e[0])})`}},be.floor={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,1),Rt(e),`floor(${te(n,e[0])})`}},be.round={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,1),Rt(e),`floor(${te(n,e[0])} + 0.5)`}},be.ceil={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,1),Rt(e),`ceil(${te(n,e[0])})`}},be.sin={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,1),Rt(e),`sin(${te(n,e[0])})`}},be.cos={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return ot(e,1),Rt(e),`cos(${te(n,e[0])})`}},be.atan={getReturnType:function(n){return q.NUMBER},toGlsl:function(n,e){return Ts(e,1),Kf(e,2),Rt(e),e.length===2?`atan(${te(n,e[0])}, ${te(n,e[1])})`:`atan(${te(n,e[0])})`}},be[">"]={getReturnType:function(n){return q.BOOLEAN},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} > ${te(n,e[1])})`}},be[">="]={getReturnType:function(n){return q.BOOLEAN},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} >= ${te(n,e[1])})`}},be["<"]={getReturnType:function(n){return q.BOOLEAN},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} < ${te(n,e[1])})`}},be["<="]={getReturnType:function(n){return q.BOOLEAN},toGlsl:function(n,e){return ot(e,2),Rt(e),`(${te(n,e[0])} <= ${te(n,e[1])})`}};function bS(n){return{getReturnType:function(e){return q.BOOLEAN},toGlsl:function(e,t){ot(t,2);let i=q.ANY;for(let r=0;r<t.length;r++)i&=wi(t[r]);if(i===q.NONE)throw new Error(`All arguments should be of compatible type, got ${JSON.stringify(t)} instead`);return i&=~q.COLOR,`(${te(e,t[0],i)} ${n} ${te(e,t[1],i)})`}}}be["=="]=bS("=="),be["!="]=bS("!="),be["!"]={getReturnType:function(n){return q.BOOLEAN},toGlsl:function(n,e){return ot(e,1),X_(e[0]),`(!${te(n,e[0])})`}};function RS(n){return{getReturnType:function(e){return q.BOOLEAN},toGlsl:function(e,t){Ts(t,2);for(let r=0;r<t.length;r++)X_(t[r]);let i="";return i=t.map(r=>te(e,r)).join(` ${n} `),i=`(${i})`,i}}}be.all=RS("&&"),be.any=RS("||"),be.between={getReturnType:function(n){return q.BOOLEAN},toGlsl:function(n,e){ot(e,3),Rt(e);const t=te(n,e[1]),i=te(n,e[2]),r=te(n,e[0]);return`(${r} >= ${t} && ${r} <= ${i})`}},be.array={getReturnType:function(n){return q.NUMBER_ARRAY},toGlsl:function(n,e){Ts(e,2),Kf(e,4),Rt(e);const t=e.map(function(i){return te(n,i,q.NUMBER)});return`vec${e.length}(${t.join(", ")})`}},be.color={getReturnType:function(n){return q.COLOR},toGlsl:function(n,e){Ts(e,3),Kf(e,4),Rt(e);const t=e;e.length===3&&t.push(1);const i=e.map(function(r,s){return te(n,r,q.NUMBER)+(s<3?" / 255.0":"")});return`vec${e.length}(${i.join(", ")})`}},be.interpolate={getReturnType:function(n){let e=q.COLOR|q.NUMBER;for(let t=3;t<n.length;t+=2)e=e&wi(n[t]);return e},toGlsl:function(n,e,t){SS(e),Ts(e,6);const i=e[0];let r;switch(i[0]){case"linear":r=1;break;case"exponential":r=i[1];break;default:r=null}if(!r)throw new Error(`Invalid interpolation type for "interpolate" operator, received: ${JSON.stringify(i)}`);t=t!==void 0?t:q.ANY;const s=be.interpolate.getReturnType(e)&t;Y_(e,s);const o=te(n,e[1]),a=Ku(r);let l="";for(let u=2;u<e.length-2;u+=2){const c=te(n,e[u]),h=l||te(n,e[u+1],s),f=te(n,e[u+2]),d=te(n,e[u+3],s);l=`mix(${h}, ${d}, pow(clamp((${o} - ${c}) / (${f} - ${c}), 0.0, 1.0), ${a}))`}return l}},be.match={getReturnType:function(n){let e=q.ANY;for(let t=2;t<n.length;t+=2)e=e&wi(n[t]);return e=e&wi(n[n.length-1]),e},toGlsl:function(n,e,t){SS(e),Ts(e,4),t=t!==void 0?t:q.ANY;const i=be.match.getReturnType(e)&t;Y_(e,i);const r=te(n,e[0]),s=te(n,e[e.length-1],i);let o=null;for(let a=e.length-3;a>=1;a-=2){const l=te(n,e[a]),u=te(n,e[a+1],i);o=`(${r} == ${l} ? ${u} : ${o||s})`}return o}},be.case={getReturnType:function(n){let e=q.ANY;for(let t=1;t<n.length;t+=2)e=e&wi(n[t]);return e=e&wi(n[n.length-1]),e},toGlsl:function(n,e,t){SG(e),Ts(e,3),t=t!==void 0?t:q.ANY;const i=be.case.getReturnType(e)&t;Y_(e,i);for(let o=0;o<e.length-1;o+=2)X_(e[o]);const r=te(n,e[e.length-1],i);let s=null;for(let o=e.length-3;o>=0;o-=2){const a=te(n,e[o]),l=te(n,e[o+1],i);s=`(${a} ? ${l} : ${s||r})`}return s}};class CS{constructor(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}addUniform(e){return this.uniforms.push(e),this}addAttribute(e){return this.attributes.push(e),this}addVarying(e,t,i){return this.varyings.push({name:e,type:t,expression:i}),this}setSizeExpression(e){return this.sizeExpression=e,this}setRotationExpression(e){return this.rotationExpression=e,this}setSymbolOffsetExpression(e){return this.offsetExpression=e,this}setColorExpression(e){return this.colorExpression=e,this}setTextureCoordinateExpression(e){return this.texCoordExpression=e,this}setFragmentDiscardExpression(e){return this.discardExpression=e,this}setSymbolRotateWithView(e){return this.rotateWithView=e,this}getSizeExpression(){return this.sizeExpression}getOffsetExpression(){return this.offsetExpression}getColorExpression(){return this.colorExpression}getTextureCoordinateExpression(){return this.texCoordExpression}getFragmentDiscardExpression(){return this.discardExpression}getSymbolVertexShader(e){const t=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix";let i=this.attributes,r=this.varyings;return e&&(i=i.concat("vec4 a_hitColor"),r=r.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;
|
157
|
-
uniform mat4 u_projectionMatrix;
|
158
|
-
uniform mat4 u_offsetScaleMatrix;
|
159
|
-
uniform mat4 u_offsetRotateMatrix;
|
160
|
-
uniform float u_time;
|
161
|
-
uniform float u_zoom;
|
162
|
-
uniform float u_resolution;
|
163
|
-
${this.uniforms.map(function(s){return"uniform "+s+";"}).join(`
|
164
|
-
`)}
|
165
|
-
attribute vec2 a_position;
|
166
|
-
attribute float a_index;
|
167
|
-
${i.map(function(s){return"attribute "+s+";"}).join(`
|
168
|
-
`)}
|
169
|
-
varying vec2 v_texCoord;
|
170
|
-
varying vec2 v_quadCoord;
|
171
|
-
${r.map(function(s){return"varying "+s.type+" "+s.name+";"}).join(`
|
172
|
-
`)}
|
173
|
-
void main(void) {
|
174
|
-
mat4 offsetMatrix = ${t};
|
175
|
-
vec2 halfSize = ${this.sizeExpression} * 0.5;
|
176
|
-
vec2 offset = ${this.offsetExpression};
|
177
|
-
float angle = ${this.rotationExpression};
|
178
|
-
float offsetX;
|
179
|
-
float offsetY;
|
180
|
-
if (a_index == 0.0) {
|
181
|
-
offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);
|
182
|
-
offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);
|
183
|
-
} else if (a_index == 1.0) {
|
184
|
-
offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);
|
185
|
-
offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);
|
186
|
-
} else if (a_index == 2.0) {
|
187
|
-
offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);
|
188
|
-
offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);
|
189
|
-
} else {
|
190
|
-
offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);
|
191
|
-
offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);
|
192
|
-
}
|
193
|
-
vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
|
194
|
-
gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
|
195
|
-
vec4 texCoord = ${this.texCoordExpression};
|
196
|
-
float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;
|
197
|
-
float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;
|
198
|
-
v_texCoord = vec2(u, v);
|
199
|
-
u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
|
200
|
-
v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;
|
201
|
-
v_quadCoord = vec2(u, v);
|
202
|
-
${r.map(function(s){return" "+s.name+" = "+s.expression+";"}).join(`
|
203
|
-
`)}
|
204
|
-
}`}getSymbolFragmentShader(e){const t=e?" if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"";let i=this.varyings;return e&&(i=i.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;
|
205
|
-
uniform float u_time;
|
206
|
-
uniform float u_zoom;
|
207
|
-
uniform float u_resolution;
|
208
|
-
${this.uniforms.map(function(r){return"uniform "+r+";"}).join(`
|
209
|
-
`)}
|
210
|
-
varying vec2 v_texCoord;
|
211
|
-
varying vec2 v_quadCoord;
|
212
|
-
${i.map(function(r){return"varying "+r.type+" "+r.name+";"}).join(`
|
213
|
-
`)}
|
214
|
-
void main(void) {
|
215
|
-
if (${this.discardExpression}) { discard; }
|
216
|
-
gl_FragColor = ${this.colorExpression};
|
217
|
-
gl_FragColor.rgb *= gl_FragColor.a;
|
218
|
-
${t}
|
219
|
-
}`}}function IS(n){const e=n.symbol,t=e.size!==void 0?e.size:1,i=e.color||"white",r=e.textureCoord||[0,0,1,1],s=e.offset||[0,0],o=e.opacity!==void 0?e.opacity:1,a=e.rotation!==void 0?e.rotation:0,l={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{},functions:{}},u=te(l,t,q.NUMBER_ARRAY|q.NUMBER),c=te(l,s,q.NUMBER_ARRAY),h=te(l,r,q.NUMBER_ARRAY),f=te(l,a,q.NUMBER),d={inFragmentShader:!0,variables:l.variables,attributes:[],stringLiteralsMap:l.stringLiteralsMap,functions:{}},g=te(d,i,q.COLOR),m=te(d,o,q.NUMBER);let p="1.0";const _=`vec2(${te(d,t,q.NUMBER_ARRAY|q.NUMBER)}).x`;switch(e.symbolType){case"square":break;case"image":break;case"circle":p=`(1.0-smoothstep(1.-4./${_},1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))`;break;case"triangle":const y="(v_quadCoord*2.-1.)",T=`(atan(${y}.x,${y}.y))`;p=`(1.0-smoothstep(.5-3./${_},.5,cos(floor(.5+${T}/2.094395102)*2.094395102-${T})*length(${y})))`;break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}const v=new CS().setSizeExpression(`vec2(${u})`).setRotationExpression(f).setSymbolOffsetExpression(c).setTextureCoordinateExpression(h).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression(`vec4(${g}.rgb, ${g}.a * ${m} * ${p})`);if(n.filter){const y=te(d,n.filter,q.BOOLEAN);v.setFragmentDiscardExpression(`!${y}`)}const x={};if(d.variables.forEach(function(y){const T=qf(y);v.addUniform(`float ${T}`),x[T]=function(){if(!n.variables||n.variables[y]===void 0)throw new Error(`The following variable is missing from the style: ${y}`);let w=n.variables[y];return typeof w=="string"&&(w=qu(l,w)),w!==void 0?w:-9999999}}),e.symbolType==="image"&&e.src){const y=new Image;y.crossOrigin=e.crossOrigin===void 0?"anonymous":e.crossOrigin,y.src=e.src,v.addUniform("sampler2D u_texture").setColorExpression(v.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),x.u_texture=y}return d.attributes.forEach(function(y){l.attributes.includes(y)||l.attributes.push(y),v.addVarying(`v_${y}`,"float",`a_${y}`)}),l.attributes.forEach(function(y){v.addAttribute(`float a_${y}`)}),{builder:v,attributes:l.attributes.map(function(y){return{name:y,callback:function(T,w){let E=w[y];return typeof E=="string"&&(E=qu(l,E)),E!==void 0?E:-9999999}}}),uniforms:x}}class bG extends io{constructor(e){const t=Object.assign({},e);super(t),this.parseResult_=IS(e.style),this.styleVariables_=e.style.variables||{},this.hitDetectionDisabled_=!!e.disableHitDetection}createRenderer(){return new Vm(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitVertexShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.hitDetectionDisabled_&&this.parseResult_.builder.getSymbolFragmentShader(!0),uniforms:this.parseResult_.uniforms,attributes:this.parseResult_.attributes})}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}}var RG=bG;function AS(n,e){const t=`
|
220
|
-
attribute vec2 ${Hu.TEXTURE_COORD};
|
221
|
-
uniform mat4 ${xe.TILE_TRANSFORM};
|
222
|
-
uniform float ${xe.TEXTURE_PIXEL_WIDTH};
|
223
|
-
uniform float ${xe.TEXTURE_PIXEL_HEIGHT};
|
224
|
-
uniform float ${xe.TEXTURE_RESOLUTION};
|
225
|
-
uniform float ${xe.TEXTURE_ORIGIN_X};
|
226
|
-
uniform float ${xe.TEXTURE_ORIGIN_Y};
|
227
|
-
uniform float ${xe.DEPTH};
|
228
|
-
|
229
|
-
varying vec2 v_textureCoord;
|
230
|
-
varying vec2 v_mapCoord;
|
231
|
-
|
232
|
-
void main() {
|
233
|
-
v_textureCoord = ${Hu.TEXTURE_COORD};
|
234
|
-
v_mapCoord = vec2(
|
235
|
-
${xe.TEXTURE_ORIGIN_X} + ${xe.TEXTURE_RESOLUTION} * ${xe.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],
|
236
|
-
${xe.TEXTURE_ORIGIN_Y} - ${xe.TEXTURE_RESOLUTION} * ${xe.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]
|
237
|
-
);
|
238
|
-
gl_Position = ${xe.TILE_TRANSFORM} * vec4(${Hu.TEXTURE_COORD}, ${xe.DEPTH}, 1.0);
|
239
|
-
}
|
240
|
-
`,i={inFragmentShader:!0,variables:[],attributes:[],stringLiteralsMap:{},functions:{},bandCount:e},r=[];if(n.color!==void 0){const h=te(i,n.color,q.COLOR);r.push(`color = ${h};`)}if(n.contrast!==void 0){const h=te(i,n.contrast,q.NUMBER);r.push(`color.rgb = clamp((${h} + 1.0) * color.rgb - (${h} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(n.exposure!==void 0){const h=te(i,n.exposure,q.NUMBER);r.push(`color.rgb = clamp((${h} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(n.saturation!==void 0){const h=te(i,n.saturation,q.NUMBER);r.push(`
|
241
|
-
float saturation = ${h} + 1.0;
|
242
|
-
float sr = (1.0 - saturation) * 0.2126;
|
243
|
-
float sg = (1.0 - saturation) * 0.7152;
|
244
|
-
float sb = (1.0 - saturation) * 0.0722;
|
245
|
-
mat3 saturationMatrix = mat3(
|
246
|
-
sr + saturation, sr, sr,
|
247
|
-
sg, sg + saturation, sg,
|
248
|
-
sb, sb, sb + saturation
|
249
|
-
);
|
250
|
-
color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));
|
251
|
-
`)}if(n.gamma!==void 0){const h=te(i,n.gamma,q.NUMBER);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${h}));`)}if(n.brightness!==void 0){const h=te(i,n.brightness,q.NUMBER);r.push(`color.rgb = clamp(color.rgb + ${h}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const s={},o=i.variables.length;if(o>1&&!n.variables)throw new Error(`Missing variables in style (expected ${i.variables})`);for(let h=0;h<o;++h){const f=i.variables[h];if(!(f in n.variables))throw new Error(`Missing '${f}' in style variables`);const d=qf(f);s[d]=function(){let g=n.variables[f];return typeof g=="string"&&(g=qu(i,g)),g!==void 0?g:-9999999}}const a=Object.keys(s).map(function(h){return`uniform float ${h};`}),l=Math.ceil(e/4);a.push(`uniform sampler2D ${xe.TILE_TEXTURE_ARRAY}[${l}];`),i.paletteTextures&&a.push(`uniform sampler2D ${Z_}[${i.paletteTextures.length}];`);const u=Object.keys(i.functions).map(function(h){return i.functions[h]}),c=`
|
252
|
-
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
253
|
-
precision highp float;
|
254
|
-
#else
|
255
|
-
precision mediump float;
|
256
|
-
#endif
|
257
|
-
|
258
|
-
varying vec2 v_textureCoord;
|
259
|
-
varying vec2 v_mapCoord;
|
260
|
-
uniform vec4 ${xe.RENDER_EXTENT};
|
261
|
-
uniform float ${xe.TRANSITION_ALPHA};
|
262
|
-
uniform float ${xe.TEXTURE_PIXEL_WIDTH};
|
263
|
-
uniform float ${xe.TEXTURE_PIXEL_HEIGHT};
|
264
|
-
uniform float ${xe.RESOLUTION};
|
265
|
-
uniform float ${xe.ZOOM};
|
266
|
-
|
267
|
-
${a.join(`
|
268
|
-
`)}
|
269
|
-
|
270
|
-
${u.join(`
|
271
|
-
`)}
|
272
|
-
|
273
|
-
void main() {
|
274
|
-
if (
|
275
|
-
v_mapCoord[0] < ${xe.RENDER_EXTENT}[0] ||
|
276
|
-
v_mapCoord[1] < ${xe.RENDER_EXTENT}[1] ||
|
277
|
-
v_mapCoord[0] > ${xe.RENDER_EXTENT}[2] ||
|
278
|
-
v_mapCoord[1] > ${xe.RENDER_EXTENT}[3]
|
279
|
-
) {
|
280
|
-
discard;
|
281
|
-
}
|
282
|
-
|
283
|
-
vec4 color = texture2D(${xe.TILE_TEXTURE_ARRAY}[0], v_textureCoord);
|
284
|
-
|
285
|
-
${r.join(`
|
286
|
-
`)}
|
287
|
-
|
288
|
-
if (color.a == 0.0) {
|
289
|
-
discard;
|
290
|
-
}
|
291
|
-
|
292
|
-
gl_FragColor = color;
|
293
|
-
gl_FragColor.rgb *= gl_FragColor.a;
|
294
|
-
gl_FragColor *= ${xe.TRANSITION_ALPHA};
|
295
|
-
}`;return{vertexShader:t,fragmentShader:c,uniforms:s,paletteTextures:i.paletteTextures}}class LS extends Fm{constructor(e){e=e?Object.assign({},e):{};const t=e.style||{};delete e.style;const i=e.cacheSize;delete e.cacheSize,super(e),this.sources_=e.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=t,this.cacheSize_=i,this.styleVariables_=this.style_.variables||{},this.addChangeListener(Ge.SOURCE,this.handleSourceUpdate_)}getSources(e,t){const i=this.getSource();return this.sources_?typeof this.sources_=="function"?this.sources_(e,t):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const e=this.getRenderSource();return e?e.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const e=Number.MAX_SAFE_INTEGER,t=this.getSources([-e,-e,e,e],e);return t&&t.length&&"bandCount"in t[0]?t[0].bandCount:4}createRenderer(){const e=AS(this.style_,this.getSourceBandCount_());return new yS(this,{vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,cacheSize:this.cacheSize_,paletteTextures:e.paletteTextures})}renderSources(e,t){const i=this.getRenderer();let r;for(let s=0,o=t.length;s<o;++s)this.renderedSource_=t[s],i.prepareFrame(e)&&(r=i.renderFrame(e));return r}render(e,t){this.rendered=!0;const i=e.viewState,r=this.getSources(e.extent,i.resolution);let s=!0;for(let a=0,l=r.length;a<l;++a){const u=r[a],c=u.getState();if(c=="loading"){const h=()=>{u.getState()=="ready"&&(u.removeEventListener("change",h),this.changed())};u.addEventListener("change",h)}s=s&&c=="ready"}const o=this.renderSources(e,r);if(this.getRenderer().renderComplete&&s)return this.renderedResolution_=i.resolution,o;if(this.renderedResolution_>.5*i.resolution){const a=this.getSources(e.extent,this.renderedResolution_).filter(l=>!r.includes(l));if(a.length>0)return this.renderSources(e,a)}return o}setStyle(e){this.styleVariables_=e.variables||{},this.style_=e;const t=AS(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,paletteTextures:t.paletteTextures}),this.changed()}updateStyleVariables(e){Object.assign(this.styleVariables_,e),this.changed()}}LS.prototype.dispose;var CG=LS;let IG;function AG(n){const e=Object.keys(n.defs),t=e.length;let i,r;for(i=0;i<t;++i){const s=e[i];if(!J(s)){const o=n.defs(s);let a=o.units;!a&&o.projName==="longlat"&&(a="degrees"),yg(new Ws({code:s,axisOrientation:o.axis,metersPerUnit:o.to_meter,units:a}))}}for(i=0;i<t;++i){const s=e[i],o=J(s);for(r=0;r<t;++r){const a=e[r],l=J(a);if(!lg(s,a))if(n.defs[s]===n.defs[a])Hc([o,l]);else{const u=n(s,a);xv(o,l,Eg(o,l,u.forward),Eg(l,o,u.inverse))}}}}let LG=0;class PG{constructor(e,t,i,r,s){this.helper_=e,this.worker_=t,this.program_=this.helper_.getProgram(r,i),this.attributes=[],this.customAttributes=s}rebuild(e,t,i,r){e.renderInstructionsTransform=this.helper_.makeProjectionTransform(t,Le()),this.generateRenderInstructions(e),this.generateBuffers_(e,i,r)}render(e,t,i,r){this.helper_.makeProjectionTransform(i,t),qo(t,r,0),rr(t,e.invertVerticesBufferTransform),this.helper_.useProgram(this.program_,i),this.helper_.bindBuffer(e.verticesBuffer),this.helper_.bindBuffer(e.indicesBuffer),this.helper_.enableAttributes(this.attributes);const s=e.indicesBuffer.getSize();this.helper_.drawElements(0,s)}generateRenderInstructions(e){ae()}generateBuffers_(e,t,i){const r=LG++;let s;switch(t){case"Polygon":s=xo.GENERATE_POLYGON_BUFFERS;break;case"Point":s=xo.GENERATE_POINT_BUFFERS;break;case"LineString":s=xo.GENERATE_LINE_STRING_BUFFERS;break}const o={id:r,type:s,renderInstructions:e.renderInstructions.buffer,renderInstructionsTransform:e.renderInstructionsTransform,customAttributesCount:this.customAttributes.length};this.worker_.postMessage(o,[e.renderInstructions.buffer]),e.renderInstructions=null;const a=function(l){const u=l.data;u.id===r&&(this.worker_.removeEventListener("message",a),e.verticesBufferTransform=u.renderInstructionsTransform,Ur(e.invertVerticesBufferTransform,e.verticesBufferTransform),e.verticesBuffer.fromArrayBuffer(u.vertexBuffer),this.helper_.flushBufferData(e.verticesBuffer),e.indicesBuffer.fromArrayBuffer(u.indexBuffer),this.helper_.flushBufferData(e.indicesBuffer),e.renderInstructions=new Float32Array(u.renderInstructions),i())}.bind(this);this.worker_.addEventListener("message",a)}}var Jf=PG;const Qf={SEGMENT_START:"a_segmentStart",SEGMENT_END:"a_segmentEnd",PARAMETERS:"a_parameters"};class MG extends Jf{constructor(e,t,i,r,s){super(e,t,i,r,s),this.attributes=[{name:Qf.SEGMENT_START,size:2,type:wt.FLOAT},{name:Qf.SEGMENT_END,size:2,type:wt.FLOAT},{name:Qf.PARAMETERS,size:1,type:wt.FLOAT}].concat(s.map(function(o){return{name:"a_"+o.name,size:1,type:wt.FLOAT}}))}generateRenderInstructions(e){const t=2*e.verticesCount+(1+this.customAttributes.length)*e.geometriesCount;(!e.renderInstructions||e.renderInstructions.length!==t)&&(e.renderInstructions=new Float32Array(t));let i;const r=[];let s=0,o;for(const a in e.entries){i=e.entries[a];for(let l=0,u=i.flatCoordss.length;l<u;l++){r.length=i.flatCoordss[l].length,ci(i.flatCoordss[l],0,r.length,2,e.renderInstructionsTransform,r);for(let c=0,h=this.customAttributes.length;c<h;c++)o=this.customAttributes[c].callback(i.feature),e.renderInstructions[s++]=o;e.renderInstructions[s++]=r.length/2;for(let c=0,h=r.length;c<h;c+=2)e.renderInstructions[s++]=r[c],e.renderInstructions[s++]=r[c+1]}}}}var PS=MG;class FG{constructor(){this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0,renderInstructions:new Float32Array(0),verticesBuffer:new Qn(_r,vi),indicesBuffer:new Qn(cs,vi),renderInstructionsTransform:Le(),verticesBufferTransform:Le(),invertVerticesBufferTransform:Le()},this.pointBatch={entries:{},geometriesCount:0,renderInstructions:new Float32Array(0),verticesBuffer:new Qn(_r,vi),indicesBuffer:new Qn(cs,vi),renderInstructionsTransform:Le(),verticesBufferTransform:Le(),invertVerticesBufferTransform:Le()},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0,renderInstructions:new Float32Array(0),verticesBuffer:new Qn(_r,vi),indicesBuffer:new Qn(cs,vi),renderInstructionsTransform:Le(),verticesBufferTransform:Le(),invertVerticesBufferTransform:Le()}}addFeatures(e){for(let t=0;t<e.length;t++)this.addFeature(e[t])}addFeature(e){const t=e.getGeometry();!t||this.addGeometry_(t,e)}addFeatureEntryInPointBatch_(e){const t=H(e);return t in this.pointBatch.entries||(this.pointBatch.entries[t]={feature:e,flatCoordss:[]}),this.pointBatch.entries[t]}addFeatureEntryInLineStringBatch_(e){const t=H(e);return t in this.lineStringBatch.entries||(this.lineStringBatch.entries[t]={feature:e,flatCoordss:[],verticesCount:0}),this.lineStringBatch.entries[t]}addFeatureEntryInPolygonBatch_(e){const t=H(e);return t in this.polygonBatch.entries||(this.polygonBatch.entries[t]={feature:e,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]}),this.polygonBatch.entries[t]}clearFeatureEntryInPointBatch_(e){const t=this.pointBatch.entries[H(e)];!t||(this.pointBatch.geometriesCount-=t.flatCoordss.length,delete this.pointBatch.entries[H(e)])}clearFeatureEntryInLineStringBatch_(e){const t=this.lineStringBatch.entries[H(e)];!t||(this.lineStringBatch.verticesCount-=t.verticesCount,this.lineStringBatch.geometriesCount-=t.flatCoordss.length,delete this.lineStringBatch.entries[H(e)])}clearFeatureEntryInPolygonBatch_(e){const t=this.polygonBatch.entries[H(e)];!t||(this.polygonBatch.verticesCount-=t.verticesCount,this.polygonBatch.ringsCount-=t.ringsCount,this.polygonBatch.geometriesCount-=t.flatCoordss.length,delete this.polygonBatch.entries[H(e)])}addGeometry_(e,t){const i=e.getType();let r,s,o;switch(i){case"GeometryCollection":e.getGeometries().map(f=>this.addGeometry_(f,t));break;case"MultiPolygon":e.getPolygons().map(f=>this.addGeometry_(f,t));break;case"MultiLineString":e.getLineStrings().map(f=>this.addGeometry_(f,t));break;case"MultiPoint":e.getPoints().map(f=>this.addGeometry_(f,t));break;case"Polygon":const a=e;o=this.addFeatureEntryInPolygonBatch_(t),r=a.getFlatCoordinates(),s=r.length/2;const l=a.getLinearRingCount(),u=a.getEnds().map((f,d,g)=>d>0?(f-g[d-1])/2:f/2);this.polygonBatch.verticesCount+=s,this.polygonBatch.ringsCount+=l,this.polygonBatch.geometriesCount++,o.flatCoordss.push(r),o.ringsVerticesCounts.push(u),o.verticesCount+=s,o.ringsCount+=l,a.getLinearRings().map(f=>this.addGeometry_(f,t));break;case"Point":const c=e;o=this.addFeatureEntryInPointBatch_(t),r=c.getFlatCoordinates(),this.pointBatch.geometriesCount++,o.flatCoordss.push(r);break;case"LineString":case"LinearRing":const h=e;o=this.addFeatureEntryInLineStringBatch_(t),r=h.getFlatCoordinates(),s=r.length/2,this.lineStringBatch.verticesCount+=s,this.lineStringBatch.geometriesCount++,o.flatCoordss.push(r),o.verticesCount+=s;break}}changeFeature(e){this.clearFeatureEntryInPointBatch_(e),this.clearFeatureEntryInPolygonBatch_(e),this.clearFeatureEntryInLineStringBatch_(e);const t=e.getGeometry();!t||this.addGeometry_(t,e)}removeFeature(e){this.clearFeatureEntryInPointBatch_(e),this.clearFeatureEntryInPolygonBatch_(e),this.clearFeatureEntryInLineStringBatch_(e)}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0}}var MS=FG;const H_={POSITION:"a_position",INDEX:"a_index"};class OG extends Jf{constructor(e,t,i,r,s){super(e,t,i,r,s),this.attributes=[{name:H_.POSITION,size:2,type:wt.FLOAT},{name:H_.INDEX,size:1,type:wt.FLOAT}].concat(s.map(function(o){return{name:"a_"+o.name,size:1,type:wt.FLOAT}}))}generateRenderInstructions(e){const t=(2+this.customAttributes.length)*e.geometriesCount;(!e.renderInstructions||e.renderInstructions.length!==t)&&(e.renderInstructions=new Float32Array(t));let i;const r=[];let s=0,o;for(const a in e.entries){i=e.entries[a];for(let l=0,u=i.flatCoordss.length;l<u;l++){r[0]=i.flatCoordss[l][0],r[1]=i.flatCoordss[l][1],ke(e.renderInstructionsTransform,r),e.renderInstructions[s++]=r[0],e.renderInstructions[s++]=r[1];for(let c=0,h=this.customAttributes.length;c<h;c++)o=this.customAttributes[c].callback(i.feature),e.renderInstructions[s++]=o}}}}var FS=OG;const OS={POSITION:"a_position"};class $G extends Jf{constructor(e,t,i,r,s){super(e,t,i,r,s),this.attributes=[{name:OS.POSITION,size:2,type:wt.FLOAT}].concat(s.map(function(o){return{name:"a_"+o.name,size:1,type:wt.FLOAT}}))}generateRenderInstructions(e){const t=2*e.verticesCount+(1+this.customAttributes.length)*e.geometriesCount+e.ringsCount;(!e.renderInstructions||e.renderInstructions.length!==t)&&(e.renderInstructions=new Float32Array(t));let i;const r=[];let s=0,o;for(const a in e.entries){i=e.entries[a];for(let l=0,u=i.flatCoordss.length;l<u;l++){r.length=i.flatCoordss[l].length,ci(i.flatCoordss[l],0,r.length,2,e.renderInstructionsTransform,r);for(let c=0,h=this.customAttributes.length;c<h;c++)o=this.customAttributes[c].callback(i.feature),e.renderInstructions[s++]=o;e.renderInstructions[s++]=i.ringsVerticesCounts[l].length;for(let c=0,h=i.ringsVerticesCounts[l].length;c<h;c++)e.renderInstructions[s++]=i.ringsVerticesCounts[l][c];for(let c=0,h=r.length;c<h;c+=2)e.renderInstructions[s++]=r[c],e.renderInstructions[s++]=r[c+1]}}}}var $S=$G;function ed(n){const e=Kr(n),t=e[0]*256*256,i=e[1]*256,r=e[2];return t+i+r}const K_=`vec3(
|
296
|
-
fract(floor(a_color / 256.0 / 256.0) / 256.0),
|
297
|
-
fract(floor(a_color / 256.0) / 256.0),
|
298
|
-
fract(a_color / 256.0)
|
299
|
-
);`,DS=`
|
300
|
-
precision mediump float;
|
301
|
-
uniform mat4 u_projectionMatrix;
|
302
|
-
attribute vec2 a_position;
|
303
|
-
attribute float a_color;
|
304
|
-
attribute float a_opacity;
|
305
|
-
varying vec3 v_color;
|
306
|
-
varying float v_opacity;
|
307
|
-
|
308
|
-
void main(void) {
|
309
|
-
gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);
|
310
|
-
v_color = ${K_}
|
311
|
-
v_opacity = a_opacity;
|
312
|
-
}`,NS=`
|
313
|
-
precision mediump float;
|
314
|
-
varying vec3 v_color;
|
315
|
-
varying float v_opacity;
|
316
|
-
|
317
|
-
void main(void) {
|
318
|
-
gl_FragColor = vec4(v_color, 1.0) * v_opacity;
|
319
|
-
}`,kS=`
|
320
|
-
precision mediump float;
|
321
|
-
uniform mat4 u_projectionMatrix;
|
322
|
-
uniform vec2 u_sizePx;
|
323
|
-
attribute vec2 a_segmentStart;
|
324
|
-
attribute vec2 a_segmentEnd;
|
325
|
-
attribute float a_parameters;
|
326
|
-
attribute float a_color;
|
327
|
-
attribute float a_opacity;
|
328
|
-
attribute float a_width;
|
329
|
-
varying vec2 v_segmentStart;
|
330
|
-
varying vec2 v_segmentEnd;
|
331
|
-
varying float v_angleStart;
|
332
|
-
varying float v_angleEnd;
|
333
|
-
varying vec3 v_color;
|
334
|
-
varying float v_opacity;
|
335
|
-
varying float v_width;
|
336
|
-
|
337
|
-
vec2 worldToPx(vec2 worldPos) {
|
338
|
-
vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);
|
339
|
-
return (0.5 * screenPos.xy + 0.5) * u_sizePx;
|
340
|
-
}
|
341
|
-
|
342
|
-
vec4 pxToScreen(vec2 pxPos) {
|
343
|
-
vec2 screenPos = pxPos * 4.0 / u_sizePx;
|
344
|
-
return vec4(screenPos.xy, 0.0, 0.0);
|
345
|
-
}
|
346
|
-
|
347
|
-
vec2 getOffsetDirection(vec2 normalPx, vec2 tangentPx, float joinAngle) {
|
348
|
-
if (cos(joinAngle) > 0.93) return normalPx - tangentPx;
|
349
|
-
float halfAngle = joinAngle / 2.0;
|
350
|
-
vec2 angleBisectorNormal = vec2(
|
351
|
-
sin(halfAngle) * normalPx.x + cos(halfAngle) * normalPx.y,
|
352
|
-
-cos(halfAngle) * normalPx.x + sin(halfAngle) * normalPx.y
|
353
|
-
);
|
354
|
-
float length = 1.0 / sin(halfAngle);
|
355
|
-
return angleBisectorNormal * length;
|
356
|
-
}
|
357
|
-
|
358
|
-
void main(void) {
|
359
|
-
float anglePrecision = 1500.0;
|
360
|
-
float paramShift = 10000.0;
|
361
|
-
v_angleStart = fract(a_parameters / paramShift) * paramShift / anglePrecision;
|
362
|
-
v_angleEnd = fract(floor(a_parameters / paramShift + 0.5) / paramShift) * paramShift / anglePrecision;
|
363
|
-
float vertexNumber = floor(a_parameters / paramShift / paramShift + 0.0001);
|
364
|
-
vec2 tangentPx = worldToPx(a_segmentEnd) - worldToPx(a_segmentStart);
|
365
|
-
tangentPx = normalize(tangentPx);
|
366
|
-
vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);
|
367
|
-
float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;
|
368
|
-
float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;
|
369
|
-
float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;
|
370
|
-
vec2 offsetPx = getOffsetDirection(normalPx * normalDir, tangentDir * tangentPx, angle) * a_width * 0.5;
|
371
|
-
vec2 position = vertexNumber < 1.5 ? a_segmentStart : a_segmentEnd;
|
372
|
-
gl_Position = u_projectionMatrix * vec4(position, 0.0, 1.0) + pxToScreen(offsetPx);
|
373
|
-
v_segmentStart = worldToPx(a_segmentStart);
|
374
|
-
v_segmentEnd = worldToPx(a_segmentEnd);
|
375
|
-
v_color = ${K_}
|
376
|
-
v_opacity = a_opacity;
|
377
|
-
v_width = a_width;
|
378
|
-
}`,GS=`
|
379
|
-
precision mediump float;
|
380
|
-
uniform float u_pixelRatio;
|
381
|
-
varying vec2 v_segmentStart;
|
382
|
-
varying vec2 v_segmentEnd;
|
383
|
-
varying float v_angleStart;
|
384
|
-
varying float v_angleEnd;
|
385
|
-
varying vec3 v_color;
|
386
|
-
varying float v_opacity;
|
387
|
-
varying float v_width;
|
388
|
-
|
389
|
-
float segmentDistanceField(vec2 point, vec2 start, vec2 end, float radius) {
|
390
|
-
vec2 startToPoint = point - start;
|
391
|
-
vec2 startToEnd = end - start;
|
392
|
-
float ratio = clamp(dot(startToPoint, startToEnd) / dot(startToEnd, startToEnd), 0.0, 1.0);
|
393
|
-
float dist = length(startToPoint - ratio * startToEnd);
|
394
|
-
return 1.0 - smoothstep(radius - 1.0, radius, dist);
|
395
|
-
}
|
396
|
-
|
397
|
-
void main(void) {
|
398
|
-
vec2 v_currentPoint = gl_FragCoord.xy / u_pixelRatio;
|
399
|
-
gl_FragColor = vec4(v_color, 1.0) * v_opacity;
|
400
|
-
gl_FragColor *= segmentDistanceField(v_currentPoint, v_segmentStart, v_segmentEnd, v_width);
|
401
|
-
}`,US=`
|
402
|
-
precision mediump float;
|
403
|
-
uniform mat4 u_projectionMatrix;
|
404
|
-
uniform mat4 u_offsetScaleMatrix;
|
405
|
-
attribute vec2 a_position;
|
406
|
-
attribute float a_index;
|
407
|
-
attribute float a_color;
|
408
|
-
attribute float a_opacity;
|
409
|
-
varying vec2 v_texCoord;
|
410
|
-
varying vec3 v_color;
|
411
|
-
varying float v_opacity;
|
412
|
-
|
413
|
-
void main(void) {
|
414
|
-
mat4 offsetMatrix = u_offsetScaleMatrix;
|
415
|
-
float size = 6.0;
|
416
|
-
float offsetX = a_index == 0.0 || a_index == 3.0 ? -size / 2.0 : size / 2.0;
|
417
|
-
float offsetY = a_index == 0.0 || a_index == 1.0 ? -size / 2.0 : size / 2.0;
|
418
|
-
vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);
|
419
|
-
gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;
|
420
|
-
float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;
|
421
|
-
float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;
|
422
|
-
v_texCoord = vec2(u, v);
|
423
|
-
v_color = ${K_}
|
424
|
-
v_opacity = a_opacity;
|
425
|
-
}`,BS=`
|
426
|
-
precision mediump float;
|
427
|
-
varying vec3 v_color;
|
428
|
-
varying float v_opacity;
|
429
|
-
|
430
|
-
void main(void) {
|
431
|
-
gl_FragColor = vec4(v_color, 1.0) * v_opacity;
|
432
|
-
}`;function q_(n){return Object.keys(n).map(e=>({name:e,callback:n[e]}))}class DG extends Tf{constructor(e,t){const i=t.uniforms||{},r=Le();i[Ui.PROJECTION_MATRIX]=r,super(e,{uniforms:i,postProcesses:t.postProcesses}),this.sourceRevision_=-1,this.previousExtent_=Ft(),this.currentTransform_=r;const s=Pr({color:function(){return ed("#ddd")},opacity:function(){return 1}},t.fill&&t.fill.attributes),o=Pr({color:function(){return ed("#eee")},opacity:function(){return 1},width:function(){return 1.5}},t.stroke&&t.stroke.attributes),a=Pr({color:function(){return ed("#eee")},opacity:function(){return 1}},t.point&&t.point.attributes);this.fillVertexShader_=t.fill&&t.fill.vertexShader||DS,this.fillFragmentShader_=t.fill&&t.fill.fragmentShader||NS,this.fillAttributes_=q_(s),this.strokeVertexShader_=t.stroke&&t.stroke.vertexShader||kS,this.strokeFragmentShader_=t.stroke&&t.stroke.fragmentShader||GS,this.strokeAttributes_=q_(o),this.pointVertexShader_=t.point&&t.point.vertexShader||US,this.pointFragmentShader_=t.point&&t.point.fragmentShader||BS,this.pointAttributes_=q_(a),this.worker_=rT(),this.batch_=new MS;const l=this.getLayer().getSource();this.batch_.addFeatures(l.getFeatures()),this.sourceListenKeys_=[re(l,ct.ADDFEATURE,this.handleSourceFeatureAdded_,this),re(l,ct.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),re(l,ct.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),re(l,ct.CLEAR,this.handleSourceFeatureClear_,this)]}afterHelperCreated(){this.polygonRenderer_=new $S(this.helper,this.worker_,this.fillVertexShader_,this.fillFragmentShader_,this.fillAttributes_),this.pointRenderer_=new FS(this.helper,this.worker_,this.pointVertexShader_,this.pointFragmentShader_,this.pointAttributes_),this.lineStringRenderer_=new PS(this.helper,this.worker_,this.strokeVertexShader_,this.strokeFragmentShader_,this.strokeAttributes_)}handleSourceFeatureAdded_(e){const t=e.feature;this.batch_.addFeature(t)}handleSourceFeatureChanged_(e){const t=e.feature;this.batch_.changeFeature(t)}handleSourceFeatureDelete_(e){const t=e.feature;this.batch_.removeFeature(t)}handleSourceFeatureClear_(){this.batch_.clear()}renderFrame(e){const t=this.helper.getGL();this.preRender(t,e);const r=this.getLayer().getSource(),s=e.viewState.projection,o=r.getWrapX()&&s.canWrapX(),a=s.getExtent(),l=e.extent,u=o?_e(a):null,c=o?Math.ceil((l[2]-a[2])/u)+1:1;let h=o?Math.floor((l[0]-a[0])/u):0;do this.polygonRenderer_.render(this.batch_.polygonBatch,this.currentTransform_,e,h*u),this.lineStringRenderer_.render(this.batch_.lineStringBatch,this.currentTransform_,e,h*u),this.pointRenderer_.render(this.batch_.pointBatch,this.currentTransform_,e,h*u);while(++h<c);this.helper.finalizeDraw(e);const f=this.helper.getCanvas(),g=e.layerStatesArray[e.layerIndex].opacity;return g!==parseFloat(f.style.opacity)&&(f.style.opacity=String(g)),this.postRender(t,e),f}prepareFrameInternal(e){const t=this.getLayer(),i=t.getSource(),r=e.viewState,s=!e.viewHints[Ye.ANIMATING]&&!e.viewHints[Ye.INTERACTING],o=!In(this.previousExtent_,e.extent),a=this.sourceRevision_<i.getRevision();if(a&&(this.sourceRevision_=i.getRevision()),s&&(o||a)){const l=r.projection,u=r.resolution,c=t instanceof vo?t.getRenderBuffer():0,h=hn(e.extent,c*u);i.loadFeatures(h,u,l),this.ready=!1;let f=3;const d=()=>{f--,this.ready=f<=0,this.getLayer().changed()};this.polygonRenderer_.rebuild(this.batch_.polygonBatch,e,"Polygon",d),this.lineStringRenderer_.rebuild(this.batch_.lineStringBatch,e,"LineString",d),this.pointRenderer_.rebuild(this.batch_.pointBatch,e,"Point",d),this.previousExtent_=e.extent.slice()}return this.helper.makeProjectionTransform(e,this.currentTransform_),this.helper.prepareDraw(e),!0}forEachFeatureAtCoordinate(e,t,i,r,s){}disposeInternal(){this.worker_.terminate(),this.layer_=null,this.sourceListenKeys_.forEach(function(e){Pe(e)}),this.sourceListenKeys_=null,super.disposeInternal()}}var NG=DG;class kG extends Ul{constructor(e,t,i,r,s,o,a){const l=e.getExtent(),u=t.getExtent(),c=u?zt(i,u):i,h=Ot(c),f=za(e,t,h,r),d=Xm,g=new Ym(e,t,c,l,f*d,r),m=g.calculateSourceExtent(),p=o(m,f,s),_=p?ce.IDLE:ce.EMPTY,v=p?p.getPixelRatio():1;super(i,r,v,_),this.targetProj_=t,this.maxSourceExtent_=l,this.triangulation_=g,this.targetResolution_=r,this.targetExtent_=i,this.sourceImage_=p,this.sourcePixelRatio_=v,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==ce.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(e==ce.LOADED){const t=_e(this.targetExtent_)/this.targetResolution_,i=Xe(this.targetExtent_)/this.targetResolution_;this.canvas_=Km(t,i,this.sourcePixelRatio_,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=e,this.changed()}load(){if(this.state==ce.IDLE){this.state=ce.LOADING,this.changed();const e=this.sourceImage_.getState();e==ce.LOADED||e==ce.ERROR?this.reproject_():(this.sourceListenerKey_=re(this.sourceImage_,K.CHANGE,function(t){const i=this.sourceImage_.getState();(i==ce.LOADED||i==ce.ERROR)&&(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}}unlistenSource_(){Pe(this.sourceListenerKey_),this.sourceListenerKey_=null}}var zS=kG;function VS(n){const e=n[0],t=new Array(e);let i=1<<e-1,r,s;for(r=0;r<e;++r)s=48,n[1]&i&&(s+=1),n[2]&i&&(s+=2),t[r]=String.fromCharCode(s),i>>=1;return t.join("")}const GG='<a class="ol-attribution-bing-tos" href="https://www.microsoft.com/maps/product/terms.html" target="_blank">Terms of Use</a>';class UG extends Vi{constructor(e){const t=e.hidpi!==void 0?e.hidpi:!1;super({cacheSize:e.cacheSize,crossOrigin:"anonymous",interpolate:e.interpolate,opaque:!0,projection:J("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,tilePixelRatio:t?2:1,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.hidpi_=t,this.culture_=e.culture!==void 0?e.culture:"en-us",this.maxZoom_=e.maxZoom!==void 0?e.maxZoom:-1,this.apiKey_=e.key,this.imagerySet_=e.imagerySet;const i="https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;Nu(i,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(e){if(e.statusCode!=200||e.statusDescription!="OK"||e.authenticationResultCode!="ValidCredentials"||e.resourceSets.length!=1||e.resourceSets[0].resources.length!=1){this.setState("error");return}const t=e.resourceSets[0].resources[0],i=this.maxZoom_==-1?t.zoomMax:this.maxZoom_,r=this.getProjection(),s=yr(r),o=this.hidpi_?2:1,a=t.imageWidth==t.imageHeight?t.imageWidth/o:[t.imageWidth/o,t.imageHeight/o],l=So({extent:s,minZoom:t.zoomMin,maxZoom:i,tileSize:a});this.tileGrid=l;const u=this.culture_,c=this.hidpi_;if(this.tileUrlFunction=Va(t.imageUrlSubdomains.map(function(h){const f=[0,0,0],d=t.imageUrl.replace("{subdomain}",h).replace("{culture}",u);return function(g,m,p){if(g){_a(g[0],g[1],g[2],f);let _=d;return c&&(_+="&dpi=d1&device=mobile"),_.replace("{quadkey}",VS(f))}else return}})),t.imageryProviders){const h=Un(J("EPSG:4326"),this.getProjection());this.setAttributions(function(f){const d=[],g=f.viewState,m=this.getTileGrid(),p=m.getZForResolution(g.resolution,this.zDirection),v=m.getTileCoordForCoordAndZ(g.center,p)[0];return t.imageryProviders.map(function(x){let y=!1;const T=x.coverageAreas;for(let w=0,E=T.length;w<E;++w){const S=T[w];if(v>=S.zoomMin&&v<=S.zoomMax){const b=S.bbox,R=[b[1],b[0],b[3],b[2]],C=Zs(R,h);if(Je(C,f.extent)){y=!0;break}}}y&&d.push(x.attribution)}),d.push(GG),d}.bind(this))}this.setState("ready")}}var BG=UG;class zG extends Vi{constructor(e){e=e||{};const t=e.projection!==void 0?e.projection:"EPSG:3857",i=e.tileGrid!==void 0?e.tileGrid:So({extent:yr(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize});super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,opaque:e.opaque,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0}getGutter(){return this.gutter_}}var Ju=zG;class VG extends Ju{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,maxZoom:e.maxZoom!==void 0?e.maxZoom:18,minZoom:e.minZoom,projection:e.projection,transition:e.transition,wrapX:e.wrapX,zDirection:e.zDirection}),this.account_=e.account,this.mapId_=e.map||"",this.config_=e.config||{},this.templateCache_={},this.initializeMap_()}getConfig(){return this.config_}updateConfig(e){Object.assign(this.config_,e),this.initializeMap_()}setConfig(e){this.config_=e||{},this.initializeMap_()}initializeMap_(){const e=JSON.stringify(this.config_);if(this.templateCache_[e]){this.applyTemplate_(this.templateCache_[e]);return}let t="https://"+this.account_+".carto.com/api/v1/map";this.mapId_&&(t+="/named/"+this.mapId_);const i=new XMLHttpRequest;i.addEventListener("load",this.handleInitResponse_.bind(this,e)),i.addEventListener("error",this.handleInitError_.bind(this)),i.open("POST",t),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.config_))}handleInitResponse_(e,t){const i=t.target;if(!i.status||i.status>=200&&i.status<300){let r;try{r=JSON.parse(i.responseText)}catch{this.setState("error");return}this.applyTemplate_(r),this.templateCache_[e]=r,this.setState("ready")}else this.setState("error")}handleInitError_(e){this.setState("error")}applyTemplate_(e){const t="https://"+e.cdn_url.https+"/"+this.account_+"/api/v1/map/"+e.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(t)}}var jG=VG;class XG extends us{constructor(e){super({attributions:e.attributions,wrapX:e.wrapX}),this.resolution=void 0,this.distance=e.distance!==void 0?e.distance:20,this.minDistance=e.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=e.geometryFunction||function(t){const i=t.getGeometry();return ne(i.getType()=="Point",10),i},this.createCustomCluster_=e.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(e.source||null)}clear(e){this.features.length=0,super.clear(e)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(e,t,i){this.source.loadFeatures(e,t,i),t!==this.resolution&&(this.resolution=t,this.refresh())}setDistance(e){this.updateDistance(e,this.minDistance)}setMinDistance(e){this.updateDistance(this.distance,e)}getMinDistance(){return this.minDistance}setSource(e){this.source&&this.source.removeEventListener(K.CHANGE,this.boundRefresh_),this.source=e,e&&e.addEventListener(K.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(e,t){const i=e===0?0:Math.min(t,e)/e,r=e!==this.distance||this.interpolationRatio!==i;this.distance=e,this.minDistance=t,this.interpolationRatio=i,r&&this.refresh()}cluster(){if(this.resolution===void 0||!this.source)return;const e=Ft(),t=this.distance*this.resolution,i=this.source.getFeatures(),r={};for(let s=0,o=i.length;s<o;s++){const a=i[s];if(!(H(a)in r)){const l=this.geometryFunction(a);if(l){const u=l.getCoordinates();zs(u,e),hn(e,t,e);const c=this.source.getFeaturesInExtent(e).filter(function(h){const f=H(h);return f in r?!1:(r[f]=!0,!0)});this.features.push(this.createCluster(c,e))}}}}createCluster(e,t){const i=[0,0];for(let a=e.length-1;a>=0;--a){const l=this.geometryFunction(e[a]);l?fg(i,l.getCoordinates()):e.splice(a,1)}dg(i,1/e.length);const r=Ot(t),s=this.interpolationRatio,o=new st([i[0]*(1-s)+r[0]*s,i[1]*(1-s)+r[1]*s]);return this.createCustomCluster_?this.createCustomCluster_(o,e):new Ne({geometry:o,features:e})}}var YG=XG;class ZG extends Du{constructor(e){const t=e.projection===void 0?"EPSG:3857":e.projection;let i=e.tileGrid;i===void 0&&t&&(i=So({extent:yr(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize})),super({cacheSize:.1,attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:t,tileGrid:i,opaque:e.opaque,state:e.state,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate}),this.gutter_=e.gutter!==void 0?e.gutter:0,this.tileSize_=e.tileSize?tt(e.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=e.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=e.bandCount===void 0?4:e.bandCount}setTileSizes(e){this.tileSizes_=e}getTileSize(e){if(this.tileSizes_)return this.tileSizes_[e];if(this.tileSize_)return this.tileSize_;const t=this.getTileGrid();return t?tt(t.getTileSize(e)):[256,256]}getGutterForProjection(e){return this.gutter_}setLoader(e){this.loader_=e}getTile(e,t,i,r,s){const o=this.getTileSize(e),a=$i(e,t,i);if(this.tileCache.containsKey(a))return this.tileCache.get(a);const l=this.loader_;function u(){return Oy(function(){return l(e,t,i)})}const c=Object.assign({tileCoord:[e,t,i],loader:u,size:o},this.tileOptions),h=new Hd(c);return h.key=this.getKey(),h.addEventListener(K.CHANGE,this.handleTileChange_),this.tileCache.set(a,h),h}handleTileChange_(e){const t=e.target,i=H(t),r=t.getState();let s;r==V.LOADING?(this.tileLoadingKeys_[i]=!0,s=To.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],s=r==V.ERROR?To.TILELOADERROR:r==V.LOADED?To.TILELOADEND:void 0),s&&this.dispatchEvent(new Qm(s,t))}}var jS=ZG;function qt(n){return(e,...t)=>WG(n,e,t)}function Ja(n,e){return qt(XS(n,e).get)}const{apply:WG,construct:X8,defineProperty:Y8,get:Z8,getOwnPropertyDescriptor:XS,getPrototypeOf:J_,has:W8,ownKeys:HG,set:H8,setPrototypeOf:K8}=Reflect,{iterator:Qu,species:q8,toStringTag:KG,for:J8}=Symbol,qG=Object,{create:Q_,defineProperty:JG,freeze:Q8,is:e6}=qG,QG=Array,eU=QG.prototype,YS=eU[Qu],tU=qt(YS),ZS=ArrayBuffer,nU=ZS.prototype;Ja(nU,"byteLength");const WS=typeof SharedArrayBuffer!="undefined"?SharedArrayBuffer:null;WS&&Ja(WS.prototype,"byteLength");const HS=J_(Uint8Array);HS.from;const En=HS.prototype;En[Qu],qt(En.keys),qt(En.values),qt(En.entries),qt(En.set),qt(En.reverse),qt(En.fill),qt(En.copyWithin),qt(En.sort),qt(En.slice),qt(En.subarray),Ja(En,"buffer"),Ja(En,"byteOffset"),Ja(En,"length"),Ja(En,KG);const Qa=Uint32Array,iU=Float32Array,td=J_([][Qu]()),rU=qt(td.next),sU=qt(function*(){}().next),oU=J_(td),aU=DataView.prototype,lU=qt(aU.getUint16),e0=WeakMap,KS=e0.prototype,qS=qt(KS.get),uU=qt(KS.set),JS=new e0,cU=Q_(null,{next:{value:function(){const e=qS(JS,this);return rU(e)}},[Qu]:{value:function(){return this}}});function hU(n){if(n[Qu]===YS)return n;const e=Q_(cU);return uU(JS,e,tU(n)),e}const fU=new e0,dU=Q_(oU,{next:{value:function(){const e=qS(fU,this);return sU(e)},writable:!0,configurable:!0}});for(const n of HG(td))n!=="next"&&JG(dU,n,XS(td,n));const QS=new ZS(4),gU=new iU(QS),pU=new Qa(QS),Zi=new Qa(512),Wi=new Qa(512);for(let n=0;n<256;++n){const e=n-127;e<-27?(Zi[n]=0,Zi[n|256]=32768,Wi[n]=24,Wi[n|256]=24):e<-14?(Zi[n]=1024>>-e-14,Zi[n|256]=1024>>-e-14|32768,Wi[n]=-e-1,Wi[n|256]=-e-1):e<=15?(Zi[n]=e+15<<10,Zi[n|256]=e+15<<10|32768,Wi[n]=13,Wi[n|256]=13):e<128?(Zi[n]=31744,Zi[n|256]=64512,Wi[n]=24,Wi[n|256]=24):(Zi[n]=31744,Zi[n|256]=64512,Wi[n]=13,Wi[n|256]=13)}const t0=new Qa(2048),el=new Qa(64),eb=new Qa(64);for(let n=1;n<1024;++n){let e=n<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,t0[n]=e|t}for(let n=1024;n<2048;++n)t0[n]=939524096+(n-1024<<13);for(let n=1;n<31;++n)el[n]=n<<23;el[31]=1199570944,el[32]=2147483648;for(let n=33;n<63;++n)el[n]=2147483648+(n-32<<23);el[63]=3347054592;for(let n=1;n<64;++n)n!==32&&(eb[n]=1024);function mU(n){const e=n>>10;return pU[0]=t0[eb[e]+(n&1023)]+el[e],gU[0]}function tb(n,e,...t){return mU(lU(n,e,...hU(t)))}var n0={exports:{}};function nb(n,e,t){const i=t&&t.debug||!1;i&&console.log("getting "+e+" in "+n);const r=typeof n=="object"?n.outer:n,s=`${e}\\="([^"]*)"`;i&&console.log("pattern:",s);const a=new RegExp(s).exec(r);if(i&&console.log("match:",a),a)return a[1]}n0.exports=nb,n0.exports.default=nb;var i0=n0.exports,r0={exports:{}},s0={exports:{}},o0={exports:{}};function ib(n,e,t){const r=new RegExp(e).exec(n.slice(t));return r?t+r.index:-1}o0.exports=ib,o0.exports.default=ib;var a0={exports:{}};function rb(n,e,t){const r=new RegExp(e).exec(n.slice(t));return r?t+r.index+r[0].length-1:-1}a0.exports=rb,a0.exports.default=rb;var l0={exports:{}};function sb(n,e){const t=new RegExp(e,"g"),i=n.match(t);return i?i.length:0}l0.exports=sb,l0.exports.default=sb;const _U=o0.exports,u0=a0.exports,ob=l0.exports;function ab(n,e,t){const i=t&&t.debug||!1,r=!(t&&typeof t.nested===!1),s=t&&t.startIndex||0;i&&console.log("[xml-utils] starting findTagByName with",e," and ",t);const o=_U(n,`<${e}[ >/]`,s);if(i&&console.log("[xml-utils] start:",o),o===-1)return;const a=n.slice(o+e.length);let l=u0(a,"^[^<]*[ /]>",0);const u=l!==-1&&a[l-1]==="/";if(i&&console.log("[xml-utils] selfClosing:",u),u===!1)if(r){let d=0,g=1,m=0;for(;(l=u0(a,"[ /]"+e+">",d))!==-1;){const p=a.substring(d,l+1);if(g+=ob(p,"<"+e),m+=ob(p,"/"+e+">"),m>=g)break;d=l}}else l=u0(a,"[ /]"+e+">",0);const c=o+e.length+l+1;if(i&&console.log("[xml-utils] end:",c),c===-1)return;const h=n.slice(o,c);let f;return u?f=null:f=h.slice(h.indexOf(">")+1,h.lastIndexOf("<")),{inner:f,outer:h,start:o,end:c}}s0.exports=ab,s0.exports.default=ab;const yU=s0.exports;function lb(n,e,t){const i=[],r=t&&t.debug||!1,s=t&&typeof t.nested=="boolean"?t.nested:!0;let o=t&&t.startIndex||0,a;for(;a=yU(n,e,{debug:r,startIndex:o});)s?o=a.start+1+e.length:o=a.end,i.push(a);return r&&console.log("findTagsByName found",i.length,"tags"),i}r0.exports=lb,r0.exports.default=lb;var vU=r0.exports;const ec={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Hi={};for(const n in ec)ec.hasOwnProperty(n)&&(Hi[ec[n]]=parseInt(n,10));const xU=[Hi.BitsPerSample,Hi.ExtraSamples,Hi.SampleFormat,Hi.StripByteCounts,Hi.StripOffsets,Hi.StripRowCounts,Hi.TileByteCounts,Hi.TileOffsets,Hi.SubIFDs],c0={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},Re={};for(const n in c0)c0.hasOwnProperty(n)&&(Re[c0[n]]=parseInt(n,10));const On={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},EU={Unspecified:0,Assocalpha:1,Unassalpha:2},wU={Version:0,AddCompression:1},ub={None:0,Deflate:1},TU={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function SU(n,e){const{width:t,height:i}=n,r=new Uint8Array(t*i*3);let s;for(let o=0,a=0;o<n.length;++o,a+=3)s=256-n[o]/e*256,r[a]=s,r[a+1]=s,r[a+2]=s;return r}function bU(n,e){const{width:t,height:i}=n,r=new Uint8Array(t*i*3);let s;for(let o=0,a=0;o<n.length;++o,a+=3)s=n[o]/e*256,r[a]=s,r[a+1]=s,r[a+2]=s;return r}function RU(n,e){const{width:t,height:i}=n,r=new Uint8Array(t*i*3),s=e.length/3,o=e.length/3*2;for(let a=0,l=0;a<n.length;++a,l+=3){const u=n[a];r[l]=e[u]/65536*256,r[l+1]=e[u+s]/65536*256,r[l+2]=e[u+o]/65536*256}return r}function CU(n){const{width:e,height:t}=n,i=new Uint8Array(e*t*3);for(let r=0,s=0;r<n.length;r+=4,s+=3){const o=n[r],a=n[r+1],l=n[r+2],u=n[r+3];i[s]=255*((255-o)/256)*((255-u)/256),i[s+1]=255*((255-a)/256)*((255-u)/256),i[s+2]=255*((255-l)/256)*((255-u)/256)}return i}function IU(n){const{width:e,height:t}=n,i=new Uint8ClampedArray(e*t*3);for(let r=0,s=0;r<n.length;r+=3,s+=3){const o=n[r],a=n[r+1],l=n[r+2];i[s]=o+1.402*(l-128),i[s+1]=o-.34414*(a-128)-.71414*(l-128),i[s+2]=o+1.772*(a-128)}return i}const AU=.95047,LU=1,PU=1.08883;function MU(n){const{width:e,height:t}=n,i=new Uint8Array(e*t*3);for(let r=0,s=0;r<n.length;r+=3,s+=3){const o=n[r+0],a=n[r+1]<<24>>24,l=n[r+2]<<24>>24;let u=(o+16)/116,c=a/500+u,h=u-l/200,f,d,g;c=AU*(c*c*c>.008856?c*c*c:(c-16/116)/7.787),u=LU*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),h=PU*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),f=c*3.2406+u*-1.5372+h*-.4986,d=c*-.9689+u*1.8758+h*.0415,g=c*.0557+u*-.204+h*1.057,f=f>.0031308?1.055*f**(1/2.4)-.055:12.92*f,d=d>.0031308?1.055*d**(1/2.4)-.055:12.92*d,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,i[s]=Math.max(0,Math.min(1,f))*255,i[s+1]=Math.max(0,Math.min(1,d))*255,i[s+2]=Math.max(0,Math.min(1,g))*255}return i}const cb=new Map;function Ss(n,e){Array.isArray(n)||(n=[n]),n.forEach(t=>cb.set(t,e))}async function hb(n){const e=cb.get(n.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${n.Compression}`);const t=await e();return new t(n)}Ss([void 0,1],()=>Promise.resolve().then(function(){return VB}).then(n=>n.default)),Ss(5,()=>Promise.resolve().then(function(){return WB}).then(n=>n.default)),Ss(6,()=>{throw new Error("old style JPEG compression is not supported.")}),Ss(7,()=>Promise.resolve().then(function(){return QB}).then(n=>n.default)),Ss([8,32946],()=>Promise.resolve().then(function(){return M8}).then(n=>n.default)),Ss(32773,()=>Promise.resolve().then(function(){return O8}).then(n=>n.default)),Ss(34887,()=>Promise.resolve().then(function(){return N8}).then(n=>n.default)),Ss(50001,()=>Promise.resolve().then(function(){return G8}).then(n=>n.default));function nd(n,e,t,i=1){return new(Object.getPrototypeOf(n)).constructor(e*t*i)}function FU(n,e,t,i,r){const s=e/i,o=t/r;return n.map(a=>{const l=nd(a,i,r);for(let u=0;u<r;++u){const c=Math.min(Math.round(o*u),t-1);for(let h=0;h<i;++h){const f=Math.min(Math.round(s*h),e-1),d=a[c*e+f];l[u*i+h]=d}}return l})}function tl(n,e,t){return(1-t)*n+t*e}function OU(n,e,t,i,r){const s=e/i,o=t/r;return n.map(a=>{const l=nd(a,i,r);for(let u=0;u<r;++u){const c=o*u,h=Math.floor(c),f=Math.min(Math.ceil(c),t-1);for(let d=0;d<i;++d){const g=s*d,m=g%1,p=Math.floor(g),_=Math.min(Math.ceil(g),e-1),v=a[h*e+p],x=a[h*e+_],y=a[f*e+p],T=a[f*e+_],w=tl(tl(v,x,m),tl(y,T,m),c%1);l[u*i+d]=w}}return l})}function $U(n,e,t,i,r,s="nearest"){switch(s.toLowerCase()){case"nearest":return FU(n,e,t,i,r);case"bilinear":case"linear":return OU(n,e,t,i,r);default:throw new Error(`Unsupported resampling method: '${s}'`)}}function DU(n,e,t,i,r,s){const o=e/i,a=t/r,l=nd(n,i,r,s);for(let u=0;u<r;++u){const c=Math.min(Math.round(a*u),t-1);for(let h=0;h<i;++h){const f=Math.min(Math.round(o*h),e-1);for(let d=0;d<s;++d){const g=n[c*e*s+f*s+d];l[u*i*s+h*s+d]=g}}}return l}function NU(n,e,t,i,r,s){const o=e/i,a=t/r,l=nd(n,i,r,s);for(let u=0;u<r;++u){const c=a*u,h=Math.floor(c),f=Math.min(Math.ceil(c),t-1);for(let d=0;d<i;++d){const g=o*d,m=g%1,p=Math.floor(g),_=Math.min(Math.ceil(g),e-1);for(let v=0;v<s;++v){const x=n[h*e*s+p*s+v],y=n[h*e*s+_*s+v],T=n[f*e*s+p*s+v],w=n[f*e*s+_*s+v],E=tl(tl(x,y,m),tl(T,w,m),c%1);l[u*i*s+d*s+v]=E}}}return l}function kU(n,e,t,i,r,s,o="nearest"){switch(o.toLowerCase()){case"nearest":return DU(n,e,t,i,r,s);case"bilinear":case"linear":return NU(n,e,t,i,r,s);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function GU(n,e,t){let i=0;for(let r=e;r<t;++r)i+=n[r];return i}function h0(n,e,t){switch(n){case 1:if(e<=8)return new Uint8Array(t);if(e<=16)return new Uint16Array(t);if(e<=32)return new Uint32Array(t);break;case 2:if(e===8)return new Int8Array(t);if(e===16)return new Int16Array(t);if(e===32)return new Int32Array(t);break;case 3:switch(e){case 16:case 32:return new Float32Array(t);case 64:return new Float64Array(t)}break}throw Error("Unsupported data format/bitsPerSample")}function UU(n,e){return(n===1||n===2)&&e<=32&&e%8===0?!1:!(n===3&&(e===16||e===32||e===64))}function BU(n,e,t,i,r,s,o){const a=new DataView(n),l=t===2?o*s:o*s*i,u=t===2?1:i,c=h0(e,r,l),h=parseInt("1".repeat(r),2);if(e===1){let f;t===1?f=i*r:f=r;let d=s*f;(d&7)!==0&&(d=d+7&-8);for(let g=0;g<o;++g){const m=g*d;for(let p=0;p<s;++p){const _=m+p*u*r;for(let v=0;v<u;++v){const x=_+v*r,y=(g*s+p)*u+v,T=Math.floor(x/8),w=x%8;if(w+r<=8)c[y]=a.getUint8(T)>>8-r-w&h;else if(w+r<=16)c[y]=a.getUint16(T)>>16-r-w&h;else if(w+r<=24){const E=a.getUint16(T)<<8|a.getUint8(T+2);c[y]=E>>24-r-w&h}else c[y]=a.getUint32(T)>>32-r-w&h}}}}return c.buffer}class zU{constructor(e,t,i,r,s,o){this.fileDirectory=e,this.geoKeys=t,this.dataView=i,this.littleEndian=r,this.tiles=s?{}:null,this.isTiled=!e.StripOffsets;const a=e.PlanarConfiguration;if(this.planarConfiguration=typeof a=="undefined"?1:a,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel!="undefined"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip!="undefined"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,i=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(r,s){return tb(this,r,s)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){const i=this.getSampleFormat(e),r=this.getBitsPerSample(e);return h0(i,r,t)}async getTileOrStrip(e,t,i,r,s){const o=Math.ceil(this.getWidth()/this.getTileWidth()),a=Math.ceil(this.getHeight()/this.getTileHeight());let l;const{tiles:u}=this;this.planarConfiguration===1?l=t*o+e:this.planarConfiguration===2&&(l=i*o*a+t*o+e);let c,h;this.isTiled?(c=this.fileDirectory.TileOffsets[l],h=this.fileDirectory.TileByteCounts[l]):(c=this.fileDirectory.StripOffsets[l],h=this.fileDirectory.StripByteCounts[l]);const f=(await this.source.fetch([{offset:c,length:h}],s))[0];let d;return u===null||!u[l]?(d=(async()=>{let g=await r.decode(this.fileDirectory,f);const m=this.getSampleFormat(),p=this.getBitsPerSample();return UU(m,p)&&(g=BU(g,m,this.planarConfiguration,this.getSamplesPerPixel(),p,this.getTileWidth(),this.getBlockHeight(t))),g})(),u!==null&&(u[l]=d)):d=u[l],{x:e,y:t,sample:i,data:await d}}async _readRaster(e,t,i,r,s,o,a,l,u){const c=this.getTileWidth(),h=this.getTileHeight(),f=this.getWidth(),d=this.getHeight(),g=Math.max(Math.floor(e[0]/c),0),m=Math.min(Math.ceil(e[2]/c),Math.ceil(f/c)),p=Math.max(Math.floor(e[1]/h),0),_=Math.min(Math.ceil(e[3]/h),Math.ceil(d/h)),v=e[2]-e[0];let x=this.getBytesPerPixel();const y=[],T=[];for(let S=0;S<t.length;++S)this.planarConfiguration===1?y.push(GU(this.fileDirectory.BitsPerSample,0,t[S])/8):y.push(0),T.push(this.getReaderForSample(t[S]));const w=[],{littleEndian:E}=this;for(let S=p;S<_;++S)for(let b=g;b<m;++b)for(let R=0;R<t.length;++R){const C=R,M=t[R];this.planarConfiguration===2&&(x=this.getSampleByteSize(R));const P=this.getTileOrStrip(b,S,M,s,u);w.push(P),P.then(U=>{const O=U.data,L=new DataView(O),$=this.getBlockHeight(U.y),N=U.y*h,D=U.x*c,Y=N+$,k=(U.x+1)*c,F=T[C],ee=Math.min($,$-(Y-e[3]),d-N),X=Math.min(c,c-(k-e[2]),f-D);for(let Z=Math.max(0,e[1]-N);Z<ee;++Z)for(let ie=Math.max(0,e[0]-D);ie<X;++ie){const B=(Z*c+ie)*x,he=F.call(L,B+y[C],E);let me;r?(me=(Z+N-e[1])*v*t.length+(ie+D-e[0])*t.length+C,i[me]=he):(me=(Z+N-e[1])*v+ie+D-e[0],i[C][me]=he)}})}if(await Promise.all(w),o&&e[2]-e[0]!==o||a&&e[3]-e[1]!==a){let S;return r?S=kU(i,e[2]-e[0],e[3]-e[1],o,a,t.length,l):S=$U(i,e[2]-e[0],e[3]-e[1],o,a,l),S.width=o,S.height=a,S}return i.width=o||e[2]-e[0],i.height=a||e[3]-e[1],i}async readRasters({window:e,samples:t=[],interleave:i,pool:r=null,width:s,height:o,resampleMethod:a,fillValue:l,signal:u}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const h=c[2]-c[0],f=c[3]-c[1],d=h*f,g=this.getSamplesPerPixel();if(!t||!t.length)for(let v=0;v<g;++v)t.push(v);else for(let v=0;v<t.length;++v)if(t[v]>=g)return Promise.reject(new RangeError(`Invalid sample index '${t[v]}'.`));let m;if(i){const v=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,x=Math.max.apply(null,this.fileDirectory.BitsPerSample);m=h0(v,x,d*t.length),l&&m.fill(l)}else{m=[];for(let v=0;v<t.length;++v){const x=this.getArrayForSample(t[v],d);Array.isArray(l)&&v<l.length?x.fill(l[v]):l&&!Array.isArray(l)&&x.fill(l),m.push(x)}}const p=r||await hb(this.fileDirectory);return await this._readRaster(c,t,m,i,p,s,o,a,u)}async readRGB({window:e,interleave:t=!0,pool:i=null,width:r,height:s,resampleMethod:o,enableAlpha:a=!1,signal:l}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const c=this.fileDirectory.PhotometricInterpretation;if(c===On.RGB){let _=[0,1,2];if(this.fileDirectory.ExtraSamples!==EU.Unspecified&&a){_=[];for(let v=0;v<this.fileDirectory.BitsPerSample.length;v+=1)_.push(v)}return this.readRasters({window:e,interleave:t,samples:_,pool:i,width:r,height:s,resampleMethod:o,signal:l})}let h;switch(c){case On.WhiteIsZero:case On.BlackIsZero:case On.Palette:h=[0];break;case On.CMYK:h=[0,1,2,3];break;case On.YCbCr:case On.CIELab:h=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const f={window:u,interleave:!0,samples:h,pool:i,width:r,height:s,resampleMethod:o,signal:l},{fileDirectory:d}=this,g=await this.readRasters(f),m=2**this.fileDirectory.BitsPerSample[0];let p;switch(c){case On.WhiteIsZero:p=SU(g,m);break;case On.BlackIsZero:p=bU(g,m);break;case On.Palette:p=RU(g,d.ColorMap);break;case On.CMYK:p=CU(g);break;case On.YCbCr:p=IU(g);break;case On.CIELab:p=MU(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const _=new Uint8Array(p.length/3),v=new Uint8Array(p.length/3),x=new Uint8Array(p.length/3);for(let y=0,T=0;y<p.length;y+=3,++T)_[T]=p[y],v[T]=p[y+1],x[T]=p[y+2];p=[_,v,x]}return p.width=g.width,p.height=g.height,p}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const i=this.fileDirectory.GDAL_METADATA;let r=vU(i,"Item");e===null?r=r.filter(s=>i0(s,"sample")===void 0):r=r.filter(s=>Number(i0(s,"sample"))===e);for(let s=0;s<r.length;++s){const o=r[s];t[i0(o,"name")]=o.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,i=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(i)return[i[0],i[5],i[10]];if(e){const[r,s,o]=e.getResolution();return[r*e.getWidth()/this.getWidth(),s*e.getHeight()/this.getHeight(),o*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(){const e=this.getOrigin(),t=this.getResolution(),i=e[0],r=e[1],s=i+t[0]*this.getWidth(),o=r+t[1]*this.getHeight();return[Math.min(i,s),Math.min(r,o),Math.max(i,s),Math.max(r,o)]}}var fb=zU;class VU{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const i=this.getUint32(e,t),r=this.getUint32(e+4,t);let s;if(t){if(s=i+2**32*r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}if(s=2**32*i+r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}getInt64(e,t){let i=0;const r=(this._dataView.getUint8(e+(t?7:0))&128)>0;let s=!0;for(let o=0;o<8;o++){let a=this._dataView.getUint8(e+(t?o:7-o));r&&(s?a!==0&&(a=~(a-1)&255,s=!1):a=~a&255),i+=a*256**o}return r&&(i=-i),i}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return tb(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}class jU{constructor(e,t,i,r){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=i,this._bigTiff=r}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),i=this.readUint32(e+4);let r;if(this._littleEndian){if(r=t+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*t+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}readInt64(e){let t=0;const i=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let r=!0;for(let s=0;s<8;s++){let o=this._dataView.getUint8(e+(this._littleEndian?s:7-s));i&&(r?o!==0&&(o=~(o-1)&255,r=!1):o=~o&255),t+=o*256**s}return i&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}const XU=typeof navigator!="undefined"&&navigator.hardwareConcurrency||2;class YU{constructor(e=XU,t){this.workers=null,this._awaitingDecoder=null,this.size=e,this.messageId=0,e&&(this._awaitingDecoder=t?Promise.resolve(t):new Promise(i=>{Promise.resolve().then(function(){return z8}).then(r=>{i(r.create)})}),this._awaitingDecoder.then(i=>{this._awaitingDecoder=null,this.workers=[];for(let r=0;r<e;r++)this.workers.push({worker:i(),idle:!0})}))}async decode(e,t){return this._awaitingDecoder&&await this._awaitingDecoder,this.size===0?hb(e).then(i=>i.decode(e,t)):new Promise(i=>{const r=this.workers.find(a=>a.idle)||this.workers[Math.floor(Math.random()*this.size)];r.idle=!1;const s=this.messageId++,o=a=>{a.data.id===s&&(r.idle=!0,i(a.data.decoded),r.worker.removeEventListener("message",o))};r.worker.addEventListener("message",o),r.worker.postMessage({fileDirectory:e,buffer:t,id:s},[t])})}destroy(){this.workers&&(this.workers.forEach(e=>{e.worker.terminate()}),this.workers=null)}}var ZU=YU;const db=`\r
|
433
|
-
\r
|
434
|
-
`;function gb(n){if(typeof Object.fromEntries!="undefined")return Object.fromEntries(n);const e={};for(const[t,i]of n)e[t.toLowerCase()]=i;return e}function WU(n){const e=n.split(`\r
|
435
|
-
`).map(t=>{const i=t.split(":").map(r=>r.trim());return i[0]=i[0].toLowerCase(),i});return gb(e)}function HU(n){const[e,...t]=n.split(";").map(r=>r.trim()),i=t.map(r=>r.split("="));return{type:e,params:gb(i)}}function f0(n){let e,t,i;return n&&([,e,t,i]=n.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),t=parseInt(t,10),i=parseInt(i,10)),{start:e,end:t,total:i}}function KU(n,e){let t=null;const i=new TextDecoder("ascii"),r=[],s=`--${e}`,o=`${s}--`;for(let a=0;a<10;++a)i.decode(new Uint8Array(n,a,s.length))===s&&(t=a);if(t===null)throw new Error("Could not find initial boundary");for(;t<n.byteLength;){const a=i.decode(new Uint8Array(n,t,Math.min(s.length+1024,n.byteLength-t)));if(a.length===0||a.startsWith(o))break;if(!a.startsWith(s))throw new Error("Part does not start with boundary");const l=a.substr(s.length+2);if(l.length===0)break;const u=l.indexOf(db),c=WU(l.substr(0,u)),{start:h,end:f,total:d}=f0(c["content-range"]),g=t+s.length+u+db.length,m=parseInt(f,10)+1-parseInt(h,10);r.push({headers:c,data:n.slice(g,g+m),offset:h,length:m,fileSize:d}),t=g+m+4}return r}class d0{async fetch(e,t=void 0){return Promise.all(e.map(i=>this.fetchSlice(i,t)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}var qU=Be;Be.Node=Fo,Be.create=Be;function Be(n){var e=this;if(e instanceof Be||(e=new Be),e.tail=null,e.head=null,e.length=0,n&&typeof n.forEach=="function")n.forEach(function(r){e.push(r)});else if(arguments.length>0)for(var t=0,i=arguments.length;t<i;t++)e.push(arguments[t]);return e}Be.prototype.removeNode=function(n){if(n.list!==this)throw new Error("removing node which does not belong to this list");var e=n.next,t=n.prev;return e&&(e.prev=t),t&&(t.next=e),n===this.head&&(this.head=e),n===this.tail&&(this.tail=t),n.list.length--,n.next=null,n.prev=null,n.list=null,e},Be.prototype.unshiftNode=function(n){if(n!==this.head){n.list&&n.list.removeNode(n);var e=this.head;n.list=this,n.next=e,e&&(e.prev=n),this.head=n,this.tail||(this.tail=n),this.length++}},Be.prototype.pushNode=function(n){if(n!==this.tail){n.list&&n.list.removeNode(n);var e=this.tail;n.list=this,n.prev=e,e&&(e.next=n),this.tail=n,this.head||(this.head=n),this.length++}},Be.prototype.push=function(){for(var n=0,e=arguments.length;n<e;n++)QU(this,arguments[n]);return this.length},Be.prototype.unshift=function(){for(var n=0,e=arguments.length;n<e;n++)e5(this,arguments[n]);return this.length},Be.prototype.pop=function(){if(!!this.tail){var n=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,n}},Be.prototype.shift=function(){if(!!this.head){var n=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,n}},Be.prototype.forEach=function(n,e){e=e||this;for(var t=this.head,i=0;t!==null;i++)n.call(e,t.value,i,this),t=t.next},Be.prototype.forEachReverse=function(n,e){e=e||this;for(var t=this.tail,i=this.length-1;t!==null;i--)n.call(e,t.value,i,this),t=t.prev},Be.prototype.get=function(n){for(var e=0,t=this.head;t!==null&&e<n;e++)t=t.next;if(e===n&&t!==null)return t.value},Be.prototype.getReverse=function(n){for(var e=0,t=this.tail;t!==null&&e<n;e++)t=t.prev;if(e===n&&t!==null)return t.value},Be.prototype.map=function(n,e){e=e||this;for(var t=new Be,i=this.head;i!==null;)t.push(n.call(e,i.value,this)),i=i.next;return t},Be.prototype.mapReverse=function(n,e){e=e||this;for(var t=new Be,i=this.tail;i!==null;)t.push(n.call(e,i.value,this)),i=i.prev;return t},Be.prototype.reduce=function(n,e){var t,i=this.head;if(arguments.length>1)t=e;else if(this.head)i=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=0;i!==null;r++)t=n(t,i.value,r),i=i.next;return t},Be.prototype.reduceReverse=function(n,e){var t,i=this.tail;if(arguments.length>1)t=e;else if(this.tail)i=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var r=this.length-1;i!==null;r--)t=n(t,i.value,r),i=i.prev;return t},Be.prototype.toArray=function(){for(var n=new Array(this.length),e=0,t=this.head;t!==null;e++)n[e]=t.value,t=t.next;return n},Be.prototype.toArrayReverse=function(){for(var n=new Array(this.length),e=0,t=this.tail;t!==null;e++)n[e]=t.value,t=t.prev;return n},Be.prototype.slice=function(n,e){e=e||this.length,e<0&&(e+=this.length),n=n||0,n<0&&(n+=this.length);var t=new Be;if(e<n||e<0)return t;n<0&&(n=0),e>this.length&&(e=this.length);for(var i=0,r=this.head;r!==null&&i<n;i++)r=r.next;for(;r!==null&&i<e;i++,r=r.next)t.push(r.value);return t},Be.prototype.sliceReverse=function(n,e){e=e||this.length,e<0&&(e+=this.length),n=n||0,n<0&&(n+=this.length);var t=new Be;if(e<n||e<0)return t;n<0&&(n=0),e>this.length&&(e=this.length);for(var i=this.length,r=this.tail;r!==null&&i>e;i--)r=r.prev;for(;r!==null&&i>n;i--,r=r.prev)t.push(r.value);return t},Be.prototype.splice=function(n,e,...t){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var i=0,r=this.head;r!==null&&i<n;i++)r=r.next;for(var s=[],i=0;r&&i<e;i++)s.push(r.value),r=this.removeNode(r);r===null&&(r=this.tail),r!==this.head&&r!==this.tail&&(r=r.prev);for(var i=0;i<t.length;i++)r=JU(this,r,t[i]);return s},Be.prototype.reverse=function(){for(var n=this.head,e=this.tail,t=n;t!==null;t=t.prev){var i=t.prev;t.prev=t.next,t.next=i}return this.head=e,this.tail=n,this};function JU(n,e,t){var i=e===n.head?new Fo(t,null,e,n):new Fo(t,e,e.next,n);return i.next===null&&(n.tail=i),i.prev===null&&(n.head=i),n.length++,i}function QU(n,e){n.tail=new Fo(e,n.tail,null,n),n.head||(n.head=n.tail),n.length++}function e5(n,e){n.head=new Fo(e,null,n.head,n),n.tail||(n.tail=n.head),n.length++}function Fo(n,e,t,i){if(!(this instanceof Fo))return new Fo(n,e,t,i);this.list=i,this.value=n,e?(e.next=this,this.prev=e):this.prev=null,t?(t.prev=this,this.next=t):this.next=null}try{require("./iterator.js")(Be)}catch{}const t5=qU,Oo=Symbol("max"),wr=Symbol("length"),nl=Symbol("lengthCalculator"),tc=Symbol("allowStale"),$o=Symbol("maxAge"),Tr=Symbol("dispose"),pb=Symbol("noDisposeOnSet"),Xt=Symbol("lruList"),Ti=Symbol("cache"),mb=Symbol("updateAgeOnGet"),g0=()=>1;class n5{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");this[Oo]=e.max||1/0;const t=e.length||g0;if(this[nl]=typeof t!="function"?g0:t,this[tc]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[$o]=e.maxAge||0,this[Tr]=e.dispose,this[pb]=e.noDisposeOnSet||!1,this[mb]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[Oo]=e||1/0,nc(this)}get max(){return this[Oo]}set allowStale(e){this[tc]=!!e}get allowStale(){return this[tc]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[$o]=e,nc(this)}get maxAge(){return this[$o]}set lengthCalculator(e){typeof e!="function"&&(e=g0),e!==this[nl]&&(this[nl]=e,this[wr]=0,this[Xt].forEach(t=>{t.length=this[nl](t.value,t.key),this[wr]+=t.length})),nc(this)}get lengthCalculator(){return this[nl]}get length(){return this[wr]}get itemCount(){return this[Xt].length}rforEach(e,t){t=t||this;for(let i=this[Xt].tail;i!==null;){const r=i.prev;_b(this,e,i,t),i=r}}forEach(e,t){t=t||this;for(let i=this[Xt].head;i!==null;){const r=i.next;_b(this,e,i,t),i=r}}keys(){return this[Xt].toArray().map(e=>e.key)}values(){return this[Xt].toArray().map(e=>e.value)}reset(){this[Tr]&&this[Xt]&&this[Xt].length&&this[Xt].forEach(e=>this[Tr](e.key,e.value)),this[Ti]=new Map,this[Xt]=new t5,this[wr]=0}dump(){return this[Xt].map(e=>id(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[Xt]}set(e,t,i){if(i=i||this[$o],i&&typeof i!="number")throw new TypeError("maxAge must be a number");const r=i?Date.now():0,s=this[nl](t,e);if(this[Ti].has(e)){if(s>this[Oo])return il(this,this[Ti].get(e)),!1;const l=this[Ti].get(e).value;return this[Tr]&&(this[pb]||this[Tr](e,l.value)),l.now=r,l.maxAge=i,l.value=t,this[wr]+=s-l.length,l.length=s,this.get(e),nc(this),!0}const o=new i5(e,t,s,r,i);return o.length>this[Oo]?(this[Tr]&&this[Tr](e,t),!1):(this[wr]+=o.length,this[Xt].unshift(o),this[Ti].set(e,this[Xt].head),nc(this),!0)}has(e){if(!this[Ti].has(e))return!1;const t=this[Ti].get(e).value;return!id(this,t)}get(e){return p0(this,e,!0)}peek(e){return p0(this,e,!1)}pop(){const e=this[Xt].tail;return e?(il(this,e),e.value):null}del(e){il(this,this[Ti].get(e))}load(e){this.reset();const t=Date.now();for(let i=e.length-1;i>=0;i--){const r=e[i],s=r.e||0;if(s===0)this.set(r.k,r.v);else{const o=s-t;o>0&&this.set(r.k,r.v,o)}}}prune(){this[Ti].forEach((e,t)=>p0(this,t,!1))}}const p0=(n,e,t)=>{const i=n[Ti].get(e);if(i){const r=i.value;if(id(n,r)){if(il(n,i),!n[tc])return}else t&&(n[mb]&&(i.value.now=Date.now()),n[Xt].unshiftNode(i));return r.value}},id=(n,e)=>{if(!e||!e.maxAge&&!n[$o])return!1;const t=Date.now()-e.now;return e.maxAge?t>e.maxAge:n[$o]&&t>n[$o]},nc=n=>{if(n[wr]>n[Oo])for(let e=n[Xt].tail;n[wr]>n[Oo]&&e!==null;){const t=e.prev;il(n,e),e=t}},il=(n,e)=>{if(e){const t=e.value;n[Tr]&&n[Tr](t.key,t.value),n[wr]-=t.length,n[Ti].delete(t.key),n[Xt].removeNode(e)}};class i5{constructor(e,t,i,r,s){this.key=e,this.value=t,this.length=i,this.now=r,this.maxAge=s||0}}const _b=(n,e,t,i)=>{let r=t.value;id(n,r)&&(il(n,t),n[tc]||(r=void 0)),r&&e.call(i,r.value,r.key,n)};var r5=n5;async function s5(n){return new Promise(e=>setTimeout(e,n))}function yb(n,e){const t=Array.isArray(n)?n:Array.from(n),i=Array.isArray(e)?e:Array.from(e);return t.map((r,s)=>[r,i[s]])}class fl extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,fl),this.name="AbortError"}}class o5 extends Error{constructor(e,t){super(t),this.errors=e,this.message=t,this.name="AggregateError"}}const a5=o5;class l5{constructor(e,t,i=null){this.offset=e,this.length=t,this.data=i}get top(){return this.offset+this.length}}class vb{constructor(e,t,i){this.offset=e,this.length=t,this.blockIds=i}}class u5 extends d0{constructor(e,{blockSize:t=65536,cacheSize:i=100}={}){super(),this.source=e,this.blockSize=t,this.blockCache=new r5({max:i}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(e,t){const i=new Map,r=new Map,s=new Set;for(const{offset:u,length:c}of e){let h=u+c;const{fileSize:f}=this;f!==null&&(h=Math.min(h,f));const d=Math.floor(u/this.blockSize)*this.blockSize;for(let g=d;g<h;g+=this.blockSize){const m=Math.floor(g/this.blockSize);this.blockCache.has(m)?i.set(m,this.blockCache.get(m)):this.blockRequests.has(m)?r.set(m,this.blockRequests.get(m)):(this.blockIdsToFetch.has(m)||this.blockIdsToFetch.add(m),s.add(m))}}await s5(),this.fetchBlocks(t);for(const u of s){const c=this.blockRequests.get(u),h=this.blockCache.get(u);if(c)r.set(u,c);else if(h)i.set(u,h);else throw new Error(`Block ${u} is not in the block requests`)}let o=await Promise.allSettled(Array.from(r.values()));if(o.some(u=>u.status==="rejected")){const u=new Set;for(const[c,h]of yb(r.keys(),o)){const{rejected:f,reason:d}=h;f&&d.name==="AbortError"&&d.signal!==t&&(this.blockIdsToFetch.add(c),u.add(c))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(t);for(const c of u){const h=this.blockRequests.get(c);if(!h)throw new Error(`Block ${c} is not in the block requests`);r.set(c,h)}o=await Promise.allSettled(Array.from(r.values()))}}if(o.some(u=>u.status==="rejected"))throw t&&t.aborted?new fl("Request was aborted"):new a5(o.filter(u=>u.status==="rejected").map(u=>u.reason),"Request failed");const a=o.map(u=>u.value),l=new Map(yb(Array.from(r.keys()),a));for(const[u,c]of i)l.set(u,c);return this.readSliceData(e,l)}fetchBlocks(e){if(this.blockIdsToFetch.size>0){const t=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(t,e);for(let r=0;r<t.length;++r){const s=t[r];for(const o of s.blockIds){const a=(async()=>{try{const l=(await i)[r],u=o*this.blockSize,c=u-l.offset,h=Math.min(c+this.blockSize,l.data.byteLength),f=l.data.slice(c,h),d=new l5(u,f.byteLength,f);return this.blockCache.set(o,d),d}catch(l){throw l.name==="AbortError"&&(l.signal=e),l}finally{this.blockRequests.delete(o)}})();this.blockRequests.set(o,a)}}this.blockIdsToFetch.clear()}}groupBlocks(e){const t=Array.from(e).sort((o,a)=>o-a);if(t.length===0)return[];let i=[],r=null;const s=[];for(const o of t)r===null||r+1===o?(i.push(o),r=o):(s.push(new vb(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[o],r=o);return s.push(new vb(i[0]*this.blockSize,i.length*this.blockSize,i)),s}readSliceData(e,t){return e.map(i=>{const r=i.offset+i.length,s=Math.floor(i.offset/this.blockSize),o=Math.floor((i.offset+i.length)/this.blockSize),a=new ArrayBuffer(i.length),l=new Uint8Array(a);for(let u=s;u<=o;++u){const c=t.get(u),h=c.offset-i.offset,f=c.top-r;let d=0,g=0,m;h<0?d=-h:h>0&&(g=h),f<0?m=c.length-d:m=r-c.offset-d;const p=new Uint8Array(c.data,d,m);l.set(p,g)}return a})}}class m0{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(e){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class _0{constructor(e){this.url=e}async request({headers:e,credentials:t,signal:i}={}){throw new Error("request is not implemented")}}class c5 extends m0{constructor(e){super(),this.response=e}get status(){return this.response.status}getHeader(e){return this.response.headers.get(e)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class h5 extends _0{constructor(e,t){super(e),this.credentials=t}async request({headers:e,credentials:t,signal:i}={}){const r=await fetch(this.url,{headers:e,credentials:t,signal:i});return new c5(r)}}class f5 extends m0{constructor(e,t){super(),this.xhr=e,this.data=t}get status(){return this.xhr.status}getHeader(e){return this.xhr.getResponseHeader(e)}async getData(){return this.data}}class d5 extends _0{constructRequest(e,t){return new Promise((i,r)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer";for(const[o,a]of Object.entries(e))s.setRequestHeader(o,a);s.onload=()=>{const o=s.response;i(new f5(s,o))},s.onerror=r,s.onabort=()=>r(new fl("Request aborted")),s.send(),t&&(t.aborted&&s.abort(),t.addEventListener("abort",()=>s.abort()))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}var y0={};class g5 extends m0{constructor(e,t){super(),this.response=e,this.dataPromise=t}get status(){return this.response.statusCode}getHeader(e){return this.response.headers[e]}async getData(){return await this.dataPromise}}class p5 extends _0{constructor(e){super(e),this.parsedUrl=y0.parse(this.url),this.httpApi=(this.parsedUrl.protocol==="http:",y0)}constructRequest(e,t){return new Promise((i,r)=>{const s=this.httpApi.get(Tl(Pr({},this.parsedUrl),{headers:e}),o=>{const a=new Promise(l=>{const u=[];o.on("data",c=>{u.push(c)}),o.on("end",()=>{const c=Buffer.concat(u).buffer;l(c)}),o.on("error",r)});i(new g5(o,a))});s.on("error",r),t&&(t.aborted&&s.destroy(new fl("Request aborted")),t.addEventListener("abort",()=>s.destroy(new fl("Request aborted"))))})}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}class v0 extends d0{constructor(e,t,i,r){super(),this.client=e,this.headers=t,this.maxRanges=i,this.allowFullFile=r,this._fileSize=null}async fetch(e,t){return this.maxRanges>=e.length?this.fetchSlices(e,t):(this.maxRanges>0&&e.length>1,Promise.all(e.map(i=>this.fetchSlice(i,t))))}async fetchSlices(e,t){const i=await this.client.request({headers:Tl(Pr({},this.headers),{Range:`bytes=${e.map(({offset:r,length:s})=>`${r}-${r+s}`).join(",")}`}),signal:t});if(i.ok)if(i.status===206){const{type:r,params:s}=HU(i.getHeader("content-type"));if(r==="multipart/byteranges"){const h=KU(await i.getData(),s.boundary);return this._fileSize=h[0].fileSize||null,h}const o=await i.getData(),{start:a,end:l,total:u}=f0(i.getHeader("content-range"));this._fileSize=u||null;const c=[{data:o,offset:a,length:l-a}];if(e.length>1){const h=await Promise.all(e.slice(1).map(f=>this.fetchSlice(f,t)));return c.concat(h)}return c}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const r=await i.getData();return this._fileSize=r.byteLength,[{data:r,offset:0,length:r.byteLength}]}else throw new Error("Error fetching data.")}async fetchSlice(e,t){const{offset:i,length:r}=e,s=await this.client.request({headers:Tl(Pr({},this.headers),{Range:`bytes=${i}-${i+r}`}),signal:t});if(s.ok)if(s.status===206){const o=await s.getData(),{total:a}=f0(s.getHeader("content-range"));return this._fileSize=a||null,{data:o,offset:i,length:r}}else{if(!this.allowFullFile)throw new Error("Server responded with full file");const o=await s.getData();return this._fileSize=o.byteLength,{data:o,offset:0,length:o.byteLength}}else throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function x0(n,{blockSize:e,cacheSize:t}){return e===null?n:new u5(n,e,t)}function m5(n,o={}){var a=o,{headers:e={},credentials:t,maxRanges:i=0,allowFullFile:r=!1}=a,s=Sl(a,["headers","credentials","maxRanges","allowFullFile"]);const l=new h5(n,t),u=new v0(l,e,i,r);return x0(u,s)}function _5(n,s={}){var o=s,{headers:e={},maxRanges:t=0,allowFullFile:i=!1}=o,r=Sl(o,["headers","maxRanges","allowFullFile"]);const a=new d5(n),l=new v0(a,e,t,i);return x0(l,r)}function y5(n,s={}){var o=s,{headers:e={},maxRanges:t=0,allowFullFile:i=!1}=o,r=Sl(o,["headers","maxRanges","allowFullFile"]);const a=new p5(n),l=new v0(a,e,t,i);return x0(l,r)}function E0(n,i={}){var r=i,{forceXHR:e=!1}=r,t=Sl(r,["forceXHR"]);return typeof fetch=="function"&&!e?m5(n,t):typeof XMLHttpRequest!="undefined"?_5(n,t):y5(n,t)}class v5 extends d0{constructor(e){super(),this.file=e}async fetchSlice(e,t){return new Promise((i,r)=>{const s=this.file.slice(e.offset,e.offset+e.length),o=new FileReader;o.onload=a=>i(a.target.result),o.onerror=r,o.onabort=r,o.readAsArrayBuffer(s),t&&t.addEventListener("abort",()=>o.abort())})}}function x5(n){return new v5(n)}function w0(n){switch(n){case Re.BYTE:case Re.ASCII:case Re.SBYTE:case Re.UNDEFINED:return 1;case Re.SHORT:case Re.SSHORT:return 2;case Re.LONG:case Re.SLONG:case Re.FLOAT:case Re.IFD:return 4;case Re.RATIONAL:case Re.SRATIONAL:case Re.DOUBLE:case Re.LONG8:case Re.SLONG8:case Re.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${n}`)}}function E5(n){const e=n.GeoKeyDirectory;if(!e)return null;const t={};for(let i=4;i<=e[3]*4;i+=4){const r=TU[e[i]],s=e[i+1]?ec[e[i+1]]:null,o=e[i+2],a=e[i+3];let l=null;if(!s)l=a;else{if(l=n[s],typeof l=="undefined"||l===null)throw new Error(`Could not get value of geoKey '${r}'.`);typeof l=="string"?l=l.substring(a,a+o-1):l.subarray&&(l=l.subarray(a,a+o),o===1&&(l=l[0]))}t[r]=l}return t}function rl(n,e,t,i){let r=null,s=null;const o=w0(e);switch(e){case Re.BYTE:case Re.ASCII:case Re.UNDEFINED:r=new Uint8Array(t),s=n.readUint8;break;case Re.SBYTE:r=new Int8Array(t),s=n.readInt8;break;case Re.SHORT:r=new Uint16Array(t),s=n.readUint16;break;case Re.SSHORT:r=new Int16Array(t),s=n.readInt16;break;case Re.LONG:case Re.IFD:r=new Uint32Array(t),s=n.readUint32;break;case Re.SLONG:r=new Int32Array(t),s=n.readInt32;break;case Re.LONG8:case Re.IFD8:r=new Array(t),s=n.readUint64;break;case Re.SLONG8:r=new Array(t),s=n.readInt64;break;case Re.RATIONAL:r=new Uint32Array(t*2),s=n.readUint32;break;case Re.SRATIONAL:r=new Int32Array(t*2),s=n.readInt32;break;case Re.FLOAT:r=new Float32Array(t),s=n.readFloat32;break;case Re.DOUBLE:r=new Float64Array(t),s=n.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Re.RATIONAL||e===Re.SRATIONAL)for(let a=0;a<t;a+=2)r[a]=s.call(n,i+a*o),r[a+1]=s.call(n,i+(a*o+4));else for(let a=0;a<t;++a)r[a]=s.call(n,i+a*o);return e===Re.ASCII?new TextDecoder("utf-8").decode(r):r}class w5{constructor(e,t,i){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=i}}class rd extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class xb{async readRasters(e={}){const{window:t,width:i,height:r}=e;let{resX:s,resY:o,bbox:a}=e;const l=await this.getImage();let u=l;const c=await this.getImageCount(),h=l.getBoundingBox();if(t&&a)throw new Error('Both "bbox" and "window" passed.');if(i||r){if(t){const[g,m]=l.getOrigin(),[p,_]=l.getResolution();a=[g+t[0]*p,m+t[1]*_,g+t[2]*p,m+t[3]*_]}const d=a||h;if(i){if(s)throw new Error("Both width and resX passed");s=(d[2]-d[0])/i}if(r){if(o)throw new Error("Both width and resY passed");o=(d[3]-d[1])/r}}if(s||o){const d=[];for(let g=0;g<c;++g){const m=await this.getImage(g),{SubfileType:p,NewSubfileType:_}=m.fileDirectory;(g===0||p===2||_&1)&&d.push(m)}d.sort((g,m)=>g.getWidth()-m.getWidth());for(let g=0;g<d.length;++g){const m=d[g],p=(h[2]-h[0])/m.getWidth(),_=(h[3]-h[1])/m.getHeight();if(u=m,s&&s>p||o&&o>_)break}}let f=t;if(a){const[d,g]=l.getOrigin(),[m,p]=u.getResolution(l);f=[Math.round((a[0]-d)/m),Math.round((a[1]-g)/p),Math.round((a[2]-d)/m),Math.round((a[3]-g)/p)],f=[Math.min(f[0],f[2]),Math.min(f[1],f[3]),Math.max(f[0],f[2]),Math.max(f[1],f[3])]}return u.readRasters(Tl(Pr({},e),{window:f}))}}class dl extends xb{constructor(e,t,i,r,s={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=i,this.firstIFDOffset=r,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const i=this.bigTiff?4048:1024;return new jU((await this.source.fetch([{offset:e,length:typeof t!="undefined"?t:i}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,i=this.bigTiff?8:2;let r=await this.getSlice(e);const s=this.bigTiff?r.readUint64(e):r.readUint16(e),o=s*t+(this.bigTiff?16:6);r.covers(e,o)||(r=await this.getSlice(e,o));const a={};let l=e+(this.bigTiff?8:2);for(let h=0;h<s;l+=t,++h){const f=r.readUint16(l),d=r.readUint16(l+2),g=this.bigTiff?r.readUint64(l+4):r.readUint32(l+4);let m,p;const _=w0(d),v=l+(this.bigTiff?12:8);if(_*g<=(this.bigTiff?8:4))m=rl(r,d,g,v);else{const x=r.readOffset(v),y=w0(d)*g;if(r.covers(x,y))m=rl(r,d,g,x);else{const T=await this.getSlice(x,y);m=rl(T,d,g,x)}}g===1&&xU.indexOf(f)===-1&&!(d===Re.RATIONAL||d===Re.SRATIONAL)?p=m[0]:p=m,a[ec[f]]=p}const u=E5(a),c=r.readOffset(e+i+t*s);return new w5(a,u,c)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){throw t instanceof rd?new rd(e):t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(t.nextIFDByteOffset===0)throw new rd(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new fb(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(i){if(i instanceof rd)t=!1;else throw i}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const t="GDAL_STRUCTURAL_METADATA_SIZE=",i=t.length+100;let r=await this.getSlice(e,i);if(t===rl(r,Re.ASCII,t.length,e)){const o=rl(r,Re.ASCII,i,e).split(`
|
436
|
-
`)[0],a=Number(o.split("=")[1].split(" ")[0])+o.length;a>i&&(r=await this.getSlice(e,a));const l=rl(r,Re.ASCII,a,e);this.ghostValues={},l.split(`
|
437
|
-
`).filter(u=>u.length>0).map(u=>u.split("=")).forEach(([u,c])=>{this.ghostValues[u]=c})}return this.ghostValues}static async fromSource(e,t,i){const r=(await e.fetch([{offset:0,length:1024}],i))[0],s=new VU(r),o=s.getUint16(0,0);let a;if(o===18761)a=!0;else if(o===19789)a=!1;else throw new TypeError("Invalid byte order value.");const l=s.getUint16(2,a);let u;if(l===42)u=!1;else if(l===43){if(u=!0,s.getUint16(4,a)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const c=u?s.getUint64(8,a):s.getUint32(4,a);return new dl(e,a,u,c,t)}close(){return typeof this.source.close=="function"?this.source.close():!1}}class T5 extends xb{constructor(e,t){super(),this.mainFile=e,this.overviewFiles=t,this.imageFiles=[e].concat(t),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const e=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map(t=>t.parseFileDirectoryAt(t.firstIFDOffset)));return this.fileDirectoriesPerFile=await Promise.all(e),this.fileDirectoriesPerFile}async getImage(e=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let t=0,i=0;for(let r=0;r<this.imageFiles.length;r++){const s=this.imageFiles[r];for(let o=0;o<this.imageCounts[r];o++){if(e===t){const a=await s.requestIFD(i);return new fb(a.fileDirectory,a.geoKeyDirectory,s.dataView,s.littleEndian,s.cache,s.source)}t++,i++}i=0}throw new RangeError("Invalid image index")}async getImageCount(){if(this.imageCount!==null)return this.imageCount;const e=[this.mainFile.getImageCount()].concat(this.overviewFiles.map(t=>t.getImageCount()));return this.imageCounts=await Promise.all(e),this.imageCount=this.imageCounts.reduce((t,i)=>t+i,0),this.imageCount}}async function S5(n,e={},t){return dl.fromSource(E0(n,e),t)}async function b5(n,e){return dl.fromSource(x5(n),e)}async function R5(n,e=[],t={},i){const r=await dl.fromSource(E0(n,t),i),s=await Promise.all(e.map(o=>dl.fromSource(E0(o,t))));return new T5(r,s)}function C5(n){return((n.fileDirectory.NewSubfileType||0)&4)===4}function I5(n,e){if(!n)return!1;if(n===!0)return!0;if(e.getSamplesPerPixel()!==3)return!1;const t=e.fileDirectory.PhotometricInterpretation,i=On;return t===i.CMYK||t===i.YCbCr||t===i.CIELab||t===i.ICCLab}const Eb="STATISTICS_MAXIMUM",wb="STATISTICS_MINIMUM";let T0;function A5(){return T0||(T0=new ZU),T0}function L5(n){try{return n.getBoundingBox()}catch{const t=n.fileDirectory;return[0,0,t.ImageWidth,t.ImageLength]}}function P5(n){try{return n.getOrigin().slice(0,2)}catch{return[0,n.fileDirectory.ImageLength]}}function M5(n,e){try{return n.getResolution(e)}catch{return[e.fileDirectory.ImageWidth/n.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/n.fileDirectory.ImageHeight]}}function F5(n){const e=n.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=J(t);if(!i){const r=rg(e.ProjLinearUnitsGeoKey);r&&(i=new Ws({code:t,units:r}))}return i}if(e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=J(t);if(!i){const r=rg(e.GeogAngularUnitsGeoKey);r&&(i=new Ws({code:t,units:r}))}return i}return null}function O5(n){return n.getImageCount().then(function(e){const t=new Array(e);for(let i=0;i<e;++i)t[i]=n.getImage(i);return Promise.all(t)})}function $5(n,e){let t;return n.blob?t=b5(n.blob):n.overviews?t=R5(n.url,n.overviews,e):t=S5(n.url,e),t.then(O5)}function ic(n,e,t,i,r){if(Array.isArray(n)){const s=n.length;if(!Array.isArray(e)||s!=e.length){const o=new Error(i);throw r(o),o}for(let o=0;o<s;++o)ic(n[o],e[o],t,i,r);return}if(e=e,Math.abs(n-e)>t*n)throw new Error(i)}function D5(n){return n instanceof Int8Array?-128:n instanceof Int16Array?-32768:n instanceof Int32Array?-2147483648:n instanceof Float32Array?12e-39:0}function N5(n){return n instanceof Int8Array?127:n instanceof Uint8Array||n instanceof Uint8ClampedArray?255:n instanceof Int16Array?32767:n instanceof Uint16Array?65535:n instanceof Int32Array?2147483647:n instanceof Uint32Array?4294967295:n instanceof Float32Array?34e37:255}class Tb extends jS{constructor(e){super({state:"loading",tileGrid:null,projection:null,opaque:e.opaque,transition:e.transition,interpolate:e.interpolate!==!1,wrapX:e.wrapX}),this.sourceInfo_=e.sources;const t=this.sourceInfo_.length;this.sourceOptions_=e.sourceOptions,this.sourceImagery_=new Array(t),this.sourceMasks_=new Array(t),this.resolutionFactors_=new Array(t),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=e.normalize!==!1,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=e.convertToRGB||!1,this.setKey(this.sourceInfo_.map(s=>s.url).join(","));const i=this,r=new Array(t);for(let s=0;s<t;++s)r[s]=$5(this.sourceInfo_[s],this.sourceOptions_);Promise.all(r).then(function(s){i.configure_(s)}).catch(function(s){console.error(s),i.error_=s,i.setState("error")})}getError(){return this.error_}configure_(e){let t,i,r,s,o;const a=new Array(e.length),l=new Array(e.length),u=new Array(e.length);let c=0;const h=e.length;for(let m=0;m<h;++m){const p=[],_=[];e[m].forEach(S=>{C5(S)?_.push(S):p.push(S)});const v=p.length;if(_.length>0&&_.length!==v)throw new Error(`Expected one mask per image found ${_.length} masks and ${v} images`);let x,y;const T=new Array(v),w=new Array(v),E=new Array(v);l[m]=new Array(v),u[m]=new Array(v);for(let S=0;S<v;++S){const b=p[S],R=b.getGDALNoData();u[m][S]=b.getGDALMetadata(0),l[m][S]=R;const C=this.sourceInfo_[m].bands;a[m]=C?C.length:b.getSamplesPerPixel();const M=v-(S+1);x||(x=L5(b)),y||(y=P5(b));const P=M5(b,p[0]);E[M]=P[0];const U=[b.getTileWidth(),b.getTileHeight()];T[M]=U;const O=P[0]/Math.abs(P[1]);w[M]=[U[0],U[1]/O]}if(t?zt(t,x,t):t=x,!i)i=y;else{const S=`Origin mismatch for source ${m}, got [${y}] but expected [${i}]`;ic(i,y,0,S,this.viewRejector)}if(!o)o=E,this.resolutionFactors_[m]=1;else{o.length-c>E.length&&(c=o.length-E.length);const S=o[o.length-1]/E[E.length-1];this.resolutionFactors_[m]=S;const b=E.map(C=>C*=S),R=`Resolution mismatch for source ${m}, got [${b}] but expected [${o}]`;ic(o.slice(c,o.length),b,.02,R,this.viewRejector)}r?ic(r.slice(c,r.length),w,.01,`Tile size mismatch for source ${m}`,this.viewRejector):r=w,s?ic(s.slice(c,s.length),T,0,`Tile size mismatch for source ${m}`,this.viewRejector):s=T,this.sourceImagery_[m]=p.reverse(),this.sourceMasks_[m]=_.reverse()}for(let m=0,p=this.sourceImagery_.length;m<p;++m){const _=this.sourceImagery_[m];for(;_.length<o.length;)_.unshift(void 0)}if(!this.getProjection()){const m=e[0];for(let p=m.length-1;p>=0;--p){const _=m[p],v=F5(_);if(v){this.projection=v;break}}}this.samplesPerPixel_=a,this.nodataValues_=l,this.metadata_=u;e:for(let m=0;m<h;++m){if(this.sourceInfo_[m].nodata!==void 0){this.addAlpha_=!0;break}if(this.sourceMasks_[m].length){this.addAlpha_=!0;break}const p=l[m],_=this.sourceInfo_[m].bands;if(_){for(let v=0;v<_.length;++v)if(p[_[v]-1]!==null){this.addAlpha_=!0;break e}continue}for(let v=0;v<p.length;++v)if(p[v]!==null){this.addAlpha_=!0;break e}}let f=this.addAlpha_?1:0;for(let m=0;m<h;++m)f+=a[m];this.bandCount=f;const d=new zi({extent:t,minZoom:c,origin:i,resolutions:o,tileSizes:r});this.tileGrid=d,this.setTileSizes(s),this.setLoader(this.loadTile_.bind(this)),this.setState("ready");let g=0;o.length===1&&(o=[o[0]*2,o[0]],g=1),this.viewResolver({showFullExtent:!0,projection:this.projection,resolutions:o,center:Yr(Ot(t),this.projection),extent:Zr(t,this.projection),zoom:g})}loadTile_(e,t,i){const r=this.getTileSize(e),s=this.sourceImagery_.length,o=new Array(s*2),a=this.nodataValues_,l=this.sourceInfo_,u=A5();for(let c=0;c<s;++c){const h=l[c],f=this.resolutionFactors_[c],d=[Math.round(t*(r[0]*f)),Math.round(i*(r[1]*f)),Math.round((t+1)*(r[0]*f)),Math.round((i+1)*(r[1]*f))],g=this.sourceImagery_[c][e];let m;h.bands&&(m=h.bands.map(function(y){return y-1}));let p;"nodata"in h&&h.nodata!==null?p=h.nodata:m?p=m.map(function(y){return a[c][y]}):p=a[c];const _={window:d,width:r[0],height:r[1],samples:m,fillValue:p,pool:u,interleave:!1};I5(this.convertToRGB_,g)?o[c]=g.readRGB(_):o[c]=g.readRasters(_);const v=s+c,x=this.sourceMasks_[c][e];if(!x){o[v]=Promise.resolve(null);continue}o[v]=x.readRasters({window:d,width:r[0],height:r[1],samples:[0],pool:u,interleave:!1})}return Promise.all(o).then(this.composeTile_.bind(this,r)).catch(function(c){throw console.error(c),c})}composeTile_(e,t){const i=this.metadata_,r=this.sourceInfo_,s=this.sourceImagery_.length,o=this.bandCount,a=this.samplesPerPixel_,l=this.nodataValues_,u=this.normalize_,c=this.addAlpha_,h=e[0]*e[1],f=h*o;let d;u?d=new Uint8Array(f):d=new Float32Array(f);let g=0;for(let m=0;m<h;++m){let p=c;for(let _=0;_<s;++_){const v=r[_];let x=v.min,y=v.max,T,w;if(u){const E=i[_][0];x===void 0&&(E&&wb in E?x=parseFloat(E[wb]):x=D5(t[_][0])),y===void 0&&(E&&Eb in E?y=parseFloat(E[Eb]):y=N5(t[_][0])),T=255/(y-x),w=-x*T}for(let E=0;E<a[_];++E){const S=t[_][E][m];let b;if(u?b=ye(T*S+w,0,255):b=S,!c)d[g]=b;else{let R=v.nodata;if(R===void 0){let M;v.bands?M=v.bands[E]-1:M=E,R=l[_][M]}const C=isNaN(R);(!C&&S!==R||C&&!isNaN(S))&&(p=!1,d[g]=b)}g++}if(!p){const E=s+_,S=t[E];S&&!S[0][m]&&(p=!0)}}c&&(p||(d[g]=255),g++)}return d}}Tb.prototype.getView;var k5=Tb;class S0 extends no{constructor(e,t,i,r,s,o,a){super(t,i,r,s,o,a),this.zoomifyImage_=null,this.tileSize_=e}getImage(){if(this.zoomifyImage_)return this.zoomifyImage_;const e=super.getImage();if(this.state==V.LOADED){const t=this.tileSize_;if(e.width==t[0]&&e.height==t[1])return this.zoomifyImage_=e,e;{const i=yt(t[0],t[1]);return i.drawImage(e,0,0),this.zoomifyImage_=i.canvas,i.canvas}}else return e}}class G5 extends Vi{constructor(e){const t=e.size,i=e.tierSizeCalculation!==void 0?e.tierSizeCalculation:"default",r=e.tilePixelRatio||1,s=t[0],o=t[1],a=[],l=e.tileSize||so;let u=l*r;switch(i){case"default":for(;s>u||o>u;)a.push([Math.ceil(s/u),Math.ceil(o/u)]),u+=u;break;case"truncated":let w=s,E=o;for(;w>u||E>u;)a.push([Math.ceil(w/u),Math.ceil(E/u)]),w>>=1,E>>=1;break;default:ne(!1,53);break}a.push([1,1]),a.reverse();const c=[r],h=[0];for(let w=1,E=a.length;w<E;w++)c.push(r<<w),h.push(a[w-1][0]*a[w-1][1]+h[w-1]);c.reverse();const f=new zi({tileSize:l,extent:e.extent||[0,-o,s,0],resolutions:c});let d=e.url;d&&!d.includes("{TileGroup}")&&!d.includes("{tileIndex}")&&(d+="{TileGroup}/{z}-{x}-{y}.jpg");const g=Lf(d);let m=l*r;function p(w){return function(E,S,b){if(E){const R=E[0],C=E[1],M=E[2],P=C+M*a[R][0],U=(P+h[R])/m|0,O={z:R,x:C,y:M,tileIndex:P,TileGroup:"TileGroup"+U};return w.replace(/\{(\w+?)\}/g,function(L,$){return O[$]})}else return}}const _=Va(g.map(p)),v=S0.bind(null,tt(l*r));super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,tilePixelRatio:r,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:v,tileGrid:f,tileUrlFunction:_,transition:e.transition}),this.zDirection=e.zDirection;const x=f.getTileCoordForCoordAndResolution(Ot(f.getExtent()),c[c.length-1]),y=_(x,1,null),T=new Image;T.addEventListener("error",function(){m=l,this.changed()}.bind(this)),T.src=y}}var U5=G5;function rc(n){return n.toLocaleString("en",{maximumFractionDigits:10})}class B5 extends Vi{constructor(e){const t=e||{};let i=t.url||"";i=i+(i.lastIndexOf("/")===i.length-1||i===""?"":"/");const r=t.version||bt.VERSION2,s=t.sizes||[],o=t.size;ne(o!=null&&Array.isArray(o)&&o.length==2&&!isNaN(o[0])&&o[0]>0&&!isNaN(o[1])&&o[1]>0,60);const a=o[0],l=o[1],u=t.tileSize,c=t.tilePixelRatio||1,h=t.format||"jpg",f=t.quality||(t.version==bt.VERSION1?"native":"default");let d=t.resolutions||[];const g=t.supports||[],m=t.extent||[0,-l,a,0],p=s!=null&&Array.isArray(s)&&s.length>0,_=u!==void 0&&(typeof u=="number"&&Number.isInteger(u)&&u>0||Array.isArray(u)&&u.length>0),v=g!=null&&Array.isArray(g)&&(g.includes("regionByPx")||g.includes("regionByPct"))&&(g.includes("sizeByWh")||g.includes("sizeByH")||g.includes("sizeByW")||g.includes("sizeByPct"));let x,y,T;if(d.sort(function(b,R){return R-b}),_||v)if(u!=null&&(typeof u=="number"&&Number.isInteger(u)&&u>0?(x=u,y=u):Array.isArray(u)&&u.length>0&&((u.length==1||u[1]==null&&Number.isInteger(u[0]))&&(x=u[0],y=u[0]),u.length==2&&(Number.isInteger(u[0])&&Number.isInteger(u[1])?(x=u[0],y=u[1]):u[0]==null&&Number.isInteger(u[1])&&(x=u[1],y=u[1])))),(x===void 0||y===void 0)&&(x=so,y=so),d.length==0){T=Math.max(Math.ceil(Math.log(a/x)/Math.LN2),Math.ceil(Math.log(l/y)/Math.LN2));for(let b=T;b>=0;b--)d.push(Math.pow(2,b))}else{const b=Math.max(...d);T=Math.round(Math.log(b)/Math.LN2)}else if(x=a,y=l,d=[],p){s.sort(function(R,C){return R[0]-C[0]}),T=-1;const b=[];for(let R=0;R<s.length;R++){const C=a/s[R][0];if(d.length>0&&d[d.length-1]==C){b.push(R);continue}d.push(C),T++}if(b.length>0)for(let R=0;R<b.length;R++)s.splice(b[R]-R,1)}else d.push(1),s.push([a,l]),T=0;const w=new zi({tileSize:[x,y],extent:m,origin:Xn(m),resolutions:d}),E=function(b,R,C){let M,P;const U=b[0];if(U>T)return;const O=b[1],L=b[2],$=d[U];if(!(O===void 0||L===void 0||$===void 0||O<0||Math.ceil(a/$/x)<=O||L<0||Math.ceil(l/$/y)<=L)){if(v||_){const N=O*x*$,D=L*y*$;let Y=x*$,k=y*$,F=x,ee=y;if(N+Y>a&&(Y=a-N),D+k>l&&(k=l-D),N+x*$>a&&(F=Math.floor((a-N+$-1)/$)),D+y*$>l&&(ee=Math.floor((l-D+$-1)/$)),N==0&&Y==a&&D==0&&k==l)M="full";else if(!v||g.includes("regionByPx"))M=N+","+D+","+Y+","+k;else if(g.includes("regionByPct")){const X=rc(N/a*100),Z=rc(D/l*100),ie=rc(Y/a*100),B=rc(k/l*100);M="pct:"+X+","+Z+","+ie+","+B}r==bt.VERSION3&&(!v||g.includes("sizeByWh"))?P=F+","+ee:!v||g.includes("sizeByW")?P=F+",":g.includes("sizeByH")?P=","+ee:g.includes("sizeByWh")?P=F+","+ee:g.includes("sizeByPct")&&(P="pct:"+rc(100/$))}else if(M="full",p){const N=s[U][0],D=s[U][1];r==bt.VERSION3?N==a&&D==l?P="max":P=N+","+D:N==a?P="full":P=N+","}else P=r==bt.VERSION3?"max":"full";return i+M+"/"+P+"/0/"+f+"."+h}},S=S0.bind(null,tt(u||256).map(function(b){return b*c}));super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:t.state,tileClass:S,tileGrid:w,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:E,transition:t.transition}),this.zDirection=t.zDirection}}var z5=B5;const sd={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class Sb extends Ct{constructor(e,t){super(e),this.image=t}}class V5 extends Na{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate!==void 0?e.interpolate:!0}),this.on,this.once,this.un,this.resolutions_=e.resolutions!==void 0?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0}getResolutions(){return this.resolutions_}findNearestResolution(e){if(this.resolutions_){const t=bl(this.resolutions_,e,0);e=this.resolutions_[t]}return e}getImage(e,t,i,r){const s=this.getProjection();if(!s||!r||fn(s,r))return s&&(r=s),this.getImageInternal(e,t,i,r);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&fn(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==t&&In(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new zS(s,r,e,t,i,function(o,a,l){return this.getImageInternal(o,a,l,s)}.bind(this),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,i,r){return ae()}handleImageChange(e){const t=e.target;let i;switch(t.getState()){case ce.LOADING:this.loading=!0,i=sd.IMAGELOADSTART;break;case ce.LOADED:this.loading=!1,i=sd.IMAGELOADEND;break;case ce.ERROR:this.loading=!1,i=sd.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new Sb(i,t))}}function sc(n,e){n.getImage().src=e}var bs=V5;function Ki(n,e){const t=[];Object.keys(e).forEach(function(r){e[r]!==null&&e[r]!==void 0&&t.push(r+"="+encodeURIComponent(e[r]))});const i=t.join("&");return n=n.replace(/[?&]$/,""),n+=n.includes("?")?"&":"?",n+i}class j5 extends bs{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:e.interpolate,projection:e.projection,resolutions:e.resolutions}),this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.url_=e.url,this.imageLoadFunction_=e.imageLoadFunction!==void 0?e.imageLoadFunction:sc,this.params_=e.params||{},this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=e.ratio!==void 0?e.ratio:1.5}getParams(){return this.params_}getImageInternal(e,t,i,r){if(this.url_===void 0)return null;t=this.findNearestResolution(t),i=this.hidpi_?i:1;const s=this.image_;if(s&&this.renderedRevision_==this.getRevision()&&s.getResolution()==t&&s.getPixelRatio()==i&&Mt(s.getExtent(),e))return s;const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(o,this.params_),e=e.slice();const a=(e[0]+e[2])/2,l=(e[1]+e[3])/2;if(this.ratio_!=1){const d=this.ratio_*_e(e)/2,g=this.ratio_*Xe(e)/2;e[0]=a-d,e[1]=l-g,e[2]=a+d,e[3]=l+g}const u=t/i,c=Math.ceil(_e(e)/u),h=Math.ceil(Xe(e)/u);e[0]=a-u*c/2,e[2]=a+u*c/2,e[1]=l-u*h/2,e[3]=l+u*h/2,this.imageSize_[0]=c,this.imageSize_[1]=h;const f=this.getRequestUrl_(e,this.imageSize_,i,r,o);return this.image_=new la(e,t,i,f,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(K.CHANGE,this.handleImageChange.bind(this)),this.image_}getImageLoadFunction(){return this.imageLoadFunction_}getRequestUrl_(e,t,i,r,s){const o=r.getCode().split(/:(?=\d+$)/).pop();s.SIZE=t[0]+","+t[1],s.BBOX=e.join(","),s.BBOXSR=o,s.IMAGESR=o,s.DPI=Math.round(90*i);const a=this.url_,l=a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return l==a&&ne(!1,50),Ki(l,s)}getUrl(){return this.url_}setImageLoadFunction(e){this.image_=null,this.imageLoadFunction_=e,this.changed()}setUrl(e){e!=this.url_&&(this.url_=e,this.image_=null,this.changed())}updateParams(e){Object.assign(this.params_,e),this.image_=null,this.changed()}}var X5=j5;class Y5 extends bs{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:e.interpolate,projection:e.projection,resolutions:e.resolutions,state:e.state}),this.canvasFunction_=e.canvasFunction,this.canvas_=null,this.renderedRevision_=0,this.ratio_=e.ratio!==void 0?e.ratio:1.5}getImageInternal(e,t,i,r){t=this.findNearestResolution(t);let s=this.canvas_;if(s&&this.renderedRevision_==this.getRevision()&&s.getResolution()==t&&s.getPixelRatio()==i&&Mt(s.getExtent(),e))return s;e=e.slice(),Il(e,this.ratio_);const o=_e(e)/t,a=Xe(e)/t,l=[o*i,a*i],u=this.canvasFunction_.call(this,e,t,i,l,r);return u&&(s=new Bl(e,t,i,u)),this.canvas_=s,this.renderedRevision_=this.getRevision(),s}}var Z5=Y5;class W5 extends bs{constructor(e){super({interpolate:e.interpolate,projection:e.projection,resolutions:e.resolutions}),this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.displayDpi_=e.displayDpi!==void 0?e.displayDpi:96,this.params_=e.params||{},this.url_=e.url,this.imageLoadFunction_=e.imageLoadFunction!==void 0?e.imageLoadFunction:sc,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.metersPerUnit_=e.metersPerUnit!==void 0?e.metersPerUnit:1,this.ratio_=e.ratio!==void 0?e.ratio:1,this.useOverlay_=e.useOverlay!==void 0?e.useOverlay:!1,this.image_=null,this.renderedRevision_=0}getParams(){return this.params_}getImageInternal(e,t,i,r){t=this.findNearestResolution(t),i=this.hidpi_?i:1;let s=this.image_;if(s&&this.renderedRevision_==this.getRevision()&&s.getResolution()==t&&s.getPixelRatio()==i&&Mt(s.getExtent(),e))return s;this.ratio_!=1&&(e=e.slice(),Il(e,this.ratio_));const o=_e(e)/t,a=Xe(e)/t,l=[o*i,a*i];if(this.url_!==void 0){const u=this.getUrl(this.url_,this.params_,e,l,r);s=new la(e,t,i,u,this.crossOrigin_,this.imageLoadFunction_),s.addEventListener(K.CHANGE,this.handleImageChange.bind(this))}else s=null;return this.image_=s,this.renderedRevision_=this.getRevision(),s}getImageLoadFunction(){return this.imageLoadFunction_}updateParams(e){Object.assign(this.params_,e),this.changed()}getUrl(e,t,i,r,s){const o=H5(i,r,this.metersPerUnit_,this.displayDpi_),a=Ot(i),l={OPERATION:this.useOverlay_?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.displayDpi_,SETDISPLAYWIDTH:Math.round(r[0]),SETDISPLAYHEIGHT:Math.round(r[1]),SETVIEWSCALE:o,SETVIEWCENTERX:a[0],SETVIEWCENTERY:a[1]};return Object.assign(l,t),Ki(e,l)}setImageLoadFunction(e){this.image_=null,this.imageLoadFunction_=e,this.changed()}}function H5(n,e,t,i){const r=_e(n),s=Xe(n),o=e[0],a=e[1],l=.0254/i;return a*r>o*s?r*t/(o*l):s*t/(a*l)}var K5=W5;class q5 extends bs{constructor(e){const t=e.crossOrigin!==void 0?e.crossOrigin:null,i=e.imageLoadFunction!==void 0?e.imageLoadFunction:sc;super({attributions:e.attributions,interpolate:e.interpolate,projection:J(e.projection)}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image_=new la(this.imageExtent_,void 0,1,this.url_,t,i),this.imageSize_=e.imageSize?e.imageSize:null,this.image_.addEventListener(K.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,i,r){return Je(e,this.image_.getExtent())?this.image_:null}getUrl(){return this.url_}handleImageChange(e){if(this.image_.getState()==ce.LOADED){const t=this.image_.getExtent(),i=this.image_.getImage();let r,s;this.imageSize_?(r=this.imageSize_[0],s=this.imageSize_[1]):(r=i.width,s=i.height);const o=_e(t),a=Xe(t),l=o/r,u=a/s;let c=r,h=s;if(l>u?c=Math.round(o/u):h=Math.round(a/l),c!==r||h!==s){const f=yt(c,h);this.getInterpolate()||(f.imageSmoothingEnabled=!1);const d=f.canvas;f.drawImage(i,0,0,r,s,0,0,d.width,d.height),this.image_.setImage(d)}}super.handleImageChange(e)}}var J5=q5;const Sr="1.3.0",Rs=4,bb=[101,101];class Q5 extends bs{constructor(e){e=e||{},super({attributions:e.attributions,interpolate:e.interpolate,projection:e.projection,resolutions:e.resolutions}),this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.url_=e.url,this.imageLoadFunction_=e.imageLoadFunction!==void 0?e.imageLoadFunction:sc,this.params_=Object.assign({},e.params),this.v13_=!0,this.updateV13_(),this.serverType_=e.serverType,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.image_=null,this.imageSize_=[0,0],this.renderedRevision_=0,this.ratio_=e.ratio!==void 0?e.ratio:1.5}getFeatureInfoUrl(e,t,i,r){if(this.url_===void 0)return;const s=J(i),o=this.getProjection();o&&o!==s&&(t=za(o,s,e,t),e=Xr(e,s,o));const a=Ys(e,t,0,bb),l={SERVICE:"WMS",VERSION:Sr,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(l,this.params_,r);const u=Qs((e[0]-a[0])/t,Rs),c=Qs((a[3]-e[1])/t,Rs);return l[this.v13_?"I":"X"]=u,l[this.v13_?"J":"Y"]=c,this.getRequestUrl_(a,bb,1,o||s,l)}getLegendUrl(e,t){if(this.url_===void 0)return;const i={SERVICE:"WMS",VERSION:Sr,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(t===void 0||t.LAYER===void 0){const r=this.params_.LAYERS;if(!(!Array.isArray(r)||r.length===1))return;i.LAYER=r}if(e!==void 0){const r=this.getProjection()?this.getProjection().getMetersPerUnit():1,s=28e-5;i.SCALE=e*r/s}return Object.assign(i,t),Ki(this.url_,i)}getParams(){return this.params_}getImageInternal(e,t,i,r){if(this.url_===void 0)return null;t=this.findNearestResolution(t),i!=1&&(!this.hidpi_||this.serverType_===void 0)&&(i=1);const s=t/i,o=Ot(e),a=sr(_e(e)/s,Rs),l=sr(Xe(e)/s,Rs),u=Ys(o,s,0,[a,l]),c=sr(this.ratio_*_e(e)/s,Rs),h=sr(this.ratio_*Xe(e)/s,Rs),f=Ys(o,s,0,[c,h]),d=this.image_;if(d&&this.renderedRevision_==this.getRevision()&&d.getResolution()==t&&d.getPixelRatio()==i&&Mt(d.getExtent(),u))return d;const g={SERVICE:"WMS",VERSION:Sr,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Object.assign(g,this.params_),this.imageSize_[0]=cg(_e(f)/s,Rs),this.imageSize_[1]=cg(Xe(f)/s,Rs);const m=this.getRequestUrl_(f,this.imageSize_,i,r,g);return this.image_=new la(f,t,i,m,this.crossOrigin_,this.imageLoadFunction_),this.renderedRevision_=this.getRevision(),this.image_.addEventListener(K.CHANGE,this.handleImageChange.bind(this)),this.image_}getImageLoadFunction(){return this.imageLoadFunction_}getRequestUrl_(e,t,i,r,s){if(ne(this.url_!==void 0,9),s[this.v13_?"CRS":"SRS"]=r.getCode(),"STYLES"in this.params_||(s.STYLES=""),i!=1)switch(this.serverType_){case"geoserver":const l=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+l:s.FORMAT_OPTIONS="dpi:"+l;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:ne(!1,8);break}s.WIDTH=t[0],s.HEIGHT=t[1];const o=r.getAxisOrientation();let a;return this.v13_&&o.substr(0,2)=="ne"?a=[e[1],e[0],e[3],e[2]]:a=e,s.BBOX=a.join(","),Ki(this.url_,s)}getUrl(){return this.url_}setImageLoadFunction(e){this.image_=null,this.imageLoadFunction_=e,this.changed()}setUrl(e){e!=this.url_&&(this.url_=e,this.image_=null,this.changed())}updateParams(e){Object.assign(this.params_,e),this.updateV13_(),this.image_=null,this.changed()}updateV13_(){const e=this.params_.VERSION||Sr;this.v13_=hg(e,"1.3")>=0}}var eB=Q5;const tB={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},nB={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Rb(n,e){let t,i;for(let r=0;r<n.length;++r){const s=n[r];if(s.rel==="item"){if(s.type===e){t=s.href;break}(tB[s.type]||!i&&s.type.startsWith("image/"))&&(i=s.href)}}if(!t)if(i)t=i;else throw new Error('Could not find "item" link');return t}function Cb(n,e,t){let i,r;const s={};for(let o=0;o<n.length;++o){const a=n[o];if(s[a.type]=a.href,a.rel==="item"){if(a.type===e){i=a.href;break}nB[a.type]&&(r=a.href)}}if(!i&&t)for(let o=0;o<t.length;++o){const a=t[o];if(s[a]){i=s[a];break}}if(!i)if(r)i=r;else throw new Error('Could not find "item" link');return i}function Ib(n,e,t,i){let r=n.projection;if(!r&&(r=J(e.crs),!r))throw new Error(`Unsupported CRS: ${e.crs}`);const s=r.getAxisOrientation().substr(0,2)!=="en",o=e.tileMatrices,a={};for(let y=0;y<o.length;++y){const T=o[y];a[T.id]=T}const l={},u=[];if(i)for(let y=0;y<i.length;++y){const T=i[y],w=T.tileMatrix;u.push(w),l[w]=T}else for(let y=0;y<o.length;++y){const T=o[y].id;u.push(T)}const c=u.length,h=new Array(c),f=new Array(c),d=new Array(c),g=new Array(c),m=[-1/0,-1/0,1/0,1/0];for(let y=0;y<c;++y){const T=u[y],w=a[T],E=w.pointOfOrigin;s?h[y]=[E[1],E[0]]:h[y]=E,f[y]=w.cellSize,d[y]=[w.matrixWidth,w.matrixHeight],g[y]=[w.tileWidth,w.tileHeight];const S=l[T];if(S){const b=w.cellSize*w.tileWidth,R=h[y][0]+S.minTileCol*b,C=h[y][0]+(S.maxTileCol+1)*b,M=w.cellSize*w.tileHeight,P=w.cornerOfOrigin==="bottomLeft";let U,O;P?(U=h[y][1]+S.minTileRow*M,O=h[y][1]+(S.maxTileRow+1)*M):(U=h[y][1]-(S.maxTileRow+1)*M,O=h[y][1]-S.minTileRow*M),zt(m,[R,U,C,O],m)}}const p=new zi({origins:h,resolutions:f,sizes:d,tileSizes:g,extent:i?m:void 0}),_=n.context,v=n.url;function x(y,T,w){if(!y)return;const E=u[y[0]],S=a[E],b=S.cornerOfOrigin==="bottomLeft",R={tileMatrix:E,tileCol:y[1],tileRow:b?-y[2]-1:y[2]};if(i){const M=l[S.id];if(R.tileCol<M.minTileCol||R.tileCol>M.maxTileCol||R.tileRow<M.minTileRow||R.tileRow>M.maxTileRow)return}Object.assign(R,_);const C=t.replace(/\{(\w+?)\}/g,function(M,P){return R[P]});return i_(v,C)}return{grid:p,urlTemplate:t,urlFunction:x}}function iB(n,e){const t=e.tileMatrixSetLimits;let i;if(e.dataType==="map")i=Rb(e.links,n.mediaType);else if(e.dataType==="vector")i=Cb(e.links,n.mediaType,n.supportedMediaTypes);else throw new Error('Expected tileset data type to be "map" or "vector"');if(e.tileMatrixSet)return Ib(n,e.tileMatrixSet,i,t);const r=e.links.find(a=>a.rel==="http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme");if(!r)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const s=r.href,o=i_(n.url,s);return n_(o).then(function(a){return Ib(n,a,i,t)})}function b0(n){return n_(n.url).then(function(e){return iB(n,e)})}class rB extends Vi{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition});const t={url:e.url,projection:this.getProjection(),mediaType:e.mediaType,context:e.context||null};b0(t).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(e){this.tileGrid=e.grid,this.setTileUrlFunction(e.urlFunction,e.urlTemplate),this.setState("ready")}handleError_(e){console.error(e),this.setState("error")}}var sB=rB;class oB extends Pf{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,format:e.format,overlaps:e.overlaps,projection:e.projection,tileClass:e.tileClass,transition:e.transition,wrapX:e.wrapX,zDirection:e.zDirection,state:"loading"});const t={url:e.url,projection:this.getProjection(),mediaType:e.mediaType,supportedMediaTypes:e.format.supportedMediaTypes,context:e.context||null};b0(t).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(e){this.tileGrid=e.grid,this.setTileUrlFunction(e.urlFunction,e.urlTemplate),this.setState("ready")}handleError_(e){console.error(e),this.setState("error")}}var aB=oB;const R0='© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class lB extends Ju{constructor(e){e=e||{};let t;e.attributions!==void 0?t=e.attributions:t=[R0];const i=e.crossOrigin!==void 0?e.crossOrigin:"anonymous",r=e.url!==void 0?e.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:i,interpolate:e.interpolate,maxZoom:e.maxZoom!==void 0?e.maxZoom:19,opaque:e.opaque!==void 0?e.opaque:!0,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:r,wrapX:e.wrapX,zDirection:e.zDirection})}}var uB=lB;let Ab=!0;try{new ImageData(10,10)}catch{Ab=!1}let C0;function Lb(n,e,t){if(Ab)return new ImageData(n,e,t);C0||(C0=document.createElement("canvas").getContext("2d"));const i=C0.createImageData(e,t);return i.data.set(n),i}function Pb(n){let e=!0;try{new ImageData(10,10)}catch{e=!1}function t(i,r,s){return e?new ImageData(i,r,s):{data:i,width:r,height:s}}return function(i){const r=i.buffers,s=i.meta,o=i.imageOps,a=i.width,l=i.height,u=r.length,c=r[0].byteLength;if(o){const g=new Array(u);for(let p=0;p<u;++p)g[p]=t(new Uint8ClampedArray(r[p]),a,l);return n(g,s).data.buffer}const h=new Uint8ClampedArray(c),f=new Array(u),d=new Array(u);for(let g=0;g<u;++g)f[g]=new Uint8ClampedArray(r[g]),d[g]=[0,0,0,0];for(let g=0;g<c;g+=4){for(let p=0;p<u;++p){const _=f[p];d[p][0]=_[g],d[p][1]=_[g+1],d[p][2]=_[g+2],d[p][3]=_[g+3]}const m=n(d,s);h[g]=m[0],h[g+1]=m[1],h[g+2]=m[2],h[g+3]=m[3]}return h.buffer}}function cB(n,e){const i=Object.keys(n.lib||{}).map(function(s){return"const "+s+" = "+n.lib[s].toString()+";"}).concat(["const __minion__ = ("+Pb.toString()+")(",n.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),r=new Worker(typeof Blob=="undefined"?"data:text/javascript;base64,"+Buffer.from(i.join(`
|
438
|
-
`),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return r.addEventListener("message",e),r}function hB(n,e){const t=Pb(n.operation);let i=!1;return{postMessage:function(r){setTimeout(function(){i||e({data:{buffer:t(r),meta:r.meta}})},0)},terminate:function(){i=!0}}}class Mb extends ks{constructor(e){super(),this._imageOps=!!e.imageOps;let t;e.threads===0?t=0:this._imageOps?t=1:t=e.threads||1;const i=new Array(t);if(t)for(let r=0;r<t;++r)i[r]=cB(e,this._onWorkerMessage.bind(this,r));else i[0]=hB(e,this._onWorkerMessage.bind(this,0));this._workers=i,this._queue=[],this._maxQueueLength=e.queue||1/0,this._running=0,this._dataLookup={},this._job=null}process(e,t,i){this._enqueue({inputs:e,meta:t,callback:i}),this._dispatch()}_enqueue(e){for(this._queue.push(e);this._queue.length>this._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||this._queue.length===0)return;const e=this._queue.shift();this._job=e;const t=e.inputs[0].width,i=e.inputs[0].height,r=e.inputs.map(function(l){return l.data.buffer}),s=this._workers.length;if(this._running=s,s===1){this._workers[0].postMessage({buffers:r,meta:e.meta,imageOps:this._imageOps,width:t,height:i},r);return}const o=e.inputs[0].data.length,a=4*Math.ceil(o/4/s);for(let l=0;l<s;++l){const u=l*a,c=[];for(let h=0,f=r.length;h<f;++h)c.push(r[h].slice(u,u+a));this._workers[l].postMessage({buffers:c,meta:e.meta,imageOps:this._imageOps,width:t,height:i},c)}}_onWorkerMessage(e,t){this.disposed||(this._dataLookup[e]=t.data,--this._running,this._running===0&&this._resolveJob())}_resolveJob(){const e=this._job,t=this._workers.length;let i,r;if(t===1)i=new Uint8ClampedArray(this._dataLookup[0].buffer),r=this._dataLookup[0].meta;else{const s=e.inputs[0].data.length;i=new Uint8ClampedArray(s),r=new Array(t);const o=4*Math.ceil(s/4/t);for(let a=0;a<t;++a){const l=this._dataLookup[a].buffer,u=a*o;i.set(new Uint8ClampedArray(l),u),r[a]=this._dataLookup[a].meta}}this._job=null,this._dataLookup={},e.callback(null,Lb(i,e.inputs[0].width,e.inputs[0].height),r),this._dispatch()}disposeInternal(){for(let e=0;e<this._workers.length;++e)this._workers[e].terminate();this._workers.length=0}}const Fb={BEFOREOPERATIONS:"beforeoperations",AFTEROPERATIONS:"afteroperations"};class I0 extends Ct{constructor(e,t,i){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=i}}class Ob extends bs{constructor(e){super({projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=e.operationType!==void 0?e.operationType:"pixel",this.threads_=e.threads!==void 0?e.threads:1,this.layers_=gB(e.sources);const t=this.changed.bind(this);for(let i=0,r=this.layers_.length;i<r;++i)this.layers_[i].addEventListener(K.CHANGE,t);this.tileQueue_=new fh(function(){return 1},this.changed.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:Le(),declutterTree:null,extent:null,index:0,layerIndex:0,layerStatesArray:dB(this.layers_),pixelRatio:1,pixelToCoordinateTransform:Le(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:H(this),renderTargets:{}},this.setAttributions(function(i){const r=[];for(let s=0,o=e.sources.length;s<o;++s){const a=e.sources[s],u=(a instanceof Na?a:a.getSource()).getAttributions();if(typeof u=="function"){const c=u(i);r.push.apply(r,c)}}return r.length!==0?r:null}),e.operation!==void 0&&this.setOperation(e.operation,e.lib)}setOperation(e,t){this.processor_&&this.processor_.dispose(),this.processor_=new Mb({operation:e,imageOps:this.operationType_==="image",queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,i){const r=Object.assign({},this.frameState_);r.viewState=Object.assign({},r.viewState);const s=Ot(e);r.extent=e.slice(),r.size[0]=Math.round(_e(e)/t),r.size[1]=Math.round(Xe(e)/t),r.time=Date.now();const o=r.viewState;return o.center=s,o.projection=i,o.resolution=t,r}allSourcesReady_(){let e=!0,t;for(let i=0,r=this.layers_.length;i<r;++i)if(t=this.layers_[i].getSource(),t.getState()!=="ready"){e=!1;break}return e}getImage(e,t,i,r){if(!this.allSourcesReady_())return null;const s=this.updateFrameState_(e,t,r);if(this.requestedFrameState_=s,this.renderedImageCanvas_){const o=this.renderedImageCanvas_.getResolution(),a=this.renderedImageCanvas_.getExtent();(t!==o||!In(e,a))&&(this.renderedImageCanvas_=null)}return(!this.renderedImageCanvas_||this.getRevision()!==this.renderedRevision_)&&this.processSources_(),s.tileQueue.loadMoreTiles(16,16),s.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const e=this.requestedFrameState_,t=this.layers_.length,i=new Array(t);for(let s=0;s<t;++s){e.layerIndex=s;const o=fB(this.layers_[s],e);if(o)i[s]=o;else return}const r={};this.dispatchEvent(new I0(Fb.BEFOREOPERATIONS,e,r)),this.processor_.process(i,r,this.onWorkerComplete_.bind(this,e))}onWorkerComplete_(e,t,i,r){if(t||!i)return;const s=e.extent,o=e.viewState.resolution;if(o!==this.requestedFrameState_.viewState.resolution||!In(s,this.requestedFrameState_.extent))return;let a;if(this.renderedImageCanvas_)a=this.renderedImageCanvas_.getImage().getContext("2d");else{const l=Math.round(_e(s)/o),u=Math.round(Xe(s)/o);a=yt(l,u),this.renderedImageCanvas_=new Bl(s,o,1,a.canvas)}a.putImageData(i,0,0),this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new I0(Fb.AFTEROPERATIONS,e,r)),e.animate&&requestAnimationFrame(this.changed.bind(this))}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}}Ob.prototype.dispose;let Do=null;function fB(n,e){const t=n.getRenderer();if(!t)throw new Error("Unsupported layer type: "+n);if(!t.prepareFrame(e))return null;const i=e.size[0],r=e.size[1];if(i===0||r===0)return null;const s=t.renderFrame(e,null);let o;if(s instanceof HTMLCanvasElement)o=s;else{if(s&&(o=s.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===i&&o.height===r)return o.getContext("2d").getImageData(0,0,i,r)}if(!Do)Do=yt(i,r);else{const a=Do.canvas;a.width!==i||a.height!==r?Do=yt(i,r):Do.clearRect(0,0,i,r)}return Do.drawImage(o,0,0,i,r),Do.getImageData(0,0,i,r)}function dB(n){return n.map(function(e){return e.getLayerState()})}function gB(n){const e=n.length,t=new Array(e);for(let i=0;i<e;++i)t[i]=pB(n[i]);return t}function pB(n){let e;return n instanceof Na?n instanceof Du?e=new xT({source:n}):n instanceof bs&&(e=new sT({source:n})):e=n,e}var mB=Ob;const _B=['Map tiles by <a href="https://stamen.com/" target="_blank">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY 3.0</a>.',R0],yB={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},vB={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}};class xB extends Ju{constructor(e){const t=e.layer.indexOf("-"),i=t==-1?e.layer:e.layer.slice(0,t),r=vB[i],s=yB[e.layer],o=e.url!==void 0?e.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+e.layer+"/{z}/{x}/{y}."+s.extension;super({attributions:_B,cacheSize:e.cacheSize,crossOrigin:"anonymous",interpolate:e.interpolate,maxZoom:e.maxZoom!=null?e.maxZoom:r.maxZoom,minZoom:e.minZoom!=null?e.minZoom:r.minZoom,opaque:s.opaque,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:o,wrapX:e.wrapX,zDirection:e.zDirection})}}var EB=xB;class wB extends Vi{constructor(e){e=e||{},super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.params_=e.params||{},this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.tmpExtent_=Ft(),this.setKey(this.getKeyForParams_())}getKeyForParams_(){let e=0;const t=[];for(const i in this.params_)t[e++]=i+"-"+this.params_[i];return t.join("/")}getParams(){return this.params_}getRequestUrl_(e,t,i,r,s,o){const a=this.urls;if(!a)return;const l=s.getCode().split(/:(?=\d+$)/).pop();o.SIZE=t[0]+","+t[1],o.BBOX=i.join(","),o.BBOXSR=l,o.IMAGESR=l,o.DPI=Math.round(o.DPI?o.DPI*r:90*r);let u;if(a.length==1)u=a[0];else{const h=Zn(Sh(e),a.length);u=a[h]}const c=u.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return Ki(c,o)}getTilePixelRatio(e){return this.hidpi_?e:1}updateParams(e){Object.assign(this.params_,e),this.setKey(this.getKeyForParams_())}tileUrlFunction(e,t,i){let r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),r.getResolutions().length<=e[0])return;t!=1&&!this.hidpi_&&(t=1);const s=r.getTileCoordExtent(e,this.tmpExtent_);let o=tt(r.getTileSize(e[0]),this.tmpSize);t!=1&&(o=wh(o,t,this.tmpSize));const a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(a,this.params_),this.getRequestUrl_(e,o,s,t,i,a)}}var TB=wB;class SB extends Ju{constructor(e){e=e||{},super({opaque:!1,projection:e.projection,tileGrid:e.tileGrid,wrapX:e.wrapX!==void 0?e.wrapX:!0,zDirection:e.zDirection,url:e.template||"z:{z} x:{x} y:{y}",tileLoadFunction:(t,i)=>{const r=t.getTileCoord()[0],s=tt(this.tileGrid.getTileSize(r)),o=yt(s[0],s[1]);o.strokeStyle="grey",o.strokeRect(.5,.5,s[0]+.5,s[1]+.5),o.fillStyle="grey",o.strokeStyle="white",o.textAlign="center",o.textBaseline="middle",o.font="24px sans-serif",o.lineWidth=4,o.strokeText(i,s[0]/2,s[1]/2,s[0]),o.fillText(i,s[0]/2,s[1]/2,s[0]),t.setImage(o.canvas)}})}}var bB=SB;class RB extends Vi{constructor(e){e=e||{};const t=Object.assign({},e.params),i="TRANSPARENT"in t?t.TRANSPARENT:!0;super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,opaque:!i,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction,url:e.url,urls:e.urls,wrapX:e.wrapX!==void 0?e.wrapX:!0,transition:e.transition,zDirection:e.zDirection}),this.gutter_=e.gutter!==void 0?e.gutter:0,this.params_=t,this.v13_=!0,this.serverType_=e.serverType,this.hidpi_=e.hidpi!==void 0?e.hidpi:!0,this.tmpExtent_=Ft(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(e,t,i,r){const s=J(i),o=this.getProjection();let a=this.getTileGrid();a||(a=this.getTileGridForProjection(s));const l=a.getZForResolution(t,this.zDirection),u=a.getTileCoordForCoordAndZ(e,l);if(a.getResolutions().length<=u[0])return;let c=a.getResolution(u[0]),h=a.getTileCoordExtent(u,this.tmpExtent_),f=tt(a.getTileSize(u[0]),this.tmpSize);const d=this.gutter_;d!==0&&(f=fp(f,d,this.tmpSize),h=hn(h,c*d,h)),o&&o!==s&&(c=za(o,s,e,c),h=ia(h,s,o),e=Xr(e,s,o));const g={SERVICE:"WMS",VERSION:Sr,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.params_.LAYERS};Object.assign(g,this.params_,r);const m=Math.floor((e[0]-h[0])/c),p=Math.floor((h[3]-e[1])/c);return g[this.v13_?"I":"X"]=m,g[this.v13_?"J":"Y"]=p,this.getRequestUrl_(u,f,h,1,o||s,g)}getLegendUrl(e,t){if(this.urls[0]===void 0)return;const i={SERVICE:"WMS",VERSION:Sr,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(t===void 0||t.LAYER===void 0){const r=this.params_.LAYERS;if(!(!Array.isArray(r)||r.length===1))return;i.LAYER=r}if(e!==void 0){const r=this.getProjection()?this.getProjection().getMetersPerUnit():1,s=28e-5;i.SCALE=e*r/s}return Object.assign(i,t),Ki(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(e,t,i,r,s,o){const a=this.urls;if(!a)return;if(o.WIDTH=t[0],o.HEIGHT=t[1],o[this.v13_?"CRS":"SRS"]=s.getCode(),"STYLES"in this.params_||(o.STYLES=""),r!=1)switch(this.serverType_){case"geoserver":const h=90*r+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+h:o.FORMAT_OPTIONS="dpi:"+h;break;case"mapserver":o.MAP_RESOLUTION=90*r;break;case"carmentaserver":case"qgis":o.DPI=90*r;break;default:ne(!1,52);break}const l=s.getAxisOrientation(),u=i;if(this.v13_&&l.substr(0,2)=="ne"){let h;h=i[0],u[0]=i[1],u[1]=h,h=i[2],u[2]=i[3],u[3]=h}o.BBOX=u.join(",");let c;if(a.length==1)c=a[0];else{const h=Zn(Sh(e),a.length);c=a[h]}return Ki(c,o)}getTilePixelRatio(e){return!this.hidpi_||this.serverType_===void 0?1:e}getKeyForParams_(){let e=0;const t=[];for(const i in this.params_)t[e++]=i+"-"+this.params_[i];return t.join("/")}updateParams(e){Object.assign(this.params_,e),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const e=this.params_.VERSION||Sr;this.v13_=hg(e,"1.3")>=0}tileUrlFunction(e,t,i){let r=this.getTileGrid();if(r||(r=this.getTileGridForProjection(i)),r.getResolutions().length<=e[0])return;t!=1&&(!this.hidpi_||this.serverType_===void 0)&&(t=1);const s=r.getResolution(e[0]);let o=r.getTileCoordExtent(e,this.tmpExtent_),a=tt(r.getTileSize(e[0]),this.tmpSize);const l=this.gutter_;l!==0&&(a=fp(a,l,this.tmpSize),o=hn(o,s*l,o)),t!=1&&(a=wh(a,t,this.tmpSize));const u={SERVICE:"WMS",VERSION:Sr,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(u,this.params_),this.getRequestUrl_(e,a,o,t,i,u)}}var CB=RB;class $b extends Nr{constructor(e,t,i,r,s,o){super(e,t),this.src_=i,this.extent_=r,this.preemptive_=s,this.grid_=null,this.keys_=null,this.data_=null,this.jsonp_=o}getImage(){return null}getData(e){if(!this.grid_||!this.keys_)return null;const t=(e[0]-this.extent_[0])/(this.extent_[2]-this.extent_[0]),i=(e[1]-this.extent_[1])/(this.extent_[3]-this.extent_[1]),r=this.grid_[Math.floor((1-i)*this.grid_.length)];if(typeof r!="string")return null;let s=r.charCodeAt(Math.floor(t*r.length));s>=93&&s--,s>=35&&s--,s-=32;let o=null;if(s in this.keys_){const a=this.keys_[s];this.data_&&a in this.data_?o=this.data_[a]:o=a}return o}forDataAtCoordinate(e,t,i){this.state==V.EMPTY&&i===!0?(this.state=V.IDLE,Us(this,K.CHANGE,function(r){t(this.getData(e))},this),this.loadInternal_()):i===!0?setTimeout(function(){t(this.getData(e))}.bind(this),0):t(this.getData(e))}getKey(){return this.src_}handleError_(){this.state=V.ERROR,this.changed()}handleLoad_(e){this.grid_=e.grid,this.keys_=e.keys,this.data_=e.data,this.state=V.LOADED,this.changed()}loadInternal_(){if(this.state==V.IDLE)if(this.state=V.LOADING,this.jsonp_)Nu(this.src_,this.handleLoad_.bind(this),this.handleError_.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",this.src_),e.send()}}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let i;try{i=JSON.parse(t.responseText)}catch{this.handleError_();return}this.handleLoad_(i)}else this.handleError_()}onXHRError_(e){this.handleError_()}load(){this.preemptive_?this.loadInternal_():this.setState(V.EMPTY)}}class IB extends Du{constructor(e){if(super({projection:J("EPSG:3857"),state:"loading",zDirection:e.zDirection}),this.preemptive_=e.preemptive!==void 0?e.preemptive:!0,this.tileUrlFunction_=pT,this.template_=void 0,this.jsonp_=e.jsonp||!1,e.url)if(this.jsonp_)Nu(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else e.tileJSON?this.handleTileJSONResponse(e.tileJSON):ne(!1,51)}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let i;try{i=JSON.parse(t.responseText)}catch{this.handleTileJSONError();return}this.handleTileJSONResponse(i)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTemplate(){return this.template_}forDataAtCoordinateAndResolution(e,t,i,r){if(this.tileGrid){const s=this.tileGrid.getZForResolution(t,this.zDirection),o=this.tileGrid.getTileCoordForCoordAndZ(e,s);this.getTile(o[0],o[1],o[2],1,this.getProjection()).forDataAtCoordinate(e,i,r)}else r===!0?setTimeout(function(){i(null)},0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(e){const t=J("EPSG:4326"),i=this.getProjection();let r;if(e.bounds!==void 0){const c=Un(t,i);r=Zs(e.bounds,c)}const s=yr(i),o=e.minzoom||0,a=e.maxzoom||22,l=So({extent:s,maxZoom:a,minZoom:o});this.tileGrid=l,this.template_=e.template;const u=e.grids;if(!u){this.setState("error");return}if(this.tileUrlFunction_=Af(u,l),e.attribution!==void 0){const c=r!==void 0?r:s;this.setAttributions(function(h){return Je(c,h.extent)?[e.attribution]:null})}this.setState("ready")}getTile(e,t,i,r,s){const o=$i(e,t,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);{const a=[e,t,i],l=this.getTileCoordForTileUrlFunction(a,s),u=this.tileUrlFunction_(l,r,s),c=new $b(a,u!==void 0?V.IDLE:V.EMPTY,u!==void 0?u:"",this.tileGrid.getTileCoordExtent(a),this.preemptive_,this.jsonp_);return this.tileCache.set(o,c),c}}useTile(e,t,i){const r=$i(e,t,i);this.tileCache.containsKey(r)&&this.tileCache.get(r)}}var AB=IB;class Db extends zi{constructor(e){super({extent:e.extent,origin:e.origin,origins:e.origins,resolutions:e.resolutions,tileSize:e.tileSize,tileSizes:e.tileSizes,sizes:e.sizes}),this.matrixIds_=e.matrixIds}getMatrixId(e){return this.matrixIds_[e]}getMatrixIds(){return this.matrixIds_}}var LB=Db;function Nb(n,e,t){const i=[],r=[],s=[],o=[],a=[];t=t!==void 0?t:[];const l="SupportedCRS",u="TileMatrix",c="Identifier",h="ScaleDenominator",f="TopLeftCorner",d="TileWidth",g="TileHeight",m=n[l],p=J(m),_=p.getMetersPerUnit(),v=p.getAxisOrientation().substr(0,2)=="ne";return n[u].sort(function(x,y){return y[h]-x[h]}),n[u].forEach(function(x){let y;if(t.length>0?y=t.find(function(T){return x[c]==T[u]?!0:x[c].includes(":")?!1:n[c]+":"+x[c]===T[u]}):y=!0,y){r.push(x[c]);const T=x[h]*28e-5/_,w=x[d],E=x[g];v?s.push([x[f][1],x[f][0]]):s.push(x[f]),i.push(T),o.push(w==E?w:[w,E]),a.push([x.MatrixWidth,x.MatrixHeight])}}),new Db({extent:e,origins:s,resolutions:i,matrixIds:r,tileSizes:o,sizes:a})}class PB extends Vi{constructor(e){const t=e.requestEncoding!==void 0?e.requestEncoding:"KVP",i=e.tileGrid;let r=e.urls;r===void 0&&e.url!==void 0&&(r=Lf(e.url)),super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileClass:e.tileClass,tileGrid:i,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,urls:r,wrapX:e.wrapX!==void 0?e.wrapX:!1,transition:e.transition,zDirection:e.zDirection}),this.version_=e.version!==void 0?e.version:"1.0.0",this.format_=e.format!==void 0?e.format:"image/jpeg",this.dimensions_=e.dimensions!==void 0?e.dimensions:{},this.layer_=e.layer,this.matrixSet_=e.matrixSet,this.style_=e.style,this.requestEncoding_=t,this.setKey(this.getKeyForDimensions_()),r&&r.length>0&&(this.tileUrlFunction=Va(r.map(this.createFromWMTSTemplate.bind(this))))}setUrls(e){this.urls=e;const t=e.join(`
|
439
|
-
`);this.setTileUrlFunction(Va(e.map(this.createFromWMTSTemplate.bind(this))),t)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){let e=0;const t=[];for(const i in this.dimensions_)t[e++]=i+"-"+this.dimensions_[i];return t.join("/")}updateDimensions(e){Object.assign(this.dimensions_,e),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(e){const t=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};t=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),e=t=="KVP"?Ki(e,i):e.replace(/\{(\w+?)\}/g,function(o,a){return a.toLowerCase()in i?i[a.toLowerCase()]:o});const r=this.tileGrid,s=this.dimensions_;return function(o,a,l){if(o){const u={TileMatrix:r.getMatrixId(o[0]),TileCol:o[1],TileRow:o[2]};Object.assign(u,s);let c=e;return t=="KVP"?c=Ki(c,u):c=c.replace(/\{(\w+?)\}/g,function(h,f){return u[f]}),c}else return}}}var MB=PB;function FB(n,e){const i=n.Contents.Layer.find(function(M){return M.Identifier==e.layer});if(!i)return null;const r=n.Contents.TileMatrixSet;let s;i.TileMatrixSetLink.length>1?"projection"in e?s=i.TileMatrixSetLink.findIndex(function(M){const U=r.find(function($){return $.Identifier==M.TileMatrixSet}).SupportedCRS,O=J(U),L=J(e.projection);return O&&L?fn(O,L):U==e.projection}):s=i.TileMatrixSetLink.findIndex(function(M){return M.TileMatrixSet==e.matrixSet}):s=0,s<0&&(s=0);const o=i.TileMatrixSetLink[s].TileMatrixSet,a=i.TileMatrixSetLink[s].TileMatrixSetLimits;let l=i.Format[0];"format"in e&&(l=e.format),s=i.Style.findIndex(function(M){return"style"in e?M.Title==e.style:M.isDefault}),s<0&&(s=0);const u=i.Style[s].Identifier,c={};"Dimension"in i&&i.Dimension.forEach(function(M,P,U){const O=M.Identifier;let L=M.Default;L===void 0&&(L=M.Value[0]),c[O]=L});const f=n.Contents.TileMatrixSet.find(function(M){return M.Identifier==o});let d;const g=f.SupportedCRS;if(g&&(d=J(g)),"projection"in e){const M=J(e.projection);M&&(!d||fn(M,d))&&(d=M)}let m=!1;const p=d.getAxisOrientation().substr(0,2)=="ne";let _=f.TileMatrix[0],v={MinTileCol:0,MinTileRow:0,MaxTileCol:_.MatrixWidth-1,MaxTileRow:_.MatrixHeight-1};if(a){v=a[a.length-1];const M=f.TileMatrix.find(P=>P.Identifier===v.TileMatrix||f.Identifier+":"+P.Identifier===v.TileMatrix);M&&(_=M)}const x=_.ScaleDenominator*28e-5/d.getMetersPerUnit(),y=p?[_.TopLeftCorner[1],_.TopLeftCorner[0]]:_.TopLeftCorner,T=_.TileWidth*x,w=_.TileHeight*x;let E=f.BoundingBox;E&&p&&(E=[E[1],E[0],E[3],E[2]]);let S=[y[0]+T*v.MinTileCol,y[1]-w*(1+v.MaxTileRow),y[0]+T*(1+v.MaxTileCol),y[1]-w*v.MinTileRow];if(E!==void 0&&!Mt(E,S)){const M=i.WGS84BoundingBox,P=J("EPSG:4326").getExtent();if(S=E,M)m=M[0]===P[0]&&M[2]===P[2];else{const U=ia(E,f.SupportedCRS,"EPSG:4326");m=U[0]-1e-10<=P[0]&&U[2]+1e-10>=P[2]}}const b=Nb(f,S,a),R=[];let C=e.requestEncoding;if(C=C!==void 0?C:"","OperationsMetadata"in n&&"GetTile"in n.OperationsMetadata){const M=n.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let P=0,U=M.length;P<U;++P)if(M[P].Constraint){const L=M[P].Constraint.find(function($){return $.name=="GetEncoding"}).AllowedValues.Value;if(C===""&&(C=L[0]),C==="KVP")L.includes("KVP")&&R.push(M[P].href);else break}else M[P].href&&(C="KVP",R.push(M[P].href))}return R.length===0&&(C="REST",i.ResourceURL.forEach(function(M){M.resourceType==="tile"&&(l=M.format,R.push(M.template))})),{urls:R,layer:e.layer,matrixSet:o,format:l,projection:d,requestEncoding:C,tileGrid:b,style:u,dimensions:c,wrapX:m,crossOrigin:e.crossOrigin}}const OB="1.3.0";function $B(n,e){const t=new Th(32),i=n.getExtent();return function(r,s){t.expireCache(),i&&(r=zt(i,r));const o=n.getZForResolution(s),a=[];return n.forEachTileCoord(r,o,l=>{const u=l.toString();if(!t.containsKey(u)){const c=e(l);t.set(u,c)}a.push(t.get(u))}),a}}class DB{constructor(e){this.first_,this.last_,this.head_,this.circular_=e===void 0?!0:e,this.length_=0}insertItem(e){const t={prev:void 0,next:void 0,data:e},i=this.head_;if(!i)this.first_=t,this.last_=t,this.circular_&&(t.next=t,t.prev=t);else{const r=i.next;t.prev=i,t.next=r,i.next=t,r&&(r.prev=t),i===this.last_&&(this.last_=t)}this.head_=t,this.length_++}removeItem(){const e=this.head_;if(e){const t=e.next,i=e.prev;t&&(t.prev=i),i&&(i.next=t),this.head_=t||i,this.first_===this.last_?(this.head_=void 0,this.first_=void 0,this.last_=void 0):this.first_===e?this.first_=this.head_:this.last_===e&&(this.last_=i?this.head_.prev:this.head_),this.length_--}}firstItem(){if(this.head_=this.first_,this.head_)return this.head_.data}lastItem(){if(this.head_=this.last_,this.head_)return this.head_.data}nextItem(){if(this.head_&&this.head_.next)return this.head_=this.head_.next,this.head_.data}getNextItem(){if(this.head_&&this.head_.next)return this.head_.next.data}prevItem(){if(this.head_&&this.head_.prev)return this.head_=this.head_.prev,this.head_.data}getPrevItem(){if(this.head_&&this.head_.prev)return this.head_.prev.data}getCurrItem(){if(this.head_)return this.head_.data}setFirstItem(){this.circular_&&this.head_&&(this.first_=this.head_,this.last_=this.head_.prev)}concat(e){if(e.head_){if(this.head_){const t=this.head_.next;this.head_.next=e.first_,e.first_.prev=this.head_,t.prev=e.last_,e.last_.next=t,this.length_+=e.length_}else this.head_=e.head_,this.first_=e.first_,this.last_=e.last_,this.length_=e.length_;e.head_=void 0,e.first_=void 0,e.last_=void 0,e.length_=0}}getLength(){return this.length_}}var NB=DB;const kB={CIRCLE:"circle",SQUARE:"square",TRIANGLE:"triangle",IMAGE:"image"};function GB(n,e){let t=n.length-e,i=0;do{for(let r=e;r>0;r--)n[i+e]+=n[i],i++;t-=e}while(t>0)}function UB(n,e,t){let i=0,r=n.length;const s=r/t;for(;r>e;){for(let a=e;a>0;--a)n[i+e]+=n[i],++i;r-=e}const o=n.slice();for(let a=0;a<s;++a)for(let l=0;l<t;++l)n[t*a+l]=o[(t-l-1)*s+a]}function BB(n,e,t,i,r,s){if(!e||e===1)return n;for(let l=0;l<r.length;++l){if(r[l]%8!==0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(r[l]!==r[0])throw new Error("When decoding with predictor, all samples must have the same size.")}const o=r[0]/8,a=s===2?1:r.length;for(let l=0;l<i&&!(l*a*t*o>=n.byteLength);++l){let u;if(e===2){switch(r[0]){case 8:u=new Uint8Array(n,l*a*t*o,a*t*o);break;case 16:u=new Uint16Array(n,l*a*t*o,a*t*o/2);break;case 32:u=new Uint32Array(n,l*a*t*o,a*t*o/4);break;default:throw new Error(`Predictor 2 not allowed with ${r[0]} bits per sample.`)}GB(u,a)}else e===3&&(u=new Uint8Array(n,l*a*t*o,a*t*o),UB(u,a,o))}return n}class No{async decode(e,t){const i=await this.decodeBlock(t),r=e.Predictor||1;if(r!==1){const s=!e.StripOffsets,o=s?e.TileWidth:e.ImageWidth,a=s?e.TileLength:e.RowsPerStrip||e.ImageLength;return BB(i,r,o,a,e.BitsPerSample,e.PlanarConfiguration)}return i}}class zB extends No{decodeBlock(e){return e}}var VB=Object.freeze(Object.defineProperty({__proto__:null,default:zB},Symbol.toStringTag,{value:"Module"}));const kb=9,A0=256,L0=257,jB=12;function XB(n,e,t){const i=e%8,r=Math.floor(e/8),s=8-i,o=e+t-(r+1)*8;let a=8*(r+2)-(e+t);const l=(r+2)*8-e;if(a=Math.max(0,a),r>=n.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),L0;let u=n[r]&2**(8-i)-1;u<<=t-s;let c=u;if(r+1<n.length){let h=n[r+1]>>>a;h<<=Math.max(0,t-l),c+=h}if(o>8&&r+2<n.length){const h=(r+3)*8-(e+t);c+=n[r+2]>>>h}return c}function P0(n,e){for(let t=e.length-1;t>=0;t--)n.push(e[t]);return n}function YB(n){const e=new Uint16Array(4093),t=new Uint8Array(4093);for(let g=0;g<=257;g++)e[g]=4096,t[g]=g;let i=258,r=kb,s=0;function o(){i=258,r=kb}function a(g){const m=XB(g,s,r);return s+=r,m}function l(g,m){return t[i]=m,e[i]=g,i++,i-1}function u(g){const m=[];for(let p=g;p!==4096;p=e[p])m.push(t[p]);return m}const c=[];o();const h=new Uint8Array(n);let f=a(h),d;for(;f!==L0;){if(f===A0){for(o(),f=a(h);f===A0;)f=a(h);if(f===L0)break;if(f>A0)throw new Error(`corrupted code at scanline ${f}`);{const g=u(f);P0(c,g),d=f}}else if(f<i){const g=u(f);P0(c,g),l(d,g[g.length-1]),d=f}else{const g=u(d);if(!g)throw new Error(`Bogus entry. Not in dictionary, ${d} / ${i}, position: ${s}`);P0(c,g),c.push(g[g.length-1]),l(d,g[g.length-1]),d=f}i+1>=2**r&&(r===jB?d=void 0:r++),f=a(h)}return new Uint8Array(c)}class ZB extends No{decodeBlock(e){return YB(e).buffer}}var WB=Object.freeze(Object.defineProperty({__proto__:null,default:ZB},Symbol.toStringTag,{value:"Module"}));const oc=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),od=4017,ad=799,ld=3406,ud=2276,cd=1567,hd=3784,sl=5793,fd=2896;function Gb(n,e){let t=0;const i=[];let r=16;for(;r>0&&!n[r-1];)--r;i.push({children:[],index:0});let s=i[0],o;for(let a=0;a<r;a++){for(let l=0;l<n[a];l++){for(s=i.pop(),s.children[s.index]=e[t];s.index>0;)s=i.pop();for(s.index++,i.push(s);i.length<=a;)i.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o;t++}a+1<r&&(i.push(o={children:[],index:0}),s.children[s.index]=o.children,s=o)}return i[0].children}function HB(n,e,t,i,r,s,o,a,l){const{mcusPerLine:u,progressive:c}=t,h=e;let f=e,d=0,g=0;function m(){if(g>0)return g--,d>>g&1;if(d=n[f++],d===255){const X=n[f++];if(X)throw new Error(`unexpected marker: ${(d<<8|X).toString(16)}`)}return g=7,d>>>7}function p(X){let Z=X,ie;for(;(ie=m())!==null;){if(Z=Z[ie],typeof Z=="number")return Z;if(typeof Z!="object")throw new Error("invalid huffman sequence")}return null}function _(X){let Z=X,ie=0;for(;Z>0;){const B=m();if(B===null)return;ie=ie<<1|B,--Z}return ie}function v(X){const Z=_(X);return Z>=1<<X-1?Z:Z+(-1<<X)+1}function x(X,Z){const ie=p(X.huffmanTableDC),B=ie===0?0:v(ie);X.pred+=B,Z[0]=X.pred;let he=1;for(;he<64;){const me=p(X.huffmanTableAC),De=me&15,rt=me>>4;if(De===0){if(rt<15)break;he+=16}else{he+=rt;const Ce=oc[he];Z[Ce]=v(De),he++}}}function y(X,Z){const ie=p(X.huffmanTableDC),B=ie===0?0:v(ie)<<l;X.pred+=B,Z[0]=X.pred}function T(X,Z){Z[0]|=m()<<l}let w=0;function E(X,Z){if(w>0){w--;return}let ie=s;const B=o;for(;ie<=B;){const he=p(X.huffmanTableAC),me=he&15,De=he>>4;if(me===0){if(De<15){w=_(De)+(1<<De)-1;break}ie+=16}else{ie+=De;const rt=oc[ie];Z[rt]=v(me)*(1<<l),ie++}}}let S=0,b;function R(X,Z){let ie=s;const B=o;let he=0;for(;ie<=B;){const me=oc[ie],De=Z[me]<0?-1:1;switch(S){case 0:{const rt=p(X.huffmanTableAC),Ce=rt&15;if(he=rt>>4,Ce===0)he<15?(w=_(he)+(1<<he),S=4):(he=16,S=1);else{if(Ce!==1)throw new Error("invalid ACn encoding");b=v(Ce),S=he?2:3}continue}case 1:case 2:Z[me]?Z[me]+=(m()<<l)*De:(he--,he===0&&(S=S===2?3:0));break;case 3:Z[me]?Z[me]+=(m()<<l)*De:(Z[me]=b<<l,S=0);break;case 4:Z[me]&&(Z[me]+=(m()<<l)*De);break}ie++}S===4&&(w--,w===0&&(S=0))}function C(X,Z,ie,B,he){const me=ie/u|0,De=ie%u,rt=me*X.v+B,Ce=De*X.h+he;Z(X,X.blocks[rt][Ce])}function M(X,Z,ie){const B=ie/X.blocksPerLine|0,he=ie%X.blocksPerLine;Z(X,X.blocks[B][he])}const P=i.length;let U,O,L,$,N,D;c?s===0?D=a===0?y:T:D=a===0?E:R:D=x;let Y=0,k,F;P===1?F=i[0].blocksPerLine*i[0].blocksPerColumn:F=u*t.mcusPerColumn;const ee=r||F;for(;Y<F;){for(O=0;O<P;O++)i[O].pred=0;if(w=0,P===1)for(U=i[0],N=0;N<ee;N++)M(U,D,Y),Y++;else for(N=0;N<ee;N++){for(O=0;O<P;O++){U=i[O];const{h:X,v:Z}=U;for(L=0;L<Z;L++)for($=0;$<X;$++)C(U,D,Y,L,$)}if(Y++,Y===F)break}if(g=0,k=n[f]<<8|n[f+1],k<65280)throw new Error("marker was not found");if(k>=65488&&k<=65495)f+=2;else break}return f-h}function KB(n,e){const t=[],{blocksPerLine:i,blocksPerColumn:r}=e,s=i<<3,o=new Int32Array(64),a=new Uint8Array(64);function l(u,c,h){const f=e.quantizationTable;let d,g,m,p,_,v,x,y,T;const w=h;let E;for(E=0;E<64;E++)w[E]=u[E]*f[E];for(E=0;E<8;++E){const S=8*E;if(w[1+S]===0&&w[2+S]===0&&w[3+S]===0&&w[4+S]===0&&w[5+S]===0&&w[6+S]===0&&w[7+S]===0){T=sl*w[0+S]+512>>10,w[0+S]=T,w[1+S]=T,w[2+S]=T,w[3+S]=T,w[4+S]=T,w[5+S]=T,w[6+S]=T,w[7+S]=T;continue}d=sl*w[0+S]+128>>8,g=sl*w[4+S]+128>>8,m=w[2+S],p=w[6+S],_=fd*(w[1+S]-w[7+S])+128>>8,y=fd*(w[1+S]+w[7+S])+128>>8,v=w[3+S]<<4,x=w[5+S]<<4,T=d-g+1>>1,d=d+g+1>>1,g=T,T=m*hd+p*cd+128>>8,m=m*cd-p*hd+128>>8,p=T,T=_-x+1>>1,_=_+x+1>>1,x=T,T=y+v+1>>1,v=y-v+1>>1,y=T,T=d-p+1>>1,d=d+p+1>>1,p=T,T=g-m+1>>1,g=g+m+1>>1,m=T,T=_*ud+y*ld+2048>>12,_=_*ld-y*ud+2048>>12,y=T,T=v*ad+x*od+2048>>12,v=v*od-x*ad+2048>>12,x=T,w[0+S]=d+y,w[7+S]=d-y,w[1+S]=g+x,w[6+S]=g-x,w[2+S]=m+v,w[5+S]=m-v,w[3+S]=p+_,w[4+S]=p-_}for(E=0;E<8;++E){const S=E;if(w[1*8+S]===0&&w[2*8+S]===0&&w[3*8+S]===0&&w[4*8+S]===0&&w[5*8+S]===0&&w[6*8+S]===0&&w[7*8+S]===0){T=sl*h[E+0]+8192>>14,w[0*8+S]=T,w[1*8+S]=T,w[2*8+S]=T,w[3*8+S]=T,w[4*8+S]=T,w[5*8+S]=T,w[6*8+S]=T,w[7*8+S]=T;continue}d=sl*w[0*8+S]+2048>>12,g=sl*w[4*8+S]+2048>>12,m=w[2*8+S],p=w[6*8+S],_=fd*(w[1*8+S]-w[7*8+S])+2048>>12,y=fd*(w[1*8+S]+w[7*8+S])+2048>>12,v=w[3*8+S],x=w[5*8+S],T=d-g+1>>1,d=d+g+1>>1,g=T,T=m*hd+p*cd+2048>>12,m=m*cd-p*hd+2048>>12,p=T,T=_-x+1>>1,_=_+x+1>>1,x=T,T=y+v+1>>1,v=y-v+1>>1,y=T,T=d-p+1>>1,d=d+p+1>>1,p=T,T=g-m+1>>1,g=g+m+1>>1,m=T,T=_*ud+y*ld+2048>>12,_=_*ld-y*ud+2048>>12,y=T,T=v*ad+x*od+2048>>12,v=v*od-x*ad+2048>>12,x=T,w[0*8+S]=d+y,w[7*8+S]=d-y,w[1*8+S]=g+x,w[6*8+S]=g-x,w[2*8+S]=m+v,w[5*8+S]=m-v,w[3*8+S]=p+_,w[4*8+S]=p-_}for(E=0;E<64;++E){const S=128+(w[E]+8>>4);S<0?c[E]=0:S>255?c[E]=255:c[E]=S}}for(let u=0;u<r;u++){const c=u<<3;for(let h=0;h<8;h++)t.push(new Uint8Array(s));for(let h=0;h<i;h++){l(e.blocks[u][h],a,o);let f=0;const d=h<<3;for(let g=0;g<8;g++){const m=t[c+g];for(let p=0;p<8;p++)m[d+p]=a[f++]}}}return t}class qB{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(e){let t=0;function i(){const a=e[t]<<8|e[t+1];return t+=2,a}function r(){const a=i(),l=e.subarray(t,t+a-2);return t+=l.length,l}function s(a){let l=0,u=0,c,h;for(h in a.components)a.components.hasOwnProperty(h)&&(c=a.components[h],l<c.h&&(l=c.h),u<c.v&&(u=c.v));const f=Math.ceil(a.samplesPerLine/8/l),d=Math.ceil(a.scanLines/8/u);for(h in a.components)if(a.components.hasOwnProperty(h)){c=a.components[h];const g=Math.ceil(Math.ceil(a.samplesPerLine/8)*c.h/l),m=Math.ceil(Math.ceil(a.scanLines/8)*c.v/u),p=f*c.h,_=d*c.v,v=[];for(let x=0;x<_;x++){const y=[];for(let T=0;T<p;T++)y.push(new Int32Array(64));v.push(y)}c.blocksPerLine=g,c.blocksPerColumn=m,c.blocks=v}a.maxH=l,a.maxV=u,a.mcusPerLine=f,a.mcusPerColumn=d}let o=i();if(o!==65496)throw new Error("SOI not found");for(o=i();o!==65497;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const a=r();o===65504&&a[0]===74&&a[1]===70&&a[2]===73&&a[3]===70&&a[4]===0&&(this.jfif={version:{major:a[5],minor:a[6]},densityUnits:a[7],xDensity:a[8]<<8|a[9],yDensity:a[10]<<8|a[11],thumbWidth:a[12],thumbHeight:a[13],thumbData:a.subarray(14,14+3*a[12]*a[13])}),o===65518&&a[0]===65&&a[1]===100&&a[2]===111&&a[3]===98&&a[4]===101&&a[5]===0&&(this.adobe={version:a[6],flags0:a[7]<<8|a[8],flags1:a[9]<<8|a[10],transformCode:a[11]});break}case 65499:{const l=i()+t-2;for(;t<l;){const u=e[t++],c=new Int32Array(64);if(u>>4===0)for(let h=0;h<64;h++){const f=oc[h];c[f]=e[t++]}else if(u>>4===1)for(let h=0;h<64;h++){const f=oc[h];c[f]=i()}else throw new Error("DQT: invalid table spec");this.quantizationTables[u&15]=c}break}case 65472:case 65473:case 65474:{i();const a={extended:o===65473,progressive:o===65474,precision:e[t++],scanLines:i(),samplesPerLine:i(),components:{},componentsOrder:[]},l=e[t++];let u;for(let c=0;c<l;c++){u=e[t];const h=e[t+1]>>4,f=e[t+1]&15,d=e[t+2];a.componentsOrder.push(u),a.components[u]={h,v:f,quantizationIdx:d},t+=3}s(a),this.frames.push(a);break}case 65476:{const a=i();for(let l=2;l<a;){const u=e[t++],c=new Uint8Array(16);let h=0;for(let d=0;d<16;d++,t++)c[d]=e[t],h+=c[d];const f=new Uint8Array(h);for(let d=0;d<h;d++,t++)f[d]=e[t];l+=17+h,u>>4===0?this.huffmanTablesDC[u&15]=Gb(c,f):this.huffmanTablesAC[u&15]=Gb(c,f)}break}case 65501:i(),this.resetInterval=i();break;case 65498:{i();const a=e[t++],l=[],u=this.frames[0];for(let g=0;g<a;g++){const m=u.components[e[t++]],p=e[t++];m.huffmanTableDC=this.huffmanTablesDC[p>>4],m.huffmanTableAC=this.huffmanTablesAC[p&15],l.push(m)}const c=e[t++],h=e[t++],f=e[t++];t+=HB(e,t,u,l,this.resetInterval,c,h,f>>4,f&15);break}case 65535:e[t]!==255&&t--;break;default:if(e[t-3]===255&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error(`unknown JPEG marker ${o.toString(16)}`)}o=i()}}getResult(){const{frames:e}=this;if(this.frames.length===0)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let c=0;c<this.frames.length;c++){const h=this.frames[c].components;for(const f of Object.keys(h))h[f].quantizationTable=this.quantizationTables[h[f].quantizationIdx],delete h[f].quantizationIdx}const t=e[0],{components:i,componentsOrder:r}=t,s=[],o=t.samplesPerLine,a=t.scanLines;for(let c=0;c<r.length;c++){const h=i[r[c]];s.push({lines:KB(t,h),scaleX:h.h/t.maxH,scaleY:h.v/t.maxV})}const l=new Uint8Array(o*a*s.length);let u=0;for(let c=0;c<a;++c)for(let h=0;h<o;++h)for(let f=0;f<s.length;++f){const d=s[f];l[u]=d.lines[0|c*d.scaleY][0|h*d.scaleX],++u}return l}}class JB extends No{constructor(e){super(),this.reader=new qB,e.JPEGTables&&this.reader.parse(e.JPEGTables)}decodeBlock(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}var QB=Object.freeze(Object.defineProperty({__proto__:null,default:JB},Symbol.toStringTag,{value:"Module"}));/*! pako 2.0.4 https://github.com/nodeca/pako @license (MIT AND Zlib) */const ez=4,Ub=0,Bb=1,tz=2;function ol(n){let e=n.length;for(;--e>=0;)n[e]=0}const nz=0,zb=1,iz=2,rz=3,sz=258,M0=29,ac=256,lc=ac+1+M0,al=30,F0=19,Vb=2*lc+1,ko=15,O0=16,oz=7,$0=256,jb=16,Xb=17,Yb=18,D0=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),dd=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),az=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Zb=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lz=512,br=new Array((lc+2)*2);ol(br);const uc=new Array(al*2);ol(uc);const cc=new Array(lz);ol(cc);const hc=new Array(sz-rz+1);ol(hc);const N0=new Array(M0);ol(N0);const gd=new Array(al);ol(gd);function k0(n,e,t,i,r){this.static_tree=n,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=r,this.has_stree=n&&n.length}let Wb,Hb,Kb;function G0(n,e){this.dyn_tree=n,this.max_code=0,this.stat_desc=e}const qb=n=>n<256?cc[n]:cc[256+(n>>>7)],fc=(n,e)=>{n.pending_buf[n.pending++]=e&255,n.pending_buf[n.pending++]=e>>>8&255},$n=(n,e,t)=>{n.bi_valid>O0-t?(n.bi_buf|=e<<n.bi_valid&65535,fc(n,n.bi_buf),n.bi_buf=e>>O0-n.bi_valid,n.bi_valid+=t-O0):(n.bi_buf|=e<<n.bi_valid&65535,n.bi_valid+=t)},qi=(n,e,t)=>{$n(n,t[e*2],t[e*2+1])},Jb=(n,e)=>{let t=0;do t|=n&1,n>>>=1,t<<=1;while(--e>0);return t>>>1},uz=n=>{n.bi_valid===16?(fc(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)},cz=(n,e)=>{const t=e.dyn_tree,i=e.max_code,r=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length;let u,c,h,f,d,g,m=0;for(f=0;f<=ko;f++)n.bl_count[f]=0;for(t[n.heap[n.heap_max]*2+1]=0,u=n.heap_max+1;u<Vb;u++)c=n.heap[u],f=t[t[c*2+1]*2+1]+1,f>l&&(f=l,m++),t[c*2+1]=f,!(c>i)&&(n.bl_count[f]++,d=0,c>=a&&(d=o[c-a]),g=t[c*2],n.opt_len+=g*(f+d),s&&(n.static_len+=g*(r[c*2+1]+d)));if(m!==0){do{for(f=l-1;n.bl_count[f]===0;)f--;n.bl_count[f]--,n.bl_count[f+1]+=2,n.bl_count[l]--,m-=2}while(m>0);for(f=l;f!==0;f--)for(c=n.bl_count[f];c!==0;)h=n.heap[--u],!(h>i)&&(t[h*2+1]!==f&&(n.opt_len+=(f-t[h*2+1])*t[h*2],t[h*2+1]=f),c--)}},Qb=(n,e,t)=>{const i=new Array(ko+1);let r=0,s,o;for(s=1;s<=ko;s++)i[s]=r=r+t[s-1]<<1;for(o=0;o<=e;o++){let a=n[o*2+1];a!==0&&(n[o*2]=Jb(i[a]++,a))}},hz=()=>{let n,e,t,i,r;const s=new Array(ko+1);for(t=0,i=0;i<M0-1;i++)for(N0[i]=t,n=0;n<1<<D0[i];n++)hc[t++]=i;for(hc[t-1]=i,r=0,i=0;i<16;i++)for(gd[i]=r,n=0;n<1<<dd[i];n++)cc[r++]=i;for(r>>=7;i<al;i++)for(gd[i]=r<<7,n=0;n<1<<dd[i]-7;n++)cc[256+r++]=i;for(e=0;e<=ko;e++)s[e]=0;for(n=0;n<=143;)br[n*2+1]=8,n++,s[8]++;for(;n<=255;)br[n*2+1]=9,n++,s[9]++;for(;n<=279;)br[n*2+1]=7,n++,s[7]++;for(;n<=287;)br[n*2+1]=8,n++,s[8]++;for(Qb(br,lc+1,s),n=0;n<al;n++)uc[n*2+1]=5,uc[n*2]=Jb(n,5);Wb=new k0(br,D0,ac+1,lc,ko),Hb=new k0(uc,dd,0,al,ko),Kb=new k0(new Array(0),az,0,F0,oz)},eR=n=>{let e;for(e=0;e<lc;e++)n.dyn_ltree[e*2]=0;for(e=0;e<al;e++)n.dyn_dtree[e*2]=0;for(e=0;e<F0;e++)n.bl_tree[e*2]=0;n.dyn_ltree[$0*2]=1,n.opt_len=n.static_len=0,n.last_lit=n.matches=0},tR=n=>{n.bi_valid>8?fc(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0},fz=(n,e,t,i)=>{tR(n),i&&(fc(n,t),fc(n,~t)),n.pending_buf.set(n.window.subarray(e,e+t),n.pending),n.pending+=t},nR=(n,e,t,i)=>{const r=e*2,s=t*2;return n[r]<n[s]||n[r]===n[s]&&i[e]<=i[t]},U0=(n,e,t)=>{const i=n.heap[t];let r=t<<1;for(;r<=n.heap_len&&(r<n.heap_len&&nR(e,n.heap[r+1],n.heap[r],n.depth)&&r++,!nR(e,i,n.heap[r],n.depth));)n.heap[t]=n.heap[r],t=r,r<<=1;n.heap[t]=i},iR=(n,e,t)=>{let i,r,s=0,o,a;if(n.last_lit!==0)do i=n.pending_buf[n.d_buf+s*2]<<8|n.pending_buf[n.d_buf+s*2+1],r=n.pending_buf[n.l_buf+s],s++,i===0?qi(n,r,e):(o=hc[r],qi(n,o+ac+1,e),a=D0[o],a!==0&&(r-=N0[o],$n(n,r,a)),i--,o=qb(i),qi(n,o,t),a=dd[o],a!==0&&(i-=gd[o],$n(n,i,a)));while(s<n.last_lit);qi(n,$0,e)},B0=(n,e)=>{const t=e.dyn_tree,i=e.stat_desc.static_tree,r=e.stat_desc.has_stree,s=e.stat_desc.elems;let o,a,l=-1,u;for(n.heap_len=0,n.heap_max=Vb,o=0;o<s;o++)t[o*2]!==0?(n.heap[++n.heap_len]=l=o,n.depth[o]=0):t[o*2+1]=0;for(;n.heap_len<2;)u=n.heap[++n.heap_len]=l<2?++l:0,t[u*2]=1,n.depth[u]=0,n.opt_len--,r&&(n.static_len-=i[u*2+1]);for(e.max_code=l,o=n.heap_len>>1;o>=1;o--)U0(n,t,o);u=s;do o=n.heap[1],n.heap[1]=n.heap[n.heap_len--],U0(n,t,1),a=n.heap[1],n.heap[--n.heap_max]=o,n.heap[--n.heap_max]=a,t[u*2]=t[o*2]+t[a*2],n.depth[u]=(n.depth[o]>=n.depth[a]?n.depth[o]:n.depth[a])+1,t[o*2+1]=t[a*2+1]=u,n.heap[1]=u++,U0(n,t,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],cz(n,e),Qb(t,l,n.bl_count)},rR=(n,e,t)=>{let i,r=-1,s,o=e[0*2+1],a=0,l=7,u=4;for(o===0&&(l=138,u=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)s=o,o=e[(i+1)*2+1],!(++a<l&&s===o)&&(a<u?n.bl_tree[s*2]+=a:s!==0?(s!==r&&n.bl_tree[s*2]++,n.bl_tree[jb*2]++):a<=10?n.bl_tree[Xb*2]++:n.bl_tree[Yb*2]++,a=0,r=s,o===0?(l=138,u=3):s===o?(l=6,u=3):(l=7,u=4))},sR=(n,e,t)=>{let i,r=-1,s,o=e[0*2+1],a=0,l=7,u=4;for(o===0&&(l=138,u=3),i=0;i<=t;i++)if(s=o,o=e[(i+1)*2+1],!(++a<l&&s===o)){if(a<u)do qi(n,s,n.bl_tree);while(--a!==0);else s!==0?(s!==r&&(qi(n,s,n.bl_tree),a--),qi(n,jb,n.bl_tree),$n(n,a-3,2)):a<=10?(qi(n,Xb,n.bl_tree),$n(n,a-3,3)):(qi(n,Yb,n.bl_tree),$n(n,a-11,7));a=0,r=s,o===0?(l=138,u=3):s===o?(l=6,u=3):(l=7,u=4)}},dz=n=>{let e;for(rR(n,n.dyn_ltree,n.l_desc.max_code),rR(n,n.dyn_dtree,n.d_desc.max_code),B0(n,n.bl_desc),e=F0-1;e>=3&&n.bl_tree[Zb[e]*2+1]===0;e--);return n.opt_len+=3*(e+1)+5+5+4,e},gz=(n,e,t,i)=>{let r;for($n(n,e-257,5),$n(n,t-1,5),$n(n,i-4,4),r=0;r<i;r++)$n(n,n.bl_tree[Zb[r]*2+1],3);sR(n,n.dyn_ltree,e-1),sR(n,n.dyn_dtree,t-1)},pz=n=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&n.dyn_ltree[t*2]!==0)return Ub;if(n.dyn_ltree[9*2]!==0||n.dyn_ltree[10*2]!==0||n.dyn_ltree[13*2]!==0)return Bb;for(t=32;t<ac;t++)if(n.dyn_ltree[t*2]!==0)return Bb;return Ub};let oR=!1;const mz=n=>{oR||(hz(),oR=!0),n.l_desc=new G0(n.dyn_ltree,Wb),n.d_desc=new G0(n.dyn_dtree,Hb),n.bl_desc=new G0(n.bl_tree,Kb),n.bi_buf=0,n.bi_valid=0,eR(n)},aR=(n,e,t,i)=>{$n(n,(nz<<1)+(i?1:0),3),fz(n,e,t,!0)},_z=n=>{$n(n,zb<<1,3),qi(n,$0,br),uz(n)},yz=(n,e,t,i)=>{let r,s,o=0;n.level>0?(n.strm.data_type===tz&&(n.strm.data_type=pz(n)),B0(n,n.l_desc),B0(n,n.d_desc),o=dz(n),r=n.opt_len+3+7>>>3,s=n.static_len+3+7>>>3,s<=r&&(r=s)):r=s=t+5,t+4<=r&&e!==-1?aR(n,e,t,i):n.strategy===ez||s===r?($n(n,(zb<<1)+(i?1:0),3),iR(n,br,uc)):($n(n,(iz<<1)+(i?1:0),3),gz(n,n.l_desc.max_code+1,n.d_desc.max_code+1,o+1),iR(n,n.dyn_ltree,n.dyn_dtree)),eR(n),i&&tR(n)},vz=(n,e,t)=>(n.pending_buf[n.d_buf+n.last_lit*2]=e>>>8&255,n.pending_buf[n.d_buf+n.last_lit*2+1]=e&255,n.pending_buf[n.l_buf+n.last_lit]=t&255,n.last_lit++,e===0?n.dyn_ltree[t*2]++:(n.matches++,e--,n.dyn_ltree[(hc[t]+ac+1)*2]++,n.dyn_dtree[qb(e)*2]++),n.last_lit===n.lit_bufsize-1);var xz=mz,Ez=aR,wz=yz,Tz=vz,Sz=_z,bz={_tr_init:xz,_tr_stored_block:Ez,_tr_flush_block:wz,_tr_tally:Tz,_tr_align:Sz};const Rz=(n,e,t,i)=>{let r=n&65535|0,s=n>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do r=r+e[i++]|0,s=s+r|0;while(--o);r%=65521,s%=65521}return r|s<<16|0};var dc=Rz;const Cz=()=>{let n,e=[];for(var t=0;t<256;t++){n=t;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e},Iz=new Uint32Array(Cz()),Az=(n,e,t,i)=>{const r=Iz,s=i+t;n^=-1;for(let o=i;o<s;o++)n=n>>>8^r[(n^e[o])&255];return n^-1};var Yt=Az,ll={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},gc={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Lz,_tr_stored_block:Pz,_tr_flush_block:Mz,_tr_tally:Cs,_tr_align:Fz}=bz,{Z_NO_FLUSH:Go,Z_PARTIAL_FLUSH:Oz,Z_FULL_FLUSH:$z,Z_FINISH:Is,Z_BLOCK:lR,Z_OK:Ji,Z_STREAM_END:uR,Z_STREAM_ERROR:ni,Z_DATA_ERROR:Dz,Z_BUF_ERROR:z0,Z_DEFAULT_COMPRESSION:Nz,Z_FILTERED:kz,Z_HUFFMAN_ONLY:pd,Z_RLE:Gz,Z_FIXED:Uz,Z_DEFAULT_STRATEGY:Bz,Z_UNKNOWN:zz,Z_DEFLATED:md}=gc,Vz=9,jz=15,Xz=8,Yz=29,Zz=256,V0=Zz+1+Yz,Wz=30,Hz=19,Kz=2*V0+1,qz=15,Fe=3,As=258,Si=As+Fe+1,Jz=32,_d=42,j0=69,yd=73,vd=91,xd=103,Uo=113,pc=666,Ut=1,mc=2,Bo=3,ul=4,Qz=3,Ls=(n,e)=>(n.msg=ll[e],e),cR=n=>(n<<1)-(n>4?9:0),Ps=n=>{let e=n.length;for(;--e>=0;)n[e]=0};let e4=(n,e,t)=>(e<<n.hash_shift^t)&n.hash_mask,Ms=e4;const Fs=n=>{const e=n.state;let t=e.pending;t>n.avail_out&&(t=n.avail_out),t!==0&&(n.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),n.next_out),n.next_out+=t,e.pending_out+=t,n.total_out+=t,n.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Jt=(n,e)=>{Mz(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,e),n.block_start=n.strstart,Fs(n.strm)},ze=(n,e)=>{n.pending_buf[n.pending++]=e},_c=(n,e)=>{n.pending_buf[n.pending++]=e>>>8&255,n.pending_buf[n.pending++]=e&255},t4=(n,e,t,i)=>{let r=n.avail_in;return r>i&&(r=i),r===0?0:(n.avail_in-=r,e.set(n.input.subarray(n.next_in,n.next_in+r),t),n.state.wrap===1?n.adler=dc(n.adler,e,r,t):n.state.wrap===2&&(n.adler=Yt(n.adler,e,r,t)),n.next_in+=r,n.total_in+=r,r)},hR=(n,e)=>{let t=n.max_chain_length,i=n.strstart,r,s,o=n.prev_length,a=n.nice_match;const l=n.strstart>n.w_size-Si?n.strstart-(n.w_size-Si):0,u=n.window,c=n.w_mask,h=n.prev,f=n.strstart+As;let d=u[i+o-1],g=u[i+o];n.prev_length>=n.good_match&&(t>>=2),a>n.lookahead&&(a=n.lookahead);do if(r=e,!(u[r+o]!==g||u[r+o-1]!==d||u[r]!==u[i]||u[++r]!==u[i+1])){i+=2,r++;do;while(u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&u[++i]===u[++r]&&i<f);if(s=As-(f-i),i=f-As,s>o){if(n.match_start=e,o=s,s>=a)break;d=u[i+o-1],g=u[i+o]}}while((e=h[e&c])>l&&--t!==0);return o<=n.lookahead?o:n.lookahead},zo=n=>{const e=n.w_size;let t,i,r,s,o;do{if(s=n.window_size-n.lookahead-n.strstart,n.strstart>=e+(e-Si)){n.window.set(n.window.subarray(e,e+e),0),n.match_start-=e,n.strstart-=e,n.block_start-=e,i=n.hash_size,t=i;do r=n.head[--t],n.head[t]=r>=e?r-e:0;while(--i);i=e,t=i;do r=n.prev[--t],n.prev[t]=r>=e?r-e:0;while(--i);s+=e}if(n.strm.avail_in===0)break;if(i=t4(n.strm,n.window,n.strstart+n.lookahead,s),n.lookahead+=i,n.lookahead+n.insert>=Fe)for(o=n.strstart-n.insert,n.ins_h=n.window[o],n.ins_h=Ms(n,n.ins_h,n.window[o+1]);n.insert&&(n.ins_h=Ms(n,n.ins_h,n.window[o+Fe-1]),n.prev[o&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=o,o++,n.insert--,!(n.lookahead+n.insert<Fe)););}while(n.lookahead<Si&&n.strm.avail_in!==0)},n4=(n,e)=>{let t=65535;for(t>n.pending_buf_size-5&&(t=n.pending_buf_size-5);;){if(n.lookahead<=1){if(zo(n),n.lookahead===0&&e===Go)return Ut;if(n.lookahead===0)break}n.strstart+=n.lookahead,n.lookahead=0;const i=n.block_start+t;if((n.strstart===0||n.strstart>=i)&&(n.lookahead=n.strstart-i,n.strstart=i,Jt(n,!1),n.strm.avail_out===0)||n.strstart-n.block_start>=n.w_size-Si&&(Jt(n,!1),n.strm.avail_out===0))return Ut}return n.insert=0,e===Is?(Jt(n,!0),n.strm.avail_out===0?Bo:ul):(n.strstart>n.block_start&&(Jt(n,!1),n.strm.avail_out===0),Ut)},X0=(n,e)=>{let t,i;for(;;){if(n.lookahead<Si){if(zo(n),n.lookahead<Si&&e===Go)return Ut;if(n.lookahead===0)break}if(t=0,n.lookahead>=Fe&&(n.ins_h=Ms(n,n.ins_h,n.window[n.strstart+Fe-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),t!==0&&n.strstart-t<=n.w_size-Si&&(n.match_length=hR(n,t)),n.match_length>=Fe)if(i=Cs(n,n.strstart-n.match_start,n.match_length-Fe),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=Fe){n.match_length--;do n.strstart++,n.ins_h=Ms(n,n.ins_h,n.window[n.strstart+Fe-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart;while(--n.match_length!==0);n.strstart++}else n.strstart+=n.match_length,n.match_length=0,n.ins_h=n.window[n.strstart],n.ins_h=Ms(n,n.ins_h,n.window[n.strstart+1]);else i=Cs(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++;if(i&&(Jt(n,!1),n.strm.avail_out===0))return Ut}return n.insert=n.strstart<Fe-1?n.strstart:Fe-1,e===Is?(Jt(n,!0),n.strm.avail_out===0?Bo:ul):n.last_lit&&(Jt(n,!1),n.strm.avail_out===0)?Ut:mc},cl=(n,e)=>{let t,i,r;for(;;){if(n.lookahead<Si){if(zo(n),n.lookahead<Si&&e===Go)return Ut;if(n.lookahead===0)break}if(t=0,n.lookahead>=Fe&&(n.ins_h=Ms(n,n.ins_h,n.window[n.strstart+Fe-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart),n.prev_length=n.match_length,n.prev_match=n.match_start,n.match_length=Fe-1,t!==0&&n.prev_length<n.max_lazy_match&&n.strstart-t<=n.w_size-Si&&(n.match_length=hR(n,t),n.match_length<=5&&(n.strategy===kz||n.match_length===Fe&&n.strstart-n.match_start>4096)&&(n.match_length=Fe-1)),n.prev_length>=Fe&&n.match_length<=n.prev_length){r=n.strstart+n.lookahead-Fe,i=Cs(n,n.strstart-1-n.prev_match,n.prev_length-Fe),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=r&&(n.ins_h=Ms(n,n.ins_h,n.window[n.strstart+Fe-1]),t=n.prev[n.strstart&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=n.strstart);while(--n.prev_length!==0);if(n.match_available=0,n.match_length=Fe-1,n.strstart++,i&&(Jt(n,!1),n.strm.avail_out===0))return Ut}else if(n.match_available){if(i=Cs(n,0,n.window[n.strstart-1]),i&&Jt(n,!1),n.strstart++,n.lookahead--,n.strm.avail_out===0)return Ut}else n.match_available=1,n.strstart++,n.lookahead--}return n.match_available&&(i=Cs(n,0,n.window[n.strstart-1]),n.match_available=0),n.insert=n.strstart<Fe-1?n.strstart:Fe-1,e===Is?(Jt(n,!0),n.strm.avail_out===0?Bo:ul):n.last_lit&&(Jt(n,!1),n.strm.avail_out===0)?Ut:mc},i4=(n,e)=>{let t,i,r,s;const o=n.window;for(;;){if(n.lookahead<=As){if(zo(n),n.lookahead<=As&&e===Go)return Ut;if(n.lookahead===0)break}if(n.match_length=0,n.lookahead>=Fe&&n.strstart>0&&(r=n.strstart-1,i=o[r],i===o[++r]&&i===o[++r]&&i===o[++r])){s=n.strstart+As;do;while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<s);n.match_length=As-(s-r),n.match_length>n.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=Fe?(t=Cs(n,1,n.match_length-Fe),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(t=Cs(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),t&&(Jt(n,!1),n.strm.avail_out===0))return Ut}return n.insert=0,e===Is?(Jt(n,!0),n.strm.avail_out===0?Bo:ul):n.last_lit&&(Jt(n,!1),n.strm.avail_out===0)?Ut:mc},r4=(n,e)=>{let t;for(;;){if(n.lookahead===0&&(zo(n),n.lookahead===0)){if(e===Go)return Ut;break}if(n.match_length=0,t=Cs(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,t&&(Jt(n,!1),n.strm.avail_out===0))return Ut}return n.insert=0,e===Is?(Jt(n,!0),n.strm.avail_out===0?Bo:ul):n.last_lit&&(Jt(n,!1),n.strm.avail_out===0)?Ut:mc};function Qi(n,e,t,i,r){this.good_length=n,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=r}const yc=[new Qi(0,0,0,0,n4),new Qi(4,4,8,4,X0),new Qi(4,5,16,8,X0),new Qi(4,6,32,32,X0),new Qi(4,4,16,16,cl),new Qi(8,16,32,32,cl),new Qi(8,16,128,128,cl),new Qi(8,32,128,256,cl),new Qi(32,128,258,1024,cl),new Qi(32,258,258,4096,cl)],s4=n=>{n.window_size=2*n.w_size,Ps(n.head),n.max_lazy_match=yc[n.level].max_lazy,n.good_match=yc[n.level].good_length,n.nice_match=yc[n.level].nice_length,n.max_chain_length=yc[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=Fe-1,n.match_available=0,n.ins_h=0};function o4(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=md,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Kz*2),this.dyn_dtree=new Uint16Array((2*Wz+1)*2),this.bl_tree=new Uint16Array((2*Hz+1)*2),Ps(this.dyn_ltree),Ps(this.dyn_dtree),Ps(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(qz+1),this.heap=new Uint16Array(2*V0+1),Ps(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*V0+1),Ps(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const fR=n=>{if(!n||!n.state)return Ls(n,ni);n.total_in=n.total_out=0,n.data_type=zz;const e=n.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?_d:Uo,n.adler=e.wrap===2?0:1,e.last_flush=Go,Lz(e),Ji},dR=n=>{const e=fR(n);return e===Ji&&s4(n.state),e},a4=(n,e)=>!n||!n.state||n.state.wrap!==2?ni:(n.state.gzhead=e,Ji),gR=(n,e,t,i,r,s)=>{if(!n)return ni;let o=1;if(e===Nz&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),r<1||r>Vz||t!==md||i<8||i>15||e<0||e>9||s<0||s>Uz)return Ls(n,ni);i===8&&(i=9);const a=new o4;return n.state=a,a.strm=n,a.wrap=o,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=r+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+Fe-1)/Fe),a.window=new Uint8Array(a.w_size*2),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<r+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new Uint8Array(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=(1+2)*a.lit_bufsize,a.level=e,a.strategy=s,a.method=t,dR(n)},l4=(n,e)=>gR(n,e,md,jz,Xz,Bz),u4=(n,e)=>{let t,i;if(!n||!n.state||e>lR||e<0)return n?Ls(n,ni):ni;const r=n.state;if(!n.output||!n.input&&n.avail_in!==0||r.status===pc&&e!==Is)return Ls(n,n.avail_out===0?z0:ni);r.strm=n;const s=r.last_flush;if(r.last_flush=e,r.status===_d)if(r.wrap===2)n.adler=0,ze(r,31),ze(r,139),ze(r,8),r.gzhead?(ze(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ze(r,r.gzhead.time&255),ze(r,r.gzhead.time>>8&255),ze(r,r.gzhead.time>>16&255),ze(r,r.gzhead.time>>24&255),ze(r,r.level===9?2:r.strategy>=pd||r.level<2?4:0),ze(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ze(r,r.gzhead.extra.length&255),ze(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(n.adler=Yt(n.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=j0):(ze(r,0),ze(r,0),ze(r,0),ze(r,0),ze(r,0),ze(r,r.level===9?2:r.strategy>=pd||r.level<2?4:0),ze(r,Qz),r.status=Uo);else{let o=md+(r.w_bits-8<<4)<<8,a=-1;r.strategy>=pd||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,o|=a<<6,r.strstart!==0&&(o|=Jz),o+=31-o%31,r.status=Uo,_c(r,o),r.strstart!==0&&(_c(r,n.adler>>>16),_c(r,n.adler&65535)),n.adler=1}if(r.status===j0)if(r.gzhead.extra){for(t=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>t&&(n.adler=Yt(n.adler,r.pending_buf,r.pending-t,t)),Fs(n),t=r.pending,r.pending===r.pending_buf_size));)ze(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>t&&(n.adler=Yt(n.adler,r.pending_buf,r.pending-t,t)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=yd)}else r.status=yd;if(r.status===yd)if(r.gzhead.name){t=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>t&&(n.adler=Yt(n.adler,r.pending_buf,r.pending-t,t)),Fs(n),t=r.pending,r.pending===r.pending_buf_size)){i=1;break}r.gzindex<r.gzhead.name.length?i=r.gzhead.name.charCodeAt(r.gzindex++)&255:i=0,ze(r,i)}while(i!==0);r.gzhead.hcrc&&r.pending>t&&(n.adler=Yt(n.adler,r.pending_buf,r.pending-t,t)),i===0&&(r.gzindex=0,r.status=vd)}else r.status=vd;if(r.status===vd)if(r.gzhead.comment){t=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>t&&(n.adler=Yt(n.adler,r.pending_buf,r.pending-t,t)),Fs(n),t=r.pending,r.pending===r.pending_buf_size)){i=1;break}r.gzindex<r.gzhead.comment.length?i=r.gzhead.comment.charCodeAt(r.gzindex++)&255:i=0,ze(r,i)}while(i!==0);r.gzhead.hcrc&&r.pending>t&&(n.adler=Yt(n.adler,r.pending_buf,r.pending-t,t)),i===0&&(r.status=xd)}else r.status=xd;if(r.status===xd&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Fs(n),r.pending+2<=r.pending_buf_size&&(ze(r,n.adler&255),ze(r,n.adler>>8&255),n.adler=0,r.status=Uo)):r.status=Uo),r.pending!==0){if(Fs(n),n.avail_out===0)return r.last_flush=-1,Ji}else if(n.avail_in===0&&cR(e)<=cR(s)&&e!==Is)return Ls(n,z0);if(r.status===pc&&n.avail_in!==0)return Ls(n,z0);if(n.avail_in!==0||r.lookahead!==0||e!==Go&&r.status!==pc){let o=r.strategy===pd?r4(r,e):r.strategy===Gz?i4(r,e):yc[r.level].func(r,e);if((o===Bo||o===ul)&&(r.status=pc),o===Ut||o===Bo)return n.avail_out===0&&(r.last_flush=-1),Ji;if(o===mc&&(e===Oz?Fz(r):e!==lR&&(Pz(r,0,0,!1),e===$z&&(Ps(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Fs(n),n.avail_out===0))return r.last_flush=-1,Ji}return e!==Is?Ji:r.wrap<=0?uR:(r.wrap===2?(ze(r,n.adler&255),ze(r,n.adler>>8&255),ze(r,n.adler>>16&255),ze(r,n.adler>>24&255),ze(r,n.total_in&255),ze(r,n.total_in>>8&255),ze(r,n.total_in>>16&255),ze(r,n.total_in>>24&255)):(_c(r,n.adler>>>16),_c(r,n.adler&65535)),Fs(n),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Ji:uR)},c4=n=>{if(!n||!n.state)return ni;const e=n.state.status;return e!==_d&&e!==j0&&e!==yd&&e!==vd&&e!==xd&&e!==Uo&&e!==pc?Ls(n,ni):(n.state=null,e===Uo?Ls(n,Dz):Ji)},h4=(n,e)=>{let t=e.length;if(!n||!n.state)return ni;const i=n.state,r=i.wrap;if(r===2||r===1&&i.status!==_d||i.lookahead)return ni;if(r===1&&(n.adler=dc(n.adler,e,t,0)),i.wrap=0,t>=i.w_size){r===0&&(Ps(i.head),i.strstart=0,i.block_start=0,i.insert=0);let l=new Uint8Array(i.w_size);l.set(e.subarray(t-i.w_size,t),0),e=l,t=i.w_size}const s=n.avail_in,o=n.next_in,a=n.input;for(n.avail_in=t,n.next_in=0,n.input=e,zo(i);i.lookahead>=Fe;){let l=i.strstart,u=i.lookahead-(Fe-1);do i.ins_h=Ms(i,i.ins_h,i.window[l+Fe-1]),i.prev[l&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=l,l++;while(--u);i.strstart=l,i.lookahead=Fe-1,zo(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=Fe-1,i.match_available=0,n.next_in=o,n.input=a,n.avail_in=s,i.wrap=r,Ji};var f4=l4,d4=gR,g4=dR,p4=fR,m4=a4,_4=u4,y4=c4,v4=h4,x4="pako deflate (from Nodeca project)",vc={deflateInit:f4,deflateInit2:d4,deflateReset:g4,deflateResetKeep:p4,deflateSetHeader:m4,deflate:_4,deflateEnd:y4,deflateSetDictionary:v4,deflateInfo:x4};const E4=(n,e)=>Object.prototype.hasOwnProperty.call(n,e);var w4=function(n){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(const i in t)E4(t,i)&&(n[i]=t[i])}}return n},T4=n=>{let e=0;for(let i=0,r=n.length;i<r;i++)e+=n[i].length;const t=new Uint8Array(e);for(let i=0,r=0,s=n.length;i<s;i++){let o=n[i];t.set(o,r),r+=o.length}return t},Ed={assign:w4,flattenChunks:T4};let pR=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{pR=!1}const xc=new Uint8Array(256);for(let n=0;n<256;n++)xc[n]=n>=252?6:n>=248?5:n>=240?4:n>=224?3:n>=192?2:1;xc[254]=xc[254]=1;var S4=n=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(n);let e,t,i,r,s,o=n.length,a=0;for(r=0;r<o;r++)t=n.charCodeAt(r),(t&64512)===55296&&r+1<o&&(i=n.charCodeAt(r+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),r++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(a),s=0,r=0;s<a;r++)t=n.charCodeAt(r),(t&64512)===55296&&r+1<o&&(i=n.charCodeAt(r+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),r++)),t<128?e[s++]=t:t<2048?(e[s++]=192|t>>>6,e[s++]=128|t&63):t<65536?(e[s++]=224|t>>>12,e[s++]=128|t>>>6&63,e[s++]=128|t&63):(e[s++]=240|t>>>18,e[s++]=128|t>>>12&63,e[s++]=128|t>>>6&63,e[s++]=128|t&63);return e};const b4=(n,e)=>{if(e<65534&&n.subarray&&pR)return String.fromCharCode.apply(null,n.length===e?n:n.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(n[i]);return t};var R4=(n,e)=>{const t=e||n.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(n.subarray(0,e));let i,r;const s=new Array(t*2);for(r=0,i=0;i<t;){let o=n[i++];if(o<128){s[r++]=o;continue}let a=xc[o];if(a>4){s[r++]=65533,i+=a-1;continue}for(o&=a===2?31:a===3?15:7;a>1&&i<t;)o=o<<6|n[i++]&63,a--;if(a>1){s[r++]=65533;continue}o<65536?s[r++]=o:(o-=65536,s[r++]=55296|o>>10&1023,s[r++]=56320|o&1023)}return b4(s,r)},C4=(n,e)=>{e=e||n.length,e>n.length&&(e=n.length);let t=e-1;for(;t>=0&&(n[t]&192)===128;)t--;return t<0||t===0?e:t+xc[n[t]]>e?t:e},Ec={string2buf:S4,buf2string:R4,utf8border:C4};function I4(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var mR=I4;const _R=Object.prototype.toString,{Z_NO_FLUSH:A4,Z_SYNC_FLUSH:L4,Z_FULL_FLUSH:P4,Z_FINISH:M4,Z_OK:wd,Z_STREAM_END:F4,Z_DEFAULT_COMPRESSION:O4,Z_DEFAULT_STRATEGY:$4,Z_DEFLATED:D4}=gc;function Y0(n){this.options=Ed.assign({level:O4,method:D4,chunkSize:16384,windowBits:15,memLevel:8,strategy:$4},n||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mR,this.strm.avail_out=0;let t=vc.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==wd)throw new Error(ll[t]);if(e.header&&vc.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=Ec.string2buf(e.dictionary):_R.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=vc.deflateSetDictionary(this.strm,i),t!==wd)throw new Error(ll[t]);this._dict_set=!0}}Y0.prototype.push=function(n,e){const t=this.strm,i=this.options.chunkSize;let r,s;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?M4:A4,typeof n=="string"?t.input=Ec.string2buf(n):_R.call(n)==="[object ArrayBuffer]"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(s===L4||s===P4)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(r=vc.deflate(t,s),r===F4)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),r=vc.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===wd;if(t.avail_out===0){this.onData(t.output);continue}if(s>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0},Y0.prototype.onData=function(n){this.chunks.push(n)},Y0.prototype.onEnd=function(n){n===wd&&(this.result=Ed.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};const Td=30,N4=12;var k4=function(e,t){let i,r,s,o,a,l,u,c,h,f,d,g,m,p,_,v,x,y,T,w,E,S,b,R;const C=e.state;i=e.next_in,b=e.input,r=i+(e.avail_in-5),s=e.next_out,R=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),l=C.dmax,u=C.wsize,c=C.whave,h=C.wnext,f=C.window,d=C.hold,g=C.bits,m=C.lencode,p=C.distcode,_=(1<<C.lenbits)-1,v=(1<<C.distbits)-1;e:do{g<15&&(d+=b[i++]<<g,g+=8,d+=b[i++]<<g,g+=8),x=m[d&_];t:for(;;){if(y=x>>>24,d>>>=y,g-=y,y=x>>>16&255,y===0)R[s++]=x&65535;else if(y&16){T=x&65535,y&=15,y&&(g<y&&(d+=b[i++]<<g,g+=8),T+=d&(1<<y)-1,d>>>=y,g-=y),g<15&&(d+=b[i++]<<g,g+=8,d+=b[i++]<<g,g+=8),x=p[d&v];n:for(;;){if(y=x>>>24,d>>>=y,g-=y,y=x>>>16&255,y&16){if(w=x&65535,y&=15,g<y&&(d+=b[i++]<<g,g+=8,g<y&&(d+=b[i++]<<g,g+=8)),w+=d&(1<<y)-1,w>l){e.msg="invalid distance too far back",C.mode=Td;break e}if(d>>>=y,g-=y,y=s-o,w>y){if(y=w-y,y>c&&C.sane){e.msg="invalid distance too far back",C.mode=Td;break e}if(E=0,S=f,h===0){if(E+=u-y,y<T){T-=y;do R[s++]=f[E++];while(--y);E=s-w,S=R}}else if(h<y){if(E+=u+h-y,y-=h,y<T){T-=y;do R[s++]=f[E++];while(--y);if(E=0,h<T){y=h,T-=y;do R[s++]=f[E++];while(--y);E=s-w,S=R}}}else if(E+=h-y,y<T){T-=y;do R[s++]=f[E++];while(--y);E=s-w,S=R}for(;T>2;)R[s++]=S[E++],R[s++]=S[E++],R[s++]=S[E++],T-=3;T&&(R[s++]=S[E++],T>1&&(R[s++]=S[E++]))}else{E=s-w;do R[s++]=R[E++],R[s++]=R[E++],R[s++]=R[E++],T-=3;while(T>2);T&&(R[s++]=R[E++],T>1&&(R[s++]=R[E++]))}}else if((y&64)===0){x=p[(x&65535)+(d&(1<<y)-1)];continue n}else{e.msg="invalid distance code",C.mode=Td;break e}break}}else if((y&64)===0){x=m[(x&65535)+(d&(1<<y)-1)];continue t}else if(y&32){C.mode=N4;break e}else{e.msg="invalid literal/length code",C.mode=Td;break e}break}}while(i<r&&s<a);T=g>>3,i-=T,g-=T<<3,d&=(1<<g)-1,e.next_in=i,e.next_out=s,e.avail_in=i<r?5+(r-i):5-(i-r),e.avail_out=s<a?257+(a-s):257-(s-a),C.hold=d,C.bits=g};const hl=15,yR=852,vR=592,xR=0,Z0=1,ER=2,G4=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),U4=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),B4=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),z4=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),V4=(n,e,t,i,r,s,o,a)=>{const l=a.bits;let u=0,c=0,h=0,f=0,d=0,g=0,m=0,p=0,_=0,v=0,x,y,T,w,E,S=null,b=0,R;const C=new Uint16Array(hl+1),M=new Uint16Array(hl+1);let P=null,U=0,O,L,$;for(u=0;u<=hl;u++)C[u]=0;for(c=0;c<i;c++)C[e[t+c]]++;for(d=l,f=hl;f>=1&&C[f]===0;f--);if(d>f&&(d=f),f===0)return r[s++]=1<<24|64<<16|0,r[s++]=1<<24|64<<16|0,a.bits=1,0;for(h=1;h<f&&C[h]===0;h++);for(d<h&&(d=h),p=1,u=1;u<=hl;u++)if(p<<=1,p-=C[u],p<0)return-1;if(p>0&&(n===xR||f!==1))return-1;for(M[1]=0,u=1;u<hl;u++)M[u+1]=M[u]+C[u];for(c=0;c<i;c++)e[t+c]!==0&&(o[M[e[t+c]]++]=c);if(n===xR?(S=P=o,R=19):n===Z0?(S=G4,b-=257,P=U4,U-=257,R=256):(S=B4,P=z4,R=-1),v=0,c=0,u=h,E=s,g=d,m=0,T=-1,_=1<<d,w=_-1,n===Z0&&_>yR||n===ER&&_>vR)return 1;for(;;){O=u-m,o[c]<R?(L=0,$=o[c]):o[c]>R?(L=P[U+o[c]],$=S[b+o[c]]):(L=32+64,$=0),x=1<<u-m,y=1<<g,h=y;do y-=x,r[E+(v>>m)+y]=O<<24|L<<16|$|0;while(y!==0);for(x=1<<u-1;v&x;)x>>=1;if(x!==0?(v&=x-1,v+=x):v=0,c++,--C[u]===0){if(u===f)break;u=e[t+o[c]]}if(u>d&&(v&w)!==T){for(m===0&&(m=d),E+=h,g=u-m,p=1<<g;g+m<f&&(p-=C[g+m],!(p<=0));)g++,p<<=1;if(_+=1<<g,n===Z0&&_>yR||n===ER&&_>vR)return 1;T=v&w,r[T]=d<<24|g<<16|E-s|0}}return v!==0&&(r[E+v]=u-m<<24|64<<16|0),a.bits=d,0};var wc=V4;const j4=0,wR=1,TR=2,{Z_FINISH:SR,Z_BLOCK:X4,Z_TREES:Sd,Z_OK:Vo,Z_STREAM_END:Y4,Z_NEED_DICT:Z4,Z_STREAM_ERROR:ii,Z_DATA_ERROR:bR,Z_MEM_ERROR:RR,Z_BUF_ERROR:W4,Z_DEFLATED:CR}=gc,IR=1,AR=2,LR=3,PR=4,MR=5,FR=6,OR=7,$R=8,DR=9,NR=10,bd=11,Rr=12,W0=13,kR=14,H0=15,GR=16,UR=17,BR=18,zR=19,Rd=20,Cd=21,VR=22,jR=23,XR=24,YR=25,ZR=26,K0=27,WR=28,HR=29,ft=30,KR=31,H4=32,K4=852,q4=592,J4=15,Q4=J4,qR=n=>(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24);function e8(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const JR=n=>{if(!n||!n.state)return ii;const e=n.state;return n.total_in=n.total_out=e.total=0,n.msg="",e.wrap&&(n.adler=e.wrap&1),e.mode=IR,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(K4),e.distcode=e.distdyn=new Int32Array(q4),e.sane=1,e.back=-1,Vo},QR=n=>{if(!n||!n.state)return ii;const e=n.state;return e.wsize=0,e.whave=0,e.wnext=0,JR(n)},eC=(n,e)=>{let t;if(!n||!n.state)return ii;const i=n.state;return e<0?(t=0,e=-e):(t=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?ii:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,QR(n))},tC=(n,e)=>{if(!n)return ii;const t=new e8;n.state=t,t.window=null;const i=eC(n,e);return i!==Vo&&(n.state=null),i},t8=n=>tC(n,Q4);let nC=!0,q0,J0;const n8=n=>{if(nC){q0=new Int32Array(512),J0=new Int32Array(32);let e=0;for(;e<144;)n.lens[e++]=8;for(;e<256;)n.lens[e++]=9;for(;e<280;)n.lens[e++]=7;for(;e<288;)n.lens[e++]=8;for(wc(wR,n.lens,0,288,q0,0,n.work,{bits:9}),e=0;e<32;)n.lens[e++]=5;wc(TR,n.lens,0,32,J0,0,n.work,{bits:5}),nC=!1}n.lencode=q0,n.lenbits=9,n.distcode=J0,n.distbits=5},iC=(n,e,t,i)=>{let r;const s=n.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(t-s.wsize,t),0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>i&&(r=i),s.window.set(e.subarray(t-i,t-i+r),s.wnext),i-=r,i?(s.window.set(e.subarray(t-i,t),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0},i8=(n,e)=>{let t,i,r,s,o,a,l,u,c,h,f,d,g,m,p=0,_,v,x,y,T,w,E,S;const b=new Uint8Array(4);let R,C;const M=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!n||!n.state||!n.output||!n.input&&n.avail_in!==0)return ii;t=n.state,t.mode===Rr&&(t.mode=W0),o=n.next_out,r=n.output,l=n.avail_out,s=n.next_in,i=n.input,a=n.avail_in,u=t.hold,c=t.bits,h=a,f=l,S=Vo;e:for(;;)switch(t.mode){case IR:if(t.wrap===0){t.mode=W0;break}for(;c<16;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(t.wrap&2&&u===35615){t.check=0,b[0]=u&255,b[1]=u>>>8&255,t.check=Yt(t.check,b,2,0),u=0,c=0,t.mode=AR;break}if(t.flags=0,t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){n.msg="incorrect header check",t.mode=ft;break}if((u&15)!==CR){n.msg="unknown compression method",t.mode=ft;break}if(u>>>=4,c-=4,E=(u&15)+8,t.wbits===0)t.wbits=E;else if(E>t.wbits){n.msg="invalid window size",t.mode=ft;break}t.dmax=1<<t.wbits,n.adler=t.check=1,t.mode=u&512?NR:Rr,u=0,c=0;break;case AR:for(;c<16;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(t.flags=u,(t.flags&255)!==CR){n.msg="unknown compression method",t.mode=ft;break}if(t.flags&57344){n.msg="unknown header flags set",t.mode=ft;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&(b[0]=u&255,b[1]=u>>>8&255,t.check=Yt(t.check,b,2,0)),u=0,c=0,t.mode=LR;case LR:for(;c<32;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}t.head&&(t.head.time=u),t.flags&512&&(b[0]=u&255,b[1]=u>>>8&255,b[2]=u>>>16&255,b[3]=u>>>24&255,t.check=Yt(t.check,b,4,0)),u=0,c=0,t.mode=PR;case PR:for(;c<16;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&(b[0]=u&255,b[1]=u>>>8&255,t.check=Yt(t.check,b,2,0)),u=0,c=0,t.mode=MR;case MR:if(t.flags&1024){for(;c<16;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&(b[0]=u&255,b[1]=u>>>8&255,t.check=Yt(t.check,b,2,0)),u=0,c=0}else t.head&&(t.head.extra=null);t.mode=FR;case FR:if(t.flags&1024&&(d=t.length,d>a&&(d=a),d&&(t.head&&(E=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(s,s+d),E)),t.flags&512&&(t.check=Yt(t.check,i,d,s)),a-=d,s+=d,t.length-=d),t.length))break e;t.length=0,t.mode=OR;case OR:if(t.flags&2048){if(a===0)break e;d=0;do E=i[s+d++],t.head&&E&&t.length<65536&&(t.head.name+=String.fromCharCode(E));while(E&&d<a);if(t.flags&512&&(t.check=Yt(t.check,i,d,s)),a-=d,s+=d,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=$R;case $R:if(t.flags&4096){if(a===0)break e;d=0;do E=i[s+d++],t.head&&E&&t.length<65536&&(t.head.comment+=String.fromCharCode(E));while(E&&d<a);if(t.flags&512&&(t.check=Yt(t.check,i,d,s)),a-=d,s+=d,E)break e}else t.head&&(t.head.comment=null);t.mode=DR;case DR:if(t.flags&512){for(;c<16;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(u!==(t.check&65535)){n.msg="header crc mismatch",t.mode=ft;break}u=0,c=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),n.adler=t.check=0,t.mode=Rr;break;case NR:for(;c<32;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}n.adler=t.check=qR(u),u=0,c=0,t.mode=bd;case bd:if(t.havedict===0)return n.next_out=o,n.avail_out=l,n.next_in=s,n.avail_in=a,t.hold=u,t.bits=c,Z4;n.adler=t.check=1,t.mode=Rr;case Rr:if(e===X4||e===Sd)break e;case W0:if(t.last){u>>>=c&7,c-=c&7,t.mode=K0;break}for(;c<3;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}switch(t.last=u&1,u>>>=1,c-=1,u&3){case 0:t.mode=kR;break;case 1:if(n8(t),t.mode=Rd,e===Sd){u>>>=2,c-=2;break e}break;case 2:t.mode=UR;break;case 3:n.msg="invalid block type",t.mode=ft}u>>>=2,c-=2;break;case kR:for(u>>>=c&7,c-=c&7;c<32;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if((u&65535)!==(u>>>16^65535)){n.msg="invalid stored block lengths",t.mode=ft;break}if(t.length=u&65535,u=0,c=0,t.mode=H0,e===Sd)break e;case H0:t.mode=GR;case GR:if(d=t.length,d){if(d>a&&(d=a),d>l&&(d=l),d===0)break e;r.set(i.subarray(s,s+d),o),a-=d,s+=d,l-=d,o+=d,t.length-=d;break}t.mode=Rr;break;case UR:for(;c<14;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(t.nlen=(u&31)+257,u>>>=5,c-=5,t.ndist=(u&31)+1,u>>>=5,c-=5,t.ncode=(u&15)+4,u>>>=4,c-=4,t.nlen>286||t.ndist>30){n.msg="too many length or distance symbols",t.mode=ft;break}t.have=0,t.mode=BR;case BR:for(;t.have<t.ncode;){for(;c<3;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}t.lens[M[t.have++]]=u&7,u>>>=3,c-=3}for(;t.have<19;)t.lens[M[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},S=wc(j4,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,S){n.msg="invalid code lengths set",t.mode=ft;break}t.have=0,t.mode=zR;case zR:for(;t.have<t.nlen+t.ndist;){for(;p=t.lencode[u&(1<<t.lenbits)-1],_=p>>>24,v=p>>>16&255,x=p&65535,!(_<=c);){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(x<16)u>>>=_,c-=_,t.lens[t.have++]=x;else{if(x===16){for(C=_+2;c<C;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(u>>>=_,c-=_,t.have===0){n.msg="invalid bit length repeat",t.mode=ft;break}E=t.lens[t.have-1],d=3+(u&3),u>>>=2,c-=2}else if(x===17){for(C=_+3;c<C;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}u>>>=_,c-=_,E=0,d=3+(u&7),u>>>=3,c-=3}else{for(C=_+7;c<C;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}u>>>=_,c-=_,E=0,d=11+(u&127),u>>>=7,c-=7}if(t.have+d>t.nlen+t.ndist){n.msg="invalid bit length repeat",t.mode=ft;break}for(;d--;)t.lens[t.have++]=E}}if(t.mode===ft)break;if(t.lens[256]===0){n.msg="invalid code -- missing end-of-block",t.mode=ft;break}if(t.lenbits=9,R={bits:t.lenbits},S=wc(wR,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,S){n.msg="invalid literal/lengths set",t.mode=ft;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},S=wc(TR,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,S){n.msg="invalid distances set",t.mode=ft;break}if(t.mode=Rd,e===Sd)break e;case Rd:t.mode=Cd;case Cd:if(a>=6&&l>=258){n.next_out=o,n.avail_out=l,n.next_in=s,n.avail_in=a,t.hold=u,t.bits=c,k4(n,f),o=n.next_out,r=n.output,l=n.avail_out,s=n.next_in,i=n.input,a=n.avail_in,u=t.hold,c=t.bits,t.mode===Rr&&(t.back=-1);break}for(t.back=0;p=t.lencode[u&(1<<t.lenbits)-1],_=p>>>24,v=p>>>16&255,x=p&65535,!(_<=c);){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(v&&(v&240)===0){for(y=_,T=v,w=x;p=t.lencode[w+((u&(1<<y+T)-1)>>y)],_=p>>>24,v=p>>>16&255,x=p&65535,!(y+_<=c);){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}u>>>=y,c-=y,t.back+=y}if(u>>>=_,c-=_,t.back+=_,t.length=x,v===0){t.mode=ZR;break}if(v&32){t.back=-1,t.mode=Rr;break}if(v&64){n.msg="invalid literal/length code",t.mode=ft;break}t.extra=v&15,t.mode=VR;case VR:if(t.extra){for(C=t.extra;c<C;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,c-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=jR;case jR:for(;p=t.distcode[u&(1<<t.distbits)-1],_=p>>>24,v=p>>>16&255,x=p&65535,!(_<=c);){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if((v&240)===0){for(y=_,T=v,w=x;p=t.distcode[w+((u&(1<<y+T)-1)>>y)],_=p>>>24,v=p>>>16&255,x=p&65535,!(y+_<=c);){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}u>>>=y,c-=y,t.back+=y}if(u>>>=_,c-=_,t.back+=_,v&64){n.msg="invalid distance code",t.mode=ft;break}t.offset=x,t.extra=v&15,t.mode=XR;case XR:if(t.extra){for(C=t.extra;c<C;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,c-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){n.msg="invalid distance too far back",t.mode=ft;break}t.mode=YR;case YR:if(l===0)break e;if(d=f-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){n.msg="invalid distance too far back",t.mode=ft;break}d>t.wnext?(d-=t.wnext,g=t.wsize-d):g=t.wnext-d,d>t.length&&(d=t.length),m=t.window}else m=r,g=o-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do r[o++]=m[g++];while(--d);t.length===0&&(t.mode=Cd);break;case ZR:if(l===0)break e;r[o++]=t.length,l--,t.mode=Cd;break;case K0:if(t.wrap){for(;c<32;){if(a===0)break e;a--,u|=i[s++]<<c,c+=8}if(f-=l,n.total_out+=f,t.total+=f,f&&(n.adler=t.check=t.flags?Yt(t.check,r,f,o-f):dc(t.check,r,f,o-f)),f=l,(t.flags?u:qR(u))!==t.check){n.msg="incorrect data check",t.mode=ft;break}u=0,c=0}t.mode=WR;case WR:if(t.wrap&&t.flags){for(;c<32;){if(a===0)break e;a--,u+=i[s++]<<c,c+=8}if(u!==(t.total&4294967295)){n.msg="incorrect length check",t.mode=ft;break}u=0,c=0}t.mode=HR;case HR:S=Y4;break e;case ft:S=bR;break e;case KR:return RR;case H4:default:return ii}return n.next_out=o,n.avail_out=l,n.next_in=s,n.avail_in=a,t.hold=u,t.bits=c,(t.wsize||f!==n.avail_out&&t.mode<ft&&(t.mode<K0||e!==SR))&&iC(n,n.output,n.next_out,f-n.avail_out),h-=n.avail_in,f-=n.avail_out,n.total_in+=h,n.total_out+=f,t.total+=f,t.wrap&&f&&(n.adler=t.check=t.flags?Yt(t.check,r,f,n.next_out-f):dc(t.check,r,f,n.next_out-f)),n.data_type=t.bits+(t.last?64:0)+(t.mode===Rr?128:0)+(t.mode===Rd||t.mode===H0?256:0),(h===0&&f===0||e===SR)&&S===Vo&&(S=W4),S},r8=n=>{if(!n||!n.state)return ii;let e=n.state;return e.window&&(e.window=null),n.state=null,Vo},s8=(n,e)=>{if(!n||!n.state)return ii;const t=n.state;return(t.wrap&2)===0?ii:(t.head=e,e.done=!1,Vo)},o8=(n,e)=>{const t=e.length;let i,r,s;return!n||!n.state||(i=n.state,i.wrap!==0&&i.mode!==bd)?ii:i.mode===bd&&(r=1,r=dc(r,e,t,0),r!==i.check)?bR:(s=iC(n,e,t,t),s?(i.mode=KR,RR):(i.havedict=1,Vo))};var a8=QR,l8=eC,u8=JR,c8=t8,h8=tC,f8=i8,d8=r8,g8=s8,p8=o8,m8="pako inflate (from Nodeca project)",Cr={inflateReset:a8,inflateReset2:l8,inflateResetKeep:u8,inflateInit:c8,inflateInit2:h8,inflate:f8,inflateEnd:d8,inflateGetHeader:g8,inflateSetDictionary:p8,inflateInfo:m8};function _8(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var y8=_8;const rC=Object.prototype.toString,{Z_NO_FLUSH:v8,Z_FINISH:x8,Z_OK:Tc,Z_STREAM_END:Q0,Z_NEED_DICT:ey,Z_STREAM_ERROR:E8,Z_DATA_ERROR:sC,Z_MEM_ERROR:w8}=gc;function Sc(n){this.options=Ed.assign({chunkSize:1024*64,windowBits:15,to:""},n||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(n&&n.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mR,this.strm.avail_out=0;let t=Cr.inflateInit2(this.strm,e.windowBits);if(t!==Tc)throw new Error(ll[t]);if(this.header=new y8,Cr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Ec.string2buf(e.dictionary):rC.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Cr.inflateSetDictionary(this.strm,e.dictionary),t!==Tc)))throw new Error(ll[t])}Sc.prototype.push=function(n,e){const t=this.strm,i=this.options.chunkSize,r=this.options.dictionary;let s,o,a;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?x8:v8,rC.call(n)==="[object ArrayBuffer]"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),s=Cr.inflate(t,o),s===ey&&r&&(s=Cr.inflateSetDictionary(t,r),s===Tc?s=Cr.inflate(t,o):s===sC&&(s=ey));t.avail_in>0&&s===Q0&&t.state.wrap>0&&n[t.next_in]!==0;)Cr.inflateReset(t),s=Cr.inflate(t,o);switch(s){case E8:case sC:case ey:case w8:return this.onEnd(s),this.ended=!0,!1}if(a=t.avail_out,t.next_out&&(t.avail_out===0||s===Q0))if(this.options.to==="string"){let l=Ec.utf8border(t.output,t.next_out),u=t.next_out-l,c=Ec.buf2string(t.output,l);t.next_out=u,t.avail_out=i-u,u&&t.output.set(t.output.subarray(l,l+u),0),this.onData(c)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(s===Tc&&a===0)){if(s===Q0)return s=Cr.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(t.avail_in===0)break}}return!0},Sc.prototype.onData=function(n){this.chunks.push(n)},Sc.prototype.onEnd=function(n){n===Tc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ed.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function ty(n,e){const t=new Sc(e);if(t.push(n),t.err)throw t.msg||ll[t.err];return t.result}function T8(n,e){return e=e||{},e.raw=!0,ty(n,e)}var S8=Sc,b8=ty,R8=T8,C8=ty,I8=gc,A8={Inflate:S8,inflate:b8,inflateRaw:R8,ungzip:C8,constants:I8};const{Inflate:t6,inflate:L8,inflateRaw:n6,ungzip:i6}=A8;var oC=L8;class P8 extends No{decodeBlock(e){return oC(new Uint8Array(e)).buffer}}var M8=Object.freeze(Object.defineProperty({__proto__:null,default:P8},Symbol.toStringTag,{value:"Module"}));class F8 extends No{decodeBlock(e){const t=new DataView(e),i=[];for(let r=0;r<e.byteLength;++r){let s=t.getInt8(r);if(s<0){const o=t.getUint8(r+1);s=-s;for(let a=0;a<=s;++a)i.push(o);r+=1}else{for(let o=0;o<=s;++o)i.push(t.getUint8(r+o+1));r+=s+1}}return new Uint8Array(i).buffer}}var O8=Object.freeze(Object.defineProperty({__proto__:null,default:F8},Symbol.toStringTag,{value:"Module"})),aC={exports:{}};(function(n){/* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */(function(){var e=function(){var s={};s.defaultNoDataValue=-34027999387901484e22,s.decode=function(h,f){f=f||{};var d=f.encodedMaskData||f.encodedMaskData===null,g=u(h,f.inputOffset||0,d),m=f.noDataValue!==null?f.noDataValue:s.defaultNoDataValue,p=o(g,f.pixelType||Float32Array,f.encodedMaskData,m,f.returnMask),_={width:g.width,height:g.height,pixelData:p.resultPixels,minValue:p.minValue,maxValue:g.pixels.maxValue,noDataValue:m};return p.resultMask&&(_.maskData=p.resultMask),f.returnEncodedMask&&g.mask&&(_.encodedMaskData=g.mask.bitset?g.mask.bitset:null),f.returnFileInfo&&(_.fileInfo=a(g),f.computeUsedBitDepths&&(_.fileInfo.bitDepths=l(g))),_};var o=function(h,f,d,g,m){var p=0,_=h.pixels.numBlocksX,v=h.pixels.numBlocksY,x=Math.floor(h.width/_),y=Math.floor(h.height/v),T=2*h.maxZError,w=Number.MAX_VALUE,E;d=d||(h.mask?h.mask.bitset:null);var S,b;S=new f(h.width*h.height),m&&d&&(b=new Uint8Array(h.width*h.height));for(var R=new Float32Array(x*y),C,M,P=0;P<=v;P++){var U=P!==v?y:h.height%v;if(U!==0)for(var O=0;O<=_;O++){var L=O!==_?x:h.width%_;if(L!==0){var $=P*h.width*y+O*x,N=h.width-L,D=h.pixels.blocks[p],Y,k,F;D.encoding<2?(D.encoding===0?Y=D.rawData:(c(D.stuffedData,D.bitsPerPixel,D.numValidPixels,D.offset,T,R,h.pixels.maxValue),Y=R),k=0):D.encoding===2?F=0:F=D.offset;var ee;if(d)for(M=0;M<U;M++){for($&7&&(ee=d[$>>3],ee<<=$&7),C=0;C<L;C++)$&7||(ee=d[$>>3]),ee&128?(b&&(b[$]=1),E=D.encoding<2?Y[k++]:F,w=w>E?E:w,S[$++]=E):(b&&(b[$]=0),S[$++]=g),ee<<=1;$+=N}else if(D.encoding<2)for(M=0;M<U;M++){for(C=0;C<L;C++)E=Y[k++],w=w>E?E:w,S[$++]=E;$+=N}else for(w=w>F?F:w,M=0;M<U;M++){for(C=0;C<L;C++)S[$++]=F;$+=N}if(D.encoding===1&&k!==D.numValidPixels)throw"Block and Mask do not match";p++}}}return{resultPixels:S,resultMask:b,minValue:w}},a=function(h){return{fileIdentifierString:h.fileIdentifierString,fileVersion:h.fileVersion,imageType:h.imageType,height:h.height,width:h.width,maxZError:h.maxZError,eofOffset:h.eofOffset,mask:h.mask?{numBlocksX:h.mask.numBlocksX,numBlocksY:h.mask.numBlocksY,numBytes:h.mask.numBytes,maxValue:h.mask.maxValue}:null,pixels:{numBlocksX:h.pixels.numBlocksX,numBlocksY:h.pixels.numBlocksY,numBytes:h.pixels.numBytes,maxValue:h.pixels.maxValue,noDataValue:h.noDataValue}}},l=function(h){for(var f=h.pixels.numBlocksX*h.pixels.numBlocksY,d={},g=0;g<f;g++){var m=h.pixels.blocks[g];m.encoding===0?d.float32=!0:m.encoding===1?d[m.bitsPerPixel]=!0:d[0]=!0}return Object.keys(d)},u=function(h,f,d){var g={},m=new Uint8Array(h,f,10);if(g.fileIdentifierString=String.fromCharCode.apply(null,m),g.fileIdentifierString.trim()!=="CntZImage")throw"Unexpected file identifier string: "+g.fileIdentifierString;f+=10;var p=new DataView(h,f,24);if(g.fileVersion=p.getInt32(0,!0),g.imageType=p.getInt32(4,!0),g.height=p.getUint32(8,!0),g.width=p.getUint32(12,!0),g.maxZError=p.getFloat64(16,!0),f+=24,!d)if(p=new DataView(h,f,16),g.mask={},g.mask.numBlocksY=p.getUint32(0,!0),g.mask.numBlocksX=p.getUint32(4,!0),g.mask.numBytes=p.getUint32(8,!0),g.mask.maxValue=p.getFloat32(12,!0),f+=16,g.mask.numBytes>0){var _=new Uint8Array(Math.ceil(g.width*g.height/8));p=new DataView(h,f,g.mask.numBytes);var v=p.getInt16(0,!0),x=2,y=0;do{if(v>0)for(;v--;)_[y++]=p.getUint8(x++);else{var T=p.getUint8(x++);for(v=-v;v--;)_[y++]=T}v=p.getInt16(x,!0),x+=2}while(x<g.mask.numBytes);if(v!==-32768||y<_.length)throw"Unexpected end of mask RLE encoding";g.mask.bitset=_,f+=g.mask.numBytes}else(g.mask.numBytes|g.mask.numBlocksY|g.mask.maxValue)===0&&(g.mask.bitset=new Uint8Array(Math.ceil(g.width*g.height/8)));p=new DataView(h,f,16),g.pixels={},g.pixels.numBlocksY=p.getUint32(0,!0),g.pixels.numBlocksX=p.getUint32(4,!0),g.pixels.numBytes=p.getUint32(8,!0),g.pixels.maxValue=p.getFloat32(12,!0),f+=16;var w=g.pixels.numBlocksX,E=g.pixels.numBlocksY,S=w+(g.width%w>0?1:0),b=E+(g.height%E>0?1:0);g.pixels.blocks=new Array(S*b);for(var R=0,C=0;C<b;C++)for(var M=0;M<S;M++){var P=0,U=h.byteLength-f;p=new DataView(h,f,Math.min(10,U));var O={};g.pixels.blocks[R++]=O;var L=p.getUint8(0);if(P++,O.encoding=L&63,O.encoding>3)throw"Invalid block encoding ("+O.encoding+")";if(O.encoding===2){f++;continue}if(L!==0&&L!==2){if(L>>=6,O.offsetType=L,L===2)O.offset=p.getInt8(1),P++;else if(L===1)O.offset=p.getInt16(1,!0),P+=2;else if(L===0)O.offset=p.getFloat32(1,!0),P+=4;else throw"Invalid block offset type";if(O.encoding===1)if(L=p.getUint8(P),P++,O.bitsPerPixel=L&63,L>>=6,O.numValidPixelsType=L,L===2)O.numValidPixels=p.getUint8(P),P++;else if(L===1)O.numValidPixels=p.getUint16(P,!0),P+=2;else if(L===0)O.numValidPixels=p.getUint32(P,!0),P+=4;else throw"Invalid valid pixel count type"}if(f+=P,O.encoding!==3){var $,N;if(O.encoding===0){var D=(g.pixels.numBytes-1)/4;if(D!==Math.floor(D))throw"uncompressed block has invalid length";$=new ArrayBuffer(D*4),N=new Uint8Array($),N.set(new Uint8Array(h,f,D*4));var Y=new Float32Array($);O.rawData=Y,f+=D*4}else if(O.encoding===1){var k=Math.ceil(O.numValidPixels*O.bitsPerPixel/8),F=Math.ceil(k/4);$=new ArrayBuffer(F*4),N=new Uint8Array($),N.set(new Uint8Array(h,f,k)),O.stuffedData=new Uint32Array($),f+=k}}}return g.eofOffset=f,g},c=function(h,f,d,g,m,p,_){var v=(1<<f)-1,x=0,y,T=0,w,E,S=Math.ceil((_-g)/m),b=h.length*4-Math.ceil(f*d/8);for(h[h.length-1]<<=8*b,y=0;y<d;y++){if(T===0&&(E=h[x++],T=32),T>=f)w=E>>>T-f&v,T-=f;else{var R=f-T;w=(E&v)<<R&v,E=h[x++],T=32-R,w+=E>>>T}p[y]=w<S?g+w*m:_}return p};return s}(),t=function(){var s={unstuff:function(u,c,h,f,d,g,m,p){var _=(1<<h)-1,v=0,x,y=0,T,w,E,S,b=u.length*4-Math.ceil(h*f/8);if(u[u.length-1]<<=8*b,d)for(x=0;x<f;x++)y===0&&(w=u[v++],y=32),y>=h?(T=w>>>y-h&_,y-=h):(E=h-y,T=(w&_)<<E&_,w=u[v++],y=32-E,T+=w>>>y),c[x]=d[T];else for(S=Math.ceil((p-g)/m),x=0;x<f;x++)y===0&&(w=u[v++],y=32),y>=h?(T=w>>>y-h&_,y-=h):(E=h-y,T=(w&_)<<E&_,w=u[v++],y=32-E,T+=w>>>y),c[x]=T<S?g+T*m:p},unstuffLUT:function(u,c,h,f,d,g){var m=(1<<c)-1,p=0,_=0,v=0,x=0,y=0,T,w=[],E=u.length*4-Math.ceil(c*h/8);u[u.length-1]<<=8*E;var S=Math.ceil((g-f)/d);for(_=0;_<h;_++)x===0&&(T=u[p++],x=32),x>=c?(y=T>>>x-c&m,x-=c):(v=c-x,y=(T&m)<<v&m,T=u[p++],x=32-v,y+=T>>>x),w[_]=y<S?f+y*d:g;return w.unshift(f),w},unstuff2:function(u,c,h,f,d,g,m,p){var _=(1<<h)-1,v=0,x,y=0,T=0,w,E,S;if(d)for(x=0;x<f;x++)y===0&&(E=u[v++],y=32,T=0),y>=h?(w=E>>>T&_,y-=h,T+=h):(S=h-y,w=E>>>T&_,E=u[v++],y=32-S,w|=(E&(1<<S)-1)<<h-S,T=S),c[x]=d[w];else{var b=Math.ceil((p-g)/m);for(x=0;x<f;x++)y===0&&(E=u[v++],y=32,T=0),y>=h?(w=E>>>T&_,y-=h,T+=h):(S=h-y,w=E>>>T&_,E=u[v++],y=32-S,w|=(E&(1<<S)-1)<<h-S,T=S),c[x]=w<b?g+w*m:p}return c},unstuffLUT2:function(u,c,h,f,d,g){var m=(1<<c)-1,p=0,_=0,v=0,x=0,y=0,T=0,w,E=[],S=Math.ceil((g-f)/d);for(_=0;_<h;_++)x===0&&(w=u[p++],x=32,T=0),x>=c?(y=w>>>T&m,x-=c,T+=c):(v=c-x,y=w>>>T&m,w=u[p++],x=32-v,y|=(w&(1<<v)-1)<<c-v,T=v),E[_]=y<S?f+y*d:g;return E.unshift(f),E},originalUnstuff:function(u,c,h,f){var d=(1<<h)-1,g=0,m,p=0,_,v,x,y=u.length*4-Math.ceil(h*f/8);for(u[u.length-1]<<=8*y,m=0;m<f;m++)p===0&&(v=u[g++],p=32),p>=h?(_=v>>>p-h&d,p-=h):(x=h-p,_=(v&d)<<x&d,v=u[g++],p=32-x,_+=v>>>p),c[m]=_;return c},originalUnstuff2:function(u,c,h,f){var d=(1<<h)-1,g=0,m,p=0,_=0,v,x,y;for(m=0;m<f;m++)p===0&&(x=u[g++],p=32,_=0),p>=h?(v=x>>>_&d,p-=h,_+=h):(y=h-p,v=x>>>_&d,x=u[g++],p=32-y,v|=(x&(1<<y)-1)<<h-y,_=y),c[m]=v;return c}},o={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(u){for(var c=65535,h=65535,f=u.length,d=Math.floor(f/2),g=0;d;){var m=d>=359?359:d;d-=m;do c+=u[g++]<<8,h+=c+=u[g++];while(--m);c=(c&65535)+(c>>>16),h=(h&65535)+(h>>>16)}return f&1&&(h+=c+=u[g]<<8),c=(c&65535)+(c>>>16),h=(h&65535)+(h>>>16),(h<<16|c)>>>0},readHeaderInfo:function(u,c){var h=c.ptr,f=new Uint8Array(u,h,6),d={};if(d.fileIdentifierString=String.fromCharCode.apply(null,f),d.fileIdentifierString.lastIndexOf("Lerc2",0)!==0)throw"Unexpected file identifier string (expect Lerc2 ): "+d.fileIdentifierString;h+=6;var g=new DataView(u,h,8),m=g.getInt32(0,!0);d.fileVersion=m,h+=4,m>=3&&(d.checksum=g.getUint32(4,!0),h+=4),g=new DataView(u,h,12),d.height=g.getUint32(0,!0),d.width=g.getUint32(4,!0),h+=8,m>=4?(d.numDims=g.getUint32(8,!0),h+=4):d.numDims=1,g=new DataView(u,h,40),d.numValidPixel=g.getUint32(0,!0),d.microBlockSize=g.getInt32(4,!0),d.blobSize=g.getInt32(8,!0),d.imageType=g.getInt32(12,!0),d.maxZError=g.getFloat64(16,!0),d.zMin=g.getFloat64(24,!0),d.zMax=g.getFloat64(32,!0),h+=40,c.headerInfo=d,c.ptr=h;var p,_;if(m>=3&&(_=m>=4?52:48,p=this.computeChecksumFletcher32(new Uint8Array(u,h-_,d.blobSize-14)),p!==d.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(u,c){var h=c.headerInfo,f=this.getDataTypeArray(h.imageType),d=h.numDims*this.getDataTypeSize(h.imageType),g=this.readSubArray(u,c.ptr,f,d),m=this.readSubArray(u,c.ptr+d,f,d);c.ptr+=2*d;var p,_=!0;for(p=0;p<h.numDims;p++)if(g[p]!==m[p]){_=!1;break}return h.minValues=g,h.maxValues=m,_},readSubArray:function(u,c,h,f){var d;if(h===Uint8Array)d=new Uint8Array(u,c,f);else{var g=new ArrayBuffer(f),m=new Uint8Array(g);m.set(new Uint8Array(u,c,f)),d=new h(g)}return d},readMask:function(u,c){var h=c.ptr,f=c.headerInfo,d=f.width*f.height,g=f.numValidPixel,m=new DataView(u,h,4),p={};if(p.numBytes=m.getUint32(0,!0),h+=4,(g===0||d===g)&&p.numBytes!==0)throw"invalid mask";var _,v;if(g===0)_=new Uint8Array(Math.ceil(d/8)),p.bitset=_,v=new Uint8Array(d),c.pixels.resultMask=v,h+=p.numBytes;else if(p.numBytes>0){_=new Uint8Array(Math.ceil(d/8)),m=new DataView(u,h,p.numBytes);var x=m.getInt16(0,!0),y=2,T=0,w=0;do{if(x>0)for(;x--;)_[T++]=m.getUint8(y++);else for(w=m.getUint8(y++),x=-x;x--;)_[T++]=w;x=m.getInt16(y,!0),y+=2}while(y<p.numBytes);if(x!==-32768||T<_.length)throw"Unexpected end of mask RLE encoding";v=new Uint8Array(d);var E=0,S=0;for(S=0;S<d;S++)S&7?(E=_[S>>3],E<<=S&7):E=_[S>>3],E&128&&(v[S]=1);c.pixels.resultMask=v,p.bitset=_,h+=p.numBytes}return c.ptr=h,c.mask=p,!0},readDataOneSweep:function(u,c,h,f){var d=c.ptr,g=c.headerInfo,m=g.numDims,p=g.width*g.height,_=g.imageType,v=g.numValidPixel*o.getDataTypeSize(_)*m,x,y=c.pixels.resultMask;if(h===Uint8Array)x=new Uint8Array(u,d,v);else{var T=new ArrayBuffer(v),w=new Uint8Array(T);w.set(new Uint8Array(u,d,v)),x=new h(T)}if(x.length===p*m)f?c.pixels.resultPixels=o.swapDimensionOrder(x,p,m,h,!0):c.pixels.resultPixels=x;else{c.pixels.resultPixels=new h(p*m);var E=0,S=0,b=0,R=0;if(m>1){if(f){for(S=0;S<p;S++)if(y[S])for(R=S,b=0;b<m;b++,R+=p)c.pixels.resultPixels[R]=x[E++]}else for(S=0;S<p;S++)if(y[S])for(R=S*m,b=0;b<m;b++)c.pixels.resultPixels[R+b]=x[E++]}else for(S=0;S<p;S++)y[S]&&(c.pixels.resultPixels[S]=x[E++])}return d+=v,c.ptr=d,!0},readHuffmanTree:function(u,c){var h=this.HUFFMAN_LUT_BITS_MAX,f=new DataView(u,c.ptr,16);c.ptr+=16;var d=f.getInt32(0,!0);if(d<2)throw"unsupported Huffman version";var g=f.getInt32(4,!0),m=f.getInt32(8,!0),p=f.getInt32(12,!0);if(m>=p)return!1;var _=new Uint32Array(p-m);o.decodeBits(u,c,_);var v=[],x,y,T,w;for(x=m;x<p;x++)y=x-(x<g?0:g),v[y]={first:_[x-m],second:null};var E=u.byteLength-c.ptr,S=Math.ceil(E/4),b=new ArrayBuffer(S*4),R=new Uint8Array(b);R.set(new Uint8Array(u,c.ptr,E));var C=new Uint32Array(b),M=0,P,U=0;for(P=C[0],x=m;x<p;x++)y=x-(x<g?0:g),w=v[y].first,w>0&&(v[y].second=P<<M>>>32-w,32-M>=w?(M+=w,M===32&&(M=0,U++,P=C[U])):(M+=w-32,U++,P=C[U],v[y].second|=P>>>32-M));var O=0,L=0,$=new a;for(x=0;x<v.length;x++)v[x]!==void 0&&(O=Math.max(O,v[x].first));O>=h?L=h:L=O;var N=[],D,Y,k,F,ee,X;for(x=m;x<p;x++)if(y=x-(x<g?0:g),w=v[y].first,w>0)if(D=[w,y],w<=L)for(Y=v[y].second<<L-w,k=1<<L-w,T=0;T<k;T++)N[Y|T]=D;else for(Y=v[y].second,X=$,F=w-1;F>=0;F--)ee=Y>>>F&1,ee?(X.right||(X.right=new a),X=X.right):(X.left||(X.left=new a),X=X.left),F===0&&!X.val&&(X.val=D[1]);return{decodeLut:N,numBitsLUTQick:L,numBitsLUT:O,tree:$,stuffedData:C,srcPtr:U,bitPos:M}},readHuffman:function(u,c,h,f){var d=c.headerInfo,g=d.numDims,m=c.headerInfo.height,p=c.headerInfo.width,_=p*m,v=this.readHuffmanTree(u,c),x=v.decodeLut,y=v.tree,T=v.stuffedData,w=v.srcPtr,E=v.bitPos,S=v.numBitsLUTQick,b=v.numBitsLUT,R=c.headerInfo.imageType===0?128:0,C,M,P,U=c.pixels.resultMask,O,L,$,N,D,Y,k,F=0;E>0&&(w++,E=0);var ee=T[w],X=c.encodeMode===1,Z=new h(_*g),ie=Z,B;if(g<2||X){for(B=0;B<g;B++)if(g>1&&(ie=new h(Z.buffer,_*B,_),F=0),c.headerInfo.numValidPixel===p*m)for(Y=0,N=0;N<m;N++)for(D=0;D<p;D++,Y++){if(M=0,O=ee<<E>>>32-S,L=O,32-E<S&&(O|=T[w+1]>>>64-E-S,L=O),x[L])M=x[L][1],E+=x[L][0];else for(O=ee<<E>>>32-b,L=O,32-E<b&&(O|=T[w+1]>>>64-E-b,L=O),C=y,k=0;k<b;k++)if($=O>>>b-k-1&1,C=$?C.right:C.left,!(C.left||C.right)){M=C.val,E=E+k+1;break}E>=32&&(E-=32,w++,ee=T[w]),P=M-R,X?(D>0?P+=F:N>0?P+=ie[Y-p]:P+=F,P&=255,ie[Y]=P,F=P):ie[Y]=P}else for(Y=0,N=0;N<m;N++)for(D=0;D<p;D++,Y++)if(U[Y]){if(M=0,O=ee<<E>>>32-S,L=O,32-E<S&&(O|=T[w+1]>>>64-E-S,L=O),x[L])M=x[L][1],E+=x[L][0];else for(O=ee<<E>>>32-b,L=O,32-E<b&&(O|=T[w+1]>>>64-E-b,L=O),C=y,k=0;k<b;k++)if($=O>>>b-k-1&1,C=$?C.right:C.left,!(C.left||C.right)){M=C.val,E=E+k+1;break}E>=32&&(E-=32,w++,ee=T[w]),P=M-R,X?(D>0&&U[Y-1]?P+=F:N>0&&U[Y-p]?P+=ie[Y-p]:P+=F,P&=255,ie[Y]=P,F=P):ie[Y]=P}}else for(Y=0,N=0;N<m;N++)for(D=0;D<p;D++)if(Y=N*p+D,!U||U[Y])for(B=0;B<g;B++,Y+=_){if(M=0,O=ee<<E>>>32-S,L=O,32-E<S&&(O|=T[w+1]>>>64-E-S,L=O),x[L])M=x[L][1],E+=x[L][0];else for(O=ee<<E>>>32-b,L=O,32-E<b&&(O|=T[w+1]>>>64-E-b,L=O),C=y,k=0;k<b;k++)if($=O>>>b-k-1&1,C=$?C.right:C.left,!(C.left||C.right)){M=C.val,E=E+k+1;break}E>=32&&(E-=32,w++,ee=T[w]),P=M-R,ie[Y]=P}c.ptr=c.ptr+(w+1)*4+(E>0?4:0),c.pixels.resultPixels=Z,g>1&&!f&&(c.pixels.resultPixels=o.swapDimensionOrder(Z,_,g,h))},decodeBits:function(u,c,h,f,d){{var g=c.headerInfo,m=g.fileVersion,p=0,_=u.byteLength-c.ptr>=5?5:u.byteLength-c.ptr,v=new DataView(u,c.ptr,_),x=v.getUint8(0);p++;var y=x>>6,T=y===0?4:3-y,w=(x&32)>0,E=x&31,S=0;if(T===1)S=v.getUint8(p),p++;else if(T===2)S=v.getUint16(p,!0),p+=2;else if(T===4)S=v.getUint32(p,!0),p+=4;else throw"Invalid valid pixel count type";var b=2*g.maxZError,R,C,M,P,U,O,L,$,N,D=g.numDims>1?g.maxValues[d]:g.zMax;if(w){for(c.counter.lut++,$=v.getUint8(p),p++,P=Math.ceil(($-1)*E/8),U=Math.ceil(P/4),C=new ArrayBuffer(U*4),M=new Uint8Array(C),c.ptr+=p,M.set(new Uint8Array(u,c.ptr,P)),L=new Uint32Array(C),c.ptr+=P,N=0;$-1>>>N;)N++;P=Math.ceil(S*N/8),U=Math.ceil(P/4),C=new ArrayBuffer(U*4),M=new Uint8Array(C),M.set(new Uint8Array(u,c.ptr,P)),R=new Uint32Array(C),c.ptr+=P,m>=3?O=s.unstuffLUT2(L,E,$-1,f,b,D):O=s.unstuffLUT(L,E,$-1,f,b,D),m>=3?s.unstuff2(R,h,N,S,O):s.unstuff(R,h,N,S,O)}else c.counter.bitstuffer++,N=E,c.ptr+=p,N>0&&(P=Math.ceil(S*N/8),U=Math.ceil(P/4),C=new ArrayBuffer(U*4),M=new Uint8Array(C),M.set(new Uint8Array(u,c.ptr,P)),R=new Uint32Array(C),c.ptr+=P,m>=3?f==null?s.originalUnstuff2(R,h,N,S):s.unstuff2(R,h,N,S,!1,f,b,D):f==null?s.originalUnstuff(R,h,N,S):s.unstuff(R,h,N,S,!1,f,b,D))}},readTiles:function(u,c,h,f){var d=c.headerInfo,g=d.width,m=d.height,p=g*m,_=d.microBlockSize,v=d.imageType,x=o.getDataTypeSize(v),y=Math.ceil(g/_),T=Math.ceil(m/_);c.pixels.numBlocksY=T,c.pixels.numBlocksX=y,c.pixels.ptr=0;var w=0,E=0,S=0,b=0,R=0,C=0,M=0,P=0,U=0,O=0,L=0,$=0,N=0,D=0,Y=0,k=0,F,ee,X,Z,ie,B,he=new h(_*_),me=m%_||_,De=g%_||_,rt,Ce,at=d.numDims,dt,et=c.pixels.resultMask,Ve=c.pixels.resultPixels,Q=d.fileVersion,wn=Q>=5?14:15,Bt,Tn=d.zMax,ln;for(S=0;S<T;S++)for(R=S!==T-1?_:me,b=0;b<y;b++)for(C=b!==y-1?_:De,L=S*g*_+b*_,$=g-C,dt=0;dt<at;dt++){if(at>1?(ln=Ve,L=S*g*_+b*_,Ve=new h(c.pixels.resultPixels.buffer,p*dt*x,p),Tn=d.maxValues[dt]):ln=null,M=u.byteLength-c.ptr,F=new DataView(u,c.ptr,Math.min(10,M)),ee={},k=0,P=F.getUint8(0),k++,Bt=d.fileVersion>=5?P&4:0,U=P>>6&255,O=P>>2&wn,O!==(b*_>>3&wn)||Bt&&dt===0)throw"integrity issue";if(B=P&3,B>3)throw c.ptr+=k,"Invalid block encoding ("+B+")";if(B===2){if(Bt)if(et)for(w=0;w<R;w++)for(E=0;E<C;E++)et[L]&&(Ve[L]=ln[L]),L++;else for(w=0;w<R;w++)for(E=0;E<C;E++)Ve[L]=ln[L],L++;c.counter.constant++,c.ptr+=k;continue}else if(B===0){if(Bt)throw"integrity issue";if(c.counter.uncompressed++,c.ptr+=k,N=R*C*x,D=u.byteLength-c.ptr,N=N<D?N:D,X=new ArrayBuffer(N%x===0?N:N+x-N%x),Z=new Uint8Array(X),Z.set(new Uint8Array(u,c.ptr,N)),ie=new h(X),Y=0,et)for(w=0;w<R;w++){for(E=0;E<C;E++)et[L]&&(Ve[L]=ie[Y++]),L++;L+=$}else for(w=0;w<R;w++){for(E=0;E<C;E++)Ve[L++]=ie[Y++];L+=$}c.ptr+=Y*x}else if(rt=o.getDataTypeUsed(Bt&&v<6?4:v,U),Ce=o.getOnePixel(ee,k,rt,F),k+=o.getDataTypeSize(rt),B===3)if(c.ptr+=k,c.counter.constantoffset++,et)for(w=0;w<R;w++){for(E=0;E<C;E++)et[L]&&(Ve[L]=Bt?Math.min(Tn,ln[L]+Ce):Ce),L++;L+=$}else for(w=0;w<R;w++){for(E=0;E<C;E++)Ve[L]=Bt?Math.min(Tn,ln[L]+Ce):Ce,L++;L+=$}else if(c.ptr+=k,o.decodeBits(u,c,he,Ce,dt),k=0,Bt)if(et)for(w=0;w<R;w++){for(E=0;E<C;E++)et[L]&&(Ve[L]=he[k++]+ln[L]),L++;L+=$}else for(w=0;w<R;w++){for(E=0;E<C;E++)Ve[L]=he[k++]+ln[L],L++;L+=$}else if(et)for(w=0;w<R;w++){for(E=0;E<C;E++)et[L]&&(Ve[L]=he[k++]),L++;L+=$}else for(w=0;w<R;w++){for(E=0;E<C;E++)Ve[L++]=he[k++];L+=$}}at>1&&!f&&(c.pixels.resultPixels=o.swapDimensionOrder(c.pixels.resultPixels,p,at,h))},formatFileInfo:function(u){return{fileIdentifierString:u.headerInfo.fileIdentifierString,fileVersion:u.headerInfo.fileVersion,imageType:u.headerInfo.imageType,height:u.headerInfo.height,width:u.headerInfo.width,numValidPixel:u.headerInfo.numValidPixel,microBlockSize:u.headerInfo.microBlockSize,blobSize:u.headerInfo.blobSize,maxZError:u.headerInfo.maxZError,pixelType:o.getPixelType(u.headerInfo.imageType),eofOffset:u.eofOffset,mask:u.mask?{numBytes:u.mask.numBytes}:null,pixels:{numBlocksX:u.pixels.numBlocksX,numBlocksY:u.pixels.numBlocksY,maxValue:u.headerInfo.zMax,minValue:u.headerInfo.zMin,noDataValue:u.noDataValue}}},constructConstantSurface:function(u,c){var h=u.headerInfo.zMax,f=u.headerInfo.zMin,d=u.headerInfo.maxValues,g=u.headerInfo.numDims,m=u.headerInfo.height*u.headerInfo.width,p=0,_=0,v=0,x=u.pixels.resultMask,y=u.pixels.resultPixels;if(x)if(g>1){if(c)for(p=0;p<g;p++)for(v=p*m,h=d[p],_=0;_<m;_++)x[_]&&(y[v+_]=h);else for(_=0;_<m;_++)if(x[_])for(v=_*g,p=0;p<g;p++)y[v+g]=d[p]}else for(_=0;_<m;_++)x[_]&&(y[_]=h);else if(g>1&&f!==h)if(c)for(p=0;p<g;p++)for(v=p*m,h=d[p],_=0;_<m;_++)y[v+_]=h;else for(_=0;_<m;_++)for(v=_*g,p=0;p<g;p++)y[v+p]=d[p];else for(_=0;_<m*g;_++)y[_]=h},getDataTypeArray:function(u){var c;switch(u){case 0:c=Int8Array;break;case 1:c=Uint8Array;break;case 2:c=Int16Array;break;case 3:c=Uint16Array;break;case 4:c=Int32Array;break;case 5:c=Uint32Array;break;case 6:c=Float32Array;break;case 7:c=Float64Array;break;default:c=Float32Array}return c},getPixelType:function(u){var c;switch(u){case 0:c="S8";break;case 1:c="U8";break;case 2:c="S16";break;case 3:c="U16";break;case 4:c="S32";break;case 5:c="U32";break;case 6:c="F32";break;case 7:c="F64";break;default:c="F32"}return c},isValidPixelValue:function(u,c){if(c==null)return!1;var h;switch(u){case 0:h=c>=-128&&c<=127;break;case 1:h=c>=0&&c<=255;break;case 2:h=c>=-32768&&c<=32767;break;case 3:h=c>=0&&c<=65536;break;case 4:h=c>=-2147483648&&c<=2147483647;break;case 5:h=c>=0&&c<=4294967296;break;case 6:h=c>=-34027999387901484e22&&c<=34027999387901484e22;break;case 7:h=c>=-17976931348623157e292&&c<=17976931348623157e292;break;default:h=!1}return h},getDataTypeSize:function(u){var c=0;switch(u){case 0:case 1:c=1;break;case 2:case 3:c=2;break;case 4:case 5:case 6:c=4;break;case 7:c=8;break;default:c=u}return c},getDataTypeUsed:function(u,c){var h=u;switch(u){case 2:case 4:h=u-c;break;case 3:case 5:h=u-2*c;break;case 6:c===0?h=u:c===1?h=2:h=1;break;case 7:c===0?h=u:h=u-2*c+1;break;default:h=u;break}return h},getOnePixel:function(u,c,h,f){var d=0;switch(h){case 0:d=f.getInt8(c);break;case 1:d=f.getUint8(c);break;case 2:d=f.getInt16(c,!0);break;case 3:d=f.getUint16(c,!0);break;case 4:d=f.getInt32(c,!0);break;case 5:d=f.getUInt32(c,!0);break;case 6:d=f.getFloat32(c,!0);break;case 7:d=f.getFloat64(c,!0);break;default:throw"the decoder does not understand this pixel type"}return d},swapDimensionOrder:function(u,c,h,f,d){var g=0,m=0,p=0,_=0,v=u;if(h>1)if(v=new f(c*h),d)for(g=0;g<c;g++)for(_=g,p=0;p<h;p++,_+=c)v[_]=u[m++];else for(g=0;g<c;g++)for(_=g,p=0;p<h;p++,_+=c)v[m++]=u[_];return v}},a=function(u,c,h){this.val=u,this.left=c,this.right=h},l={decode:function(u,c){c=c||{};var h=c.noDataValue,f=0,d={};d.ptr=c.inputOffset||0,d.pixels={},o.readHeaderInfo(u,d);var g=d.headerInfo,m=g.fileVersion,p=o.getDataTypeArray(g.imageType);if(m>5)throw"unsupported lerc version 2."+m;o.readMask(u,d),g.numValidPixel!==g.width*g.height&&!d.pixels.resultMask&&(d.pixels.resultMask=c.maskData);var _=g.width*g.height;d.pixels.resultPixels=new p(_*g.numDims),d.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var v=!c.returnPixelInterleavedDims;if(g.numValidPixel!==0)if(g.zMax===g.zMin)o.constructConstantSurface(d,v);else if(m>=4&&o.checkMinMaxRanges(u,d))o.constructConstantSurface(d,v);else{var x=new DataView(u,d.ptr,2),y=x.getUint8(0);if(d.ptr++,y)o.readDataOneSweep(u,d,p,v);else if(m>1&&g.imageType<=1&&Math.abs(g.maxZError-.5)<1e-5){var T=x.getUint8(1);if(d.ptr++,d.encodeMode=T,T>2||m<4&&T>1)throw"Invalid Huffman flag "+T;T?o.readHuffman(u,d,p,v):o.readTiles(u,d,p,v)}else o.readTiles(u,d,p,v)}d.eofOffset=d.ptr;var w;c.inputOffset?(w=d.headerInfo.blobSize+c.inputOffset-d.ptr,Math.abs(w)>=1&&(d.eofOffset=c.inputOffset+d.headerInfo.blobSize)):(w=d.headerInfo.blobSize-d.ptr,Math.abs(w)>=1&&(d.eofOffset=d.headerInfo.blobSize));var E={width:g.width,height:g.height,pixelData:d.pixels.resultPixels,minValue:g.zMin,maxValue:g.zMax,validPixelCount:g.numValidPixel,dimCount:g.numDims,dimStats:{minValues:g.minValues,maxValues:g.maxValues},maskData:d.pixels.resultMask};if(d.pixels.resultMask&&o.isValidPixelValue(g.imageType,h)){var S=d.pixels.resultMask;for(f=0;f<_;f++)S[f]||(E.pixelData[f]=h);E.noDataValue=h}return d.noDataValue=h,c.returnFileInfo&&(E.fileInfo=o.formatFileInfo(d)),E},getBandCount:function(u){var c=0,h=0,f={};for(f.ptr=0,f.pixels={};h<u.byteLength-58;)o.readHeaderInfo(u,f),h+=f.headerInfo.blobSize,c++,f.ptr=h;return c}};return l}(),i=function(){var s=new ArrayBuffer(4),o=new Uint8Array(s),a=new Uint32Array(s);return a[0]=1,o[0]===1}(),r={decode:function(s,o){if(!i)throw"Big endian system is not supported.";o=o||{};var a=o.inputOffset||0,l=new Uint8Array(s,a,10),u=String.fromCharCode.apply(null,l),c,h;if(u.trim()==="CntZImage")c=e,h=1;else if(u.substring(0,5)==="Lerc2")c=t,h=2;else throw"Unexpected file identifier string: "+u;for(var f=0,d=s.byteLength-10,g,m=[],p,_,v={width:0,height:0,pixels:[],pixelType:o.pixelType,mask:null,statistics:[]},x=0;a<d;){var y=c.decode(s,{inputOffset:a,encodedMaskData:g,maskData:_,returnMask:f===0,returnEncodedMask:f===0,returnFileInfo:!0,returnPixelInterleavedDims:o.returnPixelInterleavedDims,pixelType:o.pixelType||null,noDataValue:o.noDataValue||null});a=y.fileInfo.eofOffset,_=y.maskData,f===0&&(g=y.encodedMaskData,v.width=y.width,v.height=y.height,v.dimCount=y.dimCount||1,v.pixelType=y.pixelType||y.fileInfo.pixelType,v.mask=_),h>1&&(_&&m.push(_),y.fileInfo.mask&&y.fileInfo.mask.numBytes>0&&x++),f++,v.pixels.push(y.pixelData),v.statistics.push({minValue:y.minValue,maxValue:y.maxValue,noDataValue:y.noDataValue,dimStats:y.dimStats})}var T,w,E;if(h>1&&x>1){for(E=v.width*v.height,v.bandMasks=m,_=new Uint8Array(E),_.set(m[0]),T=1;T<m.length;T++)for(p=m[T],w=0;w<E;w++)_[w]=_[w]&p[w];v.maskData=_}return v}};n.exports?n.exports=r:this.Lerc=r})()})(aC);var $8=aC.exports;class D8 extends No{constructor(e){super(),this.planarConfiguration=typeof e.PlanarConfiguration!="undefined"?e.PlanarConfiguration:1,this.samplesPerPixel=typeof e.SamplesPerPixel!="undefined"?e.SamplesPerPixel:1,this.addCompression=e.LercParameters[wU.AddCompression]}decodeBlock(e){switch(this.addCompression){case ub.None:break;case ub.Deflate:e=oC(new Uint8Array(e)).buffer;break;default:throw new Error(`Unsupported LERC additional compression method identifier: ${this.addCompression}`)}return $8.decode(e,{returnPixelInterleavedDims:this.planarConfiguration===1}).pixels[0].buffer}}var N8=Object.freeze(Object.defineProperty({__proto__:null,default:D8},Symbol.toStringTag,{value:"Module"}));class k8 extends No{constructor(){if(super(),typeof createImageBitmap=="undefined")throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if(typeof document=="undefined"&&typeof OffscreenCanvas=="undefined")throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available")}async decode(e,t){const i=new Blob([t]),r=await createImageBitmap(i);let s;typeof document!="undefined"?(s=document.createElement("canvas"),s.width=r.width,s.height=r.height):s=new OffscreenCanvas(r.width,r.height);const o=s.getContext("2d");return o.drawImage(r,0,0),o.getImageData(0,0,r.width,r.height).data.buffer}}var G8=Object.freeze(Object.defineProperty({__proto__:null,default:k8},Symbol.toStringTag,{value:"Module"})),U8=Worker;function B8(){const n='function e(e,t,r,n,i,a,o){try{var s=e[a](o),f=s.value}catch(e){return void r(e)}s.done?t(f):Promise.resolve(f).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise((function(i,a){var o=t.apply(r,n);function s(t){e(o,i,a,s,f,"next",t)}function f(t){e(o,i,a,s,f,"throw",t)}s(void 0)}))}}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var n={exports:{}};!function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),o=new T(n||[]);return a._invoke=function(e,t,r){var n=h;return function(i,a){if(n===p)throw new Error("Generator is already running");if(n===m){if("throw"===i)throw a;return E()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=I(o,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var f=c(e,t,r);if("normal"===f.type){if(n=r.done?m:d,f.arg===v)continue;return{value:f.arg,done:r.done}}"throw"===f.type&&(n=m,r.method="throw",r.arg=f.arg)}}}(e,r,o),a}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",p="executing",m="completed",v={};function y(){}function w(){}function g(){}var b={};l(b,o,(function(){return this}));var k=Object.getPrototypeOf,x=k&&k(k(D([])));x&&x!==n&&i.call(x,o)&&(b=x);var _=g.prototype=y.prototype=Object.create(b);function A(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function P(e,t){function n(a,o,s,f){var l=c(e[a],e,o);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"===r(h)&&i.call(h,"__await")?t.resolve(h.__await).then((function(e){n("next",e,s,f)}),(function(e){n("throw",e,s,f)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,f)}))}f(l.arg)}var a;this._invoke=function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}}function I(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method))return v;r.method="throw",r.arg=new TypeError("The iterator does not provide a \'throw\' method")}return v}var i=c(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,v;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,v):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,v)}function U(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(U,this),this.reset(!0)}function D(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function r(){for(;++n<e.length;)if(i.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:E}}function E(){return{value:t,done:!0}}return w.prototype=g,l(_,"constructor",g),l(g,"constructor",w),w.displayName=l(g,f,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,l(e,f,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},A(P.prototype),l(P.prototype,s,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new P(u(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},A(_),l(_,f,"Generator"),l(_,o,(function(){return this})),l(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=D,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var f=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(f&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(f){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),S(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;S(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),v}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":r(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(n);var i=n.exports,a=new Map;function o(e,t){Array.isArray(e)||(e=[e]),e.forEach((function(e){return a.set(e,t)}))}function s(e){return f.apply(this,arguments)}function f(){return(f=t(i.mark((function e(t){var r,n;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.get(t.Compression)){e.next=3;break}throw new Error("Unknown compression method identifier: ".concat(t.Compression));case 3:return e.next=5,r();case 5:return n=e.sent,e.abrupt("return",new n(t));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}o([void 0,1],(function(){return Promise.resolve().then((function(){return _})).then((function(e){return e.default}))})),o(5,(function(){return Promise.resolve().then((function(){return S})).then((function(e){return e.default}))})),o(6,(function(){throw new Error("old style JPEG compression is not supported.")})),o(7,(function(){return Promise.resolve().then((function(){return L})).then((function(e){return e.default}))})),o([8,32946],(function(){return Promise.resolve().then((function(){return Ne})).then((function(e){return e.default}))})),o(32773,(function(){return Promise.resolve().then((function(){return Ye})).then((function(e){return e.default}))})),o(34887,(function(){return Promise.resolve().then((function(){return ut})).then((function(e){return e.default}))})),o(50001,(function(){return Promise.resolve().then((function(){return dt})).then((function(e){return e.default}))}));var l=globalThis;function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function m(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function y(e,t){var r=e.length-t,n=0;do{for(var i=t;i>0;i--)e[n+t]+=e[n],n++;r-=t}while(r>0)}function w(e,t,r){for(var n=0,i=e.length,a=i/r;i>t;){for(var o=t;o>0;--o)e[n+t]+=e[n],++n;i-=t}for(var s=e.slice(),f=0;f<a;++f)for(var l=0;l<r;++l)e[r*f+l]=s[(r-l-1)*a+f]}function g(e,t,r,n,i,a){if(!t||1===t)return e;for(var o=0;o<i.length;++o){if(i[o]%8!=0)throw new Error("When decoding with predictor, only multiple of 8 bits are supported.");if(i[o]!==i[0])throw new Error("When decoding with predictor, all samples must have the same size.")}for(var s=i[0]/8,f=2===a?1:i.length,l=0;l<n&&!(l*f*r*s>=e.byteLength);++l){var u=void 0;if(2===t){switch(i[0]){case 8:u=new Uint8Array(e,l*f*r*s,f*r*s);break;case 16:u=new Uint16Array(e,l*f*r*s,f*r*s/2);break;case 32:u=new Uint32Array(e,l*f*r*s,f*r*s/4);break;default:throw new Error("Predictor 2 not allowed with ".concat(i[0]," bits per sample."))}y(u,f)}else 3===t&&w(u=new Uint8Array(e,l*f*r*s,f*r*s),f,s)}return e}l.addEventListener("message",function(){var e=t(i.mark((function e(t){var r,n,a,o,f,u;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.data,n=r.id,a=r.fileDirectory,o=r.buffer,e.next=3,s(a);case 3:return f=e.sent,e.next=6,f.decode(a,o);case 6:u=e.sent,l.postMessage({decoded:u,id:n},[u]);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var b=function(){function e(){u(this,e)}var r;return h(e,[{key:"decode",value:(r=t(i.mark((function e(t,r){var n,a,o,s,f;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.decodeBlock(r);case 2:if(n=e.sent,1===(a=t.Predictor||1)){e.next=9;break}return o=!t.StripOffsets,s=o?t.TileWidth:t.ImageWidth,f=o?t.TileLength:t.RowsPerStrip||t.ImageLength,e.abrupt("return",g(n,a,s,f,t.BitsPerSample,t.PlanarConfiguration));case 9:return e.abrupt("return",n);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})}]),e}();function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var x=function(e){p(r,b);var t=k(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){return e}}]),r}(),_=Object.freeze({__proto__:null,default:x});function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}function P(e,t){for(var r=t.length-1;r>=0;r--)e.push(t[r]);return e}function I(e){for(var t=new Uint16Array(4093),r=new Uint8Array(4093),n=0;n<=257;n++)t[n]=4096,r[n]=n;var i=258,a=9,o=0;function s(){i=258,a=9}function f(e){var t=function(e,t,r){var n=t%8,i=Math.floor(t/8),a=8-n,o=t+r-8*(i+1),s=8*(i+2)-(t+r),f=8*(i+2)-t;if(s=Math.max(0,s),i>=e.length)return console.warn("ran off the end of the buffer before finding EOI_CODE (end on input code)"),257;var l=e[i]&Math.pow(2,8-n)-1,u=l<<=r-a;if(i+1<e.length){var c=e[i+1]>>>s;u+=c<<=Math.max(0,r-f)}if(o>8&&i+2<e.length){var h=8*(i+3)-(t+r);u+=e[i+2]>>>h}return u}(e,o,a);return o+=a,t}function l(e,n){return r[i]=n,t[i]=e,++i-1}function u(e){for(var n=[],i=e;4096!==i;i=t[i])n.push(r[i]);return n}var c=[];s();for(var h,d=new Uint8Array(e),p=f(d);257!==p;){if(256===p){for(s(),p=f(d);256===p;)p=f(d);if(257===p)break;if(p>256)throw new Error("corrupted code at scanline ".concat(p));P(c,u(p)),h=p}else if(p<i){var m=u(p);P(c,m),l(h,m[m.length-1]),h=p}else{var v=u(h);if(!v)throw new Error("Bogus entry. Not in dictionary, ".concat(h," / ").concat(i,", position: ").concat(o));P(c,v),c.push(v[v.length-1]),l(h,v[v.length-1]),h=p}i+1>=Math.pow(2,a)&&(12===a?h=void 0:a++),p=f(d)}return new Uint8Array(c)}var U=function(e){p(r,b);var t=A(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){return I(e).buffer}}]),r}(),S=Object.freeze({__proto__:null,default:U});function T(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var D=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);function E(e,t){for(var r=0,n=[],i=16;i>0&&!e[i-1];)--i;n.push({children:[],index:0});for(var a,o=n[0],s=0;s<i;s++){for(var f=0;f<e[s];f++){for((o=n.pop()).children[o.index]=t[r];o.index>0;)o=n.pop();for(o.index++,n.push(o);n.length<=s;)n.push(a={children:[],index:0}),o.children[o.index]=a.children,o=a;r++}s+1<i&&(n.push(a={children:[],index:0}),o.children[o.index]=a.children,o=a)}return n[0].children}function B(e,t,n,i,a,o,s,f,l){var u=n.mcusPerLine,c=n.progressive,h=t,d=t,p=0,m=0;function v(){if(m>0)return m--,p>>m&1;if(255===(p=e[d++])){var t=e[d++];if(t)throw new Error("unexpected marker: ".concat((p<<8|t).toString(16)))}return m=7,p>>>7}function y(e){for(var t,n=e;null!==(t=v());){if("number"==typeof(n=n[t]))return n;if("object"!==r(n))throw new Error("invalid huffman sequence")}return null}function w(e){for(var t=e,r=0;t>0;){var n=v();if(null===n)return;r=r<<1|n,--t}return r}function g(e){var t=w(e);return t>=1<<e-1?t:t+(-1<<e)+1}var b=0;var k,x=0;function _(e,t,r,n,i){var a=r%u,o=(r/u|0)*e.v+n,s=a*e.h+i;t(e,e.blocks[o][s])}function A(e,t,r){var n=r/e.blocksPerLine|0,i=r%e.blocksPerLine;t(e,e.blocks[n][i])}var P,I,U,S,T,E,B=i.length;E=c?0===o?0===f?function(e,t){var r=y(e.huffmanTableDC),n=0===r?0:g(r)<<l;e.pred+=n,t[0]=e.pred}:function(e,t){t[0]|=v()<<l}:0===f?function(e,t){if(b>0)b--;else for(var r=o,n=s;r<=n;){var i=y(e.huffmanTableAC),a=15&i,f=i>>4;if(0===a){if(f<15){b=w(f)+(1<<f)-1;break}r+=16}else t[D[r+=f]]=g(a)*(1<<l),r++}}:function(e,t){for(var r=o,n=s,i=0;r<=n;){var a=D[r],f=t[a]<0?-1:1;switch(x){case 0:var u=y(e.huffmanTableAC),c=15&u;if(i=u>>4,0===c)i<15?(b=w(i)+(1<<i),x=4):(i=16,x=1);else{if(1!==c)throw new Error("invalid ACn encoding");k=g(c),x=i?2:3}continue;case 1:case 2:t[a]?t[a]+=(v()<<l)*f:0==--i&&(x=2===x?3:0);break;case 3:t[a]?t[a]+=(v()<<l)*f:(t[a]=k<<l,x=0);break;case 4:t[a]&&(t[a]+=(v()<<l)*f)}r++}4===x&&0==--b&&(x=0)}:function(e,t){var r=y(e.huffmanTableDC),n=0===r?0:g(r);e.pred+=n,t[0]=e.pred;for(var i=1;i<64;){var a=y(e.huffmanTableAC),o=15&a,s=a>>4;if(0===o){if(s<15)break;i+=16}else t[D[i+=s]]=g(o),i++}};var O,M,C=0;M=1===B?i[0].blocksPerLine*i[0].blocksPerColumn:u*n.mcusPerColumn;for(var L=a||M;C<M;){for(I=0;I<B;I++)i[I].pred=0;if(b=0,1===B)for(P=i[0],T=0;T<L;T++)A(P,E,C),C++;else for(T=0;T<L;T++){for(I=0;I<B;I++){var R=P=i[I],V=R.h,G=R.v;for(U=0;U<G;U++)for(S=0;S<V;S++)_(P,E,C,U,S)}if(++C===M)break}if(m=0,(O=e[d]<<8|e[d+1])<65280)throw new Error("marker was not found");if(!(O>=65488&&O<=65495))break;d+=2}return d-h}function O(e,t){var r=[],n=t.blocksPerLine,i=t.blocksPerColumn,a=n<<3,o=new Int32Array(64),s=new Uint8Array(64);function f(e,r,n){var i,a,o,s,f,l,u,c,h,d,p=t.quantizationTable,m=n;for(d=0;d<64;d++)m[d]=e[d]*p[d];for(d=0;d<8;++d){var v=8*d;0!==m[1+v]||0!==m[2+v]||0!==m[3+v]||0!==m[4+v]||0!==m[5+v]||0!==m[6+v]||0!==m[7+v]?(i=5793*m[0+v]+128>>8,a=5793*m[4+v]+128>>8,o=m[2+v],s=m[6+v],f=2896*(m[1+v]-m[7+v])+128>>8,c=2896*(m[1+v]+m[7+v])+128>>8,l=m[3+v]<<4,h=i-a+1>>1,i=i+a+1>>1,a=h,h=3784*o+1567*s+128>>8,o=1567*o-3784*s+128>>8,s=h,h=f-(u=m[5+v]<<4)+1>>1,f=f+u+1>>1,u=h,h=c+l+1>>1,l=c-l+1>>1,c=h,h=i-s+1>>1,i=i+s+1>>1,s=h,h=a-o+1>>1,a=a+o+1>>1,o=h,h=2276*f+3406*c+2048>>12,f=3406*f-2276*c+2048>>12,c=h,h=799*l+4017*u+2048>>12,l=4017*l-799*u+2048>>12,u=h,m[0+v]=i+c,m[7+v]=i-c,m[1+v]=a+u,m[6+v]=a-u,m[2+v]=o+l,m[5+v]=o-l,m[3+v]=s+f,m[4+v]=s-f):(h=5793*m[0+v]+512>>10,m[0+v]=h,m[1+v]=h,m[2+v]=h,m[3+v]=h,m[4+v]=h,m[5+v]=h,m[6+v]=h,m[7+v]=h)}for(d=0;d<8;++d){var y=d;0!==m[8+y]||0!==m[16+y]||0!==m[24+y]||0!==m[32+y]||0!==m[40+y]||0!==m[48+y]||0!==m[56+y]?(i=5793*m[0+y]+2048>>12,a=5793*m[32+y]+2048>>12,o=m[16+y],s=m[48+y],f=2896*(m[8+y]-m[56+y])+2048>>12,c=2896*(m[8+y]+m[56+y])+2048>>12,l=m[24+y],h=i-a+1>>1,i=i+a+1>>1,a=h,h=3784*o+1567*s+2048>>12,o=1567*o-3784*s+2048>>12,s=h,h=f-(u=m[40+y])+1>>1,f=f+u+1>>1,u=h,h=c+l+1>>1,l=c-l+1>>1,c=h,h=i-s+1>>1,i=i+s+1>>1,s=h,h=a-o+1>>1,a=a+o+1>>1,o=h,h=2276*f+3406*c+2048>>12,f=3406*f-2276*c+2048>>12,c=h,h=799*l+4017*u+2048>>12,l=4017*l-799*u+2048>>12,u=h,m[0+y]=i+c,m[56+y]=i-c,m[8+y]=a+u,m[48+y]=a-u,m[16+y]=o+l,m[40+y]=o-l,m[24+y]=s+f,m[32+y]=s-f):(h=5793*n[d+0]+8192>>14,m[0+y]=h,m[8+y]=h,m[16+y]=h,m[24+y]=h,m[32+y]=h,m[40+y]=h,m[48+y]=h,m[56+y]=h)}for(d=0;d<64;++d){var w=128+(m[d]+8>>4);r[d]=w<0?0:w>255?255:w}}for(var l=0;l<i;l++){for(var u=l<<3,c=0;c<8;c++)r.push(new Uint8Array(a));for(var h=0;h<n;h++){f(t.blocks[l][h],s,o);for(var d=0,p=h<<3,m=0;m<8;m++)for(var v=r[u+m],y=0;y<8;y++)v[p+y]=s[d++]}}return r}var M=function(){function e(){u(this,e),this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}return h(e,[{key:"resetFrames",value:function(){this.frames=[]}},{key:"parse",value:function(e){var t=0;function r(){var r=e[t]<<8|e[t+1];return t+=2,r}function n(e){var t,r,n=0,i=0;for(r in e.components)e.components.hasOwnProperty(r)&&(n<(t=e.components[r]).h&&(n=t.h),i<t.v&&(i=t.v));var a=Math.ceil(e.samplesPerLine/8/n),o=Math.ceil(e.scanLines/8/i);for(r in e.components)if(e.components.hasOwnProperty(r)){t=e.components[r];for(var s=Math.ceil(Math.ceil(e.samplesPerLine/8)*t.h/n),f=Math.ceil(Math.ceil(e.scanLines/8)*t.v/i),l=a*t.h,u=o*t.v,c=[],h=0;h<u;h++){for(var d=[],p=0;p<l;p++)d.push(new Int32Array(64));c.push(d)}t.blocksPerLine=s,t.blocksPerColumn=f,t.blocks=c}e.maxH=n,e.maxV=i,e.mcusPerLine=a,e.mcusPerColumn=o}var i,a,o=r();if(65496!==o)throw new Error("SOI not found");for(o=r();65497!==o;){switch(o){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:var s=(i=void 0,a=void 0,i=r(),a=e.subarray(t,t+i-2),t+=a.length,a);65504===o&&74===s[0]&&70===s[1]&&73===s[2]&&70===s[3]&&0===s[4]&&(this.jfif={version:{major:s[5],minor:s[6]},densityUnits:s[7],xDensity:s[8]<<8|s[9],yDensity:s[10]<<8|s[11],thumbWidth:s[12],thumbHeight:s[13],thumbData:s.subarray(14,14+3*s[12]*s[13])}),65518===o&&65===s[0]&&100===s[1]&&111===s[2]&&98===s[3]&&101===s[4]&&0===s[5]&&(this.adobe={version:s[6],flags0:s[7]<<8|s[8],flags1:s[9]<<8|s[10],transformCode:s[11]});break;case 65499:for(var f=r()+t-2;t<f;){var l=e[t++],u=new Int32Array(64);if(l>>4==0)for(var c=0;c<64;c++){u[D[c]]=e[t++]}else{if(l>>4!=1)throw new Error("DQT: invalid table spec");for(var h=0;h<64;h++){u[D[h]]=r()}}this.quantizationTables[15&l]=u}break;case 65472:case 65473:case 65474:r();for(var d={extended:65473===o,progressive:65474===o,precision:e[t++],scanLines:r(),samplesPerLine:r(),components:{},componentsOrder:[]},p=e[t++],m=void 0,v=0;v<p;v++){m=e[t];var y=e[t+1]>>4,w=15&e[t+1],g=e[t+2];d.componentsOrder.push(m),d.components[m]={h:y,v:w,quantizationIdx:g},t+=3}n(d),this.frames.push(d);break;case 65476:for(var b=r(),k=2;k<b;){for(var x=e[t++],_=new Uint8Array(16),A=0,P=0;P<16;P++,t++)_[P]=e[t],A+=_[P];for(var I=new Uint8Array(A),U=0;U<A;U++,t++)I[U]=e[t];k+=17+A,x>>4==0?this.huffmanTablesDC[15&x]=E(_,I):this.huffmanTablesAC[15&x]=E(_,I)}break;case 65501:r(),this.resetInterval=r();break;case 65498:r();for(var S=e[t++],T=[],O=this.frames[0],M=0;M<S;M++){var C=O.components[e[t++]],L=e[t++];C.huffmanTableDC=this.huffmanTablesDC[L>>4],C.huffmanTableAC=this.huffmanTablesAC[15&L],T.push(C)}var R=e[t++],V=e[t++],G=e[t++],F=B(e,t,O,T,this.resetInterval,R,V,G>>4,15&G);t+=F;break;case 65535:255!==e[t]&&t--;break;default:if(255===e[t-3]&&e[t-2]>=192&&e[t-2]<=254){t-=3;break}throw new Error("unknown JPEG marker ".concat(o.toString(16)))}o=r()}}},{key:"getResult",value:function(){var e=this.frames;if(0===this.frames.length)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(var t=0;t<this.frames.length;t++)for(var r=this.frames[t].components,n=0,i=Object.keys(r);n<i.length;n++){var a=i[n];r[a].quantizationTable=this.quantizationTables[r[a].quantizationIdx],delete r[a].quantizationIdx}for(var o=e[0],s=o.components,f=o.componentsOrder,l=[],u=o.samplesPerLine,c=o.scanLines,h=0;h<f.length;h++){var d=s[f[h]];l.push({lines:O(0,d),scaleX:d.h/o.maxH,scaleY:d.v/o.maxV})}for(var p=new Uint8Array(u*c*l.length),m=0,v=0;v<c;++v)for(var y=0;y<u;++y)for(var w=0;w<l.length;++w){var g=l[w];p[m]=g.lines[0|v*g.scaleY][0|y*g.scaleX],++m}return p}}]),e}(),C=function(e){p(r,b);var t=T(r);function r(e){var n;return u(this,r),(n=t.call(this)).reader=new M,e.JPEGTables&&n.reader.parse(e.JPEGTables),n}return h(r,[{key:"decodeBlock",value:function(e){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(e)),this.reader.getResult().buffer}}]),r}(),L=Object.freeze({__proto__:null,default:C});function R(e){for(var t=e.length;--t>=0;)e[t]=0}R(new Array(576)),R(new Array(60)),R(new Array(512)),R(new Array(256)),R(new Array(29)),R(new Array(30));var V=function(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(i=i+t[n++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0},G=new Uint32Array(function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}()),F=function(e,t,r,n){var i=G,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e},z={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},j={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},N=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},Z=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==r(n))throw new TypeError(n+"must be non-object");for(var i in n)N(n,i)&&(e[i]=n[i])}}return e},K=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r].length;for(var i=new Uint8Array(t),a=0,o=0,s=e.length;a<s;a++){var f=e[a];i.set(f,o),o+=f.length}return i},H=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){H=!1}for(var Y=new Uint8Array(256),X=0;X<256;X++)Y[X]=X>=252?6:X>=248?5:X>=240?4:X>=224?3:X>=192?2:1;Y[254]=Y[254]=1;var W=function(e){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),a=0,i=0;a<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|63&r):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t},q=function(e,t){var r,n,i=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));var a=new Array(2*i);for(n=0,r=0;r<i;){var o=e[r++];if(o<128)a[n++]=o;else{var s=Y[o];if(s>4)a[n++]=65533,r+=s-1;else{for(o&=2===s?31:3===s?15:7;s>1&&r<i;)o=o<<6|63&e[r++],s--;s>1?a[n++]=65533:o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|1023&o)}}}return function(e,t){if(t<65534&&e.subarray&&H)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}(a,n)},J=function(e,t){(t=t||e.length)>e.length&&(t=e.length);for(var r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+Y[e[r]]>t?r:t};var Q=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},$=function(e,t){var r,n,i,a,o,s,f,l,u,c,h,d,p,m,v,y,w,g,b,k,x,_,A,P,I=e.state;r=e.next_in,A=e.input,n=r+(e.avail_in-5),i=e.next_out,P=e.output,a=i-(t-e.avail_out),o=i+(e.avail_out-257),s=I.dmax,f=I.wsize,l=I.whave,u=I.wnext,c=I.window,h=I.hold,d=I.bits,p=I.lencode,m=I.distcode,v=(1<<I.lenbits)-1,y=(1<<I.distbits)-1;e:do{d<15&&(h+=A[r++]<<d,d+=8,h+=A[r++]<<d,d+=8),w=p[h&v];t:for(;;){if(h>>>=g=w>>>24,d-=g,0===(g=w>>>16&255))P[i++]=65535&w;else{if(!(16&g)){if(0==(64&g)){w=p[(65535&w)+(h&(1<<g)-1)];continue t}if(32&g){I.mode=12;break e}e.msg="invalid literal/length code",I.mode=30;break e}b=65535&w,(g&=15)&&(d<g&&(h+=A[r++]<<d,d+=8),b+=h&(1<<g)-1,h>>>=g,d-=g),d<15&&(h+=A[r++]<<d,d+=8,h+=A[r++]<<d,d+=8),w=m[h&y];r:for(;;){if(h>>>=g=w>>>24,d-=g,!(16&(g=w>>>16&255))){if(0==(64&g)){w=m[(65535&w)+(h&(1<<g)-1)];continue r}e.msg="invalid distance code",I.mode=30;break e}if(k=65535&w,d<(g&=15)&&(h+=A[r++]<<d,(d+=8)<g&&(h+=A[r++]<<d,d+=8)),(k+=h&(1<<g)-1)>s){e.msg="invalid distance too far back",I.mode=30;break e}if(h>>>=g,d-=g,k>(g=i-a)){if((g=k-g)>l&&I.sane){e.msg="invalid distance too far back",I.mode=30;break e}if(x=0,_=c,0===u){if(x+=f-g,g<b){b-=g;do{P[i++]=c[x++]}while(--g);x=i-k,_=P}}else if(u<g){if(x+=f+u-g,(g-=u)<b){b-=g;do{P[i++]=c[x++]}while(--g);if(x=0,u<b){b-=g=u;do{P[i++]=c[x++]}while(--g);x=i-k,_=P}}}else if(x+=u-g,g<b){b-=g;do{P[i++]=c[x++]}while(--g);x=i-k,_=P}for(;b>2;)P[i++]=_[x++],P[i++]=_[x++],P[i++]=_[x++],b-=3;b&&(P[i++]=_[x++],b>1&&(P[i++]=_[x++]))}else{x=i-k;do{P[i++]=P[x++],P[i++]=P[x++],P[i++]=P[x++],b-=3}while(b>2);b&&(P[i++]=P[x++],b>1&&(P[i++]=P[x++]))}break}}break}}while(r<n&&i<o);r-=b=d>>3,h&=(1<<(d-=b<<3))-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<o?o-i+257:257-(i-o),I.hold=h,I.bits=d},ee=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),te=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),re=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),ne=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),ie=function(e,t,r,n,i,a,o,s){var f,l,u,c,h,d,p,m,v,y=s.bits,w=0,g=0,b=0,k=0,x=0,_=0,A=0,P=0,I=0,U=0,S=null,T=0,D=new Uint16Array(16),E=new Uint16Array(16),B=null,O=0;for(w=0;w<=15;w++)D[w]=0;for(g=0;g<n;g++)D[t[r+g]]++;for(x=y,k=15;k>=1&&0===D[k];k--);if(x>k&&(x=k),0===k)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(b=1;b<k&&0===D[b];b++);for(x<b&&(x=b),P=1,w=1;w<=15;w++)if(P<<=1,(P-=D[w])<0)return-1;if(P>0&&(0===e||1!==k))return-1;for(E[1]=0,w=1;w<15;w++)E[w+1]=E[w]+D[w];for(g=0;g<n;g++)0!==t[r+g]&&(o[E[t[r+g]]++]=g);if(0===e?(S=B=o,d=19):1===e?(S=ee,T-=257,B=te,O-=257,d=256):(S=re,B=ne,d=-1),U=0,g=0,w=b,h=a,_=x,A=0,u=-1,c=(I=1<<x)-1,1===e&&I>852||2===e&&I>592)return 1;for(;;){p=w-A,o[g]<d?(m=0,v=o[g]):o[g]>d?(m=B[O+o[g]],v=S[T+o[g]]):(m=96,v=0),f=1<<w-A,b=l=1<<_;do{i[h+(U>>A)+(l-=f)]=p<<24|m<<16|v|0}while(0!==l);for(f=1<<w-1;U&f;)f>>=1;if(0!==f?(U&=f-1,U+=f):U=0,g++,0==--D[w]){if(w===k)break;w=t[r+o[g]]}if(w>x&&(U&c)!==u){for(0===A&&(A=x),h+=b,P=1<<(_=w-A);_+A<k&&!((P-=D[_+A])<=0);)_++,P<<=1;if(I+=1<<_,1===e&&I>852||2===e&&I>592)return 1;i[u=U&c]=x<<24|_<<16|h-a|0}}return 0!==U&&(i[h+U]=w-A<<24|64<<16|0),s.bits=x,0},ae=j.Z_FINISH,oe=j.Z_BLOCK,se=j.Z_TREES,fe=j.Z_OK,le=j.Z_STREAM_END,ue=j.Z_NEED_DICT,ce=j.Z_STREAM_ERROR,he=j.Z_DATA_ERROR,de=j.Z_MEM_ERROR,pe=j.Z_BUF_ERROR,me=j.Z_DEFLATED,ve=function(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)};function ye(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var we,ge,be=function(e){if(!e||!e.state)return ce;var t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,fe},ke=function(e){if(!e||!e.state)return ce;var t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,be(e)},xe=function(e,t){var r;if(!e||!e.state)return ce;var n=e.state;return t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ce:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,ke(e))},_e=function(e,t){if(!e)return ce;var r=new ye;e.state=r,r.window=null;var n=xe(e,t);return n!==fe&&(e.state=null),n},Ae=!0,Pe=function(e){if(Ae){we=new Int32Array(512),ge=new Int32Array(32);for(var t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(ie(1,e.lens,0,288,we,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;ie(2,e.lens,0,32,ge,0,e.work,{bits:5}),Ae=!1}e.lencode=we,e.lenbits=9,e.distcode=ge,e.distbits=5},Ie=function(e,t,r,n){var i,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(t.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>n&&(i=n),a.window.set(t.subarray(r-n,r-n+i),a.wnext),(n-=i)?(a.window.set(t.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Ue={inflateReset:ke,inflateReset2:xe,inflateResetKeep:be,inflateInit:function(e){return _e(e,15)},inflateInit2:_e,inflate:function(e,t){var r,n,i,a,o,s,f,l,u,c,h,d,p,m,v,y,w,g,b,k,x,_,A,P,I=0,U=new Uint8Array(4),S=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return ce;12===(r=e.state).mode&&(r.mode=13),o=e.next_out,i=e.output,f=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,l=r.hold,u=r.bits,c=s,h=f,_=fe;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(2&r.wrap&&35615===l){r.check=0,U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0),l=0,u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&l)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=30;break}if((15&l)!==me){e.msg="unknown compression method",r.mode=30;break}if(u-=4,x=8+(15&(l>>>=4)),0===r.wbits)r.wbits=x;else if(x>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<r.wbits,e.adler=r.check=1,r.mode=512&l?10:12,l=0,u=0;break;case 2:for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(r.flags=l,(255&r.flags)!==me){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=l>>8&1),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0)),l=0,u=0,r.mode=3;case 3:for(;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.head&&(r.head.time=l),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,U[2]=l>>>16&255,U[3]=l>>>24&255,r.check=F(r.check,U,4,0)),l=0,u=0,r.mode=4;case 4:for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.head&&(r.head.xflags=255&l,r.head.os=l>>8),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0)),l=0,u=0,r.mode=5;case 5:if(1024&r.flags){for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.length=l,r.head&&(r.head.extra_len=l),512&r.flags&&(U[0]=255&l,U[1]=l>>>8&255,r.check=F(r.check,U,2,0)),l=0,u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((d=r.length)>s&&(d=s),d&&(r.head&&(x=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+d),x)),512&r.flags&&(r.check=F(r.check,n,d,a)),s-=d,a+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;d=0;do{x=n[a+d++],r.head&&x&&r.length<65536&&(r.head.name+=String.fromCharCode(x))}while(x&&d<s);if(512&r.flags&&(r.check=F(r.check,n,d,a)),s-=d,a+=d,x)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;d=0;do{x=n[a+d++],r.head&&x&&r.length<65536&&(r.head.comment+=String.fromCharCode(x))}while(x&&d<s);if(512&r.flags&&(r.check=F(r.check,n,d,a)),s-=d,a+=d,x)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;u<16;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(l!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}l=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}e.adler=r.check=ve(l),l=0,u=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=u,ue;e.adler=r.check=1,r.mode=12;case 12:if(t===oe||t===se)break e;case 13:if(r.last){l>>>=7&u,u-=7&u,r.mode=27;break}for(;u<3;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}switch(r.last=1&l,u-=1,3&(l>>>=1)){case 0:r.mode=14;break;case 1:if(Pe(r),r.mode=20,t===se){l>>>=2,u-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}l>>>=2,u-=2;break;case 14:for(l>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if((65535&l)!=(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&l,l=0,u=0,r.mode=15,t===se)break e;case 15:r.mode=16;case 16:if(d=r.length){if(d>s&&(d=s),d>f&&(d=f),0===d)break e;i.set(n.subarray(a,a+d),o),s-=d,a+=d,f-=d,o+=d,r.length-=d;break}r.mode=12;break;case 17:for(;u<14;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(r.nlen=257+(31&l),l>>>=5,u-=5,r.ndist=1+(31&l),l>>>=5,u-=5,r.ncode=4+(15&l),l>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;u<3;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.lens[S[r.have++]]=7&l,l>>>=3,u-=3}for(;r.have<19;)r.lens[S[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,A={bits:r.lenbits},_=ie(0,r.lens,0,19,r.lencode,0,r.work,A),r.lenbits=A.bits,_){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;y=(I=r.lencode[l&(1<<r.lenbits)-1])>>>16&255,w=65535&I,!((v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(w<16)l>>>=v,u-=v,r.lens[r.have++]=w;else{if(16===w){for(P=v+2;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(l>>>=v,u-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}x=r.lens[r.have-1],d=3+(3&l),l>>>=2,u-=2}else if(17===w){for(P=v+3;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}u-=v,x=0,d=3+(7&(l>>>=v)),l>>>=3,u-=3}else{for(P=v+7;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}u-=v,x=0,d=11+(127&(l>>>=v)),l>>>=7,u-=7}if(r.have+d>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;d--;)r.lens[r.have++]=x}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,A={bits:r.lenbits},_=ie(1,r.lens,0,r.nlen,r.lencode,0,r.work,A),r.lenbits=A.bits,_){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,A={bits:r.distbits},_=ie(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,A),r.distbits=A.bits,_){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,t===se)break e;case 20:r.mode=21;case 21:if(s>=6&&f>=258){e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=u,$(e,h),o=e.next_out,i=e.output,f=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,l=r.hold,u=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;y=(I=r.lencode[l&(1<<r.lenbits)-1])>>>16&255,w=65535&I,!((v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(y&&0==(240&y)){for(g=v,b=y,k=w;y=(I=r.lencode[k+((l&(1<<g+b)-1)>>g)])>>>16&255,w=65535&I,!(g+(v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}l>>>=g,u-=g,r.back+=g}if(l>>>=v,u-=v,r.back+=v,r.length=w,0===y){r.mode=26;break}if(32&y){r.back=-1,r.mode=12;break}if(64&y){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&y,r.mode=22;case 22:if(r.extra){for(P=r.extra;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;y=(I=r.distcode[l&(1<<r.distbits)-1])>>>16&255,w=65535&I,!((v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(0==(240&y)){for(g=v,b=y,k=w;y=(I=r.distcode[k+((l&(1<<g+b)-1)>>g)])>>>16&255,w=65535&I,!(g+(v=I>>>24)<=u);){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}l>>>=g,u-=g,r.back+=g}if(l>>>=v,u-=v,r.back+=v,64&y){e.msg="invalid distance code",r.mode=30;break}r.offset=w,r.extra=15&y,r.mode=24;case 24:if(r.extra){for(P=r.extra;u<P;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===f)break e;if(d=h-f,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}d>r.wnext?(d-=r.wnext,p=r.wsize-d):p=r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=o-r.offset,d=r.length;d>f&&(d=f),f-=d,r.length-=d;do{i[o++]=m[p++]}while(--d);0===r.length&&(r.mode=21);break;case 26:if(0===f)break e;i[o++]=r.length,f--,r.mode=21;break;case 27:if(r.wrap){for(;u<32;){if(0===s)break e;s--,l|=n[a++]<<u,u+=8}if(h-=f,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?F(r.check,i,h,o-h):V(r.check,i,h,o-h)),h=f,(r.flags?l:ve(l))!==r.check){e.msg="incorrect data check",r.mode=30;break}l=0,u=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;u<32;){if(0===s)break e;s--,l+=n[a++]<<u,u+=8}if(l!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}l=0,u=0}r.mode=29;case 29:_=le;break e;case 30:_=he;break e;case 31:return de;default:return ce}return e.next_out=o,e.avail_out=f,e.next_in=a,e.avail_in=s,r.hold=l,r.bits=u,(r.wsize||h!==e.avail_out&&r.mode<30&&(r.mode<27||t!==ae))&&Ie(e,e.output,e.next_out,h-e.avail_out),c-=e.avail_in,h-=e.avail_out,e.total_in+=c,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?F(r.check,i,h,e.next_out-h):V(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===c&&0===h||t===ae)&&_===fe&&(_=pe),_},inflateEnd:function(e){if(!e||!e.state)return ce;var t=e.state;return t.window&&(t.window=null),e.state=null,fe},inflateGetHeader:function(e,t){if(!e||!e.state)return ce;var r=e.state;return 0==(2&r.wrap)?ce:(r.head=t,t.done=!1,fe)},inflateSetDictionary:function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?ce:11===r.mode&&V(1,t,n,0)!==r.check?he:Ie(e,t,n,n)?(r.mode=31,de):(r.havedict=1,fe):ce},inflateInfo:"pako inflate (from Nodeca project)"};var Se=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},Te=Object.prototype.toString,De=j.Z_NO_FLUSH,Ee=j.Z_FINISH,Be=j.Z_OK,Oe=j.Z_STREAM_END,Me=j.Z_NEED_DICT,Ce=j.Z_STREAM_ERROR,Le=j.Z_DATA_ERROR,Re=j.Z_MEM_ERROR;function Ve(e){this.options=Z({chunkSize:65536,windowBits:15,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Q,this.strm.avail_out=0;var r=Ue.inflateInit2(this.strm,t.windowBits);if(r!==Be)throw new Error(z[r]);if(this.header=new Se,Ue.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=W(t.dictionary):"[object ArrayBuffer]"===Te.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Ue.inflateSetDictionary(this.strm,t.dictionary))!==Be))throw new Error(z[r])}function Ge(e,t){var r=new Ve(t);if(r.push(e),r.err)throw r.msg||z[r.err];return r.result}Ve.prototype.push=function(e,t){var r,n,i,a=this.strm,o=this.options.chunkSize,s=this.options.dictionary;if(this.ended)return!1;for(n=t===~~t?t:!0===t?Ee:De,"[object ArrayBuffer]"===Te.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(o),a.next_out=0,a.avail_out=o),(r=Ue.inflate(a,n))===Me&&s&&((r=Ue.inflateSetDictionary(a,s))===Be?r=Ue.inflate(a,n):r===Le&&(r=Me));a.avail_in>0&&r===Oe&&a.state.wrap>0&&0!==e[a.next_in];)Ue.inflateReset(a),r=Ue.inflate(a,n);switch(r){case Ce:case Le:case Me:case Re:return this.onEnd(r),this.ended=!0,!1}if(i=a.avail_out,a.next_out&&(0===a.avail_out||r===Oe))if("string"===this.options.to){var f=J(a.output,a.next_out),l=a.next_out-f,u=q(a.output,f);a.next_out=l,a.avail_out=o-l,l&&a.output.set(a.output.subarray(f,f+l),0),this.onData(u)}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(r!==Be||0!==i){if(r===Oe)return r=Ue.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,!0;if(0===a.avail_in)break}}return!0},Ve.prototype.onData=function(e){this.chunks.push(e)},Ve.prototype.onEnd=function(e){e===Be&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=K(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Fe={Inflate:Ve,inflate:Ge,inflateRaw:function(e,t){return(t=t||{}).raw=!0,Ge(e,t)},ungzip:Ge,constants:j}.inflate;function ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var je=function(e){p(r,b);var t=ze(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){return Fe(new Uint8Array(e)).buffer}}]),r}(),Ne=Object.freeze({__proto__:null,default:je});function Ze(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var Ke,He=function(e){p(r,b);var t=Ze(r);function r(){return u(this,r),t.apply(this,arguments)}return h(r,[{key:"decodeBlock",value:function(e){for(var t=new DataView(e),r=[],n=0;n<e.byteLength;++n){var i=t.getInt8(n);if(i<0){var a=t.getUint8(n+1);i=-i;for(var o=0;o<=i;++o)r.push(a);n+=1}else{for(var s=0;s<=i;++s)r.push(t.getUint8(n+s+1));n+=i+1}}return new Uint8Array(r).buffer}}]),r}(),Ye=Object.freeze({__proto__:null,default:He}),Xe={exports:{}};Ke=Xe,\n/* Copyright 2015-2021 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */\nfunction(){var e,t,r,n,i,a,o,s,f,l,u,c,h,d,p,m,v=(e={defaultNoDataValue:-34027999387901484e22,decode:function(a,o){var s=(o=o||{}).encodedMaskData||null===o.encodedMaskData,f=i(a,o.inputOffset||0,s),l=null!==o.noDataValue?o.noDataValue:e.defaultNoDataValue,u=t(f,o.pixelType||Float32Array,o.encodedMaskData,l,o.returnMask),c={width:f.width,height:f.height,pixelData:u.resultPixels,minValue:u.minValue,maxValue:f.pixels.maxValue,noDataValue:l};return u.resultMask&&(c.maskData=u.resultMask),o.returnEncodedMask&&f.mask&&(c.encodedMaskData=f.mask.bitset?f.mask.bitset:null),o.returnFileInfo&&(c.fileInfo=r(f),o.computeUsedBitDepths&&(c.fileInfo.bitDepths=n(f))),c}},t=function(e,t,r,n,i){var o,s,f,l=0,u=e.pixels.numBlocksX,c=e.pixels.numBlocksY,h=Math.floor(e.width/u),d=Math.floor(e.height/c),p=2*e.maxZError,m=Number.MAX_VALUE;r=r||(e.mask?e.mask.bitset:null),s=new t(e.width*e.height),i&&r&&(f=new Uint8Array(e.width*e.height));for(var v,y,w=new Float32Array(h*d),g=0;g<=c;g++){var b=g!==c?d:e.height%c;if(0!==b)for(var k=0;k<=u;k++){var x=k!==u?h:e.width%u;if(0!==x){var _,A,P,I,U=g*e.width*d+k*h,S=e.width-x,T=e.pixels.blocks[l];if(T.encoding<2?(0===T.encoding?_=T.rawData:(a(T.stuffedData,T.bitsPerPixel,T.numValidPixels,T.offset,p,w,e.pixels.maxValue),_=w),A=0):P=2===T.encoding?0:T.offset,r)for(y=0;y<b;y++){for(7&U&&(I=r[U>>3],I<<=7&U),v=0;v<x;v++)7&U||(I=r[U>>3]),128&I?(f&&(f[U]=1),m=m>(o=T.encoding<2?_[A++]:P)?o:m,s[U++]=o):(f&&(f[U]=0),s[U++]=n),I<<=1;U+=S}else if(T.encoding<2)for(y=0;y<b;y++){for(v=0;v<x;v++)m=m>(o=_[A++])?o:m,s[U++]=o;U+=S}else for(m=m>P?P:m,y=0;y<b;y++){for(v=0;v<x;v++)s[U++]=P;U+=S}if(1===T.encoding&&A!==T.numValidPixels)throw"Block and Mask do not match";l++}}}return{resultPixels:s,resultMask:f,minValue:m}},r=function(e){return{fileIdentifierString:e.fileIdentifierString,fileVersion:e.fileVersion,imageType:e.imageType,height:e.height,width:e.width,maxZError:e.maxZError,eofOffset:e.eofOffset,mask:e.mask?{numBlocksX:e.mask.numBlocksX,numBlocksY:e.mask.numBlocksY,numBytes:e.mask.numBytes,maxValue:e.mask.maxValue}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,numBytes:e.pixels.numBytes,maxValue:e.pixels.maxValue,noDataValue:e.noDataValue}}},n=function(e){for(var t=e.pixels.numBlocksX*e.pixels.numBlocksY,r={},n=0;n<t;n++){var i=e.pixels.blocks[n];0===i.encoding?r.float32=!0:1===i.encoding?r[i.bitsPerPixel]=!0:r[0]=!0}return Object.keys(r)},i=function(e,t,r){var n={},i=new Uint8Array(e,t,10);if(n.fileIdentifierString=String.fromCharCode.apply(null,i),"CntZImage"!==n.fileIdentifierString.trim())throw"Unexpected file identifier string: "+n.fileIdentifierString;t+=10;var a=new DataView(e,t,24);if(n.fileVersion=a.getInt32(0,!0),n.imageType=a.getInt32(4,!0),n.height=a.getUint32(8,!0),n.width=a.getUint32(12,!0),n.maxZError=a.getFloat64(16,!0),t+=24,!r)if(a=new DataView(e,t,16),n.mask={},n.mask.numBlocksY=a.getUint32(0,!0),n.mask.numBlocksX=a.getUint32(4,!0),n.mask.numBytes=a.getUint32(8,!0),n.mask.maxValue=a.getFloat32(12,!0),t+=16,n.mask.numBytes>0){var o=new Uint8Array(Math.ceil(n.width*n.height/8)),s=(a=new DataView(e,t,n.mask.numBytes)).getInt16(0,!0),f=2,l=0;do{if(s>0)for(;s--;)o[l++]=a.getUint8(f++);else{var u=a.getUint8(f++);for(s=-s;s--;)o[l++]=u}s=a.getInt16(f,!0),f+=2}while(f<n.mask.numBytes);if(-32768!==s||l<o.length)throw"Unexpected end of mask RLE encoding";n.mask.bitset=o,t+=n.mask.numBytes}else 0==(n.mask.numBytes|n.mask.numBlocksY|n.mask.maxValue)&&(n.mask.bitset=new Uint8Array(Math.ceil(n.width*n.height/8)));a=new DataView(e,t,16),n.pixels={},n.pixels.numBlocksY=a.getUint32(0,!0),n.pixels.numBlocksX=a.getUint32(4,!0),n.pixels.numBytes=a.getUint32(8,!0),n.pixels.maxValue=a.getFloat32(12,!0),t+=16;var c=n.pixels.numBlocksX,h=n.pixels.numBlocksY,d=c+(n.width%c>0?1:0),p=h+(n.height%h>0?1:0);n.pixels.blocks=new Array(d*p);for(var m=0,v=0;v<p;v++)for(var y=0;y<d;y++){var w=0,g=e.byteLength-t;a=new DataView(e,t,Math.min(10,g));var b={};n.pixels.blocks[m++]=b;var k=a.getUint8(0);if(w++,b.encoding=63&k,b.encoding>3)throw"Invalid block encoding ("+b.encoding+")";if(2!==b.encoding){if(0!==k&&2!==k){if(k>>=6,b.offsetType=k,2===k)b.offset=a.getInt8(1),w++;else if(1===k)b.offset=a.getInt16(1,!0),w+=2;else{if(0!==k)throw"Invalid block offset type";b.offset=a.getFloat32(1,!0),w+=4}if(1===b.encoding)if(k=a.getUint8(w),w++,b.bitsPerPixel=63&k,k>>=6,b.numValidPixelsType=k,2===k)b.numValidPixels=a.getUint8(w),w++;else if(1===k)b.numValidPixels=a.getUint16(w,!0),w+=2;else{if(0!==k)throw"Invalid valid pixel count type";b.numValidPixels=a.getUint32(w,!0),w+=4}}var x;if(t+=w,3!==b.encoding)if(0===b.encoding){var _=(n.pixels.numBytes-1)/4;if(_!==Math.floor(_))throw"uncompressed block has invalid length";x=new ArrayBuffer(4*_),new Uint8Array(x).set(new Uint8Array(e,t,4*_));var A=new Float32Array(x);b.rawData=A,t+=4*_}else if(1===b.encoding){var P=Math.ceil(b.numValidPixels*b.bitsPerPixel/8),I=Math.ceil(P/4);x=new ArrayBuffer(4*I),new Uint8Array(x).set(new Uint8Array(e,t,P)),b.stuffedData=new Uint32Array(x),t+=P}}else t++}return n.eofOffset=t,n},a=function(e,t,r,n,i,a,o){var s,f,l,u=(1<<t)-1,c=0,h=0,d=Math.ceil((o-n)/i),p=4*e.length-Math.ceil(t*r/8);for(e[e.length-1]<<=8*p,s=0;s<r;s++){if(0===h&&(l=e[c++],h=32),h>=t)f=l>>>h-t&u,h-=t;else{var m=t-h;f=(l&u)<<m&u,f+=(l=e[c++])>>>(h=32-m)}a[s]=f<d?n+f*i:o}return a},e),y=(o=function(e,t,r,n,i,a,o,s){var f,l,u,c,h,d=(1<<r)-1,p=0,m=0,v=4*e.length-Math.ceil(r*n/8);if(e[e.length-1]<<=8*v,i)for(f=0;f<n;f++)0===m&&(u=e[p++],m=32),m>=r?(l=u>>>m-r&d,m-=r):(l=(u&d)<<(c=r-m)&d,l+=(u=e[p++])>>>(m=32-c)),t[f]=i[l];else for(h=Math.ceil((s-a)/o),f=0;f<n;f++)0===m&&(u=e[p++],m=32),m>=r?(l=u>>>m-r&d,m-=r):(l=(u&d)<<(c=r-m)&d,l+=(u=e[p++])>>>(m=32-c)),t[f]=l<h?a+l*o:s},s=function(e,t,r,n,i,a){var o,s=(1<<t)-1,f=0,l=0,u=0,c=0,h=0,d=[],p=4*e.length-Math.ceil(t*r/8);e[e.length-1]<<=8*p;var m=Math.ceil((a-n)/i);for(l=0;l<r;l++)0===c&&(o=e[f++],c=32),c>=t?(h=o>>>c-t&s,c-=t):(h=(o&s)<<(u=t-c)&s,h+=(o=e[f++])>>>(c=32-u)),d[l]=h<m?n+h*i:a;return d.unshift(n),d},f=function(e,t,r,n,i,a,o,s){var f,l,u,c,h=(1<<r)-1,d=0,p=0,m=0;if(i)for(f=0;f<n;f++)0===p&&(u=e[d++],p=32,m=0),p>=r?(l=u>>>m&h,p-=r,m+=r):(l=u>>>m&h,p=32-(c=r-p),l|=((u=e[d++])&(1<<c)-1)<<r-c,m=c),t[f]=i[l];else{var v=Math.ceil((s-a)/o);for(f=0;f<n;f++)0===p&&(u=e[d++],p=32,m=0),p>=r?(l=u>>>m&h,p-=r,m+=r):(l=u>>>m&h,p=32-(c=r-p),l|=((u=e[d++])&(1<<c)-1)<<r-c,m=c),t[f]=l<v?a+l*o:s}return t},l=function(e,t,r,n,i,a){var o,s=(1<<t)-1,f=0,l=0,u=0,c=0,h=0,d=0,p=[],m=Math.ceil((a-n)/i);for(l=0;l<r;l++)0===c&&(o=e[f++],c=32,d=0),c>=t?(h=o>>>d&s,c-=t,d+=t):(h=o>>>d&s,c=32-(u=t-c),h|=((o=e[f++])&(1<<u)-1)<<t-u,d=u),p[l]=h<m?n+h*i:a;return p.unshift(n),p},u=function(e,t,r,n){var i,a,o,s,f=(1<<r)-1,l=0,u=0,c=4*e.length-Math.ceil(r*n/8);for(e[e.length-1]<<=8*c,i=0;i<n;i++)0===u&&(o=e[l++],u=32),u>=r?(a=o>>>u-r&f,u-=r):(a=(o&f)<<(s=r-u)&f,a+=(o=e[l++])>>>(u=32-s)),t[i]=a;return t},c=function(e,t,r,n){var i,a,o,s,f=(1<<r)-1,l=0,u=0,c=0;for(i=0;i<n;i++)0===u&&(o=e[l++],u=32,c=0),u>=r?(a=o>>>c&f,u-=r,c+=r):(a=o>>>c&f,u=32-(s=r-u),a|=((o=e[l++])&(1<<s)-1)<<r-s,c=s),t[i]=a;return t},h={HUFFMAN_LUT_BITS_MAX:12,computeChecksumFletcher32:function(e){for(var t=65535,r=65535,n=e.length,i=Math.floor(n/2),a=0;i;){var o=i>=359?359:i;i-=o;do{t+=e[a++]<<8,r+=t+=e[a++]}while(--o);t=(65535&t)+(t>>>16),r=(65535&r)+(r>>>16)}return 1&n&&(r+=t+=e[a]<<8),((r=(65535&r)+(r>>>16))<<16|(t=(65535&t)+(t>>>16)))>>>0},readHeaderInfo:function(e,t){var r=t.ptr,n=new Uint8Array(e,r,6),i={};if(i.fileIdentifierString=String.fromCharCode.apply(null,n),0!==i.fileIdentifierString.lastIndexOf("Lerc2",0))throw"Unexpected file identifier string (expect Lerc2 ): "+i.fileIdentifierString;r+=6;var a,o=new DataView(e,r,8),s=o.getInt32(0,!0);if(i.fileVersion=s,r+=4,s>=3&&(i.checksum=o.getUint32(4,!0),r+=4),o=new DataView(e,r,12),i.height=o.getUint32(0,!0),i.width=o.getUint32(4,!0),r+=8,s>=4?(i.numDims=o.getUint32(8,!0),r+=4):i.numDims=1,o=new DataView(e,r,40),i.numValidPixel=o.getUint32(0,!0),i.microBlockSize=o.getInt32(4,!0),i.blobSize=o.getInt32(8,!0),i.imageType=o.getInt32(12,!0),i.maxZError=o.getFloat64(16,!0),i.zMin=o.getFloat64(24,!0),i.zMax=o.getFloat64(32,!0),r+=40,t.headerInfo=i,t.ptr=r,s>=3&&(a=s>=4?52:48,this.computeChecksumFletcher32(new Uint8Array(e,r-a,i.blobSize-14))!==i.checksum))throw"Checksum failed.";return!0},checkMinMaxRanges:function(e,t){var r=t.headerInfo,n=this.getDataTypeArray(r.imageType),i=r.numDims*this.getDataTypeSize(r.imageType),a=this.readSubArray(e,t.ptr,n,i),o=this.readSubArray(e,t.ptr+i,n,i);t.ptr+=2*i;var s,f=!0;for(s=0;s<r.numDims;s++)if(a[s]!==o[s]){f=!1;break}return r.minValues=a,r.maxValues=o,f},readSubArray:function(e,t,r,n){var i;if(r===Uint8Array)i=new Uint8Array(e,t,n);else{var a=new ArrayBuffer(n);new Uint8Array(a).set(new Uint8Array(e,t,n)),i=new r(a)}return i},readMask:function(e,t){var r,n,i=t.ptr,a=t.headerInfo,o=a.width*a.height,s=a.numValidPixel,f=new DataView(e,i,4),l={};if(l.numBytes=f.getUint32(0,!0),i+=4,(0===s||o===s)&&0!==l.numBytes)throw"invalid mask";if(0===s)r=new Uint8Array(Math.ceil(o/8)),l.bitset=r,n=new Uint8Array(o),t.pixels.resultMask=n,i+=l.numBytes;else if(l.numBytes>0){r=new Uint8Array(Math.ceil(o/8));var u=(f=new DataView(e,i,l.numBytes)).getInt16(0,!0),c=2,h=0,d=0;do{if(u>0)for(;u--;)r[h++]=f.getUint8(c++);else for(d=f.getUint8(c++),u=-u;u--;)r[h++]=d;u=f.getInt16(c,!0),c+=2}while(c<l.numBytes);if(-32768!==u||h<r.length)throw"Unexpected end of mask RLE encoding";n=new Uint8Array(o);var p=0,m=0;for(m=0;m<o;m++)7&m?(p=r[m>>3],p<<=7&m):p=r[m>>3],128&p&&(n[m]=1);t.pixels.resultMask=n,l.bitset=r,i+=l.numBytes}return t.ptr=i,t.mask=l,!0},readDataOneSweep:function(e,t,r,n){var i,a=t.ptr,o=t.headerInfo,s=o.numDims,f=o.width*o.height,l=o.imageType,u=o.numValidPixel*h.getDataTypeSize(l)*s,c=t.pixels.resultMask;if(r===Uint8Array)i=new Uint8Array(e,a,u);else{var d=new ArrayBuffer(u);new Uint8Array(d).set(new Uint8Array(e,a,u)),i=new r(d)}if(i.length===f*s)t.pixels.resultPixels=n?h.swapDimensionOrder(i,f,s,r,!0):i;else{t.pixels.resultPixels=new r(f*s);var p=0,m=0,v=0,y=0;if(s>1){if(n){for(m=0;m<f;m++)if(c[m])for(y=m,v=0;v<s;v++,y+=f)t.pixels.resultPixels[y]=i[p++]}else for(m=0;m<f;m++)if(c[m])for(y=m*s,v=0;v<s;v++)t.pixels.resultPixels[y+v]=i[p++]}else for(m=0;m<f;m++)c[m]&&(t.pixels.resultPixels[m]=i[p++])}return a+=u,t.ptr=a,!0},readHuffmanTree:function(e,t){var r=this.HUFFMAN_LUT_BITS_MAX,n=new DataView(e,t.ptr,16);if(t.ptr+=16,n.getInt32(0,!0)<2)throw"unsupported Huffman version";var i=n.getInt32(4,!0),a=n.getInt32(8,!0),o=n.getInt32(12,!0);if(a>=o)return!1;var s=new Uint32Array(o-a);h.decodeBits(e,t,s);var f,l,u,c,p=[];for(f=a;f<o;f++)p[l=f-(f<i?0:i)]={first:s[f-a],second:null};var m=e.byteLength-t.ptr,v=Math.ceil(m/4),y=new ArrayBuffer(4*v);new Uint8Array(y).set(new Uint8Array(e,t.ptr,m));var w,g=new Uint32Array(y),b=0,k=0;for(w=g[0],f=a;f<o;f++)(c=p[l=f-(f<i?0:i)].first)>0&&(p[l].second=w<<b>>>32-c,32-b>=c?32===(b+=c)&&(b=0,w=g[++k]):(b+=c-32,w=g[++k],p[l].second|=w>>>32-b));var x=0,_=0,A=new d;for(f=0;f<p.length;f++)void 0!==p[f]&&(x=Math.max(x,p[f].first));_=x>=r?r:x;var P,I,U,S,T,D=[];for(f=a;f<o;f++)if((c=p[l=f-(f<i?0:i)].first)>0)if(P=[c,l],c<=_)for(I=p[l].second<<_-c,U=1<<_-c,u=0;u<U;u++)D[I|u]=P;else for(I=p[l].second,T=A,S=c-1;S>=0;S--)I>>>S&1?(T.right||(T.right=new d),T=T.right):(T.left||(T.left=new d),T=T.left),0!==S||T.val||(T.val=P[1]);return{decodeLut:D,numBitsLUTQick:_,numBitsLUT:x,tree:A,stuffedData:g,srcPtr:k,bitPos:b}},readHuffman:function(e,t,r,n){var i,a,o,s,f,l,u,c,d,p=t.headerInfo.numDims,m=t.headerInfo.height,v=t.headerInfo.width,y=v*m,w=this.readHuffmanTree(e,t),g=w.decodeLut,b=w.tree,k=w.stuffedData,x=w.srcPtr,_=w.bitPos,A=w.numBitsLUTQick,P=w.numBitsLUT,I=0===t.headerInfo.imageType?128:0,U=t.pixels.resultMask,S=0;_>0&&(x++,_=0);var T,D=k[x],E=1===t.encodeMode,B=new r(y*p),O=B;if(p<2||E){for(T=0;T<p;T++)if(p>1&&(O=new r(B.buffer,y*T,y),S=0),t.headerInfo.numValidPixel===v*m)for(c=0,l=0;l<m;l++)for(u=0;u<v;u++,c++){if(a=0,f=s=D<<_>>>32-A,32-_<A&&(f=s|=k[x+1]>>>64-_-A),g[f])a=g[f][1],_+=g[f][0];else for(f=s=D<<_>>>32-P,32-_<P&&(f=s|=k[x+1]>>>64-_-P),i=b,d=0;d<P;d++)if(!(i=s>>>P-d-1&1?i.right:i.left).left&&!i.right){a=i.val,_=_+d+1;break}_>=32&&(_-=32,D=k[++x]),o=a-I,E?(o+=u>0?S:l>0?O[c-v]:S,o&=255,O[c]=o,S=o):O[c]=o}else for(c=0,l=0;l<m;l++)for(u=0;u<v;u++,c++)if(U[c]){if(a=0,f=s=D<<_>>>32-A,32-_<A&&(f=s|=k[x+1]>>>64-_-A),g[f])a=g[f][1],_+=g[f][0];else for(f=s=D<<_>>>32-P,32-_<P&&(f=s|=k[x+1]>>>64-_-P),i=b,d=0;d<P;d++)if(!(i=s>>>P-d-1&1?i.right:i.left).left&&!i.right){a=i.val,_=_+d+1;break}_>=32&&(_-=32,D=k[++x]),o=a-I,E?(u>0&&U[c-1]?o+=S:l>0&&U[c-v]?o+=O[c-v]:o+=S,o&=255,O[c]=o,S=o):O[c]=o}}else for(c=0,l=0;l<m;l++)for(u=0;u<v;u++)if(c=l*v+u,!U||U[c])for(T=0;T<p;T++,c+=y){if(a=0,f=s=D<<_>>>32-A,32-_<A&&(f=s|=k[x+1]>>>64-_-A),g[f])a=g[f][1],_+=g[f][0];else for(f=s=D<<_>>>32-P,32-_<P&&(f=s|=k[x+1]>>>64-_-P),i=b,d=0;d<P;d++)if(!(i=s>>>P-d-1&1?i.right:i.left).left&&!i.right){a=i.val,_=_+d+1;break}_>=32&&(_-=32,D=k[++x]),o=a-I,O[c]=o}t.ptr=t.ptr+4*(x+1)+(_>0?4:0),t.pixels.resultPixels=B,p>1&&!n&&(t.pixels.resultPixels=h.swapDimensionOrder(B,y,p,r))},decodeBits:function(e,t,r,n,i){var a=t.headerInfo,h=a.fileVersion,d=0,p=e.byteLength-t.ptr>=5?5:e.byteLength-t.ptr,m=new DataView(e,t.ptr,p),v=m.getUint8(0);d++;var y=v>>6,w=0===y?4:3-y,g=(32&v)>0,b=31&v,k=0;if(1===w)k=m.getUint8(d),d++;else if(2===w)k=m.getUint16(d,!0),d+=2;else{if(4!==w)throw"Invalid valid pixel count type";k=m.getUint32(d,!0),d+=4}var x,_,A,P,I,U,S,T,D,E=2*a.maxZError,B=a.numDims>1?a.maxValues[i]:a.zMax;if(g){for(t.counter.lut++,T=m.getUint8(d),d++,P=Math.ceil((T-1)*b/8),I=Math.ceil(P/4),_=new ArrayBuffer(4*I),A=new Uint8Array(_),t.ptr+=d,A.set(new Uint8Array(e,t.ptr,P)),S=new Uint32Array(_),t.ptr+=P,D=0;T-1>>>D;)D++;P=Math.ceil(k*D/8),I=Math.ceil(P/4),_=new ArrayBuffer(4*I),(A=new Uint8Array(_)).set(new Uint8Array(e,t.ptr,P)),x=new Uint32Array(_),t.ptr+=P,U=h>=3?l(S,b,T-1,n,E,B):s(S,b,T-1,n,E,B),h>=3?f(x,r,D,k,U):o(x,r,D,k,U)}else t.counter.bitstuffer++,D=b,t.ptr+=d,D>0&&(P=Math.ceil(k*D/8),I=Math.ceil(P/4),_=new ArrayBuffer(4*I),(A=new Uint8Array(_)).set(new Uint8Array(e,t.ptr,P)),x=new Uint32Array(_),t.ptr+=P,h>=3?null==n?c(x,r,D,k):f(x,r,D,k,!1,n,E,B):null==n?u(x,r,D,k):o(x,r,D,k,!1,n,E,B))},readTiles:function(e,t,r,n){var i=t.headerInfo,a=i.width,o=i.height,s=a*o,f=i.microBlockSize,l=i.imageType,u=h.getDataTypeSize(l),c=Math.ceil(a/f),d=Math.ceil(o/f);t.pixels.numBlocksY=d,t.pixels.numBlocksX=c,t.pixels.ptr=0;var p,m,v,y,w,g,b,k,x,_,A=0,P=0,I=0,U=0,S=0,T=0,D=0,E=0,B=0,O=0,M=0,C=0,L=0,R=0,V=0,G=new r(f*f),F=o%f||f,z=a%f||f,j=i.numDims,N=t.pixels.resultMask,Z=t.pixels.resultPixels,K=i.fileVersion>=5?14:15,H=i.zMax;for(I=0;I<d;I++)for(S=I!==d-1?f:F,U=0;U<c;U++)for(O=I*a*f+U*f,M=a-(T=U!==c-1?f:z),k=0;k<j;k++){if(j>1?(_=Z,O=I*a*f+U*f,Z=new r(t.pixels.resultPixels.buffer,s*k*u,s),H=i.maxValues[k]):_=null,D=e.byteLength-t.ptr,m={},V=0,E=(p=new DataView(e,t.ptr,Math.min(10,D))).getUint8(0),V++,x=i.fileVersion>=5?4&E:0,B=E>>6&255,(E>>2&K)!=(U*f>>3&K))throw"integrity issue";if(x&&0===k)throw"integrity issue";if((w=3&E)>3)throw t.ptr+=V,"Invalid block encoding ("+w+")";if(2!==w)if(0===w){if(x)throw"integrity issue";if(t.counter.uncompressed++,t.ptr+=V,C=(C=S*T*u)<(L=e.byteLength-t.ptr)?C:L,v=new ArrayBuffer(C%u==0?C:C+u-C%u),new Uint8Array(v).set(new Uint8Array(e,t.ptr,C)),y=new r(v),R=0,N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=y[R++]),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O++]=y[R++];O+=M}t.ptr+=R*u}else if(g=h.getDataTypeUsed(x&&l<6?4:l,B),b=h.getOnePixel(m,V,g,p),V+=h.getDataTypeSize(g),3===w)if(t.ptr+=V,t.counter.constantoffset++,N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=x?Math.min(H,_[O]+b):b),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O]=x?Math.min(H,_[O]+b):b,O++;O+=M}else if(t.ptr+=V,h.decodeBits(e,t,G,b,k),V=0,x)if(N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=G[V++]+_[O]),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O]=G[V++]+_[O],O++;O+=M}else if(N)for(A=0;A<S;A++){for(P=0;P<T;P++)N[O]&&(Z[O]=G[V++]),O++;O+=M}else for(A=0;A<S;A++){for(P=0;P<T;P++)Z[O++]=G[V++];O+=M}else{if(x)if(N)for(A=0;A<S;A++)for(P=0;P<T;P++)N[O]&&(Z[O]=_[O]),O++;else for(A=0;A<S;A++)for(P=0;P<T;P++)Z[O]=_[O],O++;t.counter.constant++,t.ptr+=V}}j>1&&!n&&(t.pixels.resultPixels=h.swapDimensionOrder(t.pixels.resultPixels,s,j,r))},formatFileInfo:function(e){return{fileIdentifierString:e.headerInfo.fileIdentifierString,fileVersion:e.headerInfo.fileVersion,imageType:e.headerInfo.imageType,height:e.headerInfo.height,width:e.headerInfo.width,numValidPixel:e.headerInfo.numValidPixel,microBlockSize:e.headerInfo.microBlockSize,blobSize:e.headerInfo.blobSize,maxZError:e.headerInfo.maxZError,pixelType:h.getPixelType(e.headerInfo.imageType),eofOffset:e.eofOffset,mask:e.mask?{numBytes:e.mask.numBytes}:null,pixels:{numBlocksX:e.pixels.numBlocksX,numBlocksY:e.pixels.numBlocksY,maxValue:e.headerInfo.zMax,minValue:e.headerInfo.zMin,noDataValue:e.noDataValue}}},constructConstantSurface:function(e,t){var r=e.headerInfo.zMax,n=e.headerInfo.zMin,i=e.headerInfo.maxValues,a=e.headerInfo.numDims,o=e.headerInfo.height*e.headerInfo.width,s=0,f=0,l=0,u=e.pixels.resultMask,c=e.pixels.resultPixels;if(u)if(a>1){if(t)for(s=0;s<a;s++)for(l=s*o,r=i[s],f=0;f<o;f++)u[f]&&(c[l+f]=r);else for(f=0;f<o;f++)if(u[f])for(l=f*a,s=0;s<a;s++)c[l+a]=i[s]}else for(f=0;f<o;f++)u[f]&&(c[f]=r);else if(a>1&&n!==r)if(t)for(s=0;s<a;s++)for(l=s*o,r=i[s],f=0;f<o;f++)c[l+f]=r;else for(f=0;f<o;f++)for(l=f*a,s=0;s<a;s++)c[l+s]=i[s];else for(f=0;f<o*a;f++)c[f]=r},getDataTypeArray:function(e){var t;switch(e){case 0:t=Int8Array;break;case 1:t=Uint8Array;break;case 2:t=Int16Array;break;case 3:t=Uint16Array;break;case 4:t=Int32Array;break;case 5:t=Uint32Array;break;case 6:default:t=Float32Array;break;case 7:t=Float64Array}return t},getPixelType:function(e){var t;switch(e){case 0:t="S8";break;case 1:t="U8";break;case 2:t="S16";break;case 3:t="U16";break;case 4:t="S32";break;case 5:t="U32";break;case 6:default:t="F32";break;case 7:t="F64"}return t},isValidPixelValue:function(e,t){if(null==t)return!1;var r;switch(e){case 0:r=t>=-128&&t<=127;break;case 1:r=t>=0&&t<=255;break;case 2:r=t>=-32768&&t<=32767;break;case 3:r=t>=0&&t<=65536;break;case 4:r=t>=-2147483648&&t<=2147483647;break;case 5:r=t>=0&&t<=4294967296;break;case 6:r=t>=-34027999387901484e22&&t<=34027999387901484e22;break;case 7:r=t>=-17976931348623157e292&&t<=17976931348623157e292;break;default:r=!1}return r},getDataTypeSize:function(e){var t=0;switch(e){case 0:case 1:t=1;break;case 2:case 3:t=2;break;case 4:case 5:case 6:t=4;break;case 7:t=8;break;default:t=e}return t},getDataTypeUsed:function(e,t){var r=e;switch(e){case 2:case 4:r=e-t;break;case 3:case 5:r=e-2*t;break;case 6:r=0===t?e:1===t?2:1;break;case 7:r=0===t?e:e-2*t+1;break;default:r=e}return r},getOnePixel:function(e,t,r,n){var i=0;switch(r){case 0:i=n.getInt8(t);break;case 1:i=n.getUint8(t);break;case 2:i=n.getInt16(t,!0);break;case 3:i=n.getUint16(t,!0);break;case 4:i=n.getInt32(t,!0);break;case 5:i=n.getUInt32(t,!0);break;case 6:i=n.getFloat32(t,!0);break;case 7:i=n.getFloat64(t,!0);break;default:throw"the decoder does not understand this pixel type"}return i},swapDimensionOrder:function(e,t,r,n,i){var a=0,o=0,s=0,f=0,l=e;if(r>1)if(l=new n(t*r),i)for(a=0;a<t;a++)for(f=a,s=0;s<r;s++,f+=t)l[f]=e[o++];else for(a=0;a<t;a++)for(f=a,s=0;s<r;s++,f+=t)l[o++]=e[f];return l}},d=function(e,t,r){this.val=e,this.left=t,this.right=r},{decode:function(e,t){var r=(t=t||{}).noDataValue,n=0,i={};i.ptr=t.inputOffset||0,i.pixels={},h.readHeaderInfo(e,i);var a=i.headerInfo,o=a.fileVersion,s=h.getDataTypeArray(a.imageType);if(o>5)throw"unsupported lerc version 2."+o;h.readMask(e,i),a.numValidPixel===a.width*a.height||i.pixels.resultMask||(i.pixels.resultMask=t.maskData);var f=a.width*a.height;i.pixels.resultPixels=new s(f*a.numDims),i.counter={onesweep:0,uncompressed:0,lut:0,bitstuffer:0,constant:0,constantoffset:0};var l,u=!t.returnPixelInterleavedDims;if(0!==a.numValidPixel)if(a.zMax===a.zMin)h.constructConstantSurface(i,u);else if(o>=4&&h.checkMinMaxRanges(e,i))h.constructConstantSurface(i,u);else{var c=new DataView(e,i.ptr,2),d=c.getUint8(0);if(i.ptr++,d)h.readDataOneSweep(e,i,s,u);else if(o>1&&a.imageType<=1&&Math.abs(a.maxZError-.5)<1e-5){var p=c.getUint8(1);if(i.ptr++,i.encodeMode=p,p>2||o<4&&p>1)throw"Invalid Huffman flag "+p;p?h.readHuffman(e,i,s,u):h.readTiles(e,i,s,u)}else h.readTiles(e,i,s,u)}i.eofOffset=i.ptr,t.inputOffset?(l=i.headerInfo.blobSize+t.inputOffset-i.ptr,Math.abs(l)>=1&&(i.eofOffset=t.inputOffset+i.headerInfo.blobSize)):(l=i.headerInfo.blobSize-i.ptr,Math.abs(l)>=1&&(i.eofOffset=i.headerInfo.blobSize));var m={width:a.width,height:a.height,pixelData:i.pixels.resultPixels,minValue:a.zMin,maxValue:a.zMax,validPixelCount:a.numValidPixel,dimCount:a.numDims,dimStats:{minValues:a.minValues,maxValues:a.maxValues},maskData:i.pixels.resultMask};if(i.pixels.resultMask&&h.isValidPixelValue(a.imageType,r)){var v=i.pixels.resultMask;for(n=0;n<f;n++)v[n]||(m.pixelData[n]=r);m.noDataValue=r}return i.noDataValue=r,t.returnFileInfo&&(m.fileInfo=h.formatFileInfo(i)),m},getBandCount:function(e){for(var t=0,r=0,n={ptr:0,pixels:{}};r<e.byteLength-58;)h.readHeaderInfo(e,n),r+=n.headerInfo.blobSize,t++,n.ptr=r;return t}}),w=(p=new ArrayBuffer(4),m=new Uint8Array(p),new Uint32Array(p)[0]=1,1===m[0]),g={decode:function(e,t){if(!w)throw"Big endian system is not supported.";var r,n,i=(t=t||{}).inputOffset||0,a=new Uint8Array(e,i,10),o=String.fromCharCode.apply(null,a);if("CntZImage"===o.trim())r=v,n=1;else{if("Lerc2"!==o.substring(0,5))throw"Unexpected file identifier string: "+o;r=y,n=2}for(var s,f,l,u,c,h,d=0,p=e.byteLength-10,m=[],g={width:0,height:0,pixels:[],pixelType:t.pixelType,mask:null,statistics:[]},b=0;i<p;){var k=r.decode(e,{inputOffset:i,encodedMaskData:s,maskData:l,returnMask:0===d,returnEncodedMask:0===d,returnFileInfo:!0,returnPixelInterleavedDims:t.returnPixelInterleavedDims,pixelType:t.pixelType||null,noDataValue:t.noDataValue||null});i=k.fileInfo.eofOffset,l=k.maskData,0===d&&(s=k.encodedMaskData,g.width=k.width,g.height=k.height,g.dimCount=k.dimCount||1,g.pixelType=k.pixelType||k.fileInfo.pixelType,g.mask=l),n>1&&(l&&m.push(l),k.fileInfo.mask&&k.fileInfo.mask.numBytes>0&&b++),d++,g.pixels.push(k.pixelData),g.statistics.push({minValue:k.minValue,maxValue:k.maxValue,noDataValue:k.noDataValue,dimStats:k.dimStats})}if(n>1&&b>1){for(h=g.width*g.height,g.bandMasks=m,(l=new Uint8Array(h)).set(m[0]),u=1;u<m.length;u++)for(f=m[u],c=0;c<h;c++)l[c]=l[c]&f[c];g.maskData=l}return g}};Ke.exports?Ke.exports=g:this.Lerc=g}();var We=Xe.exports,qe={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Je={};for(var Qe in qe)qe.hasOwnProperty(Qe)&&(Je[qe[Qe]]=parseInt(Qe,10));Je.BitsPerSample,Je.ExtraSamples,Je.SampleFormat,Je.StripByteCounts,Je.StripOffsets,Je.StripRowCounts,Je.TileByteCounts,Je.TileOffsets,Je.SubIFDs;var $e={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},et={};for(var tt in $e)$e.hasOwnProperty(tt)&&(et[$e[tt]]=parseInt(tt,10));var rt=1,nt=0,it=1,at={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},ot={};for(var st in at)at.hasOwnProperty(st)&&(ot[at[st]]=parseInt(st,10));function ft(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var lt=function(e){p(r,b);var t=ft(r);function r(e){var n;return u(this,r),(n=t.call(this)).planarConfiguration=void 0!==e.PlanarConfiguration?e.PlanarConfiguration:1,n.samplesPerPixel=void 0!==e.SamplesPerPixel?e.SamplesPerPixel:1,n.addCompression=e.LercParameters[rt],n}return h(r,[{key:"decodeBlock",value:function(e){switch(this.addCompression){case nt:break;case it:e=Fe(new Uint8Array(e)).buffer;break;default:throw new Error("Unsupported LERC additional compression method identifier: ".concat(this.addCompression))}return We.decode(e,{returnPixelInterleavedDims:1===this.planarConfiguration}).pixels[0].buffer}}]),r}(),ut=Object.freeze({__proto__:null,default:lt});function ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return m(this,r)}}var ht=function(e){p(a,b);var r,n=ct(a);function a(){var e;if(u(this,a),e=n.call(this),"undefined"==typeof createImageBitmap)throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");if("undefined"==typeof document&&"undefined"==typeof OffscreenCanvas)throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available");return e}return h(a,[{key:"decode",value:(r=t(i.mark((function e(t,r){var n,a,o,s;return i.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Blob([r]),e.next=3,createImageBitmap(n);case 3:return a=e.sent,"undefined"!=typeof document?((o=document.createElement("canvas")).width=a.width,o.height=a.height):o=new OffscreenCanvas(a.width,a.height),(s=o.getContext("2d")).drawImage(a,0,0),e.abrupt("return",s.getImageData(0,0,a.width,a.height).data.buffer);case 8:case"end":return e.stop()}}),e)}))),function(e,t){return r.apply(this,arguments)})}]),a}(),dt=Object.freeze({__proto__:null,default:ht});';return new U8(typeof Blob=="undefined"?"data:application/javascript;base64,"+Buffer.from(n,"binary").toString("base64"):URL.createObjectURL(new Blob([n],{type:"application/javascript"})))}var z8=Object.freeze(Object.defineProperty({__proto__:null,create:B8},Symbol.toStringTag,{value:"Module"}));export{Lc as AssertionError,St as Collection,ks as Disposable,Ne as Feature,Vv as Geolocation,Cm as Graticule,la as Image,Ul as ImageBase,Bl as ImageCanvas,no as ImageTile,Ng as Kinetic,gp as Map,gi as MapBrowserEvent,Kg as MapBrowserEventHandler,Qr as MapEvent,Rn as Object,Mc as Observable,pp as Overlay,Nr as Tile,Ql as TileCache,fh as TileQueue,eu as TileRange,Yd as VERSION,_p as VectorRenderTile,yp as VectorTile,Fi as View,H as getUid,Lc as ol$AssertionError,St as ol$Collection,Rl as ol$Collection$CollectionEvent,gt as ol$CollectionEventType,Hd as ol$DataTile,ks as ol$Disposable,Ne as ol$Feature,ky as ol$Feature$createStyleFunction,Vv as ol$Geolocation,Cm as ol$Graticule,la as ol$Image,lh as ol$Image$listenImage,Ul as ol$ImageBase,Bl as ol$ImageCanvas,ce as ol$ImageState,no as ol$ImageTile,Ng as ol$Kinetic,gp as ol$Map,gi as ol$MapBrowserEvent,Kg as ol$MapBrowserEventHandler,Ie as ol$MapBrowserEventType,Qr as ol$MapEvent,Hn as ol$MapEventType,vt as ol$MapProperty,Rn as ol$Object,Zd as ol$Object$ObjectEvent,Mr as ol$ObjectEventType,Mc as ol$Observable,$y as ol$Observable$unByKey,pp as ol$Overlay,Nr as ol$Tile,Ql as ol$TileCache,fh as ol$TileQueue,lx as ol$TileQueue$getTilePriority,eu as ol$TileRange,lo as ol$TileRange$createOrUpdate,V as ol$TileState,Yd as ol$VERSION,_p as ol$VectorRenderTile,yp as ol$VectorTile,Fi as ol$View,gx as ol$View$createCenterConstraint,px as ol$View$createResolutionConstraint,mx as ol$View$createRotationConstraint,_x as ol$View$isNoopAnimation,Ye as ol$ViewHint,Ln as ol$ViewProperty,Ly as ol$array$binarySearch,Ai as ol$array$equals,Oe as ol$array$extend,My as ol$array$isSorted,bl as ol$array$linearFindNearest,ir as ol$array$numberSafeCompareFunction,vC as ol$array$remove,Py as ol$array$reverseSubArray,xC as ol$array$stableSort,ne as ol$asserts$assert,Jg as ol$centerconstraint$createExtent,ux as ol$centerconstraint$none,Kr as ol$color$asArray,kg as ol$color$asString,Gg as ol$color$fromString,Kv as ol$color$isStringColor,Ug as ol$color$normalize,Bg as ol$color$toString,mi as ol$colorlike$asColorLike,yx as ol$control$Attribution,Oi as ol$control$Control,n2 as ol$control$FullScreen,r2 as ol$control$MousePosition,o2 as ol$control$OverviewMap,vx as ol$control$Rotate,u2 as ol$control$ScaleLine,xx as ol$control$Zoom,h2 as ol$control$ZoomSlider,d2 as ol$control$ZoomToExtent,sp as ol$control$defaults,sp as ol$control$defaults$defaults,fg as ol$coordinate$add,fv as ol$coordinate$closestOnCircle,Pl as ol$coordinate$closestOnSegment,UC as ol$coordinate$createStringXY,Ml as ol$coordinate$degreesToStringHDMS,na as ol$coordinate$distance,Wn as ol$coordinate$equals,dv as ol$coordinate$format,gg as ol$coordinate$getWorldsAway,Vc as ol$coordinate$rotate,dg as ol$coordinate$scale,Gn as ol$coordinate$squaredDistance,jc as ol$coordinate$squaredDistanceToSegment,BC as ol$coordinate$toStringHDMS,gv as ol$coordinate$toStringXY,Xc as ol$coordinate$wrapX,Xl as ol$css$CLASS_COLLAPSED,qr as ol$css$CLASS_CONTROL,jl as ol$css$CLASS_HIDDEN,ex as ol$css$CLASS_SELECTABLE,fi as ol$css$CLASS_UNSELECTABLE,Vg as ol$css$CLASS_UNSUPPORTED,jg as ol$css$getFontParameters,yt as ol$dom$createCanvasContext2D,Xv as ol$dom$outerHeight,jv as ol$dom$outerWidth,uh as ol$dom$releaseCanvas,Dg as ol$dom$removeChildren,zl as ol$dom$removeNode,Yv as ol$dom$replaceChildren,to as ol$dom$replaceNode,Wd as ol$easing$easeIn,Dr as ol$easing$easeOut,Fc as ol$easing$inAndOut,Ny as ol$easing$linear,bC as ol$easing$upAndDown,Ct as ol$events$Event,_C as ol$events$Event$preventDefault,Ay as ol$events$Event$stopPropagation,K as ol$events$EventType,es as ol$events$KeyCode,Gs as ol$events$Target,_h as ol$events$condition$all,Tx as ol$events$condition$altKeyOnly,Sx as ol$events$condition$altShiftKeysOnly,oo as ol$events$condition$always,LI as ol$events$condition$click,MI as ol$events$condition$doubleClick,bx as ol$events$condition$focus,op as ol$events$condition$focusWithTabindex,ap as ol$events$condition$mouseActionButton,ao as ol$events$condition$mouseOnly,yh as ol$events$condition$never,vh as ol$events$condition$noModifierKeys,$I as ol$events$condition$penOnly,FI as ol$events$condition$platformModifierKeyOnly,PI as ol$events$condition$pointerMove,cp as ol$events$condition$primaryAction,Jl as ol$events$condition$shiftKeyOnly,lp as ol$events$condition$singleClick,up as ol$events$condition$targetNotEditable,OI as ol$events$condition$touchOnly,re as ol$events$listen,Us as ol$events$listenOnce,Pe as ol$events$unlistenByKey,Pt as ol$extent$Relationship,Zs as ol$extent$applyTransform,Wy as ol$extent$approximatelyEquals,pt as ol$extent$boundingExtent,hn as ol$extent$buffer,eg as ol$extent$clone,Br as ol$extent$closestSquaredDistanceXY,jn as ol$extent$containsCoordinate,Mt as ol$extent$containsExtent,Dc as ol$extent$containsXY,Nc as ol$extent$coordinateRelationship,Ft as ol$extent$createEmpty,Cn as ol$extent$createOrUpdate,zr as ol$extent$createOrUpdateEmpty,zs as ol$extent$createOrUpdateFromCoordinate,PC as ol$extent$createOrUpdateFromCoordinates,kc as ol$extent$createOrUpdateFromFlatCoordinates,MC as ol$extent$createOrUpdateFromRings,In as ol$extent$equals,tg as ol$extent$extend,Vs as ol$extent$extendCoordinate,ng as ol$extent$extendCoordinates,ig as ol$extent$extendFlatCoordinates,Hy as ol$extent$extendRings,Ky as ol$extent$extendXY,Gc as ol$extent$forEachCorner,Jo as ol$extent$getArea,js as ol$extent$getBottomLeft,Xs as ol$extent$getBottomRight,Ot as ol$extent$getCenter,qy as ol$extent$getCorner,FC as ol$extent$getEnlargedArea,Ys as ol$extent$getForViewAndSize,Xe as ol$extent$getHeight,zt as ol$extent$getIntersection,OC as ol$extent$getIntersectionArea,$C as ol$extent$getMargin,Uc as ol$extent$getRotatedViewport,DC as ol$extent$getSize,Xn as ol$extent$getTopLeft,Qo as ol$extent$getTopRight,_e as ol$extent$getWidth,Je as ol$extent$intersects,Qy as ol$extent$intersectsSegment,Vr as ol$extent$isEmpty,Jy as ol$extent$returnOrUpdate,Il as ol$extent$scaleFromCenter,ev as ol$extent$wrapAndSliceX,Bc as ol$extent$wrapX,wp as ol$featureloader$loadFeaturesXhr,g2 as ol$featureloader$setWithCredentials,Tp as ol$featureloader$xhr,O2 as ol$format$EsriJSON,va as ol$format$Feature,Rh as ol$format$Feature$transformExtentWithOptions,nt as ol$format$Feature$transformGeometryWithOptions,V2 as ol$format$GML,fo as ol$format$GML2,we as ol$format$GML3,Oh as ol$format$GML32,Ee as ol$format$GMLBase,Di as ol$format$GMLBase$GMLNS,wA as ol$format$GPX,o1 as ol$format$GeoJSON,jA as ol$format$IGC,qA as ol$format$IIIFInfo,bt as ol$format$IIIFInfo$Versions,Ih as ol$format$JSONFeature,VP as ol$format$KML,oL as ol$format$KML$getDefaultFillStyle,aL as ol$format$KML$getDefaultImageStyle,lL as ol$format$KML$getDefaultStrokeStyle,cL as ol$format$KML$getDefaultStyle,hL as ol$format$KML$getDefaultStyleArray,uL as ol$format$KML$getDefaultTextStyle,jp as ol$format$KML$readFlatCoordinates,Jp as ol$format$MVT,wM as ol$format$OSMXML,X1 as ol$format$OWS,tF as ol$format$Polyline,Z1 as ol$format$Polyline$decodeDeltas,H1 as ol$format$Polyline$decodeFloats,q1 as ol$format$Polyline$decodeSignedIntegers,Q1 as ol$format$Polyline$decodeUnsignedIntegers,Y1 as ol$format$Polyline$encodeDeltas,W1 as ol$format$Polyline$encodeFloats,K1 as ol$format$Polyline$encodeSignedIntegers,eE as ol$format$Polyline$encodeUnsignedInteger,J1 as ol$format$Polyline$encodeUnsignedIntegers,Dh as ol$format$TextFeature,dF as ol$format$TopoJSON,dO as ol$format$WFS,fO as ol$format$WFS$writeFilter,yO as ol$format$WKB,PO as ol$format$WKT,f$ as ol$format$WMSCapabilities,m$ as ol$format$WMSGetFeatureInfo,U$ as ol$format$WMTSCapabilities,qh as ol$format$XML,co as ol$format$XMLFeature,nE as ol$format$filter$And,iE as ol$format$filter$Bbox,Ia as ol$format$filter$Comparison,yo as ol$format$filter$ComparisonBinary,rE as ol$format$filter$Contains,sE as ol$format$filter$DWithin,oE as ol$format$filter$Disjoint,aE as ol$format$filter$During,lE as ol$format$filter$EqualTo,_o as ol$format$filter$Filter,uE as ol$format$filter$GreaterThan,cE as ol$format$filter$GreaterThanOrEqualTo,hE as ol$format$filter$Intersects,fE as ol$format$filter$IsBetween,dE as ol$format$filter$IsLike,gE as ol$format$filter$IsNull,pE as ol$format$filter$LessThan,mE as ol$format$filter$LessThanOrEqualTo,nm as ol$format$filter$LogicalNary,_E as ol$format$filter$Not,yE as ol$format$filter$NotEqualTo,vE as ol$format$filter$Or,xE as ol$format$filter$ResourceId,Ca as ol$format$filter$Spatial,EE as ol$format$filter$Within,wE as ol$format$filter$and,TE as ol$format$filter$bbox,QF as ol$format$filter$between,BF as ol$format$filter$contains,VF as ol$format$filter$disjoint,tO as ol$format$filter$during,XF as ol$format$filter$dwithin,YF as ol$format$filter$equalTo,KF as ol$format$filter$greaterThan,qF as ol$format$filter$greaterThanOrEqualTo,zF as ol$format$filter$intersects,JF as ol$format$filter$isNull,WF as ol$format$filter$lessThan,HF as ol$format$filter$lessThanOrEqualTo,eO as ol$format$filter$like,UF as ol$format$filter$not,ZF as ol$format$filter$notEqualTo,GF as ol$format$filter$or,nO as ol$format$filter$resourceId,jF as ol$format$filter$within,mo as ol$format$xlink$readHref,lr as ol$format$xsd$readBoolean,ns as ol$format$xsd$readBooleanString,Fh as ol$format$xsd$readDateTime,$e as ol$format$xsd$readDecimal,Ni as ol$format$xsd$readDecimalString,ki as ol$format$xsd$readNonNegativeIntegerString,Et as ol$format$xsd$readPositiveInteger,j as ol$format$xsd$readString,ho as ol$format$xsd$writeBooleanTextNode,e1 as ol$format$xsd$writeCDATASection,t1 as ol$format$xsd$writeDateTimeTextNode,_n as ol$format$xsd$writeDecimalTextNode,ou as ol$format$xsd$writeNonNegativeIntegerTextNode,fe as ol$format$xsd$writeStringTextNode,Fr as ol$functions$FALSE,kn as ol$functions$TRUE,Or as ol$functions$VOID,Fy as ol$functions$memoizeOne,Oy as ol$functions$toPromise,qp as ol$geom$Circle,Tg as ol$geom$Geometry,Vt as ol$geom$GeometryCollection,lt as ol$geom$LineString,aa as ol$geom$LinearRing,gn as ol$geom$MultiLineString,qn as ol$geom$MultiPoint,Bn as ol$geom$MultiPolygon,st as ol$geom$Point,Dt as ol$geom$Polygon,zv as ol$geom$Polygon$circular,Gl as ol$geom$Polygon$fromCircle,eo as ol$geom$Polygon$fromExtent,$g as ol$geom$Polygon$makeRegular,hi as ol$geom$SimpleGeometry,ra as ol$geom$SimpleGeometry$getStrideForLayout,Cv as ol$geom$SimpleGeometry$transformGeom2D,rh as ol$geom$flat$area$linearRing,Cg as ol$geom$flat$area$linearRings,$v as ol$geom$flat$area$linearRingss,Sp as ol$geom$flat$center$linearRingss,Qc as ol$geom$flat$closest$arrayMaxSquaredDelta,th as ol$geom$flat$closest$assignClosestArrayPoint,Lv as ol$geom$flat$closest$assignClosestMultiArrayPoint,eh as ol$geom$flat$closest$assignClosestPoint,Jc as ol$geom$flat$closest$maxSquaredDelta,Av as ol$geom$flat$closest$multiArrayMaxSquaredDelta,Dv as ol$geom$flat$contains$linearRingContainsExtent,Hr as ol$geom$flat$contains$linearRingContainsXY,sh as ol$geom$flat$contains$linearRingsContainsXY,Nv as ol$geom$flat$contains$linearRingssContainsXY,Sg as ol$geom$flat$deflate$deflateCoordinate,sa as ol$geom$flat$deflate$deflateCoordinates,nh as ol$geom$flat$deflate$deflateCoordinatesArray,Pv as ol$geom$flat$deflate$deflateMultiCoordinatesArray,em as ol$geom$flat$flip$flipXY,B$ as ol$geom$flat$geodesic$greatCircleArc,aw as ol$geom$flat$geodesic$meridian,lw as ol$geom$flat$geodesic$parallel,Pi as ol$geom$flat$inflate$inflateCoordinates,oa as ol$geom$flat$inflate$inflateCoordinatesArray,ih as ol$geom$flat$inflate$inflateMultiCoordinatesArray,oh as ol$geom$flat$interiorpoint$getInteriorPointOfArray,Ig as ol$geom$flat$interiorpoint$getInteriorPointsOfMultiArray,iu as ol$geom$flat$interpolate$interpolatePoint,Ah as ol$geom$flat$interpolate$lineStringCoordinateAtM,Hx as ol$geom$flat$interpolate$lineStringsCoordinateAtM,Nl as ol$geom$flat$intersectsextent$intersectsLineString,kv as ol$geom$flat$intersectsextent$intersectsLineStringArray,Lg as ol$geom$flat$intersectsextent$intersectsLinearRing,Pg as ol$geom$flat$intersectsextent$intersectsLinearRingArray,Gv as ol$geom$flat$intersectsextent$intersectsLinearRingMultiArray,Lh as ol$geom$flat$length$lineStringLength,_2 as ol$geom$flat$length$linearRingLength,Og as ol$geom$flat$orient$inflateEnds,kl as ol$geom$flat$orient$linearRingIsClockwise,Mg as ol$geom$flat$orient$linearRingsAreOriented,Bv as ol$geom$flat$orient$linearRingssAreOriented,ah as ol$geom$flat$orient$orientLinearRings,Fg as ol$geom$flat$orient$orientLinearRingsArray,Uv as ol$geom$flat$reverse$coordinates,Ag as ol$geom$flat$segments$forEach,Dl as ol$geom$flat$simplify$douglasPeucker,bg as ol$geom$flat$simplify$douglasPeuckerArray,qC as ol$geom$flat$simplify$douglasPeuckerMultiArray,Fv as ol$geom$flat$simplify$quantize,Rg as ol$geom$flat$simplify$quantizeArray,Ov as ol$geom$flat$simplify$quantizeMultiArray,Mv as ol$geom$flat$simplify$radialDistance,KC as ol$geom$flat$simplify$simplifyLineString,Wr as ol$geom$flat$simplify$snap,uw as ol$geom$flat$straightchunk$matchingChunk,cw as ol$geom$flat$textpath$drawTextOnPath,z$ as ol$geom$flat$topology$lineStringIsClosed,qc as ol$geom$flat$transform$rotate,bv as ol$geom$flat$transform$scale,ci as ol$geom$flat$transform$transform2D,wg as ol$geom$flat$transform$translate,H as ol$getUid,Oc as ol$has$DEVICE_PIXEL_RATIO,Gy as ol$has$FIREFOX,Vy as ol$has$IMAGE_DECODE,Kd as ol$has$MAC,qd as ol$has$PASSIVE_EVENT_LISTENERS,Uy as ol$has$SAFARI,By as ol$has$SAFARI_BUG_237906,zy as ol$has$WEBKIT,$c as ol$has$WORKER_OFFSCREEN_CANVAS,wx as ol$interaction$DoubleClickZoom,GD as ol$interaction$DragAndDrop,Cw as ol$interaction$DragAndDrop$DragAndDropEvent,Ax as ol$interaction$DragBox,Eh as ol$interaction$DragBox$DragBoxEvent,Rx as ol$interaction$DragPan,Cx as ol$interaction$DragRotate,BD as ol$interaction$DragRotateAndZoom,Lx as ol$interaction$DragZoom,HD as ol$interaction$Draw,Ru as ol$interaction$Draw$DrawEvent,ZD as ol$interaction$Draw$createBox,YD as ol$interaction$Draw$createRegularPolygon,tN as ol$interaction$Extent,Lw as ol$interaction$Extent$ExtentEvent,ar as ol$interaction$Interaction,Ex as ol$interaction$Interaction$pan,ph as ol$interaction$Interaction$zoomByDelta,Px as ol$interaction$KeyboardPan,Mx as ol$interaction$KeyboardZoom,sN as ol$interaction$Link,uN as ol$interaction$Modify,mf as ol$interaction$Modify$ModifyEvent,Fx as ol$interaction$MouseWheelZoom,Ox as ol$interaction$PinchRotate,$x as ol$interaction$PinchZoom,Kn as ol$interaction$Pointer,mh as ol$interaction$Pointer$centroid,ql as ol$interaction$Property,fN as ol$interaction$Select,Nw as ol$interaction$Select$SelectEvent,gN as ol$interaction$Snap,mN as ol$interaction$Translate,yf as ol$interaction$Translate$TranslateEvent,hp as ol$interaction$defaults,hp as ol$interaction$defaults$defaults,zg as ol$layer$Base,Gw as ol$layer$BaseImage,Fm as ol$layer$BaseTile,vo as ol$layer$BaseVector,Cm as ol$layer$Graticule,Hl as ol$layer$Group,or as ol$layer$Group$GroupEvent,tk as ol$layer$Heatmap,sT as ol$layer$Image,io as ol$layer$Layer,ch as ol$layer$Layer$inView,fG as ol$layer$MapboxVector,Ge as ol$layer$Property,xT as ol$layer$Tile,mr as ol$layer$TileProperty,ls as ol$layer$Vector,pG as ol$layer$VectorImage,$u as ol$layer$VectorTile,RG as ol$layer$WebGLPoints,CG as ol$layer$WebGLTile,bw as ol$loadingstrategy$all,AD as ol$loadingstrategy$bbox,LD as ol$loadingstrategy$tile,sr as ol$math$ceil,ye as ol$math$clamp,Qs as ol$math$floor,Li as ol$math$lerp,Zn as ol$math$modulo,cg as ol$math$round,hv as ol$math$solveLinearSystem,li as ol$math$squaredDistance,ug as ol$math$squaredSegmentDistance,Ll as ol$math$toDegrees,Js as ol$math$toFixed,$t as ol$math$toRadians,_T as ol$net$ClientError,mT as ol$net$ResponseError,n_ as ol$net$getJSON,Nu as ol$net$jsonp,vk as ol$net$overrideXHR,i_ as ol$net$resolveUrl,xk as ol$net$restoreXHR,$r as ol$obj$clear,oi as ol$obj$isEmpty,IG as ol$pixel$nothing,pi as ol$pointer$EventType,Yn as ol$proj$METERS_PER_UNIT,Ws as ol$proj$Projection,Yn as ol$proj$Units$METERS_PER_UNIT,rg as ol$proj$Units$fromCode,Sv as ol$proj$addCommon,xv as ol$proj$addCoordinateTransforms,Hc as ol$proj$addEquivalentProjections,vv as ol$proj$addEquivalentTransforms,yg as ol$proj$addProjection,yv as ol$proj$addProjections,zC as ol$proj$clearAllProjections,XC as ol$proj$clearUserProjection,Wc as ol$proj$cloneTransform,Kc as ol$proj$createProjection,Eg as ol$proj$createSafeCoordinateTransform,vg as ol$proj$createTransformFromCoordinateTransform,_g as ol$proj$disableCoordinateWarning,tv as ol$proj$epsg3857$EXTENT,Hs as ol$proj$epsg3857$HALF_SIZE,Al as ol$proj$epsg3857$MAX_SAFE_Y,sg as ol$proj$epsg3857$PROJECTIONS,ea as ol$proj$epsg3857$RADIUS,nv as ol$proj$epsg3857$WORLD_EXTENT,iv as ol$proj$epsg3857$fromEPSG4326,rv as ol$proj$epsg3857$toEPSG4326,og as ol$proj$epsg4326$EXTENT,ov as ol$proj$epsg4326$METERS_PER_UNIT,ag as ol$proj$epsg4326$PROJECTIONS,sv as ol$proj$epsg4326$RADIUS,fn as ol$proj$equivalent,xg as ol$proj$fromLonLat,Qe as ol$proj$fromUserCoordinate,An as ol$proj$fromUserExtent,Tv as ol$proj$fromUserResolution,J as ol$proj$get,$l as ol$proj$getPointResolution,ui as ol$proj$getTransform,Un as ol$proj$getTransformFromProjections,Ht as ol$proj$getUserProjection,Ol as ol$proj$identityTransform,AG as ol$proj$proj4$register,uv as ol$proj$projections$add,av as ol$proj$projections$clear,lv as ol$proj$projections$get,Ev as ol$proj$setUserProjection,VC as ol$proj$toLonLat,Yr as ol$proj$toUserCoordinate,Zr as ol$proj$toUserExtent,wv as ol$proj$toUserResolution,Xr as ol$proj$transform,ia as ol$proj$transformExtent,jC as ol$proj$transformWithProjections,qs as ol$proj$transforms$add,cv as ol$proj$transforms$clear,lg as ol$proj$transforms$get,GC as ol$proj$transforms$remove,YC as ol$proj$useGeographic,Ix as ol$render$Box,ua as ol$render$Event,nn as ol$render$EventType,Kh as ol$render$Feature,lM as ol$render$Feature$toFeature,V1 as ol$render$Feature$toGeometry,ym as ol$render$VectorContext,Fa as ol$render$canvas$Builder,wu as ol$render$canvas$BuilderGroup,vw as ol$render$canvas$Executor,Tu as ol$render$canvas$ExecutorGroup,xw as ol$render$canvas$ExecutorGroup$getPixelIndexArray,gw as ol$render$canvas$ImageBuilder,lf as ol$render$canvas$Immediate,pe as ol$render$canvas$Instruction,ss as ol$render$canvas$Instruction$beginPathInstruction,_m as ol$render$canvas$Instruction$closePathInstruction,Eu as ol$render$canvas$Instruction$fillInstruction,fr as ol$render$canvas$Instruction$strokeInstruction,pw as ol$render$canvas$LineStringBuilder,vm as ol$render$canvas$PolygonBuilder,mw as ol$render$canvas$TextBuilder,Oa as ol$render$canvas$TextBuilder$TEXT_ALIGN,di as ol$render$canvas$checkedFonts,Mi as ol$render$canvas$defaultFillStyle,Xg as ol$render$canvas$defaultFont,Yl as ol$render$canvas$defaultLineCap,ca as ol$render$canvas$defaultLineDash,ha as ol$render$canvas$defaultLineDashOffset,ro as ol$render$canvas$defaultLineJoin,pa as ol$render$canvas$defaultLineWidth,fa as ol$render$canvas$defaultMiterLimit,Jr as ol$render$canvas$defaultPadding,da as ol$render$canvas$defaultStrokeStyle,ga as ol$render$canvas$defaultTextAlign,Zl as ol$render$canvas$defaultTextBaseline,sx as ol$render$canvas$drawImageOrLabel,rx as ol$render$canvas$getTextDimensions,Mn as ol$render$canvas$hitdetect$HIT_DETECT_RESOLUTION,Sm as ol$render$canvas$hitdetect$createHitDetectionImageData,bm as ol$render$canvas$hitdetect$hitDetect,Wg as ol$render$canvas$measureAndCacheTextWidth,nx as ol$render$canvas$measureTextHeight,Wl as ol$render$canvas$measureTextWidth,Zg as ol$render$canvas$registerFont,gI as ol$render$canvas$rotateAtOffset,hh as ol$render$canvas$textHeights,FD as ol$render$getRenderPixel,Rw as ol$render$getVectorContext,MD as ol$render$toContext,Jf as ol$render$webgl$BatchRenderer,PS as ol$render$webgl$LineStringBatchRenderer,Qf as ol$render$webgl$LineStringBatchRenderer$Attributes,MS as ol$render$webgl$MixedGeometryBatch,FS as ol$render$webgl$PointBatchRenderer,H_ as ol$render$webgl$PointBatchRenderer$Attributes,$S as ol$render$webgl$PolygonBatchRenderer,OS as ol$render$webgl$PolygonBatchRenderer$Attributes,xo as ol$render$webgl$constants$WebGLWorkerMessageType,iT as ol$render$webgl$utils$colorDecodeId,nT as ol$render$webgl$utils$colorEncodeId,KN as ol$render$webgl$utils$getBlankImageData,WN as ol$render$webgl$utils$writeLineSegmentToBuffers,ZN as ol$render$webgl$utils$writePointFeatureToBuffers,HN as ol$render$webgl$utils$writePolygonTrianglesToBuffers,ox as ol$renderer$Composite,xm as ol$renderer$Layer,Qv as ol$renderer$Map,jm as ol$renderer$canvas$ImageLayer,af as ol$renderer$canvas$Layer,Em as ol$renderer$canvas$Layer$canvasPool,qm as ol$renderer$canvas$TileLayer,fS as ol$renderer$canvas$VectorImageLayer,Rm as ol$renderer$canvas$VectorLayer,uT as ol$renderer$canvas$VectorTileLayer,ww as ol$renderer$vector$defaultOrder,uf as ol$renderer$vector$getSquaredTolerance,cf as ol$renderer$vector$getTolerance,Su as ol$renderer$vector$renderFeature,Tf as ol$renderer$webgl$Layer,Vm as ol$renderer$webgl$PointsLayer,yS as ol$renderer$webgl$TileLayer,Hu as ol$renderer$webgl$TileLayer$Attributes,xe as ol$renderer$webgl$TileLayer$Uniforms,NG as ol$renderer$webgl$VectorLayer,NS as ol$renderer$webgl$shaders$FILL_FRAGMENT_SHADER,DS as ol$renderer$webgl$shaders$FILL_VERTEX_SHADER,BS as ol$renderer$webgl$shaders$POINT_FRAGMENT_SHADER,US as ol$renderer$webgl$shaders$POINT_VERTEX_SHADER,GS as ol$renderer$webgl$shaders$STROKE_FRAGMENT_SHADER,kS as ol$renderer$webgl$shaders$STROKE_VERTEX_SHADER,ed as ol$renderer$webgl$shaders$packColor,zS as ol$reproj$Image,wo as ol$reproj$Tile,Ym as ol$reproj$Triangulation,lT as ol$reproj$calculateSourceExtentResolution,za as ol$reproj$calculateSourceResolution,Wm as ol$reproj$canvasPool,Xm as ol$reproj$common$ERROR_THRESHOLD,Km as ol$reproj$render,tp as ol$resolutionconstraint$createMinMaxResolution,hx as ol$resolutionconstraint$createSnapToPower,cx as ol$resolutionconstraint$createSnapToResolutions,fx as ol$rotationconstraint$createSnapToN,dx as ol$rotationconstraint$createSnapToZero,dh as ol$rotationconstraint$disable,np as ol$rotationconstraint$none,fp as ol$size$buffer,dp as ol$size$hasArea,wh as ol$size$scale,tt as ol$size$toSize,BG as ol$source$BingMaps,VS as ol$source$BingMaps$quadKey,jG as ol$source$CartoDB,YG as ol$source$Cluster,jS as ol$source$DataTile,k5 as ol$source$GeoTIFF,z5 as ol$source$IIIF,bs as ol$source$Image,Sb as ol$source$Image$ImageSourceEvent,sd as ol$source$Image$ImageSourceEventType,sc as ol$source$Image$defaultImageLoadFunction,X5 as ol$source$ImageArcGISRest,Z5 as ol$source$ImageCanvas,K5 as ol$source$ImageMapGuide,J5 as ol$source$ImageStatic,eB as ol$source$ImageWMS,sB as ol$source$OGCMapTile,aB as ol$source$OGCVectorTile,uB as ol$source$OSM,R0 as ol$source$OSM$ATTRIBUTION,mB as ol$source$Raster,Mb as ol$source$Raster$Processor,I0 as ol$source$Raster$RasterSourceEvent,Lb as ol$source$Raster$newImageData,Na as ol$source$Source,EB as ol$source$Stamen,Du as ol$source$Tile,Qm as ol$source$Tile$TileSourceEvent,TB as ol$source$TileArcGISRest,bB as ol$source$TileDebug,To as ol$source$TileEventType,Vi as ol$source$TileImage,vT as ol$source$TileJSON,CB as ol$source$TileWMS,AB as ol$source$UTFGrid,$b as ol$source$UTFGrid$CustomTile,e_ as ol$source$UrlTile,us as ol$source$Vector,pr as ol$source$Vector$VectorSourceEvent,ct as ol$source$VectorEventType,Pf as ol$source$VectorTile,t_ as ol$source$VectorTile$defaultLoadFunction,MB as ol$source$WMTS,FB as ol$source$WMTS$optionsFromCapabilities,Ju as ol$source$XYZ,U5 as ol$source$Zoomify,S0 as ol$source$Zoomify$CustomTile,OB as ol$source$common$DEFAULT_WMS_VERSION,Rb as ol$source$ogcTileUtil$getMapTileUrlTemplate,b0 as ol$source$ogcTileUtil$getTileSetInfo,Cb as ol$source$ogcTileUtil$getVectorTileUrlTemplate,$B as ol$source$sourcesFromTileGrid,Sr as ol$source$wms$DEFAULT_VERSION,Fl as ol$sphere$DEFAULT_RADIUS,mv as ol$sphere$getArea,Yc as ol$sphere$getDistance,pv as ol$sphere$getLength,_v as ol$sphere$offset,hg as ol$string$compareVersions,jr as ol$string$padNumber,Th as ol$structs$LRUCache,NB as ol$structs$LinkedList,ax as ol$structs$PriorityQueue,Kl as ol$structs$PriorityQueue$DROP,bu as ol$structs$RBush,lu as ol$style$Circle,yn as ol$style$Fill,Ea as ol$style$Icon,JA as ol$style$IconImage,u1 as ol$style$IconImage$get,aI as ol$style$IconImageCache,Vl as ol$style$IconImageCache$shared,Np as ol$style$Image,kp as ol$style$RegularShape,on as ol$style$Stroke,kt as ol$style$Style,h1 as ol$style$Style$createDefaultStyle,wa as ol$style$Style$createEditingStyle,c1 as ol$style$Style$toFunction,po as ol$style$Text,be as ol$style$expressions$Operators,Z_ as ol$style$expressions$PALETTE_TEXTURE_ARRAY,q as ol$style$expressions$ValueTypes,j_ as ol$style$expressions$arrayToGlsl,xS as ol$style$expressions$colorToGlsl,te as ol$style$expressions$expressionToGlsl,qu as ol$style$expressions$getStringNumberEquivalent,wi as ol$style$expressions$getValueType,vS as ol$style$expressions$isTypeUnique,Ku as ol$style$expressions$numberToGlsl,ES as ol$style$expressions$stringToGlsl,qf as ol$style$expressions$uniformNameForVariable,mm as ol$style$flat$toStyle,kB as ol$style$literal$SymbolType,_a as ol$tilecoord$createOrUpdate,mp as ol$tilecoord$fromKey,kx as ol$tilecoord$getCacheKeyForTileKey,ya as ol$tilecoord$getKey,$i as ol$tilecoord$getKeyZXY,Sh as ol$tilecoord$hash,Gx as ol$tilecoord$withinExtentAndZ,zi as ol$tilegrid$TileGrid,LB as ol$tilegrid$WMTS,Nb as ol$tilegrid$WMTS$createFromCapabilitiesMatrixSet,qg as ol$tilegrid$common$DEFAULT_MAX_ZOOM,so as ol$tilegrid$common$DEFAULT_TILE_SIZE,hT as ol$tilegrid$createForExtent,dT as ol$tilegrid$createForProjection,So as ol$tilegrid$createXYZ,yr as ol$tilegrid$extentFromProjection,Jm as ol$tilegrid$getForProjection,cT as ol$tilegrid$wrapX,gT as ol$tileurlfunction$createFromTemplate,Af as ol$tileurlfunction$createFromTemplates,Va as ol$tileurlfunction$createFromTileUrlFunctions,Lf as ol$tileurlfunction$expandUrl,pT as ol$tileurlfunction$nullTileUrlFunction,ke as ol$transform$apply,tn as ol$transform$compose,IC as ol$transform$composeCssTransform,Le as ol$transform$create,Yy as ol$transform$determinant,AC as ol$transform$invert,Ur as ol$transform$makeInverse,Xy as ol$transform$makeScale,rr as ol$transform$multiply,Bs as ol$transform$reset,Qd as ol$transform$rotate,Gr as ol$transform$scale,Ko as ol$transform$set,jy as ol$transform$setFromArray,Cl as ol$transform$toString,qo as ol$transform$translate,Ki as ol$uri$appendParams,Yd as ol$util$VERSION,ae as ol$util$abstract,H as ol$util$getUid,Nm as ol$vec$mat4$create,Pu as ol$vec$mat4$fromTransform,_r as ol$webgl$ARRAY_BUFFER,Qn as ol$webgl$Buffer,Xw as ol$webgl$Buffer$BufferUsage,Ef as ol$webgl$Buffer$getArrayClassForType,Lu as ol$webgl$ContextEventType,vi as ol$webgl$DYNAMIC_DRAW,cs as ol$webgl$ELEMENT_ARRAY_BUFFER,Om as ol$webgl$FLOAT,Kw as ol$webgl$Helper,wt as ol$webgl$Helper$AttributeType,Ui as ol$webgl$Helper$DefaultUniform,SN as ol$webgl$Helper$ShaderType,Ww as ol$webgl$Helper$computeAttributesStride,dS as ol$webgl$PaletteTexture,Dm as ol$webgl$PostProcessingPass,qw as ol$webgl$RenderTarget,vf as ol$webgl$STATIC_DRAW,Uw as ol$webgl$STREAM_DRAW,CS as ol$webgl$ShaderBuilder$ShaderBuilder,IS as ol$webgl$ShaderBuilder$parseLiteralStyle,mS as ol$webgl$TileTexture,Bw as ol$webgl$UNSIGNED_BYTE,Vw as ol$webgl$UNSIGNED_INT,zw as ol$webgl$UNSIGNED_SHORT,xf as ol$webgl$getContext,vN as ol$webgl$getSupportedExtensions,Nt as ol$xml$OBJECT_PROPERTY_NODE_FACTORY,ts as ol$xml$XML_SCHEMA_INSTANCE_URI,de as ol$xml$createElementNS,sn as ol$xml$getAllTextContent,bp as ol$xml$getAllTextContent_,Jx as ol$xml$getAttributeNS,uo as ol$xml$getDocument,Qx as ol$xml$getXMLSerializer,_i as ol$xml$isDocument,su as ol$xml$makeArrayExtender,se as ol$xml$makeArrayPusher,Rp as ol$xml$makeArraySerializer,A as ol$xml$makeChildAppender,it as ol$xml$makeObjectPropertyPusher,I as ol$xml$makeObjectPropertySetter,ue as ol$xml$makeReplacer,pn as ol$xml$makeSequence,ut as ol$xml$makeSimpleNodeFactory,G as ol$xml$makeStructureNS,yi as ol$xml$parse,mn as ol$xml$parseNode,z as ol$xml$pushParseAndPop,ge as ol$xml$pushSerializeAndPop,D2 as ol$xml$registerDocument,$2 as ol$xml$registerXMLSerializer,Cp as ol$xml$serialize};
|