@defra/interactive-map 0.0.49-alpha → 0.0.51-apha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/im-core.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/docs/api.md +19 -0
- package/docs/architecture.md +14 -0
- package/docs/getting-started.md +10 -0
- package/docs/plugins/datasets.md +9 -3
- package/jest.setup.js +8 -0
- package/package.json +8 -3
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -0
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +2 -0
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js.LICENSE.txt +1 -0
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/datasets/src/adapters/loadLayerAdapter.js +7 -3
- package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +17 -0
- package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +74 -0
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +14 -79
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +4 -0
- package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +3 -89
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.js +111 -0
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +198 -0
- package/plugins/datasets/src/adapters/openlayers/layerBuilders.js +205 -0
- package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +233 -0
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +276 -0
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +431 -0
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +172 -0
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +262 -0
- package/plugins/datasets/src/fetch/createDynamicSource.js +12 -8
- package/plugins/datasets/src/fetch/createDynamicSource.test.js +61 -52
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +13 -1
- package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +20 -0
- package/plugins/datasets/src/initialise/initialiseDatasets.js +1 -1
- package/plugins/datasets/src/initialise/initialiseDatasets.test.js +1 -1
- package/plugins/datasets/src/registry/mapboxStyleDataset.js +108 -0
- package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +240 -0
- package/plugins/datasets/src/utils/bbox.js +5 -7
- package/plugins/datasets/src/utils/bbox.test.js +3 -10
- package/plugins/draw/dist/css/index.css +1 -0
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/src/index.js +2 -0
- package/plugins/draw/src/index.test.js +1 -0
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/search/dist/css/index.css +1 -1
- package/plugins/search/src/components/Form/Form.module.scss +10 -1
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/index.js +1 -1
- package/providers/beta/openlayers/src/index.js +16 -0
- package/providers/beta/openlayers/src/openlayersProvider.js +160 -7
- package/providers/beta/openlayers/src/openlayersProvider.test.js +13 -0
- package/providers/beta/openlayers/src/utils/bngProjection.js +9 -0
- package/providers/beta/openlayers/src/utils/filterEvaluator.js +32 -0
- package/providers/beta/openlayers/src/utils/filterEvaluator.test.js +36 -0
- package/providers/beta/openlayers/src/utils/highlightFeatures.js +38 -23
- package/providers/beta/openlayers/src/utils/highlightFeatures.test.js +153 -8
- package/providers/beta/openlayers/src/utils/hoverCursor.js +5 -1
- package/providers/beta/openlayers/src/utils/hoverCursor.test.js +40 -0
- package/providers/beta/openlayers/src/utils/queryFeatures.js +72 -54
- package/providers/beta/openlayers/src/utils/queryFeatures.test.js +143 -1
- package/providers/beta/openlayers/src/utils/symbolImages.js +79 -5
- package/providers/beta/openlayers/src/utils/symbolImages.test.js +111 -1
- package/providers/beta/openlayers/src/utils/vtTileFragments.js +20 -8
- package/providers/beta/openlayers/src/utils/vtTileFragments.test.js +162 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/utils/patternImages.js +4 -44
- package/rollup.esm.mjs +2 -0
- package/src/App/hooks/useLayoutMeasurements.js +1 -1
- package/src/App/hooks/useMapProviderOverrides.js +24 -8
- package/src/App/hooks/useMapProviderOverrides.test.js +11 -2
- package/src/services/patternRegistry.js +38 -0
- package/src/services/patternRegistry.test.js +61 -0
- package/src/types.js +11 -0
- package/src/utils/getSafeZoneInset.js +26 -62
- package/src/utils/getSafeZoneInset.test.js +36 -64
- package/webpack.dev.mjs +1 -0
- /package/plugins/datasets/dist/esm/{esriLayerAdapter.js → im-datasets-esri-adapter.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"@babel/runtime/helpers/asyncToGenerator";import{a as e,b as i,g as s,M as n,c as r,d as o}from"./im-datasets-ml-adapter.js";import{d as a,l as h}from"./im-datasets-plugin.js";import l from"@babel/runtime/helpers/defineProperty";import"preact/compat";import"preact/jsx-runtime";var c={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},u={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},d={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:u.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},g={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:u.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},f={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:u.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},_={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}};function p(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function m(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?p(Object(i),!0).forEach(function(e){l(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):p(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var y=new Map,x=new Map,v={},M=t=>{var e=0;for(var i of t)e=Math.trunc((e<<5)-e+i.codePointAt(0));return Math.abs(e).toString(36)},w=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function S(t,e,i){var n,r,o,a,h=null==i?void 0:i.id,l=Object.fromEntries(Object.entries(t||{}).filter(t=>{var[e]=t;return!w.has(e)})),d=Object.fromEntries(Object.entries(v).filter(t=>{var[e]=t;return!w.has(e)})),g=Object.fromEntries(Object.entries(e).filter(t=>{var[,e]=t;return null!=e})),f=m(m(m(m({},c),d),l),g),p=null!==(n=_[null==i?void 0:i.mapColorScheme])&&void 0!==n?n:_.light;return f.haloColor=null!==(r=null==i?void 0:i.haloColor)&&void 0!==r?r:p.haloColor,f.selectedColor=null!==(o=null==i?void 0:i.selectedColor)&&void 0!==o?o:p.selectedColor,f.activeColor=null!==(a=null==i?void 0:i.activeColor)&&void 0!==a?a:p.activeColor,"string"==typeof f.graphic&&u[f.graphic]&&(f.graphic=u[f.graphic]),Object.fromEntries(Object.entries(f).map(t=>{var[e,i]=t;return[e,s(i,h)||""]}))}function E(t,e){return Object.entries(e).reduce((t,e)=>{var[i,s]=e;return t.replaceAll("{{".concat(i,"}}"),s)},t)}var C={setDefaults(t){v=t||{}},getDefaults:()=>m(m({},c),v),register(t){y.set(t.id,t)},get:t=>y.get(t),list:()=>[...y.values()],clear(){y.clear()},initialise(){this.register(d),this.register(g),this.register(f)},resolve(t,e,i){var s=S(t,e||{},i);return t?(s.selectedColor="none",s.activeColor="none",E(t.svg,s)):""},resolveActive(t,e,i){var s=S(t,e||{},i);return t?E(t.svg,s):""},resolveSelected(t,e,i){var s=S(t,e||{},i);return t?(s.activeColor="none",E(t.svg,s)):""},getSymbolImageId(t,i){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,r=this.getSymbolDef(t);if(!r)return null;var o=e(t),a=s?this.resolveActive(r,o,i):this.resolve(r,o,i);return"symbol-".concat(s?"act-":"").concat(M(a),"-").concat(n,"x")},getSymbolDef(t){return t.symbolSvgContent?{svg:t.symbolSvgContent}:t.symbol?this.get(t.symbol):void 0},rasteriseSymbolImage(s,n,r,o){var a=this;return t(function*(){var t=a.getSymbolDef(s);if(!t)return null;var h,l,c=e(s);"active"===r?(h=a.resolveActive(t,c,n),l="act-"):"selected"===r?(h=a.resolveSelected(t,c,n),l="sel-"):(h=a.resolve(t,c,n),l="");var u="symbol-".concat(l).concat(M(h),"-").concat(o,"x"),d=x.get(u);if(!d){var g=i(s,t),[,,f,_]=g.split(" ").map(Number),p='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(f*o,'" height="').concat(_*o,'" viewBox="').concat(g,'">').concat(h,"</svg>");d=yield((t,e,i)=>new Promise((s,n)=>{var r="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),o=new Image(e,i);o.onload=()=>{var t=document.createElement("canvas");t.width=e,t.height=i;var n=t.getContext("2d");n.drawImage(o,0,0,e,i),s(n.getImageData(0,0,e,i))},o.onerror=()=>{n(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},o.src=r}))(p,f*o,_*o),x.set(u,d)}return{imageId:u,imageData:d}})()}};C.initialise();var b=new Map,P=new Map,I=new Map,R=new Map,G=function(){var e=t(function*(e,i,s,n){var r=s.getSymbolImageId(e,i,!1,n);if(r){var o=s.getSymbolImageId(e,i,!0,n);o&&I.set(r,o),yield Promise.all(["normal","active","selected"].map(function(){var a=t(function*(t){var a="active"===t?o:r;if("selected"===t||a&&!b.has(a)){var h=yield s.rasteriseSymbolImage(e,i,t,n);if(h&&("selected"===t&&R.set(r,h.imageId),!b.has(h.imageId))){var l=((t,e)=>{var i=b.get(t);if(i)return i;var s=document.createElement("canvas");return s.width=e.width,s.height=e.height,s.getContext("2d").putImageData(e,0,0),b.set(t,s),s})(h.imageId,h.imageData);"normal"===t&&P.set(h.imageId,l.toDataURL())}}});return function(t){return a.apply(this,arguments)}}()))}});return function(t,i,s,n){return e.apply(this,arguments)}}(),T=function(){var e=t(function*(t,e,i,s){t.length&&(yield Promise.all(t.map(t=>G(t,e,i,s))))});return function(t,i,s,n){return e.apply(this,arguments)}}();class A extends n{get leafLayerIds(){return this.hasSublayers?[]:this.hasFill||this.hasStroke||this.hasSymbol?[this.id]:[]}get source(){return this.hasDynamicGeoJSON?{type:"geojson",data:{type:"FeatureCollection",features:[]}}:this.tiles?{type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22}:this.geojson?{type:"geojson",data:this.geojson}:null}get idStrategy(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.idProperty||null:this.idProperty||null}get filter(){var t=super.filter;if(!this.sourceLayer)return t;var e=["==",["get","layer"],this.sourceLayer];return t?"all"===t[0]?[...t,e]:["all",t,e]:e}_wrapWithFilter(t){return this.filter?[{filter:this.filter,style:t}]:t}get symbolMeta(){if(!this.hasSymbol)return null;var t=C.getSymbolImageId(this.style,a.mapStyle,!1,3);return t?{imageId:t,anchor:r(this.style,C.getSymbolDef(this.style))}:null}_symbolStyle(){var t,e={},i=this.symbolMeta,s=i&&(t=i.imageId,P.get(t));return s&&(e["icon-src"]=s,e["icon-anchor"]=i.anchor,e["icon-scale"]=1/3),this._wrapWithFilter(e)}get flatStyle(){var t;if(this.hasSymbol)return this._symbolStyle();var e=null===(t=a.mapStyle)||void 0===t?void 0:t.id,i={};return this.hasFill&&!this.hasPattern&&(i["fill-color"]=s(this.style.fill,e)),this.hasStroke&&(i["stroke-color"]=s(this.style.stroke,e),i["stroke-width"]=this.style.strokeWidth||1,this.style.strokeDashArray&&(i["stroke-line-dash"]=this.style.strokeDashArray)),this._wrapWithFilter(i)}}var k="add",F="remove",O="propertychange";function L(t){for(const e in t)delete t[e]}function N(t){let e;for(e in t)return!1;return!e}function D(t,e,i,s,n){if(n){const n=i;i=function(r){return t.removeEventListener(e,i),n.call(s??this,r)}}else s&&s!==t&&(i=i.bind(s));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function j(t,e,i,s){return D(t,e,i,s,!0)}function z(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),L(t))}var B="change",W="error",X="load";class q{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}function U(t,e){return t>e?1:t<e?-1:0}function Y(t,e){return t<e?1:t>e?-1:0}function Z(t,e,i){if(t[0]<=e)return 0;const s=t.length;if(e<=t[s-1])return s-1;if("function"==typeof i){for(let n=1;n<s;++n){const s=t[n];if(s===e)return n;if(s<e)return i(e,t[n-1],s)>0?n-1:n}return s-1}if(i>0){for(let i=1;i<s;++i)if(t[i]<e)return i-1;return s-1}if(i<0){for(let i=1;i<s;++i)if(t[i]<=e)return i;return s-1}for(let i=1;i<s;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return s-1}function V(t,e,i){for(;e<i;){const s=t[e];t[e]=t[i],t[i]=s,++e,--i}}function K(t,e){const i=Array.isArray(e)?e:[e],s=i.length;for(let e=0;e<s;e++)t[t.length]=i[e]}function H(t,e){const i=t.length;if(i!==e.length)return!1;for(let s=0;s<i;s++)if(t[s]!==e[s])return!1;return!0}function $(){return!0}function J(){}function Q(t){let e,i,s;return function(){const n=Array.prototype.slice.call(arguments);return i&&this===s&&H(n,i)||(s=this,i=n,e=t.apply(this,arguments)),e}}class tt{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}class et extends q{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const n=e?new tt(t):t;n.target||(n.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=s.length;t<e;++t)if(a="handleEvent"in s[t]?s[t].handleEvent(n):s[t].call(this,n),!1===a||n.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,J);delete r[i]}return a}disposeInternal(){this.listeners_&&L(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);-1!==s&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=J,++this.pendingRemovals_[t]):(i.splice(s,1),0===i.length&&delete this.listeners_[t]))}}class it extends et{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(B)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=D(this,t[n],e);return s}return D(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let n=0;n<s;++n)i[n]=j(this,t[n],e)}else i=j(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)z(t[e]);else z(t)}(i);else if(Array.isArray(t))for(let i=0,s=t.length;i<s;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}function st(){throw new Error("Unimplemented abstract method.")}it.prototype.on,it.prototype.once,it.prototype.un;let nt=0;function rt(t){return t.ol_uid||(t.ol_uid=String(++nt))}class ot extends tt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class at extends it{constructor(t){super(),this.on,this.once,this.un,rt(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new ot(i,t,e)),i=O,this.hasListener(i)&&this.dispatchEvent(new ot(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const i=s[t];s[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],N(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const ht="length";class lt extends tt{constructor(t,e,i){super(t),this.element=e,this.index=i}}class ct extends at{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(ht)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new lt(k,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new lt(F,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new lt(F,i,t)),this.dispatchEvent(new lt(k,e,t))}updateLength_(){this.set(ht,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,n=i.length;s<n;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}function ut(t,e){if(!t)throw new Error(e)}var dt=0,gt=1,ft=2,_t=4,pt=8,mt=16;function yt(t){const e=Ct();for(let i=0,s=t.length;i<s;++i)At(e,t[i]);return e}function xt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function vt(t,e,i){let s,n;return s=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,n=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,s*s+n*n}function Mt(t,e){return St(t,e[0],e[1])}function wt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function St(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Et(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=e[0],a=e[1];let h=dt;return o<i?h|=mt:o>n&&(h|=_t),a<s?h|=pt:a>r&&(h|=ft),h===dt&&(h=gt),h}function Ct(){return[1/0,1/0,-1/0,-1/0]}function bt(t,e,i,s,n){return n?(n[0]=t,n[1]=e,n[2]=i,n[3]=s,n):[t,e,i,s]}function Pt(t){return bt(1/0,1/0,-1/0,-1/0,t)}function It(t,e){const i=t[0],s=t[1];return bt(i,s,i,s,e)}function Rt(t,e,i,s,n){return kt(Pt(n),t,e,i,s)}function Gt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Tt(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function At(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function kt(t,e,i,s,n){for(;i<s;i+=n)Ft(t,e[i],e[i+1]);return t}function Ft(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function Ot(t,e){let i;return i=e(Nt(t)),i||(i=e(Dt(t)),i||(i=e(Yt(t)),i||(i=e(Ut(t)),i||!1)))}function Lt(t){let e=0;return Kt(t)||(e=Zt(t)*Wt(t)),e}function Nt(t){return[t[0],t[1]]}function Dt(t){return[t[2],t[1]]}function jt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function zt(t,e){let i;if("bottom-left"===e)i=Nt(t);else if("bottom-right"===e)i=Dt(t);else if("top-left"===e)i=Ut(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=Yt(t)}return i}function Bt(t,e,i,s){const n=e*s[0]/2,r=e*s[1]/2,o=Math.cos(i),a=Math.sin(i),h=n*o,l=n*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-h+u,g-l-c,d-h-u,g-l+c,d+h-u,g+l+c,d+h+u,g+l-c,d-h+u,g-l-c]}function Wt(t){return t[3]-t[1]}function Xt(t,e,i){const s=i||[1/0,1/0,-1/0,-1/0];return Vt(t,e)?(t[0]>e[0]?s[0]=t[0]:s[0]=e[0],t[1]>e[1]?s[1]=t[1]:s[1]=e[1],t[2]<e[2]?s[2]=t[2]:s[2]=e[2],t[3]<e[3]?s[3]=t[3]:s[3]=e[3]):Pt(s),s}function qt(t,e){if(!Vt(t,e))return[t.slice()];if(wt(e,t))return[];const[i,s,n,r]=t,o=Math.max(i,e[0]),a=Math.max(s,e[1]),h=Math.min(n,e[2]),l=Math.min(r,e[3]),c=[];return o>i&&c.push([i,s,o,r]),h<n&&c.push([h,s,n,r]),a>s&&c.push([o,s,h,a]),l<r&&c.push([o,l,h,r]),c}function Ut(t){return[t[0],t[3]]}function Yt(t){return[t[2],t[3]]}function Zt(t){return t[2]-t[0]}function Vt(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Kt(t){return t[2]<t[0]||t[3]<t[1]}function Ht(t,e,i,s){if(Kt(t))return Pt(i);let n=[];if(s>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<s;++r)n.push(t[0]+e*r/s,t[1],t[2],t[1]+i*r/s,t[2]-e*r/s,t[3],t[0],t[3]-i*r/s)}else n=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(n,n,2);const r=[],o=[];for(let t=0,e=n.length;t<e;t+=2)r.push(n[t]),o.push(n[t+1]);return function(t,e,i){return bt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}function $t(t,e){const i=e.getExtent(),s=jt(t);if(e.canWrapX()&&(s[0]<i[0]||s[0]>=i[2])){const e=Zt(i),n=Math.floor((s[0]-i[0])/e)*e;t[0]-=n,t[2]-=n}return t}function Jt(t,e,i){if(e.canWrapX()){const s=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[s[0],t[1],s[2],t[3]]];$t(t,e);const n=Zt(s);if(Zt(t)>n&&!i)return[[s[0],t[1],s[2],t[3]]];if(t[0]<s[0])return[[t[0]+n,t[1],s[2],t[3]],[s[0],t[1],t[2],t[3]]];if(t[2]>s[2])return[[t[0],t[1],s[2],t[3]],[s[0],t[1],t[2]-n,t[3]]]}return[t]}function Qt(t,e){let i=[t];for(let t=0,s=e.length;t<s&&i.length>0;++t){const s=[];for(let n=0,r=i.length;n<r;++n)s.push(...qt(i[n],e[t]));i=s}return i}function te(t,e,i,s,n,r,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof t?t(i,s,n):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=false,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let s;"text"==t||"json"==t?s=a.responseText:"xml"==t?s=a.responseXML||a.responseText:"arraybuffer"==t&&(s=a.response),s?r(e.readFeatures(s,{extent:i,featureProjection:n}),e.readProjection(s)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function ee(t,e){return function(i,s,n,r,o){te(t,e,i,s,n,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function ie(t,e,i){return Math.min(Math.max(t,e),i)}function se(t,e,i,s,n,r){const o=n-i,a=r-s;if(0!==o||0!==a){const h=((t-i)*o+(e-s)*a)/(o*o+a*a);h>1?(i=n,s=r):h>0&&(i+=o*h,s+=a*h)}return ne(t,e,i,s)}function ne(t,e,i,s){const n=i-t,r=s-e;return n*n+r*r}function re(t){return 180*t/Math.PI}function oe(t){return t*Math.PI/180}function ae(t,e){const i=t%e;return i*e<0?i+e:i}function he(t,e,i){return t+i*(e-t)}function le(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function ce(t,e){return Math.floor(le(t,e))}function ue(t,e){return Math.ceil(le(t,e))}function de(t,e,i){if(t>=e&&t<i)return t;const s=i-e;return((t-e)%s+s)%s+e}function ge(t,e){let i=!0;for(let s=t.length-1;s>=0;--s)if(t[s]!=e[s]){i=!1;break}return i}function fe(t,e){if(e.canWrapX()){const i=Zt(e.getExtent()),s=_e(t,e,i);s&&(t[0]-=s*i)}return t}function _e(t,e,i){const s=e.getExtent();let n=0;return e.canWrapX()&&(t[0]<s[0]||t[0]>s[2])&&(i=i||Zt(s),n=Math.floor((t[0]-s[0])/i)),n}const pe={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};let me=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||pe[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}};const ye=6378137,xe=Math.PI*ye,ve=[-xe,-xe,xe,xe],Me=[-180,-85,180,85],we=ye*Math.log(Math.tan(Math.PI/2));class Se extends me{constructor(t){super({code:t,units:"m",extent:ve,global:!0,worldExtent:Me,getPointResolution:function(t,e){return t/Math.cosh(e[1]/ye)}})}}const Ee=[new Se("EPSG:3857"),new Se("EPSG:102100"),new Se("EPSG:102113"),new Se("EPSG:900913"),new Se("http://www.opengis.net/def/crs/EPSG/0/3857"),new Se("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ce(t,e,i,s){const n=t.length;i=i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let i=0;i<n;i+=s){e[i]=xe*t[i]/180;let s=ye*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));s>we?s=we:s<-we&&(s=-we),e[i+1]=s}return e}function be(t,e,i,s){const n=t.length;i=i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let i=0;i<n;i+=s)e[i]=180*t[i]/xe,e[i+1]=360*Math.atan(Math.exp(t[i+1]/ye))/Math.PI-90;return e}const Pe=[-180,-90,180,90],Ie=6378137*Math.PI/180;class Re extends me{constructor(t,e){super({code:t,units:"degrees",extent:Pe,axisOrientation:e,global:!0,metersPerUnit:Ie,worldExtent:Pe})}}const Ge=[new Re("CRS:84"),new Re("EPSG:4326","neu"),new Re("urn:ogc:def:crs:OGC:1.3:CRS84"),new Re("urn:ogc:def:crs:OGC:2:84"),new Re("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Re("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Re("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Te={};function Ae(t){return Te[t]||Te[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let ke={};function Fe(t,e,i){const s=t.getCode(),n=e.getCode();s in ke||(ke[s]={}),ke[s][n]=i}function Oe(t,e){return t in ke&&e in ke[t]?ke[t][e]:null}const Le=.9996,Ne=.00669438,De=Ne*Ne,je=De*Ne,ze=Ne/(1-Ne),Be=Math.sqrt(1-Ne),We=(1-Be)/(1+Be),Xe=We*We,qe=Xe*We,Ue=qe*We,Ye=Ue*We,Ze=.9983242984503243,Ve=15*De/256+45*je/1024,Ke=35*je/3072,He=1.5*We-27/32*qe+269/512*Ye,$e=21/16*Xe-55/32*Ue,Je=151/96*qe-417/128*Ye,Qe=1097/512*Ue,ti=6378137;function ei(t,e,i){const s=t-5e5,n=(i.north?e:e-1e7)/Le/(ti*Ze),r=n+He*Math.sin(2*n)+$e*Math.sin(4*n)+Je*Math.sin(6*n)+Qe*Math.sin(8*n),o=Math.sin(r),a=o*o,h=Math.cos(r),l=o/h,c=l*l,u=c*c,d=1-Ne*a,g=Math.sqrt(1-Ne*a),f=ze*h**2,_=f*f,p=s/(ti/g*Le),m=p*p,y=m*p,x=y*p,v=x*p,M=r-l/((1-Ne)/d)*(m/2-x/24*(5+3*c+10*f-4*_-9*ze))+v*p/720*(61+90*c+298*f+45*u-252*ze-3*_);let w=(p-y/6*(1+2*c+f)+v/120*(5-2*f+28*c-3*_+8*ze+24*u))/h;return w=de(w+oe(si(i.number)),-Math.PI,Math.PI),[re(w),re(M)]}function ii(t,e,i){t=de(t,-180,180),e<-80?e=-80:e>84&&(e=84);const s=oe(e),n=Math.sin(s),r=Math.cos(s),o=n/r,a=o*o,h=a*a,l=oe(t),c=oe(si(i.number)),u=ti/Math.sqrt(1-Ne*n**2),d=ze*r**2,g=r*de(l-c,-Math.PI,Math.PI),f=g*g,_=f*g,p=_*g,m=p*g,y=m*g,x=ti*(Ze*s-.002514607064228144*Math.sin(2*s)+Ve*Math.sin(4*s)-Ke*Math.sin(6*s)),v=Le*u*(g+_/6*(1-a+d)+m/120*(5-18*a+h+72*d-58*ze))+5e5;let M=Le*(x+u*o*(f/2+p/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+h+600*d-330*ze)));return i.north||(M+=1e7),[v,M]}function si(t){return 6*(t-1)-180+3}const ni=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ri(t){let e=0;for(const i of ni){const s=t.match(i);if(s){e=parseInt(s[1]);break}}if(!e)return null;let i=0,s=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(s=!0,i=e-32600),i?{number:i,north:s}:null}function oi(t,e){return function(i,s,n,r){const o=i.length;n=n>1?n:2,r=r??n,s||(s=n>2?i.slice():new Array(o));for(let n=0;n<o;n+=r){const r=i[n],o=i[n+1],a=t(r,o,e);s[n]=a[0],s[n+1]=a[1]}return s}}function ai(t,e,i){i=i||6371008.8;const s=oe(t[1]),n=oe(e[1]),r=(n-s)/2,o=oe(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(s)*Math.cos(n);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const hi=[function(t){const e=ri(t.getCode());return e?{forward:oi(ii,e),inverse:oi(ei,e)}:null}],li=[function(t){return ri(t)?new me({code:t,units:"m"}):null}];let ci=!0;function ui(t,e){if(void 0!==e)for(let i=0,s=t.length;i<s;++i)e[i]=t[i];else e=t.slice();return e}function di(t){!function(t,e){Te[t]=e}(t.getCode(),t),Fe(t,t,ui)}function gi(t){if("string"!=typeof t)return t;const e=Ae(t);if(e)return e;for(const e of li){const i=e(t);if(i)return i}return null}function fi(t,e,i,s){let n;const r=(t=gi(t)).getPointResolutionFunc();if(r)n=r(e,i);else{const r=t.getUnits();if("degrees"==r&&!s||"degrees"==s)n=e;else{const s=vi(t,gi("EPSG:4326"));if(s||"degrees"===r){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=s(t,t,2);n=(ai(t.slice(0,2),t.slice(2,4))+ai(t.slice(4,6),t.slice(6,8)))/2}else n=e*t.getMetersPerUnit();const o=t.getMetersPerUnit();void 0!==o&&(n/=o)}}return n}function _i(t){!function(t){t.forEach(di)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&Fe(e,t,ui)})})}function pi(t,e){return t?"string"==typeof t?gi(t):t:gi(e)}function mi(t){return function(e,i,s,n){const r=e.length;s=void 0!==s?s:2,n=n??s,i=void 0!==i?i:new Array(r);for(let o=0;o<r;o+=n){const r=t(e.slice(o,o+s)),a=r.length;for(let t=0,s=n;t<s;++t)i[o+t]=t>=a?e[o+t]:r[t]}return i}}function yi(t,e,i,s){const n=gi(t),r=gi(e);Fe(n,r,mi(i)),Fe(r,n,mi(s))}function xi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return vi(t,e)===ui&&i}function vi(t,e){const i=t.getCode(),s=e.getCode();let n=Oe(i,s);if(n)return n;let r=null,o=null;for(const i of hi)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=Mi(r.inverse,o.forward);else{const t=Oe(i,a);t&&(n=Mi(t,o.forward))}else{const t=Oe(a,s);t&&(n=Mi(r.inverse,t))}return n&&(di(t),di(e),Fe(t,e,n)),n}function Mi(t,e){return function(i,s,n,r){return s=t(i,s,n,r),e(s,s,n,r)}}function wi(t,e){return vi(gi(t),gi(e))}function Si(t,e,i){const s=wi(e,i);if(!s){const t=gi(e).getCode(),s=gi(i).getCode();throw new Error(`No transform available between ${t} and ${s}`)}return s(t,void 0,t.length)}function Ei(t,e,i,s){return Ht(t,wi(e,i),void 0,s)}function Ci(t,e){return t}function bi(t,e){return ci&&!ge(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(ci=!1,function(...t){console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Pi(t,e){return t}function Ii(t,e){return t}function Ri(t,e,i){return function(s){let n,r;if(t.canWrapX()){const e=t.getExtent(),o=Zt(e);r=_e(s=s.slice(0),t,o),r&&(s[0]=s[0]-r*o),s[0]=ie(s[0],e[0],e[2]),s[1]=ie(s[1],e[1],e[3]),n=i(s)}else n=i(s);return r&&e.canWrapX()&&(n[0]+=r*Zt(e.getExtent())),n}}var Gi,Ti,Ai;function ki(t,e){return[[-1/0,-1/0,1/0,1/0]]}_i(Ee),_i(Ge),Gi=Ee,Ti=Ce,Ai=be,Ge.forEach(function(t){Gi.forEach(function(e){Fe(t,e,Ti),Fe(e,t,Ai)})});class Fi extends at{constructor(t){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_),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Fi,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const s=this.getGeometry();for(const n in i)n===e&&s?t.set(n,s.clone()):t.set(n,i[n],!0)}const s=this.getStyle();return s&&t.setStyle(s),t}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_&&(z(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=D(t,B,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;if(Array.isArray(t))e=t;else{ut("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");e=[t]}return function(){return e}}(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}const Oi=[1,0,0,1,0,0],Li=new Array(6);function Ni(){return Oi.slice(0)}function Di(t){return zi(t,1,0,0,1,0,0)}function ji(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=t[4],a=t[5],h=e[0],l=e[1],c=e[2],u=e[3],d=e[4],g=e[5];return t[0]=i*h+n*l,t[1]=s*h+r*l,t[2]=i*c+n*u,t[3]=s*c+r*u,t[4]=i*d+n*g+o,t[5]=s*d+r*g+a,t}function zi(t,e,i,s,n,r,o){return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t[4]=r,t[5]=o,t}function Bi(t,e){const i=e[0],s=e[1];return e[0]=t[0]*i+t[2]*s+t[4],e[1]=t[1]*i+t[3]*s+t[5],e}function Wi(t,e,i){return ji(t,zi(Li,e,0,0,i,0,0))}function Xi(t,e,i,s,n,r,o,a){const h=Math.sin(r),l=Math.cos(r);return t[0]=s*l,t[1]=n*h,t[2]=-s*h,t[3]=n*l,t[4]=o*s*l-a*s*h+e,t[5]=o*n*h+a*n*l+i,t}const qi=[1e5,1e5,1e5,1e5,2,2];function Ui(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}function Yi(t,e,i,s,n,r,o){r=r||[],o=o||2;let a=0;for(let h=e;h<i;h+=s){const e=t[h],i=t[h+1];r[a++]=n[0]*e+n[2]*i+n[4],r[a++]=n[1]*e+n[3]*i+n[5];for(let e=2;e<o;e++)r[a++]=t[h+e]}return r&&r.length!=a&&(r.length=a),r}function Zi(t,e,i,s,n,r,o){o=o||[];const a=Math.cos(n),h=Math.sin(n),l=r[0],c=r[1];let u=0;for(let n=e;n<i;n+=s){const e=t[n]-l,i=t[n+1]-c;o[u++]=l+e*a-i*h,o[u++]=c+e*h+i*a;for(let e=n+2;e<n+s;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}const Vi=Ni(),Ki=[NaN,NaN];class Hi extends at{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Q((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return st()}closestPointXY(t,e,i,s){return st()}containsXY(t,e){return 0===this.closestPointXY(t,e,Ki,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return st()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Pt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){st()}scale(t,e,i){st()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return st()}getType(){return st()}applyTransform(t){st()}intersectsExtent(t){return st()}translate(t,e){st()}transform(t,e){const i=gi(t),s="tile-pixels"==i.getUnits()?function(t,s,n){const r=i.getExtent(),o=i.getWorldExtent(),a=Wt(o)/Wt(r);Xi(Vi,o[0],o[3],a,-a,0,0,0);const h=Yi(t,0,t.length,n,Vi,s),l=wi(i,e);return l?l(h,h,n):h}:wi(i,e);return this.applyTransform(s),this}}class $i extends Hi{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Rt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return st()}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(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Qi(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){st()}setLayout(t,e,i){let s;if(t)s=Qi(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}s=e.length,t=Ji(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Zi(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=jt(this.getExtent()));const s=this.getFlatCoordinates();if(s){const n=this.getStride();!function(t,e,i,s,n,r,o,a){a=a||[];const h=o[0],l=o[1];let c=0;for(let o=e;o<i;o+=s){const e=t[o]-h,i=t[o+1]-l;a[c++]=h+n*e,a[c++]=l+r*i;for(let e=o+2;e<o+s;++e)a[c++]=t[e]}a&&a.length!=c&&(a.length=c)}(s,0,s.length,n,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();!function(t,e,i,s,n,r,o){o=o||[];let a=0;for(let h=e;h<i;h+=s){o[a++]=t[h]+n,o[a++]=t[h+1]+r;for(let e=h+2;e<h+s;++e)o[a++]=t[e]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,s,t,e,i),this.changed()}}}function Ji(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function Qi(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function ts(t,e,i,s,n,r,o){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((n-a)*l+(r-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let n=0;n<s;++n)o[n]=he(t[e+n],t[i+n],d);return void(o.length=s)}u=e}}for(let e=0;e<s;++e)o[e]=t[u+e];o.length=s}function es(t,e,i,s,n){let r=t[e],o=t[e+1];for(e+=s;e<i;e+=s){const i=t[e],s=t[e+1],a=ne(r,o,i,s);a>n&&(n=a),r=i,o=s}return n}function is(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=es(t,e,o,s,n),e=o}return n}function ss(t,e,i,s,n,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===n){if(d=ne(o,a,t[e],t[e+1]),d<l){for(u=0;u<s;++u)h[u]=t[e+u];return h.length=s,d}return l}c=c||[NaN,NaN];let g=e+s;for(;g<i;)if(ts(t,g-s,g,s,o,a,c),d=ne(o,a,c[0],c[1]),d<l){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s,g+=s}else g+=s*Math.max((Math.sqrt(d)-Math.sqrt(l))/n|0,1);if(r&&(ts(t,i-s,e,s,o,a,c),d=ne(o,a,c[0],c[1]),d<l)){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s}return l}function ns(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=ss(t,e,d,s,n,r,o,a,h,l,c),e=d}return l}function rs(t,e,i,s){for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0;i<s;++i)t[e++]=r[i]}return e}function os(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=rs(t,e,i[o],s);n[r++]=a,e=a}return n.length=r,n}function as(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=os(t,e,i[o],s,n[r]);0===a.length&&(a[0]=e),n[r++]=a,e=a[a.length-1]}return n.length=r,n}function hs(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=e;o<i;o+=s)n[r++]=t.slice(o,o+s);return n.length=r,n}function ls(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=hs(t,e,a,s,n[r]),e=a}return n.length=r,n}function cs(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=1===a.length&&a[0]===e?[]:ls(t,e,a,s,n[r]),e=a[a.length-1]}return n.length=r,n}function us(t,e,i,s,n,r,o){let a,h;const l=(i-e)/s;if(1===l)a=e;else if(2===l)a=e,h=n;else if(0!==l){let r=t[e],o=t[e+1],l=0;const c=[0];for(let n=e+s;n<i;n+=s){const e=t[n],i=t[n+1];l+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(l),r=e,o=i}const u=n*l,d=function(t,e,i){let s,n;i=i||U;let r=0,o=t.length,a=!1;for(;r<o;)s=r+(o-r>>1),n=+i(t[s],e),n<0?r=s+1:(o=s,a=!n);return a?r:~r}(c,u);d<0?(h=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*s):a=e+d*s}o=o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===a?NaN:void 0===h?t[a+e]:he(t[a+e],t[a+s+e],h);return r}function ds(t,e,i,s,n,r){if(i==e)return null;let o;if(n<t[e+s-1])return r?(o=t.slice(e,e+s),o[s-1]=n,o):null;if(t[i-1]<n)return r?(o=t.slice(i-s,i),o[s-1]=n,o):null;if(n==t[e+s-1])return t.slice(e,e+s);let a=e/s,h=i/s;for(;a<h;){const e=a+h>>1;n<t[(e+1)*s-1]?h=e:a=e+1}const l=t[a*s-1];if(n==l)return t.slice((a-1)*s,(a-1)*s+s);const c=(n-l)/(t[(a+1)*s-1]-l);o=[];for(let e=0;e<s-1;++e)o.push(he(t[(a-1)*s+e],t[a*s+e],c));return o.push(n),o}function gs(t,e,i,s,n){return!Ot(n,function(n){return!fs(t,e,i,s,n[0],n[1])})}function fs(t,e,i,s,n,r){let o=0,a=t[i-s],h=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];h<=r?s>r&&(i-a)*(r-h)-(n-a)*(s-h)>0&&o++:s<=r&&(i-a)*(r-h)-(n-a)*(s-h)<0&&o--,a=i,h=s}return 0!==o}function _s(t,e,i,s,n,r){if(0===i.length)return!1;if(!fs(t,e,i[0],s,n,r))return!1;for(let e=1,o=i.length;e<o;++e)if(fs(t,i[e-1],i[e],s,n,r))return!1;return!0}function ps(t,e,i,s,n){let r;for(e+=s;e<i;e+=s)if(r=n(t.slice(e-s,e),t.slice(e,e+s)),r)return r;return!1}function ms(t,e,i,s,n,r){return r=r??kt([1/0,1/0,-1/0,-1/0],t,e,i,s),!!Vt(n,r)&&(r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||ps(t,e,i,s,function(t,e){return function(t,e,i){let s=!1;const n=Et(t,e),r=Et(t,i);if(n===gt||r===gt)s=!0;else{const o=t[0],a=t[1],h=t[2],l=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let _,p;r&ft&&!(n&ft)&&(_=d-(g-l)/f,s=_>=o&&_<=h),s||!(r&_t)||n&_t||(p=g-(d-h)*f,s=p>=a&&p<=l),s||!(r&pt)||n&pt||(_=d-(g-a)/f,s=_>=o&&_<=h),s||!(r&mt)||n&mt||(p=g-(d-o)*f,s=p>=a&&p<=l)}return s}(n,t,e)}))}function ys(t,e,i,s,n){return!!ms(t,e,i,s,n)||(!!fs(t,e,i,s,n[0],n[1])||(!!fs(t,e,i,s,n[0],n[3])||(!!fs(t,e,i,s,n[2],n[1])||!!fs(t,e,i,s,n[2],n[3]))))}function xs(t,e,i,s,n){if(!ys(t,e,i[0],s,n))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(gs(t,i[e-1],i[e],s,n)&&!ms(t,i[e-1],i[e],s,n))return!1;return!0}function vs(t,e,i,s){let n=t[e],r=t[e+1],o=0;for(let a=e+s;a<i;a+=s){const e=t[a],i=t[a+1];o+=Math.sqrt((e-n)*(e-n)+(i-r)*(i-r)),n=e,r=i}return o}function Ms(t,e,i,s,n,r,o){const a=(i-e)/s;if(a<3){for(;e<i;e+=s)r[o++]=t[e],r[o++]=t[e+1];return o}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-s];let c=0;for(;l.length>0;){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+s;e<i;e+=s){const i=se(t[e],t[e+1],a,u,d,g);i>o&&(c=e,o=i)}o>n&&(h[(c-e)/s]=1,r+s<c&&l.push(r,c),c+s<i&&l.push(c,i))}for(let i=0;i<a;++i)h[i]&&(r[o++]=t[e+i*s],r[o++]=t[e+i*s+1]);return o}function ws(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=Ms(t,e,l,s,n,r,o),a.push(o),e=l}return o}function Ss(t,e){return e*Math.round(t/e)}function Es(t,e,i,s,n,r,o){if(e==i)return o;let a,h,l=Ss(t[e],n),c=Ss(t[e+1],n);e+=s,r[o++]=l,r[o++]=c;do{if(a=Ss(t[e],n),h=Ss(t[e+1],n),(e+=s)==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);for(;e<i;){const i=Ss(t[e],n),u=Ss(t[e+1],n);if(e+=s,i==a&&u==h)continue;const d=a-l,g=h-c,f=i-l,_=u-c;d*_==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&_<g||g==_||g>0&&_>g)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}function Cs(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=Es(t,e,l,s,n,r,o),a.push(o),e=l}return o}class bs extends $i{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){K(this.flatCoordinates,t),this.changed()}clone(){const t=new bs(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<vt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(es(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ss(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return ps(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,ds(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return hs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return us(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return vs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new bs(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=rs(this.flatCoordinates,0,t,this.stride),this.changed()}}class Ps extends $i{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],s=[];for(let t=0,n=e.length;t<n;++t){K(i,e[t].getFlatCoordinates()),s.push(i.length)}const n=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(n,i),this.ends_=s}}appendLineString(t){K(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Ps(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<vt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(is(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ns(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,s))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,function(t,e,i,s,n,r,o){if(o)return ds(t,e,i[i.length-1],s,n,r);let a;if(n<t[s-1])return r?(a=t.slice(0,s),a[s-1]=n,a):null;if(t[t.length-1]<n)return r?(a=t.slice(t.length-s),a[s-1]=n,a):null;for(let r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(n<t[e+s-1])return null;if(n<=t[o-1])return ds(t,e,o,s,n,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return ls(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new bs(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,s=[];let n=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new bs(t.slice(n,o),i);s.push(a),n=o}return s}getLength(){const t=this.ends_;let e=0,i=0;for(let s=0,n=t.length;s<n;++s)i+=vs(this.flatCoordinates,e,t[s],this.stride),e=t[s];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const s=this.ends_,n=this.stride;for(let r=0,o=s.length;r<o;++r){const o=s[r];K(t,us(e,i,o,n,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=ws(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new Ps(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){if(ms(t,e,i[r],s,n))return!0;e=i[r]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=os(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}let Is=class t extends $i{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const e=new t(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(t,e,i,s){const n=this.flatCoordinates,r=ne(t,e,n[0],n[1]);if(r<s){const t=this.stride;for(let e=0;e<t;++e)i[e]=n[e];return i.length=t,r}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return It(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return St(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let s=0,n=i.length;s<n;++s)t[e++]=i[s];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}};class Rs extends $i{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){K(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Rs(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<vt(this.getExtent(),t,e))return s;const n=this.flatCoordinates,r=this.stride;for(let o=0,a=n.length;o<a;o+=r){const a=ne(t,e,n[o],n[o+1]);if(a<s){s=a;for(let t=0;t<r;++t)i[t]=n[o+t];i.length=r}}return s}getCoordinates(){return hs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Is(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,s=[];for(let n=0,r=t.length;n<r;n+=i){const r=new Is(t.slice(n,n+i),e);s.push(r)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let s=0,n=e.length;s<n;s+=i){if(St(t,e[s],e[s+1]))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=rs(this.flatCoordinates,0,t,this.stride),this.changed()}}function Gs(t,e,i,s){let n=0;const r=t[i-s],o=t[i-s+1];let a=0,h=0;for(;e<i;e+=s){const i=t[e]-r,s=t[e+1]-o;n+=h*i-a*s,a=i,h=s}return n/2}function Ts(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Gs(t,e,o,s),e=o}return n}class As extends $i{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new As(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<vt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(es(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ss(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Gs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return hs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new As(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return ms(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=rs(this.flatCoordinates,0,t,this.stride),this.changed()}}function ks(t,e,i,s,n,r,o){let a,h,l,c,u,d,g;const f=n[r+1],_=[];for(let n=0,r=i.length;n<r;++n){const r=i[n];for(c=t[r-s],d=t[r-s+1],a=e;a<r;a+=s)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(l=(f-d)/(g-d)*(u-c)+c,_.push(l)),c=u,d=g}let p=NaN,m=-1/0;for(_.sort(U),c=_[0],a=1,h=_.length;a<h;++a){u=_[a];const n=Math.abs(u-c);n>m&&(l=(c+u)/2,_s(t,e,i,s,l,f)&&(p=l,m=n)),c=u}return isNaN(p)&&(p=n[r]),o?(o.push(p,f,m),o):[p,f,m]}function Fs(t,e,i,s,n){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=ks(t,e,a,s,n,2*o,r),e=a[a.length-1]}return r}function Os(t,e,i,s){for(;e<i-s;){for(let n=0;n<s;++n){const r=t[e+n];t[e+n]=t[i-s+n],t[i-s+n]=r}e+=s,i-=s}}function Ls(t,e,i,s){let n=0,r=t[i-s],o=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];n+=(i-r)*(s+o),r=i,o=s}return 0===n?void 0:n>0}function Ns(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Ls(t,e,o,s);if(0===r){if(n&&a||!n&&!a)return!1}else if(n&&!a||!n&&a)return!1;e=o}return!0}function Ds(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!Ns(t,e,o,s,n))return!1;o.length&&(e=o[o.length-1])}return!0}function js(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Ls(t,e,o,s);(0===r?n&&a||!n&&!a:n&&!a||!n&&a)&&Os(t,e,o,s),e=o}return e}function zs(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=js(t,e,i[r],s,n);return e}function Bs(t,e){const i=[];let s,n=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],h=Ls(t,n,a,2);if(void 0===s&&(s=h),h===s)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,n=a}return i}class Ws extends $i{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?K(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Ws(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<vt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(is(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ns(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return _s(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Ts(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),js(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,ls(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=jt(this.getExtent());this.flatInteriorPoint_=ks(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Is(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new As(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new As(e.slice(n,o),t);s.push(a),n=o}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ns(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=js(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Cs(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Ws(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return xs(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=os(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}function Xs(t){if(Kt(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],s=t[2],n=t[3],r=[e,i,e,n,s,n,s,i,e,i];return new Ws(r,"XY",[r.length])}function qs(t,e,i,s){const n=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Rt(t,e,a[0],s),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return n}class Us extends $i{constructor(t,e,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(t[0])){const s=t,n=[],r=[];for(let t=0,e=s.length;t<e;++t){const e=s[t],i=n.length,o=e.getEnds();for(let t=0,e=o.length;t<e;++t)o[t]+=i;K(n,e.getFlatCoordinates()),r.push(o)}e=0===s.length?this.getLayout():s[0].getLayout(),t=n,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;K(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,s=e.length;t<s;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Us(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<vt(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=is(t,e,o,s,n),e=o[o.length-1]}return n}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=ns(t,e,d,s,n,r,o,a,h,l,c),e=d[d.length-1]}return l}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return function(t,e,i,s,n,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(_s(t,e,a,s,n,r))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Ts(t,e,o,s),e=o[o.length-1]}return n}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),zs(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,cs(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=qs(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Fs(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Rs(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ds(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=zs(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h],c=[];o=Cs(t,e,l,s,n,r,o,c),a.push(c),e=l[l.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Us(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),s=i[i.length-1];if(0!==e)for(let t=0,s=i.length;t<s;++t)i[t]-=e;return new Ws(this.flatCoordinates.slice(e,s),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==n)for(let t=0,e=o.length;t<e;++t)o[t]-=n;const h=new Ws(e.slice(n,a),t,o);s.push(h),n=a}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(xs(t,e,o,s,n))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=as(this.flatCoordinates,0,t,this.stride,this.endss_);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}const Ys=Ni();class Zs{constructor(t,e,i,s,n,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=n,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?It(this.flatCoordinates_):Rt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=jt(this.getExtent());this.flatInteriorPoints_=ks(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Bs(this.flatCoordinates_,this.ends_),e=qs(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Fs(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=us(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,n=i.length;s<n;++s){const n=i[s],r=us(t,e,n,this.stride_,.5);K(this.flatMidpoints_,r),e=n}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){const e=(t=gi(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=Wt(i)/Wt(e);Xi(Ys,i[0],i[3],t,-t,0,0,0),Yi(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Ys,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Zs(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Q((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=Ms(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=ws(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=Cs(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s)}return s&&(this.simplifiedGeometry_=new Zs(this.type_,i,s,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}function Vs(t,e,i=0,s=t.length-1,n=Hs){for(;s>i;){if(s-i>600){const r=s-i+1,o=e-i+1,a=Math.log(r),h=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*h*(r-h)/r)*(o-r/2<0?-1:1);Vs(t,e,Math.max(i,Math.floor(e-o*h/r+l)),Math.min(s,Math.floor(e+(r-o)*h/r+l)),n)}const r=t[e];let o=i,a=s;for(Ks(t,i,e),n(t[s],r)>0&&Ks(t,i,s);o<a;){for(Ks(t,o,a),o++,a--;n(t[o],r)<0;)o++;for(;n(t[a],r)>0;)a--}0===n(t[i],r)?Ks(t,i,a):(a++,Ks(t,a,s)),a<=e&&(i=a+1),e<=a&&(s=a-1)}}function Ks(t,e,i){const s=t[e];t[e]=t[i],t[i]=s}function Hs(t,e){return t<e?-1:t>e?1:0}Zs.prototype.getFlatCoordinates=Zs.prototype.getOrientedFlatCoordinates;let $s=class{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!cn(t,e))return i;const s=this.toBBox,n=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?s(o):o;cn(t,a)&&(e.leaf?i.push(o):ln(t,a)?this._all(o,i):n.push(o))}e=n.pop()}return i}collides(t){let e=this.data;if(!cn(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const n=e.children[s],r=e.leaf?this.toBBox(n):n;if(cn(t,r)){if(e.leaf||ln(t,r))return!0;i.push(n)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=un([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),n=[],r=[];let o,a,h;for(;i||n.length;){if(i||(i=n.pop(),a=n[n.length-1],o=r.pop(),h=!0),i.leaf){const s=Js(t,i.children,e);if(-1!==s)return i.children.splice(s,1),n.push(i),this._condense(n),this}h||i.leaf||!ln(i,s)?a?(o++,i=a.children[o],h=!1):i=null:(n.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];for(;t;)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const n=i-e+1;let r,o=this._maxEntries;if(n<=o)return r=un(t.slice(e,i+1)),Qs(r,this.toBBox),r;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),r=un([]),r.leaf=!1,r.height=s;const a=Math.ceil(n/o),h=a*Math.ceil(Math.sqrt(o));dn(t,e,i,h,this.compareMinX);for(let n=e;n<=i;n+=h){const e=Math.min(n+h-1,i);dn(t,n,e,a,this.compareMinY);for(let i=n;i<=e;i+=a){const n=Math.min(i+a-1,e);r.children.push(this._build(t,i,n,s-1))}}return Qs(r,this.toBBox),r}_chooseSubtree(t,e,i,s){for(;s.push(e),!e.leaf&&s.length-1!==i;){let i,s=1/0,n=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=rn(o),h=an(t,o)-a;h<n?(n=h,s=a<s?a:s,i=o):h===n&&a<s&&(s=a,i=o)}e=i||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),n=[],r=this._chooseSubtree(s,this.data,e,n);for(r.children.push(t),en(r,s);e>=0&&n[e].children.length>this._maxEntries;)this._split(n,e),e--;this._adjustParentBBoxes(s,n,e)}_split(t,e){const i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);const r=this._chooseSplitIndex(i,n,s),o=un(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Qs(i,this.toBBox),Qs(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=un([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Qs(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,n=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=tn(t,0,o,this.toBBox),a=tn(t,o,i,this.toBBox),h=hn(e,a),l=rn(e)+rn(a);h<n?(n=h,s=o,r=l<r?l:r):h===n&&l<r&&(r=l,s=o)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:sn,n=t.leaf?this.compareMinY:nn;this._allDistMargin(t,e,i,s)<this._allDistMargin(t,e,i,n)&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const n=this.toBBox,r=tn(t,0,e,n),o=tn(t,i-e,i,n);let a=on(r)+on(o);for(let s=e;s<i-e;s++){const e=t.children[s];en(r,t.leaf?n(e):e),a+=on(r)}for(let s=i-e-1;s>=e;s--){const e=t.children[s];en(o,t.leaf?n(e):e),a+=on(o)}return a}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)en(e[s],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Qs(t[i],this.toBBox)}};function Js(t,e,i){if(!i)return e.indexOf(t);for(let s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function Qs(t,e){tn(t,0,t.children.length,e,t)}function tn(t,e,i,s,n){n||(n=un(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];en(n,t.leaf?s(e):e)}return n}function en(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function sn(t,e){return t.minX-e.minX}function nn(t,e){return t.minY-e.minY}function rn(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function on(t){return t.maxX-t.minX+(t.maxY-t.minY)}function an(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function hn(t,e){const i=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,r-s)}function ln(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function cn(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function un(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function dn(t,e,i,s,n){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=s)continue;const o=e+Math.ceil((i-e)/s/2)*s;Vs(t,o,e,i,n),r.push(e,o,o,i)}}class gn{constructor(t){this.rbush_=new $s(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[rt(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,n=e.length;s<n;s++){const n=t[s],r=e[s],o={minX:n[0],minY:n[1],maxX:n[2],maxY:n[3],value:r};i[s]=o,this.items_[rt(r)]=o}this.rbush_.load(i)}remove(t){const e=rt(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[rt(e)];Gt([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,n=t.length;s<n;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return N(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return bt(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}class fn extends at{constructor(t){super(),this.projection=gi(t.projection),this.attributions_=_n(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){const t=this.getState();return"ready"===t?Promise.resolve():"error"===t?Promise.reject(new Error("Source failed to load")):new Promise((t,e)=>{const i=()=>{const s=this.getState();"ready"===s?(this.un("change",i),t()):"error"===s&&(this.un("change",i),e(new Error("Source failed to load")))};this.on("change",i)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=_n(t),this.changed()}setState(t){this.state_=t,this.changed()}}function _n(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var pn="addfeature",mn="changefeature",yn="clear",xn="removefeature",vn="featuresloadstart",Mn="featuresloadend",wn="featuresloaderror";class Sn extends tt{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class En extends fn{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=J,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(ut(this.format_,"`format` must be set when `url` is set"),this.loader_=ee(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:ki;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,s;this.featuresRtree_=e?new gn:null,this.loadedExtentsRtree_=new gn,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),e||void 0!==i||(i=new ct(s)),void 0!==s&&this.addFeaturesInternal(s),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=rt(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Sn(pn,t))}setupChangeEvents_(t,e){e instanceof Zs||(this.featureChangeKeys_[t]=[D(e,B,this.handleFeatureChange_,this),D(e,O,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof Zs){const s=this.idIndex_[t];s instanceof Zs?Array.isArray(s)?s.push(e):this.idIndex_[t]=[s,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(ut(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let e=0,s=t.length;e<s;e++){const s=t[e],n=rt(s);this.addToIndex_(n,s)&&i.push(s)}for(let t=0,n=i.length;t<n;t++){const n=i[t],r=rt(n);this.setupChangeEvents_(r,n);const o=n.getGeometry();if(o){const t=o.getExtent();e.push(t),s.push(n)}else this.nullGeometryFeatures_[r]=n}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(pn))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new Sn(pn,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(pn,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(xn,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(k,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(F,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(z)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Sn(yn);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const s=i.getGeometry();if(s instanceof Zs||s.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof Zs||s.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),N(this.nullGeometryFeatures_)||K(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=Jt(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let n=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||$,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),h=o;if(o=e instanceof Zs?0:e.closestPointXY(i,s,r,o),o<h){n=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=s-e,a[2]=i+e,a[3]=s+e}}}),n}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=rt(e),s=e.getGeometry();if(s){const t=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const n=e.getId();if(void 0!==n){const t=n.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Sn(mn,e))}hasFeature(t){const e=t.getId();if(void 0!==e){const i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return rt(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&N(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,n=this.strategy_(t,e,i);for(let t=0,r=n.length;t<r;++t){const r=n[t];if(!s.forEachInExtent(r,function(t){return wt(t.extent,r)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Sn(vn));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Sn(Mn,void 0,t))},n=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Sn(wn))};let o=!1;const a=this.loader_.call(this,r,e,i,e=>o||t(e),()=>o||n());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(n)):this.loader_.length<4&&(this.loading=!1),s.insert(r,{extent:r.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(t){i.push(t)}),i.forEach(i=>{e.remove(i);const s=qt(i.extent,t);for(const t of s)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=rt(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(z),delete this.featureChangeKeys_[e];const s=t.getId();if(void 0!==s){const e=s.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(xn)&&this.dispatchEvent(new Sn(xn,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){ut(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(ee(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}var Cn=0,bn=1;const Pn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";Pn.includes("safari")&&!Pn.includes("chrom")&&(Pn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Pn)),Pn.includes("webkit")&&Pn.includes("edge"),Pn.includes("macintosh");const In="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,Rn="undefined"!=typeof Image&&Image.prototype.decode;function Gn(t,e,i,s){let n;return n=i&&i.length?i.shift():In?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e),n.getContext("2d",s)}let Tn;function An(){return Tn||(Tn=Gn(1,1)),Tn}function kn(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Fn(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}}();var On="prerender",Ln="postrender",Nn="precompose",Dn=0,jn=1,zn=2,Bn=3;const Wn=[NaN,NaN,NaN,0];let Xn;const qn=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Un=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Yn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Zn=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Vn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function Kn(t){throw new Error('failed to parse "'+t+'" as color')}function Hn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(Un)||t.match(qn)||t.match(Yn);if(e){const t=e[4],i=100/255;return[ie(Vn(e[1],i)+.5|0,0,255),ie(Vn(e[2],i)+.5|0,0,255),ie(Vn(e[3],i)+.5|0,0,255),void 0!==t?ie(Vn(t,100),0,1):1]}Kn(t)}if(t.startsWith("#")){if(Zn.test(t)){const e=t.substring(1),i=e.length<=4?1:2,s=[0,0,0,255];for(let t=0,n=e.length;t<n;t+=i){let n=parseInt(e.substring(t,t+i),16);1===i&&(n+=n<<4),s[t/i]=n}return s[3]=s[3]/255,s}Kn(t)}const e=(Xn||(Xn=Gn(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),Xn);e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&Kn(t));const s=e.fillStyle;if(s.startsWith("#")||s.startsWith("rgba"))return Hn(s);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const n=Array.from(e.getImageData(0,0,1,1).data);return n[3]=le(n[3]/255,3),n}const $n={};let Jn=0;function Qn(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function tr(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function er(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function ir(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function sr(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function nr(t){const e=ir(t[0]),i=ir(t[1]),s=ir(t[2]),n=sr(.222488403*e+.716873169*i+.06060791*s),r=500*(sr(.452247074*e+.399439023*i+.148375274*s)-n),o=200*(n-sr(.016863605*e+.117638439*i+.865350722*s)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function rr(t){if("none"===t)return Wn;if($n.hasOwnProperty(t))return $n[t];if(Jn>=1024){let t=0;for(const e in $n)3&t++||(delete $n[e],--Jn)}const e=Hn(t);4!==e.length&&Kn(t);for(const i of e)isNaN(i)&&Kn(t);return $n[t]=e,++Jn,e}function or(t){return Array.isArray(t)?t:rr(t)}function ar(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let s=t[2];s!=(0|s)&&(s=s+.5|0);return"rgba("+e+","+i+","+s+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function hr(t,e){return e&&(t.src=e),t.src&&Rn?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(s=>t.complete&&t.width?e(t):i(s))):function(t){return new Promise((e,i)=>{function s(){r(),e(t)}function n(){r(),i(new Error("Image load error"))}function r(){t.removeEventListener("load",s),t.removeEventListener("error",n)}t.addEventListener("load",s),t.addEventListener("error",n)})}(t)}function lr(t,e){return t+":"+(e?or(e):"null")}const cr=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=lr(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=lr(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const n=lr(t,e),r=n in this.cache_;this.cache_[n]=i,s&&(i.getImageState()===Dn&&i.load(),i.getImageState()===jn?i.ready().then(()=>{this.patternCache_[n]=An().createPattern(i.getImage(1),"repeat")}):this.patternCache_[n]=An().createPattern(i.getImage(1),"repeat")),r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let ur=null;class dr extends et{constructor(t,e,i,s,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=n,this.imageState_=void 0===s?Dn:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===zn){ur||(ur=Gn(1,1,void 0,{willReadFrequently:!0})),ur.drawImage(this.image_,0,0);try{ur.getImageData(0,0,1,1),this.tainted_=!1}catch{ur=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(B)}handleImageError_(){this.imageState_=Bn,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=zn,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=Gn(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Dn){this.image_||this.initializeImage_(),this.imageState_=jn;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&hr(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==zn)return;const e=this.image_,i=Gn(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;var n;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(n=this.color_)?n:ar(n),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===zn||this.imageState_===Bn)t();else{const e=()=>{this.imageState_!==zn&&this.imageState_!==Bn||(this.removeEventListener(B,e),t())};this.addEventListener(B,e)}})),this.ready_}}function gr(t,e,i,s,n,r){let o=void 0===e?void 0:cr.get(e,n);return o||(o=new dr(t,t&&"src"in t?t.src||void 0:e,i,s,n),cr.set(e,n,o,r)),r&&o&&!cr.getPattern(e,n)&&cr.set(e,n,o,r),o}function fr(t){return t?Array.isArray(t)?ar(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return cr.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=cr.getPattern(e,t.color);if(i)return i;const s=cr.get(t.src,null);if(s.getImageState()!==zn)return null;const n=Gn(t.size[0],t.size[1]);return n.drawImage(s.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),gr(n.canvas,e,void 0,zn,t.color,!0),cr.getPattern(e,t.color)}(t):t:null}class _r{drawCustom(t,e,i,s,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const pr=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-z0-9]+?)\\s*$"].join(""),"i"),mr=["style","variant","weight","size","lineHeight","family"],yr={normal:400,bold:700},xr=function(t){const e=t.match(pr);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,s=mr.length;t<s;++t){const s=e[t+1];void 0!==s&&(i[mr[t]]="string"==typeof s?s.trim():s)}return isNaN(Number(i.weight))&&i.weight in yr&&(i.weight=yr[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},vr="10px sans-serif",Mr="#000",wr="round",Sr=[],Er="round",Cr="#000",br="center",Pr="middle",Ir=[0,0,0,0],Rr=new at;let Gr,Tr=null;const Ar={},kr=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Fr(t,e,i){return`${t} ${e} 16px "${i}"`}const Or=function(){const t=100;let e,i;async function s(t){await i.ready;const e=xr(t),s=e.families[0].toLowerCase(),n=e.weight,r=[];if(i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=yr[t.weight]||t.weight;i===s&&t.style===e.style&&o==n&&r.push(t)}),0===r.length)return!1;return(await Promise.all(r.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function n(){await i.ready;let r=!0;const o=Rr.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let n=o[i];n<t&&(await s(i)?(L(Ar),Rr.set(i,t)):(n+=10,Rr.set(i,n,!0),n<t&&(r=!1)))}e=void 0,r||(e=setTimeout(n,100))}return async function(t){i||(i=In?self.fonts:document.fonts);const s=xr(t);if(!s)return;const r=s.families;let o=!1;for(const t of r){if(kr.has(t))continue;const e=Fr(s.style,s.weight,t);void 0===Rr.get(e)&&(Rr.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(n,100))}}(),Lr=function(){let t;return function(e){let i=Ar[e];if(null==i){if(In){const t=xr(e),s=Nr(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(s.actualBoundingBoxAscent+s.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);Ar[e]=i}return i}}();function Nr(t,e){return Tr||(Tr=Gn(1,1)),t!=Gr&&(Tr.font=t,Gr=Tr.font),Tr.measureText(e)}function Dr(t,e){return Nr(t,e).width}function jr(t,e,i){if(e in i)return i[e];const s=e.split("\n").reduce((e,i)=>Math.max(e,Dr(t,i)),0);return i[e]=s,s}function zr(t,e,i,s,n,r,o,a,h,l,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),s.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,s=i.length;t<s;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(s,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(s,n,r,o,a,0,0,o,a)):t.drawImage(s,n,r,o,a,h,l,o*c[0],a*c[1]),t.restore()}const Br=0,Wr=1,Xr=2,qr=3,Ur=4,Yr=5,Zr=6,Vr=7,Kr=8,Hr=9,$r=10,Jr=11,Qr=12,to=[Kr],eo=[Qr],io=[Wr],so=[qr];class no extends _r{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,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(t){const e=this.pixelRatio;return 1==e?t:t.map(function(t){return t*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,n=this.coordinates;let r=n.length;for(let o=0,a=t.length;o<a;o+=e)s[0]=t[o],s[1]=t[o+1],Mt(i,s)&&(n[r++]=s[0],n[r++]=s[1]);return r}appendFlatLineCoordinates(t,e,i,s,n,r){const o=this.coordinates;let a=o.length;const h=this.getBufferedMaxExtent();r&&(e+=s);let l=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,_=!0;for(d=e+s;d<i;d+=s)u[0]=t[d],u[1]=t[d+1],f=Et(h,u),f!==g?(_&&(o[a++]=l,o[a++]=c,_=!1),o[a++]=u[0],o[a++]=u[1]):f===gt?(o[a++]=u[0],o[a++]=u[1],_=!1):_=!0,l=u[0],c=u[1],g=f;return(n&&_||d===e+s)&&(o[a++]=l,o[a++]=c),a}drawCustomCoordinates_(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,s,!1,!1);n.push(a),e=o}return e}drawCustom(t,e,i,s,n){this.beginGeometry(t,e,n);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let h,l,c,u,d;switch(r){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),u=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(h,d,e[t],o,i),u.push(i)}this.instructions.push([Ur,a,u,t,i,cs,n]),this.hitDetectionInstructions.push([Ur,a,u,t,s||i,cs,n]);break;case"Polygon":case"MultiLineString":c=[],h="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(h,0,t.getEnds(),o,c),this.instructions.push([Ur,a,c,t,i,ls,n]),this.hitDetectionInstructions.push([Ur,a,c,t,s||i,ls,n]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),l=this.appendFlatLineCoordinates(h,0,h.length,o,!1,!1),this.instructions.push([Ur,a,l,t,i,hs,n]),this.hitDetectionInstructions.push([Ur,a,l,t,s||i,hs,n]);break;case"MultiPoint":h=t.getFlatCoordinates(),l=this.appendFlatPointCoordinates(h,o),l>a&&(this.instructions.push([Ur,a,l,t,i,hs,n]),this.hitDetectionInstructions.push([Ur,a,l,t,s||i,hs,n]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),l=this.coordinates.length,this.instructions.push([Ur,a,l,t,i,void 0,n]),this.hitDetectionInstructions.push([Ur,a,l,t,s||i,void 0,n])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[Br,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[Br,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let s,n,r=-1;for(e=0;e<i;++e)s=t[e],n=s[0],n==Vr?r=e:n==Br&&(s[2]=e,V(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"==typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=fr(i||Mr)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=fr(i||Cr);const s=t.getLineCap();e.lineCap=void 0!==s?s:wr;const n=t.getLineDash();e.lineDash=n?n.slice():Sr;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Er;const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const h=t.getMiterLimit();e.miterLimit=void 0!==h?h:10;const l=t.getOffset();e.strokeOffset=l??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[$r,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[Jr,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!=typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,n=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,h=t.miterLimit,l=t.strokeOffset;(t.currentStrokeStyle!=i||t.currentLineCap!=s||n!=t.currentLineDash&&!H(t.currentLineDash,n)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=h||t.currentStrokeOffset!=l)&&(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=n,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=h,t.currentStrokeOffset=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[Vr,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=this.maxExtent.slice(),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;xt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}class ro extends no{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,n){const r=this.state,o=void 0!==r.fillStyle,a=void 0!==r.strokeStyle,h=i.length;this.instructions.push(io),this.hitDetectionInstructions.push(io);for(let r=0;r<h;++r){const o=i[r],h=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,o,s,!0,!a);this.instructions.push([Hr,h,l,n*this.pixelRatio,!0]),this.hitDetectionInstructions.push([Hr,h,l,n,!0]),a&&(this.instructions.push(so),this.hitDetectionInstructions.push(so)),e=o}return o&&(this.instructions.push(to),this.hitDetectionInstructions.push(to)),a&&(this.instructions.push(eo),this.hitDetectionInstructions.push(eo)),e}drawCircle(t,e,i){const s=this.state,n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([$r,Mr]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([Jr,Cr,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Sr,0]);const a=t.getFlatCoordinates(),h=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,h,!1,!1);const c=[Xr,l,o];this.instructions.push(io,c),this.hitDetectionInstructions.push(io,c),void 0!==s.fillStyle&&(this.instructions.push(to),this.hitDetectionInstructions.push(to)),void 0!==s.strokeStyle&&(this.instructions.push(eo),this.hitDetectionInstructions.push(eo)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([$r,Mr]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([Jr,Cr,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Sr,0]);const a=t.getEnds(),h=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(h,0,a,l,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state,n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([$r,Mr]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([Jr,Cr,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Sr,0]);const a=t.getEndss(),h=t.getOrientedFlatCoordinates(),l=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinatess_(h,c,a[t],l,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=Ss(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke)}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,s=e.strokeStyle,n=e.strokeOffset;return Math.abs(n)>0&&void 0!==i&&void 0!==s&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=s,e.strokeOffset=n,t(),e.fillStyle=i,!0)}}let oo=0,ao=1;function ho(t,e,i,s,n,r,o,a){const h=o-n,l=a-r;let c=0,u=1;if(0===h){if(n<t||n>i)return!1}else{let e=(t-n)/h,s=(i-n)/h;if(e>s){const t=e;e=s,s=t}if(e>c&&(c=e),s<u&&(u=s),c>u)return!1}if(0===l){if(r<e||r>s)return!1}else{let t=(e-r)/l,i=(s-r)/l;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return oo=c,ao=u,!0}function lo(t,e,i,s,n){const r=[];let o=i,a=0,h=e.slice(i,2);for(;a<t&&o+n<s;){const[i,s]=h.slice(-2),l=e[o+n],c=e[o+n+1],u=Math.sqrt((l-i)*(l-i)+(c-s)*(c-s));if(a+=u,a>=t){const e=(t-a+u)/u,d=he(i,l,e),g=he(s,c,e);h.push(d,g),r.push(h),h=[d,g],a==t&&(o+=n),a=0}else if(a<t)h.push(e[o+n],e[o+n+1]),o+=n;else{const t=u-a,e=he(i,l,t/u),d=he(s,c,t/u);h.push(e,d),r.push(h),h=[e,d],a=0,o+=n}}return a>0&&r.push(h),r}function co(t,e,i,s,n){let r,o,a,h,l,c,u,d,g,f,_=i,p=i,m=0,y=0,x=i;for(o=i;o<s;o+=n){const i=e[o],s=e[o+1];void 0!==l&&(g=i-l,f=s-c,h=Math.sqrt(g*g+f*f),void 0!==u&&(y+=a,r=Math.acos((u*g+d*f)/(a*h)),r>t&&(y>m&&(m=y,_=x,p=o),y=0,x=o-n)),a=h,u=g,d=f),l=i,c=s}return y+=h,y>m?[x,o]:[_,p]}const uo={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};const go={Circle:ro,Default:no,Image:class extends no{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!Mt(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,n);this.instructions.push([Zr,r,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([Zr,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),n=[];for(let e=0,i=s.length;e<i;e+=t.getStride())this.maxExtent&&!Mt(this.maxExtent,s.slice(e,e+2))||n.push(s[e],s[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,2);this.instructions.push([Zr,r,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([Zr,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),n=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=n[0],this.originY_=n[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}},LineString:class extends no{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([Hr,r,o,n*this.pixelRatio]),this.hitDetectionInstructions.push([Hr,r,o,n]),i}drawLineString(t,e,i){const s=this.state,n=s.strokeStyle,r=s.lineWidth,o=s.strokeOffset;if(void 0===n||void 0===r)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Jr,Cr,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Sr,0],io);const a=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(a,0,a.length,h,o),this.hitDetectionInstructions.push(eo),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,n=s.strokeStyle,r=s.lineWidth,o=s.strokeOffset;if(void 0===n||void 0===r)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i),this.hitDetectionInstructions.push([Jr,Cr,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,Sr,0],io);const a=t.getEnds(),h=t.getFlatCoordinates(),l=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinates_(h,c,a[t],l,o);this.hitDetectionInstructions.push(eo),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(eo),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(eo),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(io)}},Polygon:ro,Text:class extends no{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Mr]={fillStyle:Mr},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!s&&!n)return;const o=this.coordinates;let a=o.length;const h=t.getType();let l=null,c=t.getStride();if("line"!==r.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let s=r.overflow?null:[];switch(h){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),c=2;break;case"Polygon":l=t.getFlatInteriorPoint(),r.overflow||s.push(l[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();l=[];for(let t=0,i=e.length;t<i;t+=3)r.overflow||s.push(e[t+2]/this.resolution),l.push(e[t],e[t+1]);if(0===l.length)return;c=2}const n=this.appendFlatPointCoordinates(l,c);if(n===a)return;if(s&&(n-a)/2!==l.length/c){let t=a/2;s=s.filter((e,i)=>{const s=o[2*(t+i)]===l[i*c]&&o[2*(t+i)+1]===l[i*c+1];return s||--t,s})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i);let g=r.padding;if(g!=Ir&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],s=r.padding[3];r.scale[0]<0&&(e=-e,s=-s),r.scale[1]<0&&(t=-t,i=-i),g=[t,e,i,s]}const f=this.pixelRatio;this.instructions.push([Zr,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==Ir?Ir:g.map(function(t){return t*f}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]);const _=1/f,p=u?u.slice(0):null;p&&(p[1]=Mr),this.hitDetectionInstructions.push([Zr,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,g,p,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Mr:this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]),this.endGeometry(e)}else{const s=t.getExtent();if(!Vt(this.maxExtent,s))return;let n;if(l=t.getFlatCoordinates(),"LineString"==h)n=[l.length];else if("MultiLineString"==h)n=t.getEnds();else if("Polygon"==h)n=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}if(("LineString"==h||"MultiLineString"==h)&&!wt(this.getBufferedMaxExtent(),s)){const t=function(t,e,i,s){const n=s[0],r=s[1],o=s[2],a=s[3],h=[],l=[];let c,u,d=!1,g=0;for(let s=0,f=e.length;s<f;++s){const f=e[s];let _=t[g],p=t[g+1],m=!1;for(let e=g+i;e<f;e+=i){const i=t[e],s=t[e+1];if(ho(n,r,o,a,_,p,i,s)){const t=i-_,e=s-p,n=_+oo*t,r=p+oo*e,o=_+ao*t,a=p+ao*e;d&&m&&n===c&&r===u?h.push(o,a):(d&&l.push(h.length),h.push(n,r,o,a),d=!0),c=o,u=a,m=!0}_=i,p=s}g=f}return d&&l.push(h.length),{flatCoordinates:h,ends:l}}(l,n,c,this.getBufferedMaxExtent());if(l=t.flatCoordinates,n=t.ends,c=2,0===n.length)return}this.beginGeometry(t,e,i);const u=r.repeat,d=u?void 0:r.textAlign;let g=0;for(let t=0,e=n.length;t<e;++t){let e;e=u?lo(u*this.resolution,l,g,n[t],c):[l.slice(g,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let h=0,l=s.length;if(null==d){const t=co(r.maxAngle,s,0,s.length,2);h=t[0],l=t[1]}for(let t=h;t<l;t+=c)o.push(s[t],s[t+1]);const u=o.length;g=n[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const n=this.textKey_;n in this.textStates||(this.textStates[n]={font:e.font,textAlign:e.textAlign||br,justify:e.justify,textBaseline:e.textBaseline||Pr,scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,n=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,h=uo[s.textBaseline],l=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([Yr,t,e,h,s.overflow,o,s.maxAngle,a,c,n,d*a,u,r,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([Yr,t,e,h,s.overflow,o?Mr:o,s.maxAngle,a,c,n,d*a,u,r,1/a,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(t,e){let i,s,n;if(t){const e=t.getFill();e?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=fr(e.getColor()||Mr)):(s=null,this.textFillState_=s);const r=t.getStroke();if(r){n=this.textStrokeState_,n||(n={},this.textStrokeState_=n);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),s=r.getMiterLimit();n.lineCap=r.getLineCap()||wr,n.lineDash=t?t.slice():Sr,n.lineDashOffset=void 0===e?0:e,n.lineJoin=r.getLineJoin()||Er,n.lineWidth=void 0===i?1:i,n.miterLimit=void 0===s?10:s,n.strokeStyle=fr(r.getColor()||Cr)}else n=null,this.textStrokeState_=n;i=this.textState_;const o=t.getFont()||vr;Or(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||Pr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||Ir,i.scale=void 0===a?[1,1]:a;const h=t.getOffsetX(),l=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===h?0:h,this.textOffsetY_=void 0===l?0:l,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:rt(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?"string"==typeof s.fillStyle?s.fillStyle:"|"+rt(s.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}};class fo{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const n=i[s].finish();t[e][s]=n}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let s=this.buildersByZIndex_[i];void 0===s&&(s={},this.buildersByZIndex_[i]=s);let n=s[e];if(void 0===n){n=new(0,go[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=n}return n}}function _o(t,e,i,s,n,r,o,a){o=o??[],a=a??s;const h=t[e+s],l=t[e+s+1],c=t[i-2*s],u=t[i-2*s+1];let d,g,f,_,p,m,y,x,v=0;for(let M=e;M<i;M+=s){f=d,_=g,p=void 0,m=void 0,M+s<i&&(p=t[M+s],m=t[M+s+1]),r&&M===e&&(f=c,_=u),r&&M===i-s&&(p=h,m=l),d=t[M],g=t[M+1],[y,x]=po(d,g,f,_,p,m,n),o[v++]=y,o[v++]=x;for(let e=2;e<a;e++)o[v++]=t[M+e]}return o.length!=v&&(o.length=v),o}function po(t,e,i,s,n,r,o){let a,h;void 0!==i&&void 0!==s?(a=t-i,h=e-s):void 0!==n&&void 0!==r?(a=n-t,h=r-e):(a=1,h=0);const l=Math.hypot(a,h),c=a/l,u=h/l;if(a=-u,h=c,void 0===i||void 0===s)return[t+a*o,e+h*o];if(void 0===n||void 0===r)return[t+a*o,e+h*o];const d=function(t,e,i){const s=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),n=[(e[0]-t[0])/s,(e[1]-t[1])/s],r=[-n[1],n[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let h=0===s||0===o?0:Math.acos(ie(a[0]*n[0]+a[1]*n[1],-1,1));return h=Math.max(h,1e-5),a[0]*r[0]+a[1]*r[1]>0?h:2*Math.PI-h}([t,e],[i,s],[n,r]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const g=Math.cos(d/2),f=Math.sin(d/2);return[t+(f*a+g*h)*(1/f)*o,e+(-g*a+f*h)*(1/f)*o]}function mo(t,e,i=!1){for(let s=0,n=t.length-2;s<n;s+=e){for(let n=i&&0===s?t.length-3*e:t.length-2*e;n>s+e;n-=e){const i=t[s],r=t[s+1],o=t[s+e],a=t[s+e+1],h=t[n],l=t[n+1],c=t[n+e],u=t[n+e+1],d=(u-l)*(o-i)-(c-h)*(a-r);if(0===d)continue;const g=((c-h)*(r-l)-(u-l)*(i-h))/d,f=((o-i)*(r-l)-(a-r)*(i-h))/d;if(g>0&&g<1&&f>0&&f<1){const h=i+g*(o-i),l=r+g*(a-r);t[s+e]=h,t[s+e+1]=l,t.splice(s+2*e,n-s-e);break}}}return t}let yo;function xo(t,e,i,s,n,r,o,a,h,l,c,u,d=!0){let g=t[e],f=t[e+1],_=0,p=0,m=0,y=0;function x(){_=g,p=f,g=t[e+=s],f=t[e+1],y+=m,m=Math.sqrt((g-_)*(g-_)+(f-p)*(f-p))}do{x()}while(e<i-s&&y+m<r);let v=0===m?0:(r-y)/m;const M=he(_,g,v),w=he(p,f,v),S=e-s,E=y,C=r+a*h(l,n,c);for(;e<i-s&&y+m<C;)x();v=0===m?0:(C-y)/m;const b=he(_,g,v),P=he(p,f,v);let I=!1;if(d)if(u){const t=[M,w,b,P];Zi(t,0,4,2,u,t,t),I=t[0]>t[2]}else I=M>b;const R=Math.PI,G=[],T=S+s===e;let A;if(m=0,y=E,g=t[e=S],f=t[e+1],T){x(),A=Math.atan2(f-p,g-_),I&&(A+=A>0?-R:R);const t=(b+M)/2,e=(P+w)/2;return G[0]=[t,e,(C-r)/2,A,n],G}n=n.replace(/\n/g," ");const k=Array.from((yo||(yo=new Intl.Segmenter(void 0,{granularity:"grapheme"})),yo).segment(n),t=>t.segment);for(let t=0,n=k.length;t<n;){x();let u=Math.atan2(f-p,g-_);if(I&&(u+=u>0?-R:R),void 0!==A){let t=u-A;if(t+=t>R?-2*R:t<-R?2*R:0,Math.abs(t)>o)return null}A=u;const d=t;let M=0;for(;t<n;++t){const o=a*h(l,k[I?n-t-1:t],c);if(e+s<i&&y+m<r+M+o/2)break;M+=o}if(t===d)continue;const w=(I?k.slice(n-t,n-d):k.slice(d,t)).join("");v=0===m?0:(r+M/2-y)/m;const S=he(_,g,v),E=he(p,f,v);G.push([S,E,M/2,u,w]),r+=M}return G}class vo{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(An(),{get:(t,e)=>{if("function"==typeof t[e])return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushMethodArgs_=(...t)=>{this.push_(this.pendingMethod_,t)};pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const s=e[i];if("function"==typeof s){s(t);continue}const n=e[++i];"function"==typeof t[s]?t[s](...n):t[s]="function"==typeof n?n(t):n}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}const Mo=[1/0,1/0,-1/0,-1/0],wo=[],So=[],Eo=[],Co=[];function bo(t){return t[3].declutterBox}const Po=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 Io(t,e){return"start"===e?e=Po.test(t)?"right":"left":"end"===e&&(e=Po.test(t)?"left":"right"),uo[e]}function Ro(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function Go(t,e,i){return i%2==0&&(t+=e),t}class To{constructor(t,e,i,s,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=Ni(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=n?new vo:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const n=t+e+i+s;if(this.labels_[n])return this.labels_[n];const r=s?this.strokeStates[s]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=a.justify?uo[a.justify]:Io(Array.isArray(t)?t[0]:t,a.textAlign||br),u=s&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Ro,[]),{width:g,height:f,widths:_,heights:p,lineWidths:m}=function(t,e){const i=[],s=[],n=[];let r=0,o=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){r=Math.max(r,o),n.push(o),o=0,a+=h,h=0;continue}const d=e[l+1]||t.font,g=Dr(d,u);i.push(g),o+=g;const f=Lr(d);s.push(f),h=Math.max(h,f)}return{width:r,height:a,widths:i,heights:s,lineWidths:n}}(a,d),y=g+u,x=[],v=(y+2)*l[0],M=(f+u)*l[1],w={width:v<0?Math.floor(v):Math.ceil(v),height:M<0?Math.floor(M):Math.ceil(M),contextInstructions:x};1==l[0]&&1==l[1]||x.push("scale",l),s&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const S=.5-c;let E=c*y+S*u;const C=[],b=[];let P,I=0,R=0,G=0,T=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){R+=I,I=0,E=c*y+S*u,++T;continue}const n=d[t+1]||a.font;n!==P&&(s&&C.push("font",n),i&&b.push("font",n),P=n),I=Math.max(I,p[G]);const r=[e,E+S*_[G]+c*(_[G]-m[T]),.5*(u+I)+R];E+=_[G],s&&C.push("strokeText",r),i&&b.push("fillText",r),++G}return Array.prototype.push.apply(x,C),Array.prototype.push.apply(x,b),this.labels_[n]=w,w}replayTextBackground_(t,e,i,s,n,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,n),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,n,r,o,a,h,l,c,u,d,g,f,_){let p=i-(o*=u[0]),m=s-(a*=u[1]);const y=n+h>t?t-h:n,x=r+l>e?e-l:r,v=g[3]+y*u[0]+g[1],M=g[0]+x*u[1]+g[2],w=p-g[3],S=m-g[0];let E;return(f||0!==c)&&(wo[0]=w,Co[0]=w,wo[1]=S,So[1]=S,So[0]=w+v,Eo[0]=So[0],Eo[1]=S+M,Co[1]=Eo[1]),0!==c?(E=Xi(Ni(),i,s,1,1,c,-i,-s),Bi(E,wo),Bi(E,So),Bi(E,Eo),Bi(E,Co),bt(Math.min(wo[0],So[0],Eo[0],Co[0]),Math.min(wo[1],So[1],Eo[1],Co[1]),Math.max(wo[0],So[0],Eo[0],Co[0]),Math.max(wo[1],So[1],Eo[1],Co[1]),Mo)):bt(Math.min(w,w+v),Math.min(S,S+M),Math.max(w,w+v),Math.max(S,S+M),Mo),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:x,originX:h,originY:l,declutterBox:{minX:Mo[0],minY:Mo[1],maxX:Mo[2],maxY:Mo[3],value:_},canvasTransform:E,scale:u}}replayImageOrLabel_(t,e,i,s,n,r,o){const a=!(!r&&!o),h=s.declutterBox,l=o?o[2]*s.scale[0]/2:0;return h.minX-l<=e[0]&&h.maxX+l>=0&&h.minY-l<=e[1]&&h.maxY+l>=0&&(a&&this.replayTextBackground_(t,wo,So,Eo,Co,r,o),zr(t,s.canvasTransform,n,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Bi(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const n=this.textStates[e],r=this.createLabel(t,e,s,i),o=this.strokeStates[i],a=this.pixelRatio,h=Io(Array.isArray(t)?t[0]:t,n.textAlign||br),l=uo[n.textBaseline||Pr],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:h*(r.width/a-2*n.scale[0])+2*(.5-h)*c,anchorY:l*r.height/a+2*(.5-l)*c}}execute_(t,e,i,s,n,r,o,a){const h=this.zIndexContext_;let l;var c,u;this.pixelCoordinates_&&H(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=Yi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),c=this.renderedTransform_,u=i,c[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const g=s.length;let f,_=0;const p=[];let m,y,x,v,M,w,S,E,C,b,P,I,R,G=0,T=0;const A=this.coordinateCache_,k=this.viewRotation_,F=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},L=this.instructions!=s||this.overlaps?0:200;let N,D,j,z;for(;d<g;){const i=s[d];switch(i[0]){case Br:N=i[1],z=i[3],N.getGeometry()?void 0===o||Vt(o,z.getExtent())?++d:d=i[2]+1:d=i[2],h&&(h.zIndex=i[4]);break;case Wr:G>L&&(this.fill_(t),G=0),T>L&&(t.stroke(),T=0),G||T||(t.beginPath(),M=NaN,w=NaN),++d;break;case Xr:_=i[1],x=i[2]??0;const s=l[_],c=l[_+1],u=l[_+2]-x-s,g=l[_+3]-x-c,B=Math.sqrt(u*u+g*g);t.moveTo(s+B,c),t.arc(s,c,B,0,2*Math.PI,!0),++d;break;case qr:t.closePath(),++d;break;case Ur:_=i[1],f=i[2];const W=i[3],X=i[4],q=i[5];O.geometry=W,O.feature=N,d in A||(A[d]=[]);const U=A[d];q?q(l,_,f,2,U):(U[0]=l[_],U[1]=l[_+1],U.length=2),h&&(h.zIndex=i[6]),X(U,O),++d;break;case Zr:_=i[1],f=i[2],C=i[3],m=i[4],y=i[5];let Y=i[6];const Z=i[7],V=i[8],K=i[9],H=i[10];let $=i[11];const J=i[12];let Q=i[13];v=i[14]||"declutter";const tt=i[15];if(!C&&i.length>=20){b=i[19],P=i[20],I=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(b,P,I,R);C=t.label,i[3]=C;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const s=i[24];y=(t.anchorY-s)*this.pixelRatio,i[5]=y,Y=C.height,i[6]=Y,Q=C.width,i[13]=Q}let et,it,st,nt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],st=i[17],nt=i[18]):(it=Ir,st=null,nt=null),H&&F?$+=k:H||F||($-=k);let rt=0;for(;_<f;_+=2){if(et&&et[rt++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(C.width,C.height,l[_],l[_+1],Q,Y,m,y,V,K,$,J,n,it,!!st||!!nt,N),s=[t,e,C,i,Z,st,nt];if(a){let t,e,n,r,o;if(tt){const i=f-_;if(!tt[i]){tt[i]={args:s,declutterMode:v};continue}const r=tt[i];t=r.args,e=r.declutterMode,delete tt[i],n=bo(t)}if(!t||"declutter"===e&&a.collides(n)||(r=!0),"declutter"===v&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===v){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(n),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==v&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,s))}else this.replayImageOrLabel_.apply(this,s)}++d;break;case Yr:const ot=i[1],at=i[2],ht=i[3],lt=i[4];R=i[5];const ct=i[6],ut=i[7],dt=i[8];I=i[9];const gt=i[10];b=i[11],Array.isArray(b)&&(b=b.reduce(Go,"")),P=i[12];const ft=[i[13],i[13]];v=i[14]||"declutter";const _t=i[15],pt=i[16],mt=this.textStates[P],yt=mt.font,xt=[mt.scale[0]*ut,mt.scale[1]*ut];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const Mt=vs(l,ot,at,2),wt=Math.abs(xt[0])*jr(yt,b,vt);if(lt||wt<=Mt){const i=xo(l,ot,at,2,b,(Mt-wt)*Io(b,this.textStates[P].textAlign),ct,Math.abs(xt[0]),jr,yt,vt,F?0:this.viewRotation_,_t);t:if(i){const s=[];let n,r,o,h,l;if(I)for(n=0,r=i.length;n<r;++n){l=i[n],o=l[4],h=this.createLabel(o,P,"",I),m=l[2]+(xt[0]<0?-gt:gt)-pt,y=ht*h.height+2*(.5-ht)*gt*xt[1]/xt[0]-dt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,m,y,0,0,l[3],ft,!1,Ir,!1,N);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;s.push([t,e,h,r,1,null,null])}if(R)for(n=0,r=i.length;n<r;++n){l=i[n],o=l[4],h=this.createLabel(o,P,R,""),m=l[2]-pt,y=ht*h.height-dt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,m,y,0,0,l[3],ft,!1,Ir,!1,N);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;s.push([t,e,h,r,1,null,null])}a&&"none"!==v&&a.load(s.map(bo));for(let t=0,e=s.length;t<e;++t)this.replayImageOrLabel_.apply(this,s[t])}}++d;break;case Vr:if(void 0!==r){N=i[1];const t=r(N,z,v);if(t)return t}++d;break;case Kr:L?G++:this.fill_(t),++d;break;case Hr:let St,Et,Ct;if(_=i[1],f=i[2],x=i[3],x){const t=(i[4]??!1)||Math.abs(l[_]-l[f-2])<1e-6&&Math.abs(l[_+1]-l[f-1])<1e-6;_o(l,_,f,2,x,t,p),mo(p,2,t),St=p,Et=0,Ct=St.length}else St=l,Et=_,Ct=f;D=St[Et],j=St[Et+1],t.moveTo(D,j),M=D+.5|0,w=j+.5|0;for(let e=Et+2;e<Ct;e+=2)D=St[e],j=St[e+1],S=D+.5|0,E=j+.5|0,e!=Ct-2&&S===M&&E===w||(t.lineTo(D,j),M=S,w=E);++d;break;case $r:this.alignAndScaleFill_=i[2],G?(this.fill_(t),G=0,T&&(t.stroke(),T=0)):T&&i[1]&&(t.stroke(),T=0),t.fillStyle=i[1],++d;break;case Jr:G&&i[1]&&(this.fill_(t),G=0),T&&(t.stroke(),T=0),this.setStrokeStyle_(t,i),++d;break;case Qr:L?T++:t.stroke(),++d;break;default:++d}}G&&this.fill_(t),T&&t.stroke()}execute(t,e,i,s,n,r){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,n,void 0,void 0,r)}executeHitDetection(t,e,i,s,n){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,n)}}const Ao=["Polygon","Circle","LineString","Image","Text","Default"],ko=["Image","Text"],Fo=Ao.filter(t=>!ko.includes(t));let Oo=!1,Lo=!1;class No{constructor(t,e,i,s,n,r,o){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Ni(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,o)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];void 0===s&&(s={},this.executorsByZIndex_[i]=s);const n=t[i];for(const t in n){const i=n[t];s[t]=new To(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,s=t.length;e<s;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,n,r){!1===Lo&&function(){let t=0;const e=e=>{const i=Gn(1,1,null,{willReadFrequently:e});let s=0;const n=performance.now();for(;performance.now()-n<50;++s)i.fillStyle=`rgba(255,0,${s%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=s>t?s:t,s},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};Oo=i[t],Lo=!0}();const o=2*(s=Math.round(s))+1,a=Xi(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=Gn(o,o,null,{willReadFrequently:Oo}));const l=this.hitDetectionContext_;let c;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):h||l.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=[1/0,1/0,-1/0,-1/0],At(c,t),xt(c,e*(this.renderBuffer_+s),c));const u=function(t){if(void 0!==Do[t])return Do[t];const e=2*t+1,i=t*t,s=new Array(i+1);for(let n=0;n<=t;++n)for(let r=0;r<=t;++r){const o=n*n+r*r;if(o>i)break;let a=s[o];a||(a=[],s[o]=a),a.push(4*((t+n)*e+(t+r))+3),n>0&&a.push(4*((t-n)*e+(t+r))+3),r>0&&(a.push(4*((t+n)*e+(t-r))+3),n>0&&a.push(4*((t-n)*e+(t-r))+3))}const n=[];for(let t=0,e=s.length;t<e;++t)s[t]&&n.push(...s[t]);return Do[t]=n,n}(s);let d;function g(t,e,i){const a=l.getImageData(0,0,o,o).data;for(let h=0,c=u.length;h<c;h++)if(a[u[h]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[h]-3)/4,r=s-i%o,a=s-(i/o|0),l=n(t,e,r*r+a*a);if(l)return l}l.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let _,p,m,y,x;for(f.sort(U),_=f.length-1;_>=0;--_){const t=f[_].toString();for(m=this.executorsByZIndex_[t],p=Ao.length-1;p>=0;--p)if(d=Ao[p],y=m[d],void 0!==y&&(x=y.executeHitDetection(l,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],n=e[2],r=e[3],o=[i,s,i,r,n,r,n,s];return Yi(o,0,8,2,t,o),o}isEmpty(){return N(this.executorsByZIndex_)}execute(t,e,i,s,n,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?Y:U),r=r||Ao;const h=Ao.length;for(let l=0,c=a.length;l<c;++l){const c=a[l].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],g=u[d];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>g.execute(t,e,i,s,n,o)):g.execute(c,e,i,s,n,o),u&&c.restore(),r){r.offset();const t=a[l]*h+Ao.indexOf(d);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(U);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}}const Do={};function jo(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class zo{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=jo(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new zo({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return st()}getImage(t){return st()}getHitDetectionImage(){return st()}getPixelRatio(t){return 1}getImageState(){return st()}getImageSize(){return st()}getOrigin(){return st()}getSize(){return st()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=jo(t)}listenImageChange(t){st()}load(){st()}unlistenImageChange(t){st()}ready(){return Promise.resolve()}}function Bo(t,e,i,s){return void 0!==i&&void 0!==s?[i/t,s/e]:void 0!==i?i/t:void 0!==s?s/e:1}class Wo extends zo{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,s=void 0!==t.scale?t.scale:1,n=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:s,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:n,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(ut(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||rt(r)),ut(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),ut(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=Dn:void 0!==r&&(o="complete"in r?r.complete?r.src?zn:Dn:jn:zn),this.color_=void 0!==t.color?or(t.color):null,this.iconImage_=gr(r,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const s=this.getImage(1);if(s.width&&s.height)e=s.width,i=s.height;else if(s instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(Bo(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(Bo(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Wo({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_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?or(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),s=void 0!==i?null:this.getHitDetectionImage(),n=void 0!==i?Dn:this.iconImage_.getImageState();this.iconImage_=gr(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},n,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=gr(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Dn,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==zn?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==zn?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(B,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(B,t)}ready(){return this.iconImage_.ready()}}class Xo extends _r{constructor(t,e,i,s,n,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?le(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=r,this.userTransform_=o,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_=Ni()}drawImages_(t,e,i,s){if(!this.image_)return;const n=Yi(t,e,i,s,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let h=this.imageRotation_;0===this.transformRotation_&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let t=0,e=n.length;t<e;t+=2){const e=n[t]-this.imageAnchorX_,i=n[t+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,s=i+this.imageAnchorY_;Xi(o,t,s,1,1,h,-t,-s),r.save(),r.transform.apply(r,o),r.translate(t,s),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,i,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,s){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const n=Yi(t,e,i,s,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=s){const t=n[e]+this.textOffsetX_,i=n[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,s,n,r){const o=this.context_;let a=Yi(t,e,i,s,this.transform_,this.pixelCoordinates_);if(Math.abs(r)>0){const t=a.length,e=n||Math.abs(a[0]-a[t-2])<1e-6&&Math.abs(a[1]-a[t-1])<1e-6;a=_o(a,0,t,2,r,e,a),mo(a,2,e)}o.moveTo(a[0],a[1]);let h=a.length;n&&(h-=2);for(let t=2;t<h;t+=2)o.lineTo(a[t],a[t+1]);return n&&o.closePath(),i}drawRings_(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0,n);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Vt(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const s=t.getFlatCoordinates();if(!s)return null;const n=t.getStride();return Yi(s,0,s.length,n,e,i)}(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],s=e[3]-e[1],n=Math.sqrt(i*i+s*s),r=this.context_;r.beginPath(),r.arc(e[0],e[1],n,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Vt(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(Vt(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let s=0;const n=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=n.length;t<e;++t)s=this.moveToLineTo_(i,s,n[t],r,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Vt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Vt(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const n=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=n.length;t<e;++t){const e=n[t];s=this.drawRings_(i,s,e,r,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),H(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:br;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:fr(e||Mr)}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),s=e.getLineDash(),n=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),h=s||Sr,l=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:wr,lineDash:1===this.pixelRatio_?h:h.map(t=>t*this.pixelRatio_),lineDashOffset:(n||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Er,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:fr(t||Cr),strokeOffset:(l??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),n=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:fr(t||Mr)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),s=i.getLineDash(),n=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:wr,lineDash:s||Sr,lineDashOffset:n||0,lineJoin:void 0!==r?r:Er,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:fr(t||Cr)}}else this.textStrokeState_=null;const s=t.getFont(),n=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==s?s:vr,textAlign:void 0!==c?c:br,textBaseline:void 0!==u?u:Pr},this.text_=void 0!==l?Array.isArray(l)?l.reduce((t,e,i)=>t+(i%2?" ":e),""):l:"",this.textOffsetX_=void 0!==n?this.pixelRatio_*n:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}}const qo=.5;function Uo(t,e,i,s,n,r,o,a,h){const l=h?Pi(n):n,c=Gn(t[0]*qo,t[1]*qo);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new Xo(c,qo,n,null,o,a,h?vi(null,h):null),g=i.length,f=Math.floor(16777215/g),_={};for(let t=1;t<=g;++t){const e=i[t-1],n=e.getStyleFunction()||s;if(!n)continue;let o=n(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*f).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],s=i.getGeometryFunction()(e);if(!s||!Vt(l,s.getExtent()))continue;const n=i.clone(),r=n.getFill();r&&r.setColor(a);const h=n.getStroke();h&&(h.setColor(a),h.setLineDash(null)),n.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=Gn(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),n.setImage(new Wo({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=n.getZIndex()||0;let d=_[u];d||(d={},_[u]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const g=s.getType();if("GeometryCollection"===g){const t=s.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,n)}}else d[g.replace("Multi","")].push(s,n)}}const p=Object.keys(_).map(Number).sort(U);for(let t=0,i=p.length;t<i;++t){const i=_[p[t]];for(const t in i){const s=i[t];for(let t=0,i=s.length;t<i;t+=2){d.setStyle(s[t+1]);for(let i=0,n=e.length;i<n;++i)d.setTransform(e[i]),d.drawGeometry(s[t])}}}return c.getImageData(0,0,u.width,u.height)}function Yo(t,e,i){const s=[];if(i){const n=Math.floor(Math.round(t[0])*qo),r=Math.floor(Math.round(t[1])*qo),o=4*(ie(n,0,i.width-1)+ie(r,0,i.height-1)*i.width),a=i.data[o],h=i.data[o+1],l=i.data[o+2]+256*(h+256*a),c=Math.floor(16777215/e.length);l&&l%c===0&&s.push(e[l/c-1])}return s}const Zo={Point:function(t,e,i,s,n,r){const o=i.getImage(),a=i.getText(),h=a&&a.getText(),l=r&&o&&h?{}:void 0;if(o){if(o.getImageState()!=zn)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,l),r.drawPoint(e,s,n)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,l),r.drawText(e,s,n)}},LineString:function(t,e,i,s,n){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,s,n)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,s,n)}},Polygon:function(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}},MultiPoint:function(t,e,i,s,n,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),h=i.getText(),l=h&&h.getText(),c=r&&a&&l?{}:void 0;if(a){if(o.getImageState()!=zn)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,s,n)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(h,c),r.drawText(e,s,n)}},MultiLineString:function(t,e,i,s,n){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,s,n)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,s,n)}},MultiPolygon:function(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}},GeometryCollection:function(t,e,i,s,n,r){const o=e.getGeometriesArray();let a,h;for(a=0,h=o.length;a<h;++a){(0,Zo[o[a].getType()])(t,o[a],i,s,n,r)}},Circle:function(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}};function Vo(t,e){return parseInt(rt(t),10)-parseInt(rt(e),10)}function Ko(t,e){const i=Ho(t,e);return i*i}function Ho(t,e){return.5*t/e}function $o(t,e,i,s,n,r,o,a){const h=[],l=i.getImage();if(l){let t=!0;const e=l.getImageState();e==zn||e==Bn?t=!1:e==Dn&&l.load(),t&&h.push(l.ready())}const c=i.getFill();c&&c.loading()&&h.push(c.ready());const u=h.length>0;return u&&Promise.all(h).then(()=>n(null)),function(t,e,i,s,n,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const h=a.simplifyTransformed(s,n),l=i.getRenderer();if(l)Jo(t,h,i,e,o);else{(0,Zo[h.getType()])(t,h,i,e,o,r)}}(t,e,i,s,r,o,a),u}function Jo(t,e,i,s,n){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)Jo(t,r[e],i,s,n);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,s,i.getRenderer(),i.getHitDetectionRenderer(),n)}class Qo extends tt{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}}class ta extends it{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return st()}getData(t){return null}prepareFrame(t){return st()}renderFrame(t,e){return st()}forEachFeatureAtCoordinate(t,e,i,s,n){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==zn&&e.getState()!==Bn||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=zn&&e!=Bn&&t.addEventListener(B,this.boundHandleImageChange_),e==Dn&&(t.load(),e=t.getState()),e==zn}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}}const ea=[];let ia=null;class sa extends ta{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Ni(),this.pixelTransform=Ni(),this.inversePixelTransform=Ni(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let s;ia||(ia=Gn(1,1,void 0,{willReadFrequently:!0})),ia.clearRect(0,0,1,1);try{ia.drawImage(t,e,i,1,1,0,0,1,1),s=ia.getImageData(0,0,1,1).data}catch{return ia=null,null}return s}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i,s,n){if(Fn(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===s&&t.height===n){const e=t,s=e.getContext("2d");if(s)return this.container=t,this.context=s,this.containerReused=!0,void(i&&(s.fillStyle=i,s.fillRect(0,0,e.width,e.height)))}const r=this.getLayer().getClassName();let o,a;if(t&&t.className===r&&(!i||t&&t.style.backgroundColor&&H(or(t.style.backgroundColor),or(i)))){const e=t.firstElementChild;Fn(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const i=Ui(t),s=Ui(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-s[t])*qi[t]))return!1;return!0}(a.canvas.style.transform,e)?(this.container=t,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=In?new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get:(t,e,i)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}):document.createElement("div"),o.className=r;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=Gn();const e=a.canvas;o.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=Ut(i),n=Yt(i),r=Dt(i),o=Nt(i);Bi(e.coordinateToPixelTransform,s),Bi(e.coordinateToPixelTransform,n),Bi(e.coordinateToPixelTransform,r),Bi(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Bi(a,s),Bi(a,n),Bi(a,r),Bi(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,n=t.viewState.rotation,r=t.pixelRatio,o=Math.round(Zt(i)/s*r),a=Math.round(Wt(i)/s*r);Xi(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,n,-o/2,-a/2),function(t,e){const i=(s=e)[0]*s[3]-s[1]*s[2];var s;ut(0!==i,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5];t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=n/i,t[4]=(o*l-a*h)/i,t[5]=-(n*l-r*h)/i}(this.inversePixelTransform,this.pixelTransform);const h="matrix("+this.pixelTransform.join(", ")+")";const l=this.getBackground(t);if(this.useContainer(e,h,l,o,a),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const n=new Qo(t,this.inversePixelTransform,i,e);s.dispatchEvent(n)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(On,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Ln,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new vo),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(On,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Ln,this.context,t))}getRenderTransform(t,e,i,s,n,r,o){const a=n/2,h=r/2,l=s/e,c=-l,u=-t[0]+o,d=-t[1];return Xi(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}}class na extends sa{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(t,e,i){const s=e.extent,n=e.viewState,r=n.center,o=n.resolution,a=n.projection,h=n.rotation,l=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[Cn]||g[bn]),_=this.context,p=Math.round(Zt(s)/o*d),m=Math.round(Wt(s)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?Zt(l):null,v=y?Math.ceil((s[2]-l[2])/x)+(this.extendX_?2:1):1;let M=y?Math.floor((s[0]-l[0])/x)-(this.extendX_?1:0):0;do{let s=this.getRenderTransform(r,o,0,d,p,m,M*x);e.declutter&&(s=s.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],s,h,f,void 0===i?Ao:i?ko:Fo,i?u&&e.declutter[u]:void 0)}while(++M<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=Gn(this.context.canvas.width,this.context.canvas.height,ea))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,kn(this.context),ea.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const n=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){if(!(this.getLayer().hasListener(On)||this.getLayer().hasListener(Ln)))return this.container}this.setDrawContext_(),this.preRender(n,t),s.projection,this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=Ii(i.extent);o=Vt(e,t.extent);o&&!wt(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(n,t,e),a=!0))}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),a&&n.restore(),this.postRender(n,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,s=this.renderedRotation_,n=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],h=t[0]*qo,l=t[1]*qo;a.push(this.getRenderTransform(e,i,s,qo,h,l,0).slice());const c=o.getSource(),u=n.getExtent();if(c.getWrapX()&&n.canWrapX()&&!wt(u,r)){let t=r[0];const n=Zt(u);let o,c=0;for(;t<u[0];)--c,o=n*c,a.push(this.getRenderTransform(e,i,s,qo,h,l,o).slice()),t+=n;for(c=0,t=r[2];t>u[2];)++c,o=n*c,a.push(this.getRenderTransform(e,i,s,qo,h,l,o).slice()),t-=n}this.hitDetectionImageData_=Uo(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,s,Ko(i,this.renderedPixelRatio_),null)}e(Yo(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,n){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),h={},l=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=rt(t),o=h[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return h[r]=!0,n.splice(n.lastIndexOf(o),1),s(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return h[r]=!0,s(t,a,e);n.push(h[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:s})}},l?e.declutter?.[l]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[Cn],n=t.viewHints[bn],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&s||!o&&n)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=Vo);const _=h.center.slice(),p=xt(a,g*c),m=p.slice(),y=[p.slice()],x=l.getExtent(),v=i.getWrapX()&&l.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!Kt(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!wt(x,t.extent)||this.extendX_)){const t=Zt(x),e=Math.max(Zt(p)/2,t);let i=x[0],s=x[2];this.extendX_&&(i-=t,s+=t),p[0]=i-e,p[2]=s+e,fe(_,l);const n=$t(y[0],l);n[0]<x[0]&&n[2]<x[2]?y.push([n[0]+t,n[1],n[2]+t,n[3]]):n[0]>x[0]&&n[2]>x[2]&&y.push([n[0]-t,n[1],n[2]-t,n[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&wt(this.wrappedRenderedExtent_,p))return H(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const M=new fo(Ho(c,u),p,c,u);for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,l);const w=Ko(c,u);let S=!0;const E=(t,i)=>{let s;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(s=n(t,c)),s){const e=this.renderFeature(t,w,s,M,void 0,this.getLayer().getDeclutter(),i);S=S&&!e}},C=Pi(p),b=i.getFeaturesInExtent(C);f&&b.sort(f);for(let t=0,e=b.length;t<e;++t)E(b[t],t);this.renderedFeatures_=b,this.ready=S;const P=M.finish(),I=new No(p,c,u,i.getOverlaps(),P,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,this.renderedProjection_=l,this.renderedPixelRatio_=u,this.replayGroup_=I,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,n,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let h=0,l=i.length;h<l;++h)a=$o(s,t,i[h],e,this.boundHandleStyleImageChange_,n,r,o)||a;else a=$o(s,t,i,e,this.boundHandleStyleImageChange_,n,r,o);return a}}let ra=0;const oa=1<<ra++,aa=1<<ra++,ha=1<<ra++,la=1<<ra++,ca=1<<ra++,ua=1<<ra++,da=Math.pow(2,6)-1,ga={[oa]:"boolean",[aa]:"number",[ha]:"string",[la]:"color",[ca]:"number[]",[ua]:"size"},fa=Object.keys(ga).map(Number).sort(U);function _a(t){const e=[];for(const i of fa)pa(t,i)&&e.push(ga[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function pa(t,e){return(t&e)===e}function ma(t,e){return!!(t&e)}function ya(t,e){return t===e}class xa{constructor(t,e){if(!function(t){return t in ga}(t))throw new Error(`literal expressions must have a specific type, got ${_a(t)}`);this.type=t,this.value=e}}class va{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Ma(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function wa(t,e,i){switch(typeof t){case"boolean":if(ya(e,ha))return new xa(ha,t?"true":"false");if(!pa(e,oa))throw new Error(`got a boolean, but expected ${_a(e)}`);return new xa(oa,t);case"number":if(ya(e,ua))return new xa(ua,jo(t));if(ya(e,oa))return new xa(oa,!!t);if(ya(e,ha))return new xa(ha,t.toString());if(!pa(e,aa))throw new Error(`got a number, but expected ${_a(e)}`);return new xa(aa,t);case"string":if(ya(e,la))return new xa(la,rr(t));if(ya(e,oa))return new xa(oa,!!t);if(!pa(e,ha))throw new Error(`got a string, but expected ${_a(e)}`);return new xa(ha,t)}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"==typeof t[0])return function(t,e,i){const s=t[0],n=ph[s];if(!n)throw new Error(`unknown operator: ${s}`);return n(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(ya(e,ua)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new xa(ua,t)}if(ya(e,la)){if(3===t.length)return new xa(la,[...t,1]);if(4===t.length)return new xa(la,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!pa(e,ca))throw new Error(`got an array of numbers, but expected ${_a(e)}`);return new xa(ca,t)}const Sa="get",Ea="var",Ca="concat",ba="geometry-type",Pa="line-metric",Ia="any",Ra="all",Ga="!",Ta="resolution",Aa="zoom",ka="time",Fa="==",Oa="!=",La=">",Na=">=",Da="<",ja="<=",za="*",Ba="/",Wa="+",Xa="-",qa="clamp",Ua="%",Ya="^",Za="abs",Va="floor",Ka="ceil",Ha="round",$a="sin",Ja="cos",Qa="atan",th="sqrt",eh="match",ih="between",sh="interpolate",nh="coalesce",rh="case",oh="in",ah="number",hh="string",lh="array",ch="color",uh="id",dh="band",gh="palette",fh="to-string",_h="has",ph={[Sa]:Ch(vh(1,1/0),mh),[Ea]:function(t,e,i){const s=t[1];if("string"!=typeof s)throw new Error("expected a string argument for var operation");let n=e;const r=i.inputVariables?.[s];if(void 0!==r){const t=wa(r,da,i);if(!(t instanceof xa))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${s}`);let o=t.type;if("string"==typeof r&&ma(n,la)&&!ma(n,ha)?o=la:Array.isArray(r)&&2===r.length&&ma(n,ua)&&!ma(n,ca)&&(o=ua),n&=o,0===n)throw new Error(`the type expected from the var operator (${_a(e)}) did not have any overlap with the type of the corresponding style variables (${_a(o)}), variable name: ${s}`)}if(i.variables.has(s)){const t=i.variables.get(s);if(n&=t,0===n)throw new Error(`a new type expected from the var operator (${_a(e)}) did not have any overlap with the previous type expected for it (${_a(t)}), variable name: ${s}`)}return i.variables.set(s,n),new va(n,"var",new xa(ha,s))},[_h]:Ch(vh(1,1/0),mh),[uh]:Ch(function(t,e,i){i.featureId=!0},xh),[Ca]:Ch(vh(2,1/0),wh(ha)),[ba]:Ch(function(t,e,i){i.geometryType=!0},xh),[Pa]:Ch(function(t,e,i){i.mCoordinate=!0},xh),[Ta]:Ch(yh,xh),[Aa]:Ch(yh,xh),[ka]:Ch(yh,xh),[Ia]:Ch(vh(2,1/0),wh(oa)),[Ra]:Ch(vh(2,1/0),wh(oa)),[Ga]:Ch(vh(1,1),wh(oa)),[Fa]:Ch(vh(2,2),Sh()),[Oa]:Ch(vh(2,2),Sh()),[La]:Ch(vh(2,2),wh(aa)),[Na]:Ch(vh(2,2),wh(aa)),[Da]:Ch(vh(2,2),wh(aa)),[ja]:Ch(vh(2,2),wh(aa)),[za]:Ch(vh(2,1/0),Mh),[nh]:Ch(vh(2,1/0),Mh),[Ba]:Ch(vh(2,2),wh(aa)),[Wa]:Ch(vh(2,1/0),wh(aa)),[Xa]:Ch(vh(2,2),wh(aa)),[qa]:Ch(vh(3,3),wh(aa)),[Ua]:Ch(vh(2,2),wh(aa)),[Ya]:Ch(vh(2,2),wh(aa)),[Za]:Ch(vh(1,1),wh(aa)),[Va]:Ch(vh(1,1),wh(aa)),[Ka]:Ch(vh(1,1),wh(aa)),[Ha]:Ch(vh(1,1),wh(aa)),[$a]:Ch(vh(1,1),wh(aa)),[Ja]:Ch(vh(1,1),wh(aa)),[Qa]:Ch(vh(1,2),wh(aa)),[th]:Ch(vh(1,1),wh(aa)),[eh]:Ch(vh(4,1/0),Eh,function(t,e,i){const s=t.length-1,n=wa(t[t.length-1],e,i);let r=ha|aa|oa;const o=new Array(s-2);for(let e=0;e<s-2;e+=2){try{r&=wa(t[e+2],r,i).type}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}if(0===r)throw new Error("no common type was found among the arguments of match expression")}for(let e=0;e<s-2;e+=2){try{const s=wa(t[e+2],r,i);o[e]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const s=wa(t[e+3],n.type,i);o[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[wa(t[1],r,i),...o,n]}),[ih]:Ch(vh(3,3),wh(aa)),[sh]:Ch(vh(6,1/0),Eh,function(t,e,i){const s=t[1];let n;switch(s[0]){case"linear":n=1;break;case"exponential":const t=s[1];if("number"!=typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);n=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(s)}`)}const r=new xa(aa,n);let o;try{o=wa(t[2],aa,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let s=0;s<a.length;s+=2){try{const e=wa(t[s+3],aa,i);a[s]=e}catch(t){throw new Error(`failed to parse argument ${s+2} for interpolate expression: ${t.message}`)}try{const n=wa(t[s+4],e,i);a[s+1]=n}catch(t){throw new Error(`failed to parse argument ${s+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[rh]:Ch(vh(3,1/0),function(t,e,i){const s=t[0],n=t.length-1;if(n%2==0)throw new Error(`expected an odd number of arguments for ${s}, got ${n} instead`)},function(t,e,i){const s=wa(t[t.length-1],e,i),n=new Array(t.length-1);for(let e=0;e<n.length-1;e+=2){try{const s=wa(t[e+1],oa,i);n[e]=s}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=wa(t[e+2],s.type,i);n[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return n[n.length-1]=s,n}),[oh]:Ch(vh(2,2),function(t,e,i){let s,n=t[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');if("literal"===n[0]){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof n[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');s="string"==typeof n[0]?ha:aa;const r=new Array(n.length);for(let t=0;t<r.length;t++)try{const e=wa(n[t],s,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[wa(t[1],s,i),...r]}),[ah]:Ch(vh(1,1/0),wh(da)),[hh]:Ch(vh(1,1/0),wh(da)),[lh]:Ch(vh(1,1/0),wh(aa)),[ch]:Ch(vh(1,4),wh(aa)),[dh]:Ch(vh(1,3),wh(aa)),[gh]:Ch(vh(2,2),function(t,e,i){let s;try{s=wa(t[1],aa,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const n=t[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let t=0;t<r.length;t++){let e;try{e=wa(n[t],la,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof xa))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[s,...r]}),[fh]:Ch(vh(1,1),wh(oa|aa|ha|la))};function mh(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=t[r+1];switch(typeof s){case"number":n[r]=new xa(aa,s);break;case"string":n[r]=new xa(ha,s);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${s}`)}0===r&&i.properties.set(String(s),e)}return n}function yh(t,e,i){i.mapState=!0}function xh(t,e,i){const s=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${s} operation`);return[]}function vh(t,e){return function(i,s,n){const r=i[0],o=i.length-1;if(t===e){if(o!==t){throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}}else if(o<t||o>e){throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}}function Mh(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=wa(t[r+1],e,i);n[r]=s}return n}function wh(t){return function(e,i,s){const n=e.length-1,r=new Array(n);for(let i=0;i<n;++i){const n=wa(e[i+1],t,s);r[i]=n}return r}}function Sh(){return function(t,e,i){const s=t[0],n=t.length-1,r=new Array(n);let o=da;for(let e=0;e<n;++e){o&=wa(t[e+1],o,i).type}if(0===o)throw new Error(`no common type was found among the arguments of ${s}`);for(let e=0;e<n;++e){const s=wa(t[e+1],o,i);r[e]=s}return r}}function Eh(t,e,i){const s=t[0],n=t.length-1;if(n%2==1)throw new Error(`expected an even number of arguments for operation ${s}, got ${n} instead`)}function Ch(...t){return function(e,i,s){const n=e[0];let r;for(let n=0;n<t.length;n++){const o=t[n](e,i,s);if(n==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new va(i,n,...r)}}function bh(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return bh(t.getGeometries()[0]);default:return""}}function Ph(t,e,i){return Ih(wa(t,e,i))}function Ih(t,e){if(t instanceof xa){if(t.type===la&&"string"==typeof t.value){const e=rr(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case ah:case hh:case nh:return function(t){const e=t.operator,i=t.args.length,s=new Array(i);for(let e=0;e<i;++e)s[e]=Ih(t.args[e]);switch(e){case nh:return t=>{for(let e=0;e<i;++e){const i=s[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case ah:case hh:return t=>{for(let n=0;n<i;++n){const i=s[n](t);if(typeof i===e)return i}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}(t);case Sa:case Ea:case _h:return function(t){const e=t.args[0],i=e.value;switch(t.operator){case Sa:return e=>{const s=t.args;let n=e.properties[i];for(let t=1,e=s.length;t<e;++t){n=n[s[t].value]}return n};case Ea:return t=>t.variables[i];case _h:return e=>{const s=t.args;if(!(i in e.properties))return!1;let n=e.properties[i];for(let t=1,e=s.length;t<e;++t){const e=s[t].value;if(!n||!Object.hasOwn(n,e))return!1;n=n[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case uh:return t=>t.featureId;case ba:return t=>t.geometryType;case Ca:{const e=t.args.map(t=>Ih(t));return t=>"".concat(...e.map(e=>e(t).toString()))}case Ta:return t=>t.resolution;case Ia:case Ra:case ih:case oh:case Ga:return function(t){const e=t.operator,i=t.args.length,s=new Array(i);for(let e=0;e<i;++e)s[e]=Ih(t.args[e]);switch(e){case Ia:return t=>{for(let e=0;e<i;++e)if(s[e](t))return!0;return!1};case Ra:return t=>{for(let e=0;e<i;++e)if(!s[e](t))return!1;return!0};case ih:return t=>{const e=s[0](t),i=s[1](t),n=s[2](t);return e>=i&&e<=n};case oh:return t=>{const e=s[0](t);for(let n=1;n<i;++n)if(e===s[n](t))return!0;return!1};case Ga:return t=>!s[0](t);default:throw new Error(`Unsupported logical operator ${e}`)}}(t);case Fa:case Oa:case Da:case ja:case La:case Na:return function(t){const e=t.operator,i=Ih(t.args[0]),s=Ih(t.args[1]);switch(e){case Fa:return t=>i(t)===s(t);case Oa:return t=>i(t)!==s(t);case Da:return t=>i(t)<s(t);case ja:return t=>i(t)<=s(t);case La:return t=>i(t)>s(t);case Na:return t=>i(t)>=s(t);default:throw new Error(`Unsupported comparison operator ${e}`)}}(t);case za:case Ba:case Wa:case Xa:case qa:case Ua:case Ya:case Za:case Va:case Ka:case Ha:case $a:case Ja:case Qa:case th:return function(t){const e=t.operator,i=t.args.length,s=new Array(i);for(let e=0;e<i;++e)s[e]=Ih(t.args[e]);switch(e){case za:return t=>{let e=1;for(let n=0;n<i;++n)e*=s[n](t);return e};case Ba:return t=>s[0](t)/s[1](t);case Wa:return t=>{let e=0;for(let n=0;n<i;++n)e+=s[n](t);return e};case Xa:return t=>s[0](t)-s[1](t);case qa:return t=>{const e=s[0](t),i=s[1](t);if(e<i)return i;const n=s[2](t);return e>n?n:e};case Ua:return t=>s[0](t)%s[1](t);case Ya:return t=>Math.pow(s[0](t),s[1](t));case Za:return t=>Math.abs(s[0](t));case Va:return t=>Math.floor(s[0](t));case Ka:return t=>Math.ceil(s[0](t));case Ha:return t=>Math.round(s[0](t));case $a:return t=>Math.sin(s[0](t));case Ja:return t=>Math.cos(s[0](t));case Qa:return 2===i?t=>Math.atan2(s[0](t),s[1](t)):t=>Math.atan(s[0](t));case th:return t=>Math.sqrt(s[0](t));default:throw new Error(`Unsupported numeric operator ${e}`)}}(t);case rh:return function(t){const e=t.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Ih(t.args[s]);return t=>{for(let s=0;s<e-1;s+=2){if(i[s](t))return i[s+1](t)}return i[e-1](t)}}(t);case eh:return function(t){const e=t.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Ih(t.args[s]);return t=>{const s=i[0](t);for(let n=1;n<e-1;n+=2)if(s===i[n](t))return i[n+1](t);return i[e-1](t)}}(t);case sh:return function(t){const e=t.args.length,i=new Array(e);for(let s=0;s<e;++s)i[s]=Ih(t.args[s]);return t=>{const s=i[0](t),n=i[1](t);let r,o;for(let a=2;a<e;a+=2){const e=i[a](t);let h=i[a+1](t);const l=Array.isArray(h);if(l&&(h=Qn(h)),e>=n)return 2===a?h:l?Gh(s,n,r,o,e,h):Rh(s,n,r,o,e,h);r=e,o=h}return o}}(t);case fh:return function(t){const e=t.operator,i=t.args.length,s=new Array(i);for(let e=0;e<i;++e)s[e]=Ih(t.args[e]);if(e===fh)return e=>{const i=s[0](e);return t.args[0].type===la?ar(i):i.toString()};throw new Error(`Unsupported convert operator ${e}`)}(t);default:throw new Error(`Unsupported operator ${i}`)}}function Rh(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=e-i;return s+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-s)}function Gh(t,e,i,s,n,r){if(0===n-i)return s;const o=nr(s),a=nr(r);let h=a[2]-o[2];h>180?h-=360:h<-180&&(h+=360);return function(t){const e=(t[0]+16)/116,i=t[1],s=t[2]*Math.PI/180,n=er(e),r=er(e+i/500*Math.cos(s)),o=er(e-i/200*Math.sin(s)),a=tr(3.021973625*r-1.617392459*n-.404875592*o),h=tr(-.943766287*r+1.916279586*n+.027607165*o),l=tr(.069407491*r-.22898585*n+1.159737864*o);return[ie(a+.5|0,0,255),ie(h+.5|0,0,255),ie(l+.5|0,0,255),t[3]]}([Rh(t,e,i,o[0],n,a[0]),Rh(t,e,i,o[1],n,a[1]),o[2]+Rh(t,e,i,0,n,h),Rh(t,e,i,s[3],n,r[3])])}class Th extends zo{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?jn:zn,this.imageState_===jn&&this.ready().then(()=>this.imageState_=zn),this.render()}clone(){const t=this.getScale(),e=new Th({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(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=cr.get(i,null)?.getImage(1);if(!s){const e=this.renderOptions_,n=Math.ceil(e.size*t),r=Gn(n,n);this.draw_(e,r,t),s=r.canvas;const o=new dr(s,void 0,null,zn,null);cr.set(i,null,o),createImageBitmap(s).then(t=>{o.setImage(t)})}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let s=this.radius,n=void 0===this.radius2_?s:this.radius2_;if(s<n){const t=s;s=n,n=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=n*Math.sin(o),h=s-Math.sqrt(n*n-a*a),l=Math.sqrt(a*a+h*h),c=l/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(h/l),g=Math.sqrt((s+u)*(s+u)+d*d)-s;if(void 0===this.radius2_||"bevel"===t)return 2*g;const f=s*Math.sin(o),_=n-Math.sqrt(s*s-f*f),p=Math.sqrt(f*f+_*_)/f;if(p<=i){const t=p*e/2-n-s;return 2*Math.max(g,t)}return 2*g}createRenderOptions(){let t,e=wr,i=Er,s=0,n=null,r=0,o=0;this.stroke_&&(t=fr(this.stroke_.getColor()??Cr),o=this.stroke_.getWidth()??1,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Er,e=this.stroke_.getLineCap()??wr,s=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,s),h=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*h+a),lineCap:e,lineDash:n,lineDashOffset:r,lineJoin:i,miterLimit:s}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t=Mr),e.fillStyle=fr(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;"string"==typeof i&&(i=or(i)),null===i?s=1:Array.isArray(i)&&(s=4===i.length?i[3]:1),0===s&&(e=Gn(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const n=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=n+o*r,a=o%2==0?i:s;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=Mr,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}class Ah extends Th{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new Ah({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}class kh{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new kh({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"==typeof t&&"src"in t){const e=gr(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===Dn&&e.load(),e.getImageState()===jn&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?rt(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:or(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}class Fh{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new Fh({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),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_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}class Oh{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Dh,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new Oh({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Dh,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let Lh=null;function Nh(t,e){if(!Lh){const t=new kh({color:"rgba(255,255,255,0.4)"}),e=new Fh({color:"#3399CC",width:1.25});Lh=[new Oh({image:new Ah({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Lh}function Dh(t){return t.getGeometry()}class jh{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=jo(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new kh({color:"#333"}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new jh({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof kh?this.getFill().clone():this.getFill(),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,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}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_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=jo(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}function zh(t){return!0}function Bh(t,e){const i=function(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n){const i=t[n],r="filter"in i?Ph(i.filter,oa,e):zh;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let s=0;s<t;++s)o[s]=Xh(i.style[s],e)}else o=[Xh(i.style,e)];s[n]={filter:r,styles:o}}return function(e){const n=[];let r=!1;for(let o=0;o<i;++o){if((0,s[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of s[o].styles){const i=t(e);i&&n.push(i)}}}return n}}(t,e=e??Ma()),s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t,n){if(s.properties=t.getPropertiesInternal(),s.resolution=n,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}return e.geometryType&&(s.geometryType=bh(t.getGeometry())),i(s)}}function Wh(t,e){e=e??Ma();const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Xh(t[n],e);const n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},r=new Array(i);return function(t,o){if(n.properties=t.getPropertiesInternal(),n.resolution=o,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}e.geometryType&&(n.geometryType=bh(t.getGeometry()));let a=0;for(let t=0;t<i;++t){const e=s[t](n);e&&(r[a]=e,a+=1)}return r.length=a,r}}function Xh(t,e){const i=qh(t,"",e),s=Uh(t,"",e),n=function(t,e){const i="text-",s=Vh(t,i+"value",e);if(!s)return null;const n=qh(t,i,e),r=qh(t,i+"background-",e),o=Uh(t,i,e),a=Uh(t,i+"background-",e),h=Vh(t,i+"font",e),l=Zh(t,i+"max-angle",e),c=Zh(t,i+"offset-x",e),u=Zh(t,i+"offset-y",e),d=Kh(t,i+"overflow",e),g=Vh(t,i+"placement",e),f=Zh(t,i+"repeat",e),_=tl(t,i+"scale",e),p=Kh(t,i+"rotate-with-view",e),m=Zh(t,i+"rotation",e),y=Vh(t,i+"align",e),x=Vh(t,i+"justify",e),v=Vh(t,i+"baseline",e),M=Kh(t,i+"keep-upright",e),w=$h(t,i+"padding",e),S=nl(t,i+"declutter-mode"),E=new jh({declutterMode:S});return function(t){if(E.setText(s(t)),n&&E.setFill(n(t)),r&&E.setBackgroundFill(r(t)),o&&E.setStroke(o(t)),a&&E.setBackgroundStroke(a(t)),h&&E.setFont(h(t)),l&&E.setMaxAngle(l(t)),c&&E.setOffsetX(c(t)),u&&E.setOffsetY(u(t)),d&&E.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");E.setPlacement(e)}if(f&&E.setRepeat(f(t)),_&&E.setScale(_(t)),p&&E.setRotateWithView(p(t)),m&&E.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");E.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");E.setJustify(e)}if(v){const e=v(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");E.setTextBaseline(e)}return w&&E.setPadding(w(t)),M&&E.setKeepUpright(M(t)),E}}(t,e),r=function(t,e){if("icon-src"in t)return function(t,e){const i="icon-",s=i+"src",n=ol(t[s],s),r=Jh(t,i+"anchor",e),o=tl(t,i+"scale",e),a=Zh(t,i+"opacity",e),h=Jh(t,i+"displacement",e),l=Zh(t,i+"rotation",e),c=Kh(t,i+"rotate-with-view",e),u=il(t,i+"anchor-origin"),d=sl(t,i+"anchor-x-units"),g=sl(t,i+"anchor-y-units"),f=Yh(t,i+"color");let _,p=null;if(void 0!==f){Array.isArray(f)&&f.length>0&&"string"==typeof f[0]?p=Hh(t,i+"color",e):_=hl(f,i+"color")}const m=function(t,e){const i=t[e];if(void 0===i)return;if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}(t,i+"cross-origin"),y=function(t,e){const i=t[e];if(void 0===i)return;return rl(i,e)}(t,i+"offset"),x=il(t,i+"offset-origin"),v=el(t,i+"width"),M=el(t,i+"height"),w=function(t,e){const i=t[e];if(void 0===i)return;if("number"==typeof i)return jo(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}(t,i+"size"),S=nl(t,i+"declutter-mode"),E={src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:x,height:M,width:v,size:w,declutterMode:S};let C=null;return function(t){if(C)p&&C.setColor(p(t));else{const e=p?p(t):_;C=new Wo(void 0!==e?Object.assign({},E,{color:e}):Object.assign({},E))}return a&&C.setOpacity(a(t)),h&&C.setDisplacement(h(t)),l&&C.setRotation(l(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),r&&C.setAnchor(r(t)),C}}(t,e);if("shape-points"in t)return function(t,e){const i="shape-",s=i+"points",n=i+"radius",r=al(t[s],s);if(!(n in t))throw new Error(`Expected a number for ${n}`);const o=Zh(t,n,e),a="number"==typeof t[n]?t[n]:5,h=i+"radius2",l=Zh(t,h,e),c="number"==typeof t[h]?t[h]:void 0,u=qh(t,i,e),d=Uh(t,i,e),g=tl(t,i+"scale",e),f=Jh(t,i+"displacement",e),_=Zh(t,i+"rotation",e),p=Kh(t,i+"rotate-with-view",e),m=el(t,i+"angle"),y=nl(t,i+"declutter-mode"),x=new Th({points:r,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&x.setRadius(o(t)),l&&x.setRadius2(l(t)),u&&x.setFill(u(t)),d&&x.setStroke(d(t)),f&&x.setDisplacement(f(t)),_&&x.setRotation(_(t)),p&&x.setRotateWithView(p(t)),g&&x.setScale(g(t)),x}}(t,e);if("circle-radius"in t)return function(t,e){const i="circle-",s=qh(t,i,e),n=Uh(t,i,e),r=Zh(t,i+"radius",e),o=tl(t,i+"scale",e),a=Jh(t,i+"displacement",e),h=Zh(t,i+"rotation",e),l=Kh(t,i+"rotate-with-view",e),c=nl(t,i+"declutter-mode"),u=new Ah({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),s&&u.setFill(s(t)),n&&u.setStroke(n(t)),a&&u.setDisplacement(a(t)),h&&u.setRotation(h(t)),l&&u.setRotateWithView(l(t)),o&&u.setScale(o(t)),u}}(t,e);return null}(t,e),o=Zh(t,"z-index",e);if(!(i||s||n||r||N(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new Oh;return function(t){let e=!0;if(i){const s=i(t);s&&(e=!1),a.setFill(s)}if(s){const i=s(t);i&&(e=!1),a.setStroke(i)}if(n){const i=n(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function qh(t,e,i){let s;if(e+"fill-pattern-src"in t)s=function(t,e,i){const s=Vh(t,e+"pattern-src",i),n=Qh(t,e+"pattern-offset",i),r=Qh(t,e+"pattern-size",i),o=Hh(t,e+"color",i);return function(t){return{src:s(t),offset:n&&n(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;s=Hh(t,e+"fill-color",i)}if(!s)return null;const n=new kh;return function(t){const e=s(t);return e===Wn?null:(n.setColor(e),n)}}function Uh(t,e,i){const s=Zh(t,e+"stroke-width",i),n=Hh(t,e+"stroke-color",i);if(!s&&!n)return null;const r=Vh(t,e+"stroke-line-cap",i),o=Vh(t,e+"stroke-line-join",i),a=$h(t,e+"stroke-line-dash",i),h=Zh(t,e+"stroke-line-dash-offset",i),l=Zh(t,e+"stroke-miter-limit",i),c=Zh(t,e+"stroke-offset",i),u=new Fh;return function(t){if(n){const e=n(t);if(e===Wn)return null;u.setColor(e)}if(s&&u.setWidth(s(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),h&&u.setLineDashOffset(h(t)),l&&u.setMiterLimit(l(t)),c&&u.setOffset(c(t)),u}}function Yh(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Zh(t,e,i){const s=Yh(t,e);if(void 0===s)return;const n=Ph(s,aa,i);return function(t){return al(n(t),e)}}function Vh(t,e,i){const s=Yh(t,e);if(void 0===s)return null;const n=Ph(s,ha,i);return function(t){return ol(n(t),e)}}function Kh(t,e,i){const s=Yh(t,e);if(void 0===s)return null;const n=Ph(s,oa,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Hh(t,e,i){const s=Yh(t,e);if(void 0===s)return null;const n=Ph(s,la,i);return function(t){return hl(n(t),e)}}function $h(t,e,i){const s=Yh(t,e);if(void 0===s)return null;if(Array.isArray(s)&&(0===s.length||"string"!=typeof s[0])){const t=s.map((t,s)=>{if("number"==typeof t)return()=>t;const n=Ph(t,aa,i);return function(t){return al(n(t),`${e}[${s}]`)}});return function(e){const i=new Array(t.length);for(let s=0;s<t.length;++s)i[s]=t[s](e);return i}}const n=Ph(s,ca,i);return function(t){return rl(n(t),e)}}function Jh(t,e,i){const s=Yh(t,e);if(void 0===s)return null;const n=Ph(s,ca,i);return function(t){const i=rl(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Qh(t,e,i){const s=Yh(t,e);if(void 0===s)return null;const n=Ph(s,ca,i);return function(t){return ll(n(t),e)}}function tl(t,e,i){const s=Yh(t,e);if(void 0===s)return null;const n=Ph(s,ca|aa,i);return function(t){return function(t,e){if("number"==typeof t)return t;return ll(t,e)}(n(t),e)}}function el(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function il(t,e){const i=t[e];if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function sl(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function nl(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function rl(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let s=0;s<i;++s)if("number"!=typeof t[s])throw new Error(`Expected an array of numbers for ${e}`);return t}function ol(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function al(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function hl(t,e){if("string"==typeof t)return t;const i=rl(t,e),s=i.length;if(s<3||s>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function ll(t,e){const i=rl(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}var cl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function ul(t,e,i){return function(s,n,r,o,a){if(!s)return;if(!n&&!e)return s;const h=e?0:r[0]*n,l=e?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,f=t[1]+l/2+u,_=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),f>_&&(f=(_+f)/2,_=f);let p=ie(s[0],d,g),m=ie(s[1],f,_);if(o&&i&&n){const t=30*n;p+=-t*Math.log(1+Math.max(0,d-s[0])/t)+t*Math.log(1+Math.max(0,s[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-s[1])/t)+t*Math.log(1+Math.max(0,s[1]-_)/t)}return[p,m]}}function dl(t){return t}function gl(t){return Math.pow(t,3)}function fl(t){return 1-gl(1-t)}function _l(t){return 3*t*t-2*t*t*t}function pl(t,e,i,s){const n=Zt(e)/i[0],r=Wt(e)/i[1];return s?Math.min(t,Math.max(n,r)):Math.min(t,Math.min(n,r))}function ml(t,e,i){let s=Math.min(t,e);return s*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(s=Math.max(s,i),s/=Math.log(1+50*Math.max(0,i/t-1))/50+1),ie(s,i/2,2*e)}function yl(t,e,i,s,n){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=s?pl(t,s,a,n):t;return i&&h?ml(r,o,e):ie(r,e,o)}}}function xl(t){if(void 0!==t)return 0}function vl(t){if(void 0!==t)return t}const Ml=256;class wl extends at{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=pi(t.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,t.projection&&(ci=!1),t.center&&(t.center=bi(t.center,this.projection_)),t.extent&&(t.extent=Ii(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in cl)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,s;const n=28,r=2;let o=void 0!==t.minZoom?t.minZoom:0,a=void 0!==t.maxZoom?t.maxZoom:n;const h=void 0!==t.zoomFactor?t.zoomFactor:r,l=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=pi(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,_=t.extent;l||_||!d.isGlobal()||(f=!1,_=g);if(void 0!==t.resolutions){const n=t.resolutions;i=n[o],s=void 0!==n[a]?n[a]:n[n.length-1],e=t.constrainResolution?function(t,e,i,s){return e=void 0===e||e,function(n,r,o,a){if(void 0!==n){const h=t[0],l=t[t.length-1],c=i?pl(h,i,o,s):h;if(a)return e?ml(n,c,l):ie(n,l,c);const u=Math.min(c,n),d=Math.floor(Z(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(n,c,!f&&_,u):yl(i,s,c,!f&&_,u)}else{const l=(g?Math.max(Zt(g),Wt(g)):360*pe.degrees/d.getMetersPerUnit())/Ml/Math.pow(r,0),p=l/Math.pow(r,n-0);i=t.maxResolution,void 0!==i?o=0:i=l/Math.pow(h,o),s=t.minResolution,void 0===s&&(s=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,a):l/Math.pow(h,a):p),a=o+Math.floor(Math.log(i/s)/Math.log(h)),s=i/Math.pow(h,a-o),e=t.constrainResolution?function(t,e,i,s,n,r){return s=void 0===s||s,i=void 0!==i?i:0,function(o,a,h,l){if(void 0!==o){const c=n?pl(e,n,h,r):e;if(l)return s?ml(o,c,i):ie(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),_=Math.floor(Math.log(e/f)/Math.log(t)+g),p=Math.max(d,_);return ie(e/Math.pow(t,p),i,c)}}}(h,i,s,c,!f&&_,u):yl(i,s,c,!f&&_,u)}return{constraint:e,maxResolution:i,minResolution:s,minZoom:o,zoomFactor:h}}(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return ul(t.extent,t.constrainOnlyCenter,e)}const e=pi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,ul(t,!1,!1)}return dl}(t),n=i.constraint,r=function(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=oe(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?vl:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):vl}return xl}(t);this.constraints_={center:s,resolution:n,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const n=this.getResolution(),r=n/2*(s[3]-e[3]+e[1]-s[1]),o=n/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=bi(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=bi(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let s=0;for(;s<i&&!this.isDef();++s){const t=arguments[s];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(s===i)return void(e&&Sl(e,!0));let n=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const h=[];for(;s<i;++s){const t=arguments[s],i={start:n,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||_l,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=a;const e=ae(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}El(i)?i.complete=!0:n+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(Cn,1),this.updateAnimations_()}getAnimating(){return this.hints_[Cn]>0}getInteracting(){return this.hints_[bn]>0}cancelAnimations(){let t;this.setHint(Cn,-this.hints_[Cn]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Sl(i[0].callback,!1),!t)for(let e=0,s=i.length;e<s;++e){const s=i[e];if(!s.complete){t=s.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let n=!0;for(let i=0,r=s.length;i<r;++i){const r=s[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):n=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],s=r.targetCenter[1];this.nextCenter_=r.targetCenter;const n=t+h*(i-t),o=e+h*(s-e);this.targetCenter_=[n,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?ae(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(n){this.animations_[i]=null,this.setHint(Cn,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=s[0].callback;t&&Sl(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();var n,r;return void 0!==s&&(i=[s[0]-e[0],s[1]-e[1]],function(t,e){const i=Math.cos(e),s=Math.sin(e),n=t[0]*i-t[1]*s,r=t[1]*i+t[0]*s;t[0]=n,t[1]=r}(i,t-this.getRotation()),r=e,(n=i)[0]+=+r[0],n[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),n=this.getResolution();if(void 0!==s&&void 0!==n){i=[e[0]-t*(e[0]-s[0])/n,e[1]-t*(e[1]-s[1])/n]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?Ci(t,this.getProjection()):t}getCenterInternal(){return this.get(cl.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){return Pi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();ut(e,"The view center is not defined");const i=this.getResolution();ut(void 0!==i,"The view resolution is not defined");const s=this.getRotation();return ut(void 0!==s,"The view rotation is not defined"),function(t,e,i,s,n){const[r,o,a,h,l,c,u,d]=Bt(t,e,i,s);return bt(Math.min(r,a,l,u),Math.min(o,h,c,d),Math.max(r,a,l,u),Math.max(o,h,c,d),n)}(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(cl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Ii(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=Zt(t)/e[0],s=Wt(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*s)}}getRotation(){return this.get(cl.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,n=Math.log(i/s)/e;return function(t){return Math.log(i/t)/e/n}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const n=this.padding_;if(n){const t=this.getViewportSizeMinusPadding_();s=Cl(s,this.getViewportSize_(),[t[0]/2+n[3],t[1]/2+n[0]],e,i)}return{center:s.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,s=this.minZoom_||0;if(this.resolutions_){const n=Z(this.resolutions_,t,1);s=n,e=this.resolutions_[n],i=n==this.resolutions_.length-1?2:e/this.resolutions_[n+1]}else e=this.maxResolution_,i=this.zoomFactor_;return s+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=ie(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,ie(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(ut(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){ut(!Kt(t),"Cannot fit empty extent provided as `geometry`");i=Xs(Ii(t,this.getProjection()))}else if("Circle"===t.getType()){const e=Ii(t.getExtent(),this.getProjection());i=Xs(e),i.rotate(this.getRotation(),jt(e))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),n=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let t=0,e=n.length;t<e;t+=r){const e=n[t]*i-n[t+1]*s,r=n[t]*s+n[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),h=Math.max(h,e),l=Math.max(l,r)}return[o,a,h,l]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.getViewportSizeMinusPadding_());const s=void 0!==e.padding?e.padding:[0,0,0,0],n=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let a=this.getResolutionForExtentInternal(o,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,n?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=jt(o);u[0]+=(s[1]-s[3])/2*a,u[1]+=(s[0]-s[2])/2*a;const d=u[0]*c-u[1]*l,g=u[1]*c+u[0]*l,f=this.getConstrainedCenter([d,g],a),_=e.callback?e.callback:J;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Sl(_,!0))}centerOn(t,e,i){this.centerOnInternal(bi(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(Cl(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let n;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=Cl(t,s,[o[0]/2+r[3],o[1]/2+r[0]],e,i);n=[t[0]-a[0],t[1]-a[1]]}return n}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=Ci(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&bi(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(n,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=bi(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?bi(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),n=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,n,i),o=this.constraints_.center(this.targetCenter_,r,n,i,this.calculateCenterShift(this.targetCenter_,r,s,n));this.get(cl.ROTATION)!==s&&this.set(cl.ROTATION,s),this.get(cl.RESOLUTION)!==r&&(this.set(cl.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(cl.CENTER)&&ge(this.get(cl.CENTER),o)||this.set(cl.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const s=e||0,n=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,s,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,n,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=n,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===n&&this.getCenterInternal()&&ge(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:a,resolution:o,duration:t,easing:fl,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(bn,1)}endInteraction(t,e,i){i=i&&bi(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(bn,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Sl(t,e){setTimeout(function(){t(e)},0)}function El(t){return!(t.sourceCenter&&t.targetCenter&&!ge(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function Cl(t,e,i,s,n){const r=Math.cos(-n);let o=Math.sin(-n),a=t[0]*r-t[1]*o,h=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*s,h+=(i[1]-e[1]/2)*s,o=-o;return[a*r-h*o,h*r+a*o]}var bl="opacity",Pl="visible",Il="extent",Rl="zIndex",Gl="maxResolution",Tl="minResolution",Al="maxZoom",kl="minZoom",Fl="source",Ol="map";class Ll extends at{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[bl]=void 0!==t.opacity?t.opacity:1,ut("number"==typeof e[bl],"Layer opacity must be a number"),e[Pl]=void 0===t.visible||t.visible,e[Rl]=t.zIndex,e[Gl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Tl]=void 0!==t.minResolution?t.minResolution:0,e[kl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Al]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=ie(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return st()}getLayerStatesArray(t){return st()}getExtent(){return this.get(Il)}getMaxResolution(){return this.get(Gl)}getMinResolution(){return this.get(Tl)}getMinZoom(){return this.get(kl)}getMaxZoom(){return this.get(Al)}getOpacity(){return this.get(bl)}getSourceState(){return st()}getVisible(){return this.get(Pl)}getZIndex(){return this.get(Rl)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Il,t)}setMaxResolution(t){this.set(Gl,t)}setMinResolution(t){this.set(Tl,t)}setMaxZoom(t){this.set(Al,t)}setMinZoom(t){this.set(kl,t)}setOpacity(t){ut("number"==typeof t,"Layer opacity must be a number"),this.set(bl,t)}setVisible(t){this.set(Pl,t)}setZIndex(t){this.set(Rl,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}class Nl extends Ll{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Fl,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Fl)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(z(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=D(t,B,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let s;if(!t&&i&&(t=i.getView()),e=t instanceof wl?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(s=e.layerStatesArray.find(t=>t.layer===this),!s)return!1}else s=this.getLayerState();const n=this.getExtent();return function(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const s=e.zoom;return s>t.minZoom&&s<=t.maxZoom}(s,e.viewState)&&(!n||Vt(n,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof wl?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Ol,t)}getMapInternal(){return this.get(Ol)}setMap(t){this.mapPrecomposeKey_&&(z(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(z(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=D(t,Nn,this.handlePrecompose_,this),this.mapRenderKey_=D(this,B,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ut(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Fl,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}const Dl="renderOrder";class jl extends Nl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(Dl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==!1&&(t.declutter[i]=new $s(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(Dl,t)}setStyle(t){this.style_=void 0===t?Nh:t;const e=function(t){if(void 0===t)return Nh;if(!t)return null;if("function"==typeof t)return t;if(t instanceof Oh)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof Oh){const e=t.length,i=new Array(e);for(let s=0;s<e;++s){const e=t[s];if(!(e instanceof Oh))throw new Error("Expected a list of style instances");i[s]=e}return i}const e=t;return function(t,e){if(e=e??Ma(),!Array.isArray(t))return Wh([t],e);const i=t.length;if("style"in t[0]){const s=new Array(i);for(let e=0;e<i;++e){const i=t[e];if(!("style"in i))throw new Error("Expected a list of rules with a style property");s[e]=i}return Bh(s,e)}return Wh(t,e)}(e)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(ut("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}class zl extends jl{constructor(t){super(t)}createRenderer(){return new na(this)}}var Bl=0,Wl=1,Xl=2,ql=3,Ul=4;class Yl extends et{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(B)}release(){this.setState(Ul)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==Ul){if(this.state!==ql&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){st()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const s=e-i+1e3/60;return s>=this.transition_?1:gl(s/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}const Zl=[];class Vl extends Yl{constructor(t,e,i,s,n){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=s.bind(void 0,this),this.removeSourceTiles_=n,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=Gn(1,1,Zl)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=rt(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(kn(this.context_),Zl.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}}let Kl=class extends Yl{constructor(t,e,i,s,n,r){super(t,e,r),this.extent=null,this.format_=s,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=n,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==Bl&&(this.setState(Wl),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(ql)}setFeatures(t){this.features_=t,this.setState(Xl)}setLoader(t){this.loader_=t}};class Hl{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function $l(t,e,i,s,n){return void 0!==n?(n.minX=t,n.maxX=e,n.minY=i,n.maxY=s,n):new Hl(t,e,i,s)}function Jl(t,e,i,s){return void 0!==s?(s[0]=t,s[1]=e,s[2]=i,s):[t,e,i]}function Ql(t,e,i,s,n){return`${rt(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,s,n)}`}const tc=[0,0,0];class ec{constructor(t){let e=t.minZoom;const i=t.resolutions;let s;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,ut(function(t,e){const i=e||U;return t.every(function(e,s){if(0===s)return!0;const n=i(t[s-1],e);return!(n>0||0===n)})}(this.resolutions_,(t,e)=>e-t),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,e=this.resolutions_.length-1;t<e;++t)if(s){if(this.resolutions_[t]/this.resolutions_[t+1]!==s){s=void 0;break}}else s=this.resolutions_[t]/this.resolutions_[t+1];this.zoomFactor_=s,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,ut(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;void 0===n||this.origin_||this.origins_||(this.origin_=Ut(n)),ut(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,ut(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:Ml,ut(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==n?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.tileRanges?this.fullTileRanges_=t.tileRanges:void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const i=new Hl(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(n){const t=this.getTileRangeForExtentAndZ(n,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let t=s.minX,n=s.maxX;t<=n;++t)for(let n=s.minY,r=s.maxY;n<=r;++n)i([e,t,n])}forEachTileCoordParentTileRange(t,e,i,s){let n,r,o,a=null,h=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),n=$l(r,r,o,o,i)):n=this.getTileRangeForExtentAndZ(a,h,i),e(h,n))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],s=2*t[2];return $l(i,i+1,s,s+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],n=t[1],r=t[2];if(e===s)return $l(n,r,n,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-s),o=Math.floor(n*t),a=Math.floor(r*t);if(e<s)return $l(o,o,a,a,i);return $l(o,Math.floor(t*(n+1))-1,a,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,tc);const s=tc[1],n=tc[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,tc);return $l(s,tc[1],n,tc[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=jo(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),n=jo(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*n[0]*s,o=i[1]-(t[2]+1)*n[1]*s;return bt(r,o,r+n[0]*s,o+n[1]*s,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,n){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),h=jo(this.getTileSize(r),this.tmpSize_);let l=o*(t-a[0])/i/h[0],c=o*(a[1]-e)/i/h[1];return s?(l=ue(l,5)-1,c=ue(c,5)-1):(l=ce(l,5),c=ce(c,5)),Jl(r,l,c,n)}getTileCoordForXYAndZ_(t,e,i,s,n){const r=this.getOrigin(i),o=this.getResolution(i),a=jo(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return s?(h=ue(h,5)-1,l=ue(l,5)-1):(h=ce(h,5),l=ce(l,5)),Jl(i,h,l,n)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return ie(Z(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ys(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}function ic(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,s){const n=nc(t);return function(t,e,i,s){s=void 0!==s?s:"top-left";const n=sc(t,e,i);return new ec({extent:t,origin:zt(t,s),resolutions:n,tileSize:i})}(n,e,i,s)}(t),t.setDefaultTileGrid(e)),e}function sc(t,e,i,s){e=void 0!==e?e:42,i=jo(void 0!==i?i:Ml);const n=Wt(t),r=Zt(t);s=s>0?s:Math.max(r/i[0],n/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=s/Math.pow(2,t);return a}function nc(t){let e=(t=gi(t)).getExtent();if(!e){const i=180*pe.degrees/t.getMetersPerUnit();e=bt(-i,-i,i,i)}return e}const rc=/\{z\}/g,oc=/\{x\}/g,ac=/\{y\}/g,hc=/\{-y\}/g;function lc(t,e){return function(i,s,n){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return function(t,e,i,s,n){return t.replace(rc,e.toString()).replace(oc,i.toString()).replace(ac,s.toString()).replace(hc,function(){if(void 0===n)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(n-s).toString()})}(t,o,i[1],i[2],r)}}function cc(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=lc(t[n],e);return function(t){if(1===t.length)return t[0];return function(e,i,s){if(!e)return;const n=function(t){return e=t[0],i=t[1],s=t[2],(i<<e)+s;var e,i,s}(e),r=ae(n,t.length);return t[r](e,i,s)}}(s)}class uc extends fn{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&jo(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||rt(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,n,r){return st()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:ic(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),n=this.getTilePixelRatio(e),r=jo(s.getTileSize(t),this.tmpSize);return 1==n?r:(o=r,a=n,void 0===(h=this.tmpSize)&&(h=[0,0]),h[0]=o[0]*a+.5|0,h[1]=o[1]*a+.5|0,h);var o,a,h}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),s=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=function(t,e,i){const s=e[0],n=t.getTileCoordCenter(e),r=nc(i);if(!Mt(r,n)){const e=Zt(r),i=Math.ceil((r[0]-n[0])/e);return n[0]+=e*i,t.getTileCoordForCoordAndZ(n,s)}return e}(s,t,i)),function(t,e){const i=t[0],s=t[1],n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(s,n)}(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class dc extends tt{constructor(t,e){super(t),this.tile=e}}var gc="tileloadstart",fc="tileloadend",_c="tileloaderror";class pc extends uc{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===pc.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=rt(e),s=e.getState();let n;s==Wl?(this.tileLoadingKeys_[i]=!0,n=gc):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],n=s==ql?_c:s==Xl?fc:void 0),null!=n&&this.dispatchEvent(new dc(n,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const s=i[1].charCodeAt(0),n=i[2].charCodeAt(0);let r;for(r=s;r<=n;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const s=parseInt(i[2],10);for(let n=parseInt(i[1],10);n<=s;n++)e.push(t.replace(i[0],n.toString()));return e}return e.push(t),e}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(cc(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}class mc extends pc{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||nc(e),s=t.tileGrid||function(t){const e=t||{},i=e.extent||gi("EPSG:3857").getExtent(),s={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:sc(i,e.maxZoom,e.tileSize,e.maxResolution)};return new ec(s)}({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:s,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:yc,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Kl,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(t,e,i){const s=this.projection,n=e&&s&&!xi(e,s)?t/s.getMetersPerUnit()*e.getMetersPerUnit():t;return this.tileGrid.getZForResolution(n,i)}getSourceTiles(t,e,i,s){if(i.getState()===Bl){i.setState(Wl);const n=i.wrappedTileCoord,r=this.getTileGridForProjection(e);let o=r.getTileCoordExtent(n);const a=n[0],h=r.getResolution(a);xt(o,-h,o);const l=this.projection;e&&this.projection&&!xi(e,l)&&(o=Ei(o,e,l));const c=this.tileGrid,u=c.getExtent();u&&Xt(o,u,o);const d=this.getSourceZ_(h,e,this.zDirection),g=s||this.tileUrlFunction;c.forEachTileCoord(o,d,s=>{const n=g(s,t,e);this.sourceTiles_[n]||(this.sourceTiles_[n]=new this.tileClass(s,n?Bl:Ul,n,this.format_,this.tileLoadFunction));const r=this.sourceTiles_[n];i.sourceTiles.push(r),this.tileKeysBySourceTileUrl_[n]||(this.tileKeysBySourceTileUrl_[n]=[]),this.tileKeysBySourceTileUrl_[n].push(i.getKey());const o=r.getState();if(o<Xl){const t=e=>{this.handleTileChange(e);const s=r.getState();if(s===Xl||s===ql){const e=r.getKey();e in i.errorTileKeys?r.getState()===Xl&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,s===ql?i.errorTileKeys[e]=!0:r.removeEventListener(B,t),0===i.loadingSourceTiles&&i.setState(N(i.errorTileKeys)?Xl:ql)}};r.addEventListener(B,t),i.loadingSourceTiles++}o===Bl&&(r.extent=c.getTileCoordExtent(s),r.projection=this.projection,r.resolution=c.getResolution(s[0]),r.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>t.getState()===ql)?ql:Xl)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,s=i.length;t<s;++t){const s=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[s])return;const n=this.tileKeysBySourceTileUrl_[s].indexOf(e);-1!==n&&(this.tileKeysBySourceTileUrl_[s].splice(n,1),0===this.tileKeysBySourceTileUrl_[s].length&&(delete this.tileKeysBySourceTileUrl_[s],delete this.sourceTiles_[s]))}}getTile(t,e,i,s,n){const r=[t,e,i];let o=this.getTileCoordForTileUrlFunction(r,n);const a=this.getTileGrid().getExtent(),h=this.projection,l=this.getTileGridForProjection(n);if(o&&a){const e=l.getTileCoordExtent(o);xt(e,-l.getResolution(t),e),Vt(a,n&&h&&!xi(n,h)?Ei(e,n,h):e)||(o=null)}let c=!0;if(null!==o){const e=this.tileGrid,i=l.getResolution(t),r=this.getSourceZ_(i,n,1),a=l.getTileCoordExtent(o);xt(a,-i,a),e.forEachTileCoord(n&&h&&!xi(n,h)?Ei(a,n,h):a,r,t=>{c=c&&!this.tileUrlFunction(t,s,h)})}const u=this.tileUrlFunction,d=new Vl(r,c?Ul:Bl,o,t=>this.getSourceTiles(s,n,t,u),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const s=this.projection;if(null!==s&&!xi(s,t))return ic(t);const n=this.tileGrid,r=n.getResolutions().slice(),o=r.map(function(t,e){return n.getOrigin(e)}),a=r.map(function(t,e){return n.getTileSize(e)}),h=43;for(let t=r.length;t<h;++t)r.push(r[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new ec({extent:n.getExtent(),origins:o,resolutions:r,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const s=jo(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(s[0]*e),Math.round(s[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}}function yc(t,e){t.setLoader(function(i,s,n){te(e,t.getFormat(),i,s,n,t.onLoad.bind(t),t.onError.bind(t))})}function xc(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const vc=new Error("disposed"),Mc=[256,256];class wc extends Yl{constructor(t){const e=Bl;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=xc(this.data_);return t?[t.width,t.height]:Mc}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Bl&&this.state!==ql)return;this.state=Wl,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=Xl,t.changed()}).catch(function(e){t.error_=e,t.state=ql,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(vc),this.controller_=null),super.disposeInternal()}}class Sc extends Yl{constructor(t,e,i,s,n,r){super(t,e,r),this.crossOrigin_=s?.crossOrigin,this.referrerPolicy_=s?.referrerPolicy,this.src_=i,this.key=i,this.image_,In?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=n}getImage(){return this.image_}setImage(t){this.image_=t,this.state=Xl,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=ql,this.unlistenImage_(),this.image_=function(){const t=Gn(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(In)this.state=Xl;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=Xl:this.state=Ul}this.unlistenImage_(),this.changed()}load(){this.state==ql&&(this.state=Bl,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==Bl&&(this.state=Wl,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const s=t;let n=!0,r=!1,o=!1;const a=[j(s,X,function(){o=!0,r||e()})];return s.src&&Rn?(r=!0,s.decode().then(function(){n&&e()}).catch(function(t){n&&(o?e():i())})):a.push(j(s,W,i)),function(){n=!1,a.forEach(z)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}let Ec;const Cc=[];function bc(t,e,i,s,n){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(s,n),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,s)+1,Math.max(i,n)),t.restore()}function Pc(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ic(t,e,i,s){const n=Si(i,e,t);let r=fi(e,s,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||Mt(h,n)){const e=fi(t,r,n)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Rc(t,e,i,s,n,r,o,a,h,l,c,u,d,g){const f=Gn(Math.round(i*t),Math.round(i*e),Cc);if(u||(f.imageSmoothingEnabled=!1),0===h.length)return f.canvas;function _(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;h.forEach(function(t,e,i){Tt(p,t.extent)});const y=i/s,x=(u?1:1+Math.pow(2,-24))/y;m=Gn(Math.round(Zt(p)*y),Math.round(Wt(p)*y),Cc),u||(m.imageSmoothingEnabled=!1),h.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-p[0])*y,i=-(t.clipExtent[3]-p[3])*y,s=Zt(t.clipExtent)*y,n=Wt(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?s:Math.round(e+s)-Math.round(e),u?n:Math.round(i+n)-Math.round(i)),m.clip()}const e=(t.extent[0]-p[0])*y,i=-(t.extent[3]-p[3])*y,s=Zt(t.extent)*y,n=Wt(t.extent)*y;m.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,u?e:Math.round(e),u?i:Math.round(i),u?s:Math.round(e+s)-Math.round(e),u?n:Math.round(i+n)-Math.round(i)),t.clipExtent&&m.restore()}});const v=Ut(o);return a.getTriangles().forEach(function(t,e,i){const s=t.source,n=t.target;let o=s[0][0],a=s[0][1],l=s[1][0],c=s[1][1],d=s[2][0],g=s[2][1];const y=_((n[0][0]-v[0])/r),M=_(-(n[0][1]-v[1])/r),w=_((n[1][0]-v[0])/r),S=_(-(n[1][1]-v[1])/r),E=_((n[2][0]-v[0])/r),C=_(-(n[2][1]-v[1])/r),b=o,P=a;o=0,a=0,l-=b,c-=P,d-=b,g-=P;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let s=i,n=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>n&&(n=e,s=r)}if(0===n)return null;const r=t[s];t[s]=t[i],t[i]=r;for(let s=i+1;s<e;s++){const n=-t[s][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[s][r]=0:t[s][r]+=n*t[i][r]}}const i=new Array(e);for(let s=e-1;s>=0;s--){i[s]=t[s][e]/t[s][s];for(let n=s-1;n>=0;n--)t[n][e]-=t[n][s]*i[s]}return i}([[l,c,0,0,w-y],[d,g,0,0,E-y],[0,0,l,c,S-M],[0,0,d,g,C-M]]);if(!I)return;if(f.save(),f.beginPath(),function(){if(void 0===Ec){const t=Gn(6,6,Cc);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",bc(t,4,5,4,0),bc(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Ec=Pc(e,0)||Pc(e,4)||Pc(e,8),kn(t),Cc.push(t.canvas)}return Ec}()||!u){f.moveTo(w,S);const t=4,e=y-w,i=M-S;for(let s=0;s<t;s++)f.lineTo(w+_((s+1)*e/t),S+_(s*i/(t-1))),s!=t-1&&f.lineTo(w+_((s+1)*e/t),S+_((s+1)*i/(t-1)));f.lineTo(E,C)}else f.moveTo(w,S),f.lineTo(y,M),f.lineTo(E,C);let R;if(f.clip(),f.transform(I[0],I[2],I[1],I[3],y,M),f.translate(p[0]-b,p[3]-P),m)R=m.canvas,f.scale(x,-x);else{const t=h[0],e=t.extent;R=t.image,f.scale(Zt(e)/R.width,-Wt(e)/R.height)}f.drawImage(R,0,0),f.restore()}),m&&(kn(m),Cc.push(m.canvas)),c&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const s=t.target,n=(s[0][0]-v[0])/r,o=-(s[0][1]-v[1])/r,a=(s[1][0]-v[0])/r,h=-(s[1][1]-v[1])/r,l=(s[2][0]-v[0])/r,c=-(s[2][1]-v[1])/r;f.beginPath(),f.moveTo(a,h),f.lineTo(n,o),f.lineTo(l,c),f.closePath(),f.stroke()}),f.restore()),f.canvas}class Gc{constructor(t,e,i,s,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const h=o?mi(t=>Bi(o,Si(t,this.targetProj_,this.sourceProj_))):wi(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=h(t)),a[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&Zt(s)>=Zt(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Zt(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Zt(this.targetProj_.getExtent()):null;const l=Ut(i),c=Yt(i),u=Dt(i),d=Nt(i),g=this.transformInv_(l),f=this.transformInv_(c),_=this.transformInv_(u),p=this.transformInv_(d),m=10+(r?Math.max(0,Math.ceil(Math.log2(Lt(i)/(r*r*256*256)))):0);if(this.addQuad_(l,c,u,d,g,f,_,p,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,s){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const s=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-s<this.sourceWorldWidth_/2&&(e.source=i)}})}a={}}addTriangle_(t,e,i,s,n,r){this.triangles_.push({source:[s,n,r],target:[t,e,i]})}addQuad_(t,e,i,s,n,r,o,a,h){const l=yt([n,r,o,a]),c=this.sourceWorldWidth_?Zt(l)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){g=Zt(yt([t,e,i,s]))/this.targetWorldWidth_>.25||g}!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!g&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Vt(l,this.maxSourceExtent_))return;let f=0;if(!(g||isFinite(n[0])&&isFinite(n[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(h>0)g=!0;else if(f=(isFinite(n[0])&&isFinite(n[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(h>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],s=this.transformInv_(e);let r;if(d){r=(ae(n[0],u)+ae(o[0],u))/2-ae(s[0],u)}else r=(n[0]+o[0])/2-s[0];const a=(n[1]+o[1])/2-s[1];g=r*r+a*a>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(s[0]+t[0])/2,(s[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,n,r,c,d,h-1),this.addQuad_(u,l,i,s,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+s[0])/2,(i[1]+s[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,s,n,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(t,i,s,n,o,a),14&f||this.addTriangle_(t,i,e,n,o,r),f&&(13&f||this.addTriangle_(e,s,t,r,a,n),7&f||this.addTriangle_(e,s,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,s){const n=e.source;At(t,n[0]),At(t,n[1]),At(t,n[2])}),t}getTriangles(){return this.triangles_}}class Tc extends Yl{constructor(t,e,i,s,n,r,o,a,h,l,c,u){super(n,Bl,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()?t.getExtent():void 0;const d=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const _=g?Xt(d,g):d;if(0===Lt(_))return void(this.state=Ul);const p=t.getExtent();p&&(f=f?Xt(f,p):p);const m=s.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,s){const n=jt(i);let r=Ic(t,e,n,s);return(!isFinite(r)||r<=0)&&Ot(i,function(i){return r=Ic(t,e,i,s),isFinite(r)&&r>0}),r}(t,i,_,m);if(!isFinite(y)||y<=0)return void(this.state=Ul);const x=void 0!==l?l:.5;if(this.triangulation_=new Gc(t,i,_,f,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=Ul);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(v[1]=ie(v[1],f[1],f[3]),v[3]=ie(v[3],f[1],f[3])):v=Xt(v,f)),Lt(v)){let i=0,s=0;t.canWrapX()&&(i=Zt(p),s=Math.floor((v[0]-p[0])/i));Jt(v.slice(),t,!0).forEach(t=>{const n=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=n.minX;t<=n.maxX;t++)for(let e=n.minY;e<=n.maxY;e++){const n=s*i;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,t,e,o),offset:n})}++s}),0===this.sourceTiles_.length&&(this.state=Ul)}else this.state=Ul}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==Xl){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const n=this.clipExtent_?.slice();n&&(n[0]+=e.offset,n[2]+=e.offset),t.push({extent:s,clipExtent:n,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=ql;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s="number"==typeof i?i:i[0],n="number"==typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Rc(s,n,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=Xl}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==Bl){this.state=Wl,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(i==Bl||i==Wl){t++;const i=D(e,B,s=>{const n=e.getState();n!=Xl&&n!=ql&&n!=Ul||(z(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},e,i){t.getState()==Bl&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(z),this.sourcesListenerKeys_=null}release(){this.canvas_&&(kn(this.canvas_.getContext("2d")),Cc.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}class Ac{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof q&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return ut(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),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(t){const e=this.entries_[t];return ut(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){ut(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}function kc(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const s=t[i],n=s.has(e);return n||s.add(e),!n}function Fc(t,e,i){const s=t[i];return!!s&&s.delete(e)}function Oc(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Xt(e,Ii(i.extent,t.viewState.projection)));const s=i.layer.getRenderSource();if(!s.getWrapX()){const i=s.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Xt(e,i))}return e}class Lc extends sa{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Hl(0,0,0,0),this.tempTileCoord_=Jl(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Ac(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Ac(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const n=this.tileCache_,r=this.getLayer().getSource(),o=Ql(r,r.getKey(),t,e,i);let a;if(n.containsKey(o))a=n.get(o);else{const h=s.viewState.projection,l=r.getProjection();if(a=r.getTile(t,e,i,s.pixelRatio,h,!l||xi(l,h)?void 0:this.getSourceTileCache()),!a)return null;n.set(o,a)}return a}getTile(t,e,i,s){const n=this.getOrCreateTile(t,e,i,s);return n||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Bi(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!Mt(n,s))return null;const r=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(r.projection),h=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(r.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(s,t),n=this.getTile(t,i[1],i[2],e);if(!n||n.getState()!==Xl)continue;const l=a.getOrigin(t),c=jo(a.getTileSize(t)),u=a.getResolution(t);let d;if(n instanceof Sc||n instanceof Tc)d=n.getImage();else{if(!(n instanceof wc))continue;if(d=xc(n.getData()),!d)continue}const g=Math.floor(h*((s[0]-l[0])/u-i[1]*c[0])),f=Math.floor(h*((l[1]-s[1])/u-i[2]*c[1])),_=Math.round(h*o.getGutterForProjection(r.projection));return this.getImageData(d,g+_,f+_)}return null}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,n){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource(),h=a.getTileGridForProjection(r.projection),l=rt(a);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],u=o.getMapInternal(),d=Math.max(i-n,h.getMinZoom(),h.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):h.getResolution(0)),a.zDirection)),g=r.rotation,f=g?Bt(r.center,r.resolution,g,t.size):void 0;for(let n=i;n>=d;--n){const i=h.getTileRangeForExtentAndZ(e,n,this.tempTileRange_),r=h.getResolution(n);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(g&&!h.tileCoordIntersectsViewport([n,e,o],f))continue;const i=this.getTile(n,e,o,t);if(!i)continue;if(!kc(s,i,n))continue;const a=i.getKey();if(c[a]=!0,i.getState()===Bl&&!t.tileQueue.isKeyQueued(a)){const s=Jl(n,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,l,h.getTileCoordCenter(s),r])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],n=t[1],r=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=Ql(this.getLayer().getSource(),o[t],s,n,r);if(i.containsKey(a)){const t=i.peek(a);if(t.getState()===Xl)return t.endTransition(rt(this)),kc(e,t,s),!0}}return!1}findAltTiles_(t,e,i,s){const n=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!n)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),h=a.getKey();for(let t=n.minX;t<=n.maxX;++t)for(let e=n.minY;e<=n.maxY;++e){const n=Ql(a,h,i,t,e);let l=!1;if(o.containsKey(n)){const t=o.peek(n);t.getState()===Xl&&(kc(s,t,i),l=!0)}l||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,n=s.projection,r=s.resolution,o=s.center,a=t.pixelRatio,h=this.getLayer(),l=h.getSource(),c=l.getTileGridForProjection(n),u=c.getZForResolution(r,l.zDirection),d=c.getResolution(u);this.updateStaleKeys(l.getKey());let g=t.extent;const f=l.getTilePixelRatio(a);this.prepareContainer(t,e);const _=this.context.canvas.width,p=this.context.canvas.height;this.layerExtent=i.extent?Ii(i.extent):null,this.layerExtent&&(g=Xt(g,this.layerExtent));const m=d*_/2/f,y=d*p/2/f,x=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],v={};this.renderedTiles.length=0;const M=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(s.nextResolution,l.zDirection),i=Oc(t,t.nextExtent);this.enqueueTiles(t,i,e,v,M)}const w=Oc(t,g);if(this.enqueueTiles(t,w,u,v,0),M>0&&setTimeout(()=>{this.enqueueTiles(t,w,u-1,v,M-1)},0),!(u in v))return this.container;const S=rt(this),E=t.time;for(const e of v[u]){const i=e.getState();if(i===Ul)continue;const s=e.tileCoord;if(i===Xl){if(1===e.getAlpha(S,E)){e.endTransition(S);continue}}i!==ql&&(this.renderComplete=!1);if(this.findStaleTile_(s,v)){Fc(v,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,s,u+1,v))continue;const n=c.getMinZoom();for(let t=u-1;t>=n;--t){if(this.findAltTiles_(c,s,t,v))break}}const C=d/r*a/f,b=this.getRenderContext(t);Xi(this.tempTransform,_/2,p/2,C,C,0,-_/2,-p/2),this.layerExtent&&this.clipUnrotated(b,t,this.layerExtent),l.getInterpolate()||(b.imageSmoothingEnabled=!1),this.preRender(b,t);const P=Object.keys(v).map(Number);P.sort(U);const I=[],R=[],G=[];for(let e=P.length-1;e>=0;--e){const i=P[e],s=l.getTilePixelSize(i,a,n),r=c.getResolution(i)/d,o=s[0]*r*C,h=s[1]*r*C,g=c.getTileCoordForCoordAndZ(Ut(x),i),_=c.getTileCoordExtent(g),p=Bi(this.tempTransform,[f*(_[0]-x[0])/d,f*(x[3]-_[3])/d]),m=f*l.getGutterForProjection(n);for(const e of v[i]){if(e.getState()!==Xl)continue;const s=e.tileCoord,n=g[1]-s[1],r=Math.round(p[0]-(n-1)*o),a=g[2]-s[2],c=Math.round(p[1]-(a-1)*h),d=Math.round(p[0]-n*o),f=Math.round(p[1]-a*h),_=r-d,y=c-f,x=i===u;if(x&&e.inTransition(S)){G.push({tile:e,x:d,y:f,w:_,h:y,gutter:m}),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,l,e);continue}const v=[d,f,d+_,f+y],M=[];for(let t=0,e=I.length;t<e;++t)i<R[t]&&Vt(v,I[t])&&M.push(I[t]);let w;M.length>0&&(w=Qt(v,M)),I.push(v),R.push(i),this.drawTile(e,t,d,f,_,y,m,x,w),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,l,e)}}for(let e=0,i=G.length;e<i;++e){const{tile:i,x:s,y:n,w:r,h:o,gutter:a}=G[e];this.drawTile(i,t,s,n,r,o,a,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Gt(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&b.restore(),b.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=rt(l),s=e.wantedTiles[i],n=s?Object.keys(s).length:0;this.updateCacheSize(n),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.container}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,s,n,r,o,a,h){let l;if(t instanceof wc){if(l=xc(t.getData()),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const c=this.getRenderContext(e),u=rt(this),d=e.layerStatesArray[e.layerIndex],g=d.opacity*(a?t.getAlpha(u,e.time):1),f=g!==c.globalAlpha;f&&(c.save(),c.globalAlpha=g);const _=l.width-2*o,p=l.height-2*o;if(h){const t=_/n,e=p/r;for(let n=0,r=h.length;n<r;++n){const r=h[n],a=r[0],u=r[1],d=r[2]-r[0],g=r[3]-r[1];c.drawImage(l,o+(a-i)*t,o+(u-s)*e,d*t,g*e,a,u,d,g)}}else c.drawImage(l,o,o,_,p,i,s,n,r);f&&c.restore(),g!==d.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=rt(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}const Nc={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Dc={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class jc extends Lc{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=Ni(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,s,n,r,o,a,h){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,s,n,r,o,a,h)}getTile(t,e,i,s){const n=this.getOrCreateTile(t,e,i,s);if(!n)return null;const r=s.viewState,o=r.resolution,a=s.viewHints,h=this.getLayer().getSource(),l=h.getTileGridForProjection(r.projection),c=!(a[Cn]||a[bn]),u=l.getZForResolution(o,h.zDirection)===t;return c&&u?n.wantedResolution=o:n.wantedResolution||(n.wantedResolution=l.getResolution(t)),n}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const s=this.getLayer(),n=s.getRevision(),r=s.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(s);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==n&&a.renderedPixelRatio===e&&a.renderedRenderOrder==r)return;const h=s.getSource(),l=!!s.getDeclutter(),c=h.getTileGrid(),u=h.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=h.getSourceTiles(e,i,t),g=rt(s);delete t.hitDetectionImageData[g],t.executorGroups[g]=[],a.dirty=!1;for(let n=0,f=d.length;n<f;++n){const f=d[n];if(f.getState()!=Xl)continue;const _=h.getProjection(),p=f.tileCoord;let m=c.getTileCoordExtent(p);i&&_&&!xi(i,_)&&(m=Ei(m,_,i,32));const y=Xt(u,m),x=xt(y,s.getRenderBuffer()*o,this.tempExtent),v=Gt(m,y)?null:x,M=new fo(0,y,o,e),w=Ko(o,e),S=function(t,e){let i;const n=t.getStyleFunction()||s.getStyleFunction();if(n&&(i=n(t,o)),i){const s=this.renderFeature(t,w,i,M,l,e);a.dirty=a.dirty||s}},E=f.getFeatures();r&&r!==a.renderedRenderOrder&&E.sort(r);for(let t=0,e=E.length;t<e;++t){let e=E[t];i&&f.projection&&!xi(i,f.projection)&&(e=e.clone(),e.getGeometry().applyTransform(wi(f.projection,i))),v&&!Vt(v,e.getGeometry().getExtent())||S.call(this,e,t)}const C=M.finish(),b="vector"!==s.getRenderMode()&&l&&1===d.length?null:y,P=new No(b,o,e,h.getOverlaps(),C,s.getRenderBuffer(),!0);t.executorGroups[g].push(P)}a.renderedRevision=n,a.renderedPixelRatio=e,a.renderedRenderOrder=r,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,s,n){const r=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),h=a.getSource().getTileGridForProjection(e.viewState.projection),l=a.getRenderBuffer(),c=yt([t]);xt(c,r*(l+i),c);const u={},d=function(t,e,i){let r=t.getId();void 0===r&&(r=rt(t));const o=u[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return u[r]=!0,n.splice(n.lastIndexOf(o),1),s(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return u[r]=!0,s(t,a,e);n.push(u[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:s})}},g=this.renderedTiles,f=rt(a),_=a.getDeclutter(),p=_?e.declutter?.[_]?.all().map(t=>t.value):null;let m;t:for(let e=g.length-1;e>=0;--e){const s=g[e];if(!Vt(h.getTileCoordExtent(s.wrappedTileCoord),c))continue;const n=s.executorGroups[f];for(let e=0,s=n.length;e<s;++e)if(m=n[e].forEachFeatureAtCoordinate(t,r,o,i,d,p),m)break t}return m}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const s=this.getLayer(),n=s.getSource(),r=this.renderedProjection,o=r.getExtent(),a=this.renderedResolution,h=n.getTileGridForProjection(r),l=Bi(this.renderedPixelToCoordinateTransform_,t.slice()),c=h.getTileCoordForCoordAndResolution(l,a).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&t.getState()===Xl);if(!u||u.loadingSourceTiles>0)return void e([]);n.getWrapX()&&r.canWrapX()&&!wt(o,h.getTileCoordExtent(u.tileCoord))&&fe(l,r);const d=rt(s),g=Ut(h.getTileCoordExtent(u.wrappedTileCoord)),f=[(l[0]-g[0])/a,(g[1]-l[1])/a],_=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let p=u.hitDetectionImageData[d];if(!p){const t=jo(h.getTileSize(h.getZForResolution(a,n.zDirection))),e=this.renderedRotation_;p=Uo(t,[this.getRenderTransform(h.getTileCoordCenter(u.wrappedTileCoord),a,0,qo,t[0]*qo,t[1]*qo,0)],_,s.getStyleFunction(),h.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(s).renderedResolution,e),u.hitDetectionImageData[d]=p}e(Yo(f,_,p))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const s=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),n=s.getZForResolution(this.renderedResolution),r={};return i.forEach(i=>{if(i.tileCoord[0]!==n||i.getState()!==Xl)return;const o=i.getSourceTiles();for(let i=0,n=o.length;i<n;++i){const n=o[i],a=n.getKey();if(a in r)continue;r[a]=!0;const h=n.tileCoord;if(Vt(t,s.getTileCoordExtent(h))){const i=n.getFeatures();if(i)for(let s=0,n=i.length;s<n;++s){const n=i[s],r=n.getGeometry();Vt(t,r.getExtent())&&e.push(n)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,s=i.globalAlpha;i.globalAlpha=e.opacity;const n=t.viewHints,r=!(n[Cn]||n[bn]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),h=a?t.declutter?.[a]:void 0,l=rt(this.getLayer()),c=this.renderedTiles;for(let e=0,i=c.length;e<i;++e){const i=c[e],s=i.executorGroups[l];if(s)for(let e=s.length-1;e>=0;--e)s[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,r,ko,h)}i.globalAlpha=s}renderDeferredInternal(t){const e=this.renderedTiles,i=rt(this.getLayer()),s=e.reduce((t,e,s)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:s})),t),[]),n=s.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),r={};for(let t=0,e=s.length;t<e;++t){const e=s[t].executorGroup.getDeferredZIndexContexts();for(const t in e)r[t]=!0}const o=Object.keys(r).map(Number).sort(U);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{n.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:n}=s[i],r=e.getRenderedContext(),o=r.globalAlpha;r.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[n];a&&a.draw(r),t.draw(r),a&&r.restore(),r.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,s=e.viewState,n=s.center,r=s.resolution,o=s.rotation,a=e.size,h=Math.round(a[0]*i),l=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return ji(Wi(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(n,r,o,i,h,l,g))}clipTileContext_(t,e,i,s,n,r){const o=[];for(let t=0,r=i.length;t<r;++t)n<s[t]&&Vt(e,i[t])&&o.push(i[t]);if(0===o.length)return!1;const a=Qt(e,o);t.save(),t.beginPath();for(let e=0,i=a.length;e<i;++e){const i=a[e],s=Bi(r,[i[0],i[1]]),n=Bi(r,[i[0],i[3]]),o=Bi(r,[i[2],i[3]]),h=Bi(r,[i[2],i[1]]);t.moveTo(s[0],s[1]),t.lineTo(n[0],n[1]),t.lineTo(o[0],o[1]),t.lineTo(h[0],h[1]),t.closePath()}return t.clip(),!0}postRender(t,e){const i=e.viewHints,s=!(i[Cn]||i[bn]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const n=this.getLayer(),r=n.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=n.getDeclutter(),h=a?Dc[r].filter(t=>!ko.includes(t)):Dc[r],l=e.viewState,c=l.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const u=n.getSource(),d=u.getTileGridForProjection(l.projection).getZForResolution(l.resolution,u.zDirection),g=this.renderedTiles,f=[],_=[],p=[],m=rt(n);let y=!0;for(let i=g.length-1;i>=0;--i){const r=g[i];y=y&&!r.getReplayState(n).dirty;const o=r.executorGroups[m].filter(t=>t.hasExecutors(h));if(0===o.length)continue;const l=this.getTileRenderTransform(r,e),u=r.tileCoord[0];let x=!1;const v=o[0].getClipCoords(Oi);let M,w=t;if(v){const t=[v[0],v[1],v[4],v[5]];M=new vo,w=M.getContext(),d!==u&&(x=this.clipTileContext_(w,t,f,_,u,l)),f.push(t),_.push(u)}for(let i=0,n=o.length;i<n;++i){o[i].execute(t,[t.canvas.width,t.canvas.height],l,c,s,h,e.declutter?.[a])}x&&(w===t?w.restore():p[i]=M)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=y,this.tileClipContexts_=p,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,s,n,r){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,h=i.length;a<h;++a)o=$o(s,t,i[a],e,this.boundHandleStyleImageChange_,void 0,n,r)||o;else o=$o(s,t,i,e,this.boundHandleStyleImageChange_,void 0,n,r);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),s=e.getRevision(),n=t.wantedResolution;return i.renderedTileResolution!==n||i.renderedTileRevision!==s}renderTileImage_(t,e){const i=this.getLayer(),s=t.getReplayState(i),n=i.getRevision(),r=t.executorGroups[rt(i)];s.renderedTileRevision=n;const o=t.wrappedTileCoord,a=o[0],h=i.getSource();let l=e.pixelRatio;const c=e.viewState.projection,u=h.getTileGridForProjection(c),d=u.getResolution(t.tileCoord[0]),g=e.pixelRatio/t.wantedResolution*d,f=u.getResolution(a),_=t.getContext();l=Math.round(Math.max(l,g/l));const p=h.getTilePixelSize(a,l,c);_.canvas.width=p[0],_.canvas.height=p[1];const m=l/g;if(1!==m){const t=Di(this.tmpTransform_);Wi(t,m,m),_.setTransform.apply(_,t)}const y=u.getTileCoordExtent(o,this.tempExtent),x=g/f,v=Di(this.tmpTransform_);Wi(v,x,-x),function(t,e,i){ji(t,zi(Li,1,0,0,1,e,i))}(v,-y[0],-y[3]);for(let t=0,e=r.length;t<e;++t){r[t].execute(_,[_.canvas.width*m,_.canvas.height*m],v,0,!0,Nc[i.getRenderMode()],null)}s.renderedTileResolution=t.wantedResolution}}var zc="preload",Bc="useInterimTilesOnError";class Wc extends jl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const s=t.renderMode||"hybrid";ut("hybrid"==s||"vector"==s,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new jc(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(zc)}getUseInterimTilesOnError(){return this.get(Bc)}setPreload(t){this.set(zc,t)}setUseInterimTilesOnError(t){this.set(Bc,t)}}class Xc extends Hi{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(z),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(D(t[e],B,this.changed,this))}clone(){const t=new Xc(qc(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<vt(this.getExtent(),t,e))return s;const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)s=n[r].closestPointXY(t,e,i,s);return s}containsXY(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)if(i[s].containsXY(t,e))return!0;return!1}computeExtent(t){Pt(t);const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)Tt(t,e[i].getExtent());return t}getGeometries(){return qc(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let s=!1;for(let n=0,r=i.length;n<r;++n){const r=i[n],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(s=!0)}if(s){return new Xc(e)}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)i[s].rotate(t,e);this.changed()}scale(t,e,i){i||(i=jt(this.getExtent()));const s=this.geometries_;for(let n=0,r=s.length;n<r;++n)s[n].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(qc(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)i[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function qc(t){return t.map(t=>t.clone())}class Uc{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Fi,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?gi(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=gi(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return st()}readFeature(t,e){return st()}readFeatures(t,e){return st()}readGeometry(t,e){return st()}readProjection(t){return st()}writeFeature(t,e){return st()}writeFeatures(t,e){return st()}writeGeometry(t,e){return st()}}function Yc(t,e,i){const s=i?gi(i.featureProjection):null,n=i?gi(i.dataProjection):null;let r=t;if(s&&n&&!xi(s,n)){e&&(r=t.clone());const i=e?s:n,o=e?n:s;"tile-pixels"===i.getUnits()?r.transform(i,o):r.applyTransform(wi(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),s=function(t){for(let i=0,s=t.length;i<s;++i)t[i]=Math.round(t[i]*e)/e;return t};r===t&&(r=t.clone()),r.applyTransform(s)}return r}const Zc={Point:Is,LineString:bs,Polygon:Ws,MultiPoint:Rs,MultiLineString:Ps,MultiPolygon:Us};function Vc(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>Vc({...t,geometry:e})).flat();const s="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===s||"Circle"===s)throw new Error("Unsupported geometry type: "+s);const n=i.layout.length;return Yc(new Zs(s,"Polygon"===s?function(t,e,i){return Array.isArray(e[0])?(Ds(t,0,e,i)||zs(t=t.slice(),0,e,i),t):(Ns(t,0,e,i)||js(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,n):i.flatCoordinates,i.ends?.flat(),n,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Kc(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Kc(t,e));return new Xc(i)}return Yc(new(0,Zc[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}class Hc extends Uc{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject($c(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject($c(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return st()}readFeaturesFromObject(t,e){return st()}readGeometry(t,e){return this.readGeometryFromObject($c(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return st()}readProjection(t){return this.readProjectionFromObject($c(t))}readProjectionFromObject(t){return st()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return st()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return st()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return st()}}function $c(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}function Jc(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:Ji(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:Ji(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],s=e[0]?.[0]?.length,n=os(i,0,e,s);return{type:"Polygon",flatCoordinates:i,ends:n,layout:Ji(s)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:Ji(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,s=[],n=os(s,0,e,i);return{type:"MultiLineString",flatCoordinates:s,ends:n,layout:Ji(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],s=e[0]?.[0]?.[0].length||2,n=as(i,0,e,s);return{type:"MultiPolygon",flatCoordinates:i,ends:n,layout:Ji(s)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return Jc(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function Qc(t,e){const i=(t=Yc(t,!0,e)).getType();let s;switch(i){case"Point":s=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":s=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":s=function(t,e){let i;e&&(i=e.rightHanded);return{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":s=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":s=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":s=function(t,e){let i;e&&(i=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":s=function(t,e){e=Object.assign({},e),delete e.featureProjection;const i=t.getGeometriesArray().map(function(t){return Qc(t,e)});return{type:"GeometryCollection",geometries:i}}(t,e);break;case"Circle":s={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return s}const tu=4294967296,eu="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class iu{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,i=this.length){let s;for(;s=this.nextField(i);)t(s,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*tu;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*tu;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf,i=e[this.pos++];if(i<128)return i;let s,n=127&i;return s=e[this.pos++],n|=(127&s)<<7,s<128?n:(s=e[this.pos++],n|=(127&s)<<14,s<128?n:(s=e[this.pos++],n|=(127&s)<<21,s<128?n:(s=e[this.pos],n|=(15&s)<<28,function(t,e,i){const s=i.buf;let n,r;if(r=s[i.pos++],n=(112&r)>>4,r<128)return su(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return su(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return su(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return su(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return su(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return su(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(n,t,this))))}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&eu?eu.decode(this.buf.subarray(e,t)):function(t,e,i){let s="",n=e;for(;n<i;){const e=t[n];let r,o,a,h=null,l=e>239?4:e>223?3:e>191?2:1;if(n+l>i)break;1===l?e<128&&(h=e):2===l?(r=t[n+1],128==(192&r)&&(h=(31&e)<<6|63&r,h<=127&&(h=null))):3===l?(r=t[n+1],o=t[n+2],128==(192&r)&&128==(192&o)&&(h=(15&e)<<12|(63&r)<<6|63&o,(h<=2047||h>=55296&&h<=57343)&&(h=null))):4===l&&(r=t[n+1],o=t[n+2],a=t[n+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(h=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&a,(h<=65535||h>=1114112)&&(h=null))),null===h?(h=65533,l=1):h>65535&&(h-=65536,s+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),s+=String.fromCharCode(h),n+=l}return s}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;const e=this.readVarint();return this.type=7&e,this._valueStart=this.pos,e>>>3}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}}function su(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}class nu extends Uc{constructor(t){super(),t=t||{},this.dataProjection=new me({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Zs,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,s){t.pos=e.geometry;const n=t.readVarint()+t.pos;let r=1,o=0,a=0,h=0,l=0,c=0;for(;t.pos<n;){if(!o){const e=t.readVarint();r=7&e,o=e>>3}if(o--,1===r||2===r)a+=t.readSVarint(),h+=t.readSVarint(),1===r&&l>c&&(s.push(l),c=l),i.push(a,h),l+=2;else{if(7!==r)throw new Error("Invalid command found in the PBF");l>c&&(i.push(i[c],i[c+1]),l+=2)}}l>c&&(s.push(l),c=l)}createFeature_(t,e,i){const s=e.type;if(0===s)return null;let n;const r=e.properties;let o;this.idProperty_?(o=r[this.idProperty_],delete r[this.idProperty_]):o=e.id,r[this.layerName_]=e.layer.name;const a=[],h=[];this.readRawGeometry_(t,e,a,h);const l=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(s,h.length);if(this.featureClass===Zs)n=new this.featureClass(l,a,h,2,r,o),n.transform(i.dataProjection);else{let t;if("Polygon"==l){const e=Bs(a,h);t=e.length>1?new Us(a,"XY",e):new Ws(a,"XY",h)}else t="Point"===l?new Is(a,"XY"):"LineString"===l?new bs(a,"XY"):"MultiPoint"===l?new Rs(a,"XY"):"MultiLineString"===l?new Ps(a,"XY",h):null;n=new(0,this.featureClass),this.geometryName_&&n.setGeometryName(this.geometryName_);const e=Yc(t,!1,i);n.setGeometry(e),void 0!==o&&n.setId(o),n.setProperties(r,!0)}return n}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,s=gi((e=this.adaptOptions(e)).dataProjection);s.setWorldExtent(e.extent),e.dataProjection=s;const n=new iu(t),r=n.readFields(ru,{}),o=[];for(const t in r){if(i&&!i.includes(t))continue;const a=r[t],h=a?[0,0,a.extent,a.extent]:null;s.setExtent(h);for(let t=0,i=a.length;t<i;++t){const i=hu(n,a,t),s=this.createFeature_(n,i,e);null!==s&&o.push(s)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}}function ru(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},s=i.readVarint()+i.pos;i.readFields(ou,t,s),t.length=t.features.length,t.length&&(e[t.name]=t)}}function ou(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let s=null;const n=i.readVarint()+i.pos;for(;i.pos<n;)s=1===(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint(!0):5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(s)}}function au(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],s=e.layer.values[i.readVarint()];e.properties[t]=s}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function hu(t,e,i){t.pos=e.features[i];const s=t.readVarint()+t.pos,n={layer:e,type:0,properties:{}};return t.readFields(au,n,s),n}var lu=6378137,cu=.0066943799901413165,uu=484813681109536e-20,du=Math.PI/2,gu=1e-10,fu=.017453292519943295,_u=57.29577951308232,pu=Math.PI/4,mu=2*Math.PI,yu=3.14159265359,xu={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},vu={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},Mu=/[\s_\-\/\(\)]/g;function wu(t,e){if(t[e])return t[e];for(var i,s=Object.keys(t),n=e.toLowerCase().replace(Mu,""),r=-1;++r<s.length;)if((i=s[r]).toLowerCase().replace(Mu,"")===n)return t[i]}function Su(t){var e,i,s,n={},r=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),o={proj:"projName",datum:"datumCode",rf:function(t){n.rf=parseFloat(t)},lat_0:function(t){n.lat0=t*fu},lat_1:function(t){n.lat1=t*fu},lat_2:function(t){n.lat2=t*fu},lat_ts:function(t){n.lat_ts=t*fu},lon_0:function(t){n.long0=t*fu},lon_1:function(t){n.long1=t*fu},lon_2:function(t){n.long2=t*fu},alpha:function(t){n.alpha=parseFloat(t)*fu},gamma:function(t){n.rectified_grid_angle=parseFloat(t)*fu},lonc:function(t){n.longc=t*fu},x_0:function(t){n.x0=parseFloat(t)},y_0:function(t){n.y0=parseFloat(t)},k_0:function(t){n.k0=parseFloat(t)},k:function(t){n.k0=parseFloat(t)},a:function(t){n.a=parseFloat(t)},b:function(t){n.b=parseFloat(t)},r:function(t){n.a=n.b=parseFloat(t)},r_a:function(){n.R_A=!0},zone:function(t){n.zone=parseInt(t,10)},south:function(){n.utmSouth=!0},towgs84:function(t){n.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){n.to_meter=parseFloat(t)},units:function(t){n.units=t;var e=wu(vu,t);e&&(n.to_meter=e.to_meter)},from_greenwich:function(t){n.from_greenwich=t*fu},pm:function(t){var e=wu(xu,t);n.from_greenwich=(e||parseFloat(t))*fu},nadgrids:function(t){"@null"===t?n.datumCode="none":n.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(n.axis=t)},approx:function(){n.approx=!0},over:function(){n.over=!0}};for(e in r)i=r[e],e in o?"function"==typeof(s=o[e])?s(i):n[s]=i:n[e]=i;return"string"==typeof n.datumCode&&"WGS84"!==n.datumCode&&(n.datumCode=n.datumCode.toLowerCase()),n.projStr=t,n}class Eu{static getId(t){const e=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};const i=t[1],s=parseFloat(t[2])||null,n=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return{type:e,name:i,conversion_factor:s,id:n?{authority:n[1],code:parseInt(n[2],10)}:null}}static convertAxis(t){const e=t[1]||"Unknown";let i;const s=e.match(/^\((.)\)$/);if(s){const e=s[1].toUpperCase();if("E"===e)i="east";else if("N"===e)i="north";else if("U"===e)i="up";else{if(!t[2])throw new Error(`Unknown axis abbreviation: ${e}`);i=t[2]}}else i=t[2]||"unknown";const n=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),r=n?parseInt(n[1],10):null,o=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]));return{name:e,direction:i,unit:this.convertUnit(o),order:r}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={type:i[1],axis:this.extractAxes(t)});const s=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(s){const t=this.convertUnit(s);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type="GEODCRS"===t[0]?"GeodeticCRS":"GeographicCRS",e.name=t[1];const n=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(n){const i=this.convert(n);"ENSEMBLE"===n[0]?e.datum_ensemble=i:e.datum=i;const s=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);s&&"Greenwich"!==s[1]&&(i.prime_meridian={name:s[1],longitude:parseFloat(s[2])})}e.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));const r=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);r&&(e.accuracy=parseFloat(r[1]));const o=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);o&&(e.ellipsoid=this.convert(o)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]),t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";const a=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(a){const t=a.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(h){const t=h.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=l?this.convert(l):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const c=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=c)}),c.conversion_factor&&1!==c.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:c});break;default:e.keyword=t[0]}return e}}class Cu extends Eu{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype&&delete e.coordinate_system,e.usage&&delete e.usage,e}}class bu extends Eu{static convert(t,e={}){super.convert(t,e);const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});const s=t.find(t=>Array.isArray(t)&&"USAGE"===t[0]);if(s){const t=s.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=s.find(t=>Array.isArray(t)&&"AREA"===t[0]),n=s.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),n&&(e.usage.bbox=n.slice(1))}return e}}function Pu(t){const e=function(t){return t.find(t=>Array.isArray(t)&&"USAGE"===t[0])?"2019":(t.find(t=>Array.isArray(t)&&"CS"===t[0])||"BOUNDCRS"===t[0]||"PROJCRS"===t[0]||t[0],"2015")}(t);return("2019"===e?bu:Cu).convert(t)}var Iu=/\s/,Ru=/[A-Za-z]/,Gu=/[A-Za-z84_]/,Tu=/[,\]]/,Au=/[\d\.E\-\+]/;function ku(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function Fu(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var s=e?{}:t,n=i.reduce(function(t,e){return Ou(e,t),t},s);e&&(t[e]=n)}function Ou(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Ou(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in e||(e[i]=[]),void e[i].push(t);var s;switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Ou(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Ou(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Fu(e,i,t);case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":return t[0]=["name",t[0]],Fu(e,i,t),void(e[i].type=i);default:for(s=-1;++s<t.length;)if(!Array.isArray(t[s]))return Ou(t,e[i]);return Fu(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}ku.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Iu.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},ku.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(Tu.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},ku.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},ku.prototype.number=function(t){if(!Au.test(t)){if(Tu.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},ku.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},ku.prototype.keyword=function(t){if(Gu.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=1)}if(!Tu.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},ku.prototype.neutral=function(t){if(Ru.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Au.test(t))return this.word=t,void(this.state=3);if(!Tu.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},ku.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Lu(t){return.017453292519943295*t}function Nu(t){const e=(t.projName||"").toLowerCase().replace(/_/g," ");void 0===t.long0&&void 0!==t.longc&&(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Lu(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Lu(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Du(t){let e={units:null,to_meter:void 0};return"string"==typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function ju(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function zu(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=ju(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-ju(t.ellipsoid.semi_minor_axis))))}function Bu(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Bu(t.source_crs,e),t.transformation&&(t.transformation.method&&"NTv2"===t.transformation.method.name?e.nadgrids=t.transformation.parameters[0].value:e.datum_params=t.transformation.parameters.map(t=>t.value)),e):(Object.keys(t).forEach(i=>{const s=t[i];if(null!==s)switch(i){case"name":if(e.srsCode)break;e.name=s,e.srsCode=s;break;case"type":"GeographicCRS"===s?e.projName="longlat":"GeodeticCRS"===s?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===s&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":s.ellipsoid&&(e.ellps=s.ellipsoid.name,zu(s,e)),s.prime_meridian&&(e.from_greenwich=s.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=s.name,zu(s,e);break;case"prime_meridian":e.long0=(s.longitude||0)*Math.PI/180;break;case"coordinate_system":if(s.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=s.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),s.unit){const{units:t,to_meter:i}=Du(s.unit);e.units=t,e.to_meter=i}else if(s.axis[0]&&s.axis[0].unit){const{units:t,to_meter:i}=Du(s.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":s.authority&&s.code&&(e.title=s.authority+":"+s.code);break;case"conversion":s.method&&s.method.name&&(e.projName=s.method.name),s.parameters&&s.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),s=t.value;t.unit&&t.unit.conversion_factor?e[i]=s*t.unit.conversion_factor:"degree"===t.unit?e[i]=s*Math.PI/180:e[i]=s});break;case"unit":s.name&&(e.units=s.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),s.conversion_factor&&(e.to_meter=s.conversion_factor);break;case"base_crs":Bu(s,e),e.datumCode=s.id?s.id.authority+"_"+s.id.code:s.name}}),void 0!==e.latitude_of_false_origin&&(e.lat0=e.latitude_of_false_origin),void 0!==e.longitude_of_false_origin&&(e.long0=e.longitude_of_false_origin),void 0!==e.latitude_of_standard_parallel&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),void 0!==e.latitude_of_1st_standard_parallel&&(e.lat1=e.latitude_of_1st_standard_parallel),void 0!==e.latitude_of_2nd_standard_parallel&&(e.lat2=e.latitude_of_2nd_standard_parallel),void 0!==e.latitude_of_projection_centre&&(e.lat0=e.latitude_of_projection_centre),void 0!==e.longitude_of_projection_centre&&(e.longc=e.longitude_of_projection_centre),void 0!==e.easting_at_false_origin&&(e.x0=e.easting_at_false_origin),void 0!==e.northing_at_false_origin&&(e.y0=e.northing_at_false_origin),void 0!==e.latitude_of_natural_origin&&(e.lat0=e.latitude_of_natural_origin),void 0!==e.longitude_of_natural_origin&&(e.long0=e.longitude_of_natural_origin),void 0!==e.longitude_of_origin&&(e.long0=e.longitude_of_origin),void 0!==e.false_easting&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),void 0!==e.false_northing&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),void 0!==e.standard_parallel_1&&(e.lat1=e.standard_parallel_1),void 0!==e.standard_parallel_2&&(e.lat2=e.standard_parallel_2),void 0!==e.scale_factor_at_natural_origin&&(e.k0=e.scale_factor_at_natural_origin),void 0!==e.scale_factor_at_projection_centre&&(e.k0=e.scale_factor_at_projection_centre),void 0!==e.scale_factor_on_pseudo_standard_parallel&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),void 0!==e.azimuth&&(e.alpha=e.azimuth),void 0!==e.azimuth_at_projection_centre&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),Nu(e),e):t}var Wu=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Xu(t){for(var e=Object.keys(t),i=0,s=e.length;i<s;++i){var n=e[i];-1!==Wu.indexOf(n)&&qu(t[n]),"object"==typeof t[n]&&Xu(t[n])}}function qu(t){if(t.AUTHORITY){var e=Object.keys(t.AUTHORITY)[0];e&&e in t.AUTHORITY&&(t.title=e+":"+t.AUTHORITY[e])}if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var i="",s=0,n=t.AXIS.length;s<n;++s){var r=[t.AXIS[s][0].toLowerCase(),t.AXIS[s][1].toLowerCase()];-1!==r[0].indexOf("north")||("y"===r[0]||"lat"===r[0])&&"north"===r[1]?i+="n":-1!==r[0].indexOf("south")||("y"===r[0]||"lat"===r[0])&&"south"===r[1]?i+="s":-1!==r[0].indexOf("east")||("x"===r[0]||"lon"===r[0])&&"east"===r[1]?i+="e":-1===r[0].indexOf("west")&&("x"!==r[0]&&"lon"!==r[0]||"west"!==r[1])||(i+="w")}2===i.length&&(i+="u"),3===i.length&&(t.axis=i)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var o=t.GEOGCS;function a(e){return e*(t.to_meter||1)}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Lu(o.PRIMEM.convert)),o.DATUM?t.datumCode=o.DATUM.name.toLowerCase():t.datumCode=o.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_1949"===t.datumCode&&(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"belge_1972"===t.datumCode&&(t.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(t.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=o.DATUM.SPHEROID.a,t.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(t.datum_params=o.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=Lu(t.rectified_grid_angle));[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Lu],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Lu],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Lu],["lat0","latitude_of_origin",Lu],["lat0","standard_parallel_1",Lu],["lat1","standard_parallel_1",Lu],["lat2","standard_parallel_2",Lu],["azimuth","Azimuth"],["alpha","azimuth",Lu],["srsCode","name"]].forEach(function(e){return function(t,e){var i=e[0],s=e[1];!(i in t)&&s in t&&(t[i]=t[s],3===e.length&&(t[i]=e[2](t[i])))}(t,e)}),Nu(t)}function Uu(t){if("object"==typeof t)return Bu(t);const e=function(t){const e=t.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}(t);var i=new ku(t).output();if("WKT2"===e){return Bu(Pu(i))}var s=i[0],n={};return Ou(i,n),Xu(n),n[s]}function Yu(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?Yu[t]=Su(arguments[1]):Yu[t]=Uu(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?Yu[t]=Uu(arguments[1]):(Yu[t]=i,i||delete Yu[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?Yu.apply(e,t):Yu(t)});if("string"==typeof t){if(t in Yu)return Yu[t]}else"EPSG"in t?Yu["EPSG:"+t.EPSG]=t:"ESRI"in t?Yu["ESRI:"+t.ESRI]=t:"IAU2000"in t?Yu["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(Yu);var Zu=["3857","900913","3785","102113"];function Vu(t){let e;if(function(t){return"string"==typeof t}(t))if(function(t){return t in Yu}(t))e=Yu[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=Uu(t);var i=function(t){var e=wu(t,"extension");if(e)return wu(e,"proj4")}(e);i&&(e=Su(i))}else(function(t){return"+"===t[0]})(t)&&(e=Su(t));else e="projName"in t?t:Uu(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Zu.indexOf(t.title.substr(5))>-1;var e=wu(t,"authority");if(e){var i=wu(e,"epsg");return i&&Zu.indexOf(i)>-1}}(e)?Yu["EPSG:3857"]:e}function Ku(t,e){var i,s;if(t=t||{},!e)return t;for(s in e)void 0!==(i=e[s])&&(t[s]=i);return t}function Hu(t,e,i){var s=t*e;return i/Math.sqrt(1-s*s)}function $u(t){return t<0?-1:1}function Ju(t,e){return e||Math.abs(t)<=yu?t:t-$u(t)*mu}function Qu(t,e,i){var s=t*i,n=.5*t;return s=Math.pow((1-s)/(1+s),n),Math.tan(.5*(du-e))/s}function td(t,e){for(var i,s,n=.5*t,r=du-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(r),r+=s=du-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-r,Math.abs(s)<=1e-10)return r;return-9999}function ed(t){return t}var id=["longlat","identity"],sd=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Hu(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,s=t.x,n=t.y;if(n*_u>90&&n*_u<-90&&s*_u>180&&s*_u<-180)return null;if(Math.abs(Math.abs(n)-du)<=gu)return null;if(this.sphere)e=this.x0+this.a*this.k0*Ju(s-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(pu+.5*n));else{var r=Math.sin(n),o=Qu(this.e,n,r);e=this.x0+this.a*this.k0*Ju(s-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=du-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var r=Math.exp(-n/(this.a*this.k0));if(-9999===(i=td(this.e,r)))return null}return e=Ju(this.long0+s/(this.a*this.k0),this.over),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:ed,inverse:ed,names:id}],nd={},rd=[];function od(t,e){var i=rd.length;return t.names?(rd[i]=t,t.names.forEach(function(t){nd[t.toLowerCase()]=i}),this):(console.log(e),!0)}function ad(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}var hd={start:function(){sd.forEach(od)},add:od,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==nd[e]&&rd[nd[e]]||(e=ad(e))in nd&&rd[nd[e]]?rd[nd[e]]:void 0}},ld={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}};const cd=ld.WGS84;var ud={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var dd in ud){var gd=ud[dd];gd.datumName&&(ud[gd.datumName]=gd)}var fd={};async function _d(t,e){for(var i=[],s=await e.getImageCount(),n=s-1;n>=0;n--){var r=await e.getImage(n),o=await r.readRasters(),a=[r.getWidth(),r.getHeight()],h=r.getBoundingBox().map(md),l=[r.fileDirectory.ModelPixelScale[0],r.fileDirectory.ModelPixelScale[1]].map(md),c=h[0]+(a[0]-1)*l[0],u=h[3]-(a[1]-1)*l[1],d=o[0],g=o[1],f=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var _=t*a[0]+e;f.push([-yd(g[_]),yd(d[_])])}i.push({del:l,lim:a,ll:[-c,u],cvs:f})}var p={header:{nSubgrids:s},subgrids:i};return fd[t]=p,p}function pd(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:fd[t]||null,isNull:!1}}function md(t){return t*Math.PI/180}function yd(t){return t/3600*Math.PI/180}function xd(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function vd(t){return t.map(function(t){return[yd(t.longitudeShift),yd(t.latitudeShift)]})}function Md(t,e,i){return{name:xd(t,e+8,e+16).trim(),parent:xd(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function wd(t,e,i,s,n){var r=e+176,o=16;!1===n&&(o=8);for(var a=[],h=0;h<i.gridNodeCount;h++){var l={latitudeShift:t.getFloat32(r+h*o,s),longitudeShift:t.getFloat32(r+h*o+4,s)};!1!==n&&(l.latitudeAccuracy=t.getFloat32(r+h*o+8,s),l.longitudeAccuracy=t.getFloat32(r+h*o+12,s)),a.push(l)}return a}function Sd(t,e){if(!(this instanceof Sd))return new Sd(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=Vu(t);if("object"==typeof i){var s=Sd.projections.get(i.projName);if(s){if(i.datumCode&&"none"!==i.datumCode){var n=wu(ud,i.datumCode);n&&(i.datum_params=i.datum_params||(n.towgs84?n.towgs84.split(","):null),i.ellps=n.ellipse,i.datumName=n.datumName?n.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var r=function(t,e,i,s,n){if(!t){var r=wu(ld,s);r||(r=cd),t=r.a,e=r.b,i=r.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<gu)&&(n=!0,e=t),{a:t,b:e,rf:i,sphere:n}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,s){var n=t*t,r=e*e,o=(n-r)/n,a=0;return s?(n=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(n-r)/r}}(r.a,r.b,r.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(pd)}(i.nadgrids),h=i.datum||function(t,e,i,s,n,r,o){var a={};return a.datum_type=void 0===t||"none"===t?5:4,e&&(a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=1),a.datum_params.length>3&&(0===a.datum_params[3]&&0===a.datum_params[4]&&0===a.datum_params[5]&&0===a.datum_params[6]||(a.datum_type=2,a.datum_params[3]*=uu,a.datum_params[4]*=uu,a.datum_params[5]*=uu,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=s,a.es=n,a.ep2=r,a}(i.datumCode,i.datum_params,r.a,r.b,o.es,o.ep2,a);Ku(this,i),Ku(this,s),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=h,"init"in this&&"function"==typeof this.init&&this.init(),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}function Ed(t,e,i){var s,n,r,o,a=t.x,h=t.y,l=t.z?t.z:0;if(h<-du&&h>-1.001*du)h=-du;else if(h>du&&h<1.001*du)h=du;else{if(h<-du)return{x:-1/0,y:-1/0,z:t.z};if(h>du)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(h),o=Math.cos(h),r=n*n,{x:((s=i/Math.sqrt(1-e*r))+l)*o*Math.cos(a),y:(s+l)*o*Math.sin(a),z:(s*(1-e)+l)*n}}function Cd(t,e,i,s){var n,r,o,a,h,l,c,u,d,g,f,_,p,m,y,x=1e-12,v=t.x,M=t.y,w=t.z?t.z:0;if(n=Math.sqrt(v*v+M*M),r=Math.sqrt(v*v+M*M+w*w),n/i<x){if(m=0,r/i<x)return y=-s,{x:t.x,y:t.y,z:t.z}}else m=Math.atan2(M,v);o=w/r,u=(a=n/r)*(1-e)*(h=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*h,p=0;do{p++,l=e*(c=i/Math.sqrt(1-e*d*d))/(c+(y=n*u+w*d-c*(1-e*d*d))),_=(f=o*(h=1/Math.sqrt(1-l*(2-l)*a*a)))*u-(g=a*(1-l)*h)*d,u=g,d=f}while(_*_>1e-24&&p<30);return{x:m,y:Math.atan(f/Math.abs(g)),z:y}}function bd(t){return 1===t||2===t}function Pd(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(1===t.datum_type?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:2!==t.datum_type||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(5===t.datum_type||5===e.datum_type)return i;var s=t.a,n=t.es;if(3===t.datum_type){if(0!==Id(t,!1,i))return;s=lu,n=cu}var r=e.a,o=e.b,a=e.es;if(3===e.datum_type&&(r=lu,o=6356752.314,a=cu),n===a&&s===r&&!bd(t.datum_type)&&!bd(e.datum_type))return i;if((i=Ed(i,n,s),bd(t.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===e){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6];return{x:l*(t.x-h*t.y+a*t.z)+s,y:l*(h*t.x+t.y-o*t.z)+n,z:l*(-a*t.x+o*t.y+t.z)+r}}}(i,t.datum_type,t.datum_params)),bd(e.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===e){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6],c=(t.x-s)/l,u=(t.y-n)/l,d=(t.z-r)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}(i,e.datum_type,e.datum_params)),i=Cd(i,a,r,o),3===e.datum_type)&&0!==Id(e,!0,i))return;return i}function Id(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var s={x:-i.x,y:i.y},n={x:Number.NaN,y:Number.NaN},r=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(r.push(a.name),a.isNull){n=s;break}if(null!==a.grid)for(var h=a.grid.subgrids,l=0,c=h.length;l<c;l++){var u=h[l],d=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,g=u.ll[0]-d,f=u.ll[1]-d,_=u.ll[0]+(u.lim[0]-1)*u.del[0]+d,p=u.ll[1]+(u.lim[1]-1)*u.del[1]+d;if(!(f>s.y||g>s.x||p<s.y||_<s.x)&&(n=Rd(s,e,u),!isNaN(n.x)))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(n.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*_u+" "+s.y*_u+" tried: '"+r+"'"),-1):(i.x=-n.x,i.y=n.y,0)}function Rd(t,e,i){var s={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return s;var n={x:t.x,y:t.y};n.x-=i.ll[0],n.y-=i.ll[1],n.x=Ju(n.x-Math.PI)+Math.PI;var r=Gd(n,i);if(e){if(isNaN(r.x))return s;r.x=n.x-r.x,r.y=n.y-r.y;var o,a,h=9;do{if(a=Gd(r,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:n.x-(a.x+r.x),y:n.y-(a.y+r.y)},r.x+=o.x,r.y+=o.y}while(h--&&Math.abs(o.x)>1e-12&&Math.abs(o.y)>1e-12);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=Ju(r.x+i.ll[0]),s.y=r.y+i.ll[1]}else isNaN(r.x)||(s.x=t.x+r.x,s.y=t.y+r.y);return s}function Gd(t,e){var i,s={x:t.x/e.del[0],y:t.y/e.del[1]},n=Math.floor(s.x),r=Math.floor(s.y),o=s.x-1*n,a=s.y-1*r,h={x:Number.NaN,y:Number.NaN};if(n<0||n>=e.lim[0])return h;if(r<0||r>=e.lim[1])return h;i=r*e.lim[0]+n;var l=e.cvs[i][0],c=e.cvs[i][1];i++;var u=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var g=e.cvs[i][0],f=e.cvs[i][1];i--;var _=e.cvs[i][0],p=e.cvs[i][1],m=o*a,y=o*(1-a),x=(1-o)*(1-a),v=(1-o)*a;return h.x=x*l+y*u+v*_+m*g,h.y=x*c+y*d+v*p+m*f,h}function Td(t,e,i){var s,n,r,o=i.x,a=i.y,h=i.z||0,l={};for(r=0;r<3;r++)if(!e||2!==r||void 0!==i.z)switch(0===r?(s=o,n=-1!=="ew".indexOf(t.axis[r])?"x":"y"):1===r?(s=a,n=-1!=="ns".indexOf(t.axis[r])?"y":"x"):(s=h,n="z"),t.axis[r]){case"e":case"n":l[n]=s;break;case"w":case"s":l[n]=-s;break;case"u":void 0!==i[n]&&(l.z=s);break;case"d":void 0!==i[n]&&(l.z=-s);break;default:return null}return l}function Ad(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function kd(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Fd(t,e,i,s){var n,r=void 0!==(i=Array.isArray(i)?Ad(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){kd(t.x),kd(t.y)}(i),t.datum&&e.datum&&function(t,e){return(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==e.datumCode||(1===e.datum.datum_type||2===e.datum.datum_type||3===e.datum.datum_type)&&"WGS84"!==t.datumCode}(t,e)&&(i=Fd(t,n=new Sd("WGS84"),i,s),t=n),s&&"enu"!==t.axis&&(i=Td(t,!1,i)),"longlat"===t.projName)i={x:i.x*fu,y:i.y*fu,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=Pd(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*_u,y:i.y*_u,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),s&&"enu"!==e.axis?Td(e,!0,i):(i&&!r&&"geocent"!==e.projName&&delete i.z,i)}Sd.projections=hd,Sd.projections.start();var Od=Sd("WGS84");function Ld(t,e,i,s){var n,r,o;return Array.isArray(i)?(n=Fd(t,e,i,s)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y,i[2]].concat(i.slice(3)):[n.x,n.y].concat(i.slice(2)):[n.x,n.y]):(r=Fd(t,e,i,s),2===(o=Object.keys(i)).length||o.forEach(function(s){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===s||"y"===s||"z"===s)return}else if("x"===s||"y"===s)return;r[s]=i[s]}),r)}function Nd(t){return t instanceof Sd?t:"object"==typeof t&&"oProj"in t?t.oProj:Sd(t)}var Dd="AJSAJS",jd="AFAFAF",zd=65,Bd=73,Wd=79,Xd=86,qd=90,Ud={forward:Yd,inverse:function(t){var e=Hd(Qd(t.toUpperCase()));if(e.lat&&e.lon)return[e.lon,e.lat,e.lon,e.lat];return[e.left,e.bottom,e.right,e.top]},toPoint:Zd};function Yd(t,e){return e=e||5,function(t,e){var i="00000"+t.easting,s="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(g=t.easting,f=t.northing,_=t.zoneNumber,p=Jd(_),m=Math.floor(g/1e5),y=Math.floor(f/1e5)%20,n=m,r=y,o=p,a=o-1,h=Dd.charCodeAt(a),l=jd.charCodeAt(a),c=h+n-1,u=l+r,d=!1,c>qd&&(c=c-qd+zd-1,d=!0),(c===Bd||h<Bd&&c>Bd||(c>Bd||h<Bd)&&d)&&c++,(c===Wd||h<Wd&&c>Wd||(c>Wd||h<Wd)&&d)&&++c===Bd&&c++,c>qd&&(c=c-qd+zd-1),u>Xd?(u=u-Xd+zd-1,d=!0):d=!1,(u===Bd||l<Bd&&u>Bd||(u>Bd||l<Bd)&&d)&&u++,(u===Wd||l<Wd&&u>Wd||(u>Wd||l<Wd)&&d)&&++u===Bd&&u++,u>Xd&&(u=u-Xd+zd-1),String.fromCharCode(c)+String.fromCharCode(u))+i.substr(i.length-5,e)+s.substr(s.length-5,e);var n,r,o,a,h,l,c,u,d;var g,f,_,p,m,y}(function(t){var e,i,s,n,r,o,a,h,l=t.lat,c=t.lon,u=6378137,d=.00669438,g=.9996,f=Vd(l),_=Vd(c);h=Math.floor((c+180)/6)+1,180===c&&(h=60);l>=56&&l<64&&c>=3&&c<12&&(h=32);l>=72&&l<84&&(c>=0&&c<9?h=31:c>=9&&c<21?h=33:c>=21&&c<33?h=35:c>=33&&c<42&&(h=37));a=Vd(6*(h-1)-180+3),e=d/(1-d),i=u/Math.sqrt(1-d*Math.sin(f)*Math.sin(f)),s=Math.tan(f)*Math.tan(f),n=e*Math.cos(f)*Math.cos(f),r=Math.cos(f)*(_-a),o=u*((1-d/4-3*d*d/64-5*d*d*d/256)*f-(3*d/8+3*d*d/32+45*d*d*d/1024)*Math.sin(2*f)+(15*d*d/256+45*d*d*d/1024)*Math.sin(4*f)-35*d*d*d/3072*Math.sin(6*f));var p=g*i*(r+(1-s+n)*r*r*r/6+(5-18*s+s*s+72*n-58*e)*r*r*r*r*r/120)+5e5,m=g*(o+i*Math.tan(f)*(r*r/2+(5-s+9*n+4*n*n)*r*r*r*r/24+(61-58*s+s*s+600*n-330*e)*r*r*r*r*r*r/720));l<0&&(m+=1e7);return{northing:Math.round(m),easting:Math.round(p),zoneNumber:h,zoneLetter:$d(l)}}({lat:t[1],lon:t[0]}),e)}function Zd(t){var e=Hd(Qd(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Vd(t){return t*(Math.PI/180)}function Kd(t){return t/Math.PI*180}function Hd(t){var e=t.northing,i=t.easting,s=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var r,o,a,h,l,c,u,d,g,f=.9996,_=6378137,p=.00669438,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),y=i-5e5,x=e;s<"N"&&(x-=1e7),u=6*(n-1)-180+3,r=.006739496752268451,g=(d=x/f/6367449.145945056)+(3*m/2-27*m*m*m/32)*Math.sin(2*d)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*d)+151*m*m*m/96*Math.sin(6*d),o=_/Math.sqrt(1-p*Math.sin(g)*Math.sin(g)),a=Math.tan(g)*Math.tan(g),h=r*Math.cos(g)*Math.cos(g),l=.99330562*_/Math.pow(1-p*Math.sin(g)*Math.sin(g),1.5),c=y/(o*f);var v=g-o*Math.tan(g)/l*(c*c/2-(5+3*a+10*h-4*h*h-9*r)*c*c*c*c/24+(61+90*a+298*h+45*a*a-1.6983531815716497-3*h*h)*c*c*c*c*c*c/720);v=Kd(v);var M,w=(c-(1+2*a+h)*c*c*c/6+(5-2*h+28*a-3*h*h+8*r+24*a*a)*c*c*c*c*c/120)/Math.cos(g);if(w=u+Kd(w),t.accuracy){var S=Hd({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});M={top:S.lat,right:S.lon,bottom:v,left:w}}else M={lat:v,lon:w};return M}function $d(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Jd(t){var e=t%6;return 0===e&&(e=6),e}function Qd(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,s=null,n="",r=0;!/[A-Z]/.test(e=t.charAt(r));){if(r>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,r++}var o=parseInt(n,10);if(0===r||r+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(r++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;s=t.substring(r,r+=2);for(var h=Jd(o),l=function(t,e){var i=Dd.charCodeAt(e-1),s=1e5,n=!1;for(;i!==t.charCodeAt(0);){if(++i===Bd&&i++,i===Wd&&i++,i>qd){if(n)throw"Bad character: "+t;i=zd,n=!0}s+=1e5}return s}(s.charAt(0),h),c=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=jd.charCodeAt(e-1),s=0,n=!1;for(;i!==t.charCodeAt(0);){if(++i===Bd&&i++,i===Wd&&i++,i>Xd){if(n)throw"Bad character: "+t;i=zd,n=!0}s+=1e5}return s}(s.charAt(1),h);c<tg(a);)c+=2e6;var u=i-r;if(u%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,g,f,_=u/2,p=0,m=0;return _>0&&(d=1e5/Math.pow(10,_),g=t.substring(r,r+_),p=parseFloat(g)*d,f=t.substring(r+_),m=parseFloat(f)*d),{easting:p+l,northing:m+c,zoneLetter:a,zoneNumber:o,accuracy:d}}function tg(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function eg(t,e,i){if(!(this instanceof eg))return new eg(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var s=t.split(",");this.x=parseFloat(s[0]),this.y=parseFloat(s[1]),this.z=parseFloat(s[2])||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}eg.fromMGRS=function(t){return new eg(Zd(t))},eg.prototype.toMGRS=function(t){return Yd([this.x,this.y],t)};var ig=.046875,sg=.01953125,ng=.01068115234375;function rg(t){var e=[];e[0]=1-t*(.25+t*(ig+t*(sg+t*ng))),e[1]=t*(.75-t*(ig+t*(sg+t*ng)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e}function og(t,e,i,s){return i*=e,e*=e,s[0]*t-i*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}function ag(t,e,i){for(var s=1/(1-e),n=t,r=20;r;--r){var o=Math.sin(n),a=1-e*o*o;if(n-=a=(og(n,o,Math.cos(n),i)-t)*(a*Math.sqrt(a))*s,Math.abs(a)<gu)return n}return n}var hg={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=rg(this.es),this.ml0=og(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,s,n=t.x,r=t.y,o=Ju(n-this.long0,this.over),a=Math.sin(r),h=Math.cos(r);if(this.es){var l=h*o,c=Math.pow(l,2),u=this.ep2*Math.pow(h,2),d=Math.pow(u,2),g=Math.abs(h)>gu?Math.tan(r):0,f=Math.pow(g,2),_=Math.pow(f,2);e=1-this.es*Math.pow(a,2),l/=Math.sqrt(e);var p=og(r,a,h,this.en);i=this.a*(this.k0*l*(1+c/6*(1-f+u+c/20*(5-18*f+_+14*u-58*f*u+c/42*(61+179*_-_*f-479*f)))))+this.x0,s=this.a*(this.k0*(p-this.ml0+a*o*l/2*(1+c/12*(5-f+9*u+4*d+c/30*(61+_-58*f+270*u-330*f*u+c/56*(1385+543*_-_*f-3111*f))))))+this.y0}else{var m=h*Math.sin(o);if(Math.abs(Math.abs(m)-1)<gu)return 93;if(i=.5*this.a*this.k0*Math.log((1+m)/(1-m))+this.x0,s=h*Math.cos(o)/Math.sqrt(1-Math.pow(m,2)),(m=Math.abs(s))>=1){if(m-1>gu)return 93;s=0}else s=Math.acos(s);r<0&&(s=-s),s=this.a*this.k0*(s-this.lat0)+this.y0}return t.x=i,t.y=s,t},inverse:function(t){var e,i,s,n,r=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=ag(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<du){var a=Math.sin(i),h=Math.cos(i),l=Math.abs(h)>gu?Math.tan(i):0,c=this.ep2*Math.pow(h,2),u=Math.pow(c,2),d=Math.pow(l,2),g=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=r*Math.sqrt(e)/this.k0,_=Math.pow(f,2);s=i-(e*=l)*_/(1-this.es)*.5*(1-_/12*(5+3*d-9*c*d+c-4*u-_/30*(61+90*d-252*c*d+45*g+46*c-_/56*(1385+3633*d+4095*g+1574*g*d)))),n=Ju(this.long0+f*(1-_/6*(1+2*d+c-_/20*(5+28*d+24*g+8*c*d+6*c-_/42*(61+662*d+1320*g+720*g*d))))/h,this.over)}else s=du*$u(o),n=0;else{var p=Math.exp(r/this.k0),m=.5*(p-1/p),y=this.lat0+o/this.k0,x=Math.cos(y);e=Math.sqrt((1-Math.pow(x,2))/(1+Math.pow(m,2))),s=Math.asin(e),o<0&&(s=-s),n=0===m&&0===x?0:Ju(Math.atan2(m,x)+this.long0,this.over)}return t.x=n,t.y=s,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function lg(t){var e=Math.exp(t);return e=(e-1/e)/2}function cg(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),s=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(s,2))}function ug(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(cg(1,e)+1))),t<0?-e:e}function dg(t,e){for(var i,s=2*Math.cos(2*e),n=t.length-1,r=t[n],o=0;--n>=0;)i=s*r-o+t[n],o=r,r=i;return e+i*Math.sin(2*e)}function gg(t,e,i){for(var s,n,r=Math.sin(e),o=Math.cos(e),a=lg(i),h=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),l=2*o*h,c=-2*r*a,u=t.length-1,d=t[u],g=0,f=0,_=0;--u>=0;)s=f,n=g,d=l*(f=d)-s-c*(g=_)+t[u],_=c*f-n+l*g;return[(l=r*h)*d-(c=o*a)*_,l*_+c*d]}var fg={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(hg.init.apply(this),this.forward=hg.forward,this.inverse=hg.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var s=dg(this.cbg,this.lat0);this.Zb=-this.Qn*(s+function(t,e){for(var i,s=2*Math.cos(e),n=t.length-1,r=t[n],o=0;--n>=0;)i=s*r-o+t[n],o=r,r=i;return Math.sin(e)*i}(this.gtu,2*s))},forward:function(t){var e=Ju(t.x-this.long0,this.over),i=t.y;i=dg(this.cbg,i);var s=Math.sin(i),n=Math.cos(i),r=Math.sin(e),o=Math.cos(e);i=Math.atan2(s,o*n),e=Math.atan2(r*n,cg(s,n*o)),e=ug(Math.tan(e));var a,h,l=gg(this.gtu,2*i,2*e);return i+=l[0],e+=l[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,h=1/0),t.x=a,t.y=h,t},inverse:function(t){var e,i,s=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(n=(n-this.Zb)/this.Qn,s/=this.Qn,Math.abs(s)<=2.623395162778){var r=gg(this.utg,2*n,2*s);n+=r[0],s+=r[1],s=Math.atan(lg(s));var o=Math.sin(n),a=Math.cos(n),h=Math.sin(s),l=Math.cos(s);n=Math.atan2(o*l,cg(h,l*a)),e=Ju((s=Math.atan2(h,l*a))+this.long0,this.over),i=dg(this.cgb,n)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]};var _g={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(Ju(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*fu,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,fg.init.apply(this),this.forward=fg.forward,this.inverse=fg.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function pg(t,e){return Math.pow((1-t)/(1+t),e)}var mg={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+pu)/(Math.pow(Math.tan(.5*this.lat0+pu),this.C)*pg(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+pu),this.C)*pg(this.e*Math.sin(i),this.ratexp))-du,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,s=Math.pow(Math.tan(.5*i+pu)/this.K,1/this.C),n=20;n>0&&(i=2*Math.atan(s*pg(this.e*Math.sin(t.y),-.5*this.e))-du,!(Math.abs(i-t.y)<1e-14));--n)t.y=i;return n?(t.x=e,t.y=i,t):null}};var yg={init:function(){mg.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,s,n;return t.x=Ju(t.x-this.long0,this.over),mg.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),s=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*s),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*s),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,s,n,r;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,r=cg(t.x,t.y)){var o=2*Math.atan2(r,this.R2);e=Math.sin(o),i=Math.cos(o),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/r),s=Math.atan2(t.x*e,r*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,s=0;return t.x=s,t.y=n,mg.inverse.apply(this,[t]),t.x=Ju(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function xg(t,e,i){return e*=i,Math.tan(.5*(du+t))*Math.pow((1-e)/(1+e),.5*i)}var vg={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=gu&&(this.k0=.5*(1+$u(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=gu&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=gu&&Math.abs(Math.cos(this.lat_ts))>gu&&(this.k0=.5*this.cons*Hu(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Qu(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Hu(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(xg(this.lat0,this.sinlat0,this.e))-du,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,s,n,r,o,a=t.x,h=t.y,l=Math.sin(h),c=Math.cos(h),u=Ju(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=gu&&Math.abs(h+this.lat0)<=gu?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(u)),t.x=this.a*e*c*Math.sin(u)+this.x0,t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(u))+this.y0,t):(i=2*Math.atan(xg(h,l,this.e))-du,n=Math.cos(i),s=Math.sin(i),Math.abs(this.coslat0)<=gu?(r=Qu(this.e,h*this.con,this.con*l),o=2*this.a*this.k0*r/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<gu?(e=2*this.a*this.k0/(1+n*Math.cos(u)),t.y=e*s):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*n*Math.cos(u))),t.y=e*(this.cosX0*s-this.sinX0*n*Math.cos(u))+this.y0),t.x=e*n*Math.sin(u)+this.x0,t))},inverse:function(t){var e,i,s,n,r;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,i=this.lat0,o<=gu?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/o),e=Math.abs(this.coslat0)<gu?this.lat0>0?Ju(this.long0+Math.atan2(t.x,-1*t.y),this.over):Ju(this.long0+Math.atan2(t.x,t.y),this.over):Ju(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a)),this.over),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=gu){if(o<=gu)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,s=o*this.cons/(2*this.a*this.k0),i=this.con*td(this.e,s),e=this.con*Ju(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=gu?r=this.X0:(r=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),e=Ju(this.long0+Math.atan2(t.x*Math.sin(n),o*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)),this.over)),i=-1*td(this.e,Math.tan(.5*(du+r)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:xg};var Mg={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,s=1/this.rf,n=2*s-Math.pow(s,2),r=this.e=Math.sqrt(n);this.R=this.k0*i*Math.sqrt(1-n)/(1-n*Math.pow(e,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+r*e)/(1-r*e));this.K=o-this.alpha*a+this.alpha*r/2*h},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),s=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(s))-Math.PI/4),r=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(r)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(r))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(r));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,s=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),r=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(s)),o=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+o/this.alpha,h=0,l=r,c=-1e3,u=0;Math.abs(l-c)>1e-7;){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+r/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=a,t.y=l,t},names:["somerc"]},wg=1e-7;var Sg={init:function(){var t,e,i,s,n,r,o,a,h,l,c,u,d,g,f=0,_=0,p=0,m=0,y=0,x=0,v=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],g="object"==typeof(u=this).projName?Object.keys(u.projName)[0]:u.projName,"no_uoff"in u||"no_off"in u||-1!==d.indexOf(g)||-1!==d.indexOf(ad(g))),this.no_rot="no_rot"in this;var M=!1;"alpha"in this&&(M=!0);var w=!1;if("rectified_grid_angle"in this&&(w=!0),M&&(v=this.alpha),w&&(f=this.rectified_grid_angle),M||w)_=this.longc;else if(p=this.long1,y=this.lat1,m=this.long2,x=this.lat2,Math.abs(y-x)<=wg||(t=Math.abs(y))<=wg||Math.abs(t-du)<=wg||Math.abs(Math.abs(this.lat0)-du)<=wg||Math.abs(Math.abs(x)-du)<=wg)throw new Error;var S=1-this.es;e=Math.sqrt(S),Math.abs(this.lat0)>gu?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/S),this.A=this.B*this.k0*e/t,(n=(s=this.B*e/(i*Math.sqrt(t)))*s-1)<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=s,this.E*=Math.pow(Qu(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=n=1),M||w?(M?(c=Math.asin(Math.sin(v)/s),w||(f=v)):(c=f,v=Math.asin(s*Math.sin(c))),this.lam0=_-Math.asin(.5*(n-1/n)*Math.tan(c))/this.B):(r=Math.pow(Qu(this.e,y,Math.sin(y)),this.B),o=Math.pow(Qu(this.e,x,Math.sin(x)),this.B),n=this.E/r,h=(o-r)/(o+r),l=((l=this.E*this.E)-o*r)/(l+o*r),(t=p-m)<-Math.PI?m-=mu:t>Math.PI&&(m+=mu),this.lam0=Ju(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/h)/this.B,this.over),c=Math.atan(2*Math.sin(this.B*Ju(p-this.lam0,this.over))/(n-1/n)),f=v=Math.asin(s*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(f),this.cosrot=Math.cos(f),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(v))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(pu-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(pu+n))},forward:function(t){var e,i,s,n,r,o,a,h,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-du)>gu){if(e=.5*((r=this.E/Math.pow(Qu(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/r)),i=.5*(r+o),n=Math.sin(this.B*t.x),s=(e*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(s)-1)<gu)throw new Error;h=.5*this.ArB*Math.log((1-s)/(1+s)),o=Math.cos(this.B*t.x),a=Math.abs(o)<wg?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+n*this.singam,o)}else h=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(l.x=a,l.y=h):(a-=this.u_0,l.x=h*this.cosrot+a*this.sinrot,l.y=a*this.cosrot-h*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,l},inverse:function(t){var e,i,s,n,r,o,a,h={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),n=.5*((s=Math.exp(-this.BrA*i))-1/s),r=.5*(s+1/s),a=((o=Math.sin(this.BrA*e))*this.cosgam+n*this.singam)/r,Math.abs(Math.abs(a)-1)<gu)h.x=0,h.y=a<0?-du:du;else{if(h.y=this.E/Math.sqrt((1+a)/(1-a)),h.y=td(this.e,Math.pow(h.y,1/this.B)),h.y===1/0)throw new Error;h.x=-this.rB*Math.atan2(n*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return h.x+=this.lam0,h},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]};var Eg={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<gu)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),s=Hu(this.e,e,i),n=Qu(this.e,this.lat1,e),r=Math.sin(this.lat2),o=Math.cos(this.lat2),a=Hu(this.e,r,o),h=Qu(this.e,this.lat2,r),l=Math.abs(Math.abs(this.lat0)-du)<gu?0:Qu(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>gu?this.ns=Math.log(s/a)/Math.log(n/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(n,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=gu&&(i=$u(i)*(du-2e-10));var s,n,r=Math.abs(Math.abs(i)-du);if(r>gu)s=Qu(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(s,this.ns);else{if((r=i*this.ns)<=0)return null;n=0}var o=this.ns*Ju(e-this.long0,this.over);return t.x=this.k0*(n*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,s,n,r,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var h=0;if(0!==e&&(h=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,s=Math.pow(e/(this.a*this.f0),i),-9999===(n=td(this.e,s)))return null}else n=-du;return r=Ju(h/this.ns+this.long0,this.over),t.x=r,t.y=n,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};var Cg={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y,c=Ju(h-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),s=-c*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(n)),o=this.n*r,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,s,n,r,o,a,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),r=Math.sqrt(t.x*t.x+t.y*t.y),n=Math.atan2(t.y,t.x)/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/r,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(n)),i=Math.asin(Math.cos(s)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,l+=1}while(0===a&&l<15);return l>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function bg(t,e,i,s,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)}function Pg(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Ig(t){return.375*t*(1+.25*t*(1+.46875*t))}function Rg(t){return.05859375*t*t*(1+.75*t)}function Gg(t){return t*t*t*(35/3072)}function Tg(t,e,i){var s=e*i;return t/Math.sqrt(1-s*s)}function Ag(t){return Math.abs(t)<du?t:t-$u(t)*Math.PI}function kg(t,e,i,s,n){var r,o;r=t/e;for(var a=0;a<15;a++)if(r+=o=(t-(e*r-i*Math.sin(2*r)+s*Math.sin(4*r)-n*Math.sin(6*r)))/(e-2*i*Math.cos(2*r)+4*s*Math.cos(4*r)-6*n*Math.cos(6*r)),Math.abs(o)<=1e-10)return r;return NaN}var Fg={init:function(){this.sphere||(this.e0=Pg(this.es),this.e1=Ig(this.es),this.e2=Rg(this.es),this.e3=Gg(this.es),this.ml0=this.a*bg(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,s=t.x,n=t.y;if(s=Ju(s-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(s)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(s))-this.lat0);else{var r=Math.sin(n),o=Math.cos(n),a=Tg(this.a,this.e,r),h=Math.tan(n)*Math.tan(n),l=s*Math.cos(n),c=l*l,u=this.es*o*o/(1-this.es);e=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),i=this.a*bg(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+a*r/o*c*(.5+(5-h+6*u)*c/24)}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s=t.x/this.a,n=t.y/this.a;if(this.sphere){var r=n+this.lat0;e=Math.asin(Math.sin(r)*Math.cos(s)),i=Math.atan2(Math.tan(s),Math.cos(r))}else{var o=kg(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-du)<=gu)return t.x=this.long0,t.y=du,n<0&&(t.y*=-1),t;var a=Tg(this.a,this.e,Math.sin(o)),h=a*a*a/this.a/this.a*(1-this.es),l=Math.pow(Math.tan(o),2),c=s*this.a/a,u=c*c;e=o-a*Math.tan(o)/h*c*c*(.5-(1+3*l)*c*c/24),i=c*(1-u*(l/3+(1+3*l)*l*u/15))/Math.cos(o)}return t.x=Ju(i+this.long0,this.over),t.y=Ag(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Og(t,e){var i;return t>1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}var Lg=.3333333333333333,Ng=.17222222222222222,Dg=.10257936507936508,jg=.06388888888888888,zg=.0664021164021164,Bg=.016415012942191543;var Wg={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-du)<gu?this.mode=this.lat0<0?1:2:Math.abs(e)<gu?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Og(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=t*Lg,e=t*t,i[0]+=e*Ng,i[1]=e*jg,e*=t,i[0]+=e*Dg,i[1]+=e*zg,i[2]=e*Bg,i}(this.es),this.mode){case 2:case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Og(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else 4===this.mode&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,s,n,r,o,a,h,l,c,u=t.x,d=t.y;if(u=Ju(u-this.long0,this.over),this.sphere){if(r=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+c*s:1+this.sinph0*r+this.cosph0*c*s)<=gu)return null;e=(i=Math.sqrt(2/i))*c*Math.sin(u),i*=this.mode===this.EQUIT?r:this.cosph0*r-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<gu)return null;i=pu-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(u),i*=s}}else{switch(a=0,h=0,l=0,s=Math.cos(u),n=Math.sin(u),r=Math.sin(d),o=Og(this.e,r),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*s;break;case this.EQUIT:l=1+h*s;break;case this.N_POLE:l=du+d,o=this.qp-o;break;case this.S_POLE:l=d-du,o=this.qp+o}if(Math.abs(l)<gu)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),i=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*a-this.sinb1*h*s):(l=Math.sqrt(2/(1+h*s)))*a*this.ymf,e=this.xmf*l*h*n;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(l=Math.sqrt(o))*n,i=s*(this.mode===this.S_POLE?l:-l)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,n,r,o,a,h,l,c,u=t.x/this.a,d=t.y/this.a;if(this.sphere){var g,f=0,_=0;if((i=.5*(g=Math.sqrt(u*u+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(_=Math.sin(i),f=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(g)<=gu?0:Math.asin(d*_/g),u*=_,d=f*g;break;case this.OBLIQ:i=Math.abs(g)<=gu?this.lat0:Math.asin(f*this.sinph0+d*_*this.cosph0/g),u*=_*this.cosph0,d=(f-Math.sin(i)*this.sinph0)*g;break;case this.N_POLE:d=-d,i=du-i;break;case this.S_POLE:i-=du}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(u,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,d*=this.dd,(o=Math.sqrt(u*u+d*d))<gu)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*o/this.rq),s=Math.cos(n),u*=n=Math.sin(n),this.mode===this.OBLIQ?(a=s*this.sinb1+d*n*this.cosb1/o,r=this.qp*a,d=o*this.cosb1*s-d*this.sinb1*n):(a=d*n/o,r=this.qp*a,d=o*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(r=u*u+d*d))return t.x=this.long0,t.y=this.lat0,t;a=1-r/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(u,d),h=Math.asin(a),l=this.apa,c=h+h,i=h+l[0]*Math.sin(c)+l[1]*Math.sin(c+c)+l[2]*Math.sin(c+c+c)}return t.x=Ju(this.long0+e,this.over),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Xg(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}var qg={init:function(){Math.abs(this.lat1+this.lat2)<gu||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Hu(this.e3,this.sin_po,this.cos_po),this.qs1=Og(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Hu(this.e3,this.sin_po,this.cos_po),this.qs2=Og(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=Og(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>gu?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var s=Og(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,r=this.ns0*Ju(e-this.long0,this.over),o=n*Math.sin(r)+this.x0,a=this.rh-n*Math.cos(r)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1),n=0,0!==e&&(n=Math.atan2(s*t.x,s*t.y)),s=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-s*s)/(2*this.ns0)):(i=(this.c-s*s)/this.ns0,o=this.phi1z(this.e3,i)),r=Ju(n/this.ns0+this.long0,this.over),t.x=r,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,s,n,r,o=Xg(.5*e);if(t<gu)return o;for(var a=t*t,h=1;h<=25;h++)if(o+=r=.5*(n=1-(s=t*(i=Math.sin(o)))*s)*n/Math.cos(o)*(e/(1-a)-i/n+.5/t*Math.log((1-s)/(1+s))),Math.abs(r)<=1e-7)return o;return null}};var Ug={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y;return s=Ju(h-this.long0,this.over),e=Math.sin(l),i=Math.cos(l),n=Math.cos(s),(r=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(r)<=gu?(o=this.x0+1*this.a*i*Math.sin(s)/r,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)/r):(o=this.x0+this.infinity_dist*i*Math.sin(s),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),o=Xg((s=Math.cos(n))*this.sin_p14+t.y*i*this.cos_p14/e),r=Math.atan2(t.x*i,e*this.cos_p14*s-t.y*this.sin_p14*i),r=Ju(this.long0+r,this.over)):(o=this.phic0,r=0),t.x=r,t.y=o,t},names:["gnom"]};var Yg={init:function(){this.sphere||(this.k0=Hu(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,s=t.x,n=t.y,r=Ju(s-this.long0,this.over);if(this.sphere)e=this.x0+this.a*r*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=Og(this.e,Math.sin(n));e=this.x0+this.a*this.k0*r,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=Ju(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*du:du;for(var s,n,r,o,a=Math.asin(.5*e),h=0;h<30;h++)if(n=Math.sin(a),r=Math.cos(a),o=t*n,a+=s=Math.pow(1-o*o,2)/(2*r)*(e/(1-t*t)-n/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(s)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=Ju(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]};var Zg={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,s=Ju(e-this.long0,this.over),n=Ag(i-this.lat0);return t.x=this.x0+this.a*s*this.rc,t.y=this.y0+this.a*n,t},inverse:function(t){var e=t.x,i=t.y;return t.x=Ju(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=Ag(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]};var Vg={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Pg(this.es),this.e1=Ig(this.es),this.e2=Rg(this.es),this.e3=Gg(this.es),this.ml0=this.a*bg(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,s,n=t.x,r=t.y,o=Ju(n-this.long0,this.over);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=gu?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(s)/Math.tan(r),i=this.a*(Ag(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=gu)e=this.a*o,i=-1*this.ml0;else{var a=Tg(this.a,this.e,Math.sin(r))/Math.tan(r);e=a*Math.sin(s),i=this.a*bg(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(s))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,s,n,r,o,a,h,l;if(s=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=gu)e=Ju(s/this.a+this.long0,this.over),i=0;else{var c;for(o=this.lat0+n/this.a,a=s*s/this.a/this.a+o*o,h=o,r=20;r;--r)if(h+=l=-1*(o*(h*(c=Math.tan(h))+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),Math.abs(l)<=gu){i=h;break}e=Ju(this.long0+Math.asin(s*Math.tan(h)/this.a)/Math.sin(i),this.over)}else if(Math.abs(n+this.ml0)<=gu)i=0,e=Ju(this.long0+s/this.a,this.over);else{var u,d,g,f,_;for(o=(this.ml0+n)/this.a,a=s*s/this.a/this.a+o*o,h=o,r=20;r;--r)if(_=this.e*Math.sin(h),u=Math.sqrt(1-_*_)*Math.tan(h),d=this.a*bg(this.e0,this.e1,this.e2,this.e3,h),g=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),h-=l=(o*(u*(f=d/this.a)+1)-f-.5*u*(f*f+a))/(this.es*Math.sin(2*h)*(f*f+a-2*o*f)/(4*u)+(o-f)*(u*g-2/Math.sin(2*h))-g),Math.abs(l)<=gu){i=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=Ju(this.long0+Math.asin(s*u/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]};var Kg={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,s=t.y-this.lat0,n=i-this.long0,r=s/uu*1e-5,o=n,a=1,h=0;for(e=1;e<=10;e++)a*=r,h+=this.A[e]*a;var l,c=h,u=o,d=1,g=0,f=0,_=0;for(e=1;e<=6;e++)l=g*c+d*u,d=d*c-g*u,g=l,f=f+this.B_re[e]*d-this.B_im[e]*g,_=_+this.B_im[e]*d+this.B_re[e]*g;return t.x=_*this.a+this.x0,t.y=f*this.a+this.y0,t},inverse:function(t){var e,i,s=t.x,n=t.y,r=s-this.x0,o=(n-this.y0)/this.a,a=r/this.a,h=1,l=0,c=0,u=0;for(e=1;e<=6;e++)i=l*o+h*a,h=h*o-l*a,l=i,c=c+this.C_re[e]*h-this.C_im[e]*l,u=u+this.C_im[e]*h+this.C_re[e]*l;for(var d=0;d<this.iterations;d++){var g,f=c,_=u,p=o,m=a;for(e=2;e<=6;e++)g=_*c+f*u,f=f*c-_*u,_=g,p+=(e-1)*(this.B_re[e]*f-this.B_im[e]*_),m+=(e-1)*(this.B_im[e]*f+this.B_re[e]*_);f=1,_=0;var y=this.B_re[1],x=this.B_im[1];for(e=2;e<=6;e++)g=_*c+f*u,f=f*c-_*u,_=g,y+=e*(this.B_re[e]*f-this.B_im[e]*_),x+=e*(this.B_im[e]*f+this.B_re[e]*_);var v=y*y+x*x;c=(p*y+m*x)/v,u=(m*y-p*x)/v}var M=c,w=u,S=1,E=0;for(e=1;e<=9;e++)S*=M,E+=this.D[e]*S;var C=this.lat0+E*uu*1e5,b=this.long0+w;return t.x=b,t.y=C,t},names:["New_Zealand_Map_Grid","nzmg"]};var Hg={init:function(){},forward:function(t){var e=t.x,i=t.y,s=Ju(e-this.long0,this.over),n=this.x0+this.a*s,r=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=n,t.y=r,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=Ju(this.long0+t.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t},names:["Miller_Cylindrical","mill"]};var $g={init:function(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=rg(this.es)},forward:function(t){var e,i,s=t.x,n=t.y;if(s=Ju(s-this.long0,this.over),this.sphere){if(this.m)for(var r=this.n*Math.sin(n),o=20;o;--o){var a=(this.m*n+Math.sin(n)-r)/(this.m+Math.cos(n));if(n-=a,Math.abs(a)<gu)break}else n=1!==this.n?Math.asin(this.n*Math.sin(n)):n;e=this.a*this.C_x*s*(this.m+Math.cos(n)),i=this.a*this.C_y*n}else{var h=Math.sin(n),l=Math.cos(n);i=this.a*og(n,h,l,this.en),e=this.a*s*l/Math.sqrt(1-this.es*h*h)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=Xg((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Xg(Math.sin(e)/this.n)),i=Ju(i+this.long0,this.over),e=Ag(e)):(e=ag(t.y/this.a,this.es,this.en),(s=Math.abs(e))<du?(s=Math.sin(e),i=Ju(this.long0+t.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),this.over)):s-gu<du&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]};var Jg={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0},forward:function(t){for(var e=t.x,i=t.y,s=Ju(e-this.long0,this.over),n=i,r=Math.PI*Math.sin(i);;){var o=-(n+Math.sin(n)-r)/(1+Math.cos(n));if(n+=o,Math.abs(o)<gu)break}n/=2,Math.PI/2-Math.abs(i)<gu&&(s=0);var a=.900316316158*this.a*s*Math.cos(n)+this.x0,h=1.4142135623731*this.a*Math.sin(n)+this.y0;return t.x=a,t.y=h,t},inverse:function(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var s=Ju(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=s,t.y=n,t},names:["Mollweide","moll"]};var Qg={init:function(){Math.abs(this.lat1+this.lat2)<gu||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Pg(this.es),this.e1=Ig(this.es),this.e2=Rg(this.es),this.e3=Gg(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Hu(this.e,this.sin_phi,this.cos_phi),this.ml1=bg(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<gu?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Hu(this.e,this.sin_phi,this.cos_phi),this.ml2=bg(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=bg(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var e,i=t.x,s=t.y;if(this.sphere)e=this.a*(this.g-s);else{var n=bg(this.e0,this.e1,this.e2,this.e3,s);e=this.a*(this.g-n)}var r=this.ns*Ju(i-this.long0,this.over),o=this.x0+e*Math.sin(r),a=this.y0+this.rh-e*Math.cos(r);return t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var r=0;return 0!==i&&(r=Math.atan2(e*t.x,e*t.y)),this.sphere?(n=Ju(this.long0+r/this.ns,this.over),s=Ag(this.g-i/this.a),t.x=n,t.y=s,t):(s=kg(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),n=Ju(this.long0+r/this.ns,this.over),t.x=n,t.y=s,t)},names:["Equidistant_Conic","eqdc"]};var tf={init:function(){this.R=this.a},forward:function(t){var e,i,s=t.x,n=t.y,r=Ju(s-this.long0,this.over);Math.abs(n)<=gu&&(e=this.x0+this.R*r,i=this.y0);var o=Xg(2*Math.abs(n/Math.PI));(Math.abs(r)<=gu||Math.abs(Math.abs(n)-du)<=gu)&&(e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/r-r/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,g=u*(2/l-1),f=g*g,_=Math.PI*this.R*(a*(u-f)+Math.sqrt(h*(u-f)*(u-f)-(f+h)*(d-f)))/(f+h);r<0&&(_=-_),e=this.x0+_;var p=h+u;return _=Math.PI*this.R*(g*p-a*Math.sqrt((f+h)*(h+1)-p*p))/(f+h),i=n>=0?this.y0+_:this.y0-_,t.x=e,t.y=i,t},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,r=(s=t.x/u)*s+(n=t.y/u)*n,u=3*(n*n/(h=-2*(o=-Math.abs(n)*(1+r))+1+2*n*n+r*r)+(2*(a=o-2*n*n+s*s)*a*a/h/h/h-9*o*a/h/h)/27)/(l=(o-a*a/3/h)/h)/(c=2*Math.sqrt(-l/3)),Math.abs(u)>1&&(u=u>=0?1:-1),d=Math.acos(u)/3,i=t.y>=0?(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,e=Math.abs(s)<gu?this.long0:Ju(this.long0+Math.PI*(r-1+Math.sqrt(1+2*(s*s-n*n)+r*r))/2/s,this.over),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]};var ef={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))},forward:function(t){var e,i,s,n,r,o,a,h,l,c,u,d=t.x,g=t.y,f=Math.sin(t.y),_=Math.cos(t.y),p=Ju(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=gu?(t.x=this.x0+this.a*(du-g)*Math.sin(p),t.y=this.y0-this.a*(du-g)*Math.cos(p),t):Math.abs(this.sin_p12+1)<=gu?(t.x=this.x0+this.a*(du+g)*Math.sin(p),t.y=this.y0+this.a*(du+g)*Math.cos(p),t):(l=this.sin_p12*f+this.cos_p12*_*Math.cos(p),h=(a=Math.acos(l))?a/Math.sin(a):1,t.x=this.x0+this.a*h*_*Math.sin(p),t.y=this.y0+this.a*h*(this.cos_p12*f-this.sin_p12*_*Math.cos(p)),t):(e=Pg(this.es),i=Ig(this.es),s=Rg(this.es),n=Gg(this.es),Math.abs(this.sin_p12-1)<=gu?(r=this.a*bg(e,i,s,n,du),o=this.a*bg(e,i,s,n,g),t.x=this.x0+(r-o)*Math.sin(p),t.y=this.y0-(r-o)*Math.cos(p),t):Math.abs(this.sin_p12+1)<=gu?(r=this.a*bg(e,i,s,n,du),o=this.a*bg(e,i,s,n,g),t.x=this.x0+(r+o)*Math.sin(p),t.y=this.y0+(r+o)*Math.cos(p),t):Math.abs(d)<gu&&Math.abs(g-this.lat0)<gu?(t.x=t.y=0,t):(c=function(t,e,i,s,n,r){const o=s-e,a=Math.atan((1-r)*Math.tan(t)),h=Math.atan((1-r)*Math.tan(i)),l=Math.sin(a),c=Math.cos(a),u=Math.sin(h),d=Math.cos(h);let g,f,_,p,m,y,x,v,M,w,S,E,C,b,P,I=o,R=100;do{if(f=Math.sin(I),_=Math.cos(I),p=Math.sqrt(d*f*(d*f)+(c*u-l*d*_)*(c*u-l*d*_)),0===p)return{azi1:0,s12:0};m=l*u+c*d*_,y=Math.atan2(p,m),x=c*d*f/p,v=1-x*x,M=0!==v?m-2*l*u/v:0,w=r/16*v*(4+r*(4-3*v)),g=I,I=o+(1-w)*r*x*(y+w*p*(M+w*m*(2*M*M-1)))}while(Math.abs(I-g)>1e-12&&--R>0);return 0===R?{azi1:NaN,s12:NaN}:(S=v*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),E=1+S/16384*(4096+S*(S*(320-175*S)-768)),C=S/1024*(256+S*(S*(74-47*S)-128)),b=C*p*(M+C/4*(m*(2*M*M-1)-C/6*M*(4*p*p-3)*(4*M*M-3))),P=n*(1-r)*E*(y-b),{azi1:Math.atan2(d*f,c*u-l*d*_),s12:P})}(this.lat0,this.long0,g,d,this.a,this.f),u=c.azi1,t.x=c.s12*Math.sin(u),t.y=c.s12*Math.cos(u),t))},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d,g,f,_;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*du*this.a)return;return i=e/this.a,s=Math.sin(i),n=Math.cos(i),r=this.long0,Math.abs(e)<=gu?o=this.lat0:(o=Xg(n*this.sin_p12+t.y*s*this.cos_p12/e),a=Math.abs(this.lat0)-du,r=Math.abs(a)<=gu?this.lat0>=0?Ju(this.long0+Math.atan2(t.x,-t.y),this.over):Ju(this.long0-Math.atan2(-t.x,t.y),this.over):Ju(this.long0+Math.atan2(t.x*s,e*this.cos_p12*n-t.y*this.sin_p12*s),this.over)),t.x=r,t.y=o,t}return h=Pg(this.es),l=Ig(this.es),c=Rg(this.es),u=Gg(this.es),Math.abs(this.sin_p12-1)<=gu?(o=kg(((d=this.a*bg(h,l,c,u,du))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,h,l,c,u),r=Ju(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=r,t.y=o,t):Math.abs(this.sin_p12+1)<=gu?(d=this.a*bg(h,l,c,u,du),o=kg(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,h,l,c,u),r=Ju(this.long0+Math.atan2(t.x,t.y),this.over),t.x=r,t.y=o,t):(g=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),_=function(t,e,i,s,n,r){const o=Math.atan((1-r)*Math.tan(t)),a=Math.sin(o),h=Math.cos(o),l=Math.sin(i),c=Math.cos(i),u=Math.atan2(a,h*c),d=h*l,g=1-d*d,f=g*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),_=1+f/16384*(4096+f*(f*(320-175*f)-768)),p=f/1024*(256+f*(f*(74-47*f)-128));let m,y,x,v,M,w=s/(n*(1-r)*_),S=100;do{y=Math.cos(2*u+w),x=Math.sin(w),v=Math.cos(w),M=p*x*(y+p/4*(v*(2*y*y-1)-p/6*y*(4*x*x-3)*(4*y*y-3))),m=w,w=s/(n*(1-r)*_)+M}while(Math.abs(w-m)>1e-12&&--S>0);if(0===S)return{lat2:NaN,lon2:NaN};const E=a*x-h*v*c,C=r/16*g*(4+r*(4-3*g));return{lat2:Math.atan2(a*v+h*x*c,(1-r)*Math.sqrt(d*d+E*E)),lon2:e+(Math.atan2(x*l,h*v-a*x*c)-(1-C)*r*d*(w+C*x*(y+C*v*(2*y*y-1))))}}(this.lat0,this.long0,g,f,this.a,this.f),t.x=_.lon2,t.y=_.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]};var sf={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y;return s=Ju(h-(this.long0||0),this.over),e=Math.sin(l),i=Math.cos(l),n=Math.cos(s),((r=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(r)<=gu)&&(o=1*this.a*i*Math.sin(s),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)),t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o,a,h,l;return t.x-=this.x0||0,t.y-=this.y0||0,i=Xg((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),s=Math.sin(i),n=Math.cos(i),h=this.long0||0,l=this.lat0||0,o=h,Math.abs(e)<=gu?(a=l,t.x=o,t.y=a,t):(a=Xg(n*this.sin_p14+t.y*s*this.cos_p14/e),r=Math.abs(l)-du,Math.abs(r)<=gu?(o=Ju(l>=0?h+Math.atan2(t.x,-t.y):h-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=Ju(h+Math.atan2(t.x*s,e*this.cos_p14*n-t.y*this.sin_p14*s),this.over),t.x=o,t.y=a,t))},names:["ortho"]},nf=1,rf=2,of=3,af=4,hf=5,lf=6,cf=1,uf=2,df=3,gf=4;function ff(t,e,i,s){var n;return t<gu?(s.value=cf,n=0):(n=Math.atan2(e,i),Math.abs(n)<=pu?s.value=cf:n>pu&&n<=du+pu?(s.value=uf,n-=du):n>du+pu||n<=-(du+pu)?(s.value=df,n=n>=0?n-yu:n+yu):(s.value=gf,n+=du)),n}function _f(t,e){var i=t+e;return i<-yu?i+=mu:i>+yu&&(i-=mu),i}var pf={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=du-pu/2?this.face=hf:this.lat0<=-(du-pu/2)?this.face=lf:Math.abs(this.long0)<=pu?this.face=nf:Math.abs(this.long0)<=du+pu?this.face=this.long0>0?rf:af:this.face=of,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,s,n,r,o,a={x:0,y:0},h={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===hf)n=du-e,i>=pu&&i<=du+pu?(h.value=cf,s=i-du):i>du+pu||i<=-(du+pu)?(h.value=uf,s=i>0?i-yu:i+yu):i>-(du+pu)&&i<=-pu?(h.value=df,s=i+du):(h.value=gf,s=i);else if(this.face===lf)n=du+e,i>=pu&&i<=du+pu?(h.value=cf,s=-i+du):i<pu&&i>=-pu?(h.value=uf,s=-i):i<-pu&&i>=-(du+pu)?(h.value=df,s=-i-du):(h.value=gf,s=i>0?-i+yu:-i-yu);else{var l,c,u,d,g,f;this.face===rf?i=_f(i,+du):this.face===of?i=_f(i,+yu):this.face===af&&(i=_f(i,-du)),d=Math.sin(e),g=Math.cos(e),f=Math.sin(i),l=g*Math.cos(i),c=g*f,u=d,this.face===nf?s=ff(n=Math.acos(l),u,c,h):this.face===rf?s=ff(n=Math.acos(c),u,-l,h):this.face===of?s=ff(n=Math.acos(-l),u,-c,h):this.face===af?s=ff(n=Math.acos(-c),u,l,h):(n=s=0,h.value=cf)}return o=Math.atan(12/yu*(s+Math.acos(Math.sin(s)*Math.cos(pu))-du)),r=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===uf?o+=du:h.value===df?o+=yu:h.value===gf&&(o+=1.5*yu),a.x=r*Math.cos(o),a.y=r*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d,g={lam:0,phi:0},f={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f.value=cf:t.y>=0&&t.y>=Math.abs(t.x)?(f.value=uf,e-=du):t.x<0&&-t.x>=Math.abs(t.y)?(f.value=df,e=e<0?e+yu:e-yu):(f.value=gf,e+=du),l=yu/12*Math.tan(e),r=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(r),(a=1-(s=Math.cos(e))*s*(n=Math.tan(i))*n*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),this.face===hf)h=Math.acos(a),g.phi=du-h,f.value===cf?g.lam=o+du:f.value===uf?g.lam=o<0?o+yu:o-yu:f.value===df?g.lam=o-du:g.lam=o;else if(this.face===lf)h=Math.acos(a),g.phi=h-du,f.value===cf?g.lam=-o+du:f.value===uf?g.lam=-o:f.value===df?g.lam=-o-du:g.lam=o<0?-o-yu:-o+yu;else{var _,p,m;l=(_=a)*_,p=(l+=(m=l>=1?0:Math.sqrt(1-l)*Math.sin(o))*m)>=1?0:Math.sqrt(1-l),f.value===uf?(l=p,p=-m,m=l):f.value===df?(p=-p,m=-m):f.value===gf&&(l=p,p=m,m=-l),this.face===rf?(l=_,_=-p,p=l):this.face===of?(_=-_,p=-p):this.face===af&&(l=_,_=p,p=-l),g.phi=Math.acos(-m)-du,g.lam=Math.atan2(p,_),this.face===rf?g.lam=_f(g.lam,-du):this.face===of?g.lam=_f(g.lam,-yu):this.face===af&&(g.lam=_f(g.lam,+du))}return 0!==this.es&&(c=g.phi<0?1:0,u=Math.tan(g.phi),d=this.b/Math.sqrt(u*u+this.one_minus_f_squared),g.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),c&&(g.phi=-g.phi)),g.lam+=this.long0,t.x=g.lam,t.y=g.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},mf=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],yf=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],xf=.8487,vf=1.3523,Mf=_u/5,wf=1/Mf,Sf=18,Ef=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};var Cf={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=Ju(t.x-this.long0,this.over),i=Math.abs(t.y),s=Math.floor(i*Mf);s<0?s=0:s>=Sf&&(s=17);var n={x:Ef(mf[s],i=_u*(i-wf*s))*e,y:Ef(yf[s],i)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*xf+this.x0,n.y=n.y*this.a*vf+this.y0,n},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*xf),y:Math.abs(t.y-this.y0)/(this.a*vf)};if(e.y>=1)e.x/=mf[18][0],e.y=t.y<0?-du:du;else{var i=Math.floor(e.y*Sf);for(i<0?i=0:i>=Sf&&(i=17);;)if(yf[i][0]>e.y)--i;else{if(!(yf[i+1][0]<=e.y))break;++i}var s=yf[i],n=5*(e.y-s[0])/(yf[i+1][0]-s[0]);n=function(t,e,i,s){for(var n=e;s;--s){var r=t(n);if(n-=r,Math.abs(r)<i)break}return n}(function(t){return(Ef(s,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(s,t)},n,gu,100),e.x/=Ef(mf[i],n),e.y=(5*i+n)*fu,t.y<0&&(e.y=-e.y)}return e.x=Ju(e.x+this.long0,this.over),e},names:["Robinson","robin"]};var bf={init:function(){this.name="geocent"},forward:function(t){return Ed(t,this.es,this.a)},inverse:function(t){return Cd(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]},Pf=0,If=1,Rf=2,Gf=3,Tf={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};var Af={init:function(){if(Object.keys(Tf).forEach(function(t){if(void 0===this[t])this[t]=Tf[t].def;else{if(Tf[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);Tf[t].num&&(this[t]=parseFloat(this[t]))}Tf[t].degrees&&(this[t]=this[t]*fu)}.bind(this)),Math.abs(Math.abs(this.lat0)-du)<gu?this.mode=this.lat0<0?If:Pf:Math.abs(this.lat0)<gu?this.mode=Rf:(this.mode=Gf,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)},forward:function(t){t.x-=this.long0;var e,i,s,n,r=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case Gf:i=this.sinph0*r+this.cosph0*o*a;break;case Rf:i=o*a;break;case If:i=-r;break;case Pf:i=r}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case Gf:i*=this.cosph0*r-this.sinph0*o*a;break;case Rf:i*=r;break;case Pf:i*=-o*a;break;case If:i*=o*a}return n=1/((s=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*n,i=s*n,t.x=e*this.a,t.y=i*this.a,t},inverse:function(t){t.x/=this.a,t.y/=this.a;var e,i,s,n={x:t.x,y:t.y};s=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*s,i=this.pn1*t.y*this.cw*s,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var r=cg(t.x,t.y);if(Math.abs(r)<gu)n.x=0,n.y=t.y;else{var o,a;switch(a=1-r*r*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/r+r/this.pn1),o=Math.sqrt(1-a*a),this.mode){case Gf:n.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/r),t.y=(o-this.sinph0*Math.sin(n.y))*r,t.x*=a*this.cosph0;break;case Rf:n.y=Math.asin(t.y*a/r),t.y=o*r,t.x*=a;break;case Pf:n.y=Math.asin(o),t.y=-t.y;break;case If:n.y=-Math.asin(o)}n.x=Math.atan2(t.x,t.y)}return t.x=n.x+this.long0,t.y=n.y,t},names:["Tilted_Perspective","tpers"]};var kf={init:function(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,s,n,r=t.x,o=t.y;if(r-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/cg(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(r)*Math.cos(o),s=a*Math.sin(r)*Math.cos(o),n=a*Math.sin(o),(this.radius_g-i)*i-s*s-n*n*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/cg(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/cg(s,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(r)*e,s=Math.sin(r)*e,n=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/cg(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/cg(s,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,s,n,r=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*cg(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*cg(1,o));var h=a/this.radius_p;if(e=o*o+h*h+r*r,(s=(i=2*this.radius_g*r)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+r*r,(s=(i=2*this.radius_g*r)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]},Ff=1.340264,Of=-.081106,Lf=893e-6,Nf=.003796,Df=Math.sqrt(3)/2;var jf={init:function(){this.es=0,this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0},forward:function(t){var e=Ju(t.x-this.long0,this.over),i=t.y,s=Math.asin(Df*Math.sin(i)),n=s*s,r=n*n*n;return t.x=e*Math.cos(s)/(Df*(Ff+3*Of*n+r*(7*Lf+9*Nf*n))),t.y=s*(Ff+Of*n+r*(Lf+Nf*n)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e,i,s,n,r=t.y;for(n=0;n<12&&(r-=s=(r*(Ff+Of*(e=r*r)+(i=e*e*e)*(Lf+Nf*e))-t.y)/(Ff+3*Of*e+i*(7*Lf+9*Nf*e)),!(Math.abs(s)<1e-9));++n);return i=(e=r*r)*e*e,t.x=Df*t.x*(Ff+3*Of*e+i*(7*Lf+9*Nf*e))/Math.cos(r),t.y=Math.asin(Math.sin(r)/Df),t.x=Ju(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]},zf=1e-10;function Bf(t){var e,i,s,n=Ju(t.x-(this.long0||0),this.over),r=t.y;return e=this.am1+this.m1-og(r,i=Math.sin(r),s=Math.cos(r),this.en),i=s*n/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function Wf(t){var e,i,s,n;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=cg(t.x,t.y=this.am1-t.y),n=ag(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(n))<du)e=Math.sin(n),s=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(n);else{if(!(Math.abs(e-du)<=zf))throw new Error;s=0}return t.x=Ju(s+(this.long0||0),this.over),t.y=Ag(n),t}function Xf(t){var e,i,s=Ju(t.x-(this.long0||0),this.over),n=t.y;return i=this.cphi1+this.phi1-n,Math.abs(i)>zf?(t.x=i*Math.sin(e=s*Math.cos(n)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function qf(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var s=cg(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-s,Math.abs(i)>du)throw new Error;return e=Math.abs(Math.abs(i)-du)<=zf?0:s*Math.atan2(t.x,t.y)/Math.cos(i),t.x=Ju(e+(this.long0||0),this.over),t.y=Ag(i),t}var Uf={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<zf)throw new Error;this.es?(this.en=rg(this.es),this.m1=og(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=Wf,this.forward=Bf):(Math.abs(this.phi1)+zf>=du?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=qf,this.forward=Xf)},names:["bonne","Bonne (Werner lat_1=90)"]};const Yf={OBLIQUE:{forward:function(t,e){let{x:i,y:s}=e;i+=t.long0;const n=Math.cos(i),r=Math.sin(s),o=Math.cos(s);e.x=Ju(Math.atan2(o*Math.sin(i),t.sphip*o*n+t.cphip*r)+t.lamp),e.y=Math.asin(t.sphip*r-t.cphip*o*n);const a=t.obliqueProjection.forward(e);t.isIdentity&&(a.x*=_u,a.y*=_u);return a},inverse:function(t,e){t.isIdentity&&(e.x*=fu,e.y*=fu);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){s-=t.lamp;const i=Math.cos(s),r=Math.sin(n),o=Math.cos(n);e.x=Math.atan2(o*Math.sin(s),t.sphip*o*i-t.cphip*r),e.y=Math.asin(t.sphip*r+t.cphip*o*i)}return e.x=Ju(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:s}=e;i+=t.long0;const n=Math.cos(s),r=Math.cos(i);e.x=Ju(Math.atan2(n*Math.sin(i),Math.sin(s))+t.lamp),e.y=Math.asin(-1*n*r);const o=t.obliqueProjection.forward(e);t.isIdentity&&(o.x*=_u,o.y*=_u);return o},inverse:function(t,e){t.isIdentity&&(e.x*=fu,e.y*=fu);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){const i=Math.cos(n);s-=t.lamp,e.x=Math.atan2(i*Math.sin(s),-1*Math.sin(n)),e.y=Math.asin(i*Math.cos(s))}return e.x=Ju(e.x+t.long0),e}}},Zf={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};var Vf={init:function(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=id.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw new Error("Invalid value for o_proj: "+this.o_proj);const t=Sd(this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim());if(!t)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let e;t.long0=0,this.obliqueProjection=t;const i=Object.keys(Zf),s=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*fu;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<i.length;t++){const n=i[t],r=Zf[n],o=Object.entries(r);if(o.some(([t])=>void 0!==this[t])){e=r;for(let t=0;t<o.length;t++){const[e,i]=o[t],n=s(e);if(void 0===n)throw new Error("Missing parameter: "+e+".");this[i]=n}break}}if(!e)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:n,phip:r}=function(t,e){let i,s;if(e===Zf.ROTATE){let e=t.oLongC,n=t.oLatC,r=t.oAlpha;if(Math.abs(Math.abs(n)-du)<=gu)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");s=e+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(n)),i=Math.asin(Math.cos(n)*Math.sin(r))}else if(e===Zf.NEW_POLE)s=t.oLongP,i=t.oLatP;else{let e=t.oLong1,n=t.oLat1,r=t.oLong2,o=t.oLat2,a=Math.abs(n);if(Math.abs(n)>du-gu)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>du-gu)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(n-o)<gu)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<gu)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");s=Math.atan2(Math.cos(n)*Math.sin(o)*Math.cos(e)-Math.sin(n)*Math.cos(o)*Math.cos(r),Math.sin(n)*Math.cos(o)*Math.sin(r)-Math.cos(n)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(s-e)/Math.tan(n))}return{lamp:s,phip:i}}(this,e);this.lamp=n,Math.abs(r)>gu?(this.cphip=Math.cos(r),this.sphip=Math.sin(r),this.projectionType=Yf.OBLIQUE):this.projectionType=Yf.TRANSVERSE},forward:function(t){return this.projectionType.forward(this,t)},inverse:function(t){return this.projectionType.inverse(this,t)},names:["General Oblique Transformation","General_Oblique_Transformation","ob_tran"]};const Kf=Object.assign(function(t,e,i){var s,n,r,o=!1;return void 0===e?(n=Nd(t),s=Od,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,n=Nd(t),s=Od,o=!0),s||(s=Nd(t)),n||(n=Nd(e)),i?Ld(s,n,i):(r={forward:function(t,e){return Ld(s,n,t,e)},inverse:function(t,e){return Ld(n,s,t,e)}},o&&(r.oProj=n),r)},{defaultDatum:"WGS84",Proj:Sd,WGS84:new Sd("WGS84"),Point:eg,toPoint:Ad,defs:Yu,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var s=!0;void 0!==i&&!1===i.includeErrorFields&&(s=!1);var n=new DataView(e),r=function(t){var e=t.getInt32(8,!1);if(11===e)return!1;e=t.getInt32(8,!0),11!==e&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian");return!0}(n),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:xd(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(n,r),a=function(t,e,i,s){for(var n=176,r=[],o=0;o<e.nSubgrids;o++){var a=Md(t,n,i),h=wd(t,n,a,i,s),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),c=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[yd(a.lowerLongitude),yd(a.lowerLatitude)],del:[yd(a.longitudeInterval),yd(a.latitudeInterval)],lim:[l,c],count:a.gridNodeCount,cvs:vd(h)});var u=16;!1===s&&(u=8),n+=176+a.gridNodeCount*u}return r}(n,o,r,s),h={header:o,subgrids:a};return fd[t]=h,h}(t,e,i):{ready:_d(t,e)}},transform:Fd,mgrs:Ud,version:"__VERSION__"});!function(t){t.Proj.projections.add(hg),t.Proj.projections.add(fg),t.Proj.projections.add(_g),t.Proj.projections.add(yg),t.Proj.projections.add(vg),t.Proj.projections.add(Mg),t.Proj.projections.add(Sg),t.Proj.projections.add(Eg),t.Proj.projections.add(Cg),t.Proj.projections.add(Fg),t.Proj.projections.add(Wg),t.Proj.projections.add(qg),t.Proj.projections.add(Ug),t.Proj.projections.add(Yg),t.Proj.projections.add(Zg),t.Proj.projections.add(Vg),t.Proj.projections.add(Kg),t.Proj.projections.add(Hg),t.Proj.projections.add($g),t.Proj.projections.add(Jg),t.Proj.projections.add(Qg),t.Proj.projections.add(tf),t.Proj.projections.add(ef),t.Proj.projections.add(sf),t.Proj.projections.add(pf),t.Proj.projections.add(Cf),t.Proj.projections.add(bf),t.Proj.projections.add(Af),t.Proj.projections.add(kf),t.Proj.projections.add(jf),t.Proj.projections.add(Uf),t.Proj.projections.add(Vf)}(Kf);var Hf="EPSG:27700";Kf.defs(Hf,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),function(t){const e=Object.keys(t.defs),i=e.length;let s,n;for(s=0;s<i;++s){const i=e[s];if(!Ae(i)){const e=t.defs(i);let s=e.units;s||"longlat"!==e.projName||(s="degrees"),di(new me({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:s}))}}for(s=0;s<i;++s){const r=e[s],o=Ae(r);for(n=0;n<i;++n){const i=e[n],s=Ae(i);if(!Oe(r,i))if(t.defs[r]===t.defs[i])_i([o,s]);else{const e=t(r,i);yi(o,s,Ri(o,s,e.forward),Ri(s,o,e.inverse))}}}}(Kf);var $f=new Map,Jf=function(){var e=t(function*(t,e,i,s){var n=i.getPatternImageId(t,e,s);if(n&&!$f.has(n)){var r=yield i.rasterisePatternImage(t,e,s);if(r){var o=r.imageId;$f.has(o)||$f.set(o,(t=>{var e=document.createElement("canvas");e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t,0,0);var i=document.createElement("canvas").getContext("2d").createPattern(e,"repeat");return new kh({color:i})})(r.imageData))}}});return function(t,i,s,n){return e.apply(this,arguments)}}(),Qf=function(){var e=t(function*(t,e,i,s){t.length&&(yield Promise.all(t.map(t=>Jf(t,e,i,s))))});return function(t,i,s,n){return e.apply(this,arguments)}}(),t_=(t,e)=>{if(t.hasStroke)return new Fh({color:s(t.style.stroke,e),width:t.style.strokeWidth||1,lineDash:t.style.strokeDashArray})},e_=(t,e,i,s)=>{var n=s.getPatternImageId(t.style,e,i),r=n&&(t=>$f.get(t))(n),o=r?new Oh({fill:r,stroke:t_(t,e)}):void 0,a=(t=>{if(!t)return null;var e=Ph(t,oa,Ma()),i={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return t=>{var s,n,r;return i.properties=t.getProperties(),i.featureId=null!==(s=t.getId())&&void 0!==s?s:null,i.geometryType=null!==(n=null===(r=t.getGeometry())||void 0===r?void 0:r.getType())&&void 0!==n?n:"",Boolean(e(i))}})(t.filter);return t=>{if(o&&(!a||a(t)))return o}};function i_(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function s_(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?i_(Object(i),!0).forEach(function(e){l(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):i_(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var n_=Hf,r_=new class extends Hc{constructor(t){t=t||{},super(),this.dataProjection=gi(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=gi(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const s=Jc(i.geometry);if(this.featureClass===Zs)return Vc({geometry:s,id:i.id,properties:i.properties},e);const n=new(0,this.featureClass);return this.geometryName_?n.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&n.setGeometryName(i.geometry_name),n.setGeometry(Kc(s,e)),"id"in i&&n.setId(i.id),i.properties&&n.setProperties(i.properties,!0),n}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const s=t.features;for(let t=0,n=s.length;t<n;++t){const n=this.readFeatureFromObject(s[t],e);n&&i.push(n)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){const i=Jc(t);return Kc(i,e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=gi(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=gi("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},s=t.getId();if(void 0!==s&&(i.id=s),!t.hasProperties())return i;const n=t.getProperties(),r=t.getGeometry();return r&&(i.geometry=Qc(r,e),delete n[t.getGeometryName()]),N(n)||(i.properties=n),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let s=0,n=t.length;s<n;++s)i.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Qc(t,this.adaptOptions(e))}}({dataProjection:n_,featureProjection:n_}),o_=1e-6,a_=13e5,h_=[0,0,a_,a_],l_=new ec({extent:h_,origin:[h_[0],h_[3]],resolutions:Array.from({length:25},(t,e)=>(h_[2]-h_[0])/(256*2**e)),tileSize:256}),c_=(t,e)=>{if(!e)return r_.readFeatures(t);var i=s_(s_({},t),{},{features:t.features.map(t=>{var i,s;return s_(s_({},t),{},{id:null!==(i=null===(s=t.properties)||void 0===s?void 0:s[e])&&void 0!==i?i:t.id})})});return r_.readFeatures(i)},u_=t=>{var{source:e,id:i,idStrategy:s}=t;if(!e)return null;if("geojson"===e.type){var n,r=new En;return"string"==typeof e.data?((t,e,i,s)=>{fetch(e).then(t=>{if(!t.ok)throw new Error("".concat(t.status," ").concat(t.statusText));return t.json()}).then(e=>t.addFeatures(c_(e,i))).catch(t=>h.warn('OpenLayers datasets adapter: failed to fetch geojson for dataset "'.concat(s,'" — ').concat(t.message)))})(r,e.data,s,i):null!==(n=e.data)&&void 0!==n&&null!==(n=n.features)&&void 0!==n&&n.length&&r.addFeatures(c_(e.data,s)),r}if("vector"===e.type){var o=Array.isArray(e.tiles)?e.tiles:[e.tiles];return new mc({format:new nu({featureClass:Fi,idProperty:s||void 0}),urls:o,projection:n_,tileGrid:l_})}return h.warn('OpenLayers datasets adapter: unsupported source type "'.concat(e.type,'" (dataset "').concat(i,'")')),null},d_=function(t){var{mapStyleId:e,pixelRatio:i,patternRegistry:s}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.hasPattern?e_(t,e,i,s):t.flatStyle};class g_ extends o{constructor(t,e,i){super(t,e,i),this._sourcesById=new Map,this._layersById=new Map,this.createDataset=this.createDataset.bind(this)}createDataset(t){return new A(t)}get _styleContext(){var t;return{mapStyleId:null===(t=a.mapStyle)||void 0===t?void 0:t.id,pixelRatio:this._pixelRatio,patternRegistry:this._patternRegistry}}init(){var e=this;return t(function*(){yield Promise.all([e._registerPatterns(),e._registerSymbols()]),a.forEachDataset(t=>e._addLayers(t))})()}destroy(){this._layersById.forEach(t=>this._map.removeLayer(t)),this._layersById.clear(),this._sourcesById.clear()}onMapStyleChange(){var e=this;return t(function*(){yield Promise.all([e._registerPatterns(),e._registerSymbols()]),a.forEachDataset(t=>e._forEachLeafDataset(t,t=>{e._setLayerStyle(t)}))})()}onMapSizeChange(){var e=this;return t(function*(){yield e._registerPatterns(),a.forEachDataset(t=>e._forEachLeafDataset(t,t=>{t.hasPattern&&e._setLayerStyle(t)}))})()}_registerPatternsAndSymbols(t){return Promise.all([this._registerPatterns([t]),this._registerSymbols([t])])}removeDataset(t){var e=a.getDataset(t);if(e){e.layerIds.forEach(t=>{var e=this._layersById.get(t);e&&(this._map.removeLayer(e),this._layersById.delete(t))});var{sourceId:i}=e;a.topLevelDatasets().some(e=>e.id!==t&&e.sourceId===i)||this._sourcesById.delete(i)}}applyStyle(e){var i=this;return t(function*(){var t=a.getDataset(e);t&&(yield i._registerPatternsAndSymbols(t),i._forEachLeafDataset(t,t=>{i._layersById.has(t.id)?i._setLayerStyle(t):i._addLayers(t)}))})()}_setLayerOpacity(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setOpacity(e)}_setLayerVisibility(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setVisible("visible"===e)}applyFeatureFilter(t){var e=a.getDataset(t);e&&this._forEachLeafDataset(e,t=>{this._setLayerStyle(t)})}setData(t,e){var i,s=a.getDataset(t),n=s&&this._sourcesById.get(s.sourceId);n&&(n.clear(),null!=e&&null!==(i=e.features)&&void 0!==i&&i.length&&n.addFeatures(c_(e,s.idStrategy)))}_registerPatterns(){var e=arguments,i=this;return t(function*(){var t,s=e.length>0&&void 0!==e[0]?e[0]:a.topLevelDatasets(),n=[];s.forEach(t=>i._forEachLeafDataset(t,t=>{t.hasPattern&&n.push(t.style)}));var r=null===(t=a.mapStyle)||void 0===t?void 0:t.id;yield Qf(n,r,i._patternRegistry,i._pixelRatio)})()}_registerSymbols(){var e=arguments,i=this;return t(function*(){var t=e.length>0&&void 0!==e[0]?e[0]:a.topLevelDatasets(),s=[];t.forEach(t=>i._forEachLeafDataset(t,t=>{t.hasSymbol&&s.push(t.style)})),yield T(s,a.mapStyle,i._symbolRegistry,3)})()}_setLayerStyle(t){var e=this._layersById.get(t.id);if(e)try{e.setStyle(d_(t,this._styleContext)),t.hasSymbol&&e.set("symbolMeta",t.symbolMeta)}catch(e){h.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}}_forEachLeafDataset(t,e){t.hasSublayers?t.sublayers.forEach(t=>this._forEachLeafDataset(t,e)):e(t)}_getOrCreateSource(t){var e,{sourceId:i}=t;if(this._sourcesById.has(i))return this._sourcesById.get(i);try{e=u_(t)}catch(e){return h.warn('OpenLayers datasets adapter: failed to build a source for dataset "'.concat(t.id,'" — ').concat(e.message)),null}return e&&this._sourcesById.set(i,e),e}_addLayers(t){if(t.hasSublayers)return this._getOrCreateSource(t),void t.sublayers.forEach(t=>this._addLayers(t));if(t.leafLayerIds.length){var e=this._getOrCreateSource(t);if(e){var i;try{i=((t,e,i)=>{var s,n,r=e instanceof mc,o=new(r?Wc:zl)(s_({source:e,style:d_(t,i),opacity:t.opacity,visible:"visible"===t.visibility,minZoom:(n=t.minZoom,void 0===n?void 0:n-o_),maxZoom:(s=t.maxZoom,void 0===s?void 0:s-o_),zIndex:t.hasSymbol?1:0},r?{renderMode:"vector"}:{}));return o.set("layerType",r?"vectorTile":"vector"),o.set("layerId",t.id),t.filter&&o.set("filter",t.filter),t.hasSymbol&&o.set("symbolMeta",t.symbolMeta),o})(t,e,this._styleContext)}catch(e){return void h.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}this._map.addLayer(i),this._layersById.set(t.id,i)}}}}export{g_ as default};
|